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 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1200 | 1200 |
1201 // Called when a notification is received from the model to select a particular | 1201 // Called when a notification is received from the model to select a particular |
1202 // tab. Swaps in the toolbar and content area associated with |newContents|. | 1202 // tab. Swaps in the toolbar and content area associated with |newContents|. |
1203 - (void)activateTabWithContents:(TabContentsWrapper*)newContents | 1203 - (void)activateTabWithContents:(TabContentsWrapper*)newContents |
1204 previousContents:(TabContentsWrapper*)oldContents | 1204 previousContents:(TabContentsWrapper*)oldContents |
1205 atIndex:(NSInteger)modelIndex | 1205 atIndex:(NSInteger)modelIndex |
1206 userGesture:(bool)wasUserGesture { | 1206 userGesture:(bool)wasUserGesture { |
1207 // Take closing tabs into account. | 1207 // Take closing tabs into account. |
1208 NSInteger activeIndex = [self indexFromModelIndex:modelIndex]; | 1208 NSInteger activeIndex = [self indexFromModelIndex:modelIndex]; |
1209 | 1209 |
1210 if (oldContents && oldContents != newContents) { | 1210 if (oldContents) { |
1211 int oldModelIndex = | 1211 int oldModelIndex = |
1212 browser_->GetIndexOfController(&(oldContents->controller())); | 1212 browser_->GetIndexOfController(&(oldContents->controller())); |
1213 if (oldModelIndex != -1) { // When closing a tab, the old tab may be gone. | 1213 if (oldModelIndex != -1) { // When closing a tab, the old tab may be gone. |
1214 NSInteger oldIndex = [self indexFromModelIndex:oldModelIndex]; | 1214 NSInteger oldIndex = [self indexFromModelIndex:oldModelIndex]; |
1215 TabContentsController* oldController = | 1215 TabContentsController* oldController = |
1216 [tabContentsArray_ objectAtIndex:oldIndex]; | 1216 [tabContentsArray_ objectAtIndex:oldIndex]; |
1217 [oldController willBecomeUnselectedTab]; | 1217 [oldController willBecomeUnselectedTab]; |
1218 oldContents->view()->StoreFocus(); | 1218 oldContents->view()->StoreFocus(); |
1219 oldContents->tab_contents()->WasHidden(); | 1219 oldContents->tab_contents()->WasHidden(); |
1220 } | 1220 } |
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2128 } | 2128 } |
2129 | 2129 |
2130 std::string profileName = browser_->profile()->GetPrefs()->GetString( | 2130 std::string profileName = browser_->profile()->GetPrefs()->GetString( |
2131 prefs::kGoogleServicesUsername); | 2131 prefs::kGoogleServicesUsername); |
2132 [profileMenuButton_ setProfileDisplayName: | 2132 [profileMenuButton_ setProfileDisplayName: |
2133 [NSString stringWithUTF8String:profileName.c_str()]]; | 2133 [NSString stringWithUTF8String:profileName.c_str()]]; |
2134 [profileMenuButton_ setHidden:NO]; | 2134 [profileMenuButton_ setHidden:NO]; |
2135 } | 2135 } |
2136 | 2136 |
2137 @end | 2137 @end |
OLD | NEW |