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/browser_window_controller_private.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 maxY:(CGFloat)maxY | 468 maxY:(CGFloat)maxY |
469 width:(CGFloat)width { | 469 width:(CGFloat)width { |
470 NSView* containerView = [infoBarContainerController_ view]; | 470 NSView* containerView = [infoBarContainerController_ view]; |
471 NSRect containerFrame = [containerView frame]; | 471 NSRect containerFrame = [containerView frame]; |
472 maxY -= NSHeight(containerFrame); | 472 maxY -= NSHeight(containerFrame); |
473 maxY += [infoBarContainerController_ overlappingTipHeight]; | 473 maxY += [infoBarContainerController_ overlappingTipHeight]; |
474 containerFrame.origin.x = minX; | 474 containerFrame.origin.x = minX; |
475 containerFrame.origin.y = maxY; | 475 containerFrame.origin.y = maxY; |
476 containerFrame.size.width = width; | 476 containerFrame.size.width = width; |
477 [containerView setFrame:containerFrame]; | 477 [containerView setFrame:containerFrame]; |
| 478 [infoBarContainerController_ setMaxTopArrowHeight:[self |
| 479 infoBarMaxTopArrowHeight]]; |
478 return maxY; | 480 return maxY; |
479 } | 481 } |
480 | 482 |
481 - (CGFloat)layoutDownloadShelfAtMinX:(CGFloat)minX | 483 - (CGFloat)layoutDownloadShelfAtMinX:(CGFloat)minX |
482 minY:(CGFloat)minY | 484 minY:(CGFloat)minY |
483 width:(CGFloat)width { | 485 width:(CGFloat)width { |
484 if (downloadShelfController_.get()) { | 486 if (downloadShelfController_.get()) { |
485 NSView* downloadView = [downloadShelfController_ view]; | 487 NSView* downloadView = [downloadShelfController_ view]; |
486 NSRect downloadFrame = [downloadView frame]; | 488 NSRect downloadFrame = [downloadView frame]; |
487 downloadFrame.origin.x = minX; | 489 downloadFrame.origin.x = minX; |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1051 } | 1053 } |
1052 } | 1054 } |
1053 } | 1055 } |
1054 | 1056 |
1055 - (void)updateInfoBarTipVisibility { | 1057 - (void)updateInfoBarTipVisibility { |
1056 // If there's no toolbar then hide the infobar tip. | 1058 // If there's no toolbar then hide the infobar tip. |
1057 [infoBarContainerController_ | 1059 [infoBarContainerController_ |
1058 setShouldSuppressTopInfoBarTip:![self hasToolbar]]; | 1060 setShouldSuppressTopInfoBarTip:![self hasToolbar]]; |
1059 } | 1061 } |
1060 | 1062 |
| 1063 - (NSInteger)infoBarMaxTopArrowHeight { |
| 1064 NSInteger topArrowHeight = 0; |
| 1065 LocationBarViewMac* locationBarView = [self locationBarBridge]; |
| 1066 NSPoint iconBottom = locationBarView->GetPageInfoBubblePoint(); |
| 1067 |
| 1068 CGFloat overlappingTipHeight = |
| 1069 [infoBarContainerController_ overlappingTipHeight]; |
| 1070 NSPoint infoBarTop = |
| 1071 NSMakePoint(0, NSHeight([infoBarContainerController_ view].frame) - |
| 1072 overlappingTipHeight); |
| 1073 infoBarTop = [[infoBarContainerController_ view] convertPoint:infoBarTop |
| 1074 toView:nil]; |
| 1075 |
| 1076 topArrowHeight = iconBottom.y - infoBarTop.y; |
| 1077 return topArrowHeight; |
| 1078 } |
| 1079 |
1061 @end // @implementation BrowserWindowController(Private) | 1080 @end // @implementation BrowserWindowController(Private) |
OLD | NEW |