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

Unified Diff: chrome/browser/ui/find_bar/find_tab_helper.cc

Issue 2800163002: Prevent excessive beeping in case of Find On Page search failure
Patch Set: Move tracking to find_tab_helper Created 3 years, 8 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 | « chrome/browser/ui/find_bar/find_tab_helper.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/find_bar/find_tab_helper.cc
diff --git a/chrome/browser/ui/find_bar/find_tab_helper.cc b/chrome/browser/ui/find_bar/find_tab_helper.cc
index 4f089762b2bd65707484cf40bdfe44f32019080d..f9da77669a7024d545e30ef31a7de5c31903c7c7 100644
--- a/chrome/browser/ui/find_bar/find_tab_helper.cc
+++ b/chrome/browser/ui/find_bar/find_tab_helper.cc
@@ -35,8 +35,8 @@ FindTabHelper::FindTabHelper(WebContents* web_contents)
current_find_request_id_(find_request_id_counter_++),
current_find_session_id_(current_find_request_id_),
last_search_case_sensitive_(false),
- last_search_result_() {
-}
+ last_search_result_(),
+ final_update_received_for_current_query_(false) {}
FindTabHelper::~FindTabHelper() {
}
@@ -88,6 +88,7 @@ void FindTabHelper::StartFinding(base::string16 search_string,
last_search_case_sensitive_ = case_sensitive;
find_op_aborted_ = false;
+ final_update_received_for_current_query_ = false;
// Keep track of what the last search was across the tabs.
Profile* profile =
@@ -174,6 +175,15 @@ void FindTabHelper::HandleFindReply(int request_id,
else if (selection_rect.IsEmpty())
selection = last_search_result_.selection_rect();
+ // Don't report more than one "final update" for a given query. See
+ // https://crbug.com/682299.
+ if (final_update) {
+ if (final_update_received_for_current_query_)
+ final_update = false;
+ else
+ final_update_received_for_current_query_ = true;
+ }
+
// Notify the UI, automation and any other observers that a find result was
// found.
last_search_result_ = FindNotificationDetails(
« no previous file with comments | « chrome/browser/ui/find_bar/find_tab_helper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698