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

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

Issue 9087009: Restore all profiles which were active when restoring the last open pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix. Created 8 years, 11 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #pragma once 9 #pragma once
10 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // Returns true if the profile pointer is known to point to an existing 81 // Returns true if the profile pointer is known to point to an existing
82 // profile. 82 // profile.
83 bool IsValidProfile(Profile* profile); 83 bool IsValidProfile(Profile* profile);
84 84
85 // Returns the directory where the first created profile is stored, 85 // Returns the directory where the first created profile is stored,
86 // relative to the user data directory currently in use.. 86 // relative to the user data directory currently in use..
87 FilePath GetInitialProfileDir(); 87 FilePath GetInitialProfileDir();
88 88
89 // Get the Profile last used with this Chrome build. If no signed profile has 89 // Get the Profile last used with this Chrome build. If no signed profile has
90 // been stored in Local State, hand back the Default profile. 90 // been stored in Local State, hand back the Default profile.
91 Profile* GetLastUsedProfile(const FilePath& user_data_dir); 91 Profile* GetLastUsedProfile(const FilePath& user_data_dir);
Miranda Callahan 2012/01/09 14:38:55 Could you add a comment here (or below) making it
marja 2012/01/10 14:12:03 Clarified the comments: For GetLastUsedProfile: Ge
92 92
93 // Same as instance method but provides the default user_data_dir as well. 93 // Same as instance method but provides the default user_data_dir as well.
94 static Profile* GetLastUsedProfile(); 94 static Profile* GetLastUsedProfile();
95 95
96 // Get the Profiles which are currently active, i.e., have open browsers, (or
97 // were active the last time Chrome was running).
98 std::vector<Profile*> GetLastActiveProfiles(const FilePath& user_data_dir);
99
100 // Same as instance method but provides the default user_data_dir as well.
101 static std::vector<Profile*> GetLastActiveProfiles();
102
96 // Returns created profiles. Note, profiles order is NOT guaranteed to be 103 // Returns created profiles. Note, profiles order is NOT guaranteed to be
97 // related with the creation order. 104 // related with the creation order.
98 std::vector<Profile*> GetLoadedProfiles() const; 105 std::vector<Profile*> GetLoadedProfiles() const;
99 106
100 // content::NotificationObserver implementation. 107 // content::NotificationObserver implementation.
101 virtual void Observe(int type, 108 virtual void Observe(int type,
102 const content::NotificationSource& source, 109 const content::NotificationSource& source,
103 const content::NotificationDetails& details) OVERRIDE; 110 const content::NotificationDetails& details) OVERRIDE;
104 111
105 // BrowserList::Observer implementation. 112 // BrowserList::Observer implementation.
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 // about every profile which has been created for this instance of Chrome, 289 // about every profile which has been created for this instance of Chrome,
283 // if it has not been explicitly deleted. 290 // if it has not been explicitly deleted.
284 scoped_ptr<ProfileInfoCache> profile_info_cache_; 291 scoped_ptr<ProfileInfoCache> profile_info_cache_;
285 292
286 #if defined(OS_WIN) 293 #if defined(OS_WIN)
287 // Manages the creation, deletion, and renaming of Windows shortcuts by 294 // Manages the creation, deletion, and renaming of Windows shortcuts by
288 // observing the ProfileInfoCache. 295 // observing the ProfileInfoCache.
289 scoped_ptr<ProfileShortcutManagerWin> profile_shortcut_manager_; 296 scoped_ptr<ProfileShortcutManagerWin> profile_shortcut_manager_;
290 #endif 297 #endif
291 298
299 // For keeping track of the last active profiles.
300 std::map<Profile*, int> browser_counts_;
301 std::vector<Profile*> active_profiles_;
302 bool shutdown_started_;
303
292 DISALLOW_COPY_AND_ASSIGN(ProfileManager); 304 DISALLOW_COPY_AND_ASSIGN(ProfileManager);
293 }; 305 };
294 306
295 // Same as the ProfileManager, but doesn't initialize some services of the 307 // Same as the ProfileManager, but doesn't initialize some services of the
296 // profile. This one is useful in unittests. 308 // profile. This one is useful in unittests.
297 class ProfileManagerWithoutInit : public ProfileManager { 309 class ProfileManagerWithoutInit : public ProfileManager {
298 public: 310 public:
299 explicit ProfileManagerWithoutInit(const FilePath& user_data_dir); 311 explicit ProfileManagerWithoutInit(const FilePath& user_data_dir);
300 312
301 protected: 313 protected:
302 virtual void DoFinalInitForServices(Profile*, bool) OVERRIDE {} 314 virtual void DoFinalInitForServices(Profile*, bool) OVERRIDE {}
303 virtual void DoFinalInitLogging(Profile*) OVERRIDE {} 315 virtual void DoFinalInitLogging(Profile*) OVERRIDE {}
304 }; 316 };
305 317
306 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ 318 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698