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

Side by Side Diff: extensions/renderer/dispatcher.h

Issue 1880933002: Begin to enable extension APIs in Extension Service Worker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync @tott Created 4 years, 6 months 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
« no previous file with comments | « extensions/renderer/console.cc ('k') | extensions/renderer/dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 EXTENSIONS_RENDERER_DISPATCHER_H_ 5 #ifndef EXTENSIONS_RENDERER_DISPATCHER_H_
6 #define EXTENSIONS_RENDERER_DISPATCHER_H_ 6 #define EXTENSIONS_RENDERER_DISPATCHER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 void OnRenderFrameCreated(content::RenderFrame* render_frame); 88 void OnRenderFrameCreated(content::RenderFrame* render_frame);
89 89
90 bool IsExtensionActive(const std::string& extension_id) const; 90 bool IsExtensionActive(const std::string& extension_id) const;
91 91
92 void DidCreateScriptContext(blink::WebLocalFrame* frame, 92 void DidCreateScriptContext(blink::WebLocalFrame* frame,
93 const v8::Local<v8::Context>& context, 93 const v8::Local<v8::Context>& context,
94 int extension_group, 94 int extension_group,
95 int world_id); 95 int world_id);
96 96
97 // Runs on a different thread and should not use any member variables. 97 // Runs on a different thread and should only use thread safe member
98 static void DidInitializeServiceWorkerContextOnWorkerThread( 98 // variables.
99 void DidInitializeServiceWorkerContextOnWorkerThread(
99 v8::Local<v8::Context> v8_context, 100 v8::Local<v8::Context> v8_context,
101 int embedded_worker_id,
100 const GURL& url); 102 const GURL& url);
101 103
102 void WillReleaseScriptContext(blink::WebLocalFrame* frame, 104 void WillReleaseScriptContext(blink::WebLocalFrame* frame,
103 const v8::Local<v8::Context>& context, 105 const v8::Local<v8::Context>& context,
104 int world_id); 106 int world_id);
105 107
106 // Runs on a different thread and should not use any member variables. 108 // Runs on a different thread and should not use any member variables.
107 static void WillDestroyServiceWorkerContextOnWorkerThread( 109 static void WillDestroyServiceWorkerContextOnWorkerThread(
108 v8::Local<v8::Context> v8_context, 110 v8::Local<v8::Context> v8_context,
111 int embedded_worker_id,
109 const GURL& url); 112 const GURL& url);
110 113
111 // This method is not allowed to run JavaScript code in the frame. 114 // This method is not allowed to run JavaScript code in the frame.
112 void DidCreateDocumentElement(blink::WebLocalFrame* frame); 115 void DidCreateDocumentElement(blink::WebLocalFrame* frame);
113 116
114 // These methods may run (untrusted) JavaScript code in the frame, and 117 // These methods may run (untrusted) JavaScript code in the frame, and
115 // cause |render_frame| to become invalid. 118 // cause |render_frame| to become invalid.
116 void RunScriptsAtDocumentStart(content::RenderFrame* render_frame); 119 void RunScriptsAtDocumentStart(content::RenderFrame* render_frame);
117 void RunScriptsAtDocumentEnd(content::RenderFrame* render_frame); 120 void RunScriptsAtDocumentEnd(content::RenderFrame* render_frame);
118 121
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 219
217 // Adds or removes bindings for every context belonging to |extension_id|, or 220 // Adds or removes bindings for every context belonging to |extension_id|, or
218 // or all contexts if |extension_id| is empty. 221 // or all contexts if |extension_id| is empty.
219 void UpdateBindings(const std::string& extension_id); 222 void UpdateBindings(const std::string& extension_id);
220 223
221 void UpdateBindingsForContext(ScriptContext* context); 224 void UpdateBindingsForContext(ScriptContext* context);
222 225
223 void RegisterBinding(const std::string& api_name, ScriptContext* context); 226 void RegisterBinding(const std::string& api_name, ScriptContext* context);
224 227
225 void RegisterNativeHandlers(ModuleSystem* module_system, 228 void RegisterNativeHandlers(ModuleSystem* module_system,
226 ScriptContext* context); 229 ScriptContext* context,
230 RequestSender* request_sender,
231 V8SchemaRegistry* v8_schema_registry);
227 232
228 // Determines if a ScriptContext can connect to any externally_connectable- 233 // Determines if a ScriptContext can connect to any externally_connectable-
229 // enabled extension. 234 // enabled extension.
230 bool IsRuntimeAvailableToContext(ScriptContext* context); 235 bool IsRuntimeAvailableToContext(ScriptContext* context);
231 236
232 // Updates a web page context with any content capabilities granted by active 237 // Updates a web page context with any content capabilities granted by active
233 // extensions. 238 // extensions.
234 void UpdateContentCapabilities(ScriptContext* context); 239 void UpdateContentCapabilities(ScriptContext* context);
235 240
236 // Inserts static source code into |source_map_|. 241 // Inserts static source code into |source_map_|.
237 void PopulateSourceMap(); 242 void PopulateSourceMap();
238 243
239 // Returns whether the current renderer hosts a platform app. 244 // Returns whether the current renderer hosts a platform app.
240 bool IsWithinPlatformApp(); 245 bool IsWithinPlatformApp();
241 246
242 // Gets |field| from |object| or creates it as an empty object if it doesn't 247 // Gets |field| from |object| or creates it as an empty object if it doesn't
243 // exist. 248 // exist.
244 v8::Local<v8::Object> GetOrCreateObject(const v8::Local<v8::Object>& object, 249 static v8::Local<v8::Object> GetOrCreateObject(
245 const std::string& field, 250 const v8::Local<v8::Object>& object,
246 v8::Isolate* isolate); 251 const std::string& field,
252 v8::Isolate* isolate);
247 253
248 v8::Local<v8::Object> GetOrCreateBindObjectIfAvailable( 254 static v8::Local<v8::Object> GetOrCreateBindObjectIfAvailable(
249 const std::string& api_name, 255 const std::string& api_name,
250 std::string* bind_name, 256 std::string* bind_name,
251 ScriptContext* context); 257 ScriptContext* context);
252 258
253 // Requires the GuestView modules in the module system of the ScriptContext 259 // Requires the GuestView modules in the module system of the ScriptContext
254 // |context|. 260 // |context|.
255 void RequireGuestViewModules(ScriptContext* context); 261 void RequireGuestViewModules(ScriptContext* context);
256 262
257 // The delegate for this dispatcher. Not owned, but must extend beyond the 263 // The delegate for this dispatcher. Not owned, but must extend beyond the
258 // Dispatcher's own lifetime. 264 // Dispatcher's own lifetime.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 // if this renderer is a WebView guest render process. Otherwise, this will be 315 // if this renderer is a WebView guest render process. Otherwise, this will be
310 // empty. 316 // empty.
311 std::string webview_partition_id_; 317 std::string webview_partition_id_;
312 318
313 DISALLOW_COPY_AND_ASSIGN(Dispatcher); 319 DISALLOW_COPY_AND_ASSIGN(Dispatcher);
314 }; 320 };
315 321
316 } // namespace extensions 322 } // namespace extensions
317 323
318 #endif // EXTENSIONS_RENDERER_DISPATCHER_H_ 324 #endif // EXTENSIONS_RENDERER_DISPATCHER_H_
OLDNEW
« no previous file with comments | « extensions/renderer/console.cc ('k') | extensions/renderer/dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698