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