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/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 NSSize offsets = NSMakeSize(info_bubble::kBubbleArrowXOffset + | 333 NSSize offsets = NSMakeSize(info_bubble::kBubbleArrowXOffset + |
334 info_bubble::kBubbleArrowWidth / 2.0, 0); | 334 info_bubble::kBubbleArrowWidth / 2.0, 0); |
335 offsets = [[parentWindow_ contentView] convertSize:offsets toView:nil]; | 335 offsets = [[parentWindow_ contentView] convertSize:offsets toView:nil]; |
336 switch ([bubble_ arrowLocation]) { | 336 switch ([bubble_ arrowLocation]) { |
337 case info_bubble::kTopRight: | 337 case info_bubble::kTopRight: |
338 origin.x -= NSWidth([window frame]) - offsets.width; | 338 origin.x -= NSWidth([window frame]) - offsets.width; |
339 break; | 339 break; |
340 case info_bubble::kTopLeft: | 340 case info_bubble::kTopLeft: |
341 origin.x -= offsets.width; | 341 origin.x -= offsets.width; |
342 break; | 342 break; |
343 case info_bubble::kNoArrow: | |
344 // FALLTHROUGH. | |
345 case info_bubble::kTopCenter: | 343 case info_bubble::kTopCenter: |
346 origin.x -= NSWidth([window frame]) / 2.0; | 344 origin.x -= NSWidth([window frame]) / 2.0; |
347 break; | 345 break; |
| 346 case info_bubble::kNoArrow: |
| 347 NOTREACHED(); |
| 348 break; |
348 } | 349 } |
349 break; | 350 break; |
350 } | 351 } |
351 | 352 |
352 case info_bubble::kAlignEdgeToAnchorEdge: | 353 case info_bubble::kAlignEdgeToAnchorEdge: |
353 // If the arrow is to the right then move the origin so that the right | 354 // If the arrow is to the right then move the origin so that the right |
354 // edge aligns with the anchor. If the arrow is to the left then there's | 355 // edge aligns with the anchor. If the arrow is to the left then there's |
355 // nothing to do because the left edge is already aligned with the left | 356 // nothing to do because the left edge is already aligned with the left |
356 // edge of the anchor. | 357 // edge of the anchor. |
357 if ([bubble_ arrowLocation] == info_bubble::kTopRight) { | 358 if ([bubble_ arrowLocation] == info_bubble::kTopRight) { |
(...skipping 19 matching lines...) Expand all Loading... |
377 | 378 |
378 - (void)activateTabWithContents:(content::WebContents*)newContents | 379 - (void)activateTabWithContents:(content::WebContents*)newContents |
379 previousContents:(content::WebContents*)oldContents | 380 previousContents:(content::WebContents*)oldContents |
380 atIndex:(NSInteger)index | 381 atIndex:(NSInteger)index |
381 reason:(int)reason { | 382 reason:(int)reason { |
382 // The user switched tabs; close. | 383 // The user switched tabs; close. |
383 [self close]; | 384 [self close]; |
384 } | 385 } |
385 | 386 |
386 @end // BaseBubbleController | 387 @end // BaseBubbleController |
OLD | NEW |