Commit 6eaf11f0 authored by Marshall Greenblatt's avatar Marshall Greenblatt

views: Support top menu switching with mouse and arrow keys (issue #2102)

- cefclient: Add example ViewsMenuBar implementation and show top menu
  by default (specify `--hide-top-menu` to hide it).
parent fbc8b983
......@@ -299,6 +299,8 @@
'tests/cefclient/browser/root_window_win.h',
'tests/cefclient/browser/temp_window_win.cc',
'tests/cefclient/browser/temp_window_win.h',
'tests/cefclient/browser/views_menu_bar.cc',
'tests/cefclient/browser/views_menu_bar.h',
'tests/cefclient/browser/views_window.cc',
'tests/cefclient/browser/views_window.h',
'tests/cefclient/browser/window_test_runner_views.cc',
......@@ -350,6 +352,8 @@
'tests/cefclient/browser/root_window_views.h',
'tests/cefclient/browser/temp_window_x11.cc',
'tests/cefclient/browser/temp_window_x11.h',
'tests/cefclient/browser/views_menu_bar.cc',
'tests/cefclient/browser/views_menu_bar.h',
'tests/cefclient/browser/views_window.cc',
'tests/cefclient/browser/views_window.h',
'tests/cefclient/browser/window_test_runner_gtk.cc',
......
......@@ -58,6 +58,11 @@ typedef struct _cef_menu_model_t {
///
cef_base_ref_counted_t base;
///
// Returns true (1) if this menu is a submenu.
///
int (CEF_CALLBACK *is_sub_menu)(struct _cef_menu_model_t* self);
///
// Clears the menu. Returns true (1) on success.
///
......
......@@ -65,6 +65,30 @@ typedef struct _cef_menu_model_delegate_t {
struct _cef_menu_model_t* menu_model, int command_id,
cef_event_flags_t event_flags);
///
// Called when the user moves the mouse outside the menu and over the owning
// window.
///
void (CEF_CALLBACK *mouse_outside_menu)(
struct _cef_menu_model_delegate_t* self,
struct _cef_menu_model_t* menu_model, const cef_point_t* screen_point);
///
// Called on unhandled open submenu keyboard commands. |is_rtl| will be true
// (1) if the menu is displaying a right-to-left language.
///
void (CEF_CALLBACK *unhandled_open_submenu)(
struct _cef_menu_model_delegate_t* self,
struct _cef_menu_model_t* menu_model, int is_rtl);
///
// Called on unhandled close submenu keyboard commands. |is_rtl| will be true
// (1) if the menu is displaying a right-to-left language.
///
void (CEF_CALLBACK *unhandled_close_submenu)(
struct _cef_menu_model_delegate_t* self,
struct _cef_menu_model_t* menu_model, int is_rtl);
///
// The menu is about to show.
///
......
......@@ -62,6 +62,12 @@ typedef struct _cef_button_delegate_t {
///
void (CEF_CALLBACK *on_button_pressed)(struct _cef_button_delegate_t* self,
struct _cef_button_t* button);
///
// Called when the state of |button| changes.
///
void (CEF_CALLBACK *on_button_state_changed)(
struct _cef_button_delegate_t* self, struct _cef_button_t* button);
} cef_button_delegate_t;
......
......@@ -68,6 +68,12 @@ typedef struct _cef_menu_button_t {
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);
///
// Show the menu for this button. Results in a call to
// cef_menu_button_delegate_t::on_menu_button_pressed().
///
void (CEF_CALLBACK *trigger_menu)(struct _cef_menu_button_t* self);
} cef_menu_button_t;
......
......@@ -59,6 +59,12 @@ class CefMenuModel : public virtual CefBaseRefCounted {
static CefRefPtr<CefMenuModel> CreateMenuModel(
CefRefPtr<CefMenuModelDelegate> delegate);
///
// Returns true if this menu is a submenu.
///
/*--cef()--*/
virtual bool IsSubMenu() =0;
///
// Clears the menu. Returns true on success.
///
......
......@@ -59,6 +59,30 @@ class CefMenuModelDelegate : public virtual CefBaseRefCounted {
int command_id,
cef_event_flags_t event_flags) =0;
///
// Called when the user moves the mouse outside the menu and over the owning
// window.
///
/*--cef()--*/
virtual void MouseOutsideMenu(CefRefPtr<CefMenuModel> menu_model,
const CefPoint& screen_point) {}
///
// Called on unhandled open submenu keyboard commands. |is_rtl| will be true
// if the menu is displaying a right-to-left language.
///
/*--cef()--*/
virtual void UnhandledOpenSubmenu(CefRefPtr<CefMenuModel> menu_model,
bool is_rtl) {}
///
// Called on unhandled close submenu keyboard commands. |is_rtl| will be true
// if the menu is displaying a right-to-left language.
///
/*--cef()--*/
virtual void UnhandledCloseSubmenu(CefRefPtr<CefMenuModel> menu_model,
bool is_rtl) {}
///
// The menu is about to show.
///
......
......@@ -54,6 +54,12 @@ class CefButtonDelegate : public CefViewDelegate {
///
/*--cef()--*/
virtual void OnButtonPressed(CefRefPtr<CefButton> button) =0;
///
// Called when the state of |button| changes.
///
/*--cef()--*/
virtual void OnButtonStateChanged(CefRefPtr<CefButton> button) {};
};
#endif // CEF_INCLUDE_VIEWS_CEF_BUTTON_DELEGATE_H_
......@@ -78,6 +78,13 @@ class CefMenuButton : public CefLabelButton {
virtual void ShowMenu(CefRefPtr<CefMenuModel> menu_model,
const CefPoint& screen_point,
cef_menu_anchor_position_t anchor_position) =0;
///
// Show the menu for this button. Results in a call to
// CefMenuButtonDelegate::OnMenuButtonPressed().
///
/*--cef()--*/
virtual void TriggerMenu() =0;
};
#endif // CEF_INCLUDE_VIEWS_CEF_MENU_BUTTON_H_
......@@ -113,6 +113,7 @@ class CefWindowDelegate : public CefPanelDelegate {
/*--cef()--*/
virtual bool OnKeyEvent(CefRefPtr<CefWindow> window,
const CefKeyEvent& event) { return false; }
};
#endif // CEF_INCLUDE_VIEWS_CEF_WINDOW_DELEGATE_H_
......@@ -99,7 +99,7 @@ CefMenuManager::CefMenuManager(CefBrowserHostImpl* browser,
weak_ptr_factory_(this) {
DCHECK(web_contents());
DCHECK(runner_.get());
model_ = new CefMenuModelImpl(this, nullptr);
model_ = new CefMenuModelImpl(this, nullptr, false);
}
CefMenuManager::~CefMenuManager() {
......@@ -289,7 +289,8 @@ void CefMenuManager::MenuClosed(CefRefPtr<CefMenuModelImpl> source) {
web_contents()->NotifyContextMenuClosed(params_.custom_context);
}
bool CefMenuManager::FormatLabel(base::string16& label) {
bool CefMenuManager::FormatLabel(CefRefPtr<CefMenuModelImpl> source,
base::string16& label) {
return runner_->FormatLabel(label);
}
......
......@@ -46,7 +46,8 @@ class CefMenuManager : public CefMenuModelImpl::Delegate,
cef_event_flags_t event_flags) override;
void MenuWillShow(CefRefPtr<CefMenuModelImpl> source) override;
void MenuClosed(CefRefPtr<CefMenuModelImpl> source) override;
bool FormatLabel(base::string16& label) override;
bool FormatLabel(CefRefPtr<CefMenuModelImpl> source,
base::string16& label) override;
void ExecuteCommandCallback(int command_id,
cef_event_flags_t event_flags);
......
......@@ -14,6 +14,7 @@
#include "base/message_loop/message_loop.h"
#include "content/public/common/menu_item.h"
#include "ui/base/accelerators/accelerator.h"
#include "ui/gfx/geometry/point.h"
namespace {
......@@ -138,6 +139,18 @@ class CefSimpleMenuModel : public ui::MenuModel {
return NULL;
}
void MouseOutsideMenu(const gfx::Point& screen_point) override {
impl_->MouseOutsideMenu(screen_point);
}
void UnhandledOpenSubmenu(bool is_rtl) override {
impl_->UnhandledOpenSubmenu(is_rtl);
}
void UnhandledCloseSubmenu(bool is_rtl) override {
impl_->UnhandledCloseSubmenu(is_rtl);
}
void MenuWillShow() override {
impl_->MenuWillShow();
}
......@@ -173,7 +186,7 @@ CefRefPtr<CefMenuModel> CefMenuModel::CreateMenuModel(
return nullptr;
CefRefPtr<CefMenuModelImpl> menu_model =
new CefMenuModelImpl(nullptr, delegate);
new CefMenuModelImpl(nullptr, delegate, false);
return menu_model;
}
......@@ -219,10 +232,12 @@ struct CefMenuModelImpl::Item {
CefMenuModelImpl::CefMenuModelImpl(
Delegate* delegate,
CefRefPtr<CefMenuModelDelegate> menu_model_delegate)
CefRefPtr<CefMenuModelDelegate> menu_model_delegate,
bool is_submenu)
: supported_thread_id_(base::PlatformThread::CurrentId()),
delegate_(delegate),
menu_model_delegate_(menu_model_delegate) {
menu_model_delegate_(menu_model_delegate),
is_submenu_(is_submenu) {
DCHECK(delegate_ || menu_model_delegate_);
model_.reset(new CefSimpleMenuModel(this));
}
......@@ -230,6 +245,12 @@ CefMenuModelImpl::CefMenuModelImpl(
CefMenuModelImpl::~CefMenuModelImpl() {
}
bool CefMenuModelImpl::IsSubMenu() {
if (!VerifyContext())
return false;
return is_submenu_;
}
bool CefMenuModelImpl::Clear() {
if (!VerifyContext())
return false;
......@@ -284,7 +305,7 @@ CefRefPtr<CefMenuModel> CefMenuModelImpl::AddSubMenu(int command_id,
return NULL;
Item item(MENUITEMTYPE_SUBMENU, command_id, label, -1);
item.submenu_ = new CefMenuModelImpl(delegate_, menu_model_delegate_);
item.submenu_ = new CefMenuModelImpl(delegate_, menu_model_delegate_, true);
AppendItem(item);
return item.submenu_.get();
}
......@@ -331,7 +352,7 @@ CefRefPtr<CefMenuModel> CefMenuModelImpl::InsertSubMenuAt(
return NULL;
Item item(MENUITEMTYPE_SUBMENU, command_id, label, -1);
item.submenu_ = new CefMenuModelImpl(delegate_, menu_model_delegate_);
item.submenu_ = new CefMenuModelImpl(delegate_, menu_model_delegate_, true);
InsertItemAt(item, index);
return item.submenu_.get();
}
......@@ -646,6 +667,39 @@ void CefMenuModelImpl::ActivatedAt(int index, cef_event_flags_t event_flags) {
menu_model_delegate_->ExecuteCommand(this, command_id, event_flags);
}
void CefMenuModelImpl::MouseOutsideMenu(const gfx::Point& screen_point) {
if (!VerifyContext())
return;
// Allow the callstack to unwind before notifying the delegate since it may
// result in the menu being destroyed.
base::MessageLoop::current()->task_runner()->PostTask(
FROM_HERE,
base::Bind(&CefMenuModelImpl::OnMouseOutsideMenu, this, screen_point));
}
void CefMenuModelImpl::UnhandledOpenSubmenu(bool is_rtl) {
if (!VerifyContext())
return;
// Allow the callstack to unwind before notifying the delegate since it may
// result in the menu being destroyed.
base::MessageLoop::current()->task_runner()->PostTask(
FROM_HERE,
base::Bind(&CefMenuModelImpl::OnUnhandledOpenSubmenu, this, is_rtl));
}
void CefMenuModelImpl::UnhandledCloseSubmenu(bool is_rtl) {
if (!VerifyContext())
return;
// Allow the callstack to unwind before notifying the delegate since it may
// result in the menu being destroyed.
base::MessageLoop::current()->task_runner()->PostTask(
FROM_HERE,
base::Bind(&CefMenuModelImpl::OnUnhandledCloseSubmenu, this, is_rtl));
}
void CefMenuModelImpl::MenuWillShow() {
if (!VerifyContext())
return;
......@@ -654,14 +708,15 @@ void CefMenuModelImpl::MenuWillShow() {
delegate_->MenuWillShow(this);
if (menu_model_delegate_)
menu_model_delegate_->MenuWillShow(this);
for (auto& observer : observers_)
observer.MenuWillShow(this);
}
void CefMenuModelImpl::MenuWillClose() {
if (!VerifyContext())
return;
if (!auto_notify_menu_closed_)
return;
// Due to how menus work on the different platforms, ActivatedAt will be
// called after this. It's more convenient for the delegate to be called
// afterwards, though, so post a task.
......@@ -673,7 +728,7 @@ void CefMenuModelImpl::MenuWillClose() {
base::string16 CefMenuModelImpl::GetFormattedLabelAt(int index) {
base::string16 label = GetLabelAt(index).ToString16();
if (delegate_)
delegate_->FormatLabel(label);
delegate_->FormatLabel(this, label);
if (menu_model_delegate_) {
CefString new_label = label;
if (menu_model_delegate_->FormatLabel(this, new_label))
......@@ -699,18 +754,6 @@ bool CefMenuModelImpl::VerifyRefCount() {
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) {
const int command_id = static_cast<int>(menu_item.action);
......@@ -746,6 +789,11 @@ void CefMenuModelImpl::AddMenuItem(const content::MenuItem& menu_item) {
}
}
void CefMenuModelImpl::NotifyMenuClosed() {
DCHECK(!auto_notify_menu_closed_);
OnMenuClosed();
}
void CefMenuModelImpl::AppendItem(const Item& item) {
ValidateItem(item);
items_.push_back(item);
......@@ -772,13 +820,34 @@ void CefMenuModelImpl::ValidateItem(const Item& item) {
#endif
}
void CefMenuModelImpl::OnMouseOutsideMenu(const gfx::Point& screen_point) {
if (delegate_)
delegate_->MouseOutsideMenu(this, screen_point);
if (menu_model_delegate_) {
menu_model_delegate_->MouseOutsideMenu(this,
CefPoint(screen_point.x(), screen_point.y()));
}
}
void CefMenuModelImpl::OnUnhandledOpenSubmenu(bool is_rtl) {
if (delegate_)
delegate_->UnhandledOpenSubmenu(this, is_rtl);
if (menu_model_delegate_)
menu_model_delegate_->UnhandledOpenSubmenu(this, is_rtl);
}
void CefMenuModelImpl::OnUnhandledCloseSubmenu(bool is_rtl) {
if (delegate_)
delegate_->UnhandledCloseSubmenu(this, is_rtl);
if (menu_model_delegate_)
menu_model_delegate_->UnhandledCloseSubmenu(this, is_rtl);
}
void CefMenuModelImpl::OnMenuClosed() {
if (delegate_)
delegate_->MenuClosed(this);
if (menu_model_delegate_)
menu_model_delegate_->MenuClosed(this);
for (auto& observer : observers_)
observer.MenuClosed(this);
}
bool CefMenuModelImpl::VerifyContext() {
......
......@@ -12,7 +12,6 @@
#include "include/cef_menu_model.h"
#include "include/cef_menu_model_delegate.h"
#include "base/observer_list.h"
#include "base/threading/platform_thread.h"
#include "ui/base/models/menu_model.h"
......@@ -30,38 +29,41 @@ class CefMenuModelImpl : public CefMenuModel {
int command_id,
cef_event_flags_t event_flags) =0;
// Notifies the delegate that the menu is about to show.
// Called when the user moves the mouse outside the menu and over the owning
// window.
virtual void MouseOutsideMenu(CefRefPtr<CefMenuModelImpl> source,
const gfx::Point& screen_point) {}
// Called on unhandled open/close submenu keyboard commands. |is_rtl| will
// be true if the menu is displaying a right-to-left language.
virtual void UnhandledOpenSubmenu(CefRefPtr<CefMenuModelImpl> source,
bool is_rtl) {}
virtual void UnhandledCloseSubmenu(CefRefPtr<CefMenuModelImpl> source,
bool is_rtl) {}
// Called when the menu is about to show.
virtual void MenuWillShow(CefRefPtr<CefMenuModelImpl> source) =0;
// Notifies the delegate that the menu has closed.
// Called when the menu has closed.
virtual void MenuClosed(CefRefPtr<CefMenuModelImpl> source) =0;
// Allows the delegate to modify a menu item label before it's displayed.
virtual bool FormatLabel(base::string16& label) =0;
virtual bool FormatLabel(CefRefPtr<CefMenuModelImpl> source,
base::string16& label) =0;
protected:
virtual ~Delegate() {}
};
class Observer {
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);
CefRefPtr<CefMenuModelDelegate> menu_model_delegate,
bool is_submenu);
~CefMenuModelImpl() override;
// CefMenuModel methods.
bool IsSubMenu() override;
bool Clear() override;
int GetCount() override;
bool AddSeparator() override;
......@@ -124,6 +126,9 @@ class CefMenuModelImpl : public CefMenuModel {
// Callbacks from the ui::MenuModel implementation.
void ActivatedAt(int index, cef_event_flags_t event_flags);
void MouseOutsideMenu(const gfx::Point& screen_point);
void UnhandledOpenSubmenu(bool is_rtl);
void UnhandledCloseSubmenu(bool is_rtl);
void MenuWillShow();
void MenuWillClose();
base::string16 GetFormattedLabelAt(int index);
......@@ -131,21 +136,20 @@ class CefMenuModelImpl : public CefMenuModel {
// Verify that only a single reference exists to all CefMenuModelImpl objects.
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.
void AddMenuItem(const content::MenuItem& menu_item);
ui::MenuModel* model() { return model_.get(); }
ui::MenuModel* model() const { return model_.get(); }
// Used when created via CefMenuManager.
Delegate* delegate() { return delegate_; }
Delegate* delegate() const { return delegate_; }
void set_delegate(Delegate* delegate) { delegate_ = delegate; }
// Used for menus run via CefWindowImpl::ShowMenu to provide more accurate
// menu close notification.
void set_auto_notify_menu_closed(bool val) { auto_notify_menu_closed_ = val; }
void NotifyMenuClosed();
private:
struct Item;
......@@ -156,7 +160,10 @@ class CefMenuModelImpl : public CefMenuModel {
void InsertItemAt(const Item& item, int index);
void ValidateItem(const Item& item);
// Notify the delegate that the menu is closed.
// Notify the delegate asynchronously.
void OnMouseOutsideMenu(const gfx::Point& screen_point);
void OnUnhandledOpenSubmenu(bool is_rtl);
void OnUnhandledCloseSubmenu(bool is_rtl);
void OnMenuClosed();
// Verify that the object is being accessed from the correct thread.
......@@ -170,11 +177,12 @@ class CefMenuModelImpl : public CefMenuModel {
// Used when created via CefMenuModel::CreateMenuModel().
CefRefPtr<CefMenuModelDelegate> menu_model_delegate_;
const bool is_submenu_;
ItemVector items_;
std::unique_ptr<ui::MenuModel> model_;
// Observers that want to be notified of changes to this object.
base::ObserverList<Observer> observers_;
bool auto_notify_menu_closed_ = true;
IMPLEMENT_REFCOUNTING(CefMenuModelImpl);
DISALLOW_COPY_AND_ASSIGN(CefMenuModelImpl);
......
......@@ -40,10 +40,19 @@ CEF_BUTTON_VIEW_T class CefButtonView : public CEF_VIEW_VIEW_D {
return button;
}
// views::CustomButton methods:
void StateChanged() override;
// views::ButtonListener methods:
void ButtonPressed(views::Button* sender, const ui::Event& event) override;
};
CEF_BUTTON_VIEW_T void CEF_BUTTON_VIEW_D::StateChanged() {
ParentClass::StateChanged();
if (ParentClass::cef_delegate())
ParentClass::cef_delegate()->OnButtonStateChanged(GetCefButton());
}
CEF_BUTTON_VIEW_T void CEF_BUTTON_VIEW_D::ButtonPressed(
views::Button* sender, const ui::Event& event) {
if (ParentClass::cef_delegate())
......
......@@ -50,6 +50,11 @@ void CefMenuButtonImpl::ShowMenu(CefRefPtr<CefMenuModel> menu_model,
}
}
void CefMenuButtonImpl::TriggerMenu() {
CEF_REQUIRE_VALID_RETURN_VOID();
root_view()->Activate(nullptr);
}
CefMenuButtonImpl::CefMenuButtonImpl(CefRefPtr<CefMenuButtonDelegate> delegate)
: ParentClass(delegate) {
DCHECK(delegate);
......
......@@ -32,6 +32,7 @@ class CefMenuButtonImpl :
void ShowMenu(CefRefPtr<CefMenuModel> menu_model,
const CefPoint& screen_point,
cef_menu_anchor_position_t anchor_position) override;
void TriggerMenu() override;
// CefLabelButton methods:
CefRefPtr<CefMenuButton> AsMenuButton() override { return this; }
......
......@@ -390,13 +390,6 @@ void CefWindowImpl::OnWindowViewDeleted() {
Detach();
}
void CefWindowImpl::MenuClosed(CefRefPtr<CefMenuModelImpl> source) {
DCHECK_EQ(menu_model_, source);
menu_model_->RemoveObserver(this);
menu_model_ = nullptr;
menu_runner_.reset(nullptr);
}
// Will only be called if CanHandleAccelerators() returns true.
bool CefWindowImpl::AcceleratorPressed(const ui::Accelerator& accelerator) {
for (const auto& entry : accelerator_map_) {
......@@ -433,12 +426,16 @@ void CefWindowImpl::ShowMenu(views::MenuButton* menu_button,
return;
menu_model_ = menu_model_impl;
menu_model_->AddObserver(this);
// We'll send the MenuClosed notification manually for better accuracy.
menu_model_->set_auto_notify_menu_closed(false);
menu_runner_.reset(
new views::MenuRunner(menu_model_impl->model(),
menu_button ? views::MenuRunner::HAS_MNEMONICS :
views::MenuRunner::CONTEXT_MENU));
views::MenuRunner::ASYNC |
(menu_button ? views::MenuRunner::HAS_MNEMONICS :
views::MenuRunner::CONTEXT_MENU),
base::Bind(&CefWindowImpl::MenuClosed, this)));
views::MenuRunner::RunResult result = menu_runner_->RunMenuAt(
widget_,
......@@ -449,6 +446,12 @@ void CefWindowImpl::ShowMenu(views::MenuButton* menu_button,
ALLOW_UNUSED_LOCAL(result);
}
void CefWindowImpl::MenuClosed() {
menu_model_->NotifyMenuClosed();
menu_model_ = nullptr;
menu_runner_.reset(nullptr);
}
void CefWindowImpl::CancelMenu() {
CEF_REQUIRE_VALID_RETURN_VOID();
if (menu_runner_)
......
......@@ -26,7 +26,6 @@ class MenuButton;
class CefWindowImpl :
public CefPanelImpl<CefWindowView, CefWindow, CefWindowDelegate>,
public CefWindowView::Delegate,
public CefMenuModelImpl::Observer,
public ui::AcceleratorTarget {
public:
typedef CefPanelImpl<CefWindowView, CefWindow, CefWindowDelegate> ParentClass;
......@@ -105,9 +104,6 @@ class CefWindowImpl :
void OnWindowClosing() override;
void OnWindowViewDeleted() override;
// CefMenuModelImpl::Observer methods:
void MenuClosed(CefRefPtr<CefMenuModelImpl> source) override;
// CefViewAdapter methods:
std::string GetDebugType() override { return "Window"; }
void GetDebugInfo(base::DictionaryValue* info,
......@@ -125,6 +121,7 @@ class CefWindowImpl :
CefRefPtr<CefMenuModel> menu_model,
const CefPoint& screen_point,
cef_menu_anchor_position_t anchor_position);
void MenuClosed();
private:
// Create a new implementation object.
......
......@@ -38,6 +38,20 @@ namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK menu_model_is_sub_menu(struct _cef_menu_model_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefMenuModelCppToC::Get(self)->IsSubMenu();
// Return type: bool
return _retval;
}
int CEF_CALLBACK menu_model_clear(struct _cef_menu_model_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING