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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 const content::NotificationSource& source, | 509 const content::NotificationSource& source, |
508 const content::NotificationDetails& details) { | 510 const content::NotificationDetails& details) { |
509 switch (type) { | 511 switch (type) { |
510 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: | 512 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: |
511 case chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE: | 513 case chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE: |
512 case chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED: | 514 case chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED: |
513 case chrome::NOTIFICATION_MODULE_LIST_ENUMERATED: | 515 case chrome::NOTIFICATION_MODULE_LIST_ENUMERATED: |
514 UpdateAppMenuState(); | 516 UpdateAppMenuState(); |
515 break; | 517 break; |
516 case chrome::NOTIFICATION_OUTDATED_INSTALL: | 518 case chrome::NOTIFICATION_OUTDATED_INSTALL: |
517 ShowOutdatedInstallNotification(); | 519 ShowOutdatedInstallNotification(true); |
| 520 break; |
| 521 case chrome::NOTIFICATION_OUTDATED_INSTALL_NO_AU: |
| 522 ShowOutdatedInstallNotification(false); |
518 break; | 523 break; |
519 #if defined(OS_WIN) | 524 #if defined(OS_WIN) |
520 case chrome::NOTIFICATION_CRITICAL_UPGRADE_INSTALLED: | 525 case chrome::NOTIFICATION_CRITICAL_UPGRADE_INSTALLED: |
521 ShowCriticalNotification(); | 526 ShowCriticalNotification(); |
522 break; | 527 break; |
523 #endif | 528 #endif |
524 default: | 529 default: |
525 NOTREACHED(); | 530 NOTREACHED(); |
526 } | 531 } |
527 } | 532 } |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 } | 811 } |
807 | 812 |
808 void ToolbarView::ShowCriticalNotification() { | 813 void ToolbarView::ShowCriticalNotification() { |
809 #if defined(OS_WIN) | 814 #if defined(OS_WIN) |
810 CriticalNotificationBubbleView* bubble_delegate = | 815 CriticalNotificationBubbleView* bubble_delegate = |
811 new CriticalNotificationBubbleView(app_menu_); | 816 new CriticalNotificationBubbleView(app_menu_); |
812 views::BubbleDelegateView::CreateBubble(bubble_delegate)->Show(); | 817 views::BubbleDelegateView::CreateBubble(bubble_delegate)->Show(); |
813 #endif | 818 #endif |
814 } | 819 } |
815 | 820 |
816 void ToolbarView::ShowOutdatedInstallNotification() { | 821 void ToolbarView::ShowOutdatedInstallNotification(bool auto_update_enabled) { |
817 if (OutdatedUpgradeBubbleView::IsAvailable()) | 822 if (OutdatedUpgradeBubbleView::IsAvailable()) { |
818 OutdatedUpgradeBubbleView::ShowBubble(app_menu_, browser_); | 823 OutdatedUpgradeBubbleView::ShowBubble( |
| 824 app_menu_, browser_, auto_update_enabled); |
| 825 } |
819 } | 826 } |
820 | 827 |
821 void ToolbarView::UpdateAppMenuState() { | 828 void ToolbarView::UpdateAppMenuState() { |
822 base::string16 accname_app = l10n_util::GetStringUTF16(IDS_ACCNAME_APP); | 829 base::string16 accname_app = l10n_util::GetStringUTF16(IDS_ACCNAME_APP); |
823 if (ShouldShowUpgradeRecommended()) { | 830 if (ShouldShowUpgradeRecommended()) { |
824 accname_app = l10n_util::GetStringFUTF16( | 831 accname_app = l10n_util::GetStringFUTF16( |
825 IDS_ACCNAME_APP_UPGRADE_RECOMMENDED, accname_app); | 832 IDS_ACCNAME_APP_UPGRADE_RECOMMENDED, accname_app); |
826 } | 833 } |
827 app_menu_->SetAccessibleName(accname_app); | 834 app_menu_->SetAccessibleName(accname_app); |
828 | 835 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 | 883 |
877 void ToolbarView::OnShowHomeButtonChanged() { | 884 void ToolbarView::OnShowHomeButtonChanged() { |
878 Layout(); | 885 Layout(); |
879 SchedulePaint(); | 886 SchedulePaint(); |
880 } | 887 } |
881 | 888 |
882 int ToolbarView::content_shadow_height() const { | 889 int ToolbarView::content_shadow_height() const { |
883 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? | 890 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? |
884 kContentShadowHeightAsh : kContentShadowHeight; | 891 kContentShadowHeightAsh : kContentShadowHeight; |
885 } | 892 } |
OLD | NEW |