OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1453 IPC_MESSAGE_HANDLER(FrameMsg_SetTextTrackSettings, | 1453 IPC_MESSAGE_HANDLER(FrameMsg_SetTextTrackSettings, |
1454 OnTextTrackSettingsChanged) | 1454 OnTextTrackSettingsChanged) |
1455 IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent) | 1455 IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent) |
1456 IPC_MESSAGE_HANDLER(FrameMsg_FailedNavigation, OnFailedNavigation) | 1456 IPC_MESSAGE_HANDLER(FrameMsg_FailedNavigation, OnFailedNavigation) |
1457 IPC_MESSAGE_HANDLER(FrameMsg_GetSavableResourceLinks, | 1457 IPC_MESSAGE_HANDLER(FrameMsg_GetSavableResourceLinks, |
1458 OnGetSavableResourceLinks) | 1458 OnGetSavableResourceLinks) |
1459 IPC_MESSAGE_HANDLER(FrameMsg_GetSerializedHtmlWithLocalLinks, | 1459 IPC_MESSAGE_HANDLER(FrameMsg_GetSerializedHtmlWithLocalLinks, |
1460 OnGetSerializedHtmlWithLocalLinks) | 1460 OnGetSerializedHtmlWithLocalLinks) |
1461 IPC_MESSAGE_HANDLER(FrameMsg_SerializeAsMHTML, OnSerializeAsMHTML) | 1461 IPC_MESSAGE_HANDLER(FrameMsg_SerializeAsMHTML, OnSerializeAsMHTML) |
1462 IPC_MESSAGE_HANDLER(FrameMsg_Find, OnFind) | 1462 IPC_MESSAGE_HANDLER(FrameMsg_Find, OnFind) |
1463 IPC_MESSAGE_HANDLER(FrameMsg_ClearActiveFindMatch, OnClearActiveFindMatch) | |
1463 IPC_MESSAGE_HANDLER(FrameMsg_StopFinding, OnStopFinding) | 1464 IPC_MESSAGE_HANDLER(FrameMsg_StopFinding, OnStopFinding) |
1464 IPC_MESSAGE_HANDLER(FrameMsg_EnableViewSourceMode, OnEnableViewSourceMode) | 1465 IPC_MESSAGE_HANDLER(FrameMsg_EnableViewSourceMode, OnEnableViewSourceMode) |
1465 IPC_MESSAGE_HANDLER(FrameMsg_SuppressFurtherDialogs, | 1466 IPC_MESSAGE_HANDLER(FrameMsg_SuppressFurtherDialogs, |
1466 OnSuppressFurtherDialogs) | 1467 OnSuppressFurtherDialogs) |
1467 #if defined(OS_ANDROID) | 1468 #if defined(OS_ANDROID) |
1468 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult, | 1469 IPC_MESSAGE_HANDLER(FrameMsg_ActivateNearestFindResult, |
1469 OnActivateNearestFindResult) | 1470 OnActivateNearestFindResult) |
1471 IPC_MESSAGE_HANDLER(FrameMsg_GetNearestFindResult, | |
1472 OnGetNearestFindResult) | |
1470 IPC_MESSAGE_HANDLER(FrameMsg_FindMatchRects, OnFindMatchRects) | 1473 IPC_MESSAGE_HANDLER(FrameMsg_FindMatchRects, OnFindMatchRects) |
1471 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) | 1474 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) |
1472 #elif defined(OS_MACOSX) | 1475 #elif defined(OS_MACOSX) |
1473 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) | 1476 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) |
1474 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) | 1477 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) |
1475 #endif | 1478 #endif |
1476 IPC_END_MESSAGE_MAP() | 1479 IPC_END_MESSAGE_MAP() |
1477 | 1480 |
1478 return handled; | 1481 return handled; |
1479 } | 1482 } |
(...skipping 2585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4065 DCHECK(!frame_ || frame_ == frame); | 4068 DCHECK(!frame_ || frame_ == frame); |
4066 if (!frame->parent()) { | 4069 if (!frame->parent()) { |
4067 render_view_->Send(new ViewHostMsg_WillInsertBody( | 4070 render_view_->Send(new ViewHostMsg_WillInsertBody( |
4068 render_view_->GetRoutingID())); | 4071 render_view_->GetRoutingID())); |
4069 } | 4072 } |
4070 } | 4073 } |
4071 | 4074 |
4072 void RenderFrameImpl::reportFindInPageMatchCount(int request_id, | 4075 void RenderFrameImpl::reportFindInPageMatchCount(int request_id, |
4073 int count, | 4076 int count, |
4074 bool final_update) { | 4077 bool final_update) { |
4075 int active_match_ordinal = -1; // -1 = don't update active match ordinal | 4078 // -1 here means don't update the active match ordinal. |
4076 if (!count) | 4079 int active_match_ordinal = count ? -1 : 0; |
4077 active_match_ordinal = 0; | |
4078 | 4080 |
4079 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, count, gfx::Rect(), | 4081 SendFindReply(request_id, count, active_match_ordinal, gfx::Rect(), |
4080 active_match_ordinal, final_update)); | 4082 final_update); |
4081 } | 4083 } |
4082 | 4084 |
4083 void RenderFrameImpl::reportFindInPageSelection( | 4085 void RenderFrameImpl::reportFindInPageSelection( |
4084 int request_id, | 4086 int request_id, |
4085 int active_match_ordinal, | 4087 int active_match_ordinal, |
4086 const blink::WebRect& selection_rect) { | 4088 const blink::WebRect& selection_rect) { |
4087 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, -1, selection_rect, | 4089 SendFindReply(request_id, -1 /* match_count */, active_match_ordinal, |
4088 active_match_ordinal, false)); | 4090 selection_rect, false /* final_status_update */); |
4089 } | 4091 } |
4090 | 4092 |
4091 void RenderFrameImpl::requestStorageQuota( | 4093 void RenderFrameImpl::requestStorageQuota( |
4092 blink::WebStorageQuotaType type, | 4094 blink::WebStorageQuotaType type, |
4093 unsigned long long requested_size, | 4095 unsigned long long requested_size, |
4094 blink::WebStorageQuotaCallbacks callbacks) { | 4096 blink::WebStorageQuotaCallbacks callbacks) { |
4095 WebSecurityOrigin origin = frame_->document().getSecurityOrigin(); | 4097 WebSecurityOrigin origin = frame_->document().getSecurityOrigin(); |
4096 if (origin.isUnique()) { | 4098 if (origin.isUnique()) { |
4097 // Unique origins cannot store persistent state. | 4099 // Unique origins cannot store persistent state. |
4098 callbacks.didFail(blink::WebStorageQuotaErrorAbort); | 4100 callbacks.didFail(blink::WebStorageQuotaErrorAbort); |
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4994 // Cleanup and notify the browser process about completion. | 4996 // Cleanup and notify the browser process about completion. |
4995 file.Close(); // Need to flush file contents before sending IPC response. | 4997 file.Close(); // Need to flush file contents before sending IPC response. |
4996 Send(new FrameHostMsg_SerializeAsMHTMLResponse( | 4998 Send(new FrameHostMsg_SerializeAsMHTMLResponse( |
4997 routing_id_, params.job_id, success, | 4999 routing_id_, params.job_id, success, |
4998 digests_of_uris_of_serialized_resources)); | 5000 digests_of_uris_of_serialized_resources)); |
4999 } | 5001 } |
5000 | 5002 |
5001 void RenderFrameImpl::OnFind(int request_id, | 5003 void RenderFrameImpl::OnFind(int request_id, |
5002 const base::string16& search_text, | 5004 const base::string16& search_text, |
5003 const WebFindOptions& options) { | 5005 const WebFindOptions& options) { |
5004 // This should only be received on the main frame, since find-in-page is | |
5005 // currently orchestrated by the main frame. | |
5006 if (!is_main_frame_) { | |
5007 NOTREACHED(); | |
5008 return; | |
5009 } | |
5010 | |
5011 DCHECK(!search_text.empty()); | 5006 DCHECK(!search_text.empty()); |
5012 | 5007 |
5013 blink::WebPlugin* plugin = GetWebPluginForFind(); | 5008 blink::WebPlugin* plugin = GetWebPluginForFind(); |
5014 // Check if the plugin still exists in the document. | 5009 // Check if the plugin still exists in the document. |
5015 if (plugin) { | 5010 if (plugin) { |
5016 if (options.findNext) { | 5011 if (options.findNext) { |
5017 // Just navigate back/forward. | 5012 // Just navigate back/forward. |
5018 plugin->selectFindResult(options.forward); | 5013 plugin->selectFindResult(options.forward); |
5019 } else { | 5014 } else { |
5020 if (!plugin->startFind(search_text, options.matchCase, request_id)) { | 5015 if (!plugin->startFind(search_text, options.matchCase, request_id)) { |
5021 // Send "no results". | 5016 // Send "no results". |
5022 SendFindReply(request_id, 0, 0, gfx::Rect(), true); | 5017 SendFindReply(request_id, 0 /* match_count */, 0 /* ordinal */, |
5018 gfx::Rect(), true /* final_status_update */ ); | |
5023 } | 5019 } |
5024 } | 5020 } |
5025 return; | 5021 return; |
5026 } | 5022 } |
5027 | 5023 |
5028 WebLocalFrame* main_frame = GetWebFrame(); | 5024 // Send "no results" if this frame has no visible content. |
5029 WebLocalFrame* focused_frame = | 5025 if (!frame_->hasVisibleContent()) { |
5030 render_view_->webview()->focusedFrame()->toWebLocalFrame(); | 5026 SendFindReply(request_id, 0 /* match_count */, 0 /* ordinal */, |
5031 // Start searching in the focused frame. | 5027 gfx::Rect(), true /* final_status_update */ ); |
5032 WebLocalFrame* search_frame = focused_frame; | 5028 return; |
5033 | 5029 } |
5034 // Check for multiple searchable frames. | |
5035 bool multi_frame = (main_frame->traverseNextLocal(true) != main_frame); | |
5036 | |
5037 // If we have multiple frames, we don't want to wrap the search within the | |
5038 // frame, so we check here if we only have |main_frame| in the chain. | |
5039 bool wrap_within_frame = !multi_frame; | |
5040 | 5030 |
5041 WebRect selection_rect; | 5031 WebRect selection_rect; |
5042 bool result = false; | |
5043 bool active_now = false; | 5032 bool active_now = false; |
5044 | 5033 |
5045 // If something is selected when we start searching it means we cannot just | 5034 // If something is selected when we start searching it means we cannot just |
5046 // increment the current match ordinal; we need to re-generate it. | 5035 // increment the current match ordinal; we need to re-generate it. |
5047 WebRange current_selection = focused_frame->selectionRange(); | 5036 WebRange current_selection = frame_->selectionRange(); |
5048 | 5037 |
5049 do { | 5038 // Search for an active match only if this frame is focused or if this is a |
5050 result = | 5039 // find next request. |
5051 search_frame->find(request_id, search_text, options, wrap_within_frame, | 5040 if (frame_->isFocused() || options.findNext) { |
dcheng
2016/05/14 00:03:44
I think we can just use WebView::focusedFrame() ==
paulmeyer
2016/05/16 15:25:11
Actually, that wouldn't work. I tried that at some
dcheng
2016/05/16 17:11:02
It's confusing to have isFocused() and focusedFram
paulmeyer
2016/05/16 17:21:10
Blink could do the check, but what you put here is
dcheng
2016/05/16 17:31:37
OK, in that case, we don't need the conditionals a
paulmeyer
2016/05/16 19:27:49
I could move all of this to Blink, but it still wo
dcheng
2016/05/16 20:04:21
I don't think it should be needed in OnStopFinding
paulmeyer
2016/05/17 20:40:46
Following our offline discussion, I've made WebLoc
dcheng
2016/05/17 21:07:55
Why would it happen? Doesn't that indicate a bug i
paulmeyer
2016/05/17 22:14:35
No, not a bug. Not sure if there are other example
dcheng
2016/05/17 23:58:45
Hmm. OK.
paulmeyer
2016/05/18 14:10:46
find() could call that, but that would still resul
dcheng
2016/05/18 17:43:07
Are you willing to commit to fixing this up in a f
paulmeyer
2016/05/18 19:26:14
Yeah, I could work on cleaning this up a bit in a
| |
5052 &selection_rect, &active_now); | 5041 bool result = frame_->find(request_id, search_text, options, |
5053 | 5042 false /* wrapWithinFrame */, &selection_rect, |
5054 if (!result) { | 5043 &active_now); |
5055 // Don't leave text selected as you move to the next frame. | 5044 if (result) { |
5056 search_frame->executeCommand(WebString::fromUTF8("Unselect"), | 5045 // Indicate that at least one match has been found. 1 here means possibly |
5057 GetFocusedElement()); | 5046 // more matches could be coming. -1 here means that the exact active match |
5058 | 5047 // ordinal is not yet known. |
5059 // Find the next frame, but skip the invisible ones. | 5048 SendFindReply(request_id, 1 /* match_count */, -1 /* ordinal */, |
5060 do { | 5049 gfx::Rect(), false /* final_status_update */ ); |
5061 // What is the next frame to search (we might be going backwards)? Note | |
5062 // that we specify wrap=true so that search_frame never becomes NULL. | |
5063 search_frame = options.forward | |
5064 ? search_frame->traverseNextLocal(true) | |
5065 : search_frame->traversePreviousLocal(true); | |
5066 } while (!search_frame->hasVisibleContent() && | |
5067 search_frame != focused_frame); | |
5068 | |
5069 // Make sure selection doesn't affect the search operation in new frame. | |
5070 search_frame->executeCommand(WebString::fromUTF8("Unselect"), | |
5071 GetFocusedElement()); | |
5072 | |
5073 // If we have multiple frames and we have wrapped back around to the | |
5074 // focused frame, we need to search it once more allowing wrap within | |
5075 // the frame, otherwise it will report 'no match' if the focused frame has | |
5076 // reported matches, but no frames after the focused_frame contain a | |
5077 // match for the search word(s). | |
5078 if (multi_frame && search_frame == focused_frame) { | |
5079 result = search_frame->find(request_id, search_text, options, | |
5080 true, // Force wrapping. | |
5081 &selection_rect, &active_now); | |
5082 } | |
5083 } | 5050 } |
5084 | 5051 } |
5085 render_view_->webview()->setFocusedFrame(search_frame); | |
5086 } while (!result && search_frame != focused_frame); | |
5087 | 5052 |
5088 if (options.findNext && current_selection.isNull() && active_now) { | 5053 if (options.findNext && current_selection.isNull() && active_now) { |
5089 // Force the main_frame to report the actual count. | 5054 // Force report of the actual count. |
5090 main_frame->increaseMatchCount(0, request_id); | 5055 frame_->increaseMatchCount(0, request_id); |
5091 } else { | 5056 return; |
5092 // If nothing is found, set result to "0 of 0", otherwise, set it to | 5057 } |
5093 // "-1 of 1" to indicate that we found at least one item, but we don't know | |
5094 // yet what is active. | |
5095 int ordinal = result ? -1 : 0; // -1 here means we might know more later. | |
5096 int match_count = result ? 1 : 0; // 1 here means possibly more coming. | |
5097 | 5058 |
5098 // If we find no matches then this will be our last status update. | 5059 // Scoping effort begins. |
5099 // Otherwise the scoping effort will send more results. | 5060 frame_->resetMatchCount(); |
5100 bool final_status_update = !result; | |
5101 | 5061 |
5102 SendFindReply(request_id, match_count, ordinal, selection_rect, | 5062 // Cancel all old scoping requests before starting a new one. |
5103 final_status_update); | 5063 frame_->cancelPendingScopingEffort(); |
5104 | 5064 |
5105 // Scoping effort begins, starting with the main frame. | 5065 // Start new scoping request. If the scoping function determines that it |
5106 search_frame = main_frame; | 5066 // needs to scope, it will defer until later. |
5067 frame_->scopeStringMatches(request_id, | |
5068 search_text, | |
5069 options, | |
5070 true); // reset the tickmarks | |
5071 } | |
5107 | 5072 |
5108 main_frame->resetMatchCount(); | 5073 void RenderFrameImpl::OnClearActiveFindMatch() { |
5109 | 5074 frame_->executeCommand(WebString::fromUTF8("Unselect"), |
5110 do { | 5075 GetFocusedElement()); |
5111 // Cancel all old scoping requests before starting a new one. | 5076 frame_->clearActiveFindMatch(); |
5112 search_frame->cancelPendingScopingEffort(); | |
5113 | |
5114 // We don't start another scoping effort unless at least one match has | |
5115 // been found. | |
5116 if (result) { | |
5117 // Start new scoping request. If the scoping function determines that it | |
5118 // needs to scope, it will defer until later. | |
5119 search_frame->scopeStringMatches(request_id, search_text, options, | |
5120 true); // reset the tickmarks | |
5121 } | |
5122 | |
5123 // Iterate to the next frame. The frame will not necessarily scope, for | |
5124 // example if it is not visible. | |
5125 search_frame = search_frame->traverseNextLocal(true); | |
5126 } while (search_frame != main_frame); | |
5127 } | |
5128 } | 5077 } |
5129 | 5078 |
5130 void RenderFrameImpl::OnStopFinding(StopFindAction action) { | 5079 void RenderFrameImpl::OnStopFinding(StopFindAction action) { |
5131 // This should only be received on the main frame, since find-in-page is | |
5132 // currently orchestrated by the main frame. | |
5133 if (!is_main_frame_) { | |
5134 NOTREACHED(); | |
5135 return; | |
5136 } | |
5137 | |
5138 WebView* view = render_view_->webview(); | |
5139 if (!view) | |
5140 return; | |
5141 | |
5142 blink::WebPlugin* plugin = GetWebPluginForFind(); | 5080 blink::WebPlugin* plugin = GetWebPluginForFind(); |
5143 if (plugin) { | 5081 if (plugin) { |
5144 plugin->stopFind(); | 5082 plugin->stopFind(); |
5145 return; | 5083 return; |
5146 } | 5084 } |
5147 | 5085 |
5148 bool clear_selection = action == STOP_FIND_ACTION_CLEAR_SELECTION; | 5086 bool clear_selection = action == STOP_FIND_ACTION_CLEAR_SELECTION; |
5149 if (clear_selection) { | 5087 if (clear_selection) { |
5150 view->focusedFrame()->executeCommand(WebString::fromUTF8("Unselect"), | 5088 frame_->executeCommand(WebString::fromUTF8("Unselect"), |
5151 GetFocusedElement()); | 5089 GetFocusedElement()); |
5152 } | 5090 } |
5153 | 5091 |
5154 WebLocalFrame* frame = GetWebFrame(); | 5092 frame_->stopFinding(clear_selection); |
5155 while (frame) { | |
5156 frame->stopFinding(clear_selection); | |
5157 frame = frame->traverseNextLocal(false); | |
5158 } | |
5159 | 5093 |
5160 if (action == STOP_FIND_ACTION_ACTIVATE_SELECTION) { | 5094 if (action == STOP_FIND_ACTION_ACTIVATE_SELECTION && frame_->isFocused()) { |
5161 WebFrame* focused_frame = view->focusedFrame(); | 5095 WebDocument doc = frame_->document(); |
5162 if (focused_frame) { | 5096 if (!doc.isNull()) { |
5163 WebDocument doc = focused_frame->document(); | 5097 WebElement element = doc.focusedElement(); |
5164 if (!doc.isNull()) { | 5098 if (!element.isNull()) |
5165 WebElement element = doc.focusedElement(); | 5099 element.simulateClick(); |
5166 if (!element.isNull()) | |
5167 element.simulateClick(); | |
5168 } | |
5169 } | 5100 } |
5170 } | 5101 } |
5171 } | 5102 } |
5172 | 5103 |
5173 void RenderFrameImpl::OnEnableViewSourceMode() { | 5104 void RenderFrameImpl::OnEnableViewSourceMode() { |
5174 DCHECK(frame_); | 5105 DCHECK(frame_); |
5175 DCHECK(!frame_->parent()); | 5106 DCHECK(!frame_->parent()); |
5176 frame_->enableViewSourceMode(true); | 5107 frame_->enableViewSourceMode(true); |
5177 } | 5108 } |
5178 | 5109 |
(...skipping 13 matching lines...) Expand all Loading... | |
5192 // the current match count) in case the host is waiting for a response due | 5123 // the current match count) in case the host is waiting for a response due |
5193 // to rate-limiting. | 5124 // to rate-limiting. |
5194 frame_->increaseMatchCount(0, request_id); | 5125 frame_->increaseMatchCount(0, request_id); |
5195 return; | 5126 return; |
5196 } | 5127 } |
5197 | 5128 |
5198 SendFindReply(request_id, -1 /* number_of_matches */, ordinal, selection_rect, | 5129 SendFindReply(request_id, -1 /* number_of_matches */, ordinal, selection_rect, |
5199 true /* final_update */); | 5130 true /* final_update */); |
5200 } | 5131 } |
5201 | 5132 |
5133 void RenderFrameImpl::OnGetNearestFindResult(int nfr_request_id, | |
5134 float x, | |
5135 float y) { | |
5136 float distance = frame_->nearestFindMatch(WebFloatPoint(x, y)); | |
5137 Send(new FrameHostMsg_GetNearestFindResult_Reply( | |
5138 routing_id_, nfr_request_id, distance)); | |
5139 } | |
5140 | |
5202 void RenderFrameImpl::OnFindMatchRects(int current_version) { | 5141 void RenderFrameImpl::OnFindMatchRects(int current_version) { |
5203 std::vector<gfx::RectF> match_rects; | 5142 std::vector<gfx::RectF> match_rects; |
5204 | 5143 |
5205 int rects_version = frame_->findMatchMarkersVersion(); | 5144 int rects_version = frame_->findMatchMarkersVersion(); |
5206 if (current_version != rects_version) { | 5145 if (current_version != rects_version) { |
5207 WebVector<WebFloatRect> web_match_rects; | 5146 WebVector<WebFloatRect> web_match_rects; |
5208 frame_->findMatchRects(web_match_rects); | 5147 frame_->findMatchRects(web_match_rects); |
5209 match_rects.reserve(web_match_rects.size()); | 5148 match_rects.reserve(web_match_rects.size()); |
5210 for (size_t i = 0; i < web_match_rects.size(); ++i) | 5149 for (size_t i = 0; i < web_match_rects.size(); ++i) |
5211 match_rects.push_back(gfx::RectF(web_match_rects[i])); | 5150 match_rects.push_back(gfx::RectF(web_match_rects[i])); |
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6061 callback.Run(AudioDeviceFactory::GetOutputDeviceInfo( | 6000 callback.Run(AudioDeviceFactory::GetOutputDeviceInfo( |
6062 routing_id_, 0, sink_id.utf8(), security_origin) | 6001 routing_id_, 0, sink_id.utf8(), security_origin) |
6063 .device_status()); | 6002 .device_status()); |
6064 } | 6003 } |
6065 | 6004 |
6066 blink::ServiceRegistry* RenderFrameImpl::serviceRegistry() { | 6005 blink::ServiceRegistry* RenderFrameImpl::serviceRegistry() { |
6067 return &blink_service_registry_; | 6006 return &blink_service_registry_; |
6068 } | 6007 } |
6069 | 6008 |
6070 blink::WebPlugin* RenderFrameImpl::GetWebPluginForFind() { | 6009 blink::WebPlugin* RenderFrameImpl::GetWebPluginForFind() { |
6071 if (!is_main_frame_) | |
6072 return nullptr; | |
6073 | |
6074 if (frame_->document().isPluginDocument()) | 6010 if (frame_->document().isPluginDocument()) |
6075 return frame_->document().to<WebPluginDocument>().plugin(); | 6011 return frame_->document().to<WebPluginDocument>().plugin(); |
6076 | 6012 |
6077 #if defined(ENABLE_PLUGINS) | 6013 #if defined(ENABLE_PLUGINS) |
6078 if (plugin_find_handler_) | 6014 if (plugin_find_handler_) |
6079 return plugin_find_handler_->container()->plugin(); | 6015 return plugin_find_handler_->container()->plugin(); |
6080 #endif | 6016 #endif |
6081 | 6017 |
6082 return nullptr; | 6018 return nullptr; |
6083 } | 6019 } |
6084 | 6020 |
6085 void RenderFrameImpl::SendFindReply(int request_id, | 6021 void RenderFrameImpl::SendFindReply(int request_id, |
6086 int match_count, | 6022 int match_count, |
6087 int ordinal, | 6023 int ordinal, |
6088 const WebRect& selection_rect, | 6024 const WebRect& selection_rect, |
6089 bool final_status_update) { | 6025 bool final_status_update) { |
6090 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, | 6026 if (final_status_update && !ordinal) { |
6091 selection_rect, ordinal, | 6027 frame_->executeCommand(WebString::fromUTF8("Unselect"), |
6028 GetFocusedElement()); | |
6029 } | |
6030 DCHECK(ordinal >= -1); | |
6031 | |
6032 Send(new FrameHostMsg_Find_Reply(routing_id_, | |
6033 request_id, | |
6034 match_count, | |
6035 selection_rect, | |
6036 ordinal, | |
6092 final_status_update)); | 6037 final_status_update)); |
6093 } | 6038 } |
6094 | 6039 |
6095 #if defined(ENABLE_PLUGINS) | 6040 #if defined(ENABLE_PLUGINS) |
6096 void RenderFrameImpl::PepperInstanceCreated( | 6041 void RenderFrameImpl::PepperInstanceCreated( |
6097 PepperPluginInstanceImpl* instance) { | 6042 PepperPluginInstanceImpl* instance) { |
6098 active_pepper_instances_.insert(instance); | 6043 active_pepper_instances_.insert(instance); |
6099 | 6044 |
6100 Send(new FrameHostMsg_PepperInstanceCreated(routing_id_)); | 6045 Send(new FrameHostMsg_PepperInstanceCreated(routing_id_)); |
6101 } | 6046 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6144 // event target. Potentially a Pepper plugin will receive the event. | 6089 // event target. Potentially a Pepper plugin will receive the event. |
6145 // In order to tell whether a plugin gets the last mouse event and which it | 6090 // In order to tell whether a plugin gets the last mouse event and which it |
6146 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6091 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
6147 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6092 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
6148 // |pepper_last_mouse_event_target_|. | 6093 // |pepper_last_mouse_event_target_|. |
6149 pepper_last_mouse_event_target_ = nullptr; | 6094 pepper_last_mouse_event_target_ = nullptr; |
6150 #endif | 6095 #endif |
6151 } | 6096 } |
6152 | 6097 |
6153 } // namespace content | 6098 } // namespace content |
OLD | NEW |