| 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 661c5049d0dbe36298da68fe8ed875f42366c96a..fe3b5e4c335a01a48432779a5d7c15068484a069 100644
|
| --- a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
|
| +++ b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
|
| @@ -236,8 +236,10 @@ void AutofillDialogViews::AccountChooser::LinkClicked(views::Link* source,
|
|
|
| // AutofillDialogViews::NotificationArea ---------------------------------------
|
|
|
| -AutofillDialogViews::NotificationArea::NotificationArea()
|
| - : checkbox_(NULL) {
|
| +AutofillDialogViews::NotificationArea::NotificationArea(
|
| + AutofillDialogController* controller)
|
| + : controller_(controller),
|
| + checkbox_(NULL) {
|
| // Reserve vertical space for the arrow (regardless of whether one exists).
|
| set_border(views::Border::CreateEmptyBorder(kArrowHeight, 0, 0, 0));
|
|
|
| @@ -252,8 +254,6 @@ void AutofillDialogViews::NotificationArea::SetNotifications(
|
| const std::vector<DialogNotification>& notifications) {
|
| notifications_ = notifications;
|
|
|
| - // Default checkbox to checked. Preserve checkbox state if it already exists.
|
| - bool checkbox_state = checkbox_ ? checkbox_->checked() : true;
|
| RemoveAllChildViews(true);
|
| checkbox_ = NULL;
|
|
|
| @@ -274,7 +274,6 @@ void AutofillDialogViews::NotificationArea::SetNotifications(
|
| kNotificationPadding,
|
| kNotificationPadding,
|
| kNotificationPadding));
|
| - checkbox->SetChecked(checkbox_state);
|
| if (!notification.interactive())
|
| checkbox->SetState(views::Button::STATE_DISABLED);
|
| checkbox->SetText(notification.display_text());
|
| @@ -282,6 +281,8 @@ void AutofillDialogViews::NotificationArea::SetNotifications(
|
| checkbox->set_alignment(views::TextButtonBase::ALIGN_LEFT);
|
| checkbox->SetEnabledColor(notification.GetTextColor());
|
| checkbox->SetHoverColor(notification.GetTextColor());
|
| + checkbox->SetChecked(notification.checked());
|
| + checkbox->set_listener(this);
|
| view.reset(checkbox.release());
|
| } else {
|
| scoped_ptr<views::Label> label(new views::Label());
|
| @@ -303,10 +304,6 @@ void AutofillDialogViews::NotificationArea::SetNotifications(
|
| PreferredSizeChanged();
|
| }
|
|
|
| -bool AutofillDialogViews::NotificationArea::CheckboxIsChecked() const {
|
| - return checkbox_ && checkbox_->checked();
|
| -}
|
| -
|
| std::string AutofillDialogViews::NotificationArea::GetClassName() const {
|
| return kNotificationAreaClassName;
|
| }
|
| @@ -331,6 +328,13 @@ void AutofillDialogViews::NotificationArea::OnPaint(gfx::Canvas* canvas) {
|
| }
|
| }
|
|
|
| +void AutofillDialogViews::NotificationArea::ButtonPressed(
|
| + views::Button* sender, const ui::Event& event) {
|
| + DCHECK_EQ(sender, checkbox_);
|
| + controller_->CheckboxStateChanged(notifications_.front().type(),
|
| + checkbox_->checked());
|
| +}
|
| +
|
| bool AutofillDialogViews::NotificationArea::HasArrow() {
|
| return !notifications_.empty() && notifications_[0].HasArrow() &&
|
| arrow_centering_anchor_.get();
|
| @@ -703,10 +707,6 @@ bool AutofillDialogViews::UseBillingForShipping() {
|
| return use_billing_for_shipping_->checked();
|
| }
|
|
|
| -bool AutofillDialogViews::SaveDetailsInWallet() {
|
| - return notification_area_->CheckboxIsChecked();
|
| -}
|
| -
|
| bool AutofillDialogViews::SaveDetailsLocally() {
|
| return save_in_chrome_checkbox_->checked();
|
| }
|
| @@ -1001,7 +1001,7 @@ views::View* AutofillDialogViews::CreateMainContainer() {
|
| if (!views::DialogDelegate::UseNewStyle())
|
| main_container_->AddChildView(account_chooser_);
|
|
|
| - notification_area_ = new NotificationArea();
|
| + notification_area_ = new NotificationArea(controller_);
|
| notification_area_->set_arrow_centering_anchor(account_chooser_->AsWeakPtr());
|
| main_container_->AddChildView(notification_area_);
|
|
|
|
|