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

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

Issue 9950046: Implement FeatureProvider for ExtensionAPI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: hate hate hate Created 8 years, 8 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 <map> 7 #include <map>
8 8
9 #include "base/json/json_string_value_serializer.h" 9 #include "base/json/json_string_value_serializer.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 const extensions::ProcessMap& process_map, 244 const extensions::ProcessMap& process_map,
245 void* profile, 245 void* profile,
246 IPC::Message::Sender* ipc_sender, 246 IPC::Message::Sender* ipc_sender,
247 int routing_id) { 247 int routing_id) {
248 if (!extension) { 248 if (!extension) {
249 LOG(ERROR) << "Specified extension does not exist."; 249 LOG(ERROR) << "Specified extension does not exist.";
250 SendAccessDenied(ipc_sender, routing_id, params.request_id); 250 SendAccessDenied(ipc_sender, routing_id, params.request_id);
251 return NULL; 251 return NULL;
252 } 252 }
253 253
254 if (ExtensionAPI::GetInstance()->IsPrivileged(params.name) && 254 if (ExtensionAPI::GetSharedInstance()->IsPrivileged(params.name) &&
255 !process_map.Contains(extension->id(), requesting_process_id)) { 255 !process_map.Contains(extension->id(), requesting_process_id)) {
256 LOG(ERROR) << "Extension API called from incorrect process " 256 LOG(ERROR) << "Extension API called from incorrect process "
257 << requesting_process_id 257 << requesting_process_id
258 << " from URL " << params.source_url.spec(); 258 << " from URL " << params.source_url.spec();
259 SendAccessDenied(ipc_sender, routing_id, params.request_id); 259 SendAccessDenied(ipc_sender, routing_id, params.request_id);
260 return NULL; 260 return NULL;
261 } 261 }
262 262
263 if (!extension->HasAPIPermission(params.name)) { 263 if (!extension->HasAPIPermission(params.name)) {
264 LOG(ERROR) << "Extension " << extension->id() << " does not have " 264 LOG(ERROR) << "Extension " << extension->id() << " does not have "
(...skipping 14 matching lines...) Expand all
279 return function; 279 return function;
280 } 280 }
281 281
282 // static 282 // static
283 void ExtensionFunctionDispatcher::SendAccessDenied( 283 void ExtensionFunctionDispatcher::SendAccessDenied(
284 IPC::Message::Sender* ipc_sender, int routing_id, int request_id) { 284 IPC::Message::Sender* ipc_sender, int routing_id, int request_id) {
285 ipc_sender->Send(new ExtensionMsg_Response( 285 ipc_sender->Send(new ExtensionMsg_Response(
286 routing_id, request_id, false, std::string(), 286 routing_id, request_id, false, std::string(),
287 "Access to extension API denied.")); 287 "Access to extension API denied."));
288 } 288 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_event_router.cc ('k') | chrome/browser/extensions/settings/settings_frontend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698