summaryrefslogtreecommitdiffstats
path: root/chrome/browser/tab_contents
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-26 21:14:44 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-26 21:14:44 +0000
commit101c90ebc859a8e5d90b774ac5ae8dfda0dd31ab (patch)
tree03df8bbb8e9f5c99d27978bc360726e944f2ebe5 /chrome/browser/tab_contents
parent7c40973a0c946c25df634f4bf774afefcbbc39b2 (diff)
downloadchromium_src-101c90ebc859a8e5d90b774ac5ae8dfda0dd31ab.zip
chromium_src-101c90ebc859a8e5d90b774ac5ae8dfda0dd31ab.tar.gz
chromium_src-101c90ebc859a8e5d90b774ac5ae8dfda0dd31ab.tar.bz2
Find-in-page should not ding while deleting characters.
BUG=18120 TEST=Open google.com, type Ctrl+F, type in garbage. Erase one letter at a time and there should be no beeping while you erase. Try it again, but this time use shift-delete to cut a few letters off the end. It should not ding. Now Copy the whole find string, press Esc, open Find again and on Paste it should not ding. Review URL: http://codereview.chromium.org/338005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30092 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents')
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc4
-rw-r--r--chrome/browser/tab_contents/tab_contents.h11
2 files changed, 13 insertions, 2 deletions
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 657bee4..3876053 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -1084,6 +1084,9 @@ void TabContents::StartFinding(string16 find_text,
find_text = *last_search_prepopulate_text_;
}
+ // Keep track of the previous search.
+ previous_find_text_ = find_text_;
+
// This is a FindNext operation if we are searching for the same text again,
// or if the passed in search text is empty (FindNext keyboard shortcut). The
// exception to this is if the Find was aborted (then we don't want FindNext
@@ -1117,6 +1120,7 @@ void TabContents::StopFinding(bool clear_selection) {
// by the user, but the UI has not been dismissed.
if (!clear_selection)
find_ui_active_ = false;
+ find_text_.clear();
find_op_aborted_ = true;
last_search_result_ = FindNotificationDetails();
render_view_host()->StopFinding(clear_selection);
diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h
index 98e2d2c..091bde2 100644
--- a/chrome/browser/tab_contents/tab_contents.h
+++ b/chrome/browser/tab_contents/tab_contents.h
@@ -530,6 +530,9 @@ class TabContents : public PageNavigator,
// active searches.
string16 find_text() const { return find_text_; }
+ // Accessor for the previous search we issued.
+ string16 previous_find_text() const { return previous_find_text_; }
+
// Accessor for last_search_prepopulate_text_. Used to access the last search
// string entered, whatever tab that search was performed in.
string16 find_prepopulate_text() const {
@@ -1105,10 +1108,14 @@ class TabContents : public PageNavigator,
// This variable keeps track of what the most recent request id is.
int current_find_request_id_;
- // The last string we searched for. This is used to figure out if this is a
- // Find or a FindNext operation (FindNext should not increase the request id).
+ // The current string we are/just finished searching for. This is used to
+ // figure out if this is a Find or a FindNext operation (FindNext should not
+ // increase the request id).
string16 find_text_;
+ // The string we searched for before |find_text_|.
+ string16 previous_find_text_;
+
// Whether the last search was case sensitive or not.
bool last_search_case_sensitive_;