Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(438)

Side by Side Diff: chrome/browser/ui/cocoa/base_bubble_controller.mm

Issue 986333006: Center permission bubble if location bar is hidden in MacOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Apply Feedback Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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.
343 case info_bubble::kTopCenter: 345 case info_bubble::kTopCenter:
344 origin.x -= NSWidth([window frame]) / 2.0; 346 origin.x -= NSWidth([window frame]) / 2.0;
345 break; 347 break;
346 case info_bubble::kNoArrow:
347 NOTREACHED();
348 break;
349 } 348 }
350 break; 349 break;
351 } 350 }
352 351
353 case info_bubble::kAlignEdgeToAnchorEdge: 352 case info_bubble::kAlignEdgeToAnchorEdge:
354 // If the arrow is to the right then move the origin so that the right 353 // 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 354 // 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 355 // nothing to do because the left edge is already aligned with the left
357 // edge of the anchor. 356 // edge of the anchor.
358 if ([bubble_ arrowLocation] == info_bubble::kTopRight) { 357 if ([bubble_ arrowLocation] == info_bubble::kTopRight) {
(...skipping 19 matching lines...) Expand all
378 377
379 - (void)activateTabWithContents:(content::WebContents*)newContents 378 - (void)activateTabWithContents:(content::WebContents*)newContents
380 previousContents:(content::WebContents*)oldContents 379 previousContents:(content::WebContents*)oldContents
381 atIndex:(NSInteger)index 380 atIndex:(NSInteger)index
382 reason:(int)reason { 381 reason:(int)reason {
383 // The user switched tabs; close. 382 // The user switched tabs; close.
384 [self close]; 383 [self close];
385 } 384 }
386 385
387 @end // BaseBubbleController 386 @end // BaseBubbleController
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698