diff options
132 files changed, 249 insertions, 233 deletions
diff --git a/ash/launcher/launcher_alignment_menu.cc b/ash/launcher/launcher_alignment_menu.cc index 4648272..13a92bc 100644 --- a/ash/launcher/launcher_alignment_menu.cc +++ b/ash/launcher/launcher_alignment_menu.cc @@ -53,7 +53,7 @@ bool LauncherAlignmentMenu::GetAcceleratorForCommandId( return false; } -void LauncherAlignmentMenu::ExecuteCommand(int command_id) { +void LauncherAlignmentMenu::ExecuteCommand(int command_id, int event_flags) { switch (static_cast<MenuItem>(command_id)) { case MENU_ALIGN_LEFT: Shell::GetInstance()->SetShelfAlignment(SHELF_ALIGNMENT_LEFT, diff --git a/ash/launcher/launcher_alignment_menu.h b/ash/launcher/launcher_alignment_menu.h index 25311d4..f5e551f 100644 --- a/ash/launcher/launcher_alignment_menu.h +++ b/ash/launcher/launcher_alignment_menu.h @@ -28,7 +28,7 @@ class ASH_EXPORT LauncherAlignmentMenu : public ui::SimpleMenuModel, virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; private: enum MenuItem { diff --git a/ash/launcher/launcher_view.cc b/ash/launcher/launcher_view.cc index 9c91137..b12391f 100644 --- a/ash/launcher/launcher_view.cc +++ b/ash/launcher/launcher_view.cc @@ -211,37 +211,6 @@ class LauncherButtonFocusBorder : public views::FocusBorder { DISALLOW_COPY_AND_ASSIGN(LauncherButtonFocusBorder); }; -// ui::SimpleMenuModel::Delegate implementation that remembers the id of the -// menu that was activated. -class MenuDelegateImpl : public ui::SimpleMenuModel::Delegate { - public: - MenuDelegateImpl() : activated_command_id_(-1) {} - - int activated_command_id() const { return activated_command_id_; } - - // ui::SimpleMenuModel::Delegate overrides: - virtual bool IsCommandIdChecked(int command_id) const OVERRIDE { - return false; - } - virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE { - return true; - } - virtual bool GetAcceleratorForCommandId( - int command_id, - ui::Accelerator* accelerator) OVERRIDE { - return false; - } - virtual void ExecuteCommand(int command_id) OVERRIDE { - activated_command_id_ = command_id; - } - - private: - // ID of the command passed to ExecuteCommand. - int activated_command_id_; - - DISALLOW_COPY_AND_ASSIGN(MenuDelegateImpl); -}; - // AnimationDelegate that deletes a view when done. This is used when a launcher // item is removed, which triggers a remove animation. When the animation is // done we delete the view. diff --git a/ash/shell/context_menu.cc b/ash/shell/context_menu.cc index 04f1dcf..bb70e7c 100644 --- a/ash/shell/context_menu.cc +++ b/ash/shell/context_menu.cc @@ -50,7 +50,7 @@ bool ContextMenu::GetAcceleratorForCommandId( return false; } -void ContextMenu::ExecuteCommand(int command_id) { +void ContextMenu::ExecuteCommand(int command_id, int event_flags) { Shell* shell = Shell::GetInstance(); switch (static_cast<MenuItem>(command_id)) { case MENU_AUTO_HIDE: diff --git a/ash/shell/context_menu.h b/ash/shell/context_menu.h index 618c75b..34d2042 100644 --- a/ash/shell/context_menu.h +++ b/ash/shell/context_menu.h @@ -30,7 +30,7 @@ class ContextMenu : public ui::SimpleMenuModel, virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; private: enum MenuItem { diff --git a/ash/shell/window_type_launcher.cc b/ash/shell/window_type_launcher.cc index 1980bf2..7b710bd 100644 --- a/ash/shell/window_type_launcher.cc +++ b/ash/shell/window_type_launcher.cc @@ -379,7 +379,7 @@ void WindowTypeLauncher::ButtonPressed(views::Button* sender, } #if !defined(OS_MACOSX) -void WindowTypeLauncher::ExecuteCommand(int id) { +void WindowTypeLauncher::ExecuteCommand(int id, int event_flags) { switch (id) { case COMMAND_NEW_WINDOW: InitWindowTypeLauncher(); diff --git a/ash/shell/window_type_launcher.h b/ash/shell/window_type_launcher.h index 881ce88..51376e8 100644 --- a/ash/shell/window_type_launcher.h +++ b/ash/shell/window_type_launcher.h @@ -57,7 +57,7 @@ class WindowTypeLauncher : public views::WidgetDelegateView, #if !defined(OS_MACOSX) // Overridden from views::MenuDelegate: - virtual void ExecuteCommand(int id) OVERRIDE; + virtual void ExecuteCommand(int id, int event_flags) OVERRIDE; // Override from views::ContextMenuController: virtual void ShowContextMenuForView(views::View* source, diff --git a/chrome/browser/background/background_mode_manager.cc b/chrome/browser/background/background_mode_manager.cc index dd6ca23..b70667d0 100644 --- a/chrome/browser/background/background_mode_manager.cc +++ b/chrome/browser/background/background_mode_manager.cc @@ -81,7 +81,9 @@ bool BackgroundModeManager::BackgroundModeData::GetAcceleratorForCommandId( return false; } -void BackgroundModeManager::BackgroundModeData::ExecuteCommand(int item) { +void BackgroundModeManager::BackgroundModeData::ExecuteCommand( + int item, + int event_flags) { switch (item) { case IDC_MinimumLabelValue: // Do nothing. This is just a label. @@ -487,7 +489,7 @@ bool BackgroundModeManager::GetAcceleratorForCommandId( return false; } -void BackgroundModeManager::ExecuteCommand(int command_id) { +void BackgroundModeManager::ExecuteCommand(int command_id, int event_flags) { // When a browser window is necessary, we use the first profile. The windows // opened for these commands are not profile-specific, so any profile would // work and the first is convenient. @@ -517,7 +519,7 @@ void BackgroundModeManager::ExecuteCommand(int command_id) { break; } default: - bmd->ExecuteCommand(command_id); + bmd->ExecuteCommand(command_id, event_flags); break; } } diff --git a/chrome/browser/background/background_mode_manager.h b/chrome/browser/background/background_mode_manager.h index b1f79f8..df95335 100644 --- a/chrome/browser/background/background_mode_manager.h +++ b/chrome/browser/background/background_mode_manager.h @@ -102,7 +102,7 @@ class BackgroundModeManager virtual bool GetAcceleratorForCommandId(int command_id, ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; // Returns a browser window, or creates one if none are open. Used by // operations (like displaying the preferences dialog) that require a @@ -183,7 +183,7 @@ class BackgroundModeManager virtual bool GetAcceleratorForCommandId(int command_id, ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; // Invoked when an extension is installed so we can ensure that // launch-on-startup is enabled if appropriate. |extension| can be NULL when diff --git a/chrome/browser/chromeos/login/language_switch_menu.cc b/chrome/browser/chromeos/login/language_switch_menu.cc index 4b28738..d39130f 100644 --- a/chrome/browser/chromeos/login/language_switch_menu.cc +++ b/chrome/browser/chromeos/login/language_switch_menu.cc @@ -192,7 +192,7 @@ void LanguageSwitchMenu::OnMenuButtonClicked(views::View* source, //////////////////////////////////////////////////////////////////////////////// // views::MenuDelegate implementation. -void LanguageSwitchMenu::ExecuteCommand(int command_id) { +void LanguageSwitchMenu::ExecuteCommand(int command_id, int event_flags) { const std::string locale = language_list_->GetLocaleFromIndex(command_id); // Here, we should enable keyboard layouts associated with the locale so // that users can use those keyboard layouts on the login screen. diff --git a/chrome/browser/chromeos/login/language_switch_menu.h b/chrome/browser/chromeos/login/language_switch_menu.h index c567680..1677359 100644 --- a/chrome/browser/chromeos/login/language_switch_menu.h +++ b/chrome/browser/chromeos/login/language_switch_menu.h @@ -56,7 +56,7 @@ class LanguageSwitchMenu : public views::MenuButtonListener, const gfx::Point& point) OVERRIDE; // Overridden from views::MenuDelegate: - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; // The menu. views::MenuItemView* menu_; diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc index 5246417..8b6c90d 100644 --- a/chrome/browser/download/download_browsertest.cc +++ b/chrome/browser/download/download_browsertest.cc @@ -1975,7 +1975,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, SavePageNonHTMLViaGet) { browser()->tab_strip_model()->GetActiveWebContents(), context_menu_params); menu.Init(); - menu.ExecuteCommand(IDC_CONTENT_CONTEXT_SAVEIMAGEAS); + menu.ExecuteCommand(IDC_CONTENT_CONTEXT_SAVEIMAGEAS, 0); waiter_context_menu->WaitForFinished(); EXPECT_EQ( 1u, waiter_context_menu->NumDownloadsSeenInState(DownloadItem::COMPLETE)); @@ -2054,7 +2054,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, SavePageNonHTMLViaPost) { context_menu_params.page_url = jpeg_url; TestRenderViewContextMenu menu(web_contents, context_menu_params); menu.Init(); - menu.ExecuteCommand(IDC_CONTENT_CONTEXT_SAVEIMAGEAS); + menu.ExecuteCommand(IDC_CONTENT_CONTEXT_SAVEIMAGEAS, 0); waiter_context_menu->WaitForFinished(); EXPECT_EQ( 1u, waiter_context_menu->NumDownloadsSeenInState(DownloadItem::COMPLETE)); diff --git a/chrome/browser/download/download_shelf_context_menu.cc b/chrome/browser/download/download_shelf_context_menu.cc index dc420af..6147a4f 100644 --- a/chrome/browser/download/download_shelf_context_menu.cc +++ b/chrome/browser/download/download_shelf_context_menu.cc @@ -101,7 +101,7 @@ bool DownloadShelfContextMenu::IsCommandIdChecked(int command_id) const { return false; } -void DownloadShelfContextMenu::ExecuteCommand(int command_id) { +void DownloadShelfContextMenu::ExecuteCommand(int command_id, int event_flags) { if (!download_item_) return; diff --git a/chrome/browser/download/download_shelf_context_menu.h b/chrome/browser/download/download_shelf_context_menu.h index a4a8cb7..13902b0 100644 --- a/chrome/browser/download/download_shelf_context_menu.h +++ b/chrome/browser/download/download_shelf_context_menu.h @@ -51,7 +51,7 @@ class DownloadShelfContextMenu : public ui::SimpleMenuModel::Delegate, // ui::SimpleMenuModel::Delegate: virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE; diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc index 9bf0839..42a1e92 100644 --- a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc +++ b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc @@ -507,7 +507,7 @@ IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, UserAction) { TestRenderViewContextMenu menu(tab, params); menu.Init(); - menu.ExecuteCommand(IDC_CONTENT_CONTEXT_OPENLINKNEWTAB); + menu.ExecuteCommand(IDC_CONTENT_CONTEXT_OPENLINKNEWTAB, 0); ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); } diff --git a/chrome/browser/extensions/extension_context_menu_browsertest.cc b/chrome/browser/extensions/extension_context_menu_browsertest.cc index 8f6fefe..90c2e67 100644 --- a/chrome/browser/extensions/extension_context_menu_browsertest.cc +++ b/chrome/browser/extensions/extension_context_menu_browsertest.cc @@ -265,7 +265,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionContextMenuBrowserTest, Simple) { // Look for the extension item in the menu, and execute it. int command_id = IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST; ASSERT_TRUE(menu->IsCommandIdEnabled(command_id)); - menu->ExecuteCommand(command_id); + menu->ExecuteCommand(command_id, 0); // Wait for the extension's script to tell us its onclick fired. ASSERT_TRUE(listener2.WaitUntilSatisfied()); @@ -485,7 +485,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionContextMenuBrowserTest, MAYBE_IncognitoSplit) { // Look for the extension item in the menu, and execute it. int command_id = IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST; ASSERT_TRUE(menu->IsCommandIdEnabled(command_id)); - menu->ExecuteCommand(command_id); + menu->ExecuteCommand(command_id, 0); // Wait for the extension's script to tell us its onclick fired. Ensure // that the incognito version doesn't fire until we explicitly click the @@ -494,7 +494,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionContextMenuBrowserTest, MAYBE_IncognitoSplit) { EXPECT_FALSE(onclick_incognito.was_satisfied()); ASSERT_TRUE(menu_incognito->IsCommandIdEnabled(command_id)); - menu_incognito->ExecuteCommand(command_id); + menu_incognito->ExecuteCommand(command_id, 0); ASSERT_TRUE(onclick_incognito.WaitUntilSatisfied()); } @@ -562,7 +562,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionContextMenuBrowserLazyTest, EventPage) { // Executing the checkbox also fires the onClicked event. ExtensionTestMessageListener listener("onClicked fired for checkbox1", false); - menu->ExecuteCommand(command_id); + menu->ExecuteCommand(command_id, 0); checkbox_checked.WaitUntilClosed(); EXPECT_TRUE(menu->IsCommandIdChecked(command_id)); diff --git a/chrome/browser/extensions/extension_context_menu_model.cc b/chrome/browser/extensions/extension_context_menu_model.cc index 68f444a..8df4f0e 100644 --- a/chrome/browser/extensions/extension_context_menu_model.cc +++ b/chrome/browser/extensions/extension_context_menu_model.cc @@ -97,7 +97,8 @@ bool ExtensionContextMenuModel::GetAcceleratorForCommandId( return false; } -void ExtensionContextMenuModel::ExecuteCommand(int command_id) { +void ExtensionContextMenuModel::ExecuteCommand(int command_id, + int event_flags) { const Extension* extension = GetExtension(); if (!extension) return; diff --git a/chrome/browser/extensions/extension_context_menu_model.h b/chrome/browser/extensions/extension_context_menu_model.h index a082f72..629dd55 100644 --- a/chrome/browser/extensions/extension_context_menu_model.h +++ b/chrome/browser/extensions/extension_context_menu_model.h @@ -65,7 +65,7 @@ class ExtensionContextMenuModel virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; // ExtensionUninstallDialog::Delegate: virtual void ExtensionUninstallAccepted() OVERRIDE; diff --git a/chrome/browser/extensions/platform_app_browsertest.cc b/chrome/browser/extensions/platform_app_browsertest.cc index 4cfeeb1..7bc4a77 100644 --- a/chrome/browser/extensions/platform_app_browsertest.cc +++ b/chrome/browser/extensions/platform_app_browsertest.cc @@ -280,7 +280,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenuClicked) { // Execute the menu item ExtensionTestMessageListener onclicked_listener("onClicked fired for id1", false); - menu->ExecuteCommand(IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST); + menu->ExecuteCommand(IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST, 0); ASSERT_TRUE(onclicked_listener.WaitUntilSatisfied()); } diff --git a/chrome/browser/media/media_stream_capture_indicator.cc b/chrome/browser/media/media_stream_capture_indicator.cc index ac7a5ff..b9316c5 100644 --- a/chrome/browser/media/media_stream_capture_indicator.cc +++ b/chrome/browser/media/media_stream_capture_indicator.cc @@ -215,7 +215,8 @@ bool MediaStreamCaptureIndicator::GetAcceleratorForCommandId( return false; } -void MediaStreamCaptureIndicator::ExecuteCommand(int command_id) { +void MediaStreamCaptureIndicator::ExecuteCommand(int command_id, + int event_flags) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); const int index = diff --git a/chrome/browser/media/media_stream_capture_indicator.h b/chrome/browser/media/media_stream_capture_indicator.h index a36faf7..fa48231 100644 --- a/chrome/browser/media/media_stream_capture_indicator.h +++ b/chrome/browser/media/media_stream_capture_indicator.h @@ -39,7 +39,7 @@ class MediaStreamCaptureIndicator virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; // Called on IO thread when MediaStream opens new capture devices. void CaptureDevicesOpened(int render_process_id, diff --git a/chrome/browser/notifications/notification_options_menu_model.cc b/chrome/browser/notifications/notification_options_menu_model.cc index 3949025..bd5651f 100644 --- a/chrome/browser/notifications/notification_options_menu_model.cc +++ b/chrome/browser/notifications/notification_options_menu_model.cc @@ -107,7 +107,7 @@ bool CornerSelectionMenuModel::GetAcceleratorForCommandId( return false; } -void CornerSelectionMenuModel::ExecuteCommand(int command_id) { +void CornerSelectionMenuModel::ExecuteCommand(int command_id, int event_flags) { // TODO(dimich): MessageCenter does not use this preference (yet?) if (NotificationUIManager::DelegatesToMessageCenter()) return; @@ -235,7 +235,8 @@ bool NotificationOptionsMenuModel::GetAcceleratorForCommandId( return false; } -void NotificationOptionsMenuModel::ExecuteCommand(int command_id) { +void NotificationOptionsMenuModel::ExecuteCommand(int command_id, + int event_flags) { DesktopNotificationService* service = DesktopNotificationServiceFactory::GetForProfile(balloon_->profile()); ExtensionService* extension_service = diff --git a/chrome/browser/notifications/notification_options_menu_model.h b/chrome/browser/notifications/notification_options_menu_model.h index 2ec2b54..769084b 100644 --- a/chrome/browser/notifications/notification_options_menu_model.h +++ b/chrome/browser/notifications/notification_options_menu_model.h @@ -25,7 +25,7 @@ class CornerSelectionMenuModel : public ui::SimpleMenuModel, virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; private: // Not owned. @@ -51,7 +51,7 @@ class NotificationOptionsMenuModel : public ui::SimpleMenuModel, virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; private: Balloon* balloon_; // Not owned. diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc index 8cb23b5..0ff2463 100644 --- a/chrome/browser/tab_contents/render_view_context_menu.cc +++ b/chrome/browser/tab_contents/render_view_context_menu.cc @@ -1323,10 +1323,6 @@ bool RenderViewContextMenu::IsCommandIdChecked(int id) const { return false; } -void RenderViewContextMenu::ExecuteCommand(int id) { - ExecuteCommand(id, 0); -} - void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) { // If this command is is added by one of our observers, we dispatch it to the // observer. diff --git a/chrome/browser/tab_contents/render_view_context_menu.h b/chrome/browser/tab_contents/render_view_context_menu.h index d93b6ed..cd02133 100644 --- a/chrome/browser/tab_contents/render_view_context_menu.h +++ b/chrome/browser/tab_contents/render_view_context_menu.h @@ -147,7 +147,6 @@ class RenderViewContextMenu : public ui::SimpleMenuModel::Delegate, // SimpleMenuModel::Delegate implementation. virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; virtual void MenuWillShow(ui::SimpleMenuModel* source) OVERRIDE; virtual void MenuClosed(ui::SimpleMenuModel* source) OVERRIDE; diff --git a/chrome/browser/tab_contents/render_view_context_menu_browsertest.cc b/chrome/browser/tab_contents/render_view_context_menu_browsertest.cc index a3db8e8..bd1ce78 100644 --- a/chrome/browser/tab_contents/render_view_context_menu_browsertest.cc +++ b/chrome/browser/tab_contents/render_view_context_menu_browsertest.cc @@ -140,7 +140,7 @@ IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, CopyLinkFromIncognito) { browser_incognito->tab_strip_model()->GetActiveWebContents(), context_menu_params); menu.Init(); - menu.ExecuteCommand(IDC_CONTENT_CONTEXT_COPYLINKLOCATION); + menu.ExecuteCommand(IDC_CONTENT_CONTEXT_COPYLINKLOCATION, 0); // Check the clipboard. string16 content; diff --git a/chrome/browser/tab_contents/render_view_context_menu_browsertest_util.cc b/chrome/browser/tab_contents/render_view_context_menu_browsertest_util.cc index b86fbe4..8a7d371 100644 --- a/chrome/browser/tab_contents/render_view_context_menu_browsertest_util.cc +++ b/chrome/browser/tab_contents/render_view_context_menu_browsertest_util.cc @@ -43,6 +43,6 @@ void ContextMenuNotificationObserver::Observe( void ContextMenuNotificationObserver::ExecuteCommand( RenderViewContextMenu* context_menu) { - context_menu->ExecuteCommand(command_to_execute_); + context_menu->ExecuteCommand(command_to_execute_, 0); context_menu->Cancel(); } diff --git a/chrome/browser/tab_contents/spellchecker_submenu_observer_browsertest.cc b/chrome/browser/tab_contents/spellchecker_submenu_observer_browsertest.cc index 3a05449..e4c0437 100644 --- a/chrome/browser/tab_contents/spellchecker_submenu_observer_browsertest.cc +++ b/chrome/browser/tab_contents/spellchecker_submenu_observer_browsertest.cc @@ -48,10 +48,9 @@ class MockRenderViewContextMenu : public ui::SimpleMenuModel::Delegate, virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE { return observer_->IsCommandIdEnabled(command_id); } - virtual void ExecuteCommand(int command_id) OVERRIDE { + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE { observer_->ExecuteCommand(command_id); } - virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE {} virtual void MenuWillShow(ui::SimpleMenuModel* source) OVERRIDE {} virtual void MenuClosed(ui::SimpleMenuModel* source) OVERRIDE {} virtual bool GetAcceleratorForCommandId( @@ -149,7 +148,7 @@ IN_PROC_BROWSER_TEST_F(SpellCheckerSubMenuObserverTest, ToggleSpelling) { // Select this item and verify that the "Check Spelling While Typing" item is // not checked. Also, verify that the value of "browser.enable_spellchecking" // is now false. - menu->ExecuteCommand(IDC_CHECK_SPELLING_WHILE_TYPING); + menu->ExecuteCommand(IDC_CHECK_SPELLING_WHILE_TYPING, 0); EXPECT_FALSE( menu->GetPrefs()->GetBoolean(prefs::kEnableContinuousSpellcheck)); EXPECT_FALSE(menu->IsCommandIdChecked(IDC_CHECK_SPELLING_WHILE_TYPING)); diff --git a/chrome/browser/translate/options_menu_model.cc b/chrome/browser/translate/options_menu_model.cc index a289364..0c0da2e 100644 --- a/chrome/browser/translate/options_menu_model.cc +++ b/chrome/browser/translate/options_menu_model.cc @@ -96,7 +96,7 @@ bool OptionsMenuModel::GetAcceleratorForCommandId( return false; } -void OptionsMenuModel::ExecuteCommand(int command_id) { +void OptionsMenuModel::ExecuteCommand(int command_id, int event_flags) { switch (command_id) { case IDC_TRANSLATE_OPTIONS_NEVER_TRANSLATE_LANG: UMA_HISTOGRAM_COUNTS("Translate.NeverTranslateLang", 1); diff --git a/chrome/browser/translate/options_menu_model.h b/chrome/browser/translate/options_menu_model.h index 32d03cb..f178ca1 100644 --- a/chrome/browser/translate/options_menu_model.h +++ b/chrome/browser/translate/options_menu_model.h @@ -23,7 +23,7 @@ class OptionsMenuModel : public ui::SimpleMenuModel, virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; private: TranslateInfoBarDelegate* translate_infobar_delegate_; diff --git a/chrome/browser/translate/translate_manager_browsertest.cc b/chrome/browser/translate/translate_manager_browsertest.cc index 7565ff9..0fc464f 100644 --- a/chrome/browser/translate/translate_manager_browsertest.cc +++ b/chrome/browser/translate/translate_manager_browsertest.cc @@ -482,7 +482,7 @@ TEST_F(TranslateManagerTest, TranslateUnknownLanguage) { scoped_ptr<TestRenderViewContextMenu> menu( TestRenderViewContextMenu::CreateContextMenu(web_contents())); menu->Init(); - menu->ExecuteCommand(IDC_CONTENT_CONTEXT_TRANSLATE); + menu->ExecuteCommand(IDC_CONTENT_CONTEXT_TRANSLATE, 0); // To test that bug #49018 if fixed, make sure we deal correctly with errors. // Simulate a failure to fetch the translate script. @@ -514,7 +514,7 @@ TEST_F(TranslateManagerTest, TranslateUnknownLanguage) { SimulateNavigation(GURL("http://www.google.com"), "und", true); menu.reset(TestRenderViewContextMenu::CreateContextMenu(web_contents())); menu->Init(); - menu->ExecuteCommand(IDC_CONTENT_CONTEXT_TRANSLATE); + menu->ExecuteCommand(IDC_CONTENT_CONTEXT_TRANSLATE, 0); RenderViewHostTester::TestOnMessageReceived( rvh(), ChromeViewHostMsg_PageTranslated( @@ -530,7 +530,7 @@ TEST_F(TranslateManagerTest, TranslateUnknownLanguage) { SimulateNavigation(GURL("http://www.google.com"), "und", true); menu.reset(TestRenderViewContextMenu::CreateContextMenu(web_contents())); menu->Init(); - menu->ExecuteCommand(IDC_CONTENT_CONTEXT_TRANSLATE); + menu->ExecuteCommand(IDC_CONTENT_CONTEXT_TRANSLATE, 0); RenderViewHostTester::TestOnMessageReceived( rvh(), ChromeViewHostMsg_PageTranslated( @@ -1233,7 +1233,7 @@ TEST_F(TranslateManagerTest, ContextMenu) { EXPECT_TRUE(menu->IsCommandIdEnabled(IDC_CONTENT_CONTEXT_TRANSLATE)); // Use the menu to translate the page. - menu->ExecuteCommand(IDC_CONTENT_CONTEXT_TRANSLATE); + menu->ExecuteCommand(IDC_CONTENT_CONTEXT_TRANSLATE, 0); // That should have triggered a translation. // The "translating..." infobar should be showing. @@ -1277,7 +1277,7 @@ TEST_F(TranslateManagerTest, ContextMenu) { menu.reset(TestRenderViewContextMenu::CreateContextMenu(web_contents())); menu->Init(); EXPECT_TRUE(menu->IsCommandIdEnabled(IDC_CONTENT_CONTEXT_TRANSLATE)); - menu->ExecuteCommand(IDC_CONTENT_CONTEXT_TRANSLATE); + menu->ExecuteCommand(IDC_CONTENT_CONTEXT_TRANSLATE, 0); // No message expected since the translation should have been ignored. EXPECT_FALSE(GetTranslateMessage(&page_id, &original_lang, &target_lang)); @@ -1296,7 +1296,7 @@ TEST_F(TranslateManagerTest, ContextMenu) { rvh(), ChromeViewHostMsg_PageTranslated( 0, 0, "de", "en", TranslateErrors::NONE)); - menu->ExecuteCommand(IDC_CONTENT_CONTEXT_TRANSLATE); + menu->ExecuteCommand(IDC_CONTENT_CONTEXT_TRANSLATE, 0); // No message expected since the translation should have been ignored. EXPECT_FALSE(GetTranslateMessage(&page_id, &original_lang, &target_lang)); diff --git a/chrome/browser/ui/app_list/extension_app_item.cc b/chrome/browser/ui/app_list/extension_app_item.cc index 29e46cd..d9269ba 100644 --- a/chrome/browser/ui/app_list/extension_app_item.cc +++ b/chrome/browser/ui/app_list/extension_app_item.cc @@ -474,7 +474,7 @@ bool ExtensionAppItem::GetAcceleratorForCommandId( return false; } -void ExtensionAppItem::ExecuteCommand(int command_id) { +void ExtensionAppItem::ExecuteCommand(int command_id, int event_flags) { if (command_id == LAUNCH_NEW) { Launch(ui::EF_NONE); } else if (command_id == TOGGLE_PIN && controller_->CanPin()) { diff --git a/chrome/browser/ui/app_list/extension_app_item.h b/chrome/browser/ui/app_list/extension_app_item.h index ca16da7..3dcddff 100644 --- a/chrome/browser/ui/app_list/extension_app_item.h +++ b/chrome/browser/ui/app_list/extension_app_item.h @@ -93,7 +93,7 @@ class ExtensionAppItem : public ChromeAppListItem, virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* acclelrator) OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; // Overridden from ChromeAppListItem: virtual void Activate(int event_flags) OVERRIDE; diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.cc index 1c38584..a337320 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.cc @@ -24,5 +24,5 @@ bool ChromeLauncherAppMenuItem::IsEnabled() const { return false; } -void ChromeLauncherAppMenuItem::Execute() { +void ChromeLauncherAppMenuItem::Execute(int event_flags) { } diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h b/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h index fd13799..a1231c2 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h @@ -35,7 +35,9 @@ class ChromeLauncherAppMenuItem { virtual bool IsEnabled() const; // Executes the option. - virtual void Execute(); + // |event_flags| are the flags from the event which issued this command. + // It can be used to check additional keyboard modifiers. + virtual void Execute(int event_flags); private: const string16 title_; diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_browser.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_browser.cc index 3203bbf..9569b69 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_browser.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_browser.cc @@ -9,6 +9,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_window.h" +#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/chrome_notification_types.h" #include "content/public/browser/notification_service.h" @@ -32,10 +33,15 @@ bool ChromeLauncherAppMenuItemBrowser::IsEnabled() const { return true; } -void ChromeLauncherAppMenuItemBrowser::Execute() { +void ChromeLauncherAppMenuItemBrowser::Execute(int event_flags) { if (browser_) { - browser_->window()->Show(); - ash::wm::ActivateWindow(browser_->window()->GetNativeWindow()); + if (event_flags & (ui::EF_SHIFT_DOWN | ui::EF_MIDDLE_MOUSE_BUTTON)) { + TabStripModel* tab_strip = browser_->tab_strip_model(); + tab_strip->CloseAllTabs(); + } else { + browser_->window()->Show(); + ash::wm::ActivateWindow(browser_->window()->GetNativeWindow()); + } } } diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_browser.h b/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_browser.h index 0427a73..0e330ec 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_browser.h +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_browser.h @@ -24,7 +24,7 @@ class ChromeLauncherAppMenuItemBrowser : public content::NotificationObserver, bool has_leading_separator); virtual bool IsActive() const OVERRIDE; virtual bool IsEnabled() const OVERRIDE; - virtual void Execute() OVERRIDE; + virtual void Execute(int event_flags) OVERRIDE; private: // content::NotificationObserver. diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_tab.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_tab.cc index a0b45d3..1aaf17d 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_tab.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_tab.cc @@ -31,7 +31,7 @@ bool ChromeLauncherAppMenuItemTab::IsEnabled() const { return true; } -void ChromeLauncherAppMenuItemTab::Execute() { +void ChromeLauncherAppMenuItemTab::Execute(int event_flags) { if (!web_contents()) return; Browser* browser = chrome::FindBrowserWithWebContents(web_contents()); @@ -39,10 +39,14 @@ void ChromeLauncherAppMenuItemTab::Execute() { return; TabStripModel* tab_strip = browser->tab_strip_model(); int index = tab_strip->GetIndexOfWebContents(web_contents()); - DCHECK(index != TabStripModel::kNoTab); - tab_strip->ActivateTabAt(index, false); - browser->window()->Show(); - // Need this check to prevent unit tests from crashing. - if (browser->window()->GetNativeWindow()) - ash::wm::ActivateWindow(browser->window()->GetNativeWindow()); + DCHECK_NE(index, TabStripModel::kNoTab); + if (event_flags & (ui::EF_SHIFT_DOWN | ui::EF_MIDDLE_MOUSE_BUTTON)) { + tab_strip->CloseWebContentsAt(index, TabStripModel::CLOSE_USER_GESTURE); + } else { + tab_strip->ActivateTabAt(index, false); + browser->window()->Show(); + // Need this check to prevent unit tests from crashing. + if (browser->window()->GetNativeWindow()) + ash::wm::ActivateWindow(browser->window()->GetNativeWindow()); + } } diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_tab.h b/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_tab.h index 253aaa8..aa09bb2 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_tab.h +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_tab.h @@ -28,7 +28,7 @@ class ChromeLauncherAppMenuItemTab bool has_leading_separator); virtual bool IsActive() const OVERRIDE; virtual bool IsEnabled() const OVERRIDE; - virtual void Execute() OVERRIDE; + virtual void Execute(int event_flags) OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(ChromeLauncherAppMenuItemTab); diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_v2app.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_v2app.cc index aaa5442..d85c90b 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_v2app.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_v2app.cc @@ -23,7 +23,10 @@ bool ChromeLauncherAppMenuItemV2App::IsEnabled() const { return true; } -void ChromeLauncherAppMenuItemV2App::Execute() { +void ChromeLauncherAppMenuItemV2App::Execute(int event_flags) { + // Note: At this time there is only a single app running at any point. as + // such we will never come here with usable |event_flags|. If that ever + // changes we should add some special close code here. // Note: If the application item did go away since the menu was created, // The controller will take care of it. launcher_controller_->ActivateShellApp(app_id_, app_index_); diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_v2app.h b/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_v2app.h index 9234921..391ae26 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_v2app.h +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_v2app.h @@ -28,7 +28,7 @@ class ChromeLauncherAppMenuItemV2App : public ChromeLauncherAppMenuItem { int app_index, bool has_leading_separator); virtual bool IsEnabled() const OVERRIDE; - virtual void Execute() OVERRIDE; + virtual void Execute(int event_flags) OVERRIDE; private: // The owning class which can be used to validate the controller. diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_unittest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_unittest.cc index f59ee80..246bdf9 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_unittest.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_unittest.cc @@ -678,3 +678,47 @@ TEST_F(ChromeLauncherControllerPerAppTest, V1AppMenuExecution) { // Now the active tab should be the second item. EXPECT_EQ(0, browser()->tab_strip_model()->active_index()); } + +// Checks that the generated menu list properly deletes items. +TEST_F(ChromeLauncherControllerPerAppTest, V1AppMenuDeletionExecution) { + chrome::NewTab(browser()); + BrowserList::SetLastActive(browser()); + + ChromeLauncherControllerPerApp launcher_controller(profile(), &model_); + launcher_controller.Init(); + + // Add |extension3_| to the launcher and add two items. + GURL gmail = GURL("https://mail.google.com/mail/u"); + ash::LauncherID gmail_id = model_.next_id(); + extension_service_->AddExtension(extension3_.get()); + launcher_controller.SetRefocusURLPatternForTest(gmail_id, GURL(gmail_url)); + string16 title1 = ASCIIToUTF16("Test1"); + NavigateAndCommitActiveTabWithTitle(browser(), GURL(gmail_url), title1); + chrome::NewTab(browser()); + string16 title2 = ASCIIToUTF16("Test2"); + NavigateAndCommitActiveTabWithTitle(browser(), GURL(gmail_url), title2); + + // Check that the menu is properly set. + ash::LauncherItem item_gmail; + item_gmail.type = ash::TYPE_APP_SHORTCUT; + item_gmail.id = gmail_id; + string16 two_menu_items[] = {title1, title2}; + CheckMenuCreation(&launcher_controller, item_gmail, 2, two_menu_items, false); + + int tabs = browser()->tab_strip_model()->count(); + // Activate the proper tab through the menu item. + { + ChromeLauncherAppMenuItems items = + launcher_controller.GetApplicationList(item_gmail); + items[1]->Execute(0); + EXPECT_EQ(tabs, browser()->tab_strip_model()->count()); + } + + // Delete one tab through the menu item. + { + ChromeLauncherAppMenuItems items = + launcher_controller.GetApplicationList(item_gmail); + items[1]->Execute(ui::EF_SHIFT_DOWN); + EXPECT_EQ(--tabs, browser()->tab_strip_model()->count()); + } +} diff --git a/chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.cc b/chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.cc index 81c7519..280d14d 100644 --- a/chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.cc +++ b/chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.cc @@ -39,9 +39,10 @@ bool LauncherApplicationMenuItemModel::GetAcceleratorForCommandId( return false; } -void LauncherApplicationMenuItemModel::ExecuteCommand(int command_id) { +void LauncherApplicationMenuItemModel::ExecuteCommand(int command_id, + int event_flags) { DCHECK(command_id < static_cast<int>(launcher_items_.size())); - launcher_items_[command_id]->Execute(); + launcher_items_[command_id]->Execute(event_flags); } void LauncherApplicationMenuItemModel::Build() { diff --git a/chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h b/chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h index 853e4da..48816f4 100644 --- a/chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h +++ b/chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h @@ -27,7 +27,7 @@ class LauncherApplicationMenuItemModel : public ash::LauncherMenuModel, virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; private: void Build(); diff --git a/chrome/browser/ui/ash/launcher/launcher_context_menu.cc b/chrome/browser/ui/ash/launcher/launcher_context_menu.cc index 5bb7ebd..beac9f0 100644 --- a/chrome/browser/ui/ash/launcher/launcher_context_menu.cc +++ b/chrome/browser/ui/ash/launcher/launcher_context_menu.cc @@ -232,7 +232,7 @@ bool LauncherContextMenu::GetAcceleratorForCommandId( return false; } -void LauncherContextMenu::ExecuteCommand(int command_id) { +void LauncherContextMenu::ExecuteCommand(int command_id, int event_flags) { switch (static_cast<MenuItem>(command_id)) { case MENU_OPEN_NEW: controller_->Launch(item_.id, ui::EF_NONE); diff --git a/chrome/browser/ui/ash/launcher/launcher_context_menu.h b/chrome/browser/ui/ash/launcher/launcher_context_menu.h index 95bdaaf..def41bb 100644 --- a/chrome/browser/ui/ash/launcher/launcher_context_menu.h +++ b/chrome/browser/ui/ash/launcher/launcher_context_menu.h @@ -49,7 +49,7 @@ class LauncherContextMenu : public ui::SimpleMenuModel, virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; private: FRIEND_TEST_ALL_PREFIXES( diff --git a/chrome/browser/ui/autofill/autofill_dialog_models.cc b/chrome/browser/ui/autofill/autofill_dialog_models.cc index 740a2b1..c64147b 100644 --- a/chrome/browser/ui/autofill/autofill_dialog_models.cc +++ b/chrome/browser/ui/autofill/autofill_dialog_models.cc @@ -76,7 +76,7 @@ bool SuggestionsMenuModel::GetAcceleratorForCommandId( return false; } -void SuggestionsMenuModel::ExecuteCommand(int command_id) { +void SuggestionsMenuModel::ExecuteCommand(int command_id, int event_flags) { checked_item_ = command_id; delegate_->SuggestionItemSelected(*this); } @@ -131,7 +131,7 @@ bool AccountChooserModel::GetAcceleratorForCommandId( return false; } -void AccountChooserModel::ExecuteCommand(int command_id) { +void AccountChooserModel::ExecuteCommand(int command_id, int event_flags) { if (checked_item_ == command_id) return; diff --git a/chrome/browser/ui/autofill/autofill_dialog_models.h b/chrome/browser/ui/autofill/autofill_dialog_models.h index dab54b1..c04c888 100644 --- a/chrome/browser/ui/autofill/autofill_dialog_models.h +++ b/chrome/browser/ui/autofill/autofill_dialog_models.h @@ -65,7 +65,7 @@ class SuggestionsMenuModel : public ui::SimpleMenuModel, virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; private: // The items this model represents, in presentation order. The first @@ -107,7 +107,7 @@ class AccountChooserModel : public ui::SimpleMenuModel, virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; // Should be called when the Wallet server returns an error. void SetHadWalletError(); diff --git a/chrome/browser/ui/autofill/autofill_dialog_models_unittest.cc b/chrome/browser/ui/autofill/autofill_dialog_models_unittest.cc index 9cd4b10..8a4ea41 100644 --- a/chrome/browser/ui/autofill/autofill_dialog_models_unittest.cc +++ b/chrome/browser/ui/autofill/autofill_dialog_models_unittest.cc @@ -69,10 +69,10 @@ TEST_F(AccountChooserModelTest, RespectsUserChoice) { prefs::kAutofillDialogPayWithoutWallet, false); EXPECT_TRUE(model()->WalletIsSelected()); - model()->ExecuteCommand(1); + model()->ExecuteCommand(1, 0); EXPECT_FALSE(model()->WalletIsSelected()); - model()->ExecuteCommand(0); + model()->ExecuteCommand(0, 0); EXPECT_TRUE(model()->WalletIsSelected()); } diff --git a/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc b/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc index 5483e2f..23a2dbe 100644 --- a/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc +++ b/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc @@ -109,7 +109,7 @@ void BookmarkContextMenuController::AddCheckboxItem(int id, menu_model_->AddCheckItemWithStringId(id, localization_id); } -void BookmarkContextMenuController::ExecuteCommand(int id) { +void BookmarkContextMenuController::ExecuteCommand(int id, int event_flags) { if (delegate_) delegate_->WillExecuteCommand(); diff --git a/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.h b/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.h index 31644fc..17b2c5e 100644 --- a/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.h +++ b/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.h @@ -67,7 +67,7 @@ class BookmarkContextMenuController : public BaseBookmarkModelObserver, virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; private: // Adds a IDC_* style command to the menu with a localized string. diff --git a/chrome/browser/ui/bookmarks/bookmark_context_menu_controller_unittest.cc b/chrome/browser/ui/bookmarks/bookmark_context_menu_controller_unittest.cc index 4eb40af..110b67d 100644 --- a/chrome/browser/ui/bookmarks/bookmark_context_menu_controller_unittest.cc +++ b/chrome/browser/ui/bookmarks/bookmark_context_menu_controller_unittest.cc @@ -104,7 +104,7 @@ TEST_F(BookmarkContextMenuControllerTest, DeleteURL) { GURL url = model_->bookmark_bar_node()->GetChild(0)->url(); ASSERT_TRUE(controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_REMOVE)); // Delete the URL. - controller.ExecuteCommand(IDC_BOOKMARK_BAR_REMOVE); + controller.ExecuteCommand(IDC_BOOKMARK_BAR_REMOVE, 0); // Model shouldn't have URL anymore. ASSERT_FALSE(model_->IsBookmarked(url)); } @@ -304,12 +304,12 @@ TEST_F(BookmarkContextMenuControllerTest, CutCopyPasteNode) { EXPECT_TRUE(controller->IsCommandIdEnabled(IDC_CUT)); // Copy the URL. - controller->ExecuteCommand(IDC_COPY); + controller->ExecuteCommand(IDC_COPY, 0); controller.reset(new BookmarkContextMenuController( NULL, NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes)); int old_count = bb_node->child_count(); - controller->ExecuteCommand(IDC_PASTE); + controller->ExecuteCommand(IDC_PASTE, 0); ASSERT_TRUE(bb_node->GetChild(1)->is_url()); ASSERT_EQ(old_count + 1, bb_node->child_count()); @@ -318,7 +318,7 @@ TEST_F(BookmarkContextMenuControllerTest, CutCopyPasteNode) { controller.reset(new BookmarkContextMenuController( NULL, NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes)); // Cut the URL. - controller->ExecuteCommand(IDC_CUT); + controller->ExecuteCommand(IDC_CUT, 0); ASSERT_TRUE(bb_node->GetChild(0)->is_url()); ASSERT_TRUE(bb_node->GetChild(1)->is_folder()); ASSERT_EQ(old_count, bb_node->child_count()); diff --git a/chrome/browser/ui/cocoa/download/download_item_controller.mm b/chrome/browser/ui/cocoa/download/download_item_controller.mm index 5bdd12e..2553d4c 100644 --- a/chrome/browser/ui/cocoa/download/download_item_controller.mm +++ b/chrome/browser/ui/cocoa/download/download_item_controller.mm @@ -231,7 +231,7 @@ class DownloadShelfContextMenuMac : public DownloadShelfContextMenu { NSEvent* event = [NSApp currentEvent]; if ([event modifierFlags] & NSCommandKeyMask) { // Let cmd-click show the file in Finder, like e.g. in Safari and Spotlight. - menuBridge_->ExecuteCommand(DownloadShelfContextMenuMac::SHOW_IN_FOLDER); + menuBridge_->ExecuteCommand(DownloadShelfContextMenuMac::SHOW_IN_FOLDER, 0); } else { DownloadItem* download = bridge_->download_model()->download(); download->OpenDownload(); @@ -352,20 +352,20 @@ class DownloadShelfContextMenuMac : public DownloadShelfContextMenu { - (IBAction)handleOpen:(id)sender { menuBridge_->ExecuteCommand( - DownloadShelfContextMenuMac::OPEN_WHEN_COMPLETE); + DownloadShelfContextMenuMac::OPEN_WHEN_COMPLETE, 0); } - (IBAction)handleAlwaysOpen:(id)sender { menuBridge_->ExecuteCommand( - DownloadShelfContextMenuMac::ALWAYS_OPEN_TYPE); + DownloadShelfContextMenuMac::ALWAYS_OPEN_TYPE, 0); } - (IBAction)handleReveal:(id)sender { - menuBridge_->ExecuteCommand(DownloadShelfContextMenuMac::SHOW_IN_FOLDER); + menuBridge_->ExecuteCommand(DownloadShelfContextMenuMac::SHOW_IN_FOLDER, 0); } - (IBAction)handleCancel:(id)sender { - menuBridge_->ExecuteCommand(DownloadShelfContextMenuMac::CANCEL); + menuBridge_->ExecuteCommand(DownloadShelfContextMenuMac::CANCEL, 0); } - (IBAction)handleTogglePause:(id)sender { @@ -376,7 +376,7 @@ class DownloadShelfContextMenuMac : public DownloadShelfContextMenu { [sender setTitle:l10n_util::GetNSStringWithFixup( IDS_DOWNLOAD_MENU_RESUME_ITEM)]; } - menuBridge_->ExecuteCommand(DownloadShelfContextMenuMac::TOGGLE_PAUSE); + menuBridge_->ExecuteCommand(DownloadShelfContextMenuMac::TOGGLE_PAUSE, 0); } @end diff --git a/chrome/browser/ui/cocoa/infobars/translate_infobar_base.mm b/chrome/browser/ui/cocoa/infobars/translate_infobar_base.mm index 3e766fa..bdc67bf 100644 --- a/chrome/browser/ui/cocoa/infobars/translate_infobar_base.mm +++ b/chrome/browser/ui/cocoa/infobars/translate_infobar_base.mm @@ -449,7 +449,7 @@ InfoBar* TranslateInfoBarDelegate::CreateInfoBar(InfoBarService* owner) { // Danger Will Robinson! : This call can release the infobar (e.g. invoking // "About Translate" can open a new tab). // Do not access member variables after this line! - optionsMenuModel_->ExecuteCommand(cmd); + optionsMenuModel_->ExecuteCommand(cmd, 0); } else { NOTREACHED(); } diff --git a/chrome/browser/ui/cocoa/location_bar/action_box_menu_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/location_bar/action_box_menu_bubble_controller_unittest.mm index f084e28..f714b09 100644 --- a/chrome/browser/ui/cocoa/location_bar/action_box_menu_bubble_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/location_bar/action_box_menu_bubble_controller_unittest.mm @@ -40,7 +40,7 @@ class MenuDelegate : public ui::SimpleMenuModel::Delegate { } // Performs the action associated with the specified command id. - virtual void ExecuteCommand(int command_id) { + virtual void ExecuteCommand(int command_id, int event_flags) { } }; diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm index f653b4f..2cb9590 100644 --- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm +++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm @@ -473,7 +473,8 @@ void LocationBarViewMac::TestPageActionPressed(size_t index) { } void LocationBarViewMac::TestActionBoxMenuItemSelected(int command_id) { - plus_decoration_->action_box_button_controller()->ExecuteCommand(command_id); + plus_decoration_->action_box_button_controller()->ExecuteCommand( + command_id, 0); } bool LocationBarViewMac::GetBookmarkStarVisibility() { diff --git a/chrome/browser/ui/cocoa/menu_controller_unittest.mm b/chrome/browser/ui/cocoa/menu_controller_unittest.mm index 8c5257a..4636cdb 100644 --- a/chrome/browser/ui/cocoa/menu_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/menu_controller_unittest.mm @@ -43,7 +43,9 @@ class Delegate : public ui::SimpleMenuModel::Delegate { virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE { return false; } - virtual void ExecuteCommand(int command_id) OVERRIDE { ++execute_count_; } + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE { + ++execute_count_; + } virtual void MenuWillShow(ui::SimpleMenuModel* /*source*/) OVERRIDE { EXPECT_FALSE(did_show_); diff --git a/chrome/browser/ui/cocoa/tab_contents/render_view_context_menu_mac.h b/chrome/browser/ui/cocoa/tab_contents/render_view_context_menu_mac.h index 2c6be49..35f8177 100644 --- a/chrome/browser/ui/cocoa/tab_contents/render_view_context_menu_mac.h +++ b/chrome/browser/ui/cocoa/tab_contents/render_view_context_menu_mac.h @@ -23,7 +23,6 @@ class RenderViewContextMenuMac : public RenderViewContextMenu { virtual ~RenderViewContextMenuMac(); // SimpleMenuModel::Delegate implementation. - virtual void ExecuteCommand(int command_id) OVERRIDE; virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; diff --git a/chrome/browser/ui/cocoa/tab_contents/render_view_context_menu_mac.mm b/chrome/browser/ui/cocoa/tab_contents/render_view_context_menu_mac.mm index de54c75..67e01c9 100644 --- a/chrome/browser/ui/cocoa/tab_contents/render_view_context_menu_mac.mm +++ b/chrome/browser/ui/cocoa/tab_contents/render_view_context_menu_mac.mm @@ -108,7 +108,7 @@ void RenderViewContextMenuMac::PlatformCancel() { [menu_controller_ cancel]; } -void RenderViewContextMenuMac::ExecuteCommand(int id) { +void RenderViewContextMenuMac::ExecuteCommand(int command_id, int event_flags) { // Auxiliary windows that do not have address bars (Panels for example) // may not have Instant support. NSWindow* parent_window = [parent_view_ window]; @@ -116,10 +116,6 @@ void RenderViewContextMenuMac::ExecuteCommand(int id) { [BrowserWindowController browserWindowControllerForWindow:parent_window]; [controller commitInstant]; // It's ok if controller is nil. - ExecuteCommand(id, 0); -} - -void RenderViewContextMenuMac::ExecuteCommand(int command_id, int event_flags) { switch (command_id) { case IDC_CONTENT_CONTEXT_LOOK_UP_IN_DICTIONARY: LookUpInDictionary(); diff --git a/chrome/browser/ui/cocoa/tabs/tab_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_controller.mm index dddf4333..b22053a 100644 --- a/chrome/browser/ui/cocoa/tabs/tab_controller.mm +++ b/chrome/browser/ui/cocoa/tabs/tab_controller.mm @@ -53,7 +53,7 @@ class MenuDelegate : public ui::SimpleMenuModel::Delegate { virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE { return false; } - virtual void ExecuteCommand(int command_id) OVERRIDE { + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE { TabStripModel::ContextMenuCommand command = static_cast<TabStripModel::ContextMenuCommand>(command_id); [target_ commandDispatch:command forController:owner_]; diff --git a/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm b/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm index 569f1fa..5b57b58 100644 --- a/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm +++ b/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm @@ -227,7 +227,7 @@ class ZoomLevelObserver { // Used to perform the actual dispatch on the outermost runloop. - (void)performCommandDispatch:(NSNumber*)tag { - [self wrenchMenuModel]->ExecuteCommand([tag intValue]); + [self wrenchMenuModel]->ExecuteCommand([tag intValue], 0); } - (WrenchMenuModel*)wrenchMenuModel { diff --git a/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller_unittest.mm b/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller_unittest.mm index 73c7189..3c27b71 100644 --- a/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller_unittest.mm @@ -39,7 +39,7 @@ class MockWrenchMenuModel : public WrenchMenuModel { // short-circuits the parent destructor to avoid this crash. tab_strip_model_ = NULL; } - MOCK_METHOD1(ExecuteCommand, void(int command_id)); + MOCK_METHOD2(ExecuteCommand, void(int command_id, int event_flags)); }; class WrenchMenuControllerTest : public CocoaProfileTest { @@ -77,7 +77,7 @@ TEST_F(WrenchMenuControllerTest, DispatchSimple) { [button setTag:IDC_ZOOM_PLUS]; // Set fake model to test dispatching. - EXPECT_CALL(*fake_model_, ExecuteCommand(IDC_ZOOM_PLUS)); + EXPECT_CALL(*fake_model_, ExecuteCommand(IDC_ZOOM_PLUS, 0)); [controller() setModel:fake_model_.get()]; [controller() dispatchWrenchMenuCommand:button.get()]; diff --git a/chrome/browser/ui/content_settings/content_setting_media_menu_model.cc b/chrome/browser/ui/content_settings/content_setting_media_menu_model.cc index 60fde61..1ccc1ec 100644 --- a/chrome/browser/ui/content_settings/content_setting_media_menu_model.cc +++ b/chrome/browser/ui/content_settings/content_setting_media_menu_model.cc @@ -50,7 +50,8 @@ bool ContentSettingMediaMenuModel::GetAcceleratorForCommandId( return false; } -void ContentSettingMediaMenuModel::ExecuteCommand(int command_id) { +void ContentSettingMediaMenuModel::ExecuteCommand(int command_id, + int event_flags) { CommandMap::const_iterator it = commands_.find(command_id); DCHECK(it != commands_.end()); media_bubble_model_->OnMediaMenuClicked(type_, it->second.id); diff --git a/chrome/browser/ui/content_settings/content_setting_media_menu_model.h b/chrome/browser/ui/content_settings/content_setting_media_menu_model.h index d3b14d6..6a630b98 100644 --- a/chrome/browser/ui/content_settings/content_setting_media_menu_model.h +++ b/chrome/browser/ui/content_settings/content_setting_media_menu_model.h @@ -34,7 +34,7 @@ class ContentSettingMediaMenuModel : public ui::SimpleMenuModel, virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; private: typedef std::map<int, content::MediaStreamDevice> CommandMap; diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc index 0526786..946a0ce 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc @@ -155,7 +155,7 @@ class BookmarkEditorGtk::ContextMenuController return false; } - virtual void ExecuteCommand(int command_id) OVERRIDE { + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE { if (!editor_) return; diff --git a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc index fe17556..fab4355 100644 --- a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc +++ b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc @@ -807,7 +807,7 @@ bool BrowserActionsToolbarGtk::GetAcceleratorForCommandId( return false; } -void BrowserActionsToolbarGtk::ExecuteCommand(int command_id) { +void BrowserActionsToolbarGtk::ExecuteCommand(int command_id, int event_flags) { const Extension* extension = model_->toolbar_items()[command_id]; GURL popup_url; diff --git a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h index e855449..7386d73 100644 --- a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h +++ b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h @@ -131,7 +131,7 @@ class BrowserActionsToolbarGtk : public ExtensionToolbarModel::Observer, virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; // MenuGtk::Delegate implementation. virtual void StoppedShowing() OVERRIDE; diff --git a/chrome/browser/ui/gtk/browser_titlebar.cc b/chrome/browser/ui/gtk/browser_titlebar.cc index 4a07469..f5f489b 100644 --- a/chrome/browser/ui/gtk/browser_titlebar.cc +++ b/chrome/browser/ui/gtk/browser_titlebar.cc @@ -954,7 +954,7 @@ bool BrowserTitlebar::IsCommandIdChecked(int command_id) const { return false; } -void BrowserTitlebar::ExecuteCommand(int command_id) { +void BrowserTitlebar::ExecuteCommand(int command_id, int event_flags) { if (command_id == kShowWindowDecorationsCommand) { PrefService* prefs = browser_window_->browser()->profile()->GetPrefs(); prefs->SetBoolean(prefs::kUseCustomChromeFrame, diff --git a/chrome/browser/ui/gtk/browser_titlebar.h b/chrome/browser/ui/gtk/browser_titlebar.h index fecf602..9a07513 100644 --- a/chrome/browser/ui/gtk/browser_titlebar.h +++ b/chrome/browser/ui/gtk/browser_titlebar.h @@ -150,7 +150,7 @@ class BrowserTitlebar : public content::NotificationObserver, // SimpleMenuModel::Delegate implementation: virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE; diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.cc b/chrome/browser/ui/gtk/location_bar_view_gtk.cc index 3255193..a1d4657 100644 --- a/chrome/browser/ui/gtk/location_bar_view_gtk.cc +++ b/chrome/browser/ui/gtk/location_bar_view_gtk.cc @@ -1021,7 +1021,7 @@ void LocationBarViewGtk::TestPageActionPressed(size_t index) { void LocationBarViewGtk::TestActionBoxMenuItemSelected(int command_id) { action_box_button_->action_box_button_controller()-> - ExecuteCommand(command_id); + ExecuteCommand(command_id, 0); } bool LocationBarViewGtk::GetBookmarkStarVisibility() { diff --git a/chrome/browser/ui/gtk/reload_button_gtk.cc b/chrome/browser/ui/gtk/reload_button_gtk.cc index cb86d83..2425931 100644 --- a/chrome/browser/ui/gtk/reload_button_gtk.cc +++ b/chrome/browser/ui/gtk/reload_button_gtk.cc @@ -228,7 +228,7 @@ bool ReloadButtonGtk::GetAcceleratorForCommandId( return false; } -void ReloadButtonGtk::ExecuteCommand(int command_id) { +void ReloadButtonGtk::ExecuteCommand(int command_id, int event_flags) { switch (command_id) { case IDS_RELOAD_MENU_NORMAL_RELOAD_ITEM: DoReload(IDC_RELOAD); diff --git a/chrome/browser/ui/gtk/reload_button_gtk.h b/chrome/browser/ui/gtk/reload_button_gtk.h index d46cc84..7527c37 100644 --- a/chrome/browser/ui/gtk/reload_button_gtk.h +++ b/chrome/browser/ui/gtk/reload_button_gtk.h @@ -52,7 +52,7 @@ class ReloadButtonGtk : public content::NotificationObserver, virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; private: friend class ReloadButtonGtkTest; diff --git a/chrome/browser/ui/gtk/tabs/tab_strip_menu_controller.cc b/chrome/browser/ui/gtk/tabs/tab_strip_menu_controller.cc index 7de90e5..79289c6 100644 --- a/chrome/browser/ui/gtk/tabs/tab_strip_menu_controller.cc +++ b/chrome/browser/ui/gtk/tabs/tab_strip_menu_controller.cc @@ -55,7 +55,7 @@ bool TabStripMenuController::GetAcceleratorForCommandId( return true; } -void TabStripMenuController::ExecuteCommand(int command_id) { +void TabStripMenuController::ExecuteCommand(int command_id, int event_flags) { // Checking if the tab still exists since it is possible that the tab // corresponding to this context menu has been closed. if (!tab_) diff --git a/chrome/browser/ui/gtk/tabs/tab_strip_menu_controller.h b/chrome/browser/ui/gtk/tabs/tab_strip_menu_controller.h index c580b80..efe4a42 100644 --- a/chrome/browser/ui/gtk/tabs/tab_strip_menu_controller.h +++ b/chrome/browser/ui/gtk/tabs/tab_strip_menu_controller.h @@ -40,7 +40,7 @@ class TabStripMenuController : public ui::SimpleMenuModel::Delegate, virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; // Overridden from MenuGtk::Delegate: virtual GtkWidget* GetImageForCommandId(int command_id) const OVERRIDE; diff --git a/chrome/browser/ui/gtk/task_manager_gtk.cc b/chrome/browser/ui/gtk/task_manager_gtk.cc index d52863e..130f341 100644 --- a/chrome/browser/ui/gtk/task_manager_gtk.cc +++ b/chrome/browser/ui/gtk/task_manager_gtk.cc @@ -295,7 +295,7 @@ class TaskManagerGtk::ContextMenuController return false; } - virtual void ExecuteCommand(int command_id) OVERRIDE { + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE { if (!task_manager_) return; diff --git a/chrome/browser/ui/panels/panel_extension_browsertest.cc b/chrome/browser/ui/panels/panel_extension_browsertest.cc index 6f4a56a..4d65c0f 100644 --- a/chrome/browser/ui/panels/panel_extension_browsertest.cc +++ b/chrome/browser/ui/panels/panel_extension_browsertest.cc @@ -238,6 +238,6 @@ IN_PROC_BROWSER_TEST_F(PanelExtensionBrowserTest, CustomContextMenu) { ExtensionTestMessageListener onclick_listener("clicked", false); int command_id = IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST; ASSERT_TRUE(menu->IsCommandIdEnabled(command_id)); - menu->ExecuteCommand(command_id); + menu->ExecuteCommand(command_id, 0); EXPECT_TRUE(onclick_listener.WaitUntilSatisfied()); } diff --git a/chrome/browser/ui/toolbar/action_box_button_controller.cc b/chrome/browser/ui/toolbar/action_box_button_controller.cc index d4517db..860c1d7 100644 --- a/chrome/browser/ui/toolbar/action_box_button_controller.cc +++ b/chrome/browser/ui/toolbar/action_box_button_controller.cc @@ -84,7 +84,8 @@ bool ActionBoxButtonController::GetAcceleratorForCommandId( return false; } -void ActionBoxButtonController::ExecuteCommand(int command_id) { +void ActionBoxButtonController::ExecuteCommand(int command_id, + int event_flags) { // If the command id belongs to an extension, dispatch an onClicked event // to its pageLauncher. ExtensionIdCommandMap::const_iterator it = diff --git a/chrome/browser/ui/toolbar/action_box_button_controller.h b/chrome/browser/ui/toolbar/action_box_button_controller.h index e43529e..9482044 100644 --- a/chrome/browser/ui/toolbar/action_box_button_controller.h +++ b/chrome/browser/ui/toolbar/action_box_button_controller.h @@ -54,7 +54,7 @@ class ActionBoxButtonController : public ui::SimpleMenuModel::Delegate, virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; private: // Gets the command ID for an extension, creating a new one if necessary. diff --git a/chrome/browser/ui/toolbar/action_box_menu_model.cc b/chrome/browser/ui/toolbar/action_box_menu_model.cc index 7c1f091..e5c4d64 100644 --- a/chrome/browser/ui/toolbar/action_box_menu_model.cc +++ b/chrome/browser/ui/toolbar/action_box_menu_model.cc @@ -91,7 +91,7 @@ const extensions::Extension* ActionBoxMenuModel::GetExtensionAt(int index) { } void ActionBoxMenuModel::ExecuteCommand(int command_id) { - delegate()->ExecuteCommand(command_id); + delegate()->ExecuteCommand(command_id, 0); } int ActionBoxMenuModel::GetFirstExtensionIndex() { diff --git a/chrome/browser/ui/toolbar/action_box_menu_model_unittest.cc b/chrome/browser/ui/toolbar/action_box_menu_model_unittest.cc index 29dd8a1..9ff411f 100644 --- a/chrome/browser/ui/toolbar/action_box_menu_model_unittest.cc +++ b/chrome/browser/ui/toolbar/action_box_menu_model_unittest.cc @@ -41,7 +41,7 @@ class ActionBoxMenuModelTest : public BrowserWithTestWindowTest, return false; } - virtual void ExecuteCommand(int command_id) OVERRIDE {} + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE {} // Don't handle accelerators. virtual bool GetAcceleratorForCommandId( diff --git a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc index 065dcbb..8226dad 100644 --- a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc +++ b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc @@ -183,10 +183,6 @@ string16 RecentTabsSubMenuModel::GetLabelForCommandId(int command_id) const { return l10n_util::GetStringUTF16(string_id); } -void RecentTabsSubMenuModel::ExecuteCommand(int command_id) { - ExecuteCommand(command_id, 0); -} - void RecentTabsSubMenuModel::ExecuteCommand(int command_id, int event_flags) { if (command_id == IDC_RESTORE_TAB) { chrome::ExecuteCommandWithDisposition(browser_, command_id, diff --git a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.h b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.h index 6f7f70b..19c413e 100644 --- a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.h +++ b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.h @@ -50,7 +50,6 @@ class RecentTabsSubMenuModel : public ui::SimpleMenuModel, ui::Accelerator* accelerator) OVERRIDE; virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE; virtual string16 GetLabelForCommandId(int command_id) const OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; int GetMaxWidthForItemAtIndex(int item_index) const; diff --git a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model_unittest.cc b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model_unittest.cc index a3f36d2..df354cd 100644 --- a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model_unittest.cc +++ b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model_unittest.cc @@ -46,7 +46,7 @@ class TestRecentTabsSubMenuModel : public RecentTabsSubMenuModel { return val; } - virtual void ExecuteCommand(int command_id) OVERRIDE { + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE { ++execute_count_; } diff --git a/chrome/browser/ui/toolbar/wrench_menu_model.cc b/chrome/browser/ui/toolbar/wrench_menu_model.cc index ab2bc1f..d2f1efe 100644 --- a/chrome/browser/ui/toolbar/wrench_menu_model.cc +++ b/chrome/browser/ui/toolbar/wrench_menu_model.cc @@ -153,7 +153,7 @@ bool EncodingMenuModel::GetAcceleratorForCommandId( return false; } -void EncodingMenuModel::ExecuteCommand(int command_id) { +void EncodingMenuModel::ExecuteCommand(int command_id, int event_flags) { chrome::ExecuteCommand(browser_, command_id); } @@ -343,7 +343,7 @@ bool WrenchMenuModel::GetIconForCommandId(int command_id, return false; } -void WrenchMenuModel::ExecuteCommand(int command_id) { +void WrenchMenuModel::ExecuteCommand(int command_id, int event_flags) { GlobalError* error = GlobalErrorServiceFactory::GetForProfile( browser_->profile())->GetGlobalErrorByMenuItemCommandID(command_id); if (error) { diff --git a/chrome/browser/ui/toolbar/wrench_menu_model.h b/chrome/browser/ui/toolbar/wrench_menu_model.h index 53fb048..a3ac13e 100644 --- a/chrome/browser/ui/toolbar/wrench_menu_model.h +++ b/chrome/browser/ui/toolbar/wrench_menu_model.h @@ -37,7 +37,7 @@ class EncodingMenuModel : public ui::SimpleMenuModel, virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; private: void Build(); @@ -94,7 +94,7 @@ class WrenchMenuModel : public ui::SimpleMenuModel, virtual string16 GetLabelForCommandId(int command_id) const OVERRIDE; virtual bool GetIconForCommandId(int command_id, gfx::Image* icon) const OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; virtual bool IsCommandIdVisible(int command_id) const OVERRIDE; diff --git a/chrome/browser/ui/toolbar/wrench_menu_model_unittest.cc b/chrome/browser/ui/toolbar/wrench_menu_model_unittest.cc index a9e23cb..0cea247 100644 --- a/chrome/browser/ui/toolbar/wrench_menu_model_unittest.cc +++ b/chrome/browser/ui/toolbar/wrench_menu_model_unittest.cc @@ -114,7 +114,9 @@ class TestWrenchMenuModel : public WrenchMenuModel { return true; } - virtual void ExecuteCommand(int command_id) OVERRIDE { ++execute_count_; } + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE { + ++execute_count_; + } int execute_count_; mutable int checked_count_; diff --git a/chrome/browser/ui/views/bookmarks/bookmark_context_menu.cc b/chrome/browser/ui/views/bookmarks/bookmark_context_menu.cc index 9441b76..92f2f3d 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_context_menu.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_context_menu.cc @@ -66,7 +66,7 @@ void BookmarkContextMenu::SetPageNavigator(PageNavigator* navigator) { //////////////////////////////////////////////////////////////////////////////// // BookmarkContextMenu, views::MenuDelegate implementation: -void BookmarkContextMenu::ExecuteCommand(int command_id) { +void BookmarkContextMenu::ExecuteCommand(int command_id, int event_flags) { controller_->ExecuteCommand(command_id); } diff --git a/chrome/browser/ui/views/bookmarks/bookmark_context_menu.h b/chrome/browser/ui/views/bookmarks/bookmark_context_menu.h index c1a33ab..f03870a 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_context_menu.h +++ b/chrome/browser/ui/views/bookmarks/bookmark_context_menu.h @@ -57,7 +57,7 @@ class BookmarkContextMenu : public BookmarkContextMenuControllerViewsDelegate, void SetPageNavigator(content::PageNavigator* navigator); // Overridden from views::MenuDelegate: - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; virtual bool IsItemChecked(int command_id) const OVERRIDE; virtual bool IsCommandEnabled(int command_id) const OVERRIDE; virtual bool ShouldCloseAllMenusOnExecute(int id) OVERRIDE; diff --git a/chrome/browser/ui/views/bookmarks/bookmark_context_menu_test.cc b/chrome/browser/ui/views/bookmarks/bookmark_context_menu_test.cc index 17d3a4a..fa88611 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_context_menu_test.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_context_menu_test.cc @@ -118,7 +118,7 @@ TEST_F(BookmarkContextMenuTest, DeleteURL) { GURL url = model_->bookmark_bar_node()->GetChild(0)->url(); ASSERT_TRUE(controller.IsCommandEnabled(IDC_BOOKMARK_BAR_REMOVE)); // Delete the URL. - controller.ExecuteCommand(IDC_BOOKMARK_BAR_REMOVE); + controller.ExecuteCommand(IDC_BOOKMARK_BAR_REMOVE, 0); // Model shouldn't have URL anymore. ASSERT_FALSE(model_->IsBookmarked(url)); } @@ -305,12 +305,12 @@ TEST_F(BookmarkContextMenuTest, CutCopyPasteNode) { EXPECT_TRUE(controller->IsCommandEnabled(IDC_CUT)); // Copy the URL. - controller->ExecuteCommand(IDC_COPY); + controller->ExecuteCommand(IDC_COPY, 0); controller.reset(new BookmarkContextMenu( NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes, false)); int old_count = bb_node->child_count(); - controller->ExecuteCommand(IDC_PASTE); + controller->ExecuteCommand(IDC_PASTE, 0); ASSERT_TRUE(bb_node->GetChild(1)->is_url()); ASSERT_EQ(old_count + 1, bb_node->child_count()); @@ -319,7 +319,7 @@ TEST_F(BookmarkContextMenuTest, CutCopyPasteNode) { controller.reset(new BookmarkContextMenu( NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes, false)); // Cut the URL. - controller->ExecuteCommand(IDC_CUT); + controller->ExecuteCommand(IDC_CUT, 0); ASSERT_TRUE(bb_node->GetChild(0)->is_url()); ASSERT_TRUE(bb_node->GetChild(1)->is_folder()); ASSERT_EQ(old_count, bb_node->child_count()); diff --git a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc index 869536f..896fd24 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc @@ -193,7 +193,7 @@ bool BookmarkEditorView::GetAcceleratorForCommandId( return GetWidget()->GetAccelerator(command_id, accelerator); } -void BookmarkEditorView::ExecuteCommand(int command_id) { +void BookmarkEditorView::ExecuteCommand(int command_id, int event_flags) { DCHECK(tree_view_->GetSelectedNode()); if (command_id == IDS_EDIT) { tree_view_->StartEditing(tree_view_->GetSelectedNode()); diff --git a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.h b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.h index 3a2df88..cb53fcb 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.h +++ b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.h @@ -110,7 +110,7 @@ class BookmarkEditorView : public BookmarkEditor, virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; // Creates a Window and adds the BookmarkEditorView to it. When the window is // closed the BookmarkEditorView is deleted. diff --git a/chrome/browser/ui/views/button_dropdown_test.cc b/chrome/browser/ui/views/button_dropdown_test.cc index 0575a88..524d217 100644 --- a/chrome/browser/ui/views/button_dropdown_test.cc +++ b/chrome/browser/ui/views/button_dropdown_test.cc @@ -57,7 +57,7 @@ class ButtonDropDownDragTest : public ViewEventTestBase, return false; } - virtual void ExecuteCommand(int id) OVERRIDE { + virtual void ExecuteCommand(int id, int event_flags) OVERRIDE { } virtual void MenuWillShow(ui::SimpleMenuModel* /*source*/) OVERRIDE { diff --git a/chrome/browser/ui/views/external_tab_container_win.cc b/chrome/browser/ui/views/external_tab_container_win.cc index ff4f69d..a802612 100644 --- a/chrome/browser/ui/views/external_tab_container_win.cc +++ b/chrome/browser/ui/views/external_tab_container_win.cc @@ -402,7 +402,7 @@ bool ExternalTabContainerWin::ExecuteContextMenuCommand(int command) { } } - external_context_menu_->ExecuteCommand(command); + external_context_menu_->ExecuteCommand(command, 0); return true; } diff --git a/chrome/browser/ui/views/frame/system_menu_model_delegate.cc b/chrome/browser/ui/views/frame/system_menu_model_delegate.cc index f7fcf08..aa7b129 100644 --- a/chrome/browser/ui/views/frame/system_menu_model_delegate.cc +++ b/chrome/browser/ui/views/frame/system_menu_model_delegate.cc @@ -54,6 +54,6 @@ string16 SystemMenuModelDelegate::GetLabelForCommandId(int command_id) const { return l10n_util::GetStringUTF16(string_id); } -void SystemMenuModelDelegate::ExecuteCommand(int command_id) { +void SystemMenuModelDelegate::ExecuteCommand(int command_id, int event_flags) { chrome::ExecuteCommand(browser_, command_id); } diff --git a/chrome/browser/ui/views/frame/system_menu_model_delegate.h b/chrome/browser/ui/views/frame/system_menu_model_delegate.h index 92a9bdd..e2c5ba0 100644 --- a/chrome/browser/ui/views/frame/system_menu_model_delegate.h +++ b/chrome/browser/ui/views/frame/system_menu_model_delegate.h @@ -27,7 +27,7 @@ class SystemMenuModelDelegate : public ui::SimpleMenuModel::Delegate { ui::Accelerator* accelerator) OVERRIDE; virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE; virtual string16 GetLabelForCommandId(int command_id) const OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; private: ui::AcceleratorProvider* provider_; // weak diff --git a/chrome/browser/ui/views/infobars/translate_language_menu_model.cc b/chrome/browser/ui/views/infobars/translate_language_menu_model.cc index 6ec06e5..3fa2155 100644 --- a/chrome/browser/ui/views/infobars/translate_language_menu_model.cc +++ b/chrome/browser/ui/views/infobars/translate_language_menu_model.cc @@ -44,7 +44,8 @@ bool TranslateLanguageMenuModel::GetAcceleratorForCommandId( return false; } -void TranslateLanguageMenuModel::ExecuteCommand(int command_id) { +void TranslateLanguageMenuModel::ExecuteCommand(int command_id, + int event_flags) { size_t command_id_size_t = static_cast<size_t>(command_id); if (language_type_ == ORIGINAL) { UMA_HISTOGRAM_COUNTS("Translate.ModifyOriginalLang", 1); diff --git a/chrome/browser/ui/views/infobars/translate_language_menu_model.h b/chrome/browser/ui/views/infobars/translate_language_menu_model.h index 566c8d5..f19b6cd 100644 --- a/chrome/browser/ui/views/infobars/translate_language_menu_model.h +++ b/chrome/browser/ui/views/infobars/translate_language_menu_model.h @@ -36,7 +36,7 @@ class TranslateLanguageMenuModel : public ui::SimpleMenuModel, virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; private: size_t GetLanguageIndex() const; diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc index a0fd70e..c76f86d 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -1436,7 +1436,7 @@ void LocationBarView::TestPageActionPressed(size_t index) { void LocationBarView::TestActionBoxMenuItemSelected(int command_id) { action_box_button_view_->action_box_button_controller()-> - ExecuteCommand(command_id); + ExecuteCommand(command_id, 0); } bool LocationBarView::GetBookmarkStarVisibility() { diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc index 50f2a2a..0b749c2 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc @@ -751,7 +751,7 @@ bool OmniboxViewViews::HandlesCommand(int command_id) const { return command_id == IDS_APP_PASTE; } -void OmniboxViewViews::ExecuteCommand(int command_id) { +void OmniboxViewViews::ExecuteCommand(int command_id, int event_flags) { switch (command_id) { case IDS_APP_PASTE: OnPaste(); diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.h b/chrome/browser/ui/views/omnibox/omnibox_view_views.h index f4ba0ba..8a6b439 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_views.h +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.h @@ -127,7 +127,7 @@ class OmniboxViewViews virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE; virtual string16 GetLabelForCommandId(int command_id) const OVERRIDE; virtual bool HandlesCommand(int command_id) const OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; #if defined(OS_CHROMEOS) // chromeos::input_method::InputMethodManager::CandidateWindowObserver: diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc index c449fb5..2e5c9d7 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc @@ -1225,7 +1225,7 @@ string16 OmniboxViewWin::GetLabelForCommandId(int command_id) const { IDS_PASTE_AND_SEARCH : IDS_PASTE_AND_GO); } -void OmniboxViewWin::ExecuteCommand(int command_id) { +void OmniboxViewWin::ExecuteCommand(int command_id, int event_flags) { ScopedFreeze freeze(this, GetTextObjectModel()); if (command_id == IDS_PASTE_AND_GO) { // This case is separate from the switch() below since we don't want to wrap diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_win.h b/chrome/browser/ui/views/omnibox/omnibox_view_win.h index 00c131e..4a170eb 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_win.h +++ b/chrome/browser/ui/views/omnibox/omnibox_view_win.h @@ -189,7 +189,7 @@ class OmniboxViewWin ui::Accelerator* accelerator) OVERRIDE; virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE; virtual string16 GetLabelForCommandId(int command_id) const OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; private: enum MouseButton { diff --git a/chrome/browser/ui/views/reload_button.cc b/chrome/browser/ui/views/reload_button.cc index 30ec4cf..6340886 100644 --- a/chrome/browser/ui/views/reload_button.cc +++ b/chrome/browser/ui/views/reload_button.cc @@ -203,10 +203,6 @@ bool ReloadButton::GetAcceleratorForCommandId(int command_id, return GetWidget()->GetAccelerator(command_id, accelerator); } -void ReloadButton::ExecuteCommand(int command_id) { - ExecuteCommand(command_id, 0); -} - void ReloadButton::ExecuteCommand(int command_id, int event_flags) { int browser_command = 0; switch (command_id) { diff --git a/chrome/browser/ui/views/reload_button.h b/chrome/browser/ui/views/reload_button.h index ca886d4..9c04841 100644 --- a/chrome/browser/ui/views/reload_button.h +++ b/chrome/browser/ui/views/reload_button.h @@ -68,7 +68,6 @@ class ReloadButton : public views::ButtonDropDown, virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; private: diff --git a/chrome/browser/ui/views/tab_contents/render_view_context_menu_win.cc b/chrome/browser/ui/views/tab_contents/render_view_context_menu_win.cc index 4c54d5c..10e3ce10 100644 --- a/chrome/browser/ui/views/tab_contents/render_view_context_menu_win.cc +++ b/chrome/browser/ui/views/tab_contents/render_view_context_menu_win.cc @@ -40,10 +40,6 @@ bool RenderViewContextMenuWin::IsCommandIdVisible(int command_id) const { return RenderViewContextMenu::IsCommandIdVisible(command_id); } -void RenderViewContextMenuWin::ExecuteCommand(int command_id) { - ExecuteCommand(command_id, 0); -} - void RenderViewContextMenuWin::ExecuteCommand(int command_id, int event_flags) { if (win8::IsSingleWindowMetroMode() && diff --git a/chrome/browser/ui/views/tab_contents/render_view_context_menu_win.h b/chrome/browser/ui/views/tab_contents/render_view_context_menu_win.h index 130f63d..c23516e9 100644 --- a/chrome/browser/ui/views/tab_contents/render_view_context_menu_win.h +++ b/chrome/browser/ui/views/tab_contents/render_view_context_menu_win.h @@ -24,7 +24,6 @@ class RenderViewContextMenuWin : public RenderViewContextMenuViews { // SimpleMenuModel::Delegate implementation. virtual bool IsCommandIdVisible(int command_id) const OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; private: diff --git a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc index 867aca3..5eb7778 100644 --- a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc +++ b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc @@ -129,7 +129,7 @@ class BrowserTabStripController::TabContextMenuContents last_command_ = static_cast<TabStripModel::ContextMenuCommand>(command_id); controller_->StartHighlightTabsForCommand(last_command_, tab_); } - virtual void ExecuteCommand(int command_id) OVERRIDE { + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE { // Executing the command destroys |this|, and can also end up destroying // |controller_|. So stop the highlights before executing the command. controller_->tabstrip_->StopAllHighlighting(); diff --git a/chrome/browser/ui/views/task_manager_view.cc b/chrome/browser/ui/views/task_manager_view.cc index 2fdb35b..4bc35ee 100644 --- a/chrome/browser/ui/views/task_manager_view.cc +++ b/chrome/browser/ui/views/task_manager_view.cc @@ -247,7 +247,7 @@ class TaskManagerView : public views::ButtonListener, virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int id) OVERRIDE; + virtual void ExecuteCommand(int id, int event_flags) OVERRIDE; private: // Creates the child controls. @@ -688,7 +688,7 @@ bool TaskManagerView::GetAcceleratorForCommandId( return false; } -void TaskManagerView::ExecuteCommand(int id) { +void TaskManagerView::ExecuteCommand(int id, int event_flags) { tab_table_->SetColumnVisibility(id, !tab_table_->IsColumnVisible(id)); } diff --git a/chrome/browser/ui/website_settings/permission_menu_model.cc b/chrome/browser/ui/website_settings/permission_menu_model.cc index 1c7632c..a602d13 100644 --- a/chrome/browser/ui/website_settings/permission_menu_model.cc +++ b/chrome/browser/ui/website_settings/permission_menu_model.cc @@ -66,7 +66,7 @@ bool PermissionMenuModel::GetAcceleratorForCommandId( return false; } -void PermissionMenuModel::ExecuteCommand(int command_id) { +void PermissionMenuModel::ExecuteCommand(int command_id, int event_flags) { if (delegate_) delegate_->ExecuteCommand(command_id); } diff --git a/chrome/browser/ui/website_settings/permission_menu_model.h b/chrome/browser/ui/website_settings/permission_menu_model.h index 0abe7a2..cb6537e 100644 --- a/chrome/browser/ui/website_settings/permission_menu_model.h +++ b/chrome/browser/ui/website_settings/permission_menu_model.h @@ -40,7 +40,7 @@ class PermissionMenuModel : public ui::SimpleMenuModel, virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; private: // The delegate of the |PermissionMenuModel|. |delegate_| can be NULL. diff --git a/chrome/test/base/menu_model_test.cc b/chrome/test/base/menu_model_test.cc index 2c8bd27..4b1b25b 100644 --- a/chrome/test/base/menu_model_test.cc +++ b/chrome/test/base/menu_model_test.cc @@ -21,7 +21,7 @@ bool MenuModelTest::Delegate::GetAcceleratorForCommandId( return false; } -void MenuModelTest::Delegate::ExecuteCommand(int command_id) { +void MenuModelTest::Delegate::ExecuteCommand(int command_id, int event_flags) { ++execute_count_; } diff --git a/chrome/test/base/menu_model_test.h b/chrome/test/base/menu_model_test.h index cc64da9..e474114 100644 --- a/chrome/test/base/menu_model_test.h +++ b/chrome/test/base/menu_model_test.h @@ -28,7 +28,7 @@ class MenuModelTest { virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; int execute_count_; mutable int enable_count_; diff --git a/ui/base/models/button_menu_item_model.cc b/ui/base/models/button_menu_item_model.cc index 9490b9d..248ae03 100644 --- a/ui/base/models/button_menu_item_model.cc +++ b/ui/base/models/button_menu_item_model.cc @@ -108,7 +108,7 @@ bool ButtonMenuItemModel::PartOfGroup(int index) const { void ButtonMenuItemModel::ActivatedCommand(int command_id) { if (delegate_) - delegate_->ExecuteCommand(command_id); + delegate_->ExecuteCommand(command_id, 0); } bool ButtonMenuItemModel::IsEnabledAt(int index) const { diff --git a/ui/base/models/button_menu_item_model.h b/ui/base/models/button_menu_item_model.h index a9ef808..05b7d34 100644 --- a/ui/base/models/button_menu_item_model.h +++ b/ui/base/models/button_menu_item_model.h @@ -30,7 +30,7 @@ class UI_EXPORT ButtonMenuItemModel { virtual string16 GetLabelForCommandId(int command_id) const; // Performs the action associated with the specified command id. - virtual void ExecuteCommand(int command_id) = 0; + virtual void ExecuteCommand(int command_id, int event_flags) = 0; virtual bool IsCommandIdEnabled(int command_id) const; virtual bool DoesCommandIdDismissMenu(int command_id) const; diff --git a/ui/base/models/simple_menu_model.cc b/ui/base/models/simple_menu_model.cc index dcfacd7b..4d52132 100644 --- a/ui/base/models/simple_menu_model.cc +++ b/ui/base/models/simple_menu_model.cc @@ -50,7 +50,7 @@ void SimpleMenuModel::Delegate::CommandIdHighlighted(int command_id) { void SimpleMenuModel::Delegate::ExecuteCommand( int command_id, int event_flags) { - ExecuteCommand(command_id); + ExecuteCommand(command_id, event_flags); } void SimpleMenuModel::Delegate::MenuWillShow(SimpleMenuModel* /*source*/) { @@ -323,7 +323,7 @@ void SimpleMenuModel::HighlightChangedTo(int index) { void SimpleMenuModel::ActivatedAt(int index) { if (delegate_) - delegate_->ExecuteCommand(GetCommandIdAt(index)); + delegate_->ExecuteCommand(GetCommandIdAt(index), 0); } void SimpleMenuModel::ActivatedAt(int index, int event_flags) { diff --git a/ui/base/models/simple_menu_model.h b/ui/base/models/simple_menu_model.h index 06917f3..552e9b7 100644 --- a/ui/base/models/simple_menu_model.h +++ b/ui/base/models/simple_menu_model.h @@ -50,11 +50,10 @@ class UI_EXPORT SimpleMenuModel : public MenuModel { // visually highlighted within the menu. virtual void CommandIdHighlighted(int command_id); - // Performs the action associated with the specified command id. - virtual void ExecuteCommand(int command_id) = 0; - // Performs the action associates with the specified command id - // with |event_flags|. - virtual void ExecuteCommand(int command_id, int event_flags); + // Performs the action associates with the specified command id. + // The passed |event_flags| are the flags from the event which issued this + // command and they can be examined to find modifier keys. + virtual void ExecuteCommand(int command_id, int event_flags) = 0; // Notifies the delegate that the menu is about to show. virtual void MenuWillShow(SimpleMenuModel* source); diff --git a/ui/message_center/message_center_tray.cc b/ui/message_center/message_center_tray.cc index bf02437..6f30df7 100644 --- a/ui/message_center/message_center_tray.cc +++ b/ui/message_center/message_center_tray.cc @@ -142,7 +142,7 @@ bool MessageCenterTray::GetAcceleratorForCommandId( return false; } -void MessageCenterTray::ExecuteCommand(int command_id) { +void MessageCenterTray::ExecuteCommand(int command_id, int event_flags) { if (command_id == kToggleQuietMode) { bool in_quiet_mode = message_center()->quiet_mode(); message_center()->notification_list()->SetQuietMode(!in_quiet_mode); diff --git a/ui/message_center/message_center_tray.h b/ui/message_center/message_center_tray.h index 9a3b33c0..66b5109 100644 --- a/ui/message_center/message_center_tray.h +++ b/ui/message_center/message_center_tray.h @@ -69,7 +69,7 @@ class MESSAGE_CENTER_EXPORT MessageCenterTray virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; private: void NotifyMessageCenterTrayChanged(); diff --git a/ui/message_center/views/message_view.cc b/ui/message_center/views/message_view.cc index a8c1a63..b953c63 100644 --- a/ui/message_center/views/message_view.cc +++ b/ui/message_center/views/message_view.cc @@ -197,7 +197,7 @@ class MenuModel : public ui::SimpleMenuModel, virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; private: message_center::NotificationChangeObserver* observer_; // Weak reference. @@ -249,7 +249,7 @@ bool MenuModel::GetAcceleratorForCommandId(int command_id, return false; } -void MenuModel::ExecuteCommand(int command_id) { +void MenuModel::ExecuteCommand(int command_id, int event_flags) { switch (command_id) { case kToggleExtensionCommand: observer_->OnDisableNotificationsByExtension(notification_id_); diff --git a/ui/views/controls/textfield/native_textfield_views.cc b/ui/views/controls/textfield/native_textfield_views.cc index ecfc28c..9e0c543 100644 --- a/ui/views/controls/textfield/native_textfield_views.cc +++ b/ui/views/controls/textfield/native_textfield_views.cc @@ -697,7 +697,7 @@ int NativeTextfieldViews::GetTextfieldBaseline() const { } void NativeTextfieldViews::ExecuteTextCommand(int command_id) { - ExecuteCommand(command_id); + ExecuteCommand(command_id, 0); } ///////////////////////////////////////////////////////////////// @@ -743,7 +743,7 @@ string16 NativeTextfieldViews::GetLabelForCommandId(int command_id) const { return controller ? controller->GetLabelForCommandId(command_id) : string16(); } -void NativeTextfieldViews::ExecuteCommand(int command_id) { +void NativeTextfieldViews::ExecuteCommand(int command_id, int event_flags) { touch_selection_controller_.reset(); if (!IsCommandIdEnabled(command_id)) return; @@ -752,7 +752,7 @@ void NativeTextfieldViews::ExecuteCommand(int command_id) { OnBeforeUserAction(); TextfieldController* controller = textfield_->GetController(); if (controller && controller->HandlesCommand(command_id)) { - controller->ExecuteCommand(command_id); + controller->ExecuteCommand(command_id, 0); } else { switch (command_id) { case IDS_APP_CUT: @@ -771,7 +771,7 @@ void NativeTextfieldViews::ExecuteCommand(int command_id) { SelectAll(false); break; default: - controller->ExecuteCommand(command_id); + controller->ExecuteCommand(command_id, 0); break; } } diff --git a/ui/views/controls/textfield/native_textfield_views.h b/ui/views/controls/textfield/native_textfield_views.h index db79a13..b188843 100644 --- a/ui/views/controls/textfield/native_textfield_views.h +++ b/ui/views/controls/textfield/native_textfield_views.h @@ -157,7 +157,7 @@ class VIEWS_EXPORT NativeTextfieldViews : public View, ui::Accelerator* accelerator) OVERRIDE; virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE; virtual string16 GetLabelForCommandId(int command_id) const OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; // class name of internal static const char kViewClassName[]; diff --git a/ui/views/controls/textfield/native_textfield_views_unittest.cc b/ui/views/controls/textfield/native_textfield_views_unittest.cc index 84aea27..6e652fb 100644 --- a/ui/views/controls/textfield/native_textfield_views_unittest.cc +++ b/ui/views/controls/textfield/native_textfield_views_unittest.cc @@ -598,8 +598,8 @@ TEST_F(NativeTextfieldViewsTest, PasswordTest) { SetClipboardText("foo"); SendKeyEvent(ui::VKEY_C, false, true); SendKeyEvent(ui::VKEY_X, false, true); - ExecuteCommand(IDS_APP_COPY); - ExecuteCommand(IDS_APP_CUT); + ExecuteCommand(IDS_APP_COPY, 0); + ExecuteCommand(IDS_APP_CUT, 0); EXPECT_STR_EQ("foo", string16(GetClipboardText())); EXPECT_STR_EQ("my password", textfield_->text()); } diff --git a/ui/views/controls/textfield/native_textfield_win.cc b/ui/views/controls/textfield/native_textfield_win.cc index 7b11577..a31beff 100644 --- a/ui/views/controls/textfield/native_textfield_win.cc +++ b/ui/views/controls/textfield/native_textfield_win.cc @@ -425,7 +425,7 @@ int NativeTextfieldWin::GetTextfieldBaseline() const { } void NativeTextfieldWin::ExecuteTextCommand(int command_id) { - ExecuteCommand(command_id); + ExecuteCommand(command_id, 0); } //////////////////////////////////////////////////////////////////////////////// @@ -466,7 +466,7 @@ bool NativeTextfieldWin::GetAcceleratorForCommandId(int command_id, return container_view_->GetWidget()->GetAccelerator(command_id, accelerator); } -void NativeTextfieldWin::ExecuteCommand(int command_id) { +void NativeTextfieldWin::ExecuteCommand(int command_id, int event_flags) { ScopedFreeze freeze(this, GetTextObjectModel()); OnBeforePossibleChange(); switch (command_id) { diff --git a/ui/views/controls/textfield/native_textfield_win.h b/ui/views/controls/textfield/native_textfield_win.h index e6a90d1..9764f24 100644 --- a/ui/views/controls/textfield/native_textfield_win.h +++ b/ui/views/controls/textfield/native_textfield_win.h @@ -108,7 +108,7 @@ class NativeTextfieldWin virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; // ui::TSFEventRouterObserver: virtual void OnTextUpdated(const ui::Range& composition_range) OVERRIDE; diff --git a/ui/views/controls/textfield/textfield_controller.h b/ui/views/controls/textfield/textfield_controller.h index cb8ff2c..64e71f2 100644 --- a/ui/views/controls/textfield/textfield_controller.h +++ b/ui/views/controls/textfield/textfield_controller.h @@ -90,7 +90,7 @@ class VIEWS_EXPORT TextfieldController { virtual bool HandlesCommand(int command_id) const; // Execute context menu command specified by |command_id|. - virtual void ExecuteCommand(int command_id) {} + virtual void ExecuteCommand(int command_id, int event_flag) {} protected: virtual ~TextfieldController() {} diff --git a/ui/views/examples/menu_example.cc b/ui/views/examples/menu_example.cc index cf73038..ea8aa55 100644 --- a/ui/views/examples/menu_example.cc +++ b/ui/views/examples/menu_example.cc @@ -32,7 +32,7 @@ class ExampleMenuModel : public ui::SimpleMenuModel, virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; private: enum GroupID { @@ -124,7 +124,7 @@ bool ExampleMenuModel::GetAcceleratorForCommandId( return false; } -void ExampleMenuModel::ExecuteCommand(int command_id) { +void ExampleMenuModel::ExecuteCommand(int command_id, int event_flags) { switch (command_id) { case COMMAND_DO_SOMETHING: { LOG(INFO) << "Done something"; diff --git a/ui/views/examples/tree_view_example.cc b/ui/views/examples/tree_view_example.cc index b8932eef..313a17e 100644 --- a/ui/views/examples/tree_view_example.cc +++ b/ui/views/examples/tree_view_example.cc @@ -149,7 +149,7 @@ bool TreeViewExample::GetAcceleratorForCommandId( return false; } -void TreeViewExample::ExecuteCommand(int command_id) { +void TreeViewExample::ExecuteCommand(int command_id, int event_flags) { NodeType* selected_node = static_cast<NodeType*>(tree_view_->GetSelectedNode()); switch (command_id) { diff --git a/ui/views/examples/tree_view_example.h b/ui/views/examples/tree_view_example.h index a832bda..7b2575d 100644 --- a/ui/views/examples/tree_view_example.h +++ b/ui/views/examples/tree_view_example.h @@ -64,7 +64,7 @@ class TreeViewExample : public ExampleBase, virtual bool GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; // The tree view to be tested. TreeView* tree_view_; diff --git a/ui/views/touchui/touch_editing_menu.cc b/ui/views/touchui/touch_editing_menu.cc index ed1dae9..63d5652 100644 --- a/ui/views/touchui/touch_editing_menu.cc +++ b/ui/views/touchui/touch_editing_menu.cc @@ -95,7 +95,7 @@ void TouchEditingMenuView::ButtonPressed(Button* sender, const ui::Event& event) { if (controller_) { if (sender->tag() != kEllipsesButtonTag) - controller_->ExecuteCommand(sender->tag()); + controller_->ExecuteCommand(sender->tag(), event.flags()); else controller_->OpenContextMenu(); } diff --git a/ui/views/touchui/touch_editing_menu.h b/ui/views/touchui/touch_editing_menu.h index a667749..a34718163 100644 --- a/ui/views/touchui/touch_editing_menu.h +++ b/ui/views/touchui/touch_editing_menu.h @@ -24,7 +24,7 @@ class VIEWS_EXPORT TouchEditingMenuController { virtual bool IsCommandIdEnabled(int command_id) const = 0; // Send a context menu command to the controller. - virtual void ExecuteCommand(int command_id) = 0; + virtual void ExecuteCommand(int command_id, int event_flags) = 0; // Tell the controller that user has selected the context menu button. virtual void OpenContextMenu() = 0; diff --git a/ui/views/touchui/touch_selection_controller_impl.cc b/ui/views/touchui/touch_selection_controller_impl.cc index e5ded39..b4593f2 100644 --- a/ui/views/touchui/touch_selection_controller_impl.cc +++ b/ui/views/touchui/touch_selection_controller_impl.cc @@ -290,9 +290,10 @@ bool TouchSelectionControllerImpl::IsCommandIdEnabled(int command_id) const { return client_view_->IsCommandIdEnabled(command_id); } -void TouchSelectionControllerImpl::ExecuteCommand(int command_id) { +void TouchSelectionControllerImpl::ExecuteCommand(int command_id, + int event_flags) { HideContextMenu(); - client_view_->ExecuteCommand(command_id); + client_view_->ExecuteCommand(command_id, event_flags); } void TouchSelectionControllerImpl::OpenContextMenu() { diff --git a/ui/views/touchui/touch_selection_controller_impl.h b/ui/views/touchui/touch_selection_controller_impl.h index 8c2cd77..5d1f771 100644 --- a/ui/views/touchui/touch_selection_controller_impl.h +++ b/ui/views/touchui/touch_selection_controller_impl.h @@ -46,7 +46,7 @@ class VIEWS_EXPORT TouchSelectionControllerImpl // Overridden from TouchEditingMenuController. virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; - virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; virtual void OpenContextMenu() OVERRIDE; virtual void OnMenuClosed(TouchEditingMenuView* menu) OVERRIDE; |