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

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

Issue 937713003: Add several new TRACE call and UMA metrics for GetProfile() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: noms comment p2 Created 5 years, 10 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 <list> 10 #include <list>
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // This function is temporary and will soon be moved to ash. As such avoid 69 // This function is temporary and will soon be moved to ash. As such avoid
70 // using it at all cost. 70 // using it at all cost.
71 // TODO(skuhne): Move into ash's new user management function. 71 // TODO(skuhne): Move into ash's new user management function.
72 static Profile* GetActiveUserProfile(); 72 static Profile* GetActiveUserProfile();
73 73
74 // Returns a profile for a specific profile directory within the user data 74 // Returns a profile for a specific profile directory within the user data
75 // dir. This will return an existing profile it had already been created, 75 // dir. This will return an existing profile it had already been created,
76 // otherwise it will create and manage it. 76 // otherwise it will create and manage it.
77 Profile* GetProfile(const base::FilePath& profile_dir); 77 Profile* GetProfile(const base::FilePath& profile_dir);
78 78
79
noms (inactive) 2015/02/18 21:32:19 nit: extra \n
rkaplow 2015/02/19 00:18:57 Done.
79 // Returns total number of profiles available on this machine. 80 // Returns total number of profiles available on this machine.
80 size_t GetNumberOfProfiles(); 81 size_t GetNumberOfProfiles();
81 82
82 // Explicit asynchronous creation of a profile located at |profile_path|. 83 // Explicit asynchronous creation of a profile located at |profile_path|.
83 // If the profile has already been created then callback is called 84 // If the profile has already been created then callback is called
84 // immediately. Should be called on the UI thread. 85 // immediately. Should be called on the UI thread.
85 void CreateProfileAsync(const base::FilePath& profile_path, 86 void CreateProfileAsync(const base::FilePath& profile_path,
86 const CreateCallback& callback, 87 const CreateCallback& callback,
87 const base::string16& name, 88 const base::string16& name,
88 const base::string16& icon_url, 89 const base::string16& icon_url,
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 // The profile used can be overridden by using --login-profile on cros. 250 // The profile used can be overridden by using --login-profile on cros.
250 Profile* GetActiveUserOrOffTheRecordProfileFromPath( 251 Profile* GetActiveUserOrOffTheRecordProfileFromPath(
251 const base::FilePath& user_data_dir); 252 const base::FilePath& user_data_dir);
252 253
253 // Adds a pre-existing Profile object to the set managed by this 254 // Adds a pre-existing Profile object to the set managed by this
254 // ProfileManager. This ProfileManager takes ownership of the Profile. 255 // ProfileManager. This ProfileManager takes ownership of the Profile.
255 // The Profile should not already be managed by this ProfileManager. 256 // The Profile should not already be managed by this ProfileManager.
256 // Returns true if the profile was added, false otherwise. 257 // Returns true if the profile was added, false otherwise.
257 bool AddProfile(Profile* profile); 258 bool AddProfile(Profile* profile);
258 259
260 // Creates and returns a profile. This handles both the full creation and
261 // handles the management.
noms (inactive) 2015/02/18 21:32:19 nit: I would change this to "Synchronously creates
rkaplow 2015/02/19 00:18:57 Done.
262 Profile* CreateAndInitializeProfile(const base::FilePath& profile_dir);
263
259 // Schedules the profile at the given path to be deleted on shutdown. 264 // Schedules the profile at the given path to be deleted on shutdown.
260 void FinishDeletingProfile(const base::FilePath& profile_dir); 265 void FinishDeletingProfile(const base::FilePath& profile_dir);
261 266
262 // Registers profile with given info. Returns pointer to created ProfileInfo 267 // Registers profile with given info. Returns pointer to created ProfileInfo
263 // entry. 268 // entry.
264 ProfileInfo* RegisterProfile(Profile* profile, bool created); 269 ProfileInfo* RegisterProfile(Profile* profile, bool created);
265 270
266 // Returns ProfileInfo associated with given |path|, registred earlier with 271 // Returns ProfileInfo associated with given |path|, registred earlier with
267 // RegisterProfile. 272 // RegisterProfile.
268 ProfileInfo* GetProfileInfoByPath(const base::FilePath& path) const; 273 ProfileInfo* GetProfileInfoByPath(const base::FilePath& path) const;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 class ProfileManagerWithoutInit : public ProfileManager { 365 class ProfileManagerWithoutInit : public ProfileManager {
361 public: 366 public:
362 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir); 367 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir);
363 368
364 protected: 369 protected:
365 void DoFinalInitForServices(Profile*, bool) override {} 370 void DoFinalInitForServices(Profile*, bool) override {}
366 void DoFinalInitLogging(Profile*) override {} 371 void DoFinalInitLogging(Profile*) override {}
367 }; 372 };
368 373
369 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ 374 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698