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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 virtual ~ProfileHelper(); | 48 virtual ~ProfileHelper(); |
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 dir that corresponds to a --login-profile cmd line switch. | |
59 static base::FilePath GetProfileDirByLegacyLoginProfileSwitch(); | |
60 | |
61 // Returns profile path that corresponds to a given |user_id_hash|. | 58 // Returns profile path that corresponds to a given |user_id_hash|. |
62 static base::FilePath GetProfilePathByUserIdHash( | 59 static base::FilePath GetProfilePathByUserIdHash( |
63 const std::string& user_id_hash); | 60 const std::string& user_id_hash); |
64 | 61 |
65 // Returns the path that corresponds to the sign-in profile. | 62 // Returns the path that corresponds to the sign-in profile. |
66 static base::FilePath GetSigninProfileDir(); | 63 static base::FilePath GetSigninProfileDir(); |
67 | 64 |
68 // Returns OffTheRecord profile for use during signing phase. | 65 // Returns OffTheRecord profile for use during signing phase. |
69 static Profile* GetSigninProfile(); | 66 static Profile* GetSigninProfile(); |
70 | 67 |
71 // Returns user_id hash for |profile| instance or empty string if hash | 68 // Returns user_id hash for |profile| instance or empty string if hash |
72 // could not be extracted from |profile|. | 69 // could not be extracted from |profile|. |
73 static std::string GetUserIdHashFromProfile(Profile* profile); | 70 static std::string GetUserIdHashFromProfile(Profile* profile); |
74 | 71 |
75 // Returns profile dir for the user identified by |user_id|. | |
76 static base::FilePath GetUserProfileDirByUserId(const std::string& user_id); | |
77 | |
78 // Returns user profile dir in a format [u-user_id_hash]. | 72 // Returns user profile dir in a format [u-user_id_hash]. |
79 static base::FilePath GetUserProfileDir(const std::string& user_id_hash); | 73 static base::FilePath GetUserProfileDir(const std::string& user_id_hash); |
80 | 74 |
81 // Returns true if |profile| is the signin Profile. This can be used during | 75 // Returns true if |profile| is the signin Profile. This can be used during |
82 // construction of the signin Profile to determine if that Profile is the | 76 // construction of the signin Profile to determine if that Profile is the |
83 // signin Profile. | 77 // signin Profile. |
84 static bool IsSigninProfile(Profile* profile); | 78 static bool IsSigninProfile(Profile* profile); |
85 | 79 |
86 // Returns true when |profile| corresponds to owner's profile. | 80 // Returns true when |profile| corresponds to owner's profile. |
87 static bool IsOwnerProfile(Profile* profile); | 81 static bool IsOwnerProfile(Profile* profile); |
(...skipping 30 matching lines...) Expand all Loading... |
118 // Otherwise, returns signin profile. | 112 // Otherwise, returns signin profile. |
119 // Behaviour of this function does not correspond to its name and can be | 113 // Behaviour of this function does not correspond to its name and can be |
120 // very surprising, that's why it should not be used anymore. | 114 // very surprising, that's why it should not be used anymore. |
121 // Use |GetProfileByUser| instead. | 115 // Use |GetProfileByUser| instead. |
122 // TODO(dzhioev): remove this method. http://crbug.com/361528 | 116 // TODO(dzhioev): remove this method. http://crbug.com/361528 |
123 Profile* GetProfileByUserUnsafe(const user_manager::User* user); | 117 Profile* GetProfileByUserUnsafe(const user_manager::User* user); |
124 | 118 |
125 // Returns NULL if User is not created. | 119 // Returns NULL if User is not created. |
126 user_manager::User* GetUserByProfile(Profile* profile); | 120 user_manager::User* GetUserByProfile(Profile* profile); |
127 | 121 |
| 122 static std::string GetUserIdHashByUserIdForTesting( |
| 123 const std::string& user_id); |
| 124 |
128 private: | 125 private: |
129 friend class CryptohomeAuthenticatorTest; | 126 friend class CryptohomeAuthenticatorTest; |
130 friend class DeviceSettingsTestBase; | 127 friend class DeviceSettingsTestBase; |
131 friend class extensions::ExtensionGarbageCollectorChromeOSUnitTest; | 128 friend class extensions::ExtensionGarbageCollectorChromeOSUnitTest; |
132 friend class FakeUserManager; | 129 friend class FakeUserManager; |
133 friend class KioskTest; | 130 friend class KioskTest; |
134 friend class MockUserManager; | 131 friend class MockUserManager; |
135 friend class MultiProfileUserControllerTest; | 132 friend class MultiProfileUserControllerTest; |
136 friend class ProfileHelperTest; | 133 friend class ProfileHelperTest; |
137 friend class ProfileListChromeOSTest; | 134 friend class ProfileListChromeOSTest; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 // 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 |
190 // always be returned by GetUserByProfile(). | 187 // always be returned by GetUserByProfile(). |
191 static bool always_return_primary_user_for_testing; | 188 static bool always_return_primary_user_for_testing; |
192 | 189 |
193 DISALLOW_COPY_AND_ASSIGN(ProfileHelper); | 190 DISALLOW_COPY_AND_ASSIGN(ProfileHelper); |
194 }; | 191 }; |
195 | 192 |
196 } // namespace chromeos | 193 } // namespace chromeos |
197 | 194 |
198 #endif // CHROME_BROWSER_CHROMEOS_PROFILES_PROFILE_HELPER_H_ | 195 #endif // CHROME_BROWSER_CHROMEOS_PROFILES_PROFILE_HELPER_H_ |
OLD | NEW |