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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/json/json_string_value_serializer.h" | 8 #include "base/json/json_string_value_serializer.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 callback_wrapper->CreateCallback(params.request_id)); | 315 callback_wrapper->CreateCallback(params.request_id)); |
316 } | 316 } |
317 | 317 |
318 void ExtensionFunctionDispatcher::DispatchWithCallback( | 318 void ExtensionFunctionDispatcher::DispatchWithCallback( |
319 const ExtensionHostMsg_Request_Params& params, | 319 const ExtensionHostMsg_Request_Params& params, |
320 RenderViewHost* render_view_host, | 320 RenderViewHost* render_view_host, |
321 const ExtensionFunction::ResponseCallback& callback) { | 321 const ExtensionFunction::ResponseCallback& callback) { |
322 // TODO(yzshen): There is some shared logic between this method and | 322 // TODO(yzshen): There is some shared logic between this method and |
323 // DispatchOnIOThread(). It is nice to deduplicate. | 323 // DispatchOnIOThread(). It is nice to deduplicate. |
324 ExtensionService* service = profile()->GetExtensionService(); | 324 ExtensionService* service = profile()->GetExtensionService(); |
325 ExtensionProcessManager* process_manager = | 325 extensions::ProcessManager* process_manager = |
326 extensions::ExtensionSystem::Get(profile())->process_manager(); | 326 extensions::ExtensionSystem::Get(profile())->process_manager(); |
327 extensions::ProcessMap* process_map = service->process_map(); | 327 extensions::ProcessMap* process_map = service->process_map(); |
328 if (!service || !process_map) | 328 if (!service || !process_map) |
329 return; | 329 return; |
330 | 330 |
331 const Extension* extension = service->extensions()->GetByID( | 331 const Extension* extension = service->extensions()->GetByID( |
332 params.extension_id); | 332 params.extension_id); |
333 if (!extension) | 333 if (!extension) |
334 extension = service->extensions()->GetHostedAppByURL(params.source_url); | 334 extension = service->extensions()->GetHostedAppByURL(params.source_url); |
335 | 335 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 return function; | 488 return function; |
489 } | 489 } |
490 | 490 |
491 // static | 491 // static |
492 void ExtensionFunctionDispatcher::SendAccessDenied( | 492 void ExtensionFunctionDispatcher::SendAccessDenied( |
493 const ExtensionFunction::ResponseCallback& callback) { | 493 const ExtensionFunction::ResponseCallback& callback) { |
494 ListValue empty_list; | 494 ListValue empty_list; |
495 callback.Run(ExtensionFunction::FAILED, empty_list, | 495 callback.Run(ExtensionFunction::FAILED, empty_list, |
496 "Access to extension API denied."); | 496 "Access to extension API denied."); |
497 } | 497 } |
OLD | NEW |