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

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

Issue 10945010: Switch BookmarkTabHelper to use WebContentsUserData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 3 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 | Annotate | Revision Log
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 "chrome/app/chrome_command_ids.h" 7 #include "chrome/app/chrome_command_ids.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/defaults.h" 9 #include "chrome/browser/defaults.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 939
940 const bool show_main_ui = 940 const bool show_main_ui =
941 IsShowingMainUI(window() && window()->IsFullscreen()); 941 IsShowingMainUI(window() && window()->IsFullscreen());
942 command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS, 942 command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS,
943 show_main_ui && command_enabled); 943 show_main_ui && command_enabled);
944 command_updater_.UpdateCommandEnabled(IDC_OPTIONS, 944 command_updater_.UpdateCommandEnabled(IDC_OPTIONS,
945 show_main_ui && command_enabled); 945 show_main_ui && command_enabled);
946 } 946 }
947 947
948 void BrowserCommandController::UpdateCommandsForTabState() { 948 void BrowserCommandController::UpdateCommandsForTabState() {
949 TabContents* current_tab_contents = chrome::GetActiveTabContents(browser_); 949 WebContents* current_web_contents = chrome::GetActiveWebContents(browser_);
950 if (!current_tab_contents) // May be NULL during tab restore. 950 if (!current_web_contents) // May be NULL during tab restore.
951 return; 951 return;
952 WebContents* current_web_contents = current_tab_contents->web_contents();
953 952
954 // Navigation commands 953 // Navigation commands
955 command_updater_.UpdateCommandEnabled(IDC_BACK, CanGoBack(browser_)); 954 command_updater_.UpdateCommandEnabled(IDC_BACK, CanGoBack(browser_));
956 command_updater_.UpdateCommandEnabled(IDC_FORWARD, CanGoForward(browser_)); 955 command_updater_.UpdateCommandEnabled(IDC_FORWARD, CanGoForward(browser_));
957 command_updater_.UpdateCommandEnabled(IDC_RELOAD, CanReload(browser_)); 956 command_updater_.UpdateCommandEnabled(IDC_RELOAD, CanReload(browser_));
958 command_updater_.UpdateCommandEnabled(IDC_RELOAD_IGNORING_CACHE, 957 command_updater_.UpdateCommandEnabled(IDC_RELOAD_IGNORING_CACHE,
959 CanReload(browser_)); 958 CanReload(browser_));
960 command_updater_.UpdateCommandEnabled(IDC_RELOAD_CLEARING_CACHE, 959 command_updater_.UpdateCommandEnabled(IDC_RELOAD_CLEARING_CACHE,
961 CanReload(browser_)); 960 CanReload(browser_));
962 961
963 // Window management commands 962 // Window management commands
964 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, 963 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB,
965 !browser_->is_app() && CanDuplicateTab(browser_)); 964 !browser_->is_app() && CanDuplicateTab(browser_));
966 965
967 // Page-related commands 966 // Page-related commands
968 window()->SetStarredState( 967 window()->SetStarredState(
969 current_tab_contents->bookmark_tab_helper()->is_starred()); 968 BookmarkTabHelper::FromWebContents(current_web_contents)->is_starred());
970 window()->ZoomChangedForActiveTab(false); 969 window()->ZoomChangedForActiveTab(false);
971 command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE, 970 command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE,
972 CanViewSource(browser_)); 971 CanViewSource(browser_));
973 command_updater_.UpdateCommandEnabled(IDC_EMAIL_PAGE_LOCATION, 972 command_updater_.UpdateCommandEnabled(IDC_EMAIL_PAGE_LOCATION,
974 CanEmailPageLocation(browser_)); 973 CanEmailPageLocation(browser_));
975 if (browser_->is_devtools()) 974 if (browser_->is_devtools())
976 command_updater_.UpdateCommandEnabled(IDC_OPEN_FILE, false); 975 command_updater_.UpdateCommandEnabled(IDC_OPEN_FILE, false);
977 976
978 // Changing the encoding is not possible on Chrome-internal webpages. 977 // Changing the encoding is not possible on Chrome-internal webpages.
979 NavigationController& nc = current_web_contents->GetController(); 978 NavigationController& nc = current_web_contents->GetController();
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1166 1165
1167 BrowserWindow* BrowserCommandController::window() { 1166 BrowserWindow* BrowserCommandController::window() {
1168 return browser_->window(); 1167 return browser_->window();
1169 } 1168 }
1170 1169
1171 Profile* BrowserCommandController::profile() { 1170 Profile* BrowserCommandController::profile() {
1172 return browser_->profile(); 1171 return browser_->profile();
1173 } 1172 }
1174 1173
1175 } // namespace chrome 1174 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_adoption.cc ('k') | chrome/browser/ui/cocoa/browser_window_controller_private.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698