| 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/nacl_host/nacl_file_host.h" | 5 #include "chrome/browser/nacl_host/nacl_file_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 | 202 |
| 203 // Convert the file URL into a file path in the extension directory. | 203 // Convert the file URL into a file path in the extension directory. |
| 204 // This function is security sensitive. Be sure to check with a security | 204 // This function is security sensitive. Be sure to check with a security |
| 205 // person before you modify it. | 205 // person before you modify it. |
| 206 bool GetExtensionFilePath( | 206 bool GetExtensionFilePath( |
| 207 scoped_refptr<ExtensionInfoMap> extension_info_map, | 207 scoped_refptr<ExtensionInfoMap> extension_info_map, |
| 208 const GURL& file_url, | 208 const GURL& file_url, |
| 209 base::FilePath* file_path) { | 209 base::FilePath* file_path) { |
| 210 // Check that the URL is recognized by the extension system. | 210 // Check that the URL is recognized by the extension system. |
| 211 const extensions::Extension* extension = | 211 const extensions::Extension* extension = |
| 212 extension_info_map->extensions().GetExtensionOrAppByURL( | 212 extension_info_map->extensions().GetExtensionOrAppByURL(file_url); |
| 213 ExtensionURLInfo(file_url)); | |
| 214 if (!extension) | 213 if (!extension) |
| 215 return false; | 214 return false; |
| 216 | 215 |
| 217 std::string path = file_url.path(); | 216 std::string path = file_url.path(); |
| 218 extensions::ExtensionResource resource; | 217 extensions::ExtensionResource resource; |
| 219 | 218 |
| 220 if (SharedModuleInfo::IsImportedPath(path)) { | 219 if (SharedModuleInfo::IsImportedPath(path)) { |
| 221 // Check if this is a valid path that is imported for this extension. | 220 // Check if this is a valid path that is imported for this extension. |
| 222 std::string new_extension_id; | 221 std::string new_extension_id; |
| 223 std::string new_relative_path; | 222 std::string new_relative_path; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 base::Bind( | 388 base::Bind( |
| 390 &DoOpenNaClExecutableOnThreadPool, | 389 &DoOpenNaClExecutableOnThreadPool, |
| 391 nacl_host_message_filter, | 390 nacl_host_message_filter, |
| 392 extension_info_map, | 391 extension_info_map, |
| 393 file_url, reply_msg))) { | 392 file_url, reply_msg))) { |
| 394 NotifyRendererOfError(nacl_host_message_filter.get(), reply_msg); | 393 NotifyRendererOfError(nacl_host_message_filter.get(), reply_msg); |
| 395 } | 394 } |
| 396 } | 395 } |
| 397 | 396 |
| 398 } // namespace nacl_file_host | 397 } // namespace nacl_file_host |
| OLD | NEW |