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 WEBKIT_GLUE_ALT_404_PAGE_RESOURCE_HANDLE_CLIENT_H__ | 5 #ifndef WEBKIT_GLUE_ALT_404_PAGE_RESOURCE_HANDLE_CLIENT_H_ |
6 #define WEBKIT_GLUE_ALT_404_PAGE_RESOURCE_HANDLE_CLIENT_H__ | 6 #define WEBKIT_GLUE_ALT_404_PAGE_RESOURCE_HANDLE_CLIENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
12 | 12 |
13 #include "webkit/glue/resource_fetcher.h" | 13 #include "webkit/glue/resource_fetcher.h" |
14 | 14 |
15 class WebFrameLoaderClient; | 15 class WebFrameLoaderClient; |
16 | 16 |
| 17 namespace webkit_glue { |
| 18 |
17 // ResourceHandleClient implementation that is used for downloading alternate | 19 // ResourceHandleClient implementation that is used for downloading alternate |
18 // 404 pages. Once downloading is done (or fails), the WebFrameLoaderClient is | 20 // 404 pages. Once downloading is done (or fails), the WebFrameLoaderClient is |
19 // notified. | 21 // notified. |
20 class Alt404PageResourceFetcher : public ResourceFetcher::Delegate { | 22 class Alt404PageResourceFetcher { |
21 public: | 23 public: |
22 Alt404PageResourceFetcher(WebFrameLoaderClient* webframeloaderclient, | 24 Alt404PageResourceFetcher(WebFrameLoaderClient* webframeloaderclient, |
23 WebCore::Frame* frame, | 25 WebCore::Frame* frame, |
24 WebCore::DocumentLoader* doc_loader, | 26 WebCore::DocumentLoader* doc_loader, |
25 const GURL& url); | 27 const GURL& url); |
26 | 28 |
27 virtual void OnURLFetchComplete(const WebCore::ResourceResponse& response, | |
28 const std::string& data); | |
29 | |
30 // Stop any pending loads. | 29 // Stop any pending loads. |
31 void Cancel() { | 30 void Cancel() { |
32 if (fetcher_.get()) | 31 if (fetcher_.get()) |
33 fetcher_->Cancel(); | 32 fetcher_->Cancel(); |
34 } | 33 } |
35 | 34 |
36 private: | 35 private: |
| 36 void OnURLFetchComplete(const WebKit::WebURLResponse& response, |
| 37 const std::string& data); |
| 38 |
37 // Does the actual fetching. | 39 // Does the actual fetching. |
38 scoped_ptr<ResourceFetcherWithTimeout> fetcher_; | 40 scoped_ptr<ResourceFetcherWithTimeout> fetcher_; |
39 | 41 |
40 // References to our owner which we call when finished. | 42 // References to our owner which we call when finished. |
41 WebFrameLoaderClient* webframeloaderclient_; | 43 WebFrameLoaderClient* webframeloaderclient_; |
42 | 44 |
43 // The DocumentLoader associated with this load. If there's an error | 45 // The DocumentLoader associated with this load. If there's an error |
44 // talking with the alt 404 page server, we need this to complete the | 46 // talking with the alt 404 page server, we need this to complete the |
45 // original load. | 47 // original load. |
46 RefPtr<WebCore::DocumentLoader> doc_loader_; | 48 RefPtr<WebCore::DocumentLoader> doc_loader_; |
47 | 49 |
48 DISALLOW_EVIL_CONSTRUCTORS(Alt404PageResourceFetcher); | 50 DISALLOW_COPY_AND_ASSIGN(Alt404PageResourceFetcher); |
49 }; | 51 }; |
50 | 52 |
51 #endif // WEBKIT_GLUE_ALT_404_PAGE_RESOURCE_HANDLE_CLIENT_H__ | 53 } // namespace webkit_glue |
| 54 |
| 55 #endif // WEBKIT_GLUE_ALT_404_PAGE_RESOURCE_HANDLE_CLIENT_H_ |
OLD | NEW |