autofill_dialog_view.h revision eb525c5499e34cc9c4b825d6d9e75bb07cc06ace
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 gfx {
15class Size;
16}
17
18namespace autofill {
19
20class AutofillDialogController;
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  // Called when a different notification is available.
36  virtual void UpdateNotificationArea() = 0;
37
38  // Called when account details may have changed (user logs in to GAIA, creates
39  // a new account, etc.).
40  virtual void UpdateAccountChooser() = 0;
41
42  // Updates the container displaying detailed steps for Autocheckout. Called
43  // as progress is made through the buyflow.
44  virtual void UpdateAutocheckoutStepsArea() = 0;
45
46  // Updates the button strip based on the current controller state.
47  virtual void UpdateButtonStrip() = 0;
48
49  // Updates the container for the detail inputs. Used to hide this container
50  // while Autocheckout is running.
51  virtual void UpdateDetailArea() = 0;
52
53  // Updates the validity status of the detail inputs.
54  virtual void UpdateForErrors() = 0;
55
56  // Called when the contents of a section have changed.
57  virtual void UpdateSection(DialogSection section) = 0;
58
59  // Fills the given section with Autofill data that was triggered by a user
60  // interaction with |originating_input|.
61  virtual void FillSection(DialogSection section,
62                           const DetailInput& originating_input) = 0;
63
64  // Fills |output| with data the user manually input.
65  virtual void GetUserInput(DialogSection section, DetailOutputMap* output) = 0;
66
67  // Gets the CVC value the user typed to go along with the stored credit card
68  // data. If the user is inputing credit card data from scratch, this is not
69  // relevant.
70  virtual string16 GetCvc() = 0;
71
72  // Returns true if new or edited autofill details should be saved.
73  virtual bool SaveDetailsLocally() = 0;
74
75  // Triggers dialog to sign in to Google.
76  // Returns a NotificationSource to be used to monitor for sign-in completion.
77  virtual const content::NavigationController* ShowSignIn() = 0;
78
79  // Closes out any sign-in UI and returns to normal operation.
80  virtual void HideSignIn() = 0;
81
82  // Updates the progress bar based on the Autocheckout progress. |value| should
83  // be in [0.0, 1.0].
84  virtual void UpdateProgressBar(double value) = 0;
85
86  // Called when the active suggestions data model changed.
87  virtual void ModelChanged() = 0;
88
89  // Returns an object that can be used to test that the view is behaving as
90  // expected. This should be implemented on all platforms, but for now returns
91  // NULL on everything but Views.
92  virtual TestableAutofillDialogView* GetTestableView();
93
94  // Called by AutofillDialogSignInDelegate when the sign-in page experiences a
95  // resize. |pref_size| is the new preferred size of the sign-in page.
96  virtual void OnSignInResize(const gfx::Size& pref_size) = 0;
97
98  // Factory function to create the dialog (implemented once per view
99  // implementation). |controller| will own the created dialog.
100  static AutofillDialogView* Create(AutofillDialogController* controller);
101};
102
103}  // namespace autofill
104
105#endif  // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_VIEW_H_
106