autofill_dialog_view.h revision 3551c9c881056c480085172ff9840cab31610854
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_view_delegate.h"
9
10namespace content {
11class NavigationController;
12}
13
14namespace gfx {
15class Size;
16}
17
18namespace autofill {
19
20class AutofillDialogViewDelegate;
21class TestableAutofillDialogView;
22
23// An interface for the dialog that appears when a site initiates an Autofill
24// action via the imperative autocomplete API.
25class AutofillDialogView {
26 public:
27  virtual ~AutofillDialogView();
28
29  // Shows the dialog.
30  virtual void Show() = 0;
31
32  // Closes the dialog window. May self-delete.
33  virtual void Hide() = 0;
34
35  // A hint that the view is going to receive a series of Update* calls soon,
36  // and may want to delay visible changes until after the updates are over.
37  // As multiple calls to UpdatesStarted may be stacked, and the view should
38  // expect an equal number of calls to UpdateFinished().
39  virtual void UpdatesStarted() = 0;
40
41  // The matching call to UpdatesStarted.
42  virtual void UpdatesFinished() = 0;
43
44  // Called when a different notification is available.
45  virtual void UpdateNotificationArea() = 0;
46
47  // Called when account details may have changed (user logs in to GAIA, creates
48  // a new account, etc.).
49  virtual void UpdateAccountChooser() = 0;
50
51  // Updates the container displaying detailed steps for Autocheckout. Called
52  // as progress is made through the buyflow.
53  virtual void UpdateAutocheckoutStepsArea() = 0;
54
55  // Updates the button strip based on the current controller state.
56  virtual void UpdateButtonStrip() = 0;
57
58  // Updates the container for the detail inputs. Used to hide this container
59  // while Autocheckout is running.
60  virtual void UpdateDetailArea() = 0;
61
62  // Updates the validity status of the detail inputs.
63  virtual void UpdateForErrors() = 0;
64
65  // Called when the contents of a section have changed.
66  virtual void UpdateSection(DialogSection section) = 0;
67
68  // Fills the given section with Autofill data that was triggered by a user
69  // interaction with |originating_input|.
70  virtual void FillSection(DialogSection section,
71                           const DetailInput& originating_input) = 0;
72
73  // Fills |output| with data the user manually input.
74  virtual void GetUserInput(DialogSection section, DetailOutputMap* output) = 0;
75
76  // Gets the CVC value the user typed to go along with the stored credit card
77  // data. If the user is inputing credit card data from scratch, this is not
78  // relevant.
79  virtual string16 GetCvc() = 0;
80
81  // Returns true if new or edited autofill details should be saved.
82  virtual bool SaveDetailsLocally() = 0;
83
84  // Triggers dialog to sign in to Google.
85  // Returns a NotificationSource to be used to monitor for sign-in completion.
86  virtual const content::NavigationController* ShowSignIn() = 0;
87
88  // Closes out any sign-in UI and returns to normal operation.
89  virtual void HideSignIn() = 0;
90
91  // Updates the progress bar based on the Autocheckout progress. |value| should
92  // be in [0.0, 1.0].
93  virtual void UpdateProgressBar(double value) = 0;
94
95  // Called when the active suggestions data model changed.
96  virtual void ModelChanged() = 0;
97
98  // Returns an object that can be used to test that the view is behaving as
99  // expected.
100  virtual TestableAutofillDialogView* GetTestableView() = 0;
101
102  // Called by AutofillDialogSignInDelegate when the sign-in page experiences a
103  // resize. |pref_size| is the new preferred size of the sign-in page.
104  virtual void OnSignInResize(const gfx::Size& pref_size) = 0;
105
106  // Factory function to create the dialog (implemented once per view
107  // implementation). |controller| will own the created dialog.
108  static AutofillDialogView* Create(AutofillDialogViewDelegate* delegate);
109};
110
111}  // namespace autofill
112
113#endif  // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_VIEW_H_
114