| 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 <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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |