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

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

Issue 9265018: Change grow box computation back to a method on BrowserWindow (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 8 years, 11 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 93db17b36e9de4e65634496048ca9f869781e66a..f029f1fc83f1c6d6ecb02821a25d5662d469dbd2 100644
--- a/chrome/browser/ui/cocoa/dev_tools_controller.mm
+++ b/chrome/browser/ui/cocoa/dev_tools_controller.mm
@@ -33,7 +33,7 @@ const int kMinContentsSize = 50;
@interface DevToolsController (Private)
- (void)showDevToolsContents:(WebContents*)devToolsContents
withProfile:(Profile*)profile;
-- (void)showDevToolsContainer:(Profile*)profile;
+- (void)showDevToolsContainer:(NSView*)container profile:(Profile*)profile;
- (void)hideDevToolsContainer:(Profile*)profile;
- (void)resizeDevTools:(CGFloat)size;
@end
@@ -41,28 +41,18 @@ const int kMinContentsSize = 50;
@implementation DevToolsController
-- (id)initWithDelegate:(id<TabContentsControllerDelegate>)delegate {
+- (id)init {
if ((self = [super init])) {
splitView_.reset([[NSSplitView alloc] initWithFrame:NSZeroRect]);
[splitView_ setDividerStyle:NSSplitViewDividerStyleThin];
[splitView_ setVertical:NO];
[splitView_ setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
- [splitView_ setDelegate:self];
dockToRight_ = NO;
-
- contentsController_.reset(
- [[TabContentsController alloc] initWithContents:NULL
- delegate:delegate]);
}
return self;
}
-- (void)dealloc {
- [splitView_ setDelegate:nil];
- [super dealloc];
-}
-
- (NSView*)view {
return splitView_.get();
}
@@ -89,40 +79,34 @@ const int kMinContentsSize = 50;
NSArray* subviews = [splitView_ subviews];
if ([subviews count] == 2) {
+ scoped_nsobject<NSView> devToolsContentsView(
+ [[subviews objectAtIndex:1] retain]);
[self hideDevToolsContainer:profile];
dockToRight_ = dockToRight;
- [self showDevToolsContainer:profile];
+ [self showDevToolsContainer:devToolsContentsView profile:profile];
} else {
dockToRight_ = dockToRight;
}
}
-- (void)ensureContentsVisible {
- [contentsController_ ensureContentsVisible];
-}
-
- (void)showDevToolsContents:(WebContents*)devToolsContents
withProfile:(Profile*)profile {
- [contentsController_ ensureContentsSizeDoesNotChange];
-
NSArray* subviews = [splitView_ subviews];
if (devToolsContents) {
// |devToolsView| is a TabContentsViewCocoa object, whose ViewID was
// set to VIEW_ID_TAB_CONTAINER initially, so we need to change it to
// VIEW_ID_DEV_TOOLS_DOCKED here.
- view_id_util::SetID(devToolsContents->GetNativeView(),
- VIEW_ID_DEV_TOOLS_DOCKED);
- [self showDevToolsContainer:profile];
+ NSView* devToolsView = devToolsContents->GetNativeView();
+ view_id_util::SetID(devToolsView, VIEW_ID_DEV_TOOLS_DOCKED);
+ [self showDevToolsContainer:devToolsView profile:profile];
} else {
if ([subviews count] > 1) {
[self hideDevToolsContainer:profile];
}
}
-
- [contentsController_ changeWebContents:devToolsContents];
}
-- (void)showDevToolsContainer:(Profile*)profile {
+- (void)showDevToolsContainer:(NSView*)container profile:(Profile*)profile {
NSArray* subviews = [splitView_ subviews];
DCHECK_GE([subviews count], 1u);
@@ -140,7 +124,7 @@ const int kMinContentsSize = 50;
if (splitOffset < 0)
splitOffset = contentSize * 1 / 3;
- [splitView_ addSubview:[contentsController_ view]];
+ [splitView_ addSubview:container];
} else {
DCHECK_EQ([subviews count], 2u);
// If devtools are already visible, keep the current size.
« no previous file with comments | « chrome/browser/ui/cocoa/dev_tools_controller.h ('k') | chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698