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/base/locale_util.h"
13 #include "chrome/browser/chromeos/login/screens/terms_of_service_screen_actor.h"
14 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
20 // The sole implementation of the TermsOfServiceScreenActor, using WebUI.
21 class TermsOfServiceScreenHandler
: public BaseScreenHandler
,
22 public TermsOfServiceScreenActor
{
24 explicit TermsOfServiceScreenHandler(CoreOobeActor
* core_oobe_actor
);
25 ~TermsOfServiceScreenHandler() override
;
27 // content::WebUIMessageHandler:
28 void RegisterMessages() override
;
31 void DeclareLocalizedValues(
32 ::login::LocalizedValuesBuilder
* builder
) override
;
34 // TermsOfServiceScreenActor:
35 void SetDelegate(Delegate
* screen
) override
;
38 void SetDomain(const std::string
& domain
) override
;
39 void OnLoadError() override
;
40 void OnLoadSuccess(const std::string
& terms_of_service
) override
;
44 void Initialize() override
;
46 // Callback invoked after the UI locale has been changed.
47 void OnLanguageChangedCallback(
48 const locale_util::LanguageSwitchResult
& result
);
50 // Switch to the user's preferred input method and show the screen. This
51 // method is called after it has been ensured that the current UI locale
52 // matches the UI locale chosen by the user.
55 // Update the domain name shown in the UI.
56 void UpdateDomainInUI();
58 // Update the UI to show an error message or the Terms of Service, depending
59 // on whether the download of the Terms of Service was successful. Does
60 // nothing if the download is still in progress.
61 void UpdateTermsOfServiceInUI();
63 // Called when the user declines the Terms of Service by clicking the "back"
67 // Called when the user accepts the Terms of Service by clicking the "accept
68 // and continue" button.
71 TermsOfServiceScreenHandler::Delegate
* screen_
;
73 CoreOobeActor
* core_oobe_actor_
;
75 // Whether the screen should be shown right after initialization.
78 // The domain name whose Terms of Service are being shown.
81 // Set to |true| when the download of the Terms of Service fails.
84 // Set to the Terms of Service when the download is successful.
85 std::string terms_of_service_
;
87 DISALLOW_COPY_AND_ASSIGN(TermsOfServiceScreenHandler
);
90 } // namespace chromeos
92 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_TERMS_OF_SERVICE_SCREEN_HANDLER_H_