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"
17 // The sole implementation of the TermsOfServiceScreenActor, using WebUI.
18 class TermsOfServiceScreenHandler
: public BaseScreenHandler
,
19 public TermsOfServiceScreenActor
{
21 TermsOfServiceScreenHandler();
22 virtual ~TermsOfServiceScreenHandler();
24 // content::WebUIMessageHandler:
25 virtual void RegisterMessages() OVERRIDE
;
28 virtual void DeclareLocalizedValues(LocalizedValuesBuilder
* builder
) OVERRIDE
;
30 // TermsOfServiceScreenActor:
31 virtual void SetDelegate(Delegate
* screen
) OVERRIDE
;
32 virtual void Show() OVERRIDE
;
33 virtual void Hide() OVERRIDE
;
34 virtual void SetDomain(const std::string
& domain
) OVERRIDE
;
35 virtual void OnLoadError() OVERRIDE
;
36 virtual void OnLoadSuccess(const std::string
& terms_of_service
) OVERRIDE
;
40 virtual void Initialize() OVERRIDE
;
42 // Update the domain name shown in the UI.
43 void UpdateDomainInUI();
45 // Update the UI to show an error message or the Terms of Service, depending
46 // on whether the download of the Terms of Service was successful. Does
47 // nothing if the download is still in progress.
48 void UpdateTermsOfServiceInUI();
50 // Called when the user declines the Terms of Service by clicking the "back"
54 // Called when the user accepts the Terms of Service by clicking the "accept
55 // and continue" button.
58 TermsOfServiceScreenHandler::Delegate
* screen_
;
60 // Whether the screen should be shown right after initialization.
63 // The domain name whose Terms of Service are being shown.
66 // Set to |true| when the download of the Terms of Service fails.
69 // Set to the Terms of Service when the download is successful.
70 std::string terms_of_service_
;
72 DISALLOW_COPY_AND_ASSIGN(TermsOfServiceScreenHandler
);
75 } // namespace chromeos
77 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_TERMS_OF_SERVICE_SCREEN_HANDLER_H_