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. 4 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_TERMS_OF_SERVICE_SCREEN_ACTOR_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_TERMS_OF_SERVICE_SCREEN_ACTOR_H_ 7 8 #include <string> 9 10 namespace chromeos { 11 12 // Interface for dependency injection between TermsOfServiceScreen and its 13 // WebUI representation. 14 class TermsOfServiceScreenActor { 15 public: 16 class Delegate { 17 public: 18 virtual ~Delegate() {} 19 20 // Called when the user declines the Terms of Service. 21 virtual void OnDecline() = 0; 22 23 // Called when the user accepts the Terms of Service. 24 virtual void OnAccept() = 0; 25 26 // Called when actor is destroyed so there is no dead reference to it. 27 virtual void OnActorDestroyed(TermsOfServiceScreenActor* actor) = 0; 28 }; 29 30 virtual ~TermsOfServiceScreenActor() {} 31 32 // Sets screen this actor belongs to. 33 virtual void SetDelegate(Delegate* screen) = 0; 34 35 // Shows the contents of the screen. 36 virtual void Show() = 0; 37 38 // Hides the contents of the screen. 39 virtual void Hide() = 0; 40 41 // Sets the domain name whose Terms of Service are being shown. 42 virtual void SetDomain(const std::string& domain) = 0; 43 44 // Called when the download of the Terms of Service fails. Show an error 45 // message to the user. 46 virtual void OnLoadError() = 0; 47 48 // Called when the download of the Terms of Service is successful. Shows the 49 // downloaded |terms_of_service| to the user. 50 virtual void OnLoadSuccess(const std::string& terms_of_service) = 0; 51 }; 52 53 } // namespace chromeos 54 55 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_TERMS_OF_SERVICE_SCREEN_ACTOR_H_ 56