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

Side by Side Diff: chrome/browser/ui/cocoa/autofill/card_unmask_prompt_view_bridge.mm

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 (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "base/strings/sys_string_conversions.h" 7 #include "base/strings/sys_string_conversions.h"
8 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" 8 #include "chrome/browser/ui/autofill/autofill_dialog_models.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"
11 #include "chrome/browser/ui/chrome_style.h" 10 #include "chrome/browser/ui/chrome_style.h"
12 #import "chrome/browser/ui/cocoa/autofill/autofill_pop_up_button.h" 11 #import "chrome/browser/ui/cocoa/autofill/autofill_pop_up_button.h"
13 #import "chrome/browser/ui/cocoa/autofill/autofill_textfield.h" 12 #import "chrome/browser/ui/cocoa/autofill/autofill_textfield.h"
14 #import "chrome/browser/ui/cocoa/autofill/autofill_tooltip_controller.h" 13 #import "chrome/browser/ui/cocoa/autofill/autofill_tooltip_controller.h"
15 #include "chrome/browser/ui/cocoa/autofill/card_unmask_prompt_view_bridge.h" 14 #include "chrome/browser/ui/cocoa/autofill/card_unmask_prompt_view_bridge.h"
16 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_button.h" 15 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_button.h"
17 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_control_u tils.h" 16 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_control_u tils.h"
18 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh eet.h" 17 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh eet.h"
19 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_wi ndow.h" 18 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_wi ndow.h"
20 #import "chrome/browser/ui/cocoa/key_equivalent_constants.h" 19 #import "chrome/browser/ui/cocoa/key_equivalent_constants.h"
21 #import "chrome/browser/ui/cocoa/l10n_util.h" 20 #import "chrome/browser/ui/cocoa/l10n_util.h"
22 #import "chrome/browser/ui/cocoa/spinner_view.h" 21 #import "chrome/browser/ui/cocoa/spinner_view.h"
22 #include "components/autofill/core/browser/ui/card_unmask_prompt_controller.h"
23 #include "grit/generated_resources.h" 23 #include "grit/generated_resources.h"
24 #include "grit/theme_resources.h" 24 #include "grit/theme_resources.h"
25 #include "skia/ext/skia_utils_mac.h" 25 #include "skia/ext/skia_utils_mac.h"
26 #include "ui/base/cocoa/window_size_constants.h" 26 #include "ui/base/cocoa/window_size_constants.h"
27 #include "ui/base/l10n/l10n_util.h" 27 #include "ui/base/l10n/l10n_util.h"
28 28
29 namespace { 29 namespace {
30 30
31 const CGFloat kButtonGap = 6.0f; 31 const CGFloat kButtonGap = 6.0f;
32 const CGFloat kButtonsToRetriableErrorGap = 12.0f; 32 const CGFloat kButtonsToRetriableErrorGap = 12.0f;
(...skipping 16 matching lines...) Expand all
49 // Material blue. TODO(bondd): share with Views version. 49 // Material blue. TODO(bondd): share with Views version.
50 const SkColor kProgressTextColor = SkColorSetRGB(0x42, 0x85, 0xf4); 50 const SkColor kProgressTextColor = SkColorSetRGB(0x42, 0x85, 0xf4);
51 // TODO(bondd): Unify colors with Views version and AutofillMessageView. 51 // TODO(bondd): Unify colors with Views version and AutofillMessageView.
52 const SkColor kShadingColor = SkColorSetRGB(0xf2, 0xf2, 0xf2); 52 const SkColor kShadingColor = SkColorSetRGB(0xf2, 0xf2, 0xf2);
53 const SkColor kSubtleBorderColor = SkColorSetRGB(0xdf, 0xdf, 0xdf); 53 const SkColor kSubtleBorderColor = SkColorSetRGB(0xdf, 0xdf, 0xdf);
54 54
55 } // namespace 55 } // namespace
56 56
57 namespace autofill { 57 namespace autofill {
58 58
59 // static 59 CardUnmaskPromptView* CreateCardUnmaskPromptView(
60 CardUnmaskPromptView* CardUnmaskPromptView::CreateAndShow( 60 CardUnmaskPromptController* controller,
61 CardUnmaskPromptController* controller) { 61 content::WebContents* web_contents) {
62 return new CardUnmaskPromptViewBridge(controller); 62 return new CardUnmaskPromptViewBridge(controller, web_contents);
63 } 63 }
64 64
65 #pragma mark CardUnmaskPromptViewBridge 65 #pragma mark CardUnmaskPromptViewBridge
66 66
67 CardUnmaskPromptViewBridge::CardUnmaskPromptViewBridge( 67 CardUnmaskPromptViewBridge::CardUnmaskPromptViewBridge(
68 CardUnmaskPromptController* controller) 68 CardUnmaskPromptController* controller,
69 : controller_(controller), weak_ptr_factory_(this) { 69 content::WebContents* web_contents)
70 : controller_(controller),
71 web_contents_(web_contents),
72 weak_ptr_factory_(this) {
70 view_controller_.reset( 73 view_controller_.reset(
71 [[CardUnmaskPromptViewCocoa alloc] initWithBridge:this]); 74 [[CardUnmaskPromptViewCocoa alloc] initWithBridge:this]);
75 }
72 76
77 CardUnmaskPromptViewBridge::~CardUnmaskPromptViewBridge() {
78 }
79
80 void CardUnmaskPromptViewBridge::Show() {
73 // Setup the constrained window that will show the view. 81 // Setup the constrained window that will show the view.
74 base::scoped_nsobject<NSWindow> window([[ConstrainedWindowCustomWindow alloc] 82 base::scoped_nsobject<NSWindow> window([[ConstrainedWindowCustomWindow alloc]
75 initWithContentRect:[[view_controller_ view] bounds]]); 83 initWithContentRect:[[view_controller_ view] bounds]]);
76 [window setContentView:[view_controller_ view]]; 84 [window setContentView:[view_controller_ view]];
77 base::scoped_nsobject<CustomConstrainedWindowSheet> sheet( 85 base::scoped_nsobject<CustomConstrainedWindowSheet> sheet(
78 [[CustomConstrainedWindowSheet alloc] initWithCustomWindow:window]); 86 [[CustomConstrainedWindowSheet alloc] initWithCustomWindow:window]);
79 constrained_window_.reset( 87 constrained_window_.reset(
80 new ConstrainedWindowMac(this, controller_->GetWebContents(), sheet)); 88 new ConstrainedWindowMac(this, web_contents_, sheet));
81 }
82
83 CardUnmaskPromptViewBridge::~CardUnmaskPromptViewBridge() {
84 } 89 }
85 90
86 void CardUnmaskPromptViewBridge::ControllerGone() { 91 void CardUnmaskPromptViewBridge::ControllerGone() {
87 controller_ = nullptr; 92 controller_ = nullptr;
88 PerformClose(); 93 PerformClose();
89 } 94 }
90 95
91 void CardUnmaskPromptViewBridge::DisableAndWaitForVerification() { 96 void CardUnmaskPromptViewBridge::DisableAndWaitForVerification() {
92 [view_controller_ setProgressOverlayText: 97 [view_controller_ setProgressOverlayText:
93 l10n_util::GetStringUTF16( 98 l10n_util::GetStringUTF16(
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 674
670 // Layout inputRowView_. 675 // Layout inputRowView_.
671 [CardUnmaskPromptViewCocoa sizeToFitView:inputRowView_]; 676 [CardUnmaskPromptViewCocoa sizeToFitView:inputRowView_];
672 [CardUnmaskPromptViewCocoa verticallyCenterSubviewsInView:inputRowView_]; 677 [CardUnmaskPromptViewCocoa verticallyCenterSubviewsInView:inputRowView_];
673 678
674 [self setView:mainView]; 679 [self setView:mainView];
675 [self performLayoutAndDisplay:NO]; 680 [self performLayoutAndDisplay:NO];
676 } 681 }
677 682
678 @end 683 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698