OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This class keeps track of the currently-active profiles in the runtime. | 5 // This class keeps track of the currently-active profiles in the runtime. |
6 | 6 |
7 #ifndef CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ | 7 #ifndef CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ |
8 #define CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ | 8 #define CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ |
9 | 9 |
10 #include <list> | 10 #include <list> |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 // Explicit asynchronous creation of a profile located at |profile_path|. | 74 // Explicit asynchronous creation of a profile located at |profile_path|. |
75 // If the profile has already been created then callback is called | 75 // If the profile has already been created then callback is called |
76 // immediately. Should be called on the UI thread. | 76 // immediately. Should be called on the UI thread. |
77 void CreateProfileAsync(const base::FilePath& profile_path, | 77 void CreateProfileAsync(const base::FilePath& profile_path, |
78 const CreateCallback& callback, | 78 const CreateCallback& callback, |
79 const string16& name, | 79 const string16& name, |
80 const string16& icon_url, | 80 const string16& icon_url, |
81 bool is_managed); | 81 bool is_managed); |
82 | 82 |
83 // Initiates default profile creation. If default profile has already been | 83 // Initiates profile creation identified by |active_profile_username_hash_|. |
84 // created then the callback is called immediately. Should be called on the | 84 // If profile has already been created then the callback is called |
85 // UI thread. | 85 // immediately. Should be called on the UI thread. |
| 86 // This method is only used on Chrome OS where every user profile |
| 87 // has username_hash associated with it. |
86 static void CreateDefaultProfileAsync(const CreateCallback& callback); | 88 static void CreateDefaultProfileAsync(const CreateCallback& callback); |
87 | 89 |
88 // Returns true if the profile pointer is known to point to an existing | 90 // Returns true if the profile pointer is known to point to an existing |
89 // profile. | 91 // profile. |
90 bool IsValidProfile(Profile* profile); | 92 bool IsValidProfile(Profile* profile); |
91 | 93 |
92 // Returns the directory where the first created profile is stored, | 94 // Returns the directory where the first created profile is stored, |
93 // relative to the user data directory currently in use.. | 95 // relative to the user data directory currently in use.. |
94 base::FilePath GetInitialProfileDir(); | 96 base::FilePath GetInitialProfileDir(); |
95 | 97 |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 BrowserListObserver browser_list_observer_; | 351 BrowserListObserver browser_list_observer_; |
350 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) | 352 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
351 | 353 |
352 // For keeping track of the last active profiles. | 354 // For keeping track of the last active profiles. |
353 std::map<Profile*, int> browser_counts_; | 355 std::map<Profile*, int> browser_counts_; |
354 // On startup we launch the active profiles in the order they became active | 356 // On startup we launch the active profiles in the order they became active |
355 // during the last run. This is why they are kept in a list, not in a set. | 357 // during the last run. This is why they are kept in a list, not in a set. |
356 std::vector<Profile*> active_profiles_; | 358 std::vector<Profile*> active_profiles_; |
357 bool closing_all_browsers_; | 359 bool closing_all_browsers_; |
358 | 360 |
| 361 #if defined(OS_CHROMEOS) |
| 362 // Identifies active profile on Chrome OS. |
| 363 std::string active_profile_username_hash_; |
| 364 #endif |
| 365 |
359 DISALLOW_COPY_AND_ASSIGN(ProfileManager); | 366 DISALLOW_COPY_AND_ASSIGN(ProfileManager); |
360 }; | 367 }; |
361 | 368 |
362 // Same as the ProfileManager, but doesn't initialize some services of the | 369 // Same as the ProfileManager, but doesn't initialize some services of the |
363 // profile. This one is useful in unittests. | 370 // profile. This one is useful in unittests. |
364 class ProfileManagerWithoutInit : public ProfileManager { | 371 class ProfileManagerWithoutInit : public ProfileManager { |
365 public: | 372 public: |
366 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir); | 373 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir); |
367 | 374 |
368 protected: | 375 protected: |
369 virtual void DoFinalInitForServices(Profile*, bool) OVERRIDE {} | 376 virtual void DoFinalInitForServices(Profile*, bool) OVERRIDE {} |
370 virtual void DoFinalInitLogging(Profile*) OVERRIDE {} | 377 virtual void DoFinalInitLogging(Profile*) OVERRIDE {} |
371 }; | 378 }; |
372 | 379 |
373 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ | 380 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ |
OLD | NEW |