| 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 "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "components/nacl/renderer/histogram.h" | 8 #include "components/nacl/renderer/histogram.h" |
| 9 #include "components/nacl/renderer/nexe_load_manager.h" | 9 #include "components/nacl/renderer/nexe_load_manager.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| 11 #include "third_party/WebKit/public/platform/WebURLError.h" | 11 #include "third_party/WebKit/public/platform/WebURLError.h" |
| 12 #include "third_party/WebKit/public/platform/WebURLLoader.h" | 12 #include "third_party/WebKit/public/platform/WebURLLoader.h" |
| 13 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 13 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
| 14 | 14 |
| 15 namespace nacl { | 15 namespace nacl { |
| 16 | 16 |
| 17 ManifestDownloader::ManifestDownloader( | 17 ManifestDownloader::ManifestDownloader( |
| 18 scoped_ptr<blink::WebURLLoader> url_loader, |
| 18 bool is_installed, | 19 bool is_installed, |
| 19 ManifestDownloaderCallback cb) | 20 Callback cb) |
| 20 : is_installed_(is_installed), | 21 : url_loader_(url_loader.Pass()), |
| 22 is_installed_(is_installed), |
| 21 cb_(cb), | 23 cb_(cb), |
| 22 status_code_(-1), | 24 status_code_(-1), |
| 23 pp_nacl_error_(PP_NACL_ERROR_LOAD_SUCCESS) { | 25 pp_nacl_error_(PP_NACL_ERROR_LOAD_SUCCESS) { |
| 24 CHECK(!cb.is_null()); | 26 CHECK(!cb.is_null()); |
| 25 } | 27 } |
| 26 | 28 |
| 27 ManifestDownloader::~ManifestDownloader() { | 29 ManifestDownloader::~ManifestDownloader() { } |
| 30 |
| 31 void ManifestDownloader::Load(const blink::WebURLRequest& request) { |
| 32 url_loader_->loadAsynchronously(request, this); |
| 28 } | 33 } |
| 29 | 34 |
| 30 void ManifestDownloader::didReceiveResponse( | 35 void ManifestDownloader::didReceiveResponse( |
| 31 blink::WebURLLoader* loader, | 36 blink::WebURLLoader* loader, |
| 32 const blink::WebURLResponse& response) { | 37 const blink::WebURLResponse& response) { |
| 33 if (response.httpStatusCode() != 200) | 38 if (response.httpStatusCode() != 200) |
| 34 pp_nacl_error_ = PP_NACL_ERROR_MANIFEST_LOAD_URL; | 39 pp_nacl_error_ = PP_NACL_ERROR_MANIFEST_LOAD_URL; |
| 35 status_code_ = response.httpStatusCode(); | 40 status_code_ = response.httpStatusCode(); |
| 36 } | 41 } |
| 37 | 42 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 pp_nacl_error_ = PP_NACL_ERROR_MANIFEST_NOACCESS_URL; | 81 pp_nacl_error_ = PP_NACL_ERROR_MANIFEST_NOACCESS_URL; |
| 77 break; | 82 break; |
| 78 } | 83 } |
| 79 } else { | 84 } else { |
| 80 // It's a WebKit error. | 85 // It's a WebKit error. |
| 81 pp_nacl_error_ = PP_NACL_ERROR_MANIFEST_NOACCESS_URL; | 86 pp_nacl_error_ = PP_NACL_ERROR_MANIFEST_NOACCESS_URL; |
| 82 } | 87 } |
| 83 } | 88 } |
| 84 | 89 |
| 85 } // namespace nacl | 90 } // namespace nacl |
| OLD | NEW |