OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <limits> | 9 #include <limits> |
10 #include <string> | 10 #include <string> |
(...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 | 1208 |
1209 // Called when a notification is received from the model to select a particular | 1209 // Called when a notification is received from the model to select a particular |
1210 // tab. Swaps in the toolbar and content area associated with |newContents|. | 1210 // tab. Swaps in the toolbar and content area associated with |newContents|. |
1211 - (void)activateTabWithContents:(TabContentsWrapper*)newContents | 1211 - (void)activateTabWithContents:(TabContentsWrapper*)newContents |
1212 previousContents:(TabContentsWrapper*)oldContents | 1212 previousContents:(TabContentsWrapper*)oldContents |
1213 atIndex:(NSInteger)modelIndex | 1213 atIndex:(NSInteger)modelIndex |
1214 userGesture:(bool)wasUserGesture { | 1214 userGesture:(bool)wasUserGesture { |
1215 // Take closing tabs into account. | 1215 // Take closing tabs into account. |
1216 NSInteger activeIndex = [self indexFromModelIndex:modelIndex]; | 1216 NSInteger activeIndex = [self indexFromModelIndex:modelIndex]; |
1217 | 1217 |
1218 if (oldContents && oldContents != newContents) { | 1218 if (oldContents) { |
1219 int oldModelIndex = | 1219 int oldModelIndex = |
1220 browser_->GetIndexOfController(&(oldContents->controller())); | 1220 browser_->GetIndexOfController(&(oldContents->controller())); |
1221 if (oldModelIndex != -1) { // When closing a tab, the old tab may be gone. | 1221 if (oldModelIndex != -1) { // When closing a tab, the old tab may be gone. |
1222 NSInteger oldIndex = [self indexFromModelIndex:oldModelIndex]; | 1222 NSInteger oldIndex = [self indexFromModelIndex:oldModelIndex]; |
1223 TabContentsController* oldController = | 1223 TabContentsController* oldController = |
1224 [tabContentsArray_ objectAtIndex:oldIndex]; | 1224 [tabContentsArray_ objectAtIndex:oldIndex]; |
1225 [oldController willBecomeUnselectedTab]; | 1225 [oldController willBecomeUnselectedTab]; |
1226 oldContents->view()->StoreFocus(); | 1226 oldContents->view()->StoreFocus(); |
1227 oldContents->tab_contents()->WasHidden(); | 1227 oldContents->tab_contents()->WasHidden(); |
1228 } | 1228 } |
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2136 } | 2136 } |
2137 | 2137 |
2138 std::string profileName = browser_->profile()->GetPrefs()->GetString( | 2138 std::string profileName = browser_->profile()->GetPrefs()->GetString( |
2139 prefs::kGoogleServicesUsername); | 2139 prefs::kGoogleServicesUsername); |
2140 [profileMenuButton_ setProfileDisplayName: | 2140 [profileMenuButton_ setProfileDisplayName: |
2141 [NSString stringWithUTF8String:profileName.c_str()]]; | 2141 [NSString stringWithUTF8String:profileName.c_str()]]; |
2142 [profileMenuButton_ setHidden:NO]; | 2142 [profileMenuButton_ setHidden:NO]; |
2143 } | 2143 } |
2144 | 2144 |
2145 @end | 2145 @end |
OLD | NEW |