autofill_dialog_view.h revision 2a99a7e74a7f215066514fe81d2bfa6639d9eddd
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_VIEW_H_
6#define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_VIEW_H_
7
8#include "chrome/browser/ui/autofill/autofill_dialog_controller.h"
9
10namespace content {
11class NavigationController;
12}
13
14namespace autofill {
15
16// An interface for the dialog that appears when a site initiates an Autofill
17// action via the imperative autocomplete API.
18class AutofillDialogView {
19 public:
20  virtual ~AutofillDialogView();
21
22  // Shows the dialog.
23  virtual void Show() = 0;
24
25  // Hides the dialog as if a user pressed cancel.
26  virtual void Hide() = 0;
27
28  // Called when a different notification is available.
29  virtual void UpdateNotificationArea() = 0;
30
31  // Called when account details may have changed (user logs in to GAIA, creates
32  // a new account, etc.).
33  virtual void UpdateAccountChooser() = 0;
34
35  // Updates the button strip based on the current controller state.
36  virtual void UpdateButtonStrip() = 0;
37
38  // Called when the contents of a section have changed.
39  virtual void UpdateSection(DialogSection section) = 0;
40
41  // Fills |output| with data the user manually input.
42  virtual void GetUserInput(DialogSection section, DetailOutputMap* output) = 0;
43
44  // Gets the CVC value the user typed to go along with the stored credit card
45  // data. If the user is inputing credit card data from scratch, this is not
46  // relevant.
47  virtual string16 GetCvc() = 0;
48
49  // Returns the state of the "use billing address for shipping" checkbox.
50  virtual bool UseBillingForShipping() = 0;
51
52  // Returns true if current input should be saved in Wallet (if it differs).
53  virtual bool SaveDetailsInWallet() = 0;
54
55  // Returns true if new or edited autofill details should be saved.
56  virtual bool SaveDetailsLocally() = 0;
57
58  // Triggers dialog to sign in to Google.
59  // Returns a NotificationSource to be used to monitor for sign-in completion.
60  virtual const content::NavigationController* ShowSignIn() = 0;
61
62  // Closes out any signin UI and returns to normal operation.
63  virtual void HideSignIn() = 0;
64
65  // Updates the progress bar based on the Autocheckout progress. |value| should
66  // be in [0.0, 1.0].
67  virtual void UpdateProgressBar(double value) = 0;
68
69  // Called when the active suggestions data model changed.
70  virtual void ModelChanged() = 0;
71
72  // Simulates the user pressing 'Submit' to accept the dialog.
73  virtual void SubmitForTesting() = 0;
74
75  // Simulates the user pressing 'Cancel' to abort the dialog.
76  virtual void CancelForTesting() = 0;
77
78  // Factory function to create the dialog (implemented once per view
79  // implementation). |controller| will own the created dialog.
80  static AutofillDialogView* Create(AutofillDialogController* controller);
81};
82
83}  // namespace autofill
84
85#endif  // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_VIEW_H_
86