OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 struct DetailsGroup { | 453 struct DetailsGroup { |
454 explicit DetailsGroup(DialogSection section); | 454 explicit DetailsGroup(DialogSection section); |
455 ~DetailsGroup(); | 455 ~DetailsGroup(); |
456 | 456 |
457 // The section this group is associated with. | 457 // The section this group is associated with. |
458 const DialogSection section; | 458 const DialogSection section; |
459 // The view that contains the entire section (label + input). | 459 // The view that contains the entire section (label + input). |
460 SectionContainer* container; | 460 SectionContainer* container; |
461 // The view that allows manual input. | 461 // The view that allows manual input. |
462 views::View* manual_input; | 462 views::View* manual_input; |
463 // The textfields in |manual_input|, tracked by their DetailInput. | 463 // The textfields in |manual_input|, tracked by their ServerFieldType. |
464 TextfieldMap textfields; | 464 TextfieldMap textfields; |
465 // The comboboxes in |manual_input|, tracked by their DetailInput. | 465 // The comboboxes in |manual_input|, tracked by their ServerFieldType. |
466 ComboboxMap comboboxes; | 466 ComboboxMap comboboxes; |
467 // The view that holds the text of the suggested data. This will be | 467 // The view that holds the text of the suggested data. This will be |
468 // visible IFF |manual_input| is not visible. | 468 // visible IFF |manual_input| is not visible. |
469 SuggestionView* suggested_info; | 469 SuggestionView* suggested_info; |
470 // The view that allows selecting other data suggestions. | 470 // The view that allows selecting other data suggestions. |
471 SuggestedButton* suggested_button; | 471 SuggestedButton* suggested_button; |
472 }; | 472 }; |
473 | 473 |
474 typedef std::map<DialogSection, DetailsGroup> DetailGroupMap; | 474 typedef std::map<DialogSection, DetailsGroup> DetailGroupMap; |
475 | 475 |
(...skipping 21 matching lines...) Expand all Loading... |
497 views::View* CreateMainContainer(); | 497 views::View* CreateMainContainer(); |
498 | 498 |
499 // Creates a detail section (Shipping, Email, etc.) with the given label, | 499 // Creates a detail section (Shipping, Email, etc.) with the given label, |
500 // inputs View, and suggestion model. Relevant pointers are stored in |group|. | 500 // inputs View, and suggestion model. Relevant pointers are stored in |group|. |
501 void CreateDetailsSection(DialogSection section); | 501 void CreateDetailsSection(DialogSection section); |
502 | 502 |
503 // Creates the view that holds controls for inputing or selecting data for | 503 // Creates the view that holds controls for inputing or selecting data for |
504 // a given section. | 504 // a given section. |
505 views::View* CreateInputsContainer(DialogSection section); | 505 views::View* CreateInputsContainer(DialogSection section); |
506 | 506 |
507 // Creates a grid of textfield views for the given section, and stores them | 507 // Creates a grid of inputs for the given section. |
508 // in the appropriate DetailsGroup. The top level View in the hierarchy is | 508 void InitInputsView(DialogSection section); |
509 // returned. | |
510 views::View* InitInputsView(DialogSection section); | |
511 | 509 |
512 // Changes the function of the whole dialog. Currently this can show a loading | 510 // 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 | 511 // shield, an embedded sign in web view, or the more typical detail input mode |
514 // (suggestions and form inputs). | 512 // (suggestions and form inputs). |
515 void ShowDialogInMode(DialogMode dialog_mode); | 513 void ShowDialogInMode(DialogMode dialog_mode); |
516 | 514 |
517 // Updates the given section to match the state provided by |delegate_|. If | 515 // 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 | 516 // |clobber_inputs| is true, the current state of the textfields will be |
519 // ignored, otherwise their contents will be preserved. | 517 // ignored, otherwise their contents will be preserved. |
520 void UpdateSectionImpl(DialogSection section, bool clobber_inputs); | 518 void UpdateSectionImpl(DialogSection section, bool clobber_inputs); |
521 | 519 |
522 // Updates the visual state of the given group as per the model. | 520 // Updates the visual state of the given group as per the model. |
523 void UpdateDetailsGroupState(const DetailsGroup& group); | 521 void UpdateDetailsGroupState(const DetailsGroup& group); |
524 | 522 |
525 // Gets a pointer to the DetailsGroup that's associated with the given section | 523 // Gets a pointer to the DetailsGroup that's associated with the given section |
526 // of the dialog. | 524 // of the dialog. |
527 DetailsGroup* GroupForSection(DialogSection section); | 525 DetailsGroup* GroupForSection(DialogSection section); |
528 | 526 |
529 // Gets a pointer to the DetailsGroup that's associated with a given |view|. | 527 // Gets a pointer to the DetailsGroup that's associated with a given |view|. |
530 // Returns NULL if no DetailsGroup was found. | 528 // Returns NULL if no DetailsGroup was found. |
531 DetailsGroup* GroupForView(views::View* view); | 529 DetailsGroup* GroupForView(views::View* view); |
532 | 530 |
| 531 // Erases all views in |group| from |validity_map_|. |
| 532 void EraseInvalidViewsInGroup(const DetailsGroup* group); |
| 533 |
533 // Explicitly focuses the initially focusable view. | 534 // Explicitly focuses the initially focusable view. |
534 void FocusInitialView(); | 535 void FocusInitialView(); |
535 | 536 |
536 // Sets the visual state for an input to be either valid or invalid. This | 537 // 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 // should work on Comboboxes or DecoratedTextfields. If |message| is empty, |
538 // the input is valid. | 539 // the input is valid. |
539 template<class T> | 540 template<class T> |
540 void SetValidityForInput(T* input, const base::string16& message); | 541 void SetValidityForInput(T* input, const base::string16& message); |
541 | 542 |
542 // Shows an error bubble pointing at |view| if |view| has a message in | 543 // Shows an error bubble pointing at |view| if |view| has a message in |
(...skipping 10 matching lines...) Expand all Loading... |
553 bool overwrite_invalid); | 554 bool overwrite_invalid); |
554 | 555 |
555 // Checks all manual inputs in |group| for validity. Decorates the invalid | 556 // Checks all manual inputs in |group| for validity. Decorates the invalid |
556 // ones and returns true if all were valid. | 557 // ones and returns true if all were valid. |
557 bool ValidateGroup(const DetailsGroup& group, ValidationType type); | 558 bool ValidateGroup(const DetailsGroup& group, ValidationType type); |
558 | 559 |
559 // Checks all manual inputs in the form for validity. Decorates the invalid | 560 // Checks all manual inputs in the form for validity. Decorates the invalid |
560 // ones and returns true if all were valid. | 561 // ones and returns true if all were valid. |
561 bool ValidateForm(); | 562 bool ValidateForm(); |
562 | 563 |
563 // When an input textfield is edited (its contents change) or activated | 564 // When an input is edited (its contents change) or activated (clicked while |
564 // (clicked while focused), this function will inform the delegate that it's | 565 // focused), this function will inform the delegate to take the appropriate |
565 // time to show a suggestion popup and possibly reset the validity state of | 566 // action (textfields may show a suggestion popup, comboboxes may rebuild the |
566 // the input. | 567 // section inputs). May also reset the validity state of the input. |
567 void TextfieldEditedOrActivated(views::Textfield* textfield, bool was_edit); | 568 void InputEditedOrActivated(ServerFieldType type, |
| 569 const gfx::Rect& bounds, |
| 570 bool was_edit); |
568 | 571 |
569 // Updates the views in the button strip. | 572 // Updates the views in the button strip. |
570 void UpdateButtonStripExtraView(); | 573 void UpdateButtonStripExtraView(); |
571 | 574 |
572 // Call this when the size of anything in |contents_| might've changed. | 575 // Call this when the size of anything in |contents_| might've changed. |
573 void ContentsPreferredSizeChanged(); | 576 void ContentsPreferredSizeChanged(); |
574 void DoContentsPreferredSizeChanged(); | 577 void DoContentsPreferredSizeChanged(); |
575 | 578 |
576 // Gets the textfield view that is shown for the given |type| or NULL. | 579 // Gets the textfield view that is shown for the given |type| or NULL. |
577 views::Textfield* TextfieldForType(ServerFieldType type); | 580 DecoratedTextfield* TextfieldForType(ServerFieldType type); |
| 581 |
| 582 // Returns the associated ServerFieldType for |textfield|. |
| 583 ServerFieldType TypeForTextfield(const views::Textfield* textfield); |
578 | 584 |
579 // Gets the combobox view that is shown for the given |type|, or NULL. | 585 // Gets the combobox view that is shown for the given |type|, or NULL. |
580 views::Combobox* ComboboxForType(ServerFieldType type); | 586 views::Combobox* ComboboxForType(ServerFieldType type); |
581 | 587 |
| 588 // Returns the associated ServerFieldType for |combobox|. |
| 589 ServerFieldType TypeForCombobox(const views::Combobox* combobox) const; |
| 590 |
582 // Called when the details container changes in size or position. | 591 // Called when the details container changes in size or position. |
583 void DetailsContainerBoundsChanged(); | 592 void DetailsContainerBoundsChanged(); |
584 | 593 |
585 // Sets the icons in |section| according to the field values. For example, | 594 // Sets the icons in |section| according to the field values. For example, |
586 // sets the credit card and CVC icons according to the credit card number. | 595 // sets the credit card and CVC icons according to the credit card number. |
587 void SetIconsForSection(DialogSection section); | 596 void SetIconsForSection(DialogSection section); |
588 | 597 |
589 // Iterates over all the inputs in |section| and sets their enabled/disabled | 598 // Iterates over all the inputs in |section| and sets their enabled/disabled |
590 // state. | 599 // state. |
591 void SetEditabilityForSection(DialogSection section); | 600 void SetEditabilityForSection(DialogSection section); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 | 685 |
677 // Delegate for the sign-in dialog's webview. | 686 // Delegate for the sign-in dialog's webview. |
678 scoped_ptr<AutofillDialogSignInDelegate> sign_in_delegate_; | 687 scoped_ptr<AutofillDialogSignInDelegate> sign_in_delegate_; |
679 | 688 |
680 DISALLOW_COPY_AND_ASSIGN(AutofillDialogViews); | 689 DISALLOW_COPY_AND_ASSIGN(AutofillDialogViews); |
681 }; | 690 }; |
682 | 691 |
683 } // namespace autofill | 692 } // namespace autofill |
684 | 693 |
685 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ | 694 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ |
OLD | NEW |