| 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/chromeos/ownership/owner_settings_service_factory.h" | 5 #include "chrome/browser/chromeos/ownership/owner_settings_service_factory.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chromeos/login/users/user.h" | 7 #include "chrome/browser/chromeos/login/users/user.h" |
| 8 #include "chrome/browser/chromeos/login/users/user_manager.h" | 8 #include "chrome/browser/chromeos/login/users/user_manager.h" |
| 9 #include "chrome/browser/chromeos/ownership/owner_settings_service.h" | 9 #include "chrome/browser/chromeos/ownership/owner_settings_service.h" |
| 10 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 10 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 // static | 32 // static |
| 33 OwnerSettingsServiceFactory* OwnerSettingsServiceFactory::GetInstance() { | 33 OwnerSettingsServiceFactory* OwnerSettingsServiceFactory::GetInstance() { |
| 34 return Singleton<OwnerSettingsServiceFactory>::get(); | 34 return Singleton<OwnerSettingsServiceFactory>::get(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 void OwnerSettingsServiceFactory::SetUsername(const std::string& username) { | 37 void OwnerSettingsServiceFactory::SetUsername(const std::string& username) { |
| 38 username_ = username; | 38 username_ = username; |
| 39 if (!UserManager::IsInitialized()) | 39 if (!UserManager::IsInitialized()) |
| 40 return; | 40 return; |
| 41 const User* user = UserManager::Get()->FindUser(username_); | 41 const User* user = GetUserManager()->FindUser(username_); |
| 42 if (!user || !user->is_profile_created()) | 42 if (!user || !user->is_profile_created()) |
| 43 return; | 43 return; |
| 44 Profile* profile = ProfileHelper::Get()->GetProfileByUser(user); | 44 Profile* profile = ProfileHelper::Get()->GetProfileByUser(user); |
| 45 if (!profile) | 45 if (!profile) |
| 46 return; | 46 return; |
| 47 OwnerSettingsService* service = GetForProfile(profile); | 47 OwnerSettingsService* service = GetForProfile(profile); |
| 48 | 48 |
| 49 // It's safe to call ReloadPrivateKey() here, as profile is fully created | 49 // It's safe to call ReloadPrivateKey() here, as profile is fully created |
| 50 // at this time. | 50 // at this time. |
| 51 if (service) | 51 if (service) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 68 bool OwnerSettingsServiceFactory::ServiceIsCreatedWithBrowserContext() const { | 68 bool OwnerSettingsServiceFactory::ServiceIsCreatedWithBrowserContext() const { |
| 69 return true; | 69 return true; |
| 70 } | 70 } |
| 71 | 71 |
| 72 KeyedService* OwnerSettingsServiceFactory::BuildServiceInstanceFor( | 72 KeyedService* OwnerSettingsServiceFactory::BuildServiceInstanceFor( |
| 73 content::BrowserContext* context) const { | 73 content::BrowserContext* context) const { |
| 74 return BuildInstanceFor(context); | 74 return BuildInstanceFor(context); |
| 75 } | 75 } |
| 76 | 76 |
| 77 } // namespace chromeos | 77 } // namespace chromeos |
| OLD | NEW |