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

Side by Side Diff: chrome/browser/profiles/profile_manager.h

Issue 1782443006: Create LoadProfile method in profile_manager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
OLDNEW
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 <stddef.h> 10 #include <stddef.h>
(...skipping 17 matching lines...) Expand all
28 #include "content/public/browser/notification_registrar.h" 28 #include "content/public/browser/notification_registrar.h"
29 29
30 class NewProfileLauncher; 30 class NewProfileLauncher;
31 class ProfileInfoCache; 31 class ProfileInfoCache;
32 32
33 class ProfileManager : public base::NonThreadSafe, 33 class ProfileManager : public base::NonThreadSafe,
34 public content::NotificationObserver, 34 public content::NotificationObserver,
35 public Profile::Delegate { 35 public Profile::Delegate {
36 public: 36 public:
37 typedef base::Callback<void(Profile*, Profile::CreateStatus)> CreateCallback; 37 typedef base::Callback<void(Profile*, Profile::CreateStatus)> CreateCallback;
38 typedef base::Callback<void(Profile*)> ProfileLoadedCallback;
38 39
39 explicit ProfileManager(const base::FilePath& user_data_dir); 40 explicit ProfileManager(const base::FilePath& user_data_dir);
40 ~ProfileManager() override; 41 ~ProfileManager() override;
41 42
42 #if defined(ENABLE_SESSION_SERVICE) 43 #if defined(ENABLE_SESSION_SERVICE)
43 // Invokes SessionServiceFactory::ShutdownForProfile() for all profiles. 44 // Invokes SessionServiceFactory::ShutdownForProfile() for all profiles.
44 static void ShutdownSessionServices(); 45 static void ShutdownSessionServices();
45 #endif 46 #endif
46 47
47 // Physically remove deleted profile directories from disk. 48 // Physically remove deleted profile directories from disk.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // Because this method might synchronously create a new profile, it should 81 // Because this method might synchronously create a new profile, it should
81 // only be called for the initial profile or in tests, where blocking is 82 // only be called for the initial profile or in tests, where blocking is
82 // acceptable. 83 // acceptable.
83 // TODO(bauerb): Migrate calls from other code to GetProfileByPath(), then 84 // TODO(bauerb): Migrate calls from other code to GetProfileByPath(), then
84 // make this method private. 85 // make this method private.
85 Profile* GetProfile(const base::FilePath& profile_dir); 86 Profile* GetProfile(const base::FilePath& profile_dir);
86 87
87 // Returns total number of profiles available on this machine. 88 // Returns total number of profiles available on this machine.
88 size_t GetNumberOfProfiles(); 89 size_t GetNumberOfProfiles();
89 90
91 // Asynchronously loads an existing profile given its |profile_name| within
92 // the user data directory, optionally in |incognito| mode. The |callback|
93 // will be called with the Profile when it has been loaded, or with a nullptr
94 // otherwise. Should be called on the UI thread.
95 // Unlike CreateProfileAsync this will not create a profile if one doesn't
96 // already exist on disk
97 // Returns true if the profile exists, but the final loaded profile will come
98 // as part of the callback.
99 bool LoadProfile(const std::string& profile_name,
100 bool incognito,
101 const ProfileLoadedCallback& callback);
102
90 // Explicit asynchronous creation of a profile located at |profile_path|. 103 // Explicit asynchronous creation of a profile located at |profile_path|.
91 // If the profile has already been created then callback is called 104 // If the profile has already been created then callback is called
92 // immediately. Should be called on the UI thread. 105 // immediately. Should be called on the UI thread.
93 void CreateProfileAsync(const base::FilePath& profile_path, 106 void CreateProfileAsync(const base::FilePath& profile_path,
94 const CreateCallback& callback, 107 const CreateCallback& callback,
95 const base::string16& name, 108 const base::string16& name,
96 const std::string& icon_url, 109 const std::string& icon_url,
97 const std::string& supervised_user_id); 110 const std::string& supervised_user_id);
98 111
99 // Returns true if the profile pointer is known to point to an existing 112 // Returns true if the profile pointer is known to point to an existing
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 class ProfileManagerWithoutInit : public ProfileManager { 402 class ProfileManagerWithoutInit : public ProfileManager {
390 public: 403 public:
391 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir); 404 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir);
392 405
393 protected: 406 protected:
394 void DoFinalInitForServices(Profile*, bool) override {} 407 void DoFinalInitForServices(Profile*, bool) override {}
395 void DoFinalInitLogging(Profile*) override {} 408 void DoFinalInitLogging(Profile*) override {}
396 }; 409 };
397 410
398 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ 411 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/notifications/platform_notification_service_impl.cc ('k') | chrome/browser/profiles/profile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698