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

Side by Side Diff: chrome/browser/cocoa/tab_strip_controller.mm

Issue 155099: Don't install the RWHVMac into the view hierarchy until everything has been p... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 5 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
« no previous file with comments | « chrome/browser/cocoa/tab_contents_controller.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/cocoa/tab_strip_controller.h" 5 #import "chrome/browser/cocoa/tab_strip_controller.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/mac_util.h" 8 #include "base/mac_util.h"
9 #include "base/sys_string_conversions.h" 9 #include "base/sys_string_conversions.h"
10 #include "chrome/app/chrome_dll_resource.h" 10 #include "chrome/app/chrome_dll_resource.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 + (CGFloat)defaultTabHeight { 72 + (CGFloat)defaultTabHeight {
73 return 24.0; 73 return 24.0;
74 } 74 }
75 75
76 // Finds the associated TabContentsController at the given |index| and swaps 76 // Finds the associated TabContentsController at the given |index| and swaps
77 // out the sole child of the contentArea to display its contents. 77 // out the sole child of the contentArea to display its contents.
78 - (void)swapInTabAtIndex:(NSInteger)index { 78 - (void)swapInTabAtIndex:(NSInteger)index {
79 TabContentsController* controller = [tabContentsArray_ objectAtIndex:index]; 79 TabContentsController* controller = [tabContentsArray_ objectAtIndex:index];
80 80
81 // Resize the new view to fit the window 81 // Resize the new view to fit the window. Calling |view| may lazily
82 // instantiate the TabContentsController from the nib. Until we call
83 // |-ensureContentsVisible|, the controller doesn't install the RWHVMac into
84 // the view hierarchy. This is in order to avoid sending the renderer a
85 // spurrious default size loaded from the nib during the call to |-view|.
Mark Mentovai 2009/07/06 19:30:05 spurious
82 NSView* newView = [controller view]; 86 NSView* newView = [controller view];
83 NSRect frame = [switchView_ bounds]; 87 NSRect frame = [switchView_ bounds];
84 [newView setFrame:frame]; 88 [newView setFrame:frame];
89 [controller ensureContentsVisible];
85 90
86 // Remove the old view from the view hierarchy. We know there's only one 91 // Remove the old view from the view hierarchy. We know there's only one
87 // child of |switchView_| because we're the one who put it there. There 92 // child of |switchView_| because we're the one who put it there. There
88 // may not be any children in the case of a tab that's been closed, in 93 // may not be any children in the case of a tab that's been closed, in
89 // which case there's no swapping going on. 94 // which case there's no swapping going on.
90 NSArray* subviews = [switchView_ subviews]; 95 NSArray* subviews = [switchView_ subviews];
91 if ([subviews count]) { 96 if ([subviews count]) {
92 NSView* oldView = [subviews objectAtIndex:0]; 97 NSView* oldView = [subviews objectAtIndex:0];
93 [switchView_ replaceSubview:oldView with:newView]; 98 [switchView_ replaceSubview:oldView with:newView];
94 } else { 99 } else {
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 // window when we don't have access to the TabContents as part of our strip. 578 // window when we don't have access to the TabContents as part of our strip.
574 - (void)dropTabContents:(TabContents*)contents { 579 - (void)dropTabContents:(TabContents*)contents {
575 int index = [self indexOfPlaceholder]; 580 int index = [self indexOfPlaceholder];
576 581
577 // Insert it into this tab strip. We want it in the foreground and to not 582 // Insert it into this tab strip. We want it in the foreground and to not
578 // inherit the current tab's group. 583 // inherit the current tab's group.
579 tabModel_->InsertTabContentsAt(index, contents, true, false); 584 tabModel_->InsertTabContentsAt(index, contents, true, false);
580 } 585 }
581 586
582 @end 587 @end
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/tab_contents_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698