| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 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/supervised_user/supervised_user_service.h" | 5 #include "chrome/browser/supervised_user/supervised_user_service.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 return (*sites.begin())->category_id; | 212 return (*sites.begin())->category_id; |
| 213 } | 213 } |
| 214 | 214 |
| 215 // static | 215 // static |
| 216 void SupervisedUserService::GetCategoryNames(CategoryList* list) { | 216 void SupervisedUserService::GetCategoryNames(CategoryList* list) { |
| 217 SupervisedUserSiteList::GetCategoryNames(list); | 217 SupervisedUserSiteList::GetCategoryNames(list); |
| 218 } | 218 } |
| 219 | 219 |
| 220 std::string SupervisedUserService::GetCustodianEmailAddress() const { | 220 std::string SupervisedUserService::GetCustodianEmailAddress() const { |
| 221 #if defined(OS_CHROMEOS) | 221 #if defined(OS_CHROMEOS) |
| 222 return chromeos::UserManager::Get()->GetSupervisedUserManager()-> | 222 return chromeos::GetUserManager() |
| 223 GetManagerDisplayEmail( | 223 ->GetSupervisedUserManager() |
| 224 chromeos::UserManager::Get()->GetActiveUser()->email()); | 224 ->GetManagerDisplayEmail( |
| 225 chromeos::GetUserManager()->GetActiveUser()->email()); |
| 225 #else | 226 #else |
| 226 return profile_->GetPrefs()->GetString(prefs::kSupervisedUserCustodianEmail); | 227 return profile_->GetPrefs()->GetString(prefs::kSupervisedUserCustodianEmail); |
| 227 #endif | 228 #endif |
| 228 } | 229 } |
| 229 | 230 |
| 230 std::string SupervisedUserService::GetCustodianName() const { | 231 std::string SupervisedUserService::GetCustodianName() const { |
| 231 #if defined(OS_CHROMEOS) | 232 #if defined(OS_CHROMEOS) |
| 232 return base::UTF16ToUTF8(chromeos::UserManager::Get()-> | 233 return base::UTF16ToUTF8( |
| 233 GetSupervisedUserManager()->GetManagerDisplayName( | 234 chromeos::GetUserManager() |
| 234 chromeos::UserManager::Get()->GetActiveUser()->email())); | 235 ->GetSupervisedUserManager() |
| 236 ->GetManagerDisplayName( |
| 237 chromeos::GetUserManager()->GetActiveUser()->email())); |
| 235 #else | 238 #else |
| 236 std::string name = profile_->GetPrefs()->GetString( | 239 std::string name = profile_->GetPrefs()->GetString( |
| 237 prefs::kSupervisedUserCustodianName); | 240 prefs::kSupervisedUserCustodianName); |
| 238 return name.empty() ? GetCustodianEmailAddress() : name; | 241 return name.empty() ? GetCustodianEmailAddress() : name; |
| 239 #endif | 242 #endif |
| 240 } | 243 } |
| 241 | 244 |
| 242 void SupervisedUserService::AddNavigationBlockedCallback( | 245 void SupervisedUserService::AddNavigationBlockedCallback( |
| 243 const NavigationBlockedCallback& callback) { | 246 const NavigationBlockedCallback& callback) { |
| 244 navigation_blocked_callbacks_.push_back(callback); | 247 navigation_blocked_callbacks_.push_back(callback); |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 | 747 |
| 745 void SupervisedUserService::OnBrowserSetLastActive(Browser* browser) { | 748 void SupervisedUserService::OnBrowserSetLastActive(Browser* browser) { |
| 746 bool profile_became_active = profile_->IsSameProfile(browser->profile()); | 749 bool profile_became_active = profile_->IsSameProfile(browser->profile()); |
| 747 if (!is_profile_active_ && profile_became_active) | 750 if (!is_profile_active_ && profile_became_active) |
| 748 content::RecordAction(UserMetricsAction("ManagedUsers_OpenProfile")); | 751 content::RecordAction(UserMetricsAction("ManagedUsers_OpenProfile")); |
| 749 else if (is_profile_active_ && !profile_became_active) | 752 else if (is_profile_active_ && !profile_became_active) |
| 750 content::RecordAction(UserMetricsAction("ManagedUsers_SwitchProfile")); | 753 content::RecordAction(UserMetricsAction("ManagedUsers_SwitchProfile")); |
| 751 | 754 |
| 752 is_profile_active_ = profile_became_active; | 755 is_profile_active_ = profile_became_active; |
| 753 } | 756 } |
| OLD | NEW |