| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_TERMS_OF_SERVICE_SCREEN_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_TERMS_OF_SERVICE_SCREEN_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_TERMS_OF_SERVICE_SCREEN_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_TERMS_OF_SERVICE_SCREEN_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/timer/timer.h" | 12 #include "base/timer/timer.h" |
| 13 #include "chrome/browser/chromeos/login/screens/base_screen.h" | 13 #include "chrome/browser/chromeos/login/screens/base_screen.h" |
| 14 #include "chrome/browser/chromeos/login/screens/terms_of_service_screen_actor.h" | 14 #include "chrome/browser/chromeos/login/screens/terms_of_service_screen_view.h" |
| 15 #include "net/url_request/url_fetcher_delegate.h" | 15 #include "net/url_request/url_fetcher_delegate.h" |
| 16 | 16 |
| 17 namespace net { | 17 namespace net { |
| 18 class URLFetcher; | 18 class URLFetcher; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace chromeos { | 21 namespace chromeos { |
| 22 | 22 |
| 23 class BaseScreenDelegate; | 23 class BaseScreenDelegate; |
| 24 | 24 |
| 25 // A screen that shows Terms of Service which have been configured through | 25 // A screen that shows Terms of Service which have been configured through |
| 26 // policy. The screen is shown during login and requires the user to accept the | 26 // policy. The screen is shown during login and requires the user to accept the |
| 27 // Terms of Service before proceeding. Currently, Terms of Service are available | 27 // Terms of Service before proceeding. Currently, Terms of Service are available |
| 28 // for public sessions only. | 28 // for public sessions only. |
| 29 class TermsOfServiceScreen : public BaseScreen, | 29 class TermsOfServiceScreen : public BaseScreen, |
| 30 public TermsOfServiceScreenActor::Delegate, | 30 public TermsOfServiceScreenView::Delegate, |
| 31 public net::URLFetcherDelegate { | 31 public net::URLFetcherDelegate { |
| 32 public: | 32 public: |
| 33 TermsOfServiceScreen(BaseScreenDelegate* base_screen_delegate, | 33 TermsOfServiceScreen(BaseScreenDelegate* base_screen_delegate, |
| 34 TermsOfServiceScreenActor* actor); | 34 TermsOfServiceScreenView* view); |
| 35 ~TermsOfServiceScreen() override; | 35 ~TermsOfServiceScreen() override; |
| 36 | 36 |
| 37 // BaseScreen: | 37 // BaseScreen: |
| 38 void Show() override; | 38 void Show() override; |
| 39 void Hide() override; | 39 void Hide() override; |
| 40 | 40 |
| 41 // TermsOfServiceScreenActor::Delegate: | 41 // TermsOfServiceScreenActor::Delegate: |
| 42 void OnDecline() override; | 42 void OnDecline() override; |
| 43 void OnAccept() override; | 43 void OnAccept() override; |
| 44 void OnActorDestroyed(TermsOfServiceScreenActor* actor) override; | 44 void OnViewDestroyed(TermsOfServiceScreenView* view) override; |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 // Start downloading the Terms of Service. | 47 // Start downloading the Terms of Service. |
| 48 void StartDownload(); | 48 void StartDownload(); |
| 49 | 49 |
| 50 // Abort the attempt to download the Terms of Service if it takes too long. | 50 // Abort the attempt to download the Terms of Service if it takes too long. |
| 51 void OnDownloadTimeout(); | 51 void OnDownloadTimeout(); |
| 52 | 52 |
| 53 // net::URLFetcherDelegate: | 53 // net::URLFetcherDelegate: |
| 54 void OnURLFetchComplete(const net::URLFetcher* source) override; | 54 void OnURLFetchComplete(const net::URLFetcher* source) override; |
| 55 | 55 |
| 56 TermsOfServiceScreenActor* actor_; | 56 TermsOfServiceScreenView* view_; |
| 57 | 57 |
| 58 std::unique_ptr<net::URLFetcher> terms_of_service_fetcher_; | 58 std::unique_ptr<net::URLFetcher> terms_of_service_fetcher_; |
| 59 | 59 |
| 60 // Timer that enforces a custom (shorter) timeout on the attempt to download | 60 // Timer that enforces a custom (shorter) timeout on the attempt to download |
| 61 // the Terms of Service. | 61 // the Terms of Service. |
| 62 base::OneShotTimer download_timer_; | 62 base::OneShotTimer download_timer_; |
| 63 | 63 |
| 64 DISALLOW_COPY_AND_ASSIGN(TermsOfServiceScreen); | 64 DISALLOW_COPY_AND_ASSIGN(TermsOfServiceScreen); |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 } // namespace chromeos | 67 } // namespace chromeos |
| 68 | 68 |
| 69 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_TERMS_OF_SERVICE_SCREEN_H_ | 69 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_TERMS_OF_SERVICE_SCREEN_H_ |
| OLD | NEW |