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 "chrome/browser/guest_view/web_view/web_view_find_helper.h" | 5 #include "chrome/browser/guest_view/web_view/web_view_find_helper.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "chrome/browser/extensions/api/web_view/web_view_internal_api.h" | 9 #include "chrome/browser/extensions/api/web_view/web_view_internal_api.h" |
10 #include "chrome/browser/guest_view/web_view/web_view_constants.h" | 10 #include "chrome/browser/guest_view/web_view/web_view_constants.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 } | 28 } |
29 | 29 |
30 void WebViewFindHelper::DispatchFindUpdateEvent(bool canceled, | 30 void WebViewFindHelper::DispatchFindUpdateEvent(bool canceled, |
31 bool final_update) { | 31 bool final_update) { |
32 DCHECK(find_update_event_.get()); | 32 DCHECK(find_update_event_.get()); |
33 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 33 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
34 find_update_event_->PrepareResults(args.get()); | 34 find_update_event_->PrepareResults(args.get()); |
35 args->SetBoolean(webview::kFindCanceled, canceled); | 35 args->SetBoolean(webview::kFindCanceled, canceled); |
36 args->SetBoolean(webview::kFindFinalUpdate, final_update); | 36 args->SetBoolean(webview::kFindFinalUpdate, final_update); |
37 DCHECK(webview_guest_); | 37 DCHECK(webview_guest_); |
38 webview_guest_->DispatchEvent( | 38 webview_guest_->DispatchEventToEmbedder( |
39 new GuestViewBase::Event(webview::kEventFindReply, args.Pass())); | 39 new GuestViewBase::Event(webview::kEventFindReply, args.Pass())); |
40 } | 40 } |
41 | 41 |
42 void WebViewFindHelper::EndFindSession(int session_request_id, bool canceled) { | 42 void WebViewFindHelper::EndFindSession(int session_request_id, bool canceled) { |
43 FindInfoMap::iterator session_iterator = | 43 FindInfoMap::iterator session_iterator = |
44 find_info_map_.find(session_request_id); | 44 find_info_map_.find(session_request_id); |
45 DCHECK(session_iterator != find_info_map_.end()); | 45 DCHECK(session_iterator != find_info_map_.end()); |
46 FindInfo* find_info = session_iterator->second.get(); | 46 FindInfo* find_info = session_iterator->second.get(); |
47 | 47 |
48 // Call the callback function of the first request of the find session. | 48 // Call the callback function of the first request of the find session. |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 void WebViewFindHelper::FindInfo::SendResponse(bool canceled) { | 269 void WebViewFindHelper::FindInfo::SendResponse(bool canceled) { |
270 // Prepare the find results to pass to the callback function. | 270 // Prepare the find results to pass to the callback function. |
271 base::DictionaryValue results; | 271 base::DictionaryValue results; |
272 find_results_.PrepareResults(&results); | 272 find_results_.PrepareResults(&results); |
273 results.SetBoolean(webview::kFindCanceled, canceled); | 273 results.SetBoolean(webview::kFindCanceled, canceled); |
274 | 274 |
275 // Call the callback. | 275 // Call the callback. |
276 find_function_->SetResult(results.DeepCopy()); | 276 find_function_->SetResult(results.DeepCopy()); |
277 find_function_->SendResponse(true); | 277 find_function_->SendResponse(true); |
278 } | 278 } |
OLD | NEW |