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

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: Code review. 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
« 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) 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 static void CreateDefaultProfileAsync(const CreateCallback& callback); 79 static void CreateDefaultProfileAsync(const CreateCallback& callback);
80 80
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 (the Profile to which owns the most recently
90 // been stored in Local State, hand back the Default profile. 90 // focused window) with this Chrome build. If no signed profile has been
91 // stored in Local State, hand back the Default profile.
91 Profile* GetLastUsedProfile(const FilePath& user_data_dir); 92 Profile* GetLastUsedProfile(const FilePath& user_data_dir);
92 93
93 // Same as instance method but provides the default user_data_dir as well. 94 // Same as instance method but provides the default user_data_dir as well.
94 static Profile* GetLastUsedProfile(); 95 static Profile* GetLastUsedProfile();
95 96
97 // Get the Profiles which are currently open, i.e., have open browsers, or
98 // were open the last time Chrome was running. The Profiles appear in the
99 // order they were opened. The last used profile will be on the list, but its
100 // index on the list will depend on when it was opened (it is not necessarily
101 // the last one).
102 std::vector<Profile*> GetLastOpenedProfiles(const FilePath& user_data_dir);
103
104 // Same as instance method but provides the default user_data_dir as well.
105 static std::vector<Profile*> GetLastOpenedProfiles();
106
96 // Returns created profiles. Note, profiles order is NOT guaranteed to be 107 // Returns created profiles. Note, profiles order is NOT guaranteed to be
97 // related with the creation order. 108 // related with the creation order.
98 std::vector<Profile*> GetLoadedProfiles() const; 109 std::vector<Profile*> GetLoadedProfiles() const;
99 110
100 // content::NotificationObserver implementation. 111 // content::NotificationObserver implementation.
101 virtual void Observe(int type, 112 virtual void Observe(int type,
102 const content::NotificationSource& source, 113 const content::NotificationSource& source,
103 const content::NotificationDetails& details) OVERRIDE; 114 const content::NotificationDetails& details) OVERRIDE;
104 115
105 // BrowserList::Observer implementation. 116 // 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, 293 // about every profile which has been created for this instance of Chrome,
283 // if it has not been explicitly deleted. 294 // if it has not been explicitly deleted.
284 scoped_ptr<ProfileInfoCache> profile_info_cache_; 295 scoped_ptr<ProfileInfoCache> profile_info_cache_;
285 296
286 #if defined(OS_WIN) 297 #if defined(OS_WIN)
287 // Manages the creation, deletion, and renaming of Windows shortcuts by 298 // Manages the creation, deletion, and renaming of Windows shortcuts by
288 // observing the ProfileInfoCache. 299 // observing the ProfileInfoCache.
289 scoped_ptr<ProfileShortcutManagerWin> profile_shortcut_manager_; 300 scoped_ptr<ProfileShortcutManagerWin> profile_shortcut_manager_;
290 #endif 301 #endif
291 302
303 // For keeping track of the last active profiles.
304 std::map<Profile*, int> browser_counts_;
305 std::vector<Profile*> active_profiles_;
306 bool shutdown_started_;
307
292 DISALLOW_COPY_AND_ASSIGN(ProfileManager); 308 DISALLOW_COPY_AND_ASSIGN(ProfileManager);
293 }; 309 };
294 310
295 // Same as the ProfileManager, but doesn't initialize some services of the 311 // Same as the ProfileManager, but doesn't initialize some services of the
296 // profile. This one is useful in unittests. 312 // profile. This one is useful in unittests.
297 class ProfileManagerWithoutInit : public ProfileManager { 313 class ProfileManagerWithoutInit : public ProfileManager {
298 public: 314 public:
299 explicit ProfileManagerWithoutInit(const FilePath& user_data_dir); 315 explicit ProfileManagerWithoutInit(const FilePath& user_data_dir);
300 316
301 protected: 317 protected:
302 virtual void DoFinalInitForServices(Profile*, bool) OVERRIDE {} 318 virtual void DoFinalInitForServices(Profile*, bool) OVERRIDE {}
303 virtual void DoFinalInitLogging(Profile*) OVERRIDE {} 319 virtual void DoFinalInitLogging(Profile*) OVERRIDE {}
304 }; 320 };
305 321
306 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ 322 #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