| 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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 break; | 320 break; |
| 321 case IDC_FORWARD: | 321 case IDC_FORWARD: |
| 322 GoForward(browser_, disposition); | 322 GoForward(browser_, disposition); |
| 323 break; | 323 break; |
| 324 case IDC_RELOAD: | 324 case IDC_RELOAD: |
| 325 Reload(browser_, disposition); | 325 Reload(browser_, disposition); |
| 326 break; | 326 break; |
| 327 case IDC_RELOAD_CLEARING_CACHE: | 327 case IDC_RELOAD_CLEARING_CACHE: |
| 328 ClearCache(browser_); | 328 ClearCache(browser_); |
| 329 // FALL THROUGH | 329 // FALL THROUGH |
| 330 case IDC_RELOAD_IGNORING_CACHE: | 330 case IDC_RELOAD_BYPASSING_CACHE: |
| 331 ReloadIgnoringCache(browser_, disposition); | 331 ReloadBypassingCache(browser_, disposition); |
| 332 break; | 332 break; |
| 333 case IDC_HOME: | 333 case IDC_HOME: |
| 334 Home(browser_, disposition); | 334 Home(browser_, disposition); |
| 335 break; | 335 break; |
| 336 case IDC_OPEN_CURRENT_URL: | 336 case IDC_OPEN_CURRENT_URL: |
| 337 OpenCurrentURL(browser_); | 337 OpenCurrentURL(browser_); |
| 338 break; | 338 break; |
| 339 case IDC_STOP: | 339 case IDC_STOP: |
| 340 Stop(browser_); | 340 Stop(browser_); |
| 341 break; | 341 break; |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 return browser_->is_type_tabbed() && !should_hide_ui; | 781 return browser_->is_type_tabbed() && !should_hide_ui; |
| 782 } | 782 } |
| 783 | 783 |
| 784 void BrowserCommandController::InitCommandState() { | 784 void BrowserCommandController::InitCommandState() { |
| 785 // All browser commands whose state isn't set automagically some other way | 785 // All browser commands whose state isn't set automagically some other way |
| 786 // (like Back & Forward with initial page load) must have their state | 786 // (like Back & Forward with initial page load) must have their state |
| 787 // initialized here, otherwise they will be forever disabled. | 787 // initialized here, otherwise they will be forever disabled. |
| 788 | 788 |
| 789 // Navigation commands | 789 // Navigation commands |
| 790 command_updater_.UpdateCommandEnabled(IDC_RELOAD, true); | 790 command_updater_.UpdateCommandEnabled(IDC_RELOAD, true); |
| 791 command_updater_.UpdateCommandEnabled(IDC_RELOAD_IGNORING_CACHE, true); | 791 command_updater_.UpdateCommandEnabled(IDC_RELOAD_BYPASSING_CACHE, true); |
| 792 command_updater_.UpdateCommandEnabled(IDC_RELOAD_CLEARING_CACHE, true); | 792 command_updater_.UpdateCommandEnabled(IDC_RELOAD_CLEARING_CACHE, true); |
| 793 | 793 |
| 794 // Window management commands | 794 // Window management commands |
| 795 command_updater_.UpdateCommandEnabled(IDC_CLOSE_WINDOW, true); | 795 command_updater_.UpdateCommandEnabled(IDC_CLOSE_WINDOW, true); |
| 796 command_updater_.UpdateCommandEnabled(IDC_NEW_TAB, true); | 796 command_updater_.UpdateCommandEnabled(IDC_NEW_TAB, true); |
| 797 command_updater_.UpdateCommandEnabled(IDC_CLOSE_TAB, true); | 797 command_updater_.UpdateCommandEnabled(IDC_CLOSE_TAB, true); |
| 798 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, true); | 798 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, true); |
| 799 UpdateTabRestoreCommandState(); | 799 UpdateTabRestoreCommandState(); |
| 800 command_updater_.UpdateCommandEnabled(IDC_EXIT, true); | 800 command_updater_.UpdateCommandEnabled(IDC_EXIT, true); |
| 801 command_updater_.UpdateCommandEnabled(IDC_DEBUG_FRAME_TOGGLE, true); | 801 command_updater_.UpdateCommandEnabled(IDC_DEBUG_FRAME_TOGGLE, true); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 void BrowserCommandController::UpdateCommandsForTabState() { | 977 void BrowserCommandController::UpdateCommandsForTabState() { |
| 978 WebContents* current_web_contents = | 978 WebContents* current_web_contents = |
| 979 browser_->tab_strip_model()->GetActiveWebContents(); | 979 browser_->tab_strip_model()->GetActiveWebContents(); |
| 980 if (!current_web_contents) // May be NULL during tab restore. | 980 if (!current_web_contents) // May be NULL during tab restore. |
| 981 return; | 981 return; |
| 982 | 982 |
| 983 // Navigation commands | 983 // Navigation commands |
| 984 command_updater_.UpdateCommandEnabled(IDC_BACK, CanGoBack(browser_)); | 984 command_updater_.UpdateCommandEnabled(IDC_BACK, CanGoBack(browser_)); |
| 985 command_updater_.UpdateCommandEnabled(IDC_FORWARD, CanGoForward(browser_)); | 985 command_updater_.UpdateCommandEnabled(IDC_FORWARD, CanGoForward(browser_)); |
| 986 command_updater_.UpdateCommandEnabled(IDC_RELOAD, CanReload(browser_)); | 986 command_updater_.UpdateCommandEnabled(IDC_RELOAD, CanReload(browser_)); |
| 987 command_updater_.UpdateCommandEnabled(IDC_RELOAD_IGNORING_CACHE, | 987 command_updater_.UpdateCommandEnabled(IDC_RELOAD_BYPASSING_CACHE, |
| 988 CanReload(browser_)); | 988 CanReload(browser_)); |
| 989 command_updater_.UpdateCommandEnabled(IDC_RELOAD_CLEARING_CACHE, | 989 command_updater_.UpdateCommandEnabled(IDC_RELOAD_CLEARING_CACHE, |
| 990 CanReload(browser_)); | 990 CanReload(browser_)); |
| 991 | 991 |
| 992 // Window management commands | 992 // Window management commands |
| 993 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, | 993 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, |
| 994 !browser_->is_app() && CanDuplicateTab(browser_)); | 994 !browser_->is_app() && CanDuplicateTab(browser_)); |
| 995 | 995 |
| 996 // Page-related commands | 996 // Page-related commands |
| 997 window()->SetStarredState( | 997 window()->SetStarredState( |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1256 | 1256 |
| 1257 BrowserWindow* BrowserCommandController::window() { | 1257 BrowserWindow* BrowserCommandController::window() { |
| 1258 return browser_->window(); | 1258 return browser_->window(); |
| 1259 } | 1259 } |
| 1260 | 1260 |
| 1261 Profile* BrowserCommandController::profile() { | 1261 Profile* BrowserCommandController::profile() { |
| 1262 return browser_->profile(); | 1262 return browser_->profile(); |
| 1263 } | 1263 } |
| 1264 | 1264 |
| 1265 } // namespace chrome | 1265 } // namespace chrome |
| OLD | NEW |