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

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

Issue 374253002: Strip carriage return from find text; show newline symbols. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Restore char16 arrays for cross platform support. Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/gfx/render_text.cc » ('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 "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 22 matching lines...) Expand all
33 last_search_case_sensitive_(false), 33 last_search_case_sensitive_(false),
34 last_search_result_() { 34 last_search_result_() {
35 } 35 }
36 36
37 FindTabHelper::~FindTabHelper() { 37 FindTabHelper::~FindTabHelper() {
38 } 38 }
39 39
40 void FindTabHelper::StartFinding(base::string16 search_string, 40 void FindTabHelper::StartFinding(base::string16 search_string,
41 bool forward_direction, 41 bool forward_direction,
42 bool case_sensitive) { 42 bool case_sensitive) {
43 // Remove the carriage return character, which generally isn't in web content.
44 const base::char16 kInvalidChars[] = { '\r', 0 };
45 base::RemoveChars(search_string, kInvalidChars, &search_string);
46
43 // If search_string is empty, it means FindNext was pressed with a keyboard 47 // If search_string is empty, it means FindNext was pressed with a keyboard
44 // shortcut so unless we have something to search for we return early. 48 // shortcut so unless we have something to search for we return early.
45 if (search_string.empty() && find_text_.empty()) { 49 if (search_string.empty() && find_text_.empty()) {
46 Profile* profile = 50 Profile* profile =
47 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); 51 Profile::FromBrowserContext(web_contents()->GetBrowserContext());
48 base::string16 last_search_prepopulate_text = 52 base::string16 last_search_prepopulate_text =
49 FindBarStateFactory::GetLastPrepopulateText(profile); 53 FindBarStateFactory::GetLastPrepopulateText(profile);
50 54
51 // Try the last thing we searched for on this tab, then the last thing 55 // Try the last thing we searched for on this tab, then the last thing
52 // searched for on any tab. 56 // searched for on any tab.
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 // found. 169 // found.
166 last_search_result_ = FindNotificationDetails( 170 last_search_result_ = FindNotificationDetails(
167 request_id, number_of_matches, selection, active_match_ordinal, 171 request_id, number_of_matches, selection, active_match_ordinal,
168 final_update); 172 final_update);
169 content::NotificationService::current()->Notify( 173 content::NotificationService::current()->Notify(
170 chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, 174 chrome::NOTIFICATION_FIND_RESULT_AVAILABLE,
171 content::Source<WebContents>(web_contents()), 175 content::Source<WebContents>(web_contents()),
172 content::Details<FindNotificationDetails>(&last_search_result_)); 176 content::Details<FindNotificationDetails>(&last_search_result_));
173 } 177 }
174 } 178 }
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/render_text.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698