mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Implement Views framework on Windows and Linux (issue #1749).
- Add Views header files in a new include/views directory. - Add initial top-level window (CefWindow), control (CefBrowserView, CefLabelButton, CefMenuButton, CefPanel, CefScrollView, CefTextfield) and layout (CefBoxLayout, CefFlowLayout) support. See libcef/browser/views/view_impl.h comments for implementation details. - Add Views example usage in cefclient and cefsimple and Views unit tests in cef_unittests. Pass the `--use-views` command-line flag to cefclient, cefsimple and cef_unittests to run using the Views framework instead of platform APIs. For cefclient and cefsimple this will create the browser window and all related functionality using the Views framework. For cef_unittests this will run all tests (except OSR tests) in a Views-based browser window. Views- specific unit tests (`--gtest_filter=Views*`) will be run even if the the `--use-views` flag is not specified. - Pass the `--hide-frame` command-line flag to cefclient to demo a frameless Views-based browser window. - Pass the `--hide-controls` command-line flag to cefclient to demo a browser window without top controls. This also works in non-Views mode. - Pass the `--enable-high-dpi-support` command-line flag to cef_unittests on Windows to test high-DPI support on a display that supports it. - Add CefImage for reading/writing image file formats. - Add CefBrowser::DownloadImage() for downloading image URLs as a CefImage representation. This is primarily for loading favicons. - Add CefMenuModel::CreateMenuModel() and CefMenuModelDelegate for creating custom menus. This is primarily for use with CefMenuButton. - Add CefBrowser::TryCloseBrowser() helper for closing a browser. Also improve related documentation in cef_life_span_handler.h. - Rename cef_page_range_t to cef_range_t. It is now also used by CefTextfield. - Remove CefLifeSpanHandler::RunModal() which is never called. - Add draggable regions example to cefclient.
This commit is contained in:
@@ -41,6 +41,7 @@
|
||||
#include "include/cef_base.h"
|
||||
#include "include/cef_drag_data.h"
|
||||
#include "include/cef_frame.h"
|
||||
#include "include/cef_image.h"
|
||||
#include "include/cef_navigation_entry.h"
|
||||
#include "include/cef_process_message.h"
|
||||
#include "include/cef_request_context.h"
|
||||
@@ -251,6 +252,27 @@ class CefPdfPrintCallback : public virtual CefBase {
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
// Callback interface for CefBrowserHost::DownloadImage. The methods of this
|
||||
// class will be called on the browser process UI thread.
|
||||
///
|
||||
/*--cef(source=client)--*/
|
||||
class CefDownloadImageCallback : public virtual CefBase {
|
||||
public:
|
||||
///
|
||||
// Method that will be executed when the image download has completed.
|
||||
// |image_url| is the URL that was downloaded and |http_status_code| is the
|
||||
// resulting HTTP status code. |image| is the resulting image, possibly at
|
||||
// multiple scale factors, or empty if the download failed.
|
||||
///
|
||||
/*--cef(optional_param=image)--*/
|
||||
virtual void OnDownloadImageFinished(
|
||||
const CefString& image_url,
|
||||
int http_status_code,
|
||||
CefRefPtr<CefImage> image) =0;
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
// Class used to represent the browser process aspects of a browser window. The
|
||||
// methods of this class can only be called in the browser process. They may be
|
||||
@@ -314,6 +336,17 @@ class CefBrowserHost : public virtual CefBase {
|
||||
/*--cef()--*/
|
||||
virtual void CloseBrowser(bool force_close) =0;
|
||||
|
||||
///
|
||||
// Helper for closing a browser. Call this method from the top-level window
|
||||
// close handler. Internally this calls CloseBrowser(false) if the close has
|
||||
// not yet been initiated. This method returns false while the close is
|
||||
// pending and true after the close has completed. See CloseBrowser() and
|
||||
// CefLifeSpanHandler::DoClose() documentation for additional usage
|
||||
// information. This method must be called on the browser process UI thread.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool TryCloseBrowser() =0;
|
||||
|
||||
///
|
||||
// Set whether the browser is focused.
|
||||
///
|
||||
@@ -328,19 +361,28 @@ class CefBrowserHost : public virtual CefBase {
|
||||
virtual void SetWindowVisibility(bool visible) =0;
|
||||
|
||||
///
|
||||
// Retrieve the window handle for this browser.
|
||||
// Retrieve the window handle for this browser. If this browser is wrapped in
|
||||
// a CefBrowserView this method should be called on the browser process UI
|
||||
// thread and it will return the handle for the top-level native window.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefWindowHandle GetWindowHandle() =0;
|
||||
|
||||
///
|
||||
// Retrieve the window handle of the browser that opened this browser. Will
|
||||
// return NULL for non-popup windows. This method can be used in combination
|
||||
// with custom handling of modal windows.
|
||||
// return NULL for non-popup windows or if this browser is wrapped in a
|
||||
// CefBrowserView. This method can be used in combination with custom handling
|
||||
// of modal windows.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefWindowHandle GetOpenerWindowHandle() =0;
|
||||
|
||||
///
|
||||
// Returns true if this browser is wrapped in a CefBrowserView.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool HasView() =0;
|
||||
|
||||
///
|
||||
// Returns the client for this browser.
|
||||
///
|
||||
@@ -400,6 +442,25 @@ class CefBrowserHost : public virtual CefBase {
|
||||
/*--cef()--*/
|
||||
virtual void StartDownload(const CefString& url) =0;
|
||||
|
||||
///
|
||||
// Download |image_url| and execute |callback| on completion with the images
|
||||
// received from the renderer. If |is_favicon| is true then cookies are not
|
||||
// sent and not accepted during download. Images with density independent
|
||||
// pixel (DIP) sizes larger than |max_image_size| are filtered out from the
|
||||
// image results. Versions of the image at different scale factors may be
|
||||
// downloaded up to the maximum scale factor supported by the system. If there
|
||||
// are no image results <= |max_image_size| then the smallest image is resized
|
||||
// to |max_image_size| and is the only result. A |max_image_size| of 0 means
|
||||
// unlimited. If |bypass_cache| is true then |image_url| is requested from the
|
||||
// server even if it is present in the browser cache.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void DownloadImage(const CefString& image_url,
|
||||
bool is_favicon,
|
||||
uint32 max_image_size,
|
||||
bool bypass_cache,
|
||||
CefRefPtr<CefDownloadImageCallback> callback) =0;
|
||||
|
||||
///
|
||||
// Print the current browser contents.
|
||||
///
|
||||
@@ -437,7 +498,9 @@ class CefBrowserHost : public virtual CefBase {
|
||||
|
||||
///
|
||||
// Open developer tools in its own window. If |inspect_element_at| is non-
|
||||
// empty the element at the specified (x,y) location will be inspected.
|
||||
// empty the element at the specified (x,y) location will be inspected. The
|
||||
// |windowInfo| parameter will be ignored if this browser is wrapped in a
|
||||
// CefBrowserView.
|
||||
///
|
||||
/*--cef(optional_param=inspect_element_at)--*/
|
||||
virtual void ShowDevTools(const CefWindowInfo& windowInfo,
|
||||
|
Reference in New Issue
Block a user