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 #include "base/gtest_prod_util.h" |
12 | 12 |
13 namespace base { | 13 namespace base { |
14 class DictionaryValue; | 14 class DictionaryValue; |
15 } | 15 } |
16 | 16 |
| 17 namespace login { |
| 18 class ScreenContext; |
| 19 } |
| 20 |
17 namespace chromeos { | 21 namespace chromeos { |
18 | 22 |
19 class ScreenContext; | |
20 class ScreenObserver; | 23 class ScreenObserver; |
21 | 24 |
22 // Base class for the all OOBE/login/before-session screens. | 25 // Base class for the all OOBE/login/before-session screens. |
23 // Screens are identified by ID, screen and it's JS counterpart must have same | 26 // Screens are identified by ID, screen and it's JS counterpart must have same |
24 // id. | 27 // id. |
25 // Most of the screens will be re-created for each appearance with Initialize() | 28 // Most of the screens will be re-created for each appearance with Initialize() |
26 // method called just once. However if initialization is too expensive, screen | 29 // method called just once. However if initialization is too expensive, screen |
27 // can override result of IsPermanent() method, and do clean-up upon subsequent | 30 // can override result of IsPermanent() method, and do clean-up upon subsequent |
28 // Initialize() method calls. | 31 // Initialize() method calls. |
29 class BaseScreen { | 32 class BaseScreen { |
(...skipping 13 matching lines...) Expand all Loading... |
43 | 46 |
44 // Returns the screen name. | 47 // Returns the screen name. |
45 virtual std::string GetName() const = 0; | 48 virtual std::string GetName() const = 0; |
46 | 49 |
47 // ---- New Implementation ---- | 50 // ---- New Implementation ---- |
48 | 51 |
49 // Called to perform initialization of the screen. UI is guaranteed to exist | 52 // Called to perform initialization of the screen. UI is guaranteed to exist |
50 // at this point. Screen can alter context, resulting context will be passed | 53 // at this point. Screen can alter context, resulting context will be passed |
51 // to JS. This method will be called once per instance of the Screen object, | 54 // to JS. This method will be called once per instance of the Screen object, |
52 // unless |IsPermanent()| returns |true|. | 55 // unless |IsPermanent()| returns |true|. |
53 virtual void Initialize(ScreenContext* context); | 56 virtual void Initialize(::login::ScreenContext* context); |
54 | 57 |
55 // Called when screen appears. | 58 // Called when screen appears. |
56 virtual void OnShow(); | 59 virtual void OnShow(); |
57 // Called when screen disappears, either because it finished it's work, or | 60 // Called when screen disappears, either because it finished it's work, or |
58 // because some other screen pops up. | 61 // because some other screen pops up. |
59 virtual void OnHide(); | 62 virtual void OnHide(); |
60 | 63 |
61 // Called when we navigate from screen so that we will never return to it. | 64 // Called when we navigate from screen so that we will never return to it. |
62 // This is a last chance to call JS counterpart, this object will be deleted | 65 // This is a last chance to call JS counterpart, this object will be deleted |
63 // soon. | 66 // soon. |
(...skipping 28 matching lines...) Expand all Loading... |
92 | 95 |
93 private: | 96 private: |
94 FRIEND_TEST_ALL_PREFIXES(EnrollmentScreenTest, TestCancel); | 97 FRIEND_TEST_ALL_PREFIXES(EnrollmentScreenTest, TestCancel); |
95 FRIEND_TEST_ALL_PREFIXES(EnrollmentScreenTest, TestSuccess); | 98 FRIEND_TEST_ALL_PREFIXES(EnrollmentScreenTest, TestSuccess); |
96 FRIEND_TEST_ALL_PREFIXES(ProvisionedEnrollmentScreenTest, TestBackButton); | 99 FRIEND_TEST_ALL_PREFIXES(ProvisionedEnrollmentScreenTest, TestBackButton); |
97 | 100 |
98 friend class NetworkScreenTest; | 101 friend class NetworkScreenTest; |
99 friend class ScreenManager; | 102 friend class ScreenManager; |
100 friend class UpdateScreenTest; | 103 friend class UpdateScreenTest; |
101 | 104 |
102 void SetContext(ScreenContext* context); | 105 void SetContext(::login::ScreenContext* context); |
103 | 106 |
104 ScreenObserver* screen_observer_; | 107 ScreenObserver* screen_observer_; |
105 | 108 |
106 DISALLOW_COPY_AND_ASSIGN(BaseScreen); | 109 DISALLOW_COPY_AND_ASSIGN(BaseScreen); |
107 }; | 110 }; |
108 | 111 |
109 } // namespace chromeos | 112 } // namespace chromeos |
110 | 113 |
111 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_BASE_SCREEN_H_ | 114 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_BASE_SCREEN_H_ |
OLD | NEW |