| 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 // A wrapper around ResourceHandle and ResourceHandleClient that simplifies | 5 // A wrapper around ResourceHandle and ResourceHandleClient that simplifies |
| 6 // the download of an HTTP object. The interface is modeled after URLFetcher | 6 // the download of an HTTP object. The interface is modeled after URLFetcher |
| 7 // in the /chrome/browser. | 7 // in the /chrome/browser. |
| 8 // | 8 // |
| 9 // ResourceFetcher::Delegate::OnURLFetchComplete will be called async after | 9 // ResourceFetcher::Delegate::OnURLFetchComplete will be called async after |
| 10 // the ResourceFetcher object is created. | 10 // the ResourceFetcher object is created. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 const std::string& data) = 0; | 41 const std::string& data) = 0; |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 // We need a frame and frame loader to make requests. | 44 // We need a frame and frame loader to make requests. |
| 45 ResourceFetcher(const GURL& url, WebCore::Frame* frame, Delegate* d); | 45 ResourceFetcher(const GURL& url, WebCore::Frame* frame, Delegate* d); |
| 46 ~ResourceFetcher(); | 46 ~ResourceFetcher(); |
| 47 | 47 |
| 48 // Stop the request and don't call the callback. | 48 // Stop the request and don't call the callback. |
| 49 void Cancel(); | 49 void Cancel(); |
| 50 | 50 |
| 51 bool completed() { return completed_; } | 51 bool completed() const { return completed_; } |
| 52 | 52 |
| 53 // ResourceHandleClient methods | 53 // ResourceHandleClient methods |
| 54 virtual void didReceiveResponse(WebCore::ResourceHandle* resource_handle, | 54 virtual void didReceiveResponse(WebCore::ResourceHandle* resource_handle, |
| 55 const WebCore::ResourceResponse& response); | 55 const WebCore::ResourceResponse& response); |
| 56 | 56 |
| 57 virtual void didReceiveData(WebCore::ResourceHandle* resource_handle, | 57 virtual void didReceiveData(WebCore::ResourceHandle* resource_handle, |
| 58 const char* data, int length, int total_length); | 58 const char* data, int length, int total_length); |
| 59 | 59 |
| 60 virtual void didFinishLoading(WebCore::ResourceHandle* resource_handle); | 60 virtual void didFinishLoading(WebCore::ResourceHandle* resource_handle); |
| 61 | 61 |
| 62 virtual void didFail(WebCore::ResourceHandle* resource_handle, | 62 virtual void didFail(WebCore::ResourceHandle* resource_handle, |
| 63 const WebCore::ResourceError& error); | 63 const WebCore::ResourceError& error); |
| 64 | 64 |
| 65 protected: | 65 protected: |
| 66 // The parent ResourceHandle | 66 // The parent ResourceHandle |
| 67 RefPtr<WebCore::ResourceHandle> loader_; | 67 RefPtr<WebCore::ResourceHandle> loader_; |
| 68 | 68 |
| 69 // URL we're fetching | 69 // URL we're fetching |
| 70 GURL url_; | 70 GURL url_; |
| 71 | 71 |
| 72 // Callback when we're done | 72 // Callback when we're done |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // page server. If this timer fires and the request hasn't completed, we | 110 // page server. If this timer fires and the request hasn't completed, we |
| 111 // kill the request. | 111 // kill the request. |
| 112 void TimeoutFired(FetchTimer* timer); | 112 void TimeoutFired(FetchTimer* timer); |
| 113 | 113 |
| 114 // Limit how long we wait for the alternate error page server. | 114 // Limit how long we wait for the alternate error page server. |
| 115 scoped_ptr<FetchTimer> timeout_timer_; | 115 scoped_ptr<FetchTimer> timeout_timer_; |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 #endif // WEBKIT_GLUE_RESOURCE_FETCHER_H__ | 118 #endif // WEBKIT_GLUE_RESOURCE_FETCHER_H__ |
| 119 | 119 |
| OLD | NEW |