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_UPDATE_SCREEN_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_UPDATE_SCREEN_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_UPDATE_SCREEN_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_UPDATE_SCREEN_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 #include "base/timer.h" | 15 #include "base/timer.h" |
16 #include "chrome/browser/chromeos/login/screens/update_screen_actor.h" | 16 #include "chrome/browser/chromeos/login/screens/update_screen_actor.h" |
17 #include "chrome/browser/chromeos/login/screens/wizard_screen.h" | 17 #include "chrome/browser/chromeos/login/screens/wizard_screen.h" |
18 #include "chrome/browser/chromeos/net/network_portal_detector.h" | 18 #include "chrome/browser/chromeos/net/network_portal_detector.h" |
19 #include "chromeos/dbus/update_engine_client.h" | 19 #include "chromeos/dbus/update_engine_client.h" |
20 | 20 |
21 namespace chromeos { | 21 namespace chromeos { |
22 | 22 |
23 class ErrorScreen; | 23 class ErrorScreen; |
| 24 class NetworkState; |
24 class ScreenObserver; | 25 class ScreenObserver; |
25 | 26 |
26 // Controller for the update screen. It does not depend on the specific | 27 // Controller for the update screen. It does not depend on the specific |
27 // implementation of the screen showing (Views of WebUI based), the dependency | 28 // implementation of the screen showing (Views of WebUI based), the dependency |
28 // is moved to the UpdateScreenActor instead. | 29 // is moved to the UpdateScreenActor instead. |
29 class UpdateScreen: public UpdateEngineClient::Observer, | 30 class UpdateScreen: public UpdateEngineClient::Observer, |
30 public UpdateScreenActor::Delegate, | 31 public UpdateScreenActor::Delegate, |
31 public WizardScreen, | 32 public WizardScreen, |
32 public NetworkPortalDetector::Observer { | 33 public NetworkPortalDetector::Observer { |
33 public: | 34 public: |
(...skipping 30 matching lines...) Expand all Loading... |
64 }; | 65 }; |
65 // Reports update results to the ScreenObserver. | 66 // Reports update results to the ScreenObserver. |
66 virtual void ExitUpdate(ExitReason reason); | 67 virtual void ExitUpdate(ExitReason reason); |
67 | 68 |
68 // UpdateEngineClient::Observer implementation: | 69 // UpdateEngineClient::Observer implementation: |
69 virtual void UpdateStatusChanged( | 70 virtual void UpdateStatusChanged( |
70 const UpdateEngineClient::Status& status) OVERRIDE; | 71 const UpdateEngineClient::Status& status) OVERRIDE; |
71 | 72 |
72 // NetworkPortalDetector::Observer implementation: | 73 // NetworkPortalDetector::Observer implementation: |
73 virtual void OnPortalDetectionCompleted( | 74 virtual void OnPortalDetectionCompleted( |
74 const Network* network, | 75 const NetworkState* network, |
75 const NetworkPortalDetector::CaptivePortalState& state) OVERRIDE; | 76 const NetworkPortalDetector::CaptivePortalState& state) OVERRIDE; |
76 | 77 |
77 private: | 78 private: |
78 FRIEND_TEST_ALL_PREFIXES(UpdateScreenTest, TestBasic); | 79 FRIEND_TEST_ALL_PREFIXES(UpdateScreenTest, TestBasic); |
79 FRIEND_TEST_ALL_PREFIXES(UpdateScreenTest, TestUpdateAvailable); | 80 FRIEND_TEST_ALL_PREFIXES(UpdateScreenTest, TestUpdateAvailable); |
80 | 81 |
81 enum State { | 82 enum State { |
82 STATE_IDLE = 0, | 83 STATE_IDLE = 0, |
83 STATE_FIRST_PORTAL_CHECK, | 84 STATE_FIRST_PORTAL_CHECK, |
84 STATE_UPDATE, | 85 STATE_UPDATE, |
(...skipping 14 matching lines...) Expand all Loading... |
99 // Checks that screen is shown, shows if not. | 100 // Checks that screen is shown, shows if not. |
100 void MakeSureScreenIsShown(); | 101 void MakeSureScreenIsShown(); |
101 | 102 |
102 // Returns an instance of the error screen. | 103 // Returns an instance of the error screen. |
103 ErrorScreen* GetErrorScreen(); | 104 ErrorScreen* GetErrorScreen(); |
104 | 105 |
105 void StartUpdateCheck(); | 106 void StartUpdateCheck(); |
106 void ShowErrorMessage(); | 107 void ShowErrorMessage(); |
107 void HideErrorMessage(); | 108 void HideErrorMessage(); |
108 void UpdateErrorMessage( | 109 void UpdateErrorMessage( |
109 const Network* network, | 110 const NetworkState* network, |
110 const NetworkPortalDetector::CaptivePortalStatus status); | 111 const NetworkPortalDetector::CaptivePortalStatus status); |
111 // Timer for the interval to wait for the reboot. | 112 // Timer for the interval to wait for the reboot. |
112 // If reboot didn't happen - ask user to reboot manually. | 113 // If reboot didn't happen - ask user to reboot manually. |
113 base::OneShotTimer<UpdateScreen> reboot_timer_; | 114 base::OneShotTimer<UpdateScreen> reboot_timer_; |
114 | 115 |
115 // Returns a static InstanceSet. | 116 // Returns a static InstanceSet. |
116 typedef std::set<UpdateScreen*> InstanceSet; | 117 typedef std::set<UpdateScreen*> InstanceSet; |
117 static InstanceSet& GetInstanceSet(); | 118 static InstanceSet& GetInstanceSet(); |
118 | 119 |
119 // Current state of the update screen. | 120 // Current state of the update screen. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 bool is_first_portal_notification_; | 160 bool is_first_portal_notification_; |
160 | 161 |
161 base::WeakPtrFactory<UpdateScreen> weak_factory_; | 162 base::WeakPtrFactory<UpdateScreen> weak_factory_; |
162 | 163 |
163 DISALLOW_COPY_AND_ASSIGN(UpdateScreen); | 164 DISALLOW_COPY_AND_ASSIGN(UpdateScreen); |
164 }; | 165 }; |
165 | 166 |
166 } // namespace chromeos | 167 } // namespace chromeos |
167 | 168 |
168 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_UPDATE_SCREEN_H_ | 169 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_UPDATE_SCREEN_H_ |
OLD | NEW |