| OLD | NEW |
| 1 // Copyright (c) 2010 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/views/toolbar_view.h" | 5 #include "chrome/browser/views/toolbar_view.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/i18n/number_formatting.h" | 9 #include "base/i18n/number_formatting.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 wrench_menu_->RunMenu(app_menu_); | 348 wrench_menu_->RunMenu(app_menu_); |
| 349 | 349 |
| 350 #if defined(OS_CHROMEOS) | 350 #if defined(OS_CHROMEOS) |
| 351 cleanup: | 351 cleanup: |
| 352 #endif | 352 #endif |
| 353 if (destroyed_flag) | 353 if (destroyed_flag) |
| 354 return; | 354 return; |
| 355 destroyed_flag_ = NULL; | 355 destroyed_flag_ = NULL; |
| 356 | 356 |
| 357 // Stop showing the background app badge also. | 357 // Stop showing the background app badge also. |
| 358 BackgroundPageTracker::GetSingleton()->AcknowledgeBackgroundPages(); | 358 BackgroundPageTracker::GetInstance()->AcknowledgeBackgroundPages(); |
| 359 } | 359 } |
| 360 | 360 |
| 361 //////////////////////////////////////////////////////////////////////////////// | 361 //////////////////////////////////////////////////////////////////////////////// |
| 362 // ToolbarView, LocationBarView::Delegate implementation: | 362 // ToolbarView, LocationBarView::Delegate implementation: |
| 363 | 363 |
| 364 TabContentsWrapper* ToolbarView::GetTabContentsWrapper() { | 364 TabContentsWrapper* ToolbarView::GetTabContentsWrapper() { |
| 365 return browser_->GetSelectedTabContentsWrapper(); | 365 return browser_->GetSelectedTabContentsWrapper(); |
| 366 } | 366 } |
| 367 | 367 |
| 368 InstantController* ToolbarView::GetInstant() { | 368 InstantController* ToolbarView::GetInstant() { |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 bool ToolbarView::IsUpgradeRecommended() { | 626 bool ToolbarView::IsUpgradeRecommended() { |
| 627 #if defined(OS_CHROMEOS) | 627 #if defined(OS_CHROMEOS) |
| 628 return (chromeos::CrosLibrary::Get()->GetUpdateLibrary()->status().status == | 628 return (chromeos::CrosLibrary::Get()->GetUpdateLibrary()->status().status == |
| 629 chromeos::UPDATE_STATUS_UPDATED_NEED_REBOOT); | 629 chromeos::UPDATE_STATUS_UPDATED_NEED_REBOOT); |
| 630 #else | 630 #else |
| 631 return (UpgradeDetector::GetInstance()->notify_upgrade()); | 631 return (UpgradeDetector::GetInstance()->notify_upgrade()); |
| 632 #endif | 632 #endif |
| 633 } | 633 } |
| 634 | 634 |
| 635 bool ToolbarView::ShouldShowBackgroundPageBadge() { | 635 bool ToolbarView::ShouldShowBackgroundPageBadge() { |
| 636 return BackgroundPageTracker::GetSingleton()-> | 636 return BackgroundPageTracker::GetInstance()-> |
| 637 GetUnacknowledgedBackgroundPageCount() > 0; | 637 GetUnacknowledgedBackgroundPageCount() > 0; |
| 638 } | 638 } |
| 639 | 639 |
| 640 bool ToolbarView::ShouldShowIncompatibilityWarning() { | 640 bool ToolbarView::ShouldShowIncompatibilityWarning() { |
| 641 #if defined(OS_WIN) | 641 #if defined(OS_WIN) |
| 642 EnumerateModulesModel* loaded_modules = EnumerateModulesModel::GetSingleton(); | 642 EnumerateModulesModel* loaded_modules = EnumerateModulesModel::GetInstance(); |
| 643 return loaded_modules->confirmed_bad_modules_detected() > 0; | 643 return loaded_modules->confirmed_bad_modules_detected() > 0; |
| 644 #else | 644 #else |
| 645 return false; | 645 return false; |
| 646 #endif | 646 #endif |
| 647 } | 647 } |
| 648 | 648 |
| 649 int ToolbarView::PopupTopSpacing() const { | 649 int ToolbarView::PopupTopSpacing() const { |
| 650 return GetWindow()->GetNonClientView()->UseNativeFrame() ? | 650 return GetWindow()->GetNonClientView()->UseNativeFrame() ? |
| 651 0 : kPopupTopSpacingNonGlass; | 651 0 : kPopupTopSpacingNonGlass; |
| 652 } | 652 } |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 | 754 |
| 755 canvas->DrawBitmapInt(badge, icon.width() - badge.width(), kBadgeTopMargin); | 755 canvas->DrawBitmapInt(badge, icon.width() - badge.width(), kBadgeTopMargin); |
| 756 | 756 |
| 757 return canvas->ExtractBitmap(); | 757 return canvas->ExtractBitmap(); |
| 758 } | 758 } |
| 759 | 759 |
| 760 SkBitmap ToolbarView::GetBackgroundPageBadge() { | 760 SkBitmap ToolbarView::GetBackgroundPageBadge() { |
| 761 ThemeProvider* tp = GetThemeProvider(); | 761 ThemeProvider* tp = GetThemeProvider(); |
| 762 SkBitmap* badge = tp->GetBitmapNamed(IDR_BACKGROUND_BADGE); | 762 SkBitmap* badge = tp->GetBitmapNamed(IDR_BACKGROUND_BADGE); |
| 763 string16 badge_text = base::FormatNumber( | 763 string16 badge_text = base::FormatNumber( |
| 764 BackgroundPageTracker::GetSingleton()->GetBackgroundPageCount()); | 764 BackgroundPageTracker::GetInstance()->GetBackgroundPageCount()); |
| 765 return badge_util::DrawBadgeIconOverlay( | 765 return badge_util::DrawBadgeIconOverlay( |
| 766 *badge, | 766 *badge, |
| 767 kBadgeTextFontSize, | 767 kBadgeTextFontSize, |
| 768 badge_text, | 768 badge_text, |
| 769 l10n_util::GetStringUTF16(IDS_BACKGROUND_PAGE_BADGE_OVERFLOW)); | 769 l10n_util::GetStringUTF16(IDS_BACKGROUND_PAGE_BADGE_OVERFLOW)); |
| 770 } | 770 } |
| 771 | 771 |
| OLD | NEW |