autofill_dialog_controller_impl.h revision a93a17c8d99d686bd4a1511e5504e5e6cc9fcadf
156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks// Copyright (c) 2012 The Chromium Authors. All rights reserved.
256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks// Use of this source code is governed by a BSD-style license that can be
356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks// found in the LICENSE file.
456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks#ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_
656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks#define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_
756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks#include <map>
956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks#include <vector>
107df30109963092559d3760c0661a020f9daf1030The Android Open Source Project
117df30109963092559d3760c0661a020f9daf1030The Android Open Source Project#include "base/callback.h"
127df30109963092559d3760c0661a020f9daf1030The Android Open Source Project#include "base/memory/scoped_ptr.h"
137df30109963092559d3760c0661a020f9daf1030The Android Open Source Project#include "base/memory/weak_ptr.h"
147df30109963092559d3760c0661a020f9daf1030The Android Open Source Project#include "base/string16.h"
157df30109963092559d3760c0661a020f9daf1030The Android Open Source Project#include "base/time.h"
167df30109963092559d3760c0661a020f9daf1030The Android Open Source Project#include "chrome/browser/ui/autofill/account_chooser_model.h"
177df30109963092559d3760c0661a020f9daf1030The Android Open Source Project#include "chrome/browser/ui/autofill/autofill_dialog_controller.h"
187df30109963092559d3760c0661a020f9daf1030The Android Open Source Project#include "chrome/browser/ui/autofill/autofill_dialog_models.h"
197df30109963092559d3760c0661a020f9daf1030The Android Open Source Project#include "chrome/browser/ui/autofill/autofill_dialog_types.h"
207df30109963092559d3760c0661a020f9daf1030The Android Open Source Project#include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h"
217df30109963092559d3760c0661a020f9daf1030The Android Open Source Project#include "chrome/browser/ui/autofill/country_combobox_model.h"
2256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks#include "components/autofill/browser/autofill_manager_delegate.h"
2356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks#include "components/autofill/browser/autofill_metrics.h"
2456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks#include "components/autofill/browser/autofill_popup_delegate.h"
2556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks#include "components/autofill/browser/field_types.h"
2656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks#include "components/autofill/browser/form_structure.h"
2756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks#include "components/autofill/browser/personal_data_manager.h"
2856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks#include "components/autofill/browser/personal_data_manager_observer.h"
2956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks#include "components/autofill/browser/wallet/wallet_client.h"
3056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks#include "components/autofill/browser/wallet/wallet_client_delegate.h"
3156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks#include "components/autofill/browser/wallet/wallet_signin_helper_delegate.h"
3256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks#include "content/public/browser/notification_observer.h"
3356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks#include "content/public/browser/notification_registrar.h"
3456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks#include "content/public/common/ssl_status.h"
3556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks#include "googleurl/src/gurl.h"
3656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks#include "ui/base/models/simple_menu_model.h"
3756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks#include "ui/base/ui_base_types.h"
3856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
3956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparksclass Profile;
4056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
4156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparksnamespace content {
4256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparksclass WebContents;
4356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks}
4456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
4556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparksnamespace user_prefs {
4656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparksclass PrefRegistrySyncable;
4756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks}
4856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
4956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparksnamespace autofill {
5056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
5156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparksclass AutofillDataModel;
5256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparksclass AutofillDialogView;
5356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparksclass AutofillPopupControllerImpl;
5456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparksclass DataModelWrapper;
5556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
5656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparksnamespace risk {
5756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparksclass Fingerprint;
5856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks}
5956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
6056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparksnamespace wallet {
6156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparksclass WalletSigninHelper;
6256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks}
6356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
6456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks// This class drives the dialog that appears when a site uses the imperative
6556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks// autocomplete API to fill out a form.
6656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparksclass AutofillDialogControllerImpl : public AutofillDialogController,
6756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks                                     public AutofillPopupDelegate,
6856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks                                     public content::NotificationObserver,
6956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks                                     public SuggestionsMenuModelDelegate,
7056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks                                     public wallet::WalletClientDelegate,
7156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks                                     public wallet::WalletSigninHelperDelegate,
7256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks                                     public PersonalDataManagerObserver,
7356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks                                     public AccountChooserModelDelegate {
7456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks public:
7556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual ~AutofillDialogControllerImpl();
7656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
7756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  static base::WeakPtr<AutofillDialogControllerImpl> Create(
7856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      content::WebContents* contents,
7956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      const FormData& form_structure,
8056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      const GURL& source_url,
8156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      const DialogType dialog_type,
8256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      const base::Callback<void(const FormStructure*,
8356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks                                const std::string&)>& callback);
8456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
8556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry);
8656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
8756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  void Show();
8856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  void Hide();
8956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
9056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Updates the progress bar based on the Autocheckout progress. |value| should
9156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // be in [0.0, 1.0].
9256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  void UpdateProgressBar(double value);
9356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
9456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Whether Autocheckout is currently running.
9556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  bool AutocheckoutIsRunning() const;
9656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
9756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Whether there was an error in the previous Autocheckout flow.
9856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  bool HadAutocheckoutError() const;
9956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
10056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Called when there is an error in an active Autocheckout flow.
10156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  void OnAutocheckoutError();
10256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
10356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // AutofillDialogController implementation.
10456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual string16 DialogTitle() const OVERRIDE;
10556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual string16 AccountChooserText() const OVERRIDE;
10656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual string16 SignInLinkText() const OVERRIDE;
10756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual string16 EditSuggestionText() const OVERRIDE;
10856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual string16 CancelButtonText() const OVERRIDE;
10956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual string16 ConfirmButtonText() const OVERRIDE;
11056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual string16 SaveLocallyText() const OVERRIDE;
11156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual string16 ProgressBarText() const OVERRIDE;
11256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual string16 LegalDocumentsText() OVERRIDE;
11356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual DialogSignedInState SignedInState() const OVERRIDE;
11456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual bool ShouldShowSpinner() const OVERRIDE;
11556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual bool ShouldOfferToSaveInChrome() const OVERRIDE;
11656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual ui::MenuModel* MenuModelForAccountChooser() OVERRIDE;
11756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual gfx::Image AccountChooserImage() OVERRIDE;
11856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual bool ShouldShowDetailArea() const OVERRIDE;
11956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual bool ShouldShowProgressBar() const OVERRIDE;
12056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE;
12156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual const std::vector<ui::Range>& LegalDocumentLinks() OVERRIDE;
12256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual bool SectionIsActive(DialogSection section) const OVERRIDE;
12356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual const DetailInputs& RequestedFieldsForSection(DialogSection section)
12456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      const OVERRIDE;
12556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual ui::ComboboxModel* ComboboxModelForAutofillType(
12656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      AutofillFieldType type) OVERRIDE;
12756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual ui::MenuModel* MenuModelForSection(DialogSection section) OVERRIDE;
12856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks#if defined(OS_ANDROID)
12956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual ui::MenuModel* MenuModelForSectionHack(DialogSection section)
13056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      OVERRIDE;
13156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks#endif
13256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual string16 LabelForSection(DialogSection section) const OVERRIDE;
13356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual SuggestionState SuggestionStateForSection(
13456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      DialogSection section) OVERRIDE;
13556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void EditClickedForSection(DialogSection section) OVERRIDE;
13656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void EditCancelledForSection(DialogSection section) OVERRIDE;
13756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual gfx::Image IconForField(AutofillFieldType type,
13856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks                                  const string16& user_input) const OVERRIDE;
13956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual string16 InputValidityMessage(AutofillFieldType type,
14056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks                                        const string16& value) const OVERRIDE;
14156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual ValidityData InputsAreValid(
14256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      const DetailOutputMap& inputs,
14356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      ValidationType validation_type) const OVERRIDE;
14456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void UserEditedOrActivatedInput(const DetailInput* input,
14556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks                                          gfx::NativeView parent_view,
14656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks                                          const gfx::Rect& content_bounds,
14756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks                                          const string16& field_contents,
14856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks                                          bool was_edit) OVERRIDE;
14956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual bool HandleKeyPressEventInInput(
15056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      const content::NativeWebKeyboardEvent& event) OVERRIDE;
15156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void FocusMoved() OVERRIDE;
15256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void ViewClosed() OVERRIDE;
15356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual std::vector<DialogNotification> CurrentNotifications() const OVERRIDE;
15456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void SignInLinkClicked() OVERRIDE;
15556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void NotificationCheckboxStateChanged(DialogNotification::Type type,
15656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks                                                bool checked) OVERRIDE;
15756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void LegalDocumentLinkClicked(const ui::Range& range) OVERRIDE;
15856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void OnCancel() OVERRIDE;
15956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void OnAccept() OVERRIDE;
16056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual Profile* profile() OVERRIDE;
16156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual content::WebContents* web_contents() OVERRIDE;
16256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
16356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // AutofillPopupDelegate implementation.
16456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void OnPopupShown(content::KeyboardListener* listener) OVERRIDE;
16556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void OnPopupHidden(content::KeyboardListener* listener) OVERRIDE;
16656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void DidSelectSuggestion(int identifier) OVERRIDE;
16756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void DidAcceptSuggestion(const string16& value,
16856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks                                   int identifier) OVERRIDE;
16956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void RemoveSuggestion(const string16& value,
17056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks                                int identifier) OVERRIDE;
17156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void ClearPreviewedForm() OVERRIDE;
17256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
17356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // content::NotificationObserver implementation.
17456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void Observe(int type,
17556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks                       const content::NotificationSource& source,
17656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks                       const content::NotificationDetails& details) OVERRIDE;
17756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
17856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // SuggestionsMenuModelDelegate implementation.
17956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void SuggestionItemSelected(SuggestionsMenuModel* model,
18056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks                                      size_t index) OVERRIDE;
18156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
18256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // wallet::WalletClientDelegate implementation.
18356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual const AutofillMetrics& GetMetricLogger() const OVERRIDE;
18456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual DialogType GetDialogType() const OVERRIDE;
18556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual std::string GetRiskData() const OVERRIDE;
18656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void OnDidAcceptLegalDocuments() OVERRIDE;
18756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void OnDidAuthenticateInstrument(bool success) OVERRIDE;
18856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void OnDidGetFullWallet(
18956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      scoped_ptr<wallet::FullWallet> full_wallet) OVERRIDE;
19056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void OnDidGetWalletItems(
19156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      scoped_ptr<wallet::WalletItems> wallet_items) OVERRIDE;
19256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void OnDidSaveAddress(
19356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      const std::string& address_id,
19456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      const std::vector<wallet::RequiredAction>& required_actions) OVERRIDE;
19556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void OnDidSaveInstrument(
19656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      const std::string& instrument_id,
19756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      const std::vector<wallet::RequiredAction>& required_actions) OVERRIDE;
19856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void OnDidSaveInstrumentAndAddress(
19956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      const std::string& instrument_id,
20056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      const std::string& address_id,
20156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      const std::vector<wallet::RequiredAction>& required_actions) OVERRIDE;
20256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void OnDidUpdateAddress(
20356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      const std::string& address_id,
20456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      const std::vector<wallet::RequiredAction>& required_actions) OVERRIDE;
20556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void OnDidUpdateInstrument(
20656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      const std::string& instrument_id,
20756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      const std::vector<wallet::RequiredAction>& required_actions) OVERRIDE;
20856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void OnWalletError(
20956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      wallet::WalletClient::ErrorType error_type) OVERRIDE;
21056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void OnMalformedResponse() OVERRIDE;
21156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void OnNetworkError(int response_code) OVERRIDE;
21256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
21356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // PersonalDataManagerObserver implementation.
21456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void OnPersonalDataChanged() OVERRIDE;
21556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
21656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // AccountChooserModelDelegate implementation.
21756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void AccountChoiceChanged() OVERRIDE;
21856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void UpdateAccountChooserView() OVERRIDE;
21956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
22056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // wallet::WalletSigninHelperDelegate implementation.
22156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void OnPassiveSigninSuccess(const std::string& username) OVERRIDE;
22256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void OnPassiveSigninFailure(
22356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      const GoogleServiceAuthError& error) OVERRIDE;
22456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void OnAutomaticSigninSuccess(const std::string& username) OVERRIDE;
22556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void OnAutomaticSigninFailure(
22656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      const GoogleServiceAuthError& error) OVERRIDE;
22756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void OnUserNameFetchSuccess(const std::string& username) OVERRIDE;
22856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void OnUserNameFetchFailure(
22956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      const GoogleServiceAuthError& error) OVERRIDE;
23056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
23156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  DialogType dialog_type() const { return dialog_type_; }
23256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
23356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks protected:
23456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Exposed for testing.
23556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  AutofillDialogControllerImpl(
23656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      content::WebContents* contents,
23756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      const FormData& form_structure,
23856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      const GURL& source_url,
23956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      const DialogType dialog_type,
24056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      const base::Callback<void(const FormStructure*,
24156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks                                const std::string&)>& callback);
24256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
24356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Exposed for testing.
24456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  AutofillDialogView* view() { return view_.get(); }
24556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual AutofillDialogView* CreateView();
24656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  const DetailInput* input_showing_popup() const {
24756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks    return input_showing_popup_;
24856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  }
24956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
25056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Returns the PersonalDataManager for |profile_|.
25156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual PersonalDataManager* GetManager();
25256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
25356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Returns the WalletClient* this class uses to talk to Online Wallet. Exposed
25456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // for testing.
25556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual wallet::WalletClient* GetWalletClient();
25656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
25756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Call to disable communication to Online Wallet for this dialog.
25856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Exposed for testing.
25956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  void DisableWallet();
26056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
26156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Returns whether Wallet is the current data source. Exposed for testing.
26256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual bool IsPayingWithWallet() const;
26356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
26456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Exposed and virtual for testing.
26556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual bool IsFirstRun() const;
26656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
26756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Opens the given URL in a new foreground tab.
26856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  virtual void OpenTabWithUrl(const GURL& url);
26956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
27056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks private:
27156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Whether or not the current request wants credit info back.
27256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  bool RequestingCreditCardInfo() const;
27356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
27456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Whether the information input in this dialog will be securely transmitted
27556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // to the requesting site.
27656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  bool TransmissionWillBeSecure() const;
27756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
27856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Initializes |suggested_email_| et al.
27956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  void SuggestionsUpdated();
28056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
28156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Returns whether |profile| is complete, i.e. can fill out all the relevant
28256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // address info. Incomplete profiles will not be displayed in the dropdown
28356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // menu.
28456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  bool IsCompleteProfile(const AutofillProfile& profile);
28556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
28656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Whether the user's wallet items have at least one address and instrument.
28756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  bool HasCompleteWallet() const;
28856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
28956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Starts fetching the wallet items from Online Wallet.
29056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  void GetWalletItems();
29156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
29256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Stop showing sign in flow.
29356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  void HideSignIn();
29456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
29556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Handles the SignedInState() on Wallet or sign-in state update.
29656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Triggers the user name fetch and the passive/automatic sign-in.
29756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  void SignedInStateUpdated();
29856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
29956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Refreshes the model on Wallet or sign-in state update.
30056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  void OnWalletOrSigninUpdate();
30156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
30256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Should be called on the Wallet sign-in error.
30356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  void OnWalletSigninError();
30456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
30556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Calculates |legal_documents_text_| and |legal_document_link_ranges_| if
30656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // they have not already been calculated.
30756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  void EnsureLegalDocumentsText();
30856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
30956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Clears previously entered manual input, shows editing UI if the current
31056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // suggestion is invalid, and updates the |view_| (if it exists).
31156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  void PrepareDetailInputsForSection(DialogSection section);
31256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
31356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Creates a DataModelWrapper item for the item that's checked in the
31456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // suggestion model for |section|. This may represent Autofill
31556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // data or Wallet data, depending on whether Wallet is currently enabled.
31656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  scoped_ptr<DataModelWrapper> CreateWrapper(DialogSection section);
31756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
31856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Fills in |section|-related fields in |output_| according to the state of
31956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // |view_|.
32056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  void FillOutputForSection(DialogSection section);
32156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // As above, but uses |compare| to determine whether a DetailInput matches
32256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // a field. Saves any new Autofill data to the PersonalDataManager.
32356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  void FillOutputForSectionWithComparator(DialogSection section,
32456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks                                          const InputFieldComparator& compare);
32556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
32656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Fills in |form_structure_| using |form_group|. Utility method for
32756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // FillOutputForSection.
32856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  void FillFormStructureForSection(const AutofillDataModel& data_model,
32956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks                                   size_t variant,
33056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks                                   DialogSection section,
33156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks                                   const InputFieldComparator& compare);
33256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
33356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Sets the CVC result on |form_structure_| to the value in |cvc|.
33456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  void SetCvcResult(const string16& cvc);
33556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
33656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Gets the name from SECTION_CC (if that section is active). This might
33756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // come from manual user input or the active suggestion.
33856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  string16 GetCcName();
33956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
34056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Gets the SuggestionsMenuModel for |section|.
34156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  SuggestionsMenuModel* SuggestionsMenuModelForSection(DialogSection section);
34256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  const SuggestionsMenuModel* SuggestionsMenuModelForSection(
34356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      DialogSection section) const;
34456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // And the reverse.
34556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  DialogSection SectionForSuggestionsMenuModel(
34656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      const SuggestionsMenuModel& model);
34756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
34856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Suggested text and icons for sections. Suggestion text is used to show an
34956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // abidged overview of the currently used suggestion. Extra text is used when
35056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // part of a section is suggested but part must be manually input (e.g. during
35156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // a CVC challenge or when using Autofill's CC section [never stores CVC]).
35256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  string16 SuggestionTextForSection(DialogSection section);
35356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  gfx::Font::FontStyle SuggestionTextStyleForSection(DialogSection section)
35456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      const;
35556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  string16 RequiredActionTextForSection(DialogSection section) const;
35656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  gfx::Image SuggestionIconForSection(DialogSection section);
35756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  string16 ExtraSuggestionTextForSection(DialogSection section) const;
35856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  gfx::Image ExtraSuggestionIconForSection(DialogSection section) const;
35956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
36056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Whether |section| should be showing an "Edit" link.
36156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  bool EditEnabledForSection(DialogSection section) const;
36256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
36356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Loads profiles that can suggest data for |type|. |field_contents| is the
36456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // part the user has already typed. |inputs| is the rest of section.
36556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Identifying info is loaded into the last three outparams as well as
36656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // |popup_guids_|.
36756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  void GetProfileSuggestions(
36856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      AutofillFieldType type,
36956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      const string16& field_contents,
37056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      const DetailInputs& inputs,
37156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      std::vector<string16>* popup_values,
37256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      std::vector<string16>* popup_labels,
37356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      std::vector<string16>* popup_icons);
37456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
37556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Like RequestedFieldsForSection, but returns a pointer.
37656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  DetailInputs* MutableRequestedFieldsForSection(DialogSection section);
37756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
37856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Hides |popup_controller_|'s popup view, if it exists.
37956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  void HidePopup();
38056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
38156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Asks risk module to asynchronously load fingerprint data. Data will be
38256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // returned via OnDidLoadRiskFingerprintData.
38356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  void LoadRiskFingerprintData();
38456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  void OnDidLoadRiskFingerprintData(scoped_ptr<risk::Fingerprint> fingerprint);
38556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
38656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Whether the user has chosen to enter all new data in |section|. This
38756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // happens via choosing "Add a new X..." from a section's suggestion menu.
38856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  bool IsManuallyEditingSection(DialogSection section) const;
38956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
39056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Whether the user has chosen to enter all new data in at least one section.
39156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  bool IsManuallyEditingAnySection() const;
39256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
39356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Returns true if the |value| is a valid string for the given autofill field
39456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // type.
39556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  bool InputIsValid(AutofillFieldType type, const string16& value) const;
39656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
39756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Whether all of the input fields currently showing in the dialog have valid
39856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // contents.
39956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  bool AllSectionsAreValid() const;
40056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
40156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Whether all of the input fields currently showing in the given |section| of
40256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // the dialog have valid contents.
40356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  bool SectionIsValid(DialogSection section) const;
40456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
40556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Returns true if |key| refers to a suggestion, as opposed to some control
40656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // menu item.
40756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  bool IsASuggestionItemKey(const std::string& key);
40856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
40956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Whether the billing section should be used to fill in the shipping details.
41056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  bool ShouldUseBillingForShipping();
41156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
41256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Whether the user wishes to save information locally to Autofill.
41356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  bool ShouldSaveDetailsLocally();
41456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
41556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Change whether the controller is currently submitting details to Autofill
41656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // or Online Wallet (|is_submitting_|) and update the view.
41756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  void SetIsSubmitting(bool submitting);
41856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
41956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Start the submit proccess to interact with Online Wallet (might do various
42056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // things like accept documents, save details, update details, respond to
42156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // required actions, etc.).
42256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  void SubmitWithWallet();
42356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
42456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Creates an instrument based on |views_|' contents.
42556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  scoped_ptr<wallet::Instrument> CreateTransientInstrument();
42656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
42756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Creates an update request based on |instrument|. May return NULL.
42856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  scoped_ptr<wallet::WalletClient::UpdateInstrumentRequest>
42956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      CreateUpdateInstrumentRequest(const wallet::Instrument* instrument,
43056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks                                    const std::string& instrument_id);
43156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
43256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Creates an address based on the contents of |view_|.
43356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  scoped_ptr<wallet::Address> CreateTransientAddress();
43456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
43556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Gets a full wallet from Online Wallet so the user can purchase something.
43656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // This information is decoded to reveal a fronting (proxy) card.
43756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  void GetFullWallet();
43856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
43956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Updates the state of the controller and |view_| based on any required
44056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // actions returned by Save or Update calls to Wallet.
44156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  void HandleSaveOrUpdateRequiredActions(
44256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks      const std::vector<wallet::RequiredAction>& required_actions);
44356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
44456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Whether submission is currently waiting for |action| to be handled.
44556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  bool IsSubmitPausedOn(wallet::RequiredAction action) const;
44656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
44756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Called when there's nothing left to accept, update, save, or authenticate
44856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // in order to fill |form_structure_| and pass data back to the invoking page.
44956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  void FinishSubmit();
45056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
45156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Logs metrics when the dialog is submitted.
45256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  void LogOnFinishSubmitMetrics();
45356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
45456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Logs metrics when the dialog is canceled.
45556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  void LogOnCancelMetrics();
45656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
45756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Logs metrics when the edit ui is shown for the given |section|.
45856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  void LogEditUiShownMetric(DialogSection section);
45956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
46056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Logs metrics when a suggestion item from the given |model| is selected.
46156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  void LogSuggestionItemSelectedMetric(const SuggestionsMenuModel& model);
46256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
46356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Logs the time elapsed from when the dialog was shown to when the user could
46456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // interact with it.
46556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  void LogDialogLatencyToShow();
46656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
46756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Returns the metric corresponding to the user's initial state when
46856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // interacting with this dialog.
46956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  AutofillMetrics::DialogInitialUserStateMetric GetInitialUserState() const;
47056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
47156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // The |profile| for |contents_|.
47256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  Profile* const profile_;
47356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
47456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // The WebContents where the Autofill action originated.
47556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  content::WebContents* const contents_;
47656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
47756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // For logging UMA metrics.
47856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  const AutofillMetrics metric_logger_;
47956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  base::Time dialog_shown_timestamp_;
48056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  AutofillMetrics::DialogInitialUserStateMetric initial_user_state_;
48156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
48256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // The time that Autocheckout started running. Reset on error. While this is
48356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // a valid time, |AutocheckoutIsRunning()| will return true.
48456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  base::Time autocheckout_started_timestamp_;
48556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
48656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Whether this is an Autocheckout or a requestAutocomplete dialog.
48756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  const DialogType dialog_type_;
48856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
48956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  FormStructure form_structure_;
49056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
49156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Whether the URL visible to the user when this dialog was requested to be
49256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // invoked is the same as |source_url_|.
49356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  bool invoked_from_same_origin_;
49456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
49556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // The URL of the invoking site.
49656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  GURL source_url_;
49756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
49856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // The SSL info from the invoking site.
49956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  content::SSLStatus ssl_status_;
50056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
50156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // The callback via which we return the collected data and, if Online Wallet
50256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // was used, the Google transaction id.
50356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  base::Callback<void(const FormStructure*, const std::string&)> callback_;
50456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
50556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // The AccountChooserModel acts as the MenuModel for the account chooser,
50656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // and also tracks which data source the dialog is using.
50756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  AccountChooserModel account_chooser_model_;
50856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
50956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // The sign-in helper to fetch the user info and perform passive sign-in.
51056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // The helper is set only during fetch/sign-in, and NULL otherwise.
51156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  scoped_ptr<wallet::WalletSigninHelper> signin_helper_;
51256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
51356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // A client to talk to the Online Wallet API.
51456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  wallet::WalletClient wallet_client_;
51556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
51656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Recently received items retrieved via |wallet_client_|.
51756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  scoped_ptr<wallet::WalletItems> wallet_items_;
51856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  scoped_ptr<wallet::FullWallet> full_wallet_;
51956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
52056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // The text to display when the user is accepting new terms of service, etc.
52156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  string16 legal_documents_text_;
52256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // The ranges within |legal_documents_text_| to linkify.
52356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  std::vector<ui::Range> legal_document_link_ranges_;
52456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
52556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // The instrument and address IDs from the Online Wallet server to be used
52656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // when getting a full wallet.
52756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  std::string active_instrument_id_;
52856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  std::string active_address_id_;
52956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
53056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // The fields for billing and shipping which the page has actually requested.
53156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  DetailInputs requested_email_fields_;
53256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  DetailInputs requested_cc_fields_;
53356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  DetailInputs requested_billing_fields_;
53456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  DetailInputs requested_cc_billing_fields_;
53556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  DetailInputs requested_shipping_fields_;
53656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
53756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Models for the credit card expiration inputs.
53856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  MonthComboboxModel cc_exp_month_combobox_model_;
53956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  YearComboboxModel cc_exp_year_combobox_model_;
54056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
54156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Model for the country input.
54256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  CountryComboboxModel country_combobox_model_;
54356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
54456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Models for the suggestion views.
54556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  SuggestionsMenuModel suggested_email_;
54656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  SuggestionsMenuModel suggested_cc_;
54756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  SuggestionsMenuModel suggested_billing_;
54856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  SuggestionsMenuModel suggested_cc_billing_;
54956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  SuggestionsMenuModel suggested_shipping_;
55056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
55156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // A map from DialogSection to editing state (true for editing, false for
55256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // not editing). This only tracks if the user has clicked the edit link.
55356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  std::map<DialogSection, bool> section_editing_state_;
55456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
55556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // The GUIDs for the currently showing unverified profiles popup.
55656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  std::vector<PersonalDataManager::GUIDPair> popup_guids_;
55756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
55856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // The controller for the currently showing popup (which helps users when
55956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // they're manually filling the dialog).
56056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  base::WeakPtr<AutofillPopupControllerImpl> popup_controller_;
56156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
56256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // The input for which |popup_controller_| is currently showing a popup
56356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // (if any).
56456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  const DetailInput* input_showing_popup_;
56556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
56656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  scoped_ptr<AutofillDialogView> view_;
56756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
56856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // A NotificationRegistrar for tracking the completion of sign-in.
56956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  content::NotificationRegistrar signin_registrar_;
57056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
57156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  base::WeakPtrFactory<AutofillDialogControllerImpl> weak_ptr_factory_;
57256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
57356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Whether this is the first time this profile has seen the Autofill dialog.
57456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  bool is_first_run_;
57556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
57656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // True after the user first accepts the dialog and presses "Submit". May
57756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // continue to be true while processing required actions.
57856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  bool is_submitting_;
57956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
58056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Whether or not there was a server side validation error saving or updating
58156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Wallet data.
58256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  bool wallet_server_validation_error_;
58356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
58456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Whether or not there was an error in the Autocheckout flow.
58556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  bool had_autocheckout_error_;
58656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
58756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  // Whether the latency to display to the UI was logged to UMA yet.
58856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  bool was_ui_latency_logged_;
58956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
59056c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks  DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl);
59156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks};
59256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
59356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks}  // namespace autofill
59456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
59556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks#endif  // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_
59656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks