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

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

Issue 1138653003: Move card unmask interfaces and controller into the autofill component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix missing override declaration 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
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/create_card_unmask_prompt_view.h"
11 #include "chrome/browser/ui/views/autofill/decorated_textfield.h" 11 #include "chrome/browser/ui/views/autofill/decorated_textfield.h"
12 #include "chrome/browser/ui/views/autofill/tooltip_icon.h" 12 #include "chrome/browser/ui/views/autofill/tooltip_icon.h"
13 #include "chrome/grit/generated_resources.h" 13 #include "chrome/grit/generated_resources.h"
14 #include "components/autofill/core/browser/ui/card_unmask_prompt_controller.h"
14 #include "components/constrained_window/constrained_window_views.h" 15 #include "components/constrained_window/constrained_window_views.h"
15 #include "components/web_modal/web_contents_modal_dialog_host.h" 16 #include "components/web_modal/web_contents_modal_dialog_host.h"
16 #include "components/web_modal/web_contents_modal_dialog_manager.h" 17 #include "components/web_modal/web_contents_modal_dialog_manager.h"
17 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" 18 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h"
18 #include "grit/theme_resources.h" 19 #include "grit/theme_resources.h"
19 #include "third_party/skia/include/core/SkColor.h" 20 #include "third_party/skia/include/core/SkColor.h"
20 #include "ui/base/l10n/l10n_util.h" 21 #include "ui/base/l10n/l10n_util.h"
21 #include "ui/base/resource/resource_bundle.h" 22 #include "ui/base/resource/resource_bundle.h"
22 #include "ui/compositor/compositing_recorder.h" 23 #include "ui/compositor/compositing_recorder.h"
23 #include "ui/gfx/canvas.h" 24 #include "ui/gfx/canvas.h"
(...skipping 10 matching lines...) Expand all
34 #include "ui/views/window/dialog_client_view.h" 35 #include "ui/views/window/dialog_client_view.h"
35 36
36 namespace autofill { 37 namespace autofill {
37 38
38 // The number of pixels of blank space on the outer horizontal edges of the 39 // The number of pixels of blank space on the outer horizontal edges of the
39 // dialog. 40 // dialog.
40 const int kEdgePadding = 19; 41 const int kEdgePadding = 19;
41 42
42 SkColor kGreyTextColor = SkColorSetRGB(0x64, 0x64, 0x64); 43 SkColor kGreyTextColor = SkColorSetRGB(0x64, 0x64, 0x64);
43 44
44 // static 45 CardUnmaskPromptView* CreateCardUnmaskPromptView(
45 CardUnmaskPromptView* CardUnmaskPromptView::CreateAndShow( 46 CardUnmaskPromptController* controller,
46 CardUnmaskPromptController* controller) { 47 content::WebContents* web_contents) {
47 CardUnmaskPromptViews* view = new CardUnmaskPromptViews(controller); 48 return new CardUnmaskPromptViews(controller, web_contents);
48 view->Show();
49 return view;
50 } 49 }
51 50
52 CardUnmaskPromptViews::CardUnmaskPromptViews( 51 CardUnmaskPromptViews::CardUnmaskPromptViews(
53 CardUnmaskPromptController* controller) 52 CardUnmaskPromptController* controller,
53 content::WebContents* web_contents)
54 : controller_(controller), 54 : controller_(controller),
55 web_contents_(web_contents),
55 main_contents_(nullptr), 56 main_contents_(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),
66 progress_overlay_(nullptr), 67 progress_overlay_(nullptr),
67 progress_throbber_(nullptr), 68 progress_throbber_(nullptr),
68 progress_label_(nullptr), 69 progress_label_(nullptr),
69 overlay_animation_(this), 70 overlay_animation_(this),
70 weak_ptr_factory_(this) { 71 weak_ptr_factory_(this) {
71 } 72 }
72 73
73 CardUnmaskPromptViews::~CardUnmaskPromptViews() { 74 CardUnmaskPromptViews::~CardUnmaskPromptViews() {
74 if (controller_) 75 if (controller_)
75 controller_->OnUnmaskDialogClosed(); 76 controller_->OnUnmaskDialogClosed();
76 } 77 }
77 78
78 void CardUnmaskPromptViews::Show() { 79 void CardUnmaskPromptViews::Show() {
79 constrained_window::ShowWebModalDialogViews(this, 80 constrained_window::ShowWebModalDialogViews(this, web_contents_);
80 controller_->GetWebContents());
81 } 81 }
82 82
83 void CardUnmaskPromptViews::ControllerGone() { 83 void CardUnmaskPromptViews::ControllerGone() {
84 controller_ = nullptr; 84 controller_ = nullptr;
85 ClosePrompt(); 85 ClosePrompt();
86 } 86 }
87 87
88 void CardUnmaskPromptViews::DisableAndWaitForVerification() { 88 void CardUnmaskPromptViews::DisableAndWaitForVerification() {
89 SetInputsEnabled(false); 89 SetInputsEnabled(false);
90 progress_overlay_->SetAlpha(0); 90 progress_overlay_->SetAlpha(0);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 error_label_->SetMultiLine(false); 162 error_label_->SetMultiLine(false);
163 error_label_->SetText(base::ASCIIToUTF16(" ")); 163 error_label_->SetText(base::ASCIIToUTF16(" "));
164 error_icon_->SetVisible(false); 164 error_icon_->SetVisible(false);
165 } else { 165 } else {
166 error_label_->SetMultiLine(true); 166 error_label_->SetMultiLine(true);
167 error_label_->SetText(message); 167 error_label_->SetText(message);
168 error_icon_->SetVisible(true); 168 error_icon_->SetVisible(true);
169 } 169 }
170 170
171 // Update the dialog's size. 171 // Update the dialog's size.
172 if (GetWidget() && controller_->GetWebContents()) { 172 if (GetWidget() && web_contents_) {
173 constrained_window::UpdateWebContentsModalDialogPosition( 173 constrained_window::UpdateWebContentsModalDialogPosition(
174 GetWidget(), web_modal::WebContentsModalDialogManager::FromWebContents( 174 GetWidget(),
175 controller_->GetWebContents()) 175 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents_)
176 ->delegate() 176 ->delegate()
177 ->GetWebContentsModalDialogHost()); 177 ->GetWebContentsModalDialogHost());
178 } 178 }
179 179
180 Layout(); 180 Layout();
181 } 181 }
182 182
183 void CardUnmaskPromptViews::SetInputsEnabled(bool enabled) { 183 void CardUnmaskPromptViews::SetInputsEnabled(bool enabled) {
184 cvc_input_->SetEnabled(enabled); 184 cvc_input_->SetEnabled(enabled);
185 if (storage_checkbox_) 185 if (storage_checkbox_)
186 storage_checkbox_->SetEnabled(enabled); 186 storage_checkbox_->SetEnabled(enabled);
187 month_input_->SetEnabled(enabled); 187 month_input_->SetEnabled(enabled);
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 views::View::OnPaint(canvas); 515 views::View::OnPaint(canvas);
516 canvas->Restore(); 516 canvas->Restore();
517 } 517 }
518 518
519 void CardUnmaskPromptViews::FadeOutView::SetAlpha(uint8_t alpha) { 519 void CardUnmaskPromptViews::FadeOutView::SetAlpha(uint8_t alpha) {
520 alpha_ = alpha; 520 alpha_ = alpha;
521 SchedulePaint(); 521 SchedulePaint();
522 } 522 }
523 523
524 } // namespace autofill 524 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/autofill/card_unmask_prompt_views.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698