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:
Marshall Greenblatt
2016-01-19 15:09:01 -05:00
parent 84fe790035
commit 06e73fff15
333 changed files with 46716 additions and 656 deletions

116
cef.gyp
View File

@ -365,6 +365,7 @@
'sources': [ 'sources': [
'tests/cefclient/browser/client_app_browser.cc', 'tests/cefclient/browser/client_app_browser.cc',
'tests/cefclient/browser/client_app_browser.h', 'tests/cefclient/browser/client_app_browser.h',
'tests/cefclient/browser/resource_util.cc',
'tests/cefclient/browser/resource_util.h', 'tests/cefclient/browser/resource_util.h',
'tests/cefclient/common/client_app.cc', 'tests/cefclient/common/client_app.cc',
'tests/cefclient/common/client_app.h', 'tests/cefclient/common/client_app.h',
@ -377,6 +378,8 @@
'tests/cefclient/resources/osr_test.html', 'tests/cefclient/resources/osr_test.html',
'tests/cefclient/resources/pdf.html', 'tests/cefclient/resources/pdf.html',
'tests/cefclient/resources/pdf.pdf', 'tests/cefclient/resources/pdf.pdf',
'tests/cefclient/resources/window_icon.1x.png',
'tests/cefclient/resources/window_icon.1x.png',
'tests/unittests/browser_info_map_unittest.cc', 'tests/unittests/browser_info_map_unittest.cc',
'tests/unittests/command_line_unittest.cc', 'tests/unittests/command_line_unittest.cc',
'tests/unittests/cookie_unittest.cc', 'tests/unittests/cookie_unittest.cc',
@ -387,6 +390,9 @@
'tests/unittests/draggable_regions_unittest.cc', 'tests/unittests/draggable_regions_unittest.cc',
'tests/unittests/frame_unittest.cc', 'tests/unittests/frame_unittest.cc',
'tests/unittests/geolocation_unittest.cc', 'tests/unittests/geolocation_unittest.cc',
'tests/unittests/image_unittest.cc',
'tests/unittests/image_util.cc',
'tests/unittests/image_util.h',
'tests/unittests/jsdialog_unittest.cc', 'tests/unittests/jsdialog_unittest.cc',
'tests/unittests/life_span_unittest.cc', 'tests/unittests/life_span_unittest.cc',
'tests/unittests/message_router_unittest.cc', 'tests/unittests/message_router_unittest.cc',
@ -416,6 +422,8 @@
'tests/unittests/test_suite.h', 'tests/unittests/test_suite.h',
'tests/unittests/test_util.cc', 'tests/unittests/test_util.cc',
'tests/unittests/test_util.h', 'tests/unittests/test_util.h',
'tests/unittests/thread_helper.cc',
'tests/unittests/thread_helper.h',
'tests/unittests/tracing_unittest.cc', 'tests/unittests/tracing_unittest.cc',
'tests/unittests/translator_unittest.cc', 'tests/unittests/translator_unittest.cc',
'tests/unittests/urlrequest_unittest.cc', 'tests/unittests/urlrequest_unittest.cc',
@ -429,6 +437,8 @@
'tests/cefclient/resources/osr_test.html', 'tests/cefclient/resources/osr_test.html',
'tests/cefclient/resources/pdf.html', 'tests/cefclient/resources/pdf.html',
'tests/cefclient/resources/pdf.pdf', 'tests/cefclient/resources/pdf.pdf',
'tests/cefclient/resources/window_icon.1x.png',
'tests/cefclient/resources/window_icon.2x.png',
'tests/unittests/mac/unittests.icns', 'tests/unittests/mac/unittests.icns',
'tests/unittests/mac/English.lproj/InfoPlist.strings', 'tests/unittests/mac/English.lproj/InfoPlist.strings',
'tests/unittests/mac/English.lproj/MainMenu.xib', 'tests/unittests/mac/English.lproj/MainMenu.xib',
@ -553,6 +563,8 @@
'tests/cefclient/resources/osr_test.html', 'tests/cefclient/resources/osr_test.html',
'tests/cefclient/resources/pdf.html', 'tests/cefclient/resources/pdf.html',
'tests/cefclient/resources/pdf.pdf', 'tests/cefclient/resources/pdf.pdf',
'tests/cefclient/resources/window_icon.1x.png',
'tests/cefclient/resources/window_icon.2x.png',
], ],
}, },
], ],
@ -561,6 +573,17 @@
'-Wl,--detect-odr-violations', '-Wl,--detect-odr-violations',
], ],
}], }],
['use_aura==1', {
'sources': [
'tests/unittests/views/button_unittest.cc',
'tests/unittests/views/panel_unittest.cc',
'tests/unittests/views/scroll_view_unittest.cc',
'tests/unittests/views/test_window_delegate.cc',
'tests/unittests/views/test_window_delegate.h',
'tests/unittests/views/textfield_unittest.cc',
'tests/unittests/views/window_unittest.cc',
],
}],
], ],
}, },
{ {
@ -1022,6 +1045,8 @@
'libcef/browser/browser_platform_delegate_create.cc', 'libcef/browser/browser_platform_delegate_create.cc',
'libcef/browser/browser_urlrequest_impl.cc', 'libcef/browser/browser_urlrequest_impl.cc',
'libcef/browser/browser_urlrequest_impl.h', 'libcef/browser/browser_urlrequest_impl.h',
'libcef/browser/browser_util.cc',
'libcef/browser/browser_util.h',
'libcef/browser/chrome_browser_process_stub.cc', 'libcef/browser/chrome_browser_process_stub.cc',
'libcef/browser/chrome_browser_process_stub.h', 'libcef/browser/chrome_browser_process_stub.h',
'libcef/browser/chrome_profile_stub.cc', 'libcef/browser/chrome_profile_stub.cc',
@ -1078,6 +1103,8 @@
'libcef/browser/frame_host_impl.cc', 'libcef/browser/frame_host_impl.cc',
'libcef/browser/frame_host_impl.h', 'libcef/browser/frame_host_impl.h',
'libcef/browser/geolocation_impl.cc', 'libcef/browser/geolocation_impl.cc',
'libcef/browser/image_impl.cc',
'libcef/browser/image_impl.h',
'libcef/browser/javascript_dialog_runner.h', 'libcef/browser/javascript_dialog_runner.h',
'libcef/browser/javascript_dialog_manager.cc', 'libcef/browser/javascript_dialog_manager.cc',
'libcef/browser/javascript_dialog_manager.h', 'libcef/browser/javascript_dialog_manager.h',
@ -1560,10 +1587,96 @@
'sources': [ 'sources': [
'libcef/browser/native/window_delegate_view.cc', 'libcef/browser/native/window_delegate_view.cc',
'libcef/browser/native/window_delegate_view.h', 'libcef/browser/native/window_delegate_view.h',
'libcef/browser/views/basic_label_button_impl.cc',
'libcef/browser/views/basic_label_button_impl.h',
'libcef/browser/views/basic_label_button_view.cc',
'libcef/browser/views/basic_label_button_view.h',
'libcef/browser/views/basic_panel_impl.cc',
'libcef/browser/views/basic_panel_impl.h',
'libcef/browser/views/basic_panel_view.cc',
'libcef/browser/views/basic_panel_view.h',
'libcef/browser/views/box_layout_impl.cc',
'libcef/browser/views/box_layout_impl.h',
'libcef/browser/views/browser_platform_delegate_views.cc',
'libcef/browser/views/browser_platform_delegate_views.h',
'libcef/browser/views/browser_view_impl.cc',
'libcef/browser/views/browser_view_impl.h',
'libcef/browser/views/browser_view_view.cc',
'libcef/browser/views/browser_view_view.h',
'libcef/browser/views/button_impl.h',
'libcef/browser/views/button_view.h',
'libcef/browser/views/display_impl.cc',
'libcef/browser/views/display_impl.h',
'libcef/browser/views/fill_layout_impl.cc',
'libcef/browser/views/fill_layout_impl.h',
'libcef/browser/views/label_button_impl.h',
'libcef/browser/views/label_button_view.h',
'libcef/browser/views/layout_impl.h',
'libcef/browser/views/layout_adapter.cc',
'libcef/browser/views/layout_adapter.h',
'libcef/browser/views/layout_util.cc',
'libcef/browser/views/layout_util.h',
'libcef/browser/views/menu_button_impl.cc',
'libcef/browser/views/menu_button_impl.h',
'libcef/browser/views/menu_button_view.cc',
'libcef/browser/views/menu_button_view.h',
'libcef/browser/views/menu_runner_views.cc',
'libcef/browser/views/menu_runner_views.h',
'libcef/browser/views/panel_impl.h',
'libcef/browser/views/panel_view.h',
'libcef/browser/views/scroll_view_impl.cc',
'libcef/browser/views/scroll_view_impl.h',
'libcef/browser/views/scroll_view_view.cc',
'libcef/browser/views/scroll_view_view.h',
'libcef/browser/views/textfield_impl.cc',
'libcef/browser/views/textfield_impl.h',
'libcef/browser/views/textfield_view.cc',
'libcef/browser/views/textfield_view.h',
'libcef/browser/views/view_adapter.cc',
'libcef/browser/views/view_adapter.h',
'libcef/browser/views/view_impl.h',
'libcef/browser/views/view_util.cc',
'libcef/browser/views/view_util.h',
'libcef/browser/views/view_view.h',
'libcef/browser/views/window_impl.cc',
'libcef/browser/views/window_impl.h',
'libcef/browser/views/window_view.cc',
'libcef/browser/views/window_view.h',
'<(DEPTH)/ui/views/test/desktop_test_views_delegate.h', '<(DEPTH)/ui/views/test/desktop_test_views_delegate.h',
'<(DEPTH)/ui/views/test/desktop_test_views_delegate_aura.cc', '<(DEPTH)/ui/views/test/desktop_test_views_delegate_aura.cc',
'<(DEPTH)/ui/views/test/test_views_delegate.h', '<(DEPTH)/ui/views/test/test_views_delegate.h',
'<(DEPTH)/ui/views/test/test_views_delegate_aura.cc', '<(DEPTH)/ui/views/test/test_views_delegate_aura.cc',
# Support for UI input events.
'<(DEPTH)/ui/base/test/ui_controls.h',
'<(DEPTH)/ui/base/test/ui_controls_aura.cc',
'<(DEPTH)/ui/aura/test/ui_controls_factory_aura.h',
],
}, { # use_aura!=1
'sources': [
# Provides stub implementations for the views static methods.
'libcef_dll/views_stub.cc',
],
}],
['use_aura==1 and OS=="win"', {
'sources': [
# Support for UI input events.
'<(DEPTH)/ui/aura/test/ui_controls_factory_aurawin.cc',
'<(DEPTH)/ui/base/test/ui_controls_internal_win.cc',
'<(DEPTH)/ui/base/test/ui_controls_internal_win.h',
],
}],
['use_aura==1 and (OS=="linux" or OS=="freebsd" or OS=="openbsd")', {
'sources': [
# Support for UI input events.
'<(DEPTH)/ui/aura/test/aura_test_utils.cc',
'<(DEPTH)/ui/aura/test/aura_test_utils.h',
'<(DEPTH)/ui/aura/test/ui_controls_factory_aurax11.cc',
'<(DEPTH)/ui/aura/test/x11_event_sender.cc',
'<(DEPTH)/ui/aura/test/x11_event_sender.h',
'<(DEPTH)/ui/events/test/platform_event_waiter.cc',
'<(DEPTH)/ui/events/test/platform_event_waiter.h',
'<(DEPTH)/ui/views/test/ui_controls_factory_desktop_aurax11.cc',
'<(DEPTH)/ui/views/test/ui_controls_factory_desktop_aurax11.h',
], ],
}], }],
], ],
@ -1825,6 +1938,7 @@
'sources': [ 'sources': [
'tests/cefclient/browser/client_app_browser.cc', 'tests/cefclient/browser/client_app_browser.cc',
'tests/cefclient/browser/client_app_browser.h', 'tests/cefclient/browser/client_app_browser.h',
'tests/cefclient/browser/resource_util.cc',
'tests/cefclient/browser/resource_util.h', 'tests/cefclient/browser/resource_util.h',
'tests/cefclient/browser/resource_util_mac.mm', 'tests/cefclient/browser/resource_util_mac.mm',
'tests/cefclient/browser/resource_util_posix.cc', 'tests/cefclient/browser/resource_util_posix.cc',
@ -1858,6 +1972,8 @@
'tests/unittests/test_suite.h', 'tests/unittests/test_suite.h',
'tests/unittests/test_util.cc', 'tests/unittests/test_util.cc',
'tests/unittests/test_util.h', 'tests/unittests/test_util.h',
'tests/unittests/thread_helper.cc',
'tests/unittests/thread_helper.h',
'tests/unittests/tracing_unittest.cc', 'tests/unittests/tracing_unittest.cc',
'tests/unittests/v8_unittest.cc', 'tests/unittests/v8_unittest.cc',
], ],

View File

@ -33,11 +33,13 @@
'include/cef_frame.h', 'include/cef_frame.h',
'include/cef_geolocation.h', 'include/cef_geolocation.h',
'include/cef_geolocation_handler.h', 'include/cef_geolocation_handler.h',
'include/cef_image.h',
'include/cef_jsdialog_handler.h', 'include/cef_jsdialog_handler.h',
'include/cef_keyboard_handler.h', 'include/cef_keyboard_handler.h',
'include/cef_life_span_handler.h', 'include/cef_life_span_handler.h',
'include/cef_load_handler.h', 'include/cef_load_handler.h',
'include/cef_menu_model.h', 'include/cef_menu_model.h',
'include/cef_menu_model_delegate.h',
'include/cef_navigation_entry.h', 'include/cef_navigation_entry.h',
'include/cef_origin_whitelist.h', 'include/cef_origin_whitelist.h',
'include/cef_parser.h', 'include/cef_parser.h',
@ -70,6 +72,26 @@
'include/cef_xml_reader.h', 'include/cef_xml_reader.h',
'include/cef_zip_reader.h', 'include/cef_zip_reader.h',
'include/test/cef_translator_test.h', 'include/test/cef_translator_test.h',
'include/views/cef_box_layout.h',
'include/views/cef_browser_view.h',
'include/views/cef_browser_view_delegate.h',
'include/views/cef_button.h',
'include/views/cef_button_delegate.h',
'include/views/cef_display.h',
'include/views/cef_fill_layout.h',
'include/views/cef_label_button.h',
'include/views/cef_layout.h',
'include/views/cef_menu_button.h',
'include/views/cef_menu_button_delegate.h',
'include/views/cef_panel.h',
'include/views/cef_panel_delegate.h',
'include/views/cef_scroll_view.h',
'include/views/cef_textfield.h',
'include/views/cef_textfield_delegate.h',
'include/views/cef_view.h',
'include/views/cef_view_delegate.h',
'include/views/cef_window.h',
'include/views/cef_window_delegate.h',
], ],
'autogen_capi_includes': [ 'autogen_capi_includes': [
'include/capi/cef_app_capi.h', 'include/capi/cef_app_capi.h',
@ -93,11 +115,13 @@
'include/capi/cef_frame_capi.h', 'include/capi/cef_frame_capi.h',
'include/capi/cef_geolocation_capi.h', 'include/capi/cef_geolocation_capi.h',
'include/capi/cef_geolocation_handler_capi.h', 'include/capi/cef_geolocation_handler_capi.h',
'include/capi/cef_image_capi.h',
'include/capi/cef_jsdialog_handler_capi.h', 'include/capi/cef_jsdialog_handler_capi.h',
'include/capi/cef_keyboard_handler_capi.h', 'include/capi/cef_keyboard_handler_capi.h',
'include/capi/cef_life_span_handler_capi.h', 'include/capi/cef_life_span_handler_capi.h',
'include/capi/cef_load_handler_capi.h', 'include/capi/cef_load_handler_capi.h',
'include/capi/cef_menu_model_capi.h', 'include/capi/cef_menu_model_capi.h',
'include/capi/cef_menu_model_delegate_capi.h',
'include/capi/cef_navigation_entry_capi.h', 'include/capi/cef_navigation_entry_capi.h',
'include/capi/cef_origin_whitelist_capi.h', 'include/capi/cef_origin_whitelist_capi.h',
'include/capi/cef_parser_capi.h', 'include/capi/cef_parser_capi.h',
@ -130,6 +154,26 @@
'include/capi/cef_xml_reader_capi.h', 'include/capi/cef_xml_reader_capi.h',
'include/capi/cef_zip_reader_capi.h', 'include/capi/cef_zip_reader_capi.h',
'include/capi/test/cef_translator_test_capi.h', 'include/capi/test/cef_translator_test_capi.h',
'include/capi/views/cef_box_layout_capi.h',
'include/capi/views/cef_browser_view_capi.h',
'include/capi/views/cef_browser_view_delegate_capi.h',
'include/capi/views/cef_button_capi.h',
'include/capi/views/cef_button_delegate_capi.h',
'include/capi/views/cef_display_capi.h',
'include/capi/views/cef_fill_layout_capi.h',
'include/capi/views/cef_label_button_capi.h',
'include/capi/views/cef_layout_capi.h',
'include/capi/views/cef_menu_button_capi.h',
'include/capi/views/cef_menu_button_delegate_capi.h',
'include/capi/views/cef_panel_capi.h',
'include/capi/views/cef_panel_delegate_capi.h',
'include/capi/views/cef_scroll_view_capi.h',
'include/capi/views/cef_textfield_capi.h',
'include/capi/views/cef_textfield_delegate_capi.h',
'include/capi/views/cef_view_capi.h',
'include/capi/views/cef_view_delegate_capi.h',
'include/capi/views/cef_window_capi.h',
'include/capi/views/cef_window_delegate_capi.h',
], ],
'autogen_library_side': [ 'autogen_library_side': [
'libcef_dll/ctocpp/app_ctocpp.cc', 'libcef_dll/ctocpp/app_ctocpp.cc',
@ -140,12 +184,22 @@
'libcef_dll/cpptoc/before_download_callback_cpptoc.h', 'libcef_dll/cpptoc/before_download_callback_cpptoc.h',
'libcef_dll/cpptoc/binary_value_cpptoc.cc', 'libcef_dll/cpptoc/binary_value_cpptoc.cc',
'libcef_dll/cpptoc/binary_value_cpptoc.h', 'libcef_dll/cpptoc/binary_value_cpptoc.h',
'libcef_dll/cpptoc/views/box_layout_cpptoc.cc',
'libcef_dll/cpptoc/views/box_layout_cpptoc.h',
'libcef_dll/cpptoc/browser_cpptoc.cc', 'libcef_dll/cpptoc/browser_cpptoc.cc',
'libcef_dll/cpptoc/browser_cpptoc.h', 'libcef_dll/cpptoc/browser_cpptoc.h',
'libcef_dll/cpptoc/browser_host_cpptoc.cc', 'libcef_dll/cpptoc/browser_host_cpptoc.cc',
'libcef_dll/cpptoc/browser_host_cpptoc.h', 'libcef_dll/cpptoc/browser_host_cpptoc.h',
'libcef_dll/ctocpp/browser_process_handler_ctocpp.cc', 'libcef_dll/ctocpp/browser_process_handler_ctocpp.cc',
'libcef_dll/ctocpp/browser_process_handler_ctocpp.h', 'libcef_dll/ctocpp/browser_process_handler_ctocpp.h',
'libcef_dll/cpptoc/views/browser_view_cpptoc.cc',
'libcef_dll/cpptoc/views/browser_view_cpptoc.h',
'libcef_dll/ctocpp/views/browser_view_delegate_ctocpp.cc',
'libcef_dll/ctocpp/views/browser_view_delegate_ctocpp.h',
'libcef_dll/cpptoc/views/button_cpptoc.cc',
'libcef_dll/cpptoc/views/button_cpptoc.h',
'libcef_dll/ctocpp/views/button_delegate_ctocpp.cc',
'libcef_dll/ctocpp/views/button_delegate_ctocpp.h',
'libcef_dll/cpptoc/callback_cpptoc.cc', 'libcef_dll/cpptoc/callback_cpptoc.cc',
'libcef_dll/cpptoc/callback_cpptoc.h', 'libcef_dll/cpptoc/callback_cpptoc.h',
'libcef_dll/ctocpp/client_ctocpp.cc', 'libcef_dll/ctocpp/client_ctocpp.cc',
@ -174,10 +228,14 @@
'libcef_dll/ctocpp/dialog_handler_ctocpp.h', 'libcef_dll/ctocpp/dialog_handler_ctocpp.h',
'libcef_dll/cpptoc/dictionary_value_cpptoc.cc', 'libcef_dll/cpptoc/dictionary_value_cpptoc.cc',
'libcef_dll/cpptoc/dictionary_value_cpptoc.h', 'libcef_dll/cpptoc/dictionary_value_cpptoc.h',
'libcef_dll/cpptoc/views/display_cpptoc.cc',
'libcef_dll/cpptoc/views/display_cpptoc.h',
'libcef_dll/ctocpp/display_handler_ctocpp.cc', 'libcef_dll/ctocpp/display_handler_ctocpp.cc',
'libcef_dll/ctocpp/display_handler_ctocpp.h', 'libcef_dll/ctocpp/display_handler_ctocpp.h',
'libcef_dll/ctocpp/download_handler_ctocpp.cc', 'libcef_dll/ctocpp/download_handler_ctocpp.cc',
'libcef_dll/ctocpp/download_handler_ctocpp.h', 'libcef_dll/ctocpp/download_handler_ctocpp.h',
'libcef_dll/ctocpp/download_image_callback_ctocpp.cc',
'libcef_dll/ctocpp/download_image_callback_ctocpp.h',
'libcef_dll/cpptoc/download_item_cpptoc.cc', 'libcef_dll/cpptoc/download_item_cpptoc.cc',
'libcef_dll/cpptoc/download_item_cpptoc.h', 'libcef_dll/cpptoc/download_item_cpptoc.h',
'libcef_dll/cpptoc/download_item_callback_cpptoc.cc', 'libcef_dll/cpptoc/download_item_callback_cpptoc.cc',
@ -190,6 +248,8 @@
'libcef_dll/ctocpp/end_tracing_callback_ctocpp.h', 'libcef_dll/ctocpp/end_tracing_callback_ctocpp.h',
'libcef_dll/cpptoc/file_dialog_callback_cpptoc.cc', 'libcef_dll/cpptoc/file_dialog_callback_cpptoc.cc',
'libcef_dll/cpptoc/file_dialog_callback_cpptoc.h', 'libcef_dll/cpptoc/file_dialog_callback_cpptoc.h',
'libcef_dll/cpptoc/views/fill_layout_cpptoc.cc',
'libcef_dll/cpptoc/views/fill_layout_cpptoc.h',
'libcef_dll/ctocpp/find_handler_ctocpp.cc', 'libcef_dll/ctocpp/find_handler_ctocpp.cc',
'libcef_dll/ctocpp/find_handler_ctocpp.h', 'libcef_dll/ctocpp/find_handler_ctocpp.h',
'libcef_dll/ctocpp/focus_handler_ctocpp.cc', 'libcef_dll/ctocpp/focus_handler_ctocpp.cc',
@ -202,24 +262,40 @@
'libcef_dll/ctocpp/geolocation_handler_ctocpp.h', 'libcef_dll/ctocpp/geolocation_handler_ctocpp.h',
'libcef_dll/ctocpp/get_geolocation_callback_ctocpp.cc', 'libcef_dll/ctocpp/get_geolocation_callback_ctocpp.cc',
'libcef_dll/ctocpp/get_geolocation_callback_ctocpp.h', 'libcef_dll/ctocpp/get_geolocation_callback_ctocpp.h',
'libcef_dll/cpptoc/image_cpptoc.cc',
'libcef_dll/cpptoc/image_cpptoc.h',
'libcef_dll/cpptoc/jsdialog_callback_cpptoc.cc', 'libcef_dll/cpptoc/jsdialog_callback_cpptoc.cc',
'libcef_dll/cpptoc/jsdialog_callback_cpptoc.h', 'libcef_dll/cpptoc/jsdialog_callback_cpptoc.h',
'libcef_dll/ctocpp/jsdialog_handler_ctocpp.cc', 'libcef_dll/ctocpp/jsdialog_handler_ctocpp.cc',
'libcef_dll/ctocpp/jsdialog_handler_ctocpp.h', 'libcef_dll/ctocpp/jsdialog_handler_ctocpp.h',
'libcef_dll/ctocpp/keyboard_handler_ctocpp.cc', 'libcef_dll/ctocpp/keyboard_handler_ctocpp.cc',
'libcef_dll/ctocpp/keyboard_handler_ctocpp.h', 'libcef_dll/ctocpp/keyboard_handler_ctocpp.h',
'libcef_dll/cpptoc/views/label_button_cpptoc.cc',
'libcef_dll/cpptoc/views/label_button_cpptoc.h',
'libcef_dll/cpptoc/views/layout_cpptoc.cc',
'libcef_dll/cpptoc/views/layout_cpptoc.h',
'libcef_dll/ctocpp/life_span_handler_ctocpp.cc', 'libcef_dll/ctocpp/life_span_handler_ctocpp.cc',
'libcef_dll/ctocpp/life_span_handler_ctocpp.h', 'libcef_dll/ctocpp/life_span_handler_ctocpp.h',
'libcef_dll/cpptoc/list_value_cpptoc.cc', 'libcef_dll/cpptoc/list_value_cpptoc.cc',
'libcef_dll/cpptoc/list_value_cpptoc.h', 'libcef_dll/cpptoc/list_value_cpptoc.h',
'libcef_dll/ctocpp/load_handler_ctocpp.cc', 'libcef_dll/ctocpp/load_handler_ctocpp.cc',
'libcef_dll/ctocpp/load_handler_ctocpp.h', 'libcef_dll/ctocpp/load_handler_ctocpp.h',
'libcef_dll/cpptoc/views/menu_button_cpptoc.cc',
'libcef_dll/cpptoc/views/menu_button_cpptoc.h',
'libcef_dll/ctocpp/views/menu_button_delegate_ctocpp.cc',
'libcef_dll/ctocpp/views/menu_button_delegate_ctocpp.h',
'libcef_dll/cpptoc/menu_model_cpptoc.cc', 'libcef_dll/cpptoc/menu_model_cpptoc.cc',
'libcef_dll/cpptoc/menu_model_cpptoc.h', 'libcef_dll/cpptoc/menu_model_cpptoc.h',
'libcef_dll/ctocpp/menu_model_delegate_ctocpp.cc',
'libcef_dll/ctocpp/menu_model_delegate_ctocpp.h',
'libcef_dll/cpptoc/navigation_entry_cpptoc.cc', 'libcef_dll/cpptoc/navigation_entry_cpptoc.cc',
'libcef_dll/cpptoc/navigation_entry_cpptoc.h', 'libcef_dll/cpptoc/navigation_entry_cpptoc.h',
'libcef_dll/ctocpp/navigation_entry_visitor_ctocpp.cc', 'libcef_dll/ctocpp/navigation_entry_visitor_ctocpp.cc',
'libcef_dll/ctocpp/navigation_entry_visitor_ctocpp.h', 'libcef_dll/ctocpp/navigation_entry_visitor_ctocpp.h',
'libcef_dll/cpptoc/views/panel_cpptoc.cc',
'libcef_dll/cpptoc/views/panel_cpptoc.h',
'libcef_dll/ctocpp/views/panel_delegate_ctocpp.cc',
'libcef_dll/ctocpp/views/panel_delegate_ctocpp.h',
'libcef_dll/ctocpp/pdf_print_callback_ctocpp.cc', 'libcef_dll/ctocpp/pdf_print_callback_ctocpp.cc',
'libcef_dll/ctocpp/pdf_print_callback_ctocpp.h', 'libcef_dll/ctocpp/pdf_print_callback_ctocpp.h',
'libcef_dll/cpptoc/post_data_cpptoc.cc', 'libcef_dll/cpptoc/post_data_cpptoc.cc',
@ -276,6 +352,8 @@
'libcef_dll/ctocpp/scheme_handler_factory_ctocpp.h', 'libcef_dll/ctocpp/scheme_handler_factory_ctocpp.h',
'libcef_dll/cpptoc/scheme_registrar_cpptoc.cc', 'libcef_dll/cpptoc/scheme_registrar_cpptoc.cc',
'libcef_dll/cpptoc/scheme_registrar_cpptoc.h', 'libcef_dll/cpptoc/scheme_registrar_cpptoc.h',
'libcef_dll/cpptoc/views/scroll_view_cpptoc.cc',
'libcef_dll/cpptoc/views/scroll_view_cpptoc.h',
'libcef_dll/ctocpp/set_cookie_callback_ctocpp.cc', 'libcef_dll/ctocpp/set_cookie_callback_ctocpp.cc',
'libcef_dll/ctocpp/set_cookie_callback_ctocpp.h', 'libcef_dll/ctocpp/set_cookie_callback_ctocpp.h',
'libcef_dll/cpptoc/stream_reader_cpptoc.cc', 'libcef_dll/cpptoc/stream_reader_cpptoc.cc',
@ -288,6 +366,10 @@
'libcef_dll/ctocpp/task_ctocpp.h', 'libcef_dll/ctocpp/task_ctocpp.h',
'libcef_dll/cpptoc/task_runner_cpptoc.cc', 'libcef_dll/cpptoc/task_runner_cpptoc.cc',
'libcef_dll/cpptoc/task_runner_cpptoc.h', 'libcef_dll/cpptoc/task_runner_cpptoc.h',
'libcef_dll/cpptoc/views/textfield_cpptoc.cc',
'libcef_dll/cpptoc/views/textfield_cpptoc.h',
'libcef_dll/ctocpp/views/textfield_delegate_ctocpp.cc',
'libcef_dll/ctocpp/views/textfield_delegate_ctocpp.h',
'libcef_dll/cpptoc/test/translator_test_cpptoc.cc', 'libcef_dll/cpptoc/test/translator_test_cpptoc.cc',
'libcef_dll/cpptoc/test/translator_test_cpptoc.h', 'libcef_dll/cpptoc/test/translator_test_cpptoc.h',
'libcef_dll/ctocpp/test/translator_test_handler_ctocpp.cc', 'libcef_dll/ctocpp/test/translator_test_handler_ctocpp.cc',
@ -320,12 +402,20 @@
'libcef_dll/cpptoc/v8value_cpptoc.h', 'libcef_dll/cpptoc/v8value_cpptoc.h',
'libcef_dll/cpptoc/value_cpptoc.cc', 'libcef_dll/cpptoc/value_cpptoc.cc',
'libcef_dll/cpptoc/value_cpptoc.h', 'libcef_dll/cpptoc/value_cpptoc.h',
'libcef_dll/cpptoc/views/view_cpptoc.cc',
'libcef_dll/cpptoc/views/view_cpptoc.h',
'libcef_dll/ctocpp/views/view_delegate_ctocpp.cc',
'libcef_dll/ctocpp/views/view_delegate_ctocpp.h',
'libcef_dll/cpptoc/web_plugin_info_cpptoc.cc', 'libcef_dll/cpptoc/web_plugin_info_cpptoc.cc',
'libcef_dll/cpptoc/web_plugin_info_cpptoc.h', 'libcef_dll/cpptoc/web_plugin_info_cpptoc.h',
'libcef_dll/ctocpp/web_plugin_info_visitor_ctocpp.cc', 'libcef_dll/ctocpp/web_plugin_info_visitor_ctocpp.cc',
'libcef_dll/ctocpp/web_plugin_info_visitor_ctocpp.h', 'libcef_dll/ctocpp/web_plugin_info_visitor_ctocpp.h',
'libcef_dll/ctocpp/web_plugin_unstable_callback_ctocpp.cc', 'libcef_dll/ctocpp/web_plugin_unstable_callback_ctocpp.cc',
'libcef_dll/ctocpp/web_plugin_unstable_callback_ctocpp.h', 'libcef_dll/ctocpp/web_plugin_unstable_callback_ctocpp.h',
'libcef_dll/cpptoc/views/window_cpptoc.cc',
'libcef_dll/cpptoc/views/window_cpptoc.h',
'libcef_dll/ctocpp/views/window_delegate_ctocpp.cc',
'libcef_dll/ctocpp/views/window_delegate_ctocpp.h',
'libcef_dll/ctocpp/write_handler_ctocpp.cc', 'libcef_dll/ctocpp/write_handler_ctocpp.cc',
'libcef_dll/ctocpp/write_handler_ctocpp.h', 'libcef_dll/ctocpp/write_handler_ctocpp.h',
'libcef_dll/cpptoc/xml_reader_cpptoc.cc', 'libcef_dll/cpptoc/xml_reader_cpptoc.cc',
@ -342,12 +432,22 @@
'libcef_dll/ctocpp/before_download_callback_ctocpp.h', 'libcef_dll/ctocpp/before_download_callback_ctocpp.h',
'libcef_dll/ctocpp/binary_value_ctocpp.cc', 'libcef_dll/ctocpp/binary_value_ctocpp.cc',
'libcef_dll/ctocpp/binary_value_ctocpp.h', 'libcef_dll/ctocpp/binary_value_ctocpp.h',
'libcef_dll/ctocpp/views/box_layout_ctocpp.cc',
'libcef_dll/ctocpp/views/box_layout_ctocpp.h',
'libcef_dll/ctocpp/browser_ctocpp.cc', 'libcef_dll/ctocpp/browser_ctocpp.cc',
'libcef_dll/ctocpp/browser_ctocpp.h', 'libcef_dll/ctocpp/browser_ctocpp.h',
'libcef_dll/ctocpp/browser_host_ctocpp.cc', 'libcef_dll/ctocpp/browser_host_ctocpp.cc',
'libcef_dll/ctocpp/browser_host_ctocpp.h', 'libcef_dll/ctocpp/browser_host_ctocpp.h',
'libcef_dll/cpptoc/browser_process_handler_cpptoc.cc', 'libcef_dll/cpptoc/browser_process_handler_cpptoc.cc',
'libcef_dll/cpptoc/browser_process_handler_cpptoc.h', 'libcef_dll/cpptoc/browser_process_handler_cpptoc.h',
'libcef_dll/ctocpp/views/browser_view_ctocpp.cc',
'libcef_dll/ctocpp/views/browser_view_ctocpp.h',
'libcef_dll/cpptoc/views/browser_view_delegate_cpptoc.cc',
'libcef_dll/cpptoc/views/browser_view_delegate_cpptoc.h',
'libcef_dll/ctocpp/views/button_ctocpp.cc',
'libcef_dll/ctocpp/views/button_ctocpp.h',
'libcef_dll/cpptoc/views/button_delegate_cpptoc.cc',
'libcef_dll/cpptoc/views/button_delegate_cpptoc.h',
'libcef_dll/ctocpp/callback_ctocpp.cc', 'libcef_dll/ctocpp/callback_ctocpp.cc',
'libcef_dll/ctocpp/callback_ctocpp.h', 'libcef_dll/ctocpp/callback_ctocpp.h',
'libcef_dll/cpptoc/client_cpptoc.cc', 'libcef_dll/cpptoc/client_cpptoc.cc',
@ -376,10 +476,14 @@
'libcef_dll/cpptoc/dialog_handler_cpptoc.h', 'libcef_dll/cpptoc/dialog_handler_cpptoc.h',
'libcef_dll/ctocpp/dictionary_value_ctocpp.cc', 'libcef_dll/ctocpp/dictionary_value_ctocpp.cc',
'libcef_dll/ctocpp/dictionary_value_ctocpp.h', 'libcef_dll/ctocpp/dictionary_value_ctocpp.h',
'libcef_dll/ctocpp/views/display_ctocpp.cc',
'libcef_dll/ctocpp/views/display_ctocpp.h',
'libcef_dll/cpptoc/display_handler_cpptoc.cc', 'libcef_dll/cpptoc/display_handler_cpptoc.cc',
'libcef_dll/cpptoc/display_handler_cpptoc.h', 'libcef_dll/cpptoc/display_handler_cpptoc.h',
'libcef_dll/cpptoc/download_handler_cpptoc.cc', 'libcef_dll/cpptoc/download_handler_cpptoc.cc',
'libcef_dll/cpptoc/download_handler_cpptoc.h', 'libcef_dll/cpptoc/download_handler_cpptoc.h',
'libcef_dll/cpptoc/download_image_callback_cpptoc.cc',
'libcef_dll/cpptoc/download_image_callback_cpptoc.h',
'libcef_dll/ctocpp/download_item_ctocpp.cc', 'libcef_dll/ctocpp/download_item_ctocpp.cc',
'libcef_dll/ctocpp/download_item_ctocpp.h', 'libcef_dll/ctocpp/download_item_ctocpp.h',
'libcef_dll/ctocpp/download_item_callback_ctocpp.cc', 'libcef_dll/ctocpp/download_item_callback_ctocpp.cc',
@ -392,6 +496,8 @@
'libcef_dll/cpptoc/end_tracing_callback_cpptoc.h', 'libcef_dll/cpptoc/end_tracing_callback_cpptoc.h',
'libcef_dll/ctocpp/file_dialog_callback_ctocpp.cc', 'libcef_dll/ctocpp/file_dialog_callback_ctocpp.cc',
'libcef_dll/ctocpp/file_dialog_callback_ctocpp.h', 'libcef_dll/ctocpp/file_dialog_callback_ctocpp.h',
'libcef_dll/ctocpp/views/fill_layout_ctocpp.cc',
'libcef_dll/ctocpp/views/fill_layout_ctocpp.h',
'libcef_dll/cpptoc/find_handler_cpptoc.cc', 'libcef_dll/cpptoc/find_handler_cpptoc.cc',
'libcef_dll/cpptoc/find_handler_cpptoc.h', 'libcef_dll/cpptoc/find_handler_cpptoc.h',
'libcef_dll/cpptoc/focus_handler_cpptoc.cc', 'libcef_dll/cpptoc/focus_handler_cpptoc.cc',
@ -404,24 +510,40 @@
'libcef_dll/cpptoc/geolocation_handler_cpptoc.h', 'libcef_dll/cpptoc/geolocation_handler_cpptoc.h',
'libcef_dll/cpptoc/get_geolocation_callback_cpptoc.cc', 'libcef_dll/cpptoc/get_geolocation_callback_cpptoc.cc',
'libcef_dll/cpptoc/get_geolocation_callback_cpptoc.h', 'libcef_dll/cpptoc/get_geolocation_callback_cpptoc.h',
'libcef_dll/ctocpp/image_ctocpp.cc',
'libcef_dll/ctocpp/image_ctocpp.h',
'libcef_dll/ctocpp/jsdialog_callback_ctocpp.cc', 'libcef_dll/ctocpp/jsdialog_callback_ctocpp.cc',
'libcef_dll/ctocpp/jsdialog_callback_ctocpp.h', 'libcef_dll/ctocpp/jsdialog_callback_ctocpp.h',
'libcef_dll/cpptoc/jsdialog_handler_cpptoc.cc', 'libcef_dll/cpptoc/jsdialog_handler_cpptoc.cc',
'libcef_dll/cpptoc/jsdialog_handler_cpptoc.h', 'libcef_dll/cpptoc/jsdialog_handler_cpptoc.h',
'libcef_dll/cpptoc/keyboard_handler_cpptoc.cc', 'libcef_dll/cpptoc/keyboard_handler_cpptoc.cc',
'libcef_dll/cpptoc/keyboard_handler_cpptoc.h', 'libcef_dll/cpptoc/keyboard_handler_cpptoc.h',
'libcef_dll/ctocpp/views/label_button_ctocpp.cc',
'libcef_dll/ctocpp/views/label_button_ctocpp.h',
'libcef_dll/ctocpp/views/layout_ctocpp.cc',
'libcef_dll/ctocpp/views/layout_ctocpp.h',
'libcef_dll/cpptoc/life_span_handler_cpptoc.cc', 'libcef_dll/cpptoc/life_span_handler_cpptoc.cc',
'libcef_dll/cpptoc/life_span_handler_cpptoc.h', 'libcef_dll/cpptoc/life_span_handler_cpptoc.h',
'libcef_dll/ctocpp/list_value_ctocpp.cc', 'libcef_dll/ctocpp/list_value_ctocpp.cc',
'libcef_dll/ctocpp/list_value_ctocpp.h', 'libcef_dll/ctocpp/list_value_ctocpp.h',
'libcef_dll/cpptoc/load_handler_cpptoc.cc', 'libcef_dll/cpptoc/load_handler_cpptoc.cc',
'libcef_dll/cpptoc/load_handler_cpptoc.h', 'libcef_dll/cpptoc/load_handler_cpptoc.h',
'libcef_dll/ctocpp/views/menu_button_ctocpp.cc',
'libcef_dll/ctocpp/views/menu_button_ctocpp.h',
'libcef_dll/cpptoc/views/menu_button_delegate_cpptoc.cc',
'libcef_dll/cpptoc/views/menu_button_delegate_cpptoc.h',
'libcef_dll/ctocpp/menu_model_ctocpp.cc', 'libcef_dll/ctocpp/menu_model_ctocpp.cc',
'libcef_dll/ctocpp/menu_model_ctocpp.h', 'libcef_dll/ctocpp/menu_model_ctocpp.h',
'libcef_dll/cpptoc/menu_model_delegate_cpptoc.cc',
'libcef_dll/cpptoc/menu_model_delegate_cpptoc.h',
'libcef_dll/ctocpp/navigation_entry_ctocpp.cc', 'libcef_dll/ctocpp/navigation_entry_ctocpp.cc',
'libcef_dll/ctocpp/navigation_entry_ctocpp.h', 'libcef_dll/ctocpp/navigation_entry_ctocpp.h',
'libcef_dll/cpptoc/navigation_entry_visitor_cpptoc.cc', 'libcef_dll/cpptoc/navigation_entry_visitor_cpptoc.cc',
'libcef_dll/cpptoc/navigation_entry_visitor_cpptoc.h', 'libcef_dll/cpptoc/navigation_entry_visitor_cpptoc.h',
'libcef_dll/ctocpp/views/panel_ctocpp.cc',
'libcef_dll/ctocpp/views/panel_ctocpp.h',
'libcef_dll/cpptoc/views/panel_delegate_cpptoc.cc',
'libcef_dll/cpptoc/views/panel_delegate_cpptoc.h',
'libcef_dll/cpptoc/pdf_print_callback_cpptoc.cc', 'libcef_dll/cpptoc/pdf_print_callback_cpptoc.cc',
'libcef_dll/cpptoc/pdf_print_callback_cpptoc.h', 'libcef_dll/cpptoc/pdf_print_callback_cpptoc.h',
'libcef_dll/ctocpp/post_data_ctocpp.cc', 'libcef_dll/ctocpp/post_data_ctocpp.cc',
@ -478,6 +600,8 @@
'libcef_dll/cpptoc/scheme_handler_factory_cpptoc.h', 'libcef_dll/cpptoc/scheme_handler_factory_cpptoc.h',
'libcef_dll/ctocpp/scheme_registrar_ctocpp.cc', 'libcef_dll/ctocpp/scheme_registrar_ctocpp.cc',
'libcef_dll/ctocpp/scheme_registrar_ctocpp.h', 'libcef_dll/ctocpp/scheme_registrar_ctocpp.h',
'libcef_dll/ctocpp/views/scroll_view_ctocpp.cc',
'libcef_dll/ctocpp/views/scroll_view_ctocpp.h',
'libcef_dll/cpptoc/set_cookie_callback_cpptoc.cc', 'libcef_dll/cpptoc/set_cookie_callback_cpptoc.cc',
'libcef_dll/cpptoc/set_cookie_callback_cpptoc.h', 'libcef_dll/cpptoc/set_cookie_callback_cpptoc.h',
'libcef_dll/ctocpp/stream_reader_ctocpp.cc', 'libcef_dll/ctocpp/stream_reader_ctocpp.cc',
@ -490,6 +614,10 @@
'libcef_dll/cpptoc/task_cpptoc.h', 'libcef_dll/cpptoc/task_cpptoc.h',
'libcef_dll/ctocpp/task_runner_ctocpp.cc', 'libcef_dll/ctocpp/task_runner_ctocpp.cc',
'libcef_dll/ctocpp/task_runner_ctocpp.h', 'libcef_dll/ctocpp/task_runner_ctocpp.h',
'libcef_dll/ctocpp/views/textfield_ctocpp.cc',
'libcef_dll/ctocpp/views/textfield_ctocpp.h',
'libcef_dll/cpptoc/views/textfield_delegate_cpptoc.cc',
'libcef_dll/cpptoc/views/textfield_delegate_cpptoc.h',
'libcef_dll/ctocpp/test/translator_test_ctocpp.cc', 'libcef_dll/ctocpp/test/translator_test_ctocpp.cc',
'libcef_dll/ctocpp/test/translator_test_ctocpp.h', 'libcef_dll/ctocpp/test/translator_test_ctocpp.h',
'libcef_dll/cpptoc/test/translator_test_handler_cpptoc.cc', 'libcef_dll/cpptoc/test/translator_test_handler_cpptoc.cc',
@ -522,12 +650,20 @@
'libcef_dll/ctocpp/v8value_ctocpp.h', 'libcef_dll/ctocpp/v8value_ctocpp.h',
'libcef_dll/ctocpp/value_ctocpp.cc', 'libcef_dll/ctocpp/value_ctocpp.cc',
'libcef_dll/ctocpp/value_ctocpp.h', 'libcef_dll/ctocpp/value_ctocpp.h',
'libcef_dll/ctocpp/views/view_ctocpp.cc',
'libcef_dll/ctocpp/views/view_ctocpp.h',
'libcef_dll/cpptoc/views/view_delegate_cpptoc.cc',
'libcef_dll/cpptoc/views/view_delegate_cpptoc.h',
'libcef_dll/ctocpp/web_plugin_info_ctocpp.cc', 'libcef_dll/ctocpp/web_plugin_info_ctocpp.cc',
'libcef_dll/ctocpp/web_plugin_info_ctocpp.h', 'libcef_dll/ctocpp/web_plugin_info_ctocpp.h',
'libcef_dll/cpptoc/web_plugin_info_visitor_cpptoc.cc', 'libcef_dll/cpptoc/web_plugin_info_visitor_cpptoc.cc',
'libcef_dll/cpptoc/web_plugin_info_visitor_cpptoc.h', 'libcef_dll/cpptoc/web_plugin_info_visitor_cpptoc.h',
'libcef_dll/cpptoc/web_plugin_unstable_callback_cpptoc.cc', 'libcef_dll/cpptoc/web_plugin_unstable_callback_cpptoc.cc',
'libcef_dll/cpptoc/web_plugin_unstable_callback_cpptoc.h', 'libcef_dll/cpptoc/web_plugin_unstable_callback_cpptoc.h',
'libcef_dll/ctocpp/views/window_ctocpp.cc',
'libcef_dll/ctocpp/views/window_ctocpp.h',
'libcef_dll/cpptoc/views/window_delegate_cpptoc.cc',
'libcef_dll/cpptoc/views/window_delegate_cpptoc.h',
'libcef_dll/cpptoc/write_handler_cpptoc.cc', 'libcef_dll/cpptoc/write_handler_cpptoc.cc',
'libcef_dll/cpptoc/write_handler_cpptoc.h', 'libcef_dll/cpptoc/write_handler_cpptoc.h',
'libcef_dll/ctocpp/xml_reader_ctocpp.cc', 'libcef_dll/ctocpp/xml_reader_ctocpp.cc',

View File

@ -175,11 +175,13 @@
'tests/cefclient/browser/preferences_test.cc', 'tests/cefclient/browser/preferences_test.cc',
'tests/cefclient/browser/preferences_test.h', 'tests/cefclient/browser/preferences_test.h',
'tests/cefclient/browser/resource.h', 'tests/cefclient/browser/resource.h',
'tests/cefclient/browser/resource_util.cc',
'tests/cefclient/browser/resource_util.h', 'tests/cefclient/browser/resource_util.h',
'tests/cefclient/browser/response_filter_test.cc', 'tests/cefclient/browser/response_filter_test.cc',
'tests/cefclient/browser/response_filter_test.h', 'tests/cefclient/browser/response_filter_test.h',
'tests/cefclient/browser/root_window.cc', 'tests/cefclient/browser/root_window.cc',
'tests/cefclient/browser/root_window.h', 'tests/cefclient/browser/root_window.h',
'tests/cefclient/browser/root_window_create.cc',
'tests/cefclient/browser/root_window_manager.cc', 'tests/cefclient/browser/root_window_manager.cc',
'tests/cefclient/browser/root_window_manager.h', 'tests/cefclient/browser/root_window_manager.h',
'tests/cefclient/browser/scheme_test.cc', 'tests/cefclient/browser/scheme_test.cc',
@ -191,6 +193,8 @@
'tests/cefclient/browser/urlrequest_test.h', 'tests/cefclient/browser/urlrequest_test.h',
'tests/cefclient/browser/window_test.cc', 'tests/cefclient/browser/window_test.cc',
'tests/cefclient/browser/window_test.h', 'tests/cefclient/browser/window_test.h',
'tests/cefclient/browser/window_test_runner.cc',
'tests/cefclient/browser/window_test_runner.h',
], ],
'cefclient_sources_common': [ 'cefclient_sources_common': [
'tests/cefclient/common/client_app.cc', 'tests/cefclient/common/client_app.cc',
@ -217,8 +221,11 @@
'cefclient_sources_resources': [ 'cefclient_sources_resources': [
'tests/cefclient/resources/binding.html', 'tests/cefclient/resources/binding.html',
'tests/cefclient/resources/dialogs.html', 'tests/cefclient/resources/dialogs.html',
'tests/cefclient/resources/draggable.html',
'tests/cefclient/resources/localstorage.html', 'tests/cefclient/resources/localstorage.html',
'tests/cefclient/resources/logo.png', 'tests/cefclient/resources/logo.png',
'tests/cefclient/resources/menu_icon.1x.png',
'tests/cefclient/resources/menu_icon.2x.png',
'tests/cefclient/resources/osr_test.html', 'tests/cefclient/resources/osr_test.html',
'tests/cefclient/resources/other_tests.html', 'tests/cefclient/resources/other_tests.html',
'tests/cefclient/resources/pdf.html', 'tests/cefclient/resources/pdf.html',
@ -230,6 +237,8 @@
'tests/cefclient/resources/transparency.html', 'tests/cefclient/resources/transparency.html',
'tests/cefclient/resources/urlrequest.html', 'tests/cefclient/resources/urlrequest.html',
'tests/cefclient/resources/window.html', 'tests/cefclient/resources/window.html',
'tests/cefclient/resources/window_icon.1x.png',
'tests/cefclient/resources/window_icon.2x.png',
'tests/cefclient/resources/xmlhttprequest.html', 'tests/cefclient/resources/xmlhttprequest.html',
], ],
'cefclient_sources_win': [ 'cefclient_sources_win': [
@ -245,13 +254,20 @@
'tests/cefclient/browser/osr_window_win.cc', 'tests/cefclient/browser/osr_window_win.cc',
'tests/cefclient/browser/osr_window_win.h', 'tests/cefclient/browser/osr_window_win.h',
'tests/cefclient/browser/resource_util_win.cc', 'tests/cefclient/browser/resource_util_win.cc',
'tests/cefclient/browser/root_window_views.cc',
'tests/cefclient/browser/root_window_views.h',
'tests/cefclient/browser/root_window_win.cc', 'tests/cefclient/browser/root_window_win.cc',
'tests/cefclient/browser/root_window_win.h', 'tests/cefclient/browser/root_window_win.h',
'tests/cefclient/browser/temp_window_win.cc', 'tests/cefclient/browser/temp_window_win.cc',
'tests/cefclient/browser/temp_window_win.h', 'tests/cefclient/browser/temp_window_win.h',
'tests/cefclient/browser/util_win.cc', 'tests/cefclient/browser/util_win.cc',
'tests/cefclient/browser/util_win.h', 'tests/cefclient/browser/util_win.h',
'tests/cefclient/browser/window_test_win.cc', 'tests/cefclient/browser/views_window.cc',
'tests/cefclient/browser/views_window.h',
'tests/cefclient/browser/window_test_runner_views.cc',
'tests/cefclient/browser/window_test_runner_views.h',
'tests/cefclient/browser/window_test_runner_win.cc',
'tests/cefclient/browser/window_test_runner_win.h',
'tests/cefclient/cefclient_win.cc', 'tests/cefclient/cefclient_win.cc',
'tests/cefclient/resources/win/cefclient.exe.manifest', 'tests/cefclient/resources/win/cefclient.exe.manifest',
'tests/cefclient/resources/win/cefclient.ico', 'tests/cefclient/resources/win/cefclient.ico',
@ -274,7 +290,8 @@
'tests/cefclient/browser/root_window_mac.mm', 'tests/cefclient/browser/root_window_mac.mm',
'tests/cefclient/browser/temp_window_mac.h', 'tests/cefclient/browser/temp_window_mac.h',
'tests/cefclient/browser/temp_window_mac.mm', 'tests/cefclient/browser/temp_window_mac.mm',
'tests/cefclient/browser/window_test_mac.mm', 'tests/cefclient/browser/window_test_runner_mac.h',
'tests/cefclient/browser/window_test_runner_mac.mm',
'tests/cefclient/cefclient_mac.mm', 'tests/cefclient/cefclient_mac.mm',
'<@(cefclient_sources_browser)', '<@(cefclient_sources_browser)',
'<@(cefclient_sources_common)', '<@(cefclient_sources_common)',
@ -305,9 +322,16 @@
'tests/cefclient/browser/resource_util_posix.cc', 'tests/cefclient/browser/resource_util_posix.cc',
'tests/cefclient/browser/root_window_gtk.cc', 'tests/cefclient/browser/root_window_gtk.cc',
'tests/cefclient/browser/root_window_gtk.h', 'tests/cefclient/browser/root_window_gtk.h',
'tests/cefclient/browser/root_window_views.cc',
'tests/cefclient/browser/root_window_views.h',
'tests/cefclient/browser/temp_window_x11.cc', 'tests/cefclient/browser/temp_window_x11.cc',
'tests/cefclient/browser/temp_window_x11.h', 'tests/cefclient/browser/temp_window_x11.h',
'tests/cefclient/browser/window_test_gtk.cc', 'tests/cefclient/browser/views_window.cc',
'tests/cefclient/browser/views_window.h',
'tests/cefclient/browser/window_test_runner_gtk.cc',
'tests/cefclient/browser/window_test_runner_gtk.h',
'tests/cefclient/browser/window_test_runner_views.cc',
'tests/cefclient/browser/window_test_runner_views.h',
'tests/cefclient/cefclient_gtk.cc', 'tests/cefclient/cefclient_gtk.cc',
'<@(cefclient_sources_browser)', '<@(cefclient_sources_browser)',
'<@(cefclient_sources_common)', '<@(cefclient_sources_common)',

View File

@ -41,6 +41,7 @@
#include "include/capi/cef_base_capi.h" #include "include/capi/cef_base_capi.h"
#include "include/capi/cef_drag_data_capi.h" #include "include/capi/cef_drag_data_capi.h"
#include "include/capi/cef_frame_capi.h" #include "include/capi/cef_frame_capi.h"
#include "include/capi/cef_image_capi.h"
#include "include/capi/cef_navigation_entry_capi.h" #include "include/capi/cef_navigation_entry_capi.h"
#include "include/capi/cef_process_message_capi.h" #include "include/capi/cef_process_message_capi.h"
#include "include/capi/cef_request_context_capi.h" #include "include/capi/cef_request_context_capi.h"
@ -251,6 +252,29 @@ typedef struct _cef_pdf_print_callback_t {
} cef_pdf_print_callback_t; } cef_pdf_print_callback_t;
///
// Callback structure for cef_browser_host_t::DownloadImage. The functions of
// this structure will be called on the browser process UI thread.
///
typedef struct _cef_download_image_callback_t {
///
// Base structure.
///
cef_base_t base;
///
// 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 NULL if the download failed.
///
void (CEF_CALLBACK *on_download_image_finished)(
struct _cef_download_image_callback_t* self,
const cef_string_t* image_url, int http_status_code,
struct _cef_image_t* image);
} cef_download_image_callback_t;
/// ///
// Structure used to represent the browser process aspects of a browser window. // Structure used to represent the browser process aspects of a browser window.
// The functions of this structure can only be called in the browser process. // The functions of this structure can only be called in the browser process.
@ -282,6 +306,16 @@ typedef struct _cef_browser_host_t {
void (CEF_CALLBACK *close_browser)(struct _cef_browser_host_t* self, void (CEF_CALLBACK *close_browser)(struct _cef_browser_host_t* self,
int force_close); int force_close);
///
// Helper for closing a browser. Call this function from the top-level window
// close handler. Internally this calls CloseBrowser(false (0)) if the close
// has not yet been initiated. This function returns false (0) while the close
// is pending and true (1) after the close has completed. See close_browser()
// and cef_life_span_handler_t::do_close() documentation for additional usage
// information. This function must be called on the browser process UI thread.
///
int (CEF_CALLBACK *try_close_browser)(struct _cef_browser_host_t* self);
/// ///
// Set whether the browser is focused. // Set whether the browser is focused.
/// ///
@ -295,19 +329,27 @@ typedef struct _cef_browser_host_t {
int visible); int visible);
/// ///
// Retrieve the window handle for this browser. // Retrieve the window handle for this browser. If this browser is wrapped in
// a cef_browser_view_t this function should be called on the browser process
// UI thread and it will return the handle for the top-level native window.
/// ///
cef_window_handle_t (CEF_CALLBACK *get_window_handle)( cef_window_handle_t (CEF_CALLBACK *get_window_handle)(
struct _cef_browser_host_t* self); struct _cef_browser_host_t* self);
/// ///
// Retrieve the window handle of the browser that opened this browser. Will // Retrieve the window handle of the browser that opened this browser. Will
// return NULL for non-popup windows. This function can be used in combination // return NULL for non-popup windows or if this browser is wrapped in a
// with custom handling of modal windows. // cef_browser_view_t. This function can be used in combination with custom
// handling of modal windows.
/// ///
cef_window_handle_t (CEF_CALLBACK *get_opener_window_handle)( cef_window_handle_t (CEF_CALLBACK *get_opener_window_handle)(
struct _cef_browser_host_t* self); struct _cef_browser_host_t* self);
///
// Returns true (1) if this browser is wrapped in a cef_browser_view_t.
///
int (CEF_CALLBACK *has_view)(struct _cef_browser_host_t* self);
/// ///
// Returns the client for this browser. // Returns the client for this browser.
/// ///
@ -362,6 +404,22 @@ typedef struct _cef_browser_host_t {
void (CEF_CALLBACK *start_download)(struct _cef_browser_host_t* self, void (CEF_CALLBACK *start_download)(struct _cef_browser_host_t* self,
const cef_string_t* url); const cef_string_t* url);
///
// Download |image_url| and execute |callback| on completion with the images
// received from the renderer. If |is_favicon| is true (1) 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 (1) then |image_url| is requested from
// the server even if it is present in the browser cache.
///
void (CEF_CALLBACK *download_image)(struct _cef_browser_host_t* self,
const cef_string_t* image_url, int is_favicon, uint32 max_image_size,
int bypass_cache, struct _cef_download_image_callback_t* callback);
/// ///
// Print the current browser contents. // Print the current browser contents.
/// ///
@ -398,7 +456,9 @@ typedef struct _cef_browser_host_t {
/// ///
// Open developer tools in its own window. If |inspect_element_at| is non- // Open developer tools in its own window. If |inspect_element_at| is non-
// NULL the element at the specified (x,y) location will be inspected. // NULL the element at the specified (x,y) location will be inspected. The
// |windowInfo| parameter will be ignored if this browser is wrapped in a
// cef_browser_view_t.
/// ///
void (CEF_CALLBACK *show_dev_tools)(struct _cef_browser_host_t* self, void (CEF_CALLBACK *show_dev_tools)(struct _cef_browser_host_t* self,
const struct _cef_window_info_t* windowInfo, const struct _cef_window_info_t* windowInfo,

View File

@ -0,0 +1,187 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_CEF_IMAGE_CAPI_H_
#define CEF_INCLUDE_CAPI_CEF_IMAGE_CAPI_H_
#pragma once
#include "include/capi/cef_base_capi.h"
#include "include/capi/cef_values_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
///
// Container for a single image represented at different scale factors. All
// image representations should be the same size in density independent pixel
// (DIP) units. For example, if the image at scale factor 1.0 is 100x100 pixels
// then the image at scale factor 2.0 should be 200x200 pixels -- both images
// will display with a DIP size of 100x100 units. The functions of this
// structure must be called on the browser process UI thread.
///
typedef struct _cef_image_t {
///
// Base structure.
///
cef_base_t base;
///
// Returns true (1) if this Image is NULL.
///
int (CEF_CALLBACK *is_empty)(struct _cef_image_t* self);
///
// Returns true (1) if this Image and |that| Image share the same underlying
// storage. Will also return true (1) if both images are NULL.
///
int (CEF_CALLBACK *is_same)(struct _cef_image_t* self,
struct _cef_image_t* that);
///
// Add a bitmap image representation for |scale_factor|. Only 32-bit RGBA/BGRA
// formats are supported. |pixel_width| and |pixel_height| are the bitmap
// representation size in pixel coordinates. |pixel_data| is the array of
// pixel data and should be |pixel_width| x |pixel_height| x 4 bytes in size.
// |color_type| and |alpha_type| values specify the pixel format.
///
int (CEF_CALLBACK *add_bitmap)(struct _cef_image_t* self, float scale_factor,
int pixel_width, int pixel_height, cef_color_type_t color_type,
cef_alpha_type_t alpha_type, const void* pixel_data,
size_t pixel_data_size);
///
// Add a PNG image representation for |scale_factor|. |png_data| is the image
// data of size |png_data_size|. Any alpha transparency in the PNG data will
// be maintained.
///
int (CEF_CALLBACK *add_png)(struct _cef_image_t* self, float scale_factor,
const void* png_data, size_t png_data_size);
///
// Create a JPEG image representation for |scale_factor|. |jpeg_data| is the
// image data of size |jpeg_data_size|. The JPEG format does not support
// transparency so the alpha byte will be set to 0xFF for all pixels.
///
int (CEF_CALLBACK *add_jpeg)(struct _cef_image_t* self, float scale_factor,
const void* jpeg_data, size_t jpeg_data_size);
///
// Returns the image width in density independent pixel (DIP) units.
///
size_t (CEF_CALLBACK *get_width)(struct _cef_image_t* self);
///
// Returns the image height in density independent pixel (DIP) units.
///
size_t (CEF_CALLBACK *get_height)(struct _cef_image_t* self);
///
// Returns true (1) if this image contains a representation for
// |scale_factor|.
///
int (CEF_CALLBACK *has_representation)(struct _cef_image_t* self,
float scale_factor);
///
// Removes the representation for |scale_factor|. Returns true (1) on success.
///
int (CEF_CALLBACK *remove_representation)(struct _cef_image_t* self,
float scale_factor);
///
// Returns information for the representation that most closely matches
// |scale_factor|. |actual_scale_factor| is the actual scale factor for the
// representation. |pixel_width| and |pixel_height| are the representation
// size in pixel coordinates. Returns true (1) on success.
///
int (CEF_CALLBACK *get_representation_info)(struct _cef_image_t* self,
float scale_factor, float* actual_scale_factor, int* pixel_width,
int* pixel_height);
///
// Returns the bitmap representation that most closely matches |scale_factor|.
// Only 32-bit RGBA/BGRA formats are supported. |color_type| and |alpha_type|
// values specify the desired output pixel format. |pixel_width| and
// |pixel_height| are the output representation size in pixel coordinates.
// Returns a cef_binary_value_t containing the pixel data on success or NULL
// on failure.
///
struct _cef_binary_value_t* (CEF_CALLBACK *get_as_bitmap)(
struct _cef_image_t* self, float scale_factor,
cef_color_type_t color_type, cef_alpha_type_t alpha_type,
int* pixel_width, int* pixel_height);
///
// Returns the PNG representation that most closely matches |scale_factor|. If
// |with_transparency| is true (1) any alpha transparency in the image will be
// represented in the resulting PNG data. |pixel_width| and |pixel_height| are
// the output representation size in pixel coordinates. Returns a
// cef_binary_value_t containing the PNG image data on success or NULL on
// failure.
///
struct _cef_binary_value_t* (CEF_CALLBACK *get_as_png)(
struct _cef_image_t* self, float scale_factor, int with_transparency,
int* pixel_width, int* pixel_height);
///
// Returns the JPEG representation that most closely matches |scale_factor|.
// |quality| determines the compression level with 0 == lowest and 100 ==
// highest. The JPEG format does not support alpha transparency and the alpha
// channel, if any, will be discarded. |pixel_width| and |pixel_height| are
// the output representation size in pixel coordinates. Returns a
// cef_binary_value_t containing the JPEG image data on success or NULL on
// failure.
///
struct _cef_binary_value_t* (CEF_CALLBACK *get_as_jpeg)(
struct _cef_image_t* self, float scale_factor, int quality,
int* pixel_width, int* pixel_height);
} cef_image_t;
///
// Create a new cef_image_t. It will initially be NULL. Use the Add*() functions
// to add representations at different scale factors.
///
CEF_EXPORT cef_image_t* cef_image_create();
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_CEF_IMAGE_CAPI_H_

View File

@ -74,7 +74,9 @@ typedef struct _cef_life_span_handler_t {
// popup browser return true (1). The |client| and |settings| values will // popup browser return true (1). The |client| and |settings| values will
// default to the source browser's values. If the |no_javascript_access| value // default to the source browser's values. If the |no_javascript_access| value
// is set to false (0) the new browser will not be scriptable and may not be // is set to false (0) the new browser will not be scriptable and may not be
// hosted in the same renderer process as the source browser. // hosted in the same renderer process as the source browser. Any
// modifications to |windowInfo| will be ignored if the parent browser is
// wrapped in a cef_browser_view_t.
/// ///
int (CEF_CALLBACK *on_before_popup)(struct _cef_life_span_handler_t* self, int (CEF_CALLBACK *on_before_popup)(struct _cef_life_span_handler_t* self,
struct _cef_browser_t* browser, struct _cef_frame_t* frame, struct _cef_browser_t* browser, struct _cef_frame_t* frame,
@ -85,56 +87,81 @@ typedef struct _cef_life_span_handler_t {
struct _cef_browser_settings_t* settings, int* no_javascript_access); struct _cef_browser_settings_t* settings, int* no_javascript_access);
/// ///
// Called after a new browser is created. // Called after a new browser is created. This callback will be the first
// notification that references |browser|.
/// ///
void (CEF_CALLBACK *on_after_created)(struct _cef_life_span_handler_t* self, void (CEF_CALLBACK *on_after_created)(struct _cef_life_span_handler_t* self,
struct _cef_browser_t* browser); struct _cef_browser_t* browser);
///
// Called when a modal window is about to display and the modal loop should
// begin running. Return false (0) to use the default modal loop
// implementation or true (1) to use a custom implementation.
///
int (CEF_CALLBACK *run_modal)(struct _cef_life_span_handler_t* self,
struct _cef_browser_t* browser);
/// ///
// Called when a browser has recieved a request to close. This may result // Called when a browser has recieved a request to close. This may result
// directly from a call to cef_browser_host_t::close_browser() or indirectly // directly from a call to cef_browser_host_t::*close_browser() or indirectly
// if the browser is a top-level OS window created by CEF and the user // if the browser is parented to a top-level window created by CEF and the
// attempts to close the window. This function will be called after the // user attempts to close that window (by clicking the 'X', for example). The
// JavaScript 'onunload' event has been fired. It will not be called for // do_close() function will be called after the JavaScript 'onunload' event
// browsers after the associated OS window has been destroyed (for those // has been fired.
// browsers it is no longer possible to cancel the close).
// //
// If CEF created an OS window for the browser returning false (0) will send // An application should handle top-level owner window close notifications by
// an OS close notification to the browser window's top-level owner (e.g. // calling cef_browser_host_t::Tryclose_browser() or
// WM_CLOSE on Windows, performClose: on OS-X and "delete_event" on Linux). If // cef_browser_host_t::CloseBrowser(false (0)) instead of allowing the window
// no OS window exists (window rendering disabled) returning false (0) will // to close immediately (see the examples below). This gives CEF an
// cause the browser object to be destroyed immediately. Return true (1) if
// the browser is parented to another window and that other window needs to
// receive close notification via some non-standard technique.
//
// If an application provides its own top-level window it should handle OS
// close notifications by calling cef_browser_host_t::CloseBrowser(false (0))
// instead of immediately closing (see the example below). This gives CEF an
// opportunity to process the 'onbeforeunload' event and optionally cancel the // opportunity to process the 'onbeforeunload' event and optionally cancel the
// close before do_close() is called. // close before do_close() is called.
// //
// When windowed rendering is enabled CEF will internally create a window or
// view to host the browser. In that case returning false (0) from do_close()
// will send the standard close notification to the browser's top-level owner
// window (e.g. WM_CLOSE on Windows, performClose: on OS X, "delete_event" on
// Linux or cef_window_delegate_t::can_close() callback from Views). If the
// browser's host window/view has already been destroyed (via view hierarchy
// tear-down, for example) then do_close() will not be called for that browser
// since is no longer possible to cancel the close.
//
// When windowed rendering is disabled returning false (0) from do_close()
// will cause the browser object to be destroyed immediately.
//
// If the browser's top-level owner window requires a non-standard close
// notification then send that notification from do_close() and return true
// (1).
//
// The cef_life_span_handler_t::on_before_close() function will be called // The cef_life_span_handler_t::on_before_close() function will be called
// immediately before the browser object is destroyed. The application should // after do_close() (if do_close() is called) and immediately before the
// only exit after on_before_close() has been called for all existing // browser object is destroyed. The application should only exit after
// browsers. // on_before_close() has been called for all existing browsers.
// //
// If the browser represents a modal window and a custom modal loop // The below examples describe what should happen during window close when the
// implementation was provided in cef_life_span_handler_t::run_modal() this // browser is parented to an application-provided top-level window.
// callback should be used to restore the opener window to a usable state.
// //
// By way of example consider what should happen during window close when the // Example 1: Using cef_browser_host_t::Tryclose_browser(). This is
// browser is parented to an application-provided top-level OS window. 1. // recommended for clients using standard close handling and windows created
// User clicks the window close button which sends an OS close // on the browser process UI thread. 1. User clicks the window close button
// notification (e.g. WM_CLOSE on Windows, performClose: on OS-X and // which sends a close notification to
// "delete_event" on Linux). // the application's top-level window.
// 2. Application's top-level window receives the close notification and
// calls TryCloseBrowser() (which internally calls CloseBrowser(false)).
// TryCloseBrowser() returns false so the client cancels the window close.
// 3. JavaScript 'onbeforeunload' handler executes and shows the close
// confirmation dialog (which can be overridden via
// CefJSDialogHandler::OnBeforeUnloadDialog()).
// 4. User approves the close. 5. JavaScript 'onunload' handler executes. 6.
// CEF sends a close notification to the application's top-level window
// (because DoClose() returned false by default).
// 7. Application's top-level window receives the close notification and
// calls TryCloseBrowser(). TryCloseBrowser() returns true so the client
// allows the window close.
// 8. Application's top-level window is destroyed. 9. Application's
// on_before_close() handler is called and the browser object
// is destroyed.
// 10. Application exits by calling cef_quit_message_loop() if no other
// browsers
// exist.
//
// Example 2: Using cef_browser_host_t::CloseBrowser(false (0)) and
// implementing the do_close() callback. This is recommended for clients using
// non-standard close handling or windows that were not created on the browser
// process UI thread. 1. User clicks the window close button which sends a
// close notification to
// the application's top-level window.
// 2. Application's top-level window receives the close notification and: // 2. Application's top-level window receives the close notification and:
// A. Calls CefBrowserHost::CloseBrowser(false). // A. Calls CefBrowserHost::CloseBrowser(false).
// B. Cancels the window close. // B. Cancels the window close.
@ -145,12 +172,12 @@ typedef struct _cef_life_span_handler_t {
// Application's do_close() handler is called. Application will: // Application's do_close() handler is called. Application will:
// A. Set a flag to indicate that the next close attempt will be allowed. // A. Set a flag to indicate that the next close attempt will be allowed.
// B. Return false. // B. Return false.
// 7. CEF sends an OS close notification. 8. Application's top-level window // 7. CEF sends an close notification to the application's top-level window.
// receives the OS close notification and // 8. Application's top-level window receives the close notification and
// allows the window to close based on the flag from #6B. // allows the window to close based on the flag from #6B.
// 9. Browser OS window is destroyed. 10. Application's // 9. Application's top-level window is destroyed. 10. Application's
// cef_life_span_handler_t::on_before_close() handler is called and // on_before_close() handler is called and the browser object
// the browser object is destroyed. // is destroyed.
// 11. Application exits by calling cef_quit_message_loop() if no other // 11. Application exits by calling cef_quit_message_loop() if no other
// browsers // browsers
// exist. // exist.
@ -161,9 +188,8 @@ typedef struct _cef_life_span_handler_t {
/// ///
// Called just before a browser is destroyed. Release all references to the // Called just before a browser is destroyed. Release all references to the
// browser object and do not attempt to execute any functions on the browser // browser object and do not attempt to execute any functions on the browser
// object after this callback returns. If this is a modal window and a custom // object after this callback returns. This callback will be the last
// modal loop implementation was provided in run_modal() this callback should // notification that references |browser|. See do_close() documentation for
// be used to exit the custom modal loop. See do_close() documentation for
// additional usage information. // additional usage information.
/// ///
void (CEF_CALLBACK *on_before_close)(struct _cef_life_span_handler_t* self, void (CEF_CALLBACK *on_before_close)(struct _cef_life_span_handler_t* self,

View File

@ -39,6 +39,7 @@
#pragma once #pragma once
#include "include/capi/cef_base_capi.h" #include "include/capi/cef_base_capi.h"
#include "include/capi/cef_menu_model_delegate_capi.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -381,6 +382,13 @@ typedef struct _cef_menu_model_t {
} cef_menu_model_t; } cef_menu_model_t;
///
// Create a new MenuModel with the specified |delegate|.
///
CEF_EXPORT cef_menu_model_t* cef_menu_model_create(
struct _cef_menu_model_delegate_t* delegate);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -0,0 +1,80 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_CEF_MENU_MODEL_DELEGATE_CAPI_H_
#define CEF_INCLUDE_CAPI_CEF_MENU_MODEL_DELEGATE_CAPI_H_
#pragma once
#include "include/capi/cef_base_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
struct _cef_menu_model_t;
///
// Implement this structure to handle menu model events. The functions of this
// structure will be called on the browser process UI thread unless otherwise
// indicated.
///
typedef struct _cef_menu_model_delegate_t {
///
// Base structure.
///
cef_base_t base;
///
// Perform the action associated with the specified |command_id| and optional
// |event_flags|.
///
void (CEF_CALLBACK *execute_command)(struct _cef_menu_model_delegate_t* self,
struct _cef_menu_model_t* menu_model, int command_id,
cef_event_flags_t event_flags);
///
// The menu is about to show.
///
void (CEF_CALLBACK *menu_will_show)(struct _cef_menu_model_delegate_t* self,
struct _cef_menu_model_t* menu_model);
} cef_menu_model_delegate_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_CEF_MENU_MODEL_DELEGATE_CAPI_H_

View File

@ -121,7 +121,7 @@ typedef struct _cef_print_settings_t {
// Set the page ranges. // Set the page ranges.
/// ///
void (CEF_CALLBACK *set_page_ranges)(struct _cef_print_settings_t* self, void (CEF_CALLBACK *set_page_ranges)(struct _cef_print_settings_t* self,
size_t rangesCount, cef_page_range_t const* ranges); size_t rangesCount, cef_range_t const* ranges);
/// ///
// Returns the number of page ranges that currently exist. // Returns the number of page ranges that currently exist.
@ -133,7 +133,7 @@ typedef struct _cef_print_settings_t {
// Retrieve the page ranges. // Retrieve the page ranges.
/// ///
void (CEF_CALLBACK *get_page_ranges)(struct _cef_print_settings_t* self, void (CEF_CALLBACK *get_page_ranges)(struct _cef_print_settings_t* self,
size_t* rangesCount, cef_page_range_t* ranges); size_t* rangesCount, cef_range_t* ranges);
/// ///
// Set whether only the selection will be printed. // Set whether only the selection will be printed.

View File

@ -0,0 +1,86 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_BOX_LAYOUT_CAPI_H_
#define CEF_INCLUDE_CAPI_VIEWS_CEF_BOX_LAYOUT_CAPI_H_
#pragma once
#include "include/capi/views/cef_layout_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
struct _cef_view_t;
///
// A Layout manager that arranges child views vertically or horizontally in a
// side-by-side fashion with spacing around and between the child views. The
// child views are always sized according to their preferred size. If the host's
// bounds provide insufficient space, child views will be clamped. Excess space
// will not be distributed. Methods must be called on the browser process UI
// thread unless otherwise indicated.
///
typedef struct _cef_box_layout_t {
///
// Base structure.
///
cef_layout_t base;
///
// Set the flex weight for the given |view|. Using the preferred size as the
// basis, free space along the main axis is distributed to views in the ratio
// of their flex weights. Similarly, if the views will overflow the parent,
// space is subtracted in these ratios. A flex of 0 means this view is not
// resized. Flex values must not be negative.
///
void (CEF_CALLBACK *set_flex_for_view)(struct _cef_box_layout_t* self,
struct _cef_view_t* view, int flex);
///
// Clears the flex for the given |view|, causing it to use the default flex
// specified via cef_box_layout_tSettings.default_flex.
///
void (CEF_CALLBACK *clear_flex_for_view)(struct _cef_box_layout_t* self,
struct _cef_view_t* view);
} cef_box_layout_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_VIEWS_CEF_BOX_LAYOUT_CAPI_H_

View File

@ -0,0 +1,90 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_BROWSER_VIEW_CAPI_H_
#define CEF_INCLUDE_CAPI_VIEWS_CEF_BROWSER_VIEW_CAPI_H_
#pragma once
#include "include/capi/cef_browser_capi.h"
#include "include/capi/views/cef_browser_view_delegate_capi.h"
#include "include/capi/views/cef_view_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
///
// A View hosting a cef_browser_t instance. Methods must be called on the
// browser process UI thread unless otherwise indicated.
///
typedef struct _cef_browser_view_t {
///
// Base structure.
///
cef_view_t base;
///
// Returns the cef_browser_t hosted by this BrowserView. Will return NULL if
// the browser has not yet been created or has already been destroyed.
///
struct _cef_browser_t* (CEF_CALLBACK *get_browser)(
struct _cef_browser_view_t* self);
} cef_browser_view_t;
///
// Create a new BrowserView. The underlying cef_browser_t will not be created
// until this view is added to the views hierarchy.
///
CEF_EXPORT cef_browser_view_t* cef_browser_view_create(
struct _cef_client_t* client, const cef_string_t* url,
const struct _cef_browser_settings_t* settings,
struct _cef_request_context_t* request_context,
struct _cef_browser_view_delegate_t* delegate);
///
// Returns the BrowserView associated with |browser|.
///
CEF_EXPORT cef_browser_view_t* cef_browser_view_get_for_browser(
struct _cef_browser_t* browser);
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_VIEWS_CEF_BROWSER_VIEW_CAPI_H_

View File

@ -0,0 +1,118 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_BROWSER_VIEW_DELEGATE_CAPI_H_
#define CEF_INCLUDE_CAPI_VIEWS_CEF_BROWSER_VIEW_DELEGATE_CAPI_H_
#pragma once
#include "include/capi/cef_client_capi.h"
#include "include/capi/views/cef_view_delegate_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
struct _cef_browser_t;
struct _cef_browser_view_t;
///
// Implement this structure to handle BrowserView events. The functions of this
// structure will be called on the browser process UI thread unless otherwise
// indicated.
///
typedef struct _cef_browser_view_delegate_t {
///
// Base structure.
///
cef_view_delegate_t base;
///
// Called when |browser| associated with |browser_view| is created. This
// function will be called after cef_life_span_handler_t::on_after_created()
// is called for |browser| and before on_popup_browser_view_created() is
// called for |browser|'s parent delegate if |browser| is a popup.
///
void (CEF_CALLBACK *on_browser_created)(
struct _cef_browser_view_delegate_t* self,
struct _cef_browser_view_t* browser_view,
struct _cef_browser_t* browser);
///
// Called when |browser| associated with |browser_view| is destroyed. Release
// all references to |browser| and do not attempt to execute any functions on
// |browser| after this callback returns. This function will be called before
// cef_life_span_handler_t::on_before_close() is called for |browser|.
///
void (CEF_CALLBACK *on_browser_destroyed)(
struct _cef_browser_view_delegate_t* self,
struct _cef_browser_view_t* browser_view,
struct _cef_browser_t* browser);
///
// Called before a new popup BrowserView is created. The popup originated from
// |browser_view|. |settings| and |client| are the values returned from
// cef_life_span_handler_t::on_before_popup(). |is_devtools| will be true (1)
// if the popup will be a DevTools browser. Return the delegate that will be
// used for the new popup BrowserView.
///
struct _cef_browser_view_delegate_t* (
CEF_CALLBACK *get_delegate_for_popup_browser_view)(
struct _cef_browser_view_delegate_t* self,
struct _cef_browser_view_t* browser_view,
const struct _cef_browser_settings_t* settings,
struct _cef_client_t* client, int is_devtools);
///
// Called after |popup_browser_view| is created. This function will be called
// after cef_life_span_handler_t::on_after_created() and on_browser_created()
// are called for the new popup browser. The popup originated from
// |browser_view|. |is_devtools| will be true (1) if the popup is a DevTools
// browser. Optionally add |popup_browser_view| to the views hierarchy
// yourself and return true (1). Otherwise return false (0) and a default
// cef_window_t will be created for the popup.
///
int (CEF_CALLBACK *on_popup_browser_view_created)(
struct _cef_browser_view_delegate_t* self,
struct _cef_browser_view_t* browser_view,
struct _cef_browser_view_t* popup_browser_view, int is_devtools);
} cef_browser_view_delegate_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_VIEWS_CEF_BROWSER_VIEW_DELEGATE_CAPI_H_

View File

@ -0,0 +1,96 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_BUTTON_CAPI_H_
#define CEF_INCLUDE_CAPI_VIEWS_CEF_BUTTON_CAPI_H_
#pragma once
#include "include/capi/views/cef_view_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
struct _cef_label_button_t;
///
// A View representing a button. Depending on the specific type, the button
// could be implemented by a native control or custom rendered. Methods must be
// called on the browser process UI thread unless otherwise indicated.
///
typedef struct _cef_button_t {
///
// Base structure.
///
cef_view_t base;
///
// Returns this Button as a LabelButton or NULL if this is not a LabelButton.
///
struct _cef_label_button_t* (CEF_CALLBACK *as_label_button)(
struct _cef_button_t* self);
///
// Sets the current display state of the Button.
///
void (CEF_CALLBACK *set_state)(struct _cef_button_t* self,
cef_button_state_t state);
///
// Returns the current display state of the Button.
///
cef_button_state_t (CEF_CALLBACK *get_state)(struct _cef_button_t* self);
///
// Sets the tooltip text that will be displayed when the user hovers the mouse
// cursor over the Button.
///
void (CEF_CALLBACK *set_tooltip_text)(struct _cef_button_t* self,
const cef_string_t* tooltip_text);
///
// Sets the accessible name that will be exposed to assistive technology (AT).
///
void (CEF_CALLBACK *set_accessible_name)(struct _cef_button_t* self,
const cef_string_t* name);
} cef_button_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_VIEWS_CEF_BUTTON_CAPI_H_

View File

@ -0,0 +1,72 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_BUTTON_DELEGATE_CAPI_H_
#define CEF_INCLUDE_CAPI_VIEWS_CEF_BUTTON_DELEGATE_CAPI_H_
#pragma once
#include "include/capi/views/cef_view_delegate_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
struct _cef_button_t;
///
// Implement this structure to handle Button events. The functions of this
// structure will be called on the browser process UI thread unless otherwise
// indicated.
///
typedef struct _cef_button_delegate_t {
///
// Base structure.
///
cef_view_delegate_t base;
///
// Called when |button| is pressed.
///
void (CEF_CALLBACK *on_button_pressed)(struct _cef_button_delegate_t* self,
struct _cef_button_t* button);
} cef_button_delegate_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_VIEWS_CEF_BUTTON_DELEGATE_CAPI_H_

View File

@ -0,0 +1,145 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_DISPLAY_CAPI_H_
#define CEF_INCLUDE_CAPI_VIEWS_CEF_DISPLAY_CAPI_H_
#pragma once
#include "include/capi/cef_base_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
///
// This structure typically, but not always, corresponds to a physical display
// connected to the system. A fake Display may exist on a headless system, or a
// Display may correspond to a remote, virtual display. All size and position
// values are in density independent pixels (DIP) unless otherwise indicated.
// Methods must be called on the browser process UI thread unless otherwise
// indicated.
///
typedef struct _cef_display_t {
///
// Base structure.
///
cef_base_t base;
///
// Returns the unique identifier for this Display.
///
int64 (CEF_CALLBACK *get_id)(struct _cef_display_t* self);
///
// Returns this Display's device pixel scale factor. This specifies how much
// the UI should be scaled when the actual output has more pixels than
// standard displays (which is around 100~120dpi). The potential return values
// differ by platform.
///
float (CEF_CALLBACK *get_device_scale_factor)(struct _cef_display_t* self);
///
// Convert |point| from density independent pixels (DIP) to pixel coordinates
// using this Display's device scale factor.
///
void (CEF_CALLBACK *convert_point_to_pixels)(struct _cef_display_t* self,
cef_point_t* point);
///
// Convert |point| from pixel coordinates to density independent pixels (DIP)
// using this Display's device scale factor.
///
void (CEF_CALLBACK *convert_point_from_pixels)(struct _cef_display_t* self,
cef_point_t* point);
///
// Returns this Display's bounds. This is the full size of the display.
///
cef_rect_t (CEF_CALLBACK *get_bounds)(struct _cef_display_t* self);
///
// Returns this Display's work area. This excludes areas of the display that
// are occupied for window manager toolbars, etc.
///
cef_rect_t (CEF_CALLBACK *get_work_area)(struct _cef_display_t* self);
///
// Returns this Display's rotation in degrees.
///
int (CEF_CALLBACK *get_rotation)(struct _cef_display_t* self);
} cef_display_t;
///
// Returns the primary Display.
///
CEF_EXPORT cef_display_t* cef_display_get_primary();
///
// Returns the Display nearest |point|. Set |input_pixel_coords| to true (1) if
// |point| is in pixel coordinates instead of density independent pixels (DIP).
///
CEF_EXPORT cef_display_t* cef_display_get_nearest_point(
const cef_point_t* point, int input_pixel_coords);
///
// Returns the Display that most closely intersects |bounds|. Set
// |input_pixel_coords| to true (1) if |bounds| is in pixel coordinates instead
// of density independent pixels (DIP).
///
CEF_EXPORT cef_display_t* cef_display_get_matching_bounds(
const cef_rect_t* bounds, int input_pixel_coords);
///
// Returns the total number of Displays. Mirrored displays are excluded; this
// function is intended to return the number of distinct, usable displays.
///
CEF_EXPORT size_t cef_display_get_count();
///
// Returns all Displays. Mirrored displays are excluded; this function is
// intended to return distinct, usable displays.
///
CEF_EXPORT void cef_display_get_alls(size_t* displaysCount,
cef_display_t** displays);
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_VIEWS_CEF_DISPLAY_CAPI_H_

View File

@ -0,0 +1,65 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_FILL_LAYOUT_CAPI_H_
#define CEF_INCLUDE_CAPI_VIEWS_CEF_FILL_LAYOUT_CAPI_H_
#pragma once
#include "include/capi/views/cef_layout_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
///
// A simple Layout that causes the associated Panel's one child to be sized to
// match the bounds of its parent. Methods must be called on the browser process
// UI thread unless otherwise indicated.
///
typedef struct _cef_fill_layout_t {
///
// Base structure.
///
cef_layout_t base;
} cef_fill_layout_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_VIEWS_CEF_FILL_LAYOUT_CAPI_H_

View File

@ -0,0 +1,161 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_LABEL_BUTTON_CAPI_H_
#define CEF_INCLUDE_CAPI_VIEWS_CEF_LABEL_BUTTON_CAPI_H_
#pragma once
#include "include/capi/cef_image_capi.h"
#include "include/capi/views/cef_button_capi.h"
#include "include/capi/views/cef_button_delegate_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
struct _cef_menu_button_t;
///
// LabelButton is a button with optional text and/or icon. Methods must be
// called on the browser process UI thread unless otherwise indicated.
///
typedef struct _cef_label_button_t {
///
// Base structure.
///
cef_button_t base;
///
// Returns this LabelButton as a MenuButton or NULL if this is not a
// MenuButton.
///
struct _cef_menu_button_t* (CEF_CALLBACK *as_menu_button)(
struct _cef_label_button_t* self);
///
// Sets the text shown on the LabelButton. By default |text| will also be used
// as the accessible name.
///
void (CEF_CALLBACK *set_text)(struct _cef_label_button_t* self,
const cef_string_t* text);
///
// Returns the text shown on the LabelButton.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_text)(
struct _cef_label_button_t* self);
///
// Sets the image shown for |button_state|. When this Button is drawn if no
// image exists for the current state then the image for
// CEF_BUTTON_STATE_NORMAL, if any, will be shown.
///
void (CEF_CALLBACK *set_image)(struct _cef_label_button_t* self,
cef_button_state_t button_state, struct _cef_image_t* image);
///
// Returns the image shown for |button_state|. If no image exists for that
// state then the image for CEF_BUTTON_STATE_NORMAL will be returned.
///
struct _cef_image_t* (CEF_CALLBACK *get_image)(
struct _cef_label_button_t* self, cef_button_state_t button_state);
///
// Sets the text color shown for the specified button |for_state| to |color|.
///
void (CEF_CALLBACK *set_text_color)(struct _cef_label_button_t* self,
cef_button_state_t for_state, cef_color_t color);
///
// Sets the text colors shown for the non-disabled states to |color|.
///
void (CEF_CALLBACK *set_enabled_text_colors)(struct _cef_label_button_t* self,
cef_color_t color);
///
// Sets the font list. The format is "<FONT_FAMILY_LIST>,[STYLES] <SIZE>",
// where: - FONT_FAMILY_LIST is a comma-separated list of font family names, -
// STYLES is an optional space-separated list of style names (case-sensitive
// "Bold" and "Italic" are supported), and
// - SIZE is an integer font size in pixels with the suffix "px".
//
// Here are examples of valid font description strings: - "Arial, Helvetica,
// Bold Italic 14px" - "Arial, 14px"
///
void (CEF_CALLBACK *set_font_list)(struct _cef_label_button_t* self,
const cef_string_t* font_list);
///
// Sets the horizontal alignment; reversed in RTL. Default is
// CEF_HORIZONTAL_ALIGNMENT_CENTER.
///
void (CEF_CALLBACK *set_horizontal_alignment)(
struct _cef_label_button_t* self, cef_horizontal_alignment_t alignment);
///
// Reset the minimum size of this LabelButton to |size|.
///
void (CEF_CALLBACK *set_minimum_size)(struct _cef_label_button_t* self,
const cef_size_t* size);
///
// Reset the maximum size of this LabelButton to |size|.
///
void (CEF_CALLBACK *set_maximum_size)(struct _cef_label_button_t* self,
const cef_size_t* size);
} cef_label_button_t;
///
// Create a new LabelButton. A |delegate| must be provided to handle the button
// click. |text| will be shown on the LabelButton and used as the default
// accessible name. If |with_frame| is true (1) the button will have a visible
// frame at all times, center alignment, additional padding and a default
// minimum size of 70x33 DIP. If |with_frame| is false (0) the button will only
// have a visible frame on hover/press, left alignment, less padding and no
// default minimum size.
///
CEF_EXPORT cef_label_button_t* cef_label_button_create(
struct _cef_button_delegate_t* delegate, const cef_string_t* text,
int with_frame);
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_VIEWS_CEF_LABEL_BUTTON_CAPI_H_

View File

@ -0,0 +1,84 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_LAYOUT_CAPI_H_
#define CEF_INCLUDE_CAPI_VIEWS_CEF_LAYOUT_CAPI_H_
#pragma once
#include "include/capi/cef_base_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
struct _cef_box_layout_t;
struct _cef_fill_layout_t;
///
// A Layout handles the sizing of the children of a Panel according to
// implementation-specific heuristics. Methods must be called on the browser
// process UI thread unless otherwise indicated.
///
typedef struct _cef_layout_t {
///
// Base structure.
///
cef_base_t base;
///
// Returns this Layout as a BoxLayout or NULL if this is not a BoxLayout.
///
struct _cef_box_layout_t* (CEF_CALLBACK *as_box_layout)(
struct _cef_layout_t* self);
///
// Returns this Layout as a FillLayout or NULL if this is not a FillLayout.
///
struct _cef_fill_layout_t* (CEF_CALLBACK *as_fill_layout)(
struct _cef_layout_t* self);
///
// Returns true (1) if this Layout is valid.
///
int (CEF_CALLBACK *is_valid)(struct _cef_layout_t* self);
} cef_layout_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_VIEWS_CEF_LAYOUT_CAPI_H_

View File

@ -0,0 +1,93 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_MENU_BUTTON_CAPI_H_
#define CEF_INCLUDE_CAPI_VIEWS_CEF_MENU_BUTTON_CAPI_H_
#pragma once
#include "include/capi/cef_menu_model_capi.h"
#include "include/capi/views/cef_label_button_capi.h"
#include "include/capi/views/cef_menu_button_delegate_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
///
// MenuButton is a button with optional text, icon and/or menu marker that shows
// a menu when clicked with the left mouse button. All size and position values
// are in density independent pixels (DIP) unless otherwise indicated. Methods
// must be called on the browser process UI thread unless otherwise indicated.
///
typedef struct _cef_menu_button_t {
///
// Base structure.
///
cef_label_button_t base;
///
// Show a menu with contents |menu_model|. |screen_point| specifies the menu
// position in screen coordinates. |anchor_position| specifies how the menu
// will be anchored relative to |screen_point|. This function should be called
// from cef_menu_button_delegate_t::on_menu_button_pressed().
///
void (CEF_CALLBACK *show_menu)(struct _cef_menu_button_t* self,
struct _cef_menu_model_t* menu_model, const cef_point_t* screen_point,
cef_menu_anchor_position_t anchor_position);
} cef_menu_button_t;
///
// Create a new MenuButton. A |delegate| must be provided to call show_menu()
// when the button is clicked. |text| will be shown on the MenuButton and used
// as the default accessible name. If |with_frame| is true (1) the button will
// have a visible frame at all times, center alignment, additional padding and a
// default minimum size of 70x33 DIP. If |with_frame| is false (0) the button
// will only have a visible frame on hover/press, left alignment, less padding
// and no default minimum size. If |with_menu_marker| is true (1) a menu marker
// will be added to the button.
///
CEF_EXPORT cef_menu_button_t* cef_menu_button_create(
struct _cef_menu_button_delegate_t* delegate, const cef_string_t* text,
int with_frame, int with_menu_marker);
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_VIEWS_CEF_MENU_BUTTON_CAPI_H_

View File

@ -0,0 +1,75 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_MENU_BUTTON_DELEGATE_CAPI_H_
#define CEF_INCLUDE_CAPI_VIEWS_CEF_MENU_BUTTON_DELEGATE_CAPI_H_
#pragma once
#include "include/capi/views/cef_button_delegate_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
struct _cef_menu_button_t;
///
// Implement this structure to handle MenuButton events. The functions of this
// structure will be called on the browser process UI thread unless otherwise
// indicated.
///
typedef struct _cef_menu_button_delegate_t {
///
// Base structure.
///
cef_button_delegate_t base;
///
// Called when |button| is pressed. Call cef_menu_button_t::show_menu() to
// show the resulting menu at |screen_point|.
///
void (CEF_CALLBACK *on_menu_button_pressed)(
struct _cef_menu_button_delegate_t* self,
struct _cef_menu_button_t* menu_button,
const cef_point_t* screen_point);
} cef_menu_button_delegate_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_VIEWS_CEF_MENU_BUTTON_DELEGATE_CAPI_H_

View File

@ -0,0 +1,149 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_PANEL_CAPI_H_
#define CEF_INCLUDE_CAPI_VIEWS_CEF_PANEL_CAPI_H_
#pragma once
#include "include/capi/views/cef_panel_delegate_capi.h"
#include "include/capi/views/cef_view_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
struct _cef_box_layout_t;
struct _cef_fill_layout_t;
struct _cef_layout_t;
struct _cef_window_t;
///
// A Panel is a container in the views hierarchy that can contain other Views as
// children. Methods must be called on the browser process UI thread unless
// otherwise indicated.
///
typedef struct _cef_panel_t {
///
// Base structure.
///
cef_view_t base;
///
// Returns this Panel as a Window or NULL if this is not a Window.
///
struct _cef_window_t* (CEF_CALLBACK *as_window)(struct _cef_panel_t* self);
///
// Set this Panel's Layout to FillLayout and return the FillLayout object.
///
struct _cef_fill_layout_t* (CEF_CALLBACK *set_to_fill_layout)(
struct _cef_panel_t* self);
///
// Set this Panel's Layout to BoxLayout and return the BoxLayout object.
///
struct _cef_box_layout_t* (CEF_CALLBACK *set_to_box_layout)(
struct _cef_panel_t* self,
const struct _cef_box_layout_settings_t* settings);
///
// Get the Layout.
///
struct _cef_layout_t* (CEF_CALLBACK *get_layout)(struct _cef_panel_t* self);
///
// Lay out the child Views (set their bounds based on sizing heuristics
// specific to the current Layout).
///
void (CEF_CALLBACK *layout)(struct _cef_panel_t* self);
///
// Add a child View.
///
void (CEF_CALLBACK *add_child_view)(struct _cef_panel_t* self,
struct _cef_view_t* view);
///
// Add a child View at the specified |index|. If |index| matches the result of
// GetChildCount() then the View will be added at the end.
///
void (CEF_CALLBACK *add_child_view_at)(struct _cef_panel_t* self,
struct _cef_view_t* view, int index);
///
// Move the child View to the specified |index|. A negative value for |index|
// will move the View to the end.
///
void (CEF_CALLBACK *reorder_child_view)(struct _cef_panel_t* self,
struct _cef_view_t* view, int index);
///
// Remove a child View. The View can then be added to another Panel.
///
void (CEF_CALLBACK *remove_child_view)(struct _cef_panel_t* self,
struct _cef_view_t* view);
///
// Remove all child Views. The removed Views will be deleted if the client
// holds no references to them.
///
void (CEF_CALLBACK *remove_all_child_views)(struct _cef_panel_t* self);
///
// Returns the number of child Views.
///
size_t (CEF_CALLBACK *get_child_view_count)(struct _cef_panel_t* self);
///
// Returns the child View at the specified |index|.
///
struct _cef_view_t* (CEF_CALLBACK *get_child_view_at)(
struct _cef_panel_t* self, int index);
} cef_panel_t;
///
// Create a new Panel.
///
CEF_EXPORT cef_panel_t* cef_panel_create(
struct _cef_panel_delegate_t* delegate);
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_VIEWS_CEF_PANEL_CAPI_H_

View File

@ -0,0 +1,65 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_PANEL_DELEGATE_CAPI_H_
#define CEF_INCLUDE_CAPI_VIEWS_CEF_PANEL_DELEGATE_CAPI_H_
#pragma once
#include "include/capi/views/cef_view_delegate_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
///
// Implement this structure to handle Panel events. The functions of this
// structure will be called on the browser process UI thread unless otherwise
// indicated.
///
typedef struct _cef_panel_delegate_t {
///
// Base structure.
///
cef_view_delegate_t base;
} cef_panel_delegate_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_VIEWS_CEF_PANEL_DELEGATE_CAPI_H_

View File

@ -0,0 +1,113 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_SCROLL_VIEW_CAPI_H_
#define CEF_INCLUDE_CAPI_VIEWS_CEF_SCROLL_VIEW_CAPI_H_
#pragma once
#include "include/capi/views/cef_view_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
///
// A ScrollView will show horizontal and/or vertical scrollbars when necessary
// based on the size of the attached content view. Methods must be called on the
// browser process UI thread unless otherwise indicated.
///
typedef struct _cef_scroll_view_t {
///
// Base structure.
///
cef_view_t base;
///
// Set the content View. The content View must have a specified size (e.g. via
// cef_view_t::SetBounds or cef_view_tDelegate::GetPreferredSize).
///
void (CEF_CALLBACK *set_content_view)(struct _cef_scroll_view_t* self,
struct _cef_view_t* view);
///
// Returns the content View.
///
struct _cef_view_t* (CEF_CALLBACK *get_content_view)(
struct _cef_scroll_view_t* self);
///
// Returns the visible region of the content View.
///
cef_rect_t (CEF_CALLBACK *get_visible_content_rect)(
struct _cef_scroll_view_t* self);
///
// Returns true (1) if the horizontal scrollbar is currently showing.
///
int (CEF_CALLBACK *has_horizontal_scrollbar)(struct _cef_scroll_view_t* self);
///
// Returns the height of the horizontal scrollbar.
///
int (CEF_CALLBACK *get_horizontal_scrollbar_height)(
struct _cef_scroll_view_t* self);
///
// Returns true (1) if the vertical scrollbar is currently showing.
///
int (CEF_CALLBACK *has_vertical_scrollbar)(struct _cef_scroll_view_t* self);
///
// Returns the width of the vertical scrollbar.
///
int (CEF_CALLBACK *get_vertical_scrollbar_width)(
struct _cef_scroll_view_t* self);
} cef_scroll_view_t;
///
// Create a new ScrollView.
///
CEF_EXPORT cef_scroll_view_t* cef_scroll_view_create(
struct _cef_view_delegate_t* delegate);
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_VIEWS_CEF_SCROLL_VIEW_CAPI_H_

View File

@ -0,0 +1,279 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_TEXTFIELD_CAPI_H_
#define CEF_INCLUDE_CAPI_VIEWS_CEF_TEXTFIELD_CAPI_H_
#pragma once
#include "include/capi/views/cef_textfield_delegate_capi.h"
#include "include/capi/views/cef_view_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
///
// A Textfield supports editing of text. This control is custom rendered with no
// platform-specific code. Methods must be called on the browser process UI
// thread unless otherwise indicated.
///
typedef struct _cef_textfield_t {
///
// Base structure.
///
cef_view_t base;
///
// Sets whether the text will be displayed as asterisks.
///
void (CEF_CALLBACK *set_password_input)(struct _cef_textfield_t* self,
int password_input);
///
// Returns true (1) if the text will be displayed as asterisks.
///
int (CEF_CALLBACK *is_password_input)(struct _cef_textfield_t* self);
///
// Sets whether the text will read-only.
///
void (CEF_CALLBACK *set_read_only)(struct _cef_textfield_t* self,
int read_only);
///
// Returns true (1) if the text is read-only.
///
int (CEF_CALLBACK *is_read_only)(struct _cef_textfield_t* self);
///
// Returns the currently displayed text.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_text)(struct _cef_textfield_t* self);
///
// Sets the contents to |text|. The cursor will be moved to end of the text if
// the current position is outside of the text range.
///
void (CEF_CALLBACK *set_text)(struct _cef_textfield_t* self,
const cef_string_t* text);
///
// Appends |text| to the previously-existing text.
///
void (CEF_CALLBACK *append_text)(struct _cef_textfield_t* self,
const cef_string_t* text);
///
// Inserts |text| at the current cursor position replacing any selected text.
///
void (CEF_CALLBACK *insert_or_replace_text)(struct _cef_textfield_t* self,
const cef_string_t* text);
///
// Returns true (1) if there is any selected text.
///
int (CEF_CALLBACK *has_selection)(struct _cef_textfield_t* self);
///
// Returns the currently selected text.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_selected_text)(
struct _cef_textfield_t* self);
///
// Selects all text. If |reversed| is true (1) the range will end at the
// logical beginning of the text; this generally shows the leading portion of
// text that overflows its display area.
///
void (CEF_CALLBACK *select_all)(struct _cef_textfield_t* self, int reversed);
///
// Clears the text selection and sets the caret to the end.
///
void (CEF_CALLBACK *clear_selection)(struct _cef_textfield_t* self);
///
// Returns the selected logical text range.
///
cef_range_t (CEF_CALLBACK *get_selected_range)(struct _cef_textfield_t* self);
///
// Selects the specified logical text range.
///
void (CEF_CALLBACK *select_range)(struct _cef_textfield_t* self,
const cef_range_t* range);
///
// Returns the current cursor position.
///
size_t (CEF_CALLBACK *get_cursor_position)(struct _cef_textfield_t* self);
///
// Sets the text color.
///
void (CEF_CALLBACK *set_text_color)(struct _cef_textfield_t* self,
cef_color_t color);
///
// Returns the text color.
///
cef_color_t (CEF_CALLBACK *get_text_color)(struct _cef_textfield_t* self);
///
// Sets the selection text color.
///
void (CEF_CALLBACK *set_selection_text_color)(struct _cef_textfield_t* self,
cef_color_t color);
///
// Returns the selection text color.
///
cef_color_t (CEF_CALLBACK *get_selection_text_color)(
struct _cef_textfield_t* self);
///
// Sets the selection background color.
///
void (CEF_CALLBACK *set_selection_background_color)(
struct _cef_textfield_t* self, cef_color_t color);
///
// Returns the selection background color.
///
cef_color_t (CEF_CALLBACK *get_selection_background_color)(
struct _cef_textfield_t* self);
///
// Sets the font list. The format is "<FONT_FAMILY_LIST>,[STYLES] <SIZE>",
// where: - FONT_FAMILY_LIST is a comma-separated list of font family names, -
// STYLES is an optional space-separated list of style names (case-sensitive
// "Bold" and "Italic" are supported), and
// - SIZE is an integer font size in pixels with the suffix "px".
//
// Here are examples of valid font description strings: - "Arial, Helvetica,
// Bold Italic 14px" - "Arial, 14px"
///
void (CEF_CALLBACK *set_font_list)(struct _cef_textfield_t* self,
const cef_string_t* font_list);
///
// Applies |color| to the specified |range| without changing the default
// color. If |range| is NULL the color will be set on the complete text
// contents.
///
void (CEF_CALLBACK *apply_text_color)(struct _cef_textfield_t* self,
cef_color_t color, const cef_range_t* range);
///
// Applies |style| to the specified |range| without changing the default
// style. If |add| is true (1) the style will be added, otherwise the style
// will be removed. If |range| is NULL the style will be set on the complete
// text contents.
///
void (CEF_CALLBACK *apply_text_style)(struct _cef_textfield_t* self,
cef_text_style_t style, int add, const cef_range_t* range);
///
// Returns true (1) if the action associated with the specified command id is
// enabled. See additional comments on execute_command().
///
int (CEF_CALLBACK *is_command_enabled)(struct _cef_textfield_t* self,
int command_id);
///
// Performs the action associated with the specified command id. Valid values
// include IDS_APP_UNDO, IDS_APP_REDO, IDS_APP_CUT, IDS_APP_COPY,
// IDS_APP_PASTE, IDS_APP_DELETE, IDS_APP_SELECT_ALL, IDS_DELETE_* and
// IDS_MOVE_*. See include/cef_pack_strings.h for definitions.
///
void (CEF_CALLBACK *execute_command)(struct _cef_textfield_t* self,
int command_id);
///
// Clears Edit history.
///
void (CEF_CALLBACK *clear_edit_history)(struct _cef_textfield_t* self);
///
// Sets the placeholder text that will be displayed when the Textfield is
// NULL.
///
void (CEF_CALLBACK *set_placeholder_text)(struct _cef_textfield_t* self,
const cef_string_t* text);
///
// Returns the placeholder text that will be displayed when the Textfield is
// NULL.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_placeholder_text)(
struct _cef_textfield_t* self);
///
// Sets the placeholder text color.
///
void (CEF_CALLBACK *set_placeholder_text_color)(struct _cef_textfield_t* self,
cef_color_t color);
///
// Returns the placeholder text color.
///
cef_color_t (CEF_CALLBACK *get_placeholder_text_color)(
struct _cef_textfield_t* self);
///
// Set the accessible name that will be exposed to assistive technology (AT).
///
void (CEF_CALLBACK *set_accessible_name)(struct _cef_textfield_t* self,
const cef_string_t* name);
} cef_textfield_t;
///
// Create a new Textfield.
///
CEF_EXPORT cef_textfield_t* cef_textfield_create(
struct _cef_textfield_delegate_t* delegate);
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_VIEWS_CEF_TEXTFIELD_CAPI_H_

View File

@ -0,0 +1,82 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_TEXTFIELD_DELEGATE_CAPI_H_
#define CEF_INCLUDE_CAPI_VIEWS_CEF_TEXTFIELD_DELEGATE_CAPI_H_
#pragma once
#include "include/capi/views/cef_view_delegate_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
struct _cef_textfield_t;
///
// Implement this structure to handle Textfield events. The functions of this
// structure will be called on the browser process UI thread unless otherwise
// indicated.
///
typedef struct _cef_textfield_delegate_t {
///
// Base structure.
///
cef_view_delegate_t base;
///
// Called when |textfield| recieves a keyboard event. |event| contains
// information about the keyboard event. Return true (1) if the keyboard event
// was handled or false (0) otherwise for default handling.
///
int (CEF_CALLBACK *on_key_event)(struct _cef_textfield_delegate_t* self,
struct _cef_textfield_t* textfield,
const struct _cef_key_event_t* event);
///
// Called after performing a user action that may change |textfield|.
///
void (CEF_CALLBACK *on_after_user_action)(
struct _cef_textfield_delegate_t* self,
struct _cef_textfield_t* textfield);
} cef_textfield_delegate_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_VIEWS_CEF_TEXTFIELD_DELEGATE_CAPI_H_

View File

@ -0,0 +1,374 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_VIEW_CAPI_H_
#define CEF_INCLUDE_CAPI_VIEWS_CEF_VIEW_CAPI_H_
#pragma once
#include "include/capi/views/cef_view_delegate_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
struct _cef_browser_view_t;
struct _cef_button_t;
struct _cef_panel_t;
struct _cef_scroll_view_t;
struct _cef_textfield_t;
struct _cef_window_t;
///
// A View is a rectangle within the views View hierarchy. It is the base
// structure for all Views. All size and position values are in density
// independent pixels (DIP) unless otherwise indicated. Methods must be called
// on the browser process UI thread unless otherwise indicated.
///
typedef struct _cef_view_t {
///
// Base structure.
///
cef_base_t base;
///
// Returns this View as a BrowserView or NULL if this is not a BrowserView.
///
struct _cef_browser_view_t* (CEF_CALLBACK *as_browser_view)(
struct _cef_view_t* self);
///
// Returns this View as a Button or NULL if this is not a Button.
///
struct _cef_button_t* (CEF_CALLBACK *as_button)(struct _cef_view_t* self);
///
// Returns this View as a Panel or NULL if this is not a Panel.
///
struct _cef_panel_t* (CEF_CALLBACK *as_panel)(struct _cef_view_t* self);
///
// Returns this View as a ScrollView or NULL if this is not a ScrollView.
///
struct _cef_scroll_view_t* (CEF_CALLBACK *as_scroll_view)(
struct _cef_view_t* self);
///
// Returns this View as a Textfield or NULL if this is not a Textfield.
///
struct _cef_textfield_t* (CEF_CALLBACK *as_textfield)(
struct _cef_view_t* self);
///
// Returns the type of this View as a string. Used primarily for testing
// purposes.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_type_string)(
struct _cef_view_t* self);
///
// Returns a string representation of this View which includes the type and
// various type-specific identifying attributes. If |include_children| is true
// (1) any child Views will also be included. Used primarily for testing
// purposes.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *to_string)(struct _cef_view_t* self,
int include_children);
///
// Returns true (1) if this View is valid.
///
int (CEF_CALLBACK *is_valid)(struct _cef_view_t* self);
///
// Returns true (1) if this View is currently attached to another View. A View
// can only be attached to one View at a time.
///
int (CEF_CALLBACK *is_attached)(struct _cef_view_t* self);
///
// Returns true (1) if this View is the same as |that| View.
///
int (CEF_CALLBACK *is_same)(struct _cef_view_t* self,
struct _cef_view_t* that);
///
// Returns the delegate associated with this View, if any.
///
struct _cef_view_delegate_t* (CEF_CALLBACK *get_delegate)(
struct _cef_view_t* self);
///
// Returns the top-level Window hosting this View, if any.
///
struct _cef_window_t* (CEF_CALLBACK *get_window)(struct _cef_view_t* self);
///
// Returns the ID for this View.
///
int (CEF_CALLBACK *get_id)(struct _cef_view_t* self);
///
// Sets the ID for this View. ID should be unique within the subtree that you
// intend to search for it. 0 is the default ID for views.
///
void (CEF_CALLBACK *set_id)(struct _cef_view_t* self, int id);
///
// Returns the View that contains this View, if any.
///
struct _cef_view_t* (CEF_CALLBACK *get_parent_view)(struct _cef_view_t* self);
///
// Recursively descends the view tree starting at this View, and returns the
// first child that it encounters with the given ID. Returns NULL if no
// matching child view is found.
///
struct _cef_view_t* (CEF_CALLBACK *get_view_for_id)(struct _cef_view_t* self,
int id);
///
// Sets the bounds (size and position) of this View. Position is in parent
// coordinates.
///
void (CEF_CALLBACK *set_bounds)(struct _cef_view_t* self,
const cef_rect_t* bounds);
///
// Returns the bounds (size and position) of this View. Position is in parent
// coordinates.
///
cef_rect_t (CEF_CALLBACK *get_bounds)(struct _cef_view_t* self);
///
// Returns the bounds (size and position) of this View. Position is in screen
// coordinates.
///
cef_rect_t (CEF_CALLBACK *get_bounds_in_screen)(struct _cef_view_t* self);
///
// Sets the size of this View without changing the position.
///
void (CEF_CALLBACK *set_size)(struct _cef_view_t* self,
const cef_size_t* size);
///
// Returns the size of this View.
///
cef_size_t (CEF_CALLBACK *get_size)(struct _cef_view_t* self);
///
// Sets the position of this View without changing the size. |position| is in
// parent coordinates.
///
void (CEF_CALLBACK *set_position)(struct _cef_view_t* self,
const cef_point_t* position);
///
// Returns the position of this View. Position is in parent coordinates.
///
cef_point_t (CEF_CALLBACK *get_position)(struct _cef_view_t* self);
///
// Returns the size this View would like to be if enough space is available.
///
cef_size_t (CEF_CALLBACK *get_preferred_size)(struct _cef_view_t* self);
///
// Size this View to its preferred size.
///
void (CEF_CALLBACK *size_to_preferred_size)(struct _cef_view_t* self);
///
// Returns the minimum size for this View.
///
cef_size_t (CEF_CALLBACK *get_minimum_size)(struct _cef_view_t* self);
///
// Returns the maximum size for this View.
///
cef_size_t (CEF_CALLBACK *get_maximum_size)(struct _cef_view_t* self);
///
// Returns the height necessary to display this View with the provided width.
///
int (CEF_CALLBACK *get_height_for_width)(struct _cef_view_t* self, int width);
///
// Indicate that this View and all parent Views require a re-layout. This
// ensures the next call to layout() will propagate to this View even if the
// bounds of parent Views do not change.
///
void (CEF_CALLBACK *invalidate_layout)(struct _cef_view_t* self);
///
// Sets whether this View is visible. Windows are hidden by default and other
// views are visible by default. This View and any parent views must be set as
// visible for this View to be drawn in a Window. If this View is set as
// hidden then it and any child views will not be drawn and, if any of those
// views currently have focus, then focus will also be cleared. Painting is
// scheduled as needed. If this View is a Window then calling this function is
// equivalent to calling the Window show() and hide() functions.
///
void (CEF_CALLBACK *set_visible)(struct _cef_view_t* self, int visible);
///
// Returns whether this View is visible. A view may be visible but still not
// drawn in a Window if any parent views are hidden. If this View is a Window
// then a return value of true (1) indicates that this Window is currently
// visible to the user on-screen. If this View is not a Window then call
// is_drawn() to determine whether this View and all parent views are visible
// and will be drawn.
///
int (CEF_CALLBACK *is_visible)(struct _cef_view_t* self);
///
// Returns whether this View is visible and drawn in a Window. A view is drawn
// if it and all parent views are visible. If this View is a Window then
// calling this function is equivalent to calling is_visible(). Otherwise, to
// determine if the containing Window is visible to the user on-screen call
// is_visible() on the Window.
///
int (CEF_CALLBACK *is_drawn)(struct _cef_view_t* self);
///
// Set whether this View is enabled. A disabled View does not receive keyboard
// or mouse inputs. If |enabled| differs from the current value the View will
// be repainted. Also, clears focus if the focused View is disabled.
///
void (CEF_CALLBACK *set_enabled)(struct _cef_view_t* self, int enabled);
///
// Returns whether this View is enabled.
///
int (CEF_CALLBACK *is_enabled)(struct _cef_view_t* self);
///
// Sets whether this View is capable of taking focus. It will clear focus if
// the focused View is set to be non-focusable. This is false (0) by default
// so that a View used as a container does not get the focus.
///
void (CEF_CALLBACK *set_focusable)(struct _cef_view_t* self, int focusable);
///
// Returns true (1) if this View is focusable, enabled and drawn.
///
int (CEF_CALLBACK *is_focusable)(struct _cef_view_t* self);
///
// Return whether this View is focusable when the user requires full keyboard
// access, even though it may not be normally focusable.
///
int (CEF_CALLBACK *is_accessibility_focusable)(struct _cef_view_t* self);
///
// Request keyboard focus. If this View is focusable it will become the
// focused View.
///
void (CEF_CALLBACK *request_focus)(struct _cef_view_t* self);
///
// Sets the background color for this View.
///
void (CEF_CALLBACK *set_background_color)(struct _cef_view_t* self,
cef_color_t color);
///
// Returns the background color for this View.
///
cef_color_t (CEF_CALLBACK *get_background_color)(struct _cef_view_t* self);
///
// Convert |point| from this View's coordinate system to that of the screen.
// This View must belong to a Window when calling this function. Returns true
// (1) if the conversion is successful or false (0) otherwise. Use
// cef_display_t::convert_point_to_pixels() after calling this function if
// further conversion to display-specific pixel coordinates is desired.
///
int (CEF_CALLBACK *convert_point_to_screen)(struct _cef_view_t* self,
cef_point_t* point);
///
// Convert |point| to this View's coordinate system from that of the screen.
// This View must belong to a Window when calling this function. Returns true
// (1) if the conversion is successful or false (0) otherwise. Use
// cef_display_t::convert_point_from_pixels() before calling this function if
// conversion from display-specific pixel coordinates is necessary.
///
int (CEF_CALLBACK *convert_point_from_screen)(struct _cef_view_t* self,
cef_point_t* point);
///
// Convert |point| from this View's coordinate system to that of the Window.
// This View must belong to a Window when calling this function. Returns true
// (1) if the conversion is successful or false (0) otherwise.
///
int (CEF_CALLBACK *convert_point_to_window)(struct _cef_view_t* self,
cef_point_t* point);
///
// Convert |point| to this View's coordinate system from that of the Window.
// This View must belong to a Window when calling this function. Returns true
// (1) if the conversion is successful or false (0) otherwise.
///
int (CEF_CALLBACK *convert_point_from_window)(struct _cef_view_t* self,
cef_point_t* point);
///
// Convert |point| from this View's coordinate system to that of |view|.
// |view| needs to be in the same Window but not necessarily the same view
// hierarchy. Returns true (1) if the conversion is successful or false (0)
// otherwise.
///
int (CEF_CALLBACK *convert_point_to_view)(struct _cef_view_t* self,
struct _cef_view_t* view, cef_point_t* point);
///
// Convert |point| to this View's coordinate system from that |view|. |view|
// needs to be in the same Window but not necessarily the same view hierarchy.
// Returns true (1) if the conversion is successful or false (0) otherwise.
///
int (CEF_CALLBACK *convert_point_from_view)(struct _cef_view_t* self,
struct _cef_view_t* view, cef_point_t* point);
} cef_view_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_VIEWS_CEF_VIEW_CAPI_H_

View File

@ -0,0 +1,115 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_VIEW_DELEGATE_CAPI_H_
#define CEF_INCLUDE_CAPI_VIEWS_CEF_VIEW_DELEGATE_CAPI_H_
#pragma once
#include "include/capi/cef_base_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
struct _cef_view_t;
///
// Implement this structure to handle view events. The functions of this
// structure will be called on the browser process UI thread unless otherwise
// indicated.
///
typedef struct _cef_view_delegate_t {
///
// Base structure.
///
cef_base_t base;
///
// Return the preferred size for |view|. The Layout will use this information
// to determine the display size.
///
cef_size_t (CEF_CALLBACK *get_preferred_size)(
struct _cef_view_delegate_t* self, struct _cef_view_t* view);
///
// Return the minimum size for |view|.
///
cef_size_t (CEF_CALLBACK *get_minimum_size)(struct _cef_view_delegate_t* self,
struct _cef_view_t* view);
///
// Return the maximum size for |view|.
///
cef_size_t (CEF_CALLBACK *get_maximum_size)(struct _cef_view_delegate_t* self,
struct _cef_view_t* view);
///
// Return the height necessary to display |view| with the provided |width|. If
// not specified the result of get_preferred_size().height will be used by
// default. Override if |view|'s preferred height depends upon the width (for
// example, with Labels).
///
int (CEF_CALLBACK *get_height_for_width)(struct _cef_view_delegate_t* self,
struct _cef_view_t* view, int width);
///
// Called when the parent of |view| has changed. If |view| is being added to
// |parent| then |added| will be true (1). If |view| is being removed from
// |parent| then |added| will be false (0). If |view| is being reparented the
// remove notification will be sent before the add notification. Do not modify
// the view hierarchy in this callback.
///
void (CEF_CALLBACK *on_parent_view_changed)(struct _cef_view_delegate_t* self,
struct _cef_view_t* view, int added, struct _cef_view_t* parent);
///
// Called when a child of |view| has changed. If |child| is being added to
// |view| then |added| will be true (1). If |child| is being removed from
// |view| then |added| will be false (0). If |child| is being reparented the
// remove notification will be sent to the old parent before the add
// notification is sent to the new parent. Do not modify the view hierarchy in
// this callback.
///
void (CEF_CALLBACK *on_child_view_changed)(struct _cef_view_delegate_t* self,
struct _cef_view_t* view, int added, struct _cef_view_t* child);
} cef_view_delegate_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_VIEWS_CEF_VIEW_DELEGATE_CAPI_H_

View File

@ -0,0 +1,286 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_CAPI_H_
#define CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_CAPI_H_
#pragma once
#include "include/capi/cef_image_capi.h"
#include "include/capi/cef_menu_model_capi.h"
#include "include/capi/views/cef_display_capi.h"
#include "include/capi/views/cef_panel_capi.h"
#include "include/capi/views/cef_window_delegate_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
///
// A Window is a top-level Window/widget in the Views hierarchy. By default it
// will have a non-client area with title bar, icon and buttons that supports
// moving and resizing. All size and position values are in density independent
// pixels (DIP) unless otherwise indicated. Methods must be called on the
// browser process UI thread unless otherwise indicated.
///
typedef struct _cef_window_t {
///
// Base structure.
///
cef_panel_t base;
///
// Show the Window.
///
void (CEF_CALLBACK *show)(struct _cef_window_t* self);
///
// Hide the Window.
///
void (CEF_CALLBACK *hide)(struct _cef_window_t* self);
///
// Sizes the Window to |size| and centers it in the current display.
///
void (CEF_CALLBACK *center_window)(struct _cef_window_t* self,
const cef_size_t* size);
///
// Close the Window.
///
void (CEF_CALLBACK *close)(struct _cef_window_t* self);
///
// Returns true (1) if the Window has been closed.
///
int (CEF_CALLBACK *is_closed)(struct _cef_window_t* self);
///
// Activate the Window, assuming it already exists and is visible.
///
void (CEF_CALLBACK *activate)(struct _cef_window_t* self);
///
// Deactivate the Window, making the next Window in the Z order the active
// Window.
///
void (CEF_CALLBACK *deactivate)(struct _cef_window_t* self);
///
// Returns whether the Window is the currently active Window.
///
int (CEF_CALLBACK *is_active)(struct _cef_window_t* self);
///
// Bring this Window to the top of other Windows in the Windowing system.
///
void (CEF_CALLBACK *bring_to_top)(struct _cef_window_t* self);
///
// Set the Window to be on top of other Windows in the Windowing system.
///
void (CEF_CALLBACK *set_always_on_top)(struct _cef_window_t* self,
int on_top);
///
// Returns whether the Window has been set to be on top of other Windows in
// the Windowing system.
///
int (CEF_CALLBACK *is_always_on_top)(struct _cef_window_t* self);
///
// Maximize the Window.
///
void (CEF_CALLBACK *maximize)(struct _cef_window_t* self);
///
// Minimize the Window.
///
void (CEF_CALLBACK *minimize)(struct _cef_window_t* self);
///
// Restore the Window.
///
void (CEF_CALLBACK *restore)(struct _cef_window_t* self);
///
// Set fullscreen Window state.
///
void (CEF_CALLBACK *set_fullscreen)(struct _cef_window_t* self,
int fullscreen);
///
// Returns true (1) if the Window is maximized.
///
int (CEF_CALLBACK *is_maximized)(struct _cef_window_t* self);
///
// Returns true (1) if the Window is minimized.
///
int (CEF_CALLBACK *is_minimized)(struct _cef_window_t* self);
///
// Returns true (1) if the Window is fullscreen.
///
int (CEF_CALLBACK *is_fullscreen)(struct _cef_window_t* self);
///
// Set the Window title.
///
void (CEF_CALLBACK *set_title)(struct _cef_window_t* self,
const cef_string_t* title);
///
// Get the Window title.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_title)(struct _cef_window_t* self);
///
// Set the Window icon. This should be a 16x16 icon suitable for use in the
// Windows's title bar.
///
void (CEF_CALLBACK *set_window_icon)(struct _cef_window_t* self,
struct _cef_image_t* image);
///
// Get the Window icon.
///
struct _cef_image_t* (CEF_CALLBACK *get_window_icon)(
struct _cef_window_t* self);
///
// Set the Window App icon. This should be a larger icon for use in the host
// environment app switching UI. On Windows, this is the ICON_BIG used in Alt-
// Tab list and Windows taskbar. The Window icon will be used by default if no
// Window App icon is specified.
///
void (CEF_CALLBACK *set_window_app_icon)(struct _cef_window_t* self,
struct _cef_image_t* image);
///
// Get the Window App icon.
///
struct _cef_image_t* (CEF_CALLBACK *get_window_app_icon)(
struct _cef_window_t* self);
///
// Show a menu with contents |menu_model|. |screen_point| specifies the menu
// position in screen coordinates. |anchor_position| specifies how the menu
// will be anchored relative to |screen_point|.
///
void (CEF_CALLBACK *show_menu)(struct _cef_window_t* self,
struct _cef_menu_model_t* menu_model, const cef_point_t* screen_point,
cef_menu_anchor_position_t anchor_position);
///
// Cancel the menu that is currently showing, if any.
///
void (CEF_CALLBACK *cancel_menu)(struct _cef_window_t* self);
///
// Returns the Display that most closely intersects the bounds of this Window.
// May return NULL if this Window is not currently displayed.
///
struct _cef_display_t* (CEF_CALLBACK *get_display)(
struct _cef_window_t* self);
///
// Returns the bounds (size and position) of this Window's client area.
// Position is in screen coordinates.
///
cef_rect_t (CEF_CALLBACK *get_client_area_bounds_in_screen)(
struct _cef_window_t* self);
///
// Set the regions where mouse events will be intercepted by this Window to
// support drag operations. Call this function with an NULL vector to clear
// the draggable regions. The draggable region bounds should be in window
// coordinates.
///
void (CEF_CALLBACK *set_draggable_regions)(struct _cef_window_t* self,
size_t regionsCount, cef_draggable_region_t const* regions);
///
// Retrieve the platform window handle for this Window.
///
cef_window_handle_t (CEF_CALLBACK *get_window_handle)(
struct _cef_window_t* self);
///
// Simulate a key press. |key_code| is the VKEY_* value from Chromium's
// ui/events/keycodes/keyboard_codes.h header (VK_* values on Windows).
// |event_flags| is some combination of EVENTFLAG_SHIFT_DOWN,
// EVENTFLAG_CONTROL_DOWN and/or EVENTFLAG_ALT_DOWN. This function is exposed
// primarily for testing purposes.
///
void (CEF_CALLBACK *send_key_press)(struct _cef_window_t* self, int key_code,
uint32 event_flags);
///
// Simulate a mouse move. The mouse cursor will be moved to the specified
// (screen_x, screen_y) position. This function is exposed primarily for
// testing purposes.
///
void (CEF_CALLBACK *send_mouse_move)(struct _cef_window_t* self, int screen_x,
int screen_y);
///
// Simulate mouse down and/or mouse up events. |button| is the mouse button
// type. If |mouse_down| is true (1) a mouse down event will be sent. If
// |mouse_up| is true (1) a mouse up event will be sent. If both are true (1)
// a mouse down event will be sent followed by a mouse up event (equivalent to
// clicking the mouse button). The events will be sent using the current
// cursor position so make sure to call send_mouse_move() first to position
// the mouse. This function is exposed primarily for testing purposes.
///
void (CEF_CALLBACK *send_mouse_events)(struct _cef_window_t* self,
cef_mouse_button_type_t button, int mouse_down, int mouse_up);
} cef_window_t;
///
// Create a new Window.
///
CEF_EXPORT cef_window_t* cef_window_create_top_level(
struct _cef_window_delegate_t* delegate);
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_CAPI_H_

View File

@ -0,0 +1,113 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_DELEGATE_CAPI_H_
#define CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_DELEGATE_CAPI_H_
#pragma once
#include "include/capi/views/cef_panel_delegate_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
struct _cef_window_t;
///
// Implement this structure to handle window events. The functions of this
// structure will be called on the browser process UI thread unless otherwise
// indicated.
///
typedef struct _cef_window_delegate_t {
///
// Base structure.
///
cef_panel_delegate_t base;
///
// Called when |window| is created.
///
void (CEF_CALLBACK *on_window_created)(struct _cef_window_delegate_t* self,
struct _cef_window_t* window);
///
// Called when |window| is destroyed. Release all references to |window| and
// do not attempt to execute any functions on |window| after this callback
// returns.
///
void (CEF_CALLBACK *on_window_destroyed)(struct _cef_window_delegate_t* self,
struct _cef_window_t* window);
///
// Return true (1) if |window| should be created without a frame or title bar.
// The window will be resizable if can_resize() returns true (1). Use
// cef_window_t::set_draggable_regions() to specify draggable regions.
///
int (CEF_CALLBACK *is_frameless)(struct _cef_window_delegate_t* self,
struct _cef_window_t* window);
///
// Return true (1) if |window| can be resized.
///
int (CEF_CALLBACK *can_resize)(struct _cef_window_delegate_t* self,
struct _cef_window_t* window);
///
// Return true (1) if |window| can be maximized.
///
int (CEF_CALLBACK *can_maximize)(struct _cef_window_delegate_t* self,
struct _cef_window_t* window);
///
// Return true (1) if |window| can be minimized.
///
int (CEF_CALLBACK *can_minimize)(struct _cef_window_delegate_t* self,
struct _cef_window_t* window);
///
// Return true (1) if |window| can be closed. This will be called for user-
// initiated window close actions and when cef_window_t::close() is called.
///
int (CEF_CALLBACK *can_close)(struct _cef_window_delegate_t* self,
struct _cef_window_t* window);
} cef_window_delegate_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_DELEGATE_CAPI_H_

View File

@ -41,6 +41,7 @@
#include "include/cef_base.h" #include "include/cef_base.h"
#include "include/cef_drag_data.h" #include "include/cef_drag_data.h"
#include "include/cef_frame.h" #include "include/cef_frame.h"
#include "include/cef_image.h"
#include "include/cef_navigation_entry.h" #include "include/cef_navigation_entry.h"
#include "include/cef_process_message.h" #include "include/cef_process_message.h"
#include "include/cef_request_context.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 // 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 // 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()--*/ /*--cef()--*/
virtual void CloseBrowser(bool force_close) =0; 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. // Set whether the browser is focused.
/// ///
@ -328,19 +361,28 @@ class CefBrowserHost : public virtual CefBase {
virtual void SetWindowVisibility(bool visible) =0; 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()--*/ /*--cef()--*/
virtual CefWindowHandle GetWindowHandle() =0; virtual CefWindowHandle GetWindowHandle() =0;
/// ///
// Retrieve the window handle of the browser that opened this browser. Will // 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 // return NULL for non-popup windows or if this browser is wrapped in a
// with custom handling of modal windows. // CefBrowserView. This method can be used in combination with custom handling
// of modal windows.
/// ///
/*--cef()--*/ /*--cef()--*/
virtual CefWindowHandle GetOpenerWindowHandle() =0; 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. // Returns the client for this browser.
/// ///
@ -400,6 +442,25 @@ class CefBrowserHost : public virtual CefBase {
/*--cef()--*/ /*--cef()--*/
virtual void StartDownload(const CefString& url) =0; 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. // 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- // 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)--*/ /*--cef(optional_param=inspect_element_at)--*/
virtual void ShowDevTools(const CefWindowInfo& windowInfo, virtual void ShowDevTools(const CefWindowInfo& windowInfo,

191
include/cef_image.h Normal file
View File

@ -0,0 +1,191 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_CEF_IMAGE_H_
#define CEF_INCLUDE_CEF_IMAGE_H_
#pragma once
#include "include/cef_base.h"
#include "include/cef_values.h"
///
// Container for a single image represented at different scale factors. All
// image representations should be the same size in density independent pixel
// (DIP) units. For example, if the image at scale factor 1.0 is 100x100 pixels
// then the image at scale factor 2.0 should be 200x200 pixels -- both images
// will display with a DIP size of 100x100 units. The methods of this class must
// be called on the browser process UI thread.
///
/*--cef(source=library)--*/
class CefImage : public virtual CefBase {
public:
///
// Create a new CefImage. It will initially be empty. Use the Add*() methods
// to add representations at different scale factors.
///
/*--cef()--*/
static CefRefPtr<CefImage> CreateImage();
///
// Returns true if this Image is empty.
///
/*--cef()--*/
virtual bool IsEmpty() =0;
///
// Returns true if this Image and |that| Image share the same underlying
// storage. Will also return true if both images are empty.
///
/*--cef()--*/
virtual bool IsSame(CefRefPtr<CefImage> that) =0;
///
// Add a bitmap image representation for |scale_factor|. Only 32-bit RGBA/BGRA
// formats are supported. |pixel_width| and |pixel_height| are the bitmap
// representation size in pixel coordinates. |pixel_data| is the array of
// pixel data and should be |pixel_width| x |pixel_height| x 4 bytes in size.
// |color_type| and |alpha_type| values specify the pixel format.
///
/*--cef()--*/
virtual bool AddBitmap(float scale_factor,
int pixel_width,
int pixel_height,
cef_color_type_t color_type,
cef_alpha_type_t alpha_type,
const void* pixel_data,
size_t pixel_data_size) =0;
///
// Add a PNG image representation for |scale_factor|. |png_data| is the image
// data of size |png_data_size|. Any alpha transparency in the PNG data will
// be maintained.
///
/*--cef()--*/
virtual bool AddPNG(float scale_factor,
const void* png_data,
size_t png_data_size) =0;
///
// Create a JPEG image representation for |scale_factor|. |jpeg_data| is the
// image data of size |jpeg_data_size|. The JPEG format does not support
// transparency so the alpha byte will be set to 0xFF for all pixels.
///
/*--cef()--*/
virtual bool AddJPEG(float scale_factor,
const void* jpeg_data,
size_t jpeg_data_size) =0;
///
// Returns the image width in density independent pixel (DIP) units.
///
/*--cef()--*/
virtual size_t GetWidth() =0;
///
// Returns the image height in density independent pixel (DIP) units.
///
/*--cef()--*/
virtual size_t GetHeight() =0;
///
// Returns true if this image contains a representation for |scale_factor|.
///
/*--cef()--*/
virtual bool HasRepresentation(float scale_factor) =0;
///
// Removes the representation for |scale_factor|. Returns true on success.
///
/*--cef()--*/
virtual bool RemoveRepresentation(float scale_factor) =0;
///
// Returns information for the representation that most closely matches
// |scale_factor|. |actual_scale_factor| is the actual scale factor for the
// representation. |pixel_width| and |pixel_height| are the representation
// size in pixel coordinates. Returns true on success.
///
/*--cef()--*/
virtual bool GetRepresentationInfo(float scale_factor,
float& actual_scale_factor,
int& pixel_width,
int& pixel_height) =0;
///
// Returns the bitmap representation that most closely matches |scale_factor|.
// Only 32-bit RGBA/BGRA formats are supported. |color_type| and |alpha_type|
// values specify the desired output pixel format. |pixel_width| and
// |pixel_height| are the output representation size in pixel coordinates.
// Returns a CefBinaryValue containing the pixel data on success or NULL on
// failure.
///
/*--cef()--*/
virtual CefRefPtr<CefBinaryValue> GetAsBitmap(float scale_factor,
cef_color_type_t color_type,
cef_alpha_type_t alpha_type,
int& pixel_width,
int& pixel_height) =0;
///
// Returns the PNG representation that most closely matches |scale_factor|. If
// |with_transparency| is true any alpha transparency in the image will be
// represented in the resulting PNG data. |pixel_width| and |pixel_height| are
// the output representation size in pixel coordinates. Returns a
// CefBinaryValue containing the PNG image data on success or NULL on failure.
///
/*--cef()--*/
virtual CefRefPtr<CefBinaryValue> GetAsPNG(float scale_factor,
bool with_transparency,
int& pixel_width,
int& pixel_height) =0;
///
// Returns the JPEG representation that most closely matches |scale_factor|.
// |quality| determines the compression level with 0 == lowest and 100 ==
// highest. The JPEG format does not support alpha transparency and the alpha
// channel, if any, will be discarded. |pixel_width| and |pixel_height| are
// the output representation size in pixel coordinates. Returns a
// CefBinaryValue containing the JPEG image data on success or NULL on
// failure.
///
/*--cef()--*/
virtual CefRefPtr<CefBinaryValue> GetAsJPEG(float scale_factor,
int quality,
int& pixel_width,
int& pixel_height) =0;
};
#endif // CEF_INCLUDE_CEF_IMAGE_H_

View File

@ -69,7 +69,9 @@ class CefLifeSpanHandler : public virtual CefBase {
// browser return true. The |client| and |settings| values will default to the // browser return true. The |client| and |settings| values will default to the
// source browser's values. If the |no_javascript_access| value is set to // source browser's values. If the |no_javascript_access| value is set to
// false the new browser will not be scriptable and may not be hosted in the // false the new browser will not be scriptable and may not be hosted in the
// same renderer process as the source browser. // same renderer process as the source browser. Any modifications to
// |windowInfo| will be ignored if the parent browser is wrapped in a
// CefBrowserView.
/// ///
/*--cef(optional_param=target_url,optional_param=target_frame_name)--*/ /*--cef(optional_param=target_url,optional_param=target_frame_name)--*/
virtual bool OnBeforePopup(CefRefPtr<CefBrowser> browser, virtual bool OnBeforePopup(CefRefPtr<CefBrowser> browser,
@ -87,55 +89,80 @@ class CefLifeSpanHandler : public virtual CefBase {
} }
/// ///
// Called after a new browser is created. // Called after a new browser is created. This callback will be the first
// notification that references |browser|.
/// ///
/*--cef()--*/ /*--cef()--*/
virtual void OnAfterCreated(CefRefPtr<CefBrowser> browser) {} virtual void OnAfterCreated(CefRefPtr<CefBrowser> browser) {}
///
// Called when a modal window is about to display and the modal loop should
// begin running. Return false to use the default modal loop implementation or
// true to use a custom implementation.
///
/*--cef()--*/
virtual bool RunModal(CefRefPtr<CefBrowser> browser) { return false; }
/// ///
// Called when a browser has recieved a request to close. This may result // Called when a browser has recieved a request to close. This may result
// directly from a call to CefBrowserHost::CloseBrowser() or indirectly if the // directly from a call to CefBrowserHost::*CloseBrowser() or indirectly if
// browser is a top-level OS window created by CEF and the user attempts to // the browser is parented to a top-level window created by CEF and the user
// close the window. This method will be called after the JavaScript // attempts to close that window (by clicking the 'X', for example). The
// 'onunload' event has been fired. It will not be called for browsers after // DoClose() method will be called after the JavaScript 'onunload' event has
// the associated OS window has been destroyed (for those browsers it is no // been fired.
// longer possible to cancel the close).
// //
// If CEF created an OS window for the browser returning false will send an OS // An application should handle top-level owner window close notifications by
// close notification to the browser window's top-level owner (e.g. WM_CLOSE // calling CefBrowserHost::TryCloseBrowser() or
// on Windows, performClose: on OS-X and "delete_event" on Linux). If no OS // CefBrowserHost::CloseBrowser(false) instead of allowing the window to close
// window exists (window rendering disabled) returning false will cause the // immediately (see the examples below). This gives CEF an opportunity to
// browser object to be destroyed immediately. Return true if the browser is // process the 'onbeforeunload' event and optionally cancel the close before
// parented to another window and that other window needs to receive close // DoClose() is called.
// notification via some non-standard technique.
// //
// If an application provides its own top-level window it should handle OS // When windowed rendering is enabled CEF will internally create a window or
// close notifications by calling CefBrowserHost::CloseBrowser(false) instead // view to host the browser. In that case returning false from DoClose() will
// of immediately closing (see the example below). This gives CEF an // send the standard close notification to the browser's top-level owner
// opportunity to process the 'onbeforeunload' event and optionally cancel the // window (e.g. WM_CLOSE on Windows, performClose: on OS X, "delete_event" on
// close before DoClose() is called. // Linux or CefWindowDelegate::CanClose() callback from Views). If the
// browser's host window/view has already been destroyed (via view hierarchy
// tear-down, for example) then DoClose() will not be called for that browser
// since is no longer possible to cancel the close.
// //
// The CefLifeSpanHandler::OnBeforeClose() method will be called immediately // When windowed rendering is disabled returning false from DoClose() will
// before the browser object is destroyed. The application should only exit // cause the browser object to be destroyed immediately.
// after OnBeforeClose() has been called for all existing browsers.
// //
// If the browser represents a modal window and a custom modal loop // If the browser's top-level owner window requires a non-standard close
// implementation was provided in CefLifeSpanHandler::RunModal() this callback // notification then send that notification from DoClose() and return true.
// should be used to restore the opener window to a usable state.
// //
// By way of example consider what should happen during window close when the // The CefLifeSpanHandler::OnBeforeClose() method will be called after
// browser is parented to an application-provided top-level OS window. // DoClose() (if DoClose() is called) and immediately before the browser
// 1. User clicks the window close button which sends an OS close // object is destroyed. The application should only exit after OnBeforeClose()
// notification (e.g. WM_CLOSE on Windows, performClose: on OS-X and // has been called for all existing browsers.
// "delete_event" on Linux). //
// The below examples describe what should happen during window close when the
// browser is parented to an application-provided top-level window.
//
// Example 1: Using CefBrowserHost::TryCloseBrowser(). This is recommended for
// clients using standard close handling and windows created on the browser
// process UI thread.
// 1. User clicks the window close button which sends a close notification to
// the application's top-level window.
// 2. Application's top-level window receives the close notification and
// calls TryCloseBrowser() (which internally calls CloseBrowser(false)).
// TryCloseBrowser() returns false so the client cancels the window close.
// 3. JavaScript 'onbeforeunload' handler executes and shows the close
// confirmation dialog (which can be overridden via
// CefJSDialogHandler::OnBeforeUnloadDialog()).
// 4. User approves the close.
// 5. JavaScript 'onunload' handler executes.
// 6. CEF sends a close notification to the application's top-level window
// (because DoClose() returned false by default).
// 7. Application's top-level window receives the close notification and
// calls TryCloseBrowser(). TryCloseBrowser() returns true so the client
// allows the window close.
// 8. Application's top-level window is destroyed.
// 9. Application's OnBeforeClose() handler is called and the browser object
// is destroyed.
// 10. Application exits by calling CefQuitMessageLoop() if no other browsers
// exist.
//
// Example 2: Using CefBrowserHost::CloseBrowser(false) and implementing the
// DoClose() callback. This is recommended for clients using non-standard
// close handling or windows that were not created on the browser process UI
// thread.
// 1. User clicks the window close button which sends a close notification to
// the application's top-level window.
// 2. Application's top-level window receives the close notification and: // 2. Application's top-level window receives the close notification and:
// A. Calls CefBrowserHost::CloseBrowser(false). // A. Calls CefBrowserHost::CloseBrowser(false).
// B. Cancels the window close. // B. Cancels the window close.
@ -147,12 +174,12 @@ class CefLifeSpanHandler : public virtual CefBase {
// 6. Application's DoClose() handler is called. Application will: // 6. Application's DoClose() handler is called. Application will:
// A. Set a flag to indicate that the next close attempt will be allowed. // A. Set a flag to indicate that the next close attempt will be allowed.
// B. Return false. // B. Return false.
// 7. CEF sends an OS close notification. // 7. CEF sends an close notification to the application's top-level window.
// 8. Application's top-level window receives the OS close notification and // 8. Application's top-level window receives the close notification and
// allows the window to close based on the flag from #6B. // allows the window to close based on the flag from #6B.
// 9. Browser OS window is destroyed. // 9. Application's top-level window is destroyed.
// 10. Application's CefLifeSpanHandler::OnBeforeClose() handler is called and // 10. Application's OnBeforeClose() handler is called and the browser object
// the browser object is destroyed. // is destroyed.
// 11. Application exits by calling CefQuitMessageLoop() if no other browsers // 11. Application exits by calling CefQuitMessageLoop() if no other browsers
// exist. // exist.
/// ///
@ -162,9 +189,8 @@ class CefLifeSpanHandler : public virtual CefBase {
/// ///
// Called just before a browser is destroyed. Release all references to the // Called just before a browser is destroyed. Release all references to the
// browser object and do not attempt to execute any methods on the browser // browser object and do not attempt to execute any methods on the browser
// object after this callback returns. If this is a modal window and a custom // object after this callback returns. This callback will be the last
// modal loop implementation was provided in RunModal() this callback should // notification that references |browser|. See DoClose() documentation for
// be used to exit the custom modal loop. See DoClose() documentation for
// additional usage information. // additional usage information.
/// ///
/*--cef()--*/ /*--cef()--*/

View File

@ -39,6 +39,7 @@
#pragma once #pragma once
#include "include/cef_base.h" #include "include/cef_base.h"
#include "include/cef_menu_model_delegate.h"
/// ///
// Supports creation and modification of menus. See cef_menu_id_t for the // Supports creation and modification of menus. See cef_menu_id_t for the
@ -51,6 +52,13 @@ class CefMenuModel : public virtual CefBase {
public: public:
typedef cef_menu_item_type_t MenuItemType; typedef cef_menu_item_type_t MenuItemType;
///
// Create a new MenuModel with the specified |delegate|.
///
/*--cef()--*/
static CefRefPtr<CefMenuModel> CreateMenuModel(
CefRefPtr<CefMenuModelDelegate> delegate);
/// ///
// Clears the menu. Returns true on success. // Clears the menu. Returns true on success.
/// ///

View File

@ -0,0 +1,82 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_VIEWS_CEF_MENU_MODEL_DELEGATE_H_
#define CEF_INCLUDE_VIEWS_CEF_MENU_MODEL_DELEGATE_H_
#pragma once
#include "include/cef_base.h"
class CefMenuModel;
///
// Implement this interface to handle menu model events. The methods of this
// class will be called on the browser process UI thread unless otherwise
// indicated.
///
/*--cef(source=client)--*/
class CefMenuModelDelegate : public virtual CefBase {
public:
///
// Perform the action associated with the specified |command_id| and
// optional |event_flags|.
///
/*--cef()--*/
virtual void ExecuteCommand(CefRefPtr<CefMenuModel> menu_model,
int command_id,
cef_event_flags_t event_flags) =0;
///
// The menu is about to show.
///
/*--cef()--*/
virtual void MenuWillShow(CefRefPtr<CefMenuModel> menu_model) {};
///
// The menu has closed.
///
/*--cef()--*/
virtual void MenuClosed(CefRefPtr<CefMenuModel> menu_model) {};
///
// Optionally modify a menu item label. Return true if |label| was modified.
///
/*--cef()--*/
virtual bool FormatLabel(CefRefPtr<CefMenuModel> menu_model,
CefString& label) { return false; };
};
#endif // CEF_INCLUDE_VIEWS_CEF_MENU_MODEL_DELEGATE_H_

View File

@ -50,7 +50,7 @@ class CefPrintSettings : public virtual CefBase {
public: public:
typedef cef_color_model_t ColorModel; typedef cef_color_model_t ColorModel;
typedef cef_duplex_mode_t DuplexMode; typedef cef_duplex_mode_t DuplexMode;
typedef std::vector<CefPageRange> PageRangeList; typedef std::vector<CefRange> PageRangeList;
/// ///
// Create a new CefPrintSettings object. // Create a new CefPrintSettings object.

View File

@ -1284,6 +1284,24 @@ typedef struct _cef_size_t {
int height; int height;
} cef_size_t; } cef_size_t;
///
// Structure representing a range.
///
typedef struct _cef_range_t {
int from;
int to;
} cef_range_t;
///
// Structure representing insets.
///
typedef struct _cef_insets_t {
int top;
int left;
int bottom;
int right;
} cef_insets_t;
/// ///
// Structure representing a draggable region. // Structure representing a draggable region.
/// ///
@ -2033,14 +2051,6 @@ typedef enum {
DUPLEX_MODE_SHORT_EDGE, DUPLEX_MODE_SHORT_EDGE,
} cef_duplex_mode_t; } cef_duplex_mode_t;
///
// Structure representing a print job page range.
///
typedef struct _cef_page_range_t {
int from;
int to;
} cef_page_range_t;
/// ///
// Cursor type values. // Cursor type values.
/// ///
@ -2423,6 +2433,196 @@ typedef enum {
RESPONSE_FILTER_ERROR RESPONSE_FILTER_ERROR
} cef_response_filter_status_t; } cef_response_filter_status_t;
///
// Describes how to interpret the components of a pixel.
///
typedef enum {
///
// RGBA with 8 bits per pixel (32bits total).
///
CEF_COLOR_TYPE_RGBA_8888,
///
// BGRA with 8 bits per pixel (32bits total).
///
CEF_COLOR_TYPE_BGRA_8888,
} cef_color_type_t;
///
// Describes how to interpret the alpha component of a pixel.
///
typedef enum {
///
// No transparency. The alpha component is ignored.
///
CEF_ALPHA_TYPE_OPAQUE,
///
// Transparency with pre-multiplied alpha component.
///
CEF_ALPHA_TYPE_PREMULTIPLIED,
///
// Transparency with post-multiplied alpha component.
///
CEF_ALPHA_TYPE_POSTMULTIPLIED,
} cef_alpha_type_t;
///
// Text style types. Should be kepy in sync with gfx::TextStyle.
///
typedef enum {
CEF_TEXT_STYLE_BOLD,
CEF_TEXT_STYLE_ITALIC,
CEF_TEXT_STYLE_STRIKE,
CEF_TEXT_STYLE_DIAGONAL_STRIKE,
CEF_TEXT_STYLE_UNDERLINE,
} cef_text_style_t;
///
// Specifies where along the main axis the CefBoxLayout child views should be
// laid out.
///
typedef enum {
///
// Child views will be left-aligned.
///
CEF_MAIN_AXIS_ALIGNMENT_START,
///
// Child views will be center-aligned.
///
CEF_MAIN_AXIS_ALIGNMENT_CENTER,
///
// Child views will be right-aligned.
///
CEF_MAIN_AXIS_ALIGNMENT_END,
} cef_main_axis_alignment_t;
///
// Specifies where along the cross axis the CefBoxLayout child views should be
// laid out.
///
typedef enum {
///
// Child views will be stretched to fit.
///
CEF_CROSS_AXIS_ALIGNMENT_STRETCH,
///
// Child views will be left-aligned.
///
CEF_CROSS_AXIS_ALIGNMENT_START,
///
// Child views will be center-aligned.
///
CEF_CROSS_AXIS_ALIGNMENT_CENTER,
///
// Child views will be right-aligned.
///
CEF_CROSS_AXIS_ALIGNMENT_END,
} cef_cross_axis_alignment_t;
///
// Settings used when initializing a CefBoxLayout.
///
typedef struct _cef_box_layout_settings_t {
///
// If true (1) the layout will be horizontal, otherwise the layout will be
// vertical.
///
int horizontal;
///
// Adds additional horizontal space between the child view area and the host
// view border.
///
int inside_border_horizontal_spacing;
///
// Adds additional vertical space between the child view area and the host
// view border.
///
int inside_border_vertical_spacing;
///
// Adds additional space around the child view area.
///
cef_insets_t inside_border_insets;
///
// Adds additional space between child views.
///
int between_child_spacing;
///
// Specifies where along the main axis the child views should be laid out.
///
cef_main_axis_alignment_t main_axis_alignment;
///
// Specifies where along the cross axis the child views should be laid out.
///
cef_cross_axis_alignment_t cross_axis_alignment;
///
// Minimum cross axis size.
///
int minimum_cross_axis_size;
///
// Default flex for views when none is specified via CefBoxLayout methods.
// Using the preferred size as the basis, free space along the main axis is
// distributed to views in the ratio of their flex weights. Similarly, if the
// views will overflow the parent, space is subtracted in these ratios. A flex
// of 0 means this view is not resized. Flex values must not be negative.
///
int default_flex;
} cef_box_layout_settings_t;
///
// Specifies the button display state.
///
typedef enum {
CEF_BUTTON_STATE_NORMAL,
CEF_BUTTON_STATE_HOVERED,
CEF_BUTTON_STATE_PRESSED,
CEF_BUTTON_STATE_DISABLED,
} cef_button_state_t;
///
// Specifies the horizontal text alignment mode.
///
typedef enum {
///
// Align the text's left edge with that of its display area.
///
CEF_HORIZONTAL_ALIGNMENT_LEFT,
///
// Align the text's center with that of its display area.
///
CEF_HORIZONTAL_ALIGNMENT_CENTER,
///
// Align the text's right edge with that of its display area.
///
CEF_HORIZONTAL_ALIGNMENT_RIGHT,
} cef_horizontal_alignment_t;
///
// Specifies how a menu will be anchored for non-RTL languages. The opposite
// position will be used for RTL languages.
///
typedef enum {
CEF_MENU_ANCHOR_TOPLEFT,
CEF_MENU_ANCHOR_TOPRIGHT,
CEF_MENU_ANCHOR_BOTTOMCENTER,
} cef_menu_anchor_position_t;
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -205,6 +205,17 @@ class CefRect : public CefStructBase<CefRectTraits> {
void Set(int x_val, int y_val, int width_val, int height_val) { void Set(int x_val, int y_val, int width_val, int height_val) {
x = x_val, y = y_val, width = width_val, height = height_val; x = x_val, y = y_val, width = width_val, height = height_val;
} }
// Returns true if the point identified by point_x and point_y falls inside
// this rectangle. The point (x, y) is inside the rectangle, but the
// point (x + width, y + height) is not.
bool Contains(int point_x, int point_y) const {
return (point_x >= x) && (point_x < x + width) && (point_y >= y) &&
(point_y < y + height);
}
bool Contains(const CefPoint& point) const {
return Contains(point.x, point.y);
}
}; };
inline bool operator==(const CefRect& a, const CefRect& b) { inline bool operator==(const CefRect& a, const CefRect& b) {
@ -257,6 +268,89 @@ inline bool operator!=(const CefSize& a, const CefSize& b) {
} }
struct CefRangeTraits {
typedef cef_range_t struct_type;
static inline void init(struct_type* s) {}
static inline void clear(struct_type* s) {}
static inline void set(const struct_type* src, struct_type* target,
bool copy) {
*target = *src;
}
};
///
// Class representing a range.
///
class CefRange : public CefStructBase<CefRangeTraits> {
public:
typedef CefStructBase<CefRangeTraits> parent;
CefRange() : parent() {}
CefRange(const cef_range_t& r) // NOLINT(runtime/explicit)
: parent(r) {}
CefRange(const CefRange& r) // NOLINT(runtime/explicit)
: parent(r) {}
CefRange(int from, int to) : parent() {
Set(from, to);
}
void Set(int from_val, int to_val) {
from = from_val, to = to_val;
}
};
inline bool operator==(const CefRange& a, const CefRange& b) {
return a.from == b.from && a.to == b.to;
}
inline bool operator!=(const CefRange& a, const CefRange& b) {
return !(a == b);
}
struct CefInsetsTraits {
typedef cef_insets_t struct_type;
static inline void init(struct_type* s) {}
static inline void clear(struct_type* s) {}
static inline void set(const struct_type* src, struct_type* target,
bool copy) {
*target = *src;
}
};
///
// Class representing insets.
///
class CefInsets : public CefStructBase<CefInsetsTraits> {
public:
typedef CefStructBase<CefInsetsTraits> parent;
CefInsets() : parent() {}
CefInsets(const cef_insets_t& r) : parent(r) {} // NOLINT(runtime/explicit)
CefInsets(const CefInsets& r) : parent(r) {} // NOLINT(runtime/explicit)
CefInsets(int top, int left, int bottom, int right) : parent() {
Set(top, left, bottom, right);
}
void Set(int top_val, int left_val, int bottom_val, int right_val) {
top = top_val, left = left_val, bottom = bottom_val, right = right_val;
}
};
inline bool operator==(const CefInsets& a, const CefInsets& b) {
return a.top == b.top && a.left == b.left && a.bottom == b.bottom &&
a.right == b.right;
}
inline bool operator!=(const CefInsets& a, const CefInsets& b) {
return !(a == b);
}
struct CefDraggableRegionTraits { struct CefDraggableRegionTraits {
typedef cef_draggable_region_t struct_type; typedef cef_draggable_region_t struct_type;
@ -800,48 +894,6 @@ struct CefGeopositionTraits {
typedef CefStructBase<CefGeopositionTraits> CefGeoposition; typedef CefStructBase<CefGeopositionTraits> CefGeoposition;
struct CefPageRangeTraits {
typedef cef_page_range_t struct_type;
static inline void init(struct_type* s) {}
static inline void clear(struct_type* s) {}
static inline void set(const struct_type* src, struct_type* target,
bool copy) {
*target = *src;
}
};
///
// Class representing a print job page range.
///
class CefPageRange : public CefStructBase<CefPageRangeTraits> {
public:
typedef CefStructBase<CefPageRangeTraits> parent;
CefPageRange() : parent() {}
CefPageRange(const cef_page_range_t& r) // NOLINT(runtime/explicit)
: parent(r) {}
CefPageRange(const CefPageRange& r) // NOLINT(runtime/explicit)
: parent(r) {}
CefPageRange(int from, int to) : parent() {
Set(from, to);
}
void Set(int from_val, int to_val) {
from = from_val, to = to_val;
}
};
inline bool operator==(const CefPageRange& a, const CefPageRange& b) {
return a.from == b.from && a.to == b.to;
}
inline bool operator!=(const CefPageRange& a, const CefPageRange& b) {
return !(a == b);
}
struct CefCursorInfoTraits { struct CefCursorInfoTraits {
typedef cef_cursor_info_t struct_type; typedef cef_cursor_info_t struct_type;
@ -903,4 +955,23 @@ struct CefPdfPrintSettingsTraits {
/// ///
typedef CefStructBase<CefPdfPrintSettingsTraits> CefPdfPrintSettings; typedef CefStructBase<CefPdfPrintSettingsTraits> CefPdfPrintSettings;
struct CefBoxLayoutSettingsTraits {
typedef cef_box_layout_settings_t struct_type;
static inline void init(struct_type* s) {}
static inline void clear(struct_type* s) {}
static inline void set(const struct_type* src, struct_type* target,
bool copy) {
*target = *src;
}
};
///
// Class representing CefBoxLayout settings.
///
typedef CefStructBase<CefBoxLayoutSettingsTraits> CefBoxLayoutSettings;
#endif // CEF_INCLUDE_INTERNAL_CEF_TYPES_WRAPPERS_H_ #endif // CEF_INCLUDE_INTERNAL_CEF_TYPES_WRAPPERS_H_

View File

@ -0,0 +1,74 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_VIEWS_CEF_BOX_LAYOUT_H_
#define CEF_INCLUDE_VIEWS_CEF_BOX_LAYOUT_H_
#pragma once
#include "include/views/cef_layout.h"
class CefView;
///
// A Layout manager that arranges child views vertically or horizontally in a
// side-by-side fashion with spacing around and between the child views. The
// child views are always sized according to their preferred size. If the
// host's bounds provide insufficient space, child views will be clamped.
// Excess space will not be distributed. Methods must be called on the browser
// process UI thread unless otherwise indicated.
///
/*--cef(source=library)--*/
class CefBoxLayout : public CefLayout {
public:
///
// Set the flex weight for the given |view|. Using the preferred size as
// the basis, free space along the main axis is distributed to views in the
// ratio of their flex weights. Similarly, if the views will overflow the
// parent, space is subtracted in these ratios. A flex of 0 means this view is
// not resized. Flex values must not be negative.
///
/*--cef()--*/
virtual void SetFlexForView(CefRefPtr<CefView> view, int flex) =0;
///
// Clears the flex for the given |view|, causing it to use the default flex
// specified via CefBoxLayoutSettings.default_flex.
///
/*--cef()--*/
virtual void ClearFlexForView(CefRefPtr<CefView> view) =0;
};
#endif // CEF_INCLUDE_VIEWS_CEF_BOX_LAYOUT_H_

View File

@ -0,0 +1,79 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_VIEWS_CEF_BROWSER_VIEW_H_
#define CEF_INCLUDE_VIEWS_CEF_BROWSER_VIEW_H_
#pragma once
#include "include/cef_browser.h"
#include "include/views/cef_browser_view_delegate.h"
#include "include/views/cef_view.h"
///
// A View hosting a CefBrowser instance. Methods must be called on the browser
// process UI thread unless otherwise indicated.
///
/*--cef(source=library)--*/
class CefBrowserView : public CefView {
public:
///
// Create a new BrowserView. The underlying CefBrowser will not be created
// until this view is added to the views hierarchy.
///
/*--cef(optional_param=client,optional_param=url,
optional_param=request_context,optional_param=delegate)--*/
static CefRefPtr<CefBrowserView> CreateBrowserView(
CefRefPtr<CefClient> client,
const CefString& url,
const CefBrowserSettings& settings,
CefRefPtr<CefRequestContext> request_context,
CefRefPtr<CefBrowserViewDelegate> delegate);
///
// Returns the BrowserView associated with |browser|.
///
/*--cef()--*/
static CefRefPtr<CefBrowserView> GetForBrowser(CefRefPtr<CefBrowser> browser);
///
// Returns the CefBrowser hosted by this BrowserView. Will return NULL if the
// browser has not yet been created or has already been destroyed.
///
/*--cef()--*/
virtual CefRefPtr<CefBrowser> GetBrowser() =0;
};
#endif // CEF_INCLUDE_VIEWS_CEF_BROWSER_VIEW_H_

View File

@ -0,0 +1,109 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_VIEWS_CEF_BROWSER_VIEW_DELEGATE_H_
#define CEF_INCLUDE_VIEWS_CEF_BROWSER_VIEW_DELEGATE_H_
#pragma once
#include "include/cef_client.h"
#include "include/views/cef_view_delegate.h"
class CefBrowser;
class CefBrowserView;
///
// Implement this interface to handle BrowserView events. The methods of this
// class will be called on the browser process UI thread unless otherwise
// indicated.
///
/*--cef(source=client)--*/
class CefBrowserViewDelegate : public CefViewDelegate {
public:
///
// Called when |browser| associated with |browser_view| is created. This
// method will be called after CefLifeSpanHandler::OnAfterCreated() is called
// for |browser| and before OnPopupBrowserViewCreated() is called for
// |browser|'s parent delegate if |browser| is a popup.
///
/*--cef()--*/
virtual void OnBrowserCreated(CefRefPtr<CefBrowserView> browser_view,
CefRefPtr<CefBrowser> browser) {}
///
// Called when |browser| associated with |browser_view| is destroyed. Release
// all references to |browser| and do not attempt to execute any methods on
// |browser| after this callback returns. This method will be called before
// CefLifeSpanHandler::OnBeforeClose() is called for |browser|.
///
/*--cef()--*/
virtual void OnBrowserDestroyed(CefRefPtr<CefBrowserView> browser_view,
CefRefPtr<CefBrowser> browser) {}
///
// Called before a new popup BrowserView is created. The popup originated
// from |browser_view|. |settings| and |client| are the values returned from
// CefLifeSpanHandler::OnBeforePopup(). |is_devtools| will be true if the
// popup will be a DevTools browser. Return the delegate that will be used for
// the new popup BrowserView.
///
/*--cef()--*/
virtual CefRefPtr<CefBrowserViewDelegate> GetDelegateForPopupBrowserView(
CefRefPtr<CefBrowserView> browser_view,
const CefBrowserSettings& settings,
CefRefPtr<CefClient> client,
bool is_devtools) {
return this;
}
///
// Called after |popup_browser_view| is created. This method will be called
// after CefLifeSpanHandler::OnAfterCreated() and OnBrowserCreated() are
// called for the new popup browser. The popup originated from |browser_view|.
// |is_devtools| will be true if the popup is a DevTools browser. Optionally
// add |popup_browser_view| to the views hierarchy yourself and return true.
// Otherwise return false and a default CefWindow will be created for the
// popup.
///
/*--cef()--*/
virtual bool OnPopupBrowserViewCreated(
CefRefPtr<CefBrowserView> browser_view,
CefRefPtr<CefBrowserView> popup_browser_view,
bool is_devtools) {
return false;
}
};
#endif // CEF_INCLUDE_VIEWS_CEF_BROWSER_VIEW_DELEGATE_H_

View File

@ -0,0 +1,85 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_VIEWS_CEF_BUTTON_H_
#define CEF_INCLUDE_VIEWS_CEF_BUTTON_H_
#pragma once
#include "include/views/cef_view.h"
class CefLabelButton;
///
// A View representing a button. Depending on the specific type, the button
// could be implemented by a native control or custom rendered. Methods must be
// called on the browser process UI thread unless otherwise indicated.
///
/*--cef(source=library)--*/
class CefButton : public CefView {
public:
///
// Returns this Button as a LabelButton or NULL if this is not a LabelButton.
///
/*--cef()--*/
virtual CefRefPtr<CefLabelButton> AsLabelButton() =0;
///
// Sets the current display state of the Button.
///
/*--cef()--*/
virtual void SetState(cef_button_state_t state) =0;
///
// Returns the current display state of the Button.
///
/*--cef(default_retval=CEF_BUTTON_STATE_NORMAL)--*/
virtual cef_button_state_t GetState() =0;
///
// Sets the tooltip text that will be displayed when the user hovers the mouse
// cursor over the Button.
///
/*--cef()--*/
virtual void SetTooltipText(const CefString& tooltip_text) =0;
///
// Sets the accessible name that will be exposed to assistive technology (AT).
///
/*--cef()--*/
virtual void SetAccessibleName(const CefString& name) =0;
};
#endif // CEF_INCLUDE_VIEWS_CEF_BUTTON_H_

View File

@ -0,0 +1,59 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_VIEWS_CEF_BUTTON_DELEGATE_H_
#define CEF_INCLUDE_VIEWS_CEF_BUTTON_DELEGATE_H_
#pragma once
#include "include/views/cef_view_delegate.h"
class CefButton;
///
// Implement this interface to handle Button events. The methods of this class
// will be called on the browser process UI thread unless otherwise indicated.
///
/*--cef(source=client)--*/
class CefButtonDelegate : public CefViewDelegate {
public:
///
// Called when |button| is pressed.
///
/*--cef()--*/
virtual void OnButtonPressed(CefRefPtr<CefButton> button) =0;
};
#endif // CEF_INCLUDE_VIEWS_CEF_BUTTON_DELEGATE_H_

144
include/views/cef_display.h Normal file
View File

@ -0,0 +1,144 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_VIEWS_CEF_DISPLAY_H_
#define CEF_INCLUDE_VIEWS_CEF_DISPLAY_H_
#pragma once
#include <vector>
#include "include/cef_base.h"
///
// This class typically, but not always, corresponds to a physical display
// connected to the system. A fake Display may exist on a headless system, or a
// Display may correspond to a remote, virtual display. All size and position
// values are in density independent pixels (DIP) unless otherwise indicated.
// Methods must be called on the browser process UI thread unless otherwise
// indicated.
///
/*--cef(source=library)--*/
class CefDisplay : public CefBase {
public:
///
// Returns the primary Display.
///
/*--cef()--*/
static CefRefPtr<CefDisplay> GetPrimaryDisplay();
///
// Returns the Display nearest |point|. Set |input_pixel_coords| to true if
// |point| is in pixel coordinates instead of density independent pixels
// (DIP).
///
/*--cef()--*/
static CefRefPtr<CefDisplay> GetDisplayNearestPoint(const CefPoint& point,
bool input_pixel_coords);
///
// Returns the Display that most closely intersects |bounds|. Set
// |input_pixel_coords| to true if |bounds| is in pixel coordinates instead of
// density independent pixels (DIP).
///
/*--cef()--*/
static CefRefPtr<CefDisplay> GetDisplayMatchingBounds(
const CefRect& bounds,
bool input_pixel_coords);
///
// Returns the total number of Displays. Mirrored displays are excluded; this
// method is intended to return the number of distinct, usable displays.
///
/*--cef()--*/
static size_t GetDisplayCount();
///
// Returns all Displays. Mirrored displays are excluded; this method is
// intended to return distinct, usable displays.
///
/*--cef(count_func=displays:GetDisplayCount)--*/
static void GetAllDisplays(std::vector<CefRefPtr<CefDisplay> >& displays);
///
// Returns the unique identifier for this Display.
///
/*--cef()--*/
virtual int64 GetID() =0;
///
// Returns this Display's device pixel scale factor. This specifies how much
// the UI should be scaled when the actual output has more pixels than
// standard displays (which is around 100~120dpi). The potential return values
// differ by platform.
///
/*--cef()--*/
virtual float GetDeviceScaleFactor() =0;
///
// Convert |point| from density independent pixels (DIP) to pixel coordinates
// using this Display's device scale factor.
///
/*--cef()--*/
virtual void ConvertPointToPixels(CefPoint& point) =0;
///
// Convert |point| from pixel coordinates to density independent pixels (DIP)
// using this Display's device scale factor.
///
/*--cef()--*/
virtual void ConvertPointFromPixels(CefPoint& point) =0;
///
// Returns this Display's bounds. This is the full size of the display.
///
/*--cef()--*/
virtual CefRect GetBounds() =0;
///
// Returns this Display's work area. This excludes areas of the display that
// are occupied for window manager toolbars, etc.
///
/*--cef()--*/
virtual CefRect GetWorkArea() =0;
///
// Returns this Display's rotation in degrees.
///
/*--cef()--*/
virtual int GetRotation() =0;
};
#endif // CEF_INCLUDE_VIEWS_CEF_DISPLAY_H_

View File

@ -0,0 +1,52 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_VIEWS_CEF_FILL_LAYOUT_H_
#define CEF_INCLUDE_VIEWS_CEF_FILL_LAYOUT_H_
#pragma once
#include "include/views/cef_layout.h"
///
// A simple Layout that causes the associated Panel's one child to be sized to
// match the bounds of its parent. Methods must be called on the browser process
// UI thread unless otherwise indicated.
///
/*--cef(source=library)--*/
class CefFillLayout : public CefLayout {
};
#endif // CEF_INCLUDE_VIEWS_CEF_FILL_LAYOUT_H_

View File

@ -0,0 +1,152 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_VIEWS_CEF_LABEL_BUTTON_H_
#define CEF_INCLUDE_VIEWS_CEF_LABEL_BUTTON_H_
#pragma once
#include "include/cef_image.h"
#include "include/views/cef_button.h"
#include "include/views/cef_button_delegate.h"
class CefMenuButton;
///
// LabelButton is a button with optional text and/or icon. Methods must be
// called on the browser process UI thread unless otherwise indicated.
///
/*--cef(source=library)--*/
class CefLabelButton : public CefButton {
public:
///
// Create a new LabelButton. A |delegate| must be provided to handle the
// button click. |text| will be shown on the LabelButton and used as the
// default accessible name. If |with_frame| is true the button will have a
// visible frame at all times, center alignment, additional padding and a
// default minimum size of 70x33 DIP. If |with_frame| is false the button will
// only have a visible frame on hover/press, left alignment, less padding and
// no default minimum size.
///
/*--cef(optional_param=text)--*/
static CefRefPtr<CefLabelButton> CreateLabelButton(
CefRefPtr<CefButtonDelegate> delegate,
const CefString& text,
bool with_frame);
///
// Returns this LabelButton as a MenuButton or NULL if this is not a
// MenuButton.
///
/*--cef()--*/
virtual CefRefPtr<CefMenuButton> AsMenuButton() =0;
///
// Sets the text shown on the LabelButton. By default |text| will also be used
// as the accessible name.
///
/*--cef()--*/
virtual void SetText(const CefString& text) =0;
///
// Returns the text shown on the LabelButton.
///
/*--cef()--*/
virtual CefString GetText() =0;
///
// Sets the image shown for |button_state|. When this Button is drawn if no
// image exists for the current state then the image for
// CEF_BUTTON_STATE_NORMAL, if any, will be shown.
///
/*--cef(optional_param=image)--*/
virtual void SetImage(cef_button_state_t button_state,
CefRefPtr<CefImage> image) =0;
///
// Returns the image shown for |button_state|. If no image exists for that
// state then the image for CEF_BUTTON_STATE_NORMAL will be returned.
///
/*--cef()--*/
virtual CefRefPtr<CefImage> GetImage(cef_button_state_t button_state) =0;
///
// Sets the text color shown for the specified button |for_state| to |color|.
///
/*--cef()--*/
virtual void SetTextColor(cef_button_state_t for_state, cef_color_t color) =0;
///
// Sets the text colors shown for the non-disabled states to |color|.
///
/*--cef()--*/
virtual void SetEnabledTextColors(cef_color_t color) =0;
///
// Sets the font list. The format is "<FONT_FAMILY_LIST>,[STYLES] <SIZE>",
// where:
// - FONT_FAMILY_LIST is a comma-separated list of font family names,
// - STYLES is an optional space-separated list of style names (case-sensitive
// "Bold" and "Italic" are supported), and
// - SIZE is an integer font size in pixels with the suffix "px".
//
// Here are examples of valid font description strings:
// - "Arial, Helvetica, Bold Italic 14px"
// - "Arial, 14px"
///
/*--cef()--*/
virtual void SetFontList(const CefString& font_list) =0;
///
// Sets the horizontal alignment; reversed in RTL. Default is
// CEF_HORIZONTAL_ALIGNMENT_CENTER.
///
/*--cef()--*/
virtual void SetHorizontalAlignment(cef_horizontal_alignment_t alignment) =0;
///
// Reset the minimum size of this LabelButton to |size|.
///
/*--cef()--*/
virtual void SetMinimumSize(const CefSize& size) =0;
///
// Reset the maximum size of this LabelButton to |size|.
///
/*--cef()--*/
virtual void SetMaximumSize(const CefSize& size) =0;
};
#endif // CEF_INCLUDE_VIEWS_CEF_LABEL_BUTTON_H_

View File

@ -0,0 +1,73 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_VIEWS_CEF_LAYOUT_H_
#define CEF_INCLUDE_VIEWS_CEF_LAYOUT_H_
#pragma once
#include "include/cef_base.h"
class CefBoxLayout;
class CefFillLayout;
///
// A Layout handles the sizing of the children of a Panel according to
// implementation-specific heuristics. Methods must be called on the browser
// process UI thread unless otherwise indicated.
///
/*--cef(source=library)--*/
class CefLayout : public CefBase {
public:
///
// Returns this Layout as a BoxLayout or NULL if this is not a BoxLayout.
///
/*--cef()--*/
virtual CefRefPtr<CefBoxLayout> AsBoxLayout() =0;
///
// Returns this Layout as a FillLayout or NULL if this is not a FillLayout.
///
/*--cef()--*/
virtual CefRefPtr<CefFillLayout> AsFillLayout() =0;
///
// Returns true if this Layout is valid.
///
/*--cef()--*/
virtual bool IsValid() =0;
};
#endif // CEF_INCLUDE_VIEWS_CEF_LAYOUT_H_

View File

@ -0,0 +1,83 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_VIEWS_CEF_MENU_BUTTON_H_
#define CEF_INCLUDE_VIEWS_CEF_MENU_BUTTON_H_
#pragma once
#include "include/cef_menu_model.h"
#include "include/views/cef_label_button.h"
#include "include/views/cef_menu_button_delegate.h"
///
// MenuButton is a button with optional text, icon and/or menu marker that shows
// a menu when clicked with the left mouse button. All size and position values
// are in density independent pixels (DIP) unless otherwise indicated. Methods
// must be called on the browser process UI thread unless otherwise indicated.
///
/*--cef(source=library)--*/
class CefMenuButton : public CefLabelButton {
public:
///
// Create a new MenuButton. A |delegate| must be provided to call ShowMenu()
// when the button is clicked. |text| will be shown on the MenuButton and used
// as the default accessible name. If |with_frame| is true the button will
// have a visible frame at all times, center alignment, additional padding and
// a default minimum size of 70x33 DIP. If |with_frame| is false the button
// will only have a visible frame on hover/press, left alignment, less padding
// and no default minimum size. If |with_menu_marker| is true a menu marker
// will be added to the button.
///
/*--cef(optional_param=text)--*/
static CefRefPtr<CefMenuButton> CreateMenuButton(
CefRefPtr<CefMenuButtonDelegate> delegate,
const CefString& text,
bool with_frame,
bool with_menu_marker);
///
// Show a menu with contents |menu_model|. |screen_point| specifies the menu
// position in screen coordinates. |anchor_position| specifies how the menu
// will be anchored relative to |screen_point|. This method should be called
// from CefMenuButtonDelegate::OnMenuButtonPressed().
///
/*--cef()--*/
virtual void ShowMenu(CefRefPtr<CefMenuModel> menu_model,
const CefPoint& screen_point,
cef_menu_anchor_position_t anchor_position) =0;
};
#endif // CEF_INCLUDE_VIEWS_CEF_MENU_BUTTON_H_

View File

@ -0,0 +1,62 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_VIEWS_CEF_MENU_BUTTON_DELEGATE_H_
#define CEF_INCLUDE_VIEWS_CEF_MENU_BUTTON_DELEGATE_H_
#pragma once
#include "include/views/cef_button_delegate.h"
class CefMenuButton;
///
// Implement this interface to handle MenuButton events. The methods of this
// class will be called on the browser process UI thread unless otherwise
// indicated.
///
/*--cef(source=client)--*/
class CefMenuButtonDelegate : public CefButtonDelegate {
public:
///
// Called when |button| is pressed. Call CefMenuButton::ShowMenu() to show the
// resulting menu at |screen_point|.
///
/*--cef()--*/
virtual void OnMenuButtonPressed(CefRefPtr<CefMenuButton> menu_button,
const CefPoint& screen_point) =0;
};
#endif // CEF_INCLUDE_VIEWS_CEF_MENU_BUTTON_DELEGATE_H_

143
include/views/cef_panel.h Normal file
View File

@ -0,0 +1,143 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_VIEWS_CEF_PANEL_H_
#define CEF_INCLUDE_VIEWS_CEF_PANEL_H_
#pragma once
#include "include/views/cef_view.h"
#include "include/views/cef_panel_delegate.h"
class CefBoxLayout;
class CefFillLayout;
class CefLayout;
class CefWindow;
///
// A Panel is a container in the views hierarchy that can contain other Views
// as children. Methods must be called on the browser process UI thread unless
// otherwise indicated.
///
/*--cef(source=library)--*/
class CefPanel : public CefView {
public:
///
// Create a new Panel.
///
/*--cef(optional_param=delegate)--*/
static CefRefPtr<CefPanel> CreatePanel(CefRefPtr<CefPanelDelegate> delegate);
///
// Returns this Panel as a Window or NULL if this is not a Window.
///
/*--cef()--*/
virtual CefRefPtr<CefWindow> AsWindow() =0;
///
// Set this Panel's Layout to FillLayout and return the FillLayout object.
///
/*--cef()--*/
virtual CefRefPtr<CefFillLayout> SetToFillLayout() =0;
///
// Set this Panel's Layout to BoxLayout and return the BoxLayout object.
///
/*--cef()--*/
virtual CefRefPtr<CefBoxLayout> SetToBoxLayout(
const CefBoxLayoutSettings& settings) =0;
///
// Get the Layout.
///
/*--cef()--*/
virtual CefRefPtr<CefLayout> GetLayout() =0;
///
// Lay out the child Views (set their bounds based on sizing heuristics
// specific to the current Layout).
///
/*--cef()--*/
virtual void Layout() =0;
///
// Add a child View.
///
/*--cef()--*/
virtual void AddChildView(CefRefPtr<CefView> view) =0;
///
// Add a child View at the specified |index|. If |index| matches the result of
// GetChildCount() then the View will be added at the end.
///
/*--cef(index_param=index)--*/
virtual void AddChildViewAt(CefRefPtr<CefView> view,
int index) =0;
///
// Move the child View to the specified |index|. A negative value for |index|
// will move the View to the end.
///
/*--cef()--*/
virtual void ReorderChildView(CefRefPtr<CefView> view,
int index) =0;
///
// Remove a child View. The View can then be added to another Panel.
///
/*--cef()--*/
virtual void RemoveChildView(CefRefPtr<CefView> view) =0;
///
// Remove all child Views. The removed Views will be deleted if the client
// holds no references to them.
///
/*--cef()--*/
virtual void RemoveAllChildViews() =0;
///
// Returns the number of child Views.
///
/*--cef()--*/
virtual size_t GetChildViewCount() =0;
///
// Returns the child View at the specified |index|.
///
/*--cef(index_param=index)--*/
virtual CefRefPtr<CefView> GetChildViewAt(int index) =0;
};
#endif // CEF_INCLUDE_VIEWS_CEF_PANEL_H_

View File

@ -0,0 +1,51 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_VIEWS_CEF_PANEL_DELEGATE_H_
#define CEF_INCLUDE_VIEWS_CEF_PANEL_DELEGATE_H_
#pragma once
#include "include/views/cef_view_delegate.h"
///
// Implement this interface to handle Panel events. The methods of this class
// will be called on the browser process UI thread unless otherwise indicated.
///
/*--cef(source=client)--*/
class CefPanelDelegate : public CefViewDelegate {
};
#endif // CEF_INCLUDE_VIEWS_CEF_PANEL_DELEGATE_H_

View File

@ -0,0 +1,102 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_VIEWS_CEF_SCROLL_VIEW_H_
#define CEF_INCLUDE_VIEWS_CEF_SCROLL_VIEW_H_
#pragma once
#include "include/views/cef_view.h"
///
// A ScrollView will show horizontal and/or vertical scrollbars when necessary
// based on the size of the attached content view. Methods must be called on the
// browser process UI thread unless otherwise indicated.
///
/*--cef(source=library)--*/
class CefScrollView : public CefView {
public:
///
// Create a new ScrollView.
///
/*--cef(optional_param=delegate)--*/
static CefRefPtr<CefScrollView> CreateScrollView(
CefRefPtr<CefViewDelegate> delegate);
///
// Set the content View. The content View must have a specified size (e.g.
// via CefView::SetBounds or CefViewDelegate::GetPreferredSize).
///
/*--cef()--*/
virtual void SetContentView(CefRefPtr<CefView> view) =0;
///
// Returns the content View.
///
/*--cef()--*/
virtual CefRefPtr<CefView> GetContentView() =0;
///
// Returns the visible region of the content View.
///
/*--cef()--*/
virtual CefRect GetVisibleContentRect() =0;
///
// Returns true if the horizontal scrollbar is currently showing.
///
/*--cef()--*/
virtual bool HasHorizontalScrollbar() =0;
///
// Returns the height of the horizontal scrollbar.
///
/*--cef()--*/
virtual int GetHorizontalScrollbarHeight() =0;
///
// Returns true if the vertical scrollbar is currently showing.
///
/*--cef()--*/
virtual bool HasVerticalScrollbar() =0;
///
// Returns the width of the vertical scrollbar.
///
/*--cef()--*/
virtual int GetVerticalScrollbarWidth() =0;
};
#endif // CEF_INCLUDE_VIEWS_CEF_SCROLL_VIEW_H_

View File

@ -0,0 +1,278 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_VIEWS_CEF_TEXTFIELD_H_
#define CEF_INCLUDE_VIEWS_CEF_TEXTFIELD_H_
#pragma once
#include "include/views/cef_view.h"
#include "include/views/cef_textfield_delegate.h"
///
// A Textfield supports editing of text. This control is custom rendered with no
// platform-specific code. Methods must be called on the browser process UI
// thread unless otherwise indicated.
///
/*--cef(source=library)--*/
class CefTextfield : public CefView {
public:
///
// Create a new Textfield.
///
/*--cef(optional_param=delegate)--*/
static CefRefPtr<CefTextfield> CreateTextfield(
CefRefPtr<CefTextfieldDelegate> delegate);
///
// Sets whether the text will be displayed as asterisks.
///
/*--cef()--*/
virtual void SetPasswordInput(bool password_input) =0;
///
// Returns true if the text will be displayed as asterisks.
///
/*--cef()--*/
virtual bool IsPasswordInput() =0;
///
// Sets whether the text will read-only.
///
/*--cef()--*/
virtual void SetReadOnly(bool read_only) =0;
///
// Returns true if the text is read-only.
///
/*--cef()--*/
virtual bool IsReadOnly() =0;
///
// Returns the currently displayed text.
///
/*--cef()--*/
virtual CefString GetText() =0;
///
// Sets the contents to |text|. The cursor will be moved to end of the text if
// the current position is outside of the text range.
///
/*--cef()--*/
virtual void SetText(const CefString& text) =0;
///
// Appends |text| to the previously-existing text.
///
/*--cef()--*/
virtual void AppendText(const CefString& text) =0;
///
// Inserts |text| at the current cursor position replacing any selected text.
///
/*--cef()--*/
virtual void InsertOrReplaceText(const CefString& text) =0;
///
// Returns true if there is any selected text.
///
/*--cef()--*/
virtual bool HasSelection() =0;
///
// Returns the currently selected text.
///
/*--cef()--*/
virtual CefString GetSelectedText() =0;
///
// Selects all text. If |reversed| is true the range will end at the logical
// beginning of the text; this generally shows the leading portion of text
// that overflows its display area.
///
/*--cef()--*/
virtual void SelectAll(bool reversed) =0;
///
// Clears the text selection and sets the caret to the end.
///
/*--cef()--*/
virtual void ClearSelection() =0;
///
// Returns the selected logical text range.
///
/*--cef()--*/
virtual CefRange GetSelectedRange() =0;
///
// Selects the specified logical text range.
///
/*--cef()--*/
virtual void SelectRange(const CefRange& range) =0;
///
// Returns the current cursor position.
///
/*--cef()--*/
virtual size_t GetCursorPosition() =0;
///
// Sets the text color.
///
/*--cef()--*/
virtual void SetTextColor(cef_color_t color) =0;
///
// Returns the text color.
///
/*--cef()--*/
virtual cef_color_t GetTextColor() =0;
///
// Sets the selection text color.
///
/*--cef()--*/
virtual void SetSelectionTextColor(cef_color_t color) =0;
///
// Returns the selection text color.
///
/*--cef()--*/
virtual cef_color_t GetSelectionTextColor() =0;
///
// Sets the selection background color.
///
/*--cef()--*/
virtual void SetSelectionBackgroundColor(cef_color_t color) =0;
///
// Returns the selection background color.
///
/*--cef()--*/
virtual cef_color_t GetSelectionBackgroundColor() =0;
///
// Sets the font list. The format is "<FONT_FAMILY_LIST>,[STYLES] <SIZE>",
// where:
// - FONT_FAMILY_LIST is a comma-separated list of font family names,
// - STYLES is an optional space-separated list of style names (case-sensitive
// "Bold" and "Italic" are supported), and
// - SIZE is an integer font size in pixels with the suffix "px".
//
// Here are examples of valid font description strings:
// - "Arial, Helvetica, Bold Italic 14px"
// - "Arial, 14px"
///
/*--cef()--*/
virtual void SetFontList(const CefString& font_list) =0;
///
// Applies |color| to the specified |range| without changing the default
// color. If |range| is empty the color will be set on the complete text
// contents.
///
/*--cef()--*/
virtual void ApplyTextColor(cef_color_t color,
const CefRange& range) =0;
///
// Applies |style| to the specified |range| without changing the default
// style. If |add| is true the style will be added, otherwise the style will
// be removed. If |range| is empty the style will be set on the complete text
// contents.
///
/*--cef()--*/
virtual void ApplyTextStyle(cef_text_style_t style,
bool add,
const CefRange& range) =0;
///
// Returns true if the action associated with the specified command id is
// enabled. See additional comments on ExecuteCommand().
///
/*--cef()--*/
virtual bool IsCommandEnabled(int command_id) =0;
///
// Performs the action associated with the specified command id. Valid values
// include IDS_APP_UNDO, IDS_APP_REDO, IDS_APP_CUT, IDS_APP_COPY,
// IDS_APP_PASTE, IDS_APP_DELETE, IDS_APP_SELECT_ALL, IDS_DELETE_* and
// IDS_MOVE_*. See include/cef_pack_strings.h for definitions.
///
/*--cef()--*/
virtual void ExecuteCommand(int command_id) =0;
///
// Clears Edit history.
///
/*--cef()--*/
virtual void ClearEditHistory() =0;
///
// Sets the placeholder text that will be displayed when the Textfield is
// empty.
///
/*--cef()--*/
virtual void SetPlaceholderText(const CefString& text) =0;
///
// Returns the placeholder text that will be displayed when the Textfield is
// empty.
///
/*--cef()--*/
virtual CefString GetPlaceholderText() =0;
///
// Sets the placeholder text color.
///
/*--cef()--*/
virtual void SetPlaceholderTextColor(cef_color_t color) =0;
///
// Returns the placeholder text color.
///
/*--cef()--*/
virtual cef_color_t GetPlaceholderTextColor() =0;
///
// Set the accessible name that will be exposed to assistive technology (AT).
///
/*--cef()--*/
virtual void SetAccessibleName(const CefString& name) =0;
};
#endif // CEF_INCLUDE_VIEWS_CEF_TEXTFIELD_H_

View File

@ -0,0 +1,69 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_VIEWS_CEF_TEXTFIELD_DELEGATE_H_
#define CEF_INCLUDE_VIEWS_CEF_TEXTFIELD_DELEGATE_H_
#pragma once
#include "include/views/cef_view_delegate.h"
class CefTextfield;
///
// Implement this interface to handle Textfield events. The methods of this
// class will be called on the browser process UI thread unless otherwise
// indicated.
///
/*--cef(source=client)--*/
class CefTextfieldDelegate : public CefViewDelegate {
public:
///
// Called when |textfield| recieves a keyboard event. |event| contains
// information about the keyboard event. Return true if the keyboard event was
// handled or false otherwise for default handling.
///
/*--cef()--*/
virtual bool OnKeyEvent(CefRefPtr<CefTextfield> textfield,
const CefKeyEvent& event) { return false; }
///
// Called after performing a user action that may change |textfield|.
///
/*--cef()--*/
virtual void OnAfterUserAction(CefRefPtr<CefTextfield> textfield) {}
};
#endif // CEF_INCLUDE_VIEWS_CEF_TEXTFIELD_DELEGATE_H_

388
include/views/cef_view.h Normal file
View File

@ -0,0 +1,388 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_VIEWS_CEF_VIEW_H_
#define CEF_INCLUDE_VIEWS_CEF_VIEW_H_
#pragma once
#include "include/views/cef_view_delegate.h"
class CefBrowserView;
class CefButton;
class CefPanel;
class CefScrollView;
class CefTextfield;
class CefWindow;
///
// A View is a rectangle within the views View hierarchy. It is the base class
// for all Views. All size and position values are in density independent pixels
// (DIP) unless otherwise indicated. Methods must be called on the browser
// process UI thread unless otherwise indicated.
///
/*--cef(source=library)--*/
class CefView : public CefBase {
public:
///
// Returns this View as a BrowserView or NULL if this is not a BrowserView.
///
/*--cef()--*/
virtual CefRefPtr<CefBrowserView> AsBrowserView() =0;
///
// Returns this View as a Button or NULL if this is not a Button.
///
/*--cef()--*/
virtual CefRefPtr<CefButton> AsButton() =0;
///
// Returns this View as a Panel or NULL if this is not a Panel.
///
/*--cef()--*/
virtual CefRefPtr<CefPanel> AsPanel() =0;
///
// Returns this View as a ScrollView or NULL if this is not a ScrollView.
///
/*--cef()--*/
virtual CefRefPtr<CefScrollView> AsScrollView() =0;
///
// Returns this View as a Textfield or NULL if this is not a Textfield.
///
/*--cef()--*/
virtual CefRefPtr<CefTextfield> AsTextfield() =0;
///
// Returns the type of this View as a string. Used primarily for testing
// purposes.
///
/*--cef()--*/
virtual CefString GetTypeString() =0;
///
// Returns a string representation of this View which includes the type and
// various type-specific identifying attributes. If |include_children| is true
// any child Views will also be included. Used primarily for testing purposes.
///
/*--cef()--*/
virtual CefString ToString(bool include_children) =0;
///
// Returns true if this View is valid.
///
/*--cef()--*/
virtual bool IsValid() =0;
///
// Returns true if this View is currently attached to another View. A View can
// only be attached to one View at a time.
///
/*--cef()--*/
virtual bool IsAttached() =0;
///
// Returns true if this View is the same as |that| View.
///
/*--cef()--*/
virtual bool IsSame(CefRefPtr<CefView> that) =0;
///
// Returns the delegate associated with this View, if any.
///
/*--cef()--*/
virtual CefRefPtr<CefViewDelegate> GetDelegate() =0;
///
// Returns the top-level Window hosting this View, if any.
///
/*--cef()--*/
virtual CefRefPtr<CefWindow> GetWindow() =0;
///
// Returns the ID for this View.
///
/*--cef()--*/
virtual int GetID() =0;
///
// Sets the ID for this View. ID should be unique within the subtree that you
// intend to search for it. 0 is the default ID for views.
///
/*--cef()--*/
virtual void SetID(int id) =0;
///
// Returns the View that contains this View, if any.
///
/*--cef()--*/
virtual CefRefPtr<CefView> GetParentView() =0;
///
// Recursively descends the view tree starting at this View, and returns the
// first child that it encounters with the given ID. Returns NULL if no
// matching child view is found.
///
/*--cef()--*/
virtual CefRefPtr<CefView> GetViewForID(int id) =0;
///
// Sets the bounds (size and position) of this View. Position is in parent
// coordinates.
///
/*--cef()--*/
virtual void SetBounds(const CefRect& bounds) =0;
///
// Returns the bounds (size and position) of this View. Position is in parent
// coordinates.
///
/*--cef()--*/
virtual CefRect GetBounds() =0;
///
// Returns the bounds (size and position) of this View. Position is in screen
// coordinates.
///
/*--cef()--*/
virtual CefRect GetBoundsInScreen() =0;
///
// Sets the size of this View without changing the position.
///
/*--cef()--*/
virtual void SetSize(const CefSize& size) =0;
///
// Returns the size of this View.
///
/*--cef()--*/
virtual CefSize GetSize() =0;
///
// Sets the position of this View without changing the size. |position| is in
// parent coordinates.
///
/*--cef()--*/
virtual void SetPosition(const CefPoint& position) =0;
///
// Returns the position of this View. Position is in parent coordinates.
///
/*--cef()--*/
virtual CefPoint GetPosition() =0;
///
// Returns the size this View would like to be if enough space is available.
///
/*--cef()--*/
virtual CefSize GetPreferredSize() =0;
///
// Size this View to its preferred size.
///
/*--cef()--*/
virtual void SizeToPreferredSize() =0;
///
// Returns the minimum size for this View.
///
/*--cef()--*/
virtual CefSize GetMinimumSize() =0;
///
// Returns the maximum size for this View.
///
/*--cef()--*/
virtual CefSize GetMaximumSize() =0;
///
// Returns the height necessary to display this View with the provided width.
///
/*--cef()--*/
virtual int GetHeightForWidth(int width) =0;
///
// Indicate that this View and all parent Views require a re-layout. This
// ensures the next call to Layout() will propagate to this View even if the
// bounds of parent Views do not change.
///
/*--cef()--*/
virtual void InvalidateLayout() =0;
///
// Sets whether this View is visible. Windows are hidden by default and other
// views are visible by default. This View and any parent views must be set as
// visible for this View to be drawn in a Window. If this View is set as
// hidden then it and any child views will not be drawn and, if any of those
// views currently have focus, then focus will also be cleared. Painting is
// scheduled as needed. If this View is a Window then calling this method is
// equivalent to calling the Window Show() and Hide() methods.
///
/*--cef()--*/
virtual void SetVisible(bool visible) =0;
///
// Returns whether this View is visible. A view may be visible but still not
// drawn in a Window if any parent views are hidden. If this View is a Window
// then a return value of true indicates that this Window is currently visible
// to the user on-screen. If this View is not a Window then call IsDrawn() to
// determine whether this View and all parent views are visible and will be
// drawn.
///
/*--cef()--*/
virtual bool IsVisible() =0;
///
// Returns whether this View is visible and drawn in a Window. A view is drawn
// if it and all parent views are visible. If this View is a Window then
// calling this method is equivalent to calling IsVisible(). Otherwise, to
// determine if the containing Window is visible to the user on-screen call
// IsVisible() on the Window.
///
/*--cef()--*/
virtual bool IsDrawn() =0;
///
// Set whether this View is enabled. A disabled View does not receive keyboard
// or mouse inputs. If |enabled| differs from the current value the View will
// be repainted. Also, clears focus if the focused View is disabled.
///
/*--cef()--*/
virtual void SetEnabled(bool enabled) =0;
///
// Returns whether this View is enabled.
///
/*--cef()--*/
virtual bool IsEnabled() =0;
///
// Sets whether this View is capable of taking focus. It will clear focus if
// the focused View is set to be non-focusable. This is false by default so
// that a View used as a container does not get the focus.
///
/*--cef()--*/
virtual void SetFocusable(bool focusable) =0;
///
// Returns true if this View is focusable, enabled and drawn.
///
/*--cef()--*/
virtual bool IsFocusable() =0;
///
// Return whether this View is focusable when the user requires full keyboard
// access, even though it may not be normally focusable.
///
/*--cef()--*/
virtual bool IsAccessibilityFocusable() =0;
///
// Request keyboard focus. If this View is focusable it will become the
// focused View.
///
/*--cef()--*/
virtual void RequestFocus() =0;
///
// Sets the background color for this View.
///
/*--cef()--*/
virtual void SetBackgroundColor(cef_color_t color) =0;
///
// Returns the background color for this View.
///
/*--cef()--*/
virtual cef_color_t GetBackgroundColor() =0;
///
// Convert |point| from this View's coordinate system to that of the screen.
// This View must belong to a Window when calling this method. Returns true
// if the conversion is successful or false otherwise. Use
// CefDisplay::ConvertPointToPixels() after calling this method if further
// conversion to display-specific pixel coordinates is desired.
///
/*--cef()--*/
virtual bool ConvertPointToScreen(CefPoint& point) =0;
///
// Convert |point| to this View's coordinate system from that of the screen.
// This View must belong to a Window when calling this method. Returns true if
// the conversion is successful or false otherwise. Use
// CefDisplay::ConvertPointFromPixels() before calling this method if
// conversion from display-specific pixel coordinates is necessary.
///
/*--cef()--*/
virtual bool ConvertPointFromScreen(CefPoint& point) =0;
///
// Convert |point| from this View's coordinate system to that of the Window.
// This View must belong to a Window when calling this method. Returns true if
// the conversion is successful or false otherwise.
///
/*--cef()--*/
virtual bool ConvertPointToWindow(CefPoint& point) =0;
///
// Convert |point| to this View's coordinate system from that of the Window.
// This View must belong to a Window when calling this method. Returns true if
// the conversion is successful or false otherwise.
///
/*--cef()--*/
virtual bool ConvertPointFromWindow(CefPoint& point) =0;
///
// Convert |point| from this View's coordinate system to that of |view|.
// |view| needs to be in the same Window but not necessarily the same view
// hierarchy. Returns true if the conversion is successful or false otherwise.
///
/*--cef()--*/
virtual bool ConvertPointToView(CefRefPtr<CefView> view,
CefPoint& point) =0;
///
// Convert |point| to this View's coordinate system from that |view|. |view|
// needs to be in the same Window but not necessarily the same view hierarchy.
// Returns true if the conversion is successful or false otherwise.
///
/*--cef()--*/
virtual bool ConvertPointFromView(CefRefPtr<CefView> view,
CefPoint& point) =0;
};
#endif // CEF_INCLUDE_VIEWS_CEF_VIEW_H_

View File

@ -0,0 +1,113 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_VIEWS_CEF_VIEW_DELEGATE_H_
#define CEF_INCLUDE_VIEWS_CEF_VIEW_DELEGATE_H_
#pragma once
#include "include/cef_base.h"
class CefView;
///
// Implement this interface to handle view events. The methods of this class
// will be called on the browser process UI thread unless otherwise indicated.
///
/*--cef(source=client)--*/
class CefViewDelegate : public virtual CefBase {
public:
///
// Return the preferred size for |view|. The Layout will use this information
// to determine the display size.
///
/*--cef()--*/
virtual CefSize GetPreferredSize(CefRefPtr<CefView> view) {
return CefSize();
}
///
// Return the minimum size for |view|.
///
/*--cef()--*/
virtual CefSize GetMinimumSize(CefRefPtr<CefView> view) {
return CefSize();
}
///
// Return the maximum size for |view|.
///
/*--cef()--*/
virtual CefSize GetMaximumSize(CefRefPtr<CefView> view) {
return CefSize();
}
///
// Return the height necessary to display |view| with the provided |width|.
// If not specified the result of GetPreferredSize().height will be used by
// default. Override if |view|'s preferred height depends upon the width
// (for example, with Labels).
///
/*--cef()--*/
virtual int GetHeightForWidth(CefRefPtr<CefView> view, int width) {
return 0;
}
///
// Called when the parent of |view| has changed. If |view| is being added to
// |parent| then |added| will be true. If |view| is being removed from
// |parent| then |added| will be false. If |view| is being reparented the
// remove notification will be sent before the add notification. Do not modify
// the view hierarchy in this callback.
///
/*--cef()--*/
virtual void OnParentViewChanged(CefRefPtr<CefView> view,
bool added,
CefRefPtr<CefView> parent) {}
///
// Called when a child of |view| has changed. If |child| is being added to
// |view| then |added| will be true. If |child| is being removed from |view|
// then |added| will be false. If |child| is being reparented the remove
// notification will be sent to the old parent before the add notification is
// sent to the new parent. Do not modify the view hierarchy in this callback.
///
/*--cef()--*/
virtual void OnChildViewChanged(CefRefPtr<CefView> view,
bool added,
CefRefPtr<CefView> child) {}
};
#endif // CEF_INCLUDE_VIEWS_CEF_WINDOW_DELEGATE_H_

294
include/views/cef_window.h Normal file
View File

@ -0,0 +1,294 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_VIEWS_CEF_WINDOW_H_
#define CEF_INCLUDE_VIEWS_CEF_WINDOW_H_
#pragma once
#include "include/cef_image.h"
#include "include/cef_menu_model.h"
#include "include/views/cef_display.h"
#include "include/views/cef_panel.h"
#include "include/views/cef_window_delegate.h"
///
// A Window is a top-level Window/widget in the Views hierarchy. By default it
// will have a non-client area with title bar, icon and buttons that supports
// moving and resizing. All size and position values are in density independent
// pixels (DIP) unless otherwise indicated. Methods must be called on the
// browser process UI thread unless otherwise indicated.
///
/*--cef(source=library)--*/
class CefWindow : public CefPanel {
public:
///
// Create a new Window.
///
/*--cef(optional_param=delegate)--*/
static CefRefPtr<CefWindow> CreateTopLevelWindow(
CefRefPtr<CefWindowDelegate> delegate);
///
// Show the Window.
///
/*--cef()--*/
virtual void Show() =0;
///
// Hide the Window.
///
/*--cef()--*/
virtual void Hide() =0;
///
// Sizes the Window to |size| and centers it in the current display.
///
/*--cef()--*/
virtual void CenterWindow(const CefSize& size) =0;
///
// Close the Window.
///
/*--cef()--*/
virtual void Close() =0;
///
// Returns true if the Window has been closed.
///
/*--cef()--*/
virtual bool IsClosed() =0;
///
// Activate the Window, assuming it already exists and is visible.
///
/*--cef()--*/
virtual void Activate() =0;
///
// Deactivate the Window, making the next Window in the Z order the active
// Window.
///
/*--cef()--*/
virtual void Deactivate() =0;
///
// Returns whether the Window is the currently active Window.
///
/*--cef()--*/
virtual bool IsActive() =0;
///
// Bring this Window to the top of other Windows in the Windowing system.
///
/*--cef()--*/
virtual void BringToTop() =0;
///
// Set the Window to be on top of other Windows in the Windowing system.
///
/*--cef()--*/
virtual void SetAlwaysOnTop(bool on_top) =0;
///
// Returns whether the Window has been set to be on top of other Windows in
// the Windowing system.
///
/*--cef()--*/
virtual bool IsAlwaysOnTop() =0;
///
// Maximize the Window.
///
/*--cef()--*/
virtual void Maximize() =0;
///
// Minimize the Window.
///
/*--cef()--*/
virtual void Minimize() =0;
///
// Restore the Window.
///
/*--cef()--*/
virtual void Restore() =0;
///
// Set fullscreen Window state.
///
/*--cef()--*/
virtual void SetFullscreen(bool fullscreen) =0;
///
// Returns true if the Window is maximized.
///
/*--cef()--*/
virtual bool IsMaximized() =0;
///
// Returns true if the Window is minimized.
///
/*--cef()--*/
virtual bool IsMinimized() =0;
///
// Returns true if the Window is fullscreen.
///
/*--cef()--*/
virtual bool IsFullscreen() =0;
///
// Set the Window title.
///
/*--cef(optional_param=title)--*/
virtual void SetTitle(const CefString& title) =0;
///
// Get the Window title.
///
/*--cef()--*/
virtual CefString GetTitle() =0;
///
// Set the Window icon. This should be a 16x16 icon suitable for use in the
// Windows's title bar.
///
/*--cef()--*/
virtual void SetWindowIcon(CefRefPtr<CefImage> image) =0;
///
// Get the Window icon.
///
/*--cef()--*/
virtual CefRefPtr<CefImage> GetWindowIcon() =0;
///
// Set the Window App icon. This should be a larger icon for use in the host
// environment app switching UI. On Windows, this is the ICON_BIG used in
// Alt-Tab list and Windows taskbar. The Window icon will be used by default
// if no Window App icon is specified.
///
/*--cef()--*/
virtual void SetWindowAppIcon(CefRefPtr<CefImage> image) =0;
///
// Get the Window App icon.
///
/*--cef()--*/
virtual CefRefPtr<CefImage> GetWindowAppIcon() =0;
///
// Show a menu with contents |menu_model|. |screen_point| specifies the menu
// position in screen coordinates. |anchor_position| specifies how the menu
// will be anchored relative to |screen_point|.
///
/*--cef()--*/
virtual void ShowMenu(CefRefPtr<CefMenuModel> menu_model,
const CefPoint& screen_point,
cef_menu_anchor_position_t anchor_position) =0;
///
// Cancel the menu that is currently showing, if any.
///
/*--cef()--*/
virtual void CancelMenu() =0;
///
// Returns the Display that most closely intersects the bounds of this Window.
// May return NULL if this Window is not currently displayed.
///
/*--cef()--*/
virtual CefRefPtr<CefDisplay> GetDisplay() =0;
///
// Returns the bounds (size and position) of this Window's client area.
// Position is in screen coordinates.
///
/*--cef()--*/
virtual CefRect GetClientAreaBoundsInScreen() =0;
///
// Set the regions where mouse events will be intercepted by this Window to
// support drag operations. Call this method with an empty vector to clear the
// draggable regions. The draggable region bounds should be in window
// coordinates.
///
/*--cef(optional_param=regions)--*/
virtual void SetDraggableRegions(
const std::vector<CefDraggableRegion>& regions) =0;
///
// Retrieve the platform window handle for this Window.
///
/*--cef()--*/
virtual CefWindowHandle GetWindowHandle() =0;
///
// Simulate a key press. |key_code| is the VKEY_* value from Chromium's
// ui/events/keycodes/keyboard_codes.h header (VK_* values on Windows).
// |event_flags| is some combination of EVENTFLAG_SHIFT_DOWN,
// EVENTFLAG_CONTROL_DOWN and/or EVENTFLAG_ALT_DOWN. This method is exposed
// primarily for testing purposes.
///
/*--cef()--*/
virtual void SendKeyPress(int key_code,
uint32 event_flags) =0;
///
// Simulate a mouse move. The mouse cursor will be moved to the specified
// (screen_x, screen_y) position. This method is exposed primarily for testing
// purposes.
///
/*--cef()--*/
virtual void SendMouseMove(int screen_x, int screen_y) =0;
///
// Simulate mouse down and/or mouse up events. |button| is the mouse button
// type. If |mouse_down| is true a mouse down event will be sent. If
// |mouse_up| is true a mouse up event will be sent. If both are true a mouse
// down event will be sent followed by a mouse up event (equivalent to
// clicking the mouse button). The events will be sent using the current
// cursor position so make sure to call SendMouseMove() first to position the
// mouse. This method is exposed primarily for testing purposes.
///
/*--cef()--*/
virtual void SendMouseEvents(cef_mouse_button_type_t button,
bool mouse_down,
bool mouse_up) =0;
};
#endif // CEF_INCLUDE_VIEWS_CEF_WINDOW_H_

View File

@ -0,0 +1,100 @@
// Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_VIEWS_CEF_WINDOW_DELEGATE_H_
#define CEF_INCLUDE_VIEWS_CEF_WINDOW_DELEGATE_H_
#pragma once
#include "include/views/cef_panel_delegate.h"
class CefWindow;
///
// Implement this interface to handle window events. The methods of this class
// will be called on the browser process UI thread unless otherwise indicated.
///
/*--cef(source=client)--*/
class CefWindowDelegate : public CefPanelDelegate {
public:
///
// Called when |window| is created.
///
/*--cef()--*/
virtual void OnWindowCreated(CefRefPtr<CefWindow> window) {}
///
// Called when |window| is destroyed. Release all references to |window| and
// do not attempt to execute any methods on |window| after this callback
// returns.
///
/*--cef()--*/
virtual void OnWindowDestroyed(CefRefPtr<CefWindow> window) {}
///
// Return true if |window| should be created without a frame or title bar. The
// window will be resizable if CanResize() returns true. Use
// CefWindow::SetDraggableRegions() to specify draggable regions.
///
/*--cef()--*/
virtual bool IsFrameless(CefRefPtr<CefWindow> window) { return false; }
///
// Return true if |window| can be resized.
///
/*--cef()--*/
virtual bool CanResize(CefRefPtr<CefWindow> window) { return true; }
///
// Return true if |window| can be maximized.
///
/*--cef()--*/
virtual bool CanMaximize(CefRefPtr<CefWindow> window) { return true; }
///
// Return true if |window| can be minimized.
///
/*--cef()--*/
virtual bool CanMinimize(CefRefPtr<CefWindow> window) { return true; }
///
// Return true if |window| can be closed. This will be called for user-
// initiated window close actions and when CefWindow::Close() is called.
///
/*--cef()--*/
virtual bool CanClose(CefRefPtr<CefWindow> window) { return true; }
};
#endif // CEF_INCLUDE_VIEWS_CEF_WINDOW_DELEGATE_H_

View File

@ -11,11 +11,14 @@
#include "libcef/browser/browser_context_impl.h" #include "libcef/browser/browser_context_impl.h"
#include "libcef/browser/browser_info.h" #include "libcef/browser/browser_info.h"
#include "libcef/browser/browser_info_manager.h" #include "libcef/browser/browser_info_manager.h"
#include "libcef/browser/browser_platform_delegate.h"
#include "libcef/browser/browser_util.h"
#include "libcef/browser/content_browser_client.h" #include "libcef/browser/content_browser_client.h"
#include "libcef/browser/context.h" #include "libcef/browser/context.h"
#include "libcef/browser/devtools_delegate.h" #include "libcef/browser/devtools_delegate.h"
#include "libcef/browser/devtools_frontend.h" #include "libcef/browser/devtools_frontend.h"
#include "libcef/browser/extensions/browser_extensions_util.h" #include "libcef/browser/extensions/browser_extensions_util.h"
#include "libcef/browser/image_impl.h"
#include "libcef/browser/media_capture_devices_dispatcher.h" #include "libcef/browser/media_capture_devices_dispatcher.h"
#include "libcef/browser/navigate_params.h" #include "libcef/browser/navigate_params.h"
#include "libcef/browser/navigation_entry_impl.h" #include "libcef/browser/navigation_entry_impl.h"
@ -149,45 +152,25 @@ void ShowDevToolsWithHelper(ShowDevToolsHelper* helper) {
delete helper; delete helper;
} }
// Convert a NativeWebKeyboardEvent to a CefKeyEvent. // Callback from CefBrowserHostImpl::DownloadImage.
bool GetCefKeyEvent(const content::NativeWebKeyboardEvent& event, void OnDownloadImage(uint32 max_image_size,
CefKeyEvent& cef_event) { CefRefPtr<CefDownloadImageCallback> callback,
switch (event.type) { int id,
case blink::WebKeyboardEvent::RawKeyDown: int http_status_code,
cef_event.type = KEYEVENT_RAWKEYDOWN; const GURL& image_url,
break; const std::vector<SkBitmap>& bitmaps,
case blink::WebKeyboardEvent::KeyDown: const std::vector<gfx::Size>& sizes) {
cef_event.type = KEYEVENT_KEYDOWN; CEF_REQUIRE_UIT();
break;
case blink::WebKeyboardEvent::KeyUp: CefRefPtr<CefImageImpl> image_impl;
cef_event.type = KEYEVENT_KEYUP;
break; if (!bitmaps.empty()) {
case blink::WebKeyboardEvent::Char: image_impl = new CefImageImpl();
cef_event.type = KEYEVENT_CHAR; image_impl->AddBitmaps(max_image_size, bitmaps);
break;
default:
return false;
} }
cef_event.modifiers = 0; callback->OnDownloadImageFinished(image_url.spec(), http_status_code,
if (event.modifiers & blink::WebKeyboardEvent::ShiftKey) image_impl.get());
cef_event.modifiers |= EVENTFLAG_SHIFT_DOWN;
if (event.modifiers & blink::WebKeyboardEvent::ControlKey)
cef_event.modifiers |= EVENTFLAG_CONTROL_DOWN;
if (event.modifiers & blink::WebKeyboardEvent::AltKey)
cef_event.modifiers |= EVENTFLAG_ALT_DOWN;
if (event.modifiers & blink::WebKeyboardEvent::MetaKey)
cef_event.modifiers |= EVENTFLAG_COMMAND_DOWN;
if (event.modifiers & blink::WebKeyboardEvent::IsKeyPad)
cef_event.modifiers |= EVENTFLAG_IS_KEY_PAD;
cef_event.windows_key_code = event.windowsKeyCode;
cef_event.native_key_code = event.nativeKeyCode;
cef_event.is_system_key = event.isSystemKey;
cef_event.character = event.text[0];
cef_event.unmodified_character = event.unmodifiedText[0];
return true;
} }
} // namespace } // namespace
@ -263,9 +246,15 @@ CefRefPtr<CefBrowser> CefBrowserHost::CreateBrowserSync(
return nullptr; return nullptr;
} }
CefBrowserHostImpl::CreateParams create_params;
create_params.window_info.reset(new CefWindowInfo(windowInfo));
create_params.client = client;
create_params.url = url;
create_params.settings = settings;
create_params.request_context = request_context;
CefRefPtr<CefBrowserHostImpl> browser = CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::Create(windowInfo, client, url, settings, CefBrowserHostImpl::Create(create_params);
NULL, false, request_context);
return browser.get(); return browser.get();
} }
@ -275,28 +264,60 @@ CefRefPtr<CefBrowser> CefBrowserHost::CreateBrowserSync(
// static // static
CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::Create( CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::Create(
const CefWindowInfo& windowInfo, CreateParams& create_params) {
CefRefPtr<CefClient> client,
const CefString& url,
const CefBrowserSettings& settings,
CefRefPtr<CefBrowserHostImpl> opener,
bool is_popup,
CefRefPtr<CefRequestContext> request_context) {
scoped_ptr<CefBrowserPlatformDelegate> platform_delegate = scoped_ptr<CefBrowserPlatformDelegate> platform_delegate =
CefBrowserPlatformDelegate::Create(windowInfo, settings, client); CefBrowserPlatformDelegate::Create(create_params);
CHECK(platform_delegate.get()); CHECK(platform_delegate);
const bool is_devtools_popup = !!create_params.devtools_opener;
scoped_refptr<CefBrowserInfo> info = scoped_refptr<CefBrowserInfo> info =
CefBrowserInfoManager::GetInstance()->CreateBrowserInfo( CefBrowserInfoManager::GetInstance()->CreateBrowserInfo(
is_popup, platform_delegate->IsWindowless()); is_devtools_popup,
platform_delegate->IsWindowless());
// Get or create the request context and browser context.
CefRefPtr<CefRequestContextImpl> request_context_impl =
CefRequestContextImpl::GetForRequestContext(
create_params.request_context);
DCHECK(request_context_impl);
scoped_refptr<CefBrowserContext> browser_context =
request_context_impl->GetBrowserContext();
DCHECK(browser_context);
if (!create_params.request_context) {
// Using the global request context.
create_params.request_context = request_context_impl.get();
}
content::WebContents::CreateParams wc_create_params(
browser_context.get());
if (platform_delegate->IsWindowless()) {
// Create the OSR view for the WebContents.
platform_delegate->CreateViewForWebContents(
&wc_create_params.view,
&wc_create_params.delegate_view);
}
content::WebContents* web_contents =
content::WebContents::Create(wc_create_params);
DCHECK(web_contents);
CefRefPtr<CefBrowserHostImpl> browser = CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::CreateInternal(settings, client, NULL, info, opener, CefBrowserHostImpl::CreateInternal(
request_context, create_params.settings,
std::move(platform_delegate)); create_params.client,
if (browser.get() && !url.empty()) { web_contents,
browser->LoadURL(CefFrameHostImpl::kMainFrameId, url, content::Referrer(), info,
ui::PAGE_TRANSITION_TYPED, std::string()); create_params.devtools_opener,
is_devtools_popup,
create_params.request_context,
std::move(platform_delegate));
if (browser.get() && !create_params.url.empty()) {
browser->LoadURL(CefFrameHostImpl::kMainFrameId, create_params.url,
content::Referrer(), ui::PAGE_TRANSITION_TYPED,
std::string());
} }
return browser.get(); return browser.get();
} }
@ -308,38 +329,28 @@ CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::CreateInternal(
content::WebContents* web_contents, content::WebContents* web_contents,
scoped_refptr<CefBrowserInfo> browser_info, scoped_refptr<CefBrowserInfo> browser_info,
CefRefPtr<CefBrowserHostImpl> opener, CefRefPtr<CefBrowserHostImpl> opener,
bool is_devtools_popup,
CefRefPtr<CefRequestContext> request_context, CefRefPtr<CefRequestContext> request_context,
scoped_ptr<CefBrowserPlatformDelegate> platform_delegate) { scoped_ptr<CefBrowserPlatformDelegate> platform_delegate) {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
DCHECK(browser_info.get()); DCHECK(web_contents);
DCHECK(browser_info);
DCHECK(request_context);
DCHECK(platform_delegate);
// If |opener| is non-NULL it must be a popup window. // If |opener| is non-NULL it must be a popup window.
DCHECK(!opener.get() || browser_info->is_popup()); DCHECK(!opener.get() || browser_info->is_popup());
if (!web_contents) { if (opener) {
// Get or create the request context and browser context. // Give the opener browser's platform delegate an opportunity to modify the
CefRefPtr<CefRequestContextImpl> request_context_impl = // new browser's platform delegate.
CefRequestContextImpl::GetForRequestContext(request_context); opener->platform_delegate_->PopupWebContentsCreated(
DCHECK(request_context_impl.get()); settings, client, web_contents, platform_delegate.get(),
scoped_refptr<CefBrowserContext> browser_context = is_devtools_popup);
request_context_impl->GetBrowserContext();
DCHECK(browser_context.get());
if (!request_context.get())
request_context = request_context_impl.get();
content::WebContents::CreateParams create_params(
browser_context.get());
if (platform_delegate->IsWindowless()) {
platform_delegate->CreateViewForWebContents(&create_params.view,
&create_params.delegate_view);
}
web_contents = content::WebContents::Create(create_params);
platform_delegate->WebContentsCreated(web_contents);
} }
platform_delegate->WebContentsCreated(web_contents);
CefRefPtr<CefBrowserHostImpl> browser = CefRefPtr<CefBrowserHostImpl> browser =
new CefBrowserHostImpl(settings, client, web_contents, browser_info, new CefBrowserHostImpl(settings, client, web_contents, browser_info,
opener, request_context, opener, request_context,
@ -347,12 +358,28 @@ CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::CreateInternal(
if (!browser->CreateHostWindow()) if (!browser->CreateHostWindow())
return nullptr; return nullptr;
// Notify that the browser has been created. These must be delivered in the
// expected order.
// 1. Notify the browser's LifeSpanHandler. This must always be the first
// notification for the browser.
if (client.get()) { if (client.get()) {
CefRefPtr<CefLifeSpanHandler> handler = client->GetLifeSpanHandler(); CefRefPtr<CefLifeSpanHandler> handler = client->GetLifeSpanHandler();
if (handler.get()) if (handler.get())
handler->OnAfterCreated(browser.get()); handler->OnAfterCreated(browser.get());
} }
// 2. Notify the platform delegate. With Views this will result in a call to
// CefBrowserViewDelegate::OnBrowserCreated().
browser->platform_delegate_->NotifyBrowserCreated();
if (opener) {
// 3. Notify the opener browser's platform delegate. With Views this will
// result in a call to CefBrowserViewDelegate::OnPopupBrowserViewCreated().
opener->platform_delegate_->PopupBrowserCreated(browser.get(),
is_devtools_popup);
}
return browser; return browser;
} }
@ -539,6 +566,27 @@ void CefBrowserHostImpl::CloseBrowser(bool force_close) {
} }
} }
bool CefBrowserHostImpl::TryCloseBrowser() {
if (!CEF_CURRENTLY_ON_UIT()) {
NOTREACHED() << "called on invalid thread";
return false;
}
// Protect against multiple requests to close while the close is pending.
if (destruction_state_ <= DESTRUCTION_STATE_PENDING) {
if (destruction_state_ == DESTRUCTION_STATE_NONE) {
// Request that the browser close.
CloseBrowser(false);
}
// Cancel the close.
return false;
}
// Allow the close.
return true;
}
void CefBrowserHostImpl::SetFocus(bool focus) { void CefBrowserHostImpl::SetFocus(bool focus) {
if (!CEF_CURRENTLY_ON_UIT()) { if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT, CEF_POST_TASK(CEF_UIT,
@ -569,13 +617,23 @@ void CefBrowserHostImpl::SetWindowVisibility(bool visible) {
} }
CefWindowHandle CefBrowserHostImpl::GetWindowHandle() { CefWindowHandle CefBrowserHostImpl::GetWindowHandle() {
return platform_delegate_->GetHostWindowHandle(); if (IsViewsHosted() && CEF_CURRENTLY_ON_UIT()) {
// Always return the most up-to-date window handle for a views-hosted
// browser since it may change if the view is re-parented.
if (platform_delegate_)
return platform_delegate_->GetHostWindowHandle();
}
return host_window_handle_;
} }
CefWindowHandle CefBrowserHostImpl::GetOpenerWindowHandle() { CefWindowHandle CefBrowserHostImpl::GetOpenerWindowHandle() {
return opener_; return opener_;
} }
bool CefBrowserHostImpl::HasView() {
return IsViewsHosted();
}
CefRefPtr<CefClient> CefBrowserHostImpl::GetClient() { CefRefPtr<CefClient> CefBrowserHostImpl::GetClient() {
return client_; return client_;
} }
@ -657,6 +715,34 @@ void CefBrowserHostImpl::StartDownload(const CefString& url) {
manager->DownloadUrl(std::move(params)); manager->DownloadUrl(std::move(params));
} }
void CefBrowserHostImpl::DownloadImage(
const CefString& image_url,
bool is_favicon,
uint32 max_image_size,
bool bypass_cache,
CefRefPtr<CefDownloadImageCallback> callback) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::DownloadImage, this, image_url,
is_favicon, max_image_size, bypass_cache, callback));
return;
}
if (!callback)
return;
GURL gurl = GURL(image_url.ToString());
if (gurl.is_empty() || !gurl.is_valid())
return;
if (!web_contents())
return;
web_contents()->DownloadImage(
gurl, is_favicon, max_image_size * gfx::ImageSkia::GetMaxSupportedScale(),
bypass_cache, base::Bind(OnDownloadImage, max_image_size, callback));
}
void CefBrowserHostImpl::Print() { void CefBrowserHostImpl::Print() {
if (CEF_CURRENTLY_ON_UIT()) { if (CEF_CURRENTLY_ON_UIT()) {
content::WebContents* actionable_contents = GetActionableWebContents(); content::WebContents* actionable_contents = GetActionableWebContents();
@ -1262,6 +1348,10 @@ bool CefBrowserHostImpl::IsWindowless() const {
return is_windowless_; return is_windowless_;
} }
bool CefBrowserHostImpl::IsViewsHosted() const {
return is_views_hosted_;
}
void CefBrowserHostImpl::WindowDestroyed() { void CefBrowserHostImpl::WindowDestroyed() {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
DCHECK(!window_destroyed_); DCHECK(!window_destroyed_);
@ -1274,6 +1364,15 @@ void CefBrowserHostImpl::DestroyBrowser() {
destruction_state_ = DESTRUCTION_STATE_COMPLETED; destruction_state_ = DESTRUCTION_STATE_COMPLETED;
// Notify that this browser has been destroyed. These must be delivered in the
// expected order.
// 1. Notify the platform delegate. With Views this will result in a call to
// CefBrowserViewDelegate::OnBrowserDestroyed().
platform_delegate_->NotifyBrowserDestroyed();
// 2. Notify the browser's LifeSpanHandler. This must always be the last
// notification for this browser.
if (client_.get()) { if (client_.get()) {
CefRefPtr<CefLifeSpanHandler> handler = client_->GetLifeSpanHandler(); CefRefPtr<CefLifeSpanHandler> handler = client_->GetLifeSpanHandler();
if (handler.get()) { if (handler.get()) {
@ -1290,7 +1389,10 @@ void CefBrowserHostImpl::DestroyBrowser() {
if (menu_manager_.get()) if (menu_manager_.get())
menu_manager_->Destroy(); menu_manager_->Destroy();
// Notify any observers that may have state associated with this browser.
FOR_EACH_OBSERVER(Observer, observers_, OnBrowserDestroyed(this)); FOR_EACH_OBSERVER(Observer, observers_, OnBrowserDestroyed(this));
// Disassociate the platform delegate from this browser.
platform_delegate_->BrowserDestroyed(this); platform_delegate_->BrowserDestroyed(this);
while (!queued_messages_.empty()) { while (!queued_messages_.empty()) {
@ -1323,7 +1425,14 @@ views::Widget* CefBrowserHostImpl::GetWindowWidget() const {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
return platform_delegate_->GetWindowWidget(); return platform_delegate_->GetWindowWidget();
} }
#endif
CefRefPtr<CefBrowserView> CefBrowserHostImpl::GetBrowserView() const {
CEF_REQUIRE_UIT();
if (IsViewsHosted())
return platform_delegate_->GetBrowserView();
return nullptr;
}
#endif // defined(USE_AURA)
void CefBrowserHostImpl::CancelContextMenu() { void CefBrowserHostImpl::CancelContextMenu() {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
@ -2006,7 +2115,7 @@ bool CefBrowserHostImpl::PreHandleKeyboardEvent(
CefRefPtr<CefKeyboardHandler> handler = client_->GetKeyboardHandler(); CefRefPtr<CefKeyboardHandler> handler = client_->GetKeyboardHandler();
if (handler.get()) { if (handler.get()) {
CefKeyEvent cef_event; CefKeyEvent cef_event;
if (!GetCefKeyEvent(event, cef_event)) if (!browser_util::GetCefKeyEvent(event, cef_event))
return false; return false;
cef_event.focus_on_editable_field = focus_on_editable_field_; cef_event.focus_on_editable_field = focus_on_editable_field_;
@ -2031,7 +2140,7 @@ void CefBrowserHostImpl::HandleKeyboardEvent(
CefRefPtr<CefKeyboardHandler> handler = client_->GetKeyboardHandler(); CefRefPtr<CefKeyboardHandler> handler = client_->GetKeyboardHandler();
if (handler.get()) { if (handler.get()) {
CefKeyEvent cef_event; CefKeyEvent cef_event;
if (GetCefKeyEvent(event, cef_event)) { if (browser_util::GetCefKeyEvent(event, cef_event)) {
cef_event.focus_on_editable_field = focus_on_editable_field_; cef_event.focus_on_editable_field = focus_on_editable_field_;
CefEventHandle event_handle = platform_delegate_->GetEventHandle(event); CefEventHandle event_handle = platform_delegate_->GetEventHandle(event);
@ -2090,7 +2199,6 @@ void CefBrowserHostImpl::WebContentsCreated(
const std::string& frame_name, const std::string& frame_name,
const GURL& target_url, const GURL& target_url,
content::WebContents* new_contents) { content::WebContents* new_contents) {
CefWindowInfo window_info;
CefBrowserSettings settings; CefBrowserSettings settings;
CefRefPtr<CefClient> client; CefRefPtr<CefClient> client;
scoped_ptr<CefBrowserPlatformDelegate> platform_delegate; scoped_ptr<CefBrowserPlatformDelegate> platform_delegate;
@ -2105,8 +2213,6 @@ void CefBrowserHostImpl::WebContentsCreated(
DCHECK(info.get()); DCHECK(info.get());
DCHECK(info->is_popup()); DCHECK(info->is_popup());
platform_delegate->WebContentsCreated(new_contents);
CefRefPtr<CefBrowserHostImpl> opener = GetBrowserForContents(source_contents); CefRefPtr<CefBrowserHostImpl> opener = GetBrowserForContents(source_contents);
DCHECK(opener.get()); DCHECK(opener.get());
@ -2118,7 +2224,7 @@ void CefBrowserHostImpl::WebContentsCreated(
DCHECK(request_context.get()); DCHECK(request_context.get());
CefRefPtr<CefBrowserHostImpl> browser = CefBrowserHostImpl::CreateInternal( CefRefPtr<CefBrowserHostImpl> browser = CefBrowserHostImpl::CreateInternal(
settings, client, new_contents, info, opener, request_context, settings, client, new_contents, info, opener, false, request_context,
std::move(platform_delegate)); std::move(platform_delegate));
} }
@ -2446,9 +2552,12 @@ void CefBrowserHostImpl::DidUpdateFaviconURL(
std::vector<CefString> icon_urls; std::vector<CefString> icon_urls;
std::vector<content::FaviconURL>::const_iterator it = std::vector<content::FaviconURL>::const_iterator it =
candidates.begin(); candidates.begin();
for (; it != candidates.end(); ++it) for (; it != candidates.end(); ++it) {
icon_urls.push_back(it->icon_url.spec()); if (it->icon_type == content::FaviconURL::FAVICON)
handler->OnFaviconURLChange(this, icon_urls); icon_urls.push_back(it->icon_url.spec());
}
if (!icon_urls.empty())
handler->OnFaviconURLChange(this, icon_urls);
} }
} }
} }
@ -2639,6 +2748,8 @@ CefBrowserHostImpl::CefBrowserHostImpl(
request_context_(request_context), request_context_(request_context),
platform_delegate_(std::move(platform_delegate)), platform_delegate_(std::move(platform_delegate)),
is_windowless_(platform_delegate_->IsWindowless()), is_windowless_(platform_delegate_->IsWindowless()),
is_views_hosted_(platform_delegate_->IsViewsHosted()),
host_window_handle_(kNullWindowHandle),
is_loading_(false), is_loading_(false),
can_go_back_(false), can_go_back_(false),
can_go_forward_(false), can_go_forward_(false),
@ -2654,10 +2765,11 @@ CefBrowserHostImpl::CefBrowserHostImpl(
focus_on_editable_field_(false), focus_on_editable_field_(false),
mouse_cursor_change_disabled_(false), mouse_cursor_change_disabled_(false),
devtools_frontend_(NULL) { devtools_frontend_(NULL) {
if (opener.get()) if (opener.get() && !platform_delegate_->IsViewsHosted()) {
// GetOpenerWindowHandle() only returns a value for non-views-hosted
// popup browsers.
opener_ = opener->GetWindowHandle(); opener_ = opener->GetWindowHandle();
}
DCHECK(request_context_.get());
DCHECK(!browser_info_->browser().get()); DCHECK(!browser_info_->browser().get());
browser_info_->set_browser(this); browser_info_->set_browser(this);
@ -2692,13 +2804,19 @@ CefBrowserHostImpl::CefBrowserHostImpl(
// Make sure RenderViewCreated is called at least one time. // Make sure RenderViewCreated is called at least one time.
RenderViewCreated(web_contents->GetRenderViewHost()); RenderViewCreated(web_contents->GetRenderViewHost());
// Associate the platform delegate with this browser.
platform_delegate_->BrowserCreated(this); platform_delegate_->BrowserCreated(this);
} }
bool CefBrowserHostImpl::CreateHostWindow() { bool CefBrowserHostImpl::CreateHostWindow() {
if (IsWindowless()) // |host_window_handle_| will not change after initial host creation for
return true; // non-views-hosted browsers.
return platform_delegate_->CreateHostWindow(); bool success = true;
if (!IsWindowless())
success = platform_delegate_->CreateHostWindow();
if (success && !IsViewsHosted())
host_window_handle_ = platform_delegate_->GetHostWindowHandle();
return success;
} }
CefRefPtr<CefFrame> CefBrowserHostImpl::GetOrCreateFrame( CefRefPtr<CefFrame> CefBrowserHostImpl::GetOrCreateFrame(

View File

@ -15,8 +15,8 @@
#include "include/cef_browser.h" #include "include/cef_browser.h"
#include "include/cef_client.h" #include "include/cef_client.h"
#include "include/cef_frame.h" #include "include/cef_frame.h"
#include "include/views/cef_browser_view.h"
#include "libcef/browser/browser_info.h" #include "libcef/browser/browser_info.h"
#include "libcef/browser/browser_platform_delegate.h"
#include "libcef/browser/file_dialog_manager.h" #include "libcef/browser/file_dialog_manager.h"
#include "libcef/browser/frame_host_impl.h" #include "libcef/browser/frame_host_impl.h"
#include "libcef/browser/javascript_dialog_manager.h" #include "libcef/browser/javascript_dialog_manager.h"
@ -37,10 +37,17 @@ namespace net {
class URLRequest; class URLRequest;
} }
#if defined(USE_AURA)
namespace views {
class Widget;
}
#endif // defined(USE_AURA)
struct Cef_DraggableRegion_Params; struct Cef_DraggableRegion_Params;
struct Cef_Request_Params; struct Cef_Request_Params;
struct Cef_Response_Params; struct Cef_Response_Params;
class CefBrowserInfo; class CefBrowserInfo;
class CefBrowserPlatformDelegate;
class CefDevToolsFrontend; class CefDevToolsFrontend;
struct CefNavigateParams; struct CefNavigateParams;
class SiteInstance; class SiteInstance;
@ -86,15 +93,37 @@ class CefBrowserHostImpl : public CefBrowserHost,
~CefBrowserHostImpl() override; ~CefBrowserHostImpl() override;
struct CreateParams {
// Platform-specific window creation info. Will be nullptr when creating a
// views-hosted browser.
scoped_ptr<CefWindowInfo> window_info;
#if defined(USE_AURA)
// The BrowserView that will own a views-hosted browser. Will be nullptr for
// popup browsers (the BrowserView will be created later in that case).
CefRefPtr<CefBrowserView> browser_view;
#endif
// Client implementation. May be nullptr.
CefRefPtr<CefClient> client;
// Initial URL to load. May be empty.
CefString url;
// Browser settings.
CefBrowserSettings settings;
// Other browser that opened this DevTools browser. Will be nullptr for non-
// DevTools browsers.
CefRefPtr<CefBrowserHostImpl> devtools_opener;
// Request context to use when creating the browser. If nullptr the global
// request context will be used.
CefRefPtr<CefRequestContext> request_context;
};
// Create a new CefBrowserHostImpl instance. // Create a new CefBrowserHostImpl instance.
static CefRefPtr<CefBrowserHostImpl> Create( static CefRefPtr<CefBrowserHostImpl> Create(CreateParams& create_params);
const CefWindowInfo& windowInfo,
CefRefPtr<CefClient> client,
const CefString& url,
const CefBrowserSettings& settings,
CefRefPtr<CefBrowserHostImpl> opener,
bool is_popup,
CefRefPtr<CefRequestContext> request_context);
// Returns the browser associated with the specified RenderViewHost. // Returns the browser associated with the specified RenderViewHost.
static CefRefPtr<CefBrowserHostImpl> GetBrowserForHost( static CefRefPtr<CefBrowserHostImpl> GetBrowserForHost(
@ -118,10 +147,12 @@ class CefBrowserHostImpl : public CefBrowserHost,
// CefBrowserHost methods. // CefBrowserHost methods.
CefRefPtr<CefBrowser> GetBrowser() override; CefRefPtr<CefBrowser> GetBrowser() override;
void CloseBrowser(bool force_close) override; void CloseBrowser(bool force_close) override;
bool TryCloseBrowser() override;
void SetFocus(bool focus) override; void SetFocus(bool focus) override;
void SetWindowVisibility(bool visible) override; void SetWindowVisibility(bool visible) override;
CefWindowHandle GetWindowHandle() override; CefWindowHandle GetWindowHandle() override;
CefWindowHandle GetOpenerWindowHandle() override; CefWindowHandle GetOpenerWindowHandle() override;
bool HasView() override;
CefRefPtr<CefClient> GetClient() override; CefRefPtr<CefClient> GetClient() override;
CefRefPtr<CefRequestContext> GetRequestContext() override; CefRefPtr<CefRequestContext> GetRequestContext() override;
double GetZoomLevel() override; double GetZoomLevel() override;
@ -134,6 +165,11 @@ class CefBrowserHostImpl : public CefBrowserHost,
int selected_accept_filter, int selected_accept_filter,
CefRefPtr<CefRunFileDialogCallback> callback) override; CefRefPtr<CefRunFileDialogCallback> callback) override;
void StartDownload(const CefString& url) override; void StartDownload(const CefString& url) override;
void DownloadImage(const CefString& image_url,
bool is_favicon,
uint32 max_image_size,
bool bypass_cache,
CefRefPtr<CefDownloadImageCallback> callback) override;
void Print() override; void Print() override;
void PrintToPDF(const CefString& path, void PrintToPDF(const CefString& path,
const CefPdfPrintSettings& settings, const CefPdfPrintSettings& settings,
@ -212,6 +248,9 @@ class CefBrowserHostImpl : public CefBrowserHost,
// Returns true if windowless rendering is enabled. // Returns true if windowless rendering is enabled.
bool IsWindowless() const; bool IsWindowless() const;
// Returns true if this browser is views-hosted.
bool IsViewsHosted() const;
// Called when the OS window hosting the browser is destroyed. // Called when the OS window hosting the browser is destroyed.
void WindowDestroyed(); void WindowDestroyed();
@ -226,6 +265,10 @@ class CefBrowserHostImpl : public CefBrowserHost,
// Returns the Widget owner for the browser window. Only used with windowed // Returns the Widget owner for the browser window. Only used with windowed
// rendering. // rendering.
views::Widget* GetWindowWidget() const; views::Widget* GetWindowWidget() const;
// Returns the BrowserView associated with this browser. Only used with views-
// based browsers.
CefRefPtr<CefBrowserView> GetBrowserView() const;
#endif #endif
// Returns the frame associated with the specified URLRequest. // Returns the frame associated with the specified URLRequest.
@ -271,7 +314,8 @@ class CefBrowserHostImpl : public CefBrowserHost,
// Set the frame that currently has focus. // Set the frame that currently has focus.
void SetFocusedFrame(int64 frame_id); void SetFocusedFrame(int64 frame_id);
// Convert from view coordinates to screen coordinates. // Convert from view coordinates to screen coordinates. Potential display
// scaling will be applied to the result.
gfx::Point GetScreenPoint(const gfx::Point& view) const; gfx::Point GetScreenPoint(const gfx::Point& view) const;
// Thread safe accessors. // Thread safe accessors.
@ -449,6 +493,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
content::WebContents* web_contents, content::WebContents* web_contents,
scoped_refptr<CefBrowserInfo> browser_info, scoped_refptr<CefBrowserInfo> browser_info,
CefRefPtr<CefBrowserHostImpl> opener, CefRefPtr<CefBrowserHostImpl> opener,
bool is_devtools_popup,
CefRefPtr<CefRequestContext> request_context, CefRefPtr<CefRequestContext> request_context,
scoped_ptr<CefBrowserPlatformDelegate> platform_delegate); scoped_ptr<CefBrowserPlatformDelegate> platform_delegate);
@ -521,6 +566,8 @@ class CefBrowserHostImpl : public CefBrowserHost,
CefRefPtr<CefRequestContext> request_context_; CefRefPtr<CefRequestContext> request_context_;
scoped_ptr<CefBrowserPlatformDelegate> platform_delegate_; scoped_ptr<CefBrowserPlatformDelegate> platform_delegate_;
const bool is_windowless_; const bool is_windowless_;
const bool is_views_hosted_;
CefWindowHandle host_window_handle_;
// Volatile state information. All access must be protected by the state lock. // Volatile state information. All access must be protected by the state lock.
base::Lock state_lock_; base::Lock state_lock_;

View File

@ -202,8 +202,10 @@ bool CefBrowserInfoManager::CanCreateWindow(
CefRefPtr<CefClient> client = browser->GetClient(); CefRefPtr<CefClient> client = browser->GetClient();
bool allow = true; bool allow = true;
scoped_ptr<CefWindowInfo> window_info(new CefWindowInfo);
#if defined(OS_WIN) #if defined(OS_WIN)
pending_popup->window_info.SetAsPopup(NULL, CefString()); window_info->SetAsPopup(NULL, CefString());
#endif #endif
// Start with the current browser's settings. // Start with the current browser's settings.
@ -222,13 +224,13 @@ bool CefBrowserInfoManager::CanCreateWindow(
#if (defined(OS_WIN) || defined(OS_MACOSX)) #if (defined(OS_WIN) || defined(OS_MACOSX))
// Default to the size from the popup features. // Default to the size from the popup features.
if (cef_features.xSet) if (cef_features.xSet)
pending_popup->window_info.x = cef_features.x; window_info->x = cef_features.x;
if (cef_features.ySet) if (cef_features.ySet)
pending_popup->window_info.y = cef_features.y; window_info->y = cef_features.y;
if (cef_features.widthSet) if (cef_features.widthSet)
pending_popup->window_info.width = cef_features.width; window_info->width = cef_features.width;
if (cef_features.heightSet) if (cef_features.heightSet)
pending_popup->window_info.height = cef_features.height; window_info->height = cef_features.height;
#endif #endif
allow = !handler->OnBeforePopup(browser.get(), allow = !handler->OnBeforePopup(browser.get(),
@ -238,7 +240,7 @@ bool CefBrowserInfoManager::CanCreateWindow(
static_cast<cef_window_open_disposition_t>(disposition), static_cast<cef_window_open_disposition_t>(disposition),
user_gesture, user_gesture,
cef_features, cef_features,
pending_popup->window_info, *window_info,
pending_popup->client, pending_popup->client,
pending_popup->settings, pending_popup->settings,
no_javascript_access); no_javascript_access);
@ -246,10 +248,16 @@ bool CefBrowserInfoManager::CanCreateWindow(
} }
if (allow) { if (allow) {
CefBrowserHostImpl::CreateParams create_params;
if (!browser->IsViewsHosted())
create_params.window_info = std::move(window_info);
create_params.settings = pending_popup->settings;
create_params.client = pending_popup->client;
pending_popup->platform_delegate = pending_popup->platform_delegate =
CefBrowserPlatformDelegate::Create(pending_popup->window_info, CefBrowserPlatformDelegate::Create(create_params);
pending_popup->settings,
pending_popup->client);
CHECK(pending_popup->platform_delegate.get()); CHECK(pending_popup->platform_delegate.get());
pending_popup->step = pending_popup->step =

View File

@ -168,7 +168,6 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
std::string target_frame_name; std::string target_frame_name;
// Values specified by OnBeforePopup. // Values specified by OnBeforePopup.
CefWindowInfo window_info;
CefBrowserSettings settings; CefBrowserSettings settings;
CefRefPtr<CefClient> client; CefRefPtr<CefClient> client;

View File

@ -34,7 +34,7 @@ void CefBrowserPlatformDelegate::RenderViewCreated(
content::RenderViewHost* render_view_host) { content::RenderViewHost* render_view_host) {
// Indicate that the view has an external parent (namely us). This changes the // Indicate that the view has an external parent (namely us). This changes the
// default view behavior in some cases (e.g. focus handling on Linux). // default view behavior in some cases (e.g. focus handling on Linux).
if (render_view_host->GetWidget()->GetView()) if (!IsViewsHosted() && render_view_host->GetWidget()->GetView())
render_view_host->GetWidget()->GetView()->SetHasExternalParent(true); render_view_host->GetWidget()->GetView()->SetHasExternalParent(true);
} }
@ -43,6 +43,12 @@ void CefBrowserPlatformDelegate::BrowserCreated(CefBrowserHostImpl* browser) {
browser_ = browser; browser_ = browser;
} }
void CefBrowserPlatformDelegate::NotifyBrowserCreated() {
}
void CefBrowserPlatformDelegate::NotifyBrowserDestroyed() {
}
void CefBrowserPlatformDelegate::BrowserDestroyed(CefBrowserHostImpl* browser) { void CefBrowserPlatformDelegate::BrowserDestroyed(CefBrowserHostImpl* browser) {
DCHECK(browser_ && browser_ == browser); DCHECK(browser_ && browser_ == browser);
browser_ = nullptr; browser_ = nullptr;
@ -62,7 +68,25 @@ views::Widget* CefBrowserPlatformDelegate::GetWindowWidget() const {
NOTREACHED(); NOTREACHED();
return nullptr; return nullptr;
} }
#endif
CefRefPtr<CefBrowserView> CefBrowserPlatformDelegate::GetBrowserView() const {
NOTREACHED();
return nullptr;
}
#endif // defined(USE_AURA)
void CefBrowserPlatformDelegate::PopupWebContentsCreated(
const CefBrowserSettings& settings,
CefRefPtr<CefClient> client,
content::WebContents* new_web_contents,
CefBrowserPlatformDelegate* new_platform_delegate,
bool is_devtools) {
}
void CefBrowserPlatformDelegate::PopupBrowserCreated(
CefBrowserHostImpl* new_browser,
bool is_devtools) {
}
void CefBrowserPlatformDelegate::SendCaptureLostEvent() { void CefBrowserPlatformDelegate::SendCaptureLostEvent() {
content::RenderWidgetHostImpl* widget = content::RenderWidgetHostImpl* widget =

View File

@ -11,7 +11,9 @@
#include "include/cef_client.h" #include "include/cef_client.h"
#include "include/cef_drag_data.h" #include "include/cef_drag_data.h"
#include "include/views/cef_browser_view.h"
#include "include/internal/cef_types.h" #include "include/internal/cef_types.h"
#include "libcef/browser/browser_host_impl.h"
#include "base/callback.h" #include "base/callback.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
@ -35,7 +37,6 @@ class Widget;
} }
#endif #endif
class CefBrowserHostImpl;
class CefBrowserInfo; class CefBrowserInfo;
class CefFileDialogRunner; class CefFileDialogRunner;
class CefJavaScriptDialogRunner; class CefJavaScriptDialogRunner;
@ -49,9 +50,7 @@ class CefBrowserPlatformDelegate {
// Create a new CefBrowserPlatformDelegate instance. May be called on multiple // Create a new CefBrowserPlatformDelegate instance. May be called on multiple
// threads. // threads.
static scoped_ptr<CefBrowserPlatformDelegate> Create( static scoped_ptr<CefBrowserPlatformDelegate> Create(
const CefWindowInfo& window_info, CefBrowserHostImpl::CreateParams& create_params);
const CefBrowserSettings& settings,
CefRefPtr<CefClient> client);
// Called to create the view objects for a new WebContents. Will only be // Called to create the view objects for a new WebContents. Will only be
// called a single time per instance. May be called on multiple threads. Only // called a single time per instance. May be called on multiple threads. Only
@ -69,12 +68,22 @@ class CefBrowserPlatformDelegate {
content::RenderViewHost* render_view_host); content::RenderViewHost* render_view_host);
// Called after the owning CefBrowserHostImpl is created. Will only be called // Called after the owning CefBrowserHostImpl is created. Will only be called
// a single time per instance. // a single time per instance. Do not send any client notifications from this
// method.
virtual void BrowserCreated(CefBrowserHostImpl* browser); virtual void BrowserCreated(CefBrowserHostImpl* browser);
// Send any notifications related to browser creation. Called after
// BrowserCreated().
virtual void NotifyBrowserCreated();
// Send any notifications related to browser destruction. Called before
// BrowserDestroyed().
virtual void NotifyBrowserDestroyed();
// Called before the owning CefBrowserHostImpl is destroyed. Will only be // Called before the owning CefBrowserHostImpl is destroyed. Will only be
// called a single time per instance. All references to the CefBrowserHostImpl // called a single time per instance. All references to the CefBrowserHostImpl
// and WebContents should be cleared when this method is called. // and WebContents should be cleared when this method is called. Do not send
// any client notifications from this method.
virtual void BrowserDestroyed(CefBrowserHostImpl* browser); virtual void BrowserDestroyed(CefBrowserHostImpl* browser);
// Create the window that hosts the browser. Will only be called a single time // Create the window that hosts the browser. Will only be called a single time
@ -96,7 +105,34 @@ class CefBrowserPlatformDelegate {
// Returns the Widget owner for the browser window. Only used with windowed // Returns the Widget owner for the browser window. Only used with windowed
// rendering. // rendering.
virtual views::Widget* GetWindowWidget() const; virtual views::Widget* GetWindowWidget() const;
#endif
// Returns the BrowserView associated with this browser. Only used with views-
// based browsers.
virtual CefRefPtr<CefBrowserView> GetBrowserView() const;
#endif // defined(USE_AURA)
// Called after the WebContents have been created for a new popup browser
// parented to this browser but before the CefBrowserHostImpl is created for
// the popup. |is_devtools| will be true if the popup will host DevTools. This
// method will be called before WebContentsCreated() is called on
// |new_platform_delegate|. Do not make the new browser visible in this
// callback.
virtual void PopupWebContentsCreated(
const CefBrowserSettings& settings,
CefRefPtr<CefClient> client,
content::WebContents* new_web_contents,
CefBrowserPlatformDelegate* new_platform_delegate,
bool is_devtools);
// Called after the CefBrowserHostImpl is created for a new popup browser
// parented to this browser. |is_devtools| will be true if the popup will host
// DevTools. This method will be called immediately after
// CefLifeSpanHandler::OnAfterCreated() for the popup browser. It is safe to
// make the new browser visible in this callback (for example, add the browser
// to a window and show it).
virtual void PopupBrowserCreated(
CefBrowserHostImpl* new_browser,
bool is_devtools);
// Notify the window that it was resized. // Notify the window that it was resized.
virtual void WasResized() = 0; virtual void WasResized() = 0;
@ -128,7 +164,8 @@ class CefBrowserPlatformDelegate {
virtual void SetWindowVisibility(bool visible); virtual void SetWindowVisibility(bool visible);
#endif #endif
// Convert from view coordinates to screen coordinates. // Convert from view coordinates to screen coordinates. Potential display
// scaling will be applied to the result.
virtual gfx::Point GetScreenPoint(const gfx::Point& view) const = 0; virtual gfx::Point GetScreenPoint(const gfx::Point& view) const = 0;
// Open the specified text in the default text editor. // Open the specified text in the default text editor.
@ -173,6 +210,10 @@ class CefBrowserPlatformDelegate {
// called on multiple threads. // called on multiple threads.
virtual bool IsWindowless() const = 0; virtual bool IsWindowless() const = 0;
// Returns true if this delegate implements views-hosted browser handling. May
// be called on multiple threads.
virtual bool IsViewsHosted() const = 0;
// Notify the browser that it was hidden. Only used with windowless rendering. // Notify the browser that it was hidden. Only used with windowless rendering.
virtual void WasHidden(bool hidden); virtual void WasHidden(bool hidden);

View File

@ -21,6 +21,10 @@
#error A delegate implementation is not available for your platform. #error A delegate implementation is not available for your platform.
#endif #endif
#if defined(USE_AURA)
#include "libcef/browser/views/browser_platform_delegate_views.h"
#endif
namespace { namespace {
scoped_ptr<CefBrowserPlatformDelegateNative> CreateNativeDelegate( scoped_ptr<CefBrowserPlatformDelegateNative> CreateNativeDelegate(
@ -53,14 +57,28 @@ scoped_ptr<CefBrowserPlatformDelegateOsr> CreateOSRDelegate(
// static // static
scoped_ptr<CefBrowserPlatformDelegate> CefBrowserPlatformDelegate::Create( scoped_ptr<CefBrowserPlatformDelegate> CefBrowserPlatformDelegate::Create(
const CefWindowInfo& window_info, CefBrowserHostImpl::CreateParams& create_params) {
const CefBrowserSettings& settings, if (create_params.window_info) {
CefRefPtr<CefClient> client) { scoped_ptr<CefBrowserPlatformDelegateNative> native_delegate =
scoped_ptr<CefBrowserPlatformDelegateNative> native_delegate = CreateNativeDelegate(*create_params.window_info.get());
CreateNativeDelegate(window_info); if (create_params.window_info->windowless_rendering_enabled &&
if (window_info.windowless_rendering_enabled && create_params.client &&
client->GetRenderHandler().get()) { create_params.client->GetRenderHandler().get()) {
return CreateOSRDelegate(std::move(native_delegate)); return CreateOSRDelegate(std::move(native_delegate));
}
return std::move(native_delegate);
} }
return std::move(native_delegate); #if defined(USE_AURA)
else {
// CefWindowInfo is not used in this case.
scoped_ptr<CefBrowserPlatformDelegateNative> native_delegate =
CreateNativeDelegate(CefWindowInfo());
return make_scoped_ptr(new CefBrowserPlatformDelegateViews(
std::move(native_delegate),
static_cast<CefBrowserViewImpl*>(create_params.browser_view.get())));
}
#endif // defined(USE_AURA)
NOTREACHED();
return nullptr;
} }

View File

@ -0,0 +1,57 @@
// Copyright 2016 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
#include "libcef/browser/browser_util.h"
#include "content/public/browser/native_web_keyboard_event.h"
namespace browser_util {
bool GetCefKeyEvent(const content::NativeWebKeyboardEvent& event,
CefKeyEvent& cef_event) {
switch (event.type) {
case blink::WebKeyboardEvent::RawKeyDown:
cef_event.type = KEYEVENT_RAWKEYDOWN;
break;
case blink::WebKeyboardEvent::KeyDown:
cef_event.type = KEYEVENT_KEYDOWN;
break;
case blink::WebKeyboardEvent::KeyUp:
cef_event.type = KEYEVENT_KEYUP;
break;
case blink::WebKeyboardEvent::Char:
cef_event.type = KEYEVENT_CHAR;
break;
default:
return false;
}
cef_event.modifiers = 0;
if (event.modifiers & blink::WebKeyboardEvent::ShiftKey)
cef_event.modifiers |= EVENTFLAG_SHIFT_DOWN;
if (event.modifiers & blink::WebKeyboardEvent::ControlKey)
cef_event.modifiers |= EVENTFLAG_CONTROL_DOWN;
if (event.modifiers & blink::WebKeyboardEvent::AltKey)
cef_event.modifiers |= EVENTFLAG_ALT_DOWN;
if (event.modifiers & blink::WebKeyboardEvent::MetaKey)
cef_event.modifiers |= EVENTFLAG_COMMAND_DOWN;
if (event.modifiers & blink::WebKeyboardEvent::IsKeyPad)
cef_event.modifiers |= EVENTFLAG_IS_KEY_PAD;
cef_event.windows_key_code = event.windowsKeyCode;
cef_event.native_key_code = event.nativeKeyCode;
cef_event.is_system_key = event.isSystemKey;
cef_event.character = event.text[0];
cef_event.unmodified_character = event.unmodifiedText[0];
return true;
}
bool GetCefKeyEvent(const ui::KeyEvent& event,
CefKeyEvent& cef_event) {
content::NativeWebKeyboardEvent native_event(event);
return GetCefKeyEvent(native_event, cef_event);
}
} // namespace browser_util

View File

@ -0,0 +1,31 @@
// Copyright 2016 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_BROWSER_UTIL_H_
#define CEF_LIBCEF_BROWSER_BROWSER_UTIL_H_
#pragma once
#include "include/internal/cef_types_wrappers.h"
namespace content {
struct NativeWebKeyboardEvent;
}
namespace ui {
class KeyEvent;
}
namespace browser_util {
// Convert a content::NativeWebKeyboardEvent to a CefKeyEvent.
bool GetCefKeyEvent(const content::NativeWebKeyboardEvent& event,
CefKeyEvent& cef_event);
// Convert a ui::KeyEvent to a CefKeyEvent.
bool GetCefKeyEvent(const ui::KeyEvent& event,
CefKeyEvent& cef_event);
} // namespace browser_util
#endif // CEF_LIBCEF_BROWSER_BROWSER_UTIL_H_

View File

@ -109,11 +109,16 @@ CefDevToolsFrontend* CefDevToolsFrontend::Show(
new_settings.background_color = SK_ColorWHITE; new_settings.background_color = SK_ColorWHITE;
} }
CefBrowserHostImpl::CreateParams create_params;
if (!inspected_browser->IsViewsHosted())
create_params.window_info.reset(new CefWindowInfo(windowInfo));
create_params.client = client;
create_params.settings = new_settings;
create_params.devtools_opener = inspected_browser;
create_params.request_context = inspected_browser->GetRequestContext();
CefRefPtr<CefBrowserHostImpl> frontend_browser = CefRefPtr<CefBrowserHostImpl> frontend_browser =
CefBrowserHostImpl::Create(windowInfo, client, CefString(), CefBrowserHostImpl::Create(create_params);
new_settings,
inspected_browser, true,
inspected_browser->GetRequestContext());
content::WebContents* inspected_contents = inspected_browser->web_contents(); content::WebContents* inspected_contents = inspected_browser->web_contents();
if (!inspect_element_at.IsEmpty()) { if (!inspect_element_at.IsEmpty()) {

View File

@ -0,0 +1,426 @@
// Copyright (c) 2016 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "libcef/browser/image_impl.h"
#include <algorithm>
#include "ui/gfx/codec/jpeg_codec.h"
#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/image/image_png_rep.h"
#include "ui/gfx/image/image_skia.h"
namespace {
SkColorType GetSkColorType(cef_color_type_t color_type) {
switch (color_type) {
case CEF_COLOR_TYPE_RGBA_8888:
return kRGBA_8888_SkColorType;
case CEF_COLOR_TYPE_BGRA_8888:
return kBGRA_8888_SkColorType;
default:
break;
}
NOTREACHED();
return kUnknown_SkColorType;
}
SkAlphaType GetSkAlphaType(cef_alpha_type_t alpha_type) {
switch (alpha_type) {
case CEF_ALPHA_TYPE_OPAQUE:
return kOpaque_SkAlphaType;
case CEF_ALPHA_TYPE_PREMULTIPLIED:
return kPremul_SkAlphaType;
case CEF_ALPHA_TYPE_POSTMULTIPLIED:
return kUnpremul_SkAlphaType;
default:
break;
}
NOTREACHED();
return kUnknown_SkAlphaType;
}
// Compress as PNG. Requires post-multiplied alpha.
bool PNGMethod(bool with_transparency,
const SkBitmap& bitmap,
std::vector<unsigned char>* compressed) {
return gfx::PNGCodec::Encode(
reinterpret_cast<unsigned char*>(bitmap.getPixels()),
bitmap.colorType() == kBGRA_8888_SkColorType ?
gfx::PNGCodec::FORMAT_BGRA : gfx::PNGCodec::FORMAT_RGBA,
gfx::Size(bitmap.width(), bitmap.height()),
static_cast<int>(bitmap.rowBytes()),
bitmap.alphaType() == kOpaque_SkAlphaType || !with_transparency,
std::vector<gfx::PNGCodec::Comment>(),
compressed);
}
// Compress as JPEG. This internally uses JCS_EXT_RGBX or JCS_EXT_BGRX which
// causes the alpha channel to be ignored. Requires post-multiplied alpha.
bool JPEGMethod(int quality,
const SkBitmap& bitmap,
std::vector<unsigned char>* compressed) {
return gfx::JPEGCodec::Encode(
reinterpret_cast<unsigned char*>(bitmap.getPixels()),
bitmap.colorType() == kBGRA_8888_SkColorType ?
gfx::JPEGCodec::FORMAT_BGRA : gfx::JPEGCodec::FORMAT_RGBA,
bitmap.width(),
bitmap.height(),
static_cast<int>(bitmap.rowBytes()),
quality,
compressed);
}
} // namespace
// static
CefRefPtr<CefImage> CefImage::CreateImage() {
CEF_REQUIRE_UIT_RETURN(nullptr);
return new CefImageImpl();
}
CefImageImpl::CefImageImpl() {
CEF_REQUIRE_UIT();
}
CefImageImpl::CefImageImpl(const gfx::ImageSkia& image_skia)
: image_(image_skia) {
CEF_REQUIRE_UIT();
}
CefImageImpl::~CefImageImpl() {
CEF_REQUIRE_UIT();
}
bool CefImageImpl::IsEmpty() {
CEF_REQUIRE_UIT_RETURN(false);
return image_.IsEmpty();
}
bool CefImageImpl::IsSame(CefRefPtr<CefImage> that) {
CEF_REQUIRE_UIT_RETURN(false);
CefImageImpl* that_impl = static_cast<CefImageImpl*>(that.get());
if (!that_impl)
return false;
// Quick check for the same object.
if (this == that_impl)
return true;
return image_.AsImageSkia().BackedBySameObjectAs(
that_impl->image_.AsImageSkia());
}
bool CefImageImpl::AddBitmap(float scale_factor,
int pixel_width,
int pixel_height,
cef_color_type_t color_type,
cef_alpha_type_t alpha_type,
const void* pixel_data,
size_t pixel_data_size) {
CEF_REQUIRE_UIT_RETURN(false);
const SkColorType ct = GetSkColorType(color_type);
const SkAlphaType at = GetSkAlphaType(alpha_type);
// Make sure the client passed in the expected values.
if (ct != kBGRA_8888_SkColorType && ct != kRGBA_8888_SkColorType)
return false;
if (pixel_data_size != pixel_width * pixel_height * 4U)
return false;
SkBitmap bitmap;
if (!bitmap.tryAllocPixels(
SkImageInfo::Make(pixel_width, pixel_height, ct, at))) {
return false;
}
DCHECK_EQ(pixel_data_size, bitmap.getSize());
{
SkAutoLockPixels bitmap_lock(bitmap);
memcpy(bitmap.getPixels(), pixel_data, pixel_data_size);
}
return AddBitmap(scale_factor, bitmap);
}
bool CefImageImpl::AddPNG(float scale_factor,
const void* png_data,
size_t png_data_size) {
CEF_REQUIRE_UIT_RETURN(false);
SkBitmap bitmap;
if (!gfx::PNGCodec::Decode(static_cast<const unsigned char*>(png_data),
png_data_size, &bitmap)) {
return false;
}
return AddBitmap(scale_factor, bitmap);
}
bool CefImageImpl::AddJPEG(float scale_factor,
const void* jpeg_data,
size_t jpeg_data_size) {
CEF_REQUIRE_UIT_RETURN(false);
scoped_ptr<SkBitmap> bitmap(
gfx::JPEGCodec::Decode(static_cast<const unsigned char*>(jpeg_data),
jpeg_data_size));
if (!bitmap.get())
return false;
return AddBitmap(scale_factor, *bitmap);
}
size_t CefImageImpl::GetWidth() {
CEF_REQUIRE_UIT_RETURN(false);
return image_.Width();
}
size_t CefImageImpl::GetHeight() {
CEF_REQUIRE_UIT_RETURN(false);
return image_.Height();
}
bool CefImageImpl::HasRepresentation(float scale_factor) {
CEF_REQUIRE_UIT_RETURN(false);
return image_.AsImageSkia().HasRepresentation(scale_factor);
}
bool CefImageImpl::RemoveRepresentation(float scale_factor) {
CEF_REQUIRE_UIT_RETURN(false);
gfx::ImageSkia image_skia = image_.AsImageSkia();
if (image_skia.HasRepresentation(scale_factor)) {
image_skia.RemoveRepresentation(scale_factor);
return true;
}
return false;
}
bool CefImageImpl::GetRepresentationInfo(float scale_factor,
float& actual_scale_factor,
int& pixel_width,
int& pixel_height) {
CEF_REQUIRE_UIT_RETURN(false);
gfx::ImageSkia image_skia = image_.AsImageSkia();
if (image_skia.isNull())
return false;
const gfx::ImageSkiaRep& rep = image_skia.GetRepresentation(scale_factor);
if (rep.is_null())
return false;
actual_scale_factor = rep.scale();
pixel_width = rep.sk_bitmap().width();
pixel_height = rep.sk_bitmap().height();
return true;
}
CefRefPtr<CefBinaryValue> CefImageImpl::GetAsBitmap(
float scale_factor,
cef_color_type_t color_type,
cef_alpha_type_t alpha_type,
int& pixel_width,
int& pixel_height) {
CEF_REQUIRE_UIT_RETURN(nullptr);
const SkColorType desired_ct = GetSkColorType(color_type);
const SkAlphaType desired_at = GetSkAlphaType(alpha_type);
const SkBitmap* bitmap = GetBitmap(scale_factor);
if (!bitmap)
return nullptr;
SkAutoLockPixels bitmap_lock(*bitmap);
DCHECK(bitmap->readyToDraw());
pixel_width = bitmap->width();
pixel_height = bitmap->height();
if (bitmap->colorType() == desired_ct && bitmap->alphaType() == desired_at) {
// No conversion necessary.
return CefBinaryValue::Create(bitmap->getPixels(), bitmap->getSize());
} else {
SkBitmap desired_bitmap;
if (!ConvertBitmap(*bitmap, &desired_bitmap, desired_ct, desired_at))
return nullptr;
SkAutoLockPixels bitmap_lock(desired_bitmap);
DCHECK(desired_bitmap.readyToDraw());
return CefBinaryValue::Create(desired_bitmap.getPixels(),
desired_bitmap.getSize());
}
}
CefRefPtr<CefBinaryValue> CefImageImpl::GetAsPNG(float scale_factor,
bool with_transparency,
int& pixel_width,
int& pixel_height) {
CEF_REQUIRE_UIT_RETURN(nullptr);
const SkBitmap* bitmap = GetBitmap(scale_factor);
if (!bitmap)
return nullptr;
std::vector<unsigned char> compressed;
if (!WritePNG(*bitmap, &compressed, with_transparency))
return nullptr;
pixel_width = bitmap->width();
pixel_height = bitmap->height();
return CefBinaryValue::Create(&compressed.front(), compressed.size());
}
CefRefPtr<CefBinaryValue> CefImageImpl::GetAsJPEG(float scale_factor,
int quality,
int& pixel_width,
int& pixel_height) {
CEF_REQUIRE_UIT_RETURN(nullptr);
const SkBitmap* bitmap = GetBitmap(scale_factor);
if (!bitmap)
return nullptr;
std::vector<unsigned char> compressed;
if (!WriteJPEG(*bitmap, &compressed, quality))
return nullptr;
pixel_width = bitmap->width();
pixel_height = bitmap->height();
return CefBinaryValue::Create(&compressed.front(), compressed.size());
}
void CefImageImpl::AddBitmaps(int32_t scale_1x_size,
const std::vector<SkBitmap>& bitmaps) {
if (scale_1x_size == 0) {
// Set the scale 1x size to the smallest bitmap pixel size.
int32_t min_size = std::numeric_limits<int32_t>::max();
for (const SkBitmap& bitmap : bitmaps) {
const int32_t size = std::max(bitmap.width(), bitmap.height());
if (size < min_size)
min_size = size;
}
scale_1x_size = min_size;
}
for (const SkBitmap& bitmap : bitmaps) {
const int32_t size = std::max(bitmap.width(), bitmap.height());
const float scale_factor = static_cast<float>(size) /
static_cast<float>(scale_1x_size);
AddBitmap(scale_factor, bitmap);
}
}
gfx::ImageSkia CefImageImpl::GetForced1xScaleRepresentation(
float scale_factor) const {
if (scale_factor == 1.0f) {
// We can use the existing image without modification.
return image_.AsImageSkia();
}
const SkBitmap* bitmap = GetBitmap(scale_factor);
gfx::ImageSkia image_skia;
if (bitmap)
image_skia.AddRepresentation(gfx::ImageSkiaRep(*bitmap, 1.0f));
return image_skia;
}
bool CefImageImpl::AddBitmap(float scale_factor,
const SkBitmap& bitmap) {
DCHECK(bitmap.readyToDraw());
DCHECK(bitmap.colorType() == kBGRA_8888_SkColorType ||
bitmap.colorType() == kRGBA_8888_SkColorType);
gfx::ImageSkiaRep skia_rep(bitmap, scale_factor);
if (image_.IsEmpty()) {
gfx::Image image((gfx::ImageSkia(skia_rep)));
image_.SwapRepresentations(&image);
} else {
image_.AsImageSkia().AddRepresentation(skia_rep);
}
return true;
}
const SkBitmap* CefImageImpl::GetBitmap(float scale_factor) const {
gfx::ImageSkia image_skia = image_.AsImageSkia();
if (image_skia.isNull())
return nullptr;
const gfx::ImageSkiaRep& rep = image_skia.GetRepresentation(scale_factor);
if (rep.is_null())
return nullptr;
return &rep.sk_bitmap();
}
// static
bool CefImageImpl::ConvertBitmap(const SkBitmap& src_bitmap,
SkBitmap* target_bitmap,
SkColorType target_ct,
SkAlphaType target_at) {
DCHECK(src_bitmap.readyToDraw());
DCHECK(src_bitmap.colorType() != target_ct ||
src_bitmap.alphaType() != target_at);
DCHECK(target_bitmap);
SkImageInfo target_info =
SkImageInfo::Make(src_bitmap.width(), src_bitmap.height(), target_ct,
target_at);
if (!target_bitmap->tryAllocPixels(target_info))
return false;
SkAutoLockPixels bitmap_lock(*target_bitmap);
if (!src_bitmap.readPixels(target_info, target_bitmap->getPixels(),
target_bitmap->rowBytes(), 0, 0)) {
return false;
}
DCHECK(target_bitmap->readyToDraw());
return true;
}
// static
bool CefImageImpl::WriteCompressedFormat(const SkBitmap& bitmap,
std::vector<unsigned char>* compressed,
const CompressionMethod& method) {
const SkBitmap* bitmap_ptr = nullptr;
SkBitmap bitmap_postalpha;
if (bitmap.alphaType() == kPremul_SkAlphaType) {
// Compression methods require post-multiplied alpha values.
SkAutoLockPixels bitmap_lock(bitmap);
if (!ConvertBitmap(bitmap, &bitmap_postalpha, bitmap.colorType(),
kUnpremul_SkAlphaType)) {
return false;
}
bitmap_ptr = &bitmap_postalpha;
} else {
bitmap_ptr = &bitmap;
}
SkAutoLockPixels bitmap_lock(*bitmap_ptr);
DCHECK(bitmap_ptr->readyToDraw());
DCHECK(bitmap_ptr->colorType() == kBGRA_8888_SkColorType ||
bitmap_ptr->colorType() == kRGBA_8888_SkColorType);
DCHECK(bitmap_ptr->alphaType() == kOpaque_SkAlphaType ||
bitmap_ptr->alphaType() == kUnpremul_SkAlphaType);
return method.Run(*bitmap_ptr, compressed);
}
// static
bool CefImageImpl::WritePNG(const SkBitmap& bitmap,
std::vector<unsigned char>* compressed,
bool with_transparency) {
return WriteCompressedFormat(bitmap, compressed,
base::Bind(PNGMethod, with_transparency));
}
// static
bool CefImageImpl::WriteJPEG(const SkBitmap& bitmap,
std::vector<unsigned char>* compressed,
int quality) {
return WriteCompressedFormat(bitmap, compressed,
base::Bind(JPEGMethod, quality));
}

125
libcef/browser/image_impl.h Normal file
View File

@ -0,0 +1,125 @@
// Copyright (c) 2016 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_IMAGE_IMPL_H_
#define CEF_LIBCEF_BROWSER_IMAGE_IMPL_H_
#pragma once
#include "include/cef_image.h"
#include "libcef/browser/thread_util.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/image/image.h"
class CefImageImpl : public CefImage {
public:
// Creates an empty image with no representations.
CefImageImpl();
// Creates a new image by copying the ImageSkia for use as the default
// representation.
explicit CefImageImpl(const gfx::ImageSkia& image_skia);
// Deletes the image and, if the only owner of the storage, all of its cached
// representations.
~CefImageImpl() override;
// CefImage methods:
bool IsEmpty() override;
bool IsSame(CefRefPtr<CefImage> that) override;
bool AddBitmap(float scale_factor,
int pixel_width,
int pixel_height,
cef_color_type_t color_type,
cef_alpha_type_t alpha_type,
const void* pixel_data,
size_t pixel_data_size) override;
bool AddPNG(float scale_factor,
const void* png_data,
size_t png_data_size) override;
bool AddJPEG(float scale_factor,
const void* jpeg_data,
size_t jpeg_data_size) override;
size_t GetWidth() override;
size_t GetHeight() override;
bool HasRepresentation(float scale_factor) override;
bool RemoveRepresentation(float scale_factor) override;
bool GetRepresentationInfo(float scale_factor,
float& actual_scale_factor,
int& pixel_width,
int& pixel_height) override;
CefRefPtr<CefBinaryValue> GetAsBitmap(float scale_factor,
cef_color_type_t color_type,
cef_alpha_type_t alpha_type,
int& pixel_width,
int& pixel_height) override;
CefRefPtr<CefBinaryValue> GetAsPNG(float scale_factor,
bool with_transparency,
int& pixel_width,
int& pixel_height) override;
CefRefPtr<CefBinaryValue> GetAsJPEG(float scale_factor,
int quality,
int& pixel_width,
int& pixel_height) override;
// Add |bitmaps| which should be the same image at different scale factors.
// |scale_1x_size| is the size in pixels of the 1x factor image. If
// |scale_1x_size| is 0 the smallest image size in pixels will be used as the
// 1x factor size.
void AddBitmaps(int32_t scale_1x_size,
const std::vector<SkBitmap>& bitmaps);
// Return a representation of this Image that contains only the bitmap nearest
// |scale_factor| as the 1x scale representation. Conceptually this is an
// incorrect representation but is necessary to work around bugs in the views
// architecture.
// TODO(cef): Remove once https://crbug.com/597732 is resolved.
gfx::ImageSkia GetForced1xScaleRepresentation(float scale_factor) const;
const gfx::Image& image() const { return image_; }
private:
// Add a bitmap.
bool AddBitmap(float scale_factor,
const SkBitmap& bitmap);
// Returns the bitmap that most closely matches |scale_factor| or nullptr if
// one doesn't exist.
const SkBitmap* GetBitmap(float scale_factor) const;
// Convert |src_bitmap| to |target_bitmap| with |target_ct| and |target_at|.
static bool ConvertBitmap(const SkBitmap& src_bitmap,
SkBitmap* target_bitmap,
SkColorType target_ct,
SkAlphaType target_at);
// The |bitmap| argument will be RGBA or BGRA and either opaque or transparent
// with post-multiplied alpha. Writes the compressed output into |compressed|.
typedef base::Callback<bool(const SkBitmap& /*bitmap*/,
std::vector<unsigned char>* /*compressed*/)>
CompressionMethod;
// Write |bitmap| into |compressed| using |method|.
static bool WriteCompressedFormat(const SkBitmap& bitmap,
std::vector<unsigned char>* compressed,
const CompressionMethod& method);
// Write |bitmap| into |compressed| using PNG encoding.
static bool WritePNG(const SkBitmap& bitmap,
std::vector<unsigned char>* compressed,
bool with_transparency);
// Write |bitmap| into |compressed| using JPEG encoding. The alpha channel
// will be ignored.
static bool WriteJPEG(const SkBitmap& bitmap,
std::vector<unsigned char>* compressed,
int quality);
gfx::Image image_;
IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefImageImpl);
DISALLOW_COPY_AND_ASSIGN(CefImageImpl);
};
#endif // CEF_LIBCEF_BROWSER_IMAGE_IMPL_H_

View File

@ -98,7 +98,7 @@ CefMenuManager::CefMenuManager(CefBrowserHostImpl* browser,
weak_ptr_factory_(this) { weak_ptr_factory_(this) {
DCHECK(web_contents()); DCHECK(web_contents());
DCHECK(runner_.get()); DCHECK(runner_.get());
model_ = new CefMenuModelImpl(this); model_ = new CefMenuModelImpl(this, nullptr);
} }
CefMenuManager::~CefMenuManager() { CefMenuManager::~CefMenuManager() {
@ -197,7 +197,7 @@ bool CefMenuManager::CreateContextMenu(
if (custom_menu) if (custom_menu)
return true; return true;
return runner_->RunContextMenu(browser_, model_->model(), params_); return runner_->RunContextMenu(browser_, model_.get(), params_);
} }
void CefMenuManager::CancelContextMenu() { void CefMenuManager::CancelContextMenu() {

View File

@ -7,6 +7,8 @@
#include <vector> #include <vector>
#include "libcef/browser/thread_util.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
@ -162,6 +164,18 @@ class CefSimpleMenuModel : public ui::MenuModel {
} // namespace } // namespace
// static
CefRefPtr<CefMenuModel> CefMenuModel::CreateMenuModel(
CefRefPtr<CefMenuModelDelegate> delegate) {
CEF_REQUIRE_UIT_RETURN(nullptr);
DCHECK(delegate);
if (!delegate)
return nullptr;
CefRefPtr<CefMenuModelImpl> menu_model =
new CefMenuModelImpl(nullptr, delegate);
return menu_model;
}
struct CefMenuModelImpl::Item { struct CefMenuModelImpl::Item {
Item(cef_menu_item_type_t type, Item(cef_menu_item_type_t type,
@ -203,9 +217,13 @@ struct CefMenuModelImpl::Item {
}; };
CefMenuModelImpl::CefMenuModelImpl(Delegate* delegate) CefMenuModelImpl::CefMenuModelImpl(
Delegate* delegate,
CefRefPtr<CefMenuModelDelegate> menu_model_delegate)
: supported_thread_id_(base::PlatformThread::CurrentId()), : supported_thread_id_(base::PlatformThread::CurrentId()),
delegate_(delegate) { delegate_(delegate),
menu_model_delegate_(menu_model_delegate) {
DCHECK(delegate_ || menu_model_delegate_);
model_.reset(new CefSimpleMenuModel(this)); model_.reset(new CefSimpleMenuModel(this));
} }
@ -266,7 +284,7 @@ CefRefPtr<CefMenuModel> CefMenuModelImpl::AddSubMenu(int command_id,
return NULL; return NULL;
Item item(MENUITEMTYPE_SUBMENU, command_id, label, -1); Item item(MENUITEMTYPE_SUBMENU, command_id, label, -1);
item.submenu_ = new CefMenuModelImpl(delegate_); item.submenu_ = new CefMenuModelImpl(delegate_, menu_model_delegate_);
AppendItem(item); AppendItem(item);
return item.submenu_.get(); return item.submenu_.get();
} }
@ -313,7 +331,7 @@ CefRefPtr<CefMenuModel> CefMenuModelImpl::InsertSubMenuAt(
return NULL; return NULL;
Item item(MENUITEMTYPE_SUBMENU, command_id, label, -1); Item item(MENUITEMTYPE_SUBMENU, command_id, label, -1);
item.submenu_ = new CefMenuModelImpl(delegate_); item.submenu_ = new CefMenuModelImpl(delegate_, menu_model_delegate_);
InsertItemAt(item, index); InsertItemAt(item, index);
return item.submenu_.get(); return item.submenu_.get();
} }
@ -618,13 +636,25 @@ bool CefMenuModelImpl::GetAcceleratorAt(int index, int& key_code,
} }
void CefMenuModelImpl::ActivatedAt(int index, cef_event_flags_t event_flags) { void CefMenuModelImpl::ActivatedAt(int index, cef_event_flags_t event_flags) {
if (VerifyContext() && delegate_) if (!VerifyContext())
delegate_->ExecuteCommand(this, GetCommandIdAt(index), event_flags); return;
const int command_id = GetCommandIdAt(index);
if (delegate_)
delegate_->ExecuteCommand(this, command_id, event_flags);
if (menu_model_delegate_)
menu_model_delegate_->ExecuteCommand(this, command_id, event_flags);
} }
void CefMenuModelImpl::MenuWillShow() { void CefMenuModelImpl::MenuWillShow() {
if (VerifyContext() && delegate_) if (!VerifyContext())
return;
if (delegate_)
delegate_->MenuWillShow(this); delegate_->MenuWillShow(this);
if (menu_model_delegate_)
menu_model_delegate_->MenuWillShow(this);
FOR_EACH_OBSERVER(Observer, observers_, MenuWillShow(this));
} }
void CefMenuModelImpl::MenuClosed() { void CefMenuModelImpl::MenuClosed() {
@ -641,7 +671,13 @@ void CefMenuModelImpl::MenuClosed() {
base::string16 CefMenuModelImpl::GetFormattedLabelAt(int index) { base::string16 CefMenuModelImpl::GetFormattedLabelAt(int index) {
base::string16 label = GetLabelAt(index).ToString16(); base::string16 label = GetLabelAt(index).ToString16();
delegate_->FormatLabel(label); if (delegate_)
delegate_->FormatLabel(label);
if (menu_model_delegate_) {
CefString new_label = label;
if (menu_model_delegate_->FormatLabel(this, new_label))
label = new_label;
}
return label; return label;
} }
@ -662,6 +698,18 @@ bool CefMenuModelImpl::VerifyRefCount() {
return true; return true;
} }
void CefMenuModelImpl::AddObserver(Observer* observer) {
observers_.AddObserver(observer);
}
void CefMenuModelImpl::RemoveObserver(Observer* observer) {
observers_.RemoveObserver(observer);
}
bool CefMenuModelImpl::HasObserver(Observer* observer) const {
return observers_.HasObserver(observer);
}
void CefMenuModelImpl::AddMenuItem(const content::MenuItem& menu_item) { void CefMenuModelImpl::AddMenuItem(const content::MenuItem& menu_item) {
const int command_id = static_cast<int>(menu_item.action); const int command_id = static_cast<int>(menu_item.action);
@ -726,6 +774,9 @@ void CefMenuModelImpl::ValidateItem(const Item& item) {
void CefMenuModelImpl::OnMenuClosed() { void CefMenuModelImpl::OnMenuClosed() {
if (delegate_) if (delegate_)
delegate_->MenuClosed(this); delegate_->MenuClosed(this);
if (menu_model_delegate_)
menu_model_delegate_->MenuClosed(this);
FOR_EACH_OBSERVER(Observer, observers_, MenuClosed(this));
} }
bool CefMenuModelImpl::VerifyContext() { bool CefMenuModelImpl::VerifyContext() {

View File

@ -10,8 +10,10 @@
#include <vector> #include <vector>
#include "include/cef_menu_model.h" #include "include/cef_menu_model.h"
#include "include/cef_menu_model_delegate.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
#include "base/threading/platform_thread.h" #include "base/threading/platform_thread.h"
#include "ui/base/models/menu_model.h" #include "ui/base/models/menu_model.h"
@ -42,8 +44,22 @@ class CefMenuModelImpl : public CefMenuModel {
virtual ~Delegate() {} virtual ~Delegate() {}
}; };
// The delegate must outlive this class. class Observer {
explicit CefMenuModelImpl(Delegate* delegate); public:
// Notifies the delegate that the menu is about to show.
virtual void MenuWillShow(CefRefPtr<CefMenuModelImpl> source) {};
// Notifies the delegate that the menu has closed.
virtual void MenuClosed(CefRefPtr<CefMenuModelImpl> source) {};
protected:
virtual ~Observer() {}
};
// Either |delegate| or |menu_model_delegate| must be non-nullptr.
// If |delegate| is non-nullptr it must outlive this class.
CefMenuModelImpl(Delegate* delegate,
CefRefPtr<CefMenuModelDelegate> menu_model_delegate);
~CefMenuModelImpl() override; ~CefMenuModelImpl() override;
// CefMenuModel methods. // CefMenuModel methods.
@ -116,12 +132,20 @@ class CefMenuModelImpl : public CefMenuModel {
// Verify that only a single reference exists to all CefMenuModelImpl objects. // Verify that only a single reference exists to all CefMenuModelImpl objects.
bool VerifyRefCount(); bool VerifyRefCount();
// Manage observer objects. The observer must either outlive this object or
// remove itself before destruction.
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
bool HasObserver(Observer* observer) const;
// Helper for adding custom menu items originating from the renderer process. // Helper for adding custom menu items originating from the renderer process.
void AddMenuItem(const content::MenuItem& menu_item); void AddMenuItem(const content::MenuItem& menu_item);
ui::MenuModel* model() { return model_.get(); } ui::MenuModel* model() { return model_.get(); }
// Used when created via CefMenuManager.
Delegate* delegate() { return delegate_; } Delegate* delegate() { return delegate_; }
void set_delegate(Delegate* delegate) { delegate_ = NULL; } void set_delegate(Delegate* delegate) { delegate_ = delegate; }
private: private:
struct Item; struct Item;
@ -140,10 +164,19 @@ class CefMenuModelImpl : public CefMenuModel {
bool VerifyContext(); bool VerifyContext();
base::PlatformThreadId supported_thread_id_; base::PlatformThreadId supported_thread_id_;
// Used when created via CefMenuManager.
Delegate* delegate_; Delegate* delegate_;
// Used when created via CefMenuModel::CreateMenuModel().
CefRefPtr<CefMenuModelDelegate> menu_model_delegate_;
ItemVector items_; ItemVector items_;
scoped_ptr<ui::MenuModel> model_; scoped_ptr<ui::MenuModel> model_;
// Observers that want to be notified of changes to this object.
base::ObserverList<Observer> observers_;
IMPLEMENT_REFCOUNTING(CefMenuModelImpl); IMPLEMENT_REFCOUNTING(CefMenuModelImpl);
DISALLOW_COPY_AND_ASSIGN(CefMenuModelImpl); DISALLOW_COPY_AND_ASSIGN(CefMenuModelImpl);
}; };

View File

@ -12,17 +12,14 @@ namespace content {
struct ContextMenuParams; struct ContextMenuParams;
} }
namespace ui {
class MenuModel;
}
class CefBrowserHostImpl; class CefBrowserHostImpl;
class CefMenuModelImpl;
// Provides platform-specific menu implementations for CefMenuCreator. // Provides platform-specific menu implementations for CefMenuCreator.
class CefMenuRunner { class CefMenuRunner {
public: public:
virtual bool RunContextMenu(CefBrowserHostImpl* browser, virtual bool RunContextMenu(CefBrowserHostImpl* browser,
ui::MenuModel* model, CefMenuModelImpl* model,
const content::ContextMenuParams& params) = 0; const content::ContextMenuParams& params) = 0;
virtual void CancelContextMenu() {} virtual void CancelContextMenu() {}
virtual bool FormatLabel(base::string16& label) { return false; } virtual bool FormatLabel(base::string16& label) { return false; }

View File

@ -45,3 +45,7 @@ void CefBrowserPlatformDelegateNative::SendMouseWheelEvent(
bool CefBrowserPlatformDelegateNative::IsWindowless() const { bool CefBrowserPlatformDelegateNative::IsWindowless() const {
return false; return false;
} }
bool CefBrowserPlatformDelegateNative::IsViewsHosted() const {
return false;
}

View File

@ -30,6 +30,7 @@ class CefBrowserPlatformDelegateNative : public CefBrowserPlatformDelegate {
void SendMouseEvent(const blink::WebMouseEvent& event) override; void SendMouseEvent(const blink::WebMouseEvent& event) override;
void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event) override; void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event) override;
bool IsWindowless() const override; bool IsWindowless() const override;
bool IsViewsHosted() const override;
const CefWindowInfo& window_info() const { return window_info_; } const CefWindowInfo& window_info() const { return window_info_; }

View File

@ -133,15 +133,7 @@
} }
- (BOOL)windowShouldClose:(id)window { - (BOOL)windowShouldClose:(id)window {
// Protect against multiple requests to close while the close is pending. if (browser_ && !browser_->TryCloseBrowser()) {
if (browser_ && browser_->destruction_state() <=
CefBrowserHostImpl::DESTRUCTION_STATE_PENDING) {
if (browser_->destruction_state() ==
CefBrowserHostImpl::DESTRUCTION_STATE_NONE) {
// Request that the browser close.
browser_->CloseBrowser(false);
}
// Cancel the close. // Cancel the close.
return NO; return NO;
} }

View File

@ -576,16 +576,7 @@ LRESULT CALLBACK CefBrowserPlatformDelegateNativeWin::WndProc(
switch (message) { switch (message) {
case WM_CLOSE: case WM_CLOSE:
// Protect against multiple requests to close while the close is pending. if (browser && !browser->TryCloseBrowser()) {
if (browser &&
browser->destruction_state() <=
CefBrowserHostImpl::DESTRUCTION_STATE_PENDING) {
if (browser->destruction_state() ==
CefBrowserHostImpl::DESTRUCTION_STATE_NONE) {
// Request that the browser close.
browser->CloseBrowser(false);
}
// Cancel the close. // Cancel the close.
return 0; return 0;
} }

View File

@ -15,10 +15,10 @@ CefMenuRunnerLinux::CefMenuRunnerLinux() {
bool CefMenuRunnerLinux::RunContextMenu( bool CefMenuRunnerLinux::RunContextMenu(
CefBrowserHostImpl* browser, CefBrowserHostImpl* browser,
ui::MenuModel* model, CefMenuModelImpl* model,
const content::ContextMenuParams& params) { const content::ContextMenuParams& params) {
menu_.reset( menu_.reset(
new views::MenuRunner(model, views::MenuRunner::CONTEXT_MENU)); new views::MenuRunner(model->model(), views::MenuRunner::CONTEXT_MENU));
const gfx::Point& screen_point = const gfx::Point& screen_point =
browser->GetScreenPoint(gfx::Point(params.x, params.y)); browser->GetScreenPoint(gfx::Point(params.x, params.y));

View File

@ -17,7 +17,7 @@ class CefMenuRunnerLinux: public CefMenuRunner {
// CefMenuRunner methods. // CefMenuRunner methods.
bool RunContextMenu(CefBrowserHostImpl* browser, bool RunContextMenu(CefBrowserHostImpl* browser,
ui::MenuModel* model, CefMenuModelImpl* model,
const content::ContextMenuParams& params) override; const content::ContextMenuParams& params) override;
void CancelContextMenu() override; void CancelContextMenu() override;
bool FormatLabel(base::string16& label) override; bool FormatLabel(base::string16& label) override;

View File

@ -23,7 +23,7 @@ class CefMenuRunnerMac : public CefMenuRunner {
// CefMenuRunner methods. // CefMenuRunner methods.
bool RunContextMenu(CefBrowserHostImpl* browser, bool RunContextMenu(CefBrowserHostImpl* browser,
ui::MenuModel* model, CefMenuModelImpl* model,
const content::ContextMenuParams& params) override; const content::ContextMenuParams& params) override;
void CancelContextMenu() override; void CancelContextMenu() override;

View File

@ -20,10 +20,10 @@ CefMenuRunnerMac::~CefMenuRunnerMac() {
bool CefMenuRunnerMac::RunContextMenu( bool CefMenuRunnerMac::RunContextMenu(
CefBrowserHostImpl* browser, CefBrowserHostImpl* browser,
ui::MenuModel* model, CefMenuModelImpl* model,
const content::ContextMenuParams& params) { const content::ContextMenuParams& params) {
// Create a menu controller based on the model. // Create a menu controller based on the model.
menu_controller_.reset([[MenuController alloc] initWithModel:model menu_controller_.reset([[MenuController alloc] initWithModel:model->model()
useWithPopUpButtonCell:NO]); useWithPopUpButtonCell:NO]);
// Keep the menu controller alive (by adding an additional retain) until after // Keep the menu controller alive (by adding an additional retain) until after

View File

@ -15,10 +15,10 @@ CefMenuRunnerWin::CefMenuRunnerWin() {
bool CefMenuRunnerWin::RunContextMenu( bool CefMenuRunnerWin::RunContextMenu(
CefBrowserHostImpl* browser, CefBrowserHostImpl* browser,
ui::MenuModel* model, CefMenuModelImpl* model,
const content::ContextMenuParams& params) { const content::ContextMenuParams& params) {
// Create a menu based on the model. // Create a menu based on the model.
menu_.reset(new views::NativeMenuWin(model, NULL)); menu_.reset(new views::NativeMenuWin(model->model(), NULL));
menu_->Rebuild(NULL); menu_->Rebuild(NULL);
// Make sure events can be pumped while the menu is up. // Make sure events can be pumped while the menu is up.

View File

@ -18,7 +18,7 @@ class CefMenuRunnerWin : public CefMenuRunner {
// CefMenuRunner methods. // CefMenuRunner methods.
bool RunContextMenu(CefBrowserHostImpl* browser, bool RunContextMenu(CefBrowserHostImpl* browser,
ui::MenuModel* model, CefMenuModelImpl* model,
const content::ContextMenuParams& params) override; const content::ContextMenuParams& params) override;
private: private:

View File

@ -339,16 +339,7 @@ uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
Atom protocol = static_cast<Atom>(xev->xclient.data.l[0]); Atom protocol = static_cast<Atom>(xev->xclient.data.l[0]);
if (protocol == atom_cache_.GetAtom(kWMDeleteWindow)) { if (protocol == atom_cache_.GetAtom(kWMDeleteWindow)) {
// We have received a close message from the window manager. // We have received a close message from the window manager.
if (browser_.get() && browser_->destruction_state() <= if (!browser_ || browser_->TryCloseBrowser()) {
CefBrowserHostImpl::DESTRUCTION_STATE_PENDING) {
if (browser_->destruction_state() ==
CefBrowserHostImpl::DESTRUCTION_STATE_NONE) {
// Request that the browser close.
browser_->CloseBrowser(false);
}
// Cancel the close.
} else {
// Allow the close. // Allow the close.
XDestroyWindow(xdisplay_, xwindow_); XDestroyWindow(xdisplay_, xwindow_);
} }

View File

@ -177,6 +177,10 @@ bool CefBrowserPlatformDelegateOsr::IsWindowless() const {
return true; return true;
} }
bool CefBrowserPlatformDelegateOsr::IsViewsHosted() const {
return false;
}
void CefBrowserPlatformDelegateOsr::WasHidden(bool hidden) { void CefBrowserPlatformDelegateOsr::WasHidden(bool hidden) {
CefRenderWidgetHostViewOSR* view = GetOSRHostView(); CefRenderWidgetHostViewOSR* view = GetOSRHostView();
if (view) { if (view) {

View File

@ -51,6 +51,7 @@ class CefBrowserPlatformDelegateOsr :
scoped_ptr<CefJavaScriptDialogRunner> CreateJavaScriptDialogRunner() override; scoped_ptr<CefJavaScriptDialogRunner> CreateJavaScriptDialogRunner() override;
scoped_ptr<CefMenuRunner> CreateMenuRunner() override; scoped_ptr<CefMenuRunner> CreateMenuRunner() override;
bool IsWindowless() const override; bool IsWindowless() const override;
bool IsViewsHosted() const override;
void WasHidden(bool hidden) override; void WasHidden(bool hidden) override;
void NotifyScreenInfoChanged() override; void NotifyScreenInfoChanged() override;
void Invalidate(cef_paint_element_type_t type) override; void Invalidate(cef_paint_element_type_t type) override;

View File

@ -78,7 +78,7 @@ void CefPrintSettingsImpl::SetPageRanges(const PageRangeList& ranges) {
printing::PageRanges page_ranges; printing::PageRanges page_ranges;
PageRangeList::const_iterator it = ranges.begin(); PageRangeList::const_iterator it = ranges.begin();
for(; it != ranges.end(); ++it) { for(; it != ranges.end(); ++it) {
const CefPageRange& cef_range = *it; const CefRange& cef_range = *it;
printing::PageRange range; printing::PageRange range;
range.from = cef_range.from; range.from = cef_range.from;
range.to = cef_range.to; range.to = cef_range.to;
@ -100,7 +100,7 @@ void CefPrintSettingsImpl::GetPageRanges(PageRangeList& ranges) {
printing::PageRanges::const_iterator it = page_ranges.begin(); printing::PageRanges::const_iterator it = page_ranges.begin();
for (; it != page_ranges.end(); ++it) { for (; it != page_ranges.end(); ++it) {
const printing::PageRange& range = *it; const printing::PageRange& range = *it;
ranges.push_back(CefPageRange(range.from, range.to)); ranges.push_back(CefRange(range.from, range.to));
} }
} }

View File

@ -0,0 +1,39 @@
// Copyright 2016 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
#include "libcef/browser/views/basic_label_button_impl.h"
#include "libcef/browser/views/basic_label_button_view.h"
// static
CefRefPtr<CefLabelButton> CefLabelButton::CreateLabelButton(
CefRefPtr<CefButtonDelegate> delegate,
const CefString& text,
bool with_frame) {
return CefBasicLabelButtonImpl::Create(delegate, text, with_frame);
}
// static
CefRefPtr<CefBasicLabelButtonImpl> CefBasicLabelButtonImpl::Create(
CefRefPtr<CefButtonDelegate> delegate,
const CefString& text,
bool with_frame) {
CEF_REQUIRE_UIT_RETURN(nullptr);
CefRefPtr<CefBasicLabelButtonImpl> label_button =
new CefBasicLabelButtonImpl(delegate);
label_button->Initialize();
if (!text.empty())
label_button->SetText(text);
if (with_frame)
label_button->root_view()->SetStyle(views::CustomButton::STYLE_BUTTON);
return label_button;
}
CefBasicLabelButtonImpl::CefBasicLabelButtonImpl(CefRefPtr<CefButtonDelegate> delegate)
: ParentClass(delegate) {
}
views::LabelButton* CefBasicLabelButtonImpl::CreateRootView() {
return new CefBasicLabelButtonView(delegate());
}

View File

@ -0,0 +1,45 @@
// Copyright 2016 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_VIEWS_BASIC_LABEL_BUTTON_IMPL_H_
#define CEF_LIBCEF_BROWSER_VIEWS_BASIC_LABEL_BUTTON_IMPL_H_
#pragma once
#include "include/views/cef_label_button.h"
#include "include/views/cef_button_delegate.h"
#include "libcef/browser/views/label_button_impl.h"
#include "ui/views/controls/button/label_button.h"
class CefBasicLabelButtonImpl :
public CefLabelButtonImpl<views::LabelButton, CefLabelButton,
CefButtonDelegate> {
public:
typedef CefLabelButtonImpl<views::LabelButton, CefLabelButton,
CefButtonDelegate> ParentClass;
// Create a new CefLabelButton instance. |delegate| may be nullptr.
static CefRefPtr<CefBasicLabelButtonImpl> Create(
CefRefPtr<CefButtonDelegate> delegate,
const CefString& text,
bool with_frame);
// CefViewAdapter methods:
std::string GetDebugType() override { return "LabelButton"; }
private:
// Create a new implementation object.
// Always call Initialize() after creation.
// |delegate| may be nullptr.
explicit CefBasicLabelButtonImpl(CefRefPtr<CefButtonDelegate> delegate);
// CefViewImpl methods:
views::LabelButton* CreateRootView() override;
IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefBasicLabelButtonImpl);
DISALLOW_COPY_AND_ASSIGN(CefBasicLabelButtonImpl);
};
#endif // CEF_LIBCEF_BROWSER_VIEWS_BASIC_LABEL_BUTTON_IMPL_H_

View File

@ -0,0 +1,10 @@
// Copyright 2016 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
#include "libcef/browser/views/basic_label_button_view.h"
CefBasicLabelButtonView::CefBasicLabelButtonView(
CefButtonDelegate* cef_delegate)
: ParentClass(cef_delegate) {
}

View File

@ -0,0 +1,37 @@
// Copyright 2016 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_VIEWS_BASIC_LABEL_BUTTON_VIEW_H_
#define CEF_LIBCEF_BROWSER_VIEWS_BASIC_LABEL_BUTTON_VIEW_H_
#pragma once
#include "include/views/cef_button_delegate.h"
#include "libcef/browser/views/label_button_view.h"
#include "ui/views/controls/button/label_button.h"
// Extend views::LabelButton with a no-argument constructor as required by the
// CefViewView template and extend views::ButtonListener as required by the
// CefButtonView template.
class LabelButtonEx : public views::LabelButton,
public views::ButtonListener {
public:
LabelButtonEx() : views::LabelButton(this, base::string16()) {
}
};
class CefBasicLabelButtonView :
public CefLabelButtonView<LabelButtonEx, CefButtonDelegate> {
public:
typedef CefLabelButtonView<LabelButtonEx, CefButtonDelegate> ParentClass;
// |cef_delegate| may be nullptr.
explicit CefBasicLabelButtonView(CefButtonDelegate* cef_delegate);
private:
DISALLOW_COPY_AND_ASSIGN(CefBasicLabelButtonView);
};
#endif // CEF_LIBCEF_BROWSER_VIEWS_BASIC_LABEL_BUTTON_VIEW_H_

View File

@ -0,0 +1,30 @@
// Copyright 2016 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
#include "libcef/browser/views/basic_panel_impl.h"
#include "libcef/browser/views/basic_panel_view.h"
// static
CefRefPtr<CefPanel> CefPanel::CreatePanel(
CefRefPtr<CefPanelDelegate> delegate) {
return CefBasicPanelImpl::Create(delegate);
}
// static
CefRefPtr<CefBasicPanelImpl> CefBasicPanelImpl::Create(
CefRefPtr<CefPanelDelegate> delegate) {
CEF_REQUIRE_UIT_RETURN(nullptr);
CefRefPtr<CefBasicPanelImpl> panel = new CefBasicPanelImpl(delegate);
panel->Initialize();
return panel;
}
CefBasicPanelImpl::CefBasicPanelImpl(CefRefPtr<CefPanelDelegate> delegate)
: ParentClass(delegate) {
}
views::View* CefBasicPanelImpl::CreateRootView() {
return new CefBasicPanelView(delegate());
}

View File

@ -0,0 +1,41 @@
// Copyright 2016 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_VIEWS_BASIC_PANEL_IMPL_H_
#define CEF_LIBCEF_BROWSER_VIEWS_BASIC_PANEL_IMPL_H_
#pragma once
#include "include/views/cef_panel.h"
#include "include/views/cef_panel_delegate.h"
#include "libcef/browser/views/panel_impl.h"
#include "ui/views/view.h"
class CefBasicPanelImpl :
public CefPanelImpl<views::View, CefPanel, CefPanelDelegate> {
public:
typedef CefPanelImpl<views::View, CefPanel, CefPanelDelegate> ParentClass;
// Create a new CefPanel instance. |delegate| may be nullptr.
static CefRefPtr<CefBasicPanelImpl> Create(
CefRefPtr<CefPanelDelegate> delegate);
// CefViewAdapter methods:
std::string GetDebugType() override { return "Panel"; }
private:
// Create a new implementation object.
// Always call Initialize() after creation.
// |delegate| may be nullptr.
explicit CefBasicPanelImpl(CefRefPtr<CefPanelDelegate> delegate);
// CefViewImpl methods:
views::View* CreateRootView() override;
IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefBasicPanelImpl);
DISALLOW_COPY_AND_ASSIGN(CefBasicPanelImpl);
};
#endif // CEF_LIBCEF_BROWSER_VIEWS_BASIC_PANEL_IMPL_H_

View File

@ -0,0 +1,9 @@
// Copyright 2016 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
#include "libcef/browser/views/basic_panel_view.h"
CefBasicPanelView::CefBasicPanelView(CefPanelDelegate* cef_delegate)
: ParentClass(cef_delegate) {
}

View File

@ -0,0 +1,24 @@
// Copyright 2016 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_VIEWS_BASIC_PANEL_VIEW_H_
#define CEF_LIBCEF_BROWSER_VIEWS_BASIC_PANEL_VIEW_H_
#pragma once
#include "include/views/cef_panel_delegate.h"
#include "libcef/browser/views/panel_view.h"
class CefBasicPanelView : public CefPanelView<views::View, CefPanelDelegate> {
public:
typedef CefPanelView<views::View, CefPanelDelegate> ParentClass;
// |cef_delegate| may be nullptr.
explicit CefBasicPanelView(CefPanelDelegate* cef_delegate);
private:
DISALLOW_COPY_AND_ASSIGN(CefBasicPanelView);
};
#endif // CEF_LIBCEF_BROWSER_VIEWS_BASIC_PANEL_VIEW_H_

View File

@ -0,0 +1,78 @@
// Copyright 2016 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
#include "libcef/browser/views/box_layout_impl.h"
#include "libcef/browser/thread_util.h"
#include "libcef/browser/views/view_util.h"
// static
CefRefPtr<CefBoxLayoutImpl> CefBoxLayoutImpl::Create(
const CefBoxLayoutSettings& settings,
views::View* owner_view) {
CEF_REQUIRE_UIT_RETURN(nullptr);
CefRefPtr<CefBoxLayoutImpl> impl = new CefBoxLayoutImpl(settings);
impl->Initialize(owner_view);
return impl;
}
void CefBoxLayoutImpl::SetFlexForView(CefRefPtr<CefView> view, int flex) {
CEF_REQUIRE_VALID_RETURN_VOID();
DCHECK_GE(flex, 0);
if (flex < 0)
return;
DCHECK(view && view->IsValid() && view->IsAttached());
if (!view || !view->IsValid() || !view->IsAttached())
return;
views::View* view_ptr = view_util::GetFor(view);
DCHECK_EQ(view_ptr->parent(), owner_view());
if (view_ptr->parent() != owner_view())
return;
layout()->SetFlexForView(view_ptr, flex);
}
void CefBoxLayoutImpl::ClearFlexForView(CefRefPtr<CefView> view) {
CEF_REQUIRE_VALID_RETURN_VOID();
DCHECK(view && view->IsValid() && view->IsAttached());
if (!view || !view->IsValid() || !view->IsAttached())
return;
views::View* view_ptr = view_util::GetFor(view);
DCHECK_EQ(view_ptr->parent(), owner_view());
if (view_ptr->parent() != owner_view())
return;
layout()->ClearFlexForView(view_ptr);
}
CefBoxLayoutImpl::CefBoxLayoutImpl(const CefBoxLayoutSettings& settings)
: settings_(settings) {
}
views::BoxLayout* CefBoxLayoutImpl::CreateLayout() {
views::BoxLayout* layout = new views::BoxLayout(
settings_.horizontal ? views::BoxLayout::kHorizontal :
views::BoxLayout::kVertical,
settings_.inside_border_horizontal_spacing,
settings_.inside_border_vertical_spacing,
settings_.between_child_spacing);
layout->set_main_axis_alignment(
static_cast<views::BoxLayout::MainAxisAlignment>(
settings_.main_axis_alignment));
layout->set_cross_axis_alignment(
static_cast<views::BoxLayout::CrossAxisAlignment>(
settings_.cross_axis_alignment));
layout->set_inside_border_insets(gfx::Insets(
settings_.inside_border_insets.top,
settings_.inside_border_insets.left,
settings_.inside_border_insets.bottom,
settings_.inside_border_insets.right));
layout->set_minimum_cross_axis_size(settings_.minimum_cross_axis_size);
if (settings_.default_flex > 0)
layout->SetDefaultFlex(settings_.default_flex);
return layout;
}

View File

@ -0,0 +1,43 @@
// Copyright 2016 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_VIEWS_BOX_LAYOUT_IMPL_H_
#define CEF_LIBCEF_BROWSER_VIEWS_BOX_LAYOUT_IMPL_H_
#pragma once
#include "include/views/cef_box_layout.h"
#include "libcef/browser/views/layout_impl.h"
#include "ui/views/layout/box_layout.h"
class CefBoxLayoutImpl :
public CefLayoutImpl<views::BoxLayout, CefBoxLayout> {
public:
// Necessary for the CEF_REQUIRE_VALID_*() macros to compile.
typedef CefLayoutImpl<views::BoxLayout, CefBoxLayout> ParentClass;
// Create a new CefBoxLayout insance. |owner_view| must be non-nullptr.
static CefRefPtr<CefBoxLayoutImpl> Create(
const CefBoxLayoutSettings& settings,
views::View* owner_view);
// CefBoxLayout methods:
void SetFlexForView(CefRefPtr<CefView> view, int flex) override;
void ClearFlexForView(CefRefPtr<CefView> view) override;
// CefLayout methods:
CefRefPtr<CefBoxLayout> AsBoxLayout() override { return this; }
private:
explicit CefBoxLayoutImpl(const CefBoxLayoutSettings& settings);
views::BoxLayout* CreateLayout() override;
CefBoxLayoutSettings settings_;
IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefBoxLayoutImpl);
DISALLOW_COPY_AND_ASSIGN(CefBoxLayoutImpl);
};
#endif // CEF_LIBCEF_BROWSER_VIEWS_BOX_LAYOUT_IMPL_H_

View File

@ -0,0 +1,289 @@
// Copyright 2016 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/browser/views/browser_platform_delegate_views.h"
#include <utility>
#include "include/views/cef_window.h"
#include "libcef/browser/browser_host_impl.h"
#include "libcef/browser/views/browser_view_impl.h"
#include "libcef/browser/views/menu_runner_views.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h"
#include "ui/views/widget/widget.h"
namespace {
// Default popup window delegate implementation.
class PopupWindowDelegate : public CefWindowDelegate {
public:
explicit PopupWindowDelegate(CefRefPtr<CefBrowserView> browser_view)
: browser_view_(browser_view) {
}
void OnWindowCreated(CefRefPtr<CefWindow> window) override {
window->AddChildView(browser_view_);
window->Show();
browser_view_->RequestFocus();
}
void OnWindowDestroyed(CefRefPtr<CefWindow> window) override {
browser_view_ = nullptr;
}
bool CanClose(CefRefPtr<CefWindow> window) override {
CefRefPtr<CefBrowser> browser = browser_view_->GetBrowser();
if (browser)
return browser->GetHost()->TryCloseBrowser();
return true;
}
private:
CefRefPtr<CefBrowserView> browser_view_;
IMPLEMENT_REFCOUNTING(PopupWindowDelegate);
DISALLOW_COPY_AND_ASSIGN(PopupWindowDelegate);
};
} // namespace
CefBrowserPlatformDelegateViews::CefBrowserPlatformDelegateViews(
scoped_ptr<CefBrowserPlatformDelegateNative> native_delegate,
CefRefPtr<CefBrowserViewImpl> browser_view)
: native_delegate_(std::move(native_delegate)),
browser_view_(browser_view) {
native_delegate_->set_windowless_handler(this);
}
void CefBrowserPlatformDelegateViews::set_browser_view(
CefRefPtr<CefBrowserViewImpl> browser_view) {
browser_view_ = browser_view;
}
void CefBrowserPlatformDelegateViews::WebContentsCreated(
content::WebContents* web_contents) {
browser_view_->WebContentsCreated(web_contents);
}
void CefBrowserPlatformDelegateViews::BrowserCreated(
CefBrowserHostImpl* browser) {
CefBrowserPlatformDelegate::BrowserCreated(browser);
browser_view_->BrowserCreated(browser);
}
void CefBrowserPlatformDelegateViews::NotifyBrowserCreated() {
DCHECK(browser_view_);
DCHECK(browser_);
if (browser_view_->delegate())
browser_view_->delegate()->OnBrowserCreated(browser_view_, browser_);
}
void CefBrowserPlatformDelegateViews::NotifyBrowserDestroyed() {
DCHECK(browser_view_);
DCHECK(browser_);
if (browser_view_->delegate())
browser_view_->delegate()->OnBrowserDestroyed(browser_view_, browser_);
}
void CefBrowserPlatformDelegateViews::BrowserDestroyed(
CefBrowserHostImpl* browser) {
CefBrowserPlatformDelegate::BrowserDestroyed(browser);
browser_view_->BrowserDestroyed(browser);
browser_view_ = nullptr;
}
bool CefBrowserPlatformDelegateViews::CreateHostWindow() {
// Nothing to do here.
return true;
}
void CefBrowserPlatformDelegateViews::CloseHostWindow() {
views::Widget* widget = GetWindowWidget();
if (widget && !widget->IsClosed())
widget->Close();
}
CefWindowHandle CefBrowserPlatformDelegateViews::GetHostWindowHandle() const {
return view_util::GetWindowHandle(GetWindowWidget());
}
views::Widget* CefBrowserPlatformDelegateViews::GetWindowWidget() const {
if (browser_view_->root_view())
return browser_view_->root_view()->GetWidget();
return nullptr;
}
CefRefPtr<CefBrowserView>
CefBrowserPlatformDelegateViews::GetBrowserView() const {
return browser_view_.get();
}
void CefBrowserPlatformDelegateViews::PopupWebContentsCreated(
const CefBrowserSettings& settings,
CefRefPtr<CefClient> client,
content::WebContents* new_web_contents,
CefBrowserPlatformDelegate* new_platform_delegate,
bool is_devtools) {
DCHECK(new_platform_delegate->IsViewsHosted());
CefBrowserPlatformDelegateViews* new_platform_delegate_impl =
static_cast<CefBrowserPlatformDelegateViews*>(new_platform_delegate);
CefRefPtr<CefBrowserViewDelegate> new_delegate;
if (browser_view_->delegate()) {
new_delegate = browser_view_->delegate()->GetDelegateForPopupBrowserView(
browser_view_.get(), settings, client, is_devtools);
}
// Create a new BrowserView for the popup.
CefRefPtr<CefBrowserViewImpl> new_browser_view =
CefBrowserViewImpl::CreateForPopup(settings, new_delegate);
// Associate the PlatformDelegate with the new BrowserView.
new_platform_delegate_impl->set_browser_view(new_browser_view);
}
void CefBrowserPlatformDelegateViews::PopupBrowserCreated(
CefBrowserHostImpl* new_browser,
bool is_devtools) {
CefRefPtr<CefBrowserView> new_browser_view =
CefBrowserView::GetForBrowser(new_browser);
DCHECK(new_browser_view);
bool popup_handled = false;
if (browser_view_->delegate()) {
popup_handled = browser_view_->delegate()->OnPopupBrowserViewCreated(
browser_view_.get(), new_browser_view.get(), is_devtools);
}
if (!popup_handled) {
CefWindow::CreateTopLevelWindow(
new PopupWindowDelegate(new_browser_view.get()));
}
}
void CefBrowserPlatformDelegateViews::WasResized() {
content::RenderViewHost* host = browser_->web_contents()->GetRenderViewHost();
if (host)
host->GetWidget()->WasResized();
}
void CefBrowserPlatformDelegateViews::SendKeyEvent(
const content::NativeWebKeyboardEvent& event) {
content::RenderViewHost* host = browser_->web_contents()->GetRenderViewHost();
if (host)
host->GetWidget()->ForwardKeyboardEvent(event);
}
void CefBrowserPlatformDelegateViews::SendMouseEvent(
const blink::WebMouseEvent& event) {
content::RenderViewHost* host = browser_->web_contents()->GetRenderViewHost();
if (host)
host->GetWidget()->ForwardMouseEvent(event);
}
void CefBrowserPlatformDelegateViews::SendMouseWheelEvent(
const blink::WebMouseWheelEvent& event) {
content::RenderViewHost* host = browser_->web_contents()->GetRenderViewHost();
if (host)
host->GetWidget()->ForwardWheelEvent(event);
}
void CefBrowserPlatformDelegateViews::SendFocusEvent(bool setFocus) {
// Will result in a call to WebContents::Focus().
if (setFocus && browser_view_->root_view())
browser_view_->root_view()->RequestFocus();
}
gfx::Point CefBrowserPlatformDelegateViews::GetScreenPoint(
const gfx::Point& view_pt) const {
if (!browser_view_->root_view())
return view_pt;
gfx::Point screen_point = view_pt;
view_util::ConvertPointToScreen(browser_view_->root_view(), &screen_point,
true);
return screen_point;
}
void CefBrowserPlatformDelegateViews::ViewText(const std::string& text) {
native_delegate_->ViewText(text);
}
void CefBrowserPlatformDelegateViews::HandleKeyboardEvent(
const content::NativeWebKeyboardEvent& event) {
native_delegate_->HandleKeyboardEvent(event);
}
void CefBrowserPlatformDelegateViews::HandleExternalProtocol(const GURL& url) {
native_delegate_->HandleExternalProtocol(url);
}
void CefBrowserPlatformDelegateViews::TranslateKeyEvent(
content::NativeWebKeyboardEvent& result,
const CefKeyEvent& key_event) const {
native_delegate_->TranslateKeyEvent(result, key_event);
}
void CefBrowserPlatformDelegateViews::TranslateClickEvent(
blink::WebMouseEvent& result,
const CefMouseEvent& mouse_event,
CefBrowserHost::MouseButtonType type,
bool mouseUp, int clickCount) const {
native_delegate_->TranslateClickEvent(result, mouse_event, type, mouseUp,
clickCount);
}
void CefBrowserPlatformDelegateViews::TranslateMoveEvent(
blink::WebMouseEvent& result,
const CefMouseEvent& mouse_event,
bool mouseLeave) const {
native_delegate_->TranslateMoveEvent(result, mouse_event, mouseLeave);
}
void CefBrowserPlatformDelegateViews::TranslateWheelEvent(
blink::WebMouseWheelEvent& result,
const CefMouseEvent& mouse_event,
int deltaX, int deltaY) const {
native_delegate_->TranslateWheelEvent(result, mouse_event, deltaX, deltaY);
}
CefEventHandle CefBrowserPlatformDelegateViews::GetEventHandle(
const content::NativeWebKeyboardEvent& event) const {
return native_delegate_->GetEventHandle(event);
}
scoped_ptr<CefFileDialogRunner>
CefBrowserPlatformDelegateViews::CreateFileDialogRunner() {
return native_delegate_->CreateFileDialogRunner();
}
scoped_ptr<CefJavaScriptDialogRunner>
CefBrowserPlatformDelegateViews::CreateJavaScriptDialogRunner() {
return native_delegate_->CreateJavaScriptDialogRunner();
}
scoped_ptr<CefMenuRunner> CefBrowserPlatformDelegateViews::CreateMenuRunner() {
return make_scoped_ptr(new CefMenuRunnerViews(browser_view_.get()));
}
bool CefBrowserPlatformDelegateViews::IsWindowless() const {
return false;
}
bool CefBrowserPlatformDelegateViews::IsViewsHosted() const {
return true;
}
CefWindowHandle CefBrowserPlatformDelegateViews::GetParentWindowHandle() const {
return GetHostWindowHandle();
}
gfx::Point CefBrowserPlatformDelegateViews::GetParentScreenPoint(
const gfx::Point& view) const {
return GetScreenPoint(view);
}

View File

@ -0,0 +1,84 @@
// Copyright 2016 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_VIEWS_BROWSER_PLATFORM_DELEGATE_VIEWS_H_
#define CEF_LIBCEF_BROWSER_VIEWS_BROWSER_PLATFORM_DELEGATE_VIEWS_H_
#include "libcef/browser/browser_platform_delegate.h"
#include "libcef/browser/native/browser_platform_delegate_native.h"
#include "libcef/browser/views/browser_view_impl.h"
// Implementation of Views-based browser functionality.
class CefBrowserPlatformDelegateViews :
public CefBrowserPlatformDelegate,
public CefBrowserPlatformDelegateNative::WindowlessHandler {
public:
// Platform-specific behaviors will be delegated to |native_delegate|.
// |browser_view_getter| may be initially empty for popup browsers.
CefBrowserPlatformDelegateViews(
scoped_ptr<CefBrowserPlatformDelegateNative> native_delegate,
CefRefPtr<CefBrowserViewImpl> browser_view);
void set_browser_view(CefRefPtr<CefBrowserViewImpl> browser_view);
// CefBrowserPlatformDelegate methods:
void WebContentsCreated(content::WebContents* web_contents) override;
void BrowserCreated(CefBrowserHostImpl* browser) override;
void NotifyBrowserCreated() override;
void NotifyBrowserDestroyed() override;
void BrowserDestroyed(CefBrowserHostImpl* browser) override;
bool CreateHostWindow() override;
void CloseHostWindow() override;
CefWindowHandle GetHostWindowHandle() const override;
views::Widget* GetWindowWidget() const override;
CefRefPtr<CefBrowserView> GetBrowserView() const override;
void PopupWebContentsCreated(
const CefBrowserSettings& settings,
CefRefPtr<CefClient> client,
content::WebContents* new_web_contents,
CefBrowserPlatformDelegate* new_platform_delegate,
bool is_devtools) override;
void PopupBrowserCreated(
CefBrowserHostImpl* new_browser,
bool is_devtools) override;
void WasResized() override;
void SendKeyEvent(const content::NativeWebKeyboardEvent& event) override;
void SendMouseEvent(const blink::WebMouseEvent& event) override;
void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event) override;
void SendFocusEvent(bool setFocus) override;
gfx::Point GetScreenPoint(const gfx::Point& view) const override;
void ViewText(const std::string& text) override;
void HandleKeyboardEvent(
const content::NativeWebKeyboardEvent& event) override;
void HandleExternalProtocol(const GURL& url) override;
void TranslateKeyEvent(content::NativeWebKeyboardEvent& result,
const CefKeyEvent& key_event) const override;
void TranslateClickEvent(blink::WebMouseEvent& result,
const CefMouseEvent& mouse_event,
CefBrowserHost::MouseButtonType type,
bool mouseUp, int clickCount) const override;
void TranslateMoveEvent(blink::WebMouseEvent& result,
const CefMouseEvent& mouse_event,
bool mouseLeave) const override;
void TranslateWheelEvent(blink::WebMouseWheelEvent& result,
const CefMouseEvent& mouse_event,
int deltaX, int deltaY) const override;
CefEventHandle GetEventHandle(
const content::NativeWebKeyboardEvent& event) const override;
scoped_ptr<CefFileDialogRunner> CreateFileDialogRunner() override;
scoped_ptr<CefJavaScriptDialogRunner> CreateJavaScriptDialogRunner() override;
scoped_ptr<CefMenuRunner> CreateMenuRunner() override;
bool IsWindowless() const override;
bool IsViewsHosted() const override;
// CefBrowserPlatformDelegateNative::WindowlessHandler methods:
CefWindowHandle GetParentWindowHandle() const override;
gfx::Point GetParentScreenPoint(const gfx::Point& view) const override;
private:
scoped_ptr<CefBrowserPlatformDelegateNative> native_delegate_;
CefRefPtr<CefBrowserViewImpl> browser_view_;
};
#endif // CEF_LIBCEF_BROWSER_VIEWS_BROWSER_PLATFORM_DELEGATE_VIEWS_H_

View File

@ -0,0 +1,165 @@
// Copyright 2016 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
#include "libcef/browser/views/browser_view_impl.h"
#include "libcef/browser/browser_host_impl.h"
#include "libcef/browser/context.h"
#include "libcef/browser/thread_util.h"
// static
CefRefPtr<CefBrowserView> CefBrowserView::CreateBrowserView(
CefRefPtr<CefClient> client,
const CefString& url,
const CefBrowserSettings& settings,
CefRefPtr<CefRequestContext> request_context,
CefRefPtr<CefBrowserViewDelegate> delegate) {
return CefBrowserViewImpl::Create(client, url, settings, request_context,
delegate);
}
// static
CefRefPtr<CefBrowserView> CefBrowserView::GetForBrowser(
CefRefPtr<CefBrowser> browser) {
CEF_REQUIRE_UIT_RETURN(nullptr);
CefBrowserHostImpl* browser_impl =
static_cast<CefBrowserHostImpl*>(browser.get());
if (browser_impl && browser_impl->IsViewsHosted())
return browser_impl->GetBrowserView();
return nullptr;
}
// static
CefRefPtr<CefBrowserViewImpl> CefBrowserViewImpl::Create(
CefRefPtr<CefClient> client,
const CefString& url,
const CefBrowserSettings& settings,
CefRefPtr<CefRequestContext> request_context,
CefRefPtr<CefBrowserViewDelegate> delegate) {
CEF_REQUIRE_UIT_RETURN(nullptr);
CefRefPtr<CefBrowserViewImpl> browser_view = new CefBrowserViewImpl(delegate);
browser_view->SetPendingBrowserCreateParams(client, url, settings,
request_context);
browser_view->Initialize();
browser_view->SetDefaults(settings);
return browser_view;
}
// static
CefRefPtr<CefBrowserViewImpl> CefBrowserViewImpl::CreateForPopup(
const CefBrowserSettings& settings,
CefRefPtr<CefBrowserViewDelegate> delegate) {
CEF_REQUIRE_UIT_RETURN(nullptr);
CefRefPtr<CefBrowserViewImpl> browser_view = new CefBrowserViewImpl(delegate);
browser_view->Initialize();
browser_view->SetDefaults(settings);
return browser_view;
}
void CefBrowserViewImpl::WebContentsCreated(
content::WebContents* web_contents) {
if (root_view())
root_view()->SetWebContents(web_contents);
}
void CefBrowserViewImpl::BrowserCreated(CefBrowserHostImpl* browser) {
browser_ = browser;
}
void CefBrowserViewImpl::BrowserDestroyed(CefBrowserHostImpl* browser) {
DCHECK_EQ(browser, browser_);
browser_ = nullptr;
if (root_view())
root_view()->SetWebContents(nullptr);
}
CefRefPtr<CefBrowser> CefBrowserViewImpl::GetBrowser() {
CEF_REQUIRE_VALID_RETURN(nullptr);
return browser_;
}
void CefBrowserViewImpl::SetBackgroundColor(cef_color_t color) {
CEF_REQUIRE_VALID_RETURN_VOID();
ParentClass::SetBackgroundColor(color);
if (root_view())
root_view()->SetResizeBackgroundColor(color);
}
void CefBrowserViewImpl::Detach() {
ParentClass::Detach();
// root_view() will be nullptr now.
DCHECK(!root_view());
if (browser_) {
// |browser_| will disappear when WindowDestroyed() indirectly calls
// BrowserDestroyed() so keep a reference.
CefRefPtr<CefBrowserHostImpl> browser = browser_;
// Force the browser to be destroyed.
browser->WindowDestroyed();
}
}
void CefBrowserViewImpl::GetDebugInfo(base::DictionaryValue* info,
bool include_children) {
ParentClass::GetDebugInfo(info, include_children);
if (browser_)
info->SetString("url", browser_->GetMainFrame()->GetURL().ToString());
}
void CefBrowserViewImpl::OnBrowserViewAdded() {
if (!browser_ && pending_browser_create_params_) {
// Top-level browsers will be created when this view is added to the views
// hierarchy.
pending_browser_create_params_->browser_view = this;
CefBrowserHostImpl::Create(*pending_browser_create_params_);
DCHECK(browser_);
pending_browser_create_params_.reset(nullptr);
}
}
CefBrowserViewImpl::CefBrowserViewImpl(
CefRefPtr<CefBrowserViewDelegate> delegate)
: ParentClass(delegate) {
}
void CefBrowserViewImpl::SetPendingBrowserCreateParams(
CefRefPtr<CefClient> client,
const CefString& url,
const CefBrowserSettings& settings,
CefRefPtr<CefRequestContext> request_context) {
DCHECK(!pending_browser_create_params_);
pending_browser_create_params_.reset(new CefBrowserHostImpl::CreateParams());
pending_browser_create_params_->client = client;
pending_browser_create_params_->url = url;
pending_browser_create_params_->settings = settings;
pending_browser_create_params_->request_context = request_context;
}
void CefBrowserViewImpl::SetDefaults(const CefBrowserSettings& settings) {
SkColor background_color = SK_ColorWHITE;
if (CefColorGetA(settings.background_color) > 0) {
background_color = SkColorSetRGB(
CefColorGetR(settings.background_color),
CefColorGetG(settings.background_color),
CefColorGetB(settings.background_color));
} else {
const CefSettings& global_settings = CefContext::Get()->settings();
if (CefColorGetA(global_settings.background_color) > 0) {
background_color = SkColorSetRGB(
CefColorGetR(global_settings.background_color),
CefColorGetG(global_settings.background_color),
CefColorGetB(global_settings.background_color));
}
}
SetBackgroundColor(background_color);
}
CefBrowserViewView* CefBrowserViewImpl::CreateRootView() {
return new CefBrowserViewView(delegate(), this);
}

Some files were not shown because too many files have changed in this diff Show More