| 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 #ifndef CHROMEOS_DBUS_SERVICES_PROXY_RESOLUTION_SERVICE_PROVIDER_H_ | 5 #ifndef CHROMEOS_DBUS_SERVICES_PROXY_RESOLUTION_SERVICE_PROVIDER_H_ |
| 6 #define CHROMEOS_DBUS_SERVICES_PROXY_RESOLUTION_SERVICE_PROVIDER_H_ | 6 #define CHROMEOS_DBUS_SERVICES_PROXY_RESOLUTION_SERVICE_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "chromeos/chromeos_export.h" | 14 #include "chromeos/chromeos_export.h" |
| 15 #include "chromeos/dbus/services/cros_dbus_service.h" | 15 #include "chromeos/dbus/services/cros_dbus_service.h" |
| 16 #include "dbus/exported_object.h" | 16 #include "dbus/exported_object.h" |
| 17 #include "net/base/completion_callback.h" | 17 #include "net/base/completion_callback.h" |
| 18 | 18 |
| 19 class GURL; | |
| 20 | |
| 21 namespace base { | 19 namespace base { |
| 22 class SingleThreadTaskRunner; | 20 class SingleThreadTaskRunner; |
| 23 } | 21 } |
| 24 | 22 |
| 25 namespace dbus { | 23 namespace dbus { |
| 26 class MethodCall; | 24 class MethodCall; |
| 27 } | 25 } |
| 28 | 26 |
| 29 namespace net { | 27 namespace net { |
| 30 class ProxyInfo; | |
| 31 class ProxyService; | |
| 32 class URLRequestContextGetter; | 28 class URLRequestContextGetter; |
| 33 } | 29 } |
| 34 | 30 |
| 35 namespace chromeos { | 31 namespace chromeos { |
| 36 | 32 |
| 37 // This class provides proxy resolution service for CrosDBusService. | 33 // This class provides proxy resolution service for CrosDBusService. |
| 38 // It processes proxy resolution requests for ChromeOS clients. | 34 // It processes proxy resolution requests for ChromeOS clients. |
| 39 // | 35 // |
| 40 // The following method is exported: | 36 // The following method is exported: |
| 41 // | 37 // |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 public: | 71 public: |
| 76 // Delegate interface providing additional resources to | 72 // Delegate interface providing additional resources to |
| 77 // ProxyResolutionServiceProvider. | 73 // ProxyResolutionServiceProvider. |
| 78 class CHROMEOS_EXPORT Delegate { | 74 class CHROMEOS_EXPORT Delegate { |
| 79 public: | 75 public: |
| 80 virtual ~Delegate() {} | 76 virtual ~Delegate() {} |
| 81 | 77 |
| 82 // Returns the request context used to perform proxy resolution. | 78 // Returns the request context used to perform proxy resolution. |
| 83 // Always called on UI thread. | 79 // Always called on UI thread. |
| 84 virtual scoped_refptr<net::URLRequestContextGetter> GetRequestContext() = 0; | 80 virtual scoped_refptr<net::URLRequestContextGetter> GetRequestContext() = 0; |
| 85 | |
| 86 // Thin wrapper around net::ProxyService::ResolveProxy() to make testing | |
| 87 // easier. | |
| 88 virtual int ResolveProxy(net::ProxyService* proxy_service, | |
| 89 const GURL& url, | |
| 90 net::ProxyInfo* results, | |
| 91 const net::CompletionCallback& callback) = 0; | |
| 92 }; | 81 }; |
| 93 | 82 |
| 94 explicit ProxyResolutionServiceProvider(std::unique_ptr<Delegate> delegate); | 83 explicit ProxyResolutionServiceProvider(std::unique_ptr<Delegate> delegate); |
| 95 ~ProxyResolutionServiceProvider() override; | 84 ~ProxyResolutionServiceProvider() override; |
| 96 | 85 |
| 97 // CrosDBusService::ServiceProviderInterface: | 86 // CrosDBusService::ServiceProviderInterface: |
| 98 void Start(scoped_refptr<dbus::ExportedObject> exported_object) override; | 87 void Start(scoped_refptr<dbus::ExportedObject> exported_object) override; |
| 99 | 88 |
| 100 private: | 89 private: |
| 101 // Data used for a single proxy resolution. | 90 // Data used for a single proxy resolution. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 129 scoped_refptr<dbus::ExportedObject> exported_object_; | 118 scoped_refptr<dbus::ExportedObject> exported_object_; |
| 130 scoped_refptr<base::SingleThreadTaskRunner> origin_thread_; | 119 scoped_refptr<base::SingleThreadTaskRunner> origin_thread_; |
| 131 base::WeakPtrFactory<ProxyResolutionServiceProvider> weak_ptr_factory_; | 120 base::WeakPtrFactory<ProxyResolutionServiceProvider> weak_ptr_factory_; |
| 132 | 121 |
| 133 DISALLOW_COPY_AND_ASSIGN(ProxyResolutionServiceProvider); | 122 DISALLOW_COPY_AND_ASSIGN(ProxyResolutionServiceProvider); |
| 134 }; | 123 }; |
| 135 | 124 |
| 136 } // namespace chromeos | 125 } // namespace chromeos |
| 137 | 126 |
| 138 #endif // CHROMEOS_DBUS_SERVICES_PROXY_RESOLUTION_SERVICE_PROVIDER_H_ | 127 #endif // CHROMEOS_DBUS_SERVICES_PROXY_RESOLUTION_SERVICE_PROVIDER_H_ |
| OLD | NEW |