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

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

Issue 23551004: Move Shill property utility functions to a new separate file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 7 years, 3 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 "chromeos/network/network_configuration_handler.h" 5 #include "chromeos/network/network_configuration_handler.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/format_macros.h" 11 #include "base/format_macros.h"
12 #include "base/json/json_writer.h" 12 #include "base/json/json_writer.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/stl_util.h" 16 #include "base/stl_util.h"
17 #include "base/strings/stringprintf.h" 17 #include "base/strings/stringprintf.h"
18 #include "base/values.h" 18 #include "base/values.h"
19 #include "chromeos/dbus/dbus_thread_manager.h" 19 #include "chromeos/dbus/dbus_thread_manager.h"
20 #include "chromeos/dbus/shill_manager_client.h" 20 #include "chromeos/dbus/shill_manager_client.h"
21 #include "chromeos/dbus/shill_profile_client.h" 21 #include "chromeos/dbus/shill_profile_client.h"
22 #include "chromeos/dbus/shill_service_client.h" 22 #include "chromeos/dbus/shill_service_client.h"
23 #include "chromeos/network/network_event_log.h" 23 #include "chromeos/network/network_event_log.h"
24 #include "chromeos/network/network_state.h"
25 #include "chromeos/network/network_state_handler.h" 24 #include "chromeos/network/network_state_handler.h"
25 #include "chromeos/network/shill_property_util.h"
26 #include "dbus/object_path.h" 26 #include "dbus/object_path.h"
27 #include "third_party/cros_system_api/dbus/service_constants.h" 27 #include "third_party/cros_system_api/dbus/service_constants.h"
28 28
29 namespace chromeos { 29 namespace chromeos {
30 30
31 namespace { 31 namespace {
32 32
33 // Strip surrounding "" from keys (if present). 33 // Strip surrounding "" from keys (if present).
34 std::string StripQuotations(const std::string& in_str) { 34 std::string StripQuotations(const std::string& in_str) {
35 size_t len = in_str.length(); 35 size_t len = in_str.length();
(...skipping 14 matching lines...) Expand all
50 } 50 }
51 51
52 void GetPropertiesCallback( 52 void GetPropertiesCallback(
53 const network_handler::DictionaryResultCallback& callback, 53 const network_handler::DictionaryResultCallback& callback,
54 const network_handler::ErrorCallback& error_callback, 54 const network_handler::ErrorCallback& error_callback,
55 const std::string& service_path, 55 const std::string& service_path,
56 DBusMethodCallStatus call_status, 56 DBusMethodCallStatus call_status,
57 const base::DictionaryValue& properties) { 57 const base::DictionaryValue& properties) {
58 // Get the correct name from WifiHex if necessary. 58 // Get the correct name from WifiHex if necessary.
59 scoped_ptr<base::DictionaryValue> properties_copy(properties.DeepCopy()); 59 scoped_ptr<base::DictionaryValue> properties_copy(properties.DeepCopy());
60 std::string name = NetworkState::GetNameFromProperties( 60 std::string name =
61 service_path, properties); 61 shill_property_util::GetNameFromProperties(service_path, properties);
62 if (!name.empty()) { 62 if (!name.empty()) {
63 properties_copy->SetStringWithoutPathExpansion( 63 properties_copy->SetStringWithoutPathExpansion(
64 flimflam::kNameProperty, name); 64 flimflam::kNameProperty, name);
65 } 65 }
66 if (call_status != DBUS_METHOD_CALL_SUCCESS) { 66 if (call_status != DBUS_METHOD_CALL_SUCCESS) {
67 // Because network services are added and removed frequently, we will see 67 // Because network services are added and removed frequently, we will see
68 // failures regularly, so don't log these. 68 // failures regularly, so don't log these.
69 if (!error_callback.is_null()) { 69 if (!error_callback.is_null()) {
70 scoped_ptr<base::DictionaryValue> error_data( 70 scoped_ptr<base::DictionaryValue> error_data(
71 network_handler::CreateErrorData( 71 network_handler::CreateErrorData(
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 451
452 // static 452 // static
453 NetworkConfigurationHandler* NetworkConfigurationHandler::InitializeForTest( 453 NetworkConfigurationHandler* NetworkConfigurationHandler::InitializeForTest(
454 NetworkStateHandler* network_state_handler) { 454 NetworkStateHandler* network_state_handler) {
455 NetworkConfigurationHandler* handler = new NetworkConfigurationHandler(); 455 NetworkConfigurationHandler* handler = new NetworkConfigurationHandler();
456 handler->Init(network_state_handler); 456 handler->Init(network_state_handler);
457 return handler; 457 return handler;
458 } 458 }
459 459
460 } // namespace chromeos 460 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/managed_network_configuration_handler_impl.cc ('k') | chromeos/network/network_connection_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698