| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/views/toolbar/toolbar_view.h" | 5 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/i18n/number_formatting.h" | 9 #include "base/i18n/number_formatting.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 display_mode_ = DISPLAYMODE_LOCATION; | 160 display_mode_ = DISPLAYMODE_LOCATION; |
| 161 if (browser->SupportsWindowFeature(Browser::FEATURE_TABSTRIP) || | 161 if (browser->SupportsWindowFeature(Browser::FEATURE_TABSTRIP) || |
| 162 (browser->is_app() && IsStreamlinedHostedAppsEnabled())) | 162 (browser->is_app() && IsStreamlinedHostedAppsEnabled())) |
| 163 display_mode_ = DISPLAYMODE_NORMAL; | 163 display_mode_ = DISPLAYMODE_NORMAL; |
| 164 | 164 |
| 165 registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED, | 165 registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED, |
| 166 content::NotificationService::AllSources()); | 166 content::NotificationService::AllSources()); |
| 167 if (OutdatedUpgradeBubbleView::IsAvailable()) { | 167 if (OutdatedUpgradeBubbleView::IsAvailable()) { |
| 168 registrar_.Add(this, chrome::NOTIFICATION_OUTDATED_INSTALL, | 168 registrar_.Add(this, chrome::NOTIFICATION_OUTDATED_INSTALL, |
| 169 content::NotificationService::AllSources()); | 169 content::NotificationService::AllSources()); |
| 170 registrar_.Add(this, chrome::NOTIFICATION_OUTDATED_INSTALL_NO_AU, |
| 171 content::NotificationService::AllSources()); |
| 170 } | 172 } |
| 171 #if defined(OS_WIN) | 173 #if defined(OS_WIN) |
| 172 registrar_.Add(this, chrome::NOTIFICATION_CRITICAL_UPGRADE_INSTALLED, | 174 registrar_.Add(this, chrome::NOTIFICATION_CRITICAL_UPGRADE_INSTALLED, |
| 173 content::NotificationService::AllSources()); | 175 content::NotificationService::AllSources()); |
| 174 if (base::win::GetVersion() == base::win::VERSION_XP) { | 176 if (base::win::GetVersion() == base::win::VERSION_XP) { |
| 175 registrar_.Add(this, chrome::NOTIFICATION_MODULE_LIST_ENUMERATED, | 177 registrar_.Add(this, chrome::NOTIFICATION_MODULE_LIST_ENUMERATED, |
| 176 content::NotificationService::AllSources()); | 178 content::NotificationService::AllSources()); |
| 177 } | 179 } |
| 178 #endif | 180 #endif |
| 179 registrar_.Add(this, | 181 registrar_.Add(this, |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 const content::NotificationSource& source, | 516 const content::NotificationSource& source, |
| 515 const content::NotificationDetails& details) { | 517 const content::NotificationDetails& details) { |
| 516 switch (type) { | 518 switch (type) { |
| 517 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: | 519 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: |
| 518 case chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE: | 520 case chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE: |
| 519 case chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED: | 521 case chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED: |
| 520 case chrome::NOTIFICATION_MODULE_LIST_ENUMERATED: | 522 case chrome::NOTIFICATION_MODULE_LIST_ENUMERATED: |
| 521 UpdateAppMenuState(); | 523 UpdateAppMenuState(); |
| 522 break; | 524 break; |
| 523 case chrome::NOTIFICATION_OUTDATED_INSTALL: | 525 case chrome::NOTIFICATION_OUTDATED_INSTALL: |
| 524 ShowOutdatedInstallNotification(); | 526 ShowOutdatedInstallNotification(true); |
| 527 break; |
| 528 case chrome::NOTIFICATION_OUTDATED_INSTALL_NO_AU: |
| 529 ShowOutdatedInstallNotification(false); |
| 525 break; | 530 break; |
| 526 #if defined(OS_WIN) | 531 #if defined(OS_WIN) |
| 527 case chrome::NOTIFICATION_CRITICAL_UPGRADE_INSTALLED: | 532 case chrome::NOTIFICATION_CRITICAL_UPGRADE_INSTALLED: |
| 528 ShowCriticalNotification(); | 533 ShowCriticalNotification(); |
| 529 break; | 534 break; |
| 530 #endif | 535 #endif |
| 531 default: | 536 default: |
| 532 NOTREACHED(); | 537 NOTREACHED(); |
| 533 } | 538 } |
| 534 } | 539 } |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 } | 818 } |
| 814 | 819 |
| 815 void ToolbarView::ShowCriticalNotification() { | 820 void ToolbarView::ShowCriticalNotification() { |
| 816 #if defined(OS_WIN) | 821 #if defined(OS_WIN) |
| 817 CriticalNotificationBubbleView* bubble_delegate = | 822 CriticalNotificationBubbleView* bubble_delegate = |
| 818 new CriticalNotificationBubbleView(app_menu_); | 823 new CriticalNotificationBubbleView(app_menu_); |
| 819 views::BubbleDelegateView::CreateBubble(bubble_delegate)->Show(); | 824 views::BubbleDelegateView::CreateBubble(bubble_delegate)->Show(); |
| 820 #endif | 825 #endif |
| 821 } | 826 } |
| 822 | 827 |
| 823 void ToolbarView::ShowOutdatedInstallNotification() { | 828 void ToolbarView::ShowOutdatedInstallNotification(bool auto_update_enabled) { |
| 824 if (OutdatedUpgradeBubbleView::IsAvailable()) | 829 if (OutdatedUpgradeBubbleView::IsAvailable()) { |
| 825 OutdatedUpgradeBubbleView::ShowBubble(app_menu_, browser_); | 830 OutdatedUpgradeBubbleView::ShowBubble( |
| 831 app_menu_, browser_, auto_update_enabled); |
| 832 } |
| 826 } | 833 } |
| 827 | 834 |
| 828 void ToolbarView::UpdateAppMenuState() { | 835 void ToolbarView::UpdateAppMenuState() { |
| 829 base::string16 accname_app = l10n_util::GetStringUTF16(IDS_ACCNAME_APP); | 836 base::string16 accname_app = l10n_util::GetStringUTF16(IDS_ACCNAME_APP); |
| 830 if (ShouldShowUpgradeRecommended()) { | 837 if (ShouldShowUpgradeRecommended()) { |
| 831 accname_app = l10n_util::GetStringFUTF16( | 838 accname_app = l10n_util::GetStringFUTF16( |
| 832 IDS_ACCNAME_APP_UPGRADE_RECOMMENDED, accname_app); | 839 IDS_ACCNAME_APP_UPGRADE_RECOMMENDED, accname_app); |
| 833 } | 840 } |
| 834 app_menu_->SetAccessibleName(accname_app); | 841 app_menu_->SetAccessibleName(accname_app); |
| 835 | 842 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 | 890 |
| 884 void ToolbarView::OnShowHomeButtonChanged() { | 891 void ToolbarView::OnShowHomeButtonChanged() { |
| 885 Layout(); | 892 Layout(); |
| 886 SchedulePaint(); | 893 SchedulePaint(); |
| 887 } | 894 } |
| 888 | 895 |
| 889 int ToolbarView::content_shadow_height() const { | 896 int ToolbarView::content_shadow_height() const { |
| 890 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? | 897 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? |
| 891 kContentShadowHeightAsh : kContentShadowHeight; | 898 kContentShadowHeightAsh : kContentShadowHeight; |
| 892 } | 899 } |
| OLD | NEW |