OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_UPDATE_SCREEN_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_UPDATE_SCREEN_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_UPDATE_SCREEN_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_UPDATE_SCREEN_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
| 11 #include "base/compiler_specific.h" |
11 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
13 #include "base/timer.h" | 14 #include "base/timer.h" |
14 #include "chrome/browser/chromeos/cros/update_library.h" | 15 #include "chrome/browser/chromeos/cros/update_library.h" |
15 #include "chrome/browser/chromeos/login/update_screen_actor.h" | 16 #include "chrome/browser/chromeos/login/update_screen_actor.h" |
16 #include "chrome/browser/chromeos/login/wizard_screen.h" | 17 #include "chrome/browser/chromeos/login/wizard_screen.h" |
17 | 18 |
18 namespace chromeos { | 19 namespace chromeos { |
19 | 20 |
20 class ScreenObserver; | 21 class ScreenObserver; |
21 | 22 |
22 // Controller for the update screen. It does not depend on the specific | 23 // Controller for the update screen. It does not depend on the specific |
23 // implementation of the screen showing (Views of WebUI based), the dependency | 24 // implementation of the screen showing (Views of WebUI based), the dependency |
24 // is moved to the UpdateScreenActor instead. | 25 // is moved to the UpdateScreenActor instead. |
25 class UpdateScreen: public UpdateLibrary::Observer, | 26 class UpdateScreen: public UpdateLibrary::Observer, |
26 public UpdateScreenActor::Delegate, | 27 public UpdateScreenActor::Delegate, |
27 public WizardScreen { | 28 public WizardScreen { |
28 public: | 29 public: |
29 UpdateScreen(ScreenObserver* screen_observer, UpdateScreenActor* actor); | 30 UpdateScreen(ScreenObserver* screen_observer, UpdateScreenActor* actor); |
30 virtual ~UpdateScreen(); | 31 virtual ~UpdateScreen(); |
31 | 32 |
32 // Overridden from WizardScreen. | 33 // Overridden from WizardScreen. |
33 virtual void PrepareToShow(); | 34 virtual void PrepareToShow() OVERRIDE; |
34 virtual void Show(); | 35 virtual void Show() OVERRIDE; |
35 virtual void Hide(); | 36 virtual void Hide() OVERRIDE; |
36 | 37 |
37 // UpdateScreenActor::Delegate implementation: | 38 // UpdateScreenActor::Delegate implementation: |
38 virtual void CancelUpdate() OVERRIDE; | 39 virtual void CancelUpdate() OVERRIDE; |
39 virtual void OnActorDestroyed(UpdateScreenActor* actor) OVERRIDE; | 40 virtual void OnActorDestroyed(UpdateScreenActor* actor) OVERRIDE; |
40 | 41 |
41 // Checks for updates and performs an update if needed. Made virtual to | 42 // Checks for updates and performs an update if needed. Made virtual to |
42 // simplify mocking. | 43 // simplify mocking. |
43 virtual void StartUpdate(); | 44 virtual void StartUpdate(); |
44 | 45 |
45 // Reboot check delay get/set, in seconds. | 46 // Reboot check delay get/set, in seconds. |
46 int reboot_check_delay() const { return reboot_check_delay_; } | 47 int reboot_check_delay() const { return reboot_check_delay_; } |
47 void SetRebootCheckDelay(int seconds); | 48 void SetRebootCheckDelay(int seconds); |
48 | 49 |
49 // Returns true if this instance is still active (i.e. has not been deleted). | 50 // Returns true if this instance is still active (i.e. has not been deleted). |
50 static bool HasInstance(UpdateScreen* inst); | 51 static bool HasInstance(UpdateScreen* inst); |
51 | 52 |
52 void SetIgnoreIdleStatus(bool ignore_idle_status); | 53 void SetIgnoreIdleStatus(bool ignore_idle_status); |
53 | 54 |
54 enum ExitReason { | 55 enum ExitReason { |
55 REASON_UPDATE_CANCELED, | 56 REASON_UPDATE_CANCELED, |
56 REASON_UPDATE_INIT_FAILED, | 57 REASON_UPDATE_INIT_FAILED, |
57 REASON_UPDATE_NON_CRITICAL, | 58 REASON_UPDATE_NON_CRITICAL, |
58 REASON_UPDATE_ENDED | 59 REASON_UPDATE_ENDED |
59 }; | 60 }; |
60 // Reports update results to the ScreenObserver. | 61 // Reports update results to the ScreenObserver. |
61 virtual void ExitUpdate(ExitReason reason); | 62 virtual void ExitUpdate(ExitReason reason); |
62 | 63 |
63 // UpdateLibrary::Observer implementation: | 64 // UpdateLibrary::Observer implementation: |
64 virtual void UpdateStatusChanged(const UpdateLibrary::Status& status); | 65 virtual void UpdateStatusChanged( |
| 66 const UpdateLibrary::Status& status) OVERRIDE; |
65 | 67 |
66 private: | 68 private: |
67 FRIEND_TEST_ALL_PREFIXES(UpdateScreenTest, TestBasic); | 69 FRIEND_TEST_ALL_PREFIXES(UpdateScreenTest, TestBasic); |
68 FRIEND_TEST_ALL_PREFIXES(UpdateScreenTest, TestUpdateAvailable); | 70 FRIEND_TEST_ALL_PREFIXES(UpdateScreenTest, TestUpdateAvailable); |
69 | 71 |
70 // Returns true if there is critical system update that requires installation | 72 // Returns true if there is critical system update that requires installation |
71 // and immediate reboot. | 73 // and immediate reboot. |
72 bool HasCriticalUpdate(); | 74 bool HasCriticalUpdate(); |
73 | 75 |
74 // Timer notification handlers. | 76 // Timer notification handlers. |
(...skipping 29 matching lines...) Expand all Loading... |
104 | 106 |
105 // Keeps actor which is delegated with all showing operations. | 107 // Keeps actor which is delegated with all showing operations. |
106 UpdateScreenActor* actor_; | 108 UpdateScreenActor* actor_; |
107 | 109 |
108 DISALLOW_COPY_AND_ASSIGN(UpdateScreen); | 110 DISALLOW_COPY_AND_ASSIGN(UpdateScreen); |
109 }; | 111 }; |
110 | 112 |
111 } // namespace chromeos | 113 } // namespace chromeos |
112 | 114 |
113 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_UPDATE_SCREEN_H_ | 115 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_UPDATE_SCREEN_H_ |
OLD | NEW |