OLD | NEW |
---|---|
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/ash/system_tray_delegate_chromeos.h" | 5 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
175 content::RecordAction(base::UserMetricsAction("OpenInternetOptionsDialog")); | 175 content::RecordAction(base::UserMetricsAction("OpenInternetOptionsDialog")); |
176 ShowSettingsSubPageForActiveUser(page); | 176 ShowSettingsSubPageForActiveUser(page); |
177 } | 177 } |
178 | 178 |
179 void OnAcceptMultiprofilesIntro(bool no_show_again) { | 179 void OnAcceptMultiprofilesIntro(bool no_show_again) { |
180 PrefService* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); | 180 PrefService* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); |
181 prefs->SetBoolean(prefs::kMultiProfileNeverShowIntro, no_show_again); | 181 prefs->SetBoolean(prefs::kMultiProfileNeverShowIntro, no_show_again); |
182 UserAddingScreen::Get()->Start(); | 182 UserAddingScreen::Get()->Start(); |
183 } | 183 } |
184 | 184 |
185 void GetUpdateInfo(const UpgradeDetector* detector, ash::UpdateInfo* info) { | |
sky
2014/10/02 17:23:06
Isn't this code the same as the _win and _linux co
ygorshenin1
2014/10/03 14:55:36
Yes, this code is the same for all platforms. I've
| |
186 if (!detector || !info) | |
sky
2014/10/02 17:23:06
Do we really allow either of these to be NULL? Sho
ygorshenin1
2014/10/03 14:55:37
Done.
| |
187 return; | |
188 ash::UpdateInfo::UpdateSeverity severity = ash::UpdateInfo::UPDATE_NORMAL; | |
sky
2014/10/02 17:23:06
Why bother with the local and not set info->severi
ygorshenin1
2014/10/03 14:55:36
Done.
| |
189 switch (detector->upgrade_notification_stage()) { | |
190 case UpgradeDetector::UPGRADE_ANNOYANCE_SEVERE: | |
191 severity = ash::UpdateInfo::UPDATE_SEVERE_RED; | |
192 break; | |
193 | |
194 case UpgradeDetector::UPGRADE_ANNOYANCE_HIGH: | |
195 severity = ash::UpdateInfo::UPDATE_HIGH_ORANGE; | |
196 break; | |
197 | |
198 case UpgradeDetector::UPGRADE_ANNOYANCE_ELEVATED: | |
199 severity = ash::UpdateInfo::UPDATE_LOW_GREEN; | |
200 break; | |
201 | |
202 case UpgradeDetector::UPGRADE_ANNOYANCE_LOW: | |
203 default: | |
204 severity = ash::UpdateInfo::UPDATE_NORMAL; | |
sky
2014/10/02 17:23:06
Isn't this covered by 188? I recommend nuking 188
ygorshenin1
2014/10/03 14:55:36
Done.
| |
205 break; | |
206 } | |
207 info->severity = severity; | |
208 info->update_required = detector->notify_upgrade(); | |
209 info->factory_reset_required = detector->is_factory_reset_required(); | |
210 } | |
211 | |
185 } // namespace | 212 } // namespace |
186 | 213 |
187 SystemTrayDelegateChromeOS::SystemTrayDelegateChromeOS() | 214 SystemTrayDelegateChromeOS::SystemTrayDelegateChromeOS() |
188 : user_profile_(NULL), | 215 : user_profile_(NULL), |
189 clock_type_(base::GetHourClockType()), | 216 clock_type_(base::GetHourClockType()), |
190 search_key_mapped_to_(input_method::kSearchKey), | 217 search_key_mapped_to_(input_method::kSearchKey), |
191 screen_locked_(false), | 218 screen_locked_(false), |
192 have_session_start_time_(false), | 219 have_session_start_time_(false), |
193 have_session_length_limit_(false), | 220 have_session_length_limit_(false), |
194 should_run_bluetooth_discovery_(false), | 221 should_run_bluetooth_discovery_(false), |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
399 return l10n_util::GetStringFUTF16( | 426 return l10n_util::GetStringFUTF16( |
400 IDS_USER_IS_SUPERVISED_BY_NOTICE, | 427 IDS_USER_IS_SUPERVISED_BY_NOTICE, |
401 base::UTF8ToUTF16(GetSupervisedUserManager())); | 428 base::UTF8ToUTF16(GetSupervisedUserManager())); |
402 } | 429 } |
403 | 430 |
404 bool SystemTrayDelegateChromeOS::IsUserSupervised() const { | 431 bool SystemTrayDelegateChromeOS::IsUserSupervised() const { |
405 user_manager::User* user = user_manager::UserManager::Get()->GetActiveUser(); | 432 user_manager::User* user = user_manager::UserManager::Get()->GetActiveUser(); |
406 return user && user->IsSupervised(); | 433 return user && user->IsSupervised(); |
407 } | 434 } |
408 | 435 |
409 bool SystemTrayDelegateChromeOS::SystemShouldUpgrade() const { | 436 void SystemTrayDelegateChromeOS::GetSystemUpdateInfo( |
410 return UpgradeDetector::GetInstance()->notify_upgrade(); | 437 ash::UpdateInfo* info) const { |
438 GetUpdateInfo(UpgradeDetector::GetInstance(), info); | |
411 } | 439 } |
412 | 440 |
413 base::HourClockType SystemTrayDelegateChromeOS::GetHourClockType() const { | 441 base::HourClockType SystemTrayDelegateChromeOS::GetHourClockType() const { |
414 return clock_type_; | 442 return clock_type_; |
415 } | 443 } |
416 | 444 |
417 void SystemTrayDelegateChromeOS::ShowSettings() { | 445 void SystemTrayDelegateChromeOS::ShowSettings() { |
418 ShowSettingsSubPageForActiveUser(""); | 446 ShowSettingsSubPageForActiveUser(""); |
419 } | 447 } |
420 | 448 |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1080 return GetNativeWindowByStatus(GetUserLoginStatus(), session_started); | 1108 return GetNativeWindowByStatus(GetUserLoginStatus(), session_started); |
1081 } | 1109 } |
1082 | 1110 |
1083 // content::NotificationObserver implementation. | 1111 // content::NotificationObserver implementation. |
1084 void SystemTrayDelegateChromeOS::Observe( | 1112 void SystemTrayDelegateChromeOS::Observe( |
1085 int type, | 1113 int type, |
1086 const content::NotificationSource& source, | 1114 const content::NotificationSource& source, |
1087 const content::NotificationDetails& details) { | 1115 const content::NotificationDetails& details) { |
1088 switch (type) { | 1116 switch (type) { |
1089 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: { | 1117 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: { |
1090 UpgradeDetector* detector = | 1118 ash::UpdateInfo info; |
1091 content::Source<UpgradeDetector>(source).ptr(); | 1119 GetUpdateInfo(content::Source<UpgradeDetector>(source).ptr(), &info); |
1092 ash::UpdateObserver::UpdateSeverity severity = | 1120 GetSystemTrayNotifier()->NotifyUpdateRecommended(info); |
1093 ash::UpdateObserver::UPDATE_NORMAL; | |
1094 switch (detector->upgrade_notification_stage()) { | |
1095 case UpgradeDetector::UPGRADE_ANNOYANCE_SEVERE: | |
1096 severity = ash::UpdateObserver::UPDATE_SEVERE_RED; | |
1097 break; | |
1098 | |
1099 case UpgradeDetector::UPGRADE_ANNOYANCE_HIGH: | |
1100 severity = ash::UpdateObserver::UPDATE_HIGH_ORANGE; | |
1101 break; | |
1102 | |
1103 case UpgradeDetector::UPGRADE_ANNOYANCE_ELEVATED: | |
1104 severity = ash::UpdateObserver::UPDATE_LOW_GREEN; | |
1105 break; | |
1106 | |
1107 case UpgradeDetector::UPGRADE_ANNOYANCE_LOW: | |
1108 default: | |
1109 severity = ash::UpdateObserver::UPDATE_NORMAL; | |
1110 break; | |
1111 } | |
1112 GetSystemTrayNotifier()->NotifyUpdateRecommended(severity); | |
1113 break; | 1121 break; |
1114 } | 1122 } |
1115 case chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED: { | 1123 case chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED: { |
1116 // This notification is also sent on login screen when user avatar | 1124 // This notification is also sent on login screen when user avatar |
1117 // is loaded from file. | 1125 // is loaded from file. |
1118 if (GetUserLoginStatus() != ash::user::LOGGED_IN_NONE) { | 1126 if (GetUserLoginStatus() != ash::user::LOGGED_IN_NONE) { |
1119 GetSystemTrayNotifier()->NotifyUserUpdate(); | 1127 GetSystemTrayNotifier()->NotifyUserUpdate(); |
1120 } | 1128 } |
1121 break; | 1129 break; |
1122 } | 1130 } |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1295 accessibility_subscription_.reset(); | 1303 accessibility_subscription_.reset(); |
1296 else | 1304 else |
1297 OnAccessibilityModeChanged(details.notify); | 1305 OnAccessibilityModeChanged(details.notify); |
1298 } | 1306 } |
1299 | 1307 |
1300 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1308 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
1301 return new SystemTrayDelegateChromeOS(); | 1309 return new SystemTrayDelegateChromeOS(); |
1302 } | 1310 } |
1303 | 1311 |
1304 } // namespace chromeos | 1312 } // namespace chromeos |
OLD | NEW |