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