| 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/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "chrome/browser/chromeos/login/screens/base_screen_delegate.h" | 12 #include "chrome/browser/chromeos/login/screens/base_screen_delegate.h" |
| 13 #include "components/login/base_screen_handler_utils.h" | 13 #include "components/login/base_screen_handler_utils.h" |
| 14 #include "components/login/screens/screen_context.h" | 14 #include "components/login/screens/screen_context.h" |
| 15 | 15 |
| 16 namespace base { | 16 namespace base { |
| 17 class DictionaryValue; | 17 class DictionaryValue; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace chromeos { | 20 namespace chromeos { |
| 21 | 21 |
| 22 class ModelViewChannel; | 22 class ModelViewChannel; |
| 23 | 23 |
| 24 // Base class for the all OOBE/login/before-session screens. | 24 // Base class for the all OOBE/login/before-session screens. |
| 25 // Screens are identified by ID, screen and it's JS counterpart must have same | 25 // Screens are identified by ID, screen and it's JS counterpart must have same |
| 26 // id. | 26 // id. |
| 27 // Most of the screens will be re-created for each appearance with Initialize() | 27 // Most of the screens will be re-created for each appearance with Initialize() |
| 28 // method called just once. However if initialization is too expensive, screen | 28 // method called just once. |
| 29 // can override result of IsPermanent() method, and do clean-up upon subsequent | |
| 30 // Initialize() method calls. | |
| 31 class BaseScreen { | 29 class BaseScreen { |
| 32 public: | 30 public: |
| 33 explicit BaseScreen(BaseScreenDelegate* base_screen_delegate); | 31 explicit BaseScreen(BaseScreenDelegate* base_screen_delegate); |
| 34 virtual ~BaseScreen(); | 32 virtual ~BaseScreen(); |
| 35 | 33 |
| 36 // ---- Old implementation ---- | 34 // ---- Old implementation ---- |
| 37 | 35 |
| 38 virtual void PrepareToShow() = 0; | 36 virtual void PrepareToShow() = 0; |
| 39 | 37 |
| 40 // Makes wizard screen visible. | 38 // Makes wizard screen visible. |
| 41 virtual void Show() = 0; | 39 virtual void Show() = 0; |
| 42 | 40 |
| 43 // Makes wizard screen invisible. | 41 // Makes wizard screen invisible. |
| 44 virtual void Hide() = 0; | 42 virtual void Hide() = 0; |
| 45 | 43 |
| 46 // Returns the screen name. | 44 // Returns the screen name. |
| 47 virtual std::string GetName() const = 0; | 45 virtual std::string GetName() const = 0; |
| 48 | 46 |
| 49 // ---- New Implementation ---- | 47 // ---- New Implementation ---- |
| 50 | 48 |
| 51 // Called to perform initialization of the screen. UI is guaranteed to exist | 49 // Called to perform initialization of the screen. UI is guaranteed to exist |
| 52 // at this point. Screen can alter context, resulting context will be passed | 50 // at this point. Screen can alter context, resulting context will be passed |
| 53 // to JS. This method will be called once per instance of the Screen object, | 51 // to JS. This method will be called once per instance of the Screen object. |
| 54 // unless |IsPermanent()| returns |true|. | |
| 55 virtual void Initialize(::login::ScreenContext* context); | 52 virtual void Initialize(::login::ScreenContext* context); |
| 56 | 53 |
| 57 // Called when screen appears. | 54 // Called when screen appears. |
| 58 virtual void OnShow(); | 55 virtual void OnShow(); |
| 59 // Called when screen disappears, either because it finished it's work, or | 56 // Called when screen disappears, either because it finished it's work, or |
| 60 // because some other screen pops up. | 57 // because some other screen pops up. |
| 61 virtual void OnHide(); | 58 virtual void OnHide(); |
| 62 | 59 |
| 63 // Called when we navigate from screen so that we will never return to it. | 60 // Called when we navigate from screen so that we will never return to it. |
| 64 // This is a last chance to call JS counterpart, this object will be deleted | 61 // This is a last chance to call JS counterpart, this object will be deleted |
| 65 // soon. | 62 // soon. |
| 66 virtual void OnClose(); | 63 virtual void OnClose(); |
| 67 | 64 |
| 68 // Indicates whether status area should be displayed while this screen is | 65 // Indicates whether status area should be displayed while this screen is |
| 69 // displayed. | 66 // displayed. |
| 70 virtual bool IsStatusAreaDisplayed(); | 67 virtual bool IsStatusAreaDisplayed(); |
| 71 | 68 |
| 72 // If this method returns |true|, screen will not be deleted once we leave it. | |
| 73 // However, Initialize() might be called several times in this case. | |
| 74 virtual bool IsPermanent(); | |
| 75 | |
| 76 // Returns the identifier of the screen. | 69 // Returns the identifier of the screen. |
| 77 virtual std::string GetID() const; | 70 virtual std::string GetID() const; |
| 78 | 71 |
| 79 // Called when user action event with |event_id| | 72 // Called when user action event with |event_id| |
| 80 // happened. Notification about this event comes from the JS | 73 // happened. Notification about this event comes from the JS |
| 81 // counterpart. | 74 // counterpart. |
| 82 virtual void OnUserAction(const std::string& action_id); | 75 virtual void OnUserAction(const std::string& action_id); |
| 83 | 76 |
| 84 void set_model_view_channel(ModelViewChannel* channel) { channel_ = channel; } | 77 void set_model_view_channel(ModelViewChannel* channel) { channel_ = channel; } |
| 85 | 78 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 ModelViewChannel* channel_; | 154 ModelViewChannel* channel_; |
| 162 | 155 |
| 163 BaseScreenDelegate* base_screen_delegate_; | 156 BaseScreenDelegate* base_screen_delegate_; |
| 164 | 157 |
| 165 DISALLOW_COPY_AND_ASSIGN(BaseScreen); | 158 DISALLOW_COPY_AND_ASSIGN(BaseScreen); |
| 166 }; | 159 }; |
| 167 | 160 |
| 168 } // namespace chromeos | 161 } // namespace chromeos |
| 169 | 162 |
| 170 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_BASE_SCREEN_H_ | 163 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_BASE_SCREEN_H_ |
| OLD | NEW |