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

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

Issue 2236403004: 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: Rebased and updated comment. Created 4 years, 2 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 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 blink::WebFindOptions options; 96 blink::WebFindOptions options;
97 97
98 FindRequest() = default; 98 FindRequest() = default;
99 FindRequest(int id, 99 FindRequest(int id,
100 const base::string16& search_text, 100 const base::string16& search_text,
101 const blink::WebFindOptions& options) 101 const blink::WebFindOptions& options)
102 : id(id), search_text(search_text), options(options) {} 102 : id(id), search_text(search_text), options(options) {}
103 }; 103 };
104 104
105 // WebContentsObserver implementation. 105 // WebContentsObserver implementation.
106 void DidFinishLoad(RenderFrameHost* rfh, const GURL& validated_url) override;
106 void RenderFrameDeleted(RenderFrameHost* rfh) override; 107 void RenderFrameDeleted(RenderFrameHost* rfh) override;
107 void RenderFrameHostChanged(RenderFrameHost* old_host, 108 void RenderFrameHostChanged(RenderFrameHost* old_host,
108 RenderFrameHost* new_host) override; 109 RenderFrameHost* new_host) override;
109 void FrameDeleted(RenderFrameHost* rfh) override; 110 void FrameDeleted(RenderFrameHost* rfh) override;
110 111
111 // Resets all of the per-session state for a new find-in-page session. 112 // Resets all of the per-session state for a new find-in-page session.
112 void Reset(const FindRequest& initial_request); 113 void Reset(const FindRequest& initial_request);
113 114
114 // Called internally as find requests come up in the queue. 115 // Called internally as find requests come up in the queue.
115 void FindInternal(const FindRequest& request); 116 void FindInternal(const FindRequest& request);
(...skipping 22 matching lines...) Expand all
138 // then the traversal can wrap around past the last frame to the first one (or 139 // then the traversal can wrap around past the last frame to the first one (or
139 // vice-versa, if |forward| == false). If no frame can be found under these 140 // vice-versa, if |forward| == false). If no frame can be found under these
140 // conditions, nullptr is returned. 141 // conditions, nullptr is returned.
141 RenderFrameHost* Traverse(RenderFrameHost* from_rfh, 142 RenderFrameHost* Traverse(RenderFrameHost* from_rfh,
142 bool forward, 143 bool forward,
143 bool matches_only, 144 bool matches_only,
144 bool wrap) const; 145 bool wrap) const;
145 146
146 // Adds a frame to the set of frames that are being searched. The new frame 147 // Adds a frame to the set of frames that are being searched. The new frame
147 // will automatically be searched when added, using the same options (stored 148 // will automatically be searched when added, using the same options (stored
148 // in |current_request_.options|). 149 // in |current_request_.options|). |force| should be set to true when a
149 void AddFrame(RenderFrameHost* rfh); 150 // dynamic content change is suspected, which will treat the frame as a newly
151 // added frame even if it has already been searched. This will force a
152 // re-search of the frame.
153 void AddFrame(RenderFrameHost* rfh, bool force);
150 154
151 // Returns whether |rfh| is in the set of frames being searched in the current 155 // Returns whether |rfh| is in the set of frames being searched in the current
152 // find session. 156 // find session.
153 bool CheckFrame(RenderFrameHost* rfh) const; 157 bool CheckFrame(RenderFrameHost* rfh) const;
154 158
155 // Computes and updates |active_match_ordinal_| based on |active_frame_| and 159 // Computes and updates |active_match_ordinal_| based on |active_frame_| and
156 // |relative_active_match_ordinal_|. 160 // |relative_active_match_ordinal_|.
157 void UpdateActiveMatchOrdinal(); 161 void UpdateActiveMatchOrdinal();
158 162
159 // Called when all pending find replies have been received for the find 163 // Called when all pending find replies have been received for the find
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 std::queue<FindRequest> find_request_queue_; 304 std::queue<FindRequest> find_request_queue_;
301 305
302 // Keeps track of the find request ID of the last find reply reported via 306 // Keeps track of the find request ID of the last find reply reported via
303 // NotifyFindReply(). 307 // NotifyFindReply().
304 int last_reported_id_; 308 int last_reported_id_;
305 }; 309 };
306 310
307 } // namespace content 311 } // namespace content
308 312
309 #endif // CONTENT_BROWSER_FIND_REQUEST_MANAGER_H_ 313 #endif // CONTENT_BROWSER_FIND_REQUEST_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698