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

Side by Side Diff: chrome/browser/android/banners/app_banner_icon_fetcher.h

Issue 155273002: Repurpose NotificationBitmapFetcher to BitmapFetcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: indentation Created 6 years, 10 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
(Empty)
1 // Copyright 2014 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.
4
5 #ifndef CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_ICON_FETCHER_H_
6 #define CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_ICON_FETCHER_H_
7
8 #include <string>
9
10 #include "chrome/browser/image_decoder.h"
11 #include "net/url_request/url_fetcher_delegate.h"
12 #include "url/gurl.h"
13
14 namespace content {
15 class WebContents;
16 } // namespace content
17
18 namespace net {
19 class URLFetcher;
20 } // namespace net
21
22 // Retrieves an icon from the given URL.
23 class AppBannerIconFetcher : public ImageDecoder::Delegate,
24 public net::URLFetcherDelegate {
25 public:
26 class Delegate {
27 public:
28 // Called when the image has been fetched successfully.
29 virtual void OnIconFetchSuccessful(const GURL& image_url,
30 const SkBitmap& image) = 0;
31
32 // Called when the image fetch has failed.
33 virtual void OnIconFetchFailed(const GURL& image_url) = 0;
34 };
35
36 // Kicks off retrieval of the given image stored at |image_url|.
37 // The |delegate| is informed when the icon fetch has finished.
38 AppBannerIconFetcher(Delegate* delegate,
39 content::WebContents* web_contents,
40 const GURL& image_url);
41
42 virtual ~AppBannerIconFetcher();
43
44 // net::URLFetcherDelegate overrides.
45 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
46
47 // ImageDecoder::Delegate overrides.
48 virtual void OnImageDecoded(const ImageDecoder* decoder,
49 const SkBitmap& decoded_image) OVERRIDE;
50
51 virtual void OnDecodeImageFailed(const ImageDecoder* decoder) OVERRIDE;
52
53 private:
54 // Alert the delegate that retrieval has failed for some reason.
55 void AlertDelegateAboutFailure();
56
57 Delegate* delegate_;
58 scoped_ptr<net::URLFetcher> fetcher_;
59 const GURL image_url_;
60
61 DISALLOW_COPY_AND_ASSIGN(AppBannerIconFetcher);
62 };
63
64 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_ICON_FETCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698