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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_CORE_OOBE_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_CORE_OOBE_HANDLER_H_
10 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h"
11 #include "chrome/browser/chromeos/login/version_info_updater.h"
12 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
13 #include "content/public/browser/notification_observer.h"
14 #include "content/public/browser/notification_registrar.h"
24 // The core handler for Javascript messages related to the "oobe" view.
25 class CoreOobeHandler : public BaseScreenHandler,
26 public VersionInfoUpdater::Delegate,
27 public content::NotificationObserver,
28 public CoreOobeActor {
32 // Called when current screen is changed.
33 virtual void OnCurrentScreenChanged(const std::string& screen) = 0;
36 explicit CoreOobeHandler(OobeUI* oobe_ui);
37 virtual ~CoreOobeHandler();
39 void SetDelegate(Delegate* delegate);
41 // BaseScreenHandler implementation:
42 virtual void DeclareLocalizedValues(LocalizedValuesBuilder* builder) OVERRIDE;
43 virtual void Initialize() OVERRIDE;
45 // WebUIMessageHandler implementation.
46 virtual void RegisterMessages() OVERRIDE;
48 // VersionInfoUpdater::Delegate implementation:
49 virtual void OnOSVersionLabelTextUpdated(
50 const std::string& os_version_label_text) OVERRIDE;
51 virtual void OnEnterpriseInfoUpdated(
52 const std::string& message_text) OVERRIDE;
54 // Show or hide OOBE UI.
55 void ShowOobeUI(bool show);
57 bool show_oobe_ui() const {
62 // CoreOobeActor implementation:
63 virtual void ShowSignInError(
65 const std::string& error_text,
66 const std::string& help_link_text,
67 HelpAppLauncher::HelpTopic help_topic_id) OVERRIDE;
68 virtual void ShowTpmError() OVERRIDE;
69 virtual void ShowSignInUI(const std::string& email) OVERRIDE;
70 virtual void ResetSignInUI(bool force_online) OVERRIDE;
71 virtual void ClearUserPodPassword() OVERRIDE;
72 virtual void RefocusCurrentPod() OVERRIDE;
73 virtual void OnLoginSuccess(const std::string& username) OVERRIDE;
74 virtual void ShowPasswordChangedScreen(bool show_password_error) OVERRIDE;
75 virtual void SetUsageStats(bool checked) OVERRIDE;
76 virtual void SetOemEulaUrl(const std::string& oem_eula_url) OVERRIDE;
77 virtual void SetTpmPassword(const std::string& tmp_password) OVERRIDE;
78 virtual void ClearErrors() OVERRIDE;
79 virtual void ReloadContent(const base::DictionaryValue& dictionary) OVERRIDE;
81 // Handlers for JS WebUI messages.
82 void HandleEnableLargeCursor(bool enabled);
83 void HandleEnableHighContrast(bool enabled);
84 void HandleEnableVirtualKeyboard(bool enabled);
85 void HandleEnableScreenMagnifier(bool enabled);
86 void HandleEnableSpokenFeedback();
87 void HandleInitialized();
88 void HandleSkipUpdateEnrollAfterEula();
89 void HandleUpdateCurrentScreen(const std::string& screen);
90 void HandleSetDeviceRequisition(const std::string& requisition);
91 void HandleScreenAssetsLoaded(const std::string& screen_async_load_id);
92 void HandleSkipToLoginForTesting(const base::ListValue* args);
94 // Updates a11y menu state based on the current a11y features state(on/off).
95 void UpdateA11yState();
97 // Calls javascript to sync OOBE UI visibility with show_oobe_ui_.
98 void UpdateOobeUIVisibility();
100 // Updates label with specified id with specified text.
101 void UpdateLabel(const std::string& id, const std::string& text);
103 // Updates the device requisition string on the UI side.
104 void UpdateDeviceRequisition();
106 // content::NotificationObserver implementation:
107 virtual void Observe(int type,
108 const content::NotificationSource& source,
109 const content::NotificationDetails& details) OVERRIDE;
111 // Owner of this handler.
114 // True if we should show OOBE instead of login.
117 // Updates when version info is changed.
118 VersionInfoUpdater version_info_updater_;
122 content::NotificationRegistrar registrar_;
124 DISALLOW_COPY_AND_ASSIGN(CoreOobeHandler);
127 } // namespace chromeos
129 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_CORE_OOBE_HANDLER_H_