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

Side by Side Diff: chrome/browser/ui/ash/system_tray_delegate_chromeos.cc

Issue 783963002: Tray message changed for child accounts. Warning bubble removed for child accounts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Inline temporarily removed. Created 5 years, 12 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
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/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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 #include "net/base/escape.h" 103 #include "net/base/escape.h"
104 #include "third_party/cros_system_api/dbus/service_constants.h" 104 #include "third_party/cros_system_api/dbus/service_constants.h"
105 #include "ui/base/ime/chromeos/extension_ime_util.h" 105 #include "ui/base/ime/chromeos/extension_ime_util.h"
106 #include "ui/base/ime/chromeos/ime_keyboard.h" 106 #include "ui/base/ime/chromeos/ime_keyboard.h"
107 #include "ui/base/ime/chromeos/input_method_manager.h" 107 #include "ui/base/ime/chromeos/input_method_manager.h"
108 #include "ui/base/l10n/l10n_util.h" 108 #include "ui/base/l10n/l10n_util.h"
109 #include "ui/base/l10n/time_format.h" 109 #include "ui/base/l10n/time_format.h"
110 #include "ui/chromeos/ime/input_method_menu_item.h" 110 #include "ui/chromeos/ime/input_method_menu_item.h"
111 #include "ui/chromeos/ime/input_method_menu_manager.h" 111 #include "ui/chromeos/ime/input_method_menu_manager.h"
112 112
113 #if defined(ENABLE_SUPERVISED_USERS)
114 #include "chrome/browser/supervised_user/supervised_user_service.h"
115 #include "chrome/browser/supervised_user/supervised_user_service_factory.h"
116 #endif
117
113 namespace chromeos { 118 namespace chromeos {
114 119
115 namespace { 120 namespace {
116 121
117 // The minimum session length limit that can be set. 122 // The minimum session length limit that can be set.
118 const int kSessionLengthLimitMinMs = 30 * 1000; // 30 seconds. 123 const int kSessionLengthLimitMinMs = 30 * 1000; // 30 seconds.
119 124
120 // The maximum session length limit that can be set. 125 // The maximum session length limit that can be set.
121 const int kSessionLengthLimitMaxMs = 24 * 60 * 60 * 1000; // 24 hours. 126 const int kSessionLengthLimitMaxMs = 24 * 60 * 60 * 1000; // 24 hours.
122 127
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 if (!IsUserSupervised()) 393 if (!IsUserSupervised())
389 return base::string16(); 394 return base::string16();
390 return base::UTF8ToUTF16(SupervisedUserServiceFactory::GetForProfile( 395 return base::UTF8ToUTF16(SupervisedUserServiceFactory::GetForProfile(
391 user_profile_)->GetCustodianName()); 396 user_profile_)->GetCustodianName());
392 } 397 }
393 398
394 const base::string16 SystemTrayDelegateChromeOS::GetSupervisedUserMessage() 399 const base::string16 SystemTrayDelegateChromeOS::GetSupervisedUserMessage()
395 const { 400 const {
396 if (!IsUserSupervised()) 401 if (!IsUserSupervised())
397 return base::string16(); 402 return base::string16();
398 std::string user_manager_name = GetSupervisedUserManager(); 403 if (IsUserChild())
399 LOG_IF(WARNING, user_manager_name.empty()) << 404 return GetChildUserMessage();
400 "Returning incomplete supervised user message as manager not known yet."; 405 return GetLegacySupervisedUserMessage();
401 return l10n_util::GetStringFUTF16(
402 IDS_USER_IS_SUPERVISED_BY_NOTICE,
403 base::UTF8ToUTF16(user_manager_name));
404 } 406 }
405 407
406 bool SystemTrayDelegateChromeOS::IsUserSupervised() const { 408 bool SystemTrayDelegateChromeOS::IsUserSupervised() const {
407 user_manager::User* user = user_manager::UserManager::Get()->GetActiveUser(); 409 user_manager::User* user = user_manager::UserManager::Get()->GetActiveUser();
408 return user && user->IsSupervised(); 410 return user && user->IsSupervised();
409 } 411 }
410 412
413 bool SystemTrayDelegateChromeOS::IsUserChild() const {
414 return user_manager::UserManager::Get()->IsLoggedInAsChildUser();
415 }
416
411 void SystemTrayDelegateChromeOS::GetSystemUpdateInfo( 417 void SystemTrayDelegateChromeOS::GetSystemUpdateInfo(
412 ash::UpdateInfo* info) const { 418 ash::UpdateInfo* info) const {
413 GetUpdateInfo(UpgradeDetector::GetInstance(), info); 419 GetUpdateInfo(UpgradeDetector::GetInstance(), info);
414 } 420 }
415 421
416 base::HourClockType SystemTrayDelegateChromeOS::GetHourClockType() const { 422 base::HourClockType SystemTrayDelegateChromeOS::GetHourClockType() const {
417 return clock_type_; 423 return clock_type_;
418 } 424 }
419 425
420 void SystemTrayDelegateChromeOS::ShowSettings() { 426 void SystemTrayDelegateChromeOS::ShowSettings() {
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 } 1317 }
1312 1318
1313 void SystemTrayDelegateChromeOS::OnAccessibilityStatusChanged( 1319 void SystemTrayDelegateChromeOS::OnAccessibilityStatusChanged(
1314 const AccessibilityStatusEventDetails& details) { 1320 const AccessibilityStatusEventDetails& details) {
1315 if (details.notification_type == ACCESSIBILITY_MANAGER_SHUTDOWN) 1321 if (details.notification_type == ACCESSIBILITY_MANAGER_SHUTDOWN)
1316 accessibility_subscription_.reset(); 1322 accessibility_subscription_.reset();
1317 else 1323 else
1318 OnAccessibilityModeChanged(details.notify); 1324 OnAccessibilityModeChanged(details.notify);
1319 } 1325 }
1320 1326
1327 const base::string16
1328 SystemTrayDelegateChromeOS::GetLegacySupervisedUserMessage() const {
1329 std::string user_manager_name = GetSupervisedUserManager();
1330 return l10n_util::GetStringFUTF16(
1331 IDS_USER_IS_SUPERVISED_BY_NOTICE,
1332 base::UTF8ToUTF16(user_manager_name));
1333 }
1334
1335 const base::string16
1336 SystemTrayDelegateChromeOS::GetChildUserMessage() const {
1337 #if defined(ENABLE_SUPERVISED_USERS)
1338 SupervisedUserService* service =
1339 SupervisedUserServiceFactory::GetForProfile(user_profile_);
1340 base::string16 first_custodian =
1341 base::UTF8ToUTF16(service->GetCustodianEmailAddress());
1342 base::string16 second_custodian =
1343 base::UTF8ToUTF16(service->GetSecondCustodianEmailAddress());
1344 LOG_IF(WARNING, first_custodian.empty()) <<
1345 "Returning incomplete child user message as manager not known yet.";
1346 if (second_custodian.empty()) {
1347 return l10n_util::GetStringFUTF16(
1348 IDS_CHILD_USER_IS_MANAGED_BY_ONE_PARENT_NOTICE, first_custodian);
1349 } else {
1350 return l10n_util::GetStringFUTF16(
1351 IDS_CHILD_USER_IS_MANAGED_BY_TWO_PARENTS_NOTICE,
1352 first_custodian,
1353 second_custodian);
1354 }
1355 #endif
1356
1357 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while "
1358 << "ENABLE_SUPERVISED_USERS undefined.";
1359 return base::string16();
1360 }
1361
1321 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { 1362 ash::SystemTrayDelegate* CreateSystemTrayDelegate() {
1322 return new SystemTrayDelegateChromeOS(); 1363 return new SystemTrayDelegateChromeOS();
1323 } 1364 }
1324 1365
1325 } // namespace chromeos 1366 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/system_tray_delegate_chromeos.h ('k') | chrome/browser/ui/ash/system_tray_delegate_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698