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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 const std::string& user_id_hash); | 60 const std::string& user_id_hash); |
61 | 61 |
62 // Returns the path that corresponds to the sign-in profile. | 62 // Returns the path that corresponds to the sign-in profile. |
63 static base::FilePath GetSigninProfileDir(); | 63 static base::FilePath GetSigninProfileDir(); |
64 | 64 |
65 // Returns OffTheRecord profile for use during signing phase. | 65 // Returns OffTheRecord profile for use during signing phase. |
66 static Profile* GetSigninProfile(); | 66 static Profile* GetSigninProfile(); |
67 | 67 |
68 // 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 |
69 // could not be extracted from |profile|. | 69 // could not be extracted from |profile|. |
70 static std::string GetUserIdHashFromProfile(Profile* profile); | 70 static std::string GetUserIdHashFromProfile(const Profile* profile); |
71 | 71 |
72 // Returns user profile dir in a format [u-user_id_hash]. | 72 // Returns user profile dir in a format [u-user_id_hash]. |
73 static base::FilePath GetUserProfileDir(const std::string& user_id_hash); | 73 static base::FilePath GetUserProfileDir(const std::string& user_id_hash); |
74 | 74 |
75 // 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 |
76 // 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 |
77 // signin Profile. | 77 // signin Profile. |
78 static bool IsSigninProfile(Profile* profile); | 78 static bool IsSigninProfile(const Profile* profile); |
79 | 79 |
80 // Returns true when |profile| corresponds to owner's profile. | 80 // Returns true when |profile| corresponds to owner's profile. |
81 static bool IsOwnerProfile(Profile* profile); | 81 static bool IsOwnerProfile(Profile* profile); |
82 | 82 |
83 // Returns true when |profile| corresponds to the primary user profile | 83 // Returns true when |profile| corresponds to the primary user profile |
84 // of the current session. | 84 // of the current session. |
85 static bool IsPrimaryProfile(Profile* profile); | 85 static bool IsPrimaryProfile(const Profile* profile); |
86 | 86 |
87 // Initialize a bunch of services that are tied to a browser profile. | 87 // Initialize a bunch of services that are tied to a browser profile. |
88 // TODO(dzhioev): Investigate whether or not this method is needed. | 88 // TODO(dzhioev): Investigate whether or not this method is needed. |
89 void ProfileStartup(Profile* profile, bool process_startup); | 89 void ProfileStartup(Profile* profile, bool process_startup); |
90 | 90 |
91 // Returns active user profile dir in a format [u-$hash]. | 91 // Returns active user profile dir in a format [u-$hash]. |
92 base::FilePath GetActiveUserProfileDir(); | 92 base::FilePath GetActiveUserProfileDir(); |
93 | 93 |
94 // Should called once after UserManager instance has been created. | 94 // Should called once after UserManager instance has been created. |
95 void Initialize(); | 95 void Initialize(); |
(...skipping 14 matching lines...) Expand all Loading... |
110 // Returns profile of the |user| if user's profile is created and fully | 110 // Returns profile of the |user| if user's profile is created and fully |
111 // initialized. Otherwise, if some user is active, returns his profile. | 111 // initialized. Otherwise, if some user is active, returns his profile. |
112 // Otherwise, returns signin profile. | 112 // Otherwise, returns signin profile. |
113 // 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 |
114 // very surprising, that's why it should not be used anymore. | 114 // very surprising, that's why it should not be used anymore. |
115 // Use |GetProfileByUser| instead. | 115 // Use |GetProfileByUser| instead. |
116 // TODO(dzhioev): remove this method. http://crbug.com/361528 | 116 // TODO(dzhioev): remove this method. http://crbug.com/361528 |
117 Profile* GetProfileByUserUnsafe(const user_manager::User* user); | 117 Profile* GetProfileByUserUnsafe(const user_manager::User* user); |
118 | 118 |
119 // Returns NULL if User is not created. | 119 // Returns NULL if User is not created. |
120 user_manager::User* GetUserByProfile(Profile* profile); | 120 const user_manager::User* GetUserByProfile(const Profile* profile) const; |
| 121 user_manager::User* GetUserByProfile(Profile* profile) const; |
121 | 122 |
122 static std::string GetUserIdHashByUserIdForTesting( | 123 static std::string GetUserIdHashByUserIdForTesting( |
123 const std::string& user_id); | 124 const std::string& user_id); |
124 | 125 |
125 private: | 126 private: |
126 // TODO(nkostylev): Create a test API class that will be the only one allowed | 127 // TODO(nkostylev): Create a test API class that will be the only one allowed |
127 // to access private test methods. | 128 // to access private test methods. |
128 friend class CryptohomeAuthenticatorTest; | 129 friend class CryptohomeAuthenticatorTest; |
129 friend class DeviceSettingsTestBase; | 130 friend class DeviceSettingsTestBase; |
130 friend class ExistingUserControllerTest; | 131 friend class ExistingUserControllerTest; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 // If true and enable_profile_to_user_testing is true then primary user will | 191 // If true and enable_profile_to_user_testing is true then primary user will |
191 // always be returned by GetUserByProfile(). | 192 // always be returned by GetUserByProfile(). |
192 static bool always_return_primary_user_for_testing; | 193 static bool always_return_primary_user_for_testing; |
193 | 194 |
194 DISALLOW_COPY_AND_ASSIGN(ProfileHelper); | 195 DISALLOW_COPY_AND_ASSIGN(ProfileHelper); |
195 }; | 196 }; |
196 | 197 |
197 } // namespace chromeos | 198 } // namespace chromeos |
198 | 199 |
199 #endif // CHROME_BROWSER_CHROMEOS_PROFILES_PROFILE_HELPER_H_ | 200 #endif // CHROME_BROWSER_CHROMEOS_PROFILES_PROFILE_HELPER_H_ |
OLD | NEW |