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

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

Issue 242083: Set the initial enabledness state of any browser actions when (Closed)
Patch Set: sub-i Created 11 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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/browser.h" 5 #include "chrome/browser/browser.h"
6 6
7 #include "app/animation.h" 7 #include "app/animation.h"
8 #include "app/l10n_util.h" 8 #include "app/l10n_util.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/idle_timer.h" 10 #include "base/idle_timer.h"
(...skipping 10 matching lines...) Expand all
21 #include "chrome/browser/character_encoding.h" 21 #include "chrome/browser/character_encoding.h"
22 #include "chrome/browser/debugger/devtools_manager.h" 22 #include "chrome/browser/debugger/devtools_manager.h"
23 #include "chrome/browser/download/download_item_model.h" 23 #include "chrome/browser/download/download_item_model.h"
24 #include "chrome/browser/download/download_manager.h" 24 #include "chrome/browser/download/download_manager.h"
25 #include "chrome/browser/download/download_shelf.h" 25 #include "chrome/browser/download/download_shelf.h"
26 #include "chrome/browser/download/download_started_animation.h" 26 #include "chrome/browser/download/download_started_animation.h"
27 #include "chrome/browser/extensions/crashed_extension_infobar.h" 27 #include "chrome/browser/extensions/crashed_extension_infobar.h"
28 #include "chrome/browser/extensions/extension_browser_event_router.h" 28 #include "chrome/browser/extensions/extension_browser_event_router.h"
29 #include "chrome/browser/extensions/extension_disabled_infobar_delegate.h" 29 #include "chrome/browser/extensions/extension_disabled_infobar_delegate.h"
30 #include "chrome/browser/extensions/extension_tabs_module.h" 30 #include "chrome/browser/extensions/extension_tabs_module.h"
31 #include "chrome/browser/extensions/extensions_service.h"
31 #include "chrome/browser/find_bar.h" 32 #include "chrome/browser/find_bar.h"
32 #include "chrome/browser/find_bar_controller.h" 33 #include "chrome/browser/find_bar_controller.h"
33 #include "chrome/browser/google_url_tracker.h" 34 #include "chrome/browser/google_url_tracker.h"
34 #include "chrome/browser/location_bar.h" 35 #include "chrome/browser/location_bar.h"
35 #include "chrome/browser/metrics/user_metrics.h" 36 #include "chrome/browser/metrics/user_metrics.h"
36 #include "chrome/browser/net/url_fixer_upper.h" 37 #include "chrome/browser/net/url_fixer_upper.h"
37 #include "chrome/browser/options_window.h" 38 #include "chrome/browser/options_window.h"
38 #include "chrome/browser/profile.h" 39 #include "chrome/browser/profile.h"
39 #include "chrome/browser/renderer_host/site_instance.h" 40 #include "chrome/browser/renderer_host/site_instance.h"
40 #include "chrome/browser/sessions/session_service.h" 41 #include "chrome/browser/sessions/session_service.h"
(...skipping 2280 matching lines...) Expand 10 before | Expand all | Expand 10 after
2321 command_updater_.UpdateCommandEnabled(IDC_SHOW_HISTORY, true); 2322 command_updater_.UpdateCommandEnabled(IDC_SHOW_HISTORY, true);
2322 command_updater_.UpdateCommandEnabled(IDC_SHOW_BOOKMARK_MANAGER, true); 2323 command_updater_.UpdateCommandEnabled(IDC_SHOW_BOOKMARK_MANAGER, true);
2323 command_updater_.UpdateCommandEnabled(IDC_SHOW_EXTENSION_SHELF, true); 2324 command_updater_.UpdateCommandEnabled(IDC_SHOW_EXTENSION_SHELF, true);
2324 command_updater_.UpdateCommandEnabled(IDC_SHOW_DOWNLOADS, true); 2325 command_updater_.UpdateCommandEnabled(IDC_SHOW_DOWNLOADS, true);
2325 command_updater_.UpdateCommandEnabled(IDC_HELP_PAGE, true); 2326 command_updater_.UpdateCommandEnabled(IDC_HELP_PAGE, true);
2326 command_updater_.UpdateCommandEnabled(IDC_MANAGE_EXTENSIONS, true); 2327 command_updater_.UpdateCommandEnabled(IDC_MANAGE_EXTENSIONS, true);
2327 #if defined(OS_CHROMEOS) 2328 #if defined(OS_CHROMEOS)
2328 command_updater_.UpdateCommandEnabled(IDC_CONTROL_PANEL, true); 2329 command_updater_.UpdateCommandEnabled(IDC_CONTROL_PANEL, true);
2329 #endif 2330 #endif
2330 2331
2332 // Set up any browser action commands that are installed.
2333 ExtensionsService* service = profile()->GetExtensionsService();
2334 if (service) {
2335 std::vector<ExtensionAction*> browser_actions =
2336 service->GetBrowserActions();
2337 for (size_t i = 0; i < browser_actions.size(); ++i) {
2338 command_updater_.UpdateCommandEnabled(browser_actions[i]->command_id(),
2339 true);
2340 }
2341 }
2342
2331 // Initialize other commands based on the window type. 2343 // Initialize other commands based on the window type.
2332 { 2344 {
2333 bool normal_window = type() == TYPE_NORMAL; 2345 bool normal_window = type() == TYPE_NORMAL;
2334 2346
2335 // Navigation commands 2347 // Navigation commands
2336 command_updater_.UpdateCommandEnabled(IDC_HOME, normal_window); 2348 command_updater_.UpdateCommandEnabled(IDC_HOME, normal_window);
2337 2349
2338 // Window management commands 2350 // Window management commands
2339 command_updater_.UpdateCommandEnabled(IDC_SELECT_NEXT_TAB, normal_window); 2351 command_updater_.UpdateCommandEnabled(IDC_SELECT_NEXT_TAB, normal_window);
2340 command_updater_.UpdateCommandEnabled(IDC_SELECT_PREVIOUS_TAB, 2352 command_updater_.UpdateCommandEnabled(IDC_SELECT_PREVIOUS_TAB,
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
2915 /////////////////////////////////////////////////////////////////////////////// 2927 ///////////////////////////////////////////////////////////////////////////////
2916 // BrowserToolbarModel (private): 2928 // BrowserToolbarModel (private):
2917 2929
2918 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { 2930 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() {
2919 // This |current_tab| can be NULL during the initialization of the 2931 // This |current_tab| can be NULL during the initialization of the
2920 // toolbar during window creation (i.e. before any tabs have been added 2932 // toolbar during window creation (i.e. before any tabs have been added
2921 // to the window). 2933 // to the window).
2922 TabContents* current_tab = browser_->GetSelectedTabContents(); 2934 TabContents* current_tab = browser_->GetSelectedTabContents();
2923 return current_tab ? &current_tab->controller() : NULL; 2935 return current_tab ? &current_tab->controller() : NULL;
2924 } 2936 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698