OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h" | 7 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h" |
8 | 8 |
9 #include "base/mac/bundle_locations.h" | 9 #include "base/mac/bundle_locations.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 - (void)saveProfileName:(id)sender { | 674 - (void)saveProfileName:(id)sender { |
675 base::string16 newProfileName = | 675 base::string16 newProfileName = |
676 base::SysNSStringToUTF16([profileNameTextField_ stringValue]); | 676 base::SysNSStringToUTF16([profileNameTextField_ stringValue]); |
677 | 677 |
678 // Empty profile names are not allowed, and are treated as a cancel. | 678 // Empty profile names are not allowed, and are treated as a cancel. |
679 base::TrimWhitespace(newProfileName, base::TRIM_ALL, &newProfileName); | 679 base::TrimWhitespace(newProfileName, base::TRIM_ALL, &newProfileName); |
680 if (!newProfileName.empty()) { | 680 if (!newProfileName.empty()) { |
681 profiles::UpdateProfileName(profile_, newProfileName); | 681 profiles::UpdateProfileName(profile_, newProfileName); |
682 [controller_ | 682 [controller_ |
683 postActionPerformed:ProfileMetrics::PROFILE_DESKTOP_MENU_EDIT_NAME]; | 683 postActionPerformed:ProfileMetrics::PROFILE_DESKTOP_MENU_EDIT_NAME]; |
684 [self setTitle:base::SysUTF16ToNSString(newProfileName)]; | |
685 } else { | 684 } else { |
686 // Since the text is empty and not allowed, revert it from the textbox. | 685 // Since the text is empty and not allowed, revert it from the textbox. |
687 [profileNameTextField_ setStringValue:[self title]]; | 686 [profileNameTextField_ setStringValue:[self title]]; |
688 } | 687 } |
689 [profileNameTextField_ setHidden:YES]; | 688 [profileNameTextField_ setHidden:YES]; |
690 } | 689 } |
691 | 690 |
692 - (void)showEditableView:(id)sender { | 691 - (void)showEditableView:(id)sender { |
693 [profileNameTextField_ setHidden:NO]; | 692 [profileNameTextField_ setHidden:NO]; |
694 [[self window] makeFirstResponder:profileNameTextField_]; | 693 [[self window] makeFirstResponder:profileNameTextField_]; |
(...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2204 } | 2203 } |
2205 | 2204 |
2206 - (bool)shouldShowGoIncognito { | 2205 - (bool)shouldShowGoIncognito { |
2207 bool incognitoAvailable = | 2206 bool incognitoAvailable = |
2208 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 2207 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
2209 IncognitoModePrefs::DISABLED; | 2208 IncognitoModePrefs::DISABLED; |
2210 return incognitoAvailable && !browser_->profile()->IsGuestSession(); | 2209 return incognitoAvailable && !browser_->profile()->IsGuestSession(); |
2211 } | 2210 } |
2212 | 2211 |
2213 @end | 2212 @end |
OLD | NEW |