Fix crash on app list start page contents not existing.
[chromium-blink-merge.git] / content / child / ftp_directory_listing_response_delegate.h
blob7d910fc73994093ce14adb454d8d550175a2678f
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.
8 #ifndef CONTENT_CHILD_FTP_DIRECTORY_LISTING_RESPONSE_DELEGATE_H_
9 #define CONTENT_CHILD_FTP_DIRECTORY_LISTING_RESPONSE_DELEGATE_H_
11 #include <string>
13 #include "base/basictypes.h"
14 #include "third_party/WebKit/public/platform/WebURLResponse.h"
16 namespace blink {
17 class WebURLLoader;
18 class WebURLLoaderClient;
21 class GURL;
23 namespace content {
25 class FtpDirectoryListingResponseDelegate {
26 public:
27 FtpDirectoryListingResponseDelegate(blink::WebURLLoaderClient* client,
28 blink::WebURLLoader* loader,
29 const blink::WebURLResponse& response);
31 // The request has been canceled, so stop making calls to the client.
32 void Cancel();
34 // Passed through from ResourceHandleInternal
35 void OnReceivedData(const char* data, int data_len);
36 void OnCompletedRequest();
38 private:
39 void Init(const GURL& response_url);
41 void SendDataToClient(const std::string& data);
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_;
48 // Buffer for data received from the network.
49 std::string buffer_;
51 DISALLOW_COPY_AND_ASSIGN(FtpDirectoryListingResponseDelegate);
54 } // namespace content
56 #endif // CONTENT_CHILD_FTP_DIRECTORY_LISTING_RESPONSE_DELEGATE_H_