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

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: Created 6 years, 6 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 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 else 1027 else
1028 focused_plugin_id_ = -1; 1028 focused_plugin_id_ = -1;
1029 } 1029 }
1030 #endif 1030 #endif
1031 1031
1032 #if defined(OS_MACOSX) 1032 #if defined(OS_MACOSX)
1033 void RenderViewImpl::PluginFocusChanged(bool focused, int plugin_id) { 1033 void RenderViewImpl::PluginFocusChanged(bool focused, int plugin_id) {
1034 Send(new ViewHostMsg_PluginFocusChanged(routing_id(), focused, plugin_id)); 1034 Send(new ViewHostMsg_PluginFocusChanged(routing_id(), focused, plugin_id));
1035 } 1035 }
1036 1036
1037 void RenderViewImpl::OnGetSmartClipDataFromRect(const gfx::Rect& rect) {
1038 if (webview()) {
Alexei Svitkine (slow) 2014/06/19 14:55:09 Nit: Reverse cond and early return instead.
1039 std::string text = webview()->getSmartClipData(rect).utf8();
Alexei Svitkine (slow) 2014/06/19 14:55:09 Is it possible to iterate on the chars without con
1040 // Skips to the first valid char. SmartClip returns a string
1041 // of Text along with its position
Alexei Svitkine (slow) 2014/06/19 14:55:09 Nit: Missing punctuation at the end. Also, the co
1042 if (text.size()) {
Alexei Svitkine (slow) 2014/06/19 14:55:09 Nit: !text.empty(), same below.
1043 size_t chars_to_skip = 0;
1044 for (size_t i = 0; i < text.length(); ++i) {
1045 if (isalpha(text[i])) {
1046 chars_to_skip = i;
1047 break;
1048 }
1049 }
1050 if (text.size() && chars_to_skip > 0) {
1051 std::string trimmed_text = text.substr(chars_to_skip, text.length());
1052 Send(new ViewMsg_ExtractedDataFromRect(routing_id(), trimmed_text));
1053 }
1054 }
1055 }
1056 }
1057
1037 void RenderViewImpl::StartPluginIme() { 1058 void RenderViewImpl::StartPluginIme() {
1038 IPC::Message* msg = new ViewHostMsg_StartPluginIme(routing_id()); 1059 IPC::Message* msg = new ViewHostMsg_StartPluginIme(routing_id());
1039 // This message can be sent during event-handling, and needs to be delivered 1060 // This message can be sent during event-handling, and needs to be delivered
1040 // within that context. 1061 // within that context.
1041 msg->set_unblock(true); 1062 msg->set_unblock(true);
1042 Send(msg); 1063 Send(msg);
1043 } 1064 }
1044 #endif // defined(OS_MACOSX) 1065 #endif // defined(OS_MACOSX)
1045 1066
1046 #endif // ENABLE_PLUGINS 1067 #endif // ENABLE_PLUGINS
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, 1150 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune,
1130 OnSetHistoryLengthAndPrune) 1151 OnSetHistoryLengthAndPrune)
1131 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) 1152 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode)
1132 IPC_MESSAGE_HANDLER(ViewMsg_SetAccessibilityMode, OnSetAccessibilityMode) 1153 IPC_MESSAGE_HANDLER(ViewMsg_SetAccessibilityMode, OnSetAccessibilityMode)
1133 IPC_MESSAGE_HANDLER(ViewMsg_DisownOpener, OnDisownOpener) 1154 IPC_MESSAGE_HANDLER(ViewMsg_DisownOpener, OnDisownOpener)
1134 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupBitmap, 1155 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupBitmap,
1135 OnReleaseDisambiguationPopupBitmap) 1156 OnReleaseDisambiguationPopupBitmap)
1136 IPC_MESSAGE_HANDLER(ViewMsg_WindowSnapshotCompleted, 1157 IPC_MESSAGE_HANDLER(ViewMsg_WindowSnapshotCompleted,
1137 OnWindowSnapshotCompleted) 1158 OnWindowSnapshotCompleted)
1138 IPC_MESSAGE_HANDLER(ViewMsg_SelectWordAroundCaret, OnSelectWordAroundCaret) 1159 IPC_MESSAGE_HANDLER(ViewMsg_SelectWordAroundCaret, OnSelectWordAroundCaret)
1160
1139 #if defined(OS_ANDROID) 1161 #if defined(OS_ANDROID)
1162 IPC_MESSAGE_HANDLER(ViewMsg_ExtractSmartClipData, OnExtractSmartClipData)
1140 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult, 1163 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult,
1141 OnActivateNearestFindResult) 1164 OnActivateNearestFindResult)
1142 IPC_MESSAGE_HANDLER(ViewMsg_FindMatchRects, OnFindMatchRects) 1165 IPC_MESSAGE_HANDLER(ViewMsg_FindMatchRects, OnFindMatchRects)
1143 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) 1166 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItems, OnSelectPopupMenuItems)
1144 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTopControlsState, 1167 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTopControlsState,
1145 OnUpdateTopControlsState) 1168 OnUpdateTopControlsState)
1146 IPC_MESSAGE_HANDLER(ViewMsg_ExtractSmartClipData, OnExtractSmartClipData)
1147 #elif defined(OS_MACOSX) 1169 #elif defined(OS_MACOSX)
1170 IPC_MESSAGE_HANDLER(ViewMsg_GetSmartClipDataFromRect,
1171 OnGetSmartClipDataFromRect)
1148 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted, 1172 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted,
1149 OnPluginImeCompositionCompleted) 1173 OnPluginImeCompositionCompleted)
1150 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) 1174 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem)
1151 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) 1175 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize)
1152 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility) 1176 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility)
1153 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged) 1177 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged)
1154 #endif 1178 #endif
1155 // Adding a new message? Add platform independent ones first, then put the 1179 // Adding a new message? Add platform independent ones first, then put the
1156 // platform specific ones at the end. 1180 // platform specific ones at the end.
1157 1181
(...skipping 2865 matching lines...) Expand 10 before | Expand all | Expand 10 after
4023 std::vector<gfx::Size> sizes; 4047 std::vector<gfx::Size> sizes;
4024 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 4048 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
4025 if (!url.isEmpty()) 4049 if (!url.isEmpty())
4026 urls.push_back( 4050 urls.push_back(
4027 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 4051 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
4028 } 4052 }
4029 SendUpdateFaviconURL(urls); 4053 SendUpdateFaviconURL(urls);
4030 } 4054 }
4031 4055
4032 } // namespace content 4056 } // namespace content
OLDNEW
« content/common/view_messages.h ('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