diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-23 19:11:48 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-23 19:11:48 +0000 |
commit | b086e8071269fc23c6fb9fef3785da4e41a1d82c (patch) | |
tree | 7948c405ee492caa137259e13c2f20e2ad5dedd7 /webkit/glue/alt_error_page_resource_fetcher.h | |
parent | afa82479fced750ebee50cba4ce94c23ba064ea6 (diff) | |
download | chromium_src-b086e8071269fc23c6fb9fef3785da4e41a1d82c.zip chromium_src-b086e8071269fc23c6fb9fef3785da4e41a1d82c.tar.gz chromium_src-b086e8071269fc23c6fb9fef3785da4e41a1d82c.tar.bz2 |
Alt{Error,404}PageResourceFetcher cleanup.
This change modifies AltErrorPageResourceFetcher to use Callback so that
we can eliminate Alt404PageResourceFetcher. This change also eliminates
dependencies from AltErrorPageResourceFetcher on WebCore.
BUG=15648
TEST=none
R=tony
Review URL: http://codereview.chromium.org/159262
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21419 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/alt_error_page_resource_fetcher.h')
-rw-r--r-- | webkit/glue/alt_error_page_resource_fetcher.h | 54 |
1 files changed, 32 insertions, 22 deletions
diff --git a/webkit/glue/alt_error_page_resource_fetcher.h b/webkit/glue/alt_error_page_resource_fetcher.h index 0ca357b..3d50972 100644 --- a/webkit/glue/alt_error_page_resource_fetcher.h +++ b/webkit/glue/alt_error_page_resource_fetcher.h @@ -1,49 +1,59 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_GLUE_ALT_ERROR_PAGE_RESOURCE_FETCHER_H__ -#define WEBKIT_GLUE_ALT_ERROR_PAGE_RESOURCE_FETCHER_H__ - -#include <string> +#ifndef WEBKIT_GLUE_ALT_ERROR_PAGE_RESOURCE_FETCHER_H_ +#define WEBKIT_GLUE_ALT_ERROR_PAGE_RESOURCE_FETCHER_H_ #include "base/scoped_ptr.h" -#include "webkit/api/public/WebURLError.h" -#include "webkit/api/public/WebURLRequest.h" -#include "webkit/glue/resource_fetcher.h" +#include "base/task.h" +#include "googleurl/src/gurl.h" -class ResourceFetcherWithTimeout; -class WebFrameImpl; -class WebView; +class WebFrame; + +namespace WebKit { +class WebURLResponse; +} namespace webkit_glue { +class ResourceFetcherWithTimeout; + // Used for downloading alternate dns error pages. Once downloading is done // (or fails), the webview delegate is notified. class AltErrorPageResourceFetcher { public: - AltErrorPageResourceFetcher(WebView* web_view, - WebFrame* web_frame, - const WebKit::WebURLError& web_error, - const GURL& url); + // This will be called when the alternative error page has been fetched, + // successfully or not. If there is a failure, the second parameter (the + // data) will be empty. + typedef Callback2<const GURL&, const std::string&>::Type Callback; + + AltErrorPageResourceFetcher(const GURL& url, + WebFrame* frame, + const GURL& unreachable_url, + Callback* callback); ~AltErrorPageResourceFetcher(); + // Stop any pending loads. + void Cancel(); + private: void OnURLFetchComplete(const WebKit::WebURLResponse& response, const std::string& data); - // References to our owners - WebView* web_view_; - WebFrame* web_frame_; - WebKit::WebURLError web_error_; - WebKit::WebURLRequest failed_request_; - // Does the actual fetching. scoped_ptr<ResourceFetcherWithTimeout> fetcher_; + scoped_ptr<Callback> callback_; + + // The "unreachable url" associated with this load. If there's an error + // talking with the alt 404 page server, we need this to complete the + // original load. + GURL unreachable_url_; + DISALLOW_COPY_AND_ASSIGN(AltErrorPageResourceFetcher); }; } // namespace webkit_glue -#endif // WEBKIT_GLUE_ALT_ERROR_PAGE_RESOURCE_FETCHER_H__ +#endif // WEBKIT_GLUE_ALT_ERROR_PAGE_RESOURCE_FETCHER_H_ |