| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 const ExtensionSet* extensions() const { return &extensions_; } | 45 const ExtensionSet* extensions() const { return &extensions_; } |
| 46 UserScriptSlave* user_script_slave() { return user_script_slave_.get(); } | 46 UserScriptSlave* user_script_slave() { return user_script_slave_.get(); } |
| 47 | 47 |
| 48 bool IsExtensionActive(const std::string& extension_id); | 48 bool IsExtensionActive(const std::string& extension_id); |
| 49 | 49 |
| 50 // See WebKit::WebPermissionClient::allowScriptExtension | 50 // See WebKit::WebPermissionClient::allowScriptExtension |
| 51 bool AllowScriptExtension(WebKit::WebFrame* frame, | 51 bool AllowScriptExtension(WebKit::WebFrame* frame, |
| 52 const std::string& v8_extension_name, | 52 const std::string& v8_extension_name, |
| 53 int extension_group); | 53 int extension_group); |
| 54 | 54 |
| 55 // Sets up the host permissions for |extension|. |
| 56 static void InitHostPermissions(const Extension* extension); |
| 57 |
| 55 private: | 58 private: |
| 56 friend class RenderViewTest; | 59 friend class RenderViewTest; |
| 57 | 60 |
| 58 // RenderProcessObserver implementation: | 61 // RenderProcessObserver implementation: |
| 59 virtual bool OnControlMessageReceived(const IPC::Message& message); | 62 virtual bool OnControlMessageReceived(const IPC::Message& message); |
| 60 virtual void WebKitInitialized(); | 63 virtual void WebKitInitialized(); |
| 61 virtual void IdleNotification(); | 64 virtual void IdleNotification(); |
| 62 | 65 |
| 63 void OnMessageInvoke(const std::string& extension_id, | 66 void OnMessageInvoke(const std::string& extension_id, |
| 64 const std::string& function_name, | 67 const std::string& function_name, |
| 65 const ListValue& args, | 68 const ListValue& args, |
| 66 const GURL& event_url); | 69 const GURL& event_url); |
| 67 void OnSetFunctionNames(const std::vector<std::string>& names); | 70 void OnSetFunctionNames(const std::vector<std::string>& names); |
| 68 void OnLoaded(const ExtensionMsg_Loaded_Params& params); | 71 void OnLoaded(const ExtensionMsg_Loaded_Params& params); |
| 69 void OnUnloaded(const std::string& id); | 72 void OnUnloaded(const std::string& id); |
| 70 void OnSetScriptingWhitelist( | 73 void OnSetScriptingWhitelist( |
| 71 const Extension::ScriptingWhitelist& extension_ids); | 74 const Extension::ScriptingWhitelist& extension_ids); |
| 72 void OnPageActionsUpdated(const std::string& extension_id, | 75 void OnPageActionsUpdated(const std::string& extension_id, |
| 73 const std::vector<std::string>& page_actions); | 76 const std::vector<std::string>& page_actions); |
| 74 void OnActivateExtension(const std::string& extension_id); | 77 void OnActivateExtension(const std::string& extension_id); |
| 75 void OnUpdateUserScripts(base::SharedMemoryHandle table); | 78 void OnUpdateUserScripts(base::SharedMemoryHandle table); |
| 76 | 79 |
| 77 // Update the list of active extensions that will be reported when we crash. | 80 // Update the list of active extensions that will be reported when we crash. |
| 78 void UpdateActiveExtensions(); | 81 void UpdateActiveExtensions(); |
| 79 | 82 |
| 80 // Calls RenderThread's RegisterExtension and keeps tracks of which v8 | 83 // Calls RenderThread's RegisterExtension and keeps tracks of which v8 |
| 81 // extension is for Chrome Extensions only. | 84 // extension is for Chrome Extensions only. |
| 82 void RegisterExtension(v8::Extension* extension, bool restrict_to_extensions); | 85 void RegisterExtension(v8::Extension* extension, bool restrict_to_extensions); |
| 83 | 86 |
| 84 // Sets up the host permissions for |extension|. | |
| 85 void InitHostPermissions(const Extension* extension); | |
| 86 | |
| 87 // True if this renderer is running extensions. | 87 // True if this renderer is running extensions. |
| 88 bool is_extension_process_; | 88 bool is_extension_process_; |
| 89 | 89 |
| 90 // Contains all loaded extensions. This is essentially the renderer | 90 // Contains all loaded extensions. This is essentially the renderer |
| 91 // counterpart to ExtensionService in the browser. It contains information | 91 // counterpart to ExtensionService in the browser. It contains information |
| 92 // about all extensions currently loaded by the browser. | 92 // about all extensions currently loaded by the browser. |
| 93 ExtensionSet extensions_; | 93 ExtensionSet extensions_; |
| 94 | 94 |
| 95 scoped_ptr<UserScriptSlave> user_script_slave_; | 95 scoped_ptr<UserScriptSlave> user_script_slave_; |
| 96 | 96 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 107 // The extensions that are active in this process. | 107 // The extensions that are active in this process. |
| 108 std::set<std::string> active_extension_ids_; | 108 std::set<std::string> active_extension_ids_; |
| 109 | 109 |
| 110 // True once WebKit has been initialized (and it is therefore safe to poke). | 110 // True once WebKit has been initialized (and it is therefore safe to poke). |
| 111 bool is_webkit_initialized_; | 111 bool is_webkit_initialized_; |
| 112 | 112 |
| 113 DISALLOW_COPY_AND_ASSIGN(ExtensionDispatcher); | 113 DISALLOW_COPY_AND_ASSIGN(ExtensionDispatcher); |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 #endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_ | 116 #endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_ |
| OLD | NEW |