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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 &BrowserCommandController::UpdateCommandsForFileSelectionDialogs, | 199 &BrowserCommandController::UpdateCommandsForFileSelectionDialogs, |
200 base::Unretained(this))); | 200 base::Unretained(this))); |
201 } | 201 } |
202 | 202 |
203 profile_pref_registrar_.Init(profile()->GetPrefs()); | 203 profile_pref_registrar_.Init(profile()->GetPrefs()); |
204 profile_pref_registrar_.Add( | 204 profile_pref_registrar_.Add( |
205 prefs::kDevToolsDisabled, | 205 prefs::kDevToolsDisabled, |
206 base::Bind(&BrowserCommandController::UpdateCommandsForDevTools, | 206 base::Bind(&BrowserCommandController::UpdateCommandsForDevTools, |
207 base::Unretained(this))); | 207 base::Unretained(this))); |
208 profile_pref_registrar_.Add( | 208 profile_pref_registrar_.Add( |
209 prefs::kEditBookmarksEnabled, | 209 bookmarks::prefs::kEditBookmarksEnabled, |
210 base::Bind(&BrowserCommandController::UpdateCommandsForBookmarkEditing, | 210 base::Bind(&BrowserCommandController::UpdateCommandsForBookmarkEditing, |
211 base::Unretained(this))); | 211 base::Unretained(this))); |
212 profile_pref_registrar_.Add( | 212 profile_pref_registrar_.Add( |
213 prefs::kShowBookmarkBar, | 213 bookmarks::prefs::kShowBookmarkBar, |
214 base::Bind(&BrowserCommandController::UpdateCommandsForBookmarkBar, | 214 base::Bind(&BrowserCommandController::UpdateCommandsForBookmarkBar, |
215 base::Unretained(this))); | 215 base::Unretained(this))); |
216 profile_pref_registrar_.Add( | 216 profile_pref_registrar_.Add( |
217 prefs::kIncognitoModeAvailability, | 217 prefs::kIncognitoModeAvailability, |
218 base::Bind( | 218 base::Bind( |
219 &BrowserCommandController::UpdateCommandsForIncognitoAvailability, | 219 &BrowserCommandController::UpdateCommandsForIncognitoAvailability, |
220 base::Unretained(this))); | 220 base::Unretained(this))); |
221 profile_pref_registrar_.Add( | 221 profile_pref_registrar_.Add( |
222 prefs::kPrintingEnabled, | 222 prefs::kPrintingEnabled, |
223 base::Bind(&BrowserCommandController::UpdatePrintingState, | 223 base::Bind(&BrowserCommandController::UpdatePrintingState, |
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1171 void BrowserCommandController::UpdateCommandsForBookmarkEditing() { | 1171 void BrowserCommandController::UpdateCommandsForBookmarkEditing() { |
1172 command_updater_.UpdateCommandEnabled(IDC_BOOKMARK_PAGE, | 1172 command_updater_.UpdateCommandEnabled(IDC_BOOKMARK_PAGE, |
1173 CanBookmarkCurrentPage(browser_)); | 1173 CanBookmarkCurrentPage(browser_)); |
1174 command_updater_.UpdateCommandEnabled(IDC_BOOKMARK_ALL_TABS, | 1174 command_updater_.UpdateCommandEnabled(IDC_BOOKMARK_ALL_TABS, |
1175 CanBookmarkAllTabs(browser_)); | 1175 CanBookmarkAllTabs(browser_)); |
1176 command_updater_.UpdateCommandEnabled(IDC_PIN_TO_START_SCREEN, | 1176 command_updater_.UpdateCommandEnabled(IDC_PIN_TO_START_SCREEN, |
1177 true); | 1177 true); |
1178 } | 1178 } |
1179 | 1179 |
1180 void BrowserCommandController::UpdateCommandsForBookmarkBar() { | 1180 void BrowserCommandController::UpdateCommandsForBookmarkBar() { |
1181 command_updater_.UpdateCommandEnabled(IDC_SHOW_BOOKMARK_BAR, | 1181 command_updater_.UpdateCommandEnabled( |
1182 browser_defaults::bookmarks_enabled && | 1182 IDC_SHOW_BOOKMARK_BAR, |
1183 !profile()->IsGuestSession() && | 1183 browser_defaults::bookmarks_enabled && !profile()->IsGuestSession() && |
1184 !profile()->GetPrefs()->IsManagedPreference(prefs::kShowBookmarkBar) && | 1184 !profile()->GetPrefs()->IsManagedPreference( |
1185 IsShowingMainUI()); | 1185 bookmarks::prefs::kShowBookmarkBar) && |
| 1186 IsShowingMainUI()); |
1186 } | 1187 } |
1187 | 1188 |
1188 void BrowserCommandController::UpdateCommandsForFileSelectionDialogs() { | 1189 void BrowserCommandController::UpdateCommandsForFileSelectionDialogs() { |
1189 UpdateSaveAsState(); | 1190 UpdateSaveAsState(); |
1190 UpdateOpenFileState(&command_updater_); | 1191 UpdateOpenFileState(&command_updater_); |
1191 } | 1192 } |
1192 | 1193 |
1193 void BrowserCommandController::UpdateCommandsForFullscreenMode() { | 1194 void BrowserCommandController::UpdateCommandsForFullscreenMode() { |
1194 WindowState window_state = WINDOW_STATE_NOT_FULLSCREEN; | 1195 WindowState window_state = WINDOW_STATE_NOT_FULLSCREEN; |
1195 if (window() && window()->IsFullscreen()) { | 1196 if (window() && window()->IsFullscreen()) { |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1355 | 1356 |
1356 BrowserWindow* BrowserCommandController::window() { | 1357 BrowserWindow* BrowserCommandController::window() { |
1357 return browser_->window(); | 1358 return browser_->window(); |
1358 } | 1359 } |
1359 | 1360 |
1360 Profile* BrowserCommandController::profile() { | 1361 Profile* BrowserCommandController::profile() { |
1361 return browser_->profile(); | 1362 return browser_->profile(); |
1362 } | 1363 } |
1363 | 1364 |
1364 } // namespace chrome | 1365 } // namespace chrome |
OLD | NEW |