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 24 matching lines...) Expand all Loading... | |
35 #include "chrome/browser/ui/chrome_style.h" | 35 #include "chrome/browser/ui/chrome_style.h" |
36 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 36 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
37 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 37 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
38 #import "chrome/browser/ui/cocoa/hyperlink_text_view.h" | 38 #import "chrome/browser/ui/cocoa/hyperlink_text_view.h" |
39 #import "chrome/browser/ui/cocoa/info_bubble_view.h" | 39 #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
40 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | 40 #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
41 #import "chrome/browser/ui/cocoa/profiles/user_manager_mac.h" | 41 #import "chrome/browser/ui/cocoa/profiles/user_manager_mac.h" |
42 #include "chrome/browser/ui/singleton_tabs.h" | 42 #include "chrome/browser/ui/singleton_tabs.h" |
43 #include "chrome/common/pref_names.h" | 43 #include "chrome/common/pref_names.h" |
44 #include "chrome/common/url_constants.h" | 44 #include "chrome/common/url_constants.h" |
45 #include "components/signin/core/common/profile_management_switches.h" | |
46 #include "components/signin/core/browser/mutable_profile_oauth2_token_service.h" | 45 #include "components/signin/core/browser/mutable_profile_oauth2_token_service.h" |
47 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 46 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
48 #include "components/signin/core/browser/signin_manager.h" | 47 #include "components/signin/core/browser/signin_manager.h" |
48 #include "components/signin/core/common/profile_management_switches.h" | |
49 #include "content/public/browser/notification_service.h" | 49 #include "content/public/browser/notification_service.h" |
50 #include "content/public/browser/web_contents.h" | 50 #include "content/public/browser/web_contents.h" |
51 #include "google_apis/gaia/oauth2_token_service.h" | 51 #include "google_apis/gaia/oauth2_token_service.h" |
52 #include "grit/chromium_strings.h" | 52 #include "grit/chromium_strings.h" |
53 #include "grit/generated_resources.h" | 53 #include "grit/generated_resources.h" |
54 #include "grit/theme_resources.h" | 54 #include "grit/theme_resources.h" |
55 #include "skia/ext/skia_utils_mac.h" | 55 #include "skia/ext/skia_utils_mac.h" |
56 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw eaker.h" | 56 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw eaker.h" |
57 #import "ui/base/cocoa/cocoa_base_utils.h" | 57 #import "ui/base/cocoa/cocoa_base_utils.h" |
58 #import "ui/base/cocoa/controls/blue_label_button.h" | 58 #import "ui/base/cocoa/controls/blue_label_button.h" |
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
854 // Creates a generic link button with |title| and an |action| positioned at | 854 // Creates a generic link button with |title| and an |action| positioned at |
855 // |frameOrigin|. | 855 // |frameOrigin|. |
856 - (NSButton*)linkButtonWithTitle:(NSString*)title | 856 - (NSButton*)linkButtonWithTitle:(NSString*)title |
857 frameOrigin:(NSPoint)frameOrigin | 857 frameOrigin:(NSPoint)frameOrigin |
858 action:(SEL)action; | 858 action:(SEL)action; |
859 | 859 |
860 // Creates an email account button with |title| and a remove icon. If | 860 // Creates an email account button with |title| and a remove icon. If |
861 // |reauthRequired| is true, the button also displays a warning icon. |tag| | 861 // |reauthRequired| is true, the button also displays a warning icon. |tag| |
862 // indicates which account the button refers to. | 862 // indicates which account the button refers to. |
863 - (NSButton*)accountButtonWithRect:(NSRect)rect | 863 - (NSButton*)accountButtonWithRect:(NSRect)rect |
864 title:(const std::string&)title | 864 account_id:(const std::string&)account_id |
Alexei Svitkine (slow)
2014/08/26 01:04:44
Nit: accountId change on both sides of :.
Roger Tawa OOO till Jul 10th
2014/08/26 19:25:12
Done.
| |
865 tag:(int)tag | 865 tag:(int)tag |
866 reauthRequired:(BOOL)reauthRequired; | 866 reauthRequired:(BOOL)reauthRequired; |
867 | 867 |
868 - (bool)shouldShowGoIncognito; | 868 - (bool)shouldShowGoIncognito; |
869 @end | 869 @end |
870 | 870 |
871 @implementation ProfileChooserController | 871 @implementation ProfileChooserController |
872 - (profiles::BubbleViewMode) viewMode { | 872 - (profiles::BubbleViewMode) viewMode { |
873 return viewMode_; | 873 return viewMode_; |
874 } | 874 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
919 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN]; | 919 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN]; |
920 } | 920 } |
921 | 921 |
922 - (IBAction)addAccount:(id)sender { | 922 - (IBAction)addAccount:(id)sender { |
923 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT]; | 923 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT]; |
924 [self postActionPerformed:ProfileMetrics::PROFILE_DESKTOP_MENU_ADD_ACCT]; | 924 [self postActionPerformed:ProfileMetrics::PROFILE_DESKTOP_MENU_ADD_ACCT]; |
925 } | 925 } |
926 | 926 |
927 - (IBAction)navigateBackFromSigninPage:(id)sender { | 927 - (IBAction)navigateBackFromSigninPage:(id)sender { |
928 std::string primaryAccount = SigninManagerFactory::GetForProfile( | 928 std::string primaryAccount = SigninManagerFactory::GetForProfile( |
929 browser_->profile())->GetAuthenticatedUsername(); | 929 browser_->profile())->GetAuthenticatedAccountId(); |
930 bool hasAccountManagement = !primaryAccount.empty() && | 930 bool hasAccountManagement = !primaryAccount.empty() && |
931 switches::IsEnableAccountConsistency(); | 931 switches::IsEnableAccountConsistency(); |
932 [self initMenuContentsWithView:hasAccountManagement ? | 932 [self initMenuContentsWithView:hasAccountManagement ? |
933 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT : | 933 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT : |
934 profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER]; | 934 profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER]; |
935 } | 935 } |
936 | 936 |
937 - (IBAction)showAccountRemovalView:(id)sender { | 937 - (IBAction)showAccountRemovalView:(id)sender { |
938 DCHECK(!isGuestSession_); | 938 DCHECK(!isGuestSession_); |
939 | 939 |
940 // Tag is either |kPrimaryProfileTag| for the primary account, or equal to the | 940 // Tag is either |kPrimaryProfileTag| for the primary account, or equal to the |
941 // index in |currentProfileAccounts_| for a secondary account. | 941 // index in |currentProfileAccounts_| for a secondary account. |
942 int tag = [sender tag]; | 942 int tag = [sender tag]; |
943 if (tag == kPrimaryProfileTag) { | 943 if (tag == kPrimaryProfileTag) { |
944 accountIdToRemove_ = SigninManagerFactory::GetForProfile( | 944 accountIdToRemove_ = SigninManagerFactory::GetForProfile( |
945 browser_->profile())->GetAuthenticatedUsername(); | 945 browser_->profile())->GetAuthenticatedAccountId(); |
946 } else { | 946 } else { |
947 DCHECK(ContainsKey(currentProfileAccounts_, tag)); | 947 DCHECK(ContainsKey(currentProfileAccounts_, tag)); |
948 accountIdToRemove_ = currentProfileAccounts_[tag]; | 948 accountIdToRemove_ = currentProfileAccounts_[tag]; |
949 } | 949 } |
950 | 950 |
951 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_ACCOUNT_REMOVAL]; | 951 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_ACCOUNT_REMOVAL]; |
952 } | 952 } |
953 | 953 |
954 - (IBAction)showAccountReauthenticationView:(id)sender { | 954 - (IBAction)showAccountReauthenticationView:(id)sender { |
955 DCHECK(!isGuestSession_); | 955 DCHECK(!isGuestSession_); |
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1782 NSMaxY([accountEmails frame]))]; | 1782 NSMaxY([accountEmails frame]))]; |
1783 return container.autorelease(); | 1783 return container.autorelease(); |
1784 } | 1784 } |
1785 | 1785 |
1786 - (NSView*)createAccountsListWithRect:(NSRect)rect { | 1786 - (NSView*)createAccountsListWithRect:(NSRect)rect { |
1787 base::scoped_nsobject<NSView> container([[NSView alloc] initWithFrame:rect]); | 1787 base::scoped_nsobject<NSView> container([[NSView alloc] initWithFrame:rect]); |
1788 currentProfileAccounts_.clear(); | 1788 currentProfileAccounts_.clear(); |
1789 | 1789 |
1790 Profile* profile = browser_->profile(); | 1790 Profile* profile = browser_->profile(); |
1791 std::string primaryAccount = | 1791 std::string primaryAccount = |
1792 SigninManagerFactory::GetForProfile(profile)->GetAuthenticatedUsername(); | 1792 SigninManagerFactory::GetForProfile(profile)->GetAuthenticatedAccountId(); |
1793 DCHECK(!primaryAccount.empty()); | 1793 DCHECK(!primaryAccount.empty()); |
1794 std::vector<std::string>accounts = | 1794 std::vector<std::string>accounts = |
1795 profiles::GetSecondaryAccountsForProfile(profile, primaryAccount); | 1795 profiles::GetSecondaryAccountsForProfile(profile, primaryAccount); |
1796 | 1796 |
1797 // If there is an account with an authentication error, it needs to be | 1797 // If there is an account with an authentication error, it needs to be |
1798 // badged with a warning icon. | 1798 // badged with a warning icon. |
1799 const SigninErrorController* errorController = | 1799 const SigninErrorController* errorController = |
1800 profiles::GetSigninErrorController(profile); | 1800 profiles::GetSigninErrorController(profile); |
1801 std::string errorAccountId = | 1801 std::string errorAccountId = |
1802 errorController ? errorController->error_account_id() : std::string(); | 1802 errorController ? errorController->error_account_id() : std::string(); |
1803 | 1803 |
1804 rect.origin.y = 0; | 1804 rect.origin.y = 0; |
1805 for (size_t i = 0; i < accounts.size(); ++i) { | 1805 for (size_t i = 0; i < accounts.size(); ++i) { |
1806 // Save the original email address, as the button text could be elided. | 1806 // Save the original email address, as the button text could be elided. |
1807 currentProfileAccounts_[i] = accounts[i]; | 1807 currentProfileAccounts_[i] = accounts[i]; |
1808 NSButton* accountButton = | 1808 NSButton* accountButton = |
1809 [self accountButtonWithRect:rect | 1809 [self accountButtonWithRect:rect |
1810 title:accounts[i] | 1810 account_id:accounts[i] |
1811 tag:i | 1811 tag:i |
1812 reauthRequired:errorAccountId == accounts[i]]; | 1812 reauthRequired:errorAccountId == accounts[i]]; |
1813 [container addSubview:accountButton]; | 1813 [container addSubview:accountButton]; |
1814 rect.origin.y = NSMaxY([accountButton frame]); | 1814 rect.origin.y = NSMaxY([accountButton frame]); |
1815 } | 1815 } |
1816 | 1816 |
1817 // The primary account should always be listed first. | 1817 // The primary account should always be listed first. |
1818 NSButton* accountButton = | 1818 NSButton* accountButton = |
1819 [self accountButtonWithRect:rect | 1819 [self accountButtonWithRect:rect |
1820 title:primaryAccount | 1820 account_id:primaryAccount |
1821 tag:kPrimaryProfileTag | 1821 tag:kPrimaryProfileTag |
1822 reauthRequired:errorAccountId == primaryAccount]; | 1822 reauthRequired:errorAccountId == primaryAccount]; |
1823 [container addSubview:accountButton]; | 1823 [container addSubview:accountButton]; |
1824 [container setFrameSize:NSMakeSize(NSWidth([container frame]), | 1824 [container setFrameSize:NSMakeSize(NSWidth([container frame]), |
1825 NSMaxY([accountButton frame]))]; | 1825 NSMaxY([accountButton frame]))]; |
1826 return container.autorelease(); | 1826 return container.autorelease(); |
1827 } | 1827 } |
1828 | 1828 |
1829 - (NSView*)buildGaiaEmbeddedView { | 1829 - (NSView*)buildGaiaEmbeddedView { |
1830 base::scoped_nsobject<NSView> container( | 1830 base::scoped_nsobject<NSView> container( |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1892 - (NSView*)buildAccountRemovalView { | 1892 - (NSView*)buildAccountRemovalView { |
1893 DCHECK(!accountIdToRemove_.empty()); | 1893 DCHECK(!accountIdToRemove_.empty()); |
1894 | 1894 |
1895 base::scoped_nsobject<NSView> container( | 1895 base::scoped_nsobject<NSView> container( |
1896 [[NSView alloc] initWithFrame:NSZeroRect]); | 1896 [[NSView alloc] initWithFrame:NSZeroRect]); |
1897 CGFloat availableWidth = | 1897 CGFloat availableWidth = |
1898 kFixedAccountRemovalViewWidth - 2 * kHorizontalSpacing; | 1898 kFixedAccountRemovalViewWidth - 2 * kHorizontalSpacing; |
1899 CGFloat yOffset = kVerticalSpacing; | 1899 CGFloat yOffset = kVerticalSpacing; |
1900 | 1900 |
1901 const std::string& primaryAccount = SigninManagerFactory::GetForProfile( | 1901 const std::string& primaryAccount = SigninManagerFactory::GetForProfile( |
1902 browser_->profile())->GetAuthenticatedUsername(); | 1902 browser_->profile())->GetAuthenticatedAccountId(); |
1903 bool isPrimaryAccount = primaryAccount == accountIdToRemove_; | 1903 bool isPrimaryAccount = primaryAccount == accountIdToRemove_; |
1904 | 1904 |
1905 // Adds "remove account" button at the bottom if needed. | 1905 // Adds "remove account" button at the bottom if needed. |
1906 if (!isPrimaryAccount) { | 1906 if (!isPrimaryAccount) { |
1907 base::scoped_nsobject<NSButton> removeAccountButton( | 1907 base::scoped_nsobject<NSButton> removeAccountButton( |
1908 [[BlueLabelButton alloc] initWithFrame:NSZeroRect]); | 1908 [[BlueLabelButton alloc] initWithFrame:NSZeroRect]); |
1909 [removeAccountButton setTitle:l10n_util::GetNSString( | 1909 [removeAccountButton setTitle:l10n_util::GetNSString( |
1910 IDS_PROFILES_ACCOUNT_REMOVAL_BUTTON)]; | 1910 IDS_PROFILES_ACCOUNT_REMOVAL_BUTTON)]; |
1911 [removeAccountButton setTarget:self]; | 1911 [removeAccountButton setTarget:self]; |
1912 [removeAccountButton setAction:@selector(removeAccount:)]; | 1912 [removeAccountButton setAction:@selector(removeAccount:)]; |
1913 [removeAccountButton sizeToFit]; | 1913 [removeAccountButton sizeToFit]; |
1914 [removeAccountButton setAlignment:NSCenterTextAlignment]; | 1914 [removeAccountButton setAlignment:NSCenterTextAlignment]; |
1915 CGFloat xOffset = (kFixedAccountRemovalViewWidth - | 1915 CGFloat xOffset = (kFixedAccountRemovalViewWidth - |
1916 NSWidth([removeAccountButton frame])) / 2; | 1916 NSWidth([removeAccountButton frame])) / 2; |
1917 [removeAccountButton setFrameOrigin:NSMakePoint(xOffset, yOffset)]; | 1917 [removeAccountButton setFrameOrigin:NSMakePoint(xOffset, yOffset)]; |
1918 [container addSubview:removeAccountButton]; | 1918 [container addSubview:removeAccountButton]; |
1919 | 1919 |
1920 yOffset = NSMaxY([removeAccountButton frame]) + kVerticalSpacing; | 1920 yOffset = NSMaxY([removeAccountButton frame]) + kVerticalSpacing; |
1921 } | 1921 } |
1922 | 1922 |
1923 NSView* contentView; | 1923 NSView* contentView; |
1924 NSPoint contentFrameOrigin = NSMakePoint(kHorizontalSpacing, yOffset); | 1924 NSPoint contentFrameOrigin = NSMakePoint(kHorizontalSpacing, yOffset); |
1925 if (isPrimaryAccount) { | 1925 if (isPrimaryAccount) { |
1926 std::string email = signin_ui_util::GetDisplayEmail(browser_->profile(), | |
1927 accountIdToRemove_); | |
1926 std::vector<size_t> offsets; | 1928 std::vector<size_t> offsets; |
1927 NSString* contentStr = l10n_util::GetNSStringF( | 1929 NSString* contentStr = l10n_util::GetNSStringF( |
1928 IDS_PROFILES_PRIMARY_ACCOUNT_REMOVAL_TEXT, | 1930 IDS_PROFILES_PRIMARY_ACCOUNT_REMOVAL_TEXT, |
1929 base::UTF8ToUTF16(accountIdToRemove_), base::string16(), &offsets); | 1931 base::UTF8ToUTF16(email), base::string16(), &offsets); |
1930 NSString* linkStr = l10n_util::GetNSString(IDS_PROFILES_SETTINGS_LINK); | 1932 NSString* linkStr = l10n_util::GetNSString(IDS_PROFILES_SETTINGS_LINK); |
1931 contentView = BuildFixedWidthTextViewWithLink(self, contentStr, linkStr, | 1933 contentView = BuildFixedWidthTextViewWithLink(self, contentStr, linkStr, |
1932 offsets[1], contentFrameOrigin, availableWidth); | 1934 offsets[1], contentFrameOrigin, availableWidth); |
1933 } else { | 1935 } else { |
1934 NSString* contentStr = | 1936 NSString* contentStr = |
1935 l10n_util::GetNSString(IDS_PROFILES_ACCOUNT_REMOVAL_TEXT); | 1937 l10n_util::GetNSString(IDS_PROFILES_ACCOUNT_REMOVAL_TEXT); |
1936 NSTextField* contentLabel = BuildLabel(contentStr, contentFrameOrigin, nil); | 1938 NSTextField* contentLabel = BuildLabel(contentStr, contentFrameOrigin, nil); |
1937 [contentLabel setFrameSize:NSMakeSize(availableWidth, 0)]; | 1939 [contentLabel setFrameSize:NSMakeSize(availableWidth, 0)]; |
1938 [GTMUILocalizerAndLayoutTweaker sizeToFitFixedWidthTextField:contentLabel]; | 1940 [GTMUILocalizerAndLayoutTweaker sizeToFitFixedWidthTextField:contentLabel]; |
1939 contentView = contentLabel; | 1941 contentView = contentLabel; |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2082 [link setFont:[NSFont labelFontOfSize:kTextFontSize]]; | 2084 [link setFont:[NSFont labelFontOfSize:kTextFontSize]]; |
2083 [link setTarget:self]; | 2085 [link setTarget:self]; |
2084 [link setAction:action]; | 2086 [link setAction:action]; |
2085 [link setFrameOrigin:frameOrigin]; | 2087 [link setFrameOrigin:frameOrigin]; |
2086 [link sizeToFit]; | 2088 [link sizeToFit]; |
2087 | 2089 |
2088 return link.autorelease(); | 2090 return link.autorelease(); |
2089 } | 2091 } |
2090 | 2092 |
2091 - (NSButton*)accountButtonWithRect:(NSRect)rect | 2093 - (NSButton*)accountButtonWithRect:(NSRect)rect |
2092 title:(const std::string&)title | 2094 account_id:(const std::string&)account_id |
2093 tag:(int)tag | 2095 tag:(int)tag |
2094 reauthRequired:(BOOL)reauthRequired { | 2096 reauthRequired:(BOOL)reauthRequired { |
2097 // Get display email address for account. | |
2098 std::string email = signin_ui_util::GetDisplayEmail(browser_->profile(), | |
2099 account_id); | |
2100 | |
2095 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | 2101 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
2096 NSImage* deleteImage = rb->GetNativeImageNamed(IDR_CLOSE_1).ToNSImage(); | 2102 NSImage* deleteImage = rb->GetNativeImageNamed(IDR_CLOSE_1).ToNSImage(); |
2097 CGFloat deleteImageWidth = [deleteImage size].width; | 2103 CGFloat deleteImageWidth = [deleteImage size].width; |
2098 NSImage* warningImage = reauthRequired ? rb->GetNativeImageNamed( | 2104 NSImage* warningImage = reauthRequired ? rb->GetNativeImageNamed( |
2099 IDR_ICON_PROFILES_ACCOUNT_BUTTON_ERROR).ToNSImage() : nil; | 2105 IDR_ICON_PROFILES_ACCOUNT_BUTTON_ERROR).ToNSImage() : nil; |
2100 CGFloat warningImageWidth = [warningImage size].width; | 2106 CGFloat warningImageWidth = [warningImage size].width; |
2101 | 2107 |
2102 CGFloat availableTextWidth = rect.size.width - kHorizontalSpacing - | 2108 CGFloat availableTextWidth = rect.size.width - kHorizontalSpacing - |
2103 warningImageWidth - deleteImageWidth; | 2109 warningImageWidth - deleteImageWidth; |
2104 if (warningImage) | 2110 if (warningImage) |
2105 availableTextWidth -= kHorizontalSpacing; | 2111 availableTextWidth -= kHorizontalSpacing; |
2106 | 2112 |
2107 NSColor* backgroundColor = gfx::SkColorToCalibratedNSColor( | 2113 NSColor* backgroundColor = gfx::SkColorToCalibratedNSColor( |
2108 profiles::kAvatarBubbleAccountsBackgroundColor); | 2114 profiles::kAvatarBubbleAccountsBackgroundColor); |
2109 base::scoped_nsobject<BackgroundColorHoverButton> button( | 2115 base::scoped_nsobject<BackgroundColorHoverButton> button( |
2110 [[BackgroundColorHoverButton alloc] initWithFrame:rect | 2116 [[BackgroundColorHoverButton alloc] initWithFrame:rect |
2111 imageTitleSpacing:0 | 2117 imageTitleSpacing:0 |
2112 backgroundColor:backgroundColor]); | 2118 backgroundColor:backgroundColor]); |
2113 [button setTitle:ElideEmail(title, availableTextWidth)]; | 2119 [button setTitle:ElideEmail(email, availableTextWidth)]; |
2114 [button setAlignment:NSLeftTextAlignment]; | 2120 [button setAlignment:NSLeftTextAlignment]; |
2115 [button setBordered:NO]; | 2121 [button setBordered:NO]; |
2116 if (reauthRequired) { | 2122 if (reauthRequired) { |
2117 [button setDefaultImage:warningImage]; | 2123 [button setDefaultImage:warningImage]; |
2118 [button setImagePosition:NSImageLeft]; | 2124 [button setImagePosition:NSImageLeft]; |
2119 [button setTarget:self]; | 2125 [button setTarget:self]; |
2120 [button setAction:@selector(showAccountReauthenticationView:)]; | 2126 [button setAction:@selector(showAccountReauthenticationView:)]; |
2121 [button setTag:tag]; | 2127 [button setTag:tag]; |
2122 } | 2128 } |
2123 | 2129 |
(...skipping 28 matching lines...) Expand all Loading... | |
2152 } | 2158 } |
2153 | 2159 |
2154 - (bool)shouldShowGoIncognito { | 2160 - (bool)shouldShowGoIncognito { |
2155 bool incognitoAvailable = | 2161 bool incognitoAvailable = |
2156 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 2162 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
2157 IncognitoModePrefs::DISABLED; | 2163 IncognitoModePrefs::DISABLED; |
2158 return incognitoAvailable && !browser_->profile()->IsGuestSession(); | 2164 return incognitoAvailable && !browser_->profile()->IsGuestSession(); |
2159 } | 2165 } |
2160 | 2166 |
2161 @end | 2167 @end |
OLD | NEW |