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