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

Unified Diff: chrome/browser/find_bar_controller.cc

Issue 67066: Prepopulate the Find box with whatever was searched for last (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/find_bar_controller.cc
===================================================================
--- chrome/browser/find_bar_controller.cc (revision 13523)
+++ chrome/browser/find_bar_controller.cc (working copy)
@@ -76,12 +76,19 @@
this, NotificationType::NAV_ENTRY_COMMITTED,
Source<NavigationController>(web_contents_->controller()));
+ // Find out what we should show in the find text box. Usually, this will be
+ // the last search in this tab, but if no search has been issued in this tab
+ // we use the last search string (from any tab).
+ string16 find_string = web_contents_->find_text();
+ if (find_string.empty())
+ find_string = web_contents_->find_prepopulate_text();
Ben Goodger (Google) 2009/04/13 20:48:25 nit: indentation
+
// Update the find bar with existing results and search text, regardless of
// whether or not the find bar is visible, so that if it's subsequently
// shown it is showing the right state for this tab. We update the find text
// _first_ since the FindBarView checks its emptiness to see if it should
// clear the result count display when there's nothing in the box.
- find_bar_->SetFindText(web_contents_->find_text());
+ find_bar_->SetFindText(find_string);
if (web_contents_->find_ui_active()) {
// A tab with a visible find bar just got selected and we need to show the
« no previous file with comments | « no previous file | chrome/browser/tab_contents/web_contents.h » ('j') | chrome/browser/tab_contents/web_contents.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698