| 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 1810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2283 navigation_state = NavigationState::CreateContentInitiated(); | 2274 navigation_state = NavigationState::CreateContentInitiated(); |
| 2284 } | 2275 } |
| 2285 return navigation_state; | 2276 return navigation_state; |
| 2286 } | 2277 } |
| 2287 | 2278 |
| 2288 void RenderViewImpl::didChangeIcon(WebLocalFrame* frame, | 2279 void RenderViewImpl::didChangeIcon(WebLocalFrame* frame, |
| 2289 WebIconURL::Type icon_type) { | 2280 WebIconURL::Type icon_type) { |
| 2290 if (frame->parent()) | 2281 if (frame->parent()) |
| 2291 return; | 2282 return; |
| 2292 | 2283 |
| 2293 if (!TouchEnabled() && icon_type != WebIconURL::TypeFavicon) | |
| 2294 return; | |
| 2295 | |
| 2296 WebVector<WebIconURL> icon_urls = frame->iconURLs(icon_type); | 2284 WebVector<WebIconURL> icon_urls = frame->iconURLs(icon_type); |
| 2297 std::vector<FaviconURL> urls; | 2285 std::vector<FaviconURL> urls; |
| 2298 for (size_t i = 0; i < icon_urls.size(); i++) { | 2286 for (size_t i = 0; i < icon_urls.size(); i++) { |
| 2299 std::vector<gfx::Size> sizes; | 2287 std::vector<gfx::Size> sizes; |
| 2300 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 2288 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
| 2301 urls.push_back(FaviconURL( | 2289 urls.push_back(FaviconURL( |
| 2302 icon_urls[i].iconURL(), ToFaviconType(icon_urls[i].iconType()), sizes)); | 2290 icon_urls[i].iconURL(), ToFaviconType(icon_urls[i].iconType()), sizes)); |
| 2303 } | 2291 } |
| 2304 SendUpdateFaviconURL(urls); | 2292 SendUpdateFaviconURL(urls); |
| 2305 } | 2293 } |
| (...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3991 RenderWidget::DidCommitCompositorFrame(); | 3979 RenderWidget::DidCommitCompositorFrame(); |
| 3992 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidCommitCompositorFrame()); | 3980 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidCommitCompositorFrame()); |
| 3993 } | 3981 } |
| 3994 | 3982 |
| 3995 void RenderViewImpl::SendUpdateFaviconURL(const std::vector<FaviconURL>& urls) { | 3983 void RenderViewImpl::SendUpdateFaviconURL(const std::vector<FaviconURL>& urls) { |
| 3996 if (!urls.empty()) | 3984 if (!urls.empty()) |
| 3997 Send(new ViewHostMsg_UpdateFaviconURL(routing_id_, urls)); | 3985 Send(new ViewHostMsg_UpdateFaviconURL(routing_id_, urls)); |
| 3998 } | 3986 } |
| 3999 | 3987 |
| 4000 void RenderViewImpl::DidStopLoadingIcons() { | 3988 void RenderViewImpl::DidStopLoadingIcons() { |
| 4001 int icon_types = WebIconURL::TypeFavicon; | 3989 int icon_types = WebIconURL::TypeFavicon | WebIconURL::TypeTouchPrecomposed | |
| 4002 if (TouchEnabled()) | 3990 WebIconURL::TypeTouch; |
| 4003 icon_types |= WebIconURL::TypeTouchPrecomposed | WebIconURL::TypeTouch; | |
| 4004 | 3991 |
| 4005 // Favicons matter only for the top-level frame. If it is a WebRemoteFrame, | 3992 // Favicons matter only for the top-level frame. If it is a WebRemoteFrame, |
| 4006 // just return early. | 3993 // just return early. |
| 4007 if (webview()->mainFrame()->isWebRemoteFrame()) | 3994 if (webview()->mainFrame()->isWebRemoteFrame()) |
| 4008 return; | 3995 return; |
| 4009 | 3996 |
| 4010 WebVector<WebIconURL> icon_urls = | 3997 WebVector<WebIconURL> icon_urls = |
| 4011 webview()->mainFrame()->iconURLs(icon_types); | 3998 webview()->mainFrame()->iconURLs(icon_types); |
| 4012 | 3999 |
| 4013 std::vector<FaviconURL> urls; | 4000 std::vector<FaviconURL> urls; |
| 4014 for (size_t i = 0; i < icon_urls.size(); i++) { | 4001 for (size_t i = 0; i < icon_urls.size(); i++) { |
| 4015 WebURL url = icon_urls[i].iconURL(); | 4002 WebURL url = icon_urls[i].iconURL(); |
| 4016 std::vector<gfx::Size> sizes; | 4003 std::vector<gfx::Size> sizes; |
| 4017 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4004 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
| 4018 if (!url.isEmpty()) | 4005 if (!url.isEmpty()) |
| 4019 urls.push_back( | 4006 urls.push_back( |
| 4020 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4007 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
| 4021 } | 4008 } |
| 4022 SendUpdateFaviconURL(urls); | 4009 SendUpdateFaviconURL(urls); |
| 4023 } | 4010 } |
| 4024 | 4011 |
| 4025 } // namespace content | 4012 } // namespace content |
| OLD | NEW |