OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/favicon_helper.h" | 5 #include "content/renderer/favicon_helper.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "content/common/icon_messages.h" | 10 #include "content/common/icon_messages.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 using WebKit::WebFrame; | 25 using WebKit::WebFrame; |
26 using WebKit::WebIconURL; | 26 using WebKit::WebIconURL; |
27 using WebKit::WebVector; | 27 using WebKit::WebVector; |
28 using WebKit::WebURL; | 28 using WebKit::WebURL; |
29 using WebKit::WebURLRequest; | 29 using WebKit::WebURLRequest; |
30 using webkit_glue::MultiResolutionImageResourceFetcher; | 30 using webkit_glue::MultiResolutionImageResourceFetcher; |
31 | 31 |
32 namespace content { | 32 namespace content { |
33 | 33 |
34 namespace { | 34 namespace { |
| 35 |
35 bool TouchEnabled() { | 36 bool TouchEnabled() { |
36 // Based on the definition of chrome::kEnableTouchIcon. | 37 // Based on the definition of chrome::kEnableTouchIcon. |
37 #if defined(OS_ANDROID) | 38 #if defined(OS_ANDROID) |
38 return true; | 39 return true; |
39 #else | 40 #else |
40 return false; | 41 return false; |
41 #endif | 42 #endif |
42 } | 43 } |
43 | 44 |
44 } // namespace | 45 } // namespace |
45 | 46 |
46 | 47 |
47 static FaviconURL::IconType ToFaviconType(WebIconURL::Type type) { | 48 static FaviconURL::IconType ToFaviconType(WebIconURL::Type type) { |
48 switch (type) { | 49 switch (type) { |
49 case WebIconURL::TypeFavicon: | 50 case WebIconURL::TypeFavicon: |
50 return FaviconURL::FAVICON; | 51 return FaviconURL::FAVICON; |
51 case WebIconURL::TypeTouch: | 52 case WebIconURL::TypeTouch: |
52 return FaviconURL::TOUCH_ICON; | 53 return FaviconURL::TOUCH_ICON; |
53 case WebIconURL::TypeTouchPrecomposed: | 54 case WebIconURL::TypeTouchPrecomposed: |
54 return FaviconURL::TOUCH_PRECOMPOSED_ICON; | 55 return FaviconURL::TOUCH_PRECOMPOSED_ICON; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 render_view()->GetWebView()->mainFrame()->iconURLs(icon_types); | 183 render_view()->GetWebView()->mainFrame()->iconURLs(icon_types); |
183 std::vector<FaviconURL> urls; | 184 std::vector<FaviconURL> urls; |
184 for (size_t i = 0; i < icon_urls.size(); i++) { | 185 for (size_t i = 0; i < icon_urls.size(); i++) { |
185 WebURL url = icon_urls[i].iconURL(); | 186 WebURL url = icon_urls[i].iconURL(); |
186 if (!url.isEmpty()) | 187 if (!url.isEmpty()) |
187 urls.push_back(FaviconURL(url, ToFaviconType(icon_urls[i].iconType()))); | 188 urls.push_back(FaviconURL(url, ToFaviconType(icon_urls[i].iconType()))); |
188 } | 189 } |
189 SendUpdateFaviconURL(routing_id(), render_view()->GetPageId(), urls); | 190 SendUpdateFaviconURL(routing_id(), render_view()->GetPageId(), urls); |
190 } | 191 } |
191 | 192 |
192 } // namespace content | 193 } // namespace content |
OLD | NEW |