| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 if (entry->GetVirtualURL().SchemeIs(content::kViewSourceScheme)) | 112 if (entry->GetVirtualURL().SchemeIs(content::kViewSourceScheme)) |
| 112 return entry->GetURL().SchemeIs(content::kChromeUIScheme); | 113 return entry->GetURL().SchemeIs(content::kChromeUIScheme); |
| 113 | 114 |
| 114 return false; | 115 return false; |
| 115 } | 116 } |
| 116 | 117 |
| 117 } // namespace | 118 } // namespace |
| 118 | 119 |
| 119 namespace chrome { | 120 namespace chrome { |
| 120 | 121 |
| 121 const base::Feature kBackspaceGoesBackFeature { | |
| 122 "BackspaceGoesBack", base::FEATURE_DISABLED_BY_DEFAULT | |
| 123 }; | |
| 124 | |
| 125 /////////////////////////////////////////////////////////////////////////////// | 122 /////////////////////////////////////////////////////////////////////////////// |
| 126 // BrowserCommandController, public: | 123 // BrowserCommandController, public: |
| 127 | 124 |
| 128 BrowserCommandController::BrowserCommandController(Browser* browser) | 125 BrowserCommandController::BrowserCommandController(Browser* browser) |
| 129 : browser_(browser), | 126 : browser_(browser), |
| 130 command_updater_(this), | 127 command_updater_(this), |
| 131 block_command_execution_(false), | 128 block_command_execution_(false), |
| 132 last_blocked_command_id_(-1), | 129 last_blocked_command_id_(-1), |
| 133 last_blocked_command_disposition_(CURRENT_TAB) { | 130 last_blocked_command_disposition_(CURRENT_TAB) { |
| 134 browser_->tab_strip_model()->AddObserver(this); | 131 browser_->tab_strip_model()->AddObserver(this); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 last_blocked_command_id_ = id; | 311 last_blocked_command_id_ = id; |
| 315 last_blocked_command_disposition_ = disposition; | 312 last_blocked_command_disposition_ = disposition; |
| 316 return; | 313 return; |
| 317 } | 314 } |
| 318 | 315 |
| 319 // The order of commands in this switch statement must match the function | 316 // The order of commands in this switch statement must match the function |
| 320 // declaration order in browser.h! | 317 // declaration order in browser.h! |
| 321 switch (id) { | 318 switch (id) { |
| 322 // Navigation commands | 319 // Navigation commands |
| 323 case IDC_BACKSPACE_BACK: | 320 case IDC_BACKSPACE_BACK: |
| 324 if (base::FeatureList::IsEnabled(kBackspaceGoesBackFeature)) | 321 if (base::FeatureList::IsEnabled(features::kBackspaceGoesBackFeature)) |
| 325 GoBack(browser_, disposition); | 322 GoBack(browser_, disposition); |
| 326 else | 323 else |
| 327 browser_->window()->MaybeShowNewBackShortcutBubble(false); | 324 browser_->window()->MaybeShowNewBackShortcutBubble(false); |
| 328 break; | 325 break; |
| 329 case IDC_BACK: | 326 case IDC_BACK: |
| 330 browser_->window()->HideNewBackShortcutBubble(); | 327 browser_->window()->HideNewBackShortcutBubble(); |
| 331 GoBack(browser_, disposition); | 328 GoBack(browser_, disposition); |
| 332 break; | 329 break; |
| 333 case IDC_BACKSPACE_FORWARD: | 330 case IDC_BACKSPACE_FORWARD: |
| 334 if (base::FeatureList::IsEnabled(kBackspaceGoesBackFeature)) | 331 if (base::FeatureList::IsEnabled(features::kBackspaceGoesBackFeature)) |
| 335 GoForward(browser_, disposition); | 332 GoForward(browser_, disposition); |
| 336 else | 333 else |
| 337 browser_->window()->MaybeShowNewBackShortcutBubble(true); | 334 browser_->window()->MaybeShowNewBackShortcutBubble(true); |
| 338 break; | 335 break; |
| 339 case IDC_FORWARD: | 336 case IDC_FORWARD: |
| 340 browser_->window()->HideNewBackShortcutBubble(); | 337 browser_->window()->HideNewBackShortcutBubble(); |
| 341 GoForward(browser_, disposition); | 338 GoForward(browser_, disposition); |
| 342 break; | 339 break; |
| 343 case IDC_RELOAD: | 340 case IDC_RELOAD: |
| 344 Reload(browser_, disposition); | 341 Reload(browser_, disposition); |
| (...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1270 | 1267 |
| 1271 BrowserWindow* BrowserCommandController::window() { | 1268 BrowserWindow* BrowserCommandController::window() { |
| 1272 return browser_->window(); | 1269 return browser_->window(); |
| 1273 } | 1270 } |
| 1274 | 1271 |
| 1275 Profile* BrowserCommandController::profile() { | 1272 Profile* BrowserCommandController::profile() { |
| 1276 return browser_->profile(); | 1273 return browser_->profile(); |
| 1277 } | 1274 } |
| 1278 | 1275 |
| 1279 } // namespace chrome | 1276 } // namespace chrome |
| OLD | NEW |