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:
@ -15,6 +15,7 @@
|
||||
#include "libcef_dll/cpptoc/drag_data_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/request_context_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/client_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/download_image_callback_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/navigation_entry_visitor_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/pdf_print_callback_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/run_file_dialog_callback_ctocpp.h"
|
||||
@ -130,6 +131,21 @@ void CEF_CALLBACK browser_host_close_browser(struct _cef_browser_host_t* self,
|
||||
force_close?true:false);
|
||||
}
|
||||
|
||||
int CEF_CALLBACK browser_host_try_close_browser(
|
||||
struct _cef_browser_host_t* self) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return 0;
|
||||
|
||||
// Execute
|
||||
bool _retval = CefBrowserHostCppToC::Get(self)->TryCloseBrowser();
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
void CEF_CALLBACK browser_host_set_focus(struct _cef_browser_host_t* self,
|
||||
int focus) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
@ -188,6 +204,20 @@ cef_window_handle_t CEF_CALLBACK browser_host_get_opener_window_handle(
|
||||
return _retval;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK browser_host_has_view(struct _cef_browser_host_t* self) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return 0;
|
||||
|
||||
// Execute
|
||||
bool _retval = CefBrowserHostCppToC::Get(self)->HasView();
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
struct _cef_client_t* CEF_CALLBACK browser_host_get_client(
|
||||
struct _cef_browser_host_t* self) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
@ -297,6 +327,32 @@ void CEF_CALLBACK browser_host_start_download(struct _cef_browser_host_t* self,
|
||||
CefString(url));
|
||||
}
|
||||
|
||||
void CEF_CALLBACK browser_host_download_image(struct _cef_browser_host_t* self,
|
||||
const cef_string_t* image_url, int is_favicon, uint32 max_image_size,
|
||||
int bypass_cache, cef_download_image_callback_t* callback) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: image_url; type: string_byref_const
|
||||
DCHECK(image_url);
|
||||
if (!image_url)
|
||||
return;
|
||||
// Verify param: callback; type: refptr_diff
|
||||
DCHECK(callback);
|
||||
if (!callback)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefBrowserHostCppToC::Get(self)->DownloadImage(
|
||||
CefString(image_url),
|
||||
is_favicon?true:false,
|
||||
max_image_size,
|
||||
bypass_cache?true:false,
|
||||
CefDownloadImageCallbackCToCpp::Wrap(callback));
|
||||
}
|
||||
|
||||
void CEF_CALLBACK browser_host_print(struct _cef_browser_host_t* self) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
@ -901,16 +957,19 @@ void CEF_CALLBACK browser_host_drag_source_system_drag_ended(
|
||||
CefBrowserHostCppToC::CefBrowserHostCppToC() {
|
||||
GetStruct()->get_browser = browser_host_get_browser;
|
||||
GetStruct()->close_browser = browser_host_close_browser;
|
||||
GetStruct()->try_close_browser = browser_host_try_close_browser;
|
||||
GetStruct()->set_focus = browser_host_set_focus;
|
||||
GetStruct()->set_window_visibility = browser_host_set_window_visibility;
|
||||
GetStruct()->get_window_handle = browser_host_get_window_handle;
|
||||
GetStruct()->get_opener_window_handle = browser_host_get_opener_window_handle;
|
||||
GetStruct()->has_view = browser_host_has_view;
|
||||
GetStruct()->get_client = browser_host_get_client;
|
||||
GetStruct()->get_request_context = browser_host_get_request_context;
|
||||
GetStruct()->get_zoom_level = browser_host_get_zoom_level;
|
||||
GetStruct()->set_zoom_level = browser_host_set_zoom_level;
|
||||
GetStruct()->run_file_dialog = browser_host_run_file_dialog;
|
||||
GetStruct()->start_download = browser_host_start_download;
|
||||
GetStruct()->download_image = browser_host_download_image;
|
||||
GetStruct()->print = browser_host_print;
|
||||
GetStruct()->print_to_pdf = browser_host_print_to_pdf;
|
||||
GetStruct()->find = browser_host_find;
|
||||
|
Reference in New Issue
Block a user