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/terms_of_service_screen_actor.h"
13 #include "chrome/browser/chromeos/login/screens/wizard_screen.h"
14 #include "net/url_request/url_fetcher_delegate.h"
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 WizardScreen
,
29 public TermsOfServiceScreenActor::Delegate
,
30 public net::URLFetcherDelegate
{
32 TermsOfServiceScreen(ScreenObserver
* screen_observer
,
33 TermsOfServiceScreenActor
* actor
);
34 virtual ~TermsOfServiceScreen();
37 virtual void PrepareToShow() OVERRIDE
;
38 virtual void Show() OVERRIDE
;
39 virtual void Hide() OVERRIDE
;
40 virtual std::string
GetName() const OVERRIDE
;
42 // TermsOfServiceScreenActor::Delegate:
43 virtual void OnDecline() OVERRIDE
;
44 virtual void OnAccept() OVERRIDE
;
45 virtual 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 virtual 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_