autofill_dialog_views.h revision 58537e28ecd584eab876aee8be7156509866d23a
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::TextfieldController, 69 public views::FocusChangeListener, 70 public views::ComboboxListener, 71 public views::StyledLabelListener, 72 public views::MenuButtonListener { 73 public: 74 explicit AutofillDialogViews(AutofillDialogViewDelegate* delegate); 75 virtual ~AutofillDialogViews(); 76 77 // AutofillDialogView implementation: 78 virtual void Show() OVERRIDE; 79 virtual void Hide() OVERRIDE; 80 virtual void UpdatesStarted() OVERRIDE; 81 virtual void UpdatesFinished() OVERRIDE; 82 virtual void UpdateAccountChooser() OVERRIDE; 83 virtual void UpdateButtonStrip() OVERRIDE; 84 virtual void UpdateOverlay() OVERRIDE; 85 virtual void UpdateDetailArea() OVERRIDE; 86 virtual void UpdateForErrors() OVERRIDE; 87 virtual void UpdateNotificationArea() OVERRIDE; 88 virtual void UpdateSection(DialogSection section) OVERRIDE; 89 virtual void FillSection(DialogSection section, 90 const DetailInput& originating_input) OVERRIDE; 91 virtual void GetUserInput(DialogSection section, 92 DetailOutputMap* output) OVERRIDE; 93 virtual base::string16 GetCvc() OVERRIDE; 94 virtual bool HitTestInput(const DetailInput& input, 95 const gfx::Point& screen_point) OVERRIDE; 96 virtual bool SaveDetailsLocally() OVERRIDE; 97 virtual const content::NavigationController* ShowSignIn() OVERRIDE; 98 virtual void HideSignIn() 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 int GetDefaultDialogButton() const OVERRIDE; 128 virtual base::string16 GetDialogButtonLabel(ui::DialogButton button) const 129 OVERRIDE; 130 virtual bool ShouldDefaultButtonBeBlue() const OVERRIDE; 131 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; 132 virtual views::View* CreateExtraView() OVERRIDE; 133 virtual views::View* CreateTitlebarExtraView() OVERRIDE; 134 virtual views::View* CreateFootnoteView() OVERRIDE; 135 virtual bool Cancel() OVERRIDE; 136 virtual bool Accept() OVERRIDE; 137 virtual views::NonClientFrameView* CreateNonClientFrameView( 138 views::Widget* widget) OVERRIDE; 139 140 // views::WidgetObserver implementation: 141 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; 142 virtual void OnWidgetBoundsChanged(views::Widget* widget, 143 const gfx::Rect& new_bounds) OVERRIDE; 144 145 // views::TextfieldController implementation: 146 virtual void ContentsChanged(views::Textfield* sender, 147 const base::string16& new_contents) OVERRIDE; 148 virtual bool HandleKeyEvent(views::Textfield* sender, 149 const ui::KeyEvent& key_event) OVERRIDE; 150 virtual bool HandleMouseEvent(views::Textfield* sender, 151 const ui::MouseEvent& key_event) OVERRIDE; 152 153 // views::FocusChangeListener implementation. 154 virtual void OnWillChangeFocus(views::View* focused_before, 155 views::View* focused_now) OVERRIDE; 156 virtual void OnDidChangeFocus(views::View* focused_before, 157 views::View* focused_now) OVERRIDE; 158 159 // views::ComboboxListener implementation: 160 virtual void OnSelectedIndexChanged(views::Combobox* combobox) OVERRIDE; 161 162 // views::StyledLabelListener implementation: 163 virtual void StyledLabelLinkClicked(const gfx::Range& range, int event_flags) 164 OVERRIDE; 165 166 // views::MenuButtonListener implementation. 167 virtual void OnMenuButtonClicked(views::View* source, 168 const gfx::Point& point) OVERRIDE; 169 170 private: 171 // A class that creates and manages a widget for error messages. 172 class ErrorBubble : public views::WidgetObserver { 173 public: 174 ErrorBubble(views::View* anchor, const base::string16& message); 175 virtual ~ErrorBubble(); 176 177 bool IsShowing(); 178 179 // Re-positions the bubble over |anchor_|. If |anchor_| is not visible, 180 // the bubble will hide. 181 void UpdatePosition(); 182 183 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; 184 185 views::View* anchor() { return anchor_; } 186 187 private: 188 // Calculates and returns the bounds of |widget_|, depending on |anchor_| 189 // and |contents_|. 190 gfx::Rect GetBoundsForWidget(); 191 192 views::Widget* widget_; // Weak, may be NULL. 193 views::View* anchor_; // Weak. 194 // The contents view of |widget_|. 195 views::View* contents_; // Weak. 196 ScopedObserver<views::Widget, ErrorBubble> observer_; 197 198 DISALLOW_COPY_AND_ASSIGN(ErrorBubble); 199 }; 200 201 // A View which displays the currently selected account and lets the user 202 // switch accounts. 203 class AccountChooser : public views::View, 204 public views::LinkListener, 205 public views::MenuButtonListener, 206 public base::SupportsWeakPtr<AccountChooser> { 207 public: 208 explicit AccountChooser(AutofillDialogViewDelegate* delegate); 209 virtual ~AccountChooser(); 210 211 // Updates the view based on the state that |delegate_| reports. 212 void Update(); 213 214 // views::LinkListener implementation. 215 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; 216 217 // views::MenuButtonListener implementation. 218 virtual void OnMenuButtonClicked(views::View* source, 219 const gfx::Point& point) OVERRIDE; 220 221 private: 222 // The icon for the currently in-use account. 223 views::ImageView* image_; 224 225 // The button for showing a menu to change the currently in-use account. 226 views::MenuButton* menu_button_; 227 228 // The sign in link. 229 views::Link* link_; 230 231 // The delegate |this| queries for logic and state. 232 AutofillDialogViewDelegate* delegate_; 233 234 // Runs the suggestion menu (triggered by each section's |suggested_button|. 235 scoped_ptr<views::MenuRunner> menu_runner_; 236 237 DISALLOW_COPY_AND_ASSIGN(AccountChooser); 238 }; 239 240 // A view which displays an image, optionally some messages and a button. Used 241 // for the splash page as well as the Wallet interstitial. 242 class OverlayView : public views::View, 243 public ui::AnimationDelegate { 244 public: 245 explicit OverlayView(AutofillDialogViewDelegate* delegate); 246 virtual ~OverlayView(); 247 248 // Returns a height which should be used when the contents view has width 249 // |w|. Note that the value returned should be used as the height of the 250 // dialog's contents. 251 int GetHeightForContentsForWidth(int width); 252 253 // Sets the state to whatever |delegate_| says it should be. 254 void UpdateState(); 255 256 // Sets properties that should be displayed. Note that |state| may not come 257 // from |delegate_|. 258 void SetState(const DialogOverlayState& state); 259 260 // Fades the view out after a delay. 261 void BeginFadeOut(); 262 263 // ui::AnimationDelegate implementation: 264 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; 265 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; 266 267 // views::View implementation: 268 virtual gfx::Insets GetInsets() const OVERRIDE; 269 virtual void Layout() OVERRIDE; 270 virtual const char* GetClassName() const OVERRIDE; 271 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 272 virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; 273 274 private: 275 // Gets the border of the non-client frame view as a BubbleBorder. 276 views::BubbleBorder* GetBubbleBorder(); 277 278 // Gets the bounds of this view without the frame view's bubble border. 279 gfx::Rect ContentBoundsSansBubbleBorder(); 280 281 // The delegate that provides |state| when UpdateState is called. 282 AutofillDialogViewDelegate* delegate_; 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 289 // This MultiAnimation is used to first fade out the contents of the 290 // overlay, then fade out the background of the overlay (revealing the 291 // dialog behind the overlay). This avoids cross-fade. 292 scoped_ptr<ui::MultiAnimation> fade_out_; 293 294 DISALLOW_COPY_AND_ASSIGN(OverlayView); 295 }; 296 297 // An area for notifications. Some notifications point at the account chooser. 298 class NotificationArea : public views::View { 299 public: 300 explicit NotificationArea(AutofillDialogViewDelegate* delegate); 301 virtual ~NotificationArea(); 302 303 // Displays the given notifications. 304 void SetNotifications(const std::vector<DialogNotification>& notifications); 305 306 // views::View implementation. 307 virtual gfx::Size GetPreferredSize() OVERRIDE; 308 virtual const char* GetClassName() const OVERRIDE; 309 virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; 310 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 311 312 void set_arrow_centering_anchor( 313 const base::WeakPtr<views::View>& arrow_centering_anchor) { 314 arrow_centering_anchor_ = arrow_centering_anchor; 315 } 316 317 private: 318 // Utility function for determining whether an arrow should be drawn 319 // pointing at |arrow_centering_anchor_|. 320 bool HasArrow(); 321 322 // A reference to the delegate/controller than owns this view. 323 // Used to report when checkboxes change their values. 324 AutofillDialogViewDelegate* delegate_; // weak 325 326 // If HasArrow() is true, the arrow should point at this. 327 base::WeakPtr<views::View> arrow_centering_anchor_; 328 329 std::vector<DialogNotification> notifications_; 330 331 DISALLOW_COPY_AND_ASSIGN(NotificationArea); 332 }; 333 334 typedef std::map<const DetailInput*, DecoratedTextfield*> TextfieldMap; 335 typedef std::map<const DetailInput*, views::Combobox*> ComboboxMap; 336 337 // A view that packs a label on the left and some related controls 338 // on the right. 339 class SectionContainer : public views::View { 340 public: 341 SectionContainer(const base::string16& label, 342 views::View* controls, 343 views::Button* proxy_button); 344 virtual ~SectionContainer(); 345 346 // Sets the visual appearance of the section to active (considered active 347 // when showing the menu or hovered by the mouse cursor). 348 void SetActive(bool active); 349 350 // Sets whether mouse events should be forwarded to |proxy_button_|. 351 void SetForwardMouseEvents(bool forward); 352 353 // views::View implementation. 354 virtual void OnMouseMoved(const ui::MouseEvent& event) OVERRIDE; 355 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; 356 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; 357 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; 358 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; 359 360 private: 361 // Converts |event| to one suitable for |proxy_button_|. 362 static ui::MouseEvent ProxyEvent(const ui::MouseEvent& event); 363 364 // Mouse events on |this| are sent to this button. 365 views::Button* proxy_button_; // Weak reference. 366 367 // When true, mouse events will be forwarded to |proxy_button_|. 368 bool forward_mouse_events_; 369 370 DISALLOW_COPY_AND_ASSIGN(SectionContainer); 371 }; 372 373 // A button to show address or billing suggestions. 374 class SuggestedButton : public views::MenuButton { 375 public: 376 explicit SuggestedButton(views::MenuButtonListener* listener); 377 virtual ~SuggestedButton(); 378 379 // views::MenuButton implementation. 380 virtual gfx::Size GetPreferredSize() OVERRIDE; 381 virtual const char* GetClassName() const OVERRIDE; 382 virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; 383 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 384 385 private: 386 // Returns the corred resource ID (i.e. IDR_*) for the current |state()|. 387 int ResourceIDForState() const; 388 389 DISALLOW_COPY_AND_ASSIGN(SuggestedButton); 390 }; 391 392 // A view that runs a callback whenever its bounds change, and which can 393 // optionally suppress layout. 394 class DetailsContainerView : public views::View { 395 public: 396 explicit DetailsContainerView(const base::Closure& callback); 397 virtual ~DetailsContainerView(); 398 399 void set_ignore_layouts(bool ignore_layouts) { 400 ignore_layouts_ = ignore_layouts; 401 } 402 403 // views::View implementation. 404 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; 405 virtual void Layout() OVERRIDE; 406 407 private: 408 base::Closure bounds_changed_callback_; 409 410 // The view ignores Layout() calls when this is true. 411 bool ignore_layouts_; 412 413 DISALLOW_COPY_AND_ASSIGN(DetailsContainerView); 414 }; 415 416 // A view that contains a suggestion (such as a known address) and a link to 417 // edit the suggestion. 418 class SuggestionView : public views::View { 419 public: 420 explicit SuggestionView(AutofillDialogViews* autofill_dialog); 421 virtual ~SuggestionView(); 422 423 void SetState(const SuggestionState& state); 424 425 // views::View implementation. 426 virtual gfx::Size GetPreferredSize() OVERRIDE; 427 virtual int GetHeightForWidth(int width) OVERRIDE; 428 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; 429 430 DecoratedTextfield* decorated_textfield() { return decorated_; } 431 432 private: 433 // Returns whether there's room to display |state_.vertically_compact_text| 434 // without resorting to an ellipsis for a pixel width of |available_width|. 435 // Fills in |resulting_height| with the amount of space required to display 436 // |vertically_compact_text| or |horizontally_compact_text| as the case may 437 // be. 438 bool CanUseVerticallyCompactText(int available_width, 439 int* resulting_height); 440 441 // Sets the display text of the suggestion. 442 void SetLabelText(const base::string16& text); 443 444 // Sets the icon which should be displayed ahead of the text. 445 void SetIcon(const gfx::Image& image); 446 447 // Shows an auxiliary textfield to the right of the suggestion icon and 448 // text. This is currently only used to show a CVC field for the CC section. 449 void SetTextfield(const base::string16& placeholder_text, 450 const gfx::Image& icon); 451 452 // The state of |this|. 453 SuggestionState state_; 454 455 // This caches preferred heights for given widths. The key is a preferred 456 // width, the value is a cached result of CanUseVerticallyCompactText. 457 std::map<int, std::pair<bool, int> > calculated_heights_; 458 459 // The label that holds the suggestion description text. 460 views::Label* label_; 461 // The second (and greater) line of text that describes the suggestion. 462 views::Label* label_line_2_; 463 // The icon that comes just before |label_|. 464 views::ImageView* icon_; 465 // The input set by ShowTextfield. 466 DecoratedTextfield* decorated_; 467 // An "Edit" link that flips to editable inputs rather than suggestion text. 468 views::Link* edit_link_; 469 470 DISALLOW_COPY_AND_ASSIGN(SuggestionView); 471 }; 472 473 // A convenience struct for holding pointers to views within each detail 474 // section. None of the member pointers are owned. 475 struct DetailsGroup { 476 explicit DetailsGroup(DialogSection section); 477 ~DetailsGroup(); 478 479 // The section this group is associated with. 480 const DialogSection section; 481 // The view that contains the entire section (label + input). 482 SectionContainer* container; 483 // The view that allows manual input. 484 views::View* manual_input; 485 // The textfields in |manual_input|, tracked by their DetailInput. 486 TextfieldMap textfields; 487 // The comboboxes in |manual_input|, tracked by their DetailInput. 488 ComboboxMap comboboxes; 489 // The view that holds the text of the suggested data. This will be 490 // visible IFF |manual_input| is not visible. 491 SuggestionView* suggested_info; 492 // The view that allows selecting other data suggestions. 493 SuggestedButton* suggested_button; 494 }; 495 496 typedef std::map<DialogSection, DetailsGroup> DetailGroupMap; 497 498 gfx::Size CalculatePreferredSize(); 499 500 void InitChildViews(); 501 502 // Creates and returns a view that holds all detail sections. 503 views::View* CreateDetailsContainer(); 504 505 // Creates and returns a view that holds the requesting host and intro text. 506 views::View* CreateNotificationArea(); 507 508 // Creates and returns a view that holds the main controls of this dialog. 509 views::View* CreateMainContainer(); 510 511 // Creates a detail section (Shipping, Email, etc.) with the given label, 512 // inputs View, and suggestion model. Relevant pointers are stored in |group|. 513 void CreateDetailsSection(DialogSection section); 514 515 // Like CreateDetailsSection, but creates the combined billing/cc section, 516 // which is somewhat more complicated than the others. 517 void CreateBillingSection(); 518 519 // Creates the view that holds controls for inputing or selecting data for 520 // a given section. 521 views::View* CreateInputsContainer(DialogSection section); 522 523 // Creates a grid of textfield views for the given section, and stores them 524 // in the appropriate DetailsGroup. The top level View in the hierarchy is 525 // returned. 526 views::View* InitInputsView(DialogSection section); 527 528 // Updates the given section to match the state provided by |delegate_|. If 529 // |clobber_inputs| is true, the current state of the textfields will be 530 // ignored, otherwise their contents will be preserved. 531 void UpdateSectionImpl(DialogSection section, bool clobber_inputs); 532 533 // Updates the visual state of the given group as per the model. 534 void UpdateDetailsGroupState(const DetailsGroup& group); 535 536 // Gets a pointer to the DetailsGroup that's associated with the given section 537 // of the dialog. 538 DetailsGroup* GroupForSection(DialogSection section); 539 540 // Gets a pointer to the DetailsGroup that's associated with a given |view|. 541 // Returns NULL if no DetailsGroup was found. 542 DetailsGroup* GroupForView(views::View* view); 543 544 // Sets the visual state for an input to be either valid or invalid. This 545 // should work on Comboboxes or DecoratedTextfields. If |message| is empty, 546 // the input is valid. 547 template<class T> 548 void SetValidityForInput(T* input, const base::string16& message); 549 550 // Shows an error bubble pointing at |view| if |view| has a message in 551 // |validity_map_|. 552 void ShowErrorBubbleForViewIfNecessary(views::View* view); 553 554 // Updates validity of the inputs in |section| with the new validity data. 555 void MarkInputsInvalid(DialogSection section, 556 const ValidityData& validity_data); 557 558 // Checks all manual inputs in |group| for validity. Decorates the invalid 559 // ones and returns true if all were valid. 560 bool ValidateGroup(const DetailsGroup& group, ValidationType type); 561 562 // Checks all manual inputs in the form for validity. Decorates the invalid 563 // ones and returns true if all were valid. 564 bool ValidateForm(); 565 566 // When an input textfield is edited (its contents change) or activated 567 // (clicked while focused), this function will inform the delegate that it's 568 // time to show a suggestion popup and possibly reset the validity state of 569 // the input. 570 void TextfieldEditedOrActivated(views::Textfield* textfield, bool was_edit); 571 572 // Updates the views in the button strip. 573 void UpdateButtonStripExtraView(); 574 575 // Call this when the size of anything in |contents_| might've changed. 576 void ContentsPreferredSizeChanged(); 577 void DoContentsPreferredSizeChanged(); 578 579 // Gets the textfield view that is shown for the given DetailInput model, or 580 // NULL. 581 views::Textfield* TextfieldForInput(const DetailInput& input); 582 583 // Gets the combobox view that is shown for the given DetailInput model, or 584 // NULL. 585 views::Combobox* ComboboxForInput(const DetailInput& input); 586 587 // Called when the details container changes in size or position. 588 void DetailsContainerBoundsChanged(); 589 590 // Returns true when the dialog is showing the sign in webview. Also returns 591 // true if showing the loading indicator (spinner) after having gone through 592 // sign in. 593 bool SignInWebviewDictatesHeight() const; 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