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

Unified Diff: chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.mm

Issue 18009003: Instant Extended: Delete unused overlay code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
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 83bb984e50f0fdede67ebec939bd8a6e6bb2a533..89f5b0ddfbc1d90161adabd80e4c1d67807503d4 100644
--- a/chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.mm
+++ b/chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.mm
@@ -4,10 +4,7 @@
#import "chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.h"
-#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_separator_view.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
@@ -15,23 +12,16 @@
- (void)viewDidResize:(NSNotification*)note;
- (void)layoutViews;
- (CGFloat)overlayHeightInPixels;
-- (BOOL)shouldShowTopSeparator;
@end
@implementation OverlayableContentsController
-@synthesize drawDropShadow = drawDropShadow_;
-@synthesize activeContainerOffset = activeContainerOffset_;
-@synthesize overlayContentsOffset = overlayContentsOffset_;
-
- (id)initWithBrowser:(Browser*)browser
windowController:(BrowserWindowController*)windowController {
if ((self = [super init])) {
- windowController_ = windowController;
base::scoped_nsobject<NSView> view(
[[NSView alloc] initWithFrame:NSZeroRect]);
[view setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable];
- [view setAutoresizesSubviews:NO];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(viewDidResize:)
@@ -40,13 +30,12 @@
[self setView:view];
activeContainer_.reset([[NSView alloc] initWithFrame:NSZeroRect]);
+ [activeContainer_ setAutoresizingMask:NSViewHeightSizable |
+ NSViewWidthSizable];
[view addSubview:activeContainer_];
instantOverlayController_.reset(
new InstantOverlayControllerMac(browser, windowController, self));
- topSeparatorView_.reset(
- [[OverlayTopSeparatorView alloc] initWithFrame:NSZeroRect]);
- [[self view] addSubview:topSeparatorView_];
}
return self;
}
@@ -60,17 +49,9 @@
height:(CGFloat)height
heightUnits:(InstantSizeUnits)heightUnits
drawDropShadow:(BOOL)drawDropShadow {
- // If drawing drop shadow, clip the bottom 1-px-thick separator out of
- // overlay.
- // TODO(sail): remove this when GWS gives chrome the height without the
- // separator.
- if (drawDropShadow && heightUnits != INSTANT_SIZE_PERCENT)
- --height;
-
if (overlayContents_ == overlay &&
overlayHeight_ == height &&
- overlayHeightUnits_ == heightUnits &&
- drawDropShadow_ == drawDropShadow) {
+ overlayHeightUnits_ == heightUnits) {
return;
}
@@ -84,7 +65,6 @@
overlayContents_ = overlay;
overlayHeight_ = height;
overlayHeightUnits_ = heightUnits;
- drawDropShadow_ = drawDropShadow;
// Add the overlay contents.
if (overlayContents_) {
@@ -92,17 +72,6 @@
[[self view] addSubview:overlayContents_->GetView()->GetNativeView()];
}
- if (drawDropShadow_) {
- if (!dropShadowView_) {
- dropShadowView_.reset(
- [[OverlayBottomSeparatorView alloc] initWithFrame:NSZeroRect]);
- [[self view] addSubview:dropShadowView_];
- }
- } else {
- [dropShadowView_ removeFromSuperview];
- dropShadowView_.reset();
- }
-
[self layoutViews];
if (overlayContents_)
@@ -122,98 +91,36 @@
}
}
-- (BOOL)isShowingOverlay {
- return overlayContents_ != nil;
-}
-
- (InstantOverlayControllerMac*)instantOverlayController {
return instantOverlayController_.get();
}
-- (void)activeContentsCompositingIOSurfaceCreated {
- if (!overlayContents_)
- return;
-
- // If the active tab becomes composited the the overlay will no longer be
- // visible. Workaround this by re-adding the overlay to the view hierarchy.
- // See http://crbug.com/222122
- [overlayContents_->GetView()->GetNativeView() removeFromSuperview];
- [[self view] addSubview:overlayContents_->GetView()->GetNativeView()];
+- (BOOL)isShowingOverlay {
+ return overlayContents_ != nil;
}
- (NSView*)activeContainer {
return activeContainer_.get();
}
-- (NSView*)dropShadowView {
- return dropShadowView_.get();
-}
-
-- (void)setActiveContainerOffset:(CGFloat)activeContainerOffset {
- if (activeContainerOffset_ == activeContainerOffset)
- return;
-
- activeContainerOffset_ = activeContainerOffset;
- [self layoutViews];
-}
-
-- (void)setOverlayContentsOffset:(CGFloat)overlayContentsOffset {
- if (overlayContentsOffset_ == overlayContentsOffset)
- return;
-
- overlayContentsOffset_ = overlayContentsOffset;
- [self layoutViews];
-}
-
- (void)viewDidResize:(NSNotification*)note {
[self layoutViews];
}
- (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];
+ if (!overlayContents_)
+ return;
// Layout the overlay.
- if (overlayContents_) {
- NSRect overlayFrame = bounds;
- overlayFrame.size.height = [self overlayHeightInPixels];
- overlayFrame.origin.y = NSMinY([topSeparatorView_ frame]) -
- NSHeight(overlayFrame) - overlayContentsOffset_;
- [overlayContents_->GetView()->GetNativeView() setFrame:overlayFrame];
-
- if (dropShadowView_) {
- NSRect dropShadowFrame = bounds;
- dropShadowFrame.size.height =
- [OverlayBottomSeparatorView preferredHeight];
- dropShadowFrame.origin.y =
- NSMinY(overlayFrame) - NSHeight(dropShadowFrame);
- [dropShadowView_ setFrame:dropShadowFrame];
- }
- }
-
- // Layout the active tab contents.
- NSRect activeFrame = bounds;
- if (activeContainerOffset_)
- activeFrame.size.height -= activeContainerOffset_;
- else
- activeFrame.size.height -= NSHeight([topSeparatorView_ frame]);
- if (!NSEqualRects(activeFrame, [activeContainer_ frame])) {
- [[activeContainer_ window] disableScreenUpdatesUntilFlush];
- [activeContainer_ setFrame:activeFrame];
- }
+ NSRect bounds = [[self view] bounds];
+ NSRect overlayFrame = bounds;
+ overlayFrame.size.height = [self overlayHeightInPixels];
+ overlayFrame.origin.y = NSMaxY(bounds) - NSHeight(overlayFrame);
+ [overlayContents_->GetView()->GetNativeView() setFrame:overlayFrame];
}
- (CGFloat)overlayHeightInPixels {
- CGFloat height = NSHeight([[self view] bounds]) -
- NSHeight([topSeparatorView_ frame]) - overlayContentsOffset_;
+ CGFloat height = NSHeight([[self view] bounds]);
switch (overlayHeightUnits_) {
case INSTANT_SIZE_PERCENT:
return std::min(height, (height * overlayHeight_) / 100);
@@ -222,18 +129,4 @@
}
}
-- (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

Powered by Google App Engine
This is Rietveld 408576698