OLD | NEW |
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 "chrome/browser/ui/cocoa/autofill/card_unmask_prompt_view_bridge.h" | 5 #include "chrome/browser/ui/cocoa/autofill/card_unmask_prompt_view_bridge.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
10 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" | 10 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "components/grit/components_scaled_resources.h" | 26 #include "components/grit/components_scaled_resources.h" |
27 #include "components/strings/grit/components_strings.h" | 27 #include "components/strings/grit/components_strings.h" |
28 #include "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
29 #include "skia/ext/skia_utils_mac.h" | 29 #include "skia/ext/skia_utils_mac.h" |
30 #import "ui/base/cocoa/controls/hyperlink_button_cell.h" | 30 #import "ui/base/cocoa/controls/hyperlink_button_cell.h" |
31 #include "ui/base/cocoa/window_size_constants.h" | 31 #include "ui/base/cocoa/window_size_constants.h" |
32 #include "ui/base/l10n/l10n_util.h" | 32 #include "ui/base/l10n/l10n_util.h" |
33 #include "ui/gfx/color_palette.h" | 33 #include "ui/gfx/color_palette.h" |
34 #include "ui/gfx/image/image_skia_util_mac.h" | 34 #include "ui/gfx/image/image_skia_util_mac.h" |
35 #include "ui/gfx/paint_vector_icon.h" | 35 #include "ui/gfx/paint_vector_icon.h" |
36 #include "ui/gfx/vector_icons_public.h" | |
37 #include "ui/native_theme/native_theme.h" | 36 #include "ui/native_theme/native_theme.h" |
| 37 #include "ui/vector_icons/vector_icons.h" |
38 | 38 |
39 namespace { | 39 namespace { |
40 | 40 |
41 const CGFloat kButtonGap = 6.0f; | 41 const CGFloat kButtonGap = 6.0f; |
42 const CGFloat kButtonsToRetriableErrorGap = 12.0f; | 42 const CGFloat kButtonsToRetriableErrorGap = 12.0f; |
43 const CGFloat kCvcInputWidth = 64.0f; | 43 const CGFloat kCvcInputWidth = 64.0f; |
44 const CGFloat kCvcInputToImageGap = 8.0f; | 44 const CGFloat kCvcInputToImageGap = 8.0f; |
45 const CGFloat kDialogContentMinWidth = 210.0f; | 45 const CGFloat kDialogContentMinWidth = 210.0f; |
46 const CGFloat kInputRowToInstructionsGap = 16.0f; | 46 const CGFloat kInputRowToInstructionsGap = 16.0f; |
47 const CGFloat kInstructionsToTitleGap = 8.0f; | 47 const CGFloat kInstructionsToTitleGap = 8.0f; |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 setState:(controller->GetStoreLocallyStartState() ? NSOnState | 495 setState:(controller->GetStoreLocallyStartState() ? NSOnState |
496 : NSOffState)]; | 496 : NSOffState)]; |
497 [storageCheckbox_ sizeToFit]; | 497 [storageCheckbox_ sizeToFit]; |
498 [box addSubview:storageCheckbox_]; | 498 [box addSubview:storageCheckbox_]; |
499 | 499 |
500 // Add "i" icon with tooltip. | 500 // Add "i" icon with tooltip. |
501 storageTooltip_.reset([[AutofillTooltipController alloc] | 501 storageTooltip_.reset([[AutofillTooltipController alloc] |
502 initWithArrowLocation:info_bubble::kTopTrailing]); | 502 initWithArrowLocation:info_bubble::kTopTrailing]); |
503 [storageTooltip_ setMaxTooltipWidth:2 * autofill::kFieldWidth + | 503 [storageTooltip_ setMaxTooltipWidth:2 * autofill::kFieldWidth + |
504 autofill::kHorizontalFieldPadding]; | 504 autofill::kHorizontalFieldPadding]; |
505 [storageTooltip_ | 505 [storageTooltip_ setImage:gfx::NSImageFromImageSkia(gfx::CreateVectorIcon( |
506 setImage:gfx::NSImageFromImageSkia(gfx::CreateVectorIcon( | 506 ui::kInfoOutlineIcon, autofill::kInfoIconSize, |
507 gfx::VectorIconId::INFO_OUTLINE, autofill::kInfoIconSize, | 507 gfx::kChromeIconGrey))]; |
508 gfx::kChromeIconGrey))]; | |
509 [storageTooltip_ | 508 [storageTooltip_ |
510 setMessage:base::SysUTF16ToNSString(l10n_util::GetStringUTF16( | 509 setMessage:base::SysUTF16ToNSString(l10n_util::GetStringUTF16( |
511 IDS_AUTOFILL_CARD_UNMASK_PROMPT_STORAGE_TOOLTIP))]; | 510 IDS_AUTOFILL_CARD_UNMASK_PROMPT_STORAGE_TOOLTIP))]; |
512 [box addSubview:[storageTooltip_ view]]; | 511 [box addSubview:[storageTooltip_ view]]; |
513 [[storageTooltip_ view] setFrameOrigin: | 512 [[storageTooltip_ view] setFrameOrigin: |
514 NSMakePoint(NSMaxX([storageCheckbox_ frame]) + kButtonGap, 0)]; | 513 NSMakePoint(NSMaxX([storageCheckbox_ frame]) + kButtonGap, 0)]; |
515 | 514 |
516 // Add horizontal separator. | 515 // Add horizontal separator. |
517 base::scoped_nsobject<NSBox> separator( | 516 base::scoped_nsobject<NSBox> separator( |
518 [CardUnmaskPromptViewCocoa createPlainBox]); | 517 [CardUnmaskPromptViewCocoa createPlainBox]); |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 [verifyButton_ setAction:@selector(onVerify:)]; | 736 [verifyButton_ setAction:@selector(onVerify:)]; |
738 [verifyButton_ sizeToFit]; | 737 [verifyButton_ sizeToFit]; |
739 [self updateVerifyButtonEnabled]; | 738 [self updateVerifyButtonEnabled]; |
740 [mainView addSubview:verifyButton_]; | 739 [mainView addSubview:verifyButton_]; |
741 | 740 |
742 [self setView:mainView]; | 741 [self setView:mainView]; |
743 [self performLayoutAndDisplay:NO]; | 742 [self performLayoutAndDisplay:NO]; |
744 } | 743 } |
745 | 744 |
746 @end | 745 @end |
OLD | NEW |