| 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 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 14 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 15 #include "chrome/browser/chromeos/login/oauth2_login_manager.h" | 15 #include "chrome/browser/chromeos/login/oauth2_login_manager.h" |
| 16 #include "chrome/browser/chromeos/login/user_manager.h" | 16 #include "chrome/browser/chromeos/login/user_manager.h" |
| 17 | 17 |
| 18 class Profile; | 18 class Profile; |
| 19 | 19 |
| 20 namespace base { |
| 21 class FilePath; |
| 22 } |
| 23 |
| 20 namespace chromeos { | 24 namespace chromeos { |
| 21 | 25 |
| 22 // This helper class is used on Chrome OS to keep track of currently | 26 // This helper class is used on Chrome OS to keep track of currently |
| 23 // active user profile. | 27 // active user profile. |
| 24 // Whenever active user is changed (either add another user into session or | 28 // Whenever active user is changed (either add another user into session or |
| 25 // switch between users), ActiveUserHashChanged() will be called thus | 29 // switch between users), ActiveUserHashChanged() will be called thus |
| 26 // internal state |active_user_id_hash_| will be updated. | 30 // internal state |active_user_id_hash_| will be updated. |
| 27 // Typical use cases for using this class: | 31 // Typical use cases for using this class: |
| 28 // 1. Get "signin profile" which is a special type of profile that is only used | 32 // 1. Get "signin profile" which is a special type of profile that is only used |
| 29 // during signin flow: GetSigninProfile() | 33 // during signin flow: GetSigninProfile() |
| (...skipping 10 matching lines...) Expand all Loading... |
| 40 // Returns Profile instance that corresponds to |user_id_hash|. | 44 // Returns Profile instance that corresponds to |user_id_hash|. |
| 41 static Profile* GetProfileByUserIdHash(const std::string& user_id_hash); | 45 static Profile* GetProfileByUserIdHash(const std::string& user_id_hash); |
| 42 | 46 |
| 43 // Returns profile dir that corresponds to a --login-profile cmd line switch. | 47 // Returns profile dir that corresponds to a --login-profile cmd line switch. |
| 44 static base::FilePath GetProfileDirByLegacyLoginProfileSwitch(); | 48 static base::FilePath GetProfileDirByLegacyLoginProfileSwitch(); |
| 45 | 49 |
| 46 // Returns profile path that corresponds to a given |user_id_hash|. | 50 // Returns profile path that corresponds to a given |user_id_hash|. |
| 47 static base::FilePath GetProfilePathByUserIdHash( | 51 static base::FilePath GetProfilePathByUserIdHash( |
| 48 const std::string& user_id_hash); | 52 const std::string& user_id_hash); |
| 49 | 53 |
| 54 // Returns the path that corresponds to the sign-in profile. |
| 55 static base::FilePath GetSigninProfileDir(); |
| 56 |
| 50 // Returns OffTheRecord profile for use during signing phase. | 57 // Returns OffTheRecord profile for use during signing phase. |
| 51 static Profile* GetSigninProfile(); | 58 static Profile* GetSigninProfile(); |
| 52 | 59 |
| 53 // Returns user_id hash for |profile| instance or empty string if hash | 60 // Returns user_id hash for |profile| instance or empty string if hash |
| 54 // could not be extracted from |profile|. | 61 // could not be extracted from |profile|. |
| 55 static std::string GetUserIdHashFromProfile(Profile* profile); | 62 static std::string GetUserIdHashFromProfile(Profile* profile); |
| 56 | 63 |
| 57 // Returns user profile dir in a format [u-user_id_hash]. | 64 // Returns user profile dir in a format [u-user_id_hash]. |
| 58 static base::FilePath GetUserProfileDir(const std::string& user_id_hash); | 65 static base::FilePath GetUserProfileDir(const std::string& user_id_hash); |
| 59 | 66 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 113 |
| 107 // List of callbacks called after signin profile clearance. | 114 // List of callbacks called after signin profile clearance. |
| 108 std::vector<base::Closure> on_clear_callbacks_; | 115 std::vector<base::Closure> on_clear_callbacks_; |
| 109 | 116 |
| 110 DISALLOW_COPY_AND_ASSIGN(ProfileHelper); | 117 DISALLOW_COPY_AND_ASSIGN(ProfileHelper); |
| 111 }; | 118 }; |
| 112 | 119 |
| 113 } // namespace chromeos | 120 } // namespace chromeos |
| 114 | 121 |
| 115 #endif // CHROME_BROWSER_CHROMEOS_PROFILES_PROFILE_HELPER_H_ | 122 #endif // CHROME_BROWSER_CHROMEOS_PROFILES_PROFILE_HELPER_H_ |
| OLD | NEW |