| 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 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 } | 182 } |
| 183 | 183 |
| 184 bool updated = (new_state != state_) || | 184 bool updated = (new_state != state_) || |
| 185 (new_network_path != network_path_) || | 185 (new_network_path != network_path_) || |
| 186 (new_network_type != network_type_); | 186 (new_network_type != network_type_); |
| 187 state_ = new_state; | 187 state_ = new_state; |
| 188 network_path_ = new_network_path; | 188 network_path_ = new_network_path; |
| 189 network_type_ = new_network_type; | 189 network_type_ = new_network_type; |
| 190 | 190 |
| 191 if (updated && state_ == ONLINE) { | 191 if (updated && state_ == ONLINE) { |
| 192 FOR_EACH_OBSERVER(NetworkStateInformerObserver, observers_, | 192 for (NetworkStateInformerObserver& observer : observers_) |
| 193 OnNetworkReady()); | 193 observer.OnNetworkReady(); |
| 194 } | 194 } |
| 195 | 195 |
| 196 return updated; | 196 return updated; |
| 197 } | 197 } |
| 198 | 198 |
| 199 void NetworkStateInformer::UpdateStateAndNotify() { | 199 void NetworkStateInformer::UpdateStateAndNotify() { |
| 200 if (UpdateState()) | 200 if (UpdateState()) |
| 201 SendStateToObservers(NetworkError::ERROR_REASON_NETWORK_STATE_CHANGED); | 201 SendStateToObservers(NetworkError::ERROR_REASON_NETWORK_STATE_CHANGED); |
| 202 else | 202 else |
| 203 SendStateToObservers(NetworkError::ERROR_REASON_UPDATE); | 203 SendStateToObservers(NetworkError::ERROR_REASON_UPDATE); |
| 204 } | 204 } |
| 205 | 205 |
| 206 void NetworkStateInformer::SendStateToObservers( | 206 void NetworkStateInformer::SendStateToObservers( |
| 207 NetworkError::ErrorReason reason) { | 207 NetworkError::ErrorReason reason) { |
| 208 FOR_EACH_OBSERVER(NetworkStateInformerObserver, observers_, | 208 for (NetworkStateInformerObserver& observer : observers_) |
| 209 UpdateState(reason)); | 209 observer.UpdateState(reason); |
| 210 } | 210 } |
| 211 | 211 |
| 212 } // namespace chromeos | 212 } // namespace chromeos |
| OLD | NEW |