Home | History | Annotate | Download | only in autofill
      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 Point;
     16 class Size;
     17 }
     18 
     19 namespace autofill {
     20 
     21 class AutofillDialogViewDelegate;
     22 class TestableAutofillDialogView;
     23 
     24 // An interface for the dialog that appears when a site initiates an Autofill
     25 // action via the imperative autocomplete API.
     26 class AutofillDialogView {
     27  public:
     28   virtual ~AutofillDialogView();
     29 
     30   // Shows the dialog.
     31   virtual void Show() = 0;
     32 
     33   // Closes the dialog window. May self-delete.
     34   virtual void Hide() = 0;
     35 
     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;
     41 
     42   // The matching call to UpdatesStarted.
     43   virtual void UpdatesFinished() = 0;
     44 
     45   // Called when a different notification is available.
     46   virtual void UpdateNotificationArea() = 0;
     47 
     48   // Called when account details may have changed (user logs in to GAIA, creates
     49   // a new account, etc.).
     50   virtual void UpdateAccountChooser() = 0;
     51 
     52   // Updates the button strip based on the current controller state.
     53   virtual void UpdateButtonStrip() = 0;
     54 
     55   // Updates the dialog overlay in response to a change of state or animation
     56   // progression.
     57   virtual void UpdateOverlay() = 0;
     58 
     59   // Updates the container for the detail inputs.
     60   virtual void UpdateDetailArea() = 0;
     61 
     62   // Updates the validity status of the detail inputs.
     63   virtual void UpdateForErrors() = 0;
     64 
     65   // Called when the contents of a section have changed.
     66   virtual void UpdateSection(DialogSection section) = 0;
     67 
     68   // Updates the error bubble for this view.
     69   virtual void UpdateErrorBubble() = 0;
     70 
     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                            const DetailInput& originating_input) = 0;
     75 
     76   // Fills |output| with data the user manually input.
     77   virtual void GetUserInput(DialogSection section, FieldValueMap* output) = 0;
     78 
     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
     81   // relevant.
     82   virtual base::string16 GetCvc() = 0;
     83 
     84   // Whether or not |point| is within |input|'s bounds.
     85   virtual bool HitTestInput(const DetailInput& input,
     86                             const gfx::Point& screen_point) = 0;
     87 
     88   // Returns true if new or edited autofill details should be saved.
     89   virtual bool SaveDetailsLocally() = 0;
     90 
     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;
     94 
     95   // Closes out any sign-in UI and returns to normal operation.
     96   virtual void HideSignIn() = 0;
     97 
     98   // Called when the active suggestions data model changed.
     99   virtual void ModelChanged() = 0;
    100 
    101   // Returns an object that can be used to test that the view is behaving as
    102   // expected.
    103   virtual TestableAutofillDialogView* GetTestableView() = 0;
    104 
    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;
    108 
    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);
    112 };
    113 
    114 }  // namespace autofill
    115 
    116 #endif  // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_VIEW_H_
    117