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_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_
      6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_
      7 
      8 #include <map>
      9 
     10 #include "base/memory/scoped_vector.h"
     11 #include "base/memory/weak_ptr.h"
     12 #include "base/scoped_observer.h"
     13 #include "chrome/browser/ui/autofill/autofill_dialog_types.h"
     14 #include "chrome/browser/ui/autofill/autofill_dialog_view.h"
     15 #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h"
     16 #include "chrome/browser/ui/autofill/testable_autofill_dialog_view.h"
     17 #include "ui/base/animation/animation_delegate.h"
     18 #include "ui/views/controls/button/button.h"
     19 #include "ui/views/controls/button/menu_button_listener.h"
     20 #include "ui/views/controls/combobox/combobox_listener.h"
     21 #include "ui/views/controls/link_listener.h"
     22 #include "ui/views/controls/progress_bar.h"
     23 #include "ui/views/controls/scroll_view.h"
     24 #include "ui/views/controls/styled_label_listener.h"
     25 #include "ui/views/controls/textfield/textfield_controller.h"
     26 #include "ui/views/focus/focus_manager.h"
     27 #include "ui/views/widget/widget_observer.h"
     28 #include "ui/views/window/dialog_delegate.h"
     29 
     30 namespace content {
     31 class KeyboardListener;
     32 }
     33 
     34 namespace gfx {
     35 class Image;
     36 }
     37 
     38 namespace views {
     39 class BubbleBorder;
     40 class Checkbox;
     41 class Combobox;
     42 class FocusManager;
     43 class ImageButton;
     44 class ImageView;
     45 class Label;
     46 class LabelButton;
     47 class Link;
     48 class MenuRunner;
     49 class StyledLabel;
     50 class WebView;
     51 class Widget;
     52 }  // namespace views
     53 
     54 namespace ui {
     55 class ComboboxModel;
     56 class KeyEvent;
     57 class MultiAnimation;
     58 }
     59 
     60 namespace autofill {
     61 
     62 class AutofillDialogSignInDelegate;
     63 class DecoratedTextfield;
     64 
     65 // Views toolkit implementation of the Autofill dialog that handles the
     66 // imperative autocomplete API call.
     67 class AutofillDialogViews : public AutofillDialogView,
     68                             public TestableAutofillDialogView,
     69                             public views::DialogDelegateView,
     70                             public views::WidgetObserver,
     71                             public views::ButtonListener,
     72                             public views::TextfieldController,
     73                             public views::FocusChangeListener,
     74                             public views::ComboboxListener,
     75                             public views::StyledLabelListener {
     76  public:
     77   explicit AutofillDialogViews(AutofillDialogViewDelegate* delegate);
     78   virtual ~AutofillDialogViews();
     79 
     80   // AutofillDialogView implementation:
     81   virtual void Show() OVERRIDE;
     82   virtual void Hide() OVERRIDE;
     83   virtual void UpdateAccountChooser() OVERRIDE;
     84   virtual void UpdateAutocheckoutStepsArea() OVERRIDE;
     85   virtual void UpdateButtonStrip() OVERRIDE;
     86   virtual void UpdateDetailArea() OVERRIDE;
     87   virtual void UpdateForErrors() OVERRIDE;
     88   virtual void UpdateNotificationArea() OVERRIDE;
     89   virtual void UpdateSection(DialogSection section) OVERRIDE;
     90   virtual void FillSection(DialogSection section,
     91                            const DetailInput& originating_input) OVERRIDE;
     92   virtual void GetUserInput(DialogSection section,
     93                             DetailOutputMap* output) OVERRIDE;
     94   virtual base::string16 GetCvc() OVERRIDE;
     95   virtual bool SaveDetailsLocally() OVERRIDE;
     96   virtual const content::NavigationController* ShowSignIn() OVERRIDE;
     97   virtual void HideSignIn() OVERRIDE;
     98   virtual void UpdateProgressBar(double value) OVERRIDE;
     99   virtual void ModelChanged() OVERRIDE;
    100   virtual TestableAutofillDialogView* GetTestableView() OVERRIDE;
    101   virtual void OnSignInResize(const gfx::Size& pref_size) OVERRIDE;
    102 
    103   // TestableAutofillDialogView implementation:
    104   virtual void SubmitForTesting() OVERRIDE;
    105   virtual void CancelForTesting() OVERRIDE;
    106   virtual base::string16 GetTextContentsOfInput(
    107       const DetailInput& input) OVERRIDE;
    108   virtual void SetTextContentsOfInput(const DetailInput& input,
    109                                       const base::string16& contents) OVERRIDE;
    110   virtual void SetTextContentsOfSuggestionInput(
    111       DialogSection section,
    112       const base::string16& text) OVERRIDE;
    113   virtual void ActivateInput(const DetailInput& input) OVERRIDE;
    114   virtual gfx::Size GetSize() const OVERRIDE;
    115 
    116   // views::View implementation.
    117   virtual gfx::Size GetPreferredSize() OVERRIDE;
    118   virtual void Layout() OVERRIDE;
    119   virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE;
    120 
    121   // views::DialogDelegate implementation:
    122   virtual base::string16 GetWindowTitle() const OVERRIDE;
    123   virtual void WindowClosing() OVERRIDE;
    124   virtual void DeleteDelegate() OVERRIDE;
    125   virtual views::View* CreateOverlayView() OVERRIDE;
    126   virtual int GetDialogButtons() const OVERRIDE;
    127   virtual base::string16 GetDialogButtonLabel(ui::DialogButton button) const
    128       OVERRIDE;
    129   virtual bool ShouldDefaultButtonBeBlue() const OVERRIDE;
    130   virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE;
    131   virtual views::View* CreateExtraView() OVERRIDE;
    132   virtual views::View* CreateTitlebarExtraView() OVERRIDE;
    133   virtual views::View* CreateFootnoteView() OVERRIDE;
    134   virtual bool Cancel() OVERRIDE;
    135   virtual bool Accept() OVERRIDE;
    136   virtual views::NonClientFrameView* CreateNonClientFrameView(
    137       views::Widget* widget) OVERRIDE;
    138 
    139   // views::WidgetObserver implementation:
    140   virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE;
    141   virtual void OnWidgetBoundsChanged(views::Widget* widget,
    142                                      const gfx::Rect& new_bounds) OVERRIDE;
    143 
    144   // views::ButtonListener implementation:
    145   virtual void ButtonPressed(views::Button* sender,
    146                              const ui::Event& event) OVERRIDE;
    147 
    148   // views::TextfieldController implementation:
    149   virtual void ContentsChanged(views::Textfield* sender,
    150                                const base::string16& new_contents) OVERRIDE;
    151   virtual bool HandleKeyEvent(views::Textfield* sender,
    152                               const ui::KeyEvent& key_event) OVERRIDE;
    153   virtual bool HandleMouseEvent(views::Textfield* sender,
    154                                 const ui::MouseEvent& key_event) OVERRIDE;
    155 
    156   // views::FocusChangeListener implementation.
    157   virtual void OnWillChangeFocus(views::View* focused_before,
    158                                  views::View* focused_now) OVERRIDE;
    159   virtual void OnDidChangeFocus(views::View* focused_before,
    160                                 views::View* focused_now) OVERRIDE;
    161 
    162   // views::ComboboxListener implementation:
    163   virtual void OnSelectedIndexChanged(views::Combobox* combobox) OVERRIDE;
    164 
    165   // views::StyledLabelListener implementation:
    166   virtual void StyledLabelLinkClicked(const ui::Range& range, int event_flags)
    167       OVERRIDE;
    168 
    169  private:
    170   // A class that creates and manages a widget for error messages.
    171   class ErrorBubble : public views::WidgetObserver {
    172    public:
    173     ErrorBubble(views::View* anchor, const base::string16& message);
    174     virtual ~ErrorBubble();
    175 
    176     bool IsShowing();
    177 
    178     // Re-positions the bubble over |anchor_|. If |anchor_| is not visible,
    179     // the bubble will hide.
    180     void UpdatePosition();
    181 
    182     virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE;
    183 
    184     views::View* anchor() { return anchor_; }
    185 
    186    private:
    187     // Calculates and returns the bounds of |widget_|, depending on |anchor_|
    188     // and |contents_|.
    189     gfx::Rect GetBoundsForWidget();
    190 
    191     views::Widget* widget_;  // Weak, may be NULL.
    192     views::View* anchor_;  // Weak.
    193     // The contents view of |widget_|.
    194     views::View* contents_;  // Weak.
    195     ScopedObserver<views::Widget, ErrorBubble> observer_;
    196 
    197     DISALLOW_COPY_AND_ASSIGN(ErrorBubble);
    198   };
    199 
    200   // A View which displays the currently selected account and lets the user
    201   // switch accounts.
    202   class AccountChooser : public views::View,
    203                          public views::LinkListener,
    204                          public base::SupportsWeakPtr<AccountChooser> {
    205    public:
    206     explicit AccountChooser(AutofillDialogViewDelegate* delegate);
    207     virtual ~AccountChooser();
    208 
    209     // Updates the view based on the state that |delegate_| reports.
    210     void Update();
    211 
    212     // views::View implementation.
    213     virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE;
    214     virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE;
    215 
    216     // views::LinkListener implementation.
    217     virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
    218 
    219    private:
    220     // The icon for the currently in-use account.
    221     views::ImageView* image_;
    222 
    223     // The label for the currently in-use account.
    224     views::Label* label_;
    225 
    226     // The drop arrow.
    227     views::ImageView* arrow_;
    228 
    229     // The sign in link.
    230     views::Link* link_;
    231 
    232     // The delegate |this| queries for logic and state.
    233     AutofillDialogViewDelegate* delegate_;
    234 
    235     // Runs the suggestion menu (triggered by each section's |suggested_button|.
    236     scoped_ptr<views::MenuRunner> menu_runner_;
    237 
    238     DISALLOW_COPY_AND_ASSIGN(AccountChooser);
    239   };
    240 
    241   // A view which displays an image, optionally some messages and a button. Used
    242   // for the splash page as well as the Wallet interstitial.
    243   class OverlayView : public views::View,
    244                       public ui::AnimationDelegate {
    245    public:
    246     // The listener is informed when |button_| is pressed.
    247     explicit OverlayView(views::ButtonListener* listener);
    248     virtual ~OverlayView();
    249 
    250     // Returns a height which should be used when the contents view has width
    251     // |w|. Note that the value returned should be used as the height of the
    252     // dialog's contents.
    253     int GetHeightForContentsForWidth(int width);
    254 
    255     // Sets properties that should be displayed.
    256     void SetState(const DialogOverlayState& state,
    257                   views::ButtonListener* listener);
    258 
    259     // Fades the view out after a delay.
    260     void BeginFadeOut();
    261 
    262     // ui::AnimationDelegate implementation:
    263     virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
    264     virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
    265 
    266     // views::View implementation:
    267     virtual gfx::Insets GetInsets() const OVERRIDE;
    268     virtual void Layout() OVERRIDE;
    269     virtual const char* GetClassName() const OVERRIDE;
    270     virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
    271     virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE;
    272 
    273    private:
    274     // Gets the border of the non-client frame view as a BubbleBorder.
    275     views::BubbleBorder* GetBubbleBorder();
    276 
    277     // Gets the bounds of this view without the frame view's bubble border.
    278     gfx::Rect ContentBoundsSansBubbleBorder();
    279 
    280     // Child View. Front and center.
    281     views::ImageView* image_view_;
    282     // Child View. When visible, below |image_view_|.
    283     views::View* message_stack_;
    284     // Child View. When visible, below |message_stack_|.
    285     views::LabelButton* button_;
    286 
    287     // This MultiAnimation is used to first fade out the contents of the
    288     // overlay, then fade out the background of the overlay (revealing the
    289     // dialog behind the overlay). This avoids cross-fade.
    290     scoped_ptr<ui::MultiAnimation> fade_out_;
    291 
    292     DISALLOW_COPY_AND_ASSIGN(OverlayView);
    293   };
    294 
    295   // An area for notifications. Some notifications point at the account chooser.
    296   class NotificationArea : public views::View,
    297                            public views::ButtonListener {
    298    public:
    299     explicit NotificationArea(AutofillDialogViewDelegate* delegate);
    300     virtual ~NotificationArea();
    301 
    302     // Displays the given notifications.
    303     void SetNotifications(const std::vector<DialogNotification>& notifications);
    304 
    305     // views::View implementation.
    306     virtual gfx::Size GetPreferredSize() OVERRIDE;
    307     virtual const char* GetClassName() const OVERRIDE;
    308     virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE;
    309     virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
    310 
    311     // views::ButtonListener implementation:
    312     virtual void ButtonPressed(views::Button* sender,
    313                                const ui::Event& event) OVERRIDE;
    314 
    315     void set_arrow_centering_anchor(
    316         const base::WeakPtr<views::View>& arrow_centering_anchor) {
    317       arrow_centering_anchor_ = arrow_centering_anchor;
    318     }
    319 
    320    private:
    321     // Utility function for determining whether an arrow should be drawn
    322     // pointing at |arrow_centering_anchor_|.
    323     bool HasArrow();
    324 
    325     // A reference to the delegate/controller than owns this view.
    326     // Used to report when checkboxes change their values.
    327     AutofillDialogViewDelegate* delegate_;  // weak
    328 
    329     // The currently showing checkbox, or NULL if none exists.
    330     views::Checkbox* checkbox_;  // weak
    331 
    332     // If HasArrow() is true, the arrow should point at this.
    333     base::WeakPtr<views::View> arrow_centering_anchor_;
    334 
    335     std::vector<DialogNotification> notifications_;
    336 
    337     DISALLOW_COPY_AND_ASSIGN(NotificationArea);
    338   };
    339 
    340   typedef std::map<const DetailInput*, DecoratedTextfield*> TextfieldMap;
    341   typedef std::map<const DetailInput*, views::Combobox*> ComboboxMap;
    342 
    343   // A view that packs a label on the left and some related controls
    344   // on the right.
    345   class SectionContainer : public views::View {
    346    public:
    347     SectionContainer(const base::string16& label,
    348                      views::View* controls,
    349                      views::Button* proxy_button);
    350     virtual ~SectionContainer();
    351 
    352     // Sets the visual appearance of the section to active (considered active
    353     // when showing the menu or hovered by the mouse cursor).
    354     void SetActive(bool active);
    355 
    356     // Sets whether mouse events should be forwarded to |proxy_button_|.
    357     void SetForwardMouseEvents(bool forward);
    358 
    359     // views::View implementation.
    360     virtual void OnMouseMoved(const ui::MouseEvent& event) OVERRIDE;
    361     virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE;
    362     virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE;
    363     virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE;
    364     virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE;
    365 
    366    private:
    367     // Converts |event| to one suitable for |proxy_button_|.
    368     static ui::MouseEvent ProxyEvent(const ui::MouseEvent& event);
    369 
    370     // Mouse events on |this| are sent to this button.
    371     views::Button* proxy_button_;  // Weak reference.
    372 
    373     // When true, mouse events will be forwarded to |proxy_button_|.
    374     bool forward_mouse_events_;
    375 
    376     DISALLOW_COPY_AND_ASSIGN(SectionContainer);
    377   };
    378 
    379   // A view that contains a suggestion (such as a known address) and a link to
    380   // edit the suggestion.
    381   class SuggestionView : public views::View {
    382    public:
    383     explicit SuggestionView(AutofillDialogViews* autofill_dialog);
    384     virtual ~SuggestionView();
    385 
    386     void SetState(const SuggestionState& state);
    387 
    388     // views::View implementation.
    389     virtual gfx::Size GetPreferredSize() OVERRIDE;
    390     virtual int GetHeightForWidth(int width) OVERRIDE;
    391     virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE;
    392 
    393     DecoratedTextfield* decorated_textfield() { return decorated_; }
    394 
    395    private:
    396     // Returns whether there's room to display |state_.vertically_compact_text|
    397     // without resorting to an ellipsis for a pixel width of |available_width|.
    398     // Fills in |resulting_height| with the amount of space required to display
    399     // |vertically_compact_text| or |horizontally_compact_text| as the case may
    400     // be.
    401     bool CanUseVerticallyCompactText(int available_width,
    402                                      int* resulting_height);
    403 
    404     // Sets the display text of the suggestion.
    405     void SetLabelText(const base::string16& text);
    406 
    407     // Sets the icon which should be displayed ahead of the text.
    408     void SetIcon(const gfx::Image& image);
    409 
    410     // Shows an auxiliary textfield to the right of the suggestion icon and
    411     // text. This is currently only used to show a CVC field for the CC section.
    412     void SetTextfield(const base::string16& placeholder_text,
    413                       const gfx::Image& icon);
    414 
    415     // The state of |this|.
    416     SuggestionState state_;
    417 
    418     // This caches preferred heights for given widths. The key is a preferred
    419     // width, the value is a cached result of CanUseVerticallyCompactText.
    420     std::map<int, std::pair<bool, int> > calculated_heights_;
    421 
    422     // The label that holds the suggestion description text.
    423     views::Label* label_;
    424     // The second (and greater) line of text that describes the suggestion.
    425     views::Label* label_line_2_;
    426     // The icon that comes just before |label_|.
    427     views::ImageView* icon_;
    428     // The input set by ShowTextfield.
    429     DecoratedTextfield* decorated_;
    430     // An "Edit" link that flips to editable inputs rather than suggestion text.
    431     views::Link* edit_link_;
    432 
    433     DISALLOW_COPY_AND_ASSIGN(SuggestionView);
    434   };
    435 
    436   // A convenience struct for holding pointers to views within each detail
    437   // section. None of the member pointers are owned.
    438   struct DetailsGroup {
    439     explicit DetailsGroup(DialogSection section);
    440     ~DetailsGroup();
    441 
    442     // The section this group is associated with.
    443     const DialogSection section;
    444     // The view that contains the entire section (label + input).
    445     SectionContainer* container;
    446     // The view that allows manual input.
    447     views::View* manual_input;
    448     // The textfields in |manual_input|, tracked by their DetailInput.
    449     TextfieldMap textfields;
    450     // The comboboxes in |manual_input|, tracked by their DetailInput.
    451     ComboboxMap comboboxes;
    452     // The view that holds the text of the suggested data. This will be
    453     // visible IFF |manual_input| is not visible.
    454     SuggestionView* suggested_info;
    455     // The view that allows selecting other data suggestions.
    456     views::ImageButton* suggested_button;
    457   };
    458 
    459   // Area for displaying that status of various steps in an Autocheckout flow.
    460   class AutocheckoutStepsArea : public views::View {
    461    public:
    462     AutocheckoutStepsArea();
    463     virtual ~AutocheckoutStepsArea() {}
    464 
    465     // Display the given steps.
    466     void SetSteps(const std::vector<DialogAutocheckoutStep>& steps);
    467 
    468    private:
    469     DISALLOW_COPY_AND_ASSIGN(AutocheckoutStepsArea);
    470   };
    471 
    472   class AutocheckoutProgressBar : public views::ProgressBar {
    473    public:
    474     AutocheckoutProgressBar();
    475     virtual ~AutocheckoutProgressBar();
    476 
    477    private:
    478     // Overriden from View
    479     virtual gfx::Size GetPreferredSize() OVERRIDE;
    480 
    481     DISALLOW_COPY_AND_ASSIGN(AutocheckoutProgressBar);
    482   };
    483 
    484   typedef std::map<DialogSection, DetailsGroup> DetailGroupMap;
    485 
    486   void InitChildViews();
    487 
    488   // Creates and returns a view that holds all detail sections.
    489   views::View* CreateDetailsContainer();
    490 
    491   // Creates and returns a view that holds the requesting host and intro text.
    492   views::View* CreateNotificationArea();
    493 
    494   // Creates and returns a view that holds the main controls of this dialog.
    495   views::View* CreateMainContainer();
    496 
    497   // Creates a detail section (Shipping, Email, etc.) with the given label,
    498   // inputs View, and suggestion model. Relevant pointers are stored in |group|.
    499   void CreateDetailsSection(DialogSection section);
    500 
    501   // Like CreateDetailsSection, but creates the combined billing/cc section,
    502   // which is somewhat more complicated than the others.
    503   void CreateBillingSection();
    504 
    505   // Creates the view that holds controls for inputing or selecting data for
    506   // a given section.
    507   views::View* CreateInputsContainer(DialogSection section);
    508 
    509   // Creates a grid of textfield views for the given section, and stores them
    510   // in the appropriate DetailsGroup. The top level View in the hierarchy is
    511   // returned.
    512   views::View* InitInputsView(DialogSection section);
    513 
    514   // Updates the given section to match the state provided by |delegate_|. If
    515   // |clobber_inputs| is true, the current state of the textfields will be
    516   // ignored, otherwise their contents will be preserved.
    517   void UpdateSectionImpl(DialogSection section, bool clobber_inputs);
    518 
    519   // Updates the visual state of the given group as per the model.
    520   void UpdateDetailsGroupState(const DetailsGroup& group);
    521 
    522   // Gets a pointer to the DetailsGroup that's associated with the given section
    523   // of the dialog.
    524   DetailsGroup* GroupForSection(DialogSection section);
    525 
    526   // Gets a pointer to the DetailsGroup that's associated with a given |view|.
    527   // Returns NULL if no DetailsGroup was found.
    528   DetailsGroup* GroupForView(views::View* view);
    529 
    530   // Sets the visual state for an input to be either valid or invalid. This
    531   // should work on Comboboxes or DecoratedTextfields. If |message| is empty,
    532   // the input is valid.
    533   template<class T>
    534   void SetValidityForInput(T* input, const base::string16& message);
    535 
    536   // Shows an error bubble pointing at |view| if |view| has a message in
    537   // |validity_map_|.
    538   void ShowErrorBubbleForViewIfNecessary(views::View* view);
    539 
    540   // Updates validity of the inputs in |section| with the new validity data.
    541   void MarkInputsInvalid(DialogSection section,
    542                          const ValidityData& validity_data);
    543 
    544   // Checks all manual inputs in |group| for validity. Decorates the invalid
    545   // ones and returns true if all were valid.
    546   bool ValidateGroup(const DetailsGroup& group, ValidationType type);
    547 
    548   // Checks all manual inputs in the form for validity. Decorates the invalid
    549   // ones and returns true if all were valid.
    550   bool ValidateForm();
    551 
    552   // When an input textfield is edited (its contents change) or activated
    553   // (clicked while focused), this function will inform the delegate that it's
    554   // time to show a suggestion popup and possibly reset the validity state of
    555   // the input.
    556   void TextfieldEditedOrActivated(views::Textfield* textfield, bool was_edit);
    557 
    558   // Updates the views in the button strip.
    559   void UpdateButtonStripExtraView();
    560 
    561   // Call this when the size of anything in |contents_| might've changed.
    562   void ContentsPreferredSizeChanged();
    563 
    564   // Gets the textfield view that is shown for the given DetailInput model, or
    565   // NULL.
    566   views::Textfield* TextfieldForInput(const DetailInput& input);
    567 
    568   // Gets the combobox view that is shown for the given DetailInput model, or
    569   // NULL.
    570   views::Combobox* ComboboxForInput(const DetailInput& input);
    571 
    572   // Called when the details container changes in size or position.
    573   void DetailsContainerBoundsChanged();
    574 
    575   // The delegate that drives this view. Weak pointer, always non-NULL.
    576   AutofillDialogViewDelegate* const delegate_;
    577 
    578   // The window that displays |contents_|. Weak pointer; may be NULL when the
    579   // dialog is closing.
    580   views::Widget* window_;
    581 
    582   // A DialogSection-keyed map of the DetailGroup structs.
    583   DetailGroupMap detail_groups_;
    584 
    585   // Somewhere to show notification messages about errors, warnings, or promos.
    586   NotificationArea* notification_area_;
    587 
    588   // Runs the suggestion menu (triggered by each section's |suggested_button|.
    589   scoped_ptr<views::MenuRunner> menu_runner_;
    590 
    591   // The view that allows the user to toggle the data source.
    592   AccountChooser* account_chooser_;
    593 
    594   // A WebView to that navigates to a Google sign-in page to allow the user to
    595   // sign-in.
    596   views::WebView* sign_in_webview_;
    597 
    598   // View that wraps |details_container_| and makes it scroll vertically.
    599   views::ScrollView* scrollable_area_;
    600 
    601   // View to host details sections.
    602   views::View* details_container_;
    603 
    604   // A view that overlays |this| (for "loading..." messages).
    605   views::Label* loading_shield_;
    606 
    607   // The view that completely overlays the dialog (used for the splash page).
    608   OverlayView* overlay_view_;
    609 
    610   // The "Extra view" is on the same row as the dialog buttons.
    611   views::View* button_strip_extra_view_;
    612 
    613   // This checkbox controls whether new details are saved to the Autofill
    614   // database. It lives in |extra_view_|.
    615   views::Checkbox* save_in_chrome_checkbox_;
    616 
    617   // Holds the above checkbox and an associated tooltip icon.
    618   views::View* save_in_chrome_checkbox_container_;
    619 
    620   // Used to display an image in the button strip extra view.
    621   views::ImageView* button_strip_image_;
    622 
    623   // View that aren't in the hierarchy but are owned by |this|. Currently
    624   // just holds the (hidden) country comboboxes.
    625   ScopedVector<views::View> other_owned_views_;
    626 
    627   // View to host Autocheckout steps.
    628   AutocheckoutStepsArea* autocheckout_steps_area_;
    629 
    630   // View to host |autocheckout_progress_bar_| and its label.
    631   views::View* autocheckout_progress_bar_view_;
    632 
    633   // Progress bar for displaying Autocheckout progress.
    634   AutocheckoutProgressBar* autocheckout_progress_bar_;
    635 
    636   // The view that is appended to the bottom of the dialog, below the button
    637   // strip. Used to display legal document links.
    638   views::View* footnote_view_;
    639 
    640   // The legal document text and links.
    641   views::StyledLabel* legal_document_view_;
    642 
    643   // The focus manager for |window_|.
    644   views::FocusManager* focus_manager_;
    645 
    646   // The object that manages the error bubble widget.
    647   scoped_ptr<ErrorBubble> error_bubble_;
    648 
    649   // Map from input view (textfield or combobox) to error string.
    650   std::map<views::View*, base::string16> validity_map_;
    651 
    652   ScopedObserver<views::Widget, AutofillDialogViews> observer_;
    653 
    654   // Delegate for the sign-in dialog's webview.
    655   scoped_ptr<AutofillDialogSignInDelegate> sign_in_delegate_;
    656 
    657   DISALLOW_COPY_AND_ASSIGN(AutofillDialogViews);
    658 };
    659 
    660 }  // namespace autofill
    661 
    662 #endif  // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_
    663