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

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: More tests fixed. 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 virtual ~ProfileHelper(); 47 virtual ~ProfileHelper();
48 48
49 // Returns ProfileHelper instance. This class is not singleton and is owned 49 // Returns ProfileHelper instance. This class is not singleton and is owned
50 // by BrowserProcess/BrowserProcessPlatformPart. This method keeps that 50 // by BrowserProcess/BrowserProcessPlatformPart. This method keeps that
51 // knowledge in one place. 51 // knowledge in one place.
52 static ProfileHelper* Get(); 52 static ProfileHelper* Get();
53 53
54 // Returns Profile instance that corresponds to |user_id_hash|. 54 // Returns Profile instance that corresponds to |user_id_hash|.
55 static Profile* GetProfileByUserIdHash(const std::string& user_id_hash); 55 static Profile* GetProfileByUserIdHash(const std::string& user_id_hash);
56 56
57 // Returns profile dir that corresponds to a --login-profile cmd line switch.
58 static base::FilePath GetProfileDirByLegacyLoginProfileSwitch();
59
60 // Returns profile path that corresponds to a given |user_id_hash|. 57 // Returns profile path that corresponds to a given |user_id_hash|.
61 static base::FilePath GetProfilePathByUserIdHash( 58 static base::FilePath GetProfilePathByUserIdHash(
62 const std::string& user_id_hash); 59 const std::string& user_id_hash);
63 60
64 // Returns the path that corresponds to the sign-in profile. 61 // Returns the path that corresponds to the sign-in profile.
65 static base::FilePath GetSigninProfileDir(); 62 static base::FilePath GetSigninProfileDir();
66 63
67 // Returns OffTheRecord profile for use during signing phase. 64 // Returns OffTheRecord profile for use during signing phase.
68 static Profile* GetSigninProfile(); 65 static Profile* GetSigninProfile();
69 66
70 // Returns user_id hash for |profile| instance or empty string if hash 67 // Returns user_id hash for |profile| instance or empty string if hash
71 // could not be extracted from |profile|. 68 // could not be extracted from |profile|.
72 static std::string GetUserIdHashFromProfile(Profile* profile); 69 static std::string GetUserIdHashFromProfile(Profile* profile);
73 70
74 // Returns profile dir for the user identified by |user_id|.
75 static base::FilePath GetUserProfileDirByUserId(const std::string& user_id);
76
77 // Returns user profile dir in a format [u-user_id_hash]. 71 // Returns user profile dir in a format [u-user_id_hash].
78 static base::FilePath GetUserProfileDir(const std::string& user_id_hash); 72 static base::FilePath GetUserProfileDir(const std::string& user_id_hash);
79 73
80 // Returns true if |profile| is the signin Profile. This can be used during 74 // Returns true if |profile| is the signin Profile. This can be used during
81 // construction of the signin Profile to determine if that Profile is the 75 // construction of the signin Profile to determine if that Profile is the
82 // signin Profile. 76 // signin Profile.
83 static bool IsSigninProfile(Profile* profile); 77 static bool IsSigninProfile(Profile* profile);
84 78
85 // Returns true when |profile| corresponds to owner's profile. 79 // Returns true when |profile| corresponds to owner's profile.
86 static bool IsOwnerProfile(Profile* profile); 80 static bool IsOwnerProfile(Profile* profile);
(...skipping 30 matching lines...) Expand all
117 // Otherwise, returns signin profile. 111 // Otherwise, returns signin profile.
118 // Behaviour of this function does not correspond to its name and can be 112 // 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. 113 // very surprising, that's why it should not be used anymore.
120 // Use |GetProfileByUser| instead. 114 // Use |GetProfileByUser| instead.
121 // TODO(dzhioev): remove this method. http://crbug.com/361528 115 // TODO(dzhioev): remove this method. http://crbug.com/361528
122 Profile* GetProfileByUserUnsafe(const user_manager::User* user); 116 Profile* GetProfileByUserUnsafe(const user_manager::User* user);
123 117
124 // Returns NULL if User is not created. 118 // Returns NULL if User is not created.
125 user_manager::User* GetUserByProfile(Profile* profile); 119 user_manager::User* GetUserByProfile(Profile* profile);
126 120
121 std::string GetUserIdHashByUserIdForTests(const std::string& user_id) const;
122
127 private: 123 private:
128 friend class DeviceSettingsTestBase; 124 friend class DeviceSettingsTestBase;
129 friend class extensions::ExtensionGarbageCollectorChromeOSUnitTest; 125 friend class extensions::ExtensionGarbageCollectorChromeOSUnitTest;
130 friend class FakeUserManager; 126 friend class FakeUserManager;
131 friend class KioskTest; 127 friend class KioskTest;
132 friend class MockUserManager; 128 friend class MockUserManager;
133 friend class MultiProfileUserControllerTest; 129 friend class MultiProfileUserControllerTest;
134 friend class ParallelAuthenticatorTest; 130 friend class ParallelAuthenticatorTest;
135 friend class ProfileHelperTest; 131 friend class ProfileHelperTest;
136 friend class ProfileListChromeOSTest; 132 friend class ProfileListChromeOSTest;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 // If true and enable_profile_to_user_testing is true then primary user will 184 // If true and enable_profile_to_user_testing is true then primary user will
189 // always be returned by GetUserByProfile(). 185 // always be returned by GetUserByProfile().
190 static bool always_return_primary_user_for_testing; 186 static bool always_return_primary_user_for_testing;
191 187
192 DISALLOW_COPY_AND_ASSIGN(ProfileHelper); 188 DISALLOW_COPY_AND_ASSIGN(ProfileHelper);
193 }; 189 };
194 190
195 } // namespace chromeos 191 } // namespace chromeos
196 192
197 #endif // CHROME_BROWSER_CHROMEOS_PROFILES_PROFILE_HELPER_H_ 193 #endif // CHROME_BROWSER_CHROMEOS_PROFILES_PROFILE_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698