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

Side by Side Diff: chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm

Issue 12334073: Remove WebContents methods that duplicate WebContentsView methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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/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/memory/scoped_nsobject.h"
10 #include "content/public/browser/render_view_host.h" 10 #include "content/public/browser/render_view_host.h"
(...skipping 22 matching lines...) Expand all
33 33
34 - (void)loadView { 34 - (void)loadView {
35 scoped_nsobject<NSView> view([[NSView alloc] initWithFrame:NSZeroRect]); 35 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_->GetNativeView() setAutoresizingMask:NSViewNotSizable]; 44 [contents_->GetView()->GetNativeView()
45 setAutoresizingMask:NSViewNotSizable];
46 }
45 } 47 }
46 48
47 // Call when the tab view is properly sized and the render widget host view 49 // Call when the tab view is properly sized and the render widget host view
48 // should be put into the view hierarchy. 50 // should be put into the view hierarchy.
49 - (void)ensureContentsVisible { 51 - (void)ensureContentsVisible {
50 if (!contents_) 52 if (!contents_)
51 return; 53 return;
52 NSView* contentsContainer = [self view]; 54 NSView* contentsContainer = [self view];
53 NSArray* subviews = [contentsContainer subviews]; 55 NSArray* subviews = [contentsContainer subviews];
54 NSView* contentsNativeView = contents_->GetNativeView(); 56 NSView* contentsNativeView = contents_->GetView()->GetNativeView();
55 [contentsNativeView setFrame:[contentsContainer frame]]; 57 [contentsNativeView setFrame:[contentsContainer frame]];
56 if ([subviews count] == 0) { 58 if ([subviews count] == 0) {
57 [contentsContainer addSubview:contentsNativeView]; 59 [contentsContainer addSubview:contentsNativeView];
58 } else if ([subviews objectAtIndex:0] != contentsNativeView) { 60 } else if ([subviews objectAtIndex:0] != contentsNativeView) {
59 [contentsContainer replaceSubview:[subviews objectAtIndex:0] 61 [contentsContainer replaceSubview:[subviews objectAtIndex:0]
60 with:contentsNativeView]; 62 with:contentsNativeView];
61 } 63 }
62 [contentsNativeView setAutoresizingMask:NSViewWidthSizable| 64 [contentsNativeView setAutoresizingMask:NSViewWidthSizable|
63 NSViewHeightSizable]; 65 NSViewHeightSizable];
64 // The find bar will overlap the content's view when it comes out; inform 66 // The find bar will overlap the content's view when it comes out; inform
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // Calling setContentView: here removes any first responder status 98 // Calling setContentView: here removes any first responder status
97 // the view may have, so avoid changing the view hierarchy unless 99 // the view may have, so avoid changing the view hierarchy unless
98 // the view is different. 100 // the view is different.
99 if ([self webContents] != updatedContents) { 101 if ([self webContents] != updatedContents) {
100 contents_ = updatedContents; 102 contents_ = updatedContents;
101 [self ensureContentsVisible]; 103 [self ensureContentsVisible];
102 } 104 }
103 } 105 }
104 106
105 @end 107 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698