OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef NET_URL_REQUEST_URL_REQUEST_FTP_JOB_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_FTP_JOB_H_ |
6 #define NET_URL_REQUEST_URL_REQUEST_FTP_JOB_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_FTP_JOB_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "net/url_request/url_request_inet_job.h" | 10 #include "net/url_request/url_request_inet_job.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 int WriteData(const std::string* data, bool call_io_complete); | 65 int WriteData(const std::string* data, bool call_io_complete); |
66 | 66 |
67 // Continuation function for calling OnIOComplete through the message loop. | 67 // Continuation function for calling OnIOComplete through the message loop. |
68 virtual void ContinueIOComplete(int bytes_written); | 68 virtual void ContinueIOComplete(int bytes_written); |
69 | 69 |
70 // Continuation function for calling NotifyHeadersComplete through the message | 70 // Continuation function for calling NotifyHeadersComplete through the message |
71 // loop. | 71 // loop. |
72 virtual void ContinueNotifyHeadersComplete(); | 72 virtual void ContinueNotifyHeadersComplete(); |
73 | 73 |
74 typedef enum { | 74 typedef enum { |
75 START = 0x200, // initial state of the ftp job | 75 // Initial state of the ftp job. |
76 CONNECTING, // opening the url | 76 START = 0x200, |
77 SETTING_CUR_DIRECTORY, // attempting to change current dir to match request | 77 // Opening the url. |
78 FINDING_FIRST_FILE, // retrieving first file information in cur dir (by | 78 CONNECTING, |
79 // FtpFindFirstFile) | 79 // Attempting to change current dir to match request. |
80 GETTING_DIRECTORY, // retrieving the directory listing (if directory) | 80 SETTING_CUR_DIRECTORY, |
81 GETTING_FILE_HANDLE, // initiate access to file by call to FtpOpenFile | 81 // Retrieving first file information in cur dir (by FtpFindFirstFile). |
82 // (if file). | 82 FINDING_FIRST_FILE, |
83 GETTING_FILE, // retrieving the file (if file) | 83 // Retrieving the directory listing (if directory). |
84 DONE // URLRequestInetJob is reading the response now | 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 |
85 } FtpJobState; | 91 } FtpJobState; |
86 | 92 |
87 // The FtpJob has several asynchronous operations which happen | 93 // The FtpJob has several asynchronous operations which happen |
88 // in sequence. The state keeps track of which asynchronous IO | 94 // in sequence. The state keeps track of which asynchronous IO |
89 // is pending at any given point in time. | 95 // is pending at any given point in time. |
90 FtpJobState state_; | 96 FtpJobState state_; |
91 | 97 |
92 // In IE 4 and before, this pointer passed to asynchronous InternetReadFile | 98 // In IE 4 and before, this pointer passed to asynchronous InternetReadFile |
93 // calls is where the number of read bytes is written to. | 99 // calls is where the number of read bytes is written to. |
94 DWORD bytes_read_; | 100 DWORD bytes_read_; |
95 | 101 |
96 bool is_directory_; // does the url point to a file or directory | 102 bool is_directory_; // does the url point to a file or directory |
97 WIN32_FIND_DATAA find_data_; | 103 WIN32_FIND_DATAA find_data_; |
98 std::string directory_html_; // if url is directory holds html | 104 std::string directory_html_; // if url is directory holds html |
99 | 105 |
100 // When building a directory listing, we need to temporarily hold on to the | 106 // When building a directory listing, we need to temporarily hold on to the |
101 // buffer in between the time a Read() call comes in and we get the file | 107 // buffer in between the time a Read() call comes in and we get the file |
102 // entry from WinInet. | 108 // entry from WinInet. |
103 char* dest_; | 109 char* dest_; |
104 int dest_size_; | 110 int dest_size_; |
105 | 111 |
106 | 112 |
107 DISALLOW_EVIL_CONSTRUCTORS(URLRequestFtpJob); | 113 DISALLOW_EVIL_CONSTRUCTORS(URLRequestFtpJob); |
108 }; | 114 }; |
109 | 115 |
110 #endif // NET_URL_REQUEST_URL_REQUEST_FTP_JOB_H_ | 116 #endif // NET_URL_REQUEST_URL_REQUEST_FTP_JOB_H_ |
111 | 117 |
OLD | NEW |