diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-07 16:44:39 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-07 16:44:39 +0000 |
commit | f6134ff2597f45c240b1fc2a493d38b51aa8a884 (patch) | |
tree | beddc103816d95a1f73a586eb523251154f84e6b /webkit/glue/image_resource_fetcher.h | |
parent | 62c9a8e3985009ee3503497cb4e1ab18d8cecc97 (diff) | |
download | chromium_src-f6134ff2597f45c240b1fc2a493d38b51aa8a884.zip chromium_src-f6134ff2597f45c240b1fc2a493d38b51aa8a884.tar.gz chromium_src-f6134ff2597f45c240b1fc2a493d38b51aa8a884.tar.bz2 |
Modify ResourceFetcher to use WebURLLoader instead of ResourceHandle.
This is step 1 of moving ResourceFetcher usage out of WebFrame. This
CL adds a new method to WebFrame, named DispatchWillSendRequest, which
may be used to associate a WebURLRequest with the WebFrame. This
triggers the WebViewDelegate's WillSendRequest method among other things.
ResourceFetcher and friends have been modified to use callbacks instead
of delegates. I just find this approach a bit cleaner and easier to
work with.
BUG=15648
TEST=none
R=brettw
Review URL: http://codereview.chromium.org/149172
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20031 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/image_resource_fetcher.h')
-rw-r--r-- | webkit/glue/image_resource_fetcher.h | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/webkit/glue/image_resource_fetcher.h b/webkit/glue/image_resource_fetcher.h index d6d73db..1503481 100644 --- a/webkit/glue/image_resource_fetcher.h +++ b/webkit/glue/image_resource_fetcher.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_GLUE_IMAGE_RESOURCE_FETCHER_H__ -#define WEBKIT_GLUE_IMAGE_RESOURCE_FETCHER_H__ +#ifndef WEBKIT_GLUE_IMAGE_RESOURCE_FETCHER_H_ +#define WEBKIT_GLUE_IMAGE_RESOURCE_FETCHER_H_ #include "base/basictypes.h" #include "webkit/glue/resource_fetcher.h" @@ -11,34 +11,35 @@ class SkBitmap; class WebViewImpl; +namespace webkit_glue { + // ImageResourceFetcher handles downloading an image for a webview. Once // downloading is done the hosting WebViewImpl is notified. ImageResourceFetcher // is used to download the favicon and images for web apps. -class ImageResourceFetcher : public ResourceFetcher::Delegate { +class ImageResourceFetcher { public: - ImageResourceFetcher(WebViewImpl* web_view, + typedef Callback2<ImageResourceFetcher*, const SkBitmap&>::Type Callback; + + ImageResourceFetcher(const GURL& image_url, + WebFrame* frame, int id, - const GURL& image_url, - int image_size); + int image_size, + Callback* callback); virtual ~ImageResourceFetcher(); - // ResourceFetcher::Delegate method. Decodes the image and invokes one of - // DownloadFailed or DownloadedImage. - virtual void OnURLFetchComplete(const WebCore::ResourceResponse& response, - const std::string& data); - // URL of the image we're downloading. const GURL& image_url() const { return image_url_; } - // Hosting WebView. - WebViewImpl* web_view() const { return web_view_; } - // Unique identifier for the request. int id() const { return id_; } private: - WebViewImpl* web_view_; + // ResourceFetcher::Callback. Decodes the image and invokes callback_. + void OnURLFetchComplete(const WebKit::WebURLResponse& response, + const std::string& data); + + Callback* callback_; // Unique identifier for the request. const int id_; @@ -57,4 +58,6 @@ class ImageResourceFetcher : public ResourceFetcher::Delegate { DISALLOW_EVIL_CONSTRUCTORS(ImageResourceFetcher); }; -#endif // WEBKIT_GLUE_IMAGE_RESOURCE_FETCHER_H__ +} // namespace webkit_glue + +#endif // WEBKIT_GLUE_IMAGE_RESOURCE_FETCHER_H_ |