summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete_history_manager.cc
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-17 03:09:42 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-17 03:09:42 +0000
commitb5a1d11cc70ab12c69e579d132204863a780eb75 (patch)
treea9300148dd2434b645ad7fe1716cce2f9e42e064 /chrome/browser/autocomplete_history_manager.cc
parentcd124097edce07ef5e0a7f80105e81c7982b81a1 (diff)
downloadchromium_src-b5a1d11cc70ab12c69e579d132204863a780eb75.zip
chromium_src-b5a1d11cc70ab12c69e579d132204863a780eb75.tar.gz
chromium_src-b5a1d11cc70ab12c69e579d132204863a780eb75.tar.bz2
Make TabContentsObserver handle registration automatically, as well as exposing getters for TC, routing_id, and sending messages.
Review URL: http://codereview.chromium.org/6537004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75226 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete_history_manager.cc')
-rw-r--r--chrome/browser/autocomplete_history_manager.cc32
1 files changed, 16 insertions, 16 deletions
diff --git a/chrome/browser/autocomplete_history_manager.cc b/chrome/browser/autocomplete_history_manager.cc
index 2acdcfc..112e063 100644
--- a/chrome/browser/autocomplete_history_manager.cc
+++ b/chrome/browser/autocomplete_history_manager.cc
@@ -74,10 +74,10 @@ bool IsSSN(const string16& text) {
AutocompleteHistoryManager::AutocompleteHistoryManager(
TabContents* tab_contents)
- : tab_contents_(tab_contents),
+ : TabContentsObserver(tab_contents),
pending_query_handle_(0),
query_id_(0) {
- profile_ = tab_contents_->profile();
+ profile_ = tab_contents->profile();
// May be NULL in unit tests.
web_data_service_ = profile_->GetWebDataService(Profile::EXPLICIT_ACCESS);
autofill_enabled_.Init(prefs::kAutoFillEnabled, profile_->GetPrefs(), NULL);
@@ -191,11 +191,14 @@ void AutocompleteHistoryManager::OnWebDataServiceRequestDone(
}
AutocompleteHistoryManager::AutocompleteHistoryManager(
- Profile* profile, WebDataService* wds) : tab_contents_(NULL),
- profile_(profile),
- web_data_service_(wds),
- pending_query_handle_(0),
- query_id_(0) {
+ TabContents* tab_contents,
+ Profile* profile,
+ WebDataService* wds)
+ : TabContentsObserver(tab_contents),
+ profile_(profile),
+ web_data_service_(wds),
+ pending_query_handle_(0),
+ query_id_(0) {
autofill_enabled_.Init(
prefs::kAutoFillEnabled, profile_->GetPrefs(), NULL);
}
@@ -232,15 +235,12 @@ void AutocompleteHistoryManager::SendSuggestions(
}
}
- RenderViewHost* host = tab_contents_->render_view_host();
- if (host) {
- host->Send(new AutoFillMsg_SuggestionsReturned(host->routing_id(),
- query_id_,
- autofill_values_,
- autofill_labels_,
- autofill_icons_,
- autofill_unique_ids_));
- }
+ Send(new AutoFillMsg_SuggestionsReturned(routing_id(),
+ query_id_,
+ autofill_values_,
+ autofill_labels_,
+ autofill_icons_,
+ autofill_unique_ids_));
query_id_ = 0;
autofill_values_.clear();