Commit eeb7bbc0 authored by Alexey Baskakov's avatar Alexey Baskakov Committed by Commit Bot

WebApp: Move WebAppIconDownloader into web_app namespace.

Bug: 875698
Change-Id: I6f5b88901728799d81ae493b3dd1bcae0530bc54
Reviewed-on: https://chromium-review.googlesource.com/c/1341286Reviewed-by: default avatarGiovanni Ortuño Urquidi <ortuno@chromium.org>
Commit-Queue: Alexey Baskakov <loyso@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609173}
parent 18c300bc
......@@ -133,7 +133,7 @@ class BookmarkAppInstaller : public base::RefCounted<BookmarkAppInstaller>,
void DidFinishLoad(content::RenderFrameHost* render_frame_host,
const GURL& validated_url) override {
web_app_icon_downloader_.reset(new WebAppIconDownloader(
web_app_icon_downloader_.reset(new web_app::WebAppIconDownloader(
web_contents_.get(), urls_to_download_,
"Extensions.BookmarkApp.Icon.HttpStatusCodeClassOnSync",
base::BindOnce(&BookmarkAppInstaller::OnIconsDownloaded,
......@@ -211,7 +211,7 @@ class BookmarkAppInstaller : public base::RefCounted<BookmarkAppInstaller>,
bool is_locally_installed_;
std::unique_ptr<content::WebContents> web_contents_;
std::unique_ptr<WebAppIconDownloader> web_app_icon_downloader_;
std::unique_ptr<web_app::WebAppIconDownloader> web_app_icon_downloader_;
std::vector<GURL> urls_to_download_;
std::vector<web_app::BitmapAndSource> downloaded_bitmaps_;
};
......@@ -347,7 +347,7 @@ void BookmarkAppHelper::OnDidPerformInstallableCheck(
web_app::MergeInstallableDataIcon(data, &web_app_info_);
web_app_icon_downloader_.reset(new WebAppIconDownloader(
web_app_icon_downloader_.reset(new web_app::WebAppIconDownloader(
contents_, web_app_info_icon_urls,
"Extensions.BookmarkApp.Icon.HttpStatusCodeClassOnCreate",
base::BindOnce(&BookmarkAppHelper::OnIconsDownloaded,
......
......@@ -22,7 +22,6 @@
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
class WebAppIconDownloader;
struct InstallableData;
class InstallableManager;
class Profile;
......@@ -34,6 +33,7 @@ class WebContents;
namespace web_app {
enum class ForInstallableSite;
class WebAppIconDownloader;
} // namespace web_app
namespace extensions {
......@@ -134,7 +134,7 @@ class BookmarkAppHelper : public content::NotificationObserver {
// Downloads icons from the given WebApplicationInfo using the given
// WebContents.
std::unique_ptr<WebAppIconDownloader> web_app_icon_downloader_;
std::unique_ptr<web_app::WebAppIconDownloader> web_app_icon_downloader_;
private:
FRIEND_TEST_ALL_PREFIXES(BookmarkAppHelperTest,
......
......@@ -173,7 +173,7 @@ class TestBookmarkAppHelper : public BookmarkAppHelper {
const Extension* extension() { return extension_; }
const WebAppIconDownloader* web_app_icon_downloader() {
const web_app::WebAppIconDownloader* web_app_icon_downloader() {
return web_app_icon_downloader_.get();
}
......
......@@ -14,6 +14,8 @@
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/geometry/size.h"
namespace web_app {
WebAppIconDownloader::WebAppIconDownloader(
content::WebContents* web_contents,
const std::vector<GURL>& extra_favicon_urls,
......@@ -144,3 +146,5 @@ void WebAppIconDownloader::DidUpdateFaviconURL(
need_favicon_urls_ = false;
FetchIcons(candidates);
}
} // namespace web_app
......@@ -30,6 +30,8 @@ namespace gfx {
class Size;
}
namespace web_app {
// Class to help download all icons (including favicons and web app manifest
// icons) for a tab.
class WebAppIconDownloader : public content::WebContentsObserver {
......@@ -118,4 +120,6 @@ class WebAppIconDownloader : public content::WebContentsObserver {
DISALLOW_COPY_AND_ASSIGN(WebAppIconDownloader);
};
} // namespace web_app
#endif // CHROME_BROWSER_WEB_APPLICATIONS_COMPONENTS_WEB_APP_ICON_DOWNLOADER_H_
......@@ -19,6 +19,8 @@
using content::RenderViewHostTester;
namespace web_app {
namespace {
// Creates valid SkBitmaps of the dimensions found in |sizes| and pushes them
......@@ -293,3 +295,5 @@ TEST_F(WebAppIconDownloaderTest, PageNavigatesSameDocument) {
EXPECT_TRUE(downloader.downloads_succeeded());
histogram_tester_.ExpectUniqueSample(kTestHistogramName, 2, 1);
}
} // namespace web_app
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment