| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 base::scoped_nsobject<InfoBubbleWindow> window( | 41 base::scoped_nsobject<InfoBubbleWindow> window( |
| 42 [[InfoBubbleWindow alloc] initWithContentRect: | 42 [[InfoBubbleWindow alloc] initWithContentRect: |
| 43 NSMakeRect(0, 0, kWindowInitialWidth, kWindowInitialHeight) | 43 NSMakeRect(0, 0, kWindowInitialWidth, kWindowInitialHeight) |
| 44 styleMask:NSBorderlessWindowMask | 44 styleMask:NSBorderlessWindowMask |
| 45 backing:NSBackingStoreBuffered | 45 backing:NSBackingStoreBuffered |
| 46 defer:NO]); | 46 defer:NO]); |
| 47 if ((self = [super initWithWindow:window.get() | 47 if ((self = [super initWithWindow:window.get() |
| 48 parentWindow:parentWindow | 48 parentWindow:parentWindow |
| 49 anchoredAt:anchorPoint])) { | 49 anchoredAt:anchorPoint])) { |
| 50 [[self bubble] setArrowLocation:info_bubble::kTopLeft]; | 50 [[self bubble] setArrowLocation:info_bubble::kTopLeading]; |
| 51 self.shouldOpenAsKeyWindow = NO; | 51 self.shouldOpenAsKeyWindow = NO; |
| 52 | 52 |
| 53 NSView* contentView = [ValidationMessageBubbleController | 53 NSView* contentView = [ValidationMessageBubbleController |
| 54 constructContentView:mainText subText:subText]; | 54 constructContentView:mainText subText:subText]; |
| 55 [[window contentView] addSubview:contentView]; | 55 [[window contentView] addSubview:contentView]; |
| 56 NSRect contentFrame = [contentView frame]; | 56 NSRect contentFrame = [contentView frame]; |
| 57 NSRect windowFrame = [window frame]; | 57 NSRect windowFrame = [window frame]; |
| 58 windowFrame.size.width = NSWidth(contentFrame) + kWindowPadding * 2; | 58 windowFrame.size.width = NSWidth(contentFrame) + kWindowPadding * 2; |
| 59 windowFrame.size.height = NSHeight(contentFrame) + kWindowPadding * 2 | 59 windowFrame.size.height = NSHeight(contentFrame) + kWindowPadding * 2 |
| 60 + info_bubble::kBubbleArrowHeight; | 60 + info_bubble::kBubbleArrowHeight; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 void ValidationMessageBubbleCocoa::SetPositionRelativeToAnchor( | 172 void ValidationMessageBubbleCocoa::SetPositionRelativeToAnchor( |
| 173 content::RenderWidgetHost* widget_host, | 173 content::RenderWidgetHost* widget_host, |
| 174 const gfx::Rect& anchor_in_root_view) { | 174 const gfx::Rect& anchor_in_root_view) { |
| 175 [controller_ setAnchorPoint:GetAnchorPoint(widget_host, anchor_in_root_view)]; | 175 [controller_ setAnchorPoint:GetAnchorPoint(widget_host, anchor_in_root_view)]; |
| 176 } | 176 } |
| 177 | 177 |
| 178 void ValidationMessageBubbleCocoa::CloseValidationMessage() { | 178 void ValidationMessageBubbleCocoa::CloseValidationMessage() { |
| 179 [controller_ close]; | 179 [controller_ close]; |
| 180 delete this; | 180 delete this; |
| 181 } | 181 } |
| OLD | NEW |