OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "base/logging.h" // for NOTREACHED() | 7 #include "base/logging.h" // for NOTREACHED() |
8 #include "base/mac/bundle_locations.h" | 8 #include "base/mac/bundle_locations.h" |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 134 |
135 [info_bubble orderFront:self]; | 135 [info_bubble orderFront:self]; |
136 } | 136 } |
137 | 137 |
138 - (void)awakeFromNib { | 138 - (void)awakeFromNib { |
139 DCHECK([[self window] isKindOfClass:[InfoBubbleWindow class]]); | 139 DCHECK([[self window] isKindOfClass:[InfoBubbleWindow class]]); |
140 [messageLabel_ setStringValue:[self getLabelText]]; | 140 [messageLabel_ setStringValue:[self getLabelText]]; |
141 [self initializeLabelAndButton]; | 141 [self initializeLabelAndButton]; |
142 } | 142 } |
143 | 143 |
144 - (void)positionInWindowAtTop:(CGFloat)maxY width:(CGFloat)maxWidth { | 144 - (void)positionInWindowAtTop:(CGFloat)maxY { |
145 NSRect windowFrame = [self window].frame; | 145 NSRect windowFrame = [self window].frame; |
146 NSRect ownerWindowFrame = [owner_ window].frame; | 146 NSRect ownerWindowFrame = [owner_ window].frame; |
147 NSPoint origin; | 147 NSPoint origin; |
148 origin.x = ownerWindowFrame.origin.x + | 148 origin.x = ownerWindowFrame.origin.x + |
149 (int)(NSWidth(ownerWindowFrame) / 2 - NSWidth(windowFrame) / 2); | 149 (int)(NSWidth(ownerWindowFrame) / 2 - NSWidth(windowFrame) / 2); |
150 origin.y = ownerWindowFrame.origin.y + maxY - NSHeight(windowFrame); | 150 origin.y = ownerWindowFrame.origin.y + maxY - NSHeight(windowFrame); |
151 [[self window] setFrameOrigin:origin]; | 151 [[self window] setFrameOrigin:origin]; |
152 } | 152 } |
153 | 153 |
154 // Called when someone clicks on the embedded link. | 154 // Called when someone clicks on the embedded link. |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 - (void)hideSoon { | 343 - (void)hideSoon { |
344 hideTimer_.reset( | 344 hideTimer_.reset( |
345 [[NSTimer scheduledTimerWithTimeInterval:kInitialDelay | 345 [[NSTimer scheduledTimerWithTimeInterval:kInitialDelay |
346 target:self | 346 target:self |
347 selector:@selector(hideTimerFired:) | 347 selector:@selector(hideTimerFired:) |
348 userInfo:nil | 348 userInfo:nil |
349 repeats:NO] retain]); | 349 repeats:NO] retain]); |
350 } | 350 } |
351 | 351 |
352 @end | 352 @end |
OLD | NEW |