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

Unified Diff: components/autofill/browser/autocomplete_history_manager.cc

Issue 16286020: Abstract WebContentsObserver from Autofill shared code (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Nits Created 7 years, 6 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: components/autofill/browser/autocomplete_history_manager.cc
diff --git a/components/autofill/browser/autocomplete_history_manager.cc b/components/autofill/browser/autocomplete_history_manager.cc
index ca7988903017a7794f60d350d21b9ff1364b68b7..a0f9daa0eae601a6835810fa7c9c8c02791453d1 100644
--- a/components/autofill/browser/autocomplete_history_manager.cc
+++ b/components/autofill/browser/autocomplete_history_manager.cc
@@ -18,6 +18,7 @@
#include "content/public/browser/browser_context.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
+#include "ipc/ipc_message_macros.h"
using content::BrowserContext;
using content::WebContents;
@@ -43,13 +44,14 @@ bool IsTextField(const FormFieldData& field) {
AutocompleteHistoryManager::AutocompleteHistoryManager(
WebContents* web_contents)
- : content::WebContentsObserver(web_contents),
- browser_context_(web_contents->GetBrowserContext()),
+ : browser_context_(web_contents->GetBrowserContext()),
+ web_contents_(web_contents),
autofill_data_(
AutofillWebDataService::FromBrowserContext(browser_context_)),
pending_query_handle_(0),
query_id_(0),
- external_delegate_(NULL) {
+ external_delegate_(NULL),
+ send_IPC_(true) {
autofill_enabled_.Init(
prefs::kAutofillEnabled,
components::UserPrefs::Get(browser_context_));
@@ -59,17 +61,6 @@ AutocompleteHistoryManager::~AutocompleteHistoryManager() {
CancelPendingQuery();
}
-bool AutocompleteHistoryManager::OnMessageReceived(
- const IPC::Message& message) {
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(AutocompleteHistoryManager, message)
- IPC_MESSAGE_HANDLER(AutofillHostMsg_RemoveAutocompleteEntry,
blundell 2013/06/04 17:30:48 I moved the reception of this message into Autofil
Evan Stade 2013/06/04 18:06:36 Ilya would know for sure but my guess is that it's
Ilya Sherman 2013/06/05 10:50:02 Yes, Evan is correct -- this IPC message would onl
blundell 2013/06/11 15:35:47 Are you saying (a) that it's OK to just not handle
Ilya Sherman 2013/06/12 00:07:46 (b), though not all of autofill_agent will be goin
- OnRemoveAutocompleteEntry)
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
- return handled;
-}
-
void AutocompleteHistoryManager::OnWebDataServiceRequestDone(
WebDataServiceBase::Handle h,
const WDTypedResult* result) {
@@ -206,13 +197,14 @@ void AutocompleteHistoryManager::SendSuggestions(
autofill_labels_,
autofill_icons_,
autofill_unique_ids_);
- } else {
- Send(new AutofillMsg_SuggestionsReturned(routing_id(),
- query_id_,
- autofill_values_,
- autofill_labels_,
- autofill_icons_,
- autofill_unique_ids_));
+ } else if (send_IPC_) {
blundell 2013/06/04 17:30:48 This change is to preserve the behavior of the Ext
+ web_contents_->Send(
+ new AutofillMsg_SuggestionsReturned(web_contents_->GetRoutingID(),
+ query_id_,
+ autofill_values_,
+ autofill_labels_,
+ autofill_icons_,
+ autofill_unique_ids_));
}
query_id_ = 0;

Powered by Google App Engine
This is Rietveld 408576698