OLD | NEW |
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 22 matching lines...) Expand all Loading... |
33 } | 33 } |
34 | 34 |
35 namespace base { | 35 namespace base { |
36 class ListValue; | 36 class ListValue; |
37 } | 37 } |
38 | 38 |
39 namespace content { | 39 namespace content { |
40 class RenderThread; | 40 class RenderThread; |
41 } | 41 } |
42 | 42 |
| 43 namespace extension { |
| 44 class Extension; |
| 45 } |
| 46 |
43 // Dispatches extension control messages sent to the renderer and stores | 47 // Dispatches extension control messages sent to the renderer and stores |
44 // renderer extension related state. | 48 // renderer extension related state. |
45 class ExtensionDispatcher : public content::RenderProcessObserver { | 49 class ExtensionDispatcher : public content::RenderProcessObserver { |
46 public: | 50 public: |
47 ExtensionDispatcher(); | 51 ExtensionDispatcher(); |
48 virtual ~ExtensionDispatcher(); | 52 virtual ~ExtensionDispatcher(); |
49 | 53 |
50 const std::set<std::string>& function_names() const { | 54 const std::set<std::string>& function_names() const { |
51 return function_names_; | 55 return function_names_; |
52 } | 56 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 const std::string& tab_json, | 136 const std::string& tab_json, |
133 const std::string& source_extension_id, | 137 const std::string& source_extension_id, |
134 const std::string& target_extension_id); | 138 const std::string& target_extension_id); |
135 void OnDeliverMessage(int target_port_id, const std::string& message); | 139 void OnDeliverMessage(int target_port_id, const std::string& message); |
136 void OnDispatchOnDisconnect(int port_id, bool connection_error); | 140 void OnDispatchOnDisconnect(int port_id, bool connection_error); |
137 void OnSetFunctionNames(const std::vector<std::string>& names); | 141 void OnSetFunctionNames(const std::vector<std::string>& names); |
138 void OnLoaded( | 142 void OnLoaded( |
139 const std::vector<ExtensionMsg_Loaded_Params>& loaded_extensions); | 143 const std::vector<ExtensionMsg_Loaded_Params>& loaded_extensions); |
140 void OnUnloaded(const std::string& id); | 144 void OnUnloaded(const std::string& id); |
141 void OnSetScriptingWhitelist( | 145 void OnSetScriptingWhitelist( |
142 const Extension::ScriptingWhitelist& extension_ids); | 146 const extensions::Extension::ScriptingWhitelist& extension_ids); |
143 void OnPageActionsUpdated(const std::string& extension_id, | 147 void OnPageActionsUpdated(const std::string& extension_id, |
144 const std::vector<std::string>& page_actions); | 148 const std::vector<std::string>& page_actions); |
145 void OnActivateExtension(const std::string& extension_id); | 149 void OnActivateExtension(const std::string& extension_id); |
146 void OnUpdatePermissions(int reason_id, | 150 void OnUpdatePermissions(int reason_id, |
147 const std::string& extension_id, | 151 const std::string& extension_id, |
148 const ExtensionAPIPermissionSet& apis, | 152 const ExtensionAPIPermissionSet& apis, |
149 const URLPatternSet& explicit_hosts, | 153 const URLPatternSet& explicit_hosts, |
150 const URLPatternSet& scriptable_hosts); | 154 const URLPatternSet& scriptable_hosts); |
151 void OnUpdateUserScripts(base::SharedMemoryHandle table); | 155 void OnUpdateUserScripts(base::SharedMemoryHandle table); |
152 void OnUsingWebRequestAPI( | 156 void OnUsingWebRequestAPI( |
153 bool adblock, | 157 bool adblock, |
154 bool adblock_plus, | 158 bool adblock_plus, |
155 bool other_webrequest); | 159 bool other_webrequest); |
156 void OnShouldUnload(const std::string& extension_id, int sequence_id); | 160 void OnShouldUnload(const std::string& extension_id, int sequence_id); |
157 void OnUnload(const std::string& extension_id); | 161 void OnUnload(const std::string& extension_id); |
158 | 162 |
159 // Update the list of active extensions that will be reported when we crash. | 163 // Update the list of active extensions that will be reported when we crash. |
160 void UpdateActiveExtensions(); | 164 void UpdateActiveExtensions(); |
161 | 165 |
162 // Calls RenderThread's RegisterExtension and keeps tracks of which v8 | 166 // Calls RenderThread's RegisterExtension and keeps tracks of which v8 |
163 // extension is for Chrome Extensions only. | 167 // extension is for Chrome Extensions only. |
164 void RegisterExtension(v8::Extension* extension, bool restrict_to_extensions); | 168 void RegisterExtension(v8::Extension* extension, bool restrict_to_extensions); |
165 | 169 |
166 // Sets up the host permissions for |extension|. | 170 // Sets up the host permissions for |extension|. |
167 void InitOriginPermissions(const Extension* extension); | 171 void InitOriginPermissions(const extensions::Extension* extension); |
168 void UpdateOriginPermissions(UpdatedExtensionPermissionsInfo::Reason reason, | 172 void UpdateOriginPermissions( |
169 const Extension* extension, | 173 extensions::UpdatedExtensionPermissionsInfo::Reason reason, |
170 const URLPatternSet& origins); | 174 const extensions::Extension* extension, |
| 175 const URLPatternSet& origins); |
171 | 176 |
172 void RegisterNativeHandlers(ModuleSystem* module_system, | 177 void RegisterNativeHandlers(ModuleSystem* module_system, |
173 ChromeV8Context* context); | 178 ChromeV8Context* context); |
174 | 179 |
175 // Inserts static source code into |source_map_|. | 180 // Inserts static source code into |source_map_|. |
176 void PopulateSourceMap(); | 181 void PopulateSourceMap(); |
177 | 182 |
178 // Inserts BindingInstallers into |lazy_bindings_map_|. | 183 // Inserts BindingInstallers into |lazy_bindings_map_|. |
179 void PopulateLazyBindingsMap(); | 184 void PopulateLazyBindingsMap(); |
180 | 185 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 // them. | 239 // them. |
235 std::map<std::string, BindingInstaller> lazy_bindings_map_; | 240 std::map<std::string, BindingInstaller> lazy_bindings_map_; |
236 | 241 |
237 // Sends API requests to the extension host. | 242 // Sends API requests to the extension host. |
238 scoped_ptr<ExtensionRequestSender> request_sender_; | 243 scoped_ptr<ExtensionRequestSender> request_sender_; |
239 | 244 |
240 DISALLOW_COPY_AND_ASSIGN(ExtensionDispatcher); | 245 DISALLOW_COPY_AND_ASSIGN(ExtensionDispatcher); |
241 }; | 246 }; |
242 | 247 |
243 #endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_ | 248 #endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_ |
OLD | NEW |