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

Side by Side Diff: content/browser/find_request_manager.h

Issue 2249133002: Changes to how FindRequestManager reports find results. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Expanded comment for FinalUpdate(), and renamed to FinalUpdateReceived(). 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/find_request_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 CONTENT_BROWSER_FIND_REQUEST_MANAGER_H_ 5 #ifndef CONTENT_BROWSER_FIND_REQUEST_MANAGER_H_
6 #define CONTENT_BROWSER_FIND_REQUEST_MANAGER_H_ 6 #define CONTENT_BROWSER_FIND_REQUEST_MANAGER_H_
7 7
8 #include <queue> 8 #include <queue>
9 #include <unordered_map> 9 #include <unordered_map>
10 #include <unordered_set> 10 #include <unordered_set>
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // Called when an informative response (a response with enough information to 117 // Called when an informative response (a response with enough information to
118 // be able to route subsequent find requests) comes in for the find request 118 // be able to route subsequent find requests) comes in for the find request
119 // with ID |request_id|. Advances the |find_request_queue_| if appropriate. 119 // with ID |request_id|. Advances the |find_request_queue_| if appropriate.
120 void AdvanceQueue(int request_id); 120 void AdvanceQueue(int request_id);
121 121
122 // Sends a find IPC containing the find request |request| to the RenderFrame 122 // Sends a find IPC containing the find request |request| to the RenderFrame
123 // associated with |rfh|. 123 // associated with |rfh|.
124 void SendFindIPC(const FindRequest& request, RenderFrameHost* rfh); 124 void SendFindIPC(const FindRequest& request, RenderFrameHost* rfh);
125 125
126 // Sends the find results (as they currently are) to the WebContents. 126 // Sends the find results (as they currently are) to the WebContents.
127 void NotifyFindReply(int request_id, bool final_update) const; 127 void NotifyFindReply(int request_id, bool final_update);
128 128
129 // Returns the initial frame in search order. This will be either the first 129 // Returns the initial frame in search order. This will be either the first
130 // frame, if searching forward, or the last frame, if searching backward. 130 // frame, if searching forward, or the last frame, if searching backward.
131 RenderFrameHost* GetInitialFrame(bool forward) const; 131 RenderFrameHost* GetInitialFrame(bool forward) const;
132 132
133 // Traverses the frame tree to find and return the next RenderFrameHost after 133 // Traverses the frame tree to find and return the next RenderFrameHost after
134 // |from_rfh| in search order. |forward| indicates whether the frame tree 134 // |from_rfh| in search order. |forward| indicates whether the frame tree
135 // should be traversed forward (if true) or backward (if false). If 135 // should be traversed forward (if true) or backward (if false). If
136 // |matches_only| is set, then the frame tree will be traversed until the 136 // |matches_only| is set, then the frame tree will be traversed until the
137 // first frame is found for which matches have been found. If |wrap| is set, 137 // first frame is found for which matches have been found. If |wrap| is set,
(...skipping 13 matching lines...) Expand all
151 // Returns whether |rfh| is in the set of frames being searched in the current 151 // Returns whether |rfh| is in the set of frames being searched in the current
152 // find session. 152 // find session.
153 bool CheckFrame(RenderFrameHost* rfh) const; 153 bool CheckFrame(RenderFrameHost* rfh) const;
154 154
155 // Computes and updates |active_match_ordinal_| based on |active_frame_| and 155 // Computes and updates |active_match_ordinal_| based on |active_frame_| and
156 // |relative_active_match_ordinal_|. 156 // |relative_active_match_ordinal_|.
157 void UpdateActiveMatchOrdinal(); 157 void UpdateActiveMatchOrdinal();
158 158
159 // Called when all pending find replies have been received for the find 159 // Called when all pending find replies have been received for the find
160 // request with ID |request_id|. The final update was received from |rfh|. 160 // request with ID |request_id|. The final update was received from |rfh|.
161 void FinalUpdate(int request_id, RenderFrameHost* rfh); 161 //
162 // Note that this is the final update for this particular find request, but
163 // not necessarily for all issued requests. If there are still pending replies
164 // expected for a previous find request, then the outgoing find reply issued
165 // from this function will not be marked final.
166 void FinalUpdateReceived(int request_id, RenderFrameHost* rfh);
162 167
163 #if defined(OS_ANDROID) 168 #if defined(OS_ANDROID)
164 // Called when a nearest find result reply is no longer pending for a frame. 169 // Called when a nearest find result reply is no longer pending for a frame.
165 void RemoveNearestFindResultPendingReply(RenderFrameHost* rfh); 170 void RemoveNearestFindResultPendingReply(RenderFrameHost* rfh);
166 171
167 // Called when a find match rects reply is no longer pending for a frame. 172 // Called when a find match rects reply is no longer pending for a frame.
168 void RemoveFindMatchRectsPendingReply(RenderFrameHost* rfh); 173 void RemoveFindMatchRectsPendingReply(RenderFrameHost* rfh);
169 174
170 // State related to ActivateNearestFindResult requests. 175 // State related to ActivateNearestFindResult requests.
171 struct ActivateNearestFindResultState { 176 struct ActivateNearestFindResultState {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 // The request ID of the initial find request in the current find-in-page 250 // The request ID of the initial find request in the current find-in-page
246 // session, which uniquely identifies this session. Request IDs are included 251 // session, which uniquely identifies this session. Request IDs are included
247 // in all find-related IPCs, which allows reply IPCs containing results from 252 // in all find-related IPCs, which allows reply IPCs containing results from
248 // previous sessions (with |request_id| < |current_session_id_|) to be easily 253 // previous sessions (with |request_id| < |current_session_id_|) to be easily
249 // identified and ignored. 254 // identified and ignored.
250 int current_session_id_; 255 int current_session_id_;
251 256
252 // The current find request. 257 // The current find request.
253 FindRequest current_request_; 258 FindRequest current_request_;
254 259
255 // The set of frames that are still expected to reply to a pending find 260 // The set of frames that are still expected to reply to a pending initial
256 // request. Frames are removed from |pending_replies_| when their reply with 261 // find request. Frames are removed from |pending_initial_replies_| when their
257 // |final_update| set to true is received. 262 // reply to the initial find request is received with |final_update| set to
258 std::unordered_set<RenderFrameHost*> pending_replies_; 263 // true.
264 std::unordered_set<RenderFrameHost*> pending_initial_replies_;
265
266 // The frame (if any) that is still expected to reply to the last pending
267 // "find next" request.
268 RenderFrameHost* pending_find_next_reply_;
259 269
260 // Indicates whether an update to the active match ordinal is expected. Once 270 // Indicates whether an update to the active match ordinal is expected. Once
261 // set, |pending_active_match_ordinal_| will not reset until an update to the 271 // set, |pending_active_match_ordinal_| will not reset until an update to the
262 // active match ordinal is received in response to the find request with ID 272 // active match ordinal is received in response to the find request with ID
263 // |current_request_.id| (the latest request). 273 // |current_request_.id| (the latest request).
264 bool pending_active_match_ordinal_; 274 bool pending_active_match_ordinal_;
265 275
266 // The number of matches found in each frame. There will necessarily be 276 // The number of matches found in each frame. There will necessarily be
267 // entries in this map for every frame that is being (or has been) searched in 277 // entries in this map for every frame that is being (or has been) searched in
268 // the current find session, and no other frames. 278 // the current find session, and no other frames.
(...skipping 12 matching lines...) Expand all
281 291
282 // The overall active match ordinal for the current find-in-page session. 292 // The overall active match ordinal for the current find-in-page session.
283 int active_match_ordinal_; 293 int active_match_ordinal_;
284 294
285 // The rectangle around the active match, in screen coordinates. 295 // The rectangle around the active match, in screen coordinates.
286 gfx::Rect selection_rect_; 296 gfx::Rect selection_rect_;
287 297
288 // Find requests are queued here when previous requests need to be handled 298 // Find requests are queued here when previous requests need to be handled
289 // before these ones can be properly routed. 299 // before these ones can be properly routed.
290 std::queue<FindRequest> find_request_queue_; 300 std::queue<FindRequest> find_request_queue_;
301
302 // Keeps track of the find request ID of the last find reply reported via
303 // NotifyFindReply().
304 int last_reported_id_;
291 }; 305 };
292 306
293 } // namespace content 307 } // namespace content
294 308
295 #endif // CONTENT_BROWSER_FIND_REQUEST_MANAGER_H_ 309 #endif // CONTENT_BROWSER_FIND_REQUEST_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/find_request_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698