Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Side by Side Diff: chrome/browser/ui/views/autofill/autofill_dialog_views.cc

Issue 12094069: [autofill] Hook the sign-in button up to required actions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: isherman@ review Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 detail_groups_.insert(std::make_pair(SECTION_SHIPPING, 283 detail_groups_.insert(std::make_pair(SECTION_SHIPPING,
284 DetailsGroup(SECTION_SHIPPING))); 284 DetailsGroup(SECTION_SHIPPING)));
285 } 285 }
286 286
287 AutofillDialogViews::~AutofillDialogViews() { 287 AutofillDialogViews::~AutofillDialogViews() {
288 DCHECK(!window_); 288 DCHECK(!window_);
289 } 289 }
290 290
291 void AutofillDialogViews::Show() { 291 void AutofillDialogViews::Show() {
292 InitChildViews(); 292 InitChildViews();
293 UpdateAccountChooser();
293 UpdateNotificationArea(); 294 UpdateNotificationArea();
294 295
295 // Ownership of |contents_| is handed off by this call. The 296 // Ownership of |contents_| is handed off by this call. The
296 // WebContentsModalDialog will take care of deleting itself after calling 297 // WebContentsModalDialog will take care of deleting itself after calling
297 // DeleteDelegate(). 298 // DeleteDelegate().
298 window_ = new ConstrainedWindowViews(controller_->web_contents(), this); 299 window_ = new ConstrainedWindowViews(controller_->web_contents(), this);
299 focus_manager_ = window_->GetFocusManager(); 300 focus_manager_ = window_->GetFocusManager();
300 focus_manager_->AddFocusChangeListener(this); 301 focus_manager_->AddFocusChangeListener(this);
301 } 302 }
302 303
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 controller_->FocusMoved(); 474 controller_->FocusMoved();
474 } 475 }
475 476
476 void AutofillDialogViews::OnDidChangeFocus( 477 void AutofillDialogViews::OnDidChangeFocus(
477 views::View* focused_before, 478 views::View* focused_before,
478 views::View* focused_now) {} 479 views::View* focused_now) {}
479 480
480 void AutofillDialogViews::LinkClicked(views::Link* source, int event_flags) { 481 void AutofillDialogViews::LinkClicked(views::Link* source, int event_flags) {
481 // Sign in link. 482 // Sign in link.
482 if (source == sign_in_link_) { 483 if (source == sign_in_link_) {
484 DCHECK(sign_in_link_->enabled()); // TODO(dbeam): necessary?
483 controller_->StartSignInFlow(); 485 controller_->StartSignInFlow();
484 return; 486 return;
485 } 487 }
486 488
487 // Edit links. 489 // Edit links.
488 for (DetailGroupMap::iterator iter = detail_groups_.begin(); 490 for (DetailGroupMap::iterator iter = detail_groups_.begin();
489 iter != detail_groups_.end(); ++iter) { 491 iter != detail_groups_.end(); ++iter) {
490 if (iter->second.suggested_info->Contains(source)) { 492 if (iter->second.suggested_info->Contains(source)) {
491 controller_->EditClickedForSection(iter->first); 493 controller_->EditClickedForSection(iter->first);
492 return; 494 return;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 notification_area->SetLayoutManager( 563 notification_area->SetLayoutManager(
562 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0)); 564 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0));
563 notification_area->set_background( 565 notification_area->set_background(
564 views::Background::CreateSolidBackground(SK_ColorTRANSPARENT)); 566 views::Background::CreateSolidBackground(SK_ColorTRANSPARENT));
565 567
566 DCHECK(!notification_label_); 568 DCHECK(!notification_label_);
567 notification_label_ = new views::Label(); 569 notification_label_ = new views::Label();
568 notification_label_->SetAutoColorReadabilityEnabled(false); 570 notification_label_->SetAutoColorReadabilityEnabled(false);
569 notification_label_->SetMultiLine(true); 571 notification_label_->SetMultiLine(true);
570 notification_label_->set_collapse_when_hidden(true); 572 notification_label_->set_collapse_when_hidden(true);
573 notification_label_->set_border(
574 views::Border::CreateEmptyBorder(10, 0, 10, 0));
571 575
572 notification_area->AddChildView(notification_label_); 576 notification_area->AddChildView(notification_label_);
573 577
574 return notification_area; 578 return notification_area;
575 } 579 }
576 580
581 void AutofillDialogViews::UpdateAccountChooser() {
582 sign_in_link_->SetEnabled(controller_->HasReceivedWalletResponse());
583 sign_in_link_->SetVisible(!controller_->HasReceivedWalletResponse() ||
584 !controller_->IsSignedIn());
585 }
586
577 void AutofillDialogViews::UpdateNotificationArea() { 587 void AutofillDialogViews::UpdateNotificationArea() {
578 DCHECK(notification_label_); 588 DCHECK(notification_label_);
579 589
580 const DialogNotification& notification = controller_->CurrentNotification(); 590 const DialogNotification& notification = controller_->CurrentNotification();
581 const string16& display_text = notification.display_text(); 591 const string16& display_text = notification.display_text();
582 592
583 notification_label_->parent()->SetVisible(!display_text.empty()); 593 notification_label_->parent()->SetVisible(!display_text.empty());
584 notification_label_->SetVisible(!display_text.empty()); 594 notification_label_->SetVisible(!display_text.empty());
585 595
586 notification_label_->SetText(display_text); 596 notification_label_->SetText(display_text);
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section) 864 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section)
855 : section(section), 865 : section(section),
856 container(NULL), 866 container(NULL),
857 manual_input(NULL), 867 manual_input(NULL),
858 suggested_info(NULL), 868 suggested_info(NULL),
859 suggested_button(NULL) {} 869 suggested_button(NULL) {}
860 870
861 AutofillDialogViews::DetailsGroup::~DetailsGroup() {} 871 AutofillDialogViews::DetailsGroup::~DetailsGroup() {}
862 872
863 } // namespace autofill 873 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698