Upstream version 11.40.277.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / profiles / profile_window.h
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.
4
5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_WINDOW_H_
6 #define CHROME_BROWSER_PROFILES_PROFILE_WINDOW_H_
7
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"
15
16 class Profile;
17 namespace base { class FilePath; }
18
19 namespace profiles {
20
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.
26 };
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   USER_MANAGER_SELECT_PROFILE_CHROME_SETTINGS,
34   USER_MANAGER_SELECT_PROFILE_CHROME_MEMORY,
35 };
36
37 extern const char kUserManagerDisplayTutorial[];
38 extern const char kUserManagerSelectProfileTaskManager[];
39 extern const char kUserManagerSelectProfileAboutChrome[];
40 extern const char kUserManagerSelectProfileChromeSettings[];
41 extern const char kUserManagerSelectProfileChromeMemory[];
42
43 // Activates a window for |profile| on the desktop specified by
44 // |desktop_type|. If no such window yet exists, or if |always_create| is
45 // true, this first creates a new window, then activates
46 // that. If activating an exiting window and multiple windows exists then the
47 // window that was most recently active is activated. This is used for
48 // creation of a window from the multi-profile dropdown menu.
49 void FindOrCreateNewWindowForProfile(
50     Profile* profile,
51     chrome::startup::IsProcessStartup process_startup,
52     chrome::startup::IsFirstRun is_first_run,
53     chrome::HostDesktopType desktop_type,
54     bool always_create);
55
56 // Opens a Browser with the specified profile given by |path|.
57 // If |always_create| is true then a new window is created
58 // even if a window for that profile already exists. When the browser is
59 // opened, |callback| will be run if it isn't null.
60
61 void SwitchToProfile(const base::FilePath& path,
62                      chrome::HostDesktopType desktop_type,
63                      bool always_create,
64                      ProfileManager::CreateCallback callback,
65                      ProfileMetrics::ProfileOpen metric);
66
67 // Opens a Browser for the guest profile and runs |callback| if it isn't null.
68 void SwitchToGuestProfile(chrome::HostDesktopType desktop_type,
69                           ProfileManager::CreateCallback callback);
70
71 // Creates a new profile from the next available profile directory, and
72 // opens a new browser window for the profile once it is ready. When the browser
73 // is opened, |callback| will be run if it isn't null.
74 void CreateAndSwitchToNewProfile(chrome::HostDesktopType desktop_type,
75                                  ProfileManager::CreateCallback callback,
76                                  ProfileMetrics::ProfileAdd metric);
77
78 // Closes all browser windows that belong to the guest profile.
79 void CloseGuestProfileWindows();
80
81 // Closes all the browser windows for |profile| and opens the user manager.
82 void LockProfile(Profile* profile);
83
84 // Returns whether lock is available to this profile.
85 bool IsLockAvailable(Profile* profile);
86
87 // Creates or reuses the guest profile needed by the user manager. Based on
88 // the value of |tutorial_mode|, the user manager can show a specific
89 // tutorial, or no tutorial at all. If a tutorial is not shown, then
90 // |profile_path_to_focus| could be used to specify which user should be
91 // focused. After a profile is opened from the user manager, perform
92 // |profile_open_action|. |callback| is run with the custom url to be displayed,
93 // as well as a pointer to the guest profile.
94 void CreateGuestProfileForUserManager(
95     const base::FilePath& profile_path_to_focus,
96     profiles::UserManagerTutorialMode tutorial_mode,
97     profiles::UserManagerProfileSelected profile_open_action,
98     const base::Callback<void(Profile*, const std::string&)>& callback);
99
100 // Based on the |profile| preferences, determines whether a user manager
101 // tutorial needs to be shown, and displays the user manager with or without
102 // the tutorial.
103 void ShowUserManagerMaybeWithTutorial(Profile* profile);
104
105 // Enables new profile management preview and shows the user manager tutorial.
106 void EnableNewProfileManagementPreview(Profile* profile);
107
108 // Disables new profile management preview and attempts to relaunch Chrome.
109 void DisableNewProfileManagementPreview(Profile* profile);
110
111 // Converts from modes in the avatar menu to modes understood by
112 // ProfileChooserView.
113 void BubbleViewModeFromAvatarBubbleMode(
114     BrowserWindow::AvatarBubbleMode mode,
115     BubbleViewMode* bubble_view_mode,
116     TutorialMode* tutorial_mode);
117
118 }  // namespace profiles
119
120 #endif  // CHROME_BROWSER_PROFILES_PROFILE_WINDOW_H_