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/time.h" | 14 #include "base/time/time.h" |
15 #include "base/timer/timer.h" | 15 #include "base/timer/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 "chromeos/dbus/update_engine_client.h" | 18 #include "chromeos/dbus/update_engine_client.h" |
19 #include "chromeos/network/portal_detector/network_portal_detector.h" | 19 #include "chromeos/network/portal_detector/network_portal_detector.h" |
| 20 #include "components/pairing/host_pairing_controller.h" |
20 | 21 |
21 namespace chromeos { | 22 namespace chromeos { |
22 | 23 |
23 class ErrorScreen; | 24 class ErrorScreen; |
24 class NetworkState; | 25 class NetworkState; |
25 class ScreenManager; | 26 class ScreenManager; |
26 class ScreenObserver; | 27 class ScreenObserver; |
27 | 28 |
28 // Controller for the update screen. It does not depend on the specific | 29 // Controller for the update screen. It does not depend on the specific |
29 // implementation of the screen showing (Views of WebUI based), the dependency | 30 // implementation of the screen showing (Views of WebUI based), the dependency |
30 // is moved to the UpdateScreenActor instead. | 31 // is moved to the UpdateScreenActor instead. |
31 class UpdateScreen: public UpdateEngineClient::Observer, | 32 class UpdateScreen: public UpdateEngineClient::Observer, |
32 public UpdateScreenActor::Delegate, | 33 public UpdateScreenActor::Delegate, |
33 public WizardScreen, | 34 public WizardScreen, |
34 public NetworkPortalDetector::Observer { | 35 public NetworkPortalDetector::Observer { |
35 public: | 36 public: |
36 UpdateScreen(ScreenObserver* screen_observer, UpdateScreenActor* actor); | 37 UpdateScreen(ScreenObserver* screen_observer, |
| 38 UpdateScreenActor* actor, |
| 39 pairing_chromeos::HostPairingController* remora_controller); |
37 virtual ~UpdateScreen(); | 40 virtual ~UpdateScreen(); |
38 | 41 |
39 static UpdateScreen* Get(ScreenManager* manager); | 42 static UpdateScreen* Get(ScreenManager* manager); |
40 | 43 |
41 // Overridden from WizardScreen. | 44 // Overridden from WizardScreen. |
42 virtual void PrepareToShow() override; | 45 virtual void PrepareToShow() override; |
43 virtual void Show() override; | 46 virtual void Show() override; |
44 virtual void Hide() override; | 47 virtual void Hide() override; |
45 virtual std::string GetName() const override; | 48 virtual std::string GetName() const override; |
46 | 49 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 // Returns true if there is critical system update that requires installation | 101 // Returns true if there is critical system update that requires installation |
99 // and immediate reboot. | 102 // and immediate reboot. |
100 bool HasCriticalUpdate(); | 103 bool HasCriticalUpdate(); |
101 | 104 |
102 // Timer notification handlers. | 105 // Timer notification handlers. |
103 void OnWaitForRebootTimeElapsed(); | 106 void OnWaitForRebootTimeElapsed(); |
104 | 107 |
105 // Checks that screen is shown, shows if not. | 108 // Checks that screen is shown, shows if not. |
106 void MakeSureScreenIsShown(); | 109 void MakeSureScreenIsShown(); |
107 | 110 |
| 111 // Send update status to host pairing controller. |
| 112 void SetHostPairingControllerStatus( |
| 113 pairing_chromeos::HostPairingController::UpdateStatus update_status); |
| 114 |
108 // Returns an instance of the error screen. | 115 // Returns an instance of the error screen. |
109 ErrorScreen* GetErrorScreen(); | 116 ErrorScreen* GetErrorScreen(); |
110 | 117 |
111 void StartUpdateCheck(); | 118 void StartUpdateCheck(); |
112 void ShowErrorMessage(); | 119 void ShowErrorMessage(); |
113 void HideErrorMessage(); | 120 void HideErrorMessage(); |
114 void UpdateErrorMessage( | 121 void UpdateErrorMessage( |
115 const NetworkState* network, | 122 const NetworkState* network, |
116 const NetworkPortalDetector::CaptivePortalStatus status); | 123 const NetworkPortalDetector::CaptivePortalStatus status); |
117 // Timer for the interval to wait for the reboot. | 124 // Timer for the interval to wait for the reboot. |
(...skipping 20 matching lines...) Expand all Loading... |
138 // Note, this is false by default. | 145 // Note, this is false by default. |
139 bool is_ignore_update_deadlines_; | 146 bool is_ignore_update_deadlines_; |
140 // Whether the update screen is shown. | 147 // Whether the update screen is shown. |
141 bool is_shown_; | 148 bool is_shown_; |
142 // Ignore fist IDLE status that is sent before update screen initiated check. | 149 // Ignore fist IDLE status that is sent before update screen initiated check. |
143 bool ignore_idle_status_; | 150 bool ignore_idle_status_; |
144 | 151 |
145 // Keeps actor which is delegated with all showing operations. | 152 // Keeps actor which is delegated with all showing operations. |
146 UpdateScreenActor* actor_; | 153 UpdateScreenActor* actor_; |
147 | 154 |
| 155 // Used to track updates over Bluetooth. |
| 156 pairing_chromeos::HostPairingController* remora_controller_; |
| 157 |
148 // Time of the first notification from the downloading stage. | 158 // Time of the first notification from the downloading stage. |
149 base::Time download_start_time_; | 159 base::Time download_start_time_; |
150 double download_start_progress_; | 160 double download_start_progress_; |
151 | 161 |
152 // Time of the last notification from the downloading stage. | 162 // Time of the last notification from the downloading stage. |
153 base::Time download_last_time_; | 163 base::Time download_last_time_; |
154 double download_last_progress_; | 164 double download_last_progress_; |
155 | 165 |
156 bool is_download_average_speed_computed_; | 166 bool is_download_average_speed_computed_; |
157 double download_average_speed_; | 167 double download_average_speed_; |
158 | 168 |
159 // True if there was no notification from NetworkPortalDetector | 169 // True if there was no notification from NetworkPortalDetector |
160 // about state for the default network. | 170 // about state for the default network. |
161 bool is_first_detection_notification_; | 171 bool is_first_detection_notification_; |
162 | 172 |
163 // True if there was no notification about captive portal state for | 173 // True if there was no notification about captive portal state for |
164 // the default network. | 174 // the default network. |
165 bool is_first_portal_notification_; | 175 bool is_first_portal_notification_; |
166 | 176 |
167 base::WeakPtrFactory<UpdateScreen> weak_factory_; | 177 base::WeakPtrFactory<UpdateScreen> weak_factory_; |
168 | 178 |
169 DISALLOW_COPY_AND_ASSIGN(UpdateScreen); | 179 DISALLOW_COPY_AND_ASSIGN(UpdateScreen); |
170 }; | 180 }; |
171 | 181 |
172 } // namespace chromeos | 182 } // namespace chromeos |
173 | 183 |
174 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_UPDATE_SCREEN_H_ | 184 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_UPDATE_SCREEN_H_ |
OLD | NEW |