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 // TODO: Currently IPC truncates any data that has a |
| 1024 // size > kMaximumMessageSize. May be split the text into smaller chunks and |
| 1025 // send back using multiple IPC. See http://crbug.com/393444. |
| 1026 static const size_t kMaximumMessageSize = 8 * 1024 * 1024; |
| 1027 std::string text = webview()->mainFrame()->contentAsText( |
| 1028 kMaximumMessageSize).utf8(); |
| 1029 |
| 1030 Send(new ViewMsg_GetRenderedTextCompleted(routing_id(), text)); |
| 1031 } |
| 1032 |
1019 void RenderViewImpl::StartPluginIme() { | 1033 void RenderViewImpl::StartPluginIme() { |
1020 IPC::Message* msg = new ViewHostMsg_StartPluginIme(routing_id()); | 1034 IPC::Message* msg = new ViewHostMsg_StartPluginIme(routing_id()); |
1021 // This message can be sent during event-handling, and needs to be delivered | 1035 // This message can be sent during event-handling, and needs to be delivered |
1022 // within that context. | 1036 // within that context. |
1023 msg->set_unblock(true); | 1037 msg->set_unblock(true); |
1024 Send(msg); | 1038 Send(msg); |
1025 } | 1039 } |
1026 #endif // defined(OS_MACOSX) | 1040 #endif // defined(OS_MACOSX) |
1027 | 1041 |
1028 #endif // ENABLE_PLUGINS | 1042 #endif // ENABLE_PLUGINS |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 IPC_MESSAGE_HANDLER(ViewMsg_SelectWordAroundCaret, OnSelectWordAroundCaret) | 1135 IPC_MESSAGE_HANDLER(ViewMsg_SelectWordAroundCaret, OnSelectWordAroundCaret) |
1122 #if defined(OS_ANDROID) | 1136 #if defined(OS_ANDROID) |
1123 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult, | 1137 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult, |
1124 OnActivateNearestFindResult) | 1138 OnActivateNearestFindResult) |
1125 IPC_MESSAGE_HANDLER(ViewMsg_FindMatchRects, OnFindMatchRects) | 1139 IPC_MESSAGE_HANDLER(ViewMsg_FindMatchRects, OnFindMatchRects) |
1126 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) | 1140 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) |
1127 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTopControlsState, | 1141 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTopControlsState, |
1128 OnUpdateTopControlsState) | 1142 OnUpdateTopControlsState) |
1129 IPC_MESSAGE_HANDLER(ViewMsg_ExtractSmartClipData, OnExtractSmartClipData) | 1143 IPC_MESSAGE_HANDLER(ViewMsg_ExtractSmartClipData, OnExtractSmartClipData) |
1130 #elif defined(OS_MACOSX) | 1144 #elif defined(OS_MACOSX) |
| 1145 IPC_MESSAGE_HANDLER(ViewMsg_GetRenderedText, |
| 1146 OnGetRenderedText) |
1131 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted, | 1147 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted, |
1132 OnPluginImeCompositionCompleted) | 1148 OnPluginImeCompositionCompleted) |
1133 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) | 1149 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) |
1134 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) | 1150 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) |
1135 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility) | 1151 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility) |
1136 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged) | 1152 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged) |
1137 #endif | 1153 #endif |
1138 // Adding a new message? Add platform independent ones first, then put the | 1154 // Adding a new message? Add platform independent ones first, then put the |
1139 // platform specific ones at the end. | 1155 // platform specific ones at the end. |
1140 | 1156 |
(...skipping 2872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4013 std::vector<gfx::Size> sizes; | 4029 std::vector<gfx::Size> sizes; |
4014 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4030 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
4015 if (!url.isEmpty()) | 4031 if (!url.isEmpty()) |
4016 urls.push_back( | 4032 urls.push_back( |
4017 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4033 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
4018 } | 4034 } |
4019 SendUpdateFaviconURL(urls); | 4035 SendUpdateFaviconURL(urls); |
4020 } | 4036 } |
4021 | 4037 |
4022 } // namespace content | 4038 } // namespace content |
OLD | NEW |