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 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1343 IPC_MESSAGE_HANDLER(ViewMsg_EnablePreferredSizeChangedMode, | 1343 IPC_MESSAGE_HANDLER(ViewMsg_EnablePreferredSizeChangedMode, |
1344 OnEnablePreferredSizeChangedMode) | 1344 OnEnablePreferredSizeChangedMode) |
1345 IPC_MESSAGE_HANDLER(ViewMsg_EnableAutoResize, OnEnableAutoResize) | 1345 IPC_MESSAGE_HANDLER(ViewMsg_EnableAutoResize, OnEnableAutoResize) |
1346 IPC_MESSAGE_HANDLER(ViewMsg_DisableAutoResize, OnDisableAutoResize) | 1346 IPC_MESSAGE_HANDLER(ViewMsg_DisableAutoResize, OnDisableAutoResize) |
1347 IPC_MESSAGE_HANDLER(ViewMsg_DisableScrollbarsForSmallWindows, | 1347 IPC_MESSAGE_HANDLER(ViewMsg_DisableScrollbarsForSmallWindows, |
1348 OnDisableScrollbarsForSmallWindows) | 1348 OnDisableScrollbarsForSmallWindows) |
1349 IPC_MESSAGE_HANDLER(ViewMsg_SetRendererPrefs, OnSetRendererPrefs) | 1349 IPC_MESSAGE_HANDLER(ViewMsg_SetRendererPrefs, OnSetRendererPrefs) |
1350 IPC_MESSAGE_HANDLER(ViewMsg_MediaPlayerActionAt, OnMediaPlayerActionAt) | 1350 IPC_MESSAGE_HANDLER(ViewMsg_MediaPlayerActionAt, OnMediaPlayerActionAt) |
1351 IPC_MESSAGE_HANDLER(ViewMsg_PluginActionAt, OnPluginActionAt) | 1351 IPC_MESSAGE_HANDLER(ViewMsg_PluginActionAt, OnPluginActionAt) |
1352 IPC_MESSAGE_HANDLER(ViewMsg_SetActive, OnSetActive) | 1352 IPC_MESSAGE_HANDLER(ViewMsg_SetActive, OnSetActive) |
1353 IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage, | |
1354 OnGetAllSavableResourceLinksForCurrentPage) | |
1355 IPC_MESSAGE_HANDLER( | 1353 IPC_MESSAGE_HANDLER( |
1356 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, | 1354 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, |
1357 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) | 1355 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) |
1358 IPC_MESSAGE_HANDLER(ViewMsg_ShowContextMenu, OnShowContextMenu) | 1356 IPC_MESSAGE_HANDLER(ViewMsg_ShowContextMenu, OnShowContextMenu) |
1359 // TODO(viettrungluu): Move to a separate message filter. | 1357 // TODO(viettrungluu): Move to a separate message filter. |
1360 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryOffsetAndLength, | 1358 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryOffsetAndLength, |
1361 OnSetHistoryOffsetAndLength) | 1359 OnSetHistoryOffsetAndLength) |
1362 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) | 1360 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) |
1363 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupBitmap, | 1361 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupBitmap, |
1364 OnReleaseDisambiguationPopupBitmap) | 1362 OnReleaseDisambiguationPopupBitmap) |
(...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2795 if (webview() && webview()->mainFrame()->isWebLocalFrame()) | 2793 if (webview() && webview()->mainFrame()->isWebLocalFrame()) |
2796 webview()->mainFrame()->toWebLocalFrame()->sendOrientationChangeEvent(); | 2794 webview()->mainFrame()->toWebLocalFrame()->sendOrientationChangeEvent(); |
2797 } | 2795 } |
2798 | 2796 |
2799 void RenderViewImpl::OnPluginActionAt(const gfx::Point& location, | 2797 void RenderViewImpl::OnPluginActionAt(const gfx::Point& location, |
2800 const WebPluginAction& action) { | 2798 const WebPluginAction& action) { |
2801 if (webview()) | 2799 if (webview()) |
2802 webview()->performPluginAction(action, location); | 2800 webview()->performPluginAction(action, location); |
2803 } | 2801 } |
2804 | 2802 |
2805 void RenderViewImpl::OnGetAllSavableResourceLinksForCurrentPage( | |
2806 const GURL& page_url) { | |
2807 // Prepare list to storage all savable resource links. | |
2808 std::vector<GURL> resources_list; | |
2809 std::vector<GURL> referrer_urls_list; | |
2810 std::vector<blink::WebReferrerPolicy> referrer_policies_list; | |
2811 std::vector<GURL> frames_list; | |
2812 SavableResourcesResult result(&resources_list, | |
2813 &referrer_urls_list, | |
2814 &referrer_policies_list, | |
2815 &frames_list); | |
2816 | |
2817 // webkit/ doesn't know about Referrer. | |
2818 if (!GetAllSavableResourceLinksForCurrentPage( | |
2819 webview(), | |
2820 page_url, | |
2821 &result, | |
2822 const_cast<const char**>(GetSavableSchemes()))) { | |
2823 // If something is wrong when collecting all savable resource links, | |
2824 // send empty list to embedder(browser) to tell it failed. | |
2825 referrer_urls_list.clear(); | |
2826 referrer_policies_list.clear(); | |
2827 resources_list.clear(); | |
2828 frames_list.clear(); | |
2829 } | |
2830 | |
2831 std::vector<Referrer> referrers_list; | |
2832 CHECK_EQ(referrer_urls_list.size(), referrer_policies_list.size()); | |
2833 for (unsigned i = 0; i < referrer_urls_list.size(); ++i) { | |
2834 referrers_list.push_back( | |
2835 Referrer(referrer_urls_list[i], referrer_policies_list[i])); | |
2836 } | |
2837 | |
2838 // Send result of all savable resource links to embedder. | |
2839 Send(new ViewHostMsg_SendCurrentPageAllSavableResourceLinks(routing_id(), | |
2840 resources_list, | |
2841 referrers_list, | |
2842 frames_list)); | |
2843 } | |
2844 | |
2845 void RenderViewImpl::OnGetSerializedHtmlDataForCurrentPageWithLocalLinks( | 2803 void RenderViewImpl::OnGetSerializedHtmlDataForCurrentPageWithLocalLinks( |
2846 const std::vector<GURL>& links, | 2804 const std::vector<GURL>& links, |
2847 const std::vector<base::FilePath>& local_paths, | 2805 const std::vector<base::FilePath>& local_paths, |
2848 const base::FilePath& local_directory_name) { | 2806 const base::FilePath& local_directory_name) { |
2849 | 2807 |
2850 // Convert std::vector of GURLs to WebVector<WebURL> | 2808 // Convert std::vector of GURLs to WebVector<WebURL> |
2851 WebVector<WebURL> weburl_links(links); | 2809 WebVector<WebURL> weburl_links(links); |
2852 | 2810 |
2853 // Convert std::vector of base::FilePath to WebVector<WebString> | 2811 // Convert std::vector of base::FilePath to WebVector<WebString> |
2854 WebVector<WebString> webstring_paths(local_paths.size()); | 2812 WebVector<WebString> webstring_paths(local_paths.size()); |
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3781 std::vector<gfx::Size> sizes; | 3739 std::vector<gfx::Size> sizes; |
3782 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 3740 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
3783 if (!url.isEmpty()) | 3741 if (!url.isEmpty()) |
3784 urls.push_back( | 3742 urls.push_back( |
3785 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 3743 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
3786 } | 3744 } |
3787 SendUpdateFaviconURL(urls); | 3745 SendUpdateFaviconURL(urls); |
3788 } | 3746 } |
3789 | 3747 |
3790 } // namespace content | 3748 } // namespace content |
OLD | NEW |