Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(760)

Side by Side Diff: chrome/browser/ui/browser_command_controller.cc

Issue 1992003002: Re-add backspace-goes-back as a default disabled finch trial (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address revieww comments Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/browser_command_controller.h" 5 #include "chrome/browser/ui/browser_command_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/debug/debugging_flags.h" 12 #include "base/debug/debugging_flags.h"
13 #include "base/debug/profiler.h" 13 #include "base/debug/profiler.h"
14 #include "base/feature_list.h"
14 #include "base/macros.h" 15 #include "base/macros.h"
15 #include "build/build_config.h" 16 #include "build/build_config.h"
16 #include "chrome/app/chrome_command_ids.h" 17 #include "chrome/app/chrome_command_ids.h"
17 #include "chrome/browser/browser_process.h" 18 #include "chrome/browser/browser_process.h"
18 #include "chrome/browser/chrome_notification_types.h" 19 #include "chrome/browser/chrome_notification_types.h"
19 #include "chrome/browser/defaults.h" 20 #include "chrome/browser/defaults.h"
20 #include "chrome/browser/extensions/extension_service.h" 21 #include "chrome/browser/extensions/extension_service.h"
21 #include "chrome/browser/extensions/extension_util.h" 22 #include "chrome/browser/extensions/extension_util.h"
22 #include "chrome/browser/lifetime/application_lifetime.h" 23 #include "chrome/browser/lifetime/application_lifetime.h"
23 #include "chrome/browser/prefs/incognito_mode_prefs.h" 24 #include "chrome/browser/prefs/incognito_mode_prefs.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 if (entry->GetVirtualURL().SchemeIs(content::kViewSourceScheme)) 111 if (entry->GetVirtualURL().SchemeIs(content::kViewSourceScheme))
111 return entry->GetURL().SchemeIs(content::kChromeUIScheme); 112 return entry->GetURL().SchemeIs(content::kChromeUIScheme);
112 113
113 return false; 114 return false;
114 } 115 }
115 116
116 } // namespace 117 } // namespace
117 118
118 namespace chrome { 119 namespace chrome {
119 120
121 const base::Feature kBackspaceGoesBackFeature {
122 "BackspaceGoesBack", base::FEATURE_DISABLED_BY_DEFAULT
123 };
124
120 /////////////////////////////////////////////////////////////////////////////// 125 ///////////////////////////////////////////////////////////////////////////////
121 // BrowserCommandController, public: 126 // BrowserCommandController, public:
122 127
123 BrowserCommandController::BrowserCommandController(Browser* browser) 128 BrowserCommandController::BrowserCommandController(Browser* browser)
124 : browser_(browser), 129 : browser_(browser),
125 command_updater_(this), 130 command_updater_(this),
126 block_command_execution_(false), 131 block_command_execution_(false),
127 last_blocked_command_id_(-1), 132 last_blocked_command_id_(-1),
128 last_blocked_command_disposition_(CURRENT_TAB) { 133 last_blocked_command_disposition_(CURRENT_TAB) {
129 browser_->tab_strip_model()->AddObserver(this); 134 browser_->tab_strip_model()->AddObserver(this);
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 DCHECK_EQ(last_blocked_command_id_, -1); 313 DCHECK_EQ(last_blocked_command_id_, -1);
309 last_blocked_command_id_ = id; 314 last_blocked_command_id_ = id;
310 last_blocked_command_disposition_ = disposition; 315 last_blocked_command_disposition_ = disposition;
311 return; 316 return;
312 } 317 }
313 318
314 // The order of commands in this switch statement must match the function 319 // The order of commands in this switch statement must match the function
315 // declaration order in browser.h! 320 // declaration order in browser.h!
316 switch (id) { 321 switch (id) {
317 // Navigation commands 322 // Navigation commands
323 case IDC_BACKSPACE_BACK:
324 if (!base::FeatureList::IsEnabled(kBackspaceGoesBackFeature))
325 break;
318 case IDC_BACK: 326 case IDC_BACK:
319 GoBack(browser_, disposition); 327 GoBack(browser_, disposition);
320 break; 328 break;
329 case IDC_BACKSPACE_FORWARD:
330 if (!base::FeatureList::IsEnabled(kBackspaceGoesBackFeature))
331 break;
321 case IDC_FORWARD: 332 case IDC_FORWARD:
322 GoForward(browser_, disposition); 333 GoForward(browser_, disposition);
323 break; 334 break;
324 case IDC_RELOAD: 335 case IDC_RELOAD:
325 Reload(browser_, disposition); 336 Reload(browser_, disposition);
326 break; 337 break;
327 case IDC_RELOAD_CLEARING_CACHE: 338 case IDC_RELOAD_CLEARING_CACHE:
328 ClearCache(browser_); 339 ClearCache(browser_);
329 // FALL THROUGH 340 // FALL THROUGH
330 case IDC_RELOAD_BYPASSING_CACHE: 341 case IDC_RELOAD_BYPASSING_CACHE:
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 } 982 }
972 } 983 }
973 984
974 void BrowserCommandController::UpdateCommandsForTabState() { 985 void BrowserCommandController::UpdateCommandsForTabState() {
975 WebContents* current_web_contents = 986 WebContents* current_web_contents =
976 browser_->tab_strip_model()->GetActiveWebContents(); 987 browser_->tab_strip_model()->GetActiveWebContents();
977 if (!current_web_contents) // May be NULL during tab restore. 988 if (!current_web_contents) // May be NULL during tab restore.
978 return; 989 return;
979 990
980 // Navigation commands 991 // Navigation commands
992 command_updater_.UpdateCommandEnabled(IDC_BACKSPACE_BACK,
993 CanGoBack(browser_));
981 command_updater_.UpdateCommandEnabled(IDC_BACK, CanGoBack(browser_)); 994 command_updater_.UpdateCommandEnabled(IDC_BACK, CanGoBack(browser_));
995 command_updater_.UpdateCommandEnabled(IDC_BACKSPACE_FORWARD,
996 CanGoForward(browser_));
982 command_updater_.UpdateCommandEnabled(IDC_FORWARD, CanGoForward(browser_)); 997 command_updater_.UpdateCommandEnabled(IDC_FORWARD, CanGoForward(browser_));
983 command_updater_.UpdateCommandEnabled(IDC_RELOAD, CanReload(browser_)); 998 command_updater_.UpdateCommandEnabled(IDC_RELOAD, CanReload(browser_));
984 command_updater_.UpdateCommandEnabled(IDC_RELOAD_BYPASSING_CACHE, 999 command_updater_.UpdateCommandEnabled(IDC_RELOAD_BYPASSING_CACHE,
985 CanReload(browser_)); 1000 CanReload(browser_));
986 command_updater_.UpdateCommandEnabled(IDC_RELOAD_CLEARING_CACHE, 1001 command_updater_.UpdateCommandEnabled(IDC_RELOAD_CLEARING_CACHE,
987 CanReload(browser_)); 1002 CanReload(browser_));
988 1003
989 // Window management commands 1004 // Window management commands
990 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, 1005 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB,
991 !browser_->is_app() && CanDuplicateTab(browser_)); 1006 !browser_->is_app() && CanDuplicateTab(browser_));
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 1266
1252 BrowserWindow* BrowserCommandController::window() { 1267 BrowserWindow* BrowserCommandController::window() {
1253 return browser_->window(); 1268 return browser_->window();
1254 } 1269 }
1255 1270
1256 Profile* BrowserCommandController::profile() { 1271 Profile* BrowserCommandController::profile() {
1257 return browser_->profile(); 1272 return browser_->profile();
1258 } 1273 }
1259 1274
1260 } // namespace chrome 1275 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/global_keyboard_shortcuts_mac_unittest.mm ('k') | chrome/browser/ui/views/accelerator_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698