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/chromeos/cros/network_library.h" | 5 #include "chrome/browser/chromeos/cros/network_library.h" |
6 | 6 |
7 #include "base/i18n/icu_encoding_detection.h" | 7 #include "base/i18n/icu_encoding_detection.h" |
8 #include "base/i18n/icu_string_conversions.h" | 8 #include "base/i18n/icu_string_conversions.h" |
9 #include "base/i18n/time_formatting.h" | 9 #include "base/i18n/time_formatting.h" |
10 #include "base/json/json_writer.h" // for debug output only. | 10 #include "base/json/json_writer.h" // for debug output only. |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 | 370 |
371 void Network::CopyCredentialsFromRemembered(Network* remembered) { | 371 void Network::CopyCredentialsFromRemembered(Network* remembered) { |
372 } | 372 } |
373 | 373 |
374 void Network::SetValueProperty(const char* prop, const base::Value& value) { | 374 void Network::SetValueProperty(const char* prop, const base::Value& value) { |
375 DCHECK(prop); | 375 DCHECK(prop); |
376 if (!EnsureCrosLoaded()) | 376 if (!EnsureCrosLoaded()) |
377 return; | 377 return; |
378 CrosSetNetworkServiceProperty(service_path_, prop, value); | 378 CrosSetNetworkServiceProperty(service_path_, prop, value); |
379 // Ensure NetworkStateHandler properties are up-to-date. | 379 // Ensure NetworkStateHandler properties are up-to-date. |
380 if (NetworkStateHandler::IsInitialized()) | 380 if (NetworkHandler::IsInitialized()) { |
381 NetworkStateHandler::Get()->RequestUpdateForNetwork(service_path()); | 381 NetworkHandler::Get()->network_state_handler()->RequestUpdateForNetwork( |
| 382 service_path()); |
| 383 } |
382 } | 384 } |
383 | 385 |
384 void Network::ClearProperty(const char* prop) { | 386 void Network::ClearProperty(const char* prop) { |
385 DCHECK(prop); | 387 DCHECK(prop); |
386 if (!EnsureCrosLoaded()) | 388 if (!EnsureCrosLoaded()) |
387 return; | 389 return; |
388 CrosClearNetworkServiceProperty(service_path_, prop); | 390 CrosClearNetworkServiceProperty(service_path_, prop); |
389 // Ensure NetworkStateHandler properties are up-to-date. | 391 // Ensure NetworkStateHandler properties are up-to-date. |
390 if (NetworkStateHandler::IsInitialized()) | 392 if (NetworkHandler::IsInitialized()) { |
391 NetworkStateHandler::Get()->RequestUpdateForNetwork(service_path()); | 393 NetworkHandler::Get()->network_state_handler()->RequestUpdateForNetwork( |
| 394 service_path()); |
| 395 } |
392 } | 396 } |
393 | 397 |
394 void Network::SetStringProperty( | 398 void Network::SetStringProperty( |
395 const char* prop, const std::string& str, std::string* dest) { | 399 const char* prop, const std::string& str, std::string* dest) { |
396 if (dest) | 400 if (dest) |
397 *dest = str; | 401 *dest = str; |
398 SetValueProperty(prop, base::StringValue(str)); | 402 SetValueProperty(prop, base::StringValue(str)); |
399 } | 403 } |
400 | 404 |
401 void Network::SetOrClearStringProperty(const char* prop, | 405 void Network::SetOrClearStringProperty(const char* prop, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 | 453 |
450 void Network::AttemptConnection(const base::Closure& closure) { | 454 void Network::AttemptConnection(const base::Closure& closure) { |
451 // By default, just invoke the closure right away. Some subclasses | 455 // By default, just invoke the closure right away. Some subclasses |
452 // (Wifi, VPN, etc.) override to do more work. | 456 // (Wifi, VPN, etc.) override to do more work. |
453 closure.Run(); | 457 closure.Run(); |
454 } | 458 } |
455 | 459 |
456 void Network::set_connecting() { | 460 void Network::set_connecting() { |
457 state_ = STATE_CONNECT_REQUESTED; | 461 state_ = STATE_CONNECT_REQUESTED; |
458 // Set the connecting network in NetworkStateHandler for the status area UI. | 462 // Set the connecting network in NetworkStateHandler for the status area UI. |
459 if (NetworkStateHandler::IsInitialized()) | 463 if (NetworkHandler::IsInitialized()) { |
460 NetworkStateHandler::Get()->SetConnectingNetwork(service_path()); | 464 NetworkHandler::Get()->network_state_handler()-> |
| 465 SetConnectingNetwork(service_path()); |
| 466 } |
461 } | 467 } |
462 | 468 |
463 void Network::SetProfilePath(const std::string& profile_path) { | 469 void Network::SetProfilePath(const std::string& profile_path) { |
464 VLOG(1) << "Setting profile for: " << name_ << " to: " << profile_path; | 470 VLOG(1) << "Setting profile for: " << name_ << " to: " << profile_path; |
465 SetOrClearStringProperty( | 471 SetOrClearStringProperty( |
466 flimflam::kProfileProperty, profile_path, &profile_path_); | 472 flimflam::kProfileProperty, profile_path, &profile_path_); |
467 } | 473 } |
468 | 474 |
469 std::string Network::GetStateString() const { | 475 std::string Network::GetStateString() const { |
470 return ConnectionStateString(state_); | 476 return ConnectionStateString(state_); |
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1380 NetworkLibrary* impl; | 1386 NetworkLibrary* impl; |
1381 if (stub) | 1387 if (stub) |
1382 impl = new NetworkLibraryImplStub(); | 1388 impl = new NetworkLibraryImplStub(); |
1383 else | 1389 else |
1384 impl = new NetworkLibraryImplCros(); | 1390 impl = new NetworkLibraryImplCros(); |
1385 impl->Init(); | 1391 impl->Init(); |
1386 return impl; | 1392 return impl; |
1387 } | 1393 } |
1388 | 1394 |
1389 } // namespace chromeos | 1395 } // namespace chromeos |
OLD | NEW |