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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_WINDOW_H_
6 #define CHROME_BROWSER_PROFILES_PROFILE_WINDOW_H_
8 #include "base/callback_forward.h"
9 #include "chrome/browser/profiles/profile_manager.h"
10 #include "chrome/browser/profiles/profile_metrics.h"
11 #include "chrome/browser/ui/browser_window.h"
12 #include "chrome/browser/ui/host_desktop.h"
13 #include "chrome/browser/ui/profile_chooser_constants.h"
14 #include "chrome/browser/ui/startup/startup_types.h"
17 namespace base
{ class FilePath
; }
21 // Different tutorials that can be displayed in the user manager.
22 enum UserManagerTutorialMode
{
23 USER_MANAGER_NO_TUTORIAL
, // Does not display a tutorial.
24 USER_MANAGER_TUTORIAL_OVERVIEW
, // Basic overview of new features.
25 USER_MANAGER_TUTORIAL_LOCK
, // TODO(noms): To be implemented.
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 USER_MANAGER_SELECT_PROFILE_CHROME_SETTINGS
,
34 USER_MANAGER_SELECT_PROFILE_CHROME_MEMORY
,
35 USER_MANAGER_SELECT_PROFILE_APP_LAUNCHER
,
38 extern const char kUserManagerDisplayTutorial
[];
39 extern const char kUserManagerSelectProfileTaskManager
[];
40 extern const char kUserManagerSelectProfileAboutChrome
[];
41 extern const char kUserManagerSelectProfileChromeSettings
[];
42 extern const char kUserManagerSelectProfileChromeMemory
[];
43 extern const char kUserManagerSelectProfileAppLauncher
[];
45 // Activates a window for |profile| on the desktop specified by
46 // |desktop_type|. If no such window yet exists, or if |always_create| is
47 // true, this first creates a new window, then activates
48 // that. If activating an exiting window and multiple windows exists then the
49 // window that was most recently active is activated. This is used for
50 // creation of a window from the multi-profile dropdown menu.
51 void FindOrCreateNewWindowForProfile(
53 chrome::startup::IsProcessStartup process_startup
,
54 chrome::startup::IsFirstRun is_first_run
,
55 chrome::HostDesktopType desktop_type
,
58 // Opens a Browser with the specified profile given by |path|.
59 // If |always_create| is true then a new window is created
60 // even if a window for that profile already exists. When the browser is
61 // opened, |callback| will be run if it isn't null.
63 void SwitchToProfile(const base::FilePath
& path
,
64 chrome::HostDesktopType desktop_type
,
66 ProfileManager::CreateCallback callback
,
67 ProfileMetrics::ProfileOpen metric
);
69 // Opens a Browser for the guest profile and runs |callback| if it isn't null.
70 void SwitchToGuestProfile(chrome::HostDesktopType desktop_type
,
71 ProfileManager::CreateCallback callback
);
73 // Creates a new profile from the next available profile directory, and
74 // opens a new browser window for the profile once it is ready. When the browser
75 // is opened, |callback| will be run if it isn't null.
76 void CreateAndSwitchToNewProfile(chrome::HostDesktopType desktop_type
,
77 ProfileManager::CreateCallback callback
,
78 ProfileMetrics::ProfileAdd metric
);
80 // Closes all browser windows that belong to the guest profile.
81 void CloseGuestProfileWindows();
83 // Closes all the browser windows for |profile| and opens the user manager.
84 void LockProfile(Profile
* profile
);
86 // Returns whether lock is available to this profile.
87 bool IsLockAvailable(Profile
* profile
);
89 // Creates or reuses the system profile needed by the user manager. Based on
90 // the value of |tutorial_mode|, the user manager can show a specific
91 // tutorial, or no tutorial at all. If a tutorial is not shown, then
92 // |profile_path_to_focus| could be used to specify which user should be
93 // focused. After a profile is opened from the user manager, perform
94 // |profile_open_action|. |callback| is run with the custom url to be displayed,
95 // as well as a pointer to the guest profile.
96 void CreateSystemProfileForUserManager(
97 const base::FilePath
& profile_path_to_focus
,
98 profiles::UserManagerTutorialMode tutorial_mode
,
99 profiles::UserManagerProfileSelected profile_open_action
,
100 const base::Callback
<void(Profile
*, const std::string
&)>& callback
);
102 // Based on the |profile| preferences, determines whether a user manager
103 // tutorial needs to be shown, and displays the user manager with or without
105 void ShowUserManagerMaybeWithTutorial(Profile
* profile
);
107 // Enables new profile management preview and shows the user manager tutorial.
108 void EnableNewProfileManagementPreview(Profile
* profile
);
110 // Disables new profile management preview and attempts to relaunch Chrome.
111 void DisableNewProfileManagementPreview(Profile
* profile
);
113 // Converts from modes in the avatar menu to modes understood by
114 // ProfileChooserView.
115 void BubbleViewModeFromAvatarBubbleMode(
116 BrowserWindow::AvatarBubbleMode mode
,
117 BubbleViewMode
* bubble_view_mode
,
118 TutorialMode
* tutorial_mode
);
120 } // namespace profiles
122 #endif // CHROME_BROWSER_PROFILES_PROFILE_WINDOW_H_