| 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) { |
| 186 if (!detector || !info) |
| 187 return; |
| 188 ash::UpdateInfo::UpdateSeverity severity = |
| 189 ash::UpdateInfo::UPDATE_NORMAL; |
| 190 switch (detector->upgrade_notification_stage()) { |
| 191 case UpgradeDetector::UPGRADE_ANNOYANCE_SEVERE: |
| 192 severity = ash::UpdateInfo::UPDATE_SEVERE_RED; |
| 193 break; |
| 194 |
| 195 case UpgradeDetector::UPGRADE_ANNOYANCE_HIGH: |
| 196 severity = ash::UpdateInfo::UPDATE_HIGH_ORANGE; |
| 197 break; |
| 198 |
| 199 case UpgradeDetector::UPGRADE_ANNOYANCE_ELEVATED: |
| 200 severity = ash::UpdateInfo::UPDATE_LOW_GREEN; |
| 201 break; |
| 202 |
| 203 case UpgradeDetector::UPGRADE_ANNOYANCE_LOW: |
| 204 default: |
| 205 severity = ash::UpdateInfo::UPDATE_NORMAL; |
| 206 break; |
| 207 } |
| 208 info->severity = severity; |
| 209 info->is_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 bool SystemTrayDelegateChromeOS::SystemShouldUpgrade( |
| 410 return UpgradeDetector::GetInstance()->notify_upgrade(); | 437 ash::UpdateInfo* info) const { |
| 438 UpgradeDetector* detector = UpgradeDetector::GetInstance(); |
| 439 GetUpdateInfo(detector, info); |
| 440 return detector->notify_upgrade(); |
| 411 } | 441 } |
| 412 | 442 |
| 413 base::HourClockType SystemTrayDelegateChromeOS::GetHourClockType() const { | 443 base::HourClockType SystemTrayDelegateChromeOS::GetHourClockType() const { |
| 414 return clock_type_; | 444 return clock_type_; |
| 415 } | 445 } |
| 416 | 446 |
| 417 void SystemTrayDelegateChromeOS::ShowSettings() { | 447 void SystemTrayDelegateChromeOS::ShowSettings() { |
| 418 ShowSettingsSubPageForActiveUser(""); | 448 ShowSettingsSubPageForActiveUser(""); |
| 419 } | 449 } |
| 420 | 450 |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 return GetNativeWindowByStatus(GetUserLoginStatus(), session_started); | 1110 return GetNativeWindowByStatus(GetUserLoginStatus(), session_started); |
| 1081 } | 1111 } |
| 1082 | 1112 |
| 1083 // content::NotificationObserver implementation. | 1113 // content::NotificationObserver implementation. |
| 1084 void SystemTrayDelegateChromeOS::Observe( | 1114 void SystemTrayDelegateChromeOS::Observe( |
| 1085 int type, | 1115 int type, |
| 1086 const content::NotificationSource& source, | 1116 const content::NotificationSource& source, |
| 1087 const content::NotificationDetails& details) { | 1117 const content::NotificationDetails& details) { |
| 1088 switch (type) { | 1118 switch (type) { |
| 1089 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: { | 1119 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: { |
| 1090 UpgradeDetector* detector = | 1120 ash::UpdateInfo info; |
| 1091 content::Source<UpgradeDetector>(source).ptr(); | 1121 GetUpdateInfo(content::Source<UpgradeDetector>(source).ptr(), &info); |
| 1092 ash::UpdateObserver::UpdateSeverity severity = | 1122 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; | 1123 break; |
| 1114 } | 1124 } |
| 1115 case chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED: { | 1125 case chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED: { |
| 1116 // This notification is also sent on login screen when user avatar | 1126 // This notification is also sent on login screen when user avatar |
| 1117 // is loaded from file. | 1127 // is loaded from file. |
| 1118 if (GetUserLoginStatus() != ash::user::LOGGED_IN_NONE) { | 1128 if (GetUserLoginStatus() != ash::user::LOGGED_IN_NONE) { |
| 1119 GetSystemTrayNotifier()->NotifyUserUpdate(); | 1129 GetSystemTrayNotifier()->NotifyUserUpdate(); |
| 1120 } | 1130 } |
| 1121 break; | 1131 break; |
| 1122 } | 1132 } |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1295 accessibility_subscription_.reset(); | 1305 accessibility_subscription_.reset(); |
| 1296 else | 1306 else |
| 1297 OnAccessibilityModeChanged(details.notify); | 1307 OnAccessibilityModeChanged(details.notify); |
| 1298 } | 1308 } |
| 1299 | 1309 |
| 1300 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1310 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
| 1301 return new SystemTrayDelegateChromeOS(); | 1311 return new SystemTrayDelegateChromeOS(); |
| 1302 } | 1312 } |
| 1303 | 1313 |
| 1304 } // namespace chromeos | 1314 } // namespace chromeos |
| OLD | NEW |