Chromium Code Reviews| 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 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 603 const ExtensionHostMsg_Request_Params& params, | 603 const ExtensionHostMsg_Request_Params& params, |
| 604 RenderViewHost* render_view_host) { | 604 RenderViewHost* render_view_host) { |
| 605 ExtensionService* service = profile()->GetExtensionService(); | 605 ExtensionService* service = profile()->GetExtensionService(); |
| 606 extensions::ProcessMap* process_map = service->process_map(); | 606 extensions::ProcessMap* process_map = service->process_map(); |
| 607 if (!service || !process_map) | 607 if (!service || !process_map) |
| 608 return; | 608 return; |
| 609 | 609 |
| 610 const Extension* extension = service->GetExtensionById( | 610 const Extension* extension = service->GetExtensionById( |
| 611 params.extension_id, false); | 611 params.extension_id, false); |
| 612 if (!extension) | 612 if (!extension) |
| 613 extension = service->GetExtensionByWebExtent(params.source_url); | 613 extension = service->extensions()->GetByWebExtent(params.source_url); |
|
abarth-chromium
2011/12/07 23:51:44
Ideally we'd have the SecurityOrigin here as well
Yoyo Zhou
2011/12/09 00:18:55
Done.
| |
| 614 | 614 |
| 615 scoped_refptr<ExtensionFunction> function( | 615 scoped_refptr<ExtensionFunction> function( |
| 616 CreateExtensionFunction(params, extension, | 616 CreateExtensionFunction(params, extension, |
| 617 render_view_host->process()->GetID(), | 617 render_view_host->process()->GetID(), |
| 618 *(service->process_map()), | 618 *(service->process_map()), |
| 619 profile(), render_view_host, | 619 profile(), render_view_host, |
| 620 render_view_host->routing_id())); | 620 render_view_host->routing_id())); |
| 621 if (!function) | 621 if (!function) |
| 622 return; | 622 return; |
| 623 | 623 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 687 return function; | 687 return function; |
| 688 } | 688 } |
| 689 | 689 |
| 690 // static | 690 // static |
| 691 void ExtensionFunctionDispatcher::SendAccessDenied( | 691 void ExtensionFunctionDispatcher::SendAccessDenied( |
| 692 IPC::Message::Sender* ipc_sender, int routing_id, int request_id) { | 692 IPC::Message::Sender* ipc_sender, int routing_id, int request_id) { |
| 693 ipc_sender->Send(new ExtensionMsg_Response( | 693 ipc_sender->Send(new ExtensionMsg_Response( |
| 694 routing_id, request_id, false, std::string(), | 694 routing_id, request_id, false, std::string(), |
| 695 "Access to extension API denied.")); | 695 "Access to extension API denied.")); |
| 696 } | 696 } |
| OLD | NEW |