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