| 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/tabs/tab_strip_controller.h" | 5 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
| 6 | 6 |
| 7 #import <QuartzCore/QuartzCore.h> | 7 #import <QuartzCore/QuartzCore.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1291 | 1291 |
| 1292 - (void)tabReplacedWithContents:(content::WebContents*)newContents | 1292 - (void)tabReplacedWithContents:(content::WebContents*)newContents |
| 1293 previousContents:(content::WebContents*)oldContents | 1293 previousContents:(content::WebContents*)oldContents |
| 1294 atIndex:(NSInteger)modelIndex { | 1294 atIndex:(NSInteger)modelIndex { |
| 1295 NSInteger index = [self indexFromModelIndex:modelIndex]; | 1295 NSInteger index = [self indexFromModelIndex:modelIndex]; |
| 1296 TabContentsController* oldController = | 1296 TabContentsController* oldController = |
| 1297 [tabContentsArray_ objectAtIndex:index]; | 1297 [tabContentsArray_ objectAtIndex:index]; |
| 1298 DCHECK_EQ(oldContents, [oldController webContents]); | 1298 DCHECK_EQ(oldContents, [oldController webContents]); |
| 1299 | 1299 |
| 1300 // Simply create a new TabContentsController for |newContents| and place it | 1300 // Simply create a new TabContentsController for |newContents| and place it |
| 1301 // into the array, replacing |oldContents|. A ActiveTabChanged notification | 1301 // into the array, replacing |oldContents|. An ActiveTabChanged notification |
| 1302 // will follow, at which point we will install the new view. | 1302 // will follow, at which point we will install the new view. |
| 1303 scoped_nsobject<TabContentsController> newController( | 1303 scoped_nsobject<TabContentsController> newController( |
| 1304 [[TabContentsController alloc] initWithContents:newContents]); | 1304 [[TabContentsController alloc] initWithContents:newContents]); |
| 1305 | 1305 |
| 1306 // Bye bye, |oldController|. | 1306 // Bye bye, |oldController|. |
| 1307 [tabContentsArray_ replaceObjectAtIndex:index withObject:newController]; | 1307 [tabContentsArray_ replaceObjectAtIndex:index withObject:newController]; |
| 1308 | 1308 |
| 1309 // Fake a tab changed notification to force tab titles and favicons to update. | 1309 // Fake a tab changed notification to force tab titles and favicons to update. |
| 1310 [self tabChangedWithContents:newContents | 1310 [self tabChangedWithContents:newContents |
| 1311 atIndex:modelIndex | 1311 atIndex:modelIndex |
| (...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2109 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) { | 2109 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) { |
| 2110 // View hierarchy of the contents view: | 2110 // View hierarchy of the contents view: |
| 2111 // NSView -- switchView, same for all tabs | 2111 // NSView -- switchView, same for all tabs |
| 2112 // +- NSView -- TabContentsController's view | 2112 // +- NSView -- TabContentsController's view |
| 2113 // +- TabContentsViewCocoa | 2113 // +- TabContentsViewCocoa |
| 2114 // | 2114 // |
| 2115 // Changing it? Do not forget to modify | 2115 // Changing it? Do not forget to modify |
| 2116 // -[TabStripController swapInTabAtIndex:] too. | 2116 // -[TabStripController swapInTabAtIndex:] too. |
| 2117 return [web_contents->GetNativeView() superview]; | 2117 return [web_contents->GetNativeView() superview]; |
| 2118 } | 2118 } |
| OLD | NEW |