| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/new_credit_card_bubble_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/autofill/new_credit_card_bubble_cocoa.h" |
| 6 | 6 |
| 7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #include "base/mac/foundation_util.h" | 8 #include "base/mac/foundation_util.h" |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #include "chrome/browser/ui/autofill/new_credit_card_bubble_controller.h" | 10 #include "chrome/browser/ui/autofill/new_credit_card_bubble_controller.h" |
| 11 #include "chrome/browser/ui/browser_finder.h" | 11 #include "chrome/browser/ui/browser_finder.h" |
| 12 #include "chrome/browser/ui/browser_window.h" | 12 #include "chrome/browser/ui/browser_window.h" |
| 13 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" | 13 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" |
| 14 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 14 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 15 #import "chrome/browser/ui/cocoa/info_bubble_view.h" | 15 #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
| 16 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | 16 #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
| 17 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" | 17 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
| 18 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
| 19 #include "skia/ext/skia_utils_mac.h" | 19 #include "skia/ext/skia_utils_mac.h" |
| 20 #import "ui/base/cocoa/controls/hyperlink_button_cell.h" | 20 #import "ui/base/cocoa/controls/hyperlink_button_cell.h" |
| 21 #include "ui/base/cocoa/window_size_constants.h" | 21 #include "ui/base/cocoa/window_size_constants.h" |
| 22 #include "ui/native_theme/native_theme.h" | 22 #include "ui/native_theme/native_theme.h" |
| 23 #include "ui/native_theme/native_theme_mac.h" |
| 23 | 24 |
| 24 namespace { | 25 namespace { |
| 25 | 26 |
| 26 const CGFloat kWrenchBubblePointOffsetY = 6; | 27 const CGFloat kWrenchBubblePointOffsetY = 6; |
| 27 const CGFloat kVerticalSpacing = 8; | 28 const CGFloat kVerticalSpacing = 8; |
| 28 const CGFloat kHorizontalSpacing = 4; | 29 const CGFloat kHorizontalSpacing = 4; |
| 29 const CGFloat kInset = 20.0; | 30 const CGFloat kInset = 20.0; |
| 30 const CGFloat kTitleSpacing = 15; | 31 const CGFloat kTitleSpacing = 15; |
| 31 const CGFloat kAnchorlessEndPadding = 20; | 32 const CGFloat kAnchorlessEndPadding = 20; |
| 32 const CGFloat kAnchorlessTopPadding = 10; | 33 const CGFloat kAnchorlessTopPadding = 10; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 styleMask:NSBorderlessWindowMask | 79 styleMask:NSBorderlessWindowMask |
| 79 backing:NSBackingStoreBuffered | 80 backing:NSBackingStoreBuffered |
| 80 defer:NO]); | 81 defer:NO]); |
| 81 bridge_.reset(bridge); | 82 bridge_.reset(bridge); |
| 82 if ((self = [super initWithWindow:window | 83 if ((self = [super initWithWindow:window |
| 83 parentWindow:parentWindow | 84 parentWindow:parentWindow |
| 84 anchoredAt:NSZeroPoint])) { | 85 anchoredAt:NSZeroPoint])) { |
| 85 controller_ = controller; | 86 controller_ = controller; |
| 86 [window setInfoBubbleCanBecomeKeyWindow:NO]; | 87 [window setInfoBubbleCanBecomeKeyWindow:NO]; |
| 87 | 88 |
| 88 ui::NativeTheme* nativeTheme = ui::NativeTheme::instance(); | 89 ui::NativeTheme* nativeTheme = ui::NativeThemeMac::instance(); |
| 89 [[self bubble] setBackgroundColor: | 90 [[self bubble] setBackgroundColor: |
| 90 gfx::SkColorToCalibratedNSColor(nativeTheme->GetSystemColor( | 91 gfx::SkColorToCalibratedNSColor(nativeTheme->GetSystemColor( |
| 91 ui::NativeTheme::kColorId_DialogBackground))]; | 92 ui::NativeTheme::kColorId_DialogBackground))]; |
| 92 [self performLayout]; | 93 [self performLayout]; |
| 93 } | 94 } |
| 94 return self; | 95 return self; |
| 95 } | 96 } |
| 96 | 97 |
| 97 - (void)showAtAnchor:(NSPoint)anchorPoint { | 98 - (void)showAtAnchor:(NSPoint)anchorPoint { |
| 98 [self setAnchorPoint:anchorPoint]; | 99 [self setAnchorPoint:anchorPoint]; |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 controller:controller_ | 266 controller:controller_ |
| 266 bridge:this]; | 267 bridge:this]; |
| 267 } | 268 } |
| 268 | 269 |
| 269 InfoBubbleWindow* NewCreditCardBubbleCocoa::GetInfoBubbleWindow() { | 270 InfoBubbleWindow* NewCreditCardBubbleCocoa::GetInfoBubbleWindow() { |
| 270 return base::mac::ObjCCastStrict<InfoBubbleWindow>( | 271 return base::mac::ObjCCastStrict<InfoBubbleWindow>( |
| 271 [bubbleController_ window]); | 272 [bubbleController_ window]); |
| 272 } | 273 } |
| 273 | 274 |
| 274 } // namespace autofill | 275 } // namespace autofill |
| OLD | NEW |