Chromium Code Reviews| Index: content/renderer/favicon_helper.cc |
| diff --git a/chrome/renderer/favicon_helper.cc b/content/renderer/favicon_helper.cc |
| similarity index 88% |
| rename from chrome/renderer/favicon_helper.cc |
| rename to content/renderer/favicon_helper.cc |
| index 8df4839af873e75cd68422073a3a0bc33416c9e2..4aecb2206eec84f8126ac9f08efd47c2ec7bda37 100644 |
| --- a/chrome/renderer/favicon_helper.cc |
| +++ b/content/renderer/favicon_helper.cc |
| @@ -2,19 +2,20 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "chrome/renderer/favicon_helper.h" |
| +#include "content/renderer/favicon_helper.h" |
| #include "base/bind.h" |
| +#include "base/command_line.h" |
| #include "base/message_loop.h" |
| -#include "chrome/common/chrome_constants.h" |
| -#include "chrome/common/favicon_url.h" |
| -#include "chrome/common/icon_messages.h" |
| +#include "content/common/icon_messages.h" |
| +#include "content/public/common/favicon_url.h" |
| #include "content/public/renderer/render_view.h" |
| #include "net/base/data_url.h" |
| -#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| -#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRequest.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" |
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| +#include "ui/base/ui_base_switches.h" |
| #include "ui/gfx/favicon_size.h" |
| #include "ui/gfx/size.h" |
| #include "ui/gfx/skbitmap_operations.h" |
| @@ -22,6 +23,7 @@ |
| #include "webkit/glue/multi_resolution_image_resource_fetcher.h" |
| #include "webkit/glue/webkit_glue.h" |
| +using content::FaviconURL; |
|
jam
2012/11/27 01:16:31
nit: get rid of this
Cait (Slow)
2012/11/28 00:11:45
Done.
|
| using WebKit::WebFrame; |
| using WebKit::WebIconURL; |
| using WebKit::WebVector; |
| @@ -29,6 +31,17 @@ using WebKit::WebURL; |
| using WebKit::WebURLRequest; |
| using webkit_glue::MultiResolutionImageResourceFetcher; |
| +namespace { |
| + bool TouchEnabled() { |
|
jam
2012/11/27 01:16:31
nit: put the anonymous namespace inside the conten
Cait (Slow)
2012/11/28 00:11:45
Done.
|
| + CommandLine* cmdline = CommandLine::ForCurrentProcess(); |
| + return (cmdline->HasSwitch(switches::kTouchEvents) && |
| + cmdline->GetSwitchValueASCII(switches::kTouchEvents) == |
| + switches::kTouchEventsEnabled); |
| + } |
| +} // namespace |
| + |
| +namespace content { |
| + |
| static FaviconURL::IconType ToFaviconType(WebIconURL::Type type) { |
| switch (type) { |
| case WebIconURL::TypeFavicon: |
| @@ -43,8 +56,8 @@ static FaviconURL::IconType ToFaviconType(WebIconURL::Type type) { |
| return FaviconURL::INVALID_ICON; |
| } |
| -FaviconHelper::FaviconHelper(content::RenderView* render_view) |
| - : content::RenderViewObserver(render_view) { |
| +FaviconHelper::FaviconHelper(RenderView* render_view) |
| + : RenderViewObserver(render_view) { |
| } |
| FaviconHelper::~FaviconHelper() { |
| @@ -139,7 +152,7 @@ bool FaviconHelper::OnMessageReceived(const IPC::Message& message) { |
| void FaviconHelper::DidStopLoading() { |
| int icon_types = WebIconURL::TypeFavicon; |
| - if (chrome::kEnableTouchIcon) |
| + if (TouchEnabled()) |
| icon_types |= WebIconURL::TypeTouchPrecomposed | WebIconURL::TypeTouch; |
| WebVector<WebIconURL> icon_urls = |
| @@ -158,8 +171,7 @@ void FaviconHelper::DidChangeIcon(WebKit::WebFrame* frame, |
| if (frame->parent()) |
| return; |
| - if (!chrome::kEnableTouchIcon && |
| - icon_type != WebIconURL::TypeFavicon) |
| + if (!TouchEnabled() && icon_type != WebIconURL::TypeFavicon) |
| return; |
| WebVector<WebIconURL> icon_urls = frame->iconURLs(icon_type); |
| @@ -170,3 +182,5 @@ void FaviconHelper::DidChangeIcon(WebKit::WebFrame* frame, |
| } |
| SendUpdateFaviconURL(routing_id(), render_view()->GetPageId(), urls); |
| } |
| + |
| +} // namespace content |