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