From 21433c86e0f0acc4faa8194c5a561c80e260024f Mon Sep 17 00:00:00 2001 From: "ben@chromium.org" Date: Tue, 9 Jun 2009 23:58:02 +0000 Subject: Remove Menu2Delegate interface and fold methods onto Menu2Model instead. Enhance SimpleMenuModel::Delegate interface to support additional options required by the above. Make MenuHostWindow process WM_MENUCOMMAND and WM_MENUSELECT - the first so we can determine which index was selected, the second so we can track highlight changes within a menu. Convert Tab's context menu back to the windows native menu. This will make my life easier when I upgrade chrome_menu.cc to the new API if only the bookmarks menus/context menus are using it. BUG=none TEST=page, app menus again, context menu for tabs. open a bunch of tabs, open this page: http://bengoodger.dreamhosters.com/software/chrome/cxmenutest.html, close that tab then right click on the menu quickly. should not crash! Review URL: http://codereview.chromium.org/118426 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17996 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/views/frame/browser_view.cc | 13 +++++-------- chrome/browser/views/frame/browser_view.h | 5 +---- 2 files changed, 6 insertions(+), 12 deletions(-) (limited to 'chrome/browser/views/frame') diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index de8d082..2665610 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -976,13 +976,6 @@ void BrowserView::TabStripEmpty() { /////////////////////////////////////////////////////////////////////////////// // BrowserView, views::SimpleMenuModel::Delegate implementation: -void BrowserView::ExecuteCommand(views::Menu2Model* model, int command_id) { - browser_->ExecuteCommand(command_id); -} - -/////////////////////////////////////////////////////////////////////////////// -// BrowserView, views::SimpleMenuModel::Delegate implementation: - bool BrowserView::IsCommandIdChecked(int command_id) const { // TODO(beng): encoding menu. // No items in our system menu are check-able. @@ -1017,6 +1010,10 @@ std::wstring BrowserView::GetLabelForCommandId(int command_id) const { return l10n_util::GetString(string_id); } +void BrowserView::ExecuteCommand(int command_id) { + browser_->ExecuteCommand(command_id); +} + /////////////////////////////////////////////////////////////////////////////// // BrowserView, views::WindowDelegate implementation: @@ -1386,7 +1383,7 @@ void BrowserView::InitSystemMenu() { else BuildSystemMenuForPopupWindow(); system_menu_.reset( - new views::NativeMenuWin(system_menu_contents_.get(), this, + new views::NativeMenuWin(system_menu_contents_.get(), frame_->GetWindow()->GetNativeWindow())); system_menu_->Rebuild(); } diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h index a2e705c..a6c134b 100644 --- a/chrome/browser/views/frame/browser_view.h +++ b/chrome/browser/views/frame/browser_view.h @@ -57,7 +57,6 @@ class BrowserView : public BrowserWindow, public BrowserWindowTesting, public NotificationObserver, public TabStripModelObserver, - public views::Menu2Delegate, public views::SimpleMenuModel::Delegate, public views::WindowDelegate, public views::ClientView { @@ -257,9 +256,6 @@ class BrowserView : public BrowserWindow, bool user_gesture); virtual void TabStripEmpty(); - // Overridden from views::Menu2Delegate: - virtual void ExecuteCommand(views::Menu2Model* model, int command_id); - // Overridden from views::SimpleMenuModel::Delegate: virtual bool IsCommandIdChecked(int command_id) const; virtual bool IsCommandIdEnabled(int command_id) const; @@ -267,6 +263,7 @@ class BrowserView : public BrowserWindow, views::Accelerator* accelerator); virtual bool IsLabelForCommandIdDynamic(int command_id) const; virtual std::wstring GetLabelForCommandId(int command_id) const; + virtual void ExecuteCommand(int command_id); // Overridden from views::WindowDelegate: virtual bool CanResize() const; -- cgit v1.1