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

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

Issue 197035: [mac] Let cmd-e write the selection into the find pasteboard. (Closed)
Patch Set: Add comment, merge with ToT Created 11 years, 3 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
« no previous file with comments | « chrome/renderer/render_view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 IPC_MESSAGE_HANDLER(ViewMsg_PrintPages, OnPrintPages) 342 IPC_MESSAGE_HANDLER(ViewMsg_PrintPages, OnPrintPages)
343 IPC_MESSAGE_HANDLER(ViewMsg_PrintingDone, OnPrintingDone) 343 IPC_MESSAGE_HANDLER(ViewMsg_PrintingDone, OnPrintingDone)
344 IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate) 344 IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate)
345 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop) 345 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop)
346 IPC_MESSAGE_HANDLER(ViewMsg_LoadAlternateHTMLText, OnLoadAlternateHTMLText) 346 IPC_MESSAGE_HANDLER(ViewMsg_LoadAlternateHTMLText, OnLoadAlternateHTMLText)
347 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding) 347 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding)
348 IPC_MESSAGE_HANDLER(ViewMsg_Undo, OnUndo) 348 IPC_MESSAGE_HANDLER(ViewMsg_Undo, OnUndo)
349 IPC_MESSAGE_HANDLER(ViewMsg_Redo, OnRedo) 349 IPC_MESSAGE_HANDLER(ViewMsg_Redo, OnRedo)
350 IPC_MESSAGE_HANDLER(ViewMsg_Cut, OnCut) 350 IPC_MESSAGE_HANDLER(ViewMsg_Cut, OnCut)
351 IPC_MESSAGE_HANDLER(ViewMsg_Copy, OnCopy) 351 IPC_MESSAGE_HANDLER(ViewMsg_Copy, OnCopy)
352 IPC_MESSAGE_HANDLER(ViewMsg_CopyToFindPboard, OnCopyToFindPboard)
352 IPC_MESSAGE_HANDLER(ViewMsg_Paste, OnPaste) 353 IPC_MESSAGE_HANDLER(ViewMsg_Paste, OnPaste)
353 IPC_MESSAGE_HANDLER(ViewMsg_Replace, OnReplace) 354 IPC_MESSAGE_HANDLER(ViewMsg_Replace, OnReplace)
354 IPC_MESSAGE_HANDLER(ViewMsg_ToggleSpellPanel, OnToggleSpellPanel) 355 IPC_MESSAGE_HANDLER(ViewMsg_ToggleSpellPanel, OnToggleSpellPanel)
355 IPC_MESSAGE_HANDLER(ViewMsg_AdvanceToNextMisspelling, 356 IPC_MESSAGE_HANDLER(ViewMsg_AdvanceToNextMisspelling,
356 OnAdvanceToNextMisspelling) 357 OnAdvanceToNextMisspelling)
357 IPC_MESSAGE_HANDLER(ViewMsg_ToggleSpellCheck, OnToggleSpellCheck) 358 IPC_MESSAGE_HANDLER(ViewMsg_ToggleSpellCheck, OnToggleSpellCheck)
358 IPC_MESSAGE_HANDLER(ViewMsg_Delete, OnDelete) 359 IPC_MESSAGE_HANDLER(ViewMsg_Delete, OnDelete)
359 IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll) 360 IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll)
360 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) 361 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt)
361 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteEditCommand, OnExecuteEditCommand) 362 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteEditCommand, OnExecuteEditCommand)
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 } 817 }
817 818
818 void RenderView::OnCopy() { 819 void RenderView::OnCopy() {
819 if (!webview()) 820 if (!webview())
820 return; 821 return;
821 822
822 webview()->GetFocusedFrame()->executeCommand(WebString::fromUTF8("Copy")); 823 webview()->GetFocusedFrame()->executeCommand(WebString::fromUTF8("Copy"));
823 UserMetricsRecordAction(L"Copy"); 824 UserMetricsRecordAction(L"Copy");
824 } 825 }
825 826
827 void RenderView::OnCopyToFindPboard() {
828 if (!webview())
829 return;
830
831 // Since the find pasteboard supports only plain text, this can be simpler
832 // than the |OnCopy()| case.
833 WebFrame* frame = webview()->GetFocusedFrame();
834 if (frame->hasSelection()) {
835 string16 selection = frame->selectionAsText();
836 RenderThread::current()->Send(
837 new ViewHostMsg_ClipboardFindPboardWriteStringAsync(selection));
838 }
839
840 UserMetricsRecordAction(L"CopyToFindPboard");
841 }
842
826 void RenderView::OnPaste() { 843 void RenderView::OnPaste() {
827 if (!webview()) 844 if (!webview())
828 return; 845 return;
829 846
830 webview()->GetFocusedFrame()->executeCommand(WebString::fromUTF8("Paste")); 847 webview()->GetFocusedFrame()->executeCommand(WebString::fromUTF8("Paste"));
831 UserMetricsRecordAction(L"Paste"); 848 UserMetricsRecordAction(L"Paste");
832 } 849 }
833 850
834 void RenderView::OnReplace(const std::wstring& text) { 851 void RenderView::OnReplace(const std::wstring& text) {
835 if (!webview()) 852 if (!webview())
(...skipping 2622 matching lines...) Expand 10 before | Expand all | Expand 10 after
3458 EditCommands::iterator end = edit_commands_.end(); 3475 EditCommands::iterator end = edit_commands_.end();
3459 3476
3460 for (; it != end; ++it) { 3477 for (; it != end; ++it) {
3461 if (!frame->executeCommand(WebString::fromUTF8(it->name), 3478 if (!frame->executeCommand(WebString::fromUTF8(it->name),
3462 WebString::fromUTF8(it->value))) 3479 WebString::fromUTF8(it->value)))
3463 break; 3480 break;
3464 } 3481 }
3465 3482
3466 return true; 3483 return true;
3467 } 3484 }
OLDNEW
« no previous file with comments | « chrome/renderer/render_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698