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_DISPATCHER_H_ | 5 #ifndef CHROME_RENDERER_EXTENSIONS_DISPATCHER_H_ |
6 #define CHROME_RENDERER_EXTENSIONS_DISPATCHER_H_ | 6 #define CHROME_RENDERER_EXTENSIONS_DISPATCHER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 namespace content { | 46 namespace content { |
47 class RenderThread; | 47 class RenderThread; |
48 } | 48 } |
49 | 49 |
50 namespace extensions { | 50 namespace extensions { |
51 class ContentWatcher; | 51 class ContentWatcher; |
52 class Extension; | 52 class Extension; |
53 class FilteredEventRouter; | 53 class FilteredEventRouter; |
54 class ManifestPermissionSet; | 54 class ManifestPermissionSet; |
55 class RequestSender; | 55 class RequestSender; |
| 56 class ScriptContext; |
56 class UserScriptSlave; | 57 class UserScriptSlave; |
57 struct Message; | 58 struct Message; |
58 | 59 |
59 // Dispatches extension control messages sent to the renderer and stores | 60 // Dispatches extension control messages sent to the renderer and stores |
60 // renderer extension related state. | 61 // renderer extension related state. |
61 class Dispatcher : public content::RenderProcessObserver { | 62 class Dispatcher : public content::RenderProcessObserver { |
62 public: | 63 public: |
63 Dispatcher(); | 64 Dispatcher(); |
64 virtual ~Dispatcher(); | 65 virtual ~Dispatcher(); |
65 | 66 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 } | 121 } |
121 | 122 |
122 void OnExtensionResponse(int request_id, | 123 void OnExtensionResponse(int request_id, |
123 bool success, | 124 bool success, |
124 const base::ListValue& response, | 125 const base::ListValue& response, |
125 const std::string& error); | 126 const std::string& error); |
126 | 127 |
127 // Checks that the current context contains an extension that has permission | 128 // Checks that the current context contains an extension that has permission |
128 // to execute the specified function. If it does not, a v8 exception is thrown | 129 // to execute the specified function. If it does not, a v8 exception is thrown |
129 // and the method returns false. Otherwise returns true. | 130 // and the method returns false. Otherwise returns true. |
130 bool CheckContextAccessToExtensionAPI( | 131 bool CheckContextAccessToExtensionAPI(const std::string& function_name, |
131 const std::string& function_name, ChromeV8Context* context) const; | 132 ScriptContext* context) const; |
132 | 133 |
133 // Dispatches the event named |event_name| to all render views. | 134 // Dispatches the event named |event_name| to all render views. |
134 void DispatchEvent(const std::string& extension_id, | 135 void DispatchEvent(const std::string& extension_id, |
135 const std::string& event_name) const; | 136 const std::string& event_name) const; |
136 | 137 |
137 // Shared implementation of the various MessageInvoke IPCs. | 138 // Shared implementation of the various MessageInvoke IPCs. |
138 void InvokeModuleSystemMethod( | 139 void InvokeModuleSystemMethod( |
139 content::RenderView* render_view, | 140 content::RenderView* render_view, |
140 const std::string& extension_id, | 141 const std::string& extension_id, |
141 const std::string& module_name, | 142 const std::string& module_name, |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 | 315 |
315 // Mapping of port IDs to tabs. If there is no tab, the value would be -1. | 316 // Mapping of port IDs to tabs. If there is no tab, the value would be -1. |
316 std::map<int, int> port_to_tab_id_map_; | 317 std::map<int, int> port_to_tab_id_map_; |
317 | 318 |
318 DISALLOW_COPY_AND_ASSIGN(Dispatcher); | 319 DISALLOW_COPY_AND_ASSIGN(Dispatcher); |
319 }; | 320 }; |
320 | 321 |
321 } // namespace extensions | 322 } // namespace extensions |
322 | 323 |
323 #endif // CHROME_RENDERER_EXTENSIONS_DISPATCHER_H_ | 324 #endif // CHROME_RENDERER_EXTENSIONS_DISPATCHER_H_ |
OLD | NEW |