Index: chrome/browser/ui/views/autofill/autofill_dialog_views.cc |
diff --git a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc |
index c4786fbe95711f1c4cb9145e9b10f4d9c593cd8b..db687d507060f11295127e3100a65aabb39daa21 100644 |
--- a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc |
+++ b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc |
@@ -332,6 +332,7 @@ void AutofillDialogViews::SuggestionView::ShowTextfield( |
} |
// AutofilDialogViews::AutocheckoutProgressBar --------------------------------- |
+ |
AutofillDialogViews::AutocheckoutProgressBar::AutocheckoutProgressBar() {} |
gfx::Size AutofillDialogViews::AutocheckoutProgressBar::GetPreferredSize() { |
@@ -365,6 +366,9 @@ AutofillDialogViews::AutofillDialogViews(AutofillDialogController* controller) |
save_in_chrome_checkbox_(NULL), |
autocheckout_progress_bar_view_(NULL), |
autocheckout_progress_bar_(NULL), |
+ footnote_view_(NULL), |
+ terms_of_service_link_(NULL), |
+ privacy_policy_link_(NULL), |
focus_manager_(NULL) { |
DCHECK(controller); |
detail_groups_.insert(std::make_pair(SECTION_EMAIL, |
@@ -385,6 +389,7 @@ void AutofillDialogViews::Show() { |
InitChildViews(); |
UpdateAccountChooser(); |
UpdateNotificationArea(); |
+ UpdateFootnote(); |
// Ownership of |contents_| is handed off by this call. The |
// WebContentsModalDialog will take care of deleting itself after calling |
@@ -479,6 +484,17 @@ void AutofillDialogViews::UpdateProgressBar(double value) { |
autocheckout_progress_bar_->SetValue(value); |
} |
+void AutofillDialogViews::UpdateFootnote() { |
+ footnote_view_->SetVisible(controller_->IsFootnoteShowing()); |
+ footnote_view_->SetSize( |
Evan Stade
2013/02/08 15:38:53
You shouldn't have to explicitly set the size.
Dan Beam
2013/02/08 20:53:06
I did when I wanted to make this wrap, otherwise i
|
+ gfx::Size(contents_->width(), footnote_view_->height())); |
+ |
+ if (GetWidget()) |
+ GetWidget()->SetSize(GetWidget()->non_client_view()->GetPreferredSize()); |
+ |
+ contents_->Layout(); |
+} |
+ |
string16 AutofillDialogViews::GetWindowTitle() const { |
return controller_->DialogTitle(); |
} |
@@ -520,8 +536,7 @@ views::View* AutofillDialogViews::GetExtraView() { |
} |
views::View* AutofillDialogViews::GetFootnoteView() { |
- // TODO(estade): add a view to contain the terms of service. |
- return NULL; |
+ return footnote_view_; |
} |
bool AutofillDialogViews::Cancel() { |
@@ -602,18 +617,20 @@ void AutofillDialogViews::OnDidChangeFocus( |
views::View* focused_now) {} |
void AutofillDialogViews::LinkClicked(views::Link* source, int event_flags) { |
- // Sign in link. |
if (source == sign_in_link_) { |
controller_->StartSignInFlow(); |
- return; |
- } |
- |
- // Edit links. |
- for (DetailGroupMap::iterator iter = detail_groups_.begin(); |
- iter != detail_groups_.end(); ++iter) { |
- if (iter->second.suggested_info->Contains(source)) { |
- controller_->EditClickedForSection(iter->first); |
- return; |
+ } else if (source == terms_of_service_link_) { |
+ controller_->ShowTermsOfService(); |
+ } else if (source == privacy_policy_link_) { |
+ controller_->ShowPrivacyPolicy(); |
+ } else { |
+ // Edit links. |
+ for (DetailGroupMap::iterator iter = detail_groups_.begin(); |
+ iter != detail_groups_.end(); ++iter) { |
+ if (iter->second.suggested_info->Contains(source)) { |
+ controller_->EditClickedForSection(iter->first); |
+ return; |
+ } |
} |
} |
} |
@@ -647,6 +664,95 @@ void AutofillDialogViews::InitChildViews() { |
new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0)); |
contents_->AddChildView(CreateMainContainer()); |
contents_->AddChildView(CreateSignInContainer()); |
+ |
+ footnote_view_ = new views::View(); |
Evan Stade
2013/02/08 15:38:53
Can you pull this new code into a separate functio
Dan Beam
2013/02/08 20:53:06
Done.
|
+ footnote_view_->set_border(views::Border::CreateEmptyBorder( |
+ views::kUnrelatedControlVerticalSpacing, 0, 0, 0)); |
+ |
+ views::BoxLayout* box_layout = |
+ new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0); |
+ box_layout->set_spread_blank_space(true); |
+ footnote_view_->SetLayoutManager(box_layout); |
+ |
+ // TODO(dbeam): pull out hardcoded colors / theme? |
+ views::View* footnote_padding = new views::View(); |
+ footnote_padding->set_background(views::Background::CreateSolidBackground( |
+ SkColorSetRGB(0xf3, 0xf3, 0xf4))); |
+ footnote_padding->set_border(views::Border::CreateSolidSidedBorder( |
+ 1, 0, 0, 0, SkColorSetRGB(0xea, 0xea, 0xeb))); |
+ |
+ footnote_view_->AddChildView(footnote_padding); |
+ |
+ views::GridLayout* padding_layout = new views::GridLayout(footnote_padding); |
+ footnote_padding->SetLayoutManager(padding_layout); |
+ |
+ const std::pair<std::vector<string16>, string16>& footnote_parts = |
+ controller_->FootnoteTextParts(); |
+ |
+ const int links_column_set = 1; |
+ views::ColumnSet* column_set = padding_layout->AddColumnSet(links_column_set); |
+ |
+ for (size_t i = 0; i < footnote_parts.first.size(); ++i) { |
+ column_set->AddColumn(views::GridLayout::LEADING, |
+ views::GridLayout::FILL, |
+ 1, |
+ views::GridLayout::USE_PREF, |
+ 0, |
+ 0); |
+ } |
+ |
+ column_set->AddColumn(views::GridLayout::FILL, |
+ views::GridLayout::FILL, |
+ 1, |
+ views::GridLayout::USE_PREF, |
+ 0, |
+ 0); |
+ |
+ // Padding between border and slew of labels/links. |
+ padding_layout->StartRowWithPadding( |
+ 0, links_column_set, 0, views::kUnrelatedControlVerticalSpacing); |
+ |
+ // "" |
+ padding_layout->AddView(new views::Label(footnote_parts.first[0])); |
+ |
+ // "Google Wallet Terms of Service" (link). |
+ terms_of_service_link_ = new views::Link(footnote_parts.first[1]); |
+ terms_of_service_link_->set_listener(this); |
+ padding_layout->AddView(terms_of_service_link_); |
+ |
+ // " and ". |
+ padding_layout->AddView(new views::Label(footnote_parts.first[2])); |
+ |
+ // "Privacy Policy" (link). |
+ privacy_policy_link_ = new views::Link(footnote_parts.first[3]); |
+ privacy_policy_link_->set_listener(this); |
+ padding_layout->AddView(privacy_policy_link_); |
+ |
+ // " have been updated.". |
+ padding_layout->AddView(new views::Label(footnote_parts.first[4])); |
+ |
+ // TODO(dbeam): make this padding column work. |
Evan Stade
2013/02/08 15:38:53
Please fix this instead of leaving a todo
Dan Beam
2013/02/08 20:53:06
Done. (that sucked)
|
+ padding_layout->SkipColumns(1); |
+ |
+ const int full_width = 2; |
Evan Stade
2013/02/08 15:38:53
full_width_column_set
Dan Beam
2013/02/08 20:53:06
Done.
|
+ padding_layout->AddColumnSet(full_width)->AddColumn( |
+ views::GridLayout::FILL, |
+ views::GridLayout::FILL, |
+ 1, |
+ views::GridLayout::USE_PREF, |
+ 0, |
+ 0); |
+ |
+ // "By clicking submit you verify that you accept these changes.". |
+ views::Label* accept_these_changes = new views::Label(footnote_parts.second); |
+ accept_these_changes->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
+ |
+ padding_layout->StartRowWithPadding( |
+ 0, full_width, 0, views::kRelatedControlVerticalSpacing); |
+ padding_layout->AddView(accept_these_changes); |
+ |
+ padding_layout->StartRowWithPadding( |
+ 0, full_width, 0, views::kUnrelatedControlVerticalSpacing); |
} |
views::View* AutofillDialogViews::CreateSignInContainer() { |