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 "extensions/browser/api/guest_view/web_view/web_view_internal_api.h" | 9 #include "extensions/browser/api/guest_view/web_view/web_view_internal_api.h" |
| 10 #include "extensions/browser/guest_view/guest_view_event.h" |
10 #include "extensions/browser/guest_view/web_view/web_view_constants.h" | 11 #include "extensions/browser/guest_view/web_view/web_view_constants.h" |
11 | 12 |
12 namespace extensions { | 13 namespace extensions { |
13 | 14 |
14 WebViewFindHelper::WebViewFindHelper(WebViewGuest* webview_guest) | 15 WebViewFindHelper::WebViewFindHelper(WebViewGuest* webview_guest) |
15 : webview_guest_(webview_guest), current_find_request_id_(0) { | 16 : webview_guest_(webview_guest), current_find_request_id_(0) { |
16 } | 17 } |
17 | 18 |
18 WebViewFindHelper::~WebViewFindHelper() { | 19 WebViewFindHelper::~WebViewFindHelper() { |
19 } | 20 } |
(...skipping 11 matching lines...) Expand all Loading... |
31 | 32 |
32 void WebViewFindHelper::DispatchFindUpdateEvent(bool canceled, | 33 void WebViewFindHelper::DispatchFindUpdateEvent(bool canceled, |
33 bool final_update) { | 34 bool final_update) { |
34 DCHECK(find_update_event_.get()); | 35 DCHECK(find_update_event_.get()); |
35 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 36 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
36 find_update_event_->PrepareResults(args.get()); | 37 find_update_event_->PrepareResults(args.get()); |
37 args->SetBoolean(webview::kFindCanceled, canceled); | 38 args->SetBoolean(webview::kFindCanceled, canceled); |
38 args->SetBoolean(webview::kFindFinalUpdate, final_update); | 39 args->SetBoolean(webview::kFindFinalUpdate, final_update); |
39 DCHECK(webview_guest_); | 40 DCHECK(webview_guest_); |
40 webview_guest_->DispatchEventToView( | 41 webview_guest_->DispatchEventToView( |
41 new GuestViewBase::Event(webview::kEventFindReply, args.Pass())); | 42 new GuestViewEvent(webview::kEventFindReply, args.Pass())); |
42 } | 43 } |
43 | 44 |
44 void WebViewFindHelper::EndFindSession(int session_request_id, bool canceled) { | 45 void WebViewFindHelper::EndFindSession(int session_request_id, bool canceled) { |
45 FindInfoMap::iterator session_iterator = | 46 FindInfoMap::iterator session_iterator = |
46 find_info_map_.find(session_request_id); | 47 find_info_map_.find(session_request_id); |
47 DCHECK(session_iterator != find_info_map_.end()); | 48 DCHECK(session_iterator != find_info_map_.end()); |
48 FindInfo* find_info = session_iterator->second.get(); | 49 FindInfo* find_info = session_iterator->second.get(); |
49 | 50 |
50 // Call the callback function of the first request of the find session. | 51 // Call the callback function of the first request of the find session. |
51 find_info->SendResponse(canceled); | 52 find_info->SendResponse(canceled); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 base::DictionaryValue results; | 274 base::DictionaryValue results; |
274 find_results_.PrepareResults(&results); | 275 find_results_.PrepareResults(&results); |
275 results.SetBoolean(webview::kFindCanceled, canceled); | 276 results.SetBoolean(webview::kFindCanceled, canceled); |
276 | 277 |
277 // Call the callback. | 278 // Call the callback. |
278 find_function_->SetResult(results.DeepCopy()); | 279 find_function_->SetResult(results.DeepCopy()); |
279 find_function_->SendResponse(true); | 280 find_function_->SendResponse(true); |
280 } | 281 } |
281 | 282 |
282 } // namespace extensions | 283 } // namespace extensions |
OLD | NEW |