OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/validation_message_bubble_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/validation_message_bubble_cocoa.h" |
6 | 6 |
7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #import "chrome/browser/ui/cocoa/info_bubble_view.h" | 10 #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 base::scoped_nsobject<InfoBubbleWindow> window( | 38 base::scoped_nsobject<InfoBubbleWindow> window( |
39 [[InfoBubbleWindow alloc] initWithContentRect: | 39 [[InfoBubbleWindow alloc] initWithContentRect: |
40 NSMakeRect(0, 0, kWindowInitialWidth, kWindowInitialHeight) | 40 NSMakeRect(0, 0, kWindowInitialWidth, kWindowInitialHeight) |
41 styleMask:NSBorderlessWindowMask | 41 styleMask:NSBorderlessWindowMask |
42 backing:NSBackingStoreBuffered | 42 backing:NSBackingStoreBuffered |
43 defer:NO]); | 43 defer:NO]); |
44 if ((self = [super initWithWindow:window.get() | 44 if ((self = [super initWithWindow:window.get() |
45 parentWindow:parentWindow | 45 parentWindow:parentWindow |
46 anchoredAt:anchorPoint])) { | 46 anchoredAt:anchorPoint])) { |
47 [[self bubble] setArrowLocation:info_bubble::kTopLeft]; | 47 [[self bubble] setArrowLocation:views::BubbleBorder::TOP_LEFT]; |
48 self.shouldOpenAsKeyWindow = NO; | 48 self.shouldOpenAsKeyWindow = NO; |
49 | 49 |
50 NSView* contentView = [ValidationMessageBubbleController | 50 NSView* contentView = [ValidationMessageBubbleController |
51 constructContentView:mainText subText:subText]; | 51 constructContentView:mainText subText:subText]; |
52 [[window contentView] addSubview:contentView]; | 52 [[window contentView] addSubview:contentView]; |
53 NSRect contentFrame = [contentView frame]; | 53 NSRect contentFrame = [contentView frame]; |
54 NSRect windowFrame = [window frame]; | 54 NSRect windowFrame = [window frame]; |
55 windowFrame.size.width = NSWidth(contentFrame) + kWindowPadding * 2; | 55 windowFrame.size.width = NSWidth(contentFrame) + kWindowPadding * 2; |
56 windowFrame.size.height = NSHeight(contentFrame) + kWindowPadding * 2 | 56 windowFrame.size.height = NSHeight(contentFrame) + kWindowPadding * 2 |
57 + info_bubble::kBubbleArrowHeight; | 57 + info_bubble::kBubbleArrowHeight; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 165 |
166 ValidationMessageBubbleCocoa::~ValidationMessageBubbleCocoa() { | 166 ValidationMessageBubbleCocoa::~ValidationMessageBubbleCocoa() { |
167 [controller_ close]; | 167 [controller_ close]; |
168 } | 168 } |
169 | 169 |
170 void ValidationMessageBubbleCocoa::SetPositionRelativeToAnchor( | 170 void ValidationMessageBubbleCocoa::SetPositionRelativeToAnchor( |
171 content::RenderWidgetHost* widget_host, | 171 content::RenderWidgetHost* widget_host, |
172 const gfx::Rect& anchor_in_root_view) { | 172 const gfx::Rect& anchor_in_root_view) { |
173 [controller_ setAnchorPoint:GetAnchorPoint(widget_host, anchor_in_root_view)]; | 173 [controller_ setAnchorPoint:GetAnchorPoint(widget_host, anchor_in_root_view)]; |
174 } | 174 } |
OLD | NEW |