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

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: +snark 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 views::View* focused_before, 472 views::View* focused_before,
472 views::View* focused_now) { 473 views::View* focused_now) {
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) {
482 DCHECK(source); // TODO(dbeam): needed?
Ilya Sherman 2013/01/31 02:33:07 nit: Don't think this is needed, no.
Dan Beam 2013/01/31 02:48:51 Done.
483
481 // Sign in link. 484 // Sign in link.
482 if (source == sign_in_link_) { 485 if (source == sign_in_link_) {
486 DCHECK(signed_in_link_->enabled()); // TODO(dbeam): necessary?
483 controller_->StartSignInFlow(); 487 controller_->StartSignInFlow();
484 return; 488 return;
485 } 489 }
486 490
487 // Edit links. 491 // Edit links.
488 for (DetailGroupMap::iterator iter = detail_groups_.begin(); 492 for (DetailGroupMap::iterator iter = detail_groups_.begin();
489 iter != detail_groups_.end(); ++iter) { 493 iter != detail_groups_.end(); ++iter) {
490 if (iter->second.suggested_info->Contains(source)) { 494 if (iter->second.suggested_info->Contains(source)) {
491 controller_->EditClickedForSection(iter->first); 495 controller_->EditClickedForSection(iter->first);
492 return; 496 return;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 notification_area->SetLayoutManager( 565 notification_area->SetLayoutManager(
562 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0)); 566 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0));
563 notification_area->set_background( 567 notification_area->set_background(
564 views::Background::CreateSolidBackground(SK_ColorTRANSPARENT)); 568 views::Background::CreateSolidBackground(SK_ColorTRANSPARENT));
565 569
566 DCHECK(!notification_label_); 570 DCHECK(!notification_label_);
567 notification_label_ = new views::Label(); 571 notification_label_ = new views::Label();
568 notification_label_->SetAutoColorReadabilityEnabled(false); 572 notification_label_->SetAutoColorReadabilityEnabled(false);
569 notification_label_->SetMultiLine(true); 573 notification_label_->SetMultiLine(true);
570 notification_label_->set_collapse_when_hidden(true); 574 notification_label_->set_collapse_when_hidden(true);
575 notification_label_->set_border(
576 views::Border::CreateEmptyBorder(10, 0, 10, 0));
571 577
572 notification_area->AddChildView(notification_label_); 578 notification_area->AddChildView(notification_label_);
573 579
574 return notification_area; 580 return notification_area;
575 } 581 }
576 582
583 void AutofillDialogViews::UpdateAccountChooser() {
584 sign_in_link_->SetEnabled(controller_->HasReceivedWalletResponse());
585 sign_in_link_->SetVisible(!controller_->HasReceivedWalletResponse() ||
586 !controller_->IsSignedIn());
587 }
588
577 void AutofillDialogViews::UpdateNotificationArea() { 589 void AutofillDialogViews::UpdateNotificationArea() {
578 DCHECK(notification_label_); 590 DCHECK(notification_label_);
579 591
580 const DialogNotification& notification = controller_->CurrentNotification(); 592 const DialogNotification& notification = controller_->CurrentNotification();
581 const string16& display_text = notification.display_text(); 593 const string16& display_text = notification.display_text();
582 594
583 notification_label_->parent()->SetVisible(!display_text.empty()); 595 notification_label_->parent()->SetVisible(!display_text.empty());
584 notification_label_->SetVisible(!display_text.empty()); 596 notification_label_->SetVisible(!display_text.empty());
585 597
586 notification_label_->SetText(display_text); 598 notification_label_->SetText(display_text);
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section) 866 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section)
855 : section(section), 867 : section(section),
856 container(NULL), 868 container(NULL),
857 manual_input(NULL), 869 manual_input(NULL),
858 suggested_info(NULL), 870 suggested_info(NULL),
859 suggested_button(NULL) {} 871 suggested_button(NULL) {}
860 872
861 AutofillDialogViews::DetailsGroup::~DetailsGroup() {} 873 AutofillDialogViews::DetailsGroup::~DetailsGroup() {}
862 874
863 } // namespace autofill 875 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698