| Index: chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.mm
|
| diff --git a/chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.mm b/chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.mm
|
| index 718045e7192f665453b08a414015aea55f8fc4e3..786b0766841137d425663cf234ce4e9f21530641 100644
|
| --- a/chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.mm
|
| +++ b/chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.mm
|
| @@ -7,7 +7,7 @@
|
| #include "base/mac/bundle_locations.h"
|
| #include "chrome/browser/ui/cocoa/browser_window_controller.h"
|
| #include "chrome/browser/ui/cocoa/tab_contents/instant_overlay_controller_mac.h"
|
| -#include "chrome/browser/ui/cocoa/tab_contents/overlay_drop_shadow_view.h"
|
| +#include "chrome/browser/ui/cocoa/tab_contents/overlay_separator_view.h"
|
| #include "content/public/browser/web_contents.h"
|
| #include "content/public/browser/web_contents_view.h"
|
|
|
| @@ -15,6 +15,7 @@
|
| - (void)viewDidResize:(NSNotification*)note;
|
| - (void)layoutViews;
|
| - (CGFloat)overlayHeightInPixels;
|
| +- (BOOL)shouldShowTopSeparator;
|
| @end
|
|
|
| @implementation OverlayableContentsController
|
| @@ -41,6 +42,9 @@
|
|
|
| instantOverlayController_.reset(
|
| new InstantOverlayControllerMac(browser, windowController, self));
|
| + topSeparatorView_.reset(
|
| + [[OverlayTopSeparatorView alloc] initWithFrame:NSZeroRect]);
|
| + [[self view] addSubview:topSeparatorView_];
|
| }
|
| return self;
|
| }
|
| @@ -90,7 +94,7 @@
|
| if (drawDropShadow_) {
|
| if (!dropShadowView_) {
|
| dropShadowView_.reset(
|
| - [[OverlayDropShadowView alloc] initWithFrame:NSZeroRect]);
|
| + [[OverlayBottomSeparatorView alloc] initWithFrame:NSZeroRect]);
|
| [[self view] addSubview:dropShadowView_];
|
| }
|
| } else {
|
| @@ -148,23 +152,39 @@
|
| - (void)layoutViews {
|
| NSRect bounds = [[self view] bounds];
|
|
|
| + // Layout the separator at the top of the view.
|
| + NSRect separatorRect = bounds;
|
| + if ([self shouldShowTopSeparator])
|
| + separatorRect.size.height = [OverlayTopSeparatorView preferredHeight];
|
| + else
|
| + separatorRect.size.height = 0;
|
| + separatorRect.origin.y = NSMaxY(bounds) - NSHeight(separatorRect);
|
| + [topSeparatorView_ setFrame:separatorRect];
|
| +
|
| + // Layout the overlay.
|
| if (overlayContents_) {
|
| NSRect overlayFrame = bounds;
|
| overlayFrame.size.height = [self overlayHeightInPixels];
|
| - overlayFrame.origin.y = NSMaxY(bounds) - NSHeight(overlayFrame);
|
| + overlayFrame.origin.y =
|
| + NSMinY([topSeparatorView_ frame]) - NSHeight(overlayFrame);
|
| [overlayContents_->GetView()->GetNativeView() setFrame:overlayFrame];
|
|
|
| if (dropShadowView_) {
|
| NSRect dropShadowFrame = bounds;
|
| - dropShadowFrame.size.height = [OverlayDropShadowView preferredHeight];
|
| + dropShadowFrame.size.height =
|
| + [OverlayBottomSeparatorView preferredHeight];
|
| dropShadowFrame.origin.y =
|
| NSMinY(overlayFrame) - NSHeight(dropShadowFrame);
|
| [dropShadowView_ setFrame:dropShadowFrame];
|
| }
|
| }
|
|
|
| + // Layout the active tab contents.
|
| NSRect activeFrame = bounds;
|
| - activeFrame.size.height -= activeContainerOffset_;
|
| + if (activeContainerOffset_)
|
| + activeFrame.size.height -= activeContainerOffset_;
|
| + else
|
| + activeFrame.size.height -= NSHeight([topSeparatorView_ frame]);
|
| if (!NSEqualRects(activeFrame, [activeContainer_ frame])) {
|
| [[activeContainer_ window] disableScreenUpdatesUntilFlush];
|
| [activeContainer_ setFrame:activeFrame];
|
| @@ -172,7 +192,8 @@
|
| }
|
|
|
| - (CGFloat)overlayHeightInPixels {
|
| - CGFloat height = NSHeight([[self view] bounds]);
|
| + CGFloat height =
|
| + NSHeight([[self view] bounds]) - NSHeight([topSeparatorView_ frame]);
|
| switch (overlayHeightUnits_) {
|
| case INSTANT_SIZE_PERCENT:
|
| return std::min(height, (height * overlayHeight_) / 100);
|
| @@ -181,4 +202,18 @@
|
| }
|
| }
|
|
|
| +- (BOOL)shouldShowTopSeparator {
|
| + // In presentation mode tab contents are flush with the top of the screen
|
| + // so there's no need for a separator.
|
| + if ([windowController_ inPresentationMode])
|
| + return NO;
|
| +
|
| + if (![windowController_ hasToolbar])
|
| + return NO;
|
| +
|
| + // Show a separator is the overlay or the tab contents will be shown right
|
| + // next to the omnibox.
|
| + return activeContainerOffset_ == 0 || overlayContents_;
|
| +}
|
| +
|
| @end
|
|
|