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