Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(694)

Side by Side Diff: webkit/glue/image_resource_fetcher.h

Issue 149172: Modify ResourceFetcher to use WebURLLoader instead of ResourceHandle.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_IMAGE_RESOURCE_FETCHER_H__ 5 #ifndef WEBKIT_GLUE_IMAGE_RESOURCE_FETCHER_H__
6 #define WEBKIT_GLUE_IMAGE_RESOURCE_FETCHER_H__ 6 #define WEBKIT_GLUE_IMAGE_RESOURCE_FETCHER_H__
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "webkit/glue/resource_fetcher.h" 9 #include "webkit/glue/resource_fetcher.h"
10 10
11 class SkBitmap; 11 class SkBitmap;
12 class WebViewImpl; 12 class WebViewImpl;
13 13
14 namespace webkit_glue {
15
14 // ImageResourceFetcher handles downloading an image for a webview. Once 16 // ImageResourceFetcher handles downloading an image for a webview. Once
15 // downloading is done the hosting WebViewImpl is notified. ImageResourceFetcher 17 // downloading is done the hosting WebViewImpl is notified. ImageResourceFetcher
16 // is used to download the favicon and images for web apps. 18 // is used to download the favicon and images for web apps.
17 class ImageResourceFetcher : public ResourceFetcher::Delegate { 19 class ImageResourceFetcher {
18 public: 20 public:
19 ImageResourceFetcher(WebViewImpl* web_view, 21 typedef Callback2<ImageResourceFetcher*, const SkBitmap&>::Type Callback;
22
23 ImageResourceFetcher(const GURL& image_url,
24 WebFrame* frame,
20 int id, 25 int id,
21 const GURL& image_url, 26 int image_size,
22 int image_size); 27 Callback* callback);
23 28
24 virtual ~ImageResourceFetcher(); 29 virtual ~ImageResourceFetcher();
25 30
26 // ResourceFetcher::Delegate method. Decodes the image and invokes one of
27 // DownloadFailed or DownloadedImage.
28 virtual void OnURLFetchComplete(const WebCore::ResourceResponse& response,
29 const std::string& data);
30
31 // URL of the image we're downloading. 31 // URL of the image we're downloading.
32 const GURL& image_url() const { return image_url_; } 32 const GURL& image_url() const { return image_url_; }
33 33
34 // Hosting WebView.
35 WebViewImpl* web_view() const { return web_view_; }
36
37 // Unique identifier for the request. 34 // Unique identifier for the request.
38 int id() const { return id_; } 35 int id() const { return id_; }
39 36
40 private: 37 private:
41 WebViewImpl* web_view_; 38 // ResourceFetcher::Callback. Decodes the image and invokes callback_.
39 void OnURLFetchComplete(const WebKit::WebURLResponse& response,
40 const std::string& data);
41
42 Callback* callback_;
42 43
43 // Unique identifier for the request. 44 // Unique identifier for the request.
44 const int id_; 45 const int id_;
45 46
46 // URL of the image. 47 // URL of the image.
47 const GURL image_url_; 48 const GURL image_url_;
48 49
49 // The size of the image. This is only a hint that is used if the image 50 // The size of the image. This is only a hint that is used if the image
50 // contains multiple sizes. A value of 0 results in using the first frame 51 // contains multiple sizes. A value of 0 results in using the first frame
51 // of the image. 52 // of the image.
52 const int image_size_; 53 const int image_size_;
53 54
54 // Does the actual download. 55 // Does the actual download.
55 scoped_ptr<ResourceFetcher> fetcher_; 56 scoped_ptr<ResourceFetcher> fetcher_;
56 57
57 DISALLOW_EVIL_CONSTRUCTORS(ImageResourceFetcher); 58 DISALLOW_EVIL_CONSTRUCTORS(ImageResourceFetcher);
58 }; 59 };
59 60
61 } // namespace webkit_glue
62
60 #endif // WEBKIT_GLUE_IMAGE_RESOURCE_FETCHER_H__ 63 #endif // WEBKIT_GLUE_IMAGE_RESOURCE_FETCHER_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698