Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(777)

Side by Side Diff: chrome/browser/extensions/extension_function_dispatcher.cc

Issue 16625012: Remove ExtensionURLInfo, make security decisions in render process (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nacl Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 ExtensionService* service = profile()->GetExtensionService(); 355 ExtensionService* service = profile()->GetExtensionService();
356 ExtensionProcessManager* process_manager = 356 ExtensionProcessManager* process_manager =
357 extensions::ExtensionSystem::Get(profile())->process_manager(); 357 extensions::ExtensionSystem::Get(profile())->process_manager();
358 extensions::ProcessMap* process_map = service->process_map(); 358 extensions::ProcessMap* process_map = service->process_map();
359 if (!service || !process_map) 359 if (!service || !process_map)
360 return; 360 return;
361 361
362 const Extension* extension = service->extensions()->GetByID( 362 const Extension* extension = service->extensions()->GetByID(
363 params.extension_id); 363 params.extension_id);
364 if (!extension) 364 if (!extension)
365 extension = service->extensions()->GetHostedAppByURL(ExtensionURLInfo( 365 extension = service->extensions()->GetHostedAppByURL(params.source_url);
366 WebSecurityOrigin::createFromString(params.source_origin),
367 params.source_url));
368 366
369 scoped_refptr<ExtensionFunction> function( 367 scoped_refptr<ExtensionFunction> function(
370 CreateExtensionFunction(params, extension, 368 CreateExtensionFunction(params, extension,
371 render_view_host->GetProcess()->GetID(), 369 render_view_host->GetProcess()->GetID(),
372 *(service->process_map()), 370 *(service->process_map()),
373 extensions::ExtensionAPI::GetSharedInstance(), 371 extensions::ExtensionAPI::GetSharedInstance(),
374 profile(), callback)); 372 profile(), callback));
375 scoped_ptr<ListValue> args(params.arguments.DeepCopy()); 373 scoped_ptr<ListValue> args(params.arguments.DeepCopy());
376 374
377 if (!function.get()) { 375 if (!function.get()) {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 return function; 535 return function;
538 } 536 }
539 537
540 // static 538 // static
541 void ExtensionFunctionDispatcher::SendAccessDenied( 539 void ExtensionFunctionDispatcher::SendAccessDenied(
542 const ExtensionFunction::ResponseCallback& callback) { 540 const ExtensionFunction::ResponseCallback& callback) {
543 ListValue empty_list; 541 ListValue empty_list;
544 callback.Run(ExtensionFunction::FAILED, empty_list, 542 callback.Run(ExtensionFunction::FAILED, empty_list,
545 "Access to extension API denied."); 543 "Access to extension API denied.");
546 } 544 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698