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

Unified Diff: chrome/browser/ui/cocoa/dev_tools_controller.mm

Issue 12208060: Alternate NTP: Don't overlap dev tools with bookmark bar (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix linux Created 7 years, 10 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/dev_tools_controller.mm
diff --git a/chrome/browser/ui/cocoa/dev_tools_controller.mm b/chrome/browser/ui/cocoa/dev_tools_controller.mm
index a392e5424e61eac98c886a693c6b1a8b4e793126..ba97641273cc204ed1f0cf26662fe8aa91aacda4 100644
--- a/chrome/browser/ui/cocoa/dev_tools_controller.mm
+++ b/chrome/browser/ui/cocoa/dev_tools_controller.mm
@@ -8,6 +8,7 @@
#include <Cocoa/Cocoa.h>
+#import "base/mac/foundation_util.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
@@ -36,6 +37,15 @@ using content::WebContents;
return [NSColor darkGrayColor];
}
+- (void)drawDividerInRect:(NSRect)aRect {
+ NSRect dividerRect = aRect;
+ if ([self isVertical]) {
+ dividerRect.size.height -= topContentOffset_;
+ dividerRect.origin.y += topContentOffset_;
+ }
+ [super drawDividerInRect:dividerRect];
+}
+
- (NSView*)hitTest:(NSPoint)point {
NSPoint viewPoint = [self convertPoint:point fromView:[self superview]];
if (viewPoint.y < topContentOffset_)
@@ -45,6 +55,26 @@ using content::WebContents;
@end
+// Superview for the dev tools contents view. This class ensures that dev tools
+// view doesn't overlap the toolbar when split vertically.
+@interface DevToolsContainerView : NSView
+@end
+
+@implementation DevToolsContainerView
+
+- (void)resizeSubviewsWithOldSize:(NSSize)oldBoundsSize {
+ NSRect subviewFrame = [self bounds];
+ GraySplitView* splitView =
+ base::mac::ObjCCastStrict<GraySplitView>([self superview]);
+ if ([splitView isVertical])
+ subviewFrame.size.height -= [splitView topContentOffset];
+
+ DCHECK_EQ(1u, [[self subviews] count]);
+ [[[self subviews] lastObject] setFrame:subviewFrame];
+}
+
+@end
+
@interface DevToolsController (Private)
- (void)showDevToolsContainer;
@@ -132,7 +162,11 @@ using content::WebContents;
// VIEW_ID_DEV_TOOLS_DOCKED here.
NSView* devToolsView = devToolsContents->GetNativeView();
view_id_util::SetID(devToolsView, VIEW_ID_DEV_TOOLS_DOCKED);
- [splitView_ addSubview:devToolsView];
+
+ scoped_nsobject<DevToolsContainerView> devToolsContainerView(
+ [[DevToolsContainerView alloc] initWithFrame:[devToolsView bounds]]);
+ [devToolsContainerView addSubview:devToolsView];
+ [splitView_ addSubview:devToolsContainerView];
BOOL isVertical = devToolsWindow_->dock_side() == DEVTOOLS_DOCK_SIDE_RIGHT;
[splitView_ setVertical:isVertical];
@@ -190,6 +224,16 @@ using content::WebContents;
return YES;
}
+- (CGFloat)splitView:(NSSplitView*)splitView
+ constrainSplitPosition:(CGFloat)proposedPosition
+ ofSubviewAt:(NSInteger)dividerIndex {
+ if (![splitView_ isVertical] &&
+ proposedPosition < [splitView_ topContentOffset]) {
+ return [splitView_ topContentOffset];
+ }
+ return proposedPosition;
+}
+
-(void)splitViewWillResizeSubviews:(NSNotification *)notification {
[[splitView_ window] disableScreenUpdatesUntilFlush];
}
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller.mm ('k') | chrome/browser/ui/cocoa/dev_tools_controller_browsertest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698