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

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

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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_UI_FIND_BAR_FIND_TAB_HELPER_H_ 5 #ifndef CHROME_BROWSER_UI_FIND_BAR_FIND_TAB_HELPER_H_
6 #define CHROME_BROWSER_UI_FIND_BAR_FIND_TAB_HELPER_H_ 6 #define CHROME_BROWSER_UI_FIND_BAR_FIND_TAB_HELPER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/browser/ui/find_bar/find_bar_controller.h" 10 #include "chrome/browser/ui/find_bar/find_bar_controller.h"
11 #include "chrome/browser/ui/find_bar/find_notification_details.h" 11 #include "chrome/browser/ui/find_bar/find_notification_details.h"
12 #include "content/public/browser/web_contents_observer.h" 12 #include "content/public/browser/web_contents_observer.h"
13 #include "content/public/browser/web_contents_user_data.h" 13 #include "content/public/browser/web_contents_user_data.h"
14 #include "ui/gfx/range/range.h" 14 #include "ui/gfx/range/range.h"
15 15
16 // Per-tab find manager. Handles dealing with the life cycle of find sessions. 16 // Per-tab find manager. Handles dealing with the life cycle of find sessions.
17 class FindTabHelper : public content::WebContentsObserver, 17 class FindTabHelper : public content::WebContentsObserver,
18 public content::WebContentsUserData<FindTabHelper> { 18 public content::WebContentsUserData<FindTabHelper> {
19 public: 19 public:
20 ~FindTabHelper() override; 20 ~FindTabHelper() override;
21 21
22 // Starts the Find operation by calling StartFinding on the Tab. This function 22 // Starts the Find operation by calling StartFinding on the Tab. This function
23 // can be called from the outside as a result of hot-keys, so it uses the 23 // can be called from the outside as a result of hot-keys, so if
24 // last remembered search string as specified with set_find_string(). This 24 // |search_string| is null, it finds the last remembered search string. This
25 // function does not block while a search is in progress. The controller will 25 // function does not block while a search is in progress. The controller will
26 // receive the results through the notification mechanism. See Observe(...) 26 // receive the results through the notification mechanism. See Observe(...)
27 // for details. 27 // for details.
28 void StartFinding(base::string16 search_string, 28 void StartFinding(base::string16 search_string,
29 bool forward_direction, 29 bool forward_direction,
30 bool case_sensitive); 30 bool case_sensitive);
31 31
32 // Stops the current Find operation. 32 // Stops the current Find operation.
33 void StopFinding(FindBarController::SelectionAction selection_action); 33 void StopFinding(FindBarController::SelectionAction selection_action);
34 34
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // inactive matches can be repainted. 105 // inactive matches can be repainted.
106 bool find_op_aborted_; 106 bool find_op_aborted_;
107 107
108 // This variable keeps track of what the most recent request ID is. 108 // This variable keeps track of what the most recent request ID is.
109 int current_find_request_id_; 109 int current_find_request_id_;
110 110
111 // This variable keeps track of the ID of the first find request in the 111 // This variable keeps track of the ID of the first find request in the
112 // current session, which also uniquely identifies the session. 112 // current session, which also uniquely identifies the session.
113 int current_find_session_id_; 113 int current_find_session_id_;
114 114
115 // True if HandleFindReply has received a |final_update| notification for the
116 // current request.
117 bool final_update_received_for_current_query_;
118
115 // The current string we are/just finished searching for. This is used to 119 // The current string we are/just finished searching for. This is used to
116 // figure out if this is a Find or a FindNext operation (FindNext should not 120 // figure out if this is a Find or a FindNext operation (FindNext should not
117 // increase the request id). 121 // increase the request id).
118 base::string16 find_text_; 122 base::string16 find_text_;
119 123
120 // The string we searched for before |find_text_|. 124 // The string we searched for before |find_text_|.
121 base::string16 previous_find_text_; 125 base::string16 previous_find_text_;
122 126
123 // The selection within the text. 127 // The selection within the text.
124 gfx::Range selected_range_; 128 gfx::Range selected_range_;
125 129
126 // Whether the last search was case sensitive or not. 130 // Whether the last search was case sensitive or not.
127 bool last_search_case_sensitive_; 131 bool last_search_case_sensitive_;
128 132
129 // The last find result. This object contains details about the number of 133 // The last find result. This object contains details about the number of
130 // matches, the find selection rectangle, etc. The UI can access this 134 // matches, the find selection rectangle, etc. The UI can access this
131 // information to build its presentation. 135 // information to build its presentation.
132 FindNotificationDetails last_search_result_; 136 FindNotificationDetails last_search_result_;
133 137
134 DISALLOW_COPY_AND_ASSIGN(FindTabHelper); 138 DISALLOW_COPY_AND_ASSIGN(FindTabHelper);
135 }; 139 };
136 140
137 #endif // CHROME_BROWSER_UI_FIND_BAR_FIND_TAB_HELPER_H_ 141 #endif // CHROME_BROWSER_UI_FIND_BAR_FIND_TAB_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/find_bar/find_bar_controller.cc ('k') | chrome/browser/ui/find_bar/find_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698