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

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: Removed browser tests from Render View Created 6 years, 4 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 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 else 1295 else
1296 focused_plugin_id_ = -1; 1296 focused_plugin_id_ = -1;
1297 } 1297 }
1298 #endif 1298 #endif
1299 1299
1300 #if defined(OS_MACOSX) 1300 #if defined(OS_MACOSX)
1301 void RenderViewImpl::PluginFocusChanged(bool focused, int plugin_id) { 1301 void RenderViewImpl::PluginFocusChanged(bool focused, int plugin_id) {
1302 Send(new ViewHostMsg_PluginFocusChanged(routing_id(), focused, plugin_id)); 1302 Send(new ViewHostMsg_PluginFocusChanged(routing_id(), focused, plugin_id));
1303 } 1303 }
1304 1304
1305 void RenderViewImpl::OnGetRenderedText() {
1306 if (!webview())
1307 return;
1308 // Get rendered text from WebLocalFrame.
1309 // TODO: Currently IPC truncates any data that has a
1310 // size > kMaximumMessageSize. May be split the text into smaller chunks and
1311 // send back using multiple IPC. See http://crbug.com/393444.
1312 static const size_t kMaximumMessageSize = 8 * 1024 * 1024;
1313 std::string text = webview()->mainFrame()->contentAsText(
1314 kMaximumMessageSize).utf8();
1315
1316 Send(new ViewMsg_GetRenderedTextCompleted(routing_id(), text));
1317 }
1318
1305 void RenderViewImpl::StartPluginIme() { 1319 void RenderViewImpl::StartPluginIme() {
1306 IPC::Message* msg = new ViewHostMsg_StartPluginIme(routing_id()); 1320 IPC::Message* msg = new ViewHostMsg_StartPluginIme(routing_id());
1307 // This message can be sent during event-handling, and needs to be delivered 1321 // This message can be sent during event-handling, and needs to be delivered
1308 // within that context. 1322 // within that context.
1309 msg->set_unblock(true); 1323 msg->set_unblock(true);
1310 Send(msg); 1324 Send(msg);
1311 } 1325 }
1312 #endif // defined(OS_MACOSX) 1326 #endif // defined(OS_MACOSX)
1313 1327
1314 #endif // ENABLE_PLUGINS 1328 #endif // ENABLE_PLUGINS
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1406 IPC_MESSAGE_HANDLER(ViewMsg_SelectWordAroundCaret, OnSelectWordAroundCaret) 1420 IPC_MESSAGE_HANDLER(ViewMsg_SelectWordAroundCaret, OnSelectWordAroundCaret)
1407 #if defined(OS_ANDROID) 1421 #if defined(OS_ANDROID)
1408 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult, 1422 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult,
1409 OnActivateNearestFindResult) 1423 OnActivateNearestFindResult)
1410 IPC_MESSAGE_HANDLER(ViewMsg_FindMatchRects, OnFindMatchRects) 1424 IPC_MESSAGE_HANDLER(ViewMsg_FindMatchRects, OnFindMatchRects)
1411 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) 1425 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItems, OnSelectPopupMenuItems)
1412 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTopControlsState, 1426 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTopControlsState,
1413 OnUpdateTopControlsState) 1427 OnUpdateTopControlsState)
1414 IPC_MESSAGE_HANDLER(ViewMsg_ExtractSmartClipData, OnExtractSmartClipData) 1428 IPC_MESSAGE_HANDLER(ViewMsg_ExtractSmartClipData, OnExtractSmartClipData)
1415 #elif defined(OS_MACOSX) 1429 #elif defined(OS_MACOSX)
1430 IPC_MESSAGE_HANDLER(ViewMsg_GetRenderedText,
1431 OnGetRenderedText)
1416 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted, 1432 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted,
1417 OnPluginImeCompositionCompleted) 1433 OnPluginImeCompositionCompleted)
1418 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) 1434 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem)
1419 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) 1435 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize)
1420 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility) 1436 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility)
1421 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged) 1437 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged)
1422 #endif 1438 #endif
1423 // Adding a new message? Add platform independent ones first, then put the 1439 // Adding a new message? Add platform independent ones first, then put the
1424 // platform specific ones at the end. 1440 // platform specific ones at the end.
1425 1441
(...skipping 2887 matching lines...) Expand 10 before | Expand all | Expand 10 after
4313 std::vector<gfx::Size> sizes; 4329 std::vector<gfx::Size> sizes;
4314 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 4330 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
4315 if (!url.isEmpty()) 4331 if (!url.isEmpty())
4316 urls.push_back( 4332 urls.push_back(
4317 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 4333 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
4318 } 4334 }
4319 SendUpdateFaviconURL(urls); 4335 SendUpdateFaviconURL(urls);
4320 } 4336 }
4321 4337
4322 } // namespace content 4338 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698