Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(697)

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 342143004: Defect 248426: Speak rendered text when no selection is made on Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Uploading a clean patch Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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();
jamesr 2014/07/01 01:33:29 this could be gigantic and there's a fairly small
sarka 2014/07/01 02:03:10 Apparently I haven't tested with lots of text. I w
1025
1026 Send(new ViewMsg_GetRenderedTextCompleted(routing_id(), text));
1027 }
1028
1019 void RenderViewImpl::StartPluginIme() { 1029 void RenderViewImpl::StartPluginIme() {
1020 IPC::Message* msg = new ViewHostMsg_StartPluginIme(routing_id()); 1030 IPC::Message* msg = new ViewHostMsg_StartPluginIme(routing_id());
1021 // This message can be sent during event-handling, and needs to be delivered 1031 // This message can be sent during event-handling, and needs to be delivered
1022 // within that context. 1032 // within that context.
1023 msg->set_unblock(true); 1033 msg->set_unblock(true);
1024 Send(msg); 1034 Send(msg);
1025 } 1035 }
1026 #endif // defined(OS_MACOSX) 1036 #endif // defined(OS_MACOSX)
1027 1037
1028 #endif // ENABLE_PLUGINS 1038 #endif // ENABLE_PLUGINS
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 IPC_MESSAGE_HANDLER(ViewMsg_SelectWordAroundCaret, OnSelectWordAroundCaret) 1131 IPC_MESSAGE_HANDLER(ViewMsg_SelectWordAroundCaret, OnSelectWordAroundCaret)
1122 #if defined(OS_ANDROID) 1132 #if defined(OS_ANDROID)
1123 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult, 1133 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult,
1124 OnActivateNearestFindResult) 1134 OnActivateNearestFindResult)
1125 IPC_MESSAGE_HANDLER(ViewMsg_FindMatchRects, OnFindMatchRects) 1135 IPC_MESSAGE_HANDLER(ViewMsg_FindMatchRects, OnFindMatchRects)
1126 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) 1136 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItems, OnSelectPopupMenuItems)
1127 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTopControlsState, 1137 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTopControlsState,
1128 OnUpdateTopControlsState) 1138 OnUpdateTopControlsState)
1129 IPC_MESSAGE_HANDLER(ViewMsg_ExtractSmartClipData, OnExtractSmartClipData) 1139 IPC_MESSAGE_HANDLER(ViewMsg_ExtractSmartClipData, OnExtractSmartClipData)
1130 #elif defined(OS_MACOSX) 1140 #elif defined(OS_MACOSX)
1141 IPC_MESSAGE_HANDLER(ViewMsg_GetRenderedText,
1142 OnGetRenderedText)
1131 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted, 1143 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted,
1132 OnPluginImeCompositionCompleted) 1144 OnPluginImeCompositionCompleted)
1133 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) 1145 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem)
1134 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) 1146 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize)
1135 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility) 1147 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility)
1136 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged) 1148 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged)
1137 #endif 1149 #endif
1138 // Adding a new message? Add platform independent ones first, then put the 1150 // Adding a new message? Add platform independent ones first, then put the
1139 // platform specific ones at the end. 1151 // platform specific ones at the end.
1140 1152
(...skipping 2872 matching lines...) Expand 10 before | Expand all | Expand 10 after
4013 std::vector<gfx::Size> sizes; 4025 std::vector<gfx::Size> sizes;
4014 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 4026 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
4015 if (!url.isEmpty()) 4027 if (!url.isEmpty())
4016 urls.push_back( 4028 urls.push_back(
4017 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 4029 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
4018 } 4030 }
4019 SendUpdateFaviconURL(urls); 4031 SendUpdateFaviconURL(urls);
4020 } 4032 }
4021 4033
4022 } // namespace content 4034 } // namespace content
OLDNEW
« content/renderer/render_view_browsertest_mac.mm ('K') | « content/renderer/render_view_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698