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

Unified Diff: content/browser/manifest/manifest_icon_downloader.cc

Issue 2933743002: Move chrome/browser/manifest to content/browser. (Closed)
Patch Set: Move chrome/browser/manifest to content/browser. Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/manifest/manifest_icon_downloader.cc
diff --git a/chrome/browser/manifest/manifest_icon_downloader.cc b/content/browser/manifest/manifest_icon_downloader.cc
similarity index 89%
rename from chrome/browser/manifest/manifest_icon_downloader.cc
rename to content/browser/manifest/manifest_icon_downloader.cc
index 50714c7af14041b2fe1da0525e3313f4a8c5fc85..80ef95d150e3cb267e5c1e8ddbf383c39deb116d 100644
--- a/chrome/browser/manifest/manifest_icon_downloader.cc
+++ b/content/browser/manifest/manifest_icon_downloader.cc
@@ -2,20 +2,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/manifest/manifest_icon_downloader.h"
+#include "content/public/browser/manifest_icon_downloader.h"
#include <stddef.h>
#include <limits>
-#include "chrome/browser/manifest/manifest_icon_selector.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/manifest_icon_selector.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/common/console_message_level.h"
#include "skia/ext/image_operations.h"
+namespace content {
+
// DevToolsConsoleHelper is a class that holds a WebContents in order to be able
// to send a message to the WebContents' main frame. It is used so
// ManifestIconDownloader and the callers do not have to worry about
@@ -33,8 +35,7 @@ class ManifestIconDownloader::DevToolsConsoleHelper
ManifestIconDownloader::DevToolsConsoleHelper::DevToolsConsoleHelper(
content::WebContents* web_contents)
jochen (gone - plz use gerrit) 2017/06/14 08:19:54 nit. no content:: inside namespace content (here a
zino 2017/06/14 14:18:18 Done.
- : WebContentsObserver(web_contents) {
-}
+ : WebContentsObserver(web_contents) {}
void ManifestIconDownloader::DevToolsConsoleHelper::AddMessage(
content::ConsoleMessageLevel level,
@@ -56,11 +57,10 @@ bool ManifestIconDownloader::Download(
web_contents->DownloadImage(
icon_url,
- false, // is_favicon
- 0, // max_bitmap_size - 0 means no maximum size.
- false, // bypass_cache
- base::Bind(&ManifestIconDownloader::OnIconFetched,
- ideal_icon_size_in_px,
+ false, // is_favicon
+ 0, // max_bitmap_size - 0 means no maximum size.
+ false, // bypass_cache
+ base::Bind(&ManifestIconDownloader::OnIconFetched, ideal_icon_size_in_px,
minimum_icon_size_in_px,
base::Owned(new DevToolsConsoleHelper(web_contents)),
callback));
@@ -82,8 +82,8 @@ void ManifestIconDownloader::OnIconFetched(
if (bitmaps.empty()) {
console_helper->AddMessage(
content::CONSOLE_MESSAGE_LEVEL_ERROR,
- "Error while trying to use the following icon from the Manifest: "
- + url.spec() + " (Download error or resource isn't a valid image)");
+ "Error while trying to use the following icon from the Manifest: " +
+ url.spec() + " (Download error or resource isn't a valid image)");
callback.Run(SkBitmap());
return;
@@ -95,9 +95,9 @@ void ManifestIconDownloader::OnIconFetched(
if (closest_index == -1) {
console_helper->AddMessage(
content::CONSOLE_MESSAGE_LEVEL_ERROR,
- "Error while trying to use the following icon from the Manifest: "
- + url.spec()
- + " (Resource size is not correct - typo in the Manifest?)");
+ "Error while trying to use the following icon from the Manifest: " +
+ url.spec() +
+ " (Resource size is not correct - typo in the Manifest?)");
callback.Run(SkBitmap());
return;
@@ -127,9 +127,7 @@ void ManifestIconDownloader::ScaleIcon(
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
const SkBitmap& scaled = skia::ImageOperations::Resize(
- bitmap,
- skia::ImageOperations::RESIZE_BEST,
- ideal_icon_size_in_px,
+ bitmap, skia::ImageOperations::RESIZE_BEST, ideal_icon_size_in_px,
ideal_icon_size_in_px);
content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
@@ -187,3 +185,5 @@ int ManifestIconDownloader::FindClosestBitmapIndex(
return best_index;
}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698