Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / chromeos / login / screens / eula_screen.h
1 // Copyright (c) 2012 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_EULA_SCREEN_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_EULA_SCREEN_H_
7
8 #include <string>
9
10 #include "base/compiler_specific.h"
11 #include "chrome/browser/chromeos/login/screens/base_screen.h"
12 #include "chrome/browser/chromeos/login/screens/eula_screen_actor.h"
13 #include "chromeos/tpm_password_fetcher.h"
14 #include "url/gurl.h"
15
16 namespace chromeos {
17
18 // Representation independent class that controls OOBE screen showing EULA
19 // to users.
20 class EulaScreen : public BaseScreen,
21                    public EulaScreenActor::Delegate,
22                    public TpmPasswordFetcherDelegate {
23  public:
24   class Delegate {
25    public:
26     virtual ~Delegate() {}
27
28     // Whether usage statistics reporting is enabled on EULA screen.
29     virtual void SetUsageStatisticsReporting(bool val) = 0;
30     virtual bool GetUsageStatisticsReporting() const = 0;
31   };
32
33   EulaScreen(BaseScreenDelegate* base_screen_delegate,
34              Delegate* delegate,
35              EulaScreenActor* actor);
36   virtual ~EulaScreen();
37
38   // BaseScreen implementation:
39   virtual void PrepareToShow() override;
40   virtual void Show() override;
41   virtual void Hide() override;
42   virtual std::string GetName() const override;
43
44   // EulaScreenActor::Delegate implementation:
45   virtual GURL GetOemEulaUrl() const override;
46   virtual void OnExit(bool accepted, bool usage_stats_enabled) override;
47   virtual void InitiatePasswordFetch() override;
48   virtual bool IsUsageStatsEnabled() const override;
49   virtual void OnActorDestroyed(EulaScreenActor* actor) override;
50
51   // TpmPasswordFetcherDelegate implementation:
52   virtual void OnPasswordFetched(const std::string& tpm_password) override;
53
54  private:
55   // URL of the OEM EULA page (on disk).
56   GURL oem_eula_page_;
57
58   // TPM password local storage. By convention, we clear the password
59   // from TPM as soon as we read it. We store it here locally until
60   // EULA screen is closed.
61   // TODO(glotov): Sanitize memory used to store password when
62   // it's destroyed.
63   std::string tpm_password_;
64
65   Delegate* delegate_;
66
67   EulaScreenActor* actor_;
68
69   TpmPasswordFetcher password_fetcher_;
70
71   DISALLOW_COPY_AND_ASSIGN(EulaScreen);
72 };
73
74 }  // namespace chromeos
75
76 #endif  // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_EULA_SCREEN_H_