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 #import <Carbon/Carbon.h> // kVK_Return. | 6 #import <Carbon/Carbon.h> // kVK_Return. |
7 | 7 |
8 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h" | 8 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h" |
9 | 9 |
10 #include "base/mac/bundle_locations.h" | 10 #include "base/mac/bundle_locations.h" |
(...skipping 1688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1699 viewMode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER ? | 1699 viewMode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER ? |
1700 IDS_PROFILES_PROFILE_MANAGE_ACCOUNTS_BUTTON : | 1700 IDS_PROFILES_PROFILE_MANAGE_ACCOUNTS_BUTTON : |
1701 IDS_PROFILES_PROFILE_HIDE_MANAGE_ACCOUNTS_BUTTON); | 1701 IDS_PROFILES_PROFILE_HIDE_MANAGE_ACCOUNTS_BUTTON); |
1702 SEL linkSelector = | 1702 SEL linkSelector = |
1703 (viewMode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) ? | 1703 (viewMode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) ? |
1704 @selector(showAccountManagement:) : @selector(hideAccountManagement:); | 1704 @selector(showAccountManagement:) : @selector(hideAccountManagement:); |
1705 link = [self linkButtonWithTitle:linkTitle | 1705 link = [self linkButtonWithTitle:linkTitle |
1706 frameOrigin:rect.origin | 1706 frameOrigin:rect.origin |
1707 action:linkSelector]; | 1707 action:linkSelector]; |
1708 } else { | 1708 } else { |
1709 link = [self linkButtonWithTitle:base::SysUTF16ToNSString(item.sync_state) | 1709 link = [self linkButtonWithTitle:base::SysUTF16ToNSString(item.username) |
1710 frameOrigin:rect.origin | 1710 frameOrigin:rect.origin |
1711 action:nil]; | 1711 action:nil]; |
1712 if (HasAuthError(browser_->profile())) { | 1712 if (HasAuthError(browser_->profile())) { |
1713 [link setImage:ui::ResourceBundle::GetSharedInstance(). | 1713 [link setImage:ui::ResourceBundle::GetSharedInstance(). |
1714 GetNativeImageNamed(IDR_ICON_PROFILES_ACCOUNT_BUTTON_ERROR). | 1714 GetNativeImageNamed(IDR_ICON_PROFILES_ACCOUNT_BUTTON_ERROR). |
1715 ToNSImage()]; | 1715 ToNSImage()]; |
1716 [link setImagePosition:NSImageRight]; | 1716 [link setImagePosition:NSImageRight]; |
1717 [link setTarget:self]; | 1717 [link setTarget:self]; |
1718 [link setAction:@selector(showAccountReauthenticationView:)]; | 1718 [link setAction:@selector(showAccountReauthenticationView:)]; |
1719 [link setTag:kPrimaryProfileTag]; | 1719 [link setTag:kPrimaryProfileTag]; |
1720 [[link cell] | 1720 [[link cell] |
1721 accessibilitySetOverrideValue:l10n_util::GetNSStringF( | 1721 accessibilitySetOverrideValue:l10n_util::GetNSStringF( |
1722 IDS_PROFILES_ACCOUNT_BUTTON_AUTH_ERROR_ACCESSIBLE_NAME, | 1722 IDS_PROFILES_ACCOUNT_BUTTON_AUTH_ERROR_ACCESSIBLE_NAME, |
1723 item.sync_state) | 1723 item.username) |
1724 forAttribute:NSAccessibilityTitleAttribute]; | 1724 forAttribute:NSAccessibilityTitleAttribute]; |
1725 } else { | 1725 } else { |
1726 [link setEnabled:NO]; | 1726 [link setEnabled:NO]; |
1727 } | 1727 } |
1728 } | 1728 } |
1729 // -linkButtonWithTitle sizeToFit's the link. We can use the height, but | 1729 // -linkButtonWithTitle sizeToFit's the link. We can use the height, but |
1730 // need to re-stretch the width so that the link can be centered correctly | 1730 // need to re-stretch the width so that the link can be centered correctly |
1731 // in the view. | 1731 // in the view. |
1732 rect.size.height = [link frame].size.height; | 1732 rect.size.height = [link frame].size.height; |
1733 [link setAlignment:NSCenterTextAlignment]; | 1733 [link setAlignment:NSCenterTextAlignment]; |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2315 } | 2315 } |
2316 | 2316 |
2317 - (bool)shouldShowGoIncognito { | 2317 - (bool)shouldShowGoIncognito { |
2318 bool incognitoAvailable = | 2318 bool incognitoAvailable = |
2319 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 2319 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
2320 IncognitoModePrefs::DISABLED; | 2320 IncognitoModePrefs::DISABLED; |
2321 return incognitoAvailable && !browser_->profile()->IsGuestSession(); | 2321 return incognitoAvailable && !browser_->profile()->IsGuestSession(); |
2322 } | 2322 } |
2323 | 2323 |
2324 @end | 2324 @end |
OLD | NEW |