| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 - (NSInteger)numberOfOpenNonMiniTabs; | 168 - (NSInteger)numberOfOpenNonMiniTabs; |
| 169 - (void)mouseMoved:(NSEvent*)event; | 169 - (void)mouseMoved:(NSEvent*)event; |
| 170 - (void)setTabTrackingAreasEnabled:(BOOL)enabled; | 170 - (void)setTabTrackingAreasEnabled:(BOOL)enabled; |
| 171 - (void)droppingURLsAt:(NSPoint)point | 171 - (void)droppingURLsAt:(NSPoint)point |
| 172 givesIndex:(NSInteger*)index | 172 givesIndex:(NSInteger*)index |
| 173 disposition:(WindowOpenDisposition*)disposition; | 173 disposition:(WindowOpenDisposition*)disposition; |
| 174 - (void)setNewTabButtonHoverState:(BOOL)showHover; | 174 - (void)setNewTabButtonHoverState:(BOOL)showHover; |
| 175 - (void)updateCommonTitlePrefix; | 175 - (void)updateCommonTitlePrefix; |
| 176 - (BOOL)shouldShowProfileMenuButton; | 176 - (BOOL)shouldShowProfileMenuButton; |
| 177 - (void)updateProfileMenuButton; | 177 - (void)updateProfileMenuButton; |
| 178 - (void)createNewProfile:(id)sender; | |
| 179 @end | 178 @end |
| 180 | 179 |
| 181 // A simple view class that prevents the Window Server from dragging the area | 180 // A simple view class that prevents the Window Server from dragging the area |
| 182 // behind tabs. Sometimes core animation confuses it. Unfortunately, it can also | 181 // behind tabs. Sometimes core animation confuses it. Unfortunately, it can also |
| 183 // falsely pick up clicks during rapid tab closure, so we have to account for | 182 // falsely pick up clicks during rapid tab closure, so we have to account for |
| 184 // that. | 183 // that. |
| 185 @interface TabStripControllerDragBlockingView : NSView { | 184 @interface TabStripControllerDragBlockingView : NSView { |
| 186 TabStripController* controller_; // weak; owns us | 185 TabStripController* controller_; // weak; owns us |
| 187 } | 186 } |
| 188 | 187 |
| (...skipping 1981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2170 if (![self shouldShowProfileMenuButton]) { | 2169 if (![self shouldShowProfileMenuButton]) { |
| 2171 [profileMenuButton_ setHidden:YES]; | 2170 [profileMenuButton_ setHidden:YES]; |
| 2172 return; | 2171 return; |
| 2173 } | 2172 } |
| 2174 | 2173 |
| 2175 std::string profileName = browser_->profile()->GetPrefs()->GetString( | 2174 std::string profileName = browser_->profile()->GetPrefs()->GetString( |
| 2176 prefs::kGoogleServicesUsername); | 2175 prefs::kGoogleServicesUsername); |
| 2177 [profileMenuButton_ setProfileDisplayName: | 2176 [profileMenuButton_ setProfileDisplayName: |
| 2178 [NSString stringWithUTF8String:profileName.c_str()]]; | 2177 [NSString stringWithUTF8String:profileName.c_str()]]; |
| 2179 [profileMenuButton_ setHidden:NO]; | 2178 [profileMenuButton_ setHidden:NO]; |
| 2180 | |
| 2181 NSMenu* menu = [profileMenuButton_ menu]; | |
| 2182 while ([menu numberOfItems] > 0) { | |
| 2183 [menu removeItemAtIndex:0]; | |
| 2184 } | |
| 2185 | |
| 2186 NSString* menuTitle = | |
| 2187 l10n_util::GetNSStringWithFixup(IDS_PROFILES_CREATE_NEW_PROFILE_OPTION); | |
| 2188 NSMenuItem* menuItem = [menu addItemWithTitle:menuTitle | |
| 2189 action:@selector(createNewProfile:) | |
| 2190 keyEquivalent:@""]; | |
| 2191 [menuItem setState:NSOffState]; | |
| 2192 [menuItem setTarget:self]; | |
| 2193 } | |
| 2194 | |
| 2195 - (void)createNewProfile:(id)sender { | |
| 2196 ProfileManager::CreateMultiProfileAsync(); | |
| 2197 } | 2179 } |
| 2198 | 2180 |
| 2199 @end | 2181 @end |
| OLD | NEW |