| 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/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 | 444 |
| 445 bool HandleMouseLockedInputEvent(const blink::WebMouseEvent& event) override { | 445 bool HandleMouseLockedInputEvent(const blink::WebMouseEvent& event) override { |
| 446 // The WebWidget handles mouse lock in WebKit's handleInputEvent(). | 446 // The WebWidget handles mouse lock in WebKit's handleInputEvent(). |
| 447 return false; | 447 return false; |
| 448 } | 448 } |
| 449 | 449 |
| 450 private: | 450 private: |
| 451 blink::WebWidget* webwidget_; | 451 blink::WebWidget* webwidget_; |
| 452 }; | 452 }; |
| 453 | 453 |
| 454 bool TouchEnabled() { | |
| 455 // Based on the definition of chrome::kEnableTouchIcon. | |
| 456 #if defined(OS_ANDROID) | |
| 457 return true; | |
| 458 #else | |
| 459 return false; | |
| 460 #endif | |
| 461 } | |
| 462 | |
| 463 WebDragData DropDataToWebDragData(const DropData& drop_data) { | 454 WebDragData DropDataToWebDragData(const DropData& drop_data) { |
| 464 std::vector<WebDragData::Item> item_list; | 455 std::vector<WebDragData::Item> item_list; |
| 465 | 456 |
| 466 // These fields are currently unused when dragging into WebKit. | 457 // These fields are currently unused when dragging into WebKit. |
| 467 DCHECK(drop_data.download_metadata.empty()); | 458 DCHECK(drop_data.download_metadata.empty()); |
| 468 DCHECK(drop_data.file_contents.empty()); | 459 DCHECK(drop_data.file_contents.empty()); |
| 469 DCHECK(drop_data.file_description_filename.empty()); | 460 DCHECK(drop_data.file_description_filename.empty()); |
| 470 | 461 |
| 471 if (!drop_data.text.is_null()) { | 462 if (!drop_data.text.is_null()) { |
| 472 WebDragData::Item item; | 463 WebDragData::Item item; |
| (...skipping 1789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2262 navigation_state = NavigationState::CreateContentInitiated(); | 2253 navigation_state = NavigationState::CreateContentInitiated(); |
| 2263 } | 2254 } |
| 2264 return navigation_state; | 2255 return navigation_state; |
| 2265 } | 2256 } |
| 2266 | 2257 |
| 2267 void RenderViewImpl::didChangeIcon(WebLocalFrame* frame, | 2258 void RenderViewImpl::didChangeIcon(WebLocalFrame* frame, |
| 2268 WebIconURL::Type icon_type) { | 2259 WebIconURL::Type icon_type) { |
| 2269 if (frame->parent()) | 2260 if (frame->parent()) |
| 2270 return; | 2261 return; |
| 2271 | 2262 |
| 2272 if (!TouchEnabled() && icon_type != WebIconURL::TypeFavicon) | |
| 2273 return; | |
| 2274 | |
| 2275 WebVector<WebIconURL> icon_urls = frame->iconURLs(icon_type); | 2263 WebVector<WebIconURL> icon_urls = frame->iconURLs(icon_type); |
| 2276 std::vector<FaviconURL> urls; | 2264 std::vector<FaviconURL> urls; |
| 2277 for (size_t i = 0; i < icon_urls.size(); i++) { | 2265 for (size_t i = 0; i < icon_urls.size(); i++) { |
| 2278 std::vector<gfx::Size> sizes; | 2266 std::vector<gfx::Size> sizes; |
| 2279 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 2267 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
| 2280 urls.push_back(FaviconURL( | 2268 urls.push_back(FaviconURL( |
| 2281 icon_urls[i].iconURL(), ToFaviconType(icon_urls[i].iconType()), sizes)); | 2269 icon_urls[i].iconURL(), ToFaviconType(icon_urls[i].iconType()), sizes)); |
| 2282 } | 2270 } |
| 2283 SendUpdateFaviconURL(urls); | 2271 SendUpdateFaviconURL(urls); |
| 2284 } | 2272 } |
| (...skipping 1684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3969 RenderWidget::DidCommitCompositorFrame(); | 3957 RenderWidget::DidCommitCompositorFrame(); |
| 3970 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidCommitCompositorFrame()); | 3958 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidCommitCompositorFrame()); |
| 3971 } | 3959 } |
| 3972 | 3960 |
| 3973 void RenderViewImpl::SendUpdateFaviconURL(const std::vector<FaviconURL>& urls) { | 3961 void RenderViewImpl::SendUpdateFaviconURL(const std::vector<FaviconURL>& urls) { |
| 3974 if (!urls.empty()) | 3962 if (!urls.empty()) |
| 3975 Send(new ViewHostMsg_UpdateFaviconURL(routing_id_, urls)); | 3963 Send(new ViewHostMsg_UpdateFaviconURL(routing_id_, urls)); |
| 3976 } | 3964 } |
| 3977 | 3965 |
| 3978 void RenderViewImpl::DidStopLoadingIcons() { | 3966 void RenderViewImpl::DidStopLoadingIcons() { |
| 3979 int icon_types = WebIconURL::TypeFavicon; | 3967 int icon_types = WebIconURL::TypeFavicon | WebIconURL::TypeTouchPrecomposed | |
| 3980 if (TouchEnabled()) | 3968 WebIconURL::TypeTouch; |
| 3981 icon_types |= WebIconURL::TypeTouchPrecomposed | WebIconURL::TypeTouch; | |
| 3982 | 3969 |
| 3983 // Favicons matter only for the top-level frame. If it is a WebRemoteFrame, | 3970 // Favicons matter only for the top-level frame. If it is a WebRemoteFrame, |
| 3984 // just return early. | 3971 // just return early. |
| 3985 if (webview()->mainFrame()->isWebRemoteFrame()) | 3972 if (webview()->mainFrame()->isWebRemoteFrame()) |
| 3986 return; | 3973 return; |
| 3987 | 3974 |
| 3988 WebVector<WebIconURL> icon_urls = | 3975 WebVector<WebIconURL> icon_urls = |
| 3989 webview()->mainFrame()->iconURLs(icon_types); | 3976 webview()->mainFrame()->iconURLs(icon_types); |
| 3990 | 3977 |
| 3991 std::vector<FaviconURL> urls; | 3978 std::vector<FaviconURL> urls; |
| 3992 for (size_t i = 0; i < icon_urls.size(); i++) { | 3979 for (size_t i = 0; i < icon_urls.size(); i++) { |
| 3993 WebURL url = icon_urls[i].iconURL(); | 3980 WebURL url = icon_urls[i].iconURL(); |
| 3994 std::vector<gfx::Size> sizes; | 3981 std::vector<gfx::Size> sizes; |
| 3995 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 3982 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
| 3996 if (!url.isEmpty()) | 3983 if (!url.isEmpty()) |
| 3997 urls.push_back( | 3984 urls.push_back( |
| 3998 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 3985 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
| 3999 } | 3986 } |
| 4000 SendUpdateFaviconURL(urls); | 3987 SendUpdateFaviconURL(urls); |
| 4001 } | 3988 } |
| 4002 | 3989 |
| 4003 } // namespace content | 3990 } // namespace content |
| OLD | NEW |