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

Side by Side Diff: chrome/browser/extensions/extension_function_dispatcher.h

Issue 105553005: Make PepperWebPlugin not use RenderViews. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: review comments Created 7 years 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) 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 CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "extensions/browser/extension_function.h" 13 #include "extensions/browser/extension_function.h"
14 #include "ipc/ipc_sender.h" 14 #include "ipc/ipc_sender.h"
15 #include "url/gurl.h" 15 #include "url/gurl.h"
16 16
17 class ChromeRenderMessageFilter; 17 class ChromeRenderMessageFilter;
18 struct ExtensionHostMsg_Request_Params; 18 struct ExtensionHostMsg_Request_Params;
19 19
20 namespace content { 20 namespace content {
21 class BrowserContext; 21 class BrowserContext;
22 class RenderFrameHost;
22 class RenderViewHost; 23 class RenderViewHost;
23 class WebContents; 24 class WebContents;
24 } 25 }
25 26
26 namespace extensions { 27 namespace extensions {
27 class Extension; 28 class Extension;
28 class ExtensionAPI; 29 class ExtensionAPI;
29 class InfoMap; 30 class InfoMap;
30 class ProcessMap; 31 class ProcessMap;
31 class WindowController; 32 class WindowController;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 ExtensionFunctionDispatcher(content::BrowserContext* browser_context, 100 ExtensionFunctionDispatcher(content::BrowserContext* browser_context,
100 Delegate* delegate); 101 Delegate* delegate);
101 102
102 ~ExtensionFunctionDispatcher(); 103 ~ExtensionFunctionDispatcher();
103 104
104 Delegate* delegate() { return delegate_; } 105 Delegate* delegate() { return delegate_; }
105 106
106 // Message handlers. 107 // Message handlers.
107 // The response is sent to the corresponding render view in an 108 // The response is sent to the corresponding render view in an
108 // ExtensionMsg_Response message. 109 // ExtensionMsg_Response message.
110 // TODO (jam): convert all callers to use RenderFrameHost.
109 void Dispatch(const ExtensionHostMsg_Request_Params& params, 111 void Dispatch(const ExtensionHostMsg_Request_Params& params,
110 content::RenderViewHost* render_view_host); 112 content::RenderViewHost* render_view_host);
111 // |callback| is called when the function execution completes. 113 // Dispatch an extension function and calls |callback| when the execution
114 // completes.
112 void DispatchWithCallback( 115 void DispatchWithCallback(
113 const ExtensionHostMsg_Request_Params& params, 116 const ExtensionHostMsg_Request_Params& params,
114 content::RenderViewHost* render_view_host, 117 content::RenderFrameHost* render_frame_host,
115 const ExtensionFunction::ResponseCallback& callback); 118 const ExtensionFunction::ResponseCallback& callback);
116 119
117 // Called when an ExtensionFunction is done executing, after it has sent 120 // Called when an ExtensionFunction is done executing, after it has sent
118 // a response (if any) to the extension. 121 // a response (if any) to the extension.
119 void OnExtensionFunctionCompleted(const extensions::Extension* extension); 122 void OnExtensionFunctionCompleted(const extensions::Extension* extension);
120 123
121 // The BrowserContext that this dispatcher is associated with. 124 // The BrowserContext that this dispatcher is associated with.
122 content::BrowserContext* browser_context() { return browser_context_; } 125 content::BrowserContext* browser_context() { return browser_context_; }
123 126
124 private: 127 private:
(...skipping 24 matching lines...) Expand all
149 const extensions::ProcessMap& process_map, 152 const extensions::ProcessMap& process_map,
150 extensions::ExtensionAPI* api, 153 extensions::ExtensionAPI* api,
151 void* profile, 154 void* profile,
152 const ExtensionFunction::ResponseCallback& callback); 155 const ExtensionFunction::ResponseCallback& callback);
153 156
154 // Helper to run the response callback with an access denied error. Can be 157 // Helper to run the response callback with an access denied error. Can be
155 // called on any thread. 158 // called on any thread.
156 static void SendAccessDenied( 159 static void SendAccessDenied(
157 const ExtensionFunction::ResponseCallback& callback); 160 const ExtensionFunction::ResponseCallback& callback);
158 161
162 void DispatchWithCallbackInternal(
163 const ExtensionHostMsg_Request_Params& params,
164 content::RenderViewHost* render_view_host,
165 content::RenderFrameHost* render_frame_host,
166 const ExtensionFunction::ResponseCallback& callback);
167
159 content::BrowserContext* browser_context_; 168 content::BrowserContext* browser_context_;
160 169
161 Delegate* delegate_; 170 Delegate* delegate_;
162 171
163 // This map doesn't own either the keys or the values. When a RenderViewHost 172 // This map doesn't own either the keys or the values. When a RenderViewHost
164 // instance goes away, the corresponding entry in this map (if exists) will be 173 // instance goes away, the corresponding entry in this map (if exists) will be
165 // removed. 174 // removed.
166 typedef std::map<content::RenderViewHost*, UIThreadResponseCallbackWrapper*> 175 typedef std::map<content::RenderViewHost*, UIThreadResponseCallbackWrapper*>
167 UIThreadResponseCallbackWrapperMap; 176 UIThreadResponseCallbackWrapperMap;
168 UIThreadResponseCallbackWrapperMap ui_thread_response_callback_wrappers_; 177 UIThreadResponseCallbackWrapperMap ui_thread_response_callback_wrappers_;
169 }; 178 };
170 179
171 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ 180 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698