| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_FILE_DOWNLOADER_H_ | 5 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_FILE_DOWNLOADER_H_ |
| 6 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_FILE_DOWNLOADER_H_ | 6 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_FILE_DOWNLOADER_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 | 9 |
| 10 #include "native_client/src/include/nacl_macros.h" | 10 #include "native_client/src/include/nacl_macros.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 // Issues a GET on |url| downloading the response into a file. The file is | 51 // Issues a GET on |url| downloading the response into a file. The file is |
| 52 // then opened and a file descriptor is made available. | 52 // then opened and a file descriptor is made available. |
| 53 // Returns true when callback is scheduled to be called on success or failure. | 53 // Returns true when callback is scheduled to be called on success or failure. |
| 54 // Returns false if callback is NULL, Initialize() has not been called or if | 54 // Returns false if callback is NULL, Initialize() has not been called or if |
| 55 // the PPB_FileIO_Trusted interface is not available. | 55 // the PPB_FileIO_Trusted interface is not available. |
| 56 // If |progress_callback| is not NULL, it will be invoked for every progress | 56 // If |progress_callback| is not NULL, it will be invoked for every progress |
| 57 // update received by the loader. | 57 // update received by the loader. |
| 58 bool Open(const nacl::string& url, | 58 bool Open(const nacl::string& url, |
| 59 DownloadFlags flags, | 59 DownloadFlags flags, |
| 60 bool allow_extension_url, |
| 60 const pp::CompletionCallback& callback, | 61 const pp::CompletionCallback& callback, |
| 61 PP_URLLoaderTrusted_StatusCallback progress_callback); | 62 PP_URLLoaderTrusted_StatusCallback progress_callback); |
| 62 | 63 |
| 63 // If downloading and opening succeeded, this returns a valid read-only | 64 // If downloading and opening succeeded, this returns a valid read-only |
| 64 // POSIX file descriptor. On failure, the return value is an invalid | 65 // POSIX file descriptor. On failure, the return value is an invalid |
| 65 // descriptor. The file descriptor is owned by this instance, so the | 66 // descriptor. The file descriptor is owned by this instance, so the |
| 66 // delegate does not have to close it. | 67 // delegate does not have to close it. |
| 67 int32_t GetPOSIXFileDescriptor(); | 68 int32_t GetPOSIXFileDescriptor(); |
| 68 | 69 |
| 69 // Returns the time delta between the call to Open() and this function. | 70 // Returns the time delta between the call to Open() and this function. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 pp::CompletionCallbackFactory<FileDownloader> callback_factory_; | 119 pp::CompletionCallbackFactory<FileDownloader> callback_factory_; |
| 119 int64_t open_time_; | 120 int64_t open_time_; |
| 120 DownloadFlags flags_; | 121 DownloadFlags flags_; |
| 121 static const uint32_t kTempBufferSize = 1024; | 122 static const uint32_t kTempBufferSize = 1024; |
| 122 char temp_buffer_[kTempBufferSize]; | 123 char temp_buffer_[kTempBufferSize]; |
| 123 std::deque<char> buffer_; | 124 std::deque<char> buffer_; |
| 124 UrlSchemeType url_scheme_; | 125 UrlSchemeType url_scheme_; |
| 125 }; | 126 }; |
| 126 } // namespace plugin; | 127 } // namespace plugin; |
| 127 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_FILE_DOWNLOADER_H_ | 128 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_FILE_DOWNLOADER_H_ |
| OLD | NEW |