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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
292 using blink::WebVector; | 292 using blink::WebVector; |
293 using blink::WebView; | 293 using blink::WebView; |
294 using base::Time; | 294 using base::Time; |
295 using base::TimeDelta; | 295 using base::TimeDelta; |
296 | 296 |
297 #if defined(OS_ANDROID) | 297 #if defined(OS_ANDROID) |
298 using blink::WebFloatPoint; | 298 using blink::WebFloatPoint; |
299 using blink::WebFloatRect; | 299 using blink::WebFloatRect; |
300 #endif | 300 #endif |
301 | 301 |
302 #define STATIC_ASSERT_ENUM(a, b) \ | |
303 static_assert(static_cast<int>(a) == static_cast<int>(b), \ | |
304 "mismatching enums: " #a) | |
305 | |
302 namespace content { | 306 namespace content { |
303 | 307 |
304 namespace { | 308 namespace { |
305 | 309 |
306 const size_t kExtraCharsBeforeAndAfterSelection = 100; | 310 const size_t kExtraCharsBeforeAndAfterSelection = 100; |
307 | 311 |
308 typedef std::map<int, RenderFrameImpl*> RoutingIDFrameMap; | 312 typedef std::map<int, RenderFrameImpl*> RoutingIDFrameMap; |
309 static base::LazyInstance<RoutingIDFrameMap> g_routing_id_frame_map = | 313 static base::LazyInstance<RoutingIDFrameMap> g_routing_id_frame_map = |
310 LAZY_INSTANCE_INITIALIZER; | 314 LAZY_INSTANCE_INITIALIZER; |
311 | 315 |
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1451 IPC_MESSAGE_HANDLER(FrameMsg_SetTextTrackSettings, | 1455 IPC_MESSAGE_HANDLER(FrameMsg_SetTextTrackSettings, |
1452 OnTextTrackSettingsChanged) | 1456 OnTextTrackSettingsChanged) |
1453 IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent) | 1457 IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent) |
1454 IPC_MESSAGE_HANDLER(FrameMsg_FailedNavigation, OnFailedNavigation) | 1458 IPC_MESSAGE_HANDLER(FrameMsg_FailedNavigation, OnFailedNavigation) |
1455 IPC_MESSAGE_HANDLER(FrameMsg_GetSavableResourceLinks, | 1459 IPC_MESSAGE_HANDLER(FrameMsg_GetSavableResourceLinks, |
1456 OnGetSavableResourceLinks) | 1460 OnGetSavableResourceLinks) |
1457 IPC_MESSAGE_HANDLER(FrameMsg_GetSerializedHtmlWithLocalLinks, | 1461 IPC_MESSAGE_HANDLER(FrameMsg_GetSerializedHtmlWithLocalLinks, |
1458 OnGetSerializedHtmlWithLocalLinks) | 1462 OnGetSerializedHtmlWithLocalLinks) |
1459 IPC_MESSAGE_HANDLER(FrameMsg_SerializeAsMHTML, OnSerializeAsMHTML) | 1463 IPC_MESSAGE_HANDLER(FrameMsg_SerializeAsMHTML, OnSerializeAsMHTML) |
1460 IPC_MESSAGE_HANDLER(FrameMsg_Find, OnFind) | 1464 IPC_MESSAGE_HANDLER(FrameMsg_Find, OnFind) |
1465 IPC_MESSAGE_HANDLER(FrameMsg_ClearActiveFindMatch, OnClearActiveFindMatch) | |
1461 IPC_MESSAGE_HANDLER(FrameMsg_StopFinding, OnStopFinding) | 1466 IPC_MESSAGE_HANDLER(FrameMsg_StopFinding, OnStopFinding) |
1462 IPC_MESSAGE_HANDLER(FrameMsg_EnableViewSourceMode, OnEnableViewSourceMode) | 1467 IPC_MESSAGE_HANDLER(FrameMsg_EnableViewSourceMode, OnEnableViewSourceMode) |
1463 IPC_MESSAGE_HANDLER(FrameMsg_SuppressFurtherDialogs, | 1468 IPC_MESSAGE_HANDLER(FrameMsg_SuppressFurtherDialogs, |
1464 OnSuppressFurtherDialogs) | 1469 OnSuppressFurtherDialogs) |
1465 #if defined(OS_ANDROID) | 1470 #if defined(OS_ANDROID) |
1466 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult, | 1471 IPC_MESSAGE_HANDLER(FrameMsg_ActivateNearestFindResult, |
1467 OnActivateNearestFindResult) | 1472 OnActivateNearestFindResult) |
1473 IPC_MESSAGE_HANDLER(FrameMsg_GetNearestFindResult, | |
1474 OnGetNearestFindResult) | |
1468 IPC_MESSAGE_HANDLER(FrameMsg_FindMatchRects, OnFindMatchRects) | 1475 IPC_MESSAGE_HANDLER(FrameMsg_FindMatchRects, OnFindMatchRects) |
1469 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) | 1476 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) |
1470 #elif defined(OS_MACOSX) | 1477 #elif defined(OS_MACOSX) |
1471 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) | 1478 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) |
1472 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) | 1479 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) |
1473 #endif | 1480 #endif |
1474 IPC_END_MESSAGE_MAP() | 1481 IPC_END_MESSAGE_MAP() |
1475 | 1482 |
1476 return handled; | 1483 return handled; |
1477 } | 1484 } |
(...skipping 2565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4043 DCHECK(!frame_ || frame_ == frame); | 4050 DCHECK(!frame_ || frame_ == frame); |
4044 if (!frame->parent()) { | 4051 if (!frame->parent()) { |
4045 render_view_->Send(new ViewHostMsg_WillInsertBody( | 4052 render_view_->Send(new ViewHostMsg_WillInsertBody( |
4046 render_view_->GetRoutingID())); | 4053 render_view_->GetRoutingID())); |
4047 } | 4054 } |
4048 } | 4055 } |
4049 | 4056 |
4050 void RenderFrameImpl::reportFindInPageMatchCount(int request_id, | 4057 void RenderFrameImpl::reportFindInPageMatchCount(int request_id, |
4051 int count, | 4058 int count, |
4052 bool final_update) { | 4059 bool final_update) { |
4053 int active_match_ordinal = -1; // -1 = don't update active match ordinal | 4060 // -1 here means don't update the active match ordinal. |
4054 if (!count) | 4061 int active_match_ordinal = count ? -1 : 0; |
4055 active_match_ordinal = 0; | |
4056 | 4062 |
4057 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, count, gfx::Rect(), | 4063 SendFindReply(request_id, count, active_match_ordinal, gfx::Rect(), |
4058 active_match_ordinal, final_update)); | 4064 final_update); |
4059 } | 4065 } |
4060 | 4066 |
4061 void RenderFrameImpl::reportFindInPageSelection( | 4067 void RenderFrameImpl::reportFindInPageSelection( |
4062 int request_id, | 4068 int request_id, |
4063 int active_match_ordinal, | 4069 int active_match_ordinal, |
4064 const blink::WebRect& selection_rect) { | 4070 const blink::WebRect& selection_rect) { |
4065 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, -1, selection_rect, | 4071 SendFindReply(request_id, -1 /* match_count */, active_match_ordinal, |
4066 active_match_ordinal, false)); | 4072 selection_rect, false /* final_status_update */); |
4067 } | 4073 } |
4068 | 4074 |
4069 void RenderFrameImpl::requestStorageQuota( | 4075 void RenderFrameImpl::requestStorageQuota( |
4070 blink::WebStorageQuotaType type, | 4076 blink::WebStorageQuotaType type, |
4071 unsigned long long requested_size, | 4077 unsigned long long requested_size, |
4072 blink::WebStorageQuotaCallbacks callbacks) { | 4078 blink::WebStorageQuotaCallbacks callbacks) { |
4073 WebSecurityOrigin origin = frame_->document().getSecurityOrigin(); | 4079 WebSecurityOrigin origin = frame_->document().getSecurityOrigin(); |
4074 if (origin.isUnique()) { | 4080 if (origin.isUnique()) { |
4075 // Unique origins cannot store persistent state. | 4081 // Unique origins cannot store persistent state. |
4076 callbacks.didFail(blink::WebStorageQuotaErrorAbort); | 4082 callbacks.didFail(blink::WebStorageQuotaErrorAbort); |
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4941 // Cleanup and notify the browser process about completion. | 4947 // Cleanup and notify the browser process about completion. |
4942 file.Close(); // Need to flush file contents before sending IPC response. | 4948 file.Close(); // Need to flush file contents before sending IPC response. |
4943 Send(new FrameHostMsg_SerializeAsMHTMLResponse( | 4949 Send(new FrameHostMsg_SerializeAsMHTMLResponse( |
4944 routing_id_, params.job_id, success, | 4950 routing_id_, params.job_id, success, |
4945 digests_of_uris_of_serialized_resources)); | 4951 digests_of_uris_of_serialized_resources)); |
4946 } | 4952 } |
4947 | 4953 |
4948 void RenderFrameImpl::OnFind(int request_id, | 4954 void RenderFrameImpl::OnFind(int request_id, |
4949 const base::string16& search_text, | 4955 const base::string16& search_text, |
4950 const WebFindOptions& options) { | 4956 const WebFindOptions& options) { |
4951 // This should only be received on the main frame, since find-in-page is | |
4952 // currently orchestrated by the main frame. | |
4953 if (!is_main_frame_) { | |
4954 NOTREACHED(); | |
4955 return; | |
4956 } | |
4957 | |
4958 DCHECK(!search_text.empty()); | 4957 DCHECK(!search_text.empty()); |
4959 | 4958 |
4960 blink::WebPlugin* plugin = GetWebPluginForFind(); | 4959 blink::WebPlugin* plugin = GetWebPluginForFind(); |
4961 // Check if the plugin still exists in the document. | 4960 // Check if the plugin still exists in the document. |
4962 if (plugin) { | 4961 if (plugin) { |
4963 if (options.findNext) { | 4962 if (options.findNext) { |
4964 // Just navigate back/forward. | 4963 // Just navigate back/forward. |
4965 plugin->selectFindResult(options.forward); | 4964 plugin->selectFindResult(options.forward); |
4966 } else { | 4965 } else { |
4967 if (!plugin->startFind(search_text, options.matchCase, request_id)) { | 4966 if (!plugin->startFind(search_text, options.matchCase, request_id)) { |
4968 // Send "no results". | 4967 // Send "no results". |
4969 SendFindReply(request_id, 0, 0, gfx::Rect(), true); | 4968 SendFindReply(request_id, 0 /* match_count */, 0 /* ordinal */, |
4969 gfx::Rect(), true /* final_status_update */ ); | |
4970 } | 4970 } |
4971 } | 4971 } |
4972 return; | 4972 return; |
4973 } | 4973 } |
4974 | 4974 |
4975 WebLocalFrame* main_frame = GetWebFrame(); | 4975 // Send "no results" if this frame has no visible content. |
4976 WebLocalFrame* focused_frame = | 4976 if (!frame_->hasVisibleContent()) { |
4977 render_view_->webview()->focusedFrame()->toWebLocalFrame(); | 4977 SendFindReply(request_id, 0 /* match_count */, 0 /* ordinal */, |
4978 // Start searching in the focused frame. | 4978 gfx::Rect(), true /* final_status_update */ ); |
4979 WebLocalFrame* search_frame = focused_frame; | 4979 return; |
4980 | 4980 } |
4981 // Check for multiple searchable frames. | |
4982 bool multi_frame = (main_frame->traverseNextLocal(true) != main_frame); | |
4983 | |
4984 // If we have multiple frames, we don't want to wrap the search within the | |
4985 // frame, so we check here if we only have |main_frame| in the chain. | |
4986 bool wrap_within_frame = !multi_frame; | |
4987 | 4981 |
4988 WebRect selection_rect; | 4982 WebRect selection_rect; |
4989 bool result = false; | |
4990 bool active_now = false; | 4983 bool active_now = false; |
4991 | 4984 |
4992 // If something is selected when we start searching it means we cannot just | 4985 // If something is selected when we start searching it means we cannot just |
4993 // increment the current match ordinal; we need to re-generate it. | 4986 // increment the current match ordinal; we need to re-generate it. |
4994 WebRange current_selection = focused_frame->selectionRange(); | 4987 WebRange current_selection = frame_->selectionRange(); |
4995 | 4988 |
4996 do { | 4989 if (frame_->find(request_id, search_text, options, |
4997 result = | 4990 false /* wrapWithinFrame */, &selection_rect, &active_now)) { |
4998 search_frame->find(request_id, search_text, options, wrap_within_frame, | 4991 // Indicate that at least one match has been found. 1 here means possibly |
4999 &selection_rect, &active_now); | 4992 // more matches could be coming. -1 here means that the exact active match |
5000 | 4993 // ordinal is not yet known. |
5001 if (!result) { | 4994 SendFindReply(request_id, 1 /* match_count */, -1 /* ordinal */, |
5002 // Don't leave text selected as you move to the next frame. | 4995 gfx::Rect(), false /* final_status_update */ ); |
5003 search_frame->executeCommand(WebString::fromUTF8("Unselect")); | 4996 } |
5004 | |
5005 // Find the next frame, but skip the invisible ones. | |
5006 do { | |
5007 // What is the next frame to search (we might be going backwards)? Note | |
5008 // that we specify wrap=true so that search_frame never becomes NULL. | |
5009 search_frame = options.forward | |
5010 ? search_frame->traverseNextLocal(true) | |
5011 : search_frame->traversePreviousLocal(true); | |
5012 } while (!search_frame->hasVisibleContent() && | |
5013 search_frame != focused_frame); | |
5014 | |
5015 // Make sure selection doesn't affect the search operation in new frame. | |
5016 search_frame->executeCommand(WebString::fromUTF8("Unselect")); | |
5017 | |
5018 // If we have multiple frames and we have wrapped back around to the | |
5019 // focused frame, we need to search it once more allowing wrap within | |
5020 // the frame, otherwise it will report 'no match' if the focused frame has | |
5021 // reported matches, but no frames after the focused_frame contain a | |
5022 // match for the search word(s). | |
5023 if (multi_frame && search_frame == focused_frame) { | |
5024 result = search_frame->find(request_id, search_text, options, | |
5025 true, // Force wrapping. | |
5026 &selection_rect, &active_now); | |
5027 } | |
5028 } | |
5029 | |
5030 render_view_->webview()->setFocusedFrame(search_frame); | |
5031 } while (!result && search_frame != focused_frame); | |
5032 | 4997 |
5033 if (options.findNext && current_selection.isNull() && active_now) { | 4998 if (options.findNext && current_selection.isNull() && active_now) { |
5034 // Force the main_frame to report the actual count. | 4999 // Force report of the actual count. |
5035 main_frame->increaseMatchCount(0, request_id); | 5000 frame_->increaseMatchCount(0, request_id); |
5036 } else { | |
5037 // If nothing is found, set result to "0 of 0", otherwise, set it to | |
5038 // "-1 of 1" to indicate that we found at least one item, but we don't know | |
5039 // yet what is active. | |
5040 int ordinal = result ? -1 : 0; // -1 here means we might know more later. | |
5041 int match_count = result ? 1 : 0; // 1 here means possibly more coming. | |
5042 | |
5043 // If we find no matches then this will be our last status update. | |
5044 // Otherwise the scoping effort will send more results. | |
5045 bool final_status_update = !result; | |
5046 | |
5047 SendFindReply(request_id, match_count, ordinal, selection_rect, | |
5048 final_status_update); | |
5049 | |
5050 // Scoping effort begins, starting with the main frame. | |
5051 search_frame = main_frame; | |
5052 | |
5053 main_frame->resetMatchCount(); | |
5054 | |
5055 do { | |
5056 // Cancel all old scoping requests before starting a new one. | |
5057 search_frame->cancelPendingScopingEffort(); | |
5058 | |
5059 // We don't start another scoping effort unless at least one match has | |
5060 // been found. | |
5061 if (result) { | |
5062 // Start new scoping request. If the scoping function determines that it | |
5063 // needs to scope, it will defer until later. | |
5064 search_frame->scopeStringMatches(request_id, search_text, options, | |
5065 true); // reset the tickmarks | |
5066 } | |
5067 | |
5068 // Iterate to the next frame. The frame will not necessarily scope, for | |
5069 // example if it is not visible. | |
5070 search_frame = search_frame->traverseNextLocal(true); | |
5071 } while (search_frame != main_frame); | |
5072 } | |
5073 } | |
5074 | |
5075 void RenderFrameImpl::OnStopFinding(StopFindAction action) { | |
5076 // This should only be received on the main frame, since find-in-page is | |
5077 // currently orchestrated by the main frame. | |
5078 if (!is_main_frame_) { | |
5079 NOTREACHED(); | |
5080 return; | 5001 return; |
5081 } | 5002 } |
5082 | 5003 |
5083 WebView* view = render_view_->webview(); | 5004 // Scoping effort begins. |
5084 if (!view) | 5005 frame_->resetMatchCount(); |
5085 return; | |
5086 | 5006 |
5007 // Cancel all old scoping requests before starting a new one. | |
5008 frame_->cancelPendingScopingEffort(); | |
5009 | |
5010 // Start new scoping request. If the scoping function determines that it | |
5011 // needs to scope, it will defer until later. | |
5012 frame_->scopeStringMatches(request_id, | |
5013 search_text, | |
5014 options, | |
5015 true); // reset the tickmarks | |
5016 } | |
5017 | |
5018 void RenderFrameImpl::OnClearActiveFindMatch() { | |
5019 frame_->executeCommand(WebString::fromUTF8("Unselect")); | |
5020 frame_->clearActiveFindMatch(); | |
5021 } | |
5022 | |
5023 // Ensure that content::StopFindAction and blink::WebLocalFrame::StopFindAction | |
5024 // are kept in sync. | |
5025 STATIC_ASSERT_ENUM(STOP_FIND_ACTION_CLEAR_SELECTION, | |
5026 WebLocalFrame::StopFindActionClearSelection); | |
5027 STATIC_ASSERT_ENUM(STOP_FIND_ACTION_KEEP_SELECTION, | |
5028 WebLocalFrame::StopFindActionKeepSelection); | |
5029 STATIC_ASSERT_ENUM(STOP_FIND_ACTION_ACTIVATE_SELECTION, | |
5030 WebLocalFrame::StopFindActionActivateSelection); | |
5031 | |
5032 void RenderFrameImpl::OnStopFinding(StopFindAction action) { | |
5087 blink::WebPlugin* plugin = GetWebPluginForFind(); | 5033 blink::WebPlugin* plugin = GetWebPluginForFind(); |
5088 if (plugin) { | 5034 if (plugin) { |
5089 plugin->stopFind(); | 5035 plugin->stopFind(); |
5090 return; | 5036 return; |
5091 } | 5037 } |
5092 | 5038 |
5093 bool clear_selection = action == STOP_FIND_ACTION_CLEAR_SELECTION; | 5039 frame_->stopFinding(static_cast<WebLocalFrame::StopFindAction>(action)); |
5094 if (clear_selection) { | |
5095 view->focusedFrame()->executeCommand(WebString::fromUTF8("Unselect")); | |
5096 } | |
5097 | |
5098 WebLocalFrame* frame = GetWebFrame(); | |
5099 while (frame) { | |
5100 frame->stopFinding(clear_selection); | |
5101 frame = frame->traverseNextLocal(false); | |
5102 } | |
5103 | |
5104 if (action == STOP_FIND_ACTION_ACTIVATE_SELECTION) { | |
dglazkov
2016/06/02 04:48:57
Ohhh, I see you just moved the code from here!
paulmeyer
2016/06/02 17:36:36
Acknowledged.
| |
5105 WebFrame* focused_frame = view->focusedFrame(); | |
5106 if (focused_frame) { | |
5107 WebDocument doc = focused_frame->document(); | |
5108 if (!doc.isNull()) { | |
5109 WebElement element = doc.focusedElement(); | |
5110 if (!element.isNull()) | |
5111 element.simulateClick(); | |
5112 } | |
5113 } | |
5114 } | |
5115 } | 5040 } |
5116 | 5041 |
5117 void RenderFrameImpl::OnEnableViewSourceMode() { | 5042 void RenderFrameImpl::OnEnableViewSourceMode() { |
5118 DCHECK(frame_); | 5043 DCHECK(frame_); |
5119 DCHECK(!frame_->parent()); | 5044 DCHECK(!frame_->parent()); |
5120 frame_->enableViewSourceMode(true); | 5045 frame_->enableViewSourceMode(true); |
5121 } | 5046 } |
5122 | 5047 |
5123 void RenderFrameImpl::OnSuppressFurtherDialogs() { | 5048 void RenderFrameImpl::OnSuppressFurtherDialogs() { |
5124 suppress_further_dialogs_ = true; | 5049 suppress_further_dialogs_ = true; |
(...skipping 11 matching lines...) Expand all Loading... | |
5136 // the current match count) in case the host is waiting for a response due | 5061 // the current match count) in case the host is waiting for a response due |
5137 // to rate-limiting. | 5062 // to rate-limiting. |
5138 frame_->increaseMatchCount(0, request_id); | 5063 frame_->increaseMatchCount(0, request_id); |
5139 return; | 5064 return; |
5140 } | 5065 } |
5141 | 5066 |
5142 SendFindReply(request_id, -1 /* number_of_matches */, ordinal, selection_rect, | 5067 SendFindReply(request_id, -1 /* number_of_matches */, ordinal, selection_rect, |
5143 true /* final_update */); | 5068 true /* final_update */); |
5144 } | 5069 } |
5145 | 5070 |
5071 void RenderFrameImpl::OnGetNearestFindResult(int nfr_request_id, | |
5072 float x, | |
5073 float y) { | |
5074 float distance = frame_->distanceToNearestFindMatch(WebFloatPoint(x, y)); | |
5075 Send(new FrameHostMsg_GetNearestFindResult_Reply( | |
5076 routing_id_, nfr_request_id, distance)); | |
5077 } | |
5078 | |
5146 void RenderFrameImpl::OnFindMatchRects(int current_version) { | 5079 void RenderFrameImpl::OnFindMatchRects(int current_version) { |
5147 std::vector<gfx::RectF> match_rects; | 5080 std::vector<gfx::RectF> match_rects; |
5148 | 5081 |
5149 int rects_version = frame_->findMatchMarkersVersion(); | 5082 int rects_version = frame_->findMatchMarkersVersion(); |
5150 if (current_version != rects_version) { | 5083 if (current_version != rects_version) { |
5151 WebVector<WebFloatRect> web_match_rects; | 5084 WebVector<WebFloatRect> web_match_rects; |
5152 frame_->findMatchRects(web_match_rects); | 5085 frame_->findMatchRects(web_match_rects); |
5153 match_rects.reserve(web_match_rects.size()); | 5086 match_rects.reserve(web_match_rects.size()); |
5154 for (size_t i = 0; i < web_match_rects.size(); ++i) | 5087 for (size_t i = 0; i < web_match_rects.size(); ++i) |
5155 match_rects.push_back(gfx::RectF(web_match_rects[i])); | 5088 match_rects.push_back(gfx::RectF(web_match_rects[i])); |
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6011 callback.Run(AudioDeviceFactory::GetOutputDeviceInfo( | 5944 callback.Run(AudioDeviceFactory::GetOutputDeviceInfo( |
6012 routing_id_, 0, sink_id.utf8(), security_origin) | 5945 routing_id_, 0, sink_id.utf8(), security_origin) |
6013 .device_status()); | 5946 .device_status()); |
6014 } | 5947 } |
6015 | 5948 |
6016 blink::ServiceRegistry* RenderFrameImpl::serviceRegistry() { | 5949 blink::ServiceRegistry* RenderFrameImpl::serviceRegistry() { |
6017 return &blink_service_registry_; | 5950 return &blink_service_registry_; |
6018 } | 5951 } |
6019 | 5952 |
6020 blink::WebPlugin* RenderFrameImpl::GetWebPluginForFind() { | 5953 blink::WebPlugin* RenderFrameImpl::GetWebPluginForFind() { |
6021 if (!is_main_frame_) | |
6022 return nullptr; | |
6023 | |
6024 if (frame_->document().isPluginDocument()) | 5954 if (frame_->document().isPluginDocument()) |
6025 return frame_->document().to<WebPluginDocument>().plugin(); | 5955 return frame_->document().to<WebPluginDocument>().plugin(); |
6026 | 5956 |
6027 #if defined(ENABLE_PLUGINS) | 5957 #if defined(ENABLE_PLUGINS) |
6028 if (plugin_find_handler_) | 5958 if (plugin_find_handler_) |
6029 return plugin_find_handler_->container()->plugin(); | 5959 return plugin_find_handler_->container()->plugin(); |
6030 #endif | 5960 #endif |
6031 | 5961 |
6032 return nullptr; | 5962 return nullptr; |
6033 } | 5963 } |
6034 | 5964 |
6035 void RenderFrameImpl::SendFindReply(int request_id, | 5965 void RenderFrameImpl::SendFindReply(int request_id, |
6036 int match_count, | 5966 int match_count, |
6037 int ordinal, | 5967 int ordinal, |
6038 const WebRect& selection_rect, | 5968 const WebRect& selection_rect, |
6039 bool final_status_update) { | 5969 bool final_status_update) { |
6040 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, | 5970 if (final_status_update && !ordinal) |
6041 selection_rect, ordinal, | 5971 frame_->executeCommand(WebString::fromUTF8("Unselect")); |
5972 DCHECK(ordinal >= -1); | |
5973 | |
5974 Send(new FrameHostMsg_Find_Reply(routing_id_, | |
5975 request_id, | |
5976 match_count, | |
5977 selection_rect, | |
5978 ordinal, | |
6042 final_status_update)); | 5979 final_status_update)); |
6043 } | 5980 } |
6044 | 5981 |
6045 #if defined(ENABLE_PLUGINS) | 5982 #if defined(ENABLE_PLUGINS) |
6046 void RenderFrameImpl::PepperInstanceCreated( | 5983 void RenderFrameImpl::PepperInstanceCreated( |
6047 PepperPluginInstanceImpl* instance) { | 5984 PepperPluginInstanceImpl* instance) { |
6048 active_pepper_instances_.insert(instance); | 5985 active_pepper_instances_.insert(instance); |
6049 | 5986 |
6050 Send(new FrameHostMsg_PepperInstanceCreated(routing_id_)); | 5987 Send(new FrameHostMsg_PepperInstanceCreated(routing_id_)); |
6051 } | 5988 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6094 // event target. Potentially a Pepper plugin will receive the event. | 6031 // event target. Potentially a Pepper plugin will receive the event. |
6095 // In order to tell whether a plugin gets the last mouse event and which it | 6032 // In order to tell whether a plugin gets the last mouse event and which it |
6096 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6033 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
6097 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6034 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
6098 // |pepper_last_mouse_event_target_|. | 6035 // |pepper_last_mouse_event_target_|. |
6099 pepper_last_mouse_event_target_ = nullptr; | 6036 pepper_last_mouse_event_target_ = nullptr; |
6100 #endif | 6037 #endif |
6101 } | 6038 } |
6102 | 6039 |
6103 } // namespace content | 6040 } // namespace content |
OLD | NEW |