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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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::kTopCenter: | 343 case info_bubble::kTopCenter: |
344 case info_bubble::kNoArrow: | |
groby-ooo-7-16
2015/03/10 23:34:13
If we _must_ fall through, mark this as // FALLTHR
hcarmona
2015/03/11 22:38:03
Updated with // FALLTHROUGH.
Looked into the zoom
| |
344 origin.x -= NSWidth([window frame]) / 2.0; | 345 origin.x -= NSWidth([window frame]) / 2.0; |
345 break; | 346 break; |
346 case info_bubble::kNoArrow: | |
347 NOTREACHED(); | |
348 break; | |
349 } | 347 } |
350 break; | 348 break; |
351 } | 349 } |
352 | 350 |
353 case info_bubble::kAlignEdgeToAnchorEdge: | 351 case info_bubble::kAlignEdgeToAnchorEdge: |
354 // If the arrow is to the right then move the origin so that the right | 352 // If the arrow is to the right then move the origin so that the right |
355 // edge aligns with the anchor. If the arrow is to the left then there's | 353 // edge aligns with the anchor. If the arrow is to the left then there's |
356 // nothing to do because the left edge is already aligned with the left | 354 // nothing to do because the left edge is already aligned with the left |
357 // edge of the anchor. | 355 // edge of the anchor. |
358 if ([bubble_ arrowLocation] == info_bubble::kTopRight) { | 356 if ([bubble_ arrowLocation] == info_bubble::kTopRight) { |
(...skipping 19 matching lines...) Expand all Loading... | |
378 | 376 |
379 - (void)activateTabWithContents:(content::WebContents*)newContents | 377 - (void)activateTabWithContents:(content::WebContents*)newContents |
380 previousContents:(content::WebContents*)oldContents | 378 previousContents:(content::WebContents*)oldContents |
381 atIndex:(NSInteger)index | 379 atIndex:(NSInteger)index |
382 reason:(int)reason { | 380 reason:(int)reason { |
383 // The user switched tabs; close. | 381 // The user switched tabs; close. |
384 [self close]; | 382 [self close]; |
385 } | 383 } |
386 | 384 |
387 @end // BaseBubbleController | 385 @end // BaseBubbleController |
OLD | NEW |