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

Side by Side Diff: chrome/browser/ui/find_bar/find_tab_helper.cc

Issue 1851793002: Implement a shell of FindRequestManager, and hook it up to WebContentsImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased and small fix. Created 4 years, 8 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
« no previous file with comments | « android_webview/browser/find_helper.cc ('k') | content/browser/find_request_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/find_bar/find_tab_helper.h" 5 #include "chrome/browser/ui/find_bar/find_tab_helper.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 // This is a FindNext operation if we are searching for the same text again, 71 // This is a FindNext operation if we are searching for the same text again,
72 // or if the passed in search text is empty (FindNext keyboard shortcut). The 72 // or if the passed in search text is empty (FindNext keyboard shortcut). The
73 // exception to this is if the Find was aborted (then we don't want FindNext 73 // exception to this is if the Find was aborted (then we don't want FindNext
74 // because the highlighting has been cleared and we need it to reappear). We 74 // because the highlighting has been cleared and we need it to reappear). We
75 // therefore treat FindNext after an aborted Find operation as a full fledged 75 // therefore treat FindNext after an aborted Find operation as a full fledged
76 // Find. 76 // Find.
77 bool find_next = (find_text_ == search_string || search_string.empty()) && 77 bool find_next = (find_text_ == search_string || search_string.empty()) &&
78 (last_search_case_sensitive_ == case_sensitive) && 78 (last_search_case_sensitive_ == case_sensitive) &&
79 !find_op_aborted_; 79 !find_op_aborted_;
80 if (!find_next) 80
81 current_find_request_id_ = find_request_id_counter_++; 81 current_find_request_id_ = find_request_id_counter_++;
82 82
83 if (!search_string.empty()) 83 if (!search_string.empty())
84 find_text_ = search_string; 84 find_text_ = search_string;
85 last_search_case_sensitive_ = case_sensitive; 85 last_search_case_sensitive_ = case_sensitive;
86 86
87 find_op_aborted_ = false; 87 find_op_aborted_ = false;
88 88
89 // Keep track of what the last search was across the tabs. 89 // Keep track of what the last search was across the tabs.
90 Profile* profile = 90 Profile* profile =
91 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); 91 Profile::FromBrowserContext(web_contents()->GetBrowserContext());
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } 134 }
135 135
136 void FindTabHelper::ActivateFindInPageResultForAccessibility() { 136 void FindTabHelper::ActivateFindInPageResultForAccessibility() {
137 web_contents()->GetMainFrame()->ActivateFindInPageResultForAccessibility( 137 web_contents()->GetMainFrame()->ActivateFindInPageResultForAccessibility(
138 current_find_request_id_); 138 current_find_request_id_);
139 } 139 }
140 140
141 #if defined(OS_ANDROID) 141 #if defined(OS_ANDROID)
142 void FindTabHelper::ActivateNearestFindResult(float x, float y) { 142 void FindTabHelper::ActivateNearestFindResult(float x, float y) {
143 if (!find_op_aborted_ && !find_text_.empty()) { 143 if (!find_op_aborted_ && !find_text_.empty()) {
144 web_contents()->GetMainFrame()->ActivateNearestFindResult( 144 web_contents()->ActivateNearestFindResult(x, y);
145 current_find_request_id_, x, y);
146 } 145 }
147 } 146 }
148 147
149 void FindTabHelper::RequestFindMatchRects(int current_version) { 148 void FindTabHelper::RequestFindMatchRects(int current_version) {
150 if (!find_op_aborted_ && !find_text_.empty()) 149 if (!find_op_aborted_ && !find_text_.empty())
151 web_contents()->GetMainFrame()->RequestFindMatchRects(current_version); 150 web_contents()->RequestFindMatchRects(current_version);
152 } 151 }
153 #endif 152 #endif
154 153
155 void FindTabHelper::HandleFindReply(int request_id, 154 void FindTabHelper::HandleFindReply(int request_id,
156 int number_of_matches, 155 int number_of_matches,
157 const gfx::Rect& selection_rect, 156 const gfx::Rect& selection_rect,
158 int active_match_ordinal, 157 int active_match_ordinal,
159 bool final_update) { 158 bool final_update) {
160 // Ignore responses for requests that have been aborted. 159 // Ignore responses for requests that have been aborted.
161 // Ignore responses for requests other than the one we have most recently 160 // Ignore responses for requests other than the one we have most recently
(...skipping 15 matching lines...) Expand all
177 // found. 176 // found.
178 last_search_result_ = FindNotificationDetails( 177 last_search_result_ = FindNotificationDetails(
179 request_id, number_of_matches, selection, active_match_ordinal, 178 request_id, number_of_matches, selection, active_match_ordinal,
180 final_update); 179 final_update);
181 content::NotificationService::current()->Notify( 180 content::NotificationService::current()->Notify(
182 chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, 181 chrome::NOTIFICATION_FIND_RESULT_AVAILABLE,
183 content::Source<WebContents>(web_contents()), 182 content::Source<WebContents>(web_contents()),
184 content::Details<FindNotificationDetails>(&last_search_result_)); 183 content::Details<FindNotificationDetails>(&last_search_result_));
185 } 184 }
186 } 185 }
OLDNEW
« no previous file with comments | « android_webview/browser/find_helper.cc ('k') | content/browser/find_request_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698