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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 void Initialize(); | 100 void Initialize(); |
101 | 101 |
102 // Returns hash for active user ID which is used to identify that user profile | 102 // Returns hash for active user ID which is used to identify that user profile |
103 // on Chrome OS. | 103 // on Chrome OS. |
104 std::string active_user_id_hash() { return active_user_id_hash_; } | 104 std::string active_user_id_hash() { return active_user_id_hash_; } |
105 | 105 |
106 // Clears site data (cookies, history, etc) for signin profile. | 106 // Clears site data (cookies, history, etc) for signin profile. |
107 // Callback can be empty. Not thread-safe. | 107 // Callback can be empty. Not thread-safe. |
108 void ClearSigninProfile(const base::Closure& on_clear_callback); | 108 void ClearSigninProfile(const base::Closure& on_clear_callback); |
109 | 109 |
110 // Returns NULL if profile for user is not found or is not fully loaded. | 110 // Returns profile of the |user| if it is created and fully initialized. |
| 111 // Otherwise, returns NULL. |
111 Profile* GetProfileByUser(const user_manager::User* user); | 112 Profile* GetProfileByUser(const user_manager::User* user); |
112 | 113 |
| 114 // DEPRECATED |
| 115 // Returns profile of the |user| if user's profile is created and fully |
| 116 // initialized. Otherwise, if some user is active, returns his profile. |
| 117 // Otherwise, returns signin profile. |
| 118 // Behaviour of this function does not correspond to its name and can be |
| 119 // very surprising, that's why it should not be used anymore. |
| 120 // Use |GetProfileByUser| instead. |
| 121 // TODO(dzhioev): remove this method. http://crbug.com/361528 |
| 122 Profile* GetProfileByUserUnsafe(const user_manager::User* user); |
| 123 |
113 // Returns NULL if User is not created. | 124 // Returns NULL if User is not created. |
114 user_manager::User* GetUserByProfile(Profile* profile); | 125 user_manager::User* GetUserByProfile(Profile* profile); |
115 | 126 |
116 private: | 127 private: |
117 friend class DeviceSettingsTestBase; | 128 friend class DeviceSettingsTestBase; |
118 friend class extensions::ExtensionGarbageCollectorChromeOSUnitTest; | 129 friend class extensions::ExtensionGarbageCollectorChromeOSUnitTest; |
119 friend class FakeUserManager; | 130 friend class FakeUserManager; |
120 friend class KioskTest; | 131 friend class KioskTest; |
121 friend class MockUserManager; | 132 friend class MockUserManager; |
122 friend class MultiProfileUserControllerTest; | 133 friend class MultiProfileUserControllerTest; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // If true and enable_profile_to_user_testing is true then primary user will | 187 // If true and enable_profile_to_user_testing is true then primary user will |
177 // always be returned by GetUserByProfile(). | 188 // always be returned by GetUserByProfile(). |
178 static bool always_return_primary_user_for_testing; | 189 static bool always_return_primary_user_for_testing; |
179 | 190 |
180 DISALLOW_COPY_AND_ASSIGN(ProfileHelper); | 191 DISALLOW_COPY_AND_ASSIGN(ProfileHelper); |
181 }; | 192 }; |
182 | 193 |
183 } // namespace chromeos | 194 } // namespace chromeos |
184 | 195 |
185 #endif // CHROME_BROWSER_CHROMEOS_PROFILES_PROFILE_HELPER_H_ | 196 #endif // CHROME_BROWSER_CHROMEOS_PROFILES_PROFILE_HELPER_H_ |
OLD | NEW |