NaCl: Update revision in DEPS, r12770 -> r12773
[chromium-blink-merge.git] / chrome / browser / ui / webui / chromeos / login / terms_of_service_screen_handler.h
blob5bbbacf30aa9fefc41ce3adb4d94d0dbb4e61aac
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_
8 #include <string>
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"
15 namespace chromeos {
17 // The sole implementation of the TermsOfServiceScreenActor, using WebUI.
18 class TermsOfServiceScreenHandler : public BaseScreenHandler,
19 public TermsOfServiceScreenActor {
20 public:
21 TermsOfServiceScreenHandler();
22 virtual ~TermsOfServiceScreenHandler();
24 // content::WebUIMessageHandler:
25 virtual void RegisterMessages() OVERRIDE;
27 // BaseScreenHandler:
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;
38 private:
39 // BaseScreenHandler:
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"
51 // button.
52 void HandleBack();
54 // Called when the user accepts the Terms of Service by clicking the "accept
55 // and continue" button.
56 void HandleAccept();
58 TermsOfServiceScreenHandler::Delegate* screen_;
60 // Whether the screen should be shown right after initialization.
61 bool show_on_init_;
63 // The domain name whose Terms of Service are being shown.
64 std::string domain_;
66 // Set to |true| when the download of the Terms of Service fails.
67 bool load_error_;
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_