| 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 #include "ui/base/cocoa/cocoa_base_utils.h" |
| 20 #import "ui/base/cocoa/controls/hyperlink_button_cell.h" | 21 #import "ui/base/cocoa/controls/hyperlink_button_cell.h" |
| 21 #include "ui/base/cocoa/window_size_constants.h" | 22 #include "ui/base/cocoa/window_size_constants.h" |
| 22 #include "ui/native_theme/native_theme.h" | 23 #include "ui/native_theme/native_theme.h" |
| 23 #include "ui/native_theme/native_theme_mac.h" | 24 #include "ui/native_theme/native_theme_mac.h" |
| 24 | 25 |
| 25 namespace { | 26 namespace { |
| 26 | 27 |
| 27 const CGFloat kAppMenuBubblePointOffsetY = 6; | 28 const CGFloat kAppMenuBubblePointOffsetY = 6; |
| 28 const CGFloat kVerticalSpacing = 8; | 29 const CGFloat kVerticalSpacing = 8; |
| 29 const CGFloat kHorizontalSpacing = 4; | 30 const CGFloat kHorizontalSpacing = 4; |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 info_bubble::kAlignLeftEdgeToAnchorEdge]; | 229 info_bubble::kAlignLeftEdgeToAnchorEdge]; |
| 229 } else { | 230 } else { |
| 230 [[bubbleController_ bubble] setAlignment: | 231 [[bubbleController_ bubble] setAlignment: |
| 231 info_bubble::kAlignRightEdgeToAnchorEdge]; | 232 info_bubble::kAlignRightEdgeToAnchorEdge]; |
| 232 } | 233 } |
| 233 } | 234 } |
| 234 if ([anchor_view isFlipped]) | 235 if ([anchor_view isFlipped]) |
| 235 anchor_point.y = NSMaxY([anchor_view bounds]) - anchor_point.y; | 236 anchor_point.y = NSMaxY([anchor_view bounds]) - anchor_point.y; |
| 236 anchor_point = [anchor_view convertPoint:anchor_point toView:nil]; | 237 anchor_point = [anchor_view convertPoint:anchor_point toView:nil]; |
| 237 | 238 |
| 238 NSRect frame = NSZeroRect; | 239 anchor_point = |
| 239 frame.origin = anchor_point; | 240 ui::ConvertPointFromWindowToScreen(parent_window, anchor_point); |
| 240 anchor_point = [parent_window convertBaseToScreen:anchor_point]; | |
| 241 [bubbleController_ showAtAnchor:anchor_point]; | 241 [bubbleController_ showAtAnchor:anchor_point]; |
| 242 } | 242 } |
| 243 | 243 |
| 244 void NewCreditCardBubbleCocoa::Hide() { | 244 void NewCreditCardBubbleCocoa::Hide() { |
| 245 [bubbleController_ close]; | 245 [bubbleController_ close]; |
| 246 } | 246 } |
| 247 | 247 |
| 248 // static | 248 // static |
| 249 base::WeakPtr<NewCreditCardBubbleView> NewCreditCardBubbleView::Create( | 249 base::WeakPtr<NewCreditCardBubbleView> NewCreditCardBubbleView::Create( |
| 250 NewCreditCardBubbleController* controller) { | 250 NewCreditCardBubbleController* controller) { |
| (...skipping 15 matching lines...) Expand all 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 |