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

Side by Side Diff: chrome/browser/supervised_user/supervised_user_service.cc

Issue 444903002: [cros] user_manager component - move UserManagerBase and UserManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: similarity Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
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 29 matching lines...) Expand all
40 #include "components/signin/core/browser/signin_manager.h" 40 #include "components/signin/core/browser/signin_manager.h"
41 #include "components/signin/core/browser/signin_manager_base.h" 41 #include "components/signin/core/browser/signin_manager_base.h"
42 #include "content/public/browser/browser_thread.h" 42 #include "content/public/browser/browser_thread.h"
43 #include "content/public/browser/user_metrics.h" 43 #include "content/public/browser/user_metrics.h"
44 #include "google_apis/gaia/google_service_auth_error.h" 44 #include "google_apis/gaia/google_service_auth_error.h"
45 #include "grit/generated_resources.h" 45 #include "grit/generated_resources.h"
46 #include "net/base/escape.h" 46 #include "net/base/escape.h"
47 #include "ui/base/l10n/l10n_util.h" 47 #include "ui/base/l10n/l10n_util.h"
48 48
49 #if defined(OS_CHROMEOS) 49 #if defined(OS_CHROMEOS)
50 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h"
50 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" 51 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h"
51 #include "chrome/browser/chromeos/login/users/user_manager.h" 52 #include "components/user_manager/user_manager.h"
52 #endif 53 #endif
53 54
54 #if defined(ENABLE_EXTENSIONS) 55 #if defined(ENABLE_EXTENSIONS)
55 #include "chrome/browser/extensions/extension_service.h" 56 #include "chrome/browser/extensions/extension_service.h"
56 #include "chrome/common/extensions/api/supervised_user_private/supervised_user_h andler.h" 57 #include "chrome/common/extensions/api/supervised_user_private/supervised_user_h andler.h"
57 #include "extensions/browser/extension_registry.h" 58 #include "extensions/browser/extension_registry.h"
58 #include "extensions/browser/extension_system.h" 59 #include "extensions/browser/extension_system.h"
59 #include "extensions/common/extension_set.h" 60 #include "extensions/common/extension_set.h"
60 #endif 61 #endif
61 62
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 return (*sites.begin())->category_id; 230 return (*sites.begin())->category_id;
230 } 231 }
231 232
232 // static 233 // static
233 void SupervisedUserService::GetCategoryNames(CategoryList* list) { 234 void SupervisedUserService::GetCategoryNames(CategoryList* list) {
234 SupervisedUserSiteList::GetCategoryNames(list); 235 SupervisedUserSiteList::GetCategoryNames(list);
235 } 236 }
236 237
237 std::string SupervisedUserService::GetCustodianEmailAddress() const { 238 std::string SupervisedUserService::GetCustodianEmailAddress() const {
238 #if defined(OS_CHROMEOS) 239 #if defined(OS_CHROMEOS)
239 return chromeos::UserManager::Get()->GetSupervisedUserManager()-> 240 return chromeos::ChromeUserManager::Get()
240 GetManagerDisplayEmail( 241 ->GetSupervisedUserManager()
241 chromeos::UserManager::Get()->GetActiveUser()->email()); 242 ->GetManagerDisplayEmail(
243 user_manager::UserManager::Get()->GetActiveUser()->email());
242 #else 244 #else
243 return profile_->GetPrefs()->GetString(prefs::kSupervisedUserCustodianEmail); 245 return profile_->GetPrefs()->GetString(prefs::kSupervisedUserCustodianEmail);
244 #endif 246 #endif
245 } 247 }
246 248
247 std::string SupervisedUserService::GetCustodianName() const { 249 std::string SupervisedUserService::GetCustodianName() const {
248 #if defined(OS_CHROMEOS) 250 #if defined(OS_CHROMEOS)
249 return base::UTF16ToUTF8(chromeos::UserManager::Get()-> 251 return base::UTF16ToUTF8(
250 GetSupervisedUserManager()->GetManagerDisplayName( 252 chromeos::ChromeUserManager::Get()
251 chromeos::UserManager::Get()->GetActiveUser()->email())); 253 ->GetSupervisedUserManager()
254 ->GetManagerDisplayName(
255 user_manager::UserManager::Get()->GetActiveUser()->email()));
252 #else 256 #else
253 std::string name = profile_->GetPrefs()->GetString( 257 std::string name = profile_->GetPrefs()->GetString(
254 prefs::kSupervisedUserCustodianName); 258 prefs::kSupervisedUserCustodianName);
255 return name.empty() ? GetCustodianEmailAddress() : name; 259 return name.empty() ? GetCustodianEmailAddress() : name;
256 #endif 260 #endif
257 } 261 }
258 262
259 void SupervisedUserService::AddNavigationBlockedCallback( 263 void SupervisedUserService::AddNavigationBlockedCallback(
260 const NavigationBlockedCallback& callback) { 264 const NavigationBlockedCallback& callback) {
261 navigation_blocked_callbacks_.push_back(callback); 265 navigation_blocked_callbacks_.push_back(callback);
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 content::RecordAction(UserMetricsAction("ManagedUsers_OpenProfile")); 777 content::RecordAction(UserMetricsAction("ManagedUsers_OpenProfile"));
774 else if (is_profile_active_ && !profile_became_active) 778 else if (is_profile_active_ && !profile_became_active)
775 content::RecordAction(UserMetricsAction("ManagedUsers_SwitchProfile")); 779 content::RecordAction(UserMetricsAction("ManagedUsers_SwitchProfile"));
776 780
777 is_profile_active_ = profile_became_active; 781 is_profile_active_ = profile_became_active;
778 } 782 }
779 783
780 std::string SupervisedUserService::GetSupervisedUserName() const { 784 std::string SupervisedUserService::GetSupervisedUserName() const {
781 #if defined(OS_CHROMEOS) 785 #if defined(OS_CHROMEOS)
782 // The active user can be NULL in unit tests. 786 // The active user can be NULL in unit tests.
783 if (chromeos::UserManager::Get()->GetActiveUser()) { 787 if (user_manager::UserManager::Get()->GetActiveUser()) {
784 return UTF16ToUTF8(chromeos::UserManager::Get()->GetUserDisplayName( 788 return UTF16ToUTF8(user_manager::UserManager::Get()->GetUserDisplayName(
785 chromeos::UserManager::Get()->GetActiveUser()->GetUserID())); 789 user_manager::UserManager::Get()->GetActiveUser()->GetUserID()));
786 } 790 }
787 return std::string(); 791 return std::string();
788 #else 792 #else
789 return profile_->GetPrefs()->GetString(prefs::kProfileName); 793 return profile_->GetPrefs()->GetString(prefs::kProfileName);
790 #endif 794 #endif
791 } 795 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698