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 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1289 tabStripModel_->ContainsIndex(modelIndex)); | 1289 tabStripModel_->ContainsIndex(modelIndex)); |
1290 | 1290 |
1291 // Cancel any pending tab transition. | 1291 // Cancel any pending tab transition. |
1292 hoverTabSelector_->CancelTabTransition(); | 1292 hoverTabSelector_->CancelTabTransition(); |
1293 | 1293 |
1294 // Take closing tabs into account. | 1294 // Take closing tabs into account. |
1295 NSInteger index = [self indexFromModelIndex:modelIndex]; | 1295 NSInteger index = [self indexFromModelIndex:modelIndex]; |
1296 | 1296 |
1297 // Make a new tab. Load the contents of this tab from the nib and associate | 1297 // Make a new tab. Load the contents of this tab from the nib and associate |
1298 // the new controller with |contents| so it can be looked up later. | 1298 // the new controller with |contents| so it can be looked up later. |
| 1299 const BOOL autoEmbedFullscreen = |
| 1300 implicit_cast<content::WebContentsDelegate*>(browser_)-> |
| 1301 EmbedsFullscreenWidget(); |
1299 base::scoped_nsobject<TabContentsController> contentsController( | 1302 base::scoped_nsobject<TabContentsController> contentsController( |
1300 [[TabContentsController alloc] initWithContents:contents]); | 1303 [[TabContentsController alloc] initWithContents:contents |
| 1304 andAutoEmbedFullscreen:autoEmbedFullscreen]); |
1301 [tabContentsArray_ insertObject:contentsController atIndex:index]; | 1305 [tabContentsArray_ insertObject:contentsController atIndex:index]; |
1302 | 1306 |
1303 // Make a new tab and add it to the strip. Keep track of its controller. | 1307 // Make a new tab and add it to the strip. Keep track of its controller. |
1304 TabController* newController = [self newTab]; | 1308 TabController* newController = [self newTab]; |
1305 [newController setMini:tabStripModel_->IsMiniTab(modelIndex)]; | 1309 [newController setMini:tabStripModel_->IsMiniTab(modelIndex)]; |
1306 [newController setPinned:tabStripModel_->IsTabPinned(modelIndex)]; | 1310 [newController setPinned:tabStripModel_->IsTabPinned(modelIndex)]; |
1307 [newController setApp:tabStripModel_->IsAppTab(modelIndex)]; | 1311 [newController setApp:tabStripModel_->IsAppTab(modelIndex)]; |
1308 [newController setUrl:contents->GetURL()]; | 1312 [newController setUrl:contents->GetURL()]; |
1309 [tabArray_ insertObject:newController atIndex:index]; | 1313 [tabArray_ insertObject:newController atIndex:index]; |
1310 NSView* newView = [newController view]; | 1314 NSView* newView = [newController view]; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1403 previousContents:(content::WebContents*)oldContents | 1407 previousContents:(content::WebContents*)oldContents |
1404 atIndex:(NSInteger)modelIndex { | 1408 atIndex:(NSInteger)modelIndex { |
1405 NSInteger index = [self indexFromModelIndex:modelIndex]; | 1409 NSInteger index = [self indexFromModelIndex:modelIndex]; |
1406 TabContentsController* oldController = | 1410 TabContentsController* oldController = |
1407 [tabContentsArray_ objectAtIndex:index]; | 1411 [tabContentsArray_ objectAtIndex:index]; |
1408 DCHECK_EQ(oldContents, [oldController webContents]); | 1412 DCHECK_EQ(oldContents, [oldController webContents]); |
1409 | 1413 |
1410 // Simply create a new TabContentsController for |newContents| and place it | 1414 // Simply create a new TabContentsController for |newContents| and place it |
1411 // into the array, replacing |oldContents|. An ActiveTabChanged notification | 1415 // into the array, replacing |oldContents|. An ActiveTabChanged notification |
1412 // will follow, at which point we will install the new view. | 1416 // will follow, at which point we will install the new view. |
| 1417 const BOOL autoEmbedFullscreen = |
| 1418 implicit_cast<content::WebContentsDelegate*>(browser_)-> |
| 1419 EmbedsFullscreenWidget(); |
1413 base::scoped_nsobject<TabContentsController> newController( | 1420 base::scoped_nsobject<TabContentsController> newController( |
1414 [[TabContentsController alloc] initWithContents:newContents]); | 1421 [[TabContentsController alloc] initWithContents:newContents |
| 1422 andAutoEmbedFullscreen:autoEmbedFullscreen]); |
1415 | 1423 |
1416 // Bye bye, |oldController|. | 1424 // Bye bye, |oldController|. |
1417 [tabContentsArray_ replaceObjectAtIndex:index withObject:newController]; | 1425 [tabContentsArray_ replaceObjectAtIndex:index withObject:newController]; |
1418 | 1426 |
1419 // Fake a tab changed notification to force tab titles and favicons to update. | 1427 // Fake a tab changed notification to force tab titles and favicons to update. |
1420 [self tabChangedWithContents:newContents | 1428 [self tabChangedWithContents:newContents |
1421 atIndex:modelIndex | 1429 atIndex:modelIndex |
1422 changeType:TabStripModelObserver::ALL]; | 1430 changeType:TabStripModelObserver::ALL]; |
1423 } | 1431 } |
1424 | 1432 |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2301 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) { | 2309 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) { |
2302 // View hierarchy of the contents view: | 2310 // View hierarchy of the contents view: |
2303 // NSView -- switchView, same for all tabs | 2311 // NSView -- switchView, same for all tabs |
2304 // +- NSView -- TabContentsController's view | 2312 // +- NSView -- TabContentsController's view |
2305 // +- TabContentsViewCocoa | 2313 // +- TabContentsViewCocoa |
2306 // | 2314 // |
2307 // Changing it? Do not forget to modify | 2315 // Changing it? Do not forget to modify |
2308 // -[TabStripController swapInTabAtIndex:] too. | 2316 // -[TabStripController swapInTabAtIndex:] too. |
2309 return [web_contents->GetView()->GetNativeView() superview]; | 2317 return [web_contents->GetView()->GetNativeView() superview]; |
2310 } | 2318 } |
OLD | NEW |