| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_SIGNIN_SIGNIN_SUPERVISED_USER_IMPORT_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SIGNIN_SIGNIN_SUPERVISED_USER_IMPORT_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_SIGNIN_SIGNIN_SUPERVISED_USER_IMPORT_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SIGNIN_SIGNIN_SUPERVISED_USER_IMPORT_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback_list.h" | 10 #include "base/callback_list.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // Handler for the 'import existing supervised user' dialog. | 23 // Handler for the 'import existing supervised user' dialog. |
| 24 class SigninSupervisedUserImportHandler : public content::WebUIMessageHandler { | 24 class SigninSupervisedUserImportHandler : public content::WebUIMessageHandler { |
| 25 public: | 25 public: |
| 26 SigninSupervisedUserImportHandler(); | 26 SigninSupervisedUserImportHandler(); |
| 27 ~SigninSupervisedUserImportHandler() override; | 27 ~SigninSupervisedUserImportHandler() override; |
| 28 | 28 |
| 29 // WebUIMessageHandler implementation. | 29 // WebUIMessageHandler implementation. |
| 30 void RegisterMessages() override; | 30 void RegisterMessages() override; |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 FRIEND_TEST_ALL_PREFIXES(SigninSupervisedUserImportHandlerTest, |
| 34 NotAuthenticated); |
| 35 FRIEND_TEST_ALL_PREFIXES(SigninSupervisedUserImportHandlerTest, AuthError); |
| 36 FRIEND_TEST_ALL_PREFIXES(SigninSupervisedUserImportHandlerTest, |
| 37 CustodianIsSupervised); |
| 38 FRIEND_TEST_ALL_PREFIXES(SigninSupervisedUserImportHandlerTest, |
| 39 SendExistingSupervisedUsers); |
| 33 // Assigns a new |webui_callback_id_|. Ensures that previous in-flight request | 40 // Assigns a new |webui_callback_id_|. Ensures that previous in-flight request |
| 34 // has been fulfilled. | 41 // has been fulfilled. |
| 35 void AssignWebUICallbackId(const base::ListValue* args); | 42 void AssignWebUICallbackId(const base::ListValue* args); |
| 36 | 43 |
| 37 // Callback for the "openUrlInLastActiveProfileBrowser" message. Opens the | 44 // Callback for the "openUrlInLastActiveProfileBrowser" message. Opens the |
| 38 // given url in a new background tab in the browser owned by the last active | 45 // given url in a new background tab in the browser owned by the last active |
| 39 // profile. Hyperlinks don't work in the user manager since the system profile | 46 // profile. Hyperlinks don't work in the user manager since the system profile |
| 40 // browser is not tabbed. | 47 // browser is not tabbed. |
| 41 void OpenUrlInLastActiveProfileBrowser(const base::ListValue* args); | 48 void OpenUrlInLastActiveProfileBrowser(const base::ListValue* args); |
| 42 | 49 |
| 43 // Callback for the "getExistingSupervisedUsers" message. | 50 // Callback for the "getExistingSupervisedUsers" message. |
| 44 // Checks the sign-in status of the custodian and accordingly | 51 // Checks the sign-in status of the custodian and accordingly |
| 45 // sends an update to the WebUI. | 52 // sends an update to the WebUI. |
| 46 void GetExistingSupervisedUsers(const base::ListValue* args); | 53 void GetExistingSupervisedUsers(const base::ListValue* args); |
| 47 | 54 |
| 48 void LoadCustodianProfileCallback(Profile* custodian_profile, | 55 void LoadCustodianProfileCallback(Profile* custodian_profile, |
| 49 Profile::CreateStatus status); | 56 Profile::CreateStatus status); |
| 50 | 57 |
| 51 // Reject the WebUI callback with an error message. | 58 // Reject the WebUI callback with an error message. |
| 52 void RejectCallback(const base::string16& error); | 59 void RejectCallback(const base::string16& error); |
| 53 | 60 |
| 54 base::string16 GetLocalErorrMessage() const; | 61 base::string16 GetLocalErorrMessage() const; |
| 55 | 62 |
| 56 base::string16 GetAuthErorrMessage() const; | 63 base::string16 GetAuthErorrMessage() const; |
| 57 | 64 |
| 58 // Sends an array of supervised users to WebUI. Each entry is of the form: | 65 // Sends an array of supervised users to WebUI. Each entry is of the form: |
| 59 // supervisedProfile = { | 66 // supervisedProfile = { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 73 // The WebUI callback ID of the last in-flight async request. There is always | 80 // The WebUI callback ID of the last in-flight async request. There is always |
| 74 // only one in-flight such request. | 81 // only one in-flight such request. |
| 75 std::string webui_callback_id_; | 82 std::string webui_callback_id_; |
| 76 | 83 |
| 77 base::WeakPtrFactory<SigninSupervisedUserImportHandler> weak_ptr_factory_; | 84 base::WeakPtrFactory<SigninSupervisedUserImportHandler> weak_ptr_factory_; |
| 78 | 85 |
| 79 DISALLOW_COPY_AND_ASSIGN(SigninSupervisedUserImportHandler); | 86 DISALLOW_COPY_AND_ASSIGN(SigninSupervisedUserImportHandler); |
| 80 }; | 87 }; |
| 81 | 88 |
| 82 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_SIGNIN_SUPERVISED_USER_IMPORT_HANDLER_H
_ | 89 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_SIGNIN_SUPERVISED_USER_IMPORT_HANDLER_H
_ |
| OLD | NEW |