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

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

Issue 9653022: Revert 125811 - Convert app_bindings.js to the schema_generated_bindings.js infrastructure. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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/common/extensions/feature.h"
18 #include "chrome/renderer/extensions/chrome_v8_context.h"
19 #include "chrome/renderer/extensions/chrome_v8_context_set.h" 17 #include "chrome/renderer/extensions/chrome_v8_context_set.h"
20 #include "chrome/renderer/resource_bundle_source_map.h" 18 #include "chrome/renderer/resource_bundle_source_map.h"
21 #include "v8/include/v8.h" 19 #include "v8/include/v8.h"
22 20
23 class ModuleSystem; 21 class ModuleSystem;
24 class GURL; 22 class GURL;
25 class URLPattern; 23 class URLPattern;
26 class UserScriptSlave; 24 class UserScriptSlave;
27 struct ExtensionMsg_Loaded_Params; 25 struct ExtensionMsg_Loaded_Params;
28 26
(...skipping 20 matching lines...) Expand all
49 return function_names_; 47 return function_names_;
50 } 48 }
51 49
52 bool is_extension_process() const { return is_extension_process_; } 50 bool is_extension_process() const { return is_extension_process_; }
53 const ExtensionSet* extensions() const { return &extensions_; } 51 const ExtensionSet* extensions() const { return &extensions_; }
54 const ChromeV8ContextSet& v8_context_set() const { 52 const ChromeV8ContextSet& v8_context_set() const {
55 return v8_context_set_; 53 return v8_context_set_;
56 } 54 }
57 UserScriptSlave* user_script_slave() { return user_script_slave_.get(); } 55 UserScriptSlave* user_script_slave() { return user_script_slave_.get(); }
58 56
57 bool IsApplicationActive(const std::string& extension_id) const;
59 bool IsExtensionActive(const std::string& extension_id) const; 58 bool IsExtensionActive(const std::string& extension_id) const;
60 59
61 // Finds the extension ID for the JavaScript context associated with the 60 // Whether or not we should set up custom bindings for this api.
62 // specified |frame| and isolated world. If |world_id| is zero, finds the 61 bool AllowCustomAPI(WebKit::WebFrame* frame,
63 // extension ID associated with the main world's JavaScript context. If the 62 const std::string& custom_binding_api_name,
64 // JavaScript context isn't from an extension, returns empty string. 63 int world_id);
65 std::string GetExtensionID(WebKit::WebFrame* frame, int world_id);
66 64
67 // See WebKit::WebPermissionClient::allowScriptExtension 65 // See WebKit::WebPermissionClient::allowScriptExtension
68 // TODO(koz): Remove once WebKit no longer calls this. 66 // TODO(koz): Remove once WebKit no longer calls this.
69 bool AllowScriptExtension(WebKit::WebFrame* frame, 67 bool AllowScriptExtension(WebKit::WebFrame* frame,
70 const std::string& v8_extension_name, 68 const std::string& v8_extension_name,
71 int extension_group); 69 int extension_group);
72 70
73 // TODO(koz): Remove once WebKit no longer calls this. 71 // TODO(koz): Remove once WebKit no longer calls this.
74 bool AllowScriptExtension(WebKit::WebFrame* frame, 72 bool AllowScriptExtension(WebKit::WebFrame* frame,
75 const std::string& v8_extension_name, 73 const std::string& v8_extension_name,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 bool user_gesture); 111 bool user_gesture);
114 void OnDeliverMessage(int target_port_id, const std::string& message); 112 void OnDeliverMessage(int target_port_id, const std::string& message);
115 void OnSetFunctionNames(const std::vector<std::string>& names); 113 void OnSetFunctionNames(const std::vector<std::string>& names);
116 void OnLoaded( 114 void OnLoaded(
117 const std::vector<ExtensionMsg_Loaded_Params>& loaded_extensions); 115 const std::vector<ExtensionMsg_Loaded_Params>& loaded_extensions);
118 void OnUnloaded(const std::string& id); 116 void OnUnloaded(const std::string& id);
119 void OnSetScriptingWhitelist( 117 void OnSetScriptingWhitelist(
120 const Extension::ScriptingWhitelist& extension_ids); 118 const Extension::ScriptingWhitelist& extension_ids);
121 void OnPageActionsUpdated(const std::string& extension_id, 119 void OnPageActionsUpdated(const std::string& extension_id,
122 const std::vector<std::string>& page_actions); 120 const std::vector<std::string>& page_actions);
121 void OnActivateApplication(const std::string& extension_id);
123 void OnActivateExtension(const std::string& extension_id); 122 void OnActivateExtension(const std::string& extension_id);
124 void OnUpdatePermissions(int reason_id, 123 void OnUpdatePermissions(int reason_id,
125 const std::string& extension_id, 124 const std::string& extension_id,
126 const ExtensionAPIPermissionSet& apis, 125 const ExtensionAPIPermissionSet& apis,
127 const URLPatternSet& explicit_hosts, 126 const URLPatternSet& explicit_hosts,
128 const URLPatternSet& scriptable_hosts); 127 const URLPatternSet& scriptable_hosts);
129 void OnUpdateUserScripts(base::SharedMemoryHandle table); 128 void OnUpdateUserScripts(base::SharedMemoryHandle table);
130 void OnUsingWebRequestAPI( 129 void OnUsingWebRequestAPI(
131 bool adblock, 130 bool adblock,
132 bool adblock_plus, 131 bool adblock_plus,
(...skipping 12 matching lines...) Expand all
145 void UpdateOriginPermissions(UpdatedExtensionPermissionsInfo::Reason reason, 144 void UpdateOriginPermissions(UpdatedExtensionPermissionsInfo::Reason reason,
146 const Extension* extension, 145 const Extension* extension,
147 const URLPatternSet& origins); 146 const URLPatternSet& origins);
148 147
149 void RegisterNativeHandlers(ModuleSystem* module_system, 148 void RegisterNativeHandlers(ModuleSystem* module_system,
150 ChromeV8Context* context); 149 ChromeV8Context* context);
151 150
152 // Inserts static source code into |source_map_|. 151 // Inserts static source code into |source_map_|.
153 void PopulateSourceMap(); 152 void PopulateSourceMap();
154 153
155 // Returns the Feature::Context type of context for a JavaScript context. 154 // Finds the extension ID for the current context. This is determined from
156 extensions::Feature::Context ClassifyJavaScriptContext( 155 // |world_id| if it's non-zero, or the URL in |frame| if it is.
157 const std::string& extension_id, 156 std::string GetExtensionID(WebKit::WebFrame* frame, int world_id);
158 int extension_group,
159 const ExtensionURLInfo& url_info);
160 157
161 // True if this renderer is running extensions. 158 // True if this renderer is running extensions.
162 bool is_extension_process_; 159 bool is_extension_process_;
163 160
164 // Contains all loaded extensions. This is essentially the renderer 161 // Contains all loaded extensions. This is essentially the renderer
165 // counterpart to ExtensionService in the browser. It contains information 162 // counterpart to ExtensionService in the browser. It contains information
166 // about all extensions currently loaded by the browser. 163 // about all extensions currently loaded by the browser.
167 ExtensionSet extensions_; 164 ExtensionSet extensions_;
168 165
169 // All the bindings contexts that are currently loaded for this renderer. 166 // All the bindings contexts that are currently loaded for this renderer.
170 // There is zero or one for each v8 context. 167 // There is zero or one for each v8 context.
171 ChromeV8ContextSet v8_context_set_; 168 ChromeV8ContextSet v8_context_set_;
172 169
173 scoped_ptr<UserScriptSlave> user_script_slave_; 170 scoped_ptr<UserScriptSlave> user_script_slave_;
174 171
175 // Same as above, but on a longer timer and will run even if the process is 172 // Same as above, but on a longer timer and will run even if the process is
176 // not idle, to ensure that IdleHandle gets called eventually. 173 // not idle, to ensure that IdleHandle gets called eventually.
177 base::RepeatingTimer<content::RenderThread> forced_idle_timer_; 174 base::RepeatingTimer<content::RenderThread> forced_idle_timer_;
178 175
179 // The v8 extensions which are restricted to extension-related contexts. 176 // The v8 extensions which are restricted to extension-related contexts.
180 std::set<std::string> restricted_v8_extensions_; 177 std::set<std::string> restricted_v8_extensions_;
181 178
182 // All declared function names. 179 // All declared function names.
183 std::set<std::string> function_names_; 180 std::set<std::string> function_names_;
184 181
185 // The extensions and apps that are active in this process. 182 // The extensions that are active in this process.
186 std::set<std::string> active_extension_ids_; 183 std::set<std::string> active_extension_ids_;
187 184
185 // The applications that are active in this process.
186 std::set<std::string> active_application_ids_;
187
188 // True once WebKit has been initialized (and it is therefore safe to poke). 188 // True once WebKit has been initialized (and it is therefore safe to poke).
189 bool is_webkit_initialized_; 189 bool is_webkit_initialized_;
190 190
191 std::string test_extension_id_; 191 std::string test_extension_id_;
192 192
193 // Status of webrequest usage for known extensions. 193 // Status of webrequest usage for known extensions.
194 // TODO(mpcomplete): remove. http://crbug.com/100411 194 // TODO(mpcomplete): remove. http://crbug.com/100411
195 bool webrequest_adblock_; 195 bool webrequest_adblock_;
196 bool webrequest_adblock_plus_; 196 bool webrequest_adblock_plus_;
197 bool webrequest_other_; 197 bool webrequest_other_;
198 198
199 ResourceBundleSourceMap source_map_; 199 ResourceBundleSourceMap source_map_;
200 200
201 DISALLOW_COPY_AND_ASSIGN(ExtensionDispatcher); 201 DISALLOW_COPY_AND_ASSIGN(ExtensionDispatcher);
202 }; 202 };
203 203
204 #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