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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 const ExtensionHostMsg_Request_Params& params, | 328 const ExtensionHostMsg_Request_Params& params, |
329 RenderViewHost* render_view_host, | 329 RenderViewHost* render_view_host, |
330 content::RenderFrameHost* render_frame_host, | 330 content::RenderFrameHost* render_frame_host, |
331 const ExtensionFunction::ResponseCallback& callback) { | 331 const ExtensionFunction::ResponseCallback& callback) { |
332 DCHECK(render_view_host || render_frame_host); | 332 DCHECK(render_view_host || render_frame_host); |
333 // TODO(yzshen): There is some shared logic between this method and | 333 // TODO(yzshen): There is some shared logic between this method and |
334 // DispatchOnIOThread(). It is nice to deduplicate. | 334 // DispatchOnIOThread(). It is nice to deduplicate. |
335 ExtensionSystem* extension_system = | 335 ExtensionSystem* extension_system = |
336 ExtensionSystem::GetForBrowserContext(browser_context_); | 336 ExtensionSystem::GetForBrowserContext(browser_context_); |
337 ExtensionService* service = extension_system->extension_service(); | 337 ExtensionService* service = extension_system->extension_service(); |
338 extensions::ProcessMap* process_map = service->process_map(); | 338 extensions::ProcessMap* process_map = |
| 339 extensions::ProcessMap::Get(browser_context_); |
339 if (!process_map) | 340 if (!process_map) |
340 return; | 341 return; |
341 | 342 |
342 const Extension* extension = service->extensions()->GetByID( | 343 const Extension* extension = service->extensions()->GetByID( |
343 params.extension_id); | 344 params.extension_id); |
344 if (!extension) | 345 if (!extension) |
345 extension = service->extensions()->GetHostedAppByURL(params.source_url); | 346 extension = service->extensions()->GetHostedAppByURL(params.source_url); |
346 | 347 |
347 int process_id = render_view_host ? render_view_host->GetProcess()->GetID() : | 348 int process_id = render_view_host ? render_view_host->GetProcess()->GetID() : |
348 render_frame_host->GetProcess()->GetID(); | 349 render_frame_host->GetProcess()->GetID(); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 return function; | 511 return function; |
511 } | 512 } |
512 | 513 |
513 // static | 514 // static |
514 void ExtensionFunctionDispatcher::SendAccessDenied( | 515 void ExtensionFunctionDispatcher::SendAccessDenied( |
515 const ExtensionFunction::ResponseCallback& callback) { | 516 const ExtensionFunction::ResponseCallback& callback) { |
516 base::ListValue empty_list; | 517 base::ListValue empty_list; |
517 callback.Run(ExtensionFunction::FAILED, empty_list, | 518 callback.Run(ExtensionFunction::FAILED, empty_list, |
518 "Access to extension API denied."); | 519 "Access to extension API denied."); |
519 } | 520 } |
OLD | NEW |