| 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_CORE_OOBE_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_CORE_OOBE_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_CORE_OOBE_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_CORE_OOBE_HANDLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 public VersionInfoUpdater::Delegate, | 38 public VersionInfoUpdater::Delegate, |
| 39 public CoreOobeView, | 39 public CoreOobeView, |
| 40 public ui::EventSource { | 40 public ui::EventSource { |
| 41 public: | 41 public: |
| 42 class Delegate { | 42 class Delegate { |
| 43 public: | 43 public: |
| 44 // Called when current screen is changed. | 44 // Called when current screen is changed. |
| 45 virtual void OnCurrentScreenChanged(OobeScreen screen) = 0; | 45 virtual void OnCurrentScreenChanged(OobeScreen screen) = 0; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 explicit CoreOobeHandler(OobeUI* oobe_ui); | 48 explicit CoreOobeHandler(OobeUI* oobe_ui, |
| 49 JSCallsContainer* js_calls_container); |
| 49 ~CoreOobeHandler() override; | 50 ~CoreOobeHandler() override; |
| 50 | 51 |
| 51 void SetDelegate(Delegate* delegate); | 52 void SetDelegate(Delegate* delegate); |
| 52 | 53 |
| 53 // BaseScreenHandler implementation: | 54 // BaseScreenHandler implementation: |
| 54 void DeclareLocalizedValues( | 55 void DeclareLocalizedValues( |
| 55 ::login::LocalizedValuesBuilder* builder) override; | 56 ::login::LocalizedValuesBuilder* builder) override; |
| 56 void Initialize() override; | 57 void Initialize() override; |
| 57 | 58 |
| 58 // WebUIMessageHandler implementation. | 59 // WebUIMessageHandler implementation. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 73 bool show_oobe_ui() const { | 74 bool show_oobe_ui() const { |
| 74 return show_oobe_ui_; | 75 return show_oobe_ui_; |
| 75 } | 76 } |
| 76 | 77 |
| 77 // If |reboot_on_shutdown| is true, the reboot button becomes visible | 78 // If |reboot_on_shutdown| is true, the reboot button becomes visible |
| 78 // and the shutdown button is hidden. Vice versa if |reboot_on_shutdown| is | 79 // and the shutdown button is hidden. Vice versa if |reboot_on_shutdown| is |
| 79 // false. | 80 // false. |
| 80 void UpdateShutdownAndRebootVisibility(bool reboot_on_shutdown); | 81 void UpdateShutdownAndRebootVisibility(bool reboot_on_shutdown); |
| 81 | 82 |
| 82 private: | 83 private: |
| 83 // Calls javascript method. | |
| 84 // | |
| 85 // Note that the Args template parameter pack should consist of types | |
| 86 // convertible to base::Value. | |
| 87 template <typename... Args> | |
| 88 void ExecuteDeferredJSCall(const std::string& function_name, | |
| 89 std::unique_ptr<Args>... args); | |
| 90 | |
| 91 // Calls javascript method if the instance is already initialized, or defers | |
| 92 // the call until it gets initialized. | |
| 93 template <typename... Args> | |
| 94 void CallJSOrDefer(const std::string& function_name, const Args&... args); | |
| 95 | |
| 96 // Executes javascript calls that were deferred while the instance was not | |
| 97 // initialized yet. | |
| 98 void ExecuteDeferredJSCalls(); | |
| 99 | |
| 100 // CoreOobeActor implementation: | 84 // CoreOobeActor implementation: |
| 101 void ShowSignInError(int login_attempts, | 85 void ShowSignInError(int login_attempts, |
| 102 const std::string& error_text, | 86 const std::string& error_text, |
| 103 const std::string& help_link_text, | 87 const std::string& help_link_text, |
| 104 HelpAppLauncher::HelpTopic help_topic_id) override; | 88 HelpAppLauncher::HelpTopic help_topic_id) override; |
| 105 void ShowTpmError() override; | 89 void ShowTpmError() override; |
| 106 void ShowSignInUI(const std::string& email) override; | 90 void ShowSignInUI(const std::string& email) override; |
| 107 void ResetSignInUI(bool force_online) override; | 91 void ResetSignInUI(bool force_online) override; |
| 108 void ClearUserPodPassword() override; | 92 void ClearUserPodPassword() override; |
| 109 void RefocusCurrentPod() override; | 93 void RefocusCurrentPod() override; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // Updates the device requisition string on the UI side. | 145 // Updates the device requisition string on the UI side. |
| 162 void UpdateDeviceRequisition(); | 146 void UpdateDeviceRequisition(); |
| 163 | 147 |
| 164 // Updates client area size based on the primary screen size. | 148 // Updates client area size based on the primary screen size. |
| 165 void UpdateClientAreaSize(); | 149 void UpdateClientAreaSize(); |
| 166 | 150 |
| 167 // Notification of a change in the accessibility settings. | 151 // Notification of a change in the accessibility settings. |
| 168 void OnAccessibilityStatusChanged( | 152 void OnAccessibilityStatusChanged( |
| 169 const AccessibilityStatusEventDetails& details); | 153 const AccessibilityStatusEventDetails& details); |
| 170 | 154 |
| 171 // Whether the instance is initialized. | |
| 172 // | |
| 173 // The instance becomes initialized after the corresponding message is | |
| 174 // received from javascript side. | |
| 175 bool is_initialized_ = false; | |
| 176 | |
| 177 // Javascript calls that have been deferred while the instance was not | |
| 178 // initialized yet. | |
| 179 std::vector<base::Closure> deferred_js_calls_; | |
| 180 | |
| 181 // Owner of this handler. | 155 // Owner of this handler. |
| 182 OobeUI* oobe_ui_ = nullptr; | 156 OobeUI* oobe_ui_ = nullptr; |
| 183 | 157 |
| 184 // True if we should show OOBE instead of login. | 158 // True if we should show OOBE instead of login. |
| 185 bool show_oobe_ui_ = false; | 159 bool show_oobe_ui_ = false; |
| 186 | 160 |
| 187 // Updates when version info is changed. | 161 // Updates when version info is changed. |
| 188 VersionInfoUpdater version_info_updater_; | 162 VersionInfoUpdater version_info_updater_; |
| 189 | 163 |
| 190 // Help application used for help dialogs. | 164 // Help application used for help dialogs. |
| 191 scoped_refptr<HelpAppLauncher> help_app_; | 165 scoped_refptr<HelpAppLauncher> help_app_; |
| 192 | 166 |
| 193 Delegate* delegate_ = nullptr; | 167 Delegate* delegate_ = nullptr; |
| 194 | 168 |
| 195 std::unique_ptr<AccessibilityStatusSubscription> accessibility_subscription_; | 169 std::unique_ptr<AccessibilityStatusSubscription> accessibility_subscription_; |
| 196 | 170 |
| 197 DemoModeDetector demo_mode_detector_; | 171 DemoModeDetector demo_mode_detector_; |
| 198 | 172 |
| 199 keyboard::ScopedKeyboardDisabler scoped_keyboard_disabler_; | 173 keyboard::ScopedKeyboardDisabler scoped_keyboard_disabler_; |
| 200 | 174 |
| 201 DISALLOW_COPY_AND_ASSIGN(CoreOobeHandler); | 175 DISALLOW_COPY_AND_ASSIGN(CoreOobeHandler); |
| 202 }; | 176 }; |
| 203 | 177 |
| 204 } // namespace chromeos | 178 } // namespace chromeos |
| 205 | 179 |
| 206 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_CORE_OOBE_HANDLER_H_ | 180 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_CORE_OOBE_HANDLER_H_ |
| OLD | NEW |