[Metrics] Make MetricsStateManager take a callback param to check if UMA is enabled.
[chromium-blink-merge.git] / chrome / browser / profiles / profile_window.h
blob6cbf74c3ca71168e7a52d15ee76212ccf07dcb4b
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/host_desktop.h"
11 #include "chrome/browser/ui/startup/startup_types.h"
13 class Profile;
14 namespace base { class FilePath; }
16 namespace profiles {
18 // Callback to be used when switching to a new profile is completed.
19 typedef base::Callback<void()> ProfileSwitchingDoneCallback;
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 // Activates a window for |profile| on the desktop specified by
29 // |desktop_type|. If no such window yet exists, or if |always_create| is
30 // true, this first creates a new window, then activates
31 // that. If activating an exiting window and multiple windows exists then the
32 // window that was most recently active is activated. This is used for
33 // creation of a window from the multi-profile dropdown menu.
34 void FindOrCreateNewWindowForProfile(
35 Profile* profile,
36 chrome::startup::IsProcessStartup process_startup,
37 chrome::startup::IsFirstRun is_first_run,
38 chrome::HostDesktopType desktop_type,
39 bool always_create);
41 // Opens a Browser with the specified profile given by |path|.
42 // If |always_create| is true then a new window is created
43 // even if a window for that profile already exists. When the browser is
44 // opened, |callback| will be run if it isn't null.
46 void SwitchToProfile(const base::FilePath& path,
47 chrome::HostDesktopType desktop_type,
48 bool always_create,
49 ProfileSwitchingDoneCallback callback,
50 ProfileMetrics::ProfileOpen metric);
52 // Opens a Browser for the guest profile and runs |callback| if it isn't null.
53 void SwitchToGuestProfile(chrome::HostDesktopType desktop_type,
54 ProfileSwitchingDoneCallback callback);
56 // Creates a new profile from the next available profile directory, and
57 // opens a new browser window for the profile once it is ready. When the browser
58 // is opened, |callback| will be run if it isn't null.
59 void CreateAndSwitchToNewProfile(chrome::HostDesktopType desktop_type,
60 ProfileSwitchingDoneCallback callback,
61 ProfileMetrics::ProfileAdd metric);
63 // Closes all browser windows that belong to the guest profile.
64 void CloseGuestProfileWindows();
66 // Closes all the browser windows for |profile| and opens the user manager.
67 void LockProfile(Profile* profile);
69 // Creates or reuses the guest profile needed by the user manager. Based on
70 // the value of |tutorial_mode|, the user manager can show a specific
71 // tutorial, or no tutorial at all. If a tutorial is not shown, then
72 // |profile_path_to_focus| could be used to specify which user should be
73 // focused. |callback| is run with the custom url to be displayed, as well as
74 // a pointer to the guest profile.
75 void CreateGuestProfileForUserManager(
76 const base::FilePath& profile_path_to_focus,
77 profiles::UserManagerTutorialMode tutorial_mode,
78 const base::Callback<void(Profile*, const std::string&)>& callback);
80 // Based on the |profile| preferences, determines whether a user manager
81 // tutorial needs to be shown, and displays the user manager with or without
82 // the tutorial.
83 void ShowUserManagerMaybeWithTutorial(Profile* profile);
85 // Enables new profile management preview and shows the user manager tutorial.
86 void EnableNewProfileManagementPreview();
88 // Disables new profile management preview and attempts to relaunch Chrome.
89 void DisableNewProfileManagementPreview();
91 } // namespace profiles
93 #endif // CHROME_BROWSER_PROFILES_PROFILE_WINDOW_H_