OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/base_paths.h" | 9 #include "base/base_paths.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/gfx/point.h" | 11 #include "base/gfx/point.h" |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 return l10n_util::GetStringFUTF16(string_id, title); | 505 return l10n_util::GetStringFUTF16(string_id, title); |
506 #endif | 506 #endif |
507 } | 507 } |
508 | 508 |
509 // static | 509 // static |
510 void Browser::FormatTitleForDisplay(string16* title) { | 510 void Browser::FormatTitleForDisplay(string16* title) { |
511 size_t current_index = 0; | 511 size_t current_index = 0; |
512 size_t match_index; | 512 size_t match_index; |
513 while ((match_index = title->find(L'\n', current_index)) != | 513 while ((match_index = title->find(L'\n', current_index)) != |
514 std::wstring::npos) { | 514 std::wstring::npos) { |
515 title->replace(match_index, 1, EmptyString16()); | 515 title->replace(match_index, 1, string16()); |
516 current_index = match_index; | 516 current_index = match_index; |
517 } | 517 } |
518 } | 518 } |
519 | 519 |
520 bool Browser::ShouldShowDistributorLogo() const { | 520 bool Browser::ShouldShowDistributorLogo() const { |
521 // Don't show the distributor logo on app frames and app popups. | 521 // Don't show the distributor logo on app frames and app popups. |
522 return !(type_ & TYPE_APP); | 522 return !(type_ & TYPE_APP); |
523 } | 523 } |
524 | 524 |
525 /////////////////////////////////////////////////////////////////////////////// | 525 /////////////////////////////////////////////////////////////////////////////// |
(...skipping 2111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2637 // View-source should not be enabled if already in view-source mode or | 2637 // View-source should not be enabled if already in view-source mode or |
2638 // the source is not viewable. | 2638 // the source is not viewable. |
2639 command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE, | 2639 command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE, |
2640 active_entry && !active_entry->IsViewSourceMode() && | 2640 active_entry && !active_entry->IsViewSourceMode() && |
2641 is_source_viewable); | 2641 is_source_viewable); |
2642 | 2642 |
2643 // Instead of using GetURL here, we use url() (which is the "real" url of the | 2643 // Instead of using GetURL here, we use url() (which is the "real" url of the |
2644 // page) from the NavigationEntry because its reflects their origin rather | 2644 // page) from the NavigationEntry because its reflects their origin rather |
2645 // than the display one (returned by GetURL) which may be different (like | 2645 // than the display one (returned by GetURL) which may be different (like |
2646 // having "view-source:" on the front). | 2646 // having "view-source:" on the front). |
2647 GURL savable_url = (active_entry) ? active_entry->url() : GURL::EmptyGURL(); | 2647 GURL savable_url = (active_entry) ? active_entry->url() : GURL(); |
2648 | 2648 |
2649 command_updater_.UpdateCommandEnabled(IDC_SAVE_PAGE, | 2649 command_updater_.UpdateCommandEnabled(IDC_SAVE_PAGE, |
2650 SavePackage::IsSavableURL(savable_url)); | 2650 SavePackage::IsSavableURL(savable_url)); |
2651 command_updater_.UpdateCommandEnabled(IDC_ENCODING_MENU, | 2651 command_updater_.UpdateCommandEnabled(IDC_ENCODING_MENU, |
2652 SavePackage::IsSavableContents(current_tab->contents_mime_type()) && | 2652 SavePackage::IsSavableContents(current_tab->contents_mime_type()) && |
2653 SavePackage::IsSavableURL(savable_url)); | 2653 SavePackage::IsSavableURL(savable_url)); |
2654 | 2654 |
2655 // Disable certain items if running DevTools | 2655 // Disable certain items if running DevTools |
2656 command_updater_.UpdateCommandEnabled(IDC_RELOAD, | 2656 command_updater_.UpdateCommandEnabled(IDC_RELOAD, |
2657 CanReloadContents(current_tab)); | 2657 CanReloadContents(current_tab)); |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3188 /////////////////////////////////////////////////////////////////////////////// | 3188 /////////////////////////////////////////////////////////////////////////////// |
3189 // BrowserToolbarModel (private): | 3189 // BrowserToolbarModel (private): |
3190 | 3190 |
3191 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { | 3191 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { |
3192 // This |current_tab| can be NULL during the initialization of the | 3192 // This |current_tab| can be NULL during the initialization of the |
3193 // toolbar during window creation (i.e. before any tabs have been added | 3193 // toolbar during window creation (i.e. before any tabs have been added |
3194 // to the window). | 3194 // to the window). |
3195 TabContents* current_tab = browser_->GetSelectedTabContents(); | 3195 TabContents* current_tab = browser_->GetSelectedTabContents(); |
3196 return current_tab ? ¤t_tab->controller() : NULL; | 3196 return current_tab ? ¤t_tab->controller() : NULL; |
3197 } | 3197 } |
OLD | NEW |