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/tab_contents/tab_contents_controller.h" | 5 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
10 #include "chrome/browser/devtools/devtools_window.h" | 10 #include "chrome/browser/devtools/devtools_window.h" |
11 #include "content/public/browser/render_view_host.h" | 11 #include "content/public/browser/render_view_host.h" |
12 #include "content/public/browser/render_widget_host_view.h" | 12 #include "content/public/browser/render_widget_host_view.h" |
13 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
14 #include "content/public/browser/web_contents_view.h" | 14 #include "content/public/browser/web_contents_view.h" |
15 | 15 |
16 using content::WebContents; | 16 using content::WebContents; |
17 | 17 |
18 @implementation TabContentsController | 18 @implementation TabContentsController |
19 @synthesize webContents = contents_; | 19 @synthesize webContents = contents_; |
20 | 20 |
21 - (id)initWithContents:(WebContents*)contents { | 21 - (id)initWithContents:(WebContents*)contents { |
22 if ((self = [super initWithNibName:nil bundle:nil])) { | 22 if ((self = [super initWithNibName:nil bundle:nil])) { |
23 contents_ = contents; | 23 contents_ = contents; |
24 } | 24 } |
25 return self; | 25 return self; |
26 } | 26 } |
27 | 27 |
28 - (void)dealloc { | 28 - (void)dealloc { |
29 // make sure our contents have been removed from the window | 29 // make sure our contents have been removed from the window |
30 [[self view] removeFromSuperview]; | 30 [[self view] removeFromSuperview]; |
31 [super dealloc]; | 31 [super dealloc]; |
32 } | 32 } |
33 | 33 |
34 - (void)loadView { | 34 - (void)loadView { |
35 scoped_nsobject<NSView> view([[NSView alloc] initWithFrame:NSZeroRect]); | 35 base::scoped_nsobject<NSView> view([[NSView alloc] initWithFrame:NSZeroRect]); |
36 [view setAutoresizingMask:NSViewHeightSizable|NSViewWidthSizable]; | 36 [view setAutoresizingMask:NSViewHeightSizable|NSViewWidthSizable]; |
37 [self setView:view]; | 37 [self setView:view]; |
38 } | 38 } |
39 | 39 |
40 - (void)ensureContentsSizeDoesNotChange { | 40 - (void)ensureContentsSizeDoesNotChange { |
41 NSView* contentsContainer = [self view]; | 41 NSView* contentsContainer = [self view]; |
42 NSArray* subviews = [contentsContainer subviews]; | 42 NSArray* subviews = [contentsContainer subviews]; |
43 if ([subviews count] > 0) { | 43 if ([subviews count] > 0) { |
44 [contents_->GetView()->GetNativeView() | 44 [contents_->GetView()->GetNativeView() |
45 setAutoresizingMask:NSViewNotSizable]; | 45 setAutoresizingMask:NSViewNotSizable]; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // Calling setContentView: here removes any first responder status | 109 // Calling setContentView: here removes any first responder status |
110 // the view may have, so avoid changing the view hierarchy unless | 110 // the view may have, so avoid changing the view hierarchy unless |
111 // the view is different. | 111 // the view is different. |
112 if ([self webContents] != updatedContents) { | 112 if ([self webContents] != updatedContents) { |
113 contents_ = updatedContents; | 113 contents_ = updatedContents; |
114 [self ensureContentsVisible]; | 114 [self ensureContentsVisible]; |
115 } | 115 } |
116 } | 116 } |
117 | 117 |
118 @end | 118 @end |
OLD | NEW |