OLD | NEW |
1 // Copyright (c) 2011 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 #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" |
11 #include "native_client/src/include/nacl_string.h" | 11 #include "native_client/src/include/nacl_string.h" |
(...skipping 38 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, | |
61 const pp::CompletionCallback& callback, | 60 const pp::CompletionCallback& callback, |
62 PP_URLLoaderTrusted_StatusCallback progress_callback); | 61 PP_URLLoaderTrusted_StatusCallback progress_callback); |
63 | 62 |
64 // If downloading and opening succeeded, this returns a valid read-only | 63 // If downloading and opening succeeded, this returns a valid read-only |
65 // POSIX file descriptor. On failure, the return value is an invalid | 64 // POSIX file descriptor. On failure, the return value is an invalid |
66 // descriptor. The file descriptor is owned by this instance, so the | 65 // descriptor. The file descriptor is owned by this instance, so the |
67 // delegate does not have to close it. | 66 // delegate does not have to close it. |
68 int32_t GetPOSIXFileDescriptor(); | 67 int32_t GetPOSIXFileDescriptor(); |
69 | 68 |
70 // Returns the time delta between the call to Open() and this function. | 69 // 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... |
119 pp::CompletionCallbackFactory<FileDownloader> callback_factory_; | 118 pp::CompletionCallbackFactory<FileDownloader> callback_factory_; |
120 int64_t open_time_; | 119 int64_t open_time_; |
121 DownloadFlags flags_; | 120 DownloadFlags flags_; |
122 static const uint32_t kTempBufferSize = 1024; | 121 static const uint32_t kTempBufferSize = 1024; |
123 char temp_buffer_[kTempBufferSize]; | 122 char temp_buffer_[kTempBufferSize]; |
124 std::deque<char> buffer_; | 123 std::deque<char> buffer_; |
125 UrlSchemeType url_scheme_; | 124 UrlSchemeType url_scheme_; |
126 }; | 125 }; |
127 } // namespace plugin; | 126 } // namespace plugin; |
128 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_FILE_DOWNLOADER_H_ | 127 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_FILE_DOWNLOADER_H_ |
OLD | NEW |