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

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

Issue 10824242: This adds Cros API for calling the "Refresh" function on shill's (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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_impl_cros.h" 5 #include "chrome/browser/chromeos/cros/network_library_impl_cros.h"
6 6
7 #include <dbus/dbus-glib.h> 7 #include <dbus/dbus-glib.h>
8 #include "base/bind.h"
8 #include "base/command_line.h" 9 #include "base/command_line.h"
9 #include "base/json/json_writer.h" // for debug output only. 10 #include "base/json/json_writer.h" // for debug output only.
10 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/values.h"
11 #include "chrome/browser/chromeos/cros/cros_library.h" 13 #include "chrome/browser/chromeos/cros/cros_library.h"
12 #include "chrome/browser/chromeos/cros/native_network_constants.h" 14 #include "chrome/browser/chromeos/cros/native_network_constants.h"
13 #include "chrome/browser/chromeos/cros/native_network_parser.h" 15 #include "chrome/browser/chromeos/cros/native_network_parser.h"
14 #include "chrome/browser/chromeos/settings/cros_settings.h" 16 #include "chrome/browser/chromeos/settings/cros_settings.h"
15 #include "chrome/common/chrome_switches.h" 17 #include "chrome/common/chrome_switches.h"
16 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
17 #include "third_party/cros_system_api/dbus/service_constants.h" 19 #include "third_party/cros_system_api/dbus/service_constants.h"
18 20
19 using content::BrowserThread; 21 using content::BrowserThread;
20 22
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 base::Bind(&NetworkLibraryImplCros::NetworkManagerUpdate, 451 base::Bind(&NetworkLibraryImplCros::NetworkManagerUpdate,
450 weak_ptr_factory_.GetWeakPtr())); 452 weak_ptr_factory_.GetWeakPtr()));
451 } 453 }
452 454
453 bool NetworkLibraryImplCros::GetWifiAccessPoints( 455 bool NetworkLibraryImplCros::GetWifiAccessPoints(
454 WifiAccessPointVector* result) { 456 WifiAccessPointVector* result) {
455 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 457 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
456 return CrosGetWifiAccessPoints(result); 458 return CrosGetWifiAccessPoints(result);
457 } 459 }
458 460
461 void NetworkLibraryImplCros::RefreshIPConfig(Network* network) {
462 DCHECK(network);
463 CrosRequestNetworkDeviceProperties(
464 network->device_path(),
465 base::Bind(&NetworkLibraryImplCros::RefreshIPConfigCallback,
466 weak_ptr_factory_.GetWeakPtr()));
stevenjb 2012/08/09 20:45:50 nit: alignment
467 }
468
469 void NetworkLibraryImplCros::RefreshIPConfigCallback(
470 const std::string& device_path,
471 const base::DictionaryValue* properties) {
472 const ListValue* ips = NULL;
473 if (!properties->GetListWithoutPathExpansion(
474 flimflam::kIPConfigsProperty, &ips))
475 return;
476
477 for (size_t i = 0; i < ips->GetSize(); i++) {
478 std::string ipconfig_path;
479 if (!ips->GetString(i, &ipconfig_path))
480 continue;
481 CrosRequestIPConfigRefresh(ipconfig_path);
482 }
483 }
484
459 void NetworkLibraryImplCros::DisconnectFromNetwork(const Network* network) { 485 void NetworkLibraryImplCros::DisconnectFromNetwork(const Network* network) {
460 DCHECK(network); 486 DCHECK(network);
461 // Asynchronous disconnect request. Network state will be updated through 487 // Asynchronous disconnect request. Network state will be updated through
462 // the network manager once disconnect completes. 488 // the network manager once disconnect completes.
463 CrosRequestNetworkServiceDisconnect(network->service_path()); 489 CrosRequestNetworkServiceDisconnect(network->service_path());
464 } 490 }
465 491
466 void NetworkLibraryImplCros::CallEnableNetworkDeviceType( 492 void NetworkLibraryImplCros::CallEnableNetworkDeviceType(
467 ConnectionType device, bool enable) { 493 ConnectionType device, bool enable) {
468 busy_devices_ |= 1 << device; 494 busy_devices_ |= 1 << device;
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 // Switch back to signed settings value. 1212 // Switch back to signed settings value.
1187 SetCellularDataRoamingAllowed(settings_value); 1213 SetCellularDataRoamingAllowed(settings_value);
1188 } 1214 }
1189 } 1215 }
1190 } 1216 }
1191 NotifyNetworkManagerChanged(false); // Not forced. 1217 NotifyNetworkManagerChanged(false); // Not forced.
1192 AddNetworkDeviceObserver(device_path, network_device_observer_.get()); 1218 AddNetworkDeviceObserver(device_path, network_device_observer_.get());
1193 } 1219 }
1194 1220
1195 } // namespace chromeos 1221 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/network_library_impl_cros.h ('k') | chrome/browser/chromeos/cros/network_library_impl_stub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698