OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/renderer/ppb_nacl_private_impl.h" | 5 #include "components/nacl/renderer/ppb_nacl_private_impl.h" |
6 | 6 |
7 #include <numeric> | 7 #include <numeric> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1284 }; | 1284 }; |
1285 | 1285 |
1286 void DownloadNexeCompletion(const DownloadNexeRequest& request, | 1286 void DownloadNexeCompletion(const DownloadNexeRequest& request, |
1287 PP_NaClFileInfo* out_file_info, | 1287 PP_NaClFileInfo* out_file_info, |
1288 FileDownloader::Status status, | 1288 FileDownloader::Status status, |
1289 base::File target_file, | 1289 base::File target_file, |
1290 int http_status); | 1290 int http_status); |
1291 | 1291 |
1292 void DownloadNexe(PP_Instance instance, | 1292 void DownloadNexe(PP_Instance instance, |
1293 const char* url, | 1293 const char* url, |
1294 PP_Bool download_resource_files, | |
1295 PP_NaClFileInfo* out_file_info, | 1294 PP_NaClFileInfo* out_file_info, |
1296 PP_NaClResourceFileHandle** out_resource_file_handles, | 1295 PP_NaClResourceFileHandle** out_resource_file_handles, |
1297 uint32_t* out_resource_file_handles_len, | 1296 uint32_t* out_resource_file_handles_len, |
1298 PP_CompletionCallback callback) { | 1297 PP_CompletionCallback callback) { |
1299 CHECK(url); | 1298 CHECK(url); |
1300 CHECK(out_file_info); | 1299 CHECK(out_file_info); |
1301 CHECK(!download_resource_files || out_resource_file_handles); | 1300 CHECK(out_resource_file_handles); |
| 1301 |
| 1302 #if defined(OS_POSIX) |
| 1303 const bool kDownloadResourceFiles = true; |
| 1304 #else |
| 1305 // TODO(yusukes): Support Windows. |
| 1306 const bool kDownloadResourceFiles = false; |
| 1307 #endif |
1302 | 1308 |
1303 DownloadNexeRequest request; | 1309 DownloadNexeRequest request; |
1304 request.instance = instance; | 1310 request.instance = instance; |
1305 request.url = url; | 1311 request.url = url; |
1306 request.callback = callback; | 1312 request.callback = callback; |
1307 request.start_time = base::Time::Now(); | 1313 request.start_time = base::Time::Now(); |
1308 | 1314 |
1309 std::vector< | 1315 std::vector< |
1310 std::pair<std::string /*url*/, std::string /*key*/> > resource_files; | 1316 std::pair<std::string /*url*/, std::string /*key*/> > resource_files; |
1311 std::vector<std::string> resource_file_urls; | 1317 std::vector<std::string> resource_file_urls; |
1312 | 1318 |
1313 if (download_resource_files) { | 1319 if (kDownloadResourceFiles) { |
1314 JsonManifest* manifest = GetJsonManifest(instance); | 1320 JsonManifest* manifest = GetJsonManifest(instance); |
1315 if (manifest) | 1321 if (manifest) |
1316 manifest->GetFiles(&resource_files); | 1322 manifest->GetFiles(&resource_files); |
1317 if (resource_files.size() > kMaxPreOpenResourceFiles) | 1323 if (resource_files.size() > kMaxPreOpenResourceFiles) |
1318 resource_files.resize(kMaxPreOpenResourceFiles); | 1324 resource_files.resize(kMaxPreOpenResourceFiles); |
1319 for (size_t i = 0; i < resource_files.size(); ++i) { | 1325 for (size_t i = 0; i < resource_files.size(); ++i) { |
1320 resource_file_urls.push_back(resource_files[i].first); | 1326 resource_file_urls.push_back(resource_files[i].first); |
1321 } | 1327 } |
1322 } | 1328 } |
1323 | 1329 |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1812 &StreamPexe | 1818 &StreamPexe |
1813 }; | 1819 }; |
1814 | 1820 |
1815 } // namespace | 1821 } // namespace |
1816 | 1822 |
1817 const PPB_NaCl_Private* GetNaClPrivateInterface() { | 1823 const PPB_NaCl_Private* GetNaClPrivateInterface() { |
1818 return &nacl_interface; | 1824 return &nacl_interface; |
1819 } | 1825 } |
1820 | 1826 |
1821 } // namespace nacl | 1827 } // namespace nacl |
OLD | NEW |