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

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

Issue 325433002: Elevated install of recovery component (UI part). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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
« no previous file with comments | « chrome/browser/ui/views/toolbar/toolbar_view.h ('k') | chrome/browser/upgrade_detector.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 19 matching lines...) Expand all
30 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" 30 #include "chrome/browser/ui/toolbar/wrench_menu_model.h"
31 #include "chrome/browser/ui/view_ids.h" 31 #include "chrome/browser/ui/view_ids.h"
32 #include "chrome/browser/ui/views/extensions/extension_message_bubble_view.h" 32 #include "chrome/browser/ui/views/extensions/extension_message_bubble_view.h"
33 #include "chrome/browser/ui/views/extensions/extension_popup.h" 33 #include "chrome/browser/ui/views/extensions/extension_popup.h"
34 #include "chrome/browser/ui/views/frame/browser_view.h" 34 #include "chrome/browser/ui/views/frame/browser_view.h"
35 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" 35 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h"
36 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" 36 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h"
37 #include "chrome/browser/ui/views/location_bar/star_view.h" 37 #include "chrome/browser/ui/views/location_bar/star_view.h"
38 #include "chrome/browser/ui/views/location_bar/translate_icon_view.h" 38 #include "chrome/browser/ui/views/location_bar/translate_icon_view.h"
39 #include "chrome/browser/ui/views/outdated_upgrade_bubble_view.h" 39 #include "chrome/browser/ui/views/outdated_upgrade_bubble_view.h"
40 #include "chrome/browser/ui/views/recovery_component_bubble_view.h"
40 #include "chrome/browser/ui/views/toolbar/back_button.h" 41 #include "chrome/browser/ui/views/toolbar/back_button.h"
41 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" 42 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h"
42 #include "chrome/browser/ui/views/toolbar/home_button.h" 43 #include "chrome/browser/ui/views/toolbar/home_button.h"
43 #include "chrome/browser/ui/views/toolbar/reload_button.h" 44 #include "chrome/browser/ui/views/toolbar/reload_button.h"
44 #include "chrome/browser/ui/views/toolbar/toolbar_button.h" 45 #include "chrome/browser/ui/views/toolbar/toolbar_button.h"
45 #include "chrome/browser/ui/views/toolbar/wrench_menu.h" 46 #include "chrome/browser/ui/views/toolbar/wrench_menu.h"
46 #include "chrome/browser/ui/views/toolbar/wrench_toolbar_button.h" 47 #include "chrome/browser/ui/views/toolbar/wrench_toolbar_button.h"
47 #include "chrome/browser/upgrade_detector.h" 48 #include "chrome/browser/upgrade_detector.h"
48 #include "chrome/common/chrome_switches.h" 49 #include "chrome/common/chrome_switches.h"
49 #include "chrome/common/pref_names.h" 50 #include "chrome/common/pref_names.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 display_mode_ = DISPLAYMODE_NORMAL; 153 display_mode_ = DISPLAYMODE_NORMAL;
153 154
154 registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED, 155 registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED,
155 content::NotificationService::AllSources()); 156 content::NotificationService::AllSources());
156 if (OutdatedUpgradeBubbleView::IsAvailable()) { 157 if (OutdatedUpgradeBubbleView::IsAvailable()) {
157 registrar_.Add(this, chrome::NOTIFICATION_OUTDATED_INSTALL, 158 registrar_.Add(this, chrome::NOTIFICATION_OUTDATED_INSTALL,
158 content::NotificationService::AllSources()); 159 content::NotificationService::AllSources());
159 registrar_.Add(this, chrome::NOTIFICATION_OUTDATED_INSTALL_NO_AU, 160 registrar_.Add(this, chrome::NOTIFICATION_OUTDATED_INSTALL_NO_AU,
160 content::NotificationService::AllSources()); 161 content::NotificationService::AllSources());
161 } 162 }
163 if (RecoveryComponentBubbleView::IsAvailable()) {
164 registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_NEEDS_ELEVATION,
165 content::NotificationService::AllSources());
166 }
162 #if defined(OS_WIN) 167 #if defined(OS_WIN)
163 registrar_.Add(this, chrome::NOTIFICATION_CRITICAL_UPGRADE_INSTALLED, 168 registrar_.Add(this, chrome::NOTIFICATION_CRITICAL_UPGRADE_INSTALLED,
164 content::NotificationService::AllSources()); 169 content::NotificationService::AllSources());
165 if (base::win::GetVersion() == base::win::VERSION_XP) { 170 if (base::win::GetVersion() == base::win::VERSION_XP) {
166 registrar_.Add(this, chrome::NOTIFICATION_MODULE_LIST_ENUMERATED, 171 registrar_.Add(this, chrome::NOTIFICATION_MODULE_LIST_ENUMERATED,
167 content::NotificationService::AllSources()); 172 content::NotificationService::AllSources());
168 } 173 }
169 #endif 174 #endif
170 registrar_.Add(this, 175 registrar_.Add(this,
171 chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE, 176 chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE,
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 ShowOutdatedInstallNotification(true); 501 ShowOutdatedInstallNotification(true);
497 break; 502 break;
498 case chrome::NOTIFICATION_OUTDATED_INSTALL_NO_AU: 503 case chrome::NOTIFICATION_OUTDATED_INSTALL_NO_AU:
499 ShowOutdatedInstallNotification(false); 504 ShowOutdatedInstallNotification(false);
500 break; 505 break;
501 #if defined(OS_WIN) 506 #if defined(OS_WIN)
502 case chrome::NOTIFICATION_CRITICAL_UPGRADE_INSTALLED: 507 case chrome::NOTIFICATION_CRITICAL_UPGRADE_INSTALLED:
503 ShowCriticalNotification(); 508 ShowCriticalNotification();
504 break; 509 break;
505 #endif 510 #endif
511 case chrome::NOTIFICATION_UPGRADE_NEEDS_ELEVATION:
512 ShowRecoveryComponentNotification();
513 break;
506 default: 514 default:
507 NOTREACHED(); 515 NOTREACHED();
508 } 516 }
509 } 517 }
510 518
511 //////////////////////////////////////////////////////////////////////////////// 519 ////////////////////////////////////////////////////////////////////////////////
512 // ToolbarView, ui::AcceleratorProvider implementation: 520 // ToolbarView, ui::AcceleratorProvider implementation:
513 521
514 bool ToolbarView::GetAcceleratorForCommandId(int command_id, 522 bool ToolbarView::GetAcceleratorForCommandId(int command_id,
515 ui::Accelerator* accelerator) { 523 ui::Accelerator* accelerator) {
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 #endif 784 #endif
777 } 785 }
778 786
779 void ToolbarView::ShowOutdatedInstallNotification(bool auto_update_enabled) { 787 void ToolbarView::ShowOutdatedInstallNotification(bool auto_update_enabled) {
780 if (OutdatedUpgradeBubbleView::IsAvailable()) { 788 if (OutdatedUpgradeBubbleView::IsAvailable()) {
781 OutdatedUpgradeBubbleView::ShowBubble( 789 OutdatedUpgradeBubbleView::ShowBubble(
782 app_menu_, browser_, auto_update_enabled); 790 app_menu_, browser_, auto_update_enabled);
783 } 791 }
784 } 792 }
785 793
794 void ToolbarView::ShowRecoveryComponentNotification() {
795 if (RecoveryComponentBubbleView::IsAvailable()) {
796 RecoveryComponentBubbleView::ShowBubble(app_menu_);
797 }
798 }
799
786 void ToolbarView::UpdateAppMenuState() { 800 void ToolbarView::UpdateAppMenuState() {
787 base::string16 accname_app = l10n_util::GetStringUTF16(IDS_ACCNAME_APP); 801 base::string16 accname_app = l10n_util::GetStringUTF16(IDS_ACCNAME_APP);
788 if (ShouldShowUpgradeRecommended()) { 802 if (ShouldShowUpgradeRecommended()) {
789 accname_app = l10n_util::GetStringFUTF16( 803 accname_app = l10n_util::GetStringFUTF16(
790 IDS_ACCNAME_APP_UPGRADE_RECOMMENDED, accname_app); 804 IDS_ACCNAME_APP_UPGRADE_RECOMMENDED, accname_app);
791 } 805 }
792 app_menu_->SetAccessibleName(accname_app); 806 app_menu_->SetAccessibleName(accname_app);
793 807
794 UpdateWrenchButtonSeverity(); 808 UpdateWrenchButtonSeverity();
795 SchedulePaint(); 809 SchedulePaint();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 855
842 void ToolbarView::OnShowHomeButtonChanged() { 856 void ToolbarView::OnShowHomeButtonChanged() {
843 Layout(); 857 Layout();
844 SchedulePaint(); 858 SchedulePaint();
845 } 859 }
846 860
847 int ToolbarView::content_shadow_height() const { 861 int ToolbarView::content_shadow_height() const {
848 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? 862 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ?
849 kContentShadowHeightAsh : kContentShadowHeight; 863 kContentShadowHeightAsh : kContentShadowHeight;
850 } 864 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/toolbar/toolbar_view.h ('k') | chrome/browser/upgrade_detector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698