| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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 // This class simulates what wininet does when a dns lookup fails. | 4 // This class simulates what wininet does when a dns lookup fails. |
| 5 | 5 |
| 6 #ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_URL_REQUEST_JOB_H_ | 6 #ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_URL_REQUEST_JOB_H_ |
| 7 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_URL_REQUEST_JOB_H_ | 7 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_URL_REQUEST_JOB_H_ |
| 8 | 8 |
| 9 #include "chrome/common/ref_counted_util.h" | 9 #include "chrome/common/ref_counted_util.h" |
| 10 #include "net/http/http_response_headers.h" | 10 #include "net/http/http_response_headers.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 virtual bool IsRedirectResponse(GURL* location, int* http_status_code); | 40 virtual bool IsRedirectResponse(GURL* location, int* http_status_code); |
| 41 | 41 |
| 42 // Peek and process automation messages for URL requests. | 42 // Peek and process automation messages for URL requests. |
| 43 static bool MayFilterMessage(const IPC::Message& message, int* request_id); | 43 static bool MayFilterMessage(const IPC::Message& message, int* request_id); |
| 44 void OnMessage(const IPC::Message& message); | 44 void OnMessage(const IPC::Message& message); |
| 45 | 45 |
| 46 int id() const { | 46 int id() const { |
| 47 return id_; | 47 return id_; |
| 48 } | 48 } |
| 49 | 49 |
| 50 int request_id() const { |
| 51 return request_id_; |
| 52 } |
| 53 |
| 50 protected: | 54 protected: |
| 51 // Protected URLRequestJob override. | 55 // Protected URLRequestJob override. |
| 52 virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read); | 56 virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read); |
| 53 | 57 |
| 54 void StartAsync(); | 58 void StartAsync(); |
| 55 void Cleanup(); | 59 void Cleanup(); |
| 56 void DisconnectFromMessageFilter(); | 60 void DisconnectFromMessageFilter(); |
| 57 | 61 |
| 58 // IPC message handlers. | 62 // IPC message handlers. |
| 59 void OnRequestStarted(int tab, int id, | 63 void OnRequestStarted(int tab, int id, |
| 60 const IPC::AutomationURLResponse& response); | 64 const IPC::AutomationURLResponse& response); |
| 61 void OnDataAvailable(int tab, int id, const std::string& bytes); | 65 void OnDataAvailable(int tab, int id, const std::string& bytes); |
| 62 void OnRequestEnd(int tab, int id, const URLRequestStatus& status); | 66 void OnRequestEnd(int tab, int id, const URLRequestStatus& status); |
| 63 | 67 |
| 64 private: | 68 private: |
| 65 virtual ~URLRequestAutomationJob(); | 69 virtual ~URLRequestAutomationJob(); |
| 66 | 70 |
| 67 int id_; | 71 int id_; |
| 68 int tab_; | 72 int tab_; |
| 69 scoped_refptr<AutomationResourceMessageFilter> message_filter_; | 73 scoped_refptr<AutomationResourceMessageFilter> message_filter_; |
| 70 | 74 |
| 71 scoped_refptr<net::IOBuffer> pending_buf_; | 75 scoped_refptr<net::IOBuffer> pending_buf_; |
| 72 size_t pending_buf_size_; | 76 size_t pending_buf_size_; |
| 73 | 77 |
| 74 std::string mime_type_; | 78 std::string mime_type_; |
| 75 scoped_refptr<net::HttpResponseHeaders> headers_; | 79 scoped_refptr<net::HttpResponseHeaders> headers_; |
| 76 std::string redirect_url_; | 80 std::string redirect_url_; |
| 77 int redirect_status_; | 81 int redirect_status_; |
| 82 int request_id_; |
| 78 | 83 |
| 79 static int instance_count_; | 84 static int instance_count_; |
| 80 | 85 |
| 81 static bool is_protocol_factory_registered_; | 86 static bool is_protocol_factory_registered_; |
| 82 // The previous HTTP/HTTPs protocol factories. We pass unhandled | 87 // The previous HTTP/HTTPs protocol factories. We pass unhandled |
| 83 // requests off to these factories | 88 // requests off to these factories |
| 84 static URLRequest::ProtocolFactory* old_http_factory_; | 89 static URLRequest::ProtocolFactory* old_http_factory_; |
| 85 static URLRequest::ProtocolFactory* old_https_factory_; | 90 static URLRequest::ProtocolFactory* old_https_factory_; |
| 86 | 91 |
| 87 DISALLOW_COPY_AND_ASSIGN(URLRequestAutomationJob); | 92 DISALLOW_COPY_AND_ASSIGN(URLRequestAutomationJob); |
| 88 }; | 93 }; |
| 89 | 94 |
| 90 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_URL_REQUEST_JOB_H_ | 95 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_URL_REQUEST_JOB_H_ |
| 91 | 96 |
| OLD | NEW |