| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_CHROMEOS_LOGIN_LOCALLY_MANAGED_USER_CREATION_SCR
EEN_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SUPERVISED_USER_CREATION_SCREEN_H
ANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_LOCALLY_MANAGED_USER_CREATION_SCR
EEN_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SUPERVISED_USER_CREATION_SCREEN_H
ANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "chrome/browser/chromeos/login/users/avatar/default_user_images.h" | 12 #include "chrome/browser/chromeos/login/users/avatar/default_user_images.h" |
| 13 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" | 13 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" |
| 14 #include "content/public/browser/web_ui.h" | 14 #include "content/public/browser/web_ui.h" |
| 15 | 15 |
| 16 namespace base { | 16 namespace base { |
| 17 class ListValue; | 17 class ListValue; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace chromeos { | 20 namespace chromeos { |
| 21 | 21 |
| 22 class LocallyManagedUserCreationScreenHandler : public BaseScreenHandler { | 22 class SupervisedUserCreationScreenHandler : public BaseScreenHandler { |
| 23 public: | 23 public: |
| 24 class Delegate { | 24 class Delegate { |
| 25 public: | 25 public: |
| 26 virtual ~Delegate() {} | 26 virtual ~Delegate() {} |
| 27 | 27 |
| 28 // This method is called, when actor is being destroyed. Note, if Delegate | 28 // This method is called, when actor is being destroyed. Note, if Delegate |
| 29 // is destroyed earlier then it has to call SetDelegate(NULL). | 29 // is destroyed earlier then it has to call SetDelegate(NULL). |
| 30 virtual void OnActorDestroyed( | 30 virtual void OnActorDestroyed( |
| 31 LocallyManagedUserCreationScreenHandler* actor) = 0; | 31 SupervisedUserCreationScreenHandler* actor) = 0; |
| 32 | 32 |
| 33 // Starts managed user creation flow, with manager identified by | 33 // Starts supervised user creation flow, with manager identified by |
| 34 // |manager_id| and |manager_password|. | 34 // |manager_id| and |manager_password|. |
| 35 virtual void AuthenticateManager(const std::string& manager_id, | 35 virtual void AuthenticateManager(const std::string& manager_id, |
| 36 const std::string& manager_password) = 0; | 36 const std::string& manager_password) = 0; |
| 37 | 37 |
| 38 // Starts managed user creation flow, with supervised user that would have | 38 // Starts supervised user creation flow, with supervised user that would |
| 39 // |display_name| and authenticated by the |managed_user_password|. | 39 // have |display_name| and authenticated by the |supervised_user_password|. |
| 40 virtual void CreateManagedUser( | 40 virtual void CreateSupervisedUser( |
| 41 const base::string16& display_name, | 41 const base::string16& display_name, |
| 42 const std::string& managed_user_password) = 0; | 42 const std::string& supervised_user_password) = 0; |
| 43 | 43 |
| 44 // Look up if user with name |display_name| already exist and can be | 44 // Look up if user with name |display_name| already exist and can be |
| 45 // imported. Returns user ID in |out_id|. Returns true if user was found, | 45 // imported. Returns user ID in |out_id|. Returns true if user was found, |
| 46 // false otherwise. | 46 // false otherwise. |
| 47 virtual bool FindUserByDisplayName(const base::string16& display_name, | 47 virtual bool FindUserByDisplayName(const base::string16& display_name, |
| 48 std::string *out_id) const = 0; | 48 std::string *out_id) const = 0; |
| 49 | 49 |
| 50 // Starts managed user import flow for user identified with |user_id|. | 50 // Starts supervised user import flow for user identified with |user_id|. |
| 51 virtual void ImportManagedUser(const std::string& user_id) = 0; | 51 virtual void ImportSupervisedUser(const std::string& user_id) = 0; |
| 52 // Starts managed user import flow for user identified with |user_id| and | 52 // Starts supervised user import flow for user identified with |user_id| and |
| 53 // additional |password|. | 53 // additional |password|. |
| 54 virtual void ImportManagedUserWithPassword(const std::string& user_id, | 54 virtual void ImportSupervisedUserWithPassword( |
| 55 const std::string& password) = 0; | 55 const std::string& user_id, const std::string& password) = 0; |
| 56 | 56 |
| 57 virtual void AbortFlow() = 0; | 57 virtual void AbortFlow() = 0; |
| 58 virtual void FinishFlow() = 0; | 58 virtual void FinishFlow() = 0; |
| 59 | 59 |
| 60 virtual void OnPhotoTaken(const std::string& raw_data) = 0; | 60 virtual void OnPhotoTaken(const std::string& raw_data) = 0; |
| 61 virtual void OnImageSelected(const std::string& image_url, | 61 virtual void OnImageSelected(const std::string& image_url, |
| 62 const std::string& image_type) = 0; | 62 const std::string& image_type) = 0; |
| 63 virtual void OnImageAccepted() = 0; | 63 virtual void OnImageAccepted() = 0; |
| 64 virtual void OnPageSelected(const std::string& page) = 0; | 64 virtual void OnPageSelected(const std::string& page) = 0; |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 LocallyManagedUserCreationScreenHandler(); | 67 SupervisedUserCreationScreenHandler(); |
| 68 virtual ~LocallyManagedUserCreationScreenHandler(); | 68 virtual ~SupervisedUserCreationScreenHandler(); |
| 69 | 69 |
| 70 virtual void PrepareToShow(); | 70 virtual void PrepareToShow(); |
| 71 virtual void Show(); | 71 virtual void Show(); |
| 72 virtual void Hide(); | 72 virtual void Hide(); |
| 73 virtual void SetDelegate(Delegate* delegate); | 73 virtual void SetDelegate(Delegate* delegate); |
| 74 | 74 |
| 75 void ShowManagerPasswordError(); | 75 void ShowManagerPasswordError(); |
| 76 | 76 |
| 77 void ShowIntroPage(); | 77 void ShowIntroPage(); |
| 78 void ShowManagerSelectionPage(); | 78 void ShowManagerSelectionPage(); |
| 79 void ShowUsernamePage(); | 79 void ShowUsernamePage(); |
| 80 | 80 |
| 81 // Shows progress or error message close in the button area. |is_progress| is | 81 // Shows progress or error message close in the button area. |is_progress| is |
| 82 // true for progress messages and false for error messages. | 82 // true for progress messages and false for error messages. |
| 83 void ShowStatusMessage(bool is_progress, const base::string16& message); | 83 void ShowStatusMessage(bool is_progress, const base::string16& message); |
| 84 void ShowTutorialPage(); | 84 void ShowTutorialPage(); |
| 85 | 85 |
| 86 void ShowErrorPage(const base::string16& title, | 86 void ShowErrorPage(const base::string16& title, |
| 87 const base::string16& message, | 87 const base::string16& message, |
| 88 const base::string16& button_text); | 88 const base::string16& button_text); |
| 89 | 89 |
| 90 // Navigates to specified page. | 90 // Navigates to specified page. |
| 91 void ShowPage(const std::string& page); | 91 void ShowPage(const std::string& page); |
| 92 | 92 |
| 93 void SetCameraPresent(bool enabled); | 93 void SetCameraPresent(bool enabled); |
| 94 | 94 |
| 95 void ShowExistingManagedUsers(const base::ListValue* users); | 95 void ShowExistingSupervisedUsers(const base::ListValue* users); |
| 96 | 96 |
| 97 // BaseScreenHandler implementation: | 97 // BaseScreenHandler implementation: |
| 98 virtual void DeclareLocalizedValues(LocalizedValuesBuilder* builder) OVERRIDE; | 98 virtual void DeclareLocalizedValues(LocalizedValuesBuilder* builder) OVERRIDE; |
| 99 virtual void Initialize() OVERRIDE; | 99 virtual void Initialize() OVERRIDE; |
| 100 | 100 |
| 101 // WebUIMessageHandler implementation: | 101 // WebUIMessageHandler implementation: |
| 102 virtual void RegisterMessages() OVERRIDE; | 102 virtual void RegisterMessages() OVERRIDE; |
| 103 | 103 |
| 104 private: | 104 private: |
| 105 // WebUI message handlers. | 105 // WebUI message handlers. |
| 106 void HandleCheckLocallyManagedUserName(const base::string16& name); | 106 void HandleCheckSupervisedUserName(const base::string16& name); |
| 107 | 107 |
| 108 void HandleManagerSelected(const std::string& manager_id); | 108 void HandleManagerSelected(const std::string& manager_id); |
| 109 void HandleImportUserSelected(const std::string& user_id); | 109 void HandleImportUserSelected(const std::string& user_id); |
| 110 | 110 |
| 111 void HandleFinishLocalManagedUserCreation(); | 111 void HandleFinishLocalSupervisedUserCreation(); |
| 112 void HandleAbortLocalManagedUserCreation(); | 112 void HandleAbortLocalSupervisedUserCreation(); |
| 113 void HandleRetryLocalManagedUserCreation(const base::ListValue* args); | 113 void HandleRetryLocalSupervisedUserCreation(const base::ListValue* args); |
| 114 void HandleCurrentSupervisedUserPage(const std::string& current_page); | 114 void HandleCurrentSupervisedUserPage(const std::string& current_page); |
| 115 | 115 |
| 116 void HandleAuthenticateManager(const std::string& raw_manager_username, | 116 void HandleAuthenticateManager(const std::string& raw_manager_username, |
| 117 const std::string& manager_password); | 117 const std::string& manager_password); |
| 118 void HandleCreateManagedUser(const base::string16& new_raw_user_name, | 118 void HandleCreateSupervisedUser(const base::string16& new_raw_user_name, |
| 119 const std::string& new_user_password); | 119 const std::string& new_user_password); |
| 120 void HandleImportSupervisedUser(const std::string& user_id); | 120 void HandleImportSupervisedUser(const std::string& user_id); |
| 121 void HandleImportSupervisedUserWithPassword(const std::string& user_id, | 121 void HandleImportSupervisedUserWithPassword(const std::string& user_id, |
| 122 const std::string& password); | 122 const std::string& password); |
| 123 | 123 |
| 124 void HandleGetImages(); | 124 void HandleGetImages(); |
| 125 void HandlePhotoTaken(const std::string& image_url); | 125 void HandlePhotoTaken(const std::string& image_url); |
| 126 void HandleTakePhoto(); | 126 void HandleTakePhoto(); |
| 127 void HandleDiscardPhoto(); | 127 void HandleDiscardPhoto(); |
| 128 void HandleSelectImage(const std::string& image_url, | 128 void HandleSelectImage(const std::string& image_url, |
| 129 const std::string& image_type); | 129 const std::string& image_type); |
| 130 | 130 |
| 131 void UpdateText(const std::string& element_id, const base::string16& text); | 131 void UpdateText(const std::string& element_id, const base::string16& text); |
| 132 | 132 |
| 133 Delegate* delegate_; | 133 Delegate* delegate_; |
| 134 | 134 |
| 135 DISALLOW_COPY_AND_ASSIGN(LocallyManagedUserCreationScreenHandler); | 135 DISALLOW_COPY_AND_ASSIGN(SupervisedUserCreationScreenHandler); |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 } // namespace chromeos | 138 } // namespace chromeos |
| 139 | 139 |
| 140 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_LOCALLY_MANAGED_USER_CREATION_
SCREEN_HANDLER_H_ | 140 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SUPERVISED_USER_CREATION_SCREE
N_HANDLER_H_ |
| OLD | NEW |