// Copyright © 2015 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System;
using System.Collections.Generic;
namespace CefSharp
{
///
/// CefSharp interface for CefBrowser.
///
public interface IBrowser : IDisposable
{
///
/// Returns the browser host object. This method can only be called in the browser process.
///
/// the browser host object
IBrowserHost GetHost();
///
/// Returns true if the browser can navigate backwards.
///
bool CanGoBack { get; }
///
/// Navigate backwards.
///
void GoBack();
///
/// Returns true if the browser can navigate forwards.
///
bool CanGoForward { get; }
///
/// Navigate forwards.
///
void GoForward();
///
/// Returns true if the browser is currently loading.
///
bool IsLoading { get; }
///
/// Request that the browser close. The JavaScript 'onbeforeunload' event will be fired.
///
///
/// If forceClose is false the event handler, if any, will be allowed to prompt the user and the
/// user can optionally cancel the close. If forceClose is true the prompt will not be displayed
/// and the close will proceed. Results in a call to if
/// the event handler allows the close or if forceClose is true
/// See documentation for additional usage information.
///
void CloseBrowser(bool forceClose);
///
/// Reload the current page.
///
///
/// true a reload is performed ignoring browser cache; false a reload is
/// performed using files from the browser cache, if available.
///
void Reload(bool ignoreCache = false);
///
/// Stop loading the page.
///
void StopLoad();
///
/// Returns the globally unique identifier for this browser.
///
int Identifier { get; }
///
/// Returns true if this object is pointing to the same handle as that object.
///
/// compare browser instances
/// returns true if the same instance
bool IsSame(IBrowser that);
///
/// Returns true if the window is a popup window.
///
bool IsPopup { get; }
///
/// Returns true if a document has been loaded in the browser.
///
bool HasDocument { get; }
///
/// Returns the main (top-level) frame for the browser window.
///
IFrame MainFrame { get; }
///
/// Returns the focused frame for the browser window.
///
IFrame FocusedFrame { get; }
///
/// Returns the frame with the specified identifier, or NULL if not found.
///
/// identifier
/// frame or null
IFrame GetFrame(Int64 identifier);
///
/// Returns the frame with the specified name, or NULL if not found.
///
/// name of frame
/// frame or null
IFrame GetFrame(string name);
///
/// Returns the number of frames that currently exist.
///
/// the number of frames
int GetFrameCount();
///
/// Returns the identifiers of all existing frames.
///
/// list of frame identifiers
List GetFrameIdentifiers();
///
/// Returns the names of all existing frames.
///
/// frame names
List GetFrameNames();
///
/// Gets a value indicating whether the browser has been disposed of.
///
bool IsDisposed { get; }
//
// Send a message to the specified |target_process|. Returns true if the
// message was sent successfully.
//
/*--cef()--*/
//virtual bool SendProcessMessage(CefProcessId target_process,
// CefRefPtr message) =0;
}
}