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.
5 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_VIEW_H_
6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_VIEW_H_
8 #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h"
11 class NavigationController
;
21 class AutofillDialogViewDelegate
;
22 class TestableAutofillDialogView
;
24 // An interface for the dialog that appears when a site initiates an Autofill
25 // action via the imperative autocomplete API.
26 class AutofillDialogView
{
28 virtual ~AutofillDialogView();
31 virtual void Show() = 0;
33 // Closes the dialog window. May self-delete.
34 virtual void Hide() = 0;
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;
42 // The matching call to UpdatesStarted.
43 virtual void UpdatesFinished() = 0;
45 // Called when a different notification is available.
46 virtual void UpdateNotificationArea() = 0;
48 // Called when account details may have changed (user logs in to GAIA, creates
49 // a new account, etc.).
50 virtual void UpdateAccountChooser() = 0;
52 // Updates the button strip based on the current controller state.
53 virtual void UpdateButtonStrip() = 0;
55 // Updates the dialog overlay in response to a change of state or animation
57 virtual void UpdateOverlay() = 0;
59 // Updates the container for the detail inputs.
60 virtual void UpdateDetailArea() = 0;
62 // Updates the validity status of the detail inputs.
63 virtual void UpdateForErrors() = 0;
65 // Called when the contents of a section have changed.
66 virtual void UpdateSection(DialogSection section
) = 0;
68 // Updates the error bubble for this view.
69 virtual void UpdateErrorBubble() = 0;
71 // Fills the given section with Autofill data that was triggered by a user
72 // interaction with |originating_input|.
73 virtual void FillSection(DialogSection section
,
74 ServerFieldType originating_type
) = 0;
76 // Fills |output| with data the user manually input.
77 virtual void GetUserInput(DialogSection section
, FieldValueMap
* output
) = 0;
79 // Gets the CVC value the user typed to go along with the stored credit card
80 // data. If the user is inputing credit card data from scratch, this is not
82 virtual base::string16
GetCvc() = 0;
84 // Whether or not |point| is within the bounds of an input of |type|.
85 virtual bool HitTestInput(ServerFieldType type
,
86 const gfx::Point
& screen_point
) = 0;
88 // Returns true if new or edited autofill details should be saved.
89 virtual bool SaveDetailsLocally() = 0;
91 // Triggers dialog to sign in to Google.
92 // Returns a NotificationSource to be used to monitor for sign-in completion.
93 virtual const content::NavigationController
* ShowSignIn() = 0;
95 // Closes out any sign-in UI and returns to normal operation.
96 virtual void HideSignIn() = 0;
98 // Called when the active suggestions data model changed.
99 virtual void ModelChanged() = 0;
101 // Returns an object that can be used to test that the view is behaving as
103 virtual TestableAutofillDialogView
* GetTestableView() = 0;
105 // Called by AutofillDialogSignInDelegate when the sign-in page experiences a
106 // resize. |pref_size| is the new preferred size of the sign-in page.
107 virtual void OnSignInResize(const gfx::Size
& pref_size
) = 0;
109 // Factory function to create the dialog (implemented once per view
110 // implementation). |controller| will own the created dialog.
111 static AutofillDialogView
* Create(AutofillDialogViewDelegate
* delegate
);
114 } // namespace autofill
116 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_VIEW_H_