OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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_RESET_SCREEN_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_RESET_SCREEN_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_RESET_SCREEN_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_RESET_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 "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "chrome/browser/chromeos/login/help_app_launcher.h" | 14 #include "chrome/browser/chromeos/login/help_app_launcher.h" |
15 #include "chrome/browser/chromeos/login/screens/reset_model.h" | 15 #include "chrome/browser/chromeos/login/screens/base_screen.h" |
16 #include "chromeos/dbus/update_engine_client.h" | 16 #include "chromeos/dbus/update_engine_client.h" |
17 | 17 |
18 | 18 |
19 namespace chromeos { | 19 namespace chromeos { |
20 | 20 |
21 class ErrorScreen; | 21 class ErrorScreen; |
22 class ResetView; | 22 class ResetView; |
23 | 23 |
24 // Representation independent class that controls screen showing reset to users. | 24 // Representation independent class that controls screen showing reset to users. |
25 class ResetScreen : public ResetModel, | 25 class ResetScreen : public BaseScreen, public UpdateEngineClient::Observer { |
26 public UpdateEngineClient::Observer { | |
27 public: | 26 public: |
28 ResetScreen(BaseScreenDelegate* base_screen_delegate, | 27 ResetScreen(BaseScreenDelegate* base_screen_delegate, |
29 ResetView* view); | 28 ResetView* view); |
30 ~ResetScreen() override; | 29 ~ResetScreen() override; |
31 | 30 |
32 // ResetModel implementation: | 31 // Called when actor is destroyed so there's no dead reference to it. |
| 32 void OnViewDestroyed(ResetView* view); |
| 33 |
| 34 private: |
| 35 // BaseScreen implementation: |
33 void Show() override; | 36 void Show() override; |
34 void Hide() override; | 37 void Hide() override; |
35 void OnViewDestroyed(ResetView* view) override; | |
36 void OnUserAction(const std::string& action_id) override; | 38 void OnUserAction(const std::string& action_id) override; |
37 | 39 |
38 // UpdateEngineClient::Observer implementation: | 40 // UpdateEngineClient::Observer implementation: |
39 void UpdateStatusChanged(const UpdateEngineClient::Status& status) override; | 41 void UpdateStatusChanged(const UpdateEngineClient::Status& status) override; |
40 | 42 |
41 void OnRollbackCheck(bool can_rollback); | 43 void OnRollbackCheck(bool can_rollback); |
42 | 44 |
43 private: | |
44 | |
45 enum State { | 45 enum State { |
46 STATE_RESTART_REQUIRED = 0, | 46 STATE_RESTART_REQUIRED = 0, |
47 STATE_REVERT_PROMISE, | 47 STATE_REVERT_PROMISE, |
48 STATE_POWERWASH_PROPOSAL, | 48 STATE_POWERWASH_PROPOSAL, |
49 STATE_ERROR | 49 STATE_ERROR |
50 }; | 50 }; |
51 | 51 |
52 void OnCancel(); | 52 void OnCancel(); |
53 void OnPowerwash(); | 53 void OnPowerwash(); |
54 void OnRestart(); | 54 void OnRestart(); |
(...skipping 11 matching lines...) Expand all Loading... |
66 scoped_refptr<HelpAppLauncher> help_app_; | 66 scoped_refptr<HelpAppLauncher> help_app_; |
67 | 67 |
68 base::WeakPtrFactory<ResetScreen> weak_ptr_factory_; | 68 base::WeakPtrFactory<ResetScreen> weak_ptr_factory_; |
69 | 69 |
70 DISALLOW_COPY_AND_ASSIGN(ResetScreen); | 70 DISALLOW_COPY_AND_ASSIGN(ResetScreen); |
71 }; | 71 }; |
72 | 72 |
73 } // namespace chromeos | 73 } // namespace chromeos |
74 | 74 |
75 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_RESET_SCREEN_H_ | 75 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_RESET_SCREEN_H_ |
OLD | NEW |