OLD | NEW |
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/keyboard_codes.h" | 10 #include "base/keyboard_codes.h" |
(...skipping 2402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2413 NavigationController& nc = current_tab->controller(); | 2413 NavigationController& nc = current_tab->controller(); |
2414 command_updater_.UpdateCommandEnabled(IDC_BACK, nc.CanGoBack()); | 2414 command_updater_.UpdateCommandEnabled(IDC_BACK, nc.CanGoBack()); |
2415 command_updater_.UpdateCommandEnabled(IDC_FORWARD, nc.CanGoForward()); | 2415 command_updater_.UpdateCommandEnabled(IDC_FORWARD, nc.CanGoForward()); |
2416 | 2416 |
2417 // Window management commands | 2417 // Window management commands |
2418 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, | 2418 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, |
2419 !(type() & TYPE_APP) && CanDuplicateContentsAt(selected_index())); | 2419 !(type() & TYPE_APP) && CanDuplicateContentsAt(selected_index())); |
2420 | 2420 |
2421 // Current navigation entry, may be NULL. | 2421 // Current navigation entry, may be NULL. |
2422 NavigationEntry* active_entry = current_tab->controller().GetActiveEntry(); | 2422 NavigationEntry* active_entry = current_tab->controller().GetActiveEntry(); |
2423 bool is_source_viewable = | 2423 bool is_source_viewable = |
2424 net::IsSupportedNonImageMimeType( | 2424 net::IsSupportedNonImageMimeType( |
2425 current_tab->contents_mime_type().c_str()); | 2425 current_tab->contents_mime_type().c_str()); |
2426 | 2426 |
2427 // Page-related commands | 2427 // Page-related commands |
2428 window_->SetStarredState(current_tab->is_starred()); | 2428 window_->SetStarredState(current_tab->is_starred()); |
2429 command_updater_.UpdateCommandEnabled(IDC_BOOKMARK_ALL_TABS, | 2429 command_updater_.UpdateCommandEnabled(IDC_BOOKMARK_ALL_TABS, |
2430 CanBookmarkAllTabs()); | 2430 CanBookmarkAllTabs()); |
2431 | 2431 |
2432 // View-source should not be enabled if already in view-source mode or | 2432 // View-source should not be enabled if already in view-source mode or |
2433 // the source is not viewable. | 2433 // the source is not viewable. |
2434 command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE, | 2434 command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE, |
2435 active_entry && !active_entry->IsViewSourceMode() && | 2435 active_entry && !active_entry->IsViewSourceMode() && |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2969 /////////////////////////////////////////////////////////////////////////////// | 2969 /////////////////////////////////////////////////////////////////////////////// |
2970 // BrowserToolbarModel (private): | 2970 // BrowserToolbarModel (private): |
2971 | 2971 |
2972 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { | 2972 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { |
2973 // This |current_tab| can be NULL during the initialization of the | 2973 // This |current_tab| can be NULL during the initialization of the |
2974 // toolbar during window creation (i.e. before any tabs have been added | 2974 // toolbar during window creation (i.e. before any tabs have been added |
2975 // to the window). | 2975 // to the window). |
2976 TabContents* current_tab = browser_->GetSelectedTabContents(); | 2976 TabContents* current_tab = browser_->GetSelectedTabContents(); |
2977 return current_tab ? ¤t_tab->controller() : NULL; | 2977 return current_tab ? ¤t_tab->controller() : NULL; |
2978 } | 2978 } |
OLD | NEW |