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

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

Issue 6670085: FTP: Detect the character encoding only after the entire listing is received. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test coverage Created 9 years, 9 months 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 | Annotate | Revision Log
« no previous file with comments | « net/net.gyp ('k') | webkit/glue/ftp_directory_listing_response_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/basictypes.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h" 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h"
15 15
16 namespace WebKit { 16 namespace WebKit {
17 class WebURLLoader; 17 class WebURLLoader;
18 class WebURLLoaderClient; 18 class WebURLLoaderClient;
19 } 19 }
20 20
21 class GURL;
22
21 namespace webkit_glue { 23 namespace webkit_glue {
22 24
23 class FtpDirectoryListingResponseDelegate { 25 class FtpDirectoryListingResponseDelegate {
24 public: 26 public:
25 FtpDirectoryListingResponseDelegate(WebKit::WebURLLoaderClient* client, 27 FtpDirectoryListingResponseDelegate(WebKit::WebURLLoaderClient* client,
26 WebKit::WebURLLoader* loader, 28 WebKit::WebURLLoader* loader,
27 const WebKit::WebURLResponse& response); 29 const WebKit::WebURLResponse& response);
28 30
29 // Passed through from ResourceHandleInternal 31 // Passed through from ResourceHandleInternal
30 void OnReceivedData(const char* data, int data_len); 32 void OnReceivedData(const char* data, int data_len);
31 void OnCompletedRequest(); 33 void OnCompletedRequest();
32 34
33 private: 35 private:
34 void Init(); 36 void Init(const GURL& response_url);
35
36 // Converts |filename| to detected server encoding and puts the result
37 // in |raw_bytes| (if no conversion is necessary, an empty string is used).
38 // Returns true on success.
39 bool ConvertToServerEncoding(const string16& filename,
40 std::string* raw_bytes) const;
41
42 // Fetches the listing entries from the buffer and sends them to the client.
43 void ProcessReceivedEntries();
44 37
45 void SendDataToClient(const std::string& data); 38 void SendDataToClient(const std::string& data);
46 39
47 // Pointers to the client and associated loader so we can make callbacks as 40 // Pointers to the client and associated loader so we can make callbacks as
48 // we parse pieces of data. 41 // we parse pieces of data.
49 WebKit::WebURLLoaderClient* client_; 42 WebKit::WebURLLoaderClient* client_;
50 WebKit::WebURLLoader* loader_; 43 WebKit::WebURLLoader* loader_;
51 44
52 // The original resource response for this request. We use this as a 45 // Buffer for data received from the network.
53 // starting point for each parts response. 46 std::string buffer_;
54 WebKit::WebURLResponse original_response_;
55
56 // Data buffer also responsible for parsing the listing data.
57 net::FtpDirectoryListingBuffer buffer_;
58
59 // True if we updated histogram data (we only want to do it once).
60 bool updated_histograms_;
61
62 // True if we got an error when parsing the response.
63 bool had_parsing_error_;
64 47
65 DISALLOW_COPY_AND_ASSIGN(FtpDirectoryListingResponseDelegate); 48 DISALLOW_COPY_AND_ASSIGN(FtpDirectoryListingResponseDelegate);
66 }; 49 };
67 50
68 } // namespace webkit_glue 51 } // namespace webkit_glue
69 52
70 #endif // WEBKIT_GLUE_FTP_DIRECTORY_LISTING_RESPONSE_DELEGATE_H_ 53 #endif // WEBKIT_GLUE_FTP_DIRECTORY_LISTING_RESPONSE_DELEGATE_H_
OLDNEW
« no previous file with comments | « net/net.gyp ('k') | webkit/glue/ftp_directory_listing_response_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698