Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: webkit/glue/ftp_directory_listing_response_delegate.h

Issue 343073: Use the new FTP LIST parsing code in the browser. (Closed)
Patch Set: fixes Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 // A delegate class of WebURLLoaderImpl that handles text/vnd.chromium.ftp-dir 5 // A delegate class of WebURLLoaderImpl that handles text/vnd.chromium.ftp-dir
6 // data. 6 // data.
7 7
8 #ifndef WEBKIT_GLUE_FTP_DIRECTORY_LISTING_RESPONSE_DELEGATE_H_ 8 #ifndef WEBKIT_GLUE_FTP_DIRECTORY_LISTING_RESPONSE_DELEGATE_H_
9 #define WEBKIT_GLUE_FTP_DIRECTORY_LISTING_RESPONSE_DELEGATE_H_ 9 #define WEBKIT_GLUE_FTP_DIRECTORY_LISTING_RESPONSE_DELEGATE_H_
10 10
11 #include <string> 11 #include <string>
12 12
13 #include "net/ftp/ftp_directory_listing_buffer.h"
13 #include "net/third_party/parseftp/ParseFTPList.h" 14 #include "net/third_party/parseftp/ParseFTPList.h"
14 #include "webkit/api/public/WebURLResponse.h" 15 #include "webkit/api/public/WebURLResponse.h"
15 16
16 namespace WebKit { 17 namespace WebKit {
17 class WebURLLoader; 18 class WebURLLoader;
18 class WebURLLoaderClient; 19 class WebURLLoaderClient;
19 } 20 }
20 21
21 namespace webkit_glue { 22 namespace webkit_glue {
22 23
23 class FtpDirectoryListingResponseDelegate { 24 class FtpDirectoryListingResponseDelegate {
24 public: 25 public:
25 FtpDirectoryListingResponseDelegate(WebKit::WebURLLoaderClient* client, 26 FtpDirectoryListingResponseDelegate(WebKit::WebURLLoaderClient* client,
26 WebKit::WebURLLoader* loader, 27 WebKit::WebURLLoader* loader,
27 const WebKit::WebURLResponse& response); 28 const WebKit::WebURLResponse& response);
28 29
29 // Passed through from ResourceHandleInternal 30 // Passed through from ResourceHandleInternal
30 void OnReceivedData(const char* data, int data_len); 31 void OnReceivedData(const char* data, int data_len);
31 void OnCompletedRequest(); 32 void OnCompletedRequest();
32 33
33 private: 34 private:
34 void Init(); 35 void Init();
35 36
37 // Use the old parser to process received listing data.
38 void FeedFallbackParser();
39
40 void AppendEntryToResponseBuffer(const net::FtpDirectoryListingEntry& entry);
41
36 void SendResponseBufferToClient(); 42 void SendResponseBufferToClient();
37 43
38 // Pointers to the client and associated loader so we can make callbacks as 44 // Pointers to the client and associated loader so we can make callbacks as
39 // we parse pieces of data. 45 // we parse pieces of data.
40 WebKit::WebURLLoaderClient* client_; 46 WebKit::WebURLLoaderClient* client_;
41 WebKit::WebURLLoader* loader_; 47 WebKit::WebURLLoader* loader_;
42 48
43 // The original resource response for this request. We use this as a 49 // The original resource response for this request. We use this as a
44 // starting point for each parts response. 50 // starting point for each parts response.
45 WebKit::WebURLResponse original_response_; 51 WebKit::WebURLResponse original_response_;
46 52
53 // Data buffer also responsible for parsing the listing data (the new parser).
54 // TODO(phajdan.jr): Use only the new parser, when it is more compatible.
55 net::FtpDirectoryListingBuffer buffer_;
56
57 // True if the new parser couldn't recognize the received listing format
58 // and we switched to the old parser.
59 bool parser_fallback_;
60
47 // State kept between parsing each line of the response. 61 // State kept between parsing each line of the response.
48 struct net::list_state parse_state_; 62 struct net::list_state parse_state_;
49 63
50 // Detected encoding of the response. 64 // Detected encoding of the response.
51 std::string encoding_; 65 std::string encoding_;
52 66
53 // Buffer to hold not-yet-parsed input. 67 // Buffer to hold not-yet-parsed input.
54 std::string input_buffer_; 68 std::string input_buffer_;
55 69
56 // Buffer to hold response not-yet-sent to the caller. 70 // Buffer to hold response not-yet-sent to the caller.
57 std::string response_buffer_; 71 std::string response_buffer_;
58 }; 72 };
59 73
60 } // namespace webkit_glue 74 } // namespace webkit_glue
61 75
62 #endif // WEBKIT_GLUE_FTP_DIRECTORY_LISTING_RESPONSE_DELEGATE_H_ 76 #endif // WEBKIT_GLUE_FTP_DIRECTORY_LISTING_RESPONSE_DELEGATE_H_
OLDNEW
« no previous file with comments | « net/ftp/ftp_directory_listing_parsers.h ('k') | webkit/glue/ftp_directory_listing_response_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698