autofill_dialog_view.h revision c2e0dbddbe15c98d52c4786dac06cb8952a8ae6d
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 autofill { 15 16class TestableAutofillDialogView; 17 18// An interface for the dialog that appears when a site initiates an Autofill 19// action via the imperative autocomplete API. 20class AutofillDialogView { 21 public: 22 virtual ~AutofillDialogView(); 23 24 // Shows the dialog. 25 virtual void Show() = 0; 26 27 // Hides the dialog as if a user pressed cancel. 28 virtual void Hide() = 0; 29 30 // Called when a different notification is available. 31 virtual void UpdateNotificationArea() = 0; 32 33 // Called when account details may have changed (user logs in to GAIA, creates 34 // a new account, etc.). 35 virtual void UpdateAccountChooser() = 0; 36 37 // Updates the button strip based on the current controller state. 38 virtual void UpdateButtonStrip() = 0; 39 40 // Called when the contents of a section have changed. 41 virtual void UpdateSection(DialogSection section) = 0; 42 43 // Fills the given section with Autofill data that was triggered by a user 44 // interaction with |originating_input|. 45 virtual void FillSection(DialogSection section, 46 const DetailInput& originating_input) = 0; 47 48 // Fills |output| with data the user manually input. 49 virtual void GetUserInput(DialogSection section, DetailOutputMap* output) = 0; 50 51 // Gets the CVC value the user typed to go along with the stored credit card 52 // data. If the user is inputing credit card data from scratch, this is not 53 // relevant. 54 virtual string16 GetCvc() = 0; 55 56 // Returns true if new or edited autofill details should be saved. 57 virtual bool SaveDetailsLocally() = 0; 58 59 // Triggers dialog to sign in to Google. 60 // Returns a NotificationSource to be used to monitor for sign-in completion. 61 virtual const content::NavigationController* ShowSignIn() = 0; 62 63 // Closes out any signin UI and returns to normal operation. 64 virtual void HideSignIn() = 0; 65 66 // Updates the progress bar based on the Autocheckout progress. |value| should 67 // be in [0.0, 1.0]. 68 virtual void UpdateProgressBar(double value) = 0; 69 70 // Called when the active suggestions data model changed. 71 virtual void ModelChanged() = 0; 72 73 // Returns an object that can be used to test that the view is behaving as 74 // expected. This should be implemented on all platforms, but for now returns 75 // NULL on everything but Views. 76 virtual TestableAutofillDialogView* GetTestableView(); 77 78 // Factory function to create the dialog (implemented once per view 79 // implementation). |controller| will own the created dialog. 80 static AutofillDialogView* Create(AutofillDialogController* controller); 81}; 82 83} // namespace autofill 84 85#endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_VIEW_H_ 86