| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/cocoa/base_bubble_controller.h" | 5 #import "chrome/browser/cocoa/base_bubble_controller.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/mac_util.h" | 9 #include "base/mac_util.h" |
| 10 #include "base/scoped_nsobject.h" | 10 #include "base/scoped_nsobject.h" |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 } | 183 } |
| 184 | 184 |
| 185 // Takes the |anchor_| point and adjusts the window's origin accordingly. | 185 // Takes the |anchor_| point and adjusts the window's origin accordingly. |
| 186 - (void)updateOriginFromAnchor { | 186 - (void)updateOriginFromAnchor { |
| 187 NSWindow* window = [self window]; | 187 NSWindow* window = [self window]; |
| 188 NSPoint origin = anchor_; | 188 NSPoint origin = anchor_; |
| 189 NSSize offsets = NSMakeSize(info_bubble::kBubbleArrowXOffset + | 189 NSSize offsets = NSMakeSize(info_bubble::kBubbleArrowXOffset + |
| 190 info_bubble::kBubbleArrowWidth / 2.0, 0); | 190 info_bubble::kBubbleArrowWidth / 2.0, 0); |
| 191 offsets = [[parentWindow_ contentView] convertSize:offsets toView:nil]; | 191 offsets = [[parentWindow_ contentView] convertSize:offsets toView:nil]; |
| 192 if ([bubble_ arrowLocation] == info_bubble::kTopRight) { | 192 if ([bubble_ arrowLocation] == info_bubble::kTopRight) { |
| 193 origin.x -= NSWidth([window frame]) + offsets.width; | 193 origin.x -= NSWidth([window frame]) - offsets.width; |
| 194 } else { | 194 } else { |
| 195 origin.x -= offsets.width; | 195 origin.x -= offsets.width; |
| 196 } | 196 } |
| 197 origin.y -= NSHeight([window frame]); | 197 origin.y -= NSHeight([window frame]); |
| 198 [window setFrameOrigin:origin]; | 198 [window setFrameOrigin:origin]; |
| 199 } | 199 } |
| 200 | 200 |
| 201 @end // BaseBubbleController | 201 @end // BaseBubbleController |
| OLD | NEW |