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 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 5 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/json/json_string_value_serializer.h" | 9 #include "base/json/json_string_value_serializer.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 | 250 |
251 // We only adjust the keepalive count for UIThreadExtensionFunction for | 251 // We only adjust the keepalive count for UIThreadExtensionFunction for |
252 // now, largely for simplicity's sake. This is OK because currently, only | 252 // now, largely for simplicity's sake. This is OK because currently, only |
253 // the webRequest API uses IOThreadExtensionFunction, and that API is not | 253 // the webRequest API uses IOThreadExtensionFunction, and that API is not |
254 // compatible with lazy background pages. | 254 // compatible with lazy background pages. |
255 process_manager->IncrementLazyKeepaliveCount(extension); | 255 process_manager->IncrementLazyKeepaliveCount(extension); |
256 } | 256 } |
257 | 257 |
258 void ExtensionFunctionDispatcher::OnExtensionFunctionCompleted( | 258 void ExtensionFunctionDispatcher::OnExtensionFunctionCompleted( |
259 const Extension* extension) { | 259 const Extension* extension) { |
260 profile()->GetExtensionProcessManager()->DecrementLazyKeepaliveCount( | 260 extensions::ExtensionSystem::Get(profile())->process_manager()-> |
261 extension); | 261 DecrementLazyKeepaliveCount(extension); |
262 } | 262 } |
263 | 263 |
264 // static | 264 // static |
265 bool ExtensionFunctionDispatcher::CheckPermissions( | 265 bool ExtensionFunctionDispatcher::CheckPermissions( |
266 ExtensionFunction* function, | 266 ExtensionFunction* function, |
267 const Extension* extension, | 267 const Extension* extension, |
268 const ExtensionHostMsg_Request_Params& params, | 268 const ExtensionHostMsg_Request_Params& params, |
269 IPC::Sender* ipc_sender, | 269 IPC::Sender* ipc_sender, |
270 int routing_id) { | 270 int routing_id) { |
271 if (!function->HasPermission()) { | 271 if (!function->HasPermission()) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 } | 323 } |
324 | 324 |
325 // static | 325 // static |
326 void ExtensionFunctionDispatcher::SendAccessDenied( | 326 void ExtensionFunctionDispatcher::SendAccessDenied( |
327 IPC::Sender* ipc_sender, int routing_id, int request_id) { | 327 IPC::Sender* ipc_sender, int routing_id, int request_id) { |
328 ListValue empty_list; | 328 ListValue empty_list; |
329 ipc_sender->Send(new ExtensionMsg_Response( | 329 ipc_sender->Send(new ExtensionMsg_Response( |
330 routing_id, request_id, false, empty_list, | 330 routing_id, request_id, false, empty_list, |
331 "Access to extension API denied.")); | 331 "Access to extension API denied.")); |
332 } | 332 } |
OLD | NEW |