Add support for loading extensions (issue #1947)

- Add CefRequestContext::LoadExtension, CefExtension, CefExtensionHandler and
  related methods/interfaces.
- Add chrome://extensions-support that lists supported Chrome APIs.
- Add CefBrowserHost::SetAutoResizeEnabled and CefDisplayHandler::OnAutoResize
  to support browser resize based on preferred web contents size.
- views: Add support for custom CefMenuButton popups.
- cefclient: Run with `--load-extension=set_page_color` command-line flag for
  an extension loading example. Add `--use-views` on Windows and Linux for an
  even better example.
This commit is contained in:
Marshall Greenblatt
2017-08-03 18:55:19 -04:00
parent 5b12134a45
commit 9cff99dc4e
178 changed files with 10360 additions and 650 deletions

View File

@ -42,6 +42,12 @@
class CefMenuButton;
///
// MenuButton pressed lock is released when this object is destroyed.
///
/*--cef(source=library)--*/
class CefMenuButtonPressedLock : public CefBaseRefCounted {};
///
// Implement this interface to handle MenuButton events. The methods of this
// class will be called on the browser process UI thread unless otherwise
@ -51,12 +57,16 @@ class CefMenuButton;
class CefMenuButtonDelegate : public CefButtonDelegate {
public:
///
// Called when |button| is pressed. Call CefMenuButton::ShowMenu() to show the
// resulting menu at |screen_point|.
// Called when |button| is pressed. Call CefMenuButton::ShowMenu() to show a
// popup menu at |screen_point|. When showing a custom popup such as a window
// keep a reference to |button_pressed_lock| until the popup is hidden to
// maintain the pressed button state.
///
/*--cef()--*/
virtual void OnMenuButtonPressed(CefRefPtr<CefMenuButton> menu_button,
const CefPoint& screen_point) = 0;
virtual void OnMenuButtonPressed(
CefRefPtr<CefMenuButton> menu_button,
const CefPoint& screen_point,
CefRefPtr<CefMenuButtonPressedLock> button_pressed_lock) = 0;
};
#endif // CEF_INCLUDE_VIEWS_CEF_MENU_BUTTON_DELEGATE_H_

View File

@ -63,6 +63,21 @@ class CefWindowDelegate : public CefPanelDelegate {
/*--cef()--*/
virtual void OnWindowDestroyed(CefRefPtr<CefWindow> window) {}
///
// Return the parent for |window| or NULL if the |window| does not have a
// parent. Windows with parents will not get a taskbar button. Set |is_menu|
// to true if |window| will be displayed as a menu, in which case it will not
// be clipped to the parent window bounds. Set |can_activate_menu| to false
// if |is_menu| is true and |window| should not be activated (given keyboard
// focus) when displayed.
///
/*--cef()--*/
virtual CefRefPtr<CefWindow> GetParentWindow(CefRefPtr<CefWindow> window,
bool* is_menu,
bool* can_activate_menu) {
return NULL;
}
///
// Return true if |window| should be created without a frame or title bar. The
// window will be resizable if CanResize() returns true. Use