diff options
author | mhm@chromium.org <mhm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-26 01:37:10 +0000 |
---|---|---|
committer | mhm@chromium.org <mhm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-26 01:37:10 +0000 |
commit | fdb985153d743ecf4aaa5b88a67d9124aa835684 (patch) | |
tree | a8ea972299e78d8baaa0c77307216ddf9a0c2391 | |
parent | 67f1b0f27c9371b8ba34574f03eb32310995e622 (diff) | |
download | chromium_src-fdb985153d743ecf4aaa5b88a67d9124aa835684.zip chromium_src-fdb985153d743ecf4aaa5b88a67d9124aa835684.tar.gz chromium_src-fdb985153d743ecf4aaa5b88a67d9124aa835684.tar.bz2 |
Introduce accesskeys for Chrome menus.
Added ALT+E for Chrome Page Menu
Added ALT+F for Chrome App Menu
BUG=906 (http://crbug.com/906)
TEST=Triggered ALT+A and ALT+P from the keyboard which successfully opened the corresponding menu.
Review URL: http://codereview.chromium.org/174044
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24410 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/chrome_dll.rc | 2 | ||||
-rw-r--r-- | chrome/app/chrome_dll_resource.h | 2 | ||||
-rw-r--r-- | chrome/browser/browser.cc | 14 | ||||
-rw-r--r-- | chrome/browser/browser.h | 2 | ||||
-rw-r--r-- | chrome/browser/browser_window.h | 6 | ||||
-rw-r--r-- | chrome/browser/cocoa/browser_window_cocoa.h | 2 | ||||
-rw-r--r-- | chrome/browser/cocoa/browser_window_cocoa.mm | 8 | ||||
-rw-r--r-- | chrome/browser/gtk/browser_window_gtk.cc | 6 | ||||
-rw-r--r-- | chrome/browser/gtk/browser_window_gtk.h | 2 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view.cc | 8 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view.h | 2 | ||||
-rw-r--r-- | chrome/browser/views/toolbar_view.h | 2 | ||||
-rw-r--r-- | chrome/test/test_browser_window.h | 2 |
13 files changed, 58 insertions, 0 deletions
diff --git a/chrome/app/chrome_dll.rc b/chrome/app/chrome_dll.rc index 42beeba..6e3da8f 100644 --- a/chrome/app/chrome_dll.rc +++ b/chrome/app/chrome_dll.rc @@ -118,6 +118,8 @@ BEGIN "B", IDC_SHOW_BOOKMARK_MANAGER, VIRTKEY, CONTROL, SHIFT "J", IDC_SHOW_DOWNLOADS, VIRTKEY, CONTROL "H", IDC_SHOW_HISTORY, VIRTKEY, CONTROL + "F", IDC_SHOW_APP_MENU, VIRTKEY, ALT + "E", IDC_SHOW_PAGE_MENU, VIRTKEY, ALT "D", IDC_STAR, VIRTKEY, CONTROL VK_ESCAPE, IDC_STOP, VIRTKEY VK_ESCAPE, IDC_TASK_MANAGER, VIRTKEY, SHIFT diff --git a/chrome/app/chrome_dll_resource.h b/chrome/app/chrome_dll_resource.h index 26cb51d..bb76758 100644 --- a/chrome/app/chrome_dll_resource.h +++ b/chrome/app/chrome_dll_resource.h @@ -173,6 +173,8 @@ #define IDC_VIEW_PASSWORDS 40017 #define IDC_ABOUT 40018 #define IDC_HELP_PAGE 40019 +#define IDC_SHOW_APP_MENU 40020 +#define IDC_SHOW_PAGE_MENU 40021 // Spell-check // Insert any additional suggestions before _LAST; these have to be consecutive. diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 43a232c..2998b9f 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -707,6 +707,8 @@ void Browser::UpdateCommandsForFullscreenMode(bool is_fullscreen) { command_updater_.UpdateCommandEnabled(IDC_EDIT_SEARCH_ENGINES, show_main_ui); command_updater_.UpdateCommandEnabled(IDC_VIEW_PASSWORDS, show_main_ui); command_updater_.UpdateCommandEnabled(IDC_ABOUT, show_main_ui); + command_updater_.UpdateCommandEnabled(IDC_SHOW_APP_MENU, show_main_ui); + command_updater_.UpdateCommandEnabled(IDC_SHOW_PAGE_MENU, show_main_ui); } /////////////////////////////////////////////////////////////////////////////// @@ -1151,6 +1153,16 @@ void Browser::OpenBookmarkManager() { window_->ShowBookmarkManager(); } +void Browser::ShowAppMenu() { + UserMetrics::RecordAction(L"ShowAppMenu", profile_); + window_->ShowAppMenu(); +} + +void Browser::ShowPageMenu() { + UserMetrics::RecordAction(L"ShowPageMenu", profile_); + window_->ShowPageMenu(); +} + void Browser::ShowHistoryTab() { UserMetrics::RecordAction(L"ShowHistory", profile_); ShowSingleDOMUITab(GURL(chrome::kChromeUIHistoryURL)); @@ -1418,6 +1430,8 @@ void Browser::ExecuteCommandWithDisposition( case IDC_SHOW_BOOKMARK_MANAGER: OpenBookmarkManager(); break; case IDC_SHOW_HISTORY: ShowHistoryTab(); break; case IDC_SHOW_DOWNLOADS: ShowDownloadsTab(); break; + case IDC_SHOW_APP_MENU: ShowAppMenu(); break; + case IDC_SHOW_PAGE_MENU: ShowPageMenu(); break; #ifdef CHROME_PERSONALIZATION case IDC_SYNC_BOOKMARKS: OpenSyncMyBookmarksDialog(); break; #endif diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h index be6af7e..fd33740 100644 --- a/chrome/browser/browser.h +++ b/chrome/browser/browser.h @@ -375,6 +375,8 @@ class Browser : public TabStripModelDelegate, void ToggleBookmarkBar(); void OpenBookmarkManager(); + void ShowAppMenu(); + void ShowPageMenu(); void ShowHistoryTab(); void ShowDownloadsTab(); void OpenClearBrowsingDataDialog(); diff --git a/chrome/browser/browser_window.h b/chrome/browser/browser_window.h index 041f471..a1dbe76 100644 --- a/chrome/browser/browser_window.h +++ b/chrome/browser/browser_window.h @@ -229,6 +229,12 @@ class BrowserWindow { const NavigationEntry::SSLStatus& ssl, bool show_history) = 0; + // Shows the page menu (for accessibility). + virtual void ShowPageMenu() = 0; + + // Shows the app menu (for accessibility). + virtual void ShowAppMenu() = 0; + // Construct a BrowserWindow implementation for the specified |browser|. static BrowserWindow* CreateBrowserWindow(Browser* browser); diff --git a/chrome/browser/cocoa/browser_window_cocoa.h b/chrome/browser/cocoa/browser_window_cocoa.h index c93b733..1635602 100644 --- a/chrome/browser/cocoa/browser_window_cocoa.h +++ b/chrome/browser/cocoa/browser_window_cocoa.h @@ -81,6 +81,8 @@ class BrowserWindowCocoa : public BrowserWindow, const GURL& url, const NavigationEntry::SSLStatus& ssl, bool show_history); + virtual void ShowPageMenu(); + virtual void ShowAppMenu(); // Overridden from NotificationObserver virtual void Observe(NotificationType type, diff --git a/chrome/browser/cocoa/browser_window_cocoa.mm b/chrome/browser/cocoa/browser_window_cocoa.mm index ff1d813..13ff5bb 100644 --- a/chrome/browser/cocoa/browser_window_cocoa.mm +++ b/chrome/browser/cocoa/browser_window_cocoa.mm @@ -277,6 +277,14 @@ void BrowserWindowCocoa::ShowPageInfo(Profile* profile, PageInfoWindowMac::ShowPageInfo(profile, url, ssl, show_history); } +void BrowserWindowCocoa::ShowPageMenu() { + // No-op. Mac doesn't support showing the menus via alt keys. +} + +void BrowserWindowCocoa::ShowAppMenu() { + // No-op. Mac doesn't support showing the menus via alt keys. +} + void BrowserWindowCocoa::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc index e95aca7..54dc79a 100644 --- a/chrome/browser/gtk/browser_window_gtk.cc +++ b/chrome/browser/gtk/browser_window_gtk.cc @@ -1040,6 +1040,12 @@ void BrowserWindowGtk::ShowPageInfo(Profile* profile, browser::ShowPageInfo(window_, profile, url, ssl, show_history); } +void BrowserWindowGtk::ShowPageMenu() { +} + +void BrowserWindowGtk::ShowAppMenu() { +} + void BrowserWindowGtk::ConfirmBrowserCloseWithPendingDownloads() { NOTIMPLEMENTED(); browser_->InProgressDownloadResponse(false); diff --git a/chrome/browser/gtk/browser_window_gtk.h b/chrome/browser/gtk/browser_window_gtk.h index 10e6dbb..0c684b2 100644 --- a/chrome/browser/gtk/browser_window_gtk.h +++ b/chrome/browser/gtk/browser_window_gtk.h @@ -112,6 +112,8 @@ class BrowserWindowGtk : public BrowserWindow, const GURL& url, const NavigationEntry::SSLStatus& ssl, bool show_history); + virtual void ShowPageMenu(); + virtual void ShowAppMenu(); // Overridden from NotificationObserver: virtual void Observe(NotificationType type, diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index 84cbf69..6dc9adf 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -970,6 +970,14 @@ void BrowserView::ShowPageInfo(Profile* profile, show_history); } +void BrowserView::ShowPageMenu() { + toolbar_->page_menu()->Activate(); +} + +void BrowserView::ShowAppMenu() { + toolbar_->app_menu()->Activate(); +} + /////////////////////////////////////////////////////////////////////////////// // BrowserView, BrowserWindowTesting implementation: diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h index c788a1c..d978c51 100644 --- a/chrome/browser/views/frame/browser_view.h +++ b/chrome/browser/views/frame/browser_view.h @@ -254,6 +254,8 @@ class BrowserView : public BrowserWindow, const GURL& url, const NavigationEntry::SSLStatus& ssl, bool show_history); + virtual void ShowAppMenu(); + virtual void ShowPageMenu(); // Overridden from BrowserWindowTesting: virtual BookmarkBarView* GetBookmarkBarView() const; diff --git a/chrome/browser/views/toolbar_view.h b/chrome/browser/views/toolbar_view.h index 1eaf928..ad81be4 100644 --- a/chrome/browser/views/toolbar_view.h +++ b/chrome/browser/views/toolbar_view.h @@ -105,6 +105,8 @@ class ToolbarView : public views::View, ToolbarStarToggle* star_button() const { return star_; } GoButton* go_button() const { return go_; } LocationBarView* location_bar() const { return location_bar_; } + views::MenuButton* page_menu() const { return page_menu_; } + views::MenuButton* app_menu() const { return app_menu_; } // Overridden from Menu::BaseControllerDelegate: virtual bool GetAcceleratorInfo(int id, views::Accelerator* accel); diff --git a/chrome/test/test_browser_window.h b/chrome/test/test_browser_window.h index 3d72111..a7a06db 100644 --- a/chrome/test/test_browser_window.h +++ b/chrome/test/test_browser_window.h @@ -49,6 +49,8 @@ class TestBrowserWindow : public BrowserWindow { virtual void UpdateToolbar(TabContents* contents, bool should_restore_state) {} virtual void FocusToolbar() {} + virtual void ShowPageMenu() {} + virtual void ShowAppMenu() {} virtual bool IsBookmarkBarVisible() const { return false; } virtual gfx::Rect GetRootWindowResizerRect() const { return gfx::Rect(); } virtual void ConfirmAddSearchProvider(const TemplateURL* template_url, |