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