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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 using blink::WebVector; | 294 using blink::WebVector; |
295 using blink::WebView; | 295 using blink::WebView; |
296 using base::Time; | 296 using base::Time; |
297 using base::TimeDelta; | 297 using base::TimeDelta; |
298 | 298 |
299 #if defined(OS_ANDROID) | 299 #if defined(OS_ANDROID) |
300 using blink::WebFloatPoint; | 300 using blink::WebFloatPoint; |
301 using blink::WebFloatRect; | 301 using blink::WebFloatRect; |
302 #endif | 302 #endif |
303 | 303 |
| 304 #define STATIC_ASSERT_ENUM(a, b) \ |
| 305 static_assert(static_cast<int>(a) == static_cast<int>(b), \ |
| 306 "mismatching enums: " #a) |
| 307 |
304 namespace content { | 308 namespace content { |
305 | 309 |
306 namespace { | 310 namespace { |
307 | 311 |
308 const size_t kExtraCharsBeforeAndAfterSelection = 100; | 312 const size_t kExtraCharsBeforeAndAfterSelection = 100; |
309 | 313 |
310 typedef std::map<int, RenderFrameImpl*> RoutingIDFrameMap; | 314 typedef std::map<int, RenderFrameImpl*> RoutingIDFrameMap; |
311 static base::LazyInstance<RoutingIDFrameMap> g_routing_id_frame_map = | 315 static base::LazyInstance<RoutingIDFrameMap> g_routing_id_frame_map = |
312 LAZY_INSTANCE_INITIALIZER; | 316 LAZY_INSTANCE_INITIALIZER; |
313 | 317 |
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1489 IPC_MESSAGE_HANDLER(FrameMsg_SetTextTrackSettings, | 1493 IPC_MESSAGE_HANDLER(FrameMsg_SetTextTrackSettings, |
1490 OnTextTrackSettingsChanged) | 1494 OnTextTrackSettingsChanged) |
1491 IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent) | 1495 IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent) |
1492 IPC_MESSAGE_HANDLER(FrameMsg_FailedNavigation, OnFailedNavigation) | 1496 IPC_MESSAGE_HANDLER(FrameMsg_FailedNavigation, OnFailedNavigation) |
1493 IPC_MESSAGE_HANDLER(FrameMsg_GetSavableResourceLinks, | 1497 IPC_MESSAGE_HANDLER(FrameMsg_GetSavableResourceLinks, |
1494 OnGetSavableResourceLinks) | 1498 OnGetSavableResourceLinks) |
1495 IPC_MESSAGE_HANDLER(FrameMsg_GetSerializedHtmlWithLocalLinks, | 1499 IPC_MESSAGE_HANDLER(FrameMsg_GetSerializedHtmlWithLocalLinks, |
1496 OnGetSerializedHtmlWithLocalLinks) | 1500 OnGetSerializedHtmlWithLocalLinks) |
1497 IPC_MESSAGE_HANDLER(FrameMsg_SerializeAsMHTML, OnSerializeAsMHTML) | 1501 IPC_MESSAGE_HANDLER(FrameMsg_SerializeAsMHTML, OnSerializeAsMHTML) |
1498 IPC_MESSAGE_HANDLER(FrameMsg_Find, OnFind) | 1502 IPC_MESSAGE_HANDLER(FrameMsg_Find, OnFind) |
| 1503 IPC_MESSAGE_HANDLER(FrameMsg_ClearActiveFindMatch, OnClearActiveFindMatch) |
1499 IPC_MESSAGE_HANDLER(FrameMsg_StopFinding, OnStopFinding) | 1504 IPC_MESSAGE_HANDLER(FrameMsg_StopFinding, OnStopFinding) |
1500 IPC_MESSAGE_HANDLER(FrameMsg_EnableViewSourceMode, OnEnableViewSourceMode) | 1505 IPC_MESSAGE_HANDLER(FrameMsg_EnableViewSourceMode, OnEnableViewSourceMode) |
1501 IPC_MESSAGE_HANDLER(FrameMsg_SuppressFurtherDialogs, | 1506 IPC_MESSAGE_HANDLER(FrameMsg_SuppressFurtherDialogs, |
1502 OnSuppressFurtherDialogs) | 1507 OnSuppressFurtherDialogs) |
1503 #if defined(OS_ANDROID) | 1508 #if defined(OS_ANDROID) |
1504 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult, | 1509 IPC_MESSAGE_HANDLER(FrameMsg_ActivateNearestFindResult, |
1505 OnActivateNearestFindResult) | 1510 OnActivateNearestFindResult) |
| 1511 IPC_MESSAGE_HANDLER(FrameMsg_GetNearestFindResult, |
| 1512 OnGetNearestFindResult) |
1506 IPC_MESSAGE_HANDLER(FrameMsg_FindMatchRects, OnFindMatchRects) | 1513 IPC_MESSAGE_HANDLER(FrameMsg_FindMatchRects, OnFindMatchRects) |
1507 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) | 1514 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) |
1508 #elif defined(OS_MACOSX) | 1515 #elif defined(OS_MACOSX) |
1509 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) | 1516 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) |
1510 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) | 1517 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) |
1511 #endif | 1518 #endif |
1512 IPC_END_MESSAGE_MAP() | 1519 IPC_END_MESSAGE_MAP() |
1513 | 1520 |
1514 return handled; | 1521 return handled; |
1515 } | 1522 } |
(...skipping 2576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4092 DCHECK(!frame_ || frame_ == frame); | 4099 DCHECK(!frame_ || frame_ == frame); |
4093 if (!frame->parent()) { | 4100 if (!frame->parent()) { |
4094 render_view_->Send(new ViewHostMsg_WillInsertBody( | 4101 render_view_->Send(new ViewHostMsg_WillInsertBody( |
4095 render_view_->GetRoutingID())); | 4102 render_view_->GetRoutingID())); |
4096 } | 4103 } |
4097 } | 4104 } |
4098 | 4105 |
4099 void RenderFrameImpl::reportFindInPageMatchCount(int request_id, | 4106 void RenderFrameImpl::reportFindInPageMatchCount(int request_id, |
4100 int count, | 4107 int count, |
4101 bool final_update) { | 4108 bool final_update) { |
4102 int active_match_ordinal = -1; // -1 = don't update active match ordinal | 4109 // -1 here means don't update the active match ordinal. |
4103 if (!count) | 4110 int active_match_ordinal = count ? -1 : 0; |
4104 active_match_ordinal = 0; | |
4105 | 4111 |
4106 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, count, gfx::Rect(), | 4112 SendFindReply(request_id, count, active_match_ordinal, gfx::Rect(), |
4107 active_match_ordinal, final_update)); | 4113 final_update); |
4108 } | 4114 } |
4109 | 4115 |
4110 void RenderFrameImpl::reportFindInPageSelection( | 4116 void RenderFrameImpl::reportFindInPageSelection( |
4111 int request_id, | 4117 int request_id, |
4112 int active_match_ordinal, | 4118 int active_match_ordinal, |
4113 const blink::WebRect& selection_rect) { | 4119 const blink::WebRect& selection_rect) { |
4114 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, -1, selection_rect, | 4120 SendFindReply(request_id, -1 /* match_count */, active_match_ordinal, |
4115 active_match_ordinal, false)); | 4121 selection_rect, false /* final_status_update */); |
4116 } | 4122 } |
4117 | 4123 |
4118 void RenderFrameImpl::requestStorageQuota( | 4124 void RenderFrameImpl::requestStorageQuota( |
4119 blink::WebStorageQuotaType type, | 4125 blink::WebStorageQuotaType type, |
4120 unsigned long long requested_size, | 4126 unsigned long long requested_size, |
4121 blink::WebStorageQuotaCallbacks callbacks) { | 4127 blink::WebStorageQuotaCallbacks callbacks) { |
4122 WebSecurityOrigin origin = frame_->document().getSecurityOrigin(); | 4128 WebSecurityOrigin origin = frame_->document().getSecurityOrigin(); |
4123 if (origin.isUnique()) { | 4129 if (origin.isUnique()) { |
4124 // Unique origins cannot store persistent state. | 4130 // Unique origins cannot store persistent state. |
4125 callbacks.didFail(blink::WebStorageQuotaErrorAbort); | 4131 callbacks.didFail(blink::WebStorageQuotaErrorAbort); |
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5011 // Cleanup and notify the browser process about completion. | 5017 // Cleanup and notify the browser process about completion. |
5012 file.Close(); // Need to flush file contents before sending IPC response. | 5018 file.Close(); // Need to flush file contents before sending IPC response. |
5013 Send(new FrameHostMsg_SerializeAsMHTMLResponse( | 5019 Send(new FrameHostMsg_SerializeAsMHTMLResponse( |
5014 routing_id_, params.job_id, success, | 5020 routing_id_, params.job_id, success, |
5015 digests_of_uris_of_serialized_resources)); | 5021 digests_of_uris_of_serialized_resources)); |
5016 } | 5022 } |
5017 | 5023 |
5018 void RenderFrameImpl::OnFind(int request_id, | 5024 void RenderFrameImpl::OnFind(int request_id, |
5019 const base::string16& search_text, | 5025 const base::string16& search_text, |
5020 const WebFindOptions& options) { | 5026 const WebFindOptions& options) { |
5021 // This should only be received on the main frame, since find-in-page is | |
5022 // currently orchestrated by the main frame. | |
5023 if (!is_main_frame_) { | |
5024 NOTREACHED(); | |
5025 return; | |
5026 } | |
5027 | |
5028 DCHECK(!search_text.empty()); | 5027 DCHECK(!search_text.empty()); |
5029 | 5028 |
5030 blink::WebPlugin* plugin = GetWebPluginForFind(); | 5029 blink::WebPlugin* plugin = GetWebPluginForFind(); |
5031 // Check if the plugin still exists in the document. | 5030 // Check if the plugin still exists in the document. |
5032 if (plugin) { | 5031 if (plugin) { |
5033 if (options.findNext) { | 5032 if (options.findNext) { |
5034 // Just navigate back/forward. | 5033 // Just navigate back/forward. |
5035 plugin->selectFindResult(options.forward); | 5034 plugin->selectFindResult(options.forward); |
5036 } else { | 5035 } else { |
5037 if (!plugin->startFind(search_text, options.matchCase, request_id)) { | 5036 if (!plugin->startFind(search_text, options.matchCase, request_id)) { |
5038 // Send "no results". | 5037 // Send "no results". |
5039 SendFindReply(request_id, 0, 0, gfx::Rect(), true); | 5038 SendFindReply(request_id, 0 /* match_count */, 0 /* ordinal */, |
| 5039 gfx::Rect(), true /* final_status_update */ ); |
5040 } | 5040 } |
5041 } | 5041 } |
5042 return; | 5042 return; |
5043 } | 5043 } |
5044 | 5044 |
5045 WebLocalFrame* main_frame = GetWebFrame(); | 5045 // Send "no results" if this frame has no visible content. |
5046 WebLocalFrame* focused_frame = | 5046 if (!frame_->hasVisibleContent()) { |
5047 render_view_->webview()->focusedFrame()->toWebLocalFrame(); | 5047 SendFindReply(request_id, 0 /* match_count */, 0 /* ordinal */, |
5048 // Start searching in the focused frame. | 5048 gfx::Rect(), true /* final_status_update */ ); |
5049 WebLocalFrame* search_frame = focused_frame; | 5049 return; |
5050 | 5050 } |
5051 // Check for multiple searchable frames. | |
5052 bool multi_frame = (main_frame->traverseNextLocal(true) != main_frame); | |
5053 | |
5054 // If we have multiple frames, we don't want to wrap the search within the | |
5055 // frame, so we check here if we only have |main_frame| in the chain. | |
5056 bool wrap_within_frame = !multi_frame; | |
5057 | 5051 |
5058 WebRect selection_rect; | 5052 WebRect selection_rect; |
5059 bool result = false; | |
5060 bool active_now = false; | 5053 bool active_now = false; |
5061 | 5054 |
5062 // If something is selected when we start searching it means we cannot just | 5055 // If something is selected when we start searching it means we cannot just |
5063 // increment the current match ordinal; we need to re-generate it. | 5056 // increment the current match ordinal; we need to re-generate it. |
5064 WebRange current_selection = focused_frame->selectionRange(); | 5057 WebRange current_selection = frame_->selectionRange(); |
5065 | 5058 |
5066 do { | 5059 if (frame_->find(request_id, search_text, options, |
5067 result = | 5060 false /* wrapWithinFrame */, &selection_rect, &active_now)) { |
5068 search_frame->find(request_id, search_text, options, wrap_within_frame, | 5061 // Indicate that at least one match has been found. 1 here means possibly |
5069 &selection_rect, &active_now); | 5062 // more matches could be coming. -1 here means that the exact active match |
5070 | 5063 // ordinal is not yet known. |
5071 if (!result) { | 5064 SendFindReply(request_id, 1 /* match_count */, -1 /* ordinal */, |
5072 // Don't leave text selected as you move to the next frame. | 5065 gfx::Rect(), false /* final_status_update */ ); |
5073 search_frame->executeCommand(WebString::fromUTF8("Unselect")); | 5066 } |
5074 | |
5075 // Find the next frame, but skip the invisible ones. | |
5076 do { | |
5077 // What is the next frame to search (we might be going backwards)? Note | |
5078 // that we specify wrap=true so that search_frame never becomes NULL. | |
5079 search_frame = options.forward | |
5080 ? search_frame->traverseNextLocal(true) | |
5081 : search_frame->traversePreviousLocal(true); | |
5082 } while (!search_frame->hasVisibleContent() && | |
5083 search_frame != focused_frame); | |
5084 | |
5085 // Make sure selection doesn't affect the search operation in new frame. | |
5086 search_frame->executeCommand(WebString::fromUTF8("Unselect")); | |
5087 | |
5088 // If we have multiple frames and we have wrapped back around to the | |
5089 // focused frame, we need to search it once more allowing wrap within | |
5090 // the frame, otherwise it will report 'no match' if the focused frame has | |
5091 // reported matches, but no frames after the focused_frame contain a | |
5092 // match for the search word(s). | |
5093 if (multi_frame && search_frame == focused_frame) { | |
5094 result = search_frame->find(request_id, search_text, options, | |
5095 true, // Force wrapping. | |
5096 &selection_rect, &active_now); | |
5097 } | |
5098 } | |
5099 | |
5100 render_view_->webview()->setFocusedFrame(search_frame); | |
5101 } while (!result && search_frame != focused_frame); | |
5102 | 5067 |
5103 if (options.findNext && current_selection.isNull() && active_now) { | 5068 if (options.findNext && current_selection.isNull() && active_now) { |
5104 // Force the main_frame to report the actual count. | 5069 // Force report of the actual count. |
5105 main_frame->increaseMatchCount(0, request_id); | 5070 frame_->increaseMatchCount(0, request_id); |
5106 } else { | |
5107 // If nothing is found, set result to "0 of 0", otherwise, set it to | |
5108 // "-1 of 1" to indicate that we found at least one item, but we don't know | |
5109 // yet what is active. | |
5110 int ordinal = result ? -1 : 0; // -1 here means we might know more later. | |
5111 int match_count = result ? 1 : 0; // 1 here means possibly more coming. | |
5112 | |
5113 // If we find no matches then this will be our last status update. | |
5114 // Otherwise the scoping effort will send more results. | |
5115 bool final_status_update = !result; | |
5116 | |
5117 SendFindReply(request_id, match_count, ordinal, selection_rect, | |
5118 final_status_update); | |
5119 | |
5120 // Scoping effort begins, starting with the main frame. | |
5121 search_frame = main_frame; | |
5122 | |
5123 main_frame->resetMatchCount(); | |
5124 | |
5125 do { | |
5126 // Cancel all old scoping requests before starting a new one. | |
5127 search_frame->cancelPendingScopingEffort(); | |
5128 | |
5129 // We don't start another scoping effort unless at least one match has | |
5130 // been found. | |
5131 if (result) { | |
5132 // Start new scoping request. If the scoping function determines that it | |
5133 // needs to scope, it will defer until later. | |
5134 search_frame->scopeStringMatches(request_id, search_text, options, | |
5135 true); // reset the tickmarks | |
5136 } | |
5137 | |
5138 // Iterate to the next frame. The frame will not necessarily scope, for | |
5139 // example if it is not visible. | |
5140 search_frame = search_frame->traverseNextLocal(true); | |
5141 } while (search_frame != main_frame); | |
5142 } | |
5143 } | |
5144 | |
5145 void RenderFrameImpl::OnStopFinding(StopFindAction action) { | |
5146 // This should only be received on the main frame, since find-in-page is | |
5147 // currently orchestrated by the main frame. | |
5148 if (!is_main_frame_) { | |
5149 NOTREACHED(); | |
5150 return; | 5071 return; |
5151 } | 5072 } |
5152 | 5073 |
5153 WebView* view = render_view_->webview(); | 5074 // Scoping effort begins. |
5154 if (!view) | 5075 frame_->resetMatchCount(); |
5155 return; | |
5156 | 5076 |
| 5077 // Cancel all old scoping requests before starting a new one. |
| 5078 frame_->cancelPendingScopingEffort(); |
| 5079 |
| 5080 // Start new scoping request. If the scoping function determines that it |
| 5081 // needs to scope, it will defer until later. |
| 5082 frame_->scopeStringMatches(request_id, |
| 5083 search_text, |
| 5084 options, |
| 5085 true); // reset the tickmarks |
| 5086 } |
| 5087 |
| 5088 void RenderFrameImpl::OnClearActiveFindMatch() { |
| 5089 frame_->executeCommand(WebString::fromUTF8("Unselect")); |
| 5090 frame_->clearActiveFindMatch(); |
| 5091 } |
| 5092 |
| 5093 // Ensure that content::StopFindAction and blink::WebLocalFrame::StopFindAction |
| 5094 // are kept in sync. |
| 5095 STATIC_ASSERT_ENUM(STOP_FIND_ACTION_CLEAR_SELECTION, |
| 5096 WebLocalFrame::StopFindActionClearSelection); |
| 5097 STATIC_ASSERT_ENUM(STOP_FIND_ACTION_KEEP_SELECTION, |
| 5098 WebLocalFrame::StopFindActionKeepSelection); |
| 5099 STATIC_ASSERT_ENUM(STOP_FIND_ACTION_ACTIVATE_SELECTION, |
| 5100 WebLocalFrame::StopFindActionActivateSelection); |
| 5101 |
| 5102 void RenderFrameImpl::OnStopFinding(StopFindAction action) { |
5157 blink::WebPlugin* plugin = GetWebPluginForFind(); | 5103 blink::WebPlugin* plugin = GetWebPluginForFind(); |
5158 if (plugin) { | 5104 if (plugin) { |
5159 plugin->stopFind(); | 5105 plugin->stopFind(); |
5160 return; | 5106 return; |
5161 } | 5107 } |
5162 | 5108 |
5163 bool clear_selection = action == STOP_FIND_ACTION_CLEAR_SELECTION; | 5109 frame_->stopFinding(static_cast<WebLocalFrame::StopFindAction>(action)); |
5164 if (clear_selection) { | |
5165 view->focusedFrame()->executeCommand(WebString::fromUTF8("Unselect")); | |
5166 } | |
5167 | |
5168 WebLocalFrame* frame = GetWebFrame(); | |
5169 while (frame) { | |
5170 frame->stopFinding(clear_selection); | |
5171 frame = frame->traverseNextLocal(false); | |
5172 } | |
5173 | |
5174 if (action == STOP_FIND_ACTION_ACTIVATE_SELECTION) { | |
5175 WebFrame* focused_frame = view->focusedFrame(); | |
5176 if (focused_frame) { | |
5177 WebDocument doc = focused_frame->document(); | |
5178 if (!doc.isNull()) { | |
5179 WebElement element = doc.focusedElement(); | |
5180 if (!element.isNull()) | |
5181 element.simulateClick(); | |
5182 } | |
5183 } | |
5184 } | |
5185 } | 5110 } |
5186 | 5111 |
5187 void RenderFrameImpl::OnEnableViewSourceMode() { | 5112 void RenderFrameImpl::OnEnableViewSourceMode() { |
5188 DCHECK(frame_); | 5113 DCHECK(frame_); |
5189 DCHECK(!frame_->parent()); | 5114 DCHECK(!frame_->parent()); |
5190 frame_->enableViewSourceMode(true); | 5115 frame_->enableViewSourceMode(true); |
5191 } | 5116 } |
5192 | 5117 |
5193 void RenderFrameImpl::OnSuppressFurtherDialogs() { | 5118 void RenderFrameImpl::OnSuppressFurtherDialogs() { |
5194 suppress_further_dialogs_ = true; | 5119 suppress_further_dialogs_ = true; |
(...skipping 11 matching lines...) Expand all Loading... |
5206 // the current match count) in case the host is waiting for a response due | 5131 // the current match count) in case the host is waiting for a response due |
5207 // to rate-limiting. | 5132 // to rate-limiting. |
5208 frame_->increaseMatchCount(0, request_id); | 5133 frame_->increaseMatchCount(0, request_id); |
5209 return; | 5134 return; |
5210 } | 5135 } |
5211 | 5136 |
5212 SendFindReply(request_id, -1 /* number_of_matches */, ordinal, selection_rect, | 5137 SendFindReply(request_id, -1 /* number_of_matches */, ordinal, selection_rect, |
5213 true /* final_update */); | 5138 true /* final_update */); |
5214 } | 5139 } |
5215 | 5140 |
| 5141 void RenderFrameImpl::OnGetNearestFindResult(int nfr_request_id, |
| 5142 float x, |
| 5143 float y) { |
| 5144 float distance = frame_->distanceToNearestFindMatch(WebFloatPoint(x, y)); |
| 5145 Send(new FrameHostMsg_GetNearestFindResult_Reply( |
| 5146 routing_id_, nfr_request_id, distance)); |
| 5147 } |
| 5148 |
5216 void RenderFrameImpl::OnFindMatchRects(int current_version) { | 5149 void RenderFrameImpl::OnFindMatchRects(int current_version) { |
5217 std::vector<gfx::RectF> match_rects; | 5150 std::vector<gfx::RectF> match_rects; |
5218 | 5151 |
5219 int rects_version = frame_->findMatchMarkersVersion(); | 5152 int rects_version = frame_->findMatchMarkersVersion(); |
5220 if (current_version != rects_version) { | 5153 if (current_version != rects_version) { |
5221 WebVector<WebFloatRect> web_match_rects; | 5154 WebVector<WebFloatRect> web_match_rects; |
5222 frame_->findMatchRects(web_match_rects); | 5155 frame_->findMatchRects(web_match_rects); |
5223 match_rects.reserve(web_match_rects.size()); | 5156 match_rects.reserve(web_match_rects.size()); |
5224 for (size_t i = 0; i < web_match_rects.size(); ++i) | 5157 for (size_t i = 0; i < web_match_rects.size(); ++i) |
5225 match_rects.push_back(gfx::RectF(web_match_rects[i])); | 5158 match_rects.push_back(gfx::RectF(web_match_rects[i])); |
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6071 callback.Run(AudioDeviceFactory::GetOutputDeviceInfo( | 6004 callback.Run(AudioDeviceFactory::GetOutputDeviceInfo( |
6072 routing_id_, 0, sink_id.utf8(), security_origin) | 6005 routing_id_, 0, sink_id.utf8(), security_origin) |
6073 .device_status()); | 6006 .device_status()); |
6074 } | 6007 } |
6075 | 6008 |
6076 blink::ServiceRegistry* RenderFrameImpl::serviceRegistry() { | 6009 blink::ServiceRegistry* RenderFrameImpl::serviceRegistry() { |
6077 return &blink_service_registry_; | 6010 return &blink_service_registry_; |
6078 } | 6011 } |
6079 | 6012 |
6080 blink::WebPlugin* RenderFrameImpl::GetWebPluginForFind() { | 6013 blink::WebPlugin* RenderFrameImpl::GetWebPluginForFind() { |
6081 if (!is_main_frame_) | |
6082 return nullptr; | |
6083 | |
6084 if (frame_->document().isPluginDocument()) | 6014 if (frame_->document().isPluginDocument()) |
6085 return frame_->document().to<WebPluginDocument>().plugin(); | 6015 return frame_->document().to<WebPluginDocument>().plugin(); |
6086 | 6016 |
6087 #if defined(ENABLE_PLUGINS) | 6017 #if defined(ENABLE_PLUGINS) |
6088 if (plugin_find_handler_) | 6018 if (plugin_find_handler_) |
6089 return plugin_find_handler_->container()->plugin(); | 6019 return plugin_find_handler_->container()->plugin(); |
6090 #endif | 6020 #endif |
6091 | 6021 |
6092 return nullptr; | 6022 return nullptr; |
6093 } | 6023 } |
6094 | 6024 |
6095 void RenderFrameImpl::SendFindReply(int request_id, | 6025 void RenderFrameImpl::SendFindReply(int request_id, |
6096 int match_count, | 6026 int match_count, |
6097 int ordinal, | 6027 int ordinal, |
6098 const WebRect& selection_rect, | 6028 const WebRect& selection_rect, |
6099 bool final_status_update) { | 6029 bool final_status_update) { |
6100 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, | 6030 if (final_status_update && !ordinal) |
6101 selection_rect, ordinal, | 6031 frame_->executeCommand(WebString::fromUTF8("Unselect")); |
| 6032 DCHECK(ordinal >= -1); |
| 6033 |
| 6034 Send(new FrameHostMsg_Find_Reply(routing_id_, |
| 6035 request_id, |
| 6036 match_count, |
| 6037 selection_rect, |
| 6038 ordinal, |
6102 final_status_update)); | 6039 final_status_update)); |
6103 } | 6040 } |
6104 | 6041 |
6105 #if defined(ENABLE_PLUGINS) | 6042 #if defined(ENABLE_PLUGINS) |
6106 void RenderFrameImpl::PepperInstanceCreated( | 6043 void RenderFrameImpl::PepperInstanceCreated( |
6107 PepperPluginInstanceImpl* instance) { | 6044 PepperPluginInstanceImpl* instance) { |
6108 active_pepper_instances_.insert(instance); | 6045 active_pepper_instances_.insert(instance); |
6109 | 6046 |
6110 Send(new FrameHostMsg_PepperInstanceCreated(routing_id_)); | 6047 Send(new FrameHostMsg_PepperInstanceCreated(routing_id_)); |
6111 } | 6048 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6154 // event target. Potentially a Pepper plugin will receive the event. | 6091 // event target. Potentially a Pepper plugin will receive the event. |
6155 // In order to tell whether a plugin gets the last mouse event and which it | 6092 // In order to tell whether a plugin gets the last mouse event and which it |
6156 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6093 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
6157 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6094 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
6158 // |pepper_last_mouse_event_target_|. | 6095 // |pepper_last_mouse_event_target_|. |
6159 pepper_last_mouse_event_target_ = nullptr; | 6096 pepper_last_mouse_event_target_ = nullptr; |
6160 #endif | 6097 #endif |
6161 } | 6098 } |
6162 | 6099 |
6163 } // namespace content | 6100 } // namespace content |
OLD | NEW |