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" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 void UpdateStatusChanged(const UpdateEngineClient::Status& status) override; | 70 void UpdateStatusChanged(const UpdateEngineClient::Status& status) override; |
71 | 71 |
72 // NetworkPortalDetector::Observer implementation: | 72 // NetworkPortalDetector::Observer implementation: |
73 void OnPortalDetectionCompleted( | 73 void OnPortalDetectionCompleted( |
74 const NetworkState* network, | 74 const NetworkState* network, |
75 const NetworkPortalDetector::CaptivePortalState& state) override; | 75 const NetworkPortalDetector::CaptivePortalState& state) override; |
76 | 76 |
77 // Skip update UI, usually used only in debug builds/tests. | 77 // Skip update UI, usually used only in debug builds/tests. |
78 void CancelUpdate(); | 78 void CancelUpdate(); |
79 | 79 |
| 80 base::OneShotTimer<UpdateScreen>& GetErrorMessageTimerForTesting(); |
| 81 |
80 private: | 82 private: |
81 FRIEND_TEST_ALL_PREFIXES(UpdateScreenTest, TestBasic); | 83 FRIEND_TEST_ALL_PREFIXES(UpdateScreenTest, TestBasic); |
82 FRIEND_TEST_ALL_PREFIXES(UpdateScreenTest, TestUpdateAvailable); | 84 FRIEND_TEST_ALL_PREFIXES(UpdateScreenTest, TestUpdateAvailable); |
83 FRIEND_TEST_ALL_PREFIXES(UpdateScreenTest, TestAPReselection); | 85 FRIEND_TEST_ALL_PREFIXES(UpdateScreenTest, TestAPReselection); |
84 | 86 |
85 enum State { | 87 enum State { |
86 STATE_IDLE = 0, | 88 STATE_IDLE = 0, |
87 STATE_FIRST_PORTAL_CHECK, | 89 STATE_FIRST_PORTAL_CHECK, |
88 STATE_UPDATE, | 90 STATE_UPDATE, |
89 STATE_ERROR | 91 STATE_ERROR |
(...skipping 19 matching lines...) Expand all Loading... |
109 | 111 |
110 // Returns an instance of the error screen. | 112 // Returns an instance of the error screen. |
111 ErrorScreen* GetErrorScreen(); | 113 ErrorScreen* GetErrorScreen(); |
112 | 114 |
113 void StartUpdateCheck(); | 115 void StartUpdateCheck(); |
114 void ShowErrorMessage(); | 116 void ShowErrorMessage(); |
115 void HideErrorMessage(); | 117 void HideErrorMessage(); |
116 void UpdateErrorMessage( | 118 void UpdateErrorMessage( |
117 const NetworkState* network, | 119 const NetworkState* network, |
118 const NetworkPortalDetector::CaptivePortalStatus status); | 120 const NetworkPortalDetector::CaptivePortalStatus status); |
| 121 |
| 122 void DelayErrorMessage(); |
| 123 |
119 // Timer for the interval to wait for the reboot. | 124 // Timer for the interval to wait for the reboot. |
120 // If reboot didn't happen - ask user to reboot manually. | 125 // If reboot didn't happen - ask user to reboot manually. |
121 base::OneShotTimer<UpdateScreen> reboot_timer_; | 126 base::OneShotTimer<UpdateScreen> reboot_timer_; |
122 | 127 |
123 // Returns a static InstanceSet. | 128 // Returns a static InstanceSet. |
124 typedef std::set<UpdateScreen*> InstanceSet; | 129 typedef std::set<UpdateScreen*> InstanceSet; |
125 static InstanceSet& GetInstanceSet(); | 130 static InstanceSet& GetInstanceSet(); |
126 | 131 |
127 // Current state of the update screen. | 132 // Current state of the update screen. |
128 State state_; | 133 State state_; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 // True if there was no notification from NetworkPortalDetector | 168 // True if there was no notification from NetworkPortalDetector |
164 // about state for the default network. | 169 // about state for the default network. |
165 bool is_first_detection_notification_; | 170 bool is_first_detection_notification_; |
166 | 171 |
167 // True if there was no notification about captive portal state for | 172 // True if there was no notification about captive portal state for |
168 // the default network. | 173 // the default network. |
169 bool is_first_portal_notification_; | 174 bool is_first_portal_notification_; |
170 | 175 |
171 scoped_ptr<ErrorScreensHistogramHelper> histogram_helper_; | 176 scoped_ptr<ErrorScreensHistogramHelper> histogram_helper_; |
172 | 177 |
| 178 // Timer for the captive portal detector to show portal login page. |
| 179 // If redirect did not happen during this delay, error message is shown |
| 180 // instead. |
| 181 base::OneShotTimer<UpdateScreen> error_message_timer_; |
| 182 |
173 base::WeakPtrFactory<UpdateScreen> weak_factory_; | 183 base::WeakPtrFactory<UpdateScreen> weak_factory_; |
174 | 184 |
175 DISALLOW_COPY_AND_ASSIGN(UpdateScreen); | 185 DISALLOW_COPY_AND_ASSIGN(UpdateScreen); |
176 }; | 186 }; |
177 | 187 |
178 } // namespace chromeos | 188 } // namespace chromeos |
179 | 189 |
180 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_UPDATE_SCREEN_H_ | 190 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_UPDATE_SCREEN_H_ |
OLD | NEW |