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

Side by Side Diff: chrome/renderer/extensions/extension_dispatcher.h

Issue 9386001: Implement a module system for the extension bindings JS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 9 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 | 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_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_ 5 #ifndef CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_
6 #define CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_ 6 #define CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/shared_memory.h" 13 #include "base/shared_memory.h"
14 #include "base/timer.h" 14 #include "base/timer.h"
15 #include "content/public/renderer/render_process_observer.h" 15 #include "content/public/renderer/render_process_observer.h"
16 #include "chrome/common/extensions/extension_set.h" 16 #include "chrome/common/extensions/extension_set.h"
17 #include "chrome/renderer/extensions/chrome_v8_context_set.h" 17 #include "chrome/renderer/extensions/chrome_v8_context_set.h"
18 #include "chrome/renderer/resource_bundle_source_map.h"
18 #include "v8/include/v8.h" 19 #include "v8/include/v8.h"
19 20
21 class ModuleSystem;
20 class GURL; 22 class GURL;
21 class URLPattern; 23 class URLPattern;
22 class UserScriptSlave; 24 class UserScriptSlave;
23 struct ExtensionMsg_Loaded_Params; 25 struct ExtensionMsg_Loaded_Params;
24 26
25 namespace WebKit { 27 namespace WebKit {
26 class WebFrame; 28 class WebFrame;
27 } 29 }
28 30
29 namespace base { 31 namespace base {
(...skipping 18 matching lines...) Expand all
48 bool is_extension_process() const { return is_extension_process_; } 50 bool is_extension_process() const { return is_extension_process_; }
49 const ExtensionSet* extensions() const { return &extensions_; } 51 const ExtensionSet* extensions() const { return &extensions_; }
50 const ChromeV8ContextSet& v8_context_set() const { 52 const ChromeV8ContextSet& v8_context_set() const {
51 return v8_context_set_; 53 return v8_context_set_;
52 } 54 }
53 UserScriptSlave* user_script_slave() { return user_script_slave_.get(); } 55 UserScriptSlave* user_script_slave() { return user_script_slave_.get(); }
54 56
55 bool IsApplicationActive(const std::string& extension_id) const; 57 bool IsApplicationActive(const std::string& extension_id) const;
56 bool IsExtensionActive(const std::string& extension_id) const; 58 bool IsExtensionActive(const std::string& extension_id) const;
57 59
60 // Whether or not we should set up custom bindings for this api.
61 bool AllowCustomAPI(WebKit::WebFrame* frame,
62 const std::string& custom_binding_api_name,
63 int world_id);
64
58 // See WebKit::WebPermissionClient::allowScriptExtension 65 // See WebKit::WebPermissionClient::allowScriptExtension
59 // TODO(koz): Remove once WebKit no longer calls this. 66 // TODO(koz): Remove once WebKit no longer calls this.
60 bool AllowScriptExtension(WebKit::WebFrame* frame, 67 bool AllowScriptExtension(WebKit::WebFrame* frame,
61 const std::string& v8_extension_name, 68 const std::string& v8_extension_name,
62 int extension_group); 69 int extension_group);
63 70
71 // TODO(koz): Remove once WebKit no longer calls this.
64 bool AllowScriptExtension(WebKit::WebFrame* frame, 72 bool AllowScriptExtension(WebKit::WebFrame* frame,
65 const std::string& v8_extension_name, 73 const std::string& v8_extension_name,
66 int extension_group, 74 int extension_group,
67 int world_id); 75 int world_id);
68 76
69 void DidCreateScriptContext(WebKit::WebFrame* frame, 77 void DidCreateScriptContext(WebKit::WebFrame* frame,
70 v8::Handle<v8::Context> context, 78 v8::Handle<v8::Context> context,
71 int extension_group, 79 int extension_group,
72 int world_id); 80 int world_id);
73 void WillReleaseScriptContext(WebKit::WebFrame* frame, 81 void WillReleaseScriptContext(WebKit::WebFrame* frame,
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 // Calls RenderThread's RegisterExtension and keeps tracks of which v8 138 // Calls RenderThread's RegisterExtension and keeps tracks of which v8
131 // extension is for Chrome Extensions only. 139 // extension is for Chrome Extensions only.
132 void RegisterExtension(v8::Extension* extension, bool restrict_to_extensions); 140 void RegisterExtension(v8::Extension* extension, bool restrict_to_extensions);
133 141
134 // Sets up the host permissions for |extension|. 142 // Sets up the host permissions for |extension|.
135 void InitOriginPermissions(const Extension* extension); 143 void InitOriginPermissions(const Extension* extension);
136 void UpdateOriginPermissions(UpdatedExtensionPermissionsInfo::Reason reason, 144 void UpdateOriginPermissions(UpdatedExtensionPermissionsInfo::Reason reason,
137 const Extension* extension, 145 const Extension* extension,
138 const URLPatternSet& origins); 146 const URLPatternSet& origins);
139 147
148 void RegisterNativeHandlers(ModuleSystem* module_system,
149 ChromeV8Context* context);
150
151 // Inserts static source code into |source_map_|.
152 void PopulateSourceMap();
153
140 // Finds the extension ID for the current context. This is determined from 154 // Finds the extension ID for the current context. This is determined from
141 // |world_id| if it's non-zero, or the URL in |frame| if it is. 155 // |world_id| if it's non-zero, or the URL in |frame| if it is.
142 std::string GetExtensionID(WebKit::WebFrame* frame, int world_id); 156 std::string GetExtensionID(WebKit::WebFrame* frame, int world_id);
143 157
144 // True if this renderer is running extensions. 158 // True if this renderer is running extensions.
145 bool is_extension_process_; 159 bool is_extension_process_;
146 160
147 // Contains all loaded extensions. This is essentially the renderer 161 // Contains all loaded extensions. This is essentially the renderer
148 // counterpart to ExtensionService in the browser. It contains information 162 // counterpart to ExtensionService in the browser. It contains information
149 // about all extensions currently loaded by the browser. 163 // about all extensions currently loaded by the browser.
(...skipping 25 matching lines...) Expand all
175 bool is_webkit_initialized_; 189 bool is_webkit_initialized_;
176 190
177 std::string test_extension_id_; 191 std::string test_extension_id_;
178 192
179 // Status of webrequest usage for known extensions. 193 // Status of webrequest usage for known extensions.
180 // TODO(mpcomplete): remove. http://crbug.com/100411 194 // TODO(mpcomplete): remove. http://crbug.com/100411
181 bool webrequest_adblock_; 195 bool webrequest_adblock_;
182 bool webrequest_adblock_plus_; 196 bool webrequest_adblock_plus_;
183 bool webrequest_other_; 197 bool webrequest_other_;
184 198
199 ResourceBundleSourceMap source_map_;
200
185 DISALLOW_COPY_AND_ASSIGN(ExtensionDispatcher); 201 DISALLOW_COPY_AND_ASSIGN(ExtensionDispatcher);
186 }; 202 };
187 203
188 #endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_ 204 #endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/extension_custom_bindings.cc ('k') | chrome/renderer/extensions/extension_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698