Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / ui / webui / chromeos / login / supervised_user_creation_screen_handler.h
blob4d9284be8221bcabfbb3aecf94d7031d3cdf379d
1 // Copyright 2014 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_UI_WEBUI_CHROMEOS_LOGIN_SUPERVISED_USER_CREATION_SCREEN_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SUPERVISED_USER_CREATION_SCREEN_HANDLER_H_
8 #include <string>
10 #include "base/compiler_specific.h"
11 #include "base/strings/string16.h"
12 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
13 #include "components/user_manager/user_image/default_user_images.h"
14 #include "content/public/browser/web_ui.h"
16 namespace base {
17 class ListValue;
20 namespace chromeos {
22 class SupervisedUserCreationScreenHandler : public BaseScreenHandler {
23 public:
24 class Delegate {
25 public:
26 virtual ~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).
30 virtual void OnActorDestroyed(
31 SupervisedUserCreationScreenHandler* actor) = 0;
33 // Starts supervised user creation flow, with manager identified by
34 // |manager_id| and |manager_password|.
35 virtual void AuthenticateManager(const std::string& manager_id,
36 const std::string& manager_password) = 0;
38 // Starts supervised user creation flow, with supervised user that would
39 // have |display_name| and authenticated by the |supervised_user_password|.
40 virtual void CreateSupervisedUser(
41 const base::string16& display_name,
42 const std::string& supervised_user_password) = 0;
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,
46 // false otherwise.
47 virtual bool FindUserByDisplayName(const base::string16& display_name,
48 std::string *out_id) const = 0;
50 // Starts supervised user import flow for user identified with |user_id|.
51 virtual void ImportSupervisedUser(const std::string& user_id) = 0;
52 // Starts supervised user import flow for user identified with |user_id| and
53 // additional |password|.
54 virtual void ImportSupervisedUserWithPassword(
55 const std::string& user_id, const std::string& password) = 0;
57 virtual void AbortFlow() = 0;
58 virtual void FinishFlow() = 0;
59 virtual void HideFlow() = 0;
61 virtual void OnPhotoTaken(const std::string& raw_data) = 0;
62 virtual void OnImageSelected(const std::string& image_url,
63 const std::string& image_type) = 0;
64 virtual void OnImageAccepted() = 0;
65 virtual void OnPageSelected(const std::string& page) = 0;
68 SupervisedUserCreationScreenHandler();
69 ~SupervisedUserCreationScreenHandler() override;
71 virtual void PrepareToShow();
72 virtual void Show();
73 virtual void Hide();
74 virtual void SetDelegate(Delegate* delegate);
76 void ShowManagerPasswordError();
78 void ShowIntroPage();
79 void ShowUsernamePage();
81 // Shows progress or error message close in the button area. |is_progress| is
82 // true for progress messages and false for error messages.
83 void ShowStatusMessage(bool is_progress, const base::string16& message);
84 void ShowTutorialPage();
86 void ShowErrorPage(const base::string16& title,
87 const base::string16& message,
88 const base::string16& button_text);
90 // Navigates to specified page.
91 void ShowPage(const std::string& page);
93 void SetCameraPresent(bool enabled);
95 void ShowExistingSupervisedUsers(const base::ListValue* users);
97 // BaseScreenHandler implementation:
98 void DeclareLocalizedValues(
99 ::login::LocalizedValuesBuilder* builder) override;
100 void Initialize() override;
102 // WebUIMessageHandler implementation:
103 void RegisterMessages() override;
105 private:
106 // WebUI message handlers.
107 void HandleCheckSupervisedUserName(const base::string16& name);
109 void HandleManagerSelected(const std::string& manager_id);
110 void HandleImportUserSelected(const std::string& user_id);
112 void HandleFinishLocalSupervisedUserCreation();
113 void HandleAbortLocalSupervisedUserCreation();
114 void HandleHideLocalSupervisedUserCreation();
115 void HandleRetryLocalSupervisedUserCreation(const base::ListValue* args);
116 void HandleCurrentSupervisedUserPage(const std::string& current_page);
118 void HandleAuthenticateManager(const std::string& raw_manager_username,
119 const std::string& manager_password);
120 void HandleCreateSupervisedUser(const base::string16& new_raw_user_name,
121 const std::string& new_user_password);
122 void HandleImportSupervisedUser(const std::string& user_id);
123 void HandleImportSupervisedUserWithPassword(const std::string& user_id,
124 const std::string& password);
126 void HandleGetImages();
127 void HandlePhotoTaken(const std::string& image_url);
128 void HandleTakePhoto();
129 void HandleDiscardPhoto();
130 void HandleSelectImage(const std::string& image_url,
131 const std::string& image_type);
133 void UpdateText(const std::string& element_id, const base::string16& text);
135 Delegate* delegate_;
137 DISALLOW_COPY_AND_ASSIGN(SupervisedUserCreationScreenHandler);
140 } // namespace chromeos
142 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SUPERVISED_USER_CREATION_SCREEN_HANDLER_H_