OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/files/file.h" | 8 #include "base/files/file.h" |
9 #include "components/nacl/renderer/ppb_nacl_private.h" | 9 #include "components/nacl/renderer/ppb_nacl_private.h" |
10 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" | 10 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 // Provides the bytes received so far, and the total bytes expected to be | 33 // Provides the bytes received so far, and the total bytes expected to be |
34 // received. | 34 // received. |
35 typedef base::Callback<void(int64_t, int64_t)> ProgressCallback; | 35 typedef base::Callback<void(int64_t, int64_t)> ProgressCallback; |
36 | 36 |
37 FileDownloader(scoped_ptr<blink::WebURLLoader> url_loader, | 37 FileDownloader(scoped_ptr<blink::WebURLLoader> url_loader, |
38 base::File file, | 38 base::File file, |
39 StatusCallback status_cb, | 39 StatusCallback status_cb, |
40 ProgressCallback progress_cb); | 40 ProgressCallback progress_cb); |
41 | 41 |
42 virtual ~FileDownloader(); | 42 ~FileDownloader() override; |
43 | 43 |
44 void Load(const blink::WebURLRequest& request); | 44 void Load(const blink::WebURLRequest& request); |
45 | 45 |
46 private: | 46 private: |
47 // WebURLLoaderClient implementation. | 47 // WebURLLoaderClient implementation. |
48 virtual void didReceiveResponse(blink::WebURLLoader* loader, | 48 void didReceiveResponse(blink::WebURLLoader* loader, |
49 const blink::WebURLResponse& response); | 49 const blink::WebURLResponse& response) override; |
50 virtual void didReceiveData(blink::WebURLLoader* loader, | 50 void didReceiveData(blink::WebURLLoader* loader, |
51 const char* data, | 51 const char* data, |
52 int data_length, | 52 int data_length, |
53 int encoded_data_length); | 53 int encoded_data_length) override; |
54 virtual void didFinishLoading(blink::WebURLLoader* loader, | 54 void didFinishLoading(blink::WebURLLoader* loader, |
55 double finish_time, | 55 double finish_time, |
56 int64_t total_encoded_data_length); | 56 int64_t total_encoded_data_length) override; |
57 virtual void didFail(blink::WebURLLoader* loader, | 57 void didFail(blink::WebURLLoader* loader, |
58 const blink::WebURLError& error); | 58 const blink::WebURLError& error) override; |
59 | 59 |
60 scoped_ptr<blink::WebURLLoader> url_loader_; | 60 scoped_ptr<blink::WebURLLoader> url_loader_; |
61 base::File file_; | 61 base::File file_; |
62 StatusCallback status_cb_; | 62 StatusCallback status_cb_; |
63 ProgressCallback progress_cb_; | 63 ProgressCallback progress_cb_; |
64 int http_status_code_; | 64 int http_status_code_; |
65 int64_t total_bytes_received_; | 65 int64_t total_bytes_received_; |
66 int64_t total_bytes_to_be_received_; | 66 int64_t total_bytes_to_be_received_; |
67 Status status_; | 67 Status status_; |
68 }; | 68 }; |
69 | 69 |
70 } // namespace nacl | 70 } // namespace nacl |
OLD | NEW |