| 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/dbus/services/proxy_resolution_service_provider.h" | 5 #include "chromeos/dbus/services/proxy_resolution_service_provider.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 net::ProxyInfo proxy_info; | 78 net::ProxyInfo proxy_info; |
| 79 | 79 |
| 80 // Error from proxy resolution. | 80 // Error from proxy resolution. |
| 81 std::string error; | 81 std::string error; |
| 82 | 82 |
| 83 private: | 83 private: |
| 84 DISALLOW_COPY_AND_ASSIGN(Request); | 84 DISALLOW_COPY_AND_ASSIGN(Request); |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 ProxyResolutionServiceProvider::ProxyResolutionServiceProvider( | 87 ProxyResolutionServiceProvider::ProxyResolutionServiceProvider( |
| 88 const std::string& dbus_interface, |
| 89 const std::string& dbus_method_name, |
| 88 std::unique_ptr<Delegate> delegate) | 90 std::unique_ptr<Delegate> delegate) |
| 89 : delegate_(std::move(delegate)), | 91 : dbus_interface_(dbus_interface), |
| 92 dbus_method_name_(dbus_method_name), |
| 93 delegate_(std::move(delegate)), |
| 90 origin_thread_(base::ThreadTaskRunnerHandle::Get()), | 94 origin_thread_(base::ThreadTaskRunnerHandle::Get()), |
| 91 weak_ptr_factory_(this) {} | 95 weak_ptr_factory_(this) {} |
| 92 | 96 |
| 93 ProxyResolutionServiceProvider::~ProxyResolutionServiceProvider() { | 97 ProxyResolutionServiceProvider::~ProxyResolutionServiceProvider() { |
| 94 DCHECK(OnOriginThread()); | 98 DCHECK(OnOriginThread()); |
| 95 } | 99 } |
| 96 | 100 |
| 97 void ProxyResolutionServiceProvider::Start( | 101 void ProxyResolutionServiceProvider::Start( |
| 98 scoped_refptr<dbus::ExportedObject> exported_object) { | 102 scoped_refptr<dbus::ExportedObject> exported_object) { |
| 99 DCHECK(OnOriginThread()); | 103 DCHECK(OnOriginThread()); |
| 100 exported_object_ = exported_object; | 104 exported_object_ = exported_object; |
| 101 VLOG(1) << "ProxyResolutionServiceProvider started"; | 105 VLOG(1) << "ProxyResolutionServiceProvider started"; |
| 102 exported_object_->ExportMethod( | 106 exported_object_->ExportMethod( |
| 103 kLibCrosServiceInterface, kResolveNetworkProxy, | 107 dbus_interface_, dbus_method_name_, |
| 104 base::Bind(&ProxyResolutionServiceProvider::ResolveProxy, | 108 base::Bind(&ProxyResolutionServiceProvider::ResolveProxy, |
| 105 weak_ptr_factory_.GetWeakPtr()), | 109 weak_ptr_factory_.GetWeakPtr()), |
| 106 base::Bind(&ProxyResolutionServiceProvider::OnExported, | 110 base::Bind(&ProxyResolutionServiceProvider::OnExported, |
| 107 weak_ptr_factory_.GetWeakPtr())); | 111 weak_ptr_factory_.GetWeakPtr())); |
| 108 } | 112 } |
| 109 | 113 |
| 110 bool ProxyResolutionServiceProvider::OnOriginThread() { | 114 bool ProxyResolutionServiceProvider::OnOriginThread() { |
| 111 return origin_thread_->BelongsToCurrentThread(); | 115 return origin_thread_->BelongsToCurrentThread(); |
| 112 } | 116 } |
| 113 | 117 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 dbus::MessageWriter writer(&signal); | 252 dbus::MessageWriter writer(&signal); |
| 249 writer.AppendString(request->source_url); | 253 writer.AppendString(request->source_url); |
| 250 writer.AppendString(request->proxy_info.ToPacString()); | 254 writer.AppendString(request->proxy_info.ToPacString()); |
| 251 writer.AppendString(request->error); | 255 writer.AppendString(request->error); |
| 252 exported_object_->SendSignal(&signal); | 256 exported_object_->SendSignal(&signal); |
| 253 VLOG(1) << "Sending signal: " << signal.ToString(); | 257 VLOG(1) << "Sending signal: " << signal.ToString(); |
| 254 } | 258 } |
| 255 } | 259 } |
| 256 | 260 |
| 257 } // namespace chromeos | 261 } // namespace chromeos |
| OLD | NEW |