| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #ifndef CHROME_BROWSER_CHROMEOS_PROFILES_PROFILE_HELPER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_PROFILES_PROFILE_HELPER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_PROFILES_PROFILE_HELPER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_PROFILES_PROFILE_HELPER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 // during signin flow: GetSigninProfile() | 38 // during signin flow: GetSigninProfile() |
| 39 // 2. Get profile dir of an active user, used by ProfileManager: | 39 // 2. Get profile dir of an active user, used by ProfileManager: |
| 40 // GetActiveUserProfileDir() | 40 // GetActiveUserProfileDir() |
| 41 // 3. Get mapping from user_id_hash to Profile instance/profile path etc. | 41 // 3. Get mapping from user_id_hash to Profile instance/profile path etc. |
| 42 class ProfileHelper | 42 class ProfileHelper |
| 43 : public BrowsingDataRemover::Observer, | 43 : public BrowsingDataRemover::Observer, |
| 44 public OAuth2LoginManager::Observer, | 44 public OAuth2LoginManager::Observer, |
| 45 public user_manager::UserManager::UserSessionStateObserver { | 45 public user_manager::UserManager::UserSessionStateObserver { |
| 46 public: | 46 public: |
| 47 ProfileHelper(); | 47 ProfileHelper(); |
| 48 virtual ~ProfileHelper(); | 48 ~ProfileHelper() override; |
| 49 | 49 |
| 50 // Returns ProfileHelper instance. This class is not singleton and is owned | 50 // Returns ProfileHelper instance. This class is not singleton and is owned |
| 51 // by BrowserProcess/BrowserProcessPlatformPart. This method keeps that | 51 // by BrowserProcess/BrowserProcessPlatformPart. This method keeps that |
| 52 // knowledge in one place. | 52 // knowledge in one place. |
| 53 static ProfileHelper* Get(); | 53 static ProfileHelper* Get(); |
| 54 | 54 |
| 55 // Returns Profile instance that corresponds to |user_id_hash|. | 55 // Returns Profile instance that corresponds to |user_id_hash|. |
| 56 static Profile* GetProfileByUserIdHash(const std::string& user_id_hash); | 56 static Profile* GetProfileByUserIdHash(const std::string& user_id_hash); |
| 57 | 57 |
| 58 // Returns profile path that corresponds to a given |user_id_hash|. | 58 // Returns profile path that corresponds to a given |user_id_hash|. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 friend class extensions::ExtensionGarbageCollectorChromeOSUnitTest; | 128 friend class extensions::ExtensionGarbageCollectorChromeOSUnitTest; |
| 129 friend class FakeUserManager; | 129 friend class FakeUserManager; |
| 130 friend class KioskTest; | 130 friend class KioskTest; |
| 131 friend class MockUserManager; | 131 friend class MockUserManager; |
| 132 friend class MultiProfileUserControllerTest; | 132 friend class MultiProfileUserControllerTest; |
| 133 friend class ProfileHelperTest; | 133 friend class ProfileHelperTest; |
| 134 friend class ProfileListChromeOSTest; | 134 friend class ProfileListChromeOSTest; |
| 135 friend class SessionStateDelegateChromeOSTest; | 135 friend class SessionStateDelegateChromeOSTest; |
| 136 | 136 |
| 137 // BrowsingDataRemover::Observer implementation: | 137 // BrowsingDataRemover::Observer implementation: |
| 138 virtual void OnBrowsingDataRemoverDone() override; | 138 void OnBrowsingDataRemoverDone() override; |
| 139 | 139 |
| 140 // OAuth2LoginManager::Observer overrides. | 140 // OAuth2LoginManager::Observer overrides. |
| 141 virtual void OnSessionRestoreStateChanged( | 141 void OnSessionRestoreStateChanged( |
| 142 Profile* user_profile, | 142 Profile* user_profile, |
| 143 OAuth2LoginManager::SessionRestoreState state) override; | 143 OAuth2LoginManager::SessionRestoreState state) override; |
| 144 | 144 |
| 145 // user_manager::UserManager::UserSessionStateObserver implementation: | 145 // user_manager::UserManager::UserSessionStateObserver implementation: |
| 146 virtual void ActiveUserHashChanged(const std::string& hash) override; | 146 void ActiveUserHashChanged(const std::string& hash) override; |
| 147 | 147 |
| 148 // Associates |user| with profile with the same user_id, | 148 // Associates |user| with profile with the same user_id, |
| 149 // for GetUserByProfile() testing. | 149 // for GetUserByProfile() testing. |
| 150 void SetProfileToUserMappingForTesting(user_manager::User* user); | 150 void SetProfileToUserMappingForTesting(user_manager::User* user); |
| 151 | 151 |
| 152 // Enables/disables testing code path in GetUserByProfile() like | 152 // Enables/disables testing code path in GetUserByProfile() like |
| 153 // always return primary user (when always_return_primary_user_for_testing is | 153 // always return primary user (when always_return_primary_user_for_testing is |
| 154 // set). | 154 // set). |
| 155 static void SetProfileToUserForTestingEnabled(bool enabled); | 155 static void SetProfileToUserForTestingEnabled(bool enabled); |
| 156 | 156 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 186 // If true and enable_profile_to_user_testing is true then primary user will | 186 // If true and enable_profile_to_user_testing is true then primary user will |
| 187 // always be returned by GetUserByProfile(). | 187 // always be returned by GetUserByProfile(). |
| 188 static bool always_return_primary_user_for_testing; | 188 static bool always_return_primary_user_for_testing; |
| 189 | 189 |
| 190 DISALLOW_COPY_AND_ASSIGN(ProfileHelper); | 190 DISALLOW_COPY_AND_ASSIGN(ProfileHelper); |
| 191 }; | 191 }; |
| 192 | 192 |
| 193 } // namespace chromeos | 193 } // namespace chromeos |
| 194 | 194 |
| 195 #endif // CHROME_BROWSER_CHROMEOS_PROFILES_PROFILE_HELPER_H_ | 195 #endif // CHROME_BROWSER_CHROMEOS_PROFILES_PROFILE_HELPER_H_ |
| OLD | NEW |