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_CHROMEOS_LOGIN_SCREENS_TERMS_OF_SERVICE_SCREEN_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_TERMS_OF_SERVICE_SCREEN_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/timer/timer.h"
12 #include "chrome/browser/chromeos/login/screens/base_screen.h"
13 #include "chrome/browser/chromeos/login/screens/terms_of_service_screen_actor.h"
14 #include "net/url_request/url_fetcher_delegate.h"
22 class BaseScreenDelegate
;
24 // A screen that shows Terms of Service which have been configured through
25 // policy. The screen is shown during login and requires the user to accept the
26 // Terms of Service before proceeding. Currently, Terms of Service are available
27 // for public sessions only.
28 class TermsOfServiceScreen
: public BaseScreen
,
29 public TermsOfServiceScreenActor::Delegate
,
30 public net::URLFetcherDelegate
{
32 TermsOfServiceScreen(BaseScreenDelegate
* base_screen_delegate
,
33 TermsOfServiceScreenActor
* actor
);
34 ~TermsOfServiceScreen() override
;
37 void PrepareToShow() override
;
40 std::string
GetName() const override
;
42 // TermsOfServiceScreenActor::Delegate:
43 void OnDecline() override
;
44 void OnAccept() override
;
45 void OnActorDestroyed(TermsOfServiceScreenActor
* actor
) override
;
48 // Start downloading the Terms of Service.
51 // Abort the attempt to download the Terms of Service if it takes too long.
52 void OnDownloadTimeout();
54 // net::URLFetcherDelegate:
55 void OnURLFetchComplete(const net::URLFetcher
* source
) override
;
57 TermsOfServiceScreenActor
* actor_
;
59 scoped_ptr
<net::URLFetcher
> terms_of_service_fetcher_
;
61 // Timer that enforces a custom (shorter) timeout on the attempt to download
62 // the Terms of Service.
63 base::OneShotTimer
<TermsOfServiceScreen
> download_timer_
;
65 DISALLOW_COPY_AND_ASSIGN(TermsOfServiceScreen
);
68 } // namespace chromeos
70 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_TERMS_OF_SERVICE_SCREEN_H_