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 #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/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 void ExtensionFunctionDispatcher::DispatchOnIOThread( | 516 void ExtensionFunctionDispatcher::DispatchOnIOThread( |
517 const ExtensionInfoMap* extension_info_map, | 517 const ExtensionInfoMap* extension_info_map, |
518 void* profile, | 518 void* profile, |
519 int render_process_id, | 519 int render_process_id, |
520 base::WeakPtr<ChromeRenderMessageFilter> ipc_sender, | 520 base::WeakPtr<ChromeRenderMessageFilter> ipc_sender, |
521 int routing_id, | 521 int routing_id, |
522 const ExtensionHostMsg_Request_Params& params) { | 522 const ExtensionHostMsg_Request_Params& params) { |
523 const Extension* extension = | 523 const Extension* extension = |
524 extension_info_map->extensions().GetByURL(params.source_url); | 524 extension_info_map->extensions().GetByURL(params.source_url); |
525 | 525 |
526 if (!extension_info_map->AreBindingsEnabledForProcess(render_process_id)) { | 526 if (!extension_info_map->IsExtensionInProcess(extension->id(), |
| 527 render_process_id)) { |
527 // TODO(aa): Allow content scripts access to low-threat extension APIs. | 528 // TODO(aa): Allow content scripts access to low-threat extension APIs. |
528 // See: crbug.com/80308. | 529 // See: crbug.com/80308. |
529 LOG(ERROR) << "Extension API called from non-extension process."; | 530 LOG(ERROR) << "Extension API called from non-extension process."; |
530 SendAccessDenied(ipc_sender, routing_id, params.request_id); | 531 SendAccessDenied(ipc_sender, routing_id, params.request_id); |
531 return; | 532 return; |
532 } | 533 } |
533 | 534 |
534 scoped_refptr<ExtensionFunction> function(CreateExtensionFunction( | 535 scoped_refptr<ExtensionFunction> function(CreateExtensionFunction( |
535 params, extension, profile, ipc_sender, routing_id)); | 536 params, extension, profile, ipc_sender, routing_id)); |
536 if (!function) | 537 if (!function) |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 return function; | 681 return function; |
681 } | 682 } |
682 | 683 |
683 // static | 684 // static |
684 void ExtensionFunctionDispatcher::SendAccessDenied( | 685 void ExtensionFunctionDispatcher::SendAccessDenied( |
685 IPC::Message::Sender* ipc_sender, int routing_id, int request_id) { | 686 IPC::Message::Sender* ipc_sender, int routing_id, int request_id) { |
686 ipc_sender->Send(new ExtensionMsg_Response( | 687 ipc_sender->Send(new ExtensionMsg_Response( |
687 routing_id, request_id, false, std::string(), | 688 routing_id, request_id, false, std::string(), |
688 "Access to extension API denied.")); | 689 "Access to extension API denied.")); |
689 } | 690 } |
OLD | NEW |