summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorjcivelli@chromium.org <jcivelli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-01 21:08:33 +0000
committerjcivelli@chromium.org <jcivelli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-01 21:08:33 +0000
commitf97d7f638e2c076b4646a09a663b372493009594 (patch)
treeac7584d8fee9495345dc4703a71714a0552efd64 /chrome/browser
parentb3cbcad170eb001ef8e8be9b80a38bafc6b7597f (diff)
downloadchromium_src-f97d7f638e2c076b4646a09a663b372493009594.zip
chromium_src-f97d7f638e2c076b4646a09a663b372493009594.tar.gz
chromium_src-f97d7f638e2c076b4646a09a663b372493009594.tar.bz2
Pressing the search button brings the NTP or close it if it is opened.
Note: this requires the WebKit https://bugs.webkit.org/show_bug.cgi?id=39752 to work. BUG=3404 TEST=See bug. Review URL: http://codereview.chromium.org/2260004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48658 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/browser.cc16
-rw-r--r--chrome/browser/browser.h1
-rw-r--r--chrome/browser/views/accelerator_table_gtk.cc1
3 files changed, 17 insertions, 1 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 11b759c..2cca704 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -1391,6 +1391,17 @@ void Browser::ToggleCompactNavigationBar() {
profile_);
window_->ToggleCompactNavigationBar();
}
+
+void Browser::Search() {
+ // If the NTP is showing, close it.
+ if (StartsWithASCII(GetSelectedTabContents()->GetURL().spec(),
+ chrome::kChromeUINewTabURL, true)) {
+ CloseTab();
+ return;
+ }
+ // Otherwise just open it.
+ NewTab();
+}
#endif
void Browser::Exit() {
@@ -1952,6 +1963,7 @@ void Browser::ExecuteCommandWithDisposition(
case IDC_TOGGLE_VERTICAL_TABS: ToggleUseVerticalTabs(); break;
#if defined(OS_CHROMEOS)
case IDC_COMPACT_NAVBAR: ToggleCompactNavigationBar(); break;
+ case IDC_SEARCH: Search(); break;
#endif
// Page-related commands
@@ -2076,7 +2088,8 @@ bool Browser::IsReservedCommand(int command_id) {
command_id == IDC_RESTORE_TAB ||
command_id == IDC_SELECT_NEXT_TAB ||
command_id == IDC_SELECT_PREVIOUS_TAB ||
- command_id == IDC_EXIT;
+ command_id == IDC_EXIT ||
+ command_id == IDC_SEARCH;
}
void Browser::SetBlockCommandExecution(bool block) {
@@ -3087,6 +3100,7 @@ void Browser::InitCommandState() {
#if defined(OS_CHROMEOS)
command_updater_.UpdateCommandEnabled(IDC_COMPACT_NAVBAR, true);
+ command_updater_.UpdateCommandEnabled(IDC_SEARCH, true);
command_updater_.UpdateCommandEnabled(IDC_SYSTEM_OPTIONS, true);
command_updater_.UpdateCommandEnabled(IDC_INTERNET_OPTIONS, true);
command_updater_.UpdateCommandEnabled(IDC_EXPERIMENTAL, true);
diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h
index 29d81ea..bc9815e 100644
--- a/chrome/browser/browser.h
+++ b/chrome/browser/browser.h
@@ -458,6 +458,7 @@ class Browser : public TabStripModelDelegate,
void Exit();
#if defined(OS_CHROMEOS)
void ToggleCompactNavigationBar();
+ void Search();
#endif
// Page-related commands
diff --git a/chrome/browser/views/accelerator_table_gtk.cc b/chrome/browser/views/accelerator_table_gtk.cc
index 9e1f6c9..3edd0e9 100644
--- a/chrome/browser/views/accelerator_table_gtk.cc
+++ b/chrome/browser/views/accelerator_table_gtk.cc
@@ -138,6 +138,7 @@ const AcceleratorMapping kAcceleratorMap[] = {
#if defined(OS_CHROMEOS)
{ base::VKEY_C, true, true, false, IDC_COMPACT_NAVBAR },
{ base::VKEY_F, false, true, true, IDC_FULLSCREEN },
+ { base::VKEY_LWIN, false, false, false, IDC_SEARCH },
#endif
};