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

Unified Diff: chrome/browser/autofill/autofill_manager.h

Issue 8353025: External autofill delegates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase against TOT Created 9 years, 2 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: chrome/browser/autofill/autofill_manager.h
diff --git a/chrome/browser/autofill/autofill_manager.h b/chrome/browser/autofill/autofill_manager.h
index e4fd014d7d24ddb967b1c8adadd20f383d40d05e..f81e96491ecd19561e1b42da34f9b48b7f23f7f5 100644
--- a/chrome/browser/autofill/autofill_manager.h
+++ b/chrome/browser/autofill/autofill_manager.h
@@ -23,6 +23,7 @@
#include "chrome/browser/autofill/form_structure.h"
#include "content/browser/tab_contents/tab_contents_observer.h"
+class AutofillExternalDelegate;
class AutofillField;
class AutofillProfile;
class AutofillMetrics;
@@ -54,6 +55,14 @@ class AutofillManager : public TabContentsObserver,
// Registers our Enable/Disable Autofill pref.
static void RegisterUserPrefs(PrefService* prefs);
+ // Set our external delegate.
+ // TODO(jrg): consider passing delegate into the ctor. That won't
+ // work if the delegate has a pointer to the AutofillManager, but
+ // future directions may not need such a pointer.
+ void SetExternalDelegate(AutofillExternalDelegate* delegate) {
+ external_delegate_ = delegate;
+ }
+
protected:
// Only test code should subclass AutofillManager.
@@ -90,6 +99,17 @@ class AutofillManager : public TabContentsObserver,
ScopedVector<FormStructure>* form_structures() { return &form_structures_; }
+ // Called from our external delegate so it cannot be private.
+ void OnFillAutoFillFormData(int query_id,
+ const webkit_glue::FormData& form,
+ const webkit_glue::FormField& field,
+ int unique_id);
+
+ // Exposed for testing.
+ AutofillExternalDelegate* external_delegate() {
+ return external_delegate_;
+ }
+
private:
// TabContentsObserver:
virtual void DidNavigateMainFramePostCommit(
@@ -268,6 +288,10 @@ class AutofillManager : public TabContentsObserver,
mutable std::map<GUIDPair, int> guid_id_map_;
mutable std::map<int, GUIDPair> id_guid_map_;
+ // Delegate to perform external processing (display, selection) on
+ // our behalf. Weak.
+ AutofillExternalDelegate* external_delegate_;
+
friend class AutofillManagerTest;
friend class FormStructureBrowserTest;
FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest,
@@ -282,6 +306,9 @@ class AutofillManager : public TabContentsObserver,
FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, QualityMetricsForFailure);
FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, QualityMetricsWithExperimentId);
FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, SaneMetricsWithCacheMismatch);
+ FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, TestExternalDelegate);
+ FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest,
+ TestTabContentsWithExternalDelegate);
FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest,
UserHappinessFormLoadAndSubmission);
FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, UserHappinessFormInteraction);

Powered by Google App Engine
This is Rietveld 408576698