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 3// found in the LICENSE file. 4// 5// A delegate class of WebURLLoaderImpl that handles text/vnd.chromium.ftp-dir 6// data. 7 8#ifndef CONTENT_CHILD_FTP_DIRECTORY_LISTING_RESPONSE_DELEGATE_H_ 9#define CONTENT_CHILD_FTP_DIRECTORY_LISTING_RESPONSE_DELEGATE_H_ 10 11#include <string> 12 13#include "base/basictypes.h" 14#include "third_party/WebKit/public/platform/WebURLResponse.h" 15 16namespace blink { 17class WebURLLoader; 18class WebURLLoaderClient; 19} 20 21class GURL; 22 23namespace content { 24 25class FtpDirectoryListingResponseDelegate { 26 public: 27 FtpDirectoryListingResponseDelegate(blink::WebURLLoaderClient* client, 28 blink::WebURLLoader* loader, 29 const blink::WebURLResponse& response); 30 31 // The request has been canceled, so stop making calls to the client. 32 void Cancel(); 33 34 // Passed through from ResourceHandleInternal 35 void OnReceivedData(const char* data, int data_len); 36 void OnCompletedRequest(); 37 38 private: 39 void Init(const GURL& response_url); 40 41 void SendDataToClient(const std::string& data); 42 43 // Pointers to the client and associated loader so we can make callbacks as 44 // we parse pieces of data. 45 blink::WebURLLoaderClient* client_; 46 blink::WebURLLoader* loader_; 47 48 // Buffer for data received from the network. 49 std::string buffer_; 50 51 DISALLOW_COPY_AND_ASSIGN(FtpDirectoryListingResponseDelegate); 52}; 53 54} // namespace content 55 56#endif // CONTENT_CHILD_FTP_DIRECTORY_LISTING_RESPONSE_DELEGATE_H_ 57