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

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: rebase 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 friend class MockUserManager; 133 friend class MockUserManager;
133 friend class MultiProfileUserControllerTest; 134 friend class MultiProfileUserControllerTest;
134 friend class ParallelAuthenticatorTest; 135 friend class ParallelAuthenticatorTest;
135 friend class ProfileHelperTest; 136 friend class ProfileHelperTest;
136 friend class ProfileListChromeOSTest; 137 friend class ProfileListChromeOSTest;
137 friend class SessionStateDelegateChromeOSTest; 138 friend class SessionStateDelegateChromeOSTest;
138 139
139 // BrowsingDataRemover::Observer implementation: 140 // BrowsingDataRemover::Observer implementation:
140 virtual void OnBrowsingDataRemoverDone() OVERRIDE; 141 virtual void OnBrowsingDataRemoverDone() OVERRIDE;
141 142
142 // UserManager::Observer overrides. 143 // OAuth2LoginManager::Observer overrides.
143 virtual void OnSessionRestoreStateChanged( 144 virtual void OnSessionRestoreStateChanged(
144 Profile* user_profile, 145 Profile* user_profile,
145 OAuth2LoginManager::SessionRestoreState state) OVERRIDE; 146 OAuth2LoginManager::SessionRestoreState state) OVERRIDE;
146 147
147 // UserManager::UserSessionStateObserver implementation: 148 // user_manager::UserManager::UserSessionStateObserver implementation:
148 virtual void ActiveUserHashChanged(const std::string& hash) OVERRIDE; 149 virtual void ActiveUserHashChanged(const std::string& hash) OVERRIDE;
149 150
150 // Associates |user| with profile with the same user_id, 151 // Associates |user| with profile with the same user_id,
151 // for GetUserByProfile() testing. 152 // for GetUserByProfile() testing.
152 void SetProfileToUserMappingForTesting(user_manager::User* user); 153 void SetProfileToUserMappingForTesting(user_manager::User* user);
153 154
154 // Enables/disables testing code path in GetUserByProfile() like 155 // Enables/disables testing code path in GetUserByProfile() like
155 // always return primary user (when always_return_primary_user_for_testing is 156 // always return primary user (when always_return_primary_user_for_testing is
156 // set). 157 // set).
157 static void SetProfileToUserForTestingEnabled(bool enabled); 158 static void SetProfileToUserForTestingEnabled(bool enabled);
(...skipping 30 matching lines...) Expand all
188 // If true and enable_profile_to_user_testing is true then primary user will 189 // If true and enable_profile_to_user_testing is true then primary user will
189 // always be returned by GetUserByProfile(). 190 // always be returned by GetUserByProfile().
190 static bool always_return_primary_user_for_testing; 191 static bool always_return_primary_user_for_testing;
191 192
192 DISALLOW_COPY_AND_ASSIGN(ProfileHelper); 193 DISALLOW_COPY_AND_ASSIGN(ProfileHelper);
193 }; 194 };
194 195
195 } // namespace chromeos 196 } // namespace chromeos
196 197
197 #endif // CHROME_BROWSER_CHROMEOS_PROFILES_PROFILE_HELPER_H_ 198 #endif // CHROME_BROWSER_CHROMEOS_PROFILES_PROFILE_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/profiles/avatar_menu_actions_chromeos.cc ('k') | chrome/browser/chromeos/profiles/profile_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698