[email protected] | 64c82073 | 2012-01-05 20:50:34 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "chrome/browser/extensions/extension_function_dispatcher.h" |
| 6 | |
[email protected] | 745feedb | 2010-08-02 04:08:07 | [diff] [blame] | 7 | #include <map> |
| 8 | |
[email protected] | ffbec69 | 2012-02-26 20:26:42 | [diff] [blame] | 9 | #include "base/json/json_string_value_serializer.h" |
[email protected] | 5bc248a | 2012-04-04 23:38:11 | [diff] [blame] | 10 | #include "base/lazy_instance.h" |
[email protected] | 3b63f8f4 | 2011-03-28 01:54:15 | [diff] [blame] | 11 | #include "base/memory/ref_counted.h" |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 12 | #include "base/process_util.h" |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 13 | #include "base/values.h" |
[email protected] | 17d40f0 | 2010-07-01 01:18:06 | [diff] [blame] | 14 | #include "build/build_config.h" |
[email protected] | efd7599 | 2011-12-15 22:42:42 | [diff] [blame] | 15 | #include "chrome/browser/extensions/extension_activity_log.h" |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 16 | #include "chrome/browser/extensions/extension_function.h" |
[email protected] | ae33d32 | 2012-03-19 22:24:35 | [diff] [blame] | 17 | #include "chrome/browser/extensions/extension_function_registry.h" |
[email protected] | 2f69b38 | 2011-02-19 00:34:25 | [diff] [blame] | 18 | #include "chrome/browser/extensions/extension_service.h" |
[email protected] | 8f9d4eb | 2011-02-05 01:39:10 | [diff] [blame] | 19 | #include "chrome/browser/extensions/extension_web_ui.h" |
[email protected] | d13950e | 2009-12-04 01:43:02 | [diff] [blame] | 20 | #include "chrome/browser/extensions/extensions_quota_service.h" |
[email protected] | 83820d4 | 2011-11-12 22:03:11 | [diff] [blame] | 21 | #include "chrome/browser/extensions/process_map.h" |
[email protected] | ed2b100 | 2011-05-25 14:12:10 | [diff] [blame] | 22 | #include "chrome/browser/external_protocol/external_protocol_handler.h" |
[email protected] | 8ecad5e | 2010-12-02 21:18:33 | [diff] [blame] | 23 | #include "chrome/browser/profiles/profile.h" |
[email protected] | c357acb4 | 2011-06-09 20:52:42 | [diff] [blame] | 24 | #include "chrome/browser/renderer_host/chrome_render_message_filter.h" |
[email protected] | 83820d4 | 2011-11-12 22:03:11 | [diff] [blame] | 25 | #include "chrome/common/extensions/api/extension_api.h" |
[email protected] | 44c49c9 | 2011-03-28 16:17:23 | [diff] [blame] | 26 | #include "chrome/common/extensions/extension_messages.h" |
[email protected] | 615d88f | 2011-12-13 01:47:44 | [diff] [blame] | 27 | #include "chrome/common/extensions/extension_set.h" |
[email protected] | 9c45b718 | 2009-08-04 16:44:43 | [diff] [blame] | 28 | #include "chrome/common/url_constants.h" |
[email protected] | c333e79 | 2012-01-06 16:57:39 | [diff] [blame] | 29 | #include "content/public/browser/render_process_host.h" |
[email protected] | 9c1662b | 2012-03-06 15:44:33 | [diff] [blame] | 30 | #include "content/public/browser/render_view_host.h" |
[email protected] | f82d57b5 | 2011-04-27 19:13:17 | [diff] [blame] | 31 | #include "ipc/ipc_message.h" |
| 32 | #include "ipc/ipc_message_macros.h" |
[email protected] | 615d88f | 2011-12-13 01:47:44 | [diff] [blame] | 33 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" |
[email protected] | 9c1662b | 2012-03-06 15:44:33 | [diff] [blame] | 34 | #include "third_party/skia/include/core/SkBitmap.h" |
[email protected] | ae33d32 | 2012-03-19 22:24:35 | [diff] [blame] | 35 | #include "webkit/glue/resource_type.h" |
[email protected] | 61b55b6 | 2011-03-24 09:03:10 | [diff] [blame] | 36 | |
[email protected] | 1c321ee | 2012-05-21 03:02:34 | [diff] [blame^] | 37 | using extensions::Extension; |
[email protected] | 83820d4 | 2011-11-12 22:03:11 | [diff] [blame] | 38 | using extensions::ExtensionAPI; |
[email protected] | eaabba2 | 2012-03-07 15:02:11 | [diff] [blame] | 39 | using content::RenderViewHost; |
[email protected] | 615d88f | 2011-12-13 01:47:44 | [diff] [blame] | 40 | using WebKit::WebSecurityOrigin; |
[email protected] | 83820d4 | 2011-11-12 22:03:11 | [diff] [blame] | 41 | |
[email protected] | 5bc248a | 2012-04-04 23:38:11 | [diff] [blame] | 42 | namespace { |
| 43 | |
[email protected] | efd7599 | 2011-12-15 22:42:42 | [diff] [blame] | 44 | const char kAccessDenied[] = "access denied"; |
| 45 | const char kQuotaExceeded[] = "quota exceeded"; |
| 46 | |
| 47 | void LogSuccess(const Extension* extension, |
| 48 | const ExtensionHostMsg_Request_Params& params) { |
| 49 | ExtensionActivityLog* extension_activity_log = |
| 50 | ExtensionActivityLog::GetInstance(); |
| 51 | if (extension_activity_log->HasObservers(extension)) { |
| 52 | std::string call_signature = params.name + "("; |
| 53 | ListValue::const_iterator it = params.arguments.begin(); |
| 54 | for (; it != params.arguments.end(); ++it) { |
| 55 | std::string arg; |
| 56 | JSONStringValueSerializer serializer(&arg); |
| 57 | if (serializer.SerializeAndOmitBinaryValues(**it)) { |
| 58 | if (it != params.arguments.begin()) |
| 59 | call_signature += ", "; |
| 60 | call_signature += arg; |
| 61 | } |
| 62 | } |
| 63 | call_signature += ")"; |
| 64 | |
| 65 | extension_activity_log->Log( |
| 66 | extension, |
| 67 | ExtensionActivityLog::ACTIVITY_EXTENSION_API_CALL, |
| 68 | call_signature); |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | void LogFailure(const Extension* extension, |
| 73 | const std::string& func_name, |
| 74 | const char* reason) { |
| 75 | ExtensionActivityLog* extension_activity_log = |
| 76 | ExtensionActivityLog::GetInstance(); |
| 77 | if (extension_activity_log->HasObservers(extension)) { |
| 78 | extension_activity_log->Log( |
| 79 | extension, |
| 80 | ExtensionActivityLog::ACTIVITY_EXTENSION_API_BLOCK, |
| 81 | func_name + ": " + reason); |
| 82 | } |
| 83 | } |
| 84 | |
[email protected] | 5bc248a | 2012-04-04 23:38:11 | [diff] [blame] | 85 | // Separate copy of ExtensionAPI used for IO thread extension functions. We need |
| 86 | // this because ExtensionAPI has mutable data. It should be possible to remove |
| 87 | // this once all the extension APIs are updated to the feature system. |
| 88 | struct Static { |
| 89 | Static() |
| 90 | : api(extensions::ExtensionAPI::CreateWithDefaultConfiguration()) { |
| 91 | } |
| 92 | scoped_ptr<extensions::ExtensionAPI> api; |
| 93 | }; |
| 94 | base::LazyInstance<Static> g_global_io_data = LAZY_INSTANCE_INITIALIZER; |
| 95 | |
| 96 | } // namespace |
| 97 | |
[email protected] | d72d3a6 | 2012-05-10 03:45:08 | [diff] [blame] | 98 | ExtensionWindowController* |
| 99 | ExtensionFunctionDispatcher::Delegate::GetExtensionWindowController() |
| 100 | const { |
| 101 | return NULL; |
| 102 | } |
| 103 | |
| 104 | content::WebContents* |
| 105 | ExtensionFunctionDispatcher::Delegate::GetAssociatedWebContents() const { |
| 106 | return NULL; |
| 107 | } |
[email protected] | 5bc248a | 2012-04-04 23:38:11 | [diff] [blame] | 108 | |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 109 | void ExtensionFunctionDispatcher::GetAllFunctionNames( |
| 110 | std::vector<std::string>* names) { |
[email protected] | ae33d32 | 2012-03-19 22:24:35 | [diff] [blame] | 111 | ExtensionFunctionRegistry::GetInstance()->GetAllNames(names); |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 112 | } |
| 113 | |
[email protected] | b83e460 | 2009-05-15 22:58:33 | [diff] [blame] | 114 | bool ExtensionFunctionDispatcher::OverrideFunction( |
| 115 | const std::string& name, ExtensionFunctionFactory factory) { |
[email protected] | ae33d32 | 2012-03-19 22:24:35 | [diff] [blame] | 116 | return ExtensionFunctionRegistry::GetInstance()->OverrideFunction(name, |
| 117 | factory); |
[email protected] | b83e460 | 2009-05-15 22:58:33 | [diff] [blame] | 118 | } |
| 119 | |
| 120 | void ExtensionFunctionDispatcher::ResetFunctions() { |
[email protected] | ae33d32 | 2012-03-19 22:24:35 | [diff] [blame] | 121 | ExtensionFunctionRegistry::GetInstance()->ResetFunctions(); |
[email protected] | b83e460 | 2009-05-15 22:58:33 | [diff] [blame] | 122 | } |
| 123 | |
[email protected] | c357acb4 | 2011-06-09 20:52:42 | [diff] [blame] | 124 | // static |
| 125 | void ExtensionFunctionDispatcher::DispatchOnIOThread( |
[email protected] | fd50e7b | 2011-11-03 09:20:25 | [diff] [blame] | 126 | ExtensionInfoMap* extension_info_map, |
[email protected] | 67351452 | 2011-07-13 18:17:18 | [diff] [blame] | 127 | void* profile, |
[email protected] | c357acb4 | 2011-06-09 20:52:42 | [diff] [blame] | 128 | int render_process_id, |
| 129 | base::WeakPtr<ChromeRenderMessageFilter> ipc_sender, |
| 130 | int routing_id, |
| 131 | const ExtensionHostMsg_Request_Params& params) { |
| 132 | const Extension* extension = |
[email protected] | 83820d4 | 2011-11-12 22:03:11 | [diff] [blame] | 133 | extension_info_map->extensions().GetByID(params.extension_id); |
[email protected] | c357acb4 | 2011-06-09 20:52:42 | [diff] [blame] | 134 | |
[email protected] | 6f37144 | 2011-11-09 06:45:46 | [diff] [blame] | 135 | scoped_refptr<ExtensionFunction> function( |
| 136 | CreateExtensionFunction(params, extension, render_process_id, |
[email protected] | 5bc248a | 2012-04-04 23:38:11 | [diff] [blame] | 137 | extension_info_map->process_map(), |
| 138 | g_global_io_data.Get().api.get(), |
| 139 | profile, |
[email protected] | 6f37144 | 2011-11-09 06:45:46 | [diff] [blame] | 140 | ipc_sender, routing_id)); |
[email protected] | efd7599 | 2011-12-15 22:42:42 | [diff] [blame] | 141 | if (!function) { |
| 142 | LogFailure(extension, params.name, kAccessDenied); |
[email protected] | c357acb4 | 2011-06-09 20:52:42 | [diff] [blame] | 143 | return; |
[email protected] | efd7599 | 2011-12-15 22:42:42 | [diff] [blame] | 144 | } |
[email protected] | c357acb4 | 2011-06-09 20:52:42 | [diff] [blame] | 145 | |
| 146 | IOThreadExtensionFunction* function_io = |
| 147 | function->AsIOThreadExtensionFunction(); |
| 148 | if (!function_io) { |
| 149 | NOTREACHED(); |
| 150 | return; |
| 151 | } |
| 152 | function_io->set_ipc_sender(ipc_sender, routing_id); |
| 153 | function_io->set_extension_info_map(extension_info_map); |
| 154 | function->set_include_incognito( |
| 155 | extension_info_map->IsIncognitoEnabled(extension->id())); |
[email protected] | fd50e7b | 2011-11-03 09:20:25 | [diff] [blame] | 156 | |
[email protected] | 3629691 | 2012-03-20 11:08:49 | [diff] [blame] | 157 | ExtensionsQuotaService* quota = extension_info_map->GetQuotaService(); |
[email protected] | fd50e7b | 2011-11-03 09:20:25 | [diff] [blame] | 158 | if (quota->Assess(extension->id(), function, ¶ms.arguments, |
| 159 | base::TimeTicks::Now())) { |
| 160 | function->Run(); |
[email protected] | efd7599 | 2011-12-15 22:42:42 | [diff] [blame] | 161 | LogSuccess(extension, params); |
[email protected] | fd50e7b | 2011-11-03 09:20:25 | [diff] [blame] | 162 | } else { |
| 163 | function->OnQuotaExceeded(); |
[email protected] | efd7599 | 2011-12-15 22:42:42 | [diff] [blame] | 164 | LogFailure(extension, params.name, kQuotaExceeded); |
[email protected] | fd50e7b | 2011-11-03 09:20:25 | [diff] [blame] | 165 | } |
[email protected] | c357acb4 | 2011-06-09 20:52:42 | [diff] [blame] | 166 | } |
| 167 | |
[email protected] | c5dbef0 | 2011-05-13 05:06:09 | [diff] [blame] | 168 | ExtensionFunctionDispatcher::ExtensionFunctionDispatcher(Profile* profile, |
| 169 | Delegate* delegate) |
| 170 | : profile_(profile), |
[email protected] | 55ce33071 | 2011-05-24 19:04:27 | [diff] [blame] | 171 | delegate_(delegate) { |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 172 | } |
| 173 | |
[email protected] | 32dda36 | 2009-06-05 19:07:01 | [diff] [blame] | 174 | ExtensionFunctionDispatcher::~ExtensionFunctionDispatcher() { |
[email protected] | 32dda36 | 2009-06-05 19:07:01 | [diff] [blame] | 175 | } |
| 176 | |
[email protected] | c5dbef0 | 2011-05-13 05:06:09 | [diff] [blame] | 177 | void ExtensionFunctionDispatcher::Dispatch( |
| 178 | const ExtensionHostMsg_Request_Params& params, |
| 179 | RenderViewHost* render_view_host) { |
[email protected] | c5dbef0 | 2011-05-13 05:06:09 | [diff] [blame] | 180 | ExtensionService* service = profile()->GetExtensionService(); |
[email protected] | 6f37144 | 2011-11-09 06:45:46 | [diff] [blame] | 181 | extensions::ProcessMap* process_map = service->process_map(); |
| 182 | if (!service || !process_map) |
[email protected] | c5dbef0 | 2011-05-13 05:06:09 | [diff] [blame] | 183 | return; |
| 184 | |
[email protected] | 615d88f | 2011-12-13 01:47:44 | [diff] [blame] | 185 | const Extension* extension = service->extensions()->GetByID( |
| 186 | params.extension_id); |
[email protected] | c5dbef0 | 2011-05-13 05:06:09 | [diff] [blame] | 187 | if (!extension) |
[email protected] | 615d88f | 2011-12-13 01:47:44 | [diff] [blame] | 188 | extension = service->extensions()->GetHostedAppByURL(ExtensionURLInfo( |
| 189 | WebSecurityOrigin::createFromString(params.source_origin), |
| 190 | params.source_url)); |
[email protected] | c5dbef0 | 2011-05-13 05:06:09 | [diff] [blame] | 191 | |
[email protected] | 8add541 | 2011-10-01 21:02:14 | [diff] [blame] | 192 | scoped_refptr<ExtensionFunction> function( |
[email protected] | 6f37144 | 2011-11-09 06:45:46 | [diff] [blame] | 193 | CreateExtensionFunction(params, extension, |
[email protected] | 9f76c1e | 2012-03-05 15:15:58 | [diff] [blame] | 194 | render_view_host->GetProcess()->GetID(), |
[email protected] | 6f37144 | 2011-11-09 06:45:46 | [diff] [blame] | 195 | *(service->process_map()), |
[email protected] | 5bc248a | 2012-04-04 23:38:11 | [diff] [blame] | 196 | extensions::ExtensionAPI::GetSharedInstance(), |
[email protected] | 6f37144 | 2011-11-09 06:45:46 | [diff] [blame] | 197 | profile(), render_view_host, |
[email protected] | 9f76c1e | 2012-03-05 15:15:58 | [diff] [blame] | 198 | render_view_host->GetRoutingID())); |
[email protected] | efd7599 | 2011-12-15 22:42:42 | [diff] [blame] | 199 | if (!function) { |
| 200 | LogFailure(extension, params.name, kAccessDenied); |
[email protected] | f82d57b5 | 2011-04-27 19:13:17 | [diff] [blame] | 201 | return; |
[email protected] | efd7599 | 2011-12-15 22:42:42 | [diff] [blame] | 202 | } |
[email protected] | f82d57b5 | 2011-04-27 19:13:17 | [diff] [blame] | 203 | |
[email protected] | a2aef2e | 2011-05-26 22:48:12 | [diff] [blame] | 204 | UIThreadExtensionFunction* function_ui = |
| 205 | function->AsUIThreadExtensionFunction(); |
| 206 | if (!function_ui) { |
| 207 | NOTREACHED(); |
| 208 | return; |
| 209 | } |
| 210 | function_ui->SetRenderViewHost(render_view_host); |
| 211 | function_ui->set_dispatcher(AsWeakPtr()); |
| 212 | function_ui->set_profile(profile_); |
[email protected] | 2a8f24e | 2010-11-03 21:37:05 | [diff] [blame] | 213 | function->set_include_incognito(service->CanCrossIncognito(extension)); |
[email protected] | cb0ce1e02 | 2010-03-10 19:54:41 | [diff] [blame] | 214 | |
[email protected] | d13950e | 2009-12-04 01:43:02 | [diff] [blame] | 215 | ExtensionsQuotaService* quota = service->quota_service(); |
[email protected] | c5dbef0 | 2011-05-13 05:06:09 | [diff] [blame] | 216 | if (quota->Assess(extension->id(), function, ¶ms.arguments, |
[email protected] | 8b8e7c9 | 2010-08-19 18:05:56 | [diff] [blame] | 217 | base::TimeTicks::Now())) { |
[email protected] | d070ec6 | 2010-07-27 21:28:26 | [diff] [blame] | 218 | // See crbug.com/39178. |
| 219 | ExternalProtocolHandler::PermitLaunchUrl(); |
| 220 | |
[email protected] | d13950e | 2009-12-04 01:43:02 | [diff] [blame] | 221 | function->Run(); |
[email protected] | efd7599 | 2011-12-15 22:42:42 | [diff] [blame] | 222 | LogSuccess(extension, params); |
[email protected] | d13950e | 2009-12-04 01:43:02 | [diff] [blame] | 223 | } else { |
[email protected] | fd50e7b | 2011-11-03 09:20:25 | [diff] [blame] | 224 | function->OnQuotaExceeded(); |
[email protected] | efd7599 | 2011-12-15 22:42:42 | [diff] [blame] | 225 | LogFailure(extension, params.name, kQuotaExceeded); |
[email protected] | d13950e | 2009-12-04 01:43:02 | [diff] [blame] | 226 | } |
[email protected] | 720ad131 | 2012-02-27 23:07:36 | [diff] [blame] | 227 | |
[email protected] | 5734e88 | 2012-05-04 22:17:56 | [diff] [blame] | 228 | // Check if extension was uninstalled by management.uninstall. |
| 229 | if (!service->extensions()->GetByID(params.extension_id)) |
| 230 | return; |
| 231 | |
[email protected] | 720ad131 | 2012-02-27 23:07:36 | [diff] [blame] | 232 | // We only adjust the keepalive count for UIThreadExtensionFunction for |
| 233 | // now, largely for simplicity's sake. This is OK because currently, only |
| 234 | // the webRequest API uses IOThreadExtensionFunction, and that API is not |
| 235 | // compatible with lazy background pages. |
| 236 | profile()->GetExtensionProcessManager()->IncrementLazyKeepaliveCount( |
| 237 | extension); |
| 238 | } |
| 239 | |
| 240 | void ExtensionFunctionDispatcher::OnExtensionFunctionCompleted( |
| 241 | const Extension* extension) { |
| 242 | profile()->GetExtensionProcessManager()->DecrementLazyKeepaliveCount( |
| 243 | extension); |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 244 | } |
| 245 | |
[email protected] | c357acb4 | 2011-06-09 20:52:42 | [diff] [blame] | 246 | // static |
| 247 | ExtensionFunction* ExtensionFunctionDispatcher::CreateExtensionFunction( |
| 248 | const ExtensionHostMsg_Request_Params& params, |
| 249 | const Extension* extension, |
[email protected] | 6f37144 | 2011-11-09 06:45:46 | [diff] [blame] | 250 | int requesting_process_id, |
| 251 | const extensions::ProcessMap& process_map, |
[email protected] | 5bc248a | 2012-04-04 23:38:11 | [diff] [blame] | 252 | extensions::ExtensionAPI* api, |
[email protected] | 67351452 | 2011-07-13 18:17:18 | [diff] [blame] | 253 | void* profile, |
[email protected] | c357acb4 | 2011-06-09 20:52:42 | [diff] [blame] | 254 | IPC::Message::Sender* ipc_sender, |
| 255 | int routing_id) { |
[email protected] | c357acb4 | 2011-06-09 20:52:42 | [diff] [blame] | 256 | if (!extension) { |
[email protected] | 6f37144 | 2011-11-09 06:45:46 | [diff] [blame] | 257 | LOG(ERROR) << "Specified extension does not exist."; |
| 258 | SendAccessDenied(ipc_sender, routing_id, params.request_id); |
| 259 | return NULL; |
| 260 | } |
| 261 | |
[email protected] | 5bc248a | 2012-04-04 23:38:11 | [diff] [blame] | 262 | if (api->IsPrivileged(params.name) && |
[email protected] | 83820d4 | 2011-11-12 22:03:11 | [diff] [blame] | 263 | !process_map.Contains(extension->id(), requesting_process_id)) { |
[email protected] | 6f37144 | 2011-11-09 06:45:46 | [diff] [blame] | 264 | LOG(ERROR) << "Extension API called from incorrect process " |
| 265 | << requesting_process_id |
| 266 | << " from URL " << params.source_url.spec(); |
[email protected] | c357acb4 | 2011-06-09 20:52:42 | [diff] [blame] | 267 | SendAccessDenied(ipc_sender, routing_id, params.request_id); |
| 268 | return NULL; |
| 269 | } |
| 270 | |
[email protected] | 0d3e4a2 | 2011-06-23 19:02:52 | [diff] [blame] | 271 | if (!extension->HasAPIPermission(params.name)) { |
[email protected] | c357acb4 | 2011-06-09 20:52:42 | [diff] [blame] | 272 | LOG(ERROR) << "Extension " << extension->id() << " does not have " |
| 273 | << "permission to function: " << params.name; |
| 274 | SendAccessDenied(ipc_sender, routing_id, params.request_id); |
| 275 | return NULL; |
| 276 | } |
| 277 | |
| 278 | ExtensionFunction* function = |
[email protected] | ae33d32 | 2012-03-19 22:24:35 | [diff] [blame] | 279 | ExtensionFunctionRegistry::GetInstance()->NewFunction(params.name); |
[email protected] | c357acb4 | 2011-06-09 20:52:42 | [diff] [blame] | 280 | function->SetArgs(¶ms.arguments); |
| 281 | function->set_source_url(params.source_url); |
| 282 | function->set_request_id(params.request_id); |
| 283 | function->set_has_callback(params.has_callback); |
| 284 | function->set_user_gesture(params.user_gesture); |
| 285 | function->set_extension(extension); |
[email protected] | 637bf32 | 2011-10-01 20:46:32 | [diff] [blame] | 286 | function->set_profile_id(profile); |
[email protected] | c357acb4 | 2011-06-09 20:52:42 | [diff] [blame] | 287 | return function; |
| 288 | } |
| 289 | |
| 290 | // static |
[email protected] | c5dbef0 | 2011-05-13 05:06:09 | [diff] [blame] | 291 | void ExtensionFunctionDispatcher::SendAccessDenied( |
[email protected] | c357acb4 | 2011-06-09 20:52:42 | [diff] [blame] | 292 | IPC::Message::Sender* ipc_sender, int routing_id, int request_id) { |
[email protected] | 602542d | 2012-04-20 02:48:01 | [diff] [blame] | 293 | ListValue empty_list; |
[email protected] | c357acb4 | 2011-06-09 20:52:42 | [diff] [blame] | 294 | ipc_sender->Send(new ExtensionMsg_Response( |
[email protected] | 602542d | 2012-04-20 02:48:01 | [diff] [blame] | 295 | routing_id, request_id, false, empty_list, |
[email protected] | c5dbef0 | 2011-05-13 05:06:09 | [diff] [blame] | 296 | "Access to extension API denied.")); |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 297 | } |