Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_CHROMEOS_DBUS_PROXY_RESOLUTION_SERVICE_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DBUS_PROXY_RESOLUTION_SERVICE_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DBUS_PROXY_RESOLUTION_SERVICE_PROVIDER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DBUS_PROXY_RESOLUTION_SERVICE_PROVIDER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
| 15 #include "base/threading/platform_thread.h" | 15 #include "base/threading/platform_thread.h" |
| 16 #include "chrome/browser/chromeos/dbus/cros_dbus_service.h" | 16 #include "chrome/browser/chromeos/dbus/cros_dbus_service.h" |
| 17 #include "dbus/exported_object.h" | |
| 17 | 18 |
| 18 namespace dbus { | 19 namespace dbus { |
| 19 class ExportedObject; | |
| 20 class MethodCall; | 20 class MethodCall; |
| 21 class Response; | 21 class Response; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace chromeos { | 24 namespace chromeos { |
| 25 | 25 |
| 26 class ProxyResolverInterface; | 26 class ProxyResolverInterface; |
| 27 | 27 |
| 28 // This class provides proxy resolution service for CrosDBusService. | 28 // This class provides proxy resolution service for CrosDBusService. |
| 29 // It processes proxy resolution requests for ChromeOS clients. | 29 // It processes proxy resolution requests for ChromeOS clients. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 | 95 |
| 96 // Called from ExportedObject, when ResolveProxyHandler() is exported as | 96 // Called from ExportedObject, when ResolveProxyHandler() is exported as |
| 97 // a D-Bus method, or failed to be exported. | 97 // a D-Bus method, or failed to be exported. |
| 98 void OnExported(const std::string& interface_name, | 98 void OnExported(const std::string& interface_name, |
| 99 const std::string& method_name, | 99 const std::string& method_name, |
| 100 bool success); | 100 bool success); |
| 101 | 101 |
| 102 // Callback to be invoked when ChromeOS clients send network proxy | 102 // Callback to be invoked when ChromeOS clients send network proxy |
| 103 // resolution requests to the service running in chrome executable. | 103 // resolution requests to the service running in chrome executable. |
| 104 // Called on UI thread from dbus request. | 104 // Called on UI thread from dbus request. |
| 105 dbus::Response* ResolveProxyHandler(dbus::MethodCall* method_call); | 105 void ResolveProxyHandler(dbus::MethodCall* method_call, |
| 106 dbus::ExportedObject::SendResponseCallback send_response_cb); | |
|
satorux1
2011/11/22 06:20:05
cb -> callback, as we generally eschew abbreviatio
Vince Laviano
2011/11/22 22:10:17
Done.
| |
| 106 | 107 |
| 107 // Calls ResolveProxyHandler() if weak_ptr is not NULL. Used to ensure a | 108 // Calls ResolveProxyHandler() if weak_ptr is not NULL. Used to ensure a |
| 108 // safe shutdown. | 109 // safe shutdown. |
| 109 static dbus::Response* CallResolveProxyHandler( | 110 static void CallResolveProxyHandler( |
| 110 base::WeakPtr<ProxyResolutionServiceProvider> weak_ptr, | 111 base::WeakPtr<ProxyResolutionServiceProvider> weak_ptr, |
| 111 dbus::MethodCall* method_call); | 112 dbus::MethodCall* method_call, |
| 113 dbus::ExportedObject::SendResponseCallback send_response_cb); | |
|
satorux1
2011/11/22 06:20:05
ditto
Vince Laviano
2011/11/22 22:10:17
Done.
| |
| 112 | 114 |
| 113 // Returns true if the current thread is on the origin thread. | 115 // Returns true if the current thread is on the origin thread. |
| 114 bool OnOriginThread(); | 116 bool OnOriginThread(); |
| 115 | 117 |
| 116 scoped_refptr<dbus::ExportedObject> exported_object_; | 118 scoped_refptr<dbus::ExportedObject> exported_object_; |
| 117 scoped_ptr<ProxyResolverInterface> resolver_; | 119 scoped_ptr<ProxyResolverInterface> resolver_; |
| 118 base::PlatformThreadId origin_thread_id_; | 120 base::PlatformThreadId origin_thread_id_; |
| 119 base::WeakPtrFactory<ProxyResolutionServiceProvider> weak_ptr_factory_; | 121 base::WeakPtrFactory<ProxyResolutionServiceProvider> weak_ptr_factory_; |
| 120 | 122 |
| 121 DISALLOW_COPY_AND_ASSIGN(ProxyResolutionServiceProvider); | 123 DISALLOW_COPY_AND_ASSIGN(ProxyResolutionServiceProvider); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 138 const std::string& signal_interface, | 140 const std::string& signal_interface, |
| 139 const std::string& signal_name, | 141 const std::string& signal_name, |
| 140 scoped_refptr<dbus::ExportedObject> exported_object) = 0; | 142 scoped_refptr<dbus::ExportedObject> exported_object) = 0; |
| 141 | 143 |
| 142 virtual ~ProxyResolverInterface(); | 144 virtual ~ProxyResolverInterface(); |
| 143 }; | 145 }; |
| 144 | 146 |
| 145 } // namespace chromeos | 147 } // namespace chromeos |
| 146 | 148 |
| 147 #endif // CHROME_BROWSER_CHROMEOS_DBUS_PROXY_RESOLUTION_SERVICE_PROVIDER_H_ | 149 #endif // CHROME_BROWSER_CHROMEOS_DBUS_PROXY_RESOLUTION_SERVICE_PROVIDER_H_ |
| OLD | NEW |