Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: chrome/browser/chromeos/login/screens/eula_screen.h

Issue 755203002: Added usage of ScreenContext in EulaScreen. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed comments. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 {
Denis Kuznetsov (DE-MUC) 2014/11/25 17:31:17 Do we still need this delegate?
ygorshenin1 2014/11/26 11:45:40 Yes, because only WizardController knows how to Se
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; 41 virtual std::string GetName() const override;
43
44 // EulaScreenActor::Delegate implementation:
45 virtual GURL GetOemEulaUrl() const override; 42 virtual GURL GetOemEulaUrl() const override;
46 virtual void OnExit(bool accepted, bool usage_stats_enabled) override; 43 virtual void OnAcceptButtonClicked() override;
44 virtual void OnBackButtonClicked() override;
47 virtual void InitiatePasswordFetch() override; 45 virtual void InitiatePasswordFetch() override;
48 virtual bool IsUsageStatsEnabled() const override; 46 virtual bool IsUsageStatsEnabled() const override;
49 virtual void OnActorDestroyed(EulaScreenActor* actor) override; 47 virtual void OnViewDestroyed(EulaView* view) override;
50 48
51 // TpmPasswordFetcherDelegate implementation: 49 // TpmPasswordFetcherDelegate implementation:
52 virtual void OnPasswordFetched(const std::string& tpm_password) override; 50 virtual void OnPasswordFetched(const std::string& tpm_password) override;
53 51
54 private: 52 private:
53 void OnUsageStatisticsReportingChanged(
54 const ::login::ScreenContext::KeyType& key,
55 const base::Value& value);
56
55 // URL of the OEM EULA page (on disk). 57 // URL of the OEM EULA page (on disk).
56 GURL oem_eula_page_; 58 GURL oem_eula_page_;
57 59
58 // TPM password local storage. By convention, we clear the password 60 // 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 61 // from TPM as soon as we read it. We store it here locally until
60 // EULA screen is closed. 62 // EULA screen is closed.
61 // TODO(glotov): Sanitize memory used to store password when 63 // TODO(glotov): Sanitize memory used to store password when
62 // it's destroyed. 64 // it's destroyed.
63 std::string tpm_password_; 65 std::string tpm_password_;
64 66
65 Delegate* delegate_; 67 Delegate* delegate_;
66 68
67 EulaScreenActor* actor_; 69 EulaView* view_;
68 70
69 TpmPasswordFetcher password_fetcher_; 71 TpmPasswordFetcher password_fetcher_;
70 72
73 scoped_ptr<::login::ScreenContext::KeyObserverSubscription> subscription_;
74
71 DISALLOW_COPY_AND_ASSIGN(EulaScreen); 75 DISALLOW_COPY_AND_ASSIGN(EulaScreen);
72 }; 76 };
73 77
74 } // namespace chromeos 78 } // namespace chromeos
75 79
76 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_EULA_SCREEN_H_ 80 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_EULA_SCREEN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698