| 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 23 matching lines...) Expand all Loading... |
| 34 } | 34 } |
| 35 | 35 |
| 36 void WebViewFindHelper::DispatchFindUpdateEvent(bool canceled, | 36 void WebViewFindHelper::DispatchFindUpdateEvent(bool canceled, |
| 37 bool final_update) { | 37 bool final_update) { |
| 38 DCHECK(find_update_event_.get()); | 38 DCHECK(find_update_event_.get()); |
| 39 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 39 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
| 40 find_update_event_->PrepareResults(args.get()); | 40 find_update_event_->PrepareResults(args.get()); |
| 41 args->SetBoolean(webview::kFindCanceled, canceled); | 41 args->SetBoolean(webview::kFindCanceled, canceled); |
| 42 args->SetBoolean(webview::kFindFinalUpdate, final_update); | 42 args->SetBoolean(webview::kFindFinalUpdate, final_update); |
| 43 DCHECK(webview_guest_); | 43 DCHECK(webview_guest_); |
| 44 webview_guest_->DispatchEventToView(base::WrapUnique( | 44 webview_guest_->DispatchEventToView(base::MakeUnique<GuestViewEvent>( |
| 45 new GuestViewEvent(webview::kEventFindReply, std::move(args)))); | 45 webview::kEventFindReply, std::move(args))); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void WebViewFindHelper::EndFindSession(int session_request_id, bool canceled) { | 48 void WebViewFindHelper::EndFindSession(int session_request_id, bool canceled) { |
| 49 FindInfoMap::iterator session_iterator = | 49 FindInfoMap::iterator session_iterator = |
| 50 find_info_map_.find(session_request_id); | 50 find_info_map_.find(session_request_id); |
| 51 DCHECK(session_iterator != find_info_map_.end()); | 51 DCHECK(session_iterator != find_info_map_.end()); |
| 52 FindInfo* find_info = session_iterator->second.get(); | 52 FindInfo* find_info = session_iterator->second.get(); |
| 53 | 53 |
| 54 // Call the callback function of the first request of the find session. | 54 // Call the callback function of the first request of the find session. |
| 55 find_info->SendResponse(canceled); | 55 find_info->SendResponse(canceled); |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 results.SetBoolean(webview::kFindCanceled, canceled); | 282 results.SetBoolean(webview::kFindCanceled, canceled); |
| 283 | 283 |
| 284 // Call the callback. | 284 // Call the callback. |
| 285 find_function_->SetResult(results.CreateDeepCopy()); | 285 find_function_->SetResult(results.CreateDeepCopy()); |
| 286 find_function_->SendResponse(true); | 286 find_function_->SendResponse(true); |
| 287 } | 287 } |
| 288 | 288 |
| 289 WebViewFindHelper::FindInfo::~FindInfo() {} | 289 WebViewFindHelper::FindInfo::~FindInfo() {} |
| 290 | 290 |
| 291 } // namespace extensions | 291 } // namespace extensions |
| OLD | NEW |