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

Unified Diff: content/browser/find_request_manager.cc

Issue 2363993003: Revert of Handling new frames and frame navigations with find-in-page during a find session. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/find_request_manager.h ('k') | content/browser/find_request_manager_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/find_request_manager.cc
diff --git a/content/browser/find_request_manager.cc b/content/browser/find_request_manager.cc
index 5c2eeb2df374da1d18e384648cea298a81708156..db706a283a7ccf9267e7669048611d6fac0939c9 100644
--- a/content/browser/find_request_manager.cc
+++ b/content/browser/find_request_manager.cc
@@ -151,18 +151,11 @@
// Check for an update to the number of matches.
if (number_of_matches != -1) {
DCHECK_GE(number_of_matches, 0);
+ // Increment the global number of matches by the number of additional
+ // matches found for this frame.
auto matches_per_frame_it = matches_per_frame_.find(rfh);
- if (int matches_delta = number_of_matches - matches_per_frame_it->second) {
- // Increment the global number of matches by the number of additional
- // matches found for this frame.
- number_of_matches_ += matches_delta;
- matches_per_frame_it->second = number_of_matches;
-
- // The active match ordinal may need updating since the number of matches
- // before the active match may have changed.
- if (rfh != active_frame_)
- UpdateActiveMatchOrdinal();
- }
+ number_of_matches_ += number_of_matches - matches_per_frame_it->second;
+ matches_per_frame_it->second = number_of_matches;
}
// Check for an update to the selection rect.
@@ -353,15 +346,6 @@
}
#endif
-void FindRequestManager::DidFinishLoad(RenderFrameHost* rfh,
- const GURL& validated_url) {
- if (current_session_id_ == kInvalidId)
- return;
-
- RemoveFrame(rfh);
- AddFrame(rfh, true /* force */);
-}
-
void FindRequestManager::RenderFrameDeleted(RenderFrameHost* rfh) {
RemoveFrame(rfh);
}
@@ -421,7 +405,7 @@
// This is an initial find operation.
Reset(request);
for (FrameTreeNode* node : contents_->GetFrameTree()->Nodes())
- AddFrame(node->current_frame_host(), false /* force */);
+ AddFrame(node->current_frame_host());
}
void FindRequestManager::AdvanceQueue(int request_id) {
@@ -500,19 +484,18 @@
return nullptr;
}
-void FindRequestManager::AddFrame(RenderFrameHost* rfh, bool force) {
+void FindRequestManager::AddFrame(RenderFrameHost* rfh) {
if (!rfh || !rfh->IsRenderFrameLive())
return;
- // A frame that is already being searched should not normally be added again.
- DCHECK(force || !CheckFrame(rfh));
+ // A frame that is already being searched should not be added again.
+ DCHECK(!CheckFrame(rfh));
matches_per_frame_[rfh] = 0;
FindRequest request = current_request_;
request.id = current_session_id_;
request.options.findNext = false;
- request.options.force = force;
SendFindIPC(request, rfh);
}
@@ -545,7 +528,7 @@
RenderFrameHost* rfh) {
if (!number_of_matches_ ||
(active_match_ordinal_ && !pending_active_match_ordinal_) ||
- pending_find_next_reply_) {
+ request_id != current_request_.id) {
// All the find results for |request_id| are in and ready to report. Note
// that |final_update| will be set to false if there are still pending
// replies expected from the initial find request.
@@ -559,7 +542,7 @@
// request must be sent.
RenderFrameHost* target_rfh;
- if (request_id == current_request_.id && current_request_.options.findNext) {
+ if (current_request_.options.findNext) {
// If this was a find next operation, then the active match will be in the
// next frame with matches after this one.
target_rfh = Traverse(rfh,
« no previous file with comments | « content/browser/find_request_manager.h ('k') | content/browser/find_request_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698