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 29 matching lines...) Expand all Loading... |
572 // Call this when the size of anything in |contents_| might've changed. | 573 // Call this when the size of anything in |contents_| might've changed. |
573 void ContentsPreferredSizeChanged(); | 574 void ContentsPreferredSizeChanged(); |
574 void DoContentsPreferredSizeChanged(); | 575 void DoContentsPreferredSizeChanged(); |
575 | 576 |
576 // Gets the textfield view that is shown for the given |type| or NULL. | 577 // Gets the textfield view that is shown for the given |type| or NULL. |
577 views::Textfield* TextfieldForType(ServerFieldType type); | 578 views::Textfield* TextfieldForType(ServerFieldType type); |
578 | 579 |
579 // Gets the combobox view that is shown for the given |type|, or NULL. | 580 // Gets the combobox view that is shown for the given |type|, or NULL. |
580 views::Combobox* ComboboxForType(ServerFieldType type); | 581 views::Combobox* ComboboxForType(ServerFieldType type); |
581 | 582 |
| 583 // Returns the associated ServerFieldType for |combobox|. |
| 584 ServerFieldType TypeForCombobox(const views::Combobox* combobox) const; |
| 585 |
582 // Called when the details container changes in size or position. | 586 // Called when the details container changes in size or position. |
583 void DetailsContainerBoundsChanged(); | 587 void DetailsContainerBoundsChanged(); |
584 | 588 |
585 // Sets the icons in |section| according to the field values. For example, | 589 // 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. | 590 // sets the credit card and CVC icons according to the credit card number. |
587 void SetIconsForSection(DialogSection section); | 591 void SetIconsForSection(DialogSection section); |
588 | 592 |
589 // Iterates over all the inputs in |section| and sets their enabled/disabled | 593 // Iterates over all the inputs in |section| and sets their enabled/disabled |
590 // state. | 594 // state. |
591 void SetEditabilityForSection(DialogSection section); | 595 void SetEditabilityForSection(DialogSection section); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 | 680 |
677 // Delegate for the sign-in dialog's webview. | 681 // Delegate for the sign-in dialog's webview. |
678 scoped_ptr<AutofillDialogSignInDelegate> sign_in_delegate_; | 682 scoped_ptr<AutofillDialogSignInDelegate> sign_in_delegate_; |
679 | 683 |
680 DISALLOW_COPY_AND_ASSIGN(AutofillDialogViews); | 684 DISALLOW_COPY_AND_ASSIGN(AutofillDialogViews); |
681 }; | 685 }; |
682 | 686 |
683 } // namespace autofill | 687 } // namespace autofill |
684 | 688 |
685 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ | 689 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ |
OLD | NEW |