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 10 namespace content { 11 class NavigationController; 12 } 13 14 namespace gfx { 15 class Size; 16 } 17 18 namespace autofill { 19 20 class AutofillDialogViewDelegate; 21 22 // An interface for the dialog that appears when a site initiates an Autofill 23 // action via the imperative autocomplete API. 24 class AutofillDialogView { 25 public: 26 virtual ~AutofillDialogView(); 27 28 // Shows the dialog. 29 virtual void Show() = 0; 30 31 // Closes the dialog window. May self-delete. 32 virtual void Hide() = 0; 33 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; 39 40 // The matching call to UpdatesStarted. 41 virtual void UpdatesFinished() = 0; 42 43 // Called when a different notification is available. 44 virtual void UpdateNotificationArea() = 0; 45 46 // Called when account details may have changed (user logs in to GAIA, creates 47 // a new account, etc.). 48 virtual void UpdateAccountChooser() = 0; 49 50 // Updates the button strip based on the current controller state. 51 virtual void UpdateButtonStrip() = 0; 52 53 // Updates the dialog overlay in response to a change of state or animation 54 // progression. 55 virtual void UpdateOverlay() = 0; 56 57 // Updates the container for the detail inputs. 58 virtual void UpdateDetailArea() = 0; 59 60 // Updates the validity status of the detail inputs. 61 virtual void UpdateForErrors() = 0; 62 63 // Called when the contents of a section have changed. 64 virtual void UpdateSection(DialogSection section) = 0; 65 66 // Updates the error bubble for this view. 67 virtual void UpdateErrorBubble() = 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 ServerFieldType originating_type) = 0; 73 74 // Fills |output| with data the user manually input. 75 virtual void GetUserInput(DialogSection section, FieldValueMap* 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 base::string16 GetCvc() = 0; 81 82 // Returns true if new or edited autofill details should be saved. 83 virtual bool SaveDetailsLocally() = 0; 84 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() = 0; 88 89 // Closes out any sign-in UI and returns to normal operation. 90 virtual void HideSignIn() = 0; 91 92 // Called when the active suggestions data model changed. 93 virtual void ModelChanged() = 0; 94 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; 98 99 // Tells the view to validate its manual input in |section|. 100 virtual void ValidateSection(DialogSection section) = 0; 101 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); 105 }; 106 107 } // namespace autofill 108 109 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_VIEW_H_ 110