summaryrefslogtreecommitdiffstats
path: root/chrome/browser/tab_contents
diff options
context:
space:
mode:
authorrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-09 18:13:53 +0000
committerrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-09 18:13:53 +0000
commite5d2f713578962c4a2dc25dffe4002bb4153bfcb (patch)
treef8026c823028e7b835259c18ed2685f771cef244 /chrome/browser/tab_contents
parent51b623da27ffd93a28b03377d43a407f7811d292 (diff)
downloadchromium_src-e5d2f713578962c4a2dc25dffe4002bb4153bfcb.zip
chromium_src-e5d2f713578962c4a2dc25dffe4002bb4153bfcb.tar.gz
chromium_src-e5d2f713578962c4a2dc25dffe4002bb4153bfcb.tar.bz2
Do not prepopulate the findbar with incognito search terms.
BUG=32021 TEST=On win/linux, open an incognito window and search for some term. Then open a new normal tab and press Ctrl-F. Findbar should not be prepopoulated with your incognito search term. Review URL: http://codereview.chromium.org/1561018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44104 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents')
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc16
-rw-r--r--chrome/browser/tab_contents/tab_contents.h9
2 files changed, 8 insertions, 17 deletions
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 27d67ec..0b64c05 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -32,6 +32,7 @@
#include "chrome/browser/external_protocol_handler.h"
#include "chrome/browser/extensions/extensions_service.h"
#include "chrome/browser/favicon_service.h"
+#include "chrome/browser/find_bar_state.h"
#include "chrome/browser/google_util.h"
#include "chrome/browser/host_content_settings_map.h"
#include "chrome/browser/hung_renderer_dialog.h"
@@ -270,7 +271,6 @@ TabContents::TabContents(Profile* profile,
find_op_aborted_(false),
current_find_request_id_(find_request_id_counter_++),
last_search_case_sensitive_(false),
- last_search_prepopulate_text_(NULL),
last_search_result_(),
app_extension_(NULL),
app_extension_for_current_page_(NULL),
@@ -341,10 +341,6 @@ TabContents::TabContents(Profile* profile,
registrar_.Add(this, NotificationType::EXTENSION_UNLOADED_DISABLED,
NotificationService::AllSources());
- // Keep a global copy of the previous search string (if any).
- static string16 global_last_search = string16();
- last_search_prepopulate_text_ = &global_last_search;
-
// Set-up the showing of the omnibox search infobar if applicable.
if (OmniboxSearchHint::IsEnabled(profile))
omnibox_search_hint_.reset(new OmniboxSearchHint(this));
@@ -1142,12 +1138,15 @@ 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()) {
+ string16 last_search_prepopulate_text =
+ FindBarState::GetLastPrepopulateText(profile());
+
// 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 if (!last_search_prepopulate_text.empty())
+ search_string = last_search_prepopulate_text;
else
return;
}
@@ -1174,7 +1173,8 @@ void TabContents::StartFinding(string16 search_string,
find_op_aborted_ = false;
// Keep track of what the last search was across the tabs.
- *last_search_prepopulate_text_ = find_text_;
+ FindBarState* find_bar_state = profile()->GetFindBarState();
+ find_bar_state->set_last_prepopulate_text(find_text_);
render_view_host()->StartFinding(current_find_request_id_,
find_text_,
forward_direction,
diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h
index 123157d..902e61e 100644
--- a/chrome/browser/tab_contents/tab_contents.h
+++ b/chrome/browser/tab_contents/tab_contents.h
@@ -557,12 +557,6 @@ class TabContents : public PageNavigator,
// 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 {
- return *last_search_prepopulate_text_;
- }
-
// Accessor for find_result_.
const FindNotificationDetails& find_result() const {
return last_search_result_;
@@ -1171,9 +1165,6 @@ class TabContents : public PageNavigator,
// Whether the last search was case sensitive or not.
bool last_search_case_sensitive_;
- // Keeps track of the last search string that was used to search in any tab.
- string16* last_search_prepopulate_text_;
-
// The last find result. This object contains details about the number of
// matches, the find selection rectangle, etc. The UI can access this
// information to build its presentation.