Chromium Code Reviews| 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..31009d70f21aa81a370bb9a814afdef1e13ba66c 100644 |
| --- a/chrome/browser/manifest/manifest_icon_downloader.cc |
| +++ b/content/browser/manifest/manifest_icon_downloader.cc |
| @@ -2,20 +2,20 @@ |
| // 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 <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_downloader.h" |
|
please use gerrit instead
2017/06/12 23:57:22
This line should be on top.
zino
2017/06/13 16:07:44
Done.
|
| +#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 { |
|
please use gerrit instead
2017/06/12 23:57:22
Newline below.
zino
2017/06/13 16:07:44
Done.
|
| // 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 +33,7 @@ class ManifestIconDownloader::DevToolsConsoleHelper |
| ManifestIconDownloader::DevToolsConsoleHelper::DevToolsConsoleHelper( |
| content::WebContents* web_contents) |
| - : WebContentsObserver(web_contents) { |
| -} |
| + : WebContentsObserver(web_contents) {} |
| void ManifestIconDownloader::DevToolsConsoleHelper::AddMessage( |
| content::ConsoleMessageLevel level, |
| @@ -56,11 +55,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 +80,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 +93,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 +125,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 +183,4 @@ int ManifestIconDownloader::FindClosestBitmapIndex( |
| return best_index; |
| } |
|
please use gerrit instead
2017/06/12 23:57:22
newline below
zino
2017/06/13 16:07:44
Done.
|
| +} |
|
please use gerrit instead
2017/06/12 23:57:22
// namespace content
zino
2017/06/13 16:07:44
Done.
|