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/dev_tools_controller.h" | 5 #import "chrome/browser/ui/cocoa/dev_tools_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include <Cocoa/Cocoa.h> | 9 #include <Cocoa/Cocoa.h> |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... | |
23 | 23 |
24 // Minimal height of devtools pane or content pane when devtools are docked | 24 // Minimal height of devtools pane or content pane when devtools are docked |
25 // to the browser window. | 25 // to the browser window. |
26 const int kMinDevToolsHeight = 50; | 26 const int kMinDevToolsHeight = 50; |
27 const int kMinDevToolsWidth = 150; | 27 const int kMinDevToolsWidth = 150; |
28 const int kMinContentsSize = 50; | 28 const int kMinContentsSize = 50; |
29 | 29 |
30 } // end namespace | 30 } // end namespace |
31 | 31 |
32 | 32 |
33 @interface GraySplitView : NSSplitView | |
34 - (NSColor*)dividerColor; | |
35 @end | |
36 | |
37 | |
38 @implementation GraySplitView | |
39 - (NSColor*)dividerColor { | |
40 return [NSColor darkGrayColor]; | |
41 } | |
42 @end | |
43 | |
44 | |
33 @interface DevToolsController (Private) | 45 @interface DevToolsController (Private) |
34 - (void)showDevToolsContents:(WebContents*)devToolsContents | 46 - (void)showDevToolsContents:(WebContents*)devToolsContents |
35 withProfile:(Profile*)profile; | 47 withProfile:(Profile*)profile; |
36 - (void)showDevToolsContainer:(NSView*)container profile:(Profile*)profile; | 48 - (void)showDevToolsContainer:(NSView*)container profile:(Profile*)profile; |
37 - (void)hideDevToolsContainer:(Profile*)profile; | 49 - (void)hideDevToolsContainer:(Profile*)profile; |
38 - (void)resizeDevTools:(CGFloat)size; | 50 - (void)resizeDevTools:(CGFloat)size; |
39 @end | 51 @end |
40 | 52 |
41 | 53 |
42 @implementation DevToolsController | 54 @implementation DevToolsController |
43 | 55 |
44 - (id)init { | 56 - (id)init { |
45 if ((self = [super init])) { | 57 if ((self = [super init])) { |
46 splitView_.reset([[NSSplitView alloc] initWithFrame:NSZeroRect]); | 58 splitView_.reset([[GraySplitView alloc] initWithFrame:NSZeroRect]); |
47 [splitView_ setDividerStyle:NSSplitViewDividerStyleThin]; | 59 [splitView_ setDividerStyle:NSSplitViewDividerStyleThin]; |
48 [splitView_ setVertical:NO]; | 60 [splitView_ setVertical:NO]; |
49 [splitView_ setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable]; | 61 [splitView_ setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable]; |
62 [splitView_ setDelegate:self]; | |
50 | 63 |
51 dockToRight_ = NO; | 64 dockToRight_ = NO; |
52 } | 65 } |
53 return self; | 66 return self; |
54 } | 67 } |
55 | 68 |
56 - (NSView*)view { | 69 - (NSView*)view { |
57 return splitView_.get(); | 70 return splitView_.get(); |
58 } | 71 } |
59 | 72 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
192 NSHeight([splitView_ frame]) - ([splitView_ dividerThickness] + size); | 205 NSHeight([splitView_ frame]) - ([splitView_ dividerThickness] + size); |
193 } | 206 } |
194 | 207 |
195 [webView setFrame:webFrame]; | 208 [webView setFrame:webFrame]; |
196 [devToolsView setFrame:devToolsFrame]; | 209 [devToolsView setFrame:devToolsFrame]; |
197 | 210 |
198 [splitView_ adjustSubviews]; | 211 [splitView_ adjustSubviews]; |
199 } | 212 } |
200 | 213 |
201 // NSSplitViewDelegate protocol. | 214 // NSSplitViewDelegate protocol. |
202 - (BOOL)splitView:(NSSplitView *)splitView | 215 - (BOOL)splitView:(NSSplitView *)splitView |
jbates
2012/05/21 21:41:52
Note: this appears to have been dead code since 20
| |
203 shouldAdjustSizeOfSubview:(NSView *)subview { | 216 shouldAdjustSizeOfSubview:(NSView *)subview { |
204 // Return NO for the devTools view to indicate that it should not be resized | 217 // Return NO for the devTools view to indicate that it should not be resized |
205 // automatically. It preserves the height set by the user and also keeps | 218 // automatically. It preserves the height set by the user and also keeps |
206 // view height the same while changing tabs when one of the tabs shows infobar | 219 // view height the same while changing tabs when one of the tabs shows infobar |
207 // and others are not. | 220 // and others are not. |
208 if ([[splitView_ subviews] indexOfObject:subview] == 1) | 221 if ([[splitView_ subviews] indexOfObject:subview] == 1) |
209 return NO; | 222 return NO; |
210 return YES; | 223 return YES; |
211 } | 224 } |
212 | 225 |
226 -(void)splitViewWillResizeSubviews:(NSNotification *)notification { | |
227 [[splitView_ window] disableScreenUpdatesUntilFlush]; | |
228 } | |
229 | |
213 @end | 230 @end |
OLD | NEW |