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

Side by Side Diff: extensions/browser/guest_view/web_view/web_view_find_helper.cc

Issue 1851793002: Implement a shell of FindRequestManager, and hook it up to WebContentsImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased and small fix. Created 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/guest_view/web_view/web_view_find_helper.h" 5 #include "extensions/browser/guest_view/web_view/web_view_find_helper.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "components/guest_view/browser/guest_view_event.h" 9 #include "components/guest_view/browser/guest_view_event.h"
10 #include "extensions/browser/api/guest_view/web_view/web_view_internal_api.h" 10 #include "extensions/browser/api/guest_view/web_view/web_view_internal_api.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 FindInfoMap::iterator find_iterator = find_info_map_.find(request_id); 150 FindInfoMap::iterator find_iterator = find_info_map_.find(request_id);
151 151
152 // Ignore slow replies to canceled find requests. 152 // Ignore slow replies to canceled find requests.
153 if (find_iterator == find_info_map_.end()) 153 if (find_iterator == find_info_map_.end())
154 return; 154 return;
155 155
156 // This find request must be a part of an existing find session. 156 // This find request must be a part of an existing find session.
157 DCHECK(current_find_session_); 157 DCHECK(current_find_session_);
158 158
159 WebViewFindHelper::FindInfo* find_info = find_iterator->second.get(); 159 WebViewFindHelper::FindInfo* find_info = find_iterator->second.get();
160
161 // Handle canceled find requests. 160 // Handle canceled find requests.
162 if (!find_info->options()->findNext && 161 if (!find_info->options()->findNext &&
163 find_info_map_.begin()->first < request_id) { 162 find_info_map_.begin()->first < request_id) {
164 DCHECK_NE(current_find_session_->request_id(), 163 DCHECK_NE(current_find_session_->request_id(),
165 find_info_map_.begin()->first); 164 find_info_map_.begin()->first);
166 DispatchFindUpdateEvent(true /* canceled */, true /* final_update */); 165 if (find_update_event_)
166 DispatchFindUpdateEvent(true /* canceled */, true /* final_update */);
167 EndFindSession(find_info_map_.begin()->first, true /* canceled */); 167 EndFindSession(find_info_map_.begin()->first, true /* canceled */);
168 } 168 }
169 169
170 // Clears the results for |findupdate| for a new find session. 170 // Clears the results for |findupdate| for a new find session.
171 if (!find_info->replied() && !find_info->options()->findNext) 171 if (!find_info->replied() && !find_info->options()->findNext)
172 find_update_event_.reset(new FindUpdateEvent(find_info->search_text())); 172 find_update_event_.reset(new FindUpdateEvent(find_info->search_text()));
173 173
174 // Aggregate the find results. 174 // Aggregate the find results.
175 find_info->AggregateResults(number_of_matches, selection_rect, 175 find_info->AggregateResults(number_of_matches, selection_rect,
176 active_match_ordinal, final_update); 176 active_match_ordinal, final_update);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 results.SetBoolean(webview::kFindCanceled, canceled); 281 results.SetBoolean(webview::kFindCanceled, canceled);
282 282
283 // Call the callback. 283 // Call the callback.
284 find_function_->SetResult(results.DeepCopy()); 284 find_function_->SetResult(results.DeepCopy());
285 find_function_->SendResponse(true); 285 find_function_->SendResponse(true);
286 } 286 }
287 287
288 WebViewFindHelper::FindInfo::~FindInfo() {} 288 WebViewFindHelper::FindInfo::~FindInfo() {}
289 289
290 } // namespace extensions 290 } // namespace extensions
OLDNEW
« no previous file with comments | « content/public/browser/web_contents.h ('k') | extensions/browser/guest_view/web_view/web_view_guest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698