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 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1342 IPC_MESSAGE_HANDLER(ViewMsg_EnablePreferredSizeChangedMode, | 1342 IPC_MESSAGE_HANDLER(ViewMsg_EnablePreferredSizeChangedMode, |
1343 OnEnablePreferredSizeChangedMode) | 1343 OnEnablePreferredSizeChangedMode) |
1344 IPC_MESSAGE_HANDLER(ViewMsg_EnableAutoResize, OnEnableAutoResize) | 1344 IPC_MESSAGE_HANDLER(ViewMsg_EnableAutoResize, OnEnableAutoResize) |
1345 IPC_MESSAGE_HANDLER(ViewMsg_DisableAutoResize, OnDisableAutoResize) | 1345 IPC_MESSAGE_HANDLER(ViewMsg_DisableAutoResize, OnDisableAutoResize) |
1346 IPC_MESSAGE_HANDLER(ViewMsg_DisableScrollbarsForSmallWindows, | 1346 IPC_MESSAGE_HANDLER(ViewMsg_DisableScrollbarsForSmallWindows, |
1347 OnDisableScrollbarsForSmallWindows) | 1347 OnDisableScrollbarsForSmallWindows) |
1348 IPC_MESSAGE_HANDLER(ViewMsg_SetRendererPrefs, OnSetRendererPrefs) | 1348 IPC_MESSAGE_HANDLER(ViewMsg_SetRendererPrefs, OnSetRendererPrefs) |
1349 IPC_MESSAGE_HANDLER(ViewMsg_MediaPlayerActionAt, OnMediaPlayerActionAt) | 1349 IPC_MESSAGE_HANDLER(ViewMsg_MediaPlayerActionAt, OnMediaPlayerActionAt) |
1350 IPC_MESSAGE_HANDLER(ViewMsg_PluginActionAt, OnPluginActionAt) | 1350 IPC_MESSAGE_HANDLER(ViewMsg_PluginActionAt, OnPluginActionAt) |
1351 IPC_MESSAGE_HANDLER(ViewMsg_SetActive, OnSetActive) | 1351 IPC_MESSAGE_HANDLER(ViewMsg_SetActive, OnSetActive) |
1352 IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage, | |
1353 OnGetAllSavableResourceLinksForCurrentPage) | |
1354 IPC_MESSAGE_HANDLER( | 1352 IPC_MESSAGE_HANDLER( |
1355 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, | 1353 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, |
1356 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) | 1354 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) |
1357 IPC_MESSAGE_HANDLER(ViewMsg_ShowContextMenu, OnShowContextMenu) | 1355 IPC_MESSAGE_HANDLER(ViewMsg_ShowContextMenu, OnShowContextMenu) |
1358 // TODO(viettrungluu): Move to a separate message filter. | 1356 // TODO(viettrungluu): Move to a separate message filter. |
1359 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryOffsetAndLength, | 1357 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryOffsetAndLength, |
1360 OnSetHistoryOffsetAndLength) | 1358 OnSetHistoryOffsetAndLength) |
1361 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) | 1359 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) |
1362 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupBitmap, | 1360 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupBitmap, |
1363 OnReleaseDisambiguationPopupBitmap) | 1361 OnReleaseDisambiguationPopupBitmap) |
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2775 if (webview() && webview()->mainFrame()->isWebLocalFrame()) | 2773 if (webview() && webview()->mainFrame()->isWebLocalFrame()) |
2776 webview()->mainFrame()->toWebLocalFrame()->sendOrientationChangeEvent(); | 2774 webview()->mainFrame()->toWebLocalFrame()->sendOrientationChangeEvent(); |
2777 } | 2775 } |
2778 | 2776 |
2779 void RenderViewImpl::OnPluginActionAt(const gfx::Point& location, | 2777 void RenderViewImpl::OnPluginActionAt(const gfx::Point& location, |
2780 const WebPluginAction& action) { | 2778 const WebPluginAction& action) { |
2781 if (webview()) | 2779 if (webview()) |
2782 webview()->performPluginAction(action, location); | 2780 webview()->performPluginAction(action, location); |
2783 } | 2781 } |
2784 | 2782 |
2785 void RenderViewImpl::OnGetAllSavableResourceLinksForCurrentPage( | |
2786 const GURL& page_url) { | |
2787 // Prepare list to storage all savable resource links. | |
2788 std::vector<GURL> resources_list; | |
2789 std::vector<GURL> referrer_urls_list; | |
2790 std::vector<blink::WebReferrerPolicy> referrer_policies_list; | |
2791 std::vector<GURL> frames_list; | |
2792 SavableResourcesResult result(&resources_list, | |
2793 &referrer_urls_list, | |
2794 &referrer_policies_list, | |
2795 &frames_list); | |
2796 | |
2797 // webkit/ doesn't know about Referrer. | |
2798 if (!GetAllSavableResourceLinksForCurrentPage( | |
2799 webview(), | |
2800 page_url, | |
2801 &result, | |
2802 const_cast<const char**>(GetSavableSchemes()))) { | |
2803 // If something is wrong when collecting all savable resource links, | |
2804 // send empty list to embedder(browser) to tell it failed. | |
2805 referrer_urls_list.clear(); | |
2806 referrer_policies_list.clear(); | |
2807 resources_list.clear(); | |
2808 frames_list.clear(); | |
2809 } | |
2810 | |
2811 std::vector<Referrer> referrers_list; | |
2812 CHECK_EQ(referrer_urls_list.size(), referrer_policies_list.size()); | |
2813 for (unsigned i = 0; i < referrer_urls_list.size(); ++i) { | |
2814 referrers_list.push_back( | |
2815 Referrer(referrer_urls_list[i], referrer_policies_list[i])); | |
2816 } | |
2817 | |
2818 // Send result of all savable resource links to embedder. | |
2819 Send(new ViewHostMsg_SendCurrentPageAllSavableResourceLinks(routing_id(), | |
2820 resources_list, | |
2821 referrers_list, | |
2822 frames_list)); | |
2823 } | |
2824 | |
2825 void RenderViewImpl::OnGetSerializedHtmlDataForCurrentPageWithLocalLinks( | 2783 void RenderViewImpl::OnGetSerializedHtmlDataForCurrentPageWithLocalLinks( |
2826 const std::vector<GURL>& links, | 2784 const std::vector<GURL>& links, |
2827 const std::vector<base::FilePath>& local_paths, | 2785 const std::vector<base::FilePath>& local_paths, |
2828 const base::FilePath& local_directory_name) { | 2786 const base::FilePath& local_directory_name) { |
2829 | 2787 |
2830 // Convert std::vector of GURLs to WebVector<WebURL> | 2788 // Convert std::vector of GURLs to WebVector<WebURL> |
2831 WebVector<WebURL> weburl_links(links); | 2789 WebVector<WebURL> weburl_links(links); |
2832 | 2790 |
2833 // Convert std::vector of base::FilePath to WebVector<WebString> | 2791 // Convert std::vector of base::FilePath to WebVector<WebString> |
2834 WebVector<WebString> webstring_paths(local_paths.size()); | 2792 WebVector<WebString> webstring_paths(local_paths.size()); |
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3767 std::vector<gfx::Size> sizes; | 3725 std::vector<gfx::Size> sizes; |
3768 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 3726 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
3769 if (!url.isEmpty()) | 3727 if (!url.isEmpty()) |
3770 urls.push_back( | 3728 urls.push_back( |
3771 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 3729 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
3772 } | 3730 } |
3773 SendUpdateFaviconURL(urls); | 3731 SendUpdateFaviconURL(urls); |
3774 } | 3732 } |
3775 | 3733 |
3776 } // namespace content | 3734 } // namespace content |
OLD | NEW |