Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1680)

Side by Side Diff: chrome/browser/chromeos/dbus/proxy_resolution_service_provider.h

Issue 8637002: chrome: dbus: support asynchronous method replies (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address satorux@ review comments Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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::ResponseSender response_sender);
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::ResponseSender response_sender);
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
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_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/dbus/proxy_resolution_service_provider.cc » ('j') | dbus/bus.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698