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

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

Issue 1141983002: Autofill - Also update instructions message when "New link?" is clicked. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « chrome/browser/ui/views/autofill/card_unmask_prompt_views.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/card_unmask_prompt_views.h" 5 #include "chrome/browser/ui/views/autofill/card_unmask_prompt_views.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" 9 #include "chrome/browser/ui/autofill/autofill_dialog_types.h"
10 #include "chrome/browser/ui/autofill/card_unmask_prompt_controller.h" 10 #include "chrome/browser/ui/autofill/card_unmask_prompt_controller.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 CardUnmaskPromptController* controller) { 46 CardUnmaskPromptController* controller) {
47 CardUnmaskPromptViews* view = new CardUnmaskPromptViews(controller); 47 CardUnmaskPromptViews* view = new CardUnmaskPromptViews(controller);
48 view->Show(); 48 view->Show();
49 return view; 49 return view;
50 } 50 }
51 51
52 CardUnmaskPromptViews::CardUnmaskPromptViews( 52 CardUnmaskPromptViews::CardUnmaskPromptViews(
53 CardUnmaskPromptController* controller) 53 CardUnmaskPromptController* controller)
54 : controller_(controller), 54 : controller_(controller),
55 main_contents_(nullptr), 55 main_contents_(nullptr),
56 instructions_(nullptr),
56 permanent_error_label_(nullptr), 57 permanent_error_label_(nullptr),
57 input_row_(nullptr), 58 input_row_(nullptr),
58 cvc_input_(nullptr), 59 cvc_input_(nullptr),
59 month_input_(nullptr), 60 month_input_(nullptr),
60 year_input_(nullptr), 61 year_input_(nullptr),
61 new_card_link_(nullptr), 62 new_card_link_(nullptr),
62 error_icon_(nullptr), 63 error_icon_(nullptr),
63 error_label_(nullptr), 64 error_label_(nullptr),
64 storage_row_(nullptr), 65 storage_row_(nullptr),
65 storage_checkbox_(nullptr), 66 storage_checkbox_(nullptr),
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 controller_->NewCardLinkClicked(); 147 controller_->NewCardLinkClicked();
147 for (int i = 0; i < input_row_->child_count(); ++i) 148 for (int i = 0; i < input_row_->child_count(); ++i)
148 input_row_->child_at(i)->SetVisible(true); 149 input_row_->child_at(i)->SetVisible(true);
149 150
150 new_card_link_->SetVisible(false); 151 new_card_link_->SetVisible(false);
151 input_row_->InvalidateLayout(); 152 input_row_->InvalidateLayout();
152 cvc_input_->SetInvalid(false); 153 cvc_input_->SetInvalid(false);
153 cvc_input_->SetText(base::string16()); 154 cvc_input_->SetText(base::string16());
154 GetDialogClientView()->UpdateDialogButtons(); 155 GetDialogClientView()->UpdateDialogButtons();
155 GetWidget()->UpdateWindowTitle(); 156 GetWidget()->UpdateWindowTitle();
157 instructions_->SetText(controller_->GetInstructionsMessage());
156 SetRetriableErrorMessage(base::string16()); 158 SetRetriableErrorMessage(base::string16());
157 } 159 }
158 160
159 void CardUnmaskPromptViews::SetRetriableErrorMessage( 161 void CardUnmaskPromptViews::SetRetriableErrorMessage(
160 const base::string16& message) { 162 const base::string16& message) {
161 if (message.empty()) { 163 if (message.empty()) {
162 error_label_->SetMultiLine(false); 164 error_label_->SetMultiLine(false);
163 error_label_->SetText(base::ASCIIToUTF16(" ")); 165 error_label_->SetText(base::ASCIIToUTF16(" "));
164 error_icon_->SetVisible(false); 166 error_icon_->SetVisible(false);
165 } else { 167 } else {
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 permanent_error_label_->SetVisible(false); 393 permanent_error_label_->SetVisible(false);
392 permanent_error_label_->SetMultiLine(true); 394 permanent_error_label_->SetMultiLine(true);
393 permanent_error_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 395 permanent_error_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
394 main_contents_->AddChildView(permanent_error_label_); 396 main_contents_->AddChildView(permanent_error_label_);
395 397
396 views::View* controls_container = new views::View(); 398 views::View* controls_container = new views::View();
397 controls_container->SetLayoutManager( 399 controls_container->SetLayoutManager(
398 new views::BoxLayout(views::BoxLayout::kVertical, kEdgePadding, 0, 0)); 400 new views::BoxLayout(views::BoxLayout::kVertical, kEdgePadding, 0, 0));
399 main_contents_->AddChildView(controls_container); 401 main_contents_->AddChildView(controls_container);
400 402
401 views::Label* instructions = 403 instructions_ = new views::Label(controller_->GetInstructionsMessage());
402 new views::Label(controller_->GetInstructionsMessage()); 404 instructions_->SetEnabledColor(kGreyTextColor);
403 instructions->SetEnabledColor(kGreyTextColor); 405 instructions_->SetMultiLine(true);
404 instructions->SetMultiLine(true); 406 instructions_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
405 instructions->SetHorizontalAlignment(gfx::ALIGN_LEFT); 407 instructions_->SetBorder(views::Border::CreateEmptyBorder(0, 0, 16, 0));
406 instructions->SetBorder(views::Border::CreateEmptyBorder(0, 0, 16, 0)); 408 controls_container->AddChildView(instructions_);
407 controls_container->AddChildView(instructions);
408 409
409 input_row_ = new views::View(); 410 input_row_ = new views::View();
410 input_row_->SetLayoutManager( 411 input_row_->SetLayoutManager(
411 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 5)); 412 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 5));
412 controls_container->AddChildView(input_row_); 413 controls_container->AddChildView(input_row_);
413 414
414 month_input_ = new views::Combobox(&month_combobox_model_); 415 month_input_ = new views::Combobox(&month_combobox_model_);
415 month_input_->set_listener(this); 416 month_input_->set_listener(this);
416 input_row_->AddChildView(month_input_); 417 input_row_->AddChildView(month_input_);
417 views::Label* separator = new views::Label(l10n_util::GetStringUTF16( 418 views::Label* separator = new views::Label(l10n_util::GetStringUTF16(
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 views::View::OnPaint(canvas); 516 views::View::OnPaint(canvas);
516 canvas->Restore(); 517 canvas->Restore();
517 } 518 }
518 519
519 void CardUnmaskPromptViews::FadeOutView::SetAlpha(uint8_t alpha) { 520 void CardUnmaskPromptViews::FadeOutView::SetAlpha(uint8_t alpha) {
520 alpha_ = alpha; 521 alpha_ = alpha;
521 SchedulePaint(); 522 SchedulePaint();
522 } 523 }
523 524
524 } // namespace autofill 525 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/autofill/card_unmask_prompt_views.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698