diff options
author | huangs <huangs@chromium.org> | 2015-03-25 07:20:39 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-25 14:21:28 +0000 |
commit | ced2f17446e45420a4d6072d67adce436e32a6de (patch) | |
tree | f79d984ab53566e8f85b4c185a27744b6b2e6b0c /components | |
parent | 28307d55ab257422161f20c42cbdd693c39bcafb (diff) | |
download | chromium_src-ced2f17446e45420a4d6072d67adce436e32a6de.zip chromium_src-ced2f17446e45420a4d6072d67adce436e32a6de.tar.gz chromium_src-ced2f17446e45420a4d6072d67adce436e32a6de.tar.bz2 |
[Icons NTP] Refactoring: Moving FallbackIconService to components\favicon\core
The class used to be in components\favicon_base. The DEP changes arise
due to movement of fallback icon drawing code.
BUG=467712
Review URL: https://codereview.chromium.org/1032683002
Cr-Commit-Position: refs/heads/master@{#322157}
Diffstat (limited to 'components')
-rw-r--r-- | components/favicon.gypi | 2 | ||||
-rw-r--r-- | components/favicon/core/BUILD.gn | 2 | ||||
-rw-r--r-- | components/favicon/core/DEPS | 3 | ||||
-rw-r--r-- | components/favicon/core/fallback_icon_service.cc (renamed from components/favicon_base/fallback_icon_service.cc) | 17 | ||||
-rw-r--r-- | components/favicon/core/fallback_icon_service.h (renamed from components/favicon_base/fallback_icon_service.h) | 14 | ||||
-rw-r--r-- | components/favicon_base.gypi | 2 | ||||
-rw-r--r-- | components/favicon_base/BUILD.gn | 2 | ||||
-rw-r--r-- | components/favicon_base/DEPS | 1 |
8 files changed, 20 insertions, 23 deletions
diff --git a/components/favicon.gypi b/components/favicon.gypi index be91eeb..cddc746 100644 --- a/components/favicon.gypi +++ b/components/favicon.gypi @@ -19,6 +19,8 @@ ], 'sources': [ # Note: sources list duplicated in GN build. + 'favicon/core/fallback_icon_service.cc', + 'favicon/core/fallback_icon_service.h', 'favicon/core/favicon_client.h', 'favicon/core/favicon_driver.h', 'favicon/core/favicon_handler.cc', diff --git a/components/favicon/core/BUILD.gn b/components/favicon/core/BUILD.gn index f7ffefa..bbda145 100644 --- a/components/favicon/core/BUILD.gn +++ b/components/favicon/core/BUILD.gn @@ -4,6 +4,8 @@ static_library("core") { sources = [ + "fallback_icon_service.cc", + "fallback_icon_service.h", "favicon_client.h", "favicon_driver.h", "favicon_handler.cc", diff --git a/components/favicon/core/DEPS b/components/favicon/core/DEPS index 8a86e5b..ccb5231 100644 --- a/components/favicon/core/DEPS +++ b/components/favicon/core/DEPS @@ -2,6 +2,9 @@ include_rules = [ "+components/bookmarks/browser", "+components/history/core/browser", "+components/keyed_service/core", + "+net/base/registry_controlled_domains/registry_controlled_domain.h", "+skia", "+third_party/skia", + "+third_party/skia/include", + "+ui/gfx", ] diff --git a/components/favicon_base/fallback_icon_service.cc b/components/favicon/core/fallback_icon_service.cc index adce72e..e174818 100644 --- a/components/favicon_base/fallback_icon_service.cc +++ b/components/favicon/core/fallback_icon_service.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/favicon_base/fallback_icon_service.h" +#include "components/favicon/core/fallback_icon_service.h" #include <algorithm> @@ -18,8 +18,6 @@ #include "ui/gfx/geometry/size.h" #include "url/gurl.h" -namespace favicon_base { - namespace { // Arbitrary maximum icon size, can be reasonably increased if needed. @@ -48,7 +46,7 @@ FallbackIconService::~FallbackIconService() { std::vector<unsigned char> FallbackIconService::RenderFallbackIconBitmap( const GURL& icon_url, int size, - const FallbackIconStyle& style) { + const favicon_base::FallbackIconStyle& style) { int size_to_use = std::min(kMaxFallbackFaviconSize, size); gfx::Canvas canvas(gfx::Size(size_to_use, size_to_use), 1.0f, false); DrawFallbackIcon(icon_url, size_to_use, style, &canvas); @@ -61,10 +59,11 @@ std::vector<unsigned char> FallbackIconService::RenderFallbackIconBitmap( return bitmap_data; } -void FallbackIconService::DrawFallbackIcon(const GURL& icon_url, - int size, - const FallbackIconStyle& style, - gfx::Canvas* canvas) { +void FallbackIconService::DrawFallbackIcon( + const GURL& icon_url, + int size, + const favicon_base::FallbackIconStyle& style, + gfx::Canvas* canvas) { const int kOffsetX = 0; const int kOffsetY = 0; SkPaint paint; @@ -93,5 +92,3 @@ void FallbackIconService::DrawFallbackIcon(const GURL& icon_url, gfx::Rect(kOffsetX, kOffsetY, size, size), gfx::Canvas::TEXT_ALIGN_CENTER); } - -} // namespace favicon_base diff --git a/components/favicon_base/fallback_icon_service.h b/components/favicon/core/fallback_icon_service.h index cc98adf..9b3f6ba 100644 --- a/components/favicon_base/fallback_icon_service.h +++ b/components/favicon/core/fallback_icon_service.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_FAVICON_BASE_FALLBACK_ICON_SERVICE_H_ -#define COMPONENTS_FAVICON_BASE_FALLBACK_ICON_SERVICE_H_ +#ifndef COMPONENTS_FAVICON_CORE_FALLBACK_ICON_SERVICE_H_ +#define COMPONENTS_FAVICON_CORE_FALLBACK_ICON_SERVICE_H_ #include <string> #include <vector> @@ -17,8 +17,8 @@ class Canvas; } namespace favicon_base { - struct FallbackIconStyle; +} // A service to provide methods to render fallback favicons. class FallbackIconService { @@ -31,14 +31,14 @@ class FallbackIconService { std::vector<unsigned char> RenderFallbackIconBitmap( const GURL& icon_url, int size, - const FallbackIconStyle& style); + const favicon_base::FallbackIconStyle& style); private: // Renders a fallback icon on |canvas| at position (|x|, |y|). |size| is icon // width and height in pixels. void DrawFallbackIcon(const GURL& icon_url, int size, - const FallbackIconStyle& style, + const favicon_base::FallbackIconStyle& style, gfx::Canvas* canvas); std::vector<std::string> font_list_; @@ -46,6 +46,4 @@ class FallbackIconService { DISALLOW_COPY_AND_ASSIGN(FallbackIconService); }; -} // namespace favicon_base - -#endif // COMPONENTS_FAVICON_BASE_FALLBACK_ICON_SERVICE_H_ +#endif // COMPONENTS_FAVICON_CORE_FALLBACK_ICON_SERVICE_H_ diff --git a/components/favicon_base.gypi b/components/favicon_base.gypi index 0ea6331..852b9be 100644 --- a/components/favicon_base.gypi +++ b/components/favicon_base.gypi @@ -20,8 +20,6 @@ '../url/url.gyp:url_lib', ], 'sources': [ - 'favicon_base/fallback_icon_service.cc', - 'favicon_base/fallback_icon_service.h', 'favicon_base/fallback_icon_style.cc', 'favicon_base/fallback_icon_style.h', 'favicon_base/favicon_callback.h', diff --git a/components/favicon_base/BUILD.gn b/components/favicon_base/BUILD.gn index 07daa0a..2fcfb9c 100644 --- a/components/favicon_base/BUILD.gn +++ b/components/favicon_base/BUILD.gn @@ -4,8 +4,6 @@ source_set("favicon_base") { sources = [ - "fallback_icon_service.cc", - "fallback_icon_service.h", "fallback_icon_style.cc", "fallback_icon_style.h", "favicon_callback.h", diff --git a/components/favicon_base/DEPS b/components/favicon_base/DEPS index dc47487..0265afa 100644 --- a/components/favicon_base/DEPS +++ b/components/favicon_base/DEPS @@ -1,5 +1,4 @@ include_rules = [ - "+net/base/registry_controlled_domains/registry_controlled_domain.h", "+skia/ext", "+third_party/skia/include", "+ui/base", |