| 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 { | 17 namespace login { |
| 18 class ScreenContext; | 18 class ScreenContext; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace chromeos { | 21 namespace chromeos { |
| 22 | 22 |
| 23 class ScreenObserver; | 23 class BaseScreenDelegate; |
| 24 | 24 |
| 25 // Base class for the all OOBE/login/before-session screens. | 25 // Base class for the all OOBE/login/before-session screens. |
| 26 // 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 |
| 27 // id. | 27 // id. |
| 28 // 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() |
| 29 // method called just once. However if initialization is too expensive, screen | 29 // method called just once. However if initialization is too expensive, screen |
| 30 // 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 |
| 31 // Initialize() method calls. | 31 // Initialize() method calls. |
| 32 class BaseScreen { | 32 class BaseScreen { |
| 33 public: | 33 public: |
| 34 explicit BaseScreen(ScreenObserver* screen_observer); | 34 explicit BaseScreen(BaseScreenDelegate* base_screen_delegate); |
| 35 virtual ~BaseScreen(); | 35 virtual ~BaseScreen(); |
| 36 | 36 |
| 37 // ---- Old implementation ---- | 37 // ---- Old implementation ---- |
| 38 | 38 |
| 39 virtual void PrepareToShow() = 0; | 39 virtual void PrepareToShow() = 0; |
| 40 | 40 |
| 41 // Makes wizard screen visible. | 41 // Makes wizard screen visible. |
| 42 virtual void Show() = 0; | 42 virtual void Show() = 0; |
| 43 | 43 |
| 44 // Makes wizard screen invisible. | 44 // Makes wizard screen invisible. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 84 |
| 85 // Called when button with |button_id| was pressed. Notification | 85 // Called when button with |button_id| was pressed. Notification |
| 86 // about this event comes from the JS counterpart. | 86 // about this event comes from the JS counterpart. |
| 87 virtual void OnButtonPressed(const std::string& button_id); | 87 virtual void OnButtonPressed(const std::string& button_id); |
| 88 | 88 |
| 89 // Called when context for the currenct screen was | 89 // Called when context for the currenct screen was |
| 90 // changed. Notification about this event comes from the JS | 90 // changed. Notification about this event comes from the JS |
| 91 // counterpart. | 91 // counterpart. |
| 92 virtual void OnContextChanged(const base::DictionaryValue* diff); | 92 virtual void OnContextChanged(const base::DictionaryValue* diff); |
| 93 | 93 |
| 94 ScreenObserver* get_screen_observer() const { return screen_observer_; } | 94 BaseScreenDelegate* get_base_screen_delegate() const { |
| 95 return base_screen_delegate_; |
| 96 } |
| 95 | 97 |
| 96 private: | 98 private: |
| 97 FRIEND_TEST_ALL_PREFIXES(EnrollmentScreenTest, TestCancel); | 99 FRIEND_TEST_ALL_PREFIXES(EnrollmentScreenTest, TestCancel); |
| 98 FRIEND_TEST_ALL_PREFIXES(EnrollmentScreenTest, TestSuccess); | 100 FRIEND_TEST_ALL_PREFIXES(EnrollmentScreenTest, TestSuccess); |
| 99 FRIEND_TEST_ALL_PREFIXES(ProvisionedEnrollmentScreenTest, TestBackButton); | 101 FRIEND_TEST_ALL_PREFIXES(ProvisionedEnrollmentScreenTest, TestBackButton); |
| 100 | 102 |
| 101 friend class NetworkScreenTest; | 103 friend class NetworkScreenTest; |
| 102 friend class ScreenManager; | 104 friend class ScreenManager; |
| 103 friend class UpdateScreenTest; | 105 friend class UpdateScreenTest; |
| 104 | 106 |
| 105 void SetContext(::login::ScreenContext* context); | 107 void SetContext(::login::ScreenContext* context); |
| 106 | 108 |
| 107 ScreenObserver* screen_observer_; | 109 BaseScreenDelegate* base_screen_delegate_; |
| 108 | 110 |
| 109 DISALLOW_COPY_AND_ASSIGN(BaseScreen); | 111 DISALLOW_COPY_AND_ASSIGN(BaseScreen); |
| 110 }; | 112 }; |
| 111 | 113 |
| 112 } // namespace chromeos | 114 } // namespace chromeos |
| 113 | 115 |
| 114 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_BASE_SCREEN_H_ | 116 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_BASE_SCREEN_H_ |
| OLD | NEW |