OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ |
6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ | 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <map> | 10 #include <map> |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 static void RegisterUserPrefs(PrefService* prefs); | 57 static void RegisterUserPrefs(PrefService* prefs); |
58 | 58 |
59 // Set our external delegate. | 59 // Set our external delegate. |
60 // TODO(jrg): consider passing delegate into the ctor. That won't | 60 // TODO(jrg): consider passing delegate into the ctor. That won't |
61 // work if the delegate has a pointer to the AutofillManager, but | 61 // work if the delegate has a pointer to the AutofillManager, but |
62 // future directions may not need such a pointer. | 62 // future directions may not need such a pointer. |
63 void SetExternalDelegate(AutofillExternalDelegate* delegate) { | 63 void SetExternalDelegate(AutofillExternalDelegate* delegate) { |
64 external_delegate_ = delegate; | 64 external_delegate_ = delegate; |
65 } | 65 } |
66 | 66 |
67 // AutofillDownloadManager::Observer: | |
Ilya Sherman
2011/11/17 02:24:37
nit: Please remove this line -- these are not Auto
csharp
2011/11/18 18:15:10
Done.
| |
68 // Called from our external delegate so they cannot be private. | |
69 void OnFillAutoFillFormData(int query_id, | |
70 const webkit_glue::FormData& form, | |
71 const webkit_glue::FormField& field, | |
72 int unique_id); | |
73 void OnDidShowAutofillSuggestions(bool is_new_popup); | |
74 void OnDidFillAutofillFormData(const base::TimeTicks& timestamp); | |
75 | |
67 protected: | 76 protected: |
68 // Only test code should subclass AutofillManager. | 77 // Only test code should subclass AutofillManager. |
69 friend class base::RefCounted<AutofillManager>; | 78 friend class base::RefCounted<AutofillManager>; |
70 virtual ~AutofillManager(); | 79 virtual ~AutofillManager(); |
71 | 80 |
72 // The string/int pair is composed of the guid string and variant index | 81 // The string/int pair is composed of the guid string and variant index |
73 // respectively. The variant index is an index into the multi-valued item | 82 // respectively. The variant index is an index into the multi-valued item |
74 // (where applicable). | 83 // (where applicable). |
75 typedef std::pair<std::string, size_t> GUIDPair; | 84 typedef std::pair<std::string, size_t> GUIDPair; |
76 | 85 |
(...skipping 26 matching lines...) Expand all Loading... | |
103 // Methods for packing and unpacking credit card and profile IDs for sending | 112 // Methods for packing and unpacking credit card and profile IDs for sending |
104 // and receiving to and from the renderer process. | 113 // and receiving to and from the renderer process. |
105 int PackGUIDs(const GUIDPair& cc_guid, const GUIDPair& profile_guid) const; | 114 int PackGUIDs(const GUIDPair& cc_guid, const GUIDPair& profile_guid) const; |
106 void UnpackGUIDs(int id, GUIDPair* cc_guid, GUIDPair* profile_guid) const; | 115 void UnpackGUIDs(int id, GUIDPair* cc_guid, GUIDPair* profile_guid) const; |
107 | 116 |
108 const AutofillMetrics* metric_logger() const { return metric_logger_.get(); } | 117 const AutofillMetrics* metric_logger() const { return metric_logger_.get(); } |
109 void set_metric_logger(const AutofillMetrics* metric_logger); | 118 void set_metric_logger(const AutofillMetrics* metric_logger); |
110 | 119 |
111 ScopedVector<FormStructure>* form_structures() { return &form_structures_; } | 120 ScopedVector<FormStructure>* form_structures() { return &form_structures_; } |
112 | 121 |
113 // Called from our external delegate so it cannot be private. | |
114 void OnFillAutoFillFormData(int query_id, | |
115 const webkit_glue::FormData& form, | |
116 const webkit_glue::FormField& field, | |
117 int unique_id); | |
118 | |
119 // Exposed for testing. | 122 // Exposed for testing. |
120 AutofillExternalDelegate* external_delegate() { | 123 AutofillExternalDelegate* external_delegate() { |
121 return external_delegate_; | 124 return external_delegate_; |
122 } | 125 } |
123 | 126 |
124 // Processes the submitted |form|, saving any new Autofill data and uploading | 127 // Processes the submitted |form|, saving any new Autofill data and uploading |
125 // the possible field types for the submitted fields to the crowdsouring | 128 // the possible field types for the submitted fields to the crowdsouring |
126 // server. Returns false if this form is not relevant for Autofill. | 129 // server. Returns false if this form is not relevant for Autofill. |
127 bool OnFormSubmitted(const webkit_glue::FormData& form, | 130 bool OnFormSubmitted(const webkit_glue::FormData& form, |
128 const base::TimeTicks& timestamp); | 131 const base::TimeTicks& timestamp); |
129 | 132 |
130 private: | 133 private: |
131 // TabContentsObserver: | 134 // TabContentsObserver: |
132 virtual void DidNavigateMainFrame( | 135 virtual void DidNavigateMainFrame( |
133 const content::LoadCommittedDetails& details, | 136 const content::LoadCommittedDetails& details, |
134 const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE; | 137 const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE; |
135 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 138 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
136 | 139 |
137 // AutofillDownloadManager::Observer: | 140 // AutofillDownloadManager::Observer: |
138 virtual void OnLoadedServerPredictions( | 141 virtual void OnLoadedServerPredictions( |
139 const std::string& response_xml) OVERRIDE; | 142 const std::string& response_xml) OVERRIDE; |
140 | 143 |
141 void OnFormsSeen(const std::vector<webkit_glue::FormData>& forms, | 144 void OnFormsSeen(const std::vector<webkit_glue::FormData>& forms, |
142 const base::TimeTicks& timestamp); | 145 const base::TimeTicks& timestamp); |
143 void OnTextFieldDidChange(const webkit_glue::FormData& form, | 146 void OnTextFieldDidChange(const webkit_glue::FormData& form, |
144 const webkit_glue::FormField& field, | 147 const webkit_glue::FormField& field, |
145 const base::TimeTicks& timestamp); | 148 const base::TimeTicks& timestamp); |
146 void OnQueryFormFieldAutofill(int query_id, | 149 void OnQueryFormFieldAutofill(int query_id, |
147 const webkit_glue::FormData& form, | 150 const webkit_glue::FormData& form, |
148 const webkit_glue::FormField& field); | 151 const webkit_glue::FormField& field, |
152 bool display_warning); | |
149 void OnFillAutofillFormData(int query_id, | 153 void OnFillAutofillFormData(int query_id, |
150 const webkit_glue::FormData& form, | 154 const webkit_glue::FormData& form, |
151 const webkit_glue::FormField& field, | 155 const webkit_glue::FormField& field, |
152 int unique_id); | 156 int unique_id); |
153 void OnShowAutofillDialog(); | 157 void OnShowAutofillDialog(); |
154 void OnDidPreviewAutofillFormData(); | 158 void OnDidPreviewAutofillFormData(); |
155 void OnDidFillAutofillFormData(const base::TimeTicks& timestamp); | 159 void OnSetDidEndTextFieldEditing(); |
156 void OnDidShowAutofillSuggestions(bool is_new_popup); | |
157 | 160 |
158 // Fills |host| with the RenderViewHost for this tab. | 161 // Fills |host| with the RenderViewHost for this tab. |
159 // Returns false if Autofill is disabled or if the host is unavailable. | 162 // Returns false if Autofill is disabled or if the host is unavailable. |
160 bool GetHost(const std::vector<AutofillProfile*>& profiles, | 163 bool GetHost(const std::vector<AutofillProfile*>& profiles, |
161 const std::vector<CreditCard*>& credit_cards, | 164 const std::vector<CreditCard*>& credit_cards, |
162 RenderViewHost** host) const WARN_UNUSED_RESULT; | 165 RenderViewHost** host) const WARN_UNUSED_RESULT; |
163 | 166 |
164 // Unpacks |unique_id| and fills |profile| or |credit_card| with the | 167 // Unpacks |unique_id| and fills |profile| or |credit_card| with the |
165 // appropriate data source. Returns false if the unpacked id cannot be found. | 168 // appropriate data source. Returns false if the unpacked id cannot be found. |
166 bool GetProfileOrCreditCard(int unique_id, | 169 bool GetProfileOrCreditCard(int unique_id, |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
322 TestTabContentsWithExternalDelegate); | 325 TestTabContentsWithExternalDelegate); |
323 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, | 326 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, |
324 UserHappinessFormLoadAndSubmission); | 327 UserHappinessFormLoadAndSubmission); |
325 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, UserHappinessFormInteraction); | 328 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, UserHappinessFormInteraction); |
326 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, FormFillDuration); | 329 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, FormFillDuration); |
327 | 330 |
328 DISALLOW_COPY_AND_ASSIGN(AutofillManager); | 331 DISALLOW_COPY_AND_ASSIGN(AutofillManager); |
329 }; | 332 }; |
330 | 333 |
331 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ | 334 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ |
OLD | NEW |