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 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1261 | 1261 |
1262 - (void)tabReplacedWithContents:(TabContentsWrapper*)newContents | 1262 - (void)tabReplacedWithContents:(TabContentsWrapper*)newContents |
1263 previousContents:(TabContentsWrapper*)oldContents | 1263 previousContents:(TabContentsWrapper*)oldContents |
1264 atIndex:(NSInteger)modelIndex { | 1264 atIndex:(NSInteger)modelIndex { |
1265 NSInteger index = [self indexFromModelIndex:modelIndex]; | 1265 NSInteger index = [self indexFromModelIndex:modelIndex]; |
1266 TabContentsController* oldController = | 1266 TabContentsController* oldController = |
1267 [tabContentsArray_ objectAtIndex:index]; | 1267 [tabContentsArray_ objectAtIndex:index]; |
1268 DCHECK_EQ(oldContents->tab_contents(), [oldController tabContents]); | 1268 DCHECK_EQ(oldContents->tab_contents(), [oldController tabContents]); |
1269 | 1269 |
1270 // Simply create a new TabContentsController for |newContents| and place it | 1270 // Simply create a new TabContentsController for |newContents| and place it |
1271 // into the array, replacing |oldContents|. A TabSelectedAt notification will | 1271 // into the array, replacing |oldContents|. A ActiveTabChanged notification |
1272 // follow, at which point we will install the new view. | 1272 // will follow, at which point we will install the new view. |
1273 scoped_nsobject<TabContentsController> newController( | 1273 scoped_nsobject<TabContentsController> newController( |
1274 [[TabContentsController alloc] | 1274 [[TabContentsController alloc] |
1275 initWithContents:newContents->tab_contents() | 1275 initWithContents:newContents->tab_contents() |
1276 delegate:self]); | 1276 delegate:self]); |
1277 | 1277 |
1278 // Bye bye, |oldController|. | 1278 // Bye bye, |oldController|. |
1279 [tabContentsArray_ replaceObjectAtIndex:index withObject:newController]; | 1279 [tabContentsArray_ replaceObjectAtIndex:index withObject:newController]; |
1280 | 1280 |
1281 [delegate_ onReplaceTabWithContents:newContents->tab_contents()]; | 1281 [delegate_ onReplaceTabWithContents:newContents->tab_contents()]; |
1282 | 1282 |
(...skipping 845 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 |