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
;
20 class AutofillDialogViewDelegate
;
22 // An interface for the dialog that appears when a site initiates an Autofill
23 // action via the imperative autocomplete API.
24 class AutofillDialogView
{
26 virtual ~AutofillDialogView();
29 virtual void Show() = 0;
31 // Closes the dialog window. May self-delete.
32 virtual void Hide() = 0;
34 // A hint that the view is going to receive a series of Update* calls soon,
35 // and may want to delay visible changes until after the updates are over.
36 // As multiple calls to UpdatesStarted may be stacked, and the view should
37 // expect an equal number of calls to UpdateFinished().
38 virtual void UpdatesStarted() = 0;
40 // The matching call to UpdatesStarted.
41 virtual void UpdatesFinished() = 0;
43 // Called when a different notification is available.
44 virtual void UpdateNotificationArea() = 0;
46 // Called when account details may have changed (user logs in to GAIA, creates
47 // a new account, etc.).
48 virtual void UpdateAccountChooser() = 0;
50 // Updates the button strip based on the current controller state.
51 virtual void UpdateButtonStrip() = 0;
53 // Updates the dialog overlay in response to a change of state or animation
55 virtual void UpdateOverlay() = 0;
57 // Updates the container for the detail inputs.
58 virtual void UpdateDetailArea() = 0;
60 // Updates the validity status of the detail inputs.
61 virtual void UpdateForErrors() = 0;
63 // Called when the contents of a section have changed.
64 virtual void UpdateSection(DialogSection section
) = 0;
66 // Updates the error bubble for this view.
67 virtual void UpdateErrorBubble() = 0;
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 ServerFieldType originating_type
) = 0;
74 // Fills |output| with data the user manually input.
75 virtual void GetUserInput(DialogSection section
, FieldValueMap
* output
) = 0;
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
80 virtual base::string16
GetCvc() = 0;
82 // Returns true if new or edited autofill details should be saved.
83 virtual bool SaveDetailsLocally() = 0;
85 // Triggers dialog to sign in to Google.
86 // Returns a NotificationSource to be used to monitor for sign-in completion.
87 virtual const content::NavigationController
* ShowSignIn(const GURL
& url
) = 0;
89 // Closes out any sign-in UI and returns to normal operation.
90 virtual void HideSignIn() = 0;
92 // Called when the active suggestions data model changed.
93 virtual void ModelChanged() = 0;
95 // Called by AutofillDialogSignInDelegate when the sign-in page experiences a
96 // resize. |pref_size| is the new preferred size of the sign-in page.
97 virtual void OnSignInResize(const gfx::Size
& pref_size
) = 0;
99 // Tells the view to validate its manual input in |section|.
100 virtual void ValidateSection(DialogSection section
) = 0;
102 // Factory function to create the dialog (implemented once per view
103 // implementation). |controller| will own the created dialog.
104 static AutofillDialogView
* Create(AutofillDialogViewDelegate
* delegate
);
107 } // namespace autofill
109 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_VIEW_H_