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

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

Issue 1931043002: Remove requestAutocomplete (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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"
10 #include "chrome/browser/ui/chrome_style.h" 9 #include "chrome/browser/ui/chrome_style.h"
11 #import "chrome/browser/ui/cocoa/autofill/autofill_pop_up_button.h" 10 #import "chrome/browser/ui/cocoa/autofill/autofill_pop_up_button.h"
12 #import "chrome/browser/ui/cocoa/autofill/autofill_textfield.h" 11 #import "chrome/browser/ui/cocoa/autofill/autofill_textfield.h"
13 #import "chrome/browser/ui/cocoa/autofill/autofill_tooltip_controller.h" 12 #import "chrome/browser/ui/cocoa/autofill/autofill_tooltip_controller.h"
14 #include "chrome/browser/ui/cocoa/autofill/card_unmask_prompt_view_bridge.h" 13 #include "chrome/browser/ui/cocoa/autofill/card_unmask_prompt_view_bridge.h"
15 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_button.h" 14 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_button.h"
16 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_control_u tils.h" 15 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_control_u tils.h"
17 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh eet.h" 16 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh eet.h"
18 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_wi ndow.h" 17 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_wi ndow.h"
19 #import "chrome/browser/ui/cocoa/key_equivalent_constants.h" 18 #import "chrome/browser/ui/cocoa/key_equivalent_constants.h"
20 #import "chrome/browser/ui/cocoa/l10n_util.h" 19 #import "chrome/browser/ui/cocoa/l10n_util.h"
21 #import "chrome/browser/ui/cocoa/spinner_view.h" 20 #import "chrome/browser/ui/cocoa/spinner_view.h"
22 #include "chrome/browser/ui/cocoa/themed_window.h" 21 #include "chrome/browser/ui/cocoa/themed_window.h"
23 #include "components/autofill/core/browser/ui/card_unmask_prompt_controller.h" 22 #include "components/autofill/core/browser/ui/card_unmask_prompt_controller.h"
24 #include "content/public/browser/web_contents.h" 23 #include "content/public/browser/web_contents.h"
25 #include "grit/components_scaled_resources.h" 24 #include "grit/components_scaled_resources.h"
26 #include "grit/components_strings.h" 25 #include "grit/components_strings.h"
27 #include "grit/generated_resources.h" 26 #include "grit/generated_resources.h"
28 #include "skia/ext/skia_utils_mac.h" 27 #include "skia/ext/skia_utils_mac.h"
29 #import "ui/base/cocoa/controls/hyperlink_button_cell.h" 28 #import "ui/base/cocoa/controls/hyperlink_button_cell.h"
30 #include "ui/base/cocoa/window_size_constants.h" 29 #include "ui/base/cocoa/window_size_constants.h"
31 #include "ui/base/l10n/l10n_util.h" 30 #include "ui/base/l10n/l10n_util.h"
31 #include "ui/gfx/color_palette.h"
32 #include "ui/native_theme/native_theme_mac.h" 32 #include "ui/native_theme/native_theme_mac.h"
33 33
34 namespace { 34 namespace {
35 35
36 const CGFloat kButtonGap = 6.0f; 36 const CGFloat kButtonGap = 6.0f;
37 const CGFloat kButtonsToRetriableErrorGap = 12.0f; 37 const CGFloat kButtonsToRetriableErrorGap = 12.0f;
38 const CGFloat kCvcInputWidth = 64.0f; 38 const CGFloat kCvcInputWidth = 64.0f;
39 const CGFloat kCvcInputToImageGap = 8.0f; 39 const CGFloat kCvcInputToImageGap = 8.0f;
40 const CGFloat kDialogContentMinWidth = 210.0f; 40 const CGFloat kDialogContentMinWidth = 210.0f;
41 const CGFloat kInputRowToInstructionsGap = 16.0f; 41 const CGFloat kInputRowToInstructionsGap = 16.0f;
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 [inputRowView_ addSubview:newCardButton_]; 297 [inputRowView_ addSubview:newCardButton_];
298 } 298 }
299 299
300 [self performLayoutAndDisplay:YES]; 300 [self performLayoutAndDisplay:YES];
301 } 301 }
302 302
303 - (void)setPermanentErrorMessage:(const base::string16&)text { 303 - (void)setPermanentErrorMessage:(const base::string16&)text {
304 if (!text.empty()) { 304 if (!text.empty()) {
305 if (!permanentErrorBox_) { 305 if (!permanentErrorBox_) {
306 permanentErrorBox_ = [CardUnmaskPromptViewCocoa createPlainBox]; 306 permanentErrorBox_ = [CardUnmaskPromptViewCocoa createPlainBox];
307 [permanentErrorBox_ setFillColor:skia::SkColorToCalibratedNSColor( 307 [permanentErrorBox_
308 autofill::kWarningColor)]; 308 setFillColor:skia::SkColorToCalibratedNSColor(gfx::kGoogleRed700)];
309 [permanentErrorBox_ 309 [permanentErrorBox_
310 setContentViewMargins:NSMakeSize(kPermanentErrorHorizontalPadding, 310 setContentViewMargins:NSMakeSize(kPermanentErrorHorizontalPadding,
311 kPermanentErrorVerticalPadding)]; 311 kPermanentErrorVerticalPadding)];
312 312
313 permanentErrorLabel_.reset([constrained_window::CreateLabel() retain]); 313 permanentErrorLabel_.reset([constrained_window::CreateLabel() retain]);
314 [permanentErrorLabel_ setAutoresizingMask:NSViewWidthSizable]; 314 [permanentErrorLabel_ setAutoresizingMask:NSViewWidthSizable];
315 [permanentErrorLabel_ setTextColor:skia::SkColorToCalibratedNSColor( 315 [permanentErrorLabel_ setTextColor:skia::SkColorToCalibratedNSColor(
316 kPermanentErrorTextColor)]; 316 kPermanentErrorTextColor)];
317 317
318 [permanentErrorBox_ addSubview:permanentErrorLabel_]; 318 [permanentErrorBox_ addSubview:permanentErrorLabel_];
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 NSImage* cvcImage = 705 NSImage* cvcImage =
706 rb.GetNativeImageNamed(controller->GetCvcImageRid()).ToNSImage(); 706 rb.GetNativeImageNamed(controller->GetCvcImageRid()).ToNSImage();
707 cvcImageView_.reset([[NSImageView alloc] initWithFrame:NSZeroRect]); 707 cvcImageView_.reset([[NSImageView alloc] initWithFrame:NSZeroRect]);
708 [cvcImageView_ setImage:cvcImage]; 708 [cvcImageView_ setImage:cvcImage];
709 [cvcImageView_ setFrameSize:[cvcImage size]]; 709 [cvcImageView_ setFrameSize:[cvcImage size]];
710 [inputRowView_ addSubview:cvcImageView_]; 710 [inputRowView_ addSubview:cvcImageView_];
711 711
712 // Add error message label. 712 // Add error message label.
713 errorLabel_.reset([constrained_window::CreateLabel() retain]); 713 errorLabel_.reset([constrained_window::CreateLabel() retain]);
714 [errorLabel_ 714 [errorLabel_
715 setTextColor:skia::SkColorToCalibratedNSColor(autofill::kWarningColor)]; 715 setTextColor:skia::SkColorToCalibratedNSColor(gfx::kGoogleRed700)];
716 [mainView addSubview:errorLabel_]; 716 [mainView addSubview:errorLabel_];
717 717
718 // Add cancel button. 718 // Add cancel button.
719 cancelButton_.reset( 719 cancelButton_.reset(
720 [[ConstrainedWindowButton alloc] initWithFrame:NSZeroRect]); 720 [[ConstrainedWindowButton alloc] initWithFrame:NSZeroRect]);
721 [cancelButton_ setTitle:l10n_util::GetNSStringWithFixup(IDS_CANCEL)]; 721 [cancelButton_ setTitle:l10n_util::GetNSStringWithFixup(IDS_CANCEL)];
722 [cancelButton_ setKeyEquivalent:kKeyEquivalentEscape]; 722 [cancelButton_ setKeyEquivalent:kKeyEquivalentEscape];
723 [cancelButton_ setTarget:self]; 723 [cancelButton_ setTarget:self];
724 [cancelButton_ setAction:@selector(onCancel:)]; 724 [cancelButton_ setAction:@selector(onCancel:)];
725 [cancelButton_ sizeToFit]; 725 [cancelButton_ sizeToFit];
726 [mainView addSubview:cancelButton_]; 726 [mainView addSubview:cancelButton_];
727 727
728 // Add verify button. 728 // Add verify button.
729 verifyButton_.reset( 729 verifyButton_.reset(
730 [[ConstrainedWindowButton alloc] initWithFrame:NSZeroRect]); 730 [[ConstrainedWindowButton alloc] initWithFrame:NSZeroRect]);
731 [verifyButton_ setTitle:l10n_util::FixUpWindowsStyleLabel( 731 [verifyButton_ setTitle:l10n_util::FixUpWindowsStyleLabel(
732 controller->GetOkButtonLabel())]; 732 controller->GetOkButtonLabel())];
733 [verifyButton_ setKeyEquivalent:kKeyEquivalentReturn]; 733 [verifyButton_ setKeyEquivalent:kKeyEquivalentReturn];
734 [verifyButton_ setTarget:self]; 734 [verifyButton_ setTarget:self];
735 [verifyButton_ setAction:@selector(onVerify:)]; 735 [verifyButton_ setAction:@selector(onVerify:)];
736 [verifyButton_ sizeToFit]; 736 [verifyButton_ sizeToFit];
737 [self updateVerifyButtonEnabled]; 737 [self updateVerifyButtonEnabled];
738 [mainView addSubview:verifyButton_]; 738 [mainView addSubview:verifyButton_];
739 739
740 [self setView:mainView]; 740 [self setView:mainView];
741 [self performLayoutAndDisplay:NO]; 741 [self performLayoutAndDisplay:NO];
742 } 742 }
743 743
744 @end 744 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698