| Index: content/child/ftp_directory_listing_response_delegate.cc
|
| diff --git a/content/child/ftp_directory_listing_response_delegate.cc b/content/child/ftp_directory_listing_response_delegate.cc
|
| index 5b7763eed636054b53738afbc2e7068478fbe72f..554e2faafc2240fbf9cbe065c8a0ca0d54d15471 100644
|
| --- a/content/child/ftp_directory_listing_response_delegate.cc
|
| +++ b/content/child/ftp_directory_listing_response_delegate.cc
|
| @@ -23,11 +23,9 @@
|
| #include "net/ftp/ftp_directory_listing_parser.h"
|
| #include "net/net_features.h"
|
| #include "third_party/WebKit/public/platform/WebURL.h"
|
| +#include "third_party/WebKit/public/platform/WebURLLoader.h"
|
| #include "third_party/WebKit/public/platform/WebURLLoaderClient.h"
|
|
|
| -using blink::WebURLLoader;
|
| -using blink::WebURLLoaderClient;
|
| -using blink::WebURLResponse;
|
| using net::FtpDirectoryListingEntry;
|
|
|
| namespace {
|
| @@ -59,11 +57,10 @@ base::string16 ConvertPathToUTF16(const std::string& path) {
|
| namespace content {
|
|
|
| FtpDirectoryListingResponseDelegate::FtpDirectoryListingResponseDelegate(
|
| - WebURLLoaderClient* client,
|
| - WebURLLoader* loader,
|
| - const WebURLResponse& response)
|
| - : client_(client),
|
| - loader_(loader) {
|
| + blink::WebURLLoaderClient* client,
|
| + blink::WebURLLoader* loader,
|
| + const blink::WebURLResponse& response)
|
| + : client_(client), loader_(loader) {
|
| if (response.GetExtraData()) {
|
| // |extra_data| can be NULL during tests.
|
| WebURLResponseExtraDataImpl* extra_data =
|
| @@ -83,14 +80,20 @@ void FtpDirectoryListingResponseDelegate::OnReceivedData(const char* data,
|
| buffer_.append(data, data_len);
|
| }
|
|
|
| -void FtpDirectoryListingResponseDelegate::OnCompletedRequest() {
|
| +void FtpDirectoryListingResponseDelegate::OnCompletedRequest(int error_code) {
|
| std::vector<FtpDirectoryListingEntry> entries;
|
| int rv = net::ERR_NOT_IMPLEMENTED;
|
| #if !BUILDFLAG(DISABLE_FTP_SUPPORT)
|
| - rv = net::ParseFtpDirectoryListing(buffer_, base::Time::Now(), &entries);
|
| + if (error_code == net::OK)
|
| + rv = net::ParseFtpDirectoryListing(buffer_, base::Time::Now(), &entries);
|
| + else
|
| + rv = error_code;
|
| #endif
|
| + buffer_.clear();
|
| if (rv != net::OK) {
|
| SendDataToClient("<script>onListingParsingError();</script>\n");
|
| + if (loader_)
|
| + loader_->Cancel();
|
| return;
|
| }
|
| for (const FtpDirectoryListingEntry& entry : entries) {
|
| @@ -125,7 +128,7 @@ void FtpDirectoryListingResponseDelegate::Init(const GURL& response_url) {
|
| }
|
|
|
| void FtpDirectoryListingResponseDelegate::SendDataToClient(
|
| - const std::string& data) {
|
| + base::StringPiece data) {
|
| if (client_) {
|
| client_->DidReceiveData(data.data(), data.length());
|
| }
|
|
|