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

Side by Side Diff: chrome/renderer/render_view.cc

Issue 63145: Copy text selection from renderer to browser every time it changes. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/renderer/render_view.h" 5 #include "chrome/renderer/render_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 OnReceivedAutofillSuggestions) 433 OnReceivedAutofillSuggestions)
434 IPC_MESSAGE_HANDLER(ViewMsg_PopupNotificationVisiblityChanged, 434 IPC_MESSAGE_HANDLER(ViewMsg_PopupNotificationVisiblityChanged,
435 OnPopupNotificationVisiblityChanged) 435 OnPopupNotificationVisiblityChanged)
436 IPC_MESSAGE_HANDLER(ViewMsg_RequestAudioPacket, OnRequestAudioPacket) 436 IPC_MESSAGE_HANDLER(ViewMsg_RequestAudioPacket, OnRequestAudioPacket)
437 IPC_MESSAGE_HANDLER(ViewMsg_NotifyAudioStreamCreated, OnAudioStreamCreated) 437 IPC_MESSAGE_HANDLER(ViewMsg_NotifyAudioStreamCreated, OnAudioStreamCreated)
438 IPC_MESSAGE_HANDLER(ViewMsg_NotifyAudioStreamStateChanged, 438 IPC_MESSAGE_HANDLER(ViewMsg_NotifyAudioStreamStateChanged,
439 OnAudioStreamStateChanged) 439 OnAudioStreamStateChanged)
440 IPC_MESSAGE_HANDLER(ViewMsg_NotifyAudioStreamVolume, OnAudioStreamVolume) 440 IPC_MESSAGE_HANDLER(ViewMsg_NotifyAudioStreamVolume, OnAudioStreamVolume)
441 IPC_MESSAGE_HANDLER(ViewMsg_MoveOrResizeStarted, OnMoveOrResizeStarted) 441 IPC_MESSAGE_HANDLER(ViewMsg_MoveOrResizeStarted, OnMoveOrResizeStarted)
442 IPC_MESSAGE_HANDLER(ViewMsg_ExtensionResponse, OnExtensionResponse) 442 IPC_MESSAGE_HANDLER(ViewMsg_ExtensionResponse, OnExtensionResponse)
443 IPC_MESSAGE_HANDLER(ViewMsg_RequestSelectionText, OnRequestSelectionText)
444 IPC_MESSAGE_HANDLER(ViewMsg_ClearFocusedNode, OnClearFocusedNode) 443 IPC_MESSAGE_HANDLER(ViewMsg_ClearFocusedNode, OnClearFocusedNode)
445 444
446 // Have the super handle all other messages. 445 // Have the super handle all other messages.
447 IPC_MESSAGE_UNHANDLED(RenderWidget::OnMessageReceived(message)) 446 IPC_MESSAGE_UNHANDLED(RenderWidget::OnMessageReceived(message))
448 IPC_END_MESSAGE_MAP() 447 IPC_END_MESSAGE_MAP()
449 } 448 }
450 449
451 void RenderView::SendThumbnail() { 450 void RenderView::SendThumbnail() {
452 WebFrame* main_frame = webview()->GetMainFrame(); 451 WebFrame* main_frame = webview()->GetMainFrame();
453 if (!main_frame) 452 if (!main_frame)
(...skipping 10 matching lines...) Expand all
464 ThumbnailScore score; 463 ThumbnailScore score;
465 SkBitmap thumbnail; 464 SkBitmap thumbnail;
466 if (!CaptureThumbnail(main_frame, kThumbnailWidth, kThumbnailHeight, 465 if (!CaptureThumbnail(main_frame, kThumbnailWidth, kThumbnailHeight,
467 &thumbnail, &score)) 466 &thumbnail, &score))
468 return; 467 return;
469 468
470 // send the thumbnail message to the browser process 469 // send the thumbnail message to the browser process
471 Send(new ViewHostMsg_Thumbnail(routing_id_, url, score, thumbnail)); 470 Send(new ViewHostMsg_Thumbnail(routing_id_, url, score, thumbnail));
472 } 471 }
473 472
474 void RenderView::OnRequestSelectionText() {
475 Send(new ViewHostMsg_SetSelectionText(routing_id_, selection_text_));
476 }
477
478 void RenderView::PrintPage(const ViewMsg_PrintPage_Params& params, 473 void RenderView::PrintPage(const ViewMsg_PrintPage_Params& params,
479 const gfx::Size& canvas_size, 474 const gfx::Size& canvas_size,
480 WebFrame* frame) { 475 WebFrame* frame) {
481 #if defined(OS_WIN) 476 #if defined(OS_WIN)
482 // Generate a memory-based EMF file. The EMF will use the current screen's 477 // Generate a memory-based EMF file. The EMF will use the current screen's
483 // DPI. 478 // DPI.
484 gfx::Emf emf; 479 gfx::Emf emf;
485 480
486 emf.CreateDc(NULL, NULL); 481 emf.CreateDc(NULL, NULL);
487 HDC hdc = emf.hdc(); 482 HDC hdc = emf.hdc();
(...skipping 1982 matching lines...) Expand 10 before | Expand all | Expand 10 after
2470 } 2465 }
2471 2466
2472 void RenderView::SetTooltipText(WebView* webview, 2467 void RenderView::SetTooltipText(WebView* webview,
2473 const std::wstring& tooltip_text) { 2468 const std::wstring& tooltip_text) {
2474 Send(new ViewHostMsg_SetTooltipText(routing_id_, tooltip_text)); 2469 Send(new ViewHostMsg_SetTooltipText(routing_id_, tooltip_text));
2475 } 2470 }
2476 2471
2477 void RenderView::DidChangeSelection(bool is_empty_selection) { 2472 void RenderView::DidChangeSelection(bool is_empty_selection) {
2478 #if defined(OS_LINUX) 2473 #if defined(OS_LINUX)
2479 if (!is_empty_selection) { 2474 if (!is_empty_selection) {
2480 // TODO(estade): find a way to incrementally update the selection text. 2475 Send(new ViewHostMsg_SelectionChanged(routing_id_,
2481 selection_text_ = webview()->GetMainFrame()->GetSelection(false); 2476 webview()->GetMainFrame()->GetSelection(false)));
2482 Send(new ViewHostMsg_SelectionChanged(routing_id_));
2483 } 2477 }
2484 #endif 2478 #endif
2485 } 2479 }
2486 2480
2487 2481
2488 void RenderView::DownloadUrl(const GURL& url, const GURL& referrer) { 2482 void RenderView::DownloadUrl(const GURL& url, const GURL& referrer) {
2489 Send(new ViewHostMsg_DownloadUrl(routing_id_, url, referrer)); 2483 Send(new ViewHostMsg_DownloadUrl(routing_id_, url, referrer));
2490 } 2484 }
2491 2485
2492 WebDevToolsAgentDelegate* RenderView::GetWebDevToolsAgentDelegate() { 2486 WebDevToolsAgentDelegate* RenderView::GetWebDevToolsAgentDelegate() {
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
3147 "Renderer.Other.StartToFinishDoc", start_to_finish_doc); 3141 "Renderer.Other.StartToFinishDoc", start_to_finish_doc);
3148 UMA_HISTOGRAM_TIMES( 3142 UMA_HISTOGRAM_TIMES(
3149 "Renderer.Other.FinishDocToFinish", finish_doc_to_finish); 3143 "Renderer.Other.FinishDocToFinish", finish_doc_to_finish);
3150 UMA_HISTOGRAM_TIMES( 3144 UMA_HISTOGRAM_TIMES(
3151 "Renderer.Other.RequestToFinish", request_to_finish); 3145 "Renderer.Other.RequestToFinish", request_to_finish);
3152 UMA_HISTOGRAM_TIMES( 3146 UMA_HISTOGRAM_TIMES(
3153 "Renderer.Other.StartToFinish", start_to_finish); 3147 "Renderer.Other.StartToFinish", start_to_finish);
3154 break; 3148 break;
3155 } 3149 }
3156 } 3150 }
OLDNEW
« chrome/browser/renderer_host/render_widget_host_view.h ('K') | « chrome/renderer/render_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698