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

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

Issue 442043002: ProfileManager doesn't depend on "--login-profile" switch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased and comments addressed. 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
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 virtual ~ProfileHelper(); 48 virtual ~ProfileHelper();
49 49
50 // Returns ProfileHelper instance. This class is not singleton and is owned 50 // Returns ProfileHelper instance. This class is not singleton and is owned
51 // by BrowserProcess/BrowserProcessPlatformPart. This method keeps that 51 // by BrowserProcess/BrowserProcessPlatformPart. This method keeps that
52 // knowledge in one place. 52 // knowledge in one place.
53 static ProfileHelper* Get(); 53 static ProfileHelper* Get();
54 54
55 // Returns Profile instance that corresponds to |user_id_hash|. 55 // Returns Profile instance that corresponds to |user_id_hash|.
56 static Profile* GetProfileByUserIdHash(const std::string& user_id_hash); 56 static Profile* GetProfileByUserIdHash(const std::string& user_id_hash);
57 57
58 // Returns profile dir that corresponds to a --login-profile cmd line switch.
59 static base::FilePath GetProfileDirByLegacyLoginProfileSwitch();
60
61 // Returns profile path that corresponds to a given |user_id_hash|. 58 // Returns profile path that corresponds to a given |user_id_hash|.
62 static base::FilePath GetProfilePathByUserIdHash( 59 static base::FilePath GetProfilePathByUserIdHash(
63 const std::string& user_id_hash); 60 const std::string& user_id_hash);
64 61
65 // Returns the path that corresponds to the sign-in profile. 62 // Returns the path that corresponds to the sign-in profile.
66 static base::FilePath GetSigninProfileDir(); 63 static base::FilePath GetSigninProfileDir();
67 64
68 // Returns OffTheRecord profile for use during signing phase. 65 // Returns OffTheRecord profile for use during signing phase.
69 static Profile* GetSigninProfile(); 66 static Profile* GetSigninProfile();
70 67
71 // 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
72 // could not be extracted from |profile|. 69 // could not be extracted from |profile|.
73 static std::string GetUserIdHashFromProfile(Profile* profile); 70 static std::string GetUserIdHashFromProfile(Profile* profile);
74 71
75 // Returns profile dir for the user identified by |user_id|.
76 static base::FilePath GetUserProfileDirByUserId(const std::string& user_id);
77
78 // Returns user profile dir in a format [u-user_id_hash]. 72 // Returns user profile dir in a format [u-user_id_hash].
79 static base::FilePath GetUserProfileDir(const std::string& user_id_hash); 73 static base::FilePath GetUserProfileDir(const std::string& user_id_hash);
80 74
81 // 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
82 // 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
83 // signin Profile. 77 // signin Profile.
84 static bool IsSigninProfile(Profile* profile); 78 static bool IsSigninProfile(Profile* profile);
85 79
86 // Returns true when |profile| corresponds to owner's profile. 80 // Returns true when |profile| corresponds to owner's profile.
87 static bool IsOwnerProfile(Profile* profile); 81 static bool IsOwnerProfile(Profile* profile);
(...skipping 30 matching lines...) Expand all
118 // Otherwise, returns signin profile. 112 // Otherwise, returns signin profile.
119 // 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
120 // very surprising, that's why it should not be used anymore. 114 // very surprising, that's why it should not be used anymore.
121 // Use |GetProfileByUser| instead. 115 // Use |GetProfileByUser| instead.
122 // TODO(dzhioev): remove this method. http://crbug.com/361528 116 // TODO(dzhioev): remove this method. http://crbug.com/361528
123 Profile* GetProfileByUserUnsafe(const user_manager::User* user); 117 Profile* GetProfileByUserUnsafe(const user_manager::User* user);
124 118
125 // Returns NULL if User is not created. 119 // Returns NULL if User is not created.
126 user_manager::User* GetUserByProfile(Profile* profile); 120 user_manager::User* GetUserByProfile(Profile* profile);
127 121
122 std::string GetUserIdHashByUserIdForTests(const std::string& user_id) const;
xiyuan 2014/08/15 16:38:43 nit: Could we make this a static helper so that te
dzhioev (left Google) 2014/08/20 20:21:35 Done.
123
128 private: 124 private:
129 friend class DeviceSettingsTestBase; 125 friend class DeviceSettingsTestBase;
130 friend class extensions::ExtensionGarbageCollectorChromeOSUnitTest; 126 friend class extensions::ExtensionGarbageCollectorChromeOSUnitTest;
131 friend class FakeUserManager; 127 friend class FakeUserManager;
132 friend class KioskTest; 128 friend class KioskTest;
133 friend class MockUserManager; 129 friend class MockUserManager;
134 friend class MultiProfileUserControllerTest; 130 friend class MultiProfileUserControllerTest;
135 friend class ParallelAuthenticatorTest; 131 friend class ParallelAuthenticatorTest;
136 friend class ProfileHelperTest; 132 friend class ProfileHelperTest;
137 friend class ProfileListChromeOSTest; 133 friend class ProfileListChromeOSTest;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 // If true and enable_profile_to_user_testing is true then primary user will 185 // If true and enable_profile_to_user_testing is true then primary user will
190 // always be returned by GetUserByProfile(). 186 // always be returned by GetUserByProfile().
191 static bool always_return_primary_user_for_testing; 187 static bool always_return_primary_user_for_testing;
192 188
193 DISALLOW_COPY_AND_ASSIGN(ProfileHelper); 189 DISALLOW_COPY_AND_ASSIGN(ProfileHelper);
194 }; 190 };
195 191
196 } // namespace chromeos 192 } // namespace chromeos
197 193
198 #endif // CHROME_BROWSER_CHROMEOS_PROFILES_PROFILE_HELPER_H_ 194 #endif // CHROME_BROWSER_CHROMEOS_PROFILES_PROFILE_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698