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

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

Issue 10967003: Add desktop type context to most existing instances of FindTabbedBrowser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pre-review pass. Created 8 years, 2 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) 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>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/file_path.h" 14 #include "base/file_path.h"
15 #include "base/gtest_prod_util.h" 15 #include "base/gtest_prod_util.h"
16 #include "base/hash_tables.h" 16 #include "base/hash_tables.h"
17 #include "base/memory/linked_ptr.h" 17 #include "base/memory/linked_ptr.h"
18 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
19 #include "base/message_loop.h" 19 #include "base/message_loop.h"
20 #include "base/threading/non_thread_safe.h" 20 #include "base/threading/non_thread_safe.h"
21 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/browser/profiles/profile_shortcut_manager.h" 22 #include "chrome/browser/profiles/profile_shortcut_manager.h"
23 #include "chrome/browser/ui/browser_list_observer.h" 23 #include "chrome/browser/ui/browser_list_observer.h"
24 #include "chrome/browser/ui/host_desktop.h"
24 #include "chrome/browser/ui/startup/startup_types.h" 25 #include "chrome/browser/ui/startup/startup_types.h"
25 #include "content/public/browser/notification_observer.h" 26 #include "content/public/browser/notification_observer.h"
26 #include "content/public/browser/notification_registrar.h" 27 #include "content/public/browser/notification_registrar.h"
27 28
28 class NewProfileLauncher; 29 class NewProfileLauncher;
29 class ProfileInfoCache; 30 class ProfileInfoCache;
30 31
31 class ProfileManager : public base::NonThreadSafe, 32 class ProfileManager : public base::NonThreadSafe,
32 public content::NotificationObserver, 33 public content::NotificationObserver,
33 public Profile::Delegate { 34 public Profile::Delegate {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 static FilePath GetDefaultProfileDir(const FilePath& user_data_dir); 132 static FilePath GetDefaultProfileDir(const FilePath& user_data_dir);
132 133
133 // Returns the path to the preferences file given the user profile directory. 134 // Returns the path to the preferences file given the user profile directory.
134 static FilePath GetProfilePrefsPath(const FilePath& profile_dir); 135 static FilePath GetProfilePrefsPath(const FilePath& profile_dir);
135 136
136 // If a profile with the given path is currently managed by this object, 137 // If a profile with the given path is currently managed by this object,
137 // return a pointer to the corresponding Profile object; 138 // return a pointer to the corresponding Profile object;
138 // otherwise return NULL. 139 // otherwise return NULL.
139 Profile* GetProfileByPath(const FilePath& path) const; 140 Profile* GetProfileByPath(const FilePath& path) const;
140 141
141 // Activates a window for |profile|. If no such window yet exists, or if 142 // Activates a window for |profile| on the desktop specified by
142 // |always_create| is true, this first creates a new window, then activates 143 // |desktop_type|. If no such window yet exists, or if |always_create| is
144 // true, this first creates a new window, then activates
143 // that. If activating an exiting window and multiple windows exists then the 145 // that. If activating an exiting window and multiple windows exists then the
144 // window that was most recently active is activated. This is used for 146 // window that was most recently active is activated. This is used for
145 // creation of a window from the multi-profile dropdown menu. 147 // creation of a window from the multi-profile dropdown menu.
146 static void FindOrCreateNewWindowForProfile( 148 static void FindOrCreateNewWindowForProfile(
147 Profile* profile, 149 Profile* profile,
148 chrome::startup::IsProcessStartup process_startup, 150 chrome::startup::IsProcessStartup process_startup,
149 chrome::startup::IsFirstRun is_first_run, 151 chrome::startup::IsFirstRun is_first_run,
152 chrome::HostDesktopType desktop_type,
150 bool always_create); 153 bool always_create);
151 154
152 // Profile::Delegate implementation: 155 // Profile::Delegate implementation:
153 virtual void OnProfileCreated(Profile* profile, 156 virtual void OnProfileCreated(Profile* profile,
154 bool success, 157 bool success,
155 bool is_new_profile) OVERRIDE; 158 bool is_new_profile) OVERRIDE;
156 159
157 // Add or remove a profile launcher to/from the list of launchers waiting for 160 // Add or remove a profile launcher to/from the list of launchers waiting for
158 // new profiles to be created from the multi-profile menu. 161 // new profiles to be created from the multi-profile menu.
159 void AddProfileLauncher(NewProfileLauncher* profile_launcher); 162 void AddProfileLauncher(NewProfileLauncher* profile_launcher);
160 void RemoveProfileLauncher(NewProfileLauncher* profile_launcher); 163 void RemoveProfileLauncher(NewProfileLauncher* profile_launcher);
161 164
162 // Creates a new profile in the next available multiprofile directory. 165 // Creates a new profile in the next available multiprofile directory.
163 // Directories are named "profile_1", "profile_2", etc., in sequence of 166 // Directories are named "profile_1", "profile_2", etc., in sequence of
164 // creation. (Because directories can be removed, however, it may be the case 167 // creation. (Because directories can be removed, however, it may be the case
165 // that at some point the list of numbered profiles is not continuous.) 168 // that at some point the list of numbered profiles is not continuous.)
166 static void CreateMultiProfileAsync( 169 static void CreateMultiProfileAsync(
167 const string16& name, 170 const string16& name,
168 const string16& icon_url, 171 const string16& icon_url,
169 const CreateCallback& callback); 172 const CreateCallback& callback,
173 chrome::HostDesktopType desktop_type);
170 174
171 // Register multi-profile related preferences in Local State. 175 // Register multi-profile related preferences in Local State.
172 static void RegisterPrefs(PrefService* prefs); 176 static void RegisterPrefs(PrefService* prefs);
173 177
174 // Returns a ProfileInfoCache object which can be used to get information 178 // Returns a ProfileInfoCache object which can be used to get information
175 // about profiles without having to load them from disk. 179 // about profiles without having to load them from disk.
176 ProfileInfoCache& GetProfileInfoCache(); 180 ProfileInfoCache& GetProfileInfoCache();
177 181
178 // Returns a ProfileShortcut Manager that enables the caller to create 182 // Returns a ProfileShortcut Manager that enables the caller to create
179 // profile specfic desktop shortcuts. 183 // profile specfic desktop shortcuts.
180 ProfileShortcutManager* profile_shortcut_manager(); 184 ProfileShortcutManager* profile_shortcut_manager();
181 185
182 // Schedules the profile at the given path to be deleted on shutdown. 186 // Schedules the profile at the given path to be deleted on shutdown.
183 void ScheduleProfileForDeletion(const FilePath& profile_dir); 187 void ScheduleProfileForDeletion(const FilePath& profile_dir,
188 chrome::HostDesktopType desktop_type);
184 189
185 // Checks if multiple profiles is enabled. 190 // Checks if multiple profiles is enabled.
186 static bool IsMultipleProfilesEnabled(); 191 static bool IsMultipleProfilesEnabled();
187 192
188 // Autoloads profiles if they are running background apps. 193 // Autoloads profiles if they are running background apps.
189 void AutoloadProfiles(); 194 void AutoloadProfiles();
190 195
191 // Register and add testing profile to the ProfileManager. Use ONLY in tests. 196 // Register and add testing profile to the ProfileManager. Use ONLY in tests.
192 // This allows the creation of Profiles outside of the standard creation path 197 // This allows the creation of Profiles outside of the standard creation path
193 // for testing. If |addToCache|, add to ProfileInfoCache as well. 198 // for testing. If |addToCache|, add to ProfileInfoCache as well.
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 class ProfileManagerWithoutInit : public ProfileManager { 341 class ProfileManagerWithoutInit : public ProfileManager {
337 public: 342 public:
338 explicit ProfileManagerWithoutInit(const FilePath& user_data_dir); 343 explicit ProfileManagerWithoutInit(const FilePath& user_data_dir);
339 344
340 protected: 345 protected:
341 virtual void DoFinalInitForServices(Profile*, bool) OVERRIDE {} 346 virtual void DoFinalInitForServices(Profile*, bool) OVERRIDE {}
342 virtual void DoFinalInitLogging(Profile*) OVERRIDE {} 347 virtual void DoFinalInitLogging(Profile*) OVERRIDE {}
343 }; 348 };
344 349
345 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_ 350 #endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698