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

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

Issue 7753020: Revert recent changes to base::Value (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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) 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 } 176 }
177 177
178 NetworkDevice::~NetworkDevice() {} 178 NetworkDevice::~NetworkDevice() {}
179 179
180 void NetworkDevice::ParseInfo(const DictionaryValue& info) { 180 void NetworkDevice::ParseInfo(const DictionaryValue& info) {
181 if (device_parser_.get()) 181 if (device_parser_.get())
182 device_parser_->UpdateDeviceFromInfo(info, this); 182 device_parser_->UpdateDeviceFromInfo(info, this);
183 } 183 }
184 184
185 bool NetworkDevice::UpdateStatus(const std::string& key, 185 bool NetworkDevice::UpdateStatus(const std::string& key,
186 Value* value, 186 const Value& value,
187 PropertyIndex* index) { 187 PropertyIndex* index) {
188 if (device_parser_.get()) 188 if (device_parser_.get())
189 return device_parser_->UpdateStatus(key, value, this, index); 189 return device_parser_->UpdateStatus(key, value, this, index);
190 return false; 190 return false;
191 } 191 }
192 192
193 //////////////////////////////////////////////////////////////////////////////// 193 ////////////////////////////////////////////////////////////////////////////////
194 // Network 194 // Network
195 195
196 Network::Network(const std::string& service_path, 196 Network::Network(const std::string& service_path,
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 ip_address_ = ipconfig.address; 423 ip_address_ = ipconfig.address;
424 break; 424 break;
425 } 425 }
426 } 426 }
427 chromeos::FreeIPConfigStatus(ipconfig_status); 427 chromeos::FreeIPConfigStatus(ipconfig_status);
428 } 428 }
429 } 429 }
430 } 430 }
431 431
432 bool Network::UpdateStatus(const std::string& key, 432 bool Network::UpdateStatus(const std::string& key,
433 Value* value, 433 const Value& value,
434 PropertyIndex* index) { 434 PropertyIndex* index) {
435 if (network_parser_.get()) 435 if (network_parser_.get())
436 return network_parser_->UpdateStatus(key, value, this, index); 436 return network_parser_->UpdateStatus(key, value, this, index);
437 return false; 437 return false;
438 } 438 }
439 439
440 //////////////////////////////////////////////////////////////////////////////// 440 ////////////////////////////////////////////////////////////////////////////////
441 // EthernetNetwork 441 // EthernetNetwork
442 442
443 EthernetNetwork::EthernetNetwork(const std::string& service_path) 443 EthernetNetwork::EthernetNetwork(const std::string& service_path)
(...skipping 2530 matching lines...) Expand 10 before | Expand all | Expand 10 after
2974 virtual NetworkIPConfigVector GetIPConfigs( 2974 virtual NetworkIPConfigVector GetIPConfigs(
2975 const std::string& device_path, 2975 const std::string& device_path,
2976 std::string* hardware_address, 2976 std::string* hardware_address,
2977 HardwareAddressFormat format) OVERRIDE; 2977 HardwareAddressFormat format) OVERRIDE;
2978 virtual void SetIPConfig(const NetworkIPConfig& ipconfig) OVERRIDE; 2978 virtual void SetIPConfig(const NetworkIPConfig& ipconfig) OVERRIDE;
2979 2979
2980 ////////////////////////////////////////////////////////////////////////////// 2980 //////////////////////////////////////////////////////////////////////////////
2981 // Calbacks. 2981 // Calbacks.
2982 static void NetworkStatusChangedHandler( 2982 static void NetworkStatusChangedHandler(
2983 void* object, const char* path, const char* key, const Value* value); 2983 void* object, const char* path, const char* key, const Value* value);
2984 void UpdateNetworkStatus(const std::string& path, 2984 void UpdateNetworkStatus(
2985 const std::string& key, 2985 const std::string& path, const std::string& key, const Value& value);
2986 Value* value);
2987 2986
2988 static void NetworkDevicePropertyChangedHandler( 2987 static void NetworkDevicePropertyChangedHandler(
2989 void* object, const char* path, const char* key, const Value* value); 2988 void* object, const char* path, const char* key, const Value* value);
2990 void UpdateNetworkDeviceStatus( 2989 void UpdateNetworkDeviceStatus(
2991 const std::string& path, const std::string& key, Value* value); 2990 const std::string& path, const std::string& key, const Value& value);
2992 2991
2993 static void PinOperationCallback(void* object, 2992 static void PinOperationCallback(void* object,
2994 const char* path, 2993 const char* path,
2995 NetworkMethodErrorType error, 2994 NetworkMethodErrorType error,
2996 const char* error_message); 2995 const char* error_message);
2997 2996
2998 static void CellularRegisterCallback(void* object, 2997 static void CellularRegisterCallback(void* object,
2999 const char* path, 2998 const char* path,
3000 NetworkMethodErrorType error, 2999 NetworkMethodErrorType error,
3001 const char* error_message); 3000 const char* error_message);
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
3168 } 3167 }
3169 3168
3170 // static callback 3169 // static callback
3171 void NetworkLibraryImplCros::NetworkStatusChangedHandler( 3170 void NetworkLibraryImplCros::NetworkStatusChangedHandler(
3172 void* object, const char* path, const char* key, const Value* value) { 3171 void* object, const char* path, const char* key, const Value* value) {
3173 NetworkLibraryImplCros* networklib = 3172 NetworkLibraryImplCros* networklib =
3174 static_cast<NetworkLibraryImplCros*>(object); 3173 static_cast<NetworkLibraryImplCros*>(object);
3175 DCHECK(networklib); 3174 DCHECK(networklib);
3176 if (key == NULL || value == NULL || path == NULL || object == NULL) 3175 if (key == NULL || value == NULL || path == NULL || object == NULL)
3177 return; 3176 return;
3178 networklib->UpdateNetworkStatus(std::string(path), 3177 networklib->UpdateNetworkStatus(std::string(path), std::string(key), *value);
3179 std::string(key),
3180 const_cast<Value*>(value));
3181 } 3178 }
3182 3179
3183 void NetworkLibraryImplCros::UpdateNetworkStatus(const std::string& path, 3180 void NetworkLibraryImplCros::UpdateNetworkStatus(
3184 const std::string& key, 3181 const std::string& path, const std::string& key, const Value& value) {
3185 Value* value) {
3186 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 3182 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
3187 Network* network = FindNetworkByPath(path); 3183 Network* network = FindNetworkByPath(path);
3188 if (network) { 3184 if (network) {
3189 VLOG(2) << "UpdateNetworkStatus: " << network->name() << "." << key; 3185 VLOG(2) << "UpdateNetworkStatus: " << network->name() << "." << key;
3190 bool prev_connected = network->connected(); 3186 bool prev_connected = network->connected();
3191 if (!network->UpdateStatus(key, value, NULL)) { 3187 if (!network->UpdateStatus(key, value, NULL)) {
3192 LOG(WARNING) << "UpdateNetworkStatus: Error updating: " 3188 LOG(WARNING) << "UpdateNetworkStatus: Error updating: "
3193 << path << "." << key; 3189 << path << "." << key;
3194 } 3190 }
3195 // If we just connected, this may have been added to remembered list. 3191 // If we just connected, this may have been added to remembered list.
3196 if (!prev_connected && network->connected()) 3192 if (!prev_connected && network->connected())
3197 RequestRememberedNetworksUpdate(); 3193 RequestRememberedNetworksUpdate();
3198 NotifyNetworkChanged(network); 3194 NotifyNetworkChanged(network);
3199 // Anything observing the manager needs to know about any service change. 3195 // Anything observing the manager needs to know about any service change.
3200 NotifyNetworkManagerChanged(false); // Not forced. 3196 NotifyNetworkManagerChanged(false); // Not forced.
3201 } 3197 }
3202 } 3198 }
3203 3199
3204 // static callback 3200 // static callback
3205 void NetworkLibraryImplCros::NetworkDevicePropertyChangedHandler( 3201 void NetworkLibraryImplCros::NetworkDevicePropertyChangedHandler(
3206 void* object, const char* path, const char* key, const Value* value) { 3202 void* object, const char* path, const char* key, const Value* value) {
3207 NetworkLibraryImplCros* networklib = 3203 NetworkLibraryImplCros* networklib =
3208 static_cast<NetworkLibraryImplCros*>(object); 3204 static_cast<NetworkLibraryImplCros*>(object);
3209 DCHECK(networklib); 3205 DCHECK(networklib);
3210 if (key == NULL || value == NULL || path == NULL || object == NULL) 3206 if (key == NULL || value == NULL || path == NULL || object == NULL)
3211 return; 3207 return;
3212 networklib->UpdateNetworkDeviceStatus(std::string(path), 3208 networklib->UpdateNetworkDeviceStatus(std::string(path),
3213 std::string(key), 3209 std::string(key),
3214 const_cast<Value*>(value)); 3210 *value);
3215 } 3211 }
3216 3212
3217 void NetworkLibraryImplCros::UpdateNetworkDeviceStatus(const std::string& path, 3213 void NetworkLibraryImplCros::UpdateNetworkDeviceStatus(
3218 const std::string& key, 3214 const std::string& path, const std::string& key, const Value& value) {
3219 Value* value) {
3220 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 3215 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
3221 NetworkDevice* device = FindNetworkDeviceByPath(path); 3216 NetworkDevice* device = FindNetworkDeviceByPath(path);
3222 if (device) { 3217 if (device) {
3223 VLOG(2) << "UpdateNetworkDeviceStatus: " << device->name() << "." << key; 3218 VLOG(2) << "UpdateNetworkDeviceStatus: " << device->name() << "." << key;
3224 PropertyIndex index = PROPERTY_INDEX_UNKNOWN; 3219 PropertyIndex index = PROPERTY_INDEX_UNKNOWN;
3225 if (device->UpdateStatus(key, value, &index)) { 3220 if (device->UpdateStatus(key, value, &index)) {
3226 if (index == PROPERTY_INDEX_CELLULAR_ALLOW_ROAMING) { 3221 if (index == PROPERTY_INDEX_CELLULAR_ALLOW_ROAMING) {
3227 if (!device->data_roaming_allowed() && IsCellularAlwaysInRoaming()) { 3222 if (!device->data_roaming_allowed() && IsCellularAlwaysInRoaming()) {
3228 SetCellularDataRoamingAllowed(true); 3223 SetCellularDataRoamingAllowed(true);
3229 } else { 3224 } else {
(...skipping 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after
4657 return network_library; 4652 return network_library;
4658 } 4653 }
4659 4654
4660 ///////////////////////////////////////////////////////////////////////////// 4655 /////////////////////////////////////////////////////////////////////////////
4661 4656
4662 } // namespace chromeos 4657 } // namespace chromeos
4663 4658
4664 // Allows InvokeLater without adding refcounting. This class is a Singleton and 4659 // Allows InvokeLater without adding refcounting. This class is a Singleton and
4665 // won't be deleted until its last InvokeLater is run. 4660 // won't be deleted until its last InvokeLater is run.
4666 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImplBase); 4661 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImplBase);
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/network_library.h ('k') | chrome/browser/chromeos/cros/network_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698