Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: chrome/browser/ui/views/toolbar_view.cc

Issue 11440020: Add an outdated upgrade bubble view. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Exclude Chrome OS correctly Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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_view.h" 5 #include "chrome/browser/ui/views/toolbar_view.h"
6 6
7 #include "base/i18n/number_formatting.h" 7 #include "base/i18n/number_formatting.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/command_updater.h" 10 #include "chrome/browser/command_updater.h"
(...skipping 11 matching lines...) Expand all
22 #include "chrome/browser/ui/global_error/global_error_service_factory.h" 22 #include "chrome/browser/ui/global_error/global_error_service_factory.h"
23 #include "chrome/browser/ui/omnibox/omnibox_view.h" 23 #include "chrome/browser/ui/omnibox/omnibox_view.h"
24 #include "chrome/browser/ui/tabs/tab_strip_model.h" 24 #include "chrome/browser/ui/tabs/tab_strip_model.h"
25 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" 25 #include "chrome/browser/ui/toolbar/wrench_menu_model.h"
26 #include "chrome/browser/ui/view_ids.h" 26 #include "chrome/browser/ui/view_ids.h"
27 #include "chrome/browser/ui/views/browser_actions_container.h" 27 #include "chrome/browser/ui/views/browser_actions_container.h"
28 #include "chrome/browser/ui/views/extensions/disabled_extensions_view.h" 28 #include "chrome/browser/ui/views/extensions/disabled_extensions_view.h"
29 #include "chrome/browser/ui/views/frame/browser_view.h" 29 #include "chrome/browser/ui/views/frame/browser_view.h"
30 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" 30 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h"
31 #include "chrome/browser/ui/views/location_bar/star_view.h" 31 #include "chrome/browser/ui/views/location_bar/star_view.h"
32 #include "chrome/browser/ui/views/outdated_upgrade_bubble_view.h"
32 #include "chrome/browser/ui/views/wrench_menu.h" 33 #include "chrome/browser/ui/views/wrench_menu.h"
33 #include "chrome/browser/upgrade_detector.h" 34 #include "chrome/browser/upgrade_detector.h"
34 #include "chrome/common/chrome_notification_types.h" 35 #include "chrome/common/chrome_notification_types.h"
35 #include "chrome/common/pref_names.h" 36 #include "chrome/common/pref_names.h"
36 #include "content/public/browser/browser_accessibility_state.h" 37 #include "content/public/browser/browser_accessibility_state.h"
37 #include "content/public/browser/notification_service.h" 38 #include "content/public/browser/notification_service.h"
38 #include "content/public/browser/render_view_host.h" 39 #include "content/public/browser/render_view_host.h"
39 #include "content/public/browser/user_metrics.h" 40 #include "content/public/browser/user_metrics.h"
40 #include "content/public/browser/web_contents.h" 41 #include "content/public/browser/web_contents.h"
41 #include "content/public/browser/web_contents_view.h" 42 #include "content/public/browser/web_contents_view.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 display_mode_ = browser->SupportsWindowFeature(Browser::FEATURE_TABSTRIP) ? 182 display_mode_ = browser->SupportsWindowFeature(Browser::FEATURE_TABSTRIP) ?
182 DISPLAYMODE_NORMAL : DISPLAYMODE_LOCATION; 183 DISPLAYMODE_NORMAL : DISPLAYMODE_LOCATION;
183 184
184 if (!kPopupBackgroundEdge) { 185 if (!kPopupBackgroundEdge) {
185 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 186 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
186 kPopupBackgroundEdge = rb.GetImageSkiaNamed(IDR_LOCATIONBG_POPUPMODE_EDGE); 187 kPopupBackgroundEdge = rb.GetImageSkiaNamed(IDR_LOCATIONBG_POPUPMODE_EDGE);
187 } 188 }
188 189
189 registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED, 190 registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED,
190 content::NotificationService::AllSources()); 191 content::NotificationService::AllSources());
192 // This should only be available on non-Chrome OS desktop platforms.
193 #if defined(OS_WIN) || defined(OS_MACOSX) || \
194 (defined(OS_LINUX) && !defined(OS_CHROMEOS)
195 registrar_.Add(this, chrome::NOTIFICATION_OUTDATED_INSTALL,
196 content::NotificationService::AllSources());
197 #endif
191 #if defined(OS_WIN) 198 #if defined(OS_WIN)
192 registrar_.Add(this, chrome::NOTIFICATION_CRITICAL_UPGRADE_INSTALLED, 199 registrar_.Add(this, chrome::NOTIFICATION_CRITICAL_UPGRADE_INSTALLED,
193 content::NotificationService::AllSources()); 200 content::NotificationService::AllSources());
194 #endif 201 #endif
195 registrar_.Add(this, 202 registrar_.Add(this,
196 chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE, 203 chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE,
197 content::NotificationService::AllSources()); 204 content::NotificationService::AllSources());
198 registrar_.Add(this, chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED, 205 registrar_.Add(this, chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED,
199 content::Source<Profile>(browser_->profile())); 206 content::Source<Profile>(browser_->profile()));
200 } 207 }
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 548
542 void ToolbarView::Observe(int type, 549 void ToolbarView::Observe(int type,
543 const content::NotificationSource& source, 550 const content::NotificationSource& source,
544 const content::NotificationDetails& details) { 551 const content::NotificationDetails& details) {
545 switch (type) { 552 switch (type) {
546 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: 553 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED:
547 case chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE: 554 case chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE:
548 case chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED: 555 case chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED:
549 UpdateAppMenuState(); 556 UpdateAppMenuState();
550 break; 557 break;
558 #if defined(OS_WIN) || defined(OS_MACOSX) || \
559 (defined(OS_LINUX) && !defined(OS_CHROMEOS)
560 case chrome::NOTIFICATION_OUTDATED_INSTALL:
561 ShowOutdatedInstallNotification();
562 break;
563 #endif
551 #if defined(OS_WIN) 564 #if defined(OS_WIN)
552 case chrome::NOTIFICATION_CRITICAL_UPGRADE_INSTALLED: 565 case chrome::NOTIFICATION_CRITICAL_UPGRADE_INSTALLED:
553 ShowCriticalNotification(); 566 ShowCriticalNotification();
554 break; 567 break;
555 #endif 568 #endif
556 default: 569 default:
557 NOTREACHED(); 570 NOTREACHED();
558 } 571 }
559 } 572 }
560 573
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 899
887 void ToolbarView::ShowCriticalNotification() { 900 void ToolbarView::ShowCriticalNotification() {
888 #if defined(OS_WIN) 901 #if defined(OS_WIN)
889 CriticalNotificationBubbleView* bubble_delegate = 902 CriticalNotificationBubbleView* bubble_delegate =
890 new CriticalNotificationBubbleView(app_menu_); 903 new CriticalNotificationBubbleView(app_menu_);
891 views::BubbleDelegateView::CreateBubble(bubble_delegate); 904 views::BubbleDelegateView::CreateBubble(bubble_delegate);
892 bubble_delegate->StartFade(true); 905 bubble_delegate->StartFade(true);
893 #endif 906 #endif
894 } 907 }
895 908
909 void ToolbarView::ShowOutdatedInstallNotification() {
910 // This should only work on non-Chrome OS desktop platforms.
911 #if defined(OS_WIN) || defined(OS_MACOSX) || \
912 (defined(OS_LINUX) && !defined(OS_CHROMEOS)
913 OutdatedUpgradeBubbleView::ShowBubble(app_menu_, browser_);
914 #endif
915 }
916
896 void ToolbarView::UpdateAppMenuState() { 917 void ToolbarView::UpdateAppMenuState() {
897 string16 accname_app = l10n_util::GetStringUTF16(IDS_ACCNAME_APP); 918 string16 accname_app = l10n_util::GetStringUTF16(IDS_ACCNAME_APP);
898 if (ShouldShowUpgradeRecommended()) { 919 if (ShouldShowUpgradeRecommended()) {
899 accname_app = l10n_util::GetStringFUTF16( 920 accname_app = l10n_util::GetStringFUTF16(
900 IDS_ACCNAME_APP_UPGRADE_RECOMMENDED, accname_app); 921 IDS_ACCNAME_APP_UPGRADE_RECOMMENDED, accname_app);
901 } 922 }
902 app_menu_->SetAccessibleName(accname_app); 923 app_menu_->SetAccessibleName(accname_app);
903 924
904 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::STATE_NORMAL)); 925 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::STATE_NORMAL));
905 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::STATE_HOVERED)); 926 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::STATE_HOVERED));
906 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::STATE_PRESSED)); 927 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::STATE_PRESSED));
907 SchedulePaint(); 928 SchedulePaint();
908 } 929 }
909 930
910 void ToolbarView::OnShowHomeButtonChanged() { 931 void ToolbarView::OnShowHomeButtonChanged() {
911 Layout(); 932 Layout();
912 SchedulePaint(); 933 SchedulePaint();
913 } 934 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698