Chromium Code Reviews| Index: chrome/browser/manifest/manifest_icon_downloader.h |
| diff --git a/chrome/browser/manifest/manifest_icon_downloader.h b/chrome/browser/manifest/manifest_icon_downloader.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3b67ca93363be2bcff9a0da234c41dc0e297de0f |
| --- /dev/null |
| +++ b/chrome/browser/manifest/manifest_icon_downloader.h |
| @@ -0,0 +1,49 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_MANIFEST_MANIFEST_ICON_DOWNLOADER_H_ |
| +#define CHROME_BROWSER_MANIFEST_MANIFEST_ICON_DOWNLOADER_H_ |
| + |
| +#include "base/basictypes.h" |
| +#include "base/bind.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "content/public/browser/web_contents_observer.h" |
| +#include "content/public/common/manifest.h" |
| +#include "third_party/skia/include/core/SkBitmap.h" |
| +#include "url/gurl.h" |
| + |
| +namespace content { |
| +class WebContents; |
| +} // namespace content |
| + |
| +class ManifestIconDownloader |
| + : public content::WebContentsObserver { |
| + public: |
| + explicit ManifestIconDownloader(content::WebContents* web_contents); |
| + virtual ~ManifestIconDownloader() {}; |
| + |
| + 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.
|
| + 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.
|
| + int ideal_icon_size, |
| + const Callback& callback); |
| + |
| + private: |
| + // 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.
|
| + void OnIconFetched(const int ideal_icon_size, |
| + const Callback& callback, |
| + int id, |
| + int http_status_code, |
| + const GURL& url, |
| + const std::vector<SkBitmap>& bitmaps, |
| + const std::vector<gfx::Size>& sizes); |
| + void ScaleAndCallback(const SkBitmap& image, |
| + const float scaled_ideal_icon_size, |
| + const Callback& callback); |
| + |
| + base::WeakPtrFactory<ManifestIconDownloader> weak_ptr_factory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ManifestIconDownloader); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_MANIFEST_MANIFEST_ICON_DOWNLOADER_H_ |