summaryrefslogtreecommitdiffstats
path: root/chrome/browser/tab_contents/tab_contents.cc
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-11 02:20:21 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-11 02:20:21 +0000
commit87fae51359ae20a37a3f24f55bc715f8b3013761 (patch)
tree2061ea03ca659787099cc1a4ff83963fd6d76fbc /chrome/browser/tab_contents/tab_contents.cc
parent82aa72dfc7fb4aebea7857ce0c896434f18167bb (diff)
downloadchromium_src-87fae51359ae20a37a3f24f55bc715f8b3013761.zip
chromium_src-87fae51359ae20a37a3f24f55bc715f8b3013761.tar.gz
chromium_src-87fae51359ae20a37a3f24f55bc715f8b3013761.tar.bz2
Find bar fixes:
- prefer previous find from same tab contents over overall most recent find when re-opening find bar - GTK + Windows: always update find bar view text if it doesn't match the search results. TEST=see bug for repro steps BUG=30006 Review URL: http://codereview.chromium.org/482015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34322 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents/tab_contents.cc')
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 30b393d..2d62549 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -246,7 +246,6 @@ TabContents::TabContents(Profile* profile,
find_ui_active_(false),
find_op_aborted_(false),
current_find_request_id_(find_request_id_counter_++),
- find_text_(),
last_search_case_sensitive_(false),
last_search_prepopulate_text_(NULL),
last_search_result_(),
@@ -1020,10 +1019,14 @@ void TabContents::StartFinding(string16 search_string,
// If search_string is empty, it means FindNext was pressed with a keyboard
// shortcut so unless we have something to search for we return early.
if (search_string.empty() && find_text_.empty()) {
- if (last_search_prepopulate_text_->empty())
+ // Try the last thing we searched for on this tab, then the last thing
+ // searched for on any tab.
+ if (!previous_find_text_.empty())
+ search_string = previous_find_text_;
+ else if (!last_search_prepopulate_text_->empty())
+ search_string = *last_search_prepopulate_text_;
+ else
return;
- // Try whatever we searched for last in any tab.
- search_string = *last_search_prepopulate_text_;
}
// Keep track of the previous search.
@@ -1061,6 +1064,7 @@ void TabContents::StopFinding(bool clear_selection) {
// by the user, but the UI has not been dismissed.
if (!clear_selection)
find_ui_active_ = false;
+ previous_find_text_ = find_text_;
find_text_.clear();
find_op_aborted_ = true;
last_search_result_ = FindNotificationDetails();