| OLD | NEW |
| 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 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "chrome/browser/signin/signin_promo.h" | 29 #include "chrome/browser/signin/signin_promo.h" |
| 30 #include "chrome/browser/sync/profile_sync_service_factory.h" | 30 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 31 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 31 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
| 32 #include "chrome/browser/ui/browser.h" | 32 #include "chrome/browser/ui/browser.h" |
| 33 #include "chrome/browser/ui/browser_commands.h" | 33 #include "chrome/browser/ui/browser_commands.h" |
| 34 #include "chrome/browser/ui/browser_window.h" | 34 #include "chrome/browser/ui/browser_window.h" |
| 35 #include "chrome/browser/ui/chrome_pages.h" | 35 #include "chrome/browser/ui/chrome_pages.h" |
| 36 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 36 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 37 #include "chrome/browser/ui/tabs/tab_strip_model_utils.h" | 37 #include "chrome/browser/ui/tabs/tab_strip_model_utils.h" |
| 38 #include "chrome/browser/ui/webui/inspect_ui.h" | 38 #include "chrome/browser/ui/webui/inspect_ui.h" |
| 39 #include "chrome/common/chrome_features.h" |
| 39 #include "chrome/common/content_restriction.h" | 40 #include "chrome/common/content_restriction.h" |
| 40 #include "chrome/common/pref_names.h" | 41 #include "chrome/common/pref_names.h" |
| 41 #include "chrome/common/profiling.h" | 42 #include "chrome/common/profiling.h" |
| 42 #include "components/bookmarks/common/bookmark_pref_names.h" | 43 #include "components/bookmarks/common/bookmark_pref_names.h" |
| 43 #include "components/browser_sync/browser/profile_sync_service.h" | 44 #include "components/browser_sync/browser/profile_sync_service.h" |
| 44 #include "components/dom_distiller/core/dom_distiller_switches.h" | 45 #include "components/dom_distiller/core/dom_distiller_switches.h" |
| 45 #include "components/prefs/pref_service.h" | 46 #include "components/prefs/pref_service.h" |
| 46 #include "components/sessions/core/tab_restore_service.h" | 47 #include "components/sessions/core/tab_restore_service.h" |
| 47 #include "components/signin/core/common/signin_pref_names.h" | 48 #include "components/signin/core/common/signin_pref_names.h" |
| 48 #include "content/public/browser/native_web_keyboard_event.h" | 49 #include "content/public/browser/native_web_keyboard_event.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 if (entry->GetVirtualURL().SchemeIs(content::kViewSourceScheme)) | 109 if (entry->GetVirtualURL().SchemeIs(content::kViewSourceScheme)) |
| 109 return entry->GetURL().SchemeIs(content::kChromeUIScheme); | 110 return entry->GetURL().SchemeIs(content::kChromeUIScheme); |
| 110 | 111 |
| 111 return false; | 112 return false; |
| 112 } | 113 } |
| 113 | 114 |
| 114 } // namespace | 115 } // namespace |
| 115 | 116 |
| 116 namespace chrome { | 117 namespace chrome { |
| 117 | 118 |
| 118 const base::Feature kBackspaceGoesBackFeature { | |
| 119 "BackspaceGoesBack", base::FEATURE_DISABLED_BY_DEFAULT | |
| 120 }; | |
| 121 | |
| 122 /////////////////////////////////////////////////////////////////////////////// | 119 /////////////////////////////////////////////////////////////////////////////// |
| 123 // BrowserCommandController, public: | 120 // BrowserCommandController, public: |
| 124 | 121 |
| 125 BrowserCommandController::BrowserCommandController(Browser* browser) | 122 BrowserCommandController::BrowserCommandController(Browser* browser) |
| 126 : browser_(browser), | 123 : browser_(browser), |
| 127 command_updater_(this), | 124 command_updater_(this), |
| 128 block_command_execution_(false), | 125 block_command_execution_(false), |
| 129 last_blocked_command_id_(-1), | 126 last_blocked_command_id_(-1), |
| 130 last_blocked_command_disposition_(CURRENT_TAB) { | 127 last_blocked_command_disposition_(CURRENT_TAB) { |
| 131 browser_->tab_strip_model()->AddObserver(this); | 128 browser_->tab_strip_model()->AddObserver(this); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 last_blocked_command_id_ = id; | 308 last_blocked_command_id_ = id; |
| 312 last_blocked_command_disposition_ = disposition; | 309 last_blocked_command_disposition_ = disposition; |
| 313 return; | 310 return; |
| 314 } | 311 } |
| 315 | 312 |
| 316 // The order of commands in this switch statement must match the function | 313 // The order of commands in this switch statement must match the function |
| 317 // declaration order in browser.h! | 314 // declaration order in browser.h! |
| 318 switch (id) { | 315 switch (id) { |
| 319 // Navigation commands | 316 // Navigation commands |
| 320 case IDC_BACKSPACE_BACK: | 317 case IDC_BACKSPACE_BACK: |
| 321 if (base::FeatureList::IsEnabled(kBackspaceGoesBackFeature)) | 318 if (base::FeatureList::IsEnabled(features::kBackspaceGoesBackFeature)) |
| 322 GoBack(browser_, disposition); | 319 GoBack(browser_, disposition); |
| 323 else | 320 else |
| 324 browser_->window()->MaybeShowNewBackShortcutBubble(false); | 321 browser_->window()->MaybeShowNewBackShortcutBubble(false); |
| 325 break; | 322 break; |
| 326 case IDC_BACK: | 323 case IDC_BACK: |
| 327 browser_->window()->HideNewBackShortcutBubble(); | 324 browser_->window()->HideNewBackShortcutBubble(); |
| 328 GoBack(browser_, disposition); | 325 GoBack(browser_, disposition); |
| 329 break; | 326 break; |
| 330 case IDC_BACKSPACE_FORWARD: | 327 case IDC_BACKSPACE_FORWARD: |
| 331 if (base::FeatureList::IsEnabled(kBackspaceGoesBackFeature)) | 328 if (base::FeatureList::IsEnabled(features::kBackspaceGoesBackFeature)) |
| 332 GoForward(browser_, disposition); | 329 GoForward(browser_, disposition); |
| 333 else | 330 else |
| 334 browser_->window()->MaybeShowNewBackShortcutBubble(true); | 331 browser_->window()->MaybeShowNewBackShortcutBubble(true); |
| 335 break; | 332 break; |
| 336 case IDC_FORWARD: | 333 case IDC_FORWARD: |
| 337 browser_->window()->HideNewBackShortcutBubble(); | 334 browser_->window()->HideNewBackShortcutBubble(); |
| 338 GoForward(browser_, disposition); | 335 GoForward(browser_, disposition); |
| 339 break; | 336 break; |
| 340 case IDC_RELOAD: | 337 case IDC_RELOAD: |
| 341 Reload(browser_, disposition); | 338 Reload(browser_, disposition); |
| (...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1267 | 1264 |
| 1268 BrowserWindow* BrowserCommandController::window() { | 1265 BrowserWindow* BrowserCommandController::window() { |
| 1269 return browser_->window(); | 1266 return browser_->window(); |
| 1270 } | 1267 } |
| 1271 | 1268 |
| 1272 Profile* BrowserCommandController::profile() { | 1269 Profile* BrowserCommandController::profile() { |
| 1273 return browser_->profile(); | 1270 return browser_->profile(); |
| 1274 } | 1271 } |
| 1275 | 1272 |
| 1276 } // namespace chrome | 1273 } // namespace chrome |
| OLD | NEW |