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

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: Addressed CR comments... 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 #include "ui/views/controls/button/button_dropdown.h" 53 #include "ui/views/controls/button/button_dropdown.h"
54 #include "ui/views/controls/menu/menu_listener.h" 54 #include "ui/views/controls/menu/menu_listener.h"
55 #include "ui/views/focus/view_storage.h" 55 #include "ui/views/focus/view_storage.h"
56 #include "ui/views/widget/tooltip_manager.h" 56 #include "ui/views/widget/tooltip_manager.h"
57 #include "ui/views/widget/widget.h" 57 #include "ui/views/widget/widget.h"
58 #include "ui/views/window/non_client_view.h" 58 #include "ui/views/window/non_client_view.h"
59 59
60 #if defined(OS_WIN) 60 #if defined(OS_WIN)
61 #include "chrome/browser/enumerate_modules_model_win.h" 61 #include "chrome/browser/enumerate_modules_model_win.h"
62 #include "chrome/browser/ui/views/critical_notification_bubble_view.h" 62 #include "chrome/browser/ui/views/critical_notification_bubble_view.h"
63 #include "chrome/browser/ui/views/outdated_upgrade_bubble_view.h"
63 #if !defined(USE_AURA) 64 #if !defined(USE_AURA)
64 #include "chrome/browser/ui/views/app_menu_button_win.h" 65 #include "chrome/browser/ui/views/app_menu_button_win.h"
65 #endif 66 #endif
66 #endif 67 #endif
67 68
68 #if defined(USE_AURA) 69 #if defined(USE_AURA)
69 #include "ui/aura/window.h" 70 #include "ui/aura/window.h"
70 #include "ui/compositor/layer.h" 71 #include "ui/compositor/layer.h"
71 #include "ui/native_theme/native_theme_aura.h" 72 #include "ui/native_theme/native_theme_aura.h"
72 #endif 73 #endif
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
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());
191 #if defined(OS_WIN) 192 #if defined(OS_WIN)
192 registrar_.Add(this, chrome::NOTIFICATION_CRITICAL_UPGRADE_INSTALLED, 193 registrar_.Add(this, chrome::NOTIFICATION_CRITICAL_UPGRADE_INSTALLED,
193 content::NotificationService::AllSources()); 194 content::NotificationService::AllSources());
195 registrar_.Add(this, chrome::NOTIFICATION_OUTDATED_INSTALL,
196 content::NotificationService::AllSources());
194 #endif 197 #endif
195 registrar_.Add(this, 198 registrar_.Add(this,
196 chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE, 199 chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE,
197 content::NotificationService::AllSources()); 200 content::NotificationService::AllSources());
198 registrar_.Add(this, chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED, 201 registrar_.Add(this, chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED,
199 content::Source<Profile>(browser_->profile())); 202 content::Source<Profile>(browser_->profile()));
200 } 203 }
201 204
202 ToolbarView::~ToolbarView() { 205 ToolbarView::~ToolbarView() {
203 // NOTE: Don't remove the command observers here. This object gets destroyed 206 // NOTE: Don't remove the command observers here. This object gets destroyed
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 switch (type) { 548 switch (type) {
546 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: 549 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED:
547 case chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE: 550 case chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE:
548 case chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED: 551 case chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED:
549 UpdateAppMenuState(); 552 UpdateAppMenuState();
550 break; 553 break;
551 #if defined(OS_WIN) 554 #if defined(OS_WIN)
552 case chrome::NOTIFICATION_CRITICAL_UPGRADE_INSTALLED: 555 case chrome::NOTIFICATION_CRITICAL_UPGRADE_INSTALLED:
553 ShowCriticalNotification(); 556 ShowCriticalNotification();
554 break; 557 break;
558 case chrome::NOTIFICATION_OUTDATED_INSTALL:
559 ShowOutdatedInstallNotification();
560 break;
555 #endif 561 #endif
556 default: 562 default:
557 NOTREACHED(); 563 NOTREACHED();
558 } 564 }
559 } 565 }
560 566
561 //////////////////////////////////////////////////////////////////////////////// 567 ////////////////////////////////////////////////////////////////////////////////
562 // ToolbarView, ui::AcceleratorProvider implementation: 568 // ToolbarView, ui::AcceleratorProvider implementation:
563 569
564 bool ToolbarView::GetAcceleratorForCommandId(int command_id, 570 bool ToolbarView::GetAcceleratorForCommandId(int command_id,
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 home_->SetImage(views::CustomButton::STATE_PRESSED, 885 home_->SetImage(views::CustomButton::STATE_PRESSED,
880 tp->GetImageSkiaNamed(IDR_HOME_P)); 886 tp->GetImageSkiaNamed(IDR_HOME_P));
881 887
882 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::STATE_NORMAL)); 888 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::STATE_NORMAL));
883 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::STATE_HOVERED)); 889 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::STATE_HOVERED));
884 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::STATE_PRESSED)); 890 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::STATE_PRESSED));
885 } 891 }
886 892
887 void ToolbarView::ShowCriticalNotification() { 893 void ToolbarView::ShowCriticalNotification() {
888 #if defined(OS_WIN) 894 #if defined(OS_WIN)
889 CriticalNotificationBubbleView* bubble_delegate = 895 // The upgrade bubble shows up on start up, so should always be there before
890 new CriticalNotificationBubbleView(app_menu_); 896 // we try to show the CriticalNotificationBubbleView, and never after.
891 views::BubbleDelegateView::CreateBubble(bubble_delegate); 897 if (!OutdatedUpgradeBubbleView::IsShowing()) {
892 bubble_delegate->StartFade(true); 898 CriticalNotificationBubbleView* bubble_delegate =
899 new CriticalNotificationBubbleView(app_menu_);
900 views::BubbleDelegateView::CreateBubble(bubble_delegate);
901 bubble_delegate->StartFade(true);
902 }
893 #endif 903 #endif
894 } 904 }
895 905
906 void ToolbarView::ShowOutdatedInstallNotification() {
907 #if defined(OS_WIN)
908 OutdatedUpgradeBubbleView::ShowBubble(app_menu_, browser_);
909 #endif
910 }
911
896 void ToolbarView::UpdateAppMenuState() { 912 void ToolbarView::UpdateAppMenuState() {
897 string16 accname_app = l10n_util::GetStringUTF16(IDS_ACCNAME_APP); 913 string16 accname_app = l10n_util::GetStringUTF16(IDS_ACCNAME_APP);
898 if (ShouldShowUpgradeRecommended()) { 914 if (ShouldShowUpgradeRecommended()) {
899 accname_app = l10n_util::GetStringFUTF16( 915 accname_app = l10n_util::GetStringFUTF16(
900 IDS_ACCNAME_APP_UPGRADE_RECOMMENDED, accname_app); 916 IDS_ACCNAME_APP_UPGRADE_RECOMMENDED, accname_app);
901 } 917 }
902 app_menu_->SetAccessibleName(accname_app); 918 app_menu_->SetAccessibleName(accname_app);
903 919
904 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::STATE_NORMAL)); 920 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::STATE_NORMAL));
905 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::STATE_HOVERED)); 921 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::STATE_HOVERED));
906 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::STATE_PRESSED)); 922 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::STATE_PRESSED));
907 SchedulePaint(); 923 SchedulePaint();
908 } 924 }
909 925
910 void ToolbarView::OnShowHomeButtonChanged() { 926 void ToolbarView::OnShowHomeButtonChanged() {
911 Layout(); 927 Layout();
912 SchedulePaint(); 928 SchedulePaint();
913 } 929 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698