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

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

Issue 14581006: [cros mp] Load profiles from /home/chronos/u-[$hash], add GetUserIdHashFromProfile() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ProfileHelper - check for non-empty user_id_hash only with --multi-profiles switch Created 7 years, 7 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 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/files/file_path.h"
11 #include "chrome/browser/chromeos/login/user_manager.h" 12 #include "chrome/browser/chromeos/login/user_manager.h"
12 13
13 class Profile; 14 class Profile;
14 15
15 namespace chromeos { 16 namespace chromeos {
16 17
17 class ProfileHelper : public UserManager::UserSessionStateObserver { 18 class ProfileHelper : public UserManager::UserSessionStateObserver {
18 public: 19 public:
20 // Chrome OS profile directories have custom prefix.
Dmitry Polukhin 2013/05/08 09:51:39 Please expand this comment.
Nikita (slow) 2013/05/08 11:10:01 Done.
21 static const char kProfileDirPrefix[];
22
19 ProfileHelper(); 23 ProfileHelper();
20 virtual ~ProfileHelper(); 24 virtual ~ProfileHelper();
21 25
22 // Returns Profile instance that corresponds to |user_id_hash|. 26 // Returns Profile instance that corresponds to |user_id_hash|.
23 static Profile* GetProfileByUserIdHash(const std::string& user_id_hash); 27 static Profile* GetProfileByUserIdHash(const std::string& user_id_hash);
24 28
25 // Returns OffTheRecord profile for use during signing phase. 29 // Returns OffTheRecord profile for use during signing phase.
26 static Profile* GetSigninProfile(); 30 static Profile* GetSigninProfile();
27 31
32 // Returns user_id hash for |profile| instance or empty string if hash
33 // could not be extracted from |profile|.
34 static std::string GetUserIdHashFromProfile(Profile* profile);
35
28 // Returns true if |profile| is the signin Profile. This can be used during 36 // Returns true if |profile| is the signin Profile. This can be used during
29 // construction of the signin Profile to determine if that Profile is the 37 // construction of the signin Profile to determine if that Profile is the
30 // signin Profile. 38 // signin Profile.
31 static bool IsSigninProfile(Profile* profile); 39 static bool IsSigninProfile(Profile* profile);
32 40
33 // Initialize a bunch of services that are tied to a browser profile. 41 // Initialize a bunch of services that are tied to a browser profile.
34 // TODO(dzhioev): Investigate whether or not this method is needed. 42 // TODO(dzhioev): Investigate whether or not this method is needed.
35 static void ProfileStartup(Profile* profile, bool process_startup); 43 static void ProfileStartup(Profile* profile, bool process_startup);
36 44
45 // Returns active user profile dir in a format [u-$hash].
46 base::FilePath GetActiveUserProfileDir();
47
37 // Should called once after UserManager instance has been created. 48 // Should called once after UserManager instance has been created.
38 void Initialize(); 49 void Initialize();
39 50
40 // Returns hash for active user ID which is used to identify that user profile 51 // Returns hash for active user ID which is used to identify that user profile
41 // on Chrome OS. 52 // on Chrome OS.
42 std::string active_user_id_hash() { return active_user_id_hash_; } 53 std::string active_user_id_hash() { return active_user_id_hash_; }
43 54
44 private: 55 private:
56 friend class ProfileHelperTest;
57
45 // UserManager::UserSessionStateObserver implementation: 58 // UserManager::UserSessionStateObserver implementation:
46 virtual void ActiveUserHashChanged(const std::string& hash) OVERRIDE; 59 virtual void ActiveUserHashChanged(const std::string& hash) OVERRIDE;
47 60
48 // Identifies path to active user profile on Chrome OS. 61 // Identifies path to active user profile on Chrome OS.
49 std::string active_user_id_hash_; 62 std::string active_user_id_hash_;
50 63
51 DISALLOW_COPY_AND_ASSIGN(ProfileHelper); 64 DISALLOW_COPY_AND_ASSIGN(ProfileHelper);
52 }; 65 };
53 66
54 } // namespace chromeos 67 } // namespace chromeos
55 68
56 #endif // CHROME_BROWSER_CHROMEOS_PROFILES_PROFILE_HELPER_H_ 69 #endif // CHROME_BROWSER_CHROMEOS_PROFILES_PROFILE_HELPER_H_
57 70
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/networking_private_apitest.cc ('k') | chrome/browser/chromeos/profiles/profile_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698