Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: chrome/browser/ui/views/autofill/autofill_dialog_views.h

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

Powered by Google App Engine
This is Rietveld 408576698