| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 154 |
| 155 // Convert the file URL into a file path in the extension directory. | 155 // Convert the file URL into a file path in the extension directory. |
| 156 // This function is security sensitive. Be sure to check with a security | 156 // This function is security sensitive. Be sure to check with a security |
| 157 // person before you modify it. | 157 // person before you modify it. |
| 158 bool GetExtensionFilePath( | 158 bool GetExtensionFilePath( |
| 159 scoped_refptr<ExtensionInfoMap> extension_info_map, | 159 scoped_refptr<ExtensionInfoMap> extension_info_map, |
| 160 const GURL& file_url, | 160 const GURL& file_url, |
| 161 base::FilePath* file_path) { | 161 base::FilePath* file_path) { |
| 162 // Check that the URL is recognized by the extension system. | 162 // Check that the URL is recognized by the extension system. |
| 163 const extensions::Extension* extension = | 163 const extensions::Extension* extension = |
| 164 extension_info_map->extensions().GetExtensionOrAppByURL( | 164 extension_info_map->extensions().GetExtensionOrAppByURL(file_url); |
| 165 ExtensionURLInfo(file_url)); | |
| 166 if (!extension) | 165 if (!extension) |
| 167 return false; | 166 return false; |
| 168 | 167 |
| 169 std::string path = file_url.path(); | 168 std::string path = file_url.path(); |
| 170 extensions::ExtensionResource resource; | 169 extensions::ExtensionResource resource; |
| 171 | 170 |
| 172 if (SharedModuleInfo::IsImportedPath(path)) { | 171 if (SharedModuleInfo::IsImportedPath(path)) { |
| 173 // Check if this is a valid path that is imported for this extension. | 172 // Check if this is a valid path that is imported for this extension. |
| 174 std::string new_extension_id; | 173 std::string new_extension_id; |
| 175 std::string new_relative_path; | 174 std::string new_relative_path; |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 base::Bind( | 339 base::Bind( |
| 341 &DoOpenNaClExecutableOnThreadPool, | 340 &DoOpenNaClExecutableOnThreadPool, |
| 342 chrome_render_message_filter, | 341 chrome_render_message_filter, |
| 343 extension_info_map, | 342 extension_info_map, |
| 344 file_url, reply_msg))) { | 343 file_url, reply_msg))) { |
| 345 NotifyRendererOfError(chrome_render_message_filter.get(), reply_msg); | 344 NotifyRendererOfError(chrome_render_message_filter.get(), reply_msg); |
| 346 } | 345 } |
| 347 } | 346 } |
| 348 | 347 |
| 349 } // namespace nacl_file_host | 348 } // namespace nacl_file_host |
| OLD | NEW |