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

Side by Side Diff: chrome/browser/manifest/manifest_icon_downloader.h

Issue 1261143004: Implement manifest icon downloader (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add scaling to non correct icons Created 5 years, 4 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
OLDNEW
(Empty)
1 // Copyright 2015 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_MANIFEST_MANIFEST_ICON_DOWNLOADER_H_
6 #define CHROME_BROWSER_MANIFEST_MANIFEST_ICON_DOWNLOADER_H_
7
8 #include "base/basictypes.h"
9 #include "base/bind.h"
10 #include "base/memory/ref_counted.h"
11 #include "content/public/browser/web_contents_observer.h"
12 #include "content/public/common/manifest.h"
13 #include "third_party/skia/include/core/SkBitmap.h"
14 #include "url/gurl.h"
15
16 namespace content {
17 class WebContents;
18 } // namespace content
19
20 class ManifestIconDownloader
21 : public content::WebContentsObserver {
22 public:
23 explicit ManifestIconDownloader(content::WebContents* web_contents);
24 virtual ~ManifestIconDownloader() {};
25
26 typedef base::Callback<void(const SkBitmap&)> Callback;
gone 2015/07/31 18:09:20 nit: Move the typedef above the constructor. Seem
Lalit Maganti 2015/08/03 08:58:29 Will do.
27 bool Download(const GURL& icon_url,
gone 2015/07/31 18:09:20 Add documentation.
Lalit Maganti 2015/08/03 08:58:29 Will do.
28 int ideal_icon_size,
29 const Callback& callback);
30
31 private:
32 // Callback run after an attempt to download manifest icon has been made.
gone 2015/07/31 18:09:20 nit: to download the manifest icon
Lalit Maganti 2015/08/03 08:58:29 Will do.
33 void OnIconFetched(const int ideal_icon_size,
34 const Callback& callback,
35 int id,
36 int http_status_code,
37 const GURL& url,
38 const std::vector<SkBitmap>& bitmaps,
39 const std::vector<gfx::Size>& sizes);
40 void ScaleAndCallback(const SkBitmap& image,
41 const float scaled_ideal_icon_size,
42 const Callback& callback);
43
44 base::WeakPtrFactory<ManifestIconDownloader> weak_ptr_factory_;
45
46 DISALLOW_COPY_AND_ASSIGN(ManifestIconDownloader);
47 };
48
49 #endif // CHROME_BROWSER_MANIFEST_MANIFEST_ICON_DOWNLOADER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698