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

Side by Side Diff: chrome/browser/ui/find_bar/find_tab_helper.cc

Issue 2723253002: Fix beep when navigating/closing a page with find bar open
Patch Set: android Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/ui/find_bar/find_tab_helper.h" 5 #include "chrome/browser/ui/find_bar/find_tab_helper.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 void FindTabHelper::RequestFindMatchRects(int current_version) { 151 void FindTabHelper::RequestFindMatchRects(int current_version) {
152 if (!find_op_aborted_ && !find_text_.empty()) 152 if (!find_op_aborted_ && !find_text_.empty())
153 web_contents()->RequestFindMatchRects(current_version); 153 web_contents()->RequestFindMatchRects(current_version);
154 } 154 }
155 #endif 155 #endif
156 156
157 void FindTabHelper::HandleFindReply(int request_id, 157 void FindTabHelper::HandleFindReply(int request_id,
158 int number_of_matches, 158 int number_of_matches,
159 const gfx::Rect& selection_rect, 159 const gfx::Rect& selection_rect,
160 int active_match_ordinal, 160 int active_match_ordinal,
161 bool final_update) { 161 bool final_update,
162 bool was_frame_removal) {
162 // Ignore responses for requests that have been aborted. 163 // Ignore responses for requests that have been aborted.
163 // Ignore responses for requests from previous sessions. That way we won't act 164 // Ignore responses for requests from previous sessions. That way we won't act
164 // on stale results when the user has already typed in another query. 165 // on stale results when the user has already typed in another query.
165 if (!find_op_aborted_ && request_id >= current_find_session_id_) { 166 if (!find_op_aborted_ && request_id >= current_find_session_id_) {
166 if (number_of_matches == -1) 167 if (number_of_matches == -1)
167 number_of_matches = last_search_result_.number_of_matches(); 168 number_of_matches = last_search_result_.number_of_matches();
168 if (active_match_ordinal == -1) 169 if (active_match_ordinal == -1)
169 active_match_ordinal = last_search_result_.active_match_ordinal(); 170 active_match_ordinal = last_search_result_.active_match_ordinal();
170 171
171 gfx::Rect selection = selection_rect; 172 gfx::Rect selection = selection_rect;
172 if (final_update && active_match_ordinal == 0) 173 if (final_update && active_match_ordinal == 0)
173 selection = gfx::Rect(); 174 selection = gfx::Rect();
174 else if (selection_rect.IsEmpty()) 175 else if (selection_rect.IsEmpty())
175 selection = last_search_result_.selection_rect(); 176 selection = last_search_result_.selection_rect();
176 177
177 // Notify the UI, automation and any other observers that a find result was 178 // Notify the UI, automation and any other observers that a find result was
178 // found. 179 // found.
179 last_search_result_ = FindNotificationDetails( 180 last_search_result_ = FindNotificationDetails(
180 request_id, number_of_matches, selection, active_match_ordinal, 181 request_id, number_of_matches, selection, active_match_ordinal,
181 final_update); 182 final_update, was_frame_removal);
182 content::NotificationService::current()->Notify( 183 content::NotificationService::current()->Notify(
183 chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, 184 chrome::NOTIFICATION_FIND_RESULT_AVAILABLE,
184 content::Source<WebContents>(web_contents()), 185 content::Source<WebContents>(web_contents()),
185 content::Details<FindNotificationDetails>(&last_search_result_)); 186 content::Details<FindNotificationDetails>(&last_search_result_));
186 } 187 }
187 } 188 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/find_bar/find_tab_helper.h ('k') | components/guest_view/browser/guest_view_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698