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 "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "components/guest_view/browser/guest_view_event.h" | 10 #include "components/guest_view/browser/guest_view_event.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
214 | 214 |
215 void WebViewFindHelper::FindResults::PrepareResults( | 215 void WebViewFindHelper::FindResults::PrepareResults( |
216 base::DictionaryValue* results) { | 216 base::DictionaryValue* results) { |
217 results->SetInteger(webview::kFindNumberOfMatches, number_of_matches_); | 217 results->SetInteger(webview::kFindNumberOfMatches, number_of_matches_); |
218 results->SetInteger(webview::kFindActiveMatchOrdinal, active_match_ordinal_); | 218 results->SetInteger(webview::kFindActiveMatchOrdinal, active_match_ordinal_); |
219 base::DictionaryValue rect; | 219 base::DictionaryValue rect; |
220 rect.SetInteger(webview::kFindRectLeft, selection_rect_.x()); | 220 rect.SetInteger(webview::kFindRectLeft, selection_rect_.x()); |
221 rect.SetInteger(webview::kFindRectTop, selection_rect_.y()); | 221 rect.SetInteger(webview::kFindRectTop, selection_rect_.y()); |
222 rect.SetInteger(webview::kFindRectWidth, selection_rect_.width()); | 222 rect.SetInteger(webview::kFindRectWidth, selection_rect_.width()); |
223 rect.SetInteger(webview::kFindRectHeight, selection_rect_.height()); | 223 rect.SetInteger(webview::kFindRectHeight, selection_rect_.height()); |
224 results->Set(webview::kFindSelectionRect, rect.DeepCopy()); | 224 results->Set(webview::kFindSelectionRect, |
225 base::MakeUnique<base::Value>(rect)); | |
Devlin
2017/06/02 15:38:48
This was wrong before, but let's fix it :)
|rect|
vabr (Chromium)
2017/06/03 11:14:52
My suggestion is to keep |rect| just a DictionaryV
Devlin
2017/06/05 13:27:33
That's fine, too - either way, we avoid the copy,
jdoerrie
2017/06/06 12:40:23
I added a call to std::move to avoid the copy here
| |
225 } | 226 } |
226 | 227 |
227 WebViewFindHelper::FindUpdateEvent::FindUpdateEvent( | 228 WebViewFindHelper::FindUpdateEvent::FindUpdateEvent( |
228 const base::string16& search_text) | 229 const base::string16& search_text) |
229 : search_text_(search_text) { | 230 : search_text_(search_text) { |
230 } | 231 } |
231 | 232 |
232 WebViewFindHelper::FindUpdateEvent::~FindUpdateEvent() { | 233 WebViewFindHelper::FindUpdateEvent::~FindUpdateEvent() { |
233 } | 234 } |
234 | 235 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
282 results.SetBoolean(webview::kFindCanceled, canceled); | 283 results.SetBoolean(webview::kFindCanceled, canceled); |
283 | 284 |
284 // Call the callback. | 285 // Call the callback. |
285 find_function_->SetResult(results.CreateDeepCopy()); | 286 find_function_->SetResult(results.CreateDeepCopy()); |
286 find_function_->SendResponse(true); | 287 find_function_->SendResponse(true); |
287 } | 288 } |
288 | 289 |
289 WebViewFindHelper::FindInfo::~FindInfo() {} | 290 WebViewFindHelper::FindInfo::~FindInfo() {} |
290 | 291 |
291 } // namespace extensions | 292 } // namespace extensions |
OLD | NEW |