Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(526)

Side by Side Diff: chrome/browser/chromeos/cros/network_library.cc

Issue 10849003: This fixes connecting to hidden networks by not marking them failed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed indent Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/chromeos/cros/network_library.h" 5 #include "chrome/browser/chromeos/cros/network_library.h"
6 6
7 #include <dbus/dbus-glib.h> 7 #include <dbus/dbus-glib.h>
8 8
9 #include "base/i18n/icu_encoding_detection.h" 9 #include "base/i18n/icu_encoding_detection.h"
10 #include "base/i18n/icu_string_conversions.h" 10 #include "base/i18n/icu_string_conversions.h"
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 return new Network("fake_service_path", type); 282 return new Network("fake_service_path", type);
283 } 283 }
284 284
285 void Network::SetState(ConnectionState new_state) { 285 void Network::SetState(ConnectionState new_state) {
286 if (new_state == state_) 286 if (new_state == state_)
287 return; 287 return;
288 if (state_ == STATE_CONNECT_REQUESTED && new_state == STATE_IDLE) { 288 if (state_ == STATE_CONNECT_REQUESTED && new_state == STATE_IDLE) {
289 // CONNECT_REQUESTED is set internally. Shill/flimflam do not update the 289 // CONNECT_REQUESTED is set internally. Shill/flimflam do not update the
290 // state immediately, so ignore any Idle state updates sent while a 290 // state immediately, so ignore any Idle state updates sent while a
291 // connection attempt is in progress. 291 // connection attempt is in progress.
292 VLOG(2) << "Ignoring idle state change after connection request.";
292 return; 293 return;
293 } 294 }
294 ConnectionState old_state = state_; 295 ConnectionState old_state = state_;
296 VLOG(2) << "Entering new state: " << ConnectionStateString(new_state);
295 state_ = new_state; 297 state_ = new_state;
296 if (!IsConnectingState(new_state)) 298 if (!IsConnectingState(new_state))
297 set_connection_started(false); 299 set_connection_started(false);
298 if (new_state == STATE_FAILURE) { 300 if (new_state == STATE_FAILURE) {
301 VLOG(2) << "Detected Failure state.";
299 if (old_state != STATE_UNKNOWN && old_state != STATE_IDLE) { 302 if (old_state != STATE_UNKNOWN && old_state != STATE_IDLE) {
300 // New failure, the user needs to be notified. 303 // New failure, the user needs to be notified.
301 // Transition STATE_IDLE -> STATE_FAILURE sometimes happens on resume 304 // Transition STATE_IDLE -> STATE_FAILURE sometimes happens on resume
302 // but is not an actual failure as network device is not ready yet. 305 // but is not an actual failure as network device is not ready yet.
303 notify_failure_ = true; 306 notify_failure_ = true;
304 // Normally error_ should be set, but if it is not we need to set it to 307 // Normally error_ should be set, but if it is not we need to set it to
305 // something here so that the retry logic will be triggered. 308 // something here so that the retry logic will be triggered.
306 if (error_ == ERROR_NO_ERROR) 309 if (error_ == ERROR_NO_ERROR) {
310 VLOG(2) << "Detected NO_ERROR error state. Setting to UNKNOWN.";
307 error_ = ERROR_UNKNOWN; 311 error_ = ERROR_UNKNOWN;
312 }
308 } 313 }
309 } else if (new_state != STATE_UNKNOWN) { 314 } else if (new_state != STATE_UNKNOWN) {
310 notify_failure_ = false; 315 notify_failure_ = false;
311 // State changed, so refresh IP address. 316 // State changed, so refresh IP address.
312 // Note: blocking DBus call. TODO(stevenjb): refactor this. 317 // Note: blocking DBus call. TODO(stevenjb): refactor this.
313 InitIPAddress(); 318 InitIPAddress();
314 } 319 }
315 VLOG(1) << name() << ".State [" << service_path() << "]: " << GetStateString() 320 VLOG(1) << name() << ".State [" << service_path() << "]: " << GetStateString()
316 << " (was: " << ConnectionStateString(old_state) << ")"; 321 << " (was: " << ConnectionStateString(old_state) << ")";
317 } 322 }
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after
1319 NetworkLibrary* impl; 1324 NetworkLibrary* impl;
1320 if (stub) 1325 if (stub)
1321 impl = new NetworkLibraryImplStub(); 1326 impl = new NetworkLibraryImplStub();
1322 else 1327 else
1323 impl = new NetworkLibraryImplCros(); 1328 impl = new NetworkLibraryImplCros();
1324 impl->Init(); 1329 impl->Init();
1325 return impl; 1330 return impl;
1326 } 1331 }
1327 1332
1328 } // namespace chromeos 1333 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698