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

Side by Side Diff: chrome/browser/ui/cocoa/dev_tools_controller.mm

Issue 440663003: DevTools: remove unused resizing strategy code paths, make it solely bounds-based. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for landing Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include <cmath> 8 #include <cmath>
9 9
10 #include <Cocoa/Cocoa.h> 10 #include <Cocoa/Cocoa.h>
(...skipping 25 matching lines...) Expand all
36 - (BOOL)hasDevToolsView; 36 - (BOOL)hasDevToolsView;
37 37
38 @end 38 @end
39 39
40 40
41 @implementation DevToolsContainerView 41 @implementation DevToolsContainerView
42 42
43 - (void)setDevToolsView:(NSView*)devToolsView 43 - (void)setDevToolsView:(NSView*)devToolsView
44 withStrategy:(const DevToolsContentsResizingStrategy&)strategy { 44 withStrategy:(const DevToolsContentsResizingStrategy&)strategy {
45 strategy_.CopyFrom(strategy); 45 strategy_.CopyFrom(strategy);
46 46 if (devToolsView == devToolsView_) {
47 if (devToolsView == devToolsView_) 47 if (contentsView_)
48 [contentsView_ setHidden:strategy.hide_inspected_contents()];
48 return; 49 return;
50 }
49 51
50 if (devToolsView_) { 52 if (devToolsView_) {
51 DCHECK_EQ(2u, [[self subviews] count]); 53 DCHECK_EQ(2u, [[self subviews] count]);
52 [devToolsView_ removeFromSuperview]; 54 [devToolsView_ removeFromSuperview];
55 [contentsView_ setHidden:NO];
53 contentsView_ = nil; 56 contentsView_ = nil;
54 devToolsView_ = nil; 57 devToolsView_ = nil;
55 } 58 }
56 59
57 if (devToolsView) { 60 if (devToolsView) {
58 NSArray* subviews = [self subviews]; 61 NSArray* subviews = [self subviews];
59 DCHECK_EQ(1u, [subviews count]); 62 DCHECK_EQ(1u, [subviews count]);
60 contentsView_ = [subviews objectAtIndex:0]; 63 contentsView_ = [subviews objectAtIndex:0];
61 devToolsView_ = devToolsView; 64 devToolsView_ = devToolsView;
62 // Place DevTools under contents. 65 // Place DevTools under contents.
63 [self addSubview:devToolsView positioned:NSWindowBelow relativeTo:nil]; 66 [self addSubview:devToolsView positioned:NSWindowBelow relativeTo:nil];
67
68 [contentsView_ setHidden:strategy.hide_inspected_contents()];
64 } 69 }
65 } 70 }
66 71
67 - (void)resizeSubviewsWithOldSize:(NSSize)oldBoundsSize { 72 - (void)resizeSubviewsWithOldSize:(NSSize)oldBoundsSize {
68 [self adjustSubviews]; 73 [self adjustSubviews];
69 } 74 }
70 75
71 - (BOOL)hasDevToolsView { 76 - (BOOL)hasDevToolsView {
72 return devToolsView_ != nil; 77 return devToolsView_ != nil;
73 } 78 }
74 79
75 - (void)adjustSubviews { 80 - (void)adjustSubviews {
76 if (![[self subviews] count]) 81 if (![[self subviews] count])
77 return; 82 return;
78 83
79 if (!devToolsView_) { 84 if (!devToolsView_) {
80 DCHECK_EQ(1u, [[self subviews] count]); 85 DCHECK_EQ(1u, [[self subviews] count]);
81 NSView* contents = [[self subviews] objectAtIndex:0]; 86 NSView* contents = [[self subviews] objectAtIndex:0];
82 [contents setFrame:[self bounds]]; 87 [contents setFrame:[self bounds]];
83 return; 88 return;
84 } 89 }
85 90
86 DCHECK_EQ(2u, [[self subviews] count]); 91 DCHECK_EQ(2u, [[self subviews] count]);
87 92
88 gfx::Rect new_devtools_bounds; 93 gfx::Rect new_devtools_bounds;
89 gfx::Rect new_contents_bounds; 94 gfx::Rect new_contents_bounds;
90 ApplyDevToolsContentsResizingStrategy( 95 ApplyDevToolsContentsResizingStrategy(
91 strategy_, gfx::Size(NSSizeToCGSize([self bounds].size)), 96 strategy_, gfx::Size(NSSizeToCGSize([self bounds].size)),
92 [self flipNSRectToRect:[devToolsView_ bounds]],
93 [self flipNSRectToRect:[contentsView_ bounds]],
94 &new_devtools_bounds, &new_contents_bounds); 97 &new_devtools_bounds, &new_contents_bounds);
95 [devToolsView_ setFrame:[self flipRectToNSRect:new_devtools_bounds]]; 98 [devToolsView_ setFrame:[self flipRectToNSRect:new_devtools_bounds]];
96 [contentsView_ setFrame:[self flipRectToNSRect:new_contents_bounds]]; 99 [contentsView_ setFrame:[self flipRectToNSRect:new_contents_bounds]];
97 } 100 }
98 101
99 @end 102 @end
100 103
101 104
102 @implementation DevToolsController 105 @implementation DevToolsController
103 106
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 contents->SetAllowOtherViews(true); 149 contents->SetAllowOtherViews(true);
147 } else { 150 } else {
148 contents->SetAllowOtherViews(false); 151 contents->SetAllowOtherViews(false);
149 } 152 }
150 153
151 [devToolsContainerView_ setDevToolsView:devToolsView withStrategy:strategy]; 154 [devToolsContainerView_ setDevToolsView:devToolsView withStrategy:strategy];
152 [devToolsContainerView_ adjustSubviews]; 155 [devToolsContainerView_ adjustSubviews];
153 } 156 }
154 157
155 @end 158 @end
OLDNEW
« no previous file with comments | « chrome/browser/devtools/devtools_window.cc ('k') | chrome/browser/ui/views/frame/browser_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698