| 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 "chrome/browser/ui/cocoa/base_bubble_controller.h" | 5 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/mac/bundle_locations.h" | 8 #include "base/mac/bundle_locations.h" |
| 9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
| 10 #include "base/memory/scoped_nsobject.h" | 10 #include "base/memory/scoped_nsobject.h" |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 origin.x -= NSWidth([window frame]) - offsets.width; | 246 origin.x -= NSWidth([window frame]) - offsets.width; |
| 247 } else { | 247 } else { |
| 248 origin.x -= offsets.width; | 248 origin.x -= offsets.width; |
| 249 } | 249 } |
| 250 break; | 250 break; |
| 251 } | 251 } |
| 252 | 252 |
| 253 case info_bubble::kAlignEdgeToAnchorEdge: | 253 case info_bubble::kAlignEdgeToAnchorEdge: |
| 254 // If the arrow is to the right then move the origin so that the right | 254 // If the arrow is to the right then move the origin so that the right |
| 255 // edge aligns with the anchor. If the arrow is to the left then there's | 255 // edge aligns with the anchor. If the arrow is to the left then there's |
| 256 // nothing to do becaues the left edge is already aligned with the left | 256 // nothing to do because the left edge is already aligned with the left |
| 257 // edge of the anchor. | 257 // edge of the anchor. |
| 258 if ([bubble_ arrowLocation] == info_bubble::kTopRight) { | 258 if ([bubble_ arrowLocation] == info_bubble::kTopRight) { |
| 259 origin.x -= NSWidth([window frame]); | 259 origin.x -= NSWidth([window frame]); |
| 260 } | 260 } |
| 261 break; | 261 break; |
| 262 | 262 |
| 263 case info_bubble::kAlignRightEdgeToAnchorEdge: |
| 264 origin.x -= NSWidth([window frame]); |
| 265 break; |
| 266 |
| 267 case info_bubble::kAlignLeftEdgeToAnchorEdge: |
| 268 // Nothing to do. |
| 269 break; |
| 270 |
| 263 default: | 271 default: |
| 264 NOTREACHED(); | 272 NOTREACHED(); |
| 265 } | 273 } |
| 266 | 274 |
| 267 origin.y -= NSHeight([window frame]); | 275 origin.y -= NSHeight([window frame]); |
| 268 [window setFrameOrigin:origin]; | 276 [window setFrameOrigin:origin]; |
| 269 } | 277 } |
| 270 | 278 |
| 271 - (void)activateTabWithContents:(TabContents*)newContents | 279 - (void)activateTabWithContents:(TabContents*)newContents |
| 272 previousContents:(TabContents*)oldContents | 280 previousContents:(TabContents*)oldContents |
| 273 atIndex:(NSInteger)index | 281 atIndex:(NSInteger)index |
| 274 userGesture:(bool)wasUserGesture { | 282 userGesture:(bool)wasUserGesture { |
| 275 // The user switched tabs; close. | 283 // The user switched tabs; close. |
| 276 [self close]; | 284 [self close]; |
| 277 } | 285 } |
| 278 | 286 |
| 279 @end // BaseBubbleController | 287 @end // BaseBubbleController |
| OLD | NEW |