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 "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/logging.h" | 11 #include "base/logging.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "chromeos/dbus/dbus_method_call_status.h" | 15 #include "chromeos/dbus/dbus_method_call_status.h" |
16 #include "chromeos/dbus/dbus_thread_manager.h" | 16 #include "chromeos/dbus/dbus_thread_manager.h" |
17 #include "chromeos/dbus/shill_manager_client.h" | 17 #include "chromeos/dbus/shill_manager_client.h" |
18 #include "chromeos/dbus/shill_service_client.h" | 18 #include "chromeos/dbus/shill_service_client.h" |
| 19 #include "chromeos/network/network_state_handler.h" |
19 #include "dbus/object_path.h" | 20 #include "dbus/object_path.h" |
20 #include "third_party/cros_system_api/dbus/service_constants.h" | 21 #include "third_party/cros_system_api/dbus/service_constants.h" |
21 | 22 |
22 namespace chromeos { | 23 namespace chromeos { |
23 | 24 |
24 namespace { | 25 namespace { |
25 | 26 |
26 NetworkConfigurationHandler* g_configuration_handler_instance = NULL; | 27 NetworkConfigurationHandler* g_configuration_handler_instance = NULL; |
27 | 28 |
28 // None of these error messages are user-facing: they should only appear in | 29 // None of these error messages are user-facing: they should only appear in |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 error_callback.Run(kDBusFailedError, error_data.Pass()); | 90 error_callback.Run(kDBusFailedError, error_data.Pass()); |
90 } else { | 91 } else { |
91 callback.Run(service_path, value); | 92 callback.Run(service_path, value); |
92 } | 93 } |
93 } | 94 } |
94 | 95 |
95 void RunCreateNetworkCallback( | 96 void RunCreateNetworkCallback( |
96 const network_handler::StringResultCallback& callback, | 97 const network_handler::StringResultCallback& callback, |
97 const dbus::ObjectPath& service_path) { | 98 const dbus::ObjectPath& service_path) { |
98 callback.Run(service_path.value()); | 99 callback.Run(service_path.value()); |
| 100 // This may also get called when CreateConfiguration is used to update an |
| 101 // existing configuration, so request a service update just in case. |
| 102 // TODO(pneubeck): Separate 'Create' and 'Update' calls and only trigger |
| 103 // this on an update. |
| 104 NetworkStateHandler::Get()->RequestUpdateForNetwork(service_path.value()); |
99 } | 105 } |
100 | 106 |
101 void IgnoreObjectPathCallback(const base::Closure& callback, | 107 void IgnoreObjectPathCallback(const base::Closure& callback, |
102 const dbus::ObjectPath& object_path) { | 108 const dbus::ObjectPath& object_path) { |
103 callback.Run(); | 109 callback.Run(); |
104 } | 110 } |
105 | 111 |
106 } // namespace | 112 } // namespace |
107 | 113 |
108 // static | 114 // static |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 void NetworkConfigurationHandler::SetProperties( | 146 void NetworkConfigurationHandler::SetProperties( |
141 const std::string& service_path, | 147 const std::string& service_path, |
142 const base::DictionaryValue& properties, | 148 const base::DictionaryValue& properties, |
143 const base::Closure& callback, | 149 const base::Closure& callback, |
144 const network_handler::ErrorCallback& error_callback) const { | 150 const network_handler::ErrorCallback& error_callback) const { |
145 DBusThreadManager::Get()->GetShillManagerClient()->ConfigureService( | 151 DBusThreadManager::Get()->GetShillManagerClient()->ConfigureService( |
146 properties, | 152 properties, |
147 base::Bind(&IgnoreObjectPathCallback, callback), | 153 base::Bind(&IgnoreObjectPathCallback, callback), |
148 base::Bind(&network_handler::ShillErrorCallbackFunction, | 154 base::Bind(&network_handler::ShillErrorCallbackFunction, |
149 service_path, error_callback)); | 155 service_path, error_callback)); |
| 156 NetworkStateHandler::Get()->RequestUpdateForNetwork(service_path); |
150 } | 157 } |
151 | 158 |
152 void NetworkConfigurationHandler::ClearProperties( | 159 void NetworkConfigurationHandler::ClearProperties( |
153 const std::string& service_path, | 160 const std::string& service_path, |
154 const std::vector<std::string>& names, | 161 const std::vector<std::string>& names, |
155 const base::Closure& callback, | 162 const base::Closure& callback, |
156 const network_handler::ErrorCallback& error_callback) { | 163 const network_handler::ErrorCallback& error_callback) { |
157 DBusThreadManager::Get()->GetShillServiceClient()->ClearProperties( | 164 DBusThreadManager::Get()->GetShillServiceClient()->ClearProperties( |
158 dbus::ObjectPath(service_path), | 165 dbus::ObjectPath(service_path), |
159 names, | 166 names, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 service_path, error_callback)); | 216 service_path, error_callback)); |
210 } | 217 } |
211 | 218 |
212 NetworkConfigurationHandler::NetworkConfigurationHandler() { | 219 NetworkConfigurationHandler::NetworkConfigurationHandler() { |
213 } | 220 } |
214 | 221 |
215 NetworkConfigurationHandler::~NetworkConfigurationHandler() { | 222 NetworkConfigurationHandler::~NetworkConfigurationHandler() { |
216 } | 223 } |
217 | 224 |
218 } // namespace chromeos | 225 } // namespace chromeos |
OLD | NEW |