summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser.cc
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-16 19:51:56 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-16 19:51:56 +0000
commitd56bcd21c5842c72ec0a8cd14c910e1dd4ed7048 (patch)
treeeb64e16a90396c8be28d8ddece03c7f8bf0e4c5e /chrome/browser/browser.cc
parent79106726b69152f8ef4bb1a711e3c1d9c7e033f6 (diff)
downloadchromium_src-d56bcd21c5842c72ec0a8cd14c910e1dd4ed7048.zip
chromium_src-d56bcd21c5842c72ec0a8cd14c910e1dd4ed7048.tar.gz
chromium_src-d56bcd21c5842c72ec0a8cd14c910e1dd4ed7048.tar.bz2
Linux accelerators cleanup:
- Give renderer a chance to handle accelerators before browser does. - Handle browser accelerators that aren't attached to any particular UI element in BrowserWindowGtk rather than in BrowserToolbarGtk - Use Browser::ExecuteCommand() to handle accelerator activation - Switch a random void* to gfx::NativeWindow - Enable three browser commands on linux : Focus Location, Focus Search, Open file This fully enables ctrl-l, ctrl-k, and ctrl-o. This fixes copy-pasta in the omnibox. This fixes the problem Dean described with <http://www.quirksmode.org/js/keys.html>. bug=8659 Review URL: http://codereview.chromium.org/42190 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11759 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser.cc')
-rw-r--r--chrome/browser/browser.cc20
1 files changed, 16 insertions, 4 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index baf46a6..6c5a2c6 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -904,10 +904,12 @@ void Browser::FocusToolbar() {
UserMetrics::RecordAction(L"FocusToolbar", profile_);
window_->FocusToolbar();
}
+#endif
+#if defined(OS_WIN) || defined(OS_LINUX)
void Browser::FocusLocationBar() {
UserMetrics::RecordAction(L"FocusLocation", profile_);
- window_->GetLocationBar()->FocusLocation();
+ window_->SetFocusToLocationBar();
}
void Browser::FocusSearch() {
@@ -915,20 +917,24 @@ void Browser::FocusSearch() {
UserMetrics::RecordAction(L"FocusSearch", profile_);
window_->GetLocationBar()->FocusSearch();
}
+#endif
+#if defined(OS_WIN) || defined(OS_LINUX)
void Browser::OpenFile() {
UserMetrics::RecordAction(L"OpenFile", profile_);
if (!select_file_dialog_.get())
select_file_dialog_ = SelectFileDialog::Create(this);
// TODO(beng): figure out how to juggle this.
- HWND parent_hwnd = reinterpret_cast<HWND>(window_->GetNativeHandle());
+ gfx::NativeWindow parent_window = window_->GetNativeHandle();
select_file_dialog_->SelectFile(SelectFileDialog::SELECT_OPEN_FILE,
std::wstring(), std::wstring(),
std::wstring(), std::wstring(),
- parent_hwnd, NULL);
+ parent_window, NULL);
}
+#endif
+#if defined(OS_WIN)
void Browser::OpenCreateShortcutsDialog() {
UserMetrics::RecordAction(L"CreateShortcut", profile_);
GetSelectedTabContents()->AsWebContents()->CreateShortcut();
@@ -1215,14 +1221,20 @@ void Browser::ExecuteCommand(int id) {
case IDC_ZOOM_NORMAL: ZoomReset(); break;
case IDC_ZOOM_MINUS: ZoomOut(); break;
-#if defined(OS_WIN)
// Focus various bits of UI
+#if defined(OS_WIN)
case IDC_FOCUS_TOOLBAR: FocusToolbar(); break;
+#endif
+#if defined(OS_WIN) || defined(OS_LINUX)
case IDC_FOCUS_LOCATION: FocusLocationBar(); break;
case IDC_FOCUS_SEARCH: FocusSearch(); break;
+#endif
// Show various bits of UI
+#if defined(OS_WIN)|| defined(OS_LINUX)
case IDC_OPEN_FILE: OpenFile(); break;
+#endif
+#if defined(OS_WIN)
case IDC_CREATE_SHORTCUTS: OpenCreateShortcutsDialog(); break;
case IDC_DEBUGGER: OpenDebuggerWindow(); break;
case IDC_JS_CONSOLE: OpenJavaScriptConsole(); break;