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 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1394 // selected tab to the top. | 1394 // selected tab to the top. |
1395 [self layoutTabs]; | 1395 [self layoutTabs]; |
1396 | 1396 |
1397 // Swap in the contents for the new tab. | 1397 // Swap in the contents for the new tab. |
1398 [self swapInTabAtIndex:modelIndex]; | 1398 [self swapInTabAtIndex:modelIndex]; |
1399 | 1399 |
1400 if (newContents) { | 1400 if (newContents) { |
1401 newContents->WasShown(); | 1401 newContents->WasShown(); |
1402 newContents->GetView()->RestoreFocus(); | 1402 newContents->GetView()->RestoreFocus(); |
1403 } | 1403 } |
| 1404 |
| 1405 // The Browser expects a platform-specific TabStripModelObserver to call |
| 1406 // OnActiveTabChanged(). |
| 1407 browser_->OnActiveTabChanged(oldContents, newContents, modelIndex, reason); |
1404 } | 1408 } |
1405 | 1409 |
1406 - (void)tabReplacedWithContents:(content::WebContents*)newContents | 1410 - (void)tabReplacedWithContents:(content::WebContents*)newContents |
1407 previousContents:(content::WebContents*)oldContents | 1411 previousContents:(content::WebContents*)oldContents |
1408 atIndex:(NSInteger)modelIndex { | 1412 atIndex:(NSInteger)modelIndex { |
1409 NSInteger index = [self indexFromModelIndex:modelIndex]; | 1413 NSInteger index = [self indexFromModelIndex:modelIndex]; |
1410 TabContentsController* oldController = | 1414 TabContentsController* oldController = |
1411 [tabContentsArray_ objectAtIndex:index]; | 1415 [tabContentsArray_ objectAtIndex:index]; |
1412 DCHECK_EQ(oldContents, [oldController webContents]); | 1416 DCHECK_EQ(oldContents, [oldController webContents]); |
1413 | 1417 |
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2309 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) { | 2313 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) { |
2310 // View hierarchy of the contents view: | 2314 // View hierarchy of the contents view: |
2311 // NSView -- switchView, same for all tabs | 2315 // NSView -- switchView, same for all tabs |
2312 // +- NSView -- TabContentsController's view | 2316 // +- NSView -- TabContentsController's view |
2313 // +- TabContentsViewCocoa | 2317 // +- TabContentsViewCocoa |
2314 // | 2318 // |
2315 // Changing it? Do not forget to modify | 2319 // Changing it? Do not forget to modify |
2316 // -[TabStripController swapInTabAtIndex:] too. | 2320 // -[TabStripController swapInTabAtIndex:] too. |
2317 return [web_contents->GetView()->GetNativeView() superview]; | 2321 return [web_contents->GetView()->GetNativeView() superview]; |
2318 } | 2322 } |
OLD | NEW |