OLD | NEW |
---|---|
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 Loading... | |
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_.get()) |
dcheng
2016/04/04 18:59:52
Nit: no .get()
paulmeyer
2016/04/04 20:07:47
Done.
| |
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 Loading... | |
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 |
OLD | NEW |