OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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/recovery/recovery_install_global_error.h" | 5 #include "chrome/browser/recovery/recovery_install_global_error.h" |
6 | 6 |
7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
| 8 #include "chrome/app/vector_icons/vector_icons.h" |
8 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/component_updater/recovery_component_installer.h" | 10 #include "chrome/browser/component_updater/recovery_component_installer.h" |
10 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/ui/global_error/global_error_service.h" | 12 #include "chrome/browser/ui/global_error/global_error_service.h" |
12 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 13 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
13 #include "chrome/browser/upgrade_detector.h" | 14 #include "chrome/browser/upgrade_detector.h" |
14 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
15 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
16 #include "chrome/grit/chromium_strings.h" | 17 #include "chrome/grit/chromium_strings.h" |
17 #include "components/prefs/pref_service.h" | 18 #include "components/prefs/pref_service.h" |
18 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
19 #include "ui/gfx/paint_vector_icon.h" | 20 #include "ui/gfx/paint_vector_icon.h" |
20 #include "ui/gfx/vector_icons_public.h" | |
21 #include "ui/native_theme/native_theme.h" | 21 #include "ui/native_theme/native_theme.h" |
22 | 22 |
23 RecoveryInstallGlobalError::RecoveryInstallGlobalError(Profile* profile) | 23 RecoveryInstallGlobalError::RecoveryInstallGlobalError(Profile* profile) |
24 : elevation_needed_(false), | 24 : elevation_needed_(false), |
25 profile_(profile), | 25 profile_(profile), |
26 has_shown_bubble_view_(false) { | 26 has_shown_bubble_view_(false) { |
27 GlobalErrorServiceFactory::GetForProfile(profile_)->AddUnownedGlobalError( | 27 GlobalErrorServiceFactory::GetForProfile(profile_)->AddUnownedGlobalError( |
28 this); | 28 this); |
29 | 29 |
30 PrefService* pref = g_browser_process->local_state(); | 30 PrefService* pref = g_browser_process->local_state(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 int RecoveryInstallGlobalError::MenuItemCommandID() { | 62 int RecoveryInstallGlobalError::MenuItemCommandID() { |
63 return IDC_ELEVATED_RECOVERY_DIALOG; | 63 return IDC_ELEVATED_RECOVERY_DIALOG; |
64 } | 64 } |
65 | 65 |
66 base::string16 RecoveryInstallGlobalError::MenuItemLabel() { | 66 base::string16 RecoveryInstallGlobalError::MenuItemLabel() { |
67 return l10n_util::GetStringUTF16(IDS_UPDATE_NOW); | 67 return l10n_util::GetStringUTF16(IDS_UPDATE_NOW); |
68 } | 68 } |
69 | 69 |
70 gfx::Image RecoveryInstallGlobalError::MenuItemIcon() { | 70 gfx::Image RecoveryInstallGlobalError::MenuItemIcon() { |
71 return gfx::Image(gfx::CreateVectorIcon( | 71 return gfx::Image(gfx::CreateVectorIcon( |
72 gfx::VectorIconId::BROWSER_TOOLS_UPDATE, | 72 kBrowserToolsUpdateIcon, |
73 ui::NativeTheme::GetInstanceForNativeUi()->GetSystemColor( | 73 ui::NativeTheme::GetInstanceForNativeUi()->GetSystemColor( |
74 ui::NativeTheme::kColorId_AlertSeverityHigh))); | 74 ui::NativeTheme::kColorId_AlertSeverityHigh))); |
75 } | 75 } |
76 | 76 |
77 void RecoveryInstallGlobalError::ExecuteMenuItem(Browser* browser) { | 77 void RecoveryInstallGlobalError::ExecuteMenuItem(Browser* browser) { |
78 ShowBubbleView(browser); | 78 ShowBubbleView(browser); |
79 } | 79 } |
80 | 80 |
81 bool RecoveryInstallGlobalError::HasBubbleView() { | 81 bool RecoveryInstallGlobalError::HasBubbleView() { |
82 return HasElevationNotification(); | 82 return HasElevationNotification(); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 DCHECK(pref->FindPreference(prefs::kRecoveryComponentNeedsElevation)); | 150 DCHECK(pref->FindPreference(prefs::kRecoveryComponentNeedsElevation)); |
151 elevation_needed_ = pref->GetBoolean(prefs::kRecoveryComponentNeedsElevation); | 151 elevation_needed_ = pref->GetBoolean(prefs::kRecoveryComponentNeedsElevation); |
152 | 152 |
153 // Got a new elevation request, resets |has_shown_bubble_view_| so the | 153 // Got a new elevation request, resets |has_shown_bubble_view_| so the |
154 // bubble has a higher priority to show. | 154 // bubble has a higher priority to show. |
155 if (elevation_needed_) | 155 if (elevation_needed_) |
156 has_shown_bubble_view_ = false; | 156 has_shown_bubble_view_ = false; |
157 | 157 |
158 GlobalErrorServiceFactory::GetForProfile(profile_)->NotifyErrorsChanged(this); | 158 GlobalErrorServiceFactory::GetForProfile(profile_)->NotifyErrorsChanged(this); |
159 } | 159 } |
OLD | NEW |