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_metrics.h"
10 #include "chrome/browser/ui/browser_window.h"
11 #include "chrome/browser/ui/host_desktop.h"
12 #include "chrome/browser/ui/profile_chooser_constants.h"
13 #include "chrome/browser/ui/startup/startup_types.h"
16 namespace base
{ class FilePath
; }
20 // Callback to be used when switching to a new profile is completed.
21 typedef base::Callback
<void()> ProfileSwitchingDoneCallback
;
23 // Different tutorials that can be displayed in the user manager.
24 enum UserManagerTutorialMode
{
25 USER_MANAGER_NO_TUTORIAL
, // Does not display a tutorial.
26 USER_MANAGER_TUTORIAL_OVERVIEW
, // Basic overview of new features.
27 USER_MANAGER_TUTORIAL_LOCK
, // TODO(noms): To be implemented.
30 // Activates a window for |profile| on the desktop specified by
31 // |desktop_type|. If no such window yet exists, or if |always_create| is
32 // true, this first creates a new window, then activates
33 // 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
35 // creation of a window from the multi-profile dropdown menu.
36 void FindOrCreateNewWindowForProfile(
38 chrome::startup::IsProcessStartup process_startup
,
39 chrome::startup::IsFirstRun is_first_run
,
40 chrome::HostDesktopType desktop_type
,
43 // Opens a Browser with the specified profile given by |path|.
44 // 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
46 // opened, |callback| will be run if it isn't null.
48 void SwitchToProfile(const base::FilePath
& path
,
49 chrome::HostDesktopType desktop_type
,
51 ProfileSwitchingDoneCallback callback
,
52 ProfileMetrics::ProfileOpen metric
);
54 // Opens a Browser for the guest profile and runs |callback| if it isn't null.
55 void SwitchToGuestProfile(chrome::HostDesktopType desktop_type
,
56 ProfileSwitchingDoneCallback callback
);
58 // 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
60 // is opened, |callback| will be run if it isn't null.
61 void CreateAndSwitchToNewProfile(chrome::HostDesktopType desktop_type
,
62 ProfileSwitchingDoneCallback callback
,
63 ProfileMetrics::ProfileAdd metric
);
65 // Closes all browser windows that belong to the guest profile.
66 void CloseGuestProfileWindows();
68 // Closes all the browser windows for |profile| and opens the user manager.
69 void LockProfile(Profile
* profile
);
71 // 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
73 // 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
75 // focused. |callback| is run with the custom url to be displayed, as well as
76 // a pointer to the guest profile.
77 void CreateGuestProfileForUserManager(
78 const base::FilePath
& profile_path_to_focus
,
79 profiles::UserManagerTutorialMode tutorial_mode
,
80 const base::Callback
<void(Profile
*, const std::string
&)>& callback
);
82 // Based on the |profile| preferences, determines whether a user manager
83 // tutorial needs to be shown, and displays the user manager with or without
85 void ShowUserManagerMaybeWithTutorial(Profile
* profile
);
87 // Enables new profile management preview and shows the user manager tutorial.
88 void EnableNewProfileManagementPreview(Profile
* profile
);
90 // Disables new profile management preview and attempts to relaunch Chrome.
91 void DisableNewProfileManagementPreview(Profile
* profile
);
93 // Converts from modes in the avatar menu to modes understood by
94 // ProfileChooserView.
95 void BubbleViewModeFromAvatarBubbleMode(
96 BrowserWindow::AvatarBubbleMode mode
,
97 BubbleViewMode
* bubble_view_mode
,
98 TutorialMode
* tutorial_mode
);
100 } // namespace profiles
102 #endif // CHROME_BROWSER_PROFILES_PROFILE_WINDOW_H_