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

Side by Side Diff: net/url_request/url_request_ftp_job.h

Issue 523034: Remove WinInet FTP code. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 10 years, 11 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') | net/url_request/url_request_ftp_job.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2006-2008 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 #ifndef NET_URL_REQUEST_URL_REQUEST_FTP_JOB_H_
6 #define NET_URL_REQUEST_URL_REQUEST_FTP_JOB_H_
7
8 #include <string>
9
10 #include "net/url_request/url_request_inet_job.h"
11
12 // A basic FTP job that handles download files and showing directory listings.
13 class URLRequestFtpJob : public URLRequestInetJob {
14 public:
15 static URLRequestJob* Factory(URLRequest* request, const std::string& scheme);
16
17 // URLRequestJob methods:
18 virtual void Start();
19 virtual bool GetMimeType(std::string* mime_type) const;
20
21 // URLRequestInetJob methods:
22 virtual void OnIOComplete(const AsyncResult& result);
23
24 protected:
25 explicit URLRequestFtpJob(URLRequest* request);
26
27 // Starts the WinInet request.
28 virtual void SendRequest();
29
30 virtual int CallInternetRead(char* dest, int dest_size, int *bytes_read);
31 virtual bool GetReadBytes(const AsyncResult& result, int* bytes_read);
32 virtual void OnCancelAuth();
33 virtual void OnSetAuth();
34 virtual bool NeedsAuth();
35 virtual void GetAuthChallengeInfo(scoped_refptr<net::AuthChallengeInfo>*);
36 virtual bool IsRedirectResponse(GURL* location, int* http_status_code);
37
38 private:
39 virtual ~URLRequestFtpJob();
40
41 // Called after InternetConnect successfully connects to server.
42 void OnConnect();
43
44 // Called after FtpSetCurrentDirectory attempts to change current dir.
45 void OnSetCurrentDirectory(DWORD last_error);
46
47 // Requests the next file in the directory listing from WinInet.
48 void FindNextFile();
49
50 // Called when the first file in a directory listing is available.
51 void OnFindFirstFile(DWORD last_error);
52
53 // Called when a file in a directory listing is available.
54 void OnFindFile(DWORD last_error);
55
56 // Call this when starting a directory listing to setup the html.
57 void OnStartDirectoryTraversal();
58
59 // Call this at the end of a directory listing to complete the html.
60 void OnFinishDirectoryTraversal();
61
62 // If given data, writes it to the directory listing html. If
63 // call_io_complete is true, will also notify the parent class that we wrote
64 // data in the given buffer.
65 int WriteData(const std::string* data, bool call_io_complete);
66
67 // Continuation function for calling OnIOComplete through the message loop.
68 virtual void ContinueIOComplete(int bytes_written);
69
70 // Continuation function for calling NotifyHeadersComplete through the message
71 // loop.
72 virtual void ContinueNotifyHeadersComplete();
73
74 typedef enum {
75 // Initial state of the ftp job.
76 START = 0x200,
77 // Opening the url.
78 CONNECTING,
79 // Attempting to change current dir to match request.
80 SETTING_CUR_DIRECTORY,
81 // Retrieving first file information in cur dir (by FtpFindFirstFile).
82 FINDING_FIRST_FILE,
83 // Retrieving the directory listing (if directory).
84 GETTING_DIRECTORY,
85 // Initiate access to file by call to FtpOpenFile (if file).
86 GETTING_FILE_HANDLE,
87 // Retrieving the file (if file).
88 GETTING_FILE,
89 // URLRequestInetJob is reading the response now.
90 DONE
91 } FtpJobState;
92
93 // The FtpJob has several asynchronous operations which happen
94 // in sequence. The state keeps track of which asynchronous IO
95 // is pending at any given point in time.
96 FtpJobState state_;
97
98 // In IE 4 and before, this pointer passed to asynchronous InternetReadFile
99 // calls is where the number of read bytes is written to.
100 DWORD bytes_read_;
101
102 bool is_directory_; // does the url point to a file or directory
103 WIN32_FIND_DATAA find_data_;
104 std::string directory_html_; // if url is directory holds html
105
106 // When building a directory listing, we need to temporarily hold on to the
107 // buffer in between the time a Read() call comes in and we get the file
108 // entry from WinInet.
109 char* dest_;
110 int dest_size_;
111
112
113 DISALLOW_EVIL_CONSTRUCTORS(URLRequestFtpJob);
114 };
115
116 #endif // NET_URL_REQUEST_URL_REQUEST_FTP_JOB_H_
OLDNEW
« no previous file with comments | « net/net.gyp ('k') | net/url_request/url_request_ftp_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698