1 // Copyright (c) 2013 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_TERMS_OF_SERVICE_SCREEN_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_TERMS_OF_SERVICE_SCREEN_HANDLER_H_
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "chrome/browser/chromeos/login/screens/terms_of_service_screen_actor.h"
13 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
19 // The sole implementation of the TermsOfServiceScreenActor, using WebUI.
20 class TermsOfServiceScreenHandler : public BaseScreenHandler,
21 public TermsOfServiceScreenActor {
23 explicit TermsOfServiceScreenHandler(CoreOobeActor* core_oobe_actor);
24 virtual ~TermsOfServiceScreenHandler();
26 // content::WebUIMessageHandler:
27 virtual void RegisterMessages() override;
30 virtual void DeclareLocalizedValues(LocalizedValuesBuilder* builder) override;
32 // TermsOfServiceScreenActor:
33 virtual void SetDelegate(Delegate* screen) override;
34 virtual void Show() override;
35 virtual void Hide() override;
36 virtual void SetDomain(const std::string& domain) override;
37 virtual void OnLoadError() override;
38 virtual void OnLoadSuccess(const std::string& terms_of_service) override;
42 virtual void Initialize() override;
44 // Callback invoked after the UI locale has been changed.
45 void OnLanguageChangedCallback(const std::string& requested_locale,
46 const std::string& loaded_locale,
49 // Switch to the user's preferred input method and show the screen. This
50 // method is called after it has been ensured that the current UI locale
51 // matches the UI locale chosen by the user.
54 // Update the domain name shown in the UI.
55 void UpdateDomainInUI();
57 // Update the UI to show an error message or the Terms of Service, depending
58 // on whether the download of the Terms of Service was successful. Does
59 // nothing if the download is still in progress.
60 void UpdateTermsOfServiceInUI();
62 // Called when the user declines the Terms of Service by clicking the "back"
66 // Called when the user accepts the Terms of Service by clicking the "accept
67 // and continue" button.
70 TermsOfServiceScreenHandler::Delegate* screen_;
72 CoreOobeActor* core_oobe_actor_;
74 // Whether the screen should be shown right after initialization.
77 // The domain name whose Terms of Service are being shown.
80 // Set to |true| when the download of the Terms of Service fails.
83 // Set to the Terms of Service when the download is successful.
84 std::string terms_of_service_;
86 DISALLOW_COPY_AND_ASSIGN(TermsOfServiceScreenHandler);
89 } // namespace chromeos
91 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_TERMS_OF_SERVICE_SCREEN_HANDLER_H_