| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/sync/notifier/base/network_status_detector_task.h" | 5 #include "chrome/common/net/notifier/base/network_status_detector_task.h" |
| 6 | 6 |
| 7 namespace notifier { | 7 namespace notifier { |
| 8 | 8 |
| 9 void NetworkStatusDetectorTask::DetectNetworkState() { | 9 void NetworkStatusDetectorTask::DetectNetworkState() { |
| 10 // If the detection has been finished, then just broadcast the current state. | 10 // If the detection has been finished, then just broadcast the current state. |
| 11 // Otherwise, allow the signal to be sent when the initial detection is | 11 // Otherwise, allow the signal to be sent when the initial detection is |
| 12 // finished. | 12 // finished. |
| 13 if (initial_detection_done_) { | 13 if (initial_detection_done_) { |
| 14 SignalNetworkStateDetected(is_alive_, is_alive_); | 14 SignalNetworkStateDetected(is_alive_, is_alive_); |
| 15 } | 15 } |
| 16 } | 16 } |
| 17 | 17 |
| 18 void NetworkStatusDetectorTask::SetNetworkAlive(bool is_alive) { | 18 void NetworkStatusDetectorTask::SetNetworkAlive(bool is_alive) { |
| 19 bool was_alive = is_alive_; | 19 bool was_alive = is_alive_; |
| 20 is_alive_ = is_alive; | 20 is_alive_ = is_alive; |
| 21 | 21 |
| 22 if (!initial_detection_done_ || was_alive != is_alive_) { | 22 if (!initial_detection_done_ || was_alive != is_alive_) { |
| 23 initial_detection_done_ = true; | 23 initial_detection_done_ = true; |
| 24 | 24 |
| 25 // Tell everyone about the network state change. | 25 // Tell everyone about the network state change. |
| 26 SignalNetworkStateDetected(was_alive, is_alive_); | 26 SignalNetworkStateDetected(was_alive, is_alive_); |
| 27 } | 27 } |
| 28 } | 28 } |
| 29 | 29 |
| 30 } // namespace notifier | 30 } // namespace notifier |
| OLD | NEW |