Chromium Code Reviews| Index: chrome/browser/ui/views/autofill/autofill_dialog_views.h |
| diff --git a/chrome/browser/ui/views/autofill/autofill_dialog_views.h b/chrome/browser/ui/views/autofill/autofill_dialog_views.h |
| index a71d67c850372aa4252d6c6254792a08519ab73f..faacbbfdad8dd9b28e3b2983c0aa8b8998e31f32 100644 |
| --- a/chrome/browser/ui/views/autofill/autofill_dialog_views.h |
| +++ b/chrome/browser/ui/views/autofill/autofill_dialog_views.h |
| @@ -7,6 +7,7 @@ |
| #include <map> |
| +#include "base/memory/scoped_vector.h" |
| #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" |
| #include "chrome/browser/ui/autofill/autofill_dialog_view.h" |
| #include "ui/views/controls/button/button.h" |
| @@ -24,6 +25,7 @@ class KeyboardListener; |
| } |
| namespace gfx { |
| +class Font; |
| class Image; |
| } |
| @@ -31,6 +33,7 @@ namespace views { |
| class Checkbox; |
| class Combobox; |
| class FocusManager; |
| +class GridLayout; |
| class ImageButton; |
| class ImageView; |
| class Label; |
| @@ -76,6 +79,7 @@ class AutofillDialogViews : public AutofillDialogView, |
| virtual const content::NavigationController& ShowSignIn() OVERRIDE; |
| virtual void HideSignIn() OVERRIDE; |
| virtual void UpdateProgressBar(double value) OVERRIDE; |
| + virtual void UpdateFootnote() OVERRIDE; |
| // views::DialogDelegate implementation: |
| virtual string16 GetWindowTitle() const OVERRIDE; |
| @@ -262,13 +266,66 @@ class AutofillDialogViews : public AutofillDialogView, |
| public: |
| AutocheckoutProgressBar(); |
| - private: |
| // Overidden from View: |
| virtual gfx::Size GetPreferredSize() OVERRIDE; |
| + private: |
| DISALLOW_COPY_AND_ASSIGN(AutocheckoutProgressBar); |
| }; |
| + class FootnoteView : public views::View { |
|
sky
2013/02/14 22:47:10
If I understand this correctly this class is effec
Dan Beam
2013/02/15 01:48:31
hey Scott, originally estade@ and I discussed this
|
| + public: |
| + FootnoteView(); |
| + virtual ~FootnoteView(); |
| + |
| + void AddLabel(views::Label* label, bool is_link); |
| + int IndexOfLink(views::Label* link); // Returns -1 if not found. |
| + |
| + // views::View implementation. |
| + virtual std::string GetClassName() const OVERRIDE; |
| + virtual void Layout() OVERRIDE; |
| + |
| + private: |
| + struct FootnoteLabel { |
| + scoped_ptr<views::Label> label; |
| + bool is_link; |
| + }; |
| + |
| + void StartRow(); |
| + views::View* CurrentRow(); |
| + void ResetLayoutManager(); |
| + void ResetRows(); |
| + |
| + void AppendText(const string16& text_part); |
| + const string16& CurrentText() const; |
| + void ResetText(); |
| + |
| + void AddWidth(size_t width); |
| + size_t CurrentWidth() const; |
| + int ParentWidth(); |
| + void ResetWidth(); |
| + int WidthRemaining(); |
| + |
| + void AddCloneWithWidth(views::Label* label, size_t width); |
| + views::Label* CloneLabel(const string16& text, |
| + const gfx::Font& font, |
| + bool is_link); |
| + void TransferListener(views::Label* from_label, views::Label* to_label); |
| + |
| + void Reset(); |
| + |
| + ScopedVector<FootnoteLabel> footnote_labels_; // owned by us. |
| + std::vector<views::Label*> links_; // weak. |
| + string16 current_text_; |
| + |
| + size_t current_width_; |
| + views::GridLayout* layout_; // weak; owned by view hierarchy. |
| + int previous_parent_width_; |
| + const int single_column_set_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(FootnoteView); |
| + }; |
| + |
| typedef std::map<DialogSection, DetailsGroup> DetailGroupMap; |
| void InitChildViews(); |
| @@ -279,11 +336,17 @@ class AutofillDialogViews : public AutofillDialogView, |
| // Creates and returns a view that holds the requesting host and intro text. |
| views::View* CreateNotificationArea(); |
| + // Creates and returns a view that holds the main controls of this dialog. |
| + views::View* CreateMainContainer(); |
| + |
| // Creates and returns a view that holds a sign in page and related controls. |
| views::View* CreateSignInContainer(); |
| - // Creates and returns a view that holds the main controls of this dialog. |
| - views::View* CreateMainContainer(); |
| + // Creates footnote container. |
| + void CreateFootnoteView(); |
| + |
| + // [Re-]populates footnote links based on the controller's link text parts. |
| + void PopulateFootnoteLinks(); |
| // Creates a detail section (Shipping, Email, etc.) with the given label, |
| // inputs View, and suggestion model. Relevant pointers are stored in |group|. |
| @@ -323,6 +386,10 @@ class AutofillDialogViews : public AutofillDialogView, |
| // the input. |
| void TextfieldEditedOrActivated(views::Textfield* textfield, bool was_edit); |
| + // When something inside of |contents_| could've changed in height, call this |
| + // to ensure |contents_|' preferred size is correct. |
| + void ContentsResized(); |
| + |
| // The controller that drives this view. Weak pointer, always non-NULL. |
| AutofillDialogController* const controller_; |
| @@ -379,6 +446,10 @@ class AutofillDialogViews : public AutofillDialogView, |
| // Progress bar for displaying Autocheckout progress. |
| AutocheckoutProgressBar* autocheckout_progress_bar_; |
| + // View shown when accepting of a new Terms of Service is required. Lives |
| + // below the Cancel/Submit buttons. |
| + FootnoteView* footnote_view_; |
| + |
| // The focus manager for |window_|. |
| views::FocusManager* focus_manager_; |