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