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 #include "ui/native_theme/native_theme_mac.h" |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 const CGFloat kWrenchBubblePointOffsetY = 6; | 27 const CGFloat kAppMenuBubblePointOffsetY = 6; |
28 const CGFloat kVerticalSpacing = 8; | 28 const CGFloat kVerticalSpacing = 8; |
29 const CGFloat kHorizontalSpacing = 4; | 29 const CGFloat kHorizontalSpacing = 4; |
30 const CGFloat kInset = 20.0; | 30 const CGFloat kInset = 20.0; |
31 const CGFloat kTitleSpacing = 15; | 31 const CGFloat kTitleSpacing = 15; |
32 const CGFloat kAnchorlessEndPadding = 20; | 32 const CGFloat kAnchorlessEndPadding = 20; |
33 const CGFloat kAnchorlessTopPadding = 10; | 33 const CGFloat kAnchorlessTopPadding = 10; |
34 | 34 |
35 } // namespace | 35 } // namespace |
36 | 36 |
37 @interface NewCreditCardBubbleControllerCocoa : BaseBubbleController { | 37 @interface NewCreditCardBubbleControllerCocoa : BaseBubbleController { |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 NSWindow* parent_window = [browser_view window]; | 203 NSWindow* parent_window = [browser_view window]; |
204 BrowserWindowController* bwc = [BrowserWindowController | 204 BrowserWindowController* bwc = [BrowserWindowController |
205 browserWindowControllerForWindow:parent_window]; | 205 browserWindowControllerForWindow:parent_window]; |
206 | 206 |
207 if (!bubbleController_) | 207 if (!bubbleController_) |
208 CreateCocoaController(parent_window); | 208 CreateCocoaController(parent_window); |
209 | 209 |
210 NSPoint anchor_point; | 210 NSPoint anchor_point; |
211 NSView* anchor_view; | 211 NSView* anchor_view; |
212 if ([bwc isTabbedWindow]) { | 212 if ([bwc isTabbedWindow]) { |
213 anchor_view = [[bwc toolbarController] wrenchButton]; | 213 anchor_view = [[bwc toolbarController] appMenuButton]; |
214 anchor_point = NSMakePoint( | 214 anchor_point = NSMakePoint( |
215 NSMidX([anchor_view bounds]), | 215 NSMidX([anchor_view bounds]), |
216 NSMinY([anchor_view bounds]) + kWrenchBubblePointOffsetY); | 216 NSMinY([anchor_view bounds]) + kAppMenuBubblePointOffsetY); |
217 [[bubbleController_ bubble] setArrowLocation:info_bubble::kTopRight]; | 217 [[bubbleController_ bubble] setArrowLocation:info_bubble::kTopRight]; |
218 [[bubbleController_ bubble] setAlignment:info_bubble::kAlignArrowToAnchor]; | 218 [[bubbleController_ bubble] setAlignment:info_bubble::kAlignArrowToAnchor]; |
219 } else { | 219 } else { |
220 anchor_view = browser_view; | 220 anchor_view = browser_view; |
221 anchor_point = NSMakePoint( | 221 anchor_point = NSMakePoint( |
222 NSMaxX([browser_view bounds]) - kAnchorlessEndPadding, | 222 NSMaxX([browser_view bounds]) - kAnchorlessEndPadding, |
223 NSMaxY([browser_view bounds]) - kAnchorlessTopPadding); | 223 NSMaxY([browser_view bounds]) - kAnchorlessTopPadding); |
224 [[bubbleController_ bubble] setArrowLocation:info_bubble::kNoArrow]; | 224 [[bubbleController_ bubble] setArrowLocation:info_bubble::kNoArrow]; |
225 if (base::i18n::IsRTL()) { | 225 if (base::i18n::IsRTL()) { |
226 anchor_point.x = NSMaxX([anchor_view bounds]) - anchor_point.x; | 226 anchor_point.x = NSMaxX([anchor_view bounds]) - anchor_point.x; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 controller:controller_ | 266 controller:controller_ |
267 bridge:this]; | 267 bridge:this]; |
268 } | 268 } |
269 | 269 |
270 InfoBubbleWindow* NewCreditCardBubbleCocoa::GetInfoBubbleWindow() { | 270 InfoBubbleWindow* NewCreditCardBubbleCocoa::GetInfoBubbleWindow() { |
271 return base::mac::ObjCCastStrict<InfoBubbleWindow>( | 271 return base::mac::ObjCCastStrict<InfoBubbleWindow>( |
272 [bubbleController_ window]); | 272 [bubbleController_ window]); |
273 } | 273 } |
274 | 274 |
275 } // namespace autofill | 275 } // namespace autofill |
OLD | NEW |