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

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

Issue 2556253002: cros: Fold EulaModel into EulaView. (Closed)
Patch Set: Address comments Created 3 years, 11 months 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 "base/macros.h" 11 #include "base/macros.h"
12 #include "chrome/browser/chromeos/login/screens/base_screen.h" 12 #include "chrome/browser/chromeos/login/screens/base_screen.h"
13 #include "chrome/browser/chromeos/login/screens/eula_model.h"
14 #include "chromeos/tpm/tpm_password_fetcher.h" 13 #include "chromeos/tpm/tpm_password_fetcher.h"
15 #include "components/login/screens/screen_context.h" 14 #include "components/login/screens/screen_context.h"
16 #include "url/gurl.h" 15 #include "url/gurl.h"
17 16
18 namespace chromeos { 17 namespace chromeos {
19 18
19 class BaseScreenDelegate;
20 class EulaView;
21
20 // Representation independent class that controls OOBE screen showing EULA 22 // Representation independent class that controls OOBE screen showing EULA
21 // to users. 23 // to users.
22 class EulaScreen : public EulaModel, public TpmPasswordFetcherDelegate { 24 class EulaScreen : public BaseScreen, public TpmPasswordFetcherDelegate {
23 public: 25 public:
24 class Delegate { 26 class Delegate {
25 public: 27 public:
26 virtual ~Delegate() {} 28 virtual ~Delegate() {}
27 29
28 // Whether usage statistics reporting is enabled on EULA screen. 30 // Whether usage statistics reporting is enabled on EULA screen.
29 virtual void SetUsageStatisticsReporting(bool val) = 0; 31 virtual void SetUsageStatisticsReporting(bool val) = 0;
30 virtual bool GetUsageStatisticsReporting() const = 0; 32 virtual bool GetUsageStatisticsReporting() const = 0;
31 }; 33 };
32 34
33 EulaScreen(BaseScreenDelegate* base_screen_delegate, 35 EulaScreen(BaseScreenDelegate* base_screen_delegate,
34 Delegate* delegate, 36 Delegate* delegate,
35 EulaView* view); 37 EulaView* view);
36 ~EulaScreen() override; 38 ~EulaScreen() override;
37 39
38 // EulaModel implementation: 40 // Returns URL of the OEM EULA page that should be displayed using current
41 // locale and manifest. Returns empty URL otherwise.
42 GURL GetOemEulaUrl() const;
43
44 // Initiate TPM password fetch. Will call actor's OnPasswordFetched() when
45 // done.
46 void InitiatePasswordFetch();
47
48 // Returns true if usage statistics reporting is enabled.
49 bool IsUsageStatsEnabled() const;
50
51 // This method is called, when view is being destroyed. Note, if model
52 // is destroyed earlier then it has to call SetModel(NULL).
53 void OnViewDestroyed(EulaView* view);
54
55 private:
56 // BaseScreen implementation:
39 void Show() override; 57 void Show() override;
40 void Hide() override; 58 void Hide() override;
41 GURL GetOemEulaUrl() const override;
42 void InitiatePasswordFetch() override;
43 bool IsUsageStatsEnabled() const override;
44 void OnViewDestroyed(EulaView* view) override;
45 void OnUserAction(const std::string& action_id) override; 59 void OnUserAction(const std::string& action_id) override;
46 void OnContextKeyUpdated(const ::login::ScreenContext::KeyType& key) override; 60 void OnContextKeyUpdated(const ::login::ScreenContext::KeyType& key) override;
47 61
48 // TpmPasswordFetcherDelegate implementation: 62 // TpmPasswordFetcherDelegate implementation:
49 void OnPasswordFetched(const std::string& tpm_password) override; 63 void OnPasswordFetched(const std::string& tpm_password) override;
50 64
51 private:
52 // URL of the OEM EULA page (on disk). 65 // URL of the OEM EULA page (on disk).
53 GURL oem_eula_page_; 66 GURL oem_eula_page_;
54 67
55 // TPM password local storage. By convention, we clear the password 68 // TPM password local storage. By convention, we clear the password
56 // from TPM as soon as we read it. We store it here locally until 69 // from TPM as soon as we read it. We store it here locally until
57 // EULA screen is closed. 70 // EULA screen is closed.
58 // TODO(glotov): Sanitize memory used to store password when 71 // TODO(glotov): Sanitize memory used to store password when
59 // it's destroyed. 72 // it's destroyed.
60 std::string tpm_password_; 73 std::string tpm_password_;
61 74
62 Delegate* delegate_; 75 Delegate* delegate_;
63 76
64 EulaView* view_; 77 EulaView* view_;
65 78
66 TpmPasswordFetcher password_fetcher_; 79 TpmPasswordFetcher password_fetcher_;
67 80
68 DISALLOW_COPY_AND_ASSIGN(EulaScreen); 81 DISALLOW_COPY_AND_ASSIGN(EulaScreen);
69 }; 82 };
70 83
71 } // namespace chromeos 84 } // namespace chromeos
72 85
73 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_EULA_SCREEN_H_ 86 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_EULA_SCREEN_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/screens/eula_model.cc ('k') | chrome/browser/chromeos/login/screens/eula_screen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698