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