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 11 matching lines...) Expand all Loading... |
22 #include "chrome/browser/autocomplete/autocomplete_match.h" | 22 #include "chrome/browser/autocomplete/autocomplete_match.h" |
23 #include "chrome/browser/debugger/devtools_window.h" | 23 #include "chrome/browser/debugger/devtools_window.h" |
24 #include "chrome/browser/extensions/extension_tab_helper.h" | 24 #include "chrome/browser/extensions/extension_tab_helper.h" |
25 #include "chrome/browser/favicon/favicon_tab_helper.h" | 25 #include "chrome/browser/favicon/favicon_tab_helper.h" |
26 #include "chrome/browser/net/url_fixer_upper.h" | 26 #include "chrome/browser/net/url_fixer_upper.h" |
27 #include "chrome/browser/prefs/pref_service.h" | 27 #include "chrome/browser/prefs/pref_service.h" |
28 #include "chrome/browser/profiles/profile.h" | 28 #include "chrome/browser/profiles/profile.h" |
29 #include "chrome/browser/profiles/profile_manager.h" | 29 #include "chrome/browser/profiles/profile_manager.h" |
30 #include "chrome/browser/ui/browser.h" | 30 #include "chrome/browser/ui/browser.h" |
31 #include "chrome/browser/ui/browser_navigator.h" | 31 #include "chrome/browser/ui/browser_navigator.h" |
| 32 #include "chrome/browser/ui/browser_tabstrip.h" |
32 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 33 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
33 #import "chrome/browser/ui/cocoa/constrained_window_mac.h" | 34 #import "chrome/browser/ui/cocoa/constrained_window_mac.h" |
34 #include "chrome/browser/ui/cocoa/drag_util.h" | 35 #include "chrome/browser/ui/cocoa/drag_util.h" |
35 #import "chrome/browser/ui/cocoa/image_button_cell.h" | 36 #import "chrome/browser/ui/cocoa/image_button_cell.h" |
36 #import "chrome/browser/ui/cocoa/new_tab_button.h" | 37 #import "chrome/browser/ui/cocoa/new_tab_button.h" |
37 #import "chrome/browser/ui/cocoa/tab_contents/favicon_util.h" | 38 #import "chrome/browser/ui/cocoa/tab_contents/favicon_util.h" |
38 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h" | 39 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h" |
39 #import "chrome/browser/ui/cocoa/tabs/tab_controller.h" | 40 #import "chrome/browser/ui/cocoa/tabs/tab_controller.h" |
40 #import "chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.h" | 41 #import "chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.h" |
41 #import "chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.h" | 42 #import "chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.h" |
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1213 // Called when a notification is received from the model to select a particular | 1214 // Called when a notification is received from the model to select a particular |
1214 // tab. Swaps in the toolbar and content area associated with |newContents|. | 1215 // tab. Swaps in the toolbar and content area associated with |newContents|. |
1215 - (void)activateTabWithContents:(TabContents*)newContents | 1216 - (void)activateTabWithContents:(TabContents*)newContents |
1216 previousContents:(TabContents*)oldContents | 1217 previousContents:(TabContents*)oldContents |
1217 atIndex:(NSInteger)modelIndex | 1218 atIndex:(NSInteger)modelIndex |
1218 userGesture:(bool)wasUserGesture { | 1219 userGesture:(bool)wasUserGesture { |
1219 // Take closing tabs into account. | 1220 // Take closing tabs into account. |
1220 NSInteger activeIndex = [self indexFromModelIndex:modelIndex]; | 1221 NSInteger activeIndex = [self indexFromModelIndex:modelIndex]; |
1221 | 1222 |
1222 if (oldContents) { | 1223 if (oldContents) { |
1223 int oldModelIndex = browser_->GetIndexOfController( | 1224 int oldModelIndex = |
1224 &(oldContents->web_contents()->GetController())); | 1225 chrome::GetIndexOfTab(browser_, oldContents->web_contents()); |
1225 if (oldModelIndex != -1) { // When closing a tab, the old tab may be gone. | 1226 if (oldModelIndex != -1) { // When closing a tab, the old tab may be gone. |
1226 NSInteger oldIndex = [self indexFromModelIndex:oldModelIndex]; | 1227 NSInteger oldIndex = [self indexFromModelIndex:oldModelIndex]; |
1227 TabContentsController* oldController = | 1228 TabContentsController* oldController = |
1228 [tabContentsArray_ objectAtIndex:oldIndex]; | 1229 [tabContentsArray_ objectAtIndex:oldIndex]; |
1229 [oldController willBecomeUnselectedTab]; | 1230 [oldController willBecomeUnselectedTab]; |
1230 oldContents->web_contents()->GetView()->StoreFocus(); | 1231 oldContents->web_contents()->GetView()->StoreFocus(); |
1231 oldContents->web_contents()->WasHidden(); | 1232 oldContents->web_contents()->WasHidden(); |
1232 } | 1233 } |
1233 } | 1234 } |
1234 | 1235 |
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2122 NSInteger index = [self indexFromModelIndex:modelIndex]; | 2123 NSInteger index = [self indexFromModelIndex:modelIndex]; |
2123 BrowserWindowController* controller = | 2124 BrowserWindowController* controller = |
2124 (BrowserWindowController*)[[switchView_ window] windowController]; | 2125 (BrowserWindowController*)[[switchView_ window] windowController]; |
2125 DCHECK(index >= 0); | 2126 DCHECK(index >= 0); |
2126 if (index >= 0) { | 2127 if (index >= 0) { |
2127 [controller setTab:[self viewAtIndex:index] isDraggable:YES]; | 2128 [controller setTab:[self viewAtIndex:index] isDraggable:YES]; |
2128 } | 2129 } |
2129 } | 2130 } |
2130 | 2131 |
2131 @end | 2132 @end |
OLD | NEW |