OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ | |
6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ | |
7 | |
8 #include <stddef.h> | |
9 | |
10 #include <memory> | |
11 #include <set> | |
12 #include <vector> | |
13 | |
14 #include "base/gtest_prod_util.h" | |
15 #include "base/macros.h" | |
16 #include "base/memory/weak_ptr.h" | |
17 #include "base/strings/string16.h" | |
18 #include "base/time/time.h" | |
19 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" | |
20 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" | |
21 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" | |
22 #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h" | |
23 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" | |
24 #include "chrome/browser/ui/autofill/country_combobox_model.h" | |
25 #include "components/autofill/core/browser/autofill_client.h" | |
26 #include "components/autofill/core/browser/autofill_metrics.h" | |
27 #include "components/autofill/core/browser/autofill_popup_delegate.h" | |
28 #include "components/autofill/core/browser/field_types.h" | |
29 #include "components/autofill/core/browser/form_structure.h" | |
30 #include "components/autofill/core/browser/personal_data_manager.h" | |
31 #include "components/autofill/core/browser/personal_data_manager_observer.h" | |
32 #include "content/public/browser/notification_observer.h" | |
33 #include "content/public/browser/notification_registrar.h" | |
34 #include "content/public/browser/web_contents_observer.h" | |
35 #include "content/public/common/ssl_status.h" | |
36 #include "third_party/libaddressinput/chromium/chrome_address_validator.h" | |
37 #include "third_party/skia/include/core/SkColor.h" | |
38 #include "ui/base/models/simple_menu_model.h" | |
39 #include "ui/base/ui_base_types.h" | |
40 #include "ui/gfx/animation/animation_delegate.h" | |
41 #include "ui/gfx/animation/linear_animation.h" | |
42 #include "url/gurl.h" | |
43 | |
44 class Profile; | |
45 | |
46 namespace content { | |
47 class WebContents; | |
48 } | |
49 | |
50 namespace i18n { | |
51 namespace addressinput { | |
52 struct AddressData; | |
53 } | |
54 } | |
55 | |
56 namespace autofill { | |
57 | |
58 class AutofillDataModel; | |
59 class AutofillDialogView; | |
60 class AutofillPopupControllerImpl; | |
61 class DataModelWrapper; | |
62 | |
63 namespace risk { | |
64 class Fingerprint; | |
65 } | |
66 | |
67 namespace wallet { | |
68 class WalletSigninHelper; | |
69 } | |
70 | |
71 // This class drives the dialog that appears when a site uses the imperative | |
72 // autocomplete API to fill out a form. | |
73 class AutofillDialogControllerImpl | |
74 : public AutofillDialogViewDelegate, | |
75 public AutofillDialogController, | |
76 public AutofillPopupDelegate, | |
77 public content::WebContentsObserver, | |
78 public SuggestionsMenuModelDelegate, | |
79 public PersonalDataManagerObserver, | |
80 public LoadRulesListener { | |
81 public: | |
82 ~AutofillDialogControllerImpl() override; | |
83 | |
84 static base::WeakPtr<AutofillDialogControllerImpl> Create( | |
85 content::WebContents* contents, | |
86 const FormData& form_structure, | |
87 const GURL& source_url, | |
88 const AutofillClient::ResultCallback& callback); | |
89 | |
90 // AutofillDialogController implementation. | |
91 void Show() override; | |
92 void Hide() override; | |
93 void TabActivated() override; | |
94 | |
95 // AutofillDialogViewDelegate implementation. | |
96 base::string16 DialogTitle() const override; | |
97 base::string16 EditSuggestionText() const override; | |
98 base::string16 CancelButtonText() const override; | |
99 base::string16 ConfirmButtonText() const override; | |
100 base::string16 SaveLocallyText() const override; | |
101 base::string16 SaveLocallyTooltip() const override; | |
102 bool ShouldOfferToSaveInChrome() const override; | |
103 bool ShouldSaveInChrome() const override; | |
104 int GetDialogButtons() const override; | |
105 bool IsDialogButtonEnabled(ui::DialogButton button) const override; | |
106 bool SectionIsActive(DialogSection section) const override; | |
107 const DetailInputs& RequestedFieldsForSection( | |
108 DialogSection section) const override; | |
109 ui::ComboboxModel* ComboboxModelForAutofillType( | |
110 ServerFieldType type) override; | |
111 ui::MenuModel* MenuModelForSection(DialogSection section) override; | |
112 base::string16 LabelForSection(DialogSection section) const override; | |
113 SuggestionState SuggestionStateForSection(DialogSection section) override; | |
114 FieldIconMap IconsForFields(const FieldValueMap& user_inputs) const override; | |
115 bool FieldControlsIcons(ServerFieldType type) const override; | |
116 base::string16 TooltipForField(ServerFieldType type) const override; | |
117 base::string16 InputValidityMessage(DialogSection section, | |
118 ServerFieldType type, | |
119 const base::string16& value) override; | |
120 ValidityMessages InputsAreValid(DialogSection section, | |
121 const FieldValueMap& inputs) override; | |
122 void UserEditedOrActivatedInput(DialogSection section, | |
123 ServerFieldType type, | |
124 gfx::NativeView parent_view, | |
125 const gfx::Rect& content_bounds, | |
126 const base::string16& field_contents, | |
127 bool was_edit) override; | |
128 bool HandleKeyPressEventInInput( | |
129 const content::NativeWebKeyboardEvent& event) override; | |
130 void FocusMoved() override; | |
131 bool ShouldShowErrorBubble() const override; | |
132 void ViewClosed() override; | |
133 std::vector<DialogNotification> CurrentNotifications() override; | |
134 void LinkClicked(const GURL& url) override; | |
135 void OnCancel() override; | |
136 void OnAccept() override; | |
137 Profile* profile() override; | |
138 content::WebContents* GetWebContents() override; | |
139 | |
140 // AutofillPopupDelegate implementation. | |
141 void OnPopupShown() override; | |
142 void OnPopupHidden() override; | |
143 void DidSelectSuggestion(const base::string16& value, | |
144 int identifier) override; | |
145 void DidAcceptSuggestion(const base::string16& value, | |
146 int identifier, | |
147 int position) override; | |
148 bool GetDeletionConfirmationText(const base::string16& value, | |
149 int identifier, | |
150 base::string16* title, | |
151 base::string16* body) override; | |
152 bool RemoveSuggestion(const base::string16& value, int identifier) override; | |
153 void ClearPreviewedForm() override; | |
154 | |
155 | |
156 // SuggestionsMenuModelDelegate implementation. | |
157 void SuggestionItemSelected(SuggestionsMenuModel* model, | |
158 size_t index) override; | |
159 | |
160 // PersonalDataManagerObserver implementation. | |
161 void OnPersonalDataChanged() override; | |
162 | |
163 // LoadRulesListener implementation. | |
164 void OnAddressValidationRulesLoaded(const std::string& country_code, | |
165 bool success) override; | |
166 | |
167 protected: | |
168 // Exposed for testing. | |
169 AutofillDialogControllerImpl(content::WebContents* contents, | |
170 const FormData& form_structure, | |
171 const GURL& source_url, | |
172 const AutofillClient::ResultCallback& callback); | |
173 | |
174 // Exposed for testing. | |
175 AutofillDialogView* view() { return view_.get(); } | |
176 virtual AutofillDialogView* CreateView(); | |
177 ServerFieldType popup_input_type() const { | |
178 return popup_input_type_; | |
179 } | |
180 | |
181 // Returns the PersonalDataManager for |profile_|. | |
182 virtual PersonalDataManager* GetManager() const; | |
183 | |
184 // Returns an address validation helper. May be NULL during tests. | |
185 virtual AddressValidator* GetValidator(); | |
186 | |
187 // Opens the given URL in a new foreground tab. | |
188 virtual void OpenTabWithUrl(const GURL& url); | |
189 | |
190 // The active billing section for the current state of the dialog (e.g. when | |
191 // paying for wallet, the combined credit card + billing address section). | |
192 DialogSection ActiveBillingSection() const; | |
193 | |
194 // Whether |section| was sent into edit mode based on existing data. This | |
195 // happens when a user clicks "Edit" or a suggestion is invalid. | |
196 virtual bool IsEditingExistingData(DialogSection section) const; | |
197 | |
198 // Whether the user has chosen to enter all new data in |section|. This | |
199 // happens via choosing "Add a new X..." from a section's suggestion menu. | |
200 bool IsManuallyEditingSection(DialogSection section) const; | |
201 | |
202 // Delays enabling submit button for a short period of time. Exposed for | |
203 // testing. | |
204 virtual void SubmitButtonDelayBegin(); | |
205 | |
206 void FinishSubmit(); | |
207 | |
208 // Ends the delay for enabling the submit button. Called only from tests. | |
209 // Without this method, the tests would have to wait for the delay timer to | |
210 // finish, which would be flaky. | |
211 void SubmitButtonDelayEndForTesting(); | |
212 | |
213 private: | |
214 FRIEND_TEST_ALL_PREFIXES(AutofillDialogControllerTest, | |
215 AutocompleteEvent); | |
216 FRIEND_TEST_ALL_PREFIXES(AutofillDialogControllerTest, | |
217 AutocompleteErrorEventReasonCancel); | |
218 FRIEND_TEST_ALL_PREFIXES(AutofillDialogControllerTest, | |
219 AutocompleteErrorEventReasonInvalid); | |
220 FRIEND_TEST_ALL_PREFIXES(AutofillDialogControllerTest, | |
221 ErrorWithFrameNavigation); | |
222 FRIEND_TEST_ALL_PREFIXES(AutofillDialogControllerTest, | |
223 FillFormIncludesCVC); | |
224 FRIEND_TEST_ALL_PREFIXES(AutofillDialogControllerTest, | |
225 Submit); | |
226 FRIEND_TEST_ALL_PREFIXES(AutofillDialogControllerTest, | |
227 TransactionAmount); | |
228 FRIEND_TEST_ALL_PREFIXES(AutofillDialogControllerTest, | |
229 TransactionAmountReadonly); | |
230 | |
231 // Initializes or updates |suggested_cc_| et al. | |
232 void SuggestionsUpdated(); | |
233 | |
234 // Starts fetching the wallet items from Online Wallet. | |
235 void GetWalletItems(); | |
236 | |
237 // Clears previously entered manual input and removes |section| from | |
238 // |section_editing_state_|. Does not update the view. | |
239 void ResetSectionInput(DialogSection section); | |
240 | |
241 // Force |section| into edit mode if the current suggestion is invalid. | |
242 void ShowEditUiIfBadSuggestion(DialogSection section); | |
243 | |
244 // Whether the |value| of |input| should be preserved on account change. | |
245 bool InputWasEdited(ServerFieldType type, | |
246 const base::string16& value); | |
247 | |
248 // Takes a snapshot of the newly inputted user data in |view_| (if it exists). | |
249 FieldValueMap TakeUserInputSnapshot(); | |
250 | |
251 // Fills the detail inputs from a previously taken user input snapshot. Does | |
252 // not update the view. | |
253 void RestoreUserInputFromSnapshot(const FieldValueMap& snapshot); | |
254 | |
255 // Tells the view to update |section|. | |
256 void UpdateSection(DialogSection section); | |
257 | |
258 // Tells |view_| to update the validity status of its detail inputs (if | |
259 // |view_| is non-null). Currently this is used solely for highlighting | |
260 // invalid suggestions, so if no sections are based on existing data, | |
261 // |view_->UpdateForErrors()| is not called. | |
262 void UpdateForErrors(); | |
263 | |
264 // Creates a DataModelWrapper item for the item that's checked in the | |
265 // suggestion model for |section|. This may represent Autofill | |
266 // data or Wallet data, depending on whether Wallet is currently enabled. | |
267 std::unique_ptr<DataModelWrapper> CreateWrapper(DialogSection section); | |
268 | |
269 // Fills in |section|-related fields in |output_| according to the state of | |
270 // |view_|. | |
271 void FillOutputForSection(DialogSection section); | |
272 // As above, but uses |compare| to determine whether a DetailInput matches | |
273 // a field. Saves any new Autofill data to the PersonalDataManager. | |
274 void FillOutputForSectionWithComparator( | |
275 DialogSection section, | |
276 const FormStructure::InputFieldComparator& compare); | |
277 | |
278 // Returns whether |form_structure|_| has any fields that match the fieldset | |
279 // represented by |section|. | |
280 bool FormStructureCaresAboutSection(DialogSection section) const; | |
281 | |
282 // Finds all fields of the given |type| in |form_structure_|, if any, and sets | |
283 // each field's value to |output|. | |
284 void SetOutputForFieldsOfType(ServerFieldType type, | |
285 const base::string16& output); | |
286 | |
287 // Gets the value for |type| in |section|, whether it comes from manual user | |
288 // input or the active suggestion. | |
289 base::string16 GetValueFromSection(DialogSection section, | |
290 ServerFieldType type); | |
291 | |
292 // Returns whether the given section can accept an address with the given | |
293 // country code. | |
294 bool CanAcceptCountry(DialogSection section, const std::string& country_code); | |
295 | |
296 // Whether |profile| should be suggested for |section|. | |
297 bool ShouldSuggestProfile(DialogSection section, | |
298 const AutofillProfile& profile); | |
299 | |
300 // Gets the SuggestionsMenuModel for |section|. | |
301 SuggestionsMenuModel* SuggestionsMenuModelForSection(DialogSection section); | |
302 const SuggestionsMenuModel* SuggestionsMenuModelForSection( | |
303 DialogSection section) const; | |
304 // And the reverse. | |
305 DialogSection SectionForSuggestionsMenuModel( | |
306 const SuggestionsMenuModel& model); | |
307 | |
308 // Gets the CountryComboboxModel for |section|. | |
309 CountryComboboxModel* CountryComboboxModelForSection(DialogSection section); | |
310 | |
311 // Clears and builds the inputs in |section| for |country_name|. | |
312 // When |should_clobber| is false, and the view's country value matches | |
313 // |country_name|, the inputs won't be rebuilt. | |
314 bool RebuildInputsForCountry(DialogSection section, | |
315 const base::string16& country_name, | |
316 bool should_clobber); | |
317 | |
318 // Suggested text and icons for sections. Suggestion text is used to show an | |
319 // abridged overview of the currently used suggestion. Extra text is used when | |
320 // part of a section is suggested but part must be manually input (e.g. during | |
321 // a CVC challenge or when using Autofill's CC section [never stores CVC]). | |
322 bool SuggestionTextForSection(DialogSection section, | |
323 base::string16* vertically_compact, | |
324 base::string16* horizontally_compact); | |
325 gfx::Image SuggestionIconForSection(DialogSection section); | |
326 base::string16 ExtraSuggestionTextForSection(DialogSection section) const; | |
327 gfx::Image ExtraSuggestionIconForSection(DialogSection section); | |
328 | |
329 // Suggests address completions using the downloaded i18n validation rules. | |
330 // Stores the suggestions in |i18n_validator_suggestions_|. | |
331 void GetI18nValidatorSuggestions( | |
332 DialogSection section, | |
333 ServerFieldType type, | |
334 std::vector<autofill::Suggestion>* popup_suggestions); | |
335 | |
336 // Like RequestedFieldsForSection, but returns a pointer. | |
337 DetailInputs* MutableRequestedFieldsForSection(DialogSection section); | |
338 | |
339 // Returns a pointer to the language code that should be used for formatting | |
340 // the address in |section| for display. Returns NULL for a non-address | |
341 // |section|. | |
342 std::string* MutableAddressLanguageCodeForSection(DialogSection section); | |
343 | |
344 // Returns the language code that should be used for formatting the address in | |
345 // |section|. Returns an empty string for a non-address |section|. | |
346 std::string AddressLanguageCodeForSection(DialogSection section); | |
347 | |
348 // Returns just the |type| attributes of RequestedFieldsForSection(section). | |
349 std::vector<ServerFieldType> RequestedTypesForSection(DialogSection section) | |
350 const; | |
351 | |
352 // Returns the country code (e.g. "US") for |section|. | |
353 std::string CountryCodeForSection(DialogSection section); | |
354 | |
355 // Hides |popup_controller_|'s popup view, if it exists. | |
356 void HidePopup(); | |
357 | |
358 // Set whether the currently editing |section| was originally based on | |
359 // existing Wallet or Autofill data. | |
360 void SetEditingExistingData(DialogSection section, bool editing); | |
361 | |
362 // Whether the user has chosen to enter all new data in at least one section. | |
363 bool IsManuallyEditingAnySection() const; | |
364 | |
365 // Returns validity message for a given credit card number. | |
366 base::string16 CreditCardNumberValidityMessage( | |
367 const base::string16& number) const; | |
368 | |
369 // Whether all of the input fields currently showing in the dialog have valid | |
370 // contents. This validates only by checking "sure" messages, i.e. messages | |
371 // that would have been displayed to the user during editing, as opposed to | |
372 // submission. | |
373 bool AllSectionsAreValid(); | |
374 | |
375 // Whether all of the input fields currently showing in the given |section| of | |
376 // the dialog have valid contents. This validates only by checking "sure" | |
377 // messages - see AllSectionsAreValid. | |
378 bool SectionIsValid(DialogSection section); | |
379 | |
380 // Whether validation rules for |section| are loaded. | |
381 bool RulesAreLoaded(DialogSection section); | |
382 | |
383 // Whether the currently active credit card expiration date is valid. | |
384 bool IsCreditCardExpirationValid(const base::string16& year, | |
385 const base::string16& month) const; | |
386 | |
387 // Returns true if we should reject the given credit card brand. |type| should | |
388 // be a display string, such as "Visa". | |
389 bool ShouldDisallowCcType(const base::string16& type) const; | |
390 | |
391 // Returns true if |profile| has an address we can be sure is invalid. | |
392 // Profiles with invalid addresses are not suggested in the dropdown menu for | |
393 // billing and shipping addresses. | |
394 bool HasInvalidAddress(const AutofillProfile& profile); | |
395 | |
396 // Returns true if |key| refers to a suggestion, as opposed to some control | |
397 // menu item. | |
398 bool IsASuggestionItemKey(const std::string& key) const; | |
399 | |
400 // Returns whether Autofill is enabled for |profile_|. | |
401 bool IsAutofillEnabled() const; | |
402 | |
403 // Whether the billing section should be used to fill in the shipping details. | |
404 bool ShouldUseBillingForShipping(); | |
405 | |
406 // Whether the user wishes to save information locally to Autofill. | |
407 bool ShouldSaveDetailsLocally(); | |
408 | |
409 // Writes to prefs the choice of AutofillDataModel for |section|. | |
410 void PersistAutofillChoice(DialogSection section, | |
411 const std::string& guid); | |
412 | |
413 // Sets the outparams to the default AutofillDataModel for |section| (which is | |
414 // the first one in the menu that is a suggestion item). | |
415 void GetDefaultAutofillChoice(DialogSection section, | |
416 std::string* guid); | |
417 | |
418 // Reads from prefs the choice of AutofillDataModel for |section|. Returns | |
419 // whether there was a setting to read. | |
420 bool GetAutofillChoice(DialogSection section, | |
421 std::string* guid); | |
422 | |
423 // Logs metrics when the dialog is submitted. | |
424 void LogOnFinishSubmitMetrics(); | |
425 | |
426 // Logs metrics when the dialog is canceled. | |
427 void LogOnCancelMetrics(); | |
428 | |
429 // Logs metrics when the edit ui is shown for the given |section|. | |
430 void LogEditUiShownMetric(DialogSection section); | |
431 | |
432 // Logs metrics when a suggestion item from the given |model| is selected. | |
433 void LogSuggestionItemSelectedMetric(const SuggestionsMenuModel& model); | |
434 | |
435 // Logs the time elapsed from when the dialog was shown to when the user could | |
436 // interact with it. | |
437 void LogDialogLatencyToShow(); | |
438 | |
439 // Returns the metric corresponding to the user's initial state when | |
440 // interacting with this dialog. | |
441 AutofillMetrics::DialogInitialUserStateMetric GetInitialUserState() const; | |
442 | |
443 // Called when the delay for enabling the submit button ends. | |
444 void OnSubmitButtonDelayEnd(); | |
445 | |
446 // The |profile| for |contents_|. | |
447 Profile* const profile_; | |
448 | |
449 // For logging UMA metrics. | |
450 base::Time dialog_shown_timestamp_; | |
451 AutofillMetrics::DialogInitialUserStateMetric initial_user_state_; | |
452 | |
453 FormStructure form_structure_; | |
454 | |
455 // Whether the URL visible to the user when this dialog was requested to be | |
456 // invoked is the same as |source_url_|. | |
457 bool invoked_from_same_origin_; | |
458 | |
459 // The URL of the invoking site. | |
460 GURL source_url_; | |
461 | |
462 // The callback via which we return the collected data. | |
463 AutofillClient::ResultCallback callback_; | |
464 | |
465 // A helper to validate international address input. | |
466 std::unique_ptr<AddressValidator> validator_; | |
467 | |
468 // The default active instrument and shipping address object IDs as of the | |
469 // last time Wallet items were fetched. These variables are only set | |
470 // (i.e. non-empty) when the Wallet items are being re-fetched. | |
471 std::string previous_default_instrument_id_; | |
472 std::string previous_default_shipping_address_id_; | |
473 // The last active instrument and shipping address object IDs. These | |
474 // variables are only set (i.e. non-empty) when the Wallet items are being | |
475 // re-fetched. | |
476 std::string previously_selected_instrument_id_; | |
477 std::string previously_selected_shipping_address_id_; | |
478 | |
479 // When the Wallet items were last fetched. | |
480 base::TimeTicks last_wallet_items_fetch_timestamp_; | |
481 | |
482 // Local machine signals to pass along on each request to trigger (or | |
483 // discourage) risk challenges; sent if the user is up to date on legal docs. | |
484 std::string risk_data_; | |
485 | |
486 // The text to display when the user is accepting new terms of service, etc. | |
487 base::string16 legal_documents_text_; | |
488 // The ranges within |legal_documents_text_| to linkify. | |
489 std::vector<gfx::Range> legal_document_link_ranges_; | |
490 | |
491 // The instrument and address IDs from the Online Wallet server to be used | |
492 // when getting a full wallet. | |
493 std::string active_instrument_id_; | |
494 std::string active_address_id_; | |
495 | |
496 // The fields for billing and shipping which the page has actually requested. | |
497 DetailInputs requested_cc_fields_; | |
498 DetailInputs requested_billing_fields_; | |
499 DetailInputs requested_cc_billing_fields_; | |
500 DetailInputs requested_shipping_fields_; | |
501 | |
502 // The BCP 47 language codes used for formatting the addresses for display. | |
503 std::string billing_address_language_code_; | |
504 std::string shipping_address_language_code_; | |
505 | |
506 // Models for the credit card expiration inputs. | |
507 MonthComboboxModel cc_exp_month_combobox_model_; | |
508 YearComboboxModel cc_exp_year_combobox_model_; | |
509 | |
510 // Models for country input. | |
511 std::unique_ptr<CountryComboboxModel> billing_country_combobox_model_; | |
512 std::unique_ptr<CountryComboboxModel> shipping_country_combobox_model_; | |
513 | |
514 // Models for the suggestion views. | |
515 SuggestionsMenuModel suggested_cc_; | |
516 SuggestionsMenuModel suggested_billing_; | |
517 SuggestionsMenuModel suggested_shipping_; | |
518 | |
519 // The set of values for cc-type that the site accepts. Empty means all types | |
520 // are accepted. | |
521 std::set<base::string16> acceptable_cc_types_; | |
522 | |
523 // |DialogSection|s that are in edit mode that are based on existing data. | |
524 std::set<DialogSection> section_editing_state_; | |
525 | |
526 // Sections that need to be validated when their validation rules load. | |
527 std::set<DialogSection> needs_validation_; | |
528 | |
529 // Whether |form_structure_| has asked for any details that would indicate | |
530 // we should show a shipping section. | |
531 bool cares_about_shipping_; | |
532 | |
533 // Site-provided transaction amount and currency. No attempt to validate this | |
534 // input; it's passed directly to Wallet. | |
535 base::string16 transaction_amount_; | |
536 base::string16 transaction_currency_; | |
537 | |
538 // The IDs for the currently showing unverified profiles popup. This will | |
539 // be the first section in the list. The rest of the items will be the | |
540 // i18n_validator_suggestions_. | |
541 std::vector<std::string> popup_suggestion_ids_; | |
542 | |
543 // The autofill suggestions based on downloaded i18n validation rules. | |
544 std::vector< ::i18n::addressinput::AddressData> i18n_validator_suggestions_; | |
545 | |
546 // The controller for the currently showing popup (which helps users when | |
547 // they're manually filling the dialog). | |
548 base::WeakPtr<AutofillPopupControllerImpl> popup_controller_; | |
549 | |
550 // The type of the visible Autofill popup input (or UNKNOWN_TYPE if none). | |
551 ServerFieldType popup_input_type_; | |
552 | |
553 // The section of the dialog that's showing a popup, undefined if no popup | |
554 // is showing. | |
555 DialogSection popup_section_; | |
556 | |
557 std::unique_ptr<AutofillDialogView> view_; | |
558 | |
559 // A NotificationRegistrar for tracking the completion of sign-in. | |
560 content::NotificationRegistrar signin_registrar_; | |
561 | |
562 // The countries the form structure can accept for shipping. | |
563 std::set<base::string16> acceptable_shipping_countries_; | |
564 | |
565 // Whether |callback_| was Run() with a filled |form_structure_|. | |
566 bool data_was_passed_back_; | |
567 | |
568 typedef std::map<ServerFieldType, | |
569 std::pair<base::string16, base::string16> > TypeErrorInputMap; | |
570 // Whether the latency to display to the UI was logged to UMA yet. | |
571 bool was_ui_latency_logged_; | |
572 | |
573 // A map from dialog sections to the GUID of a newly saved Autofill data | |
574 // models for that section. No entries present that don't have newly saved | |
575 // data models. | |
576 std::map<DialogSection, std::string> newly_saved_data_model_guids_; | |
577 | |
578 // The timer that delays enabling submit button for a short period of time on | |
579 // startup. | |
580 base::OneShotTimer submit_button_delay_timer_; | |
581 | |
582 base::WeakPtrFactory<AutofillDialogControllerImpl> weak_ptr_factory_; | |
583 | |
584 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); | |
585 }; | |
586 | |
587 } // namespace autofill | |
588 | |
589 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ | |
OLD | NEW |