| 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_manager.h" |
| 9 #include "chrome/browser/profiles/profile_metrics.h" | 10 #include "chrome/browser/profiles/profile_metrics.h" |
| 10 #include "chrome/browser/ui/browser_window.h" | 11 #include "chrome/browser/ui/browser_window.h" |
| 11 #include "chrome/browser/ui/host_desktop.h" | 12 #include "chrome/browser/ui/host_desktop.h" |
| 12 #include "chrome/browser/ui/profile_chooser_constants.h" | 13 #include "chrome/browser/ui/profile_chooser_constants.h" |
| 13 #include "chrome/browser/ui/startup/startup_types.h" | 14 #include "chrome/browser/ui/startup/startup_types.h" |
| 14 | 15 |
| 15 class Profile; | 16 class Profile; |
| 16 namespace base { class FilePath; } | 17 namespace base { class FilePath; } |
| 17 | 18 |
| 18 namespace profiles { | 19 namespace profiles { |
| 19 | 20 |
| 20 // Callback to be used when switching to a new profile is completed. | |
| 21 typedef base::Callback<void()> ProfileSwitchingDoneCallback; | |
| 22 | |
| 23 // Different tutorials that can be displayed in the user manager. | 21 // Different tutorials that can be displayed in the user manager. |
| 24 enum UserManagerTutorialMode { | 22 enum UserManagerTutorialMode { |
| 25 USER_MANAGER_NO_TUTORIAL, // Does not display a tutorial. | 23 USER_MANAGER_NO_TUTORIAL, // Does not display a tutorial. |
| 26 USER_MANAGER_TUTORIAL_OVERVIEW, // Basic overview of new features. | 24 USER_MANAGER_TUTORIAL_OVERVIEW, // Basic overview of new features. |
| 27 USER_MANAGER_TUTORIAL_LOCK, // TODO(noms): To be implemented. | 25 USER_MANAGER_TUTORIAL_LOCK, // TODO(noms): To be implemented. |
| 28 }; | 26 }; |
| 29 | 27 |
| 28 // Different actions to perform after the user manager selects a profile. |
| 29 enum UserManagerProfileSelected { |
| 30 USER_MANAGER_SELECT_PROFILE_NO_ACTION, |
| 31 USER_MANAGER_SELECT_PROFILE_TASK_MANAGER, |
| 32 USER_MANAGER_SELECT_PROFILE_ABOUT_CHROME, |
| 33 }; |
| 34 |
| 35 extern const char kUserManagerSelectProfileTaskManager[]; |
| 36 extern const char kUserManagerSelectProfileAboutChrome[]; |
| 37 |
| 30 // Activates a window for |profile| on the desktop specified by | 38 // Activates a window for |profile| on the desktop specified by |
| 31 // |desktop_type|. If no such window yet exists, or if |always_create| is | 39 // |desktop_type|. If no such window yet exists, or if |always_create| is |
| 32 // true, this first creates a new window, then activates | 40 // true, this first creates a new window, then activates |
| 33 // that. If activating an exiting window and multiple windows exists then the | 41 // that. If activating an exiting window and multiple windows exists then the |
| 34 // window that was most recently active is activated. This is used for | 42 // window that was most recently active is activated. This is used for |
| 35 // creation of a window from the multi-profile dropdown menu. | 43 // creation of a window from the multi-profile dropdown menu. |
| 36 void FindOrCreateNewWindowForProfile( | 44 void FindOrCreateNewWindowForProfile( |
| 37 Profile* profile, | 45 Profile* profile, |
| 38 chrome::startup::IsProcessStartup process_startup, | 46 chrome::startup::IsProcessStartup process_startup, |
| 39 chrome::startup::IsFirstRun is_first_run, | 47 chrome::startup::IsFirstRun is_first_run, |
| 40 chrome::HostDesktopType desktop_type, | 48 chrome::HostDesktopType desktop_type, |
| 41 bool always_create); | 49 bool always_create); |
| 42 | 50 |
| 43 // Opens a Browser with the specified profile given by |path|. | 51 // Opens a Browser with the specified profile given by |path|. |
| 44 // If |always_create| is true then a new window is created | 52 // If |always_create| is true then a new window is created |
| 45 // even if a window for that profile already exists. When the browser is | 53 // even if a window for that profile already exists. When the browser is |
| 46 // opened, |callback| will be run if it isn't null. | 54 // opened, |callback| will be run if it isn't null. |
| 47 | 55 |
| 48 void SwitchToProfile(const base::FilePath& path, | 56 void SwitchToProfile(const base::FilePath& path, |
| 49 chrome::HostDesktopType desktop_type, | 57 chrome::HostDesktopType desktop_type, |
| 50 bool always_create, | 58 bool always_create, |
| 51 ProfileSwitchingDoneCallback callback, | 59 ProfileManager::CreateCallback callback, |
| 52 ProfileMetrics::ProfileOpen metric); | 60 ProfileMetrics::ProfileOpen metric); |
| 53 | 61 |
| 54 // Opens a Browser for the guest profile and runs |callback| if it isn't null. | 62 // Opens a Browser for the guest profile and runs |callback| if it isn't null. |
| 55 void SwitchToGuestProfile(chrome::HostDesktopType desktop_type, | 63 void SwitchToGuestProfile(chrome::HostDesktopType desktop_type, |
| 56 ProfileSwitchingDoneCallback callback); | 64 ProfileManager::CreateCallback callback); |
| 57 | 65 |
| 58 // Creates a new profile from the next available profile directory, and | 66 // Creates a new profile from the next available profile directory, and |
| 59 // opens a new browser window for the profile once it is ready. When the browser | 67 // opens a new browser window for the profile once it is ready. When the browser |
| 60 // is opened, |callback| will be run if it isn't null. | 68 // is opened, |callback| will be run if it isn't null. |
| 61 void CreateAndSwitchToNewProfile(chrome::HostDesktopType desktop_type, | 69 void CreateAndSwitchToNewProfile(chrome::HostDesktopType desktop_type, |
| 62 ProfileSwitchingDoneCallback callback, | 70 ProfileManager::CreateCallback callback, |
| 63 ProfileMetrics::ProfileAdd metric); | 71 ProfileMetrics::ProfileAdd metric); |
| 64 | 72 |
| 65 // Closes all browser windows that belong to the guest profile. | 73 // Closes all browser windows that belong to the guest profile. |
| 66 void CloseGuestProfileWindows(); | 74 void CloseGuestProfileWindows(); |
| 67 | 75 |
| 68 // Closes all the browser windows for |profile| and opens the user manager. | 76 // Closes all the browser windows for |profile| and opens the user manager. |
| 69 void LockProfile(Profile* profile); | 77 void LockProfile(Profile* profile); |
| 70 | 78 |
| 71 // Creates or reuses the guest profile needed by the user manager. Based on | 79 // Creates or reuses the guest profile needed by the user manager. Based on |
| 72 // the value of |tutorial_mode|, the user manager can show a specific | 80 // the value of |tutorial_mode|, the user manager can show a specific |
| 73 // tutorial, or no tutorial at all. If a tutorial is not shown, then | 81 // tutorial, or no tutorial at all. If a tutorial is not shown, then |
| 74 // |profile_path_to_focus| could be used to specify which user should be | 82 // |profile_path_to_focus| could be used to specify which user should be |
| 75 // focused. |callback| is run with the custom url to be displayed, as well as | 83 // focused. After a profile is opened from the user manager, perform |
| 76 // a pointer to the guest profile. | 84 // |profile_open_action|. |callback| is run with the custom url to be displayed, |
| 85 // as well as a pointer to the guest profile. |
| 77 void CreateGuestProfileForUserManager( | 86 void CreateGuestProfileForUserManager( |
| 78 const base::FilePath& profile_path_to_focus, | 87 const base::FilePath& profile_path_to_focus, |
| 79 profiles::UserManagerTutorialMode tutorial_mode, | 88 profiles::UserManagerTutorialMode tutorial_mode, |
| 89 profiles::UserManagerProfileSelected profile_open_action, |
| 80 const base::Callback<void(Profile*, const std::string&)>& callback); | 90 const base::Callback<void(Profile*, const std::string&)>& callback); |
| 81 | 91 |
| 82 // Based on the |profile| preferences, determines whether a user manager | 92 // Based on the |profile| preferences, determines whether a user manager |
| 83 // tutorial needs to be shown, and displays the user manager with or without | 93 // tutorial needs to be shown, and displays the user manager with or without |
| 84 // the tutorial. | 94 // the tutorial. |
| 85 void ShowUserManagerMaybeWithTutorial(Profile* profile); | 95 void ShowUserManagerMaybeWithTutorial(Profile* profile); |
| 86 | 96 |
| 87 // Enables new profile management preview and shows the user manager tutorial. | 97 // Enables new profile management preview and shows the user manager tutorial. |
| 88 void EnableNewProfileManagementPreview(Profile* profile); | 98 void EnableNewProfileManagementPreview(Profile* profile); |
| 89 | 99 |
| 90 // Disables new profile management preview and attempts to relaunch Chrome. | 100 // Disables new profile management preview and attempts to relaunch Chrome. |
| 91 void DisableNewProfileManagementPreview(Profile* profile); | 101 void DisableNewProfileManagementPreview(Profile* profile); |
| 92 | 102 |
| 93 // Converts from modes in the avatar menu to modes understood by | 103 // Converts from modes in the avatar menu to modes understood by |
| 94 // ProfileChooserView. | 104 // ProfileChooserView. |
| 95 void BubbleViewModeFromAvatarBubbleMode( | 105 void BubbleViewModeFromAvatarBubbleMode( |
| 96 BrowserWindow::AvatarBubbleMode mode, | 106 BrowserWindow::AvatarBubbleMode mode, |
| 97 BubbleViewMode* bubble_view_mode, | 107 BubbleViewMode* bubble_view_mode, |
| 98 TutorialMode* tutorial_mode); | 108 TutorialMode* tutorial_mode); |
| 99 | 109 |
| 100 } // namespace profiles | 110 } // namespace profiles |
| 101 | 111 |
| 102 #endif // CHROME_BROWSER_PROFILES_PROFILE_WINDOW_H_ | 112 #endif // CHROME_BROWSER_PROFILES_PROFILE_WINDOW_H_ |
| OLD | NEW |