OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CHROME_BROWSER_PROFILES_PROFILE_WINDOW_H_ | 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_WINDOW_H_ |
6 #define CHROME_BROWSER_PROFILES_PROFILE_WINDOW_H_ | 6 #define CHROME_BROWSER_PROFILES_PROFILE_WINDOW_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
| 9 #include "chrome/browser/profiles/profile_metrics.h" |
9 #include "chrome/browser/ui/host_desktop.h" | 10 #include "chrome/browser/ui/host_desktop.h" |
10 #include "chrome/browser/ui/startup/startup_types.h" | 11 #include "chrome/browser/ui/startup/startup_types.h" |
11 | 12 |
12 class Profile; | 13 class Profile; |
13 namespace base { class FilePath; } | 14 namespace base { class FilePath; } |
14 | 15 |
15 namespace profiles { | 16 namespace profiles { |
16 | 17 |
17 // Callback to be used when switching to a new profile is completed. | 18 // Callback to be used when switching to a new profile is completed. |
18 typedef base::Callback<void()> ProfileSwitchingDoneCallback; | 19 typedef base::Callback<void()> ProfileSwitchingDoneCallback; |
19 | 20 |
20 // Activates a window for |profile| on the desktop specified by | 21 // Activates a window for |profile| on the desktop specified by |
21 // |desktop_type|. If no such window yet exists, or if |always_create| is | 22 // |desktop_type|. If no such window yet exists, or if |always_create| is |
22 // true, this first creates a new window, then activates | 23 // true, this first creates a new window, then activates |
23 // that. If activating an exiting window and multiple windows exists then the | 24 // that. If activating an exiting window and multiple windows exists then the |
24 // window that was most recently active is activated. This is used for | 25 // window that was most recently active is activated. This is used for |
25 // creation of a window from the multi-profile dropdown menu. | 26 // creation of a window from the multi-profile dropdown menu. |
26 void FindOrCreateNewWindowForProfile( | 27 void FindOrCreateNewWindowForProfile( |
27 Profile* profile, | 28 Profile* profile, |
28 chrome::startup::IsProcessStartup process_startup, | 29 chrome::startup::IsProcessStartup process_startup, |
29 chrome::startup::IsFirstRun is_first_run, | 30 chrome::startup::IsFirstRun is_first_run, |
30 chrome::HostDesktopType desktop_type, | 31 chrome::HostDesktopType desktop_type, |
31 bool always_create); | 32 bool always_create); |
32 | 33 |
33 // Opens a Browser with the specified profile given by |path|. | 34 // Opens a Browser with the specified profile given by |path|. |
34 // If |always_create| is true then a new window is created | 35 // If |always_create| is true then a new window is created |
35 // even if a window for that profile already exists. When the browser is | 36 // even if a window for that profile already exists. When the browser is |
36 // opened, |callback| will be run if it isn't null. | 37 // opened, |callback| will be run if it isn't null. |
37 | 38 |
38 void SwitchToProfile( | 39 void SwitchToProfile(const base::FilePath& path, |
39 const base::FilePath& path, | 40 chrome::HostDesktopType desktop_type, |
40 chrome::HostDesktopType desktop_type, | 41 bool always_create, |
41 bool always_create, | 42 ProfileSwitchingDoneCallback callback, |
42 ProfileSwitchingDoneCallback callback); | 43 ProfileMetrics::ProfileOpen metric); |
43 | 44 |
44 // Opens a Browser for the guest profile and runs |callback| if it isn't null. | 45 // Opens a Browser for the guest profile and runs |callback| if it isn't null. |
45 void SwitchToGuestProfile(chrome::HostDesktopType desktop_type, | 46 void SwitchToGuestProfile(chrome::HostDesktopType desktop_type, |
46 ProfileSwitchingDoneCallback callback); | 47 ProfileSwitchingDoneCallback callback); |
47 | 48 |
48 // Creates a new profile from the next available profile directory, and | 49 // Creates a new profile from the next available profile directory, and |
49 // opens a new browser window for the profile once it is ready. When the browser | 50 // opens a new browser window for the profile once it is ready. When the browser |
50 // is opened, |callback| will be run if it isn't null. | 51 // is opened, |callback| will be run if it isn't null. |
51 void CreateAndSwitchToNewProfile(chrome::HostDesktopType desktop_type, | 52 void CreateAndSwitchToNewProfile(chrome::HostDesktopType desktop_type, |
52 ProfileSwitchingDoneCallback callback); | 53 ProfileSwitchingDoneCallback callback, |
| 54 ProfileMetrics::ProfileAdd metric); |
53 | 55 |
54 // Closes all browser windows that belong to the guest profile. | 56 // Closes all browser windows that belong to the guest profile. |
55 void CloseGuestProfileWindows(); | 57 void CloseGuestProfileWindows(); |
56 | 58 |
57 // Closes all the browser windows for |profile| and opens the user manager. | 59 // Closes all the browser windows for |profile| and opens the user manager. |
58 void LockProfile(Profile* profile); | 60 void LockProfile(Profile* profile); |
59 | 61 |
60 } // namespace profiles | 62 } // namespace profiles |
61 | 63 |
62 #endif // CHROME_BROWSER_PROFILES_PROFILE_WINDOW_H_ | 64 #endif // CHROME_BROWSER_PROFILES_PROFILE_WINDOW_H_ |
OLD | NEW |