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 89% |
| rename from chrome/renderer/favicon_helper.cc |
| rename to content/renderer/favicon_helper.cc |
| index 8df4839af873e75cd68422073a3a0bc33416c9e2..f19d32f89cf891ebe8861bcc5a851306818eeff8 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" |
|
jam
2012/12/03 21:59:39
nit: redundant since by definition icon_messages.h
Cait (Slow)
2012/12/04 20:57:35
Done.
|
| #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" |
| @@ -29,6 +30,18 @@ using WebKit::WebURL; |
| using WebKit::WebURLRequest; |
| using webkit_glue::MultiResolutionImageResourceFetcher; |
| +namespace content { |
| + |
| +namespace { |
| +bool TouchEnabled() { |
| + CommandLine* cmdline = CommandLine::ForCurrentProcess(); |
| + return (cmdline->HasSwitch(switches::kTouchEvents) && |
| + cmdline->GetSwitchValueASCII(switches::kTouchEvents) == |
| + switches::kTouchEventsEnabled); |
| +} |
| +} // namespace |
| + |
| + |
| 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 |