OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/autofill/autofill_manager.h" | 5 #include "chrome/browser/autofill/autofill_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 #include <map> | 10 #include <map> |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 it->GetMatchingTypes(value, &matching_types); | 161 it->GetMatchingTypes(value, &matching_types); |
162 } | 162 } |
163 | 163 |
164 if (matching_types.empty()) | 164 if (matching_types.empty()) |
165 matching_types.insert(UNKNOWN_TYPE); | 165 matching_types.insert(UNKNOWN_TYPE); |
166 | 166 |
167 field->set_possible_types(matching_types); | 167 field->set_possible_types(matching_types); |
168 } | 168 } |
169 } | 169 } |
170 | 170 |
171 // Check for unidentified forms among those with the most query or upload | |
172 // requests. If found, present an infobar prompting the user to send Google | |
173 // Feedback identifying these forms. Only executes if the appropriate flag is | |
174 // set in about:flags. | |
175 const char* kPopularFormSignatures[] = { | |
176 "10135289994685082173", | |
177 "7883844738557049416", | |
178 "14651966297402649464", | |
179 "17177862793067325164", | |
180 "15222964025577790589", | |
181 "14138834153984647462", | |
182 "1522221299769735301", | |
183 "8604254969743383026", | |
184 "1080809576396139601", | |
185 "10591138561307360539", | |
186 "3483444043750493124", | |
187 "3764098888295731941", | |
188 "957190629194980629", | |
189 "11314948061179499915", | |
190 "2226179674176240706", | |
191 "9886974103926218264", | |
192 "16089161644523512553", | |
193 "17395441333004474813", | |
194 "7131540066857838464", | |
195 "1799736626243038725", | |
196 "4314535457620699296", | |
197 "16597101416150066076", | |
198 "11571064402466920341", | |
199 "17529644200058912705", | |
200 "17442663271235869548", | |
201 "10423886468225016833", | |
202 "8205718441232482003", | |
203 "12566467866837059201", | |
204 "14998753650075003914", | |
205 "8463873542596795823", | |
206 "3341181348270175432", | |
207 "12047213380448477438", | |
208 "7626117232464424739", | |
209 "6755316823149690927", | |
210 "17343480863386343671", | |
211 "4345267765838738360" | |
212 }; | |
213 | |
214 void CheckForPopularForms(const std::vector<FormStructure*>& forms, | |
215 TabContentsWrapper* tab_contents_wrapper, | |
216 TabContents* tab_contents) { | |
217 if (!CommandLine::ForCurrentProcess()->HasSwitch(kEnableAutofillFeedback)) | |
218 return; | |
219 | |
220 for (std::vector<FormStructure*>::const_iterator it = forms.begin(); | |
221 it != forms.end(); | |
222 ++it) { | |
223 std::string form_signature = (*it)->FormSignature(); | |
224 for (size_t i = 0; i < arraysize(kPopularFormSignatures); ++i) { | |
225 if (form_signature != kPopularFormSignatures[i]) | |
226 continue; | |
227 | |
228 string16 text = | |
229 l10n_util::GetStringUTF16(IDS_AUTOFILL_FEEDBACK_INFOBAR_TEXT); | |
230 string16 link = | |
231 l10n_util::GetStringUTF16(IDS_AUTOFILL_FEEDBACK_INFOBAR_LINK_TEXT); | |
232 std::string message = | |
233 l10n_util::GetStringFUTF8(IDS_AUTOFILL_FEEDBACK_POPULAR_FORM_MESSAGE, | |
234 ASCIIToUTF16(form_signature), | |
235 UTF8ToUTF16((*it)->source_url().spec())); | |
236 | |
237 InfoBarTabHelper* infobar_helper = | |
238 tab_contents_wrapper->infobar_tab_helper(); | |
239 infobar_helper->AddInfoBar( | |
240 new AutofillFeedbackInfoBarDelegate(infobar_helper, text, link, | |
241 message)); | |
242 break; | |
243 } | |
244 } | |
245 } | |
246 | |
247 } // namespace | 171 } // namespace |
248 | 172 |
249 AutofillManager::AutofillManager(TabContentsWrapper* tab_contents) | 173 AutofillManager::AutofillManager(TabContentsWrapper* tab_contents) |
250 : content::WebContentsObserver(tab_contents->web_contents()), | 174 : content::WebContentsObserver(tab_contents->web_contents()), |
251 tab_contents_wrapper_(tab_contents), | 175 tab_contents_wrapper_(tab_contents), |
252 personal_data_(NULL), | 176 personal_data_(NULL), |
253 download_manager_(tab_contents->profile(), this), | 177 download_manager_(tab_contents->profile(), this), |
254 disable_download_manager_requests_(false), | 178 disable_download_manager_requests_(false), |
255 metric_logger_(new AutofillMetrics), | 179 metric_logger_(new AutofillMetrics), |
256 has_logged_autofill_enabled_(false), | 180 has_logged_autofill_enabled_(false), |
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1310 *profile_guid = IDToGUID(profile_id); | 1234 *profile_guid = IDToGUID(profile_id); |
1311 } | 1235 } |
1312 | 1236 |
1313 void AutofillManager::UpdateInitialInteractionTimestamp( | 1237 void AutofillManager::UpdateInitialInteractionTimestamp( |
1314 const TimeTicks& interaction_timestamp) { | 1238 const TimeTicks& interaction_timestamp) { |
1315 if (initial_interaction_timestamp_.is_null() || | 1239 if (initial_interaction_timestamp_.is_null() || |
1316 interaction_timestamp < initial_interaction_timestamp_) { | 1240 interaction_timestamp < initial_interaction_timestamp_) { |
1317 initial_interaction_timestamp_ = interaction_timestamp; | 1241 initial_interaction_timestamp_ = interaction_timestamp; |
1318 } | 1242 } |
1319 } | 1243 } |
OLD | NEW |