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

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: Sync'd to ToT Created 7 years, 10 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/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
(...skipping 12 matching lines...) Expand all
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/home_button.h" 30 #include "chrome/browser/ui/views/home_button.h"
31 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" 31 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h"
32 #include "chrome/browser/ui/views/location_bar/star_view.h" 32 #include "chrome/browser/ui/views/location_bar/star_view.h"
33 #include "chrome/browser/ui/views/outdated_upgrade_bubble_view.h"
33 #include "chrome/browser/ui/views/wrench_menu.h" 34 #include "chrome/browser/ui/views/wrench_menu.h"
34 #include "chrome/browser/upgrade_detector.h" 35 #include "chrome/browser/upgrade_detector.h"
35 #include "chrome/common/chrome_notification_types.h" 36 #include "chrome/common/chrome_notification_types.h"
36 #include "chrome/common/pref_names.h" 37 #include "chrome/common/pref_names.h"
37 #include "content/public/browser/browser_accessibility_state.h" 38 #include "content/public/browser/browser_accessibility_state.h"
38 #include "content/public/browser/notification_service.h" 39 #include "content/public/browser/notification_service.h"
39 #include "content/public/browser/render_view_host.h" 40 #include "content/public/browser/render_view_host.h"
40 #include "content/public/browser/user_metrics.h" 41 #include "content/public/browser/user_metrics.h"
41 #include "content/public/browser/web_contents.h" 42 #include "content/public/browser/web_contents.h"
42 #include "content/public/browser/web_contents_view.h" 43 #include "content/public/browser/web_contents_view.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 display_mode_ = browser->SupportsWindowFeature(Browser::FEATURE_TABSTRIP) ? 180 display_mode_ = browser->SupportsWindowFeature(Browser::FEATURE_TABSTRIP) ?
180 DISPLAYMODE_NORMAL : DISPLAYMODE_LOCATION; 181 DISPLAYMODE_NORMAL : DISPLAYMODE_LOCATION;
181 182
182 if (!kPopupBackgroundEdge) { 183 if (!kPopupBackgroundEdge) {
183 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 184 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
184 kPopupBackgroundEdge = rb.GetImageSkiaNamed(IDR_LOCATIONBG_POPUPMODE_EDGE); 185 kPopupBackgroundEdge = rb.GetImageSkiaNamed(IDR_LOCATIONBG_POPUPMODE_EDGE);
185 } 186 }
186 187
187 registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED, 188 registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED,
188 content::NotificationService::AllSources()); 189 content::NotificationService::AllSources());
190 // This should only be available on non-Chrome OS desktop platforms.
191 #if defined(OS_WIN) || defined(OS_MACOSX) || \
Ben Goodger (Google) 2013/02/13 22:35:44 instead of having these ifdefs everywhere, how abo
MAD 2013/02/14 14:04:06 Done.
192 (defined(OS_LINUX) && !defined(OS_CHROMEOS))
193 registrar_.Add(this, chrome::NOTIFICATION_OUTDATED_INSTALL,
194 content::NotificationService::AllSources());
195 #endif
189 #if defined(OS_WIN) 196 #if defined(OS_WIN)
190 registrar_.Add(this, chrome::NOTIFICATION_CRITICAL_UPGRADE_INSTALLED, 197 registrar_.Add(this, chrome::NOTIFICATION_CRITICAL_UPGRADE_INSTALLED,
191 content::NotificationService::AllSources()); 198 content::NotificationService::AllSources());
192 #endif 199 #endif
193 registrar_.Add(this, 200 registrar_.Add(this,
194 chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE, 201 chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE,
195 content::NotificationService::AllSources()); 202 content::NotificationService::AllSources());
196 registrar_.Add(this, chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED, 203 registrar_.Add(this, chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED,
197 content::Source<Profile>(browser_->profile())); 204 content::Source<Profile>(browser_->profile()));
198 } 205 }
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 546
540 void ToolbarView::Observe(int type, 547 void ToolbarView::Observe(int type,
541 const content::NotificationSource& source, 548 const content::NotificationSource& source,
542 const content::NotificationDetails& details) { 549 const content::NotificationDetails& details) {
543 switch (type) { 550 switch (type) {
544 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: 551 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED:
545 case chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE: 552 case chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE:
546 case chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED: 553 case chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED:
547 UpdateAppMenuState(); 554 UpdateAppMenuState();
548 break; 555 break;
556 #if defined(OS_WIN) || defined(OS_MACOSX) || \
557 (defined(OS_LINUX) && !defined(OS_CHROMEOS))
558 case chrome::NOTIFICATION_OUTDATED_INSTALL:
559 ShowOutdatedInstallNotification();
560 break;
561 #endif
549 #if defined(OS_WIN) 562 #if defined(OS_WIN)
550 case chrome::NOTIFICATION_CRITICAL_UPGRADE_INSTALLED: 563 case chrome::NOTIFICATION_CRITICAL_UPGRADE_INSTALLED:
551 ShowCriticalNotification(); 564 ShowCriticalNotification();
552 break; 565 break;
553 #endif 566 #endif
554 default: 567 default:
555 NOTREACHED(); 568 NOTREACHED();
556 } 569 }
557 } 570 }
558 571
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 892
880 void ToolbarView::ShowCriticalNotification() { 893 void ToolbarView::ShowCriticalNotification() {
881 #if defined(OS_WIN) 894 #if defined(OS_WIN)
882 CriticalNotificationBubbleView* bubble_delegate = 895 CriticalNotificationBubbleView* bubble_delegate =
883 new CriticalNotificationBubbleView(app_menu_); 896 new CriticalNotificationBubbleView(app_menu_);
884 views::BubbleDelegateView::CreateBubble(bubble_delegate); 897 views::BubbleDelegateView::CreateBubble(bubble_delegate);
885 bubble_delegate->StartFade(true); 898 bubble_delegate->StartFade(true);
886 #endif 899 #endif
887 } 900 }
888 901
902 void ToolbarView::ShowOutdatedInstallNotification() {
903 // This should only work on non-Chrome OS desktop platforms.
904 #if defined(OS_WIN) || defined(OS_MACOSX) || \
905 (defined(OS_LINUX) && !defined(OS_CHROMEOS))
906 OutdatedUpgradeBubbleView::ShowBubble(app_menu_, browser_);
907 #endif
908 }
909
889 void ToolbarView::UpdateAppMenuState() { 910 void ToolbarView::UpdateAppMenuState() {
890 string16 accname_app = l10n_util::GetStringUTF16(IDS_ACCNAME_APP); 911 string16 accname_app = l10n_util::GetStringUTF16(IDS_ACCNAME_APP);
891 if (ShouldShowUpgradeRecommended()) { 912 if (ShouldShowUpgradeRecommended()) {
892 accname_app = l10n_util::GetStringFUTF16( 913 accname_app = l10n_util::GetStringFUTF16(
893 IDS_ACCNAME_APP_UPGRADE_RECOMMENDED, accname_app); 914 IDS_ACCNAME_APP_UPGRADE_RECOMMENDED, accname_app);
894 } 915 }
895 app_menu_->SetAccessibleName(accname_app); 916 app_menu_->SetAccessibleName(accname_app);
896 917
897 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::STATE_NORMAL)); 918 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::STATE_NORMAL));
898 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::STATE_HOVERED)); 919 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::STATE_HOVERED));
899 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::STATE_PRESSED)); 920 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::STATE_PRESSED));
900 SchedulePaint(); 921 SchedulePaint();
901 } 922 }
902 923
903 void ToolbarView::OnShowHomeButtonChanged() { 924 void ToolbarView::OnShowHomeButtonChanged() {
904 Layout(); 925 Layout();
905 SchedulePaint(); 926 SchedulePaint();
906 } 927 }
907 928
908 int ToolbarView::content_shadow_height() const { 929 int ToolbarView::content_shadow_height() const {
909 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? 930 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ?
910 kContentShadowHeightAsh : kContentShadowHeight; 931 kContentShadowHeightAsh : kContentShadowHeight;
911 } 932 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698