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