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_BASE_SCREEN_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_BASE_SCREEN_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_BASE_SCREEN_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_BASE_SCREEN_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/gtest_prod_util.h" |
11 | 12 |
12 namespace base { | 13 namespace base { |
13 class DictionaryValue; | 14 class DictionaryValue; |
14 } | 15 } |
15 | 16 |
16 namespace chromeos { | 17 namespace chromeos { |
17 | 18 |
18 class ScreenContext; | 19 class ScreenContext; |
| 20 class ScreenObserver; |
19 | 21 |
20 // Base class for the all OOBE/login/before-session screens. | 22 // Base class for the all OOBE/login/before-session screens. |
21 // Screens are identified by ID, screen and it's JS counterpart must have same | 23 // Screens are identified by ID, screen and it's JS counterpart must have same |
22 // id. | 24 // id. |
23 // Most of the screens will be re-created for each appearance with Initialize() | 25 // Most of the screens will be re-created for each appearance with Initialize() |
24 // method called just once. However if initialization is too expensive, screen | 26 // method called just once. However if initialization is too expensive, screen |
25 // can override result of IsPermanent() method, and do clean-up upon subsequent | 27 // can override result of IsPermanent() method, and do clean-up upon subsequent |
26 // Initialize() method calls. | 28 // Initialize() method calls. |
27 class BaseScreen { | 29 class BaseScreen { |
28 public: | 30 public: |
29 BaseScreen(); | 31 explicit BaseScreen(ScreenObserver* screen_observer); |
30 virtual ~BaseScreen(); | 32 virtual ~BaseScreen(); |
31 | 33 |
32 // ---- Old implementation ---- | 34 // ---- Old implementation ---- |
33 | 35 |
34 virtual void PrepareToShow() = 0; | 36 virtual void PrepareToShow() = 0; |
35 | 37 |
36 // Makes wizard screen visible. | 38 // Makes wizard screen visible. |
37 virtual void Show() = 0; | 39 virtual void Show() = 0; |
38 | 40 |
39 // Makes wizard screen invisible. | 41 // Makes wizard screen invisible. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 81 |
80 // Called when button with |button_id| was pressed. Notification | 82 // Called when button with |button_id| was pressed. Notification |
81 // about this event comes from the JS counterpart. | 83 // about this event comes from the JS counterpart. |
82 virtual void OnButtonPressed(const std::string& button_id); | 84 virtual void OnButtonPressed(const std::string& button_id); |
83 | 85 |
84 // Called when context for the currenct screen was | 86 // Called when context for the currenct screen was |
85 // changed. Notification about this event comes from the JS | 87 // changed. Notification about this event comes from the JS |
86 // counterpart. | 88 // counterpart. |
87 virtual void OnContextChanged(const base::DictionaryValue* diff); | 89 virtual void OnContextChanged(const base::DictionaryValue* diff); |
88 | 90 |
| 91 ScreenObserver* get_screen_observer() const { return screen_observer_; } |
| 92 |
89 private: | 93 private: |
| 94 FRIEND_TEST_ALL_PREFIXES(EnrollmentScreenTest, TestCancel); |
| 95 FRIEND_TEST_ALL_PREFIXES(EnrollmentScreenTest, TestSuccess); |
| 96 FRIEND_TEST_ALL_PREFIXES(ProvisionedEnrollmentScreenTest, TestBackButton); |
| 97 |
| 98 friend class NetworkScreenTest; |
90 friend class ScreenManager; | 99 friend class ScreenManager; |
| 100 friend class UpdateScreenTest; |
| 101 |
91 void SetContext(ScreenContext* context); | 102 void SetContext(ScreenContext* context); |
92 | 103 |
| 104 ScreenObserver* screen_observer_; |
| 105 |
93 DISALLOW_COPY_AND_ASSIGN(BaseScreen); | 106 DISALLOW_COPY_AND_ASSIGN(BaseScreen); |
94 }; | 107 }; |
95 | 108 |
96 } // namespace chromeos | 109 } // namespace chromeos |
97 | 110 |
98 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_BASE_SCREEN_H_ | 111 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_BASE_SCREEN_H_ |
OLD | NEW |