| 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 "components/nacl/renderer/manifest_downloader.h" | 5 #include "components/nacl/renderer/manifest_downloader.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "components/nacl/renderer/histogram.h" | 10 #include "components/nacl/renderer/histogram.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 } | 35 } |
| 36 | 36 |
| 37 void ManifestDownloader::didReceiveResponse( | 37 void ManifestDownloader::didReceiveResponse( |
| 38 blink::WebURLLoader* loader, | 38 blink::WebURLLoader* loader, |
| 39 const blink::WebURLResponse& response) { | 39 const blink::WebURLResponse& response) { |
| 40 if (response.httpStatusCode() != 200) | 40 if (response.httpStatusCode() != 200) |
| 41 pp_nacl_error_ = PP_NACL_ERROR_MANIFEST_LOAD_URL; | 41 pp_nacl_error_ = PP_NACL_ERROR_MANIFEST_LOAD_URL; |
| 42 status_code_ = response.httpStatusCode(); | 42 status_code_ = response.httpStatusCode(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void ManifestDownloader::didReceiveData( | 45 void ManifestDownloader::didReceiveData(blink::WebURLLoader* loader, |
| 46 blink::WebURLLoader* loader, | 46 const char* data, |
| 47 const char* data, | 47 int data_length, |
| 48 int data_length, | 48 int encoded_data_length, |
| 49 int encoded_data_length) { | 49 int encoded_body_length) { |
| 50 if (buffer_.size() + data_length > kNaClManifestMaxFileBytes) { | 50 if (buffer_.size() + data_length > kNaClManifestMaxFileBytes) { |
| 51 pp_nacl_error_ = PP_NACL_ERROR_MANIFEST_TOO_LARGE; | 51 pp_nacl_error_ = PP_NACL_ERROR_MANIFEST_TOO_LARGE; |
| 52 buffer_.clear(); | 52 buffer_.clear(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 if (pp_nacl_error_ == PP_NACL_ERROR_LOAD_SUCCESS) | 55 if (pp_nacl_error_ == PP_NACL_ERROR_LOAD_SUCCESS) |
| 56 buffer_.append(data, data_length); | 56 buffer_.append(data, data_length); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void ManifestDownloader::Close() { | 59 void ManifestDownloader::Close() { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 89 } | 89 } |
| 90 } else { | 90 } else { |
| 91 // It's a WebKit error. | 91 // It's a WebKit error. |
| 92 pp_nacl_error_ = PP_NACL_ERROR_MANIFEST_NOACCESS_URL; | 92 pp_nacl_error_ = PP_NACL_ERROR_MANIFEST_NOACCESS_URL; |
| 93 } | 93 } |
| 94 | 94 |
| 95 Close(); | 95 Close(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 } // namespace nacl | 98 } // namespace nacl |
| OLD | NEW |