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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 const std::string& tab_json, | 137 const std::string& tab_json, |
134 const std::string& source_extension_id, | 138 const std::string& source_extension_id, |
135 const std::string& target_extension_id); | 139 const std::string& target_extension_id); |
136 void OnDeliverMessage(int target_port_id, const std::string& message); | 140 void OnDeliverMessage(int target_port_id, const std::string& message); |
137 void OnDispatchOnDisconnect(int port_id, bool connection_error); | 141 void OnDispatchOnDisconnect(int port_id, bool connection_error); |
138 void OnSetFunctionNames(const std::vector<std::string>& names); | 142 void OnSetFunctionNames(const std::vector<std::string>& names); |
139 void OnLoaded( | 143 void OnLoaded( |
140 const std::vector<ExtensionMsg_Loaded_Params>& loaded_extensions); | 144 const std::vector<ExtensionMsg_Loaded_Params>& loaded_extensions); |
141 void OnUnloaded(const std::string& id); | 145 void OnUnloaded(const std::string& id); |
142 void OnSetScriptingWhitelist( | 146 void OnSetScriptingWhitelist( |
143 const Extension::ScriptingWhitelist& extension_ids); | 147 const extensions::Extension::ScriptingWhitelist& extension_ids); |
144 void OnPageActionsUpdated(const std::string& extension_id, | 148 void OnPageActionsUpdated(const std::string& extension_id, |
145 const std::vector<std::string>& page_actions); | 149 const std::vector<std::string>& page_actions); |
146 void OnActivateExtension(const std::string& extension_id); | 150 void OnActivateExtension(const std::string& extension_id); |
147 void OnUpdatePermissions(int reason_id, | 151 void OnUpdatePermissions(int reason_id, |
148 const std::string& extension_id, | 152 const std::string& extension_id, |
149 const ExtensionAPIPermissionSet& apis, | 153 const ExtensionAPIPermissionSet& apis, |
150 const URLPatternSet& explicit_hosts, | 154 const URLPatternSet& explicit_hosts, |
151 const URLPatternSet& scriptable_hosts); | 155 const URLPatternSet& scriptable_hosts); |
152 void OnUpdateUserScripts(base::SharedMemoryHandle table); | 156 void OnUpdateUserScripts(base::SharedMemoryHandle table); |
153 void OnUsingWebRequestAPI( | 157 void OnUsingWebRequestAPI( |
154 bool adblock, | 158 bool adblock, |
155 bool adblock_plus, | 159 bool adblock_plus, |
156 bool other_webrequest); | 160 bool other_webrequest); |
157 void OnShouldUnload(const std::string& extension_id, int sequence_id); | 161 void OnShouldUnload(const std::string& extension_id, int sequence_id); |
158 void OnUnload(const std::string& extension_id); | 162 void OnUnload(const std::string& extension_id); |
159 | 163 |
160 // Update the list of active extensions that will be reported when we crash. | 164 // Update the list of active extensions that will be reported when we crash. |
161 void UpdateActiveExtensions(); | 165 void UpdateActiveExtensions(); |
162 | 166 |
163 // Calls RenderThread's RegisterExtension and keeps tracks of which v8 | 167 // Calls RenderThread's RegisterExtension and keeps tracks of which v8 |
164 // extension is for Chrome Extensions only. | 168 // extension is for Chrome Extensions only. |
165 void RegisterExtension(v8::Extension* extension, bool restrict_to_extensions); | 169 void RegisterExtension(v8::Extension* extension, bool restrict_to_extensions); |
166 | 170 |
167 // Sets up the host permissions for |extension|. | 171 // Sets up the host permissions for |extension|. |
168 void InitOriginPermissions(const Extension* extension); | 172 void InitOriginPermissions(const extensions::Extension* extension); |
169 void UpdateOriginPermissions(UpdatedExtensionPermissionsInfo::Reason reason, | 173 void UpdateOriginPermissions( |
170 const Extension* extension, | 174 extensions::UpdatedExtensionPermissionsInfo::Reason reason, |
171 const URLPatternSet& origins); | 175 const extensions::Extension* extension, |
| 176 const URLPatternSet& origins); |
172 | 177 |
173 void RegisterNativeHandlers(ModuleSystem* module_system, | 178 void RegisterNativeHandlers(ModuleSystem* module_system, |
174 ChromeV8Context* context); | 179 ChromeV8Context* context); |
175 | 180 |
176 // Inserts static source code into |source_map_|. | 181 // Inserts static source code into |source_map_|. |
177 void PopulateSourceMap(); | 182 void PopulateSourceMap(); |
178 | 183 |
179 // Inserts BindingInstallers into |lazy_bindings_map_|. | 184 // Inserts BindingInstallers into |lazy_bindings_map_|. |
180 void PopulateLazyBindingsMap(); | 185 void PopulateLazyBindingsMap(); |
181 | 186 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 scoped_ptr<ExtensionRequestSender> request_sender_; | 244 scoped_ptr<ExtensionRequestSender> request_sender_; |
240 | 245 |
241 // The current channel. From VersionInfo::GetChannel(). | 246 // The current channel. From VersionInfo::GetChannel(). |
242 // TODO(aa): Remove when we can restrict non-permission APIs to dev-only. | 247 // TODO(aa): Remove when we can restrict non-permission APIs to dev-only. |
243 int chrome_channel_; | 248 int chrome_channel_; |
244 | 249 |
245 DISALLOW_COPY_AND_ASSIGN(ExtensionDispatcher); | 250 DISALLOW_COPY_AND_ASSIGN(ExtensionDispatcher); |
246 }; | 251 }; |
247 | 252 |
248 #endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_ | 253 #endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_ |
OLD | NEW |