Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(563)

Side by Side Diff: chrome/browser/chromeos/profiles/profile_helper.h

Issue 444903002: [cros] user_manager component - move UserManagerBase and UserManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: similarity Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/signin/oauth2_login_manager.h" 15 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h"
16 #include "chrome/browser/chromeos/login/users/user_manager.h" 16 #include "components/user_manager/user_manager.h"
17 17
18 class Profile; 18 class Profile;
19 class User; 19 class User;
20 20
21 namespace base { 21 namespace base {
22 class FilePath; 22 class FilePath;
23 } 23 }
24 24
25 namespace extensions { 25 namespace extensions {
26 class ExtensionGarbageCollectorChromeOSUnitTest; 26 class ExtensionGarbageCollectorChromeOSUnitTest;
27 } 27 }
28 28
29 namespace chromeos { 29 namespace chromeos {
30 30
31 // This helper class is used on Chrome OS to keep track of currently 31 // This helper class is used on Chrome OS to keep track of currently
32 // active user profile. 32 // active user profile.
33 // Whenever active user is changed (either add another user into session or 33 // Whenever active user is changed (either add another user into session or
34 // switch between users), ActiveUserHashChanged() will be called thus 34 // switch between users), ActiveUserHashChanged() will be called thus
35 // internal state |active_user_id_hash_| will be updated. 35 // internal state |active_user_id_hash_| will be updated.
36 // Typical use cases for using this class: 36 // Typical use cases for using this class:
37 // 1. Get "signin profile" which is a special type of profile that is only used 37 // 1. Get "signin profile" which is a special type of profile that is only used
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 : public BrowsingDataRemover::Observer, 42 class ProfileHelper
43 public OAuth2LoginManager::Observer, 43 : public BrowsingDataRemover::Observer,
44 public UserManager::UserSessionStateObserver { 44 public OAuth2LoginManager::Observer,
45 public user_manager::UserManager::UserSessionStateObserver {
45 public: 46 public:
46 ProfileHelper(); 47 ProfileHelper();
47 virtual ~ProfileHelper(); 48 virtual ~ProfileHelper();
48 49
49 // Returns ProfileHelper instance. This class is not singleton and is owned 50 // Returns ProfileHelper instance. This class is not singleton and is owned
50 // by BrowserProcess/BrowserProcessPlatformPart. This method keeps that 51 // by BrowserProcess/BrowserProcessPlatformPart. This method keeps that
51 // knowledge in one place. 52 // knowledge in one place.
52 static ProfileHelper* Get(); 53 static ProfileHelper* Get();
53 54
54 // Returns Profile instance that corresponds to |user_id_hash|. 55 // Returns Profile instance that corresponds to |user_id_hash|.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 friend class KioskTest; 121 friend class KioskTest;
121 friend class MockUserManager; 122 friend class MockUserManager;
122 friend class MultiProfileUserControllerTest; 123 friend class MultiProfileUserControllerTest;
123 friend class ParallelAuthenticatorTest; 124 friend class ParallelAuthenticatorTest;
124 friend class ProfileHelperTest; 125 friend class ProfileHelperTest;
125 friend class ProfileListChromeOSTest; 126 friend class ProfileListChromeOSTest;
126 127
127 // BrowsingDataRemover::Observer implementation: 128 // BrowsingDataRemover::Observer implementation:
128 virtual void OnBrowsingDataRemoverDone() OVERRIDE; 129 virtual void OnBrowsingDataRemoverDone() OVERRIDE;
129 130
130 // UserManager::Observer overrides. 131 // OAuth2LoginManager::Observer overrides.
131 virtual void OnSessionRestoreStateChanged( 132 virtual void OnSessionRestoreStateChanged(
132 Profile* user_profile, 133 Profile* user_profile,
133 OAuth2LoginManager::SessionRestoreState state) OVERRIDE; 134 OAuth2LoginManager::SessionRestoreState state) OVERRIDE;
134 135
135 // UserManager::UserSessionStateObserver implementation: 136 // user_manager::UserManager::UserSessionStateObserver implementation:
136 virtual void ActiveUserHashChanged(const std::string& hash) OVERRIDE; 137 virtual void ActiveUserHashChanged(const std::string& hash) OVERRIDE;
137 138
138 // Associates |user| with profile with the same user_id, 139 // Associates |user| with profile with the same user_id,
139 // for GetUserByProfile() testing. 140 // for GetUserByProfile() testing.
140 void SetProfileToUserMappingForTesting(user_manager::User* user); 141 void SetProfileToUserMappingForTesting(user_manager::User* user);
141 142
142 // Enables/disables testing code path in GetUserByProfile() like 143 // Enables/disables testing code path in GetUserByProfile() like
143 // always return primary user (when always_return_primary_user_for_testing is 144 // always return primary user (when always_return_primary_user_for_testing is
144 // set). 145 // set).
145 static void SetProfileToUserForTestingEnabled(bool enabled); 146 static void SetProfileToUserForTestingEnabled(bool enabled);
(...skipping 30 matching lines...) Expand all
176 // If true and enable_profile_to_user_testing is true then primary user will 177 // If true and enable_profile_to_user_testing is true then primary user will
177 // always be returned by GetUserByProfile(). 178 // always be returned by GetUserByProfile().
178 static bool always_return_primary_user_for_testing; 179 static bool always_return_primary_user_for_testing;
179 180
180 DISALLOW_COPY_AND_ASSIGN(ProfileHelper); 181 DISALLOW_COPY_AND_ASSIGN(ProfileHelper);
181 }; 182 };
182 183
183 } // namespace chromeos 184 } // namespace chromeos
184 185
185 #endif // CHROME_BROWSER_CHROMEOS_PROFILES_PROFILE_HELPER_H_ 186 #endif // CHROME_BROWSER_CHROMEOS_PROFILES_PROFILE_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698