| OLD | NEW |
| 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 #ifndef CHROME_FRAME_URLMON_URL_REQUEST_H_ | 5 #ifndef CHROME_FRAME_URLMON_URL_REQUEST_H_ |
| 6 #define CHROME_FRAME_URLMON_URL_REQUEST_H_ | 6 #define CHROME_FRAME_URLMON_URL_REQUEST_H_ |
| 7 | 7 |
| 8 #include <urlmon.h> | 8 #include <urlmon.h> |
| 9 #include <atlbase.h> | 9 #include <atlbase.h> |
| 10 #include <atlcom.h> | 10 #include <atlcom.h> |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 } | 112 } |
| 113 | 113 |
| 114 virtual void OnFinalMessage(HWND window); | 114 virtual void OnFinalMessage(HWND window); |
| 115 | 115 |
| 116 protected: | 116 protected: |
| 117 // The following functions issue and handle Urlmon requests on the dedicated | 117 // The following functions issue and handle Urlmon requests on the dedicated |
| 118 // Urlmon thread. | 118 // Urlmon thread. |
| 119 void StartAsync(); | 119 void StartAsync(); |
| 120 void StopAsync(); | 120 void StopAsync(); |
| 121 void ReadAsync(int bytes_to_read); | 121 void ReadAsync(int bytes_to_read); |
| 122 void ReleaseBindings(); |
| 122 | 123 |
| 123 static const size_t kCopyChunkSize = 32 * 1024; | 124 static const size_t kCopyChunkSize = 32 * 1024; |
| 124 // URL requests are handled on this thread. | 125 // URL requests are handled on this thread. |
| 125 base::Thread* worker_thread_; | 126 base::Thread* worker_thread_; |
| 126 | 127 |
| 127 // A fake stream class to make it easier to copy received data using | 128 // A fake stream class to make it easier to copy received data using |
| 128 // IStream::CopyTo instead of allocating temporary buffers and keeping | 129 // IStream::CopyTo instead of allocating temporary buffers and keeping |
| 129 // track of data copied so far. | 130 // track of data copied so far. |
| 130 class SendStream | 131 class SendStream |
| 131 : public CComObjectRoot, | 132 : public CComObjectRoot, |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 bool is_valid() const { | 230 bool is_valid() const { |
| 230 return (stream_ != NULL); | 231 return (stream_ != NULL); |
| 231 } | 232 } |
| 232 | 233 |
| 233 protected: | 234 protected: |
| 234 ScopedComPtr<IStream> stream_; | 235 ScopedComPtr<IStream> stream_; |
| 235 char read_buffer_[kCopyChunkSize]; | 236 char read_buffer_[kCopyChunkSize]; |
| 236 }; | 237 }; |
| 237 | 238 |
| 238 HRESULT StartAsyncDownload(); | 239 HRESULT StartAsyncDownload(); |
| 240 // Sends over the response end notification to chrome, releases the bindings |
| 241 // and releases the initial reference on the UrlmonUrlRequest object. |
| 242 // After this function is called we should not attempt to access any members |
| 243 // as the object could become invalid at any point. |
| 239 void EndRequest(); | 244 void EndRequest(); |
| 240 // Executes in the context of the UI thread and releases the outstanding | 245 // Executes in the context of the UI thread and releases the outstanding |
| 241 // reference to us. It also deletes the request mapping for this instance. | 246 // reference to us. It also deletes the request mapping for this instance. |
| 242 void EndRequestInternal(); | 247 void EndRequestInternal(); |
| 243 int GetHttpResponseStatus() const; | 248 int GetHttpResponseStatus() const; |
| 244 std::string GetHttpHeaders() const; | 249 std::string GetHttpHeaders() const; |
| 245 | 250 |
| 246 static net::Error HresultToNetError(HRESULT hr); | 251 static net::Error HresultToNetError(HRESULT hr); |
| 247 | 252 |
| 248 private: | 253 private: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 259 static int instance_count_; | 264 static int instance_count_; |
| 260 HWND parent_window_; | 265 HWND parent_window_; |
| 261 // Set to true if a redirect notification was aborted. | 266 // Set to true if a redirect notification was aborted. |
| 262 bool ignore_redirect_stop_binding_error_; | 267 bool ignore_redirect_stop_binding_error_; |
| 263 | 268 |
| 264 DISALLOW_COPY_AND_ASSIGN(UrlmonUrlRequest); | 269 DISALLOW_COPY_AND_ASSIGN(UrlmonUrlRequest); |
| 265 }; | 270 }; |
| 266 | 271 |
| 267 #endif // CHROME_FRAME_URLMON_URL_REQUEST_H_ | 272 #endif // CHROME_FRAME_URLMON_URL_REQUEST_H_ |
| 268 | 273 |
| OLD | NEW |