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_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 static bool OverrideFunction(const std::string& name, | 71 static bool OverrideFunction(const std::string& name, |
72 ExtensionFunctionFactory factory); | 72 ExtensionFunctionFactory factory); |
73 | 73 |
74 // Resets all functions to their initial implementation. | 74 // Resets all functions to their initial implementation. |
75 static void ResetFunctions(); | 75 static void ResetFunctions(); |
76 | 76 |
77 // Dispatches an IO-thread extension function. Only used for specific | 77 // Dispatches an IO-thread extension function. Only used for specific |
78 // functions that must be handled on the IO-thread. | 78 // functions that must be handled on the IO-thread. |
79 static void DispatchOnIOThread( | 79 static void DispatchOnIOThread( |
80 const ExtensionInfoMap* extension_info_map, | 80 const ExtensionInfoMap* extension_info_map, |
81 ProfileId profile_id, | 81 void* profile, |
82 int render_process_id, | 82 int render_process_id, |
83 base::WeakPtr<ChromeRenderMessageFilter> ipc_sender, | 83 base::WeakPtr<ChromeRenderMessageFilter> ipc_sender, |
84 int routing_id, | 84 int routing_id, |
85 const ExtensionHostMsg_Request_Params& params); | 85 const ExtensionHostMsg_Request_Params& params); |
86 | 86 |
87 // Public constructor. Callers must ensure that: | 87 // Public constructor. Callers must ensure that: |
88 // - |delegate| outlives this object. | 88 // - |delegate| outlives this object. |
89 // - This object outlives any RenderViewHost's passed to created | 89 // - This object outlives any RenderViewHost's passed to created |
90 // ExtensionFunctions. | 90 // ExtensionFunctions. |
91 ExtensionFunctionDispatcher(Profile* profile, Delegate* delegate); | 91 ExtensionFunctionDispatcher(Profile* profile, Delegate* delegate); |
(...skipping 18 matching lines...) Expand all Loading... |
110 // The profile that this dispatcher is associated with. | 110 // The profile that this dispatcher is associated with. |
111 Profile* profile() { return profile_; } | 111 Profile* profile() { return profile_; } |
112 | 112 |
113 private: | 113 private: |
114 // Helper to create an ExtensionFunction to handle the function given by | 114 // Helper to create an ExtensionFunction to handle the function given by |
115 // |params|. Can be called on any thread. | 115 // |params|. Can be called on any thread. |
116 // Does not set subclass properties, or include_incognito. | 116 // Does not set subclass properties, or include_incognito. |
117 static ExtensionFunction* CreateExtensionFunction( | 117 static ExtensionFunction* CreateExtensionFunction( |
118 const ExtensionHostMsg_Request_Params& params, | 118 const ExtensionHostMsg_Request_Params& params, |
119 const Extension* extension, | 119 const Extension* extension, |
120 ProfileId profile_id, | 120 void* profile, |
121 int render_process_id, | 121 int render_process_id, |
122 IPC::Message::Sender* ipc_sender, | 122 IPC::Message::Sender* ipc_sender, |
123 int routing_id); | 123 int routing_id); |
124 | 124 |
125 // Helper to send an access denied error to the requesting renderer. Can be | 125 // Helper to send an access denied error to the requesting renderer. Can be |
126 // called on any thread. | 126 // called on any thread. |
127 static void SendAccessDenied(IPC::Message::Sender* ipc_sender, | 127 static void SendAccessDenied(IPC::Message::Sender* ipc_sender, |
128 int routing_id, | 128 int routing_id, |
129 int request_id); | 129 int request_id); |
130 | 130 |
131 Profile* profile_; | 131 Profile* profile_; |
132 | 132 |
133 Delegate* delegate_; | 133 Delegate* delegate_; |
134 }; | 134 }; |
135 | 135 |
136 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ | 136 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ |
OLD | NEW |