| 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 "components/nacl/browser/nacl_file_host.h" | 5 #include "components/nacl/browser/nacl_file_host.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 } // namespace | 172 } // namespace |
| 173 | 173 |
| 174 namespace nacl_file_host { | 174 namespace nacl_file_host { |
| 175 | 175 |
| 176 void GetReadonlyPnaclFd( | 176 void GetReadonlyPnaclFd( |
| 177 scoped_refptr<nacl::NaClHostMessageFilter> nacl_host_message_filter, | 177 scoped_refptr<nacl::NaClHostMessageFilter> nacl_host_message_filter, |
| 178 const std::string& filename, | 178 const std::string& filename, |
| 179 bool is_executable, | 179 bool is_executable, |
| 180 IPC::Message* reply_msg) { | 180 IPC::Message* reply_msg) { |
| 181 base::PostTaskWithTraits( | 181 base::PostTaskWithTraits( |
| 182 FROM_HERE, base::TaskTraits().MayBlock(), | 182 FROM_HERE, {base::MayBlock()}, |
| 183 base::Bind(&DoOpenPnaclFile, nacl_host_message_filter, filename, | 183 base::Bind(&DoOpenPnaclFile, nacl_host_message_filter, filename, |
| 184 is_executable, reply_msg)); | 184 is_executable, reply_msg)); |
| 185 } | 185 } |
| 186 | 186 |
| 187 // This function is security sensitive. Be sure to check with a security | 187 // This function is security sensitive. Be sure to check with a security |
| 188 // person before you modify it. | 188 // person before you modify it. |
| 189 bool PnaclCanOpenFile(const std::string& filename, | 189 bool PnaclCanOpenFile(const std::string& filename, |
| 190 base::FilePath* file_to_open) { | 190 base::FilePath* file_to_open) { |
| 191 if (filename.length() > kMaxFileLength) | 191 if (filename.length() > kMaxFileLength) |
| 192 return false; | 192 return false; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 site_instance->GetSiteURL(), | 253 site_instance->GetSiteURL(), |
| 254 file_url)) { | 254 file_url)) { |
| 255 NotifyRendererOfError(nacl_host_message_filter.get(), reply_msg); | 255 NotifyRendererOfError(nacl_host_message_filter.get(), reply_msg); |
| 256 return; | 256 return; |
| 257 } | 257 } |
| 258 | 258 |
| 259 // The URL is part of the current app. Now query the extension system for the | 259 // The URL is part of the current app. Now query the extension system for the |
| 260 // file path and convert that to a file descriptor. This should be done on a | 260 // file path and convert that to a file descriptor. This should be done on a |
| 261 // blocking pool thread. | 261 // blocking pool thread. |
| 262 base::PostTaskWithTraits( | 262 base::PostTaskWithTraits( |
| 263 FROM_HERE, base::TaskTraits().MayBlock(), | 263 FROM_HERE, {base::MayBlock()}, |
| 264 base::Bind(&DoOpenNaClExecutableOnThreadPool, nacl_host_message_filter, | 264 base::Bind(&DoOpenNaClExecutableOnThreadPool, nacl_host_message_filter, |
| 265 file_url, enable_validation_caching, reply_msg)); | 265 file_url, enable_validation_caching, reply_msg)); |
| 266 } | 266 } |
| 267 | 267 |
| 268 } // namespace nacl_file_host | 268 } // namespace nacl_file_host |
| OLD | NEW |