| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CREATE_PROFILE_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CREATE_PROFILE_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CREATE_PROFILE_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CREATE_PROFILE_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // (optional, boolean) | 67 // (optional, boolean) |
| 68 // 4: a string representing the supervised user ID. | 68 // 4: a string representing the supervised user ID. |
| 69 void CreateProfile(const base::ListValue* args); | 69 void CreateProfile(const base::ListValue* args); |
| 70 | 70 |
| 71 // If a local error occurs during profile creation, then show an appropriate | 71 // If a local error occurs during profile creation, then show an appropriate |
| 72 // error message. However, if profile creation succeeded and the | 72 // error message. However, if profile creation succeeded and the |
| 73 // profile being created/imported is a supervised user profile, | 73 // profile being created/imported is a supervised user profile, |
| 74 // then proceed with the registration step. Otherwise, update the UI | 74 // then proceed with the registration step. Otherwise, update the UI |
| 75 // as the final task after a new profile has been created. | 75 // as the final task after a new profile has been created. |
| 76 void OnProfileCreated(bool create_shortcut, | 76 void OnProfileCreated(bool create_shortcut, |
| 77 chrome::HostDesktopType desktop_type, | 77 ui::HostDesktopType desktop_type, |
| 78 const std::string& supervised_user_id, | 78 const std::string& supervised_user_id, |
| 79 Profile* profile, | 79 Profile* profile, |
| 80 Profile::CreateStatus status); | 80 Profile::CreateStatus status); |
| 81 | 81 |
| 82 void HandleProfileCreationSuccess(bool create_shortcut, | 82 void HandleProfileCreationSuccess(bool create_shortcut, |
| 83 chrome::HostDesktopType desktop_type, | 83 ui::HostDesktopType desktop_type, |
| 84 const std::string& supervised_user_id, | 84 const std::string& supervised_user_id, |
| 85 Profile* profile); | 85 Profile* profile); |
| 86 | 86 |
| 87 // Creates desktop shortcut and updates the UI to indicate success | 87 // Creates desktop shortcut and updates the UI to indicate success |
| 88 // when creating a profile. | 88 // when creating a profile. |
| 89 void CreateShortcutAndShowSuccess(bool create_shortcut, | 89 void CreateShortcutAndShowSuccess(bool create_shortcut, |
| 90 chrome::HostDesktopType desktop_type, | 90 ui::HostDesktopType desktop_type, |
| 91 Profile* profile); | 91 Profile* profile); |
| 92 | 92 |
| 93 // Updates the UI to show an error when creating a profile. | 93 // Updates the UI to show an error when creating a profile. |
| 94 void ShowProfileCreationError(Profile* profile, const base::string16& error); | 94 void ShowProfileCreationError(Profile* profile, const base::string16& error); |
| 95 | 95 |
| 96 // Updates the UI to show a non-fatal warning when creating a profile. | 96 // Updates the UI to show a non-fatal warning when creating a profile. |
| 97 void ShowProfileCreationWarning(const base::string16& warning); | 97 void ShowProfileCreationWarning(const base::string16& warning); |
| 98 | 98 |
| 99 // Records UMA histograms relevant to profile creation. | 99 // Records UMA histograms relevant to profile creation. |
| 100 void RecordProfileCreationMetrics(Profile::CreateStatus status); | 100 void RecordProfileCreationMetrics(Profile::CreateStatus status); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 // Internal implementation. This may safely be called whether profile creation | 136 // Internal implementation. This may safely be called whether profile creation |
| 137 // or registration is in progress or not. |user_initiated| should be true if | 137 // or registration is in progress or not. |user_initiated| should be true if |
| 138 // the cancellation was deliberately requested by the user, and false if it | 138 // the cancellation was deliberately requested by the user, and false if it |
| 139 // was caused implicitly, e.g. by shutting down the browser. | 139 // was caused implicitly, e.g. by shutting down the browser. |
| 140 void CancelProfileRegistration(bool user_initiated); | 140 void CancelProfileRegistration(bool user_initiated); |
| 141 | 141 |
| 142 // After a new supervised-user profile has been created, registers the user | 142 // After a new supervised-user profile has been created, registers the user |
| 143 // with the management server. | 143 // with the management server. |
| 144 void RegisterSupervisedUser(bool create_shortcut, | 144 void RegisterSupervisedUser(bool create_shortcut, |
| 145 chrome::HostDesktopType desktop_type, | 145 ui::HostDesktopType desktop_type, |
| 146 const std::string& managed_user_id, | 146 const std::string& managed_user_id, |
| 147 Profile* new_profile); | 147 Profile* new_profile); |
| 148 | 148 |
| 149 // Called back with the result of the supervised user registration. | 149 // Called back with the result of the supervised user registration. |
| 150 void OnSupervisedUserRegistered(bool create_shortcut, | 150 void OnSupervisedUserRegistered(bool create_shortcut, |
| 151 chrome::HostDesktopType desktop_type, | 151 ui::HostDesktopType desktop_type, |
| 152 Profile* profile, | 152 Profile* profile, |
| 153 const GoogleServiceAuthError& error); | 153 const GoogleServiceAuthError& error); |
| 154 | 154 |
| 155 // Records UMA histograms relevant to supervised user profiles | 155 // Records UMA histograms relevant to supervised user profiles |
| 156 // creation and registration. | 156 // creation and registration. |
| 157 void RecordSupervisedProfileCreationMetrics( | 157 void RecordSupervisedProfileCreationMetrics( |
| 158 GoogleServiceAuthError::State error_state); | 158 GoogleServiceAuthError::State error_state); |
| 159 | 159 |
| 160 bool IsValidExistingSupervisedUserId( | 160 bool IsValidExistingSupervisedUserId( |
| 161 const std::string& existing_supervised_user_id) const; | 161 const std::string& existing_supervised_user_id) const; |
| 162 | 162 |
| 163 scoped_ptr<SupervisedUserRegistrationUtility> | 163 scoped_ptr<SupervisedUserRegistrationUtility> |
| 164 supervised_user_registration_utility_; | 164 supervised_user_registration_utility_; |
| 165 #endif | 165 #endif |
| 166 | 166 |
| 167 base::WeakPtrFactory<CreateProfileHandler> weak_ptr_factory_; | 167 base::WeakPtrFactory<CreateProfileHandler> weak_ptr_factory_; |
| 168 | 168 |
| 169 DISALLOW_COPY_AND_ASSIGN(CreateProfileHandler); | 169 DISALLOW_COPY_AND_ASSIGN(CreateProfileHandler); |
| 170 }; | 170 }; |
| 171 | 171 |
| 172 } // namespace options | 172 } // namespace options |
| 173 | 173 |
| 174 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CREATE_PROFILE_HANDLER_H_ | 174 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CREATE_PROFILE_HANDLER_H_ |
| OLD | NEW |