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