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 "chrome/browser/chromeos/dbus/proxy_resolution_service_provider.h" | 5 #include "chrome/browser/chromeos/dbus/proxy_resolution_service_provider.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/threading/platform_thread.h" | 9 #include "base/threading/platform_thread.h" |
10 #include "chrome/browser/profiles/profile_manager.h" | 10 #include "chrome/browser/profiles/profile_manager.h" |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 VLOG(1) << "Handing method call: " << method_call->ToString(); | 232 VLOG(1) << "Handing method call: " << method_call->ToString(); |
233 // The method call should contain the three string parameters. | 233 // The method call should contain the three string parameters. |
234 dbus::MessageReader reader(method_call); | 234 dbus::MessageReader reader(method_call); |
235 std::string source_url; | 235 std::string source_url; |
236 std::string signal_interface; | 236 std::string signal_interface; |
237 std::string signal_name; | 237 std::string signal_name; |
238 if (!reader.PopString(&source_url) || | 238 if (!reader.PopString(&source_url) || |
239 !reader.PopString(&signal_interface) || | 239 !reader.PopString(&signal_interface) || |
240 !reader.PopString(&signal_name)) { | 240 !reader.PopString(&signal_name)) { |
241 LOG(ERROR) << "Unexpected method call: " << method_call->ToString(); | 241 LOG(ERROR) << "Unexpected method call: " << method_call->ToString(); |
242 response_sender.Run(NULL); | 242 response_sender.Run(scoped_ptr<dbus::Response>()); |
243 return; | 243 return; |
244 } | 244 } |
245 | 245 |
246 resolver_->ResolveProxy(source_url, | 246 resolver_->ResolveProxy(source_url, |
247 signal_interface, | 247 signal_interface, |
248 signal_name, | 248 signal_name, |
249 exported_object_); | 249 exported_object_); |
250 | 250 |
251 // Send an empty response for now. We'll send a signal once the network proxy | 251 // Send an empty response for now. We'll send a signal once the network proxy |
252 // resolution is completed. | 252 // resolution is completed. |
253 dbus::Response* response = dbus::Response::FromMethodCall(method_call); | 253 response_sender.Run(dbus::Response::FromMethodCall(method_call)); |
254 response_sender.Run(response); | |
255 } | 254 } |
256 | 255 |
257 // static | 256 // static |
258 void ProxyResolutionServiceProvider::CallResolveProxyHandler( | 257 void ProxyResolutionServiceProvider::CallResolveProxyHandler( |
259 base::WeakPtr<ProxyResolutionServiceProvider> provider_weak_ptr, | 258 base::WeakPtr<ProxyResolutionServiceProvider> provider_weak_ptr, |
260 dbus::MethodCall* method_call, | 259 dbus::MethodCall* method_call, |
261 dbus::ExportedObject::ResponseSender response_sender) { | 260 dbus::ExportedObject::ResponseSender response_sender) { |
262 if (!provider_weak_ptr) { | 261 if (!provider_weak_ptr) { |
263 LOG(WARNING) << "Called after the object is deleted"; | 262 LOG(WARNING) << "Called after the object is deleted"; |
264 response_sender.Run(NULL); | 263 response_sender.Run(scoped_ptr<dbus::Response>()); |
265 return; | 264 return; |
266 } | 265 } |
267 provider_weak_ptr->ResolveProxyHandler(method_call, response_sender); | 266 provider_weak_ptr->ResolveProxyHandler(method_call, response_sender); |
268 } | 267 } |
269 | 268 |
270 ProxyResolutionServiceProvider* ProxyResolutionServiceProvider::Create() { | 269 ProxyResolutionServiceProvider* ProxyResolutionServiceProvider::Create() { |
271 return new ProxyResolutionServiceProvider(new ProxyResolverImpl); | 270 return new ProxyResolutionServiceProvider(new ProxyResolverImpl); |
272 } | 271 } |
273 | 272 |
274 ProxyResolutionServiceProvider* | 273 ProxyResolutionServiceProvider* |
275 ProxyResolutionServiceProvider::CreateForTesting( | 274 ProxyResolutionServiceProvider::CreateForTesting( |
276 ProxyResolverInterface* resolver) { | 275 ProxyResolverInterface* resolver) { |
277 return new ProxyResolutionServiceProvider(resolver); | 276 return new ProxyResolutionServiceProvider(resolver); |
278 } | 277 } |
279 | 278 |
280 ProxyResolverInterface::~ProxyResolverInterface() { | 279 ProxyResolverInterface::~ProxyResolverInterface() { |
281 } | 280 } |
282 | 281 |
283 } // namespace chromeos | 282 } // namespace chromeos |
OLD | NEW |