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

Side by Side Diff: chromeos/network/shill_property_handler.cc

Issue 275543005: Use GUID instead of ServicePath in networkingPrivate API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 7 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
« no previous file with comments | « chromeos/network/network_util.cc ('k') | components/wifi/fake_wifi_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chromeos/network/shill_property_handler.h" 5 #include "chromeos/network/shill_property_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/format_macros.h" 8 #include "base/format_macros.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 std::set<std::string> new_requested_updates; 346 std::set<std::string> new_requested_updates;
347 NET_LOG_DEBUG( 347 NET_LOG_DEBUG(
348 base::StringPrintf("UpdateProperties: %" PRIuS, entries.GetSize()), 348 base::StringPrintf("UpdateProperties: %" PRIuS, entries.GetSize()),
349 ManagedState::TypeToString(type)); 349 ManagedState::TypeToString(type));
350 for (base::ListValue::const_iterator iter = entries.begin(); 350 for (base::ListValue::const_iterator iter = entries.begin();
351 iter != entries.end(); ++iter) { 351 iter != entries.end(); ++iter) {
352 std::string path; 352 std::string path;
353 (*iter)->GetAsString(&path); 353 (*iter)->GetAsString(&path);
354 if (path.empty()) 354 if (path.empty())
355 continue; 355 continue;
356 // Only request properties once. Favorites that are visible will be updated
357 // when the Network entry is updated. Since 'Services' is always processed
358 // before ServiceCompleteList, only Favorites that are not visible will be
359 // requested here, and GetPropertiesCallback() will only get called with
360 // type == FAVORITE for non-visible Favorites.
356 if (type == ManagedState::MANAGED_TYPE_FAVORITE && 361 if (type == ManagedState::MANAGED_TYPE_FAVORITE &&
357 requested_service_updates.count(path) > 0) 362 requested_service_updates.count(path) > 0) {
358 continue; // Update already requested 363 continue;
364 }
359 365
360 // We add a special case for devices here to work around an issue in shill 366 // We add a special case for devices here to work around an issue in shill
361 // that prevents it from sending property changed signals for cellular 367 // that prevents it from sending property changed signals for cellular
362 // devices (see crbug.com/321854). 368 // devices (see crbug.com/321854).
363 if (type == ManagedState::MANAGED_TYPE_DEVICE || 369 if (type == ManagedState::MANAGED_TYPE_DEVICE ||
364 requested_updates.find(path) == requested_updates.end()) 370 requested_updates.find(path) == requested_updates.end())
365 RequestProperties(type, path); 371 RequestProperties(type, path);
366 new_requested_updates.insert(path); 372 new_requested_updates.insert(path);
367 } 373 }
368 requested_updates.swap(new_requested_updates); 374 requested_updates.swap(new_requested_updates);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 NET_LOG_DEBUG("GetPropertiesCallback: " + ManagedState::TypeToString(type), 476 NET_LOG_DEBUG("GetPropertiesCallback: " + ManagedState::TypeToString(type),
471 path); 477 path);
472 pending_updates_[type].erase(path); 478 pending_updates_[type].erase(path);
473 if (call_status != DBUS_METHOD_CALL_SUCCESS) { 479 if (call_status != DBUS_METHOD_CALL_SUCCESS) {
474 // The shill service no longer exists. This can happen when a network 480 // The shill service no longer exists. This can happen when a network
475 // has been removed. 481 // has been removed.
476 NET_LOG_DEBUG("Failed to get properties", 482 NET_LOG_DEBUG("Failed to get properties",
477 base::StringPrintf("%s: %d", path.c_str(), call_status)); 483 base::StringPrintf("%s: %d", path.c_str(), call_status));
478 return; 484 return;
479 } 485 }
480 // Update Favorite properties for networks in the Services list. 486 // Update Favorite properties for networks in the Services list. Call this
487 // for all networks, regardless of whether or not Profile is set, because
488 // we track all networks in the Favorites list (even if they aren't saved
489 // in a Profile). See notes in UpdateProperties() and favorite_state.h.
481 if (type == ManagedState::MANAGED_TYPE_NETWORK) { 490 if (type == ManagedState::MANAGED_TYPE_NETWORK) {
482 // Only networks with a ProfilePath set are Favorites. 491 listener_->UpdateManagedStateProperties(
483 std::string profile_path; 492 ManagedState::MANAGED_TYPE_FAVORITE, path, properties);
484 properties.GetStringWithoutPathExpansion(
485 shill::kProfileProperty, &profile_path);
486 if (!profile_path.empty()) {
487 listener_->UpdateManagedStateProperties(
488 ManagedState::MANAGED_TYPE_FAVORITE, path, properties);
489 }
490 } 493 }
491 listener_->UpdateManagedStateProperties(type, path, properties); 494 listener_->UpdateManagedStateProperties(type, path, properties);
492 495
493 if (type == ManagedState::MANAGED_TYPE_NETWORK) { 496 if (type == ManagedState::MANAGED_TYPE_NETWORK) {
494 // Request IPConfig properties. 497 // Request IPConfig properties.
495 const base::Value* value; 498 const base::Value* value;
496 if (properties.GetWithoutPathExpansion(shill::kIPConfigProperty, &value)) 499 if (properties.GetWithoutPathExpansion(shill::kIPConfigProperty, &value))
497 RequestIPConfig(type, path, *value); 500 RequestIPConfig(type, path, *value);
498 } else if (type == ManagedState::MANAGED_TYPE_DEVICE) { 501 } else if (type == ManagedState::MANAGED_TYPE_DEVICE) {
499 // Clear and request IPConfig properties for each entry in IPConfigs. 502 // Clear and request IPConfig properties for each entry in IPConfigs.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 NET_LOG_ERROR("Failed to get IP Config properties", 577 NET_LOG_ERROR("Failed to get IP Config properties",
575 base::StringPrintf("%s: %d", path.c_str(), call_status)); 578 base::StringPrintf("%s: %d", path.c_str(), call_status));
576 return; 579 return;
577 } 580 }
578 NET_LOG_EVENT("IP Config properties received", path); 581 NET_LOG_EVENT("IP Config properties received", path);
579 listener_->UpdateIPConfigProperties(type, path, ip_config_path, properties); 582 listener_->UpdateIPConfigProperties(type, path, ip_config_path, properties);
580 } 583 }
581 584
582 } // namespace internal 585 } // namespace internal
583 } // namespace chromeos 586 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/network_util.cc ('k') | components/wifi/fake_wifi_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698