| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/chromeos/cros/network_library.h" | 5 #include "chrome/browser/chromeos/cros/network_library.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 } | 208 } |
| 209 | 209 |
| 210 Network::~Network() {} | 210 Network::~Network() {} |
| 211 | 211 |
| 212 void Network::SetState(ConnectionState new_state) { | 212 void Network::SetState(ConnectionState new_state) { |
| 213 if (new_state == state_) | 213 if (new_state == state_) |
| 214 return; | 214 return; |
| 215 ConnectionState old_state = state_; | 215 ConnectionState old_state = state_; |
| 216 state_ = new_state; | 216 state_ = new_state; |
| 217 if (new_state == STATE_FAILURE) { | 217 if (new_state == STATE_FAILURE) { |
| 218 if (old_state != STATE_UNKNOWN) { | 218 if (old_state != STATE_UNKNOWN && |
| 219 old_state != STATE_IDLE) { |
| 219 // New failure, the user needs to be notified. | 220 // New failure, the user needs to be notified. |
| 221 // Transition STATE_IDLE -> STATE_FAILURE sometimes happens on resume |
| 222 // but is not an actual failure as network device is not ready yet. |
| 220 notify_failure_ = true; | 223 notify_failure_ = true; |
| 221 } | 224 } |
| 222 } else { | 225 } else { |
| 223 if (!IsConnectingState(new_state)) | 226 if (!IsConnectingState(new_state)) |
| 224 set_connection_started(false); | 227 set_connection_started(false); |
| 225 // State changed, so refresh IP address. | 228 // State changed, so refresh IP address. |
| 226 // Note: blocking DBus call. TODO(stevenjb): refactor this. | 229 // Note: blocking DBus call. TODO(stevenjb): refactor this. |
| 227 InitIPAddress(); | 230 InitIPAddress(); |
| 228 } | 231 } |
| 229 VLOG(1) << name() << ".State = " << GetStateString(); | 232 VLOG(1) << name() << ".State = " << GetStateString(); |
| (...skipping 4382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4612 return network_library; | 4615 return network_library; |
| 4613 } | 4616 } |
| 4614 | 4617 |
| 4615 ///////////////////////////////////////////////////////////////////////////// | 4618 ///////////////////////////////////////////////////////////////////////////// |
| 4616 | 4619 |
| 4617 } // namespace chromeos | 4620 } // namespace chromeos |
| 4618 | 4621 |
| 4619 // Allows InvokeLater without adding refcounting. This class is a Singleton and | 4622 // Allows InvokeLater without adding refcounting. This class is a Singleton and |
| 4620 // won't be deleted until its last InvokeLater is run. | 4623 // won't be deleted until its last InvokeLater is run. |
| 4621 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImplBase); | 4624 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImplBase); |
| OLD | NEW |