Fix auto-uninstall of legacy multi-install Chrome Frame.
[chromium-blink-merge.git] / content / renderer / fetchers / multi_resolution_image_resource_fetcher.h
blob1b32950034267f4fe6665ba8c91f6a86e1838d6e
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::TargetType target_type,
40 const Callback& callback);
42 virtual ~MultiResolutionImageResourceFetcher();
44 // URL of the image we're downloading.
45 const GURL& image_url() const { return image_url_; }
47 // Unique identifier for the request.
48 int id() const { return id_; }
50 // HTTP status code upon fetch completion.
51 int http_status_code() const { return http_status_code_; }
53 private:
54 // ResourceFetcher::Callback. Decodes the image and invokes callback_.
55 void OnURLFetchComplete(const blink::WebURLResponse& response,
56 const std::string& data);
58 Callback callback_;
60 // Unique identifier for the request.
61 const int id_;
63 // HTTP status code upon fetch completion.
64 int http_status_code_;
66 // URL of the image.
67 const GURL image_url_;
69 // Does the actual download.
70 scoped_ptr<ResourceFetcher> fetcher_;
72 DISALLOW_COPY_AND_ASSIGN(MultiResolutionImageResourceFetcher);
75 } // namespace content
77 #endif // CONTENT_RENDERER_FETCHERS_MULTI_RESOLUTION_IMAGE_RESOURCE_FETCHER_H_