Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: extensions/browser/guest_view/web_view/web_view_find_helper.cc

Issue 579563002: Find working in app_shell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase+cleanup Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/web_view/web_view_internal_api.h" 9 #include "extensions/browser/api/web_view/web_view_internal_api.h"
10 #include "extensions/browser/guest_view/web_view/web_view_constants.h" 10 #include "extensions/browser/guest_view/web_view/web_view_constants.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 (*i)->SendResponse(canceled); 77 (*i)->SendResponse(canceled);
78 find_info_map_.erase((*i)->request_id_); 78 find_info_map_.erase((*i)->request_id_);
79 } 79 }
80 80
81 // Erase the first find request's map entry to free the 81 // Erase the first find request's map entry to free the
82 // WebViewInternalFindFunction 82 // WebViewInternalFindFunction
83 // object. 83 // object.
84 find_info_map_.erase(session_request_id); 84 find_info_map_.erase(session_request_id);
85 } 85 }
86 86
87 void WebViewFindHelper::Find( 87 void WebViewFindHelper::Find(content::WebContents* guest_web_contents,
88 content::WebContents* guest_web_contents, 88 const base::string16& search_text,
89 const base::string16& search_text, 89 const blink::WebFindOptions& options,
90 const blink::WebFindOptions& options, 90 WebViewInternalFindFunction* find_function) {
Fady Samuel 2014/09/18 16:49:48 Why are you making this change?
91 scoped_refptr<WebViewInternalFindFunction> find_function) {
92 // Need a new request_id for each new find request. 91 // Need a new request_id for each new find request.
93 ++current_find_request_id_; 92 ++current_find_request_id_;
94 93
95 // Stores the find request information by request_id so that its callback 94 // Stores the find request information by request_id so that its callback
96 // function can be called when the find results are available. 95 // function can be called when the find results are available.
97 std::pair<FindInfoMap::iterator, bool> insert_result = 96 std::pair<FindInfoMap::iterator, bool> insert_result =
98 find_info_map_.insert(std::make_pair( 97 find_info_map_.insert(std::make_pair(
99 current_find_request_id_, 98 current_find_request_id_,
100 linked_ptr< 99 linked_ptr<
101 WebViewFindHelper::FindInfo>(new WebViewFindHelper::FindInfo( 100 WebViewFindHelper::FindInfo>(new WebViewFindHelper::FindInfo(
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 void WebViewFindHelper::FindUpdateEvent::PrepareResults( 233 void WebViewFindHelper::FindUpdateEvent::PrepareResults(
235 base::DictionaryValue* results) { 234 base::DictionaryValue* results) {
236 results->SetString(webview::kFindSearchText, search_text_); 235 results->SetString(webview::kFindSearchText, search_text_);
237 find_results_.PrepareResults(results); 236 find_results_.PrepareResults(results);
238 } 237 }
239 238
240 WebViewFindHelper::FindInfo::FindInfo( 239 WebViewFindHelper::FindInfo::FindInfo(
241 int request_id, 240 int request_id,
242 const base::string16& search_text, 241 const base::string16& search_text,
243 const blink::WebFindOptions& options, 242 const blink::WebFindOptions& options,
244 scoped_refptr<WebViewInternalFindFunction> find_function) 243 WebViewInternalFindFunction* find_function)
245 : request_id_(request_id), 244 : request_id_(request_id),
246 search_text_(search_text), 245 search_text_(search_text),
247 options_(options), 246 options_(options),
248 find_function_(find_function), 247 find_function_(find_function),
249 replied_(false), 248 replied_(false),
250 weak_ptr_factory_(this) { 249 weak_ptr_factory_(this) {
251 } 250 }
252 251
253 WebViewFindHelper::FindInfo::~FindInfo() { 252 WebViewFindHelper::FindInfo::~FindInfo() {
254 } 253 }
(...skipping 18 matching lines...) Expand all
273 base::DictionaryValue results; 272 base::DictionaryValue results;
274 find_results_.PrepareResults(&results); 273 find_results_.PrepareResults(&results);
275 results.SetBoolean(webview::kFindCanceled, canceled); 274 results.SetBoolean(webview::kFindCanceled, canceled);
276 275
277 // Call the callback. 276 // Call the callback.
278 find_function_->SetResult(results.DeepCopy()); 277 find_function_->SetResult(results.DeepCopy());
279 find_function_->SendResponse(true); 278 find_function_->SendResponse(true);
280 } 279 }
281 280
282 } // namespace extensions 281 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698