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

Side by Side Diff: content/child/ftp_directory_listing_response_delegate.h

Issue 2823173003: Improve error handling in FtpDirectoryListingResponseDelegate. (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « no previous file | content/child/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 2014 The Chromium Authors. All rights reserved. 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 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 CONTENT_CHILD_FTP_DIRECTORY_LISTING_RESPONSE_DELEGATE_H_ 8 #ifndef CONTENT_CHILD_FTP_DIRECTORY_LISTING_RESPONSE_DELEGATE_H_
9 #define CONTENT_CHILD_FTP_DIRECTORY_LISTING_RESPONSE_DELEGATE_H_ 9 #define CONTENT_CHILD_FTP_DIRECTORY_LISTING_RESPONSE_DELEGATE_H_
10 10
11 #include <string> 11 #include <string>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/strings/string_piece.h"
14 #include "third_party/WebKit/public/platform/WebURLResponse.h" 15 #include "third_party/WebKit/public/platform/WebURLResponse.h"
15 16
16 namespace blink { 17 namespace blink {
17 class WebURLLoader; 18 class WebURLLoader;
18 class WebURLLoaderClient; 19 class WebURLLoaderClient;
19 } 20 }
20 21
21 class GURL; 22 class GURL;
22 23
23 namespace content { 24 namespace content {
24 25
25 class FtpDirectoryListingResponseDelegate { 26 class FtpDirectoryListingResponseDelegate {
26 public: 27 public:
27 FtpDirectoryListingResponseDelegate(blink::WebURLLoaderClient* client, 28 FtpDirectoryListingResponseDelegate(blink::WebURLLoaderClient* client,
28 blink::WebURLLoader* loader, 29 blink::WebURLLoader* loader,
29 const blink::WebURLResponse& response); 30 const blink::WebURLResponse& response);
30 31
31 // The request has been canceled, so stop making calls to the client. 32 // The request has been canceled, so stop making calls to the client.
32 void Cancel(); 33 void Cancel();
33 34
34 // Passed through from ResourceHandleInternal 35 // Called from WebURLLoaderImpl.
35 void OnReceivedData(const char* data, int data_len); 36 void OnReceivedData(const char* data, int data_len);
36 void OnCompletedRequest(); 37 void OnCompletedRequest(int error_code);
37 38
38 private: 39 private:
39 void Init(const GURL& response_url); 40 void Init(const GURL& response_url);
40 41
41 void SendDataToClient(const std::string& data); 42 void SendDataToClient(base::StringPiece data);
42 43
43 // 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
44 // we parse pieces of data. 45 // we parse pieces of data.
45 blink::WebURLLoaderClient* client_; 46 blink::WebURLLoaderClient* client_;
46 blink::WebURLLoader* loader_; 47 blink::WebURLLoader* loader_;
47 48
48 // Buffer for data received from the network. 49 // Buffer for data received from the network.
49 std::string buffer_; 50 std::string buffer_;
50 51
51 DISALLOW_COPY_AND_ASSIGN(FtpDirectoryListingResponseDelegate); 52 DISALLOW_COPY_AND_ASSIGN(FtpDirectoryListingResponseDelegate);
52 }; 53 };
53 54
54 } // namespace content 55 } // namespace content
55 56
56 #endif // CONTENT_CHILD_FTP_DIRECTORY_LISTING_RESPONSE_DELEGATE_H_ 57 #endif // CONTENT_CHILD_FTP_DIRECTORY_LISTING_RESPONSE_DELEGATE_H_
OLDNEW
« no previous file with comments | « no previous file | content/child/ftp_directory_listing_response_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698