| 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 <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/threading/thread_task_runner_handle.h" | 13 #include "base/threading/thread_task_runner_handle.h" |
| 14 #include "dbus/bus.h" | 14 #include "dbus/bus.h" |
| 15 #include "dbus/message.h" | 15 #include "dbus/message.h" |
| 16 #include "net/base/load_flags.h" | |
| 17 #include "net/base/net_errors.h" | 16 #include "net/base/net_errors.h" |
| 18 #include "net/proxy/proxy_service.h" | 17 #include "net/proxy/proxy_service.h" |
| 19 #include "net/url_request/url_request_context.h" | 18 #include "net/url_request/url_request_context.h" |
| 20 #include "net/url_request/url_request_context_getter.h" | 19 #include "net/url_request/url_request_context_getter.h" |
| 21 #include "third_party/cros_system_api/dbus/service_constants.h" | 20 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 22 | 21 |
| 23 namespace chromeos { | 22 namespace chromeos { |
| 24 | 23 |
| 25 // The ProxyResolverInterface implementation used in production. | 24 // The ProxyResolverInterface implementation used in production. |
| 26 class ProxyResolverImpl : public ProxyResolverInterface { | 25 class ProxyResolverImpl : public ProxyResolverInterface { |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 return; | 126 return; |
| 128 } | 127 } |
| 129 | 128 |
| 130 VLOG(1) << "Starting network proxy resolution for " | 129 VLOG(1) << "Starting network proxy resolution for " |
| 131 << request->source_url_; | 130 << request->source_url_; |
| 132 net::CompletionCallback completion_callback = | 131 net::CompletionCallback completion_callback = |
| 133 base::Bind(&Request::OnCompletion, | 132 base::Bind(&Request::OnCompletion, |
| 134 base::Unretained(request), | 133 base::Unretained(request), |
| 135 origin_thread); | 134 origin_thread); |
| 136 const int result = proxy_service->ResolveProxy( | 135 const int result = proxy_service->ResolveProxy( |
| 137 GURL(request->source_url_), std::string(), net::LOAD_NORMAL, | 136 GURL(request->source_url_), std::string(), &request->proxy_info_, |
| 138 &request->proxy_info_, completion_callback, NULL, NULL, | 137 completion_callback, NULL, NULL, net::BoundNetLog()); |
| 139 net::BoundNetLog()); | |
| 140 if (result != net::ERR_IO_PENDING) { | 138 if (result != net::ERR_IO_PENDING) { |
| 141 VLOG(1) << "Network proxy resolution completed synchronously."; | 139 VLOG(1) << "Network proxy resolution completed synchronously."; |
| 142 completion_callback.Run(result); | 140 completion_callback.Run(result); |
| 143 } | 141 } |
| 144 } | 142 } |
| 145 | 143 |
| 146 // Called on UI thread as task posted from Request::OnCompletion on IO | 144 // Called on UI thread as task posted from Request::OnCompletion on IO |
| 147 // thread. | 145 // thread. |
| 148 void NotifyProxyResolved( | 146 void NotifyProxyResolved( |
| 149 const std::string& signal_interface, | 147 const std::string& signal_interface, |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 ProxyResolutionServiceProvider* ProxyResolutionServiceProvider::Create( | 268 ProxyResolutionServiceProvider* ProxyResolutionServiceProvider::Create( |
| 271 std::unique_ptr<ProxyResolverDelegate> delegate) { | 269 std::unique_ptr<ProxyResolverDelegate> delegate) { |
| 272 return new ProxyResolutionServiceProvider( | 270 return new ProxyResolutionServiceProvider( |
| 273 new ProxyResolverImpl(std::move(delegate))); | 271 new ProxyResolverImpl(std::move(delegate))); |
| 274 } | 272 } |
| 275 | 273 |
| 276 ProxyResolverInterface::~ProxyResolverInterface() { | 274 ProxyResolverInterface::~ProxyResolverInterface() { |
| 277 } | 275 } |
| 278 | 276 |
| 279 } // namespace chromeos | 277 } // namespace chromeos |
| OLD | NEW |