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/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.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 14 matching lines...) Expand all Loading... |
25 | 25 |
26 // This is a pretty arbitrary limit on the byte size of the NaCl manifest | 26 // This is a pretty arbitrary limit on the byte size of the NaCl manifest |
27 // file. | 27 // file. |
28 // Note that the resulting string object has to have at least one byte extra | 28 // Note that the resulting string object has to have at least one byte extra |
29 // for the null termination character. | 29 // for the null termination character. |
30 static const size_t kNaClManifestMaxFileBytes = 1024 * 1024; | 30 static const size_t kNaClManifestMaxFileBytes = 1024 * 1024; |
31 | 31 |
32 ManifestDownloader(scoped_ptr<blink::WebURLLoader> url_loader, | 32 ManifestDownloader(scoped_ptr<blink::WebURLLoader> url_loader, |
33 bool is_installed, | 33 bool is_installed, |
34 Callback cb); | 34 Callback cb); |
35 virtual ~ManifestDownloader(); | 35 ~ManifestDownloader() override; |
36 | 36 |
37 void Load(const blink::WebURLRequest& request); | 37 void Load(const blink::WebURLRequest& request); |
38 | 38 |
39 private: | 39 private: |
40 void Close(); | 40 void Close(); |
41 | 41 |
42 // WebURLLoaderClient implementation. | 42 // WebURLLoaderClient implementation. |
43 virtual void didReceiveResponse(blink::WebURLLoader* loader, | 43 void didReceiveResponse(blink::WebURLLoader* loader, |
44 const blink::WebURLResponse& response); | 44 const blink::WebURLResponse& response) override; |
45 virtual void didReceiveData(blink::WebURLLoader* loader, | 45 void didReceiveData(blink::WebURLLoader* loader, |
46 const char* data, | 46 const char* data, |
47 int data_length, | 47 int data_length, |
48 int encoded_data_length); | 48 int encoded_data_length) override; |
49 virtual void didFinishLoading(blink::WebURLLoader* loader, | 49 void didFinishLoading(blink::WebURLLoader* loader, |
50 double finish_time, | 50 double finish_time, |
51 int64_t total_encoded_data_length); | 51 int64_t total_encoded_data_length) override; |
52 virtual void didFail(blink::WebURLLoader* loader, | 52 void didFail(blink::WebURLLoader* loader, |
53 const blink::WebURLError& error); | 53 const blink::WebURLError& error) override; |
54 | 54 |
55 scoped_ptr<blink::WebURLLoader> url_loader_; | 55 scoped_ptr<blink::WebURLLoader> url_loader_; |
56 bool is_installed_; | 56 bool is_installed_; |
57 Callback cb_; | 57 Callback cb_; |
58 std::string buffer_; | 58 std::string buffer_; |
59 int status_code_; | 59 int status_code_; |
60 PP_NaClError pp_nacl_error_; | 60 PP_NaClError pp_nacl_error_; |
61 }; | 61 }; |
62 | 62 |
63 } // namespace nacl | 63 } // namespace nacl |
OLD | NEW |