OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_RENDERER_DISPATCHER_H_ | 5 #ifndef EXTENSIONS_RENDERER_DISPATCHER_H_ |
6 #define EXTENSIONS_RENDERER_DISPATCHER_H_ | 6 #define EXTENSIONS_RENDERER_DISPATCHER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 class ScriptContext; | 59 class ScriptContext; |
60 class ScriptInjectionManager; | 60 class ScriptInjectionManager; |
61 struct Message; | 61 struct Message; |
62 | 62 |
63 // Dispatches extension control messages sent to the renderer and stores | 63 // Dispatches extension control messages sent to the renderer and stores |
64 // renderer extension related state. | 64 // renderer extension related state. |
65 class Dispatcher : public content::RenderProcessObserver, | 65 class Dispatcher : public content::RenderProcessObserver, |
66 public UserScriptSetManager::Observer { | 66 public UserScriptSetManager::Observer { |
67 public: | 67 public: |
68 explicit Dispatcher(DispatcherDelegate* delegate); | 68 explicit Dispatcher(DispatcherDelegate* delegate); |
69 virtual ~Dispatcher(); | 69 ~Dispatcher() override; |
70 | 70 |
71 const std::set<std::string>& function_names() const { | 71 const std::set<std::string>& function_names() const { |
72 return function_names_; | 72 return function_names_; |
73 } | 73 } |
74 | 74 |
75 bool is_extension_process() const { return is_extension_process_; } | 75 bool is_extension_process() const { return is_extension_process_; } |
76 | 76 |
77 const ExtensionSet* extensions() const { return &extensions_; } | 77 const ExtensionSet* extensions() const { return &extensions_; } |
78 | 78 |
79 const ScriptContextSet& script_context_set() const { | 79 const ScriptContextSet& script_context_set() const { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 V8SchemaRegistry* v8_schema_registry); | 149 V8SchemaRegistry* v8_schema_registry); |
150 | 150 |
151 bool WasWebRequestUsedBySomeExtensions() const { return webrequest_used_; } | 151 bool WasWebRequestUsedBySomeExtensions() const { return webrequest_used_; } |
152 | 152 |
153 private: | 153 private: |
154 friend class ::ChromeRenderViewTest; | 154 friend class ::ChromeRenderViewTest; |
155 FRIEND_TEST_ALL_PREFIXES(RendererPermissionsPolicyDelegateTest, | 155 FRIEND_TEST_ALL_PREFIXES(RendererPermissionsPolicyDelegateTest, |
156 CannotScriptWebstore); | 156 CannotScriptWebstore); |
157 | 157 |
158 // RenderProcessObserver implementation: | 158 // RenderProcessObserver implementation: |
159 virtual bool OnControlMessageReceived(const IPC::Message& message) override; | 159 bool OnControlMessageReceived(const IPC::Message& message) override; |
160 virtual void WebKitInitialized() override; | 160 void WebKitInitialized() override; |
161 virtual void IdleNotification() override; | 161 void IdleNotification() override; |
162 virtual void OnRenderProcessShutdown() override; | 162 void OnRenderProcessShutdown() override; |
163 | 163 |
164 void OnActivateExtension(const std::string& extension_id); | 164 void OnActivateExtension(const std::string& extension_id); |
165 void OnCancelSuspend(const std::string& extension_id); | 165 void OnCancelSuspend(const std::string& extension_id); |
166 void OnClearTabSpecificPermissions( | 166 void OnClearTabSpecificPermissions( |
167 int tab_id, | 167 int tab_id, |
168 const std::vector<std::string>& extension_ids); | 168 const std::vector<std::string>& extension_ids); |
169 void OnDeliverMessage(int target_port_id, const Message& message); | 169 void OnDeliverMessage(int target_port_id, const Message& message); |
170 void OnDispatchOnConnect(int target_port_id, | 170 void OnDispatchOnConnect(int target_port_id, |
171 const std::string& channel_name, | 171 const std::string& channel_name, |
172 const base::DictionaryValue& source_tab, | 172 const base::DictionaryValue& source_tab, |
(...skipping 19 matching lines...) Expand all Loading... |
192 void OnTransferBlobs(const std::vector<std::string>& blob_uuids); | 192 void OnTransferBlobs(const std::vector<std::string>& blob_uuids); |
193 void OnUnloaded(const std::string& id); | 193 void OnUnloaded(const std::string& id); |
194 void OnUpdatePermissions(const ExtensionMsg_UpdatePermissions_Params& params); | 194 void OnUpdatePermissions(const ExtensionMsg_UpdatePermissions_Params& params); |
195 void OnUpdateTabSpecificPermissions(const GURL& url, | 195 void OnUpdateTabSpecificPermissions(const GURL& url, |
196 int tab_id, | 196 int tab_id, |
197 const std::string& extension_id, | 197 const std::string& extension_id, |
198 const URLPatternSet& origin_set); | 198 const URLPatternSet& origin_set); |
199 void OnUsingWebRequestAPI(bool webrequest_used); | 199 void OnUsingWebRequestAPI(bool webrequest_used); |
200 | 200 |
201 // UserScriptSetManager::Observer implementation. | 201 // UserScriptSetManager::Observer implementation. |
202 virtual void OnUserScriptsUpdated( | 202 void OnUserScriptsUpdated(const std::set<std::string>& changed_extensions, |
203 const std::set<std::string>& changed_extensions, | 203 const std::vector<UserScript*>& scripts) override; |
204 const std::vector<UserScript*>& scripts) override; | |
205 | 204 |
206 void UpdateActiveExtensions(); | 205 void UpdateActiveExtensions(); |
207 | 206 |
208 // Sets up the host permissions for |extension|. | 207 // Sets up the host permissions for |extension|. |
209 void InitOriginPermissions(const Extension* extension); | 208 void InitOriginPermissions(const Extension* extension); |
210 | 209 |
211 // Updates the host permissions for extension to include only those in | 210 // Updates the host permissions for extension to include only those in |
212 // |new_patterns|, and remove from |old_patterns| that are no longer allowed. | 211 // |new_patterns|, and remove from |old_patterns| that are no longer allowed. |
213 void UpdateOriginPermissions(const Extension* extension, | 212 void UpdateOriginPermissions(const Extension* extension, |
214 const URLPatternSet& old_patterns, | 213 const URLPatternSet& old_patterns, |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 | 314 |
316 // Status of webrequest usage. | 315 // Status of webrequest usage. |
317 bool webrequest_used_; | 316 bool webrequest_used_; |
318 | 317 |
319 DISALLOW_COPY_AND_ASSIGN(Dispatcher); | 318 DISALLOW_COPY_AND_ASSIGN(Dispatcher); |
320 }; | 319 }; |
321 | 320 |
322 } // namespace extensions | 321 } // namespace extensions |
323 | 322 |
324 #endif // EXTENSIONS_RENDERER_DISPATCHER_H_ | 323 #endif // EXTENSIONS_RENDERER_DISPATCHER_H_ |
OLD | NEW |