Chromium Code Reviews| 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 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1009 else | 1009 else |
| 1010 focused_plugin_id_ = -1; | 1010 focused_plugin_id_ = -1; |
| 1011 } | 1011 } |
| 1012 #endif | 1012 #endif |
| 1013 | 1013 |
| 1014 #if defined(OS_MACOSX) | 1014 #if defined(OS_MACOSX) |
| 1015 void RenderViewImpl::PluginFocusChanged(bool focused, int plugin_id) { | 1015 void RenderViewImpl::PluginFocusChanged(bool focused, int plugin_id) { |
| 1016 Send(new ViewHostMsg_PluginFocusChanged(routing_id(), focused, plugin_id)); | 1016 Send(new ViewHostMsg_PluginFocusChanged(routing_id(), focused, plugin_id)); |
| 1017 } | 1017 } |
| 1018 | 1018 |
| 1019 void RenderViewImpl::OnGetRenderedText() { | |
| 1020 if (!webview()) | |
| 1021 return; | |
| 1022 // Get rendered text from WebLocalFrame. | |
| 1023 std::string text = webview()->mainFrame()->contentAsText( | |
| 1024 std::numeric_limits<size_t>::max()).utf8(); | |
| 1025 | |
| 1026 if (!text.empty()) | |
|
Alexei Svitkine (slow)
2014/06/25 13:58:29
Why not send it even if it's empty? You're already
| |
| 1027 Send(new ViewMsg_GetRenderedTextCompleted(routing_id(), text)); | |
| 1028 } | |
| 1029 | |
| 1019 void RenderViewImpl::StartPluginIme() { | 1030 void RenderViewImpl::StartPluginIme() { |
| 1020 IPC::Message* msg = new ViewHostMsg_StartPluginIme(routing_id()); | 1031 IPC::Message* msg = new ViewHostMsg_StartPluginIme(routing_id()); |
| 1021 // This message can be sent during event-handling, and needs to be delivered | 1032 // This message can be sent during event-handling, and needs to be delivered |
| 1022 // within that context. | 1033 // within that context. |
| 1023 msg->set_unblock(true); | 1034 msg->set_unblock(true); |
| 1024 Send(msg); | 1035 Send(msg); |
| 1025 } | 1036 } |
| 1026 #endif // defined(OS_MACOSX) | 1037 #endif // defined(OS_MACOSX) |
| 1027 | 1038 |
| 1028 #endif // ENABLE_PLUGINS | 1039 #endif // ENABLE_PLUGINS |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1111 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, | 1122 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, |
| 1112 OnSetHistoryLengthAndPrune) | 1123 OnSetHistoryLengthAndPrune) |
| 1113 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) | 1124 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) |
| 1114 IPC_MESSAGE_HANDLER(ViewMsg_SetAccessibilityMode, OnSetAccessibilityMode) | 1125 IPC_MESSAGE_HANDLER(ViewMsg_SetAccessibilityMode, OnSetAccessibilityMode) |
| 1115 IPC_MESSAGE_HANDLER(ViewMsg_DisownOpener, OnDisownOpener) | 1126 IPC_MESSAGE_HANDLER(ViewMsg_DisownOpener, OnDisownOpener) |
| 1116 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupBitmap, | 1127 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupBitmap, |
| 1117 OnReleaseDisambiguationPopupBitmap) | 1128 OnReleaseDisambiguationPopupBitmap) |
| 1118 IPC_MESSAGE_HANDLER(ViewMsg_WindowSnapshotCompleted, | 1129 IPC_MESSAGE_HANDLER(ViewMsg_WindowSnapshotCompleted, |
| 1119 OnWindowSnapshotCompleted) | 1130 OnWindowSnapshotCompleted) |
| 1120 IPC_MESSAGE_HANDLER(ViewMsg_SelectWordAroundCaret, OnSelectWordAroundCaret) | 1131 IPC_MESSAGE_HANDLER(ViewMsg_SelectWordAroundCaret, OnSelectWordAroundCaret) |
| 1132 | |
| 1121 #if defined(OS_ANDROID) | 1133 #if defined(OS_ANDROID) |
| 1134 IPC_MESSAGE_HANDLER(ViewMsg_ExtractSmartClipData, OnExtractSmartClipData) | |
| 1122 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult, | 1135 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult, |
| 1123 OnActivateNearestFindResult) | 1136 OnActivateNearestFindResult) |
| 1124 IPC_MESSAGE_HANDLER(ViewMsg_FindMatchRects, OnFindMatchRects) | 1137 IPC_MESSAGE_HANDLER(ViewMsg_FindMatchRects, OnFindMatchRects) |
| 1125 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) | 1138 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) |
| 1126 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTopControlsState, | 1139 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTopControlsState, |
| 1127 OnUpdateTopControlsState) | 1140 OnUpdateTopControlsState) |
| 1128 IPC_MESSAGE_HANDLER(ViewMsg_ExtractSmartClipData, OnExtractSmartClipData) | |
| 1129 #elif defined(OS_MACOSX) | 1141 #elif defined(OS_MACOSX) |
| 1142 IPC_MESSAGE_HANDLER(ViewMsg_GetRenderedText, | |
| 1143 OnGetRenderedText) | |
| 1130 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted, | 1144 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted, |
| 1131 OnPluginImeCompositionCompleted) | 1145 OnPluginImeCompositionCompleted) |
| 1132 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) | 1146 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) |
| 1133 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) | 1147 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) |
| 1134 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility) | 1148 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility) |
| 1135 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged) | 1149 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged) |
| 1136 #endif | 1150 #endif |
| 1137 // Adding a new message? Add platform independent ones first, then put the | 1151 // Adding a new message? Add platform independent ones first, then put the |
| 1138 // platform specific ones at the end. | 1152 // platform specific ones at the end. |
| 1139 | 1153 |
| (...skipping 2859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3999 std::vector<gfx::Size> sizes; | 4013 std::vector<gfx::Size> sizes; |
| 4000 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4014 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
| 4001 if (!url.isEmpty()) | 4015 if (!url.isEmpty()) |
| 4002 urls.push_back( | 4016 urls.push_back( |
| 4003 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4017 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
| 4004 } | 4018 } |
| 4005 SendUpdateFaviconURL(urls); | 4019 SendUpdateFaviconURL(urls); |
| 4006 } | 4020 } |
| 4007 | 4021 |
| 4008 } // namespace content | 4022 } // namespace content |
| OLD | NEW |