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

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

Issue 1113333003: Don't create a new profile when cleaning up stale ephemeral profiles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: fix Created 5 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
« no previous file with comments | « chrome/browser/chrome_browser_main.cc ('k') | chrome/browser/profiles/profile_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 // Get the Profile last used (the Profile to which owns the most recently 104 // Get the Profile last used (the Profile to which owns the most recently
105 // focused window) with this Chrome build. If no signed profile has been 105 // focused window) with this Chrome build. If no signed profile has been
106 // stored in Local State, hand back the Default profile. 106 // stored in Local State, hand back the Default profile.
107 Profile* GetLastUsedProfile(const base::FilePath& user_data_dir); 107 Profile* GetLastUsedProfile(const base::FilePath& user_data_dir);
108 108
109 // Get the path of the last used profile, or if that's undefined, the default 109 // Get the path of the last used profile, or if that's undefined, the default
110 // profile. 110 // profile.
111 base::FilePath GetLastUsedProfileDir(const base::FilePath& user_data_dir); 111 base::FilePath GetLastUsedProfileDir(const base::FilePath& user_data_dir);
112 112
113 // Get the name of the last used profile, or if that's undefined, the default
114 // profile.
115 std::string GetLastUsedProfileName();
116
113 // Get the Profiles which are currently open, i.e., have open browsers, or 117 // Get the Profiles which are currently open, i.e., have open browsers, or
114 // were open the last time Chrome was running. The Profiles appear in the 118 // were open the last time Chrome was running. The Profiles appear in the
115 // order they were opened. The last used profile will be on the list, but its 119 // order they were opened. The last used profile will be on the list, but its
116 // index on the list will depend on when it was opened (it is not necessarily 120 // index on the list will depend on when it was opened (it is not necessarily
117 // the last one). 121 // the last one).
118 std::vector<Profile*> GetLastOpenedProfiles( 122 std::vector<Profile*> GetLastOpenedProfiles(
119 const base::FilePath& user_data_dir); 123 const base::FilePath& user_data_dir);
120 124
121 // Returns created and fully initialized profiles. Note, profiles order is NOT 125 // Returns created and fully initialized profiles. Note, profiles order is NOT
122 // guaranteed to be related with the creation order. 126 // guaranteed to be related with the creation order.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // Returns a ProfileShortcut Manager that enables the caller to create 165 // Returns a ProfileShortcut Manager that enables the caller to create
162 // profile specfic desktop shortcuts. 166 // profile specfic desktop shortcuts.
163 ProfileShortcutManager* profile_shortcut_manager(); 167 ProfileShortcutManager* profile_shortcut_manager();
164 168
165 // Schedules the profile at the given path to be deleted on shutdown. If we're 169 // Schedules the profile at the given path to be deleted on shutdown. If we're
166 // deleting the last profile, a new one will be created in its place, and in 170 // deleting the last profile, a new one will be created in its place, and in
167 // that case the callback will be called when profile creation is complete. 171 // that case the callback will be called when profile creation is complete.
168 void ScheduleProfileForDeletion(const base::FilePath& profile_dir, 172 void ScheduleProfileForDeletion(const base::FilePath& profile_dir,
169 const CreateCallback& callback); 173 const CreateCallback& callback);
170 174
171 // Called on start-up if there are any stale ephemeral profiles to be deleted.
172 // This can be the case if the browser has crashed and the clean-up code had
173 // no chance to run then.
174 static void CleanUpStaleProfiles(
175 const std::vector<base::FilePath>& profile_paths);
176
177 // Autoloads profiles if they are running background apps. 175 // Autoloads profiles if they are running background apps.
178 void AutoloadProfiles(); 176 void AutoloadProfiles();
179 177
178 // Checks if any ephemeral profiles are left behind (e.g. because of a browser
179 // crash) and schedule them for deletion.
180 void CleanUpEphemeralProfiles();
181
180 // Initializes user prefs of |profile|. This includes profile name and 182 // Initializes user prefs of |profile|. This includes profile name and
181 // avatar values. 183 // avatar values.
182 void InitProfileUserPrefs(Profile* profile); 184 void InitProfileUserPrefs(Profile* profile);
183 185
184 // Register and add testing profile to the ProfileManager. Use ONLY in tests. 186 // Register and add testing profile to the ProfileManager. Use ONLY in tests.
185 // This allows the creation of Profiles outside of the standard creation path 187 // This allows the creation of Profiles outside of the standard creation path
186 // for testing. If |addToCache|, adds to ProfileInfoCache as well. 188 // for testing. If |addToCache|, adds to ProfileInfoCache as well.
187 // If |start_deferred_task_runners|, starts the deferred task runners. 189 // If |start_deferred_task_runners|, starts the deferred task runners.
188 // Use ONLY in tests. 190 // Use ONLY in tests.
189 void RegisterTestingProfile(Profile* profile, 191 void RegisterTestingProfile(Profile* profile,
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 class ProfileManagerWithoutInit : public ProfileManager { 374 class ProfileManagerWithoutInit : public ProfileManager {
373 public: 375 public:
374 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir); 376 explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir);
375 377
376 protected: 378 protected:
377 void DoFinalInitForServices(Profile*, bool) override {} 379 void DoFinalInitForServices(Profile*, bool) override {}
378 void DoFinalInitLogging(Profile*) override {} 380 void DoFinalInitLogging(Profile*) override {}
379 }; 381 };
380 382
381 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ 383 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_main.cc ('k') | chrome/browser/profiles/profile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698