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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 226 |
227 // Check if extension was uninstalled by management.uninstall. | 227 // Check if extension was uninstalled by management.uninstall. |
228 if (!service->extensions()->GetByID(params.extension_id)) | 228 if (!service->extensions()->GetByID(params.extension_id)) |
229 return; | 229 return; |
230 | 230 |
231 // We only adjust the keepalive count for UIThreadExtensionFunction for | 231 // We only adjust the keepalive count for UIThreadExtensionFunction for |
232 // now, largely for simplicity's sake. This is OK because currently, only | 232 // now, largely for simplicity's sake. This is OK because currently, only |
233 // the webRequest API uses IOThreadExtensionFunction, and that API is not | 233 // the webRequest API uses IOThreadExtensionFunction, and that API is not |
234 // compatible with lazy background pages. | 234 // compatible with lazy background pages. |
235 profile()->GetExtensionProcessManager()->IncrementLazyKeepaliveCount( | 235 profile()->GetExtensionProcessManager()->IncrementLazyKeepaliveCount( |
236 extension, ExtensionProcessManager::DONT_CANCEL_SUSPEND); | 236 extension); |
237 } | 237 } |
238 | 238 |
239 void ExtensionFunctionDispatcher::OnExtensionFunctionCompleted( | 239 void ExtensionFunctionDispatcher::OnExtensionFunctionCompleted( |
240 const Extension* extension) { | 240 const Extension* extension) { |
241 profile()->GetExtensionProcessManager()->DecrementLazyKeepaliveCount( | 241 profile()->GetExtensionProcessManager()->DecrementLazyKeepaliveCount( |
242 extension); | 242 extension); |
243 } | 243 } |
244 | 244 |
245 // static | 245 // static |
246 ExtensionFunction* ExtensionFunctionDispatcher::CreateExtensionFunction( | 246 ExtensionFunction* ExtensionFunctionDispatcher::CreateExtensionFunction( |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 } | 287 } |
288 | 288 |
289 // static | 289 // static |
290 void ExtensionFunctionDispatcher::SendAccessDenied( | 290 void ExtensionFunctionDispatcher::SendAccessDenied( |
291 IPC::Sender* ipc_sender, int routing_id, int request_id) { | 291 IPC::Sender* ipc_sender, int routing_id, int request_id) { |
292 ListValue empty_list; | 292 ListValue empty_list; |
293 ipc_sender->Send(new ExtensionMsg_Response( | 293 ipc_sender->Send(new ExtensionMsg_Response( |
294 routing_id, request_id, false, empty_list, | 294 routing_id, request_id, false, empty_list, |
295 "Access to extension API denied.")); | 295 "Access to extension API denied.")); |
296 } | 296 } |
OLD | NEW |