autofill_dialog_views.h revision 5f1c94371a64b3196d4be9466099bb892df9b88e
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#include <set>
10
11#include "base/memory/scoped_vector.h"
12#include "base/memory/weak_ptr.h"
13#include "base/scoped_observer.h"
14#include "chrome/browser/ui/autofill/autofill_dialog_types.h"
15#include "chrome/browser/ui/autofill/autofill_dialog_view.h"
16#include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h"
17#include "ui/views/controls/button/button.h"
18#include "ui/views/controls/button/menu_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/view_targeter_delegate.h"
28#include "ui/views/widget/widget_observer.h"
29#include "ui/views/window/dialog_delegate.h"
30
31namespace gfx {
32class Image;
33}
34
35namespace views {
36class BubbleBorder;
37class Checkbox;
38class Combobox;
39class FocusManager;
40class ImageView;
41class Label;
42class LabelButton;
43class Link;
44class MenuRunner;
45class StyledLabel;
46class WebView;
47class Widget;
48}  // namespace views
49
50namespace ui {
51class ComboboxModel;
52class EventHandler;
53class KeyEvent;
54}
55
56namespace autofill {
57
58class AutofillDialogSignInDelegate;
59class ExpandingTextfield;
60class InfoBubble;
61
62// Views toolkit implementation of the Autofill dialog that handles the
63// imperative autocomplete API call.
64class AutofillDialogViews : public AutofillDialogView,
65                            public views::DialogDelegateView,
66                            public views::WidgetObserver,
67                            public views::TextfieldController,
68                            public views::FocusChangeListener,
69                            public views::ComboboxListener,
70                            public views::StyledLabelListener,
71                            public views::MenuButtonListener {
72 public:
73  explicit AutofillDialogViews(AutofillDialogViewDelegate* delegate);
74  virtual ~AutofillDialogViews();
75
76  // AutofillDialogView implementation:
77  virtual void Show() OVERRIDE;
78  virtual void Hide() OVERRIDE;
79  virtual void UpdatesStarted() OVERRIDE;
80  virtual void UpdatesFinished() OVERRIDE;
81  virtual void UpdateAccountChooser() OVERRIDE;
82  virtual void UpdateButtonStrip() OVERRIDE;
83  virtual void UpdateOverlay() OVERRIDE;
84  virtual void UpdateDetailArea() OVERRIDE;
85  virtual void UpdateForErrors() OVERRIDE;
86  virtual void UpdateNotificationArea() OVERRIDE;
87  virtual void UpdateSection(DialogSection section) OVERRIDE;
88  virtual void UpdateErrorBubble() OVERRIDE;
89  virtual void FillSection(DialogSection section,
90                           ServerFieldType originating_type) OVERRIDE;
91  virtual void GetUserInput(DialogSection section,
92                            FieldValueMap* output) OVERRIDE;
93  virtual base::string16 GetCvc() OVERRIDE;
94  virtual bool SaveDetailsLocally() OVERRIDE;
95  virtual const content::NavigationController* ShowSignIn() OVERRIDE;
96  virtual void HideSignIn() OVERRIDE;
97  virtual void ModelChanged() OVERRIDE;
98  virtual void OnSignInResize(const gfx::Size& pref_size) OVERRIDE;
99  virtual void ValidateSection(DialogSection section) OVERRIDE;
100
101  // views::View implementation.
102  virtual gfx::Size GetPreferredSize() const OVERRIDE;
103  virtual gfx::Size GetMinimumSize() const OVERRIDE;
104  virtual void Layout() OVERRIDE;
105  virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE;
106
107  // views::DialogDelegate implementation:
108  virtual ui::ModalType GetModalType() const OVERRIDE;
109  virtual base::string16 GetWindowTitle() const OVERRIDE;
110  virtual void WindowClosing() OVERRIDE;
111  virtual void DeleteDelegate() OVERRIDE;
112  virtual views::View* CreateOverlayView() OVERRIDE;
113  virtual int GetDialogButtons() const OVERRIDE;
114  virtual int GetDefaultDialogButton() const OVERRIDE;
115  virtual base::string16 GetDialogButtonLabel(ui::DialogButton button) const
116      OVERRIDE;
117  virtual bool ShouldDefaultButtonBeBlue() const OVERRIDE;
118  virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE;
119  virtual views::View* GetInitiallyFocusedView() OVERRIDE;
120  virtual views::View* CreateExtraView() OVERRIDE;
121  virtual views::View* CreateTitlebarExtraView() OVERRIDE;
122  virtual views::View* CreateFootnoteView() OVERRIDE;
123  virtual bool Cancel() OVERRIDE;
124  virtual bool Accept() OVERRIDE;
125
126  // views::WidgetObserver implementation:
127  virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE;
128  virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE;
129  virtual void OnWidgetBoundsChanged(views::Widget* widget,
130                                     const gfx::Rect& new_bounds) OVERRIDE;
131
132  // views::TextfieldController implementation:
133  virtual void ContentsChanged(views::Textfield* sender,
134                               const base::string16& new_contents) OVERRIDE;
135  virtual bool HandleKeyEvent(views::Textfield* sender,
136                              const ui::KeyEvent& key_event) OVERRIDE;
137  virtual bool HandleMouseEvent(views::Textfield* sender,
138                                const ui::MouseEvent& key_event) OVERRIDE;
139
140  // views::FocusChangeListener implementation.
141  virtual void OnWillChangeFocus(views::View* focused_before,
142                                 views::View* focused_now) OVERRIDE;
143  virtual void OnDidChangeFocus(views::View* focused_before,
144                                views::View* focused_now) OVERRIDE;
145
146  // views::ComboboxListener implementation:
147  virtual void OnPerformAction(views::Combobox* combobox) OVERRIDE;
148
149  // views::StyledLabelListener implementation:
150  virtual void StyledLabelLinkClicked(const gfx::Range& range, int event_flags)
151      OVERRIDE;
152
153  // views::MenuButtonListener implementation.
154  virtual void OnMenuButtonClicked(views::View* source,
155                                   const gfx::Point& point) OVERRIDE;
156
157 protected:
158  // Exposed for testing.
159  views::View* GetLoadingShieldForTesting();
160  views::WebView* GetSignInWebViewForTesting();
161  views::View* GetNotificationAreaForTesting();
162  views::View* GetScrollableAreaForTesting();
163
164 private:
165  friend class AutofillDialogViewTesterViews;
166
167  // What the entire dialog should be doing (e.g. gathering info from the user,
168  // asking the user to sign in, etc.).
169  enum DialogMode {
170    DETAIL_INPUT,
171    LOADING,
172    SIGN_IN,
173  };
174
175  // A View which displays the currently selected account and lets the user
176  // switch accounts.
177  class AccountChooser : public views::View,
178                         public views::LinkListener,
179                         public views::MenuButtonListener,
180                         public base::SupportsWeakPtr<AccountChooser> {
181   public:
182    explicit AccountChooser(AutofillDialogViewDelegate* delegate);
183    virtual ~AccountChooser();
184
185    // Updates the view based on the state that |delegate_| reports.
186    void Update();
187
188    // views::LinkListener implementation.
189    virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
190
191    // views::MenuButtonListener implementation.
192    virtual void OnMenuButtonClicked(views::View* source,
193                                     const gfx::Point& point) OVERRIDE;
194
195   private:
196    // The icon for the currently in-use account.
197    views::ImageView* image_;
198
199    // The button for showing a menu to change the currently in-use account.
200    views::MenuButton* menu_button_;
201
202    // The sign in link.
203    views::Link* link_;
204
205    // The delegate |this| queries for logic and state.
206    AutofillDialogViewDelegate* delegate_;
207
208    // Runs the suggestion menu (triggered by each section's |suggested_button|.
209    scoped_ptr<views::MenuRunner> menu_runner_;
210
211    DISALLOW_COPY_AND_ASSIGN(AccountChooser);
212  };
213
214  // A view which displays an image, optionally some messages and a button. Used
215  // for the Wallet interstitial.
216  class OverlayView : public views::View {
217   public:
218    explicit OverlayView(AutofillDialogViewDelegate* delegate);
219    virtual ~OverlayView();
220
221    // Returns a height which should be used when the contents view has width
222    // |w|. Note that the value returned should be used as the height of the
223    // dialog's contents.
224    int GetHeightForContentsForWidth(int width);
225
226    // Sets the state to whatever |delegate_| says it should be.
227    void UpdateState();
228
229    // views::View implementation:
230    virtual gfx::Insets GetInsets() const OVERRIDE;
231    virtual void Layout() OVERRIDE;
232    virtual const char* GetClassName() const OVERRIDE;
233    virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
234    virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE;
235
236   private:
237    // Gets the border of the non-client frame view as a BubbleBorder.
238    views::BubbleBorder* GetBubbleBorder();
239
240    // Gets the bounds of this view without the frame view's bubble border.
241    gfx::Rect ContentBoundsSansBubbleBorder();
242
243    // The delegate that provides |state| when UpdateState is called.
244    AutofillDialogViewDelegate* delegate_;
245
246    // Child View. Front and center.
247    views::ImageView* image_view_;
248    // Child View. When visible, below |image_view_|.
249    views::Label* message_view_;
250
251    DISALLOW_COPY_AND_ASSIGN(OverlayView);
252  };
253
254  // An area for notifications. Some notifications point at the account chooser.
255  class NotificationArea : public views::View {
256   public:
257    explicit NotificationArea(AutofillDialogViewDelegate* delegate);
258    virtual ~NotificationArea();
259
260    // Displays the given notifications.
261    void SetNotifications(const std::vector<DialogNotification>& notifications);
262
263    // views::View implementation.
264    virtual gfx::Size GetPreferredSize() const OVERRIDE;
265    virtual const char* GetClassName() const OVERRIDE;
266    virtual void PaintChildren(gfx::Canvas* canvas,
267                               const views::CullSet& cull_set) OVERRIDE;
268    virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
269
270    void set_arrow_centering_anchor(
271        const base::WeakPtr<views::View>& arrow_centering_anchor) {
272      arrow_centering_anchor_ = arrow_centering_anchor;
273    }
274
275   private:
276    // Utility function for determining whether an arrow should be drawn
277    // pointing at |arrow_centering_anchor_|.
278    bool HasArrow();
279
280    // A reference to the delegate/controller than owns this view.
281    // Used to report when checkboxes change their values.
282    AutofillDialogViewDelegate* delegate_;  // weak
283
284    // If HasArrow() is true, the arrow should point at this.
285    base::WeakPtr<views::View> arrow_centering_anchor_;
286
287    std::vector<DialogNotification> notifications_;
288
289    DISALLOW_COPY_AND_ASSIGN(NotificationArea);
290  };
291
292  typedef std::map<ServerFieldType, ExpandingTextfield*> TextfieldMap;
293  typedef std::map<ServerFieldType, views::Combobox*> ComboboxMap;
294
295  // A view that packs a label on the left and some related controls
296  // on the right.
297  class SectionContainer : public views::View,
298                           public views::ViewTargeterDelegate {
299   public:
300    SectionContainer(const base::string16& label,
301                     views::View* controls,
302                     views::Button* proxy_button);
303    virtual ~SectionContainer();
304
305    // Sets the visual appearance of the section to active (considered active
306    // when showing the menu or hovered by the mouse cursor).
307    void SetActive(bool active);
308
309    // Sets whether mouse events should be forwarded to |proxy_button_|.
310    void SetForwardMouseEvents(bool forward);
311
312    // views::View implementation.
313    virtual const char* GetClassName() const OVERRIDE;
314    virtual void OnMouseMoved(const ui::MouseEvent& event) OVERRIDE;
315    virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE;
316    virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE;
317    virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE;
318    virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE;
319    virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
320
321   private:
322    // views::ViewTargeterDelegate:
323    virtual views::View* TargetForRect(views::View* root,
324                                       const gfx::Rect& rect) OVERRIDE;
325
326    // Converts |event| to one suitable for |proxy_button_|.
327    static ui::MouseEvent ProxyEvent(const ui::MouseEvent& event);
328
329    // Returns true if the given event should be forwarded to |proxy_button_|.
330    bool ShouldForwardEvent(const ui::LocatedEvent& event);
331
332    // Mouse events on |this| are sent to this button.
333    views::Button* proxy_button_;  // Weak reference.
334
335    // When true, all mouse events will be forwarded to |proxy_button_|.
336    bool forward_mouse_events_;
337
338    DISALLOW_COPY_AND_ASSIGN(SectionContainer);
339  };
340
341  // A button to show address or billing suggestions.
342  class SuggestedButton : public views::MenuButton {
343   public:
344    explicit SuggestedButton(views::MenuButtonListener* listener);
345    virtual ~SuggestedButton();
346
347    // views::MenuButton implementation.
348    virtual gfx::Size GetPreferredSize() const OVERRIDE;
349    virtual const char* GetClassName() const OVERRIDE;
350    virtual void PaintChildren(gfx::Canvas* canvas,
351                               const views::CullSet& cull_set) OVERRIDE;
352    virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
353
354   private:
355    // Returns the corred resource ID (i.e. IDR_*) for the current |state()|.
356    int ResourceIDForState() const;
357
358    DISALLOW_COPY_AND_ASSIGN(SuggestedButton);
359  };
360
361  // A view that runs a callback whenever its bounds change, and which can
362  // optionally suppress layout.
363  class DetailsContainerView : public views::View {
364   public:
365    explicit DetailsContainerView(const base::Closure& callback);
366    virtual ~DetailsContainerView();
367
368    void set_ignore_layouts(bool ignore_layouts) {
369      ignore_layouts_ = ignore_layouts;
370    }
371
372    // views::View implementation.
373    virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE;
374    virtual void Layout() OVERRIDE;
375
376   private:
377    base::Closure bounds_changed_callback_;
378
379    // The view ignores Layout() calls when this is true.
380    bool ignore_layouts_;
381
382    DISALLOW_COPY_AND_ASSIGN(DetailsContainerView);
383  };
384
385  // A view that contains a suggestion (such as a known address).
386  class SuggestionView : public views::View {
387   public:
388    explicit SuggestionView(AutofillDialogViews* autofill_dialog);
389    virtual ~SuggestionView();
390
391    void SetState(const SuggestionState& state);
392
393    // views::View implementation.
394    virtual gfx::Size GetPreferredSize() const OVERRIDE;
395    virtual int GetHeightForWidth(int width) const OVERRIDE;
396    virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE;
397
398    ExpandingTextfield* textfield() { return textfield_; }
399
400   private:
401    // Returns whether there's room to display |state_.vertically_compact_text|
402    // without resorting to an ellipsis for a pixel width of |available_width|.
403    // Fills in |resulting_height| with the amount of space required to display
404    // |vertically_compact_text| or |horizontally_compact_text| as the case may
405    // be.
406    bool CanUseVerticallyCompactText(int available_width,
407                                     int* resulting_height) const;
408
409    // Sets the display text of the suggestion.
410    void SetLabelText(const base::string16& text);
411
412    // Sets the icon which should be displayed ahead of the text.
413    void SetIcon(const gfx::Image& image);
414
415    // Shows an auxiliary textfield to the right of the suggestion icon and
416    // text. This is currently only used to show a CVC field for the CC section.
417    void SetTextfield(const base::string16& placeholder_text,
418                      const gfx::Image& icon);
419
420    // Calls SetLabelText() with the appropriate text based on current bounds.
421    void UpdateLabelText();
422
423    // The state of |this|.
424    SuggestionState state_;
425
426    // This caches preferred heights for given widths. The key is a preferred
427    // width, the value is a cached result of CanUseVerticallyCompactText.
428    mutable std::map<int, std::pair<bool, int> > calculated_heights_;
429
430    // The label that holds the suggestion description text.
431    views::Label* label_;
432    // The second (and greater) line of text that describes the suggestion.
433    views::Label* label_line_2_;
434    // The icon that comes just before |label_|.
435    views::ImageView* icon_;
436    // The input set by ShowTextfield.
437    ExpandingTextfield* textfield_;
438
439    DISALLOW_COPY_AND_ASSIGN(SuggestionView);
440  };
441
442  // A convenience struct for holding pointers to views within each detail
443  // section. None of the member pointers are owned.
444  struct DetailsGroup {
445    explicit DetailsGroup(DialogSection section);
446    ~DetailsGroup();
447
448    // The section this group is associated with.
449    const DialogSection section;
450    // The view that contains the entire section (label + input).
451    SectionContainer* container;
452    // The view that allows manual input.
453    views::View* manual_input;
454    // The textfields in |manual_input|, tracked by their ServerFieldType.
455    TextfieldMap textfields;
456    // The comboboxes in |manual_input|, tracked by their ServerFieldType.
457    ComboboxMap comboboxes;
458    // The view that holds the text of the suggested data. This will be
459    // visible IFF |manual_input| is not visible.
460    SuggestionView* suggested_info;
461    // The view that allows selecting other data suggestions.
462    SuggestedButton* suggested_button;
463  };
464
465  typedef std::map<DialogSection, DetailsGroup> DetailGroupMap;
466
467  // Returns the preferred size or minimum size (if |get_minimum_size| is true).
468  gfx::Size CalculatePreferredSize(bool get_minimum_size) const;
469
470  // Returns the minimum size of the sign in view for this dialog.
471  gfx::Size GetMinimumSignInViewSize() const;
472
473  // Returns the maximum size of the sign in view for this dialog.
474  gfx::Size GetMaximumSignInViewSize() const;
475
476  // Returns which section should currently be used for credit card info.
477  DialogSection GetCreditCardSection() const;
478
479  void InitChildViews();
480
481  // Creates and returns a view that holds all detail sections.
482  views::View* CreateDetailsContainer();
483
484  // Creates and returns a view that holds the requesting host and intro text.
485  views::View* CreateNotificationArea();
486
487  // Creates and returns a view that holds the main controls of this dialog.
488  views::View* CreateMainContainer();
489
490  // Creates a detail section (Shipping, Email, etc.) with the given label,
491  // inputs View, and suggestion model. Relevant pointers are stored in |group|.
492  void CreateDetailsSection(DialogSection section);
493
494  // Creates the view that holds controls for inputing or selecting data for
495  // a given section.
496  views::View* CreateInputsContainer(DialogSection section);
497
498  // Creates a grid of inputs for the given section.
499  void InitInputsView(DialogSection section);
500
501  // Changes the function of the whole dialog. Currently this can show a loading
502  // shield, an embedded sign in web view, or the more typical detail input mode
503  // (suggestions and form inputs).
504  void ShowDialogInMode(DialogMode dialog_mode);
505
506  // Updates the given section to match the state provided by |delegate_|. If
507  // |clobber_inputs| is true, the current state of the textfields will be
508  // ignored, otherwise their contents will be preserved.
509  void UpdateSectionImpl(DialogSection section, bool clobber_inputs);
510
511  // Updates the visual state of the given group as per the model.
512  void UpdateDetailsGroupState(const DetailsGroup& group);
513
514  // Gets a pointer to the DetailsGroup that's associated with the given section
515  // of the dialog.
516  DetailsGroup* GroupForSection(DialogSection section);
517
518  // Gets a pointer to the DetailsGroup that's associated with a given |view|.
519  // Returns NULL if no DetailsGroup was found.
520  DetailsGroup* GroupForView(views::View* view);
521
522  // Erases all views in |group| from |validity_map_|.
523  void EraseInvalidViewsInGroup(const DetailsGroup* group);
524
525  // Explicitly focuses the initially focusable view.
526  void FocusInitialView();
527
528  // Sets the visual state for an input to be either valid or invalid. This
529  // should work on Comboboxes or ExpandingTextfields. If |message| is empty,
530  // the input is valid.
531  template<class T>
532  void SetValidityForInput(T* input, const base::string16& message);
533
534  // Shows an error bubble pointing at |view| if |view| has a message in
535  // |validity_map_|.
536  void ShowErrorBubbleForViewIfNecessary(views::View* view);
537
538  // Hides |error_bubble_| (if it exists).
539  void HideErrorBubble();
540
541  // Updates validity of the inputs in |section| with new |validity_messages|.
542  // Fields are only updated with unsure messages if |overwrite_valid| is true.
543  void MarkInputsInvalid(DialogSection section,
544                         const ValidityMessages& validity_messages,
545                         bool overwrite_invalid);
546
547  // Checks all manual inputs in |group| for validity. Decorates the invalid
548  // ones and returns true if all were valid.
549  bool ValidateGroup(const DetailsGroup& group, ValidationType type);
550
551  // Checks all manual inputs in the form for validity. Decorates the invalid
552  // ones and returns true if all were valid.
553  bool ValidateForm();
554
555  // When an input is edited (its contents change) or activated (clicked while
556  // focused), this function will inform the delegate to take the appropriate
557  // action (textfields may show a suggestion popup, comboboxes may rebuild the
558  // section inputs). May also reset the validity state of the input.
559  void InputEditedOrActivated(ServerFieldType type,
560                              const gfx::Rect& bounds,
561                              bool was_edit);
562
563  // Updates the views in the button strip.
564  void UpdateButtonStripExtraView();
565
566  // Call this when the size of anything in the contents might have changed.
567  void ContentsPreferredSizeChanged();
568  void DoContentsPreferredSizeChanged();
569
570  // Gets the textfield view that is shown for the given |type| or NULL.
571  ExpandingTextfield* TextfieldForType(ServerFieldType type);
572
573  // Returns the associated ServerFieldType for |textfield|.
574  ServerFieldType TypeForTextfield(const views::View* textfield);
575
576  // Gets the combobox view that is shown for the given |type|, or NULL.
577  views::Combobox* ComboboxForType(ServerFieldType type);
578
579  // Returns the associated ServerFieldType for |combobox|.
580  ServerFieldType TypeForCombobox(const views::Combobox* combobox) const;
581
582  // Called when the details container changes in size or position.
583  void DetailsContainerBoundsChanged();
584
585  // Sets the icons in |section| according to the field values. For example,
586  // sets the credit card and CVC icons according to the credit card number.
587  void SetIconsForSection(DialogSection section);
588
589  // Iterates over all the inputs in |section| and sets their enabled/disabled
590  // state.
591  void SetEditabilityForSection(DialogSection section);
592
593  // Handles mouse presses on the non-client view.
594  void NonClientMousePressed();
595
596  // The delegate that drives this view. Weak pointer, always non-NULL.
597  AutofillDialogViewDelegate* const delegate_;
598
599  // The preferred size of the view, cached to avoid needless recomputation.
600  mutable gfx::Size preferred_size_;
601
602  // The current number of unmatched calls to UpdatesStarted.
603  int updates_scope_;
604
605  // True when there's been a call to ContentsPreferredSizeChanged() suppressed
606  // due to an unmatched UpdatesStarted.
607  bool needs_update_;
608
609  // The window that displays the dialog contents. Weak pointer; may be NULL
610  // when the dialog is closing.
611  views::Widget* window_;
612
613  // A DialogSection-keyed map of the DetailGroup structs.
614  DetailGroupMap detail_groups_;
615
616  // Somewhere to show notification messages about errors, warnings, or promos.
617  NotificationArea* notification_area_;
618
619  // Runs the suggestion menu (triggered by each section's |suggested_button|.
620  scoped_ptr<views::MenuRunner> menu_runner_;
621
622  // The view that allows the user to toggle the data source.
623  AccountChooser* account_chooser_;
624
625  // A WebView to that navigates to a Google sign-in page to allow the user to
626  // sign-in.
627  views::WebView* sign_in_web_view_;
628
629  // View that wraps |details_container_| and makes it scroll vertically.
630  views::ScrollView* scrollable_area_;
631
632  // View to host details sections.
633  DetailsContainerView* details_container_;
634
635  // A view that overlays |this| (for "loading..." messages).
636  views::View* loading_shield_;
637
638  // The height for |loading_shield_|. This prevents the height of the dialog
639  // from changing while the loading shield is showing.
640  int loading_shield_height_;
641
642  // The view that completely overlays the dialog (used for the splash page).
643  OverlayView* overlay_view_;
644
645  // The "Extra view" is on the same row as the dialog buttons.
646  views::View* button_strip_extra_view_;
647
648  // This checkbox controls whether new details are saved to the Autofill
649  // database. It lives in |extra_view_|.
650  views::Checkbox* save_in_chrome_checkbox_;
651
652  // Holds the above checkbox and an associated tooltip icon.
653  views::View* save_in_chrome_checkbox_container_;
654
655  // Used to display an image in the button strip extra view.
656  views::ImageView* button_strip_image_;
657
658  // View that aren't in the hierarchy but are owned by |this|. Currently
659  // just holds the (hidden) country comboboxes.
660  ScopedVector<views::View> other_owned_views_;
661
662  // The view that is appended to the bottom of the dialog, below the button
663  // strip. Used to display legal document links.
664  views::View* footnote_view_;
665
666  // The legal document text and links.
667  views::StyledLabel* legal_document_view_;
668
669  // The focus manager for |window_|.
670  views::FocusManager* focus_manager_;
671
672  // The object that manages the error bubble widget.
673  InfoBubble* error_bubble_;  // Weak; owns itself.
674
675  // Map from input view (textfield or combobox) to error string.
676  std::map<views::View*, base::string16> validity_map_;
677
678  ScopedObserver<views::Widget, AutofillDialogViews> observer_;
679
680  // Delegate for the sign-in dialog's webview.
681  scoped_ptr<AutofillDialogSignInDelegate> sign_in_delegate_;
682
683  // Used to tell the delegate when focus moves to hide the Autofill popup.
684  scoped_ptr<ui::EventHandler> event_handler_;
685
686  DISALLOW_COPY_AND_ASSIGN(AutofillDialogViews);
687};
688
689}  // namespace autofill
690
691#endif  // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_
692