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

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

Issue 9835039: Make app_custom_bindings.js lazily evaluated so it doesn't execute on every page load. (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
« no previous file with comments | « no previous file | chrome/renderer/extensions/extension_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 (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>
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 } 97 }
98 bool IsAdblockPlusWithWebRequestInstalled() const { 98 bool IsAdblockPlusWithWebRequestInstalled() const {
99 return webrequest_adblock_plus_; 99 return webrequest_adblock_plus_;
100 } 100 }
101 bool IsOtherExtensionWithWebRequestInstalled() const { 101 bool IsOtherExtensionWithWebRequestInstalled() const {
102 return webrequest_other_; 102 return webrequest_other_;
103 } 103 }
104 104
105 private: 105 private:
106 friend class RenderViewTest; 106 friend class RenderViewTest;
107 typedef void (*BindingInstaller)(ModuleSystem* module_system,
108 v8::Handle<v8::Object> chrome,
109 v8::Handle<v8::Object> chrome_hidden);
107 110
108 // RenderProcessObserver implementation: 111 // RenderProcessObserver implementation:
109 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; 112 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE;
110 virtual void WebKitInitialized() OVERRIDE; 113 virtual void WebKitInitialized() OVERRIDE;
111 virtual void IdleNotification() OVERRIDE; 114 virtual void IdleNotification() OVERRIDE;
112 115
113 void OnMessageInvoke(const std::string& extension_id, 116 void OnMessageInvoke(const std::string& extension_id,
114 const std::string& function_name, 117 const std::string& function_name,
115 const base::ListValue& args, 118 const base::ListValue& args,
116 const GURL& event_url, 119 const GURL& event_url,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 void UpdateOriginPermissions(UpdatedExtensionPermissionsInfo::Reason reason, 152 void UpdateOriginPermissions(UpdatedExtensionPermissionsInfo::Reason reason,
150 const Extension* extension, 153 const Extension* extension,
151 const URLPatternSet& origins); 154 const URLPatternSet& origins);
152 155
153 void RegisterNativeHandlers(ModuleSystem* module_system, 156 void RegisterNativeHandlers(ModuleSystem* module_system,
154 ChromeV8Context* context); 157 ChromeV8Context* context);
155 158
156 // Inserts static source code into |source_map_|. 159 // Inserts static source code into |source_map_|.
157 void PopulateSourceMap(); 160 void PopulateSourceMap();
158 161
162 // Inserts BindingInstallers into |lazy_bindings_map_|.
163 void PopulateLazyBindingsMap();
164
165 // Sets up the bindings for the given api.
166 void InstallBindings(ModuleSystem* module_system,
167 v8::Handle<v8::Context> v8_context,
168 const std::string& api);
169
159 // Returns the Feature::Context type of context for a JavaScript context. 170 // Returns the Feature::Context type of context for a JavaScript context.
160 extensions::Feature::Context ClassifyJavaScriptContext( 171 extensions::Feature::Context ClassifyJavaScriptContext(
161 const std::string& extension_id, 172 const std::string& extension_id,
162 int extension_group, 173 int extension_group,
163 const ExtensionURLInfo& url_info); 174 const ExtensionURLInfo& url_info);
164 175
165 // True if this renderer is running extensions. 176 // True if this renderer is running extensions.
166 bool is_extension_process_; 177 bool is_extension_process_;
167 178
168 // Contains all loaded extensions. This is essentially the renderer 179 // Contains all loaded extensions. This is essentially the renderer
(...skipping 29 matching lines...) Expand all
198 // TODO(mpcomplete): remove. http://crbug.com/100411 209 // TODO(mpcomplete): remove. http://crbug.com/100411
199 bool webrequest_adblock_; 210 bool webrequest_adblock_;
200 bool webrequest_adblock_plus_; 211 bool webrequest_adblock_plus_;
201 bool webrequest_other_; 212 bool webrequest_other_;
202 213
203 ResourceBundleSourceMap source_map_; 214 ResourceBundleSourceMap source_map_;
204 215
205 // Cache for the v8 representation of extension API schemas. 216 // Cache for the v8 representation of extension API schemas.
206 extensions::V8SchemaRegistry v8_schema_registry_; 217 extensions::V8SchemaRegistry v8_schema_registry_;
207 218
219 // Bindings that are defined lazily and have BindingInstallers to install
220 // them.
221 std::map<std::string, BindingInstaller> lazy_bindings_map_;
222
208 DISALLOW_COPY_AND_ASSIGN(ExtensionDispatcher); 223 DISALLOW_COPY_AND_ASSIGN(ExtensionDispatcher);
209 }; 224 };
210 225
211 #endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_ 226 #endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/extensions/extension_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698