summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autofill/autofill_manager.h
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-20 22:01:17 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-20 22:01:17 +0000
commit9c6d006761c3313f7fe81ff304d10a6c02400622 (patch)
tree238158837a6f8800c5d2a0a2faa9434fffbbd718 /chrome/browser/autofill/autofill_manager.h
parent58555ce035571ee7d8620dd3e57cc7bf1adfd9b2 (diff)
downloadchromium_src-9c6d006761c3313f7fe81ff304d10a6c02400622.zip
chromium_src-9c6d006761c3313f7fe81ff304d10a6c02400622.tar.gz
chromium_src-9c6d006761c3313f7fe81ff304d10a6c02400622.tar.bz2
AutoFill: Segregate profile and credit card filling.
* Refactor suggestions filling into Get[Profile,CreditCard]Suggestions. * Don't fill the default credit card when the AutoFill shortcut is initiated. * Don't fill the default credit card when filling the profile. BUG=41334 TEST=none Review URL: http://codereview.chromium.org/1619029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45087 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill/autofill_manager.h')
-rw-r--r--chrome/browser/autofill/autofill_manager.h44
1 files changed, 30 insertions, 14 deletions
diff --git a/chrome/browser/autofill/autofill_manager.h b/chrome/browser/autofill/autofill_manager.h
index a8fe529..eb0abe7 100644
--- a/chrome/browser/autofill/autofill_manager.h
+++ b/chrome/browser/autofill/autofill_manager.h
@@ -15,11 +15,6 @@
#include "chrome/browser/autofill/personal_data_manager.h"
#include "chrome/browser/renderer_host/render_view_host_delegate.h"
-namespace webkit_glue {
-struct FormData;
-class FormField;
-} // namespace webkit_glue
-
class AutoFillInfoBarDelegate;
class AutoFillProfile;
class CreditCard;
@@ -27,6 +22,11 @@ class FormStructure;
class PrefService;
class TabContents;
+namespace webkit_glue {
+struct FormData;
+class FormField;
+} // namespace webkit_glue
+
// TODO(jhawkins): Maybe this should be in a grd file?
extern const char* kAutoFillLearnMoreUrl;
@@ -81,6 +81,9 @@ class AutoFillManager : public RenderViewHostDelegate::AutoFill,
AutoFillDownloadManager::AutoFillRequestType request_type,
int http_error);
+ // Returns the value of the AutoFillEnabled pref.
+ virtual bool IsAutoFillEnabled() const;
+
// Uses heuristics and existing personal data to determine the possible field
// types.
void DeterminePossibleFieldTypes(FormStructure* form_structure);
@@ -88,30 +91,43 @@ class AutoFillManager : public RenderViewHostDelegate::AutoFill,
// Handles the form data submitted by the user.
void HandleSubmit();
-
- // Uploads the form data to the autofill server.
+ // Uploads the form data to the AutoFill server.
void UploadFormData();
- // Returns the value of the AutoFillEnabled pref.
- bool IsAutoFillEnabled();
-
- // Fills all the forms in the page with the default profile.
+ // Fills all the forms in the page with the default profile. Credit card
+ // fields are not filled out.
// TODO(jhawkins): Do we really want to fill all of the forms on the page?
// Check how toolbar handles this case.
void FillDefaultProfile();
protected:
- // For AutoFillInfoBarDelegateTest.
+ // For tests.
AutoFillManager();
+ AutoFillManager(TabContents* tab_contents,
+ PersonalDataManager* personal_data);
private:
+ // Returns a list of values from the stored profiles that match |type| and the
+ // value of |field| and returns the labels of the matching profiles.
+ void GetProfileSuggestions(const webkit_glue::FormField& field,
+ AutoFillFieldType type,
+ std::vector<string16>* values,
+ std::vector<string16>* labels);
+
+ // Returns a list of values from the stored credit cards that match |type| and
+ // the value of |field| and returns the labels of the matching credit cards.
+ void GetCreditCardSuggestions(const webkit_glue::FormField& field,
+ AutoFillFieldType type,
+ std::vector<string16>* values,
+ std::vector<string16>* labels);
+
// The TabContents hosting this AutoFillManager.
// Weak reference.
// May not be NULL.
TabContents* tab_contents_;
// The personal data manager, used to save and load personal data to/from the
- // web database.
+ // web database. This is overridden by the AutoFillManagerTest.
// Weak reference.
// May be NULL. NULL indicates OTR.
PersonalDataManager* personal_data_;
@@ -125,7 +141,7 @@ class AutoFillManager : public RenderViewHostDelegate::AutoFill,
// The form data the user has submitted.
scoped_ptr<FormStructure> upload_form_structure_;
- // The infobar that asks for permission to store form information.
+ // The InfoBar that asks for permission to store form information.
scoped_ptr<AutoFillInfoBarDelegate> infobar_;
DISALLOW_COPY_AND_ASSIGN(AutoFillManager);