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 |
| 69 - (void)dealloc { |
| 70 [splitView_ setDelegate:nil]; |
| 71 [super dealloc]; |
| 72 } |
| 73 |
56 - (NSView*)view { | 74 - (NSView*)view { |
57 return splitView_.get(); | 75 return splitView_.get(); |
58 } | 76 } |
59 | 77 |
60 - (NSSplitView*)splitView { | 78 - (NSSplitView*)splitView { |
61 return splitView_.get(); | 79 return splitView_.get(); |
62 } | 80 } |
63 | 81 |
64 - (void)updateDevToolsForWebContents:(WebContents*)contents | 82 - (void)updateDevToolsForWebContents:(WebContents*)contents |
65 withProfile:(Profile*)profile { | 83 withProfile:(Profile*)profile { |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 shouldAdjustSizeOfSubview:(NSView *)subview { | 221 shouldAdjustSizeOfSubview:(NSView *)subview { |
204 // Return NO for the devTools view to indicate that it should not be resized | 222 // 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 | 223 // 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 | 224 // view height the same while changing tabs when one of the tabs shows infobar |
207 // and others are not. | 225 // and others are not. |
208 if ([[splitView_ subviews] indexOfObject:subview] == 1) | 226 if ([[splitView_ subviews] indexOfObject:subview] == 1) |
209 return NO; | 227 return NO; |
210 return YES; | 228 return YES; |
211 } | 229 } |
212 | 230 |
| 231 -(void)splitViewWillResizeSubviews:(NSNotification *)notification { |
| 232 [[splitView_ window] disableScreenUpdatesUntilFlush]; |
| 233 } |
| 234 |
213 @end | 235 @end |
OLD | NEW |