Update V8 to version 4.6.61.
[chromium-blink-merge.git] / content / renderer / fetchers / multi_resolution_image_resource_fetcher.h
blobde44acef7d54c11b6a5bddf91b1ebdaab7afb0da
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_FETCHERS_MULTI_RESOLUTION_IMAGE_RESOURCE_FETCHER_H_
6 #define CONTENT_RENDERER_FETCHERS_MULTI_RESOLUTION_IMAGE_RESOURCE_FETCHER_H_
8 #include <string>
9 #include <vector>
11 #include "base/basictypes.h"
12 #include "base/callback.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "third_party/WebKit/public/platform/WebURLRequest.h"
15 #include "url/gurl.h"
17 class SkBitmap;
19 namespace blink {
20 class WebFrame;
21 class WebURLResponse;
24 namespace content {
26 class ResourceFetcher;
28 // A resource fetcher that returns all (differently-sized) frames in
29 // an image. Useful for favicons.
30 class MultiResolutionImageResourceFetcher {
31 public:
32 typedef base::Callback<void(MultiResolutionImageResourceFetcher*,
33 const std::vector<SkBitmap>&)> Callback;
35 MultiResolutionImageResourceFetcher(
36 const GURL& image_url,
37 blink::WebFrame* frame,
38 int id,
39 blink::WebURLRequest::RequestContext request_context,
40 blink::WebURLRequest::CachePolicy cache_policy,
41 const Callback& callback);
43 virtual ~MultiResolutionImageResourceFetcher();
45 // URL of the image we're downloading.
46 const GURL& image_url() const { return image_url_; }
48 // Unique identifier for the request.
49 int id() const { return id_; }
51 // HTTP status code upon fetch completion.
52 int http_status_code() const { return http_status_code_; }
54 private:
55 // ResourceFetcher::Callback. Decodes the image and invokes callback_.
56 void OnURLFetchComplete(const blink::WebURLResponse& response,
57 const std::string& data);
59 Callback callback_;
61 // Unique identifier for the request.
62 const int id_;
64 // HTTP status code upon fetch completion.
65 int http_status_code_;
67 // URL of the image.
68 const GURL image_url_;
70 // Does the actual download.
71 scoped_ptr<ResourceFetcher> fetcher_;
73 DISALLOW_COPY_AND_ASSIGN(MultiResolutionImageResourceFetcher);
76 } // namespace content
78 #endif // CONTENT_RENDERER_FETCHERS_MULTI_RESOLUTION_IMAGE_RESOURCE_FETCHER_H_