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

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

Issue 1075011: Chrome side of adding search support to Pepper. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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
« no previous file with comments | « chrome/renderer/render_view.h ('k') | chrome/renderer/webplugin_delegate_pepper.h » ('j') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 #include "third_party/WebKit/WebKit/chromium/public/WebDragData.h" 80 #include "third_party/WebKit/WebKit/chromium/public/WebDragData.h"
81 #include "third_party/WebKit/WebKit/chromium/public/WebFileChooserParams.h" 81 #include "third_party/WebKit/WebKit/chromium/public/WebFileChooserParams.h"
82 #include "third_party/WebKit/WebKit/chromium/public/WebFormElement.h" 82 #include "third_party/WebKit/WebKit/chromium/public/WebFormElement.h"
83 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" 83 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
84 #include "third_party/WebKit/WebKit/chromium/public/WebHistoryItem.h" 84 #include "third_party/WebKit/WebKit/chromium/public/WebHistoryItem.h"
85 #include "third_party/WebKit/WebKit/chromium/public/WebImage.h" 85 #include "third_party/WebKit/WebKit/chromium/public/WebImage.h"
86 #include "third_party/WebKit/WebKit/chromium/public/WebInputElement.h" 86 #include "third_party/WebKit/WebKit/chromium/public/WebInputElement.h"
87 #include "third_party/WebKit/WebKit/chromium/public/WebNode.h" 87 #include "third_party/WebKit/WebKit/chromium/public/WebNode.h"
88 #include "third_party/WebKit/WebKit/chromium/public/WebNodeList.h" 88 #include "third_party/WebKit/WebKit/chromium/public/WebNodeList.h"
89 #include "third_party/WebKit/WebKit/chromium/public/WebPageSerializer.h" 89 #include "third_party/WebKit/WebKit/chromium/public/WebPageSerializer.h"
90 #include "third_party/WebKit/WebKit/chromium/public/WebPlugin.h"
91 #include "third_party/WebKit/WebKit/chromium/public/WebPluginDocument.h"
90 #include "third_party/WebKit/WebKit/chromium/public/WebPoint.h" 92 #include "third_party/WebKit/WebKit/chromium/public/WebPoint.h"
91 #include "third_party/WebKit/WebKit/chromium/public/WebRange.h" 93 #include "third_party/WebKit/WebKit/chromium/public/WebRange.h"
92 #include "third_party/WebKit/WebKit/chromium/public/WebRect.h" 94 #include "third_party/WebKit/WebKit/chromium/public/WebRect.h"
93 #include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" 95 #include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h"
94 #include "third_party/WebKit/WebKit/chromium/public/WebSearchableFormData.h" 96 #include "third_party/WebKit/WebKit/chromium/public/WebSearchableFormData.h"
95 #include "third_party/WebKit/WebKit/chromium/public/WebSecurityOrigin.h" 97 #include "third_party/WebKit/WebKit/chromium/public/WebSecurityOrigin.h"
96 #include "third_party/WebKit/WebKit/chromium/public/WebSize.h" 98 #include "third_party/WebKit/WebKit/chromium/public/WebSize.h"
97 #include "third_party/WebKit/WebKit/chromium/public/WebStorageNamespace.h" 99 #include "third_party/WebKit/WebKit/chromium/public/WebStorageNamespace.h"
98 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" 100 #include "third_party/WebKit/WebKit/chromium/public/WebString.h"
99 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" 101 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h"
(...skipping 10 matching lines...) Expand all
110 #include "webkit/glue/image_decoder.h" 112 #include "webkit/glue/image_decoder.h"
111 #include "webkit/glue/media/buffered_data_source.h" 113 #include "webkit/glue/media/buffered_data_source.h"
112 #include "webkit/glue/media/simple_data_source.h" 114 #include "webkit/glue/media/simple_data_source.h"
113 #include "webkit/glue/password_form.h" 115 #include "webkit/glue/password_form.h"
114 #include "webkit/glue/plugins/plugin_list.h" 116 #include "webkit/glue/plugins/plugin_list.h"
115 #include "webkit/glue/plugins/webplugin_delegate_impl.h" 117 #include "webkit/glue/plugins/webplugin_delegate_impl.h"
116 #include "webkit/glue/media/video_renderer_impl.h" 118 #include "webkit/glue/media/video_renderer_impl.h"
117 #include "webkit/glue/webdropdata.h" 119 #include "webkit/glue/webdropdata.h"
118 #include "webkit/glue/webkit_glue.h" 120 #include "webkit/glue/webkit_glue.h"
119 #include "webkit/glue/webmediaplayer_impl.h" 121 #include "webkit/glue/webmediaplayer_impl.h"
122 #include "webkit/glue/webplugin_delegate.h"
120 #include "webkit/glue/webplugin_impl.h" 123 #include "webkit/glue/webplugin_impl.h"
121 124
122 #if defined(OS_WIN) 125 #if defined(OS_WIN)
123 // TODO(port): these files are currently Windows only because they concern: 126 // TODO(port): these files are currently Windows only because they concern:
124 // * theming 127 // * theming
125 #include "gfx/native_theme_win.h" 128 #include "gfx/native_theme_win.h"
126 #elif defined(USE_X11) 129 #elif defined(USE_X11)
127 #include "third_party/WebKit/WebKit/chromium/public/linux/WebRenderTheme.h" 130 #include "third_party/WebKit/WebKit/chromium/public/linux/WebRenderTheme.h"
128 #endif 131 #endif
129 132
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 using WebKit::WebMediaPlayer; 164 using WebKit::WebMediaPlayer;
162 using WebKit::WebMediaPlayerAction; 165 using WebKit::WebMediaPlayerAction;
163 using WebKit::WebMediaPlayerClient; 166 using WebKit::WebMediaPlayerClient;
164 using WebKit::WebNavigationPolicy; 167 using WebKit::WebNavigationPolicy;
165 using WebKit::WebNavigationType; 168 using WebKit::WebNavigationType;
166 using WebKit::WebNode; 169 using WebKit::WebNode;
167 using WebKit::WebPageSerializer; 170 using WebKit::WebPageSerializer;
168 using WebKit::WebPageSerializerClient; 171 using WebKit::WebPageSerializerClient;
169 using WebKit::WebPlugin; 172 using WebKit::WebPlugin;
170 using WebKit::WebPluginParams; 173 using WebKit::WebPluginParams;
174 using WebKit::WebPluginDocument;
171 using WebKit::WebPoint; 175 using WebKit::WebPoint;
172 using WebKit::WebPopupMenuInfo; 176 using WebKit::WebPopupMenuInfo;
173 using WebKit::WebRange; 177 using WebKit::WebRange;
174 using WebKit::WebRect; 178 using WebKit::WebRect;
175 using WebKit::WebScriptSource; 179 using WebKit::WebScriptSource;
176 using WebKit::WebSearchableFormData; 180 using WebKit::WebSearchableFormData;
177 using WebKit::WebSecurityOrigin; 181 using WebKit::WebSecurityOrigin;
178 using WebKit::WebSettings; 182 using WebKit::WebSettings;
179 using WebKit::WebSharedWorker; 183 using WebKit::WebSharedWorker;
180 using WebKit::WebSize; 184 using WebKit::WebSize;
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 504
501 IPC_BEGIN_MESSAGE_MAP(RenderView, message) 505 IPC_BEGIN_MESSAGE_MAP(RenderView, message)
502 IPC_MESSAGE_HANDLER(ViewMsg_CaptureThumbnail, SendThumbnail) 506 IPC_MESSAGE_HANDLER(ViewMsg_CaptureThumbnail, SendThumbnail)
503 IPC_MESSAGE_HANDLER(ViewMsg_CaptureSnapshot, SendSnapshot) 507 IPC_MESSAGE_HANDLER(ViewMsg_CaptureSnapshot, SendSnapshot)
504 IPC_MESSAGE_HANDLER(ViewMsg_PrintPages, OnPrintPages) 508 IPC_MESSAGE_HANDLER(ViewMsg_PrintPages, OnPrintPages)
505 IPC_MESSAGE_HANDLER(ViewMsg_PrintingDone, OnPrintingDone) 509 IPC_MESSAGE_HANDLER(ViewMsg_PrintingDone, OnPrintingDone)
506 IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate) 510 IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate)
507 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop) 511 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop)
508 IPC_MESSAGE_HANDLER(ViewMsg_ReloadFrame, OnReloadFrame) 512 IPC_MESSAGE_HANDLER(ViewMsg_ReloadFrame, OnReloadFrame)
509 IPC_MESSAGE_HANDLER(ViewMsg_LoadAlternateHTMLText, OnLoadAlternateHTMLText) 513 IPC_MESSAGE_HANDLER(ViewMsg_LoadAlternateHTMLText, OnLoadAlternateHTMLText)
510 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding)
511 IPC_MESSAGE_HANDLER(ViewMsg_Undo, OnUndo) 514 IPC_MESSAGE_HANDLER(ViewMsg_Undo, OnUndo)
512 IPC_MESSAGE_HANDLER(ViewMsg_Redo, OnRedo) 515 IPC_MESSAGE_HANDLER(ViewMsg_Redo, OnRedo)
513 IPC_MESSAGE_HANDLER(ViewMsg_Cut, OnCut) 516 IPC_MESSAGE_HANDLER(ViewMsg_Cut, OnCut)
514 IPC_MESSAGE_HANDLER(ViewMsg_Copy, OnCopy) 517 IPC_MESSAGE_HANDLER(ViewMsg_Copy, OnCopy)
515 #if defined(OS_MACOSX) 518 #if defined(OS_MACOSX)
516 IPC_MESSAGE_HANDLER(ViewMsg_CopyToFindPboard, OnCopyToFindPboard) 519 IPC_MESSAGE_HANDLER(ViewMsg_CopyToFindPboard, OnCopyToFindPboard)
517 #endif 520 #endif
518 IPC_MESSAGE_HANDLER(ViewMsg_Paste, OnPaste) 521 IPC_MESSAGE_HANDLER(ViewMsg_Paste, OnPaste)
519 IPC_MESSAGE_HANDLER(ViewMsg_Replace, OnReplace) 522 IPC_MESSAGE_HANDLER(ViewMsg_Replace, OnReplace)
520 IPC_MESSAGE_HANDLER(ViewMsg_ToggleSpellPanel, OnToggleSpellPanel) 523 IPC_MESSAGE_HANDLER(ViewMsg_ToggleSpellPanel, OnToggleSpellPanel)
521 IPC_MESSAGE_HANDLER(ViewMsg_AdvanceToNextMisspelling, 524 IPC_MESSAGE_HANDLER(ViewMsg_AdvanceToNextMisspelling,
522 OnAdvanceToNextMisspelling) 525 OnAdvanceToNextMisspelling)
523 IPC_MESSAGE_HANDLER(ViewMsg_ToggleSpellCheck, OnToggleSpellCheck) 526 IPC_MESSAGE_HANDLER(ViewMsg_ToggleSpellCheck, OnToggleSpellCheck)
524 IPC_MESSAGE_HANDLER(ViewMsg_Delete, OnDelete) 527 IPC_MESSAGE_HANDLER(ViewMsg_Delete, OnDelete)
525 IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll) 528 IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll)
526 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) 529 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt)
527 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteEditCommand, OnExecuteEditCommand) 530 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteEditCommand, OnExecuteEditCommand)
528 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) 531 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind)
532 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding)
533 IPC_MESSAGE_HANDLER(ViewMsg_FindReplyACK, OnFindReplyAck)
529 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) 534 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom)
530 IPC_MESSAGE_HANDLER(ViewMsg_SetContentSettingsForLoadingHost, 535 IPC_MESSAGE_HANDLER(ViewMsg_SetContentSettingsForLoadingHost,
531 OnSetContentSettingsForLoadingHost) 536 OnSetContentSettingsForLoadingHost)
532 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingHost, 537 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingHost,
533 OnSetZoomLevelForLoadingHost) 538 OnSetZoomLevelForLoadingHost)
534 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) 539 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding)
535 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, 540 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault,
536 OnResetPageEncodingToDefault) 541 OnResetPageEncodingToDefault)
537 IPC_MESSAGE_HANDLER(ViewMsg_SetupDevToolsClient, OnSetupDevToolsClient) 542 IPC_MESSAGE_HANDLER(ViewMsg_SetupDevToolsClient, OnSetupDevToolsClient)
538 IPC_MESSAGE_HANDLER(ViewMsg_DownloadFavIcon, OnDownloadFavIcon) 543 IPC_MESSAGE_HANDLER(ViewMsg_DownloadFavIcon, OnDownloadFavIcon)
539 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) 544 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest)
540 IPC_MESSAGE_HANDLER(ViewMsg_CSSInsertRequest, OnCSSInsertRequest) 545 IPC_MESSAGE_HANDLER(ViewMsg_CSSInsertRequest, OnCSSInsertRequest)
541 IPC_MESSAGE_HANDLER(ViewMsg_AddMessageToConsole, OnAddMessageToConsole) 546 IPC_MESSAGE_HANDLER(ViewMsg_AddMessageToConsole, OnAddMessageToConsole)
542 IPC_MESSAGE_HANDLER(ViewMsg_ReservePageIDRange, OnReservePageIDRange) 547 IPC_MESSAGE_HANDLER(ViewMsg_ReservePageIDRange, OnReservePageIDRange)
543 IPC_MESSAGE_HANDLER(ViewMsg_FillPasswordForm, OnFillPasswordForm) 548 IPC_MESSAGE_HANDLER(ViewMsg_FillPasswordForm, OnFillPasswordForm)
544 IPC_MESSAGE_HANDLER(ViewMsg_DragTargetDragEnter, OnDragTargetDragEnter) 549 IPC_MESSAGE_HANDLER(ViewMsg_DragTargetDragEnter, OnDragTargetDragEnter)
545 IPC_MESSAGE_HANDLER(ViewMsg_DragTargetDragOver, OnDragTargetDragOver) 550 IPC_MESSAGE_HANDLER(ViewMsg_DragTargetDragOver, OnDragTargetDragOver)
546 IPC_MESSAGE_HANDLER(ViewMsg_DragTargetDragLeave, OnDragTargetDragLeave) 551 IPC_MESSAGE_HANDLER(ViewMsg_DragTargetDragLeave, OnDragTargetDragLeave)
547 IPC_MESSAGE_HANDLER(ViewMsg_DragTargetDrop, OnDragTargetDrop) 552 IPC_MESSAGE_HANDLER(ViewMsg_DragTargetDrop, OnDragTargetDrop)
548 IPC_MESSAGE_HANDLER(ViewMsg_AllowBindings, OnAllowBindings) 553 IPC_MESSAGE_HANDLER(ViewMsg_AllowBindings, OnAllowBindings)
549 IPC_MESSAGE_HANDLER(ViewMsg_SetDOMUIProperty, OnSetDOMUIProperty) 554 IPC_MESSAGE_HANDLER(ViewMsg_SetDOMUIProperty, OnSetDOMUIProperty)
550 IPC_MESSAGE_HANDLER(ViewMsg_DragSourceEndedOrMoved, 555 IPC_MESSAGE_HANDLER(ViewMsg_DragSourceEndedOrMoved,
551 OnDragSourceEndedOrMoved) 556 OnDragSourceEndedOrMoved)
552 IPC_MESSAGE_HANDLER(ViewMsg_DragSourceSystemDragEnded, 557 IPC_MESSAGE_HANDLER(ViewMsg_DragSourceSystemDragEnded,
553 OnDragSourceSystemDragEnded) 558 OnDragSourceSystemDragEnded)
554 IPC_MESSAGE_HANDLER(ViewMsg_SetInitialFocus, OnSetInitialFocus) 559 IPC_MESSAGE_HANDLER(ViewMsg_SetInitialFocus, OnSetInitialFocus)
555 IPC_MESSAGE_HANDLER(ViewMsg_FindReplyACK, OnFindReplyAck)
556 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTargetURL_ACK, OnUpdateTargetURLAck) 560 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTargetURL_ACK, OnUpdateTargetURLAck)
557 IPC_MESSAGE_HANDLER(ViewMsg_UpdateWebPreferences, OnUpdateWebPreferences) 561 IPC_MESSAGE_HANDLER(ViewMsg_UpdateWebPreferences, OnUpdateWebPreferences)
558 IPC_MESSAGE_HANDLER(ViewMsg_SetAltErrorPageURL, OnSetAltErrorPageURL) 562 IPC_MESSAGE_HANDLER(ViewMsg_SetAltErrorPageURL, OnSetAltErrorPageURL)
559 IPC_MESSAGE_HANDLER(ViewMsg_InstallMissingPlugin, OnInstallMissingPlugin) 563 IPC_MESSAGE_HANDLER(ViewMsg_InstallMissingPlugin, OnInstallMissingPlugin)
560 IPC_MESSAGE_HANDLER(ViewMsg_RunFileChooserResponse, OnFileChooserResponse) 564 IPC_MESSAGE_HANDLER(ViewMsg_RunFileChooserResponse, OnFileChooserResponse)
561 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) 565 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode)
562 IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage, 566 IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage,
563 OnGetAllSavableResourceLinksForCurrentPage) 567 OnGetAllSavableResourceLinksForCurrentPage)
564 IPC_MESSAGE_HANDLER( 568 IPC_MESSAGE_HANDLER(
565 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, 569 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks,
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 989
986 webview()->focusedFrame()->executeCommand( 990 webview()->focusedFrame()->executeCommand(
987 WebString::fromUTF8(name), WebString::fromUTF8(value)); 991 WebString::fromUTF8(name), WebString::fromUTF8(value));
988 } 992 }
989 993
990 void RenderView::OnSetupDevToolsClient() { 994 void RenderView::OnSetupDevToolsClient() {
991 DCHECK(!devtools_client_.get()); 995 DCHECK(!devtools_client_.get());
992 devtools_client_.reset(new DevToolsClient(this)); 996 devtools_client_.reset(new DevToolsClient(this));
993 } 997 }
994 998
995 void RenderView::OnStopFinding(const ViewMsg_StopFinding_Params& params) {
996 WebView* view = webview();
997 if (!view)
998 return;
999
1000 bool clear_selection =
1001 params.action == ViewMsg_StopFinding_Params::kClearSelection;
1002 if (clear_selection)
1003 view->focusedFrame()->executeCommand(WebString::fromUTF8("Unselect"));
1004
1005 WebFrame* frame = view->mainFrame();
1006 while (frame) {
1007 frame->stopFinding(clear_selection);
1008 frame = frame->traverseNext(false);
1009 }
1010
1011 if (params.action == ViewMsg_StopFinding_Params::kActivateSelection) {
1012 WebFrame* focused_frame = view->focusedFrame();
1013 if (focused_frame) {
1014 WebDocument doc = focused_frame->document();
1015 if (!doc.isNull()) {
1016 WebNode node = doc.focusedNode();
1017 if (!node.isNull())
1018 node.simulateClick();
1019 }
1020 }
1021 }
1022 }
1023
1024 void RenderView::OnFindReplyAck() {
1025 // Check if there is any queued up request waiting to be sent.
1026 if (queued_find_reply_message_.get()) {
1027 // Send the search result over to the browser process.
1028 Send(queued_find_reply_message_.get());
1029 queued_find_reply_message_.release();
1030 }
1031 }
1032
1033 void RenderView::OnUpdateTargetURLAck() { 999 void RenderView::OnUpdateTargetURLAck() {
1034 // Check if there is a targeturl waiting to be sent. 1000 // Check if there is a targeturl waiting to be sent.
1035 if (target_url_status_ == TARGET_PENDING) { 1001 if (target_url_status_ == TARGET_PENDING) {
1036 Send(new ViewHostMsg_UpdateTargetURL(routing_id_, page_id_, 1002 Send(new ViewHostMsg_UpdateTargetURL(routing_id_, page_id_,
1037 pending_target_url_)); 1003 pending_target_url_));
1038 } 1004 }
1039 1005
1040 target_url_status_ = TARGET_NONE; 1006 target_url_status_ = TARGET_NONE;
1041 } 1007 }
1042 1008
(...skipping 1936 matching lines...) Expand 10 before | Expand all | Expand 10 after
2979 const WebRect& selection_rect) { 2945 const WebRect& selection_rect) {
2980 // Send the search result over to the browser process. 2946 // Send the search result over to the browser process.
2981 Send(new ViewHostMsg_Find_Reply(routing_id_, 2947 Send(new ViewHostMsg_Find_Reply(routing_id_,
2982 request_id, 2948 request_id,
2983 -1, 2949 -1,
2984 selection_rect, 2950 selection_rect,
2985 active_match_ordinal, 2951 active_match_ordinal,
2986 false)); 2952 false));
2987 } 2953 }
2988 2954
2955 void RenderView::ReportNoFindInPageResults(int request_id) {
2956 Send(new ViewHostMsg_Find_Reply(routing_id_,
2957 request_id,
2958 0,
2959 gfx::Rect(),
2960 0,
2961 true));
2962 }
2963
2989 // webkit_glue::WebPluginPageDelegate ----------------------------------------- 2964 // webkit_glue::WebPluginPageDelegate -----------------------------------------
2990 2965
2991 webkit_glue::WebPluginDelegate* RenderView::CreatePluginDelegate( 2966 webkit_glue::WebPluginDelegate* RenderView::CreatePluginDelegate(
2992 const GURL& url, 2967 const GURL& url,
2993 const std::string& mime_type, 2968 const std::string& mime_type,
2994 std::string* actual_mime_type) { 2969 std::string* actual_mime_type) {
2995 if (!PluginChannelHost::IsListening()) 2970 if (!PluginChannelHost::IsListening())
2996 return NULL; 2971 return NULL;
2997 2972
2998 GURL policy_url; 2973 GURL policy_url;
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
3245 NOTREACHED() << "unknown ErrorPageType"; 3220 NOTREACHED() << "unknown ErrorPageType";
3246 } 3221 }
3247 3222
3248 // OK, build the final url to return. 3223 // OK, build the final url to return.
3249 GURL::Replacements link_doctor_params; 3224 GURL::Replacements link_doctor_params;
3250 link_doctor_params.SetQueryStr(params); 3225 link_doctor_params.SetQueryStr(params);
3251 GURL url = alternate_error_page_url_.ReplaceComponents(link_doctor_params); 3226 GURL url = alternate_error_page_url_.ReplaceComponents(link_doctor_params);
3252 return url; 3227 return url;
3253 } 3228 }
3254 3229
3230 webkit_glue::WebPluginDelegate* RenderView::GetDelegateForPluginDocument() {
3231 WebPlugin* plugin = webview()->mainFrame()->document().
3232 toElement<WebPluginDocument>().plugin();
3233 return static_cast<webkit_glue::WebPluginImpl*>(plugin)->delegate();
3234 }
3235
3255 void RenderView::OnFind(int request_id, const string16& search_text, 3236 void RenderView::OnFind(int request_id, const string16& search_text,
3256 const WebFindOptions& options) { 3237 const WebFindOptions& options) {
3257 WebFrame* main_frame = webview()->mainFrame(); 3238 WebFrame* main_frame = webview()->mainFrame();
3239
3240 if (main_frame->document().isPluginDocument()) {
3241 webkit_glue::WebPluginDelegate* delegate = GetDelegateForPluginDocument();
3242 if (options.findNext) {
3243 // Just navigate back/forward.
3244 delegate->SelectFindResult(options.forward);
3245 } else {
3246 if (delegate->SupportsFind()) {
3247 delegate->StartFind(UTF16ToUTF8(search_text),
3248 options.matchCase,
3249 request_id);
3250 } else {
3251 ReportNoFindInPageResults(request_id);
3252 }
3253 }
3254 return;
3255 }
3256
3258 WebFrame* frame_after_main = main_frame->traverseNext(true); 3257 WebFrame* frame_after_main = main_frame->traverseNext(true);
3259 WebFrame* focused_frame = webview()->focusedFrame(); 3258 WebFrame* focused_frame = webview()->focusedFrame();
3260 WebFrame* search_frame = focused_frame; // start searching focused frame. 3259 WebFrame* search_frame = focused_frame; // start searching focused frame.
3261 3260
3262 bool multi_frame = (frame_after_main != main_frame); 3261 bool multi_frame = (frame_after_main != main_frame);
3263 3262
3264 // If we have multiple frames, we don't want to wrap the search within the 3263 // If we have multiple frames, we don't want to wrap the search within the
3265 // frame, so we check here if we only have main_frame in the chain. 3264 // frame, so we check here if we only have main_frame in the chain.
3266 bool wrap_within_frame = !multi_frame; 3265 bool wrap_within_frame = !multi_frame;
3267 3266
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
3350 true); // reset the tickmarks 3349 true); // reset the tickmarks
3351 } 3350 }
3352 3351
3353 // Iterate to the next frame. The frame will not necessarily scope, for 3352 // Iterate to the next frame. The frame will not necessarily scope, for
3354 // example if it is not visible. 3353 // example if it is not visible.
3355 search_frame = search_frame->traverseNext(true); 3354 search_frame = search_frame->traverseNext(true);
3356 } while (search_frame != main_frame); 3355 } while (search_frame != main_frame);
3357 } 3356 }
3358 } 3357 }
3359 3358
3359 void RenderView::OnStopFinding(const ViewMsg_StopFinding_Params& params) {
3360 WebView* view = webview();
3361 if (!view)
3362 return;
3363
3364 WebDocument doc = view->mainFrame()->document();
3365 if (doc.isPluginDocument()) {
3366 GetDelegateForPluginDocument()->StopFind();
3367 return;
3368 }
3369
3370 bool clear_selection =
3371 params.action == ViewMsg_StopFinding_Params::kClearSelection;
3372 if (clear_selection)
3373 view->focusedFrame()->executeCommand(WebString::fromUTF8("Unselect"));
3374
3375 WebFrame* frame = view->mainFrame();
3376 while (frame) {
3377 frame->stopFinding(clear_selection);
3378 frame = frame->traverseNext(false);
3379 }
3380
3381 if (params.action == ViewMsg_StopFinding_Params::kActivateSelection) {
3382 WebFrame* focused_frame = view->focusedFrame();
3383 if (focused_frame) {
3384 WebDocument doc = focused_frame->document();
3385 if (!doc.isNull()) {
3386 WebNode node = doc.focusedNode();
3387 if (!node.isNull())
3388 node.simulateClick();
3389 }
3390 }
3391 }
3392 }
3393
3394 void RenderView::OnFindReplyAck() {
3395 // Check if there is any queued up request waiting to be sent.
3396 if (queued_find_reply_message_.get()) {
3397 // Send the search result over to the browser process.
3398 Send(queued_find_reply_message_.get());
3399 queued_find_reply_message_.release();
3400 }
3401 }
3402
3360 // static 3403 // static
3361 std::string RenderView::DetermineTextLanguage(const std::wstring& text) { 3404 std::string RenderView::DetermineTextLanguage(const std::wstring& text) {
3362 // Text with less than 100 bytes will probably not provide good results. 3405 // Text with less than 100 bytes will probably not provide good results.
3363 // Report it as unknown language. 3406 // Report it as unknown language.
3364 if (text.length() < 100) 3407 if (text.length() < 100)
3365 return kUnknownLanguageCode; 3408 return kUnknownLanguageCode;
3366 3409
3367 std::string language = kUnknownLanguageCode; 3410 std::string language = kUnknownLanguageCode;
3368 int num_languages = 0; 3411 int num_languages = 0;
3369 bool is_reliable = false; 3412 bool is_reliable = false;
(...skipping 1372 matching lines...) Expand 10 before | Expand all | Expand 10 after
4742 gfx::PluginWindowHandle window) { 4785 gfx::PluginWindowHandle window) {
4743 Send(new ViewHostMsg_AcceleratedSurfaceBuffersSwapped(routing_id(), window)); 4786 Send(new ViewHostMsg_AcceleratedSurfaceBuffersSwapped(routing_id(), window));
4744 } 4787 }
4745 #endif 4788 #endif
4746 4789
4747 WebKit::WebGeolocationServiceInterface* RenderView::getGeolocationService() { 4790 WebKit::WebGeolocationServiceInterface* RenderView::getGeolocationService() {
4748 if (!geolocation_dispatcher_.get()) 4791 if (!geolocation_dispatcher_.get())
4749 geolocation_dispatcher_.reset(new GeolocationDispatcher(this)); 4792 geolocation_dispatcher_.reset(new GeolocationDispatcher(this));
4750 return geolocation_dispatcher_.get(); 4793 return geolocation_dispatcher_.get();
4751 } 4794 }
OLDNEW
« no previous file with comments | « chrome/renderer/render_view.h ('k') | chrome/renderer/webplugin_delegate_pepper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698