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

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: fix assert in test 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 GoBack(browser_, disposition);
326 break;
327 case IDC_BACKSPACE_FORWARD:
328 if (base::FeatureList::IsEnabled(kBackspaceGoesBackFeature))
329 GoForward(browser_, disposition);
330 break;
318 case IDC_BACK: 331 case IDC_BACK:
319 GoBack(browser_, disposition); 332 GoBack(browser_, disposition);
320 break; 333 break;
Peter Kasting 2016/05/19 09:28:30 Nit: Slightly shorter, and abides by the comment a
ojan 2016/05/20 16:33:48 done
Matt Giuca 2016/05/23 01:12:01 Um, this is kind of gross and I'm going to have to
Matt Giuca 2016/05/23 01:15:40 Sorry, actually I can keep the conditional fall-th
321 case IDC_FORWARD: 334 case IDC_FORWARD:
322 GoForward(browser_, disposition); 335 GoForward(browser_, disposition);
323 break; 336 break;
324 case IDC_RELOAD: 337 case IDC_RELOAD:
325 Reload(browser_, disposition); 338 Reload(browser_, disposition);
326 break; 339 break;
327 case IDC_RELOAD_CLEARING_CACHE: 340 case IDC_RELOAD_CLEARING_CACHE:
328 ClearCache(browser_); 341 ClearCache(browser_);
329 // FALL THROUGH 342 // FALL THROUGH
330 case IDC_RELOAD_BYPASSING_CACHE: 343 case IDC_RELOAD_BYPASSING_CACHE:
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 } 984 }
972 } 985 }
973 986
974 void BrowserCommandController::UpdateCommandsForTabState() { 987 void BrowserCommandController::UpdateCommandsForTabState() {
975 WebContents* current_web_contents = 988 WebContents* current_web_contents =
976 browser_->tab_strip_model()->GetActiveWebContents(); 989 browser_->tab_strip_model()->GetActiveWebContents();
977 if (!current_web_contents) // May be NULL during tab restore. 990 if (!current_web_contents) // May be NULL during tab restore.
978 return; 991 return;
979 992
980 // Navigation commands 993 // Navigation commands
994 command_updater_.UpdateCommandEnabled(IDC_BACKSPACE_BACK,
995 CanGoBack(browser_));
996 command_updater_.UpdateCommandEnabled(IDC_BACKSPACE_FORWARD,
Peter Kasting 2016/05/19 09:28:30 Nit: Swap this with next line to keep the backs/fo
ojan 2016/05/20 16:33:48 done
997 CanGoForward(browser_));
981 command_updater_.UpdateCommandEnabled(IDC_BACK, CanGoBack(browser_)); 998 command_updater_.UpdateCommandEnabled(IDC_BACK, CanGoBack(browser_));
982 command_updater_.UpdateCommandEnabled(IDC_FORWARD, CanGoForward(browser_)); 999 command_updater_.UpdateCommandEnabled(IDC_FORWARD, CanGoForward(browser_));
983 command_updater_.UpdateCommandEnabled(IDC_RELOAD, CanReload(browser_)); 1000 command_updater_.UpdateCommandEnabled(IDC_RELOAD, CanReload(browser_));
984 command_updater_.UpdateCommandEnabled(IDC_RELOAD_BYPASSING_CACHE, 1001 command_updater_.UpdateCommandEnabled(IDC_RELOAD_BYPASSING_CACHE,
985 CanReload(browser_)); 1002 CanReload(browser_));
986 command_updater_.UpdateCommandEnabled(IDC_RELOAD_CLEARING_CACHE, 1003 command_updater_.UpdateCommandEnabled(IDC_RELOAD_CLEARING_CACHE,
987 CanReload(browser_)); 1004 CanReload(browser_));
988 1005
989 // Window management commands 1006 // Window management commands
990 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, 1007 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB,
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 1268
1252 BrowserWindow* BrowserCommandController::window() { 1269 BrowserWindow* BrowserCommandController::window() {
1253 return browser_->window(); 1270 return browser_->window();
1254 } 1271 }
1255 1272
1256 Profile* BrowserCommandController::profile() { 1273 Profile* BrowserCommandController::profile() {
1257 return browser_->profile(); 1274 return browser_->profile();
1258 } 1275 }
1259 1276
1260 } // namespace chrome 1277 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698