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(); | |
309 UpdateNotificationArea(); | 308 UpdateNotificationArea(); |
310 | 309 |
311 // Ownership of |contents_| is handed off by this call. The | 310 // Ownership of |contents_| is handed off by this call. The |
312 // WebContentsModalDialog will take care of deleting itself after calling | 311 // WebContentsModalDialog will take care of deleting itself after calling |
313 // DeleteDelegate(). | 312 // DeleteDelegate(). |
314 window_ = new ConstrainedWindowViews(controller_->web_contents(), this); | 313 window_ = new ConstrainedWindowViews(controller_->web_contents(), this); |
315 focus_manager_ = window_->GetFocusManager(); | 314 focus_manager_ = window_->GetFocusManager(); |
316 focus_manager_->AddFocusChangeListener(this); | 315 focus_manager_->AddFocusChangeListener(this); |
317 } | 316 } |
318 | 317 |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 notification_area->SetLayoutManager( | 594 notification_area->SetLayoutManager( |
596 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0)); | 595 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0)); |
597 notification_area->set_background( | 596 notification_area->set_background( |
598 views::Background::CreateSolidBackground(SK_ColorTRANSPARENT)); | 597 views::Background::CreateSolidBackground(SK_ColorTRANSPARENT)); |
599 | 598 |
600 DCHECK(!notification_label_); | 599 DCHECK(!notification_label_); |
601 notification_label_ = new views::Label(); | 600 notification_label_ = new views::Label(); |
602 notification_label_->SetAutoColorReadabilityEnabled(false); | 601 notification_label_->SetAutoColorReadabilityEnabled(false); |
603 notification_label_->SetMultiLine(true); | 602 notification_label_->SetMultiLine(true); |
604 notification_label_->set_collapse_when_hidden(true); | 603 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. | |
608 | 604 |
609 notification_area->AddChildView(notification_label_); | 605 notification_area->AddChildView(notification_label_); |
610 | 606 |
611 return notification_area; | 607 return notification_area; |
612 } | 608 } |
613 | 609 |
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 | |
620 void AutofillDialogViews::UpdateNotificationArea() { | 610 void AutofillDialogViews::UpdateNotificationArea() { |
621 DCHECK(notification_label_); | 611 DCHECK(notification_label_); |
622 | 612 |
623 const DialogNotification& notification = controller_->CurrentNotification(); | 613 const DialogNotification& notification = controller_->CurrentNotification(); |
624 const string16& display_text = notification.display_text(); | 614 const string16& display_text = notification.display_text(); |
625 | 615 |
626 notification_label_->parent()->SetVisible(!display_text.empty()); | 616 notification_label_->parent()->SetVisible(!display_text.empty()); |
627 notification_label_->SetVisible(!display_text.empty()); | 617 notification_label_->SetVisible(!display_text.empty()); |
628 | 618 |
629 notification_label_->SetText(display_text); | 619 notification_label_->SetText(display_text); |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section) | 887 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section) |
898 : section(section), | 888 : section(section), |
899 container(NULL), | 889 container(NULL), |
900 manual_input(NULL), | 890 manual_input(NULL), |
901 suggested_info(NULL), | 891 suggested_info(NULL), |
902 suggested_button(NULL) {} | 892 suggested_button(NULL) {} |
903 | 893 |
904 AutofillDialogViews::DetailsGroup::~DetailsGroup() {} | 894 AutofillDialogViews::DetailsGroup::~DetailsGroup() {} |
905 | 895 |
906 } // namespace autofill | 896 } // namespace autofill |
OLD | NEW |