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 #include "chrome/browser/ui/views/autofill/autofill_dialog_views.h" | 5 #include "chrome/browser/ui/views/autofill/autofill_dialog_views.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/autofill/wallet/wallet_service_url.h" | 10 #include "chrome/browser/autofill/wallet/wallet_service_url.h" |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 detail_groups_.insert(std::make_pair(SECTION_SHIPPING, | 298 detail_groups_.insert(std::make_pair(SECTION_SHIPPING, |
299 DetailsGroup(SECTION_SHIPPING))); | 299 DetailsGroup(SECTION_SHIPPING))); |
300 } | 300 } |
301 | 301 |
302 AutofillDialogViews::~AutofillDialogViews() { | 302 AutofillDialogViews::~AutofillDialogViews() { |
303 DCHECK(!window_); | 303 DCHECK(!window_); |
304 } | 304 } |
305 | 305 |
306 void AutofillDialogViews::Show() { | 306 void AutofillDialogViews::Show() { |
307 InitChildViews(); | 307 InitChildViews(); |
| 308 UpdateAccountChooser(); |
308 UpdateNotificationArea(); | 309 UpdateNotificationArea(); |
309 | 310 |
310 // Ownership of |contents_| is handed off by this call. The | 311 // Ownership of |contents_| is handed off by this call. The |
311 // WebContentsModalDialog will take care of deleting itself after calling | 312 // WebContentsModalDialog will take care of deleting itself after calling |
312 // DeleteDelegate(). | 313 // DeleteDelegate(). |
313 window_ = new ConstrainedWindowViews(controller_->web_contents(), this); | 314 window_ = new ConstrainedWindowViews(controller_->web_contents(), this); |
314 focus_manager_ = window_->GetFocusManager(); | 315 focus_manager_ = window_->GetFocusManager(); |
315 focus_manager_->AddFocusChangeListener(this); | 316 focus_manager_->AddFocusChangeListener(this); |
316 } | 317 } |
317 | 318 |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 notification_area->SetLayoutManager( | 595 notification_area->SetLayoutManager( |
595 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0)); | 596 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0)); |
596 notification_area->set_background( | 597 notification_area->set_background( |
597 views::Background::CreateSolidBackground(SK_ColorTRANSPARENT)); | 598 views::Background::CreateSolidBackground(SK_ColorTRANSPARENT)); |
598 | 599 |
599 DCHECK(!notification_label_); | 600 DCHECK(!notification_label_); |
600 notification_label_ = new views::Label(); | 601 notification_label_ = new views::Label(); |
601 notification_label_->SetAutoColorReadabilityEnabled(false); | 602 notification_label_->SetAutoColorReadabilityEnabled(false); |
602 notification_label_->SetMultiLine(true); | 603 notification_label_->SetMultiLine(true); |
603 notification_label_->set_collapse_when_hidden(true); | 604 notification_label_->set_collapse_when_hidden(true); |
| 605 notification_label_->set_border( |
| 606 views::Border::CreateEmptyBorder(10, 0, 10, 0)); |
| 607 // TODO(dbeam): talk to msw@ or ainslie@ to make this border match the mocks. |
604 | 608 |
605 notification_area->AddChildView(notification_label_); | 609 notification_area->AddChildView(notification_label_); |
606 | 610 |
607 return notification_area; | 611 return notification_area; |
608 } | 612 } |
609 | 613 |
| 614 void AutofillDialogViews::UpdateAccountChooser() { |
| 615 DialogSignedInState state = controller_->SignedInState(); |
| 616 sign_in_link_->SetEnabled(state != REQUIRES_RESPONSE); |
| 617 sign_in_link_->SetVisible(state != SIGNED_IN); |
| 618 } |
| 619 |
610 void AutofillDialogViews::UpdateNotificationArea() { | 620 void AutofillDialogViews::UpdateNotificationArea() { |
611 DCHECK(notification_label_); | 621 DCHECK(notification_label_); |
612 | 622 |
613 const DialogNotification& notification = controller_->CurrentNotification(); | 623 const DialogNotification& notification = controller_->CurrentNotification(); |
614 const string16& display_text = notification.display_text(); | 624 const string16& display_text = notification.display_text(); |
615 | 625 |
616 notification_label_->parent()->SetVisible(!display_text.empty()); | 626 notification_label_->parent()->SetVisible(!display_text.empty()); |
617 notification_label_->SetVisible(!display_text.empty()); | 627 notification_label_->SetVisible(!display_text.empty()); |
618 | 628 |
619 notification_label_->SetText(display_text); | 629 notification_label_->SetText(display_text); |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section) | 897 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section) |
888 : section(section), | 898 : section(section), |
889 container(NULL), | 899 container(NULL), |
890 manual_input(NULL), | 900 manual_input(NULL), |
891 suggested_info(NULL), | 901 suggested_info(NULL), |
892 suggested_button(NULL) {} | 902 suggested_button(NULL) {} |
893 | 903 |
894 AutofillDialogViews::DetailsGroup::~DetailsGroup() {} | 904 AutofillDialogViews::DetailsGroup::~DetailsGroup() {} |
895 | 905 |
896 } // namespace autofill | 906 } // namespace autofill |
OLD | NEW |