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

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: 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') | ui/gfx/render_text.cc » ('J')
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 const base::char16 kInvalidChars[] = { '\r', 0 };
44 base::RemoveChars(search_string, kInvalidChars, &search_string);
Peter Kasting 2014/07/09 00:27:05 You can just pass L"\r" here directly, no need to
msw 2014/07/09 00:40:12 Done.
Peter Kasting 2014/07/09 00:43:26 I'm thinking of pages that actually contain, say,
msw 2014/07/09 15:39:33 The patch works well in my tests of the following
45
43 // If search_string is empty, it means FindNext was pressed with a keyboard 46 // 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. 47 // shortcut so unless we have something to search for we return early.
45 if (search_string.empty() && find_text_.empty()) { 48 if (search_string.empty() && find_text_.empty()) {
46 Profile* profile = 49 Profile* profile =
47 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); 50 Profile::FromBrowserContext(web_contents()->GetBrowserContext());
48 base::string16 last_search_prepopulate_text = 51 base::string16 last_search_prepopulate_text =
49 FindBarStateFactory::GetLastPrepopulateText(profile); 52 FindBarStateFactory::GetLastPrepopulateText(profile);
50 53
51 // Try the last thing we searched for on this tab, then the last thing 54 // Try the last thing we searched for on this tab, then the last thing
52 // searched for on any tab. 55 // searched for on any tab.
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 // found. 168 // found.
166 last_search_result_ = FindNotificationDetails( 169 last_search_result_ = FindNotificationDetails(
167 request_id, number_of_matches, selection, active_match_ordinal, 170 request_id, number_of_matches, selection, active_match_ordinal,
168 final_update); 171 final_update);
169 content::NotificationService::current()->Notify( 172 content::NotificationService::current()->Notify(
170 chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, 173 chrome::NOTIFICATION_FIND_RESULT_AVAILABLE,
171 content::Source<WebContents>(web_contents()), 174 content::Source<WebContents>(web_contents()),
172 content::Details<FindNotificationDetails>(&last_search_result_)); 175 content::Details<FindNotificationDetails>(&last_search_result_));
173 } 176 }
174 } 177 }
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/render_text.cc » ('j') | ui/gfx/render_text.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698