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 | 7 |
7 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h" | 8 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h" |
8 | 9 |
9 #include "base/mac/bundle_locations.h" | 10 #include "base/mac/bundle_locations.h" |
10 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
11 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
12 #include "base/strings/sys_string_conversions.h" | 13 #include "base/strings/sys_string_conversions.h" |
13 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
14 #include "chrome/app/chrome_command_ids.h" | 15 #include "chrome/app/chrome_command_ids.h" |
15 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
788 NSColor* backgroundColor = isHighlighted ? hoverColor_ : backgroundColor_; | 789 NSColor* backgroundColor = isHighlighted ? hoverColor_ : backgroundColor_; |
789 [[self cell] setBackgroundColor:backgroundColor]; | 790 [[self cell] setBackgroundColor:backgroundColor]; |
790 } | 791 } |
791 | 792 |
792 - (BOOL)canBecomeKeyView { | 793 - (BOOL)canBecomeKeyView { |
793 return YES; | 794 return YES; |
794 } | 795 } |
795 | 796 |
796 @end | 797 @end |
797 | 798 |
799 // Wrapper for a BackgroundColorHoverButton so that the button can be activated | |
800 // on enter, to match the behaviour on Windows. | |
801 @interface BackgroundColorHoverButtonContainer : NSView { | |
groby-ooo-7-16
2015/02/02 21:57:33
Why not just subclass BackgroundColorHoverButton,
noms (inactive)
2015/02/02 23:01:05
Ah, duh. I misunderstood my old CL when I tried to
| |
802 @private | |
803 NSButton* button_; | |
804 } | |
805 | |
806 - (id)initWithFrame:(NSRect)frame | |
807 button:(NSButton*)button; | |
808 @end | |
809 | |
810 @implementation BackgroundColorHoverButtonContainer | |
811 - (id)initWithFrame:(NSRect)frame | |
812 button:(NSButton*)button { | |
813 if ((self = [super initWithFrame:frame])) { | |
814 button_ = button; | |
815 [self addSubview:button_]; | |
816 } | |
817 return self; | |
818 } | |
819 | |
820 -(void)keyDown:(NSEvent*)event { | |
821 // On enter, activate the wrapped button. | |
groby-ooo-7-16
2015/02/02 21:57:33
Do we care about the state of modifier keys? Menus
noms (inactive)
2015/02/02 23:01:05
I don't think we do, nope.
| |
822 if ([event keyCode] == kVK_Return) | |
823 [button_ performClick:self]; | |
824 else | |
825 [super keyDown:event]; | |
826 } | |
827 | |
828 @end | |
829 | |
798 // A custom view with the given background color. | 830 // A custom view with the given background color. |
799 @interface BackgroundColorView : NSView { | 831 @interface BackgroundColorView : NSView { |
800 @private | 832 @private |
801 base::scoped_nsobject<NSColor> backgroundColor_; | 833 base::scoped_nsobject<NSColor> backgroundColor_; |
802 } | 834 } |
803 @end | 835 @end |
804 | 836 |
805 @implementation BackgroundColorView | 837 @implementation BackgroundColorView |
806 - (id)initWithFrame:(NSRect)frameRect | 838 - (id)initWithFrame:(NSRect)frameRect |
807 withColor:(NSColor*)color { | 839 withColor:(NSColor*)color { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
880 | 912 |
881 // Creates the disclaimer text for supervised users, telling them that the | 913 // Creates the disclaimer text for supervised users, telling them that the |
882 // manager can view their history etc. | 914 // manager can view their history etc. |
883 - (NSView*)createSupervisedUserDisclaimerView; | 915 - (NSView*)createSupervisedUserDisclaimerView; |
884 | 916 |
885 // Creates a main profile card for the guest user. | 917 // Creates a main profile card for the guest user. |
886 - (NSView*)createGuestProfileView; | 918 - (NSView*)createGuestProfileView; |
887 | 919 |
888 // Creates an item for the profile |itemIndex| that is used in the fast profile | 920 // Creates an item for the profile |itemIndex| that is used in the fast profile |
889 // switcher in the middle of the bubble. | 921 // switcher in the middle of the bubble. |
890 - (NSButton*)createOtherProfileView:(int)itemIndex; | 922 - (NSView*)createOtherProfileView:(int)itemIndex; |
891 | 923 |
892 // Creates the "Not you" and Lock option buttons. | 924 // Creates the "Not you" and Lock option buttons. |
893 - (NSView*)createOptionsViewWithRect:(NSRect)rect | 925 - (NSView*)createOptionsViewWithRect:(NSRect)rect |
894 displayLock:(BOOL)displayLock; | 926 displayLock:(BOOL)displayLock; |
895 | 927 |
896 // Creates the account management view for the active profile. | 928 // Creates the account management view for the active profile. |
897 - (NSView*)createCurrentProfileAccountsView:(NSRect)rect; | 929 - (NSView*)createCurrentProfileAccountsView:(NSRect)rect; |
898 | 930 |
899 // Creates the list of accounts for the active profile. | 931 // Creates the list of accounts for the active profile. |
900 - (NSView*)createAccountsListWithRect:(NSRect)rect; | 932 - (NSView*)createAccountsListWithRect:(NSRect)rect; |
901 | 933 |
902 // Creates the Gaia sign-in/add account view. | 934 // Creates the Gaia sign-in/add account view. |
903 - (NSView*)buildGaiaEmbeddedView; | 935 - (NSView*)buildGaiaEmbeddedView; |
904 | 936 |
905 // Creates the account removal view. | 937 // Creates the account removal view. |
906 - (NSView*)buildAccountRemovalView; | 938 - (NSView*)buildAccountRemovalView; |
907 | 939 |
908 // Create a view that shows various options for an upgrade user who is not | 940 // Create a view that shows various options for an upgrade user who is not |
909 // the same person as the currently signed in user. | 941 // the same person as the currently signed in user. |
910 - (NSView*)buildSwitchUserView; | 942 - (NSView*)buildSwitchUserView; |
911 | 943 |
912 // Creates a button with |text|, an icon given by |imageResourceId| and with | 944 // Creates a button with |text|, an icon given by |imageResourceId| and with |
913 // |action|. | 945 // |action|. |
914 - (NSButton*)hoverButtonWithRect:(NSRect)rect | 946 - (NSView*)hoverButtonWithRect:(NSRect)rect |
915 text:(NSString*)text | 947 text:(NSString*)text |
916 imageResourceId:(int)imageResourceId | 948 imageResourceId:(int)imageResourceId |
917 action:(SEL)action; | 949 action:(SEL)action; |
918 | 950 |
919 // Creates a generic link button with |title| and an |action| positioned at | 951 // Creates a generic link button with |title| and an |action| positioned at |
920 // |frameOrigin|. | 952 // |frameOrigin|. |
921 - (NSButton*)linkButtonWithTitle:(NSString*)title | 953 - (NSButton*)linkButtonWithTitle:(NSString*)title |
922 frameOrigin:(NSPoint)frameOrigin | 954 frameOrigin:(NSPoint)frameOrigin |
923 action:(SEL)action; | 955 action:(SEL)action; |
924 | 956 |
925 // Creates an email account button with |title| and a remove icon. If | 957 // Creates an email account button with |title| and a remove icon. If |
926 // |reauthRequired| is true, the button also displays a warning icon. |tag| | 958 // |reauthRequired| is true, the button also displays a warning icon. |tag| |
927 // indicates which account the button refers to. | 959 // indicates which account the button refers to. |
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1753 AvatarMenu::Item guestItem(std::string::npos, /* menu_index, not used */ | 1785 AvatarMenu::Item guestItem(std::string::npos, /* menu_index, not used */ |
1754 std::string::npos, /* profile_index, not used */ | 1786 std::string::npos, /* profile_index, not used */ |
1755 guestIcon); | 1787 guestIcon); |
1756 guestItem.active = true; | 1788 guestItem.active = true; |
1757 guestItem.name = base::SysNSStringToUTF16( | 1789 guestItem.name = base::SysNSStringToUTF16( |
1758 l10n_util::GetNSString(IDS_PROFILES_GUEST_PROFILE_NAME)); | 1790 l10n_util::GetNSString(IDS_PROFILES_GUEST_PROFILE_NAME)); |
1759 | 1791 |
1760 return [self createCurrentProfileView:guestItem]; | 1792 return [self createCurrentProfileView:guestItem]; |
1761 } | 1793 } |
1762 | 1794 |
1763 - (NSButton*)createOtherProfileView:(int)itemIndex { | 1795 - (NSView*)createOtherProfileView:(int)itemIndex { |
1764 const AvatarMenu::Item& item = avatarMenu_->GetItemAt(itemIndex); | 1796 const AvatarMenu::Item& item = avatarMenu_->GetItemAt(itemIndex); |
1765 | 1797 |
1766 NSRect rect = NSMakeRect( | 1798 NSRect rect = NSMakeRect( |
1767 0, 0, kFixedMenuWidth, kBlueButtonHeight + kSmallVerticalSpacing); | 1799 0, 0, kFixedMenuWidth, kBlueButtonHeight + kSmallVerticalSpacing); |
1768 base::scoped_nsobject<BackgroundColorHoverButton> profileButton( | 1800 base::scoped_nsobject<BackgroundColorHoverButton> profileButton( |
1769 [[BackgroundColorHoverButton alloc] | 1801 [[BackgroundColorHoverButton alloc] |
1770 initWithFrame:rect | 1802 initWithFrame:NSMakeRect(0, 0, rect.size.width, rect.size.height) |
1771 imageTitleSpacing:kImageTitleSpacing | 1803 imageTitleSpacing:kImageTitleSpacing |
1772 backgroundColor:GetDialogBackgroundColor()]); | 1804 backgroundColor:GetDialogBackgroundColor()]); |
1773 [profileButton setTitle:base::SysUTF16ToNSString(item.name)]; | 1805 [profileButton setTitle:base::SysUTF16ToNSString(item.name)]; |
1774 [profileButton setDefaultImage:CreateProfileImage( | 1806 [profileButton setDefaultImage:CreateProfileImage( |
1775 item.icon, kSmallImageSide).ToNSImage()]; | 1807 item.icon, kSmallImageSide).ToNSImage()]; |
1776 [profileButton setImagePosition:NSImageLeft]; | 1808 [profileButton setImagePosition:NSImageLeft]; |
1777 [profileButton setAlignment:NSLeftTextAlignment]; | 1809 [profileButton setAlignment:NSLeftTextAlignment]; |
1778 [profileButton setBordered:NO]; | 1810 [profileButton setBordered:NO]; |
1779 [profileButton setTag:itemIndex]; | 1811 [profileButton setTag:itemIndex]; |
1780 [profileButton setTarget:self]; | 1812 [profileButton setTarget:self]; |
1781 [profileButton setAction:@selector(switchToProfile:)]; | 1813 [profileButton setAction:@selector(switchToProfile:)]; |
1782 | 1814 |
1783 return profileButton.autorelease(); | 1815 base::scoped_nsobject<BackgroundColorHoverButtonContainer> container( |
1816 [[BackgroundColorHoverButtonContainer alloc] | |
1817 initWithFrame:rect | |
1818 button:profileButton]); | |
1819 return container.autorelease(); | |
1784 } | 1820 } |
1785 | 1821 |
1786 - (NSView*)createOptionsViewWithRect:(NSRect)rect | 1822 - (NSView*)createOptionsViewWithRect:(NSRect)rect |
1787 displayLock:(BOOL)displayLock { | 1823 displayLock:(BOOL)displayLock { |
1788 NSRect viewRect = NSMakeRect(0, 0, | 1824 NSRect viewRect = NSMakeRect(0, 0, |
1789 rect.size.width, | 1825 rect.size.width, |
1790 kBlueButtonHeight + kSmallVerticalSpacing); | 1826 kBlueButtonHeight + kSmallVerticalSpacing); |
1791 base::scoped_nsobject<NSView> container([[NSView alloc] initWithFrame:rect]); | 1827 base::scoped_nsobject<NSView> container([[NSView alloc] initWithFrame:rect]); |
1792 | 1828 |
1793 if (displayLock) { | 1829 if (displayLock) { |
1794 NSButton* lockButton = | 1830 NSView* lockButton = |
1795 [self hoverButtonWithRect:viewRect | 1831 [self hoverButtonWithRect:viewRect |
1796 text:l10n_util::GetNSString( | 1832 text:l10n_util::GetNSString( |
1797 IDS_PROFILES_PROFILE_SIGNOUT_BUTTON) | 1833 IDS_PROFILES_PROFILE_SIGNOUT_BUTTON) |
1798 imageResourceId:IDR_ICON_PROFILES_MENU_LOCK | 1834 imageResourceId:IDR_ICON_PROFILES_MENU_LOCK |
1799 action:@selector(lockProfile:)]; | 1835 action:@selector(lockProfile:)]; |
1800 [container addSubview:lockButton]; | 1836 [container addSubview:lockButton]; |
1801 viewRect.origin.y = NSMaxY([lockButton frame]); | 1837 viewRect.origin.y = NSMaxY([lockButton frame]); |
1802 | 1838 |
1803 NSBox* separator = [self horizontalSeparatorWithFrame:viewRect]; | 1839 NSBox* separator = [self horizontalSeparatorWithFrame:viewRect]; |
1804 [container addSubview:separator]; | 1840 [container addSubview:separator]; |
1805 viewRect.origin.y = NSMaxY([separator frame]); | 1841 viewRect.origin.y = NSMaxY([separator frame]); |
1806 } | 1842 } |
1807 | 1843 |
1808 if ([self shouldShowGoIncognito]) { | 1844 if ([self shouldShowGoIncognito]) { |
1809 NSButton* goIncognitoButton = | 1845 NSView* goIncognitoButton = |
1810 [self hoverButtonWithRect:viewRect | 1846 [self hoverButtonWithRect:viewRect |
1811 text:l10n_util::GetNSString( | 1847 text:l10n_util::GetNSString( |
1812 IDS_PROFILES_GO_INCOGNITO_BUTTON) | 1848 IDS_PROFILES_GO_INCOGNITO_BUTTON) |
1813 imageResourceId:IDR_ICON_PROFILES_MENU_INCOGNITO | 1849 imageResourceId:IDR_ICON_PROFILES_MENU_INCOGNITO |
1814 action:@selector(goIncognito:)]; | 1850 action:@selector(goIncognito:)]; |
1815 viewRect.origin.y = NSMaxY([goIncognitoButton frame]); | 1851 viewRect.origin.y = NSMaxY([goIncognitoButton frame]); |
1816 [container addSubview:goIncognitoButton]; | 1852 [container addSubview:goIncognitoButton]; |
1817 | 1853 |
1818 NSBox* separator = [self horizontalSeparatorWithFrame:viewRect]; | 1854 NSBox* separator = [self horizontalSeparatorWithFrame:viewRect]; |
1819 [container addSubview:separator]; | 1855 [container addSubview:separator]; |
1820 viewRect.origin.y = NSMaxY([separator frame]); | 1856 viewRect.origin.y = NSMaxY([separator frame]); |
1821 } | 1857 } |
1822 | 1858 |
1823 NSString* text = isGuestSession_ ? | 1859 NSString* text = isGuestSession_ ? |
1824 l10n_util::GetNSString(IDS_PROFILES_EXIT_GUEST) : | 1860 l10n_util::GetNSString(IDS_PROFILES_EXIT_GUEST) : |
1825 l10n_util::GetNSString(IDS_PROFILES_SWITCH_USERS_BUTTON); | 1861 l10n_util::GetNSString(IDS_PROFILES_SWITCH_USERS_BUTTON); |
1826 NSButton* switchUsersButton = | 1862 NSView* switchUsersButton = |
1827 [self hoverButtonWithRect:viewRect | 1863 [self hoverButtonWithRect:viewRect |
1828 text:text | 1864 text:text |
1829 imageResourceId:IDR_ICON_PROFILES_MENU_AVATAR | 1865 imageResourceId:IDR_ICON_PROFILES_MENU_AVATAR |
1830 action:isGuestSession_? @selector(exitGuest:) : | 1866 action:isGuestSession_? @selector(exitGuest:) : |
1831 @selector(showUserManager:)]; | 1867 @selector(showUserManager:)]; |
1832 viewRect.origin.y = NSMaxY([switchUsersButton frame]); | 1868 viewRect.origin.y = NSMaxY([switchUsersButton frame]); |
1833 [container addSubview:switchUsersButton]; | 1869 [container addSubview:switchUsersButton]; |
1834 | 1870 |
1835 [container setFrameSize:NSMakeSize(rect.size.width, viewRect.origin.y)]; | 1871 [container setFrameSize:NSMakeSize(rect.size.width, viewRect.origin.y)]; |
1836 return container.autorelease(); | 1872 return container.autorelease(); |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2071 kFixedSwitchUserViewWidth - 2 * kHorizontalSpacing; | 2107 kFixedSwitchUserViewWidth - 2 * kHorizontalSpacing; |
2072 CGFloat yOffset = 0; | 2108 CGFloat yOffset = 0; |
2073 NSRect viewRect = NSMakeRect(0, yOffset, | 2109 NSRect viewRect = NSMakeRect(0, yOffset, |
2074 kFixedSwitchUserViewWidth, | 2110 kFixedSwitchUserViewWidth, |
2075 kBlueButtonHeight + kSmallVerticalSpacing); | 2111 kBlueButtonHeight + kSmallVerticalSpacing); |
2076 | 2112 |
2077 const AvatarMenu::Item& avatarItem = | 2113 const AvatarMenu::Item& avatarItem = |
2078 avatarMenu_->GetItemAt(avatarMenu_->GetActiveProfileIndex()); | 2114 avatarMenu_->GetItemAt(avatarMenu_->GetActiveProfileIndex()); |
2079 | 2115 |
2080 // Adds "Disconnect your Google Account" button at the bottom. | 2116 // Adds "Disconnect your Google Account" button at the bottom. |
2081 NSButton* disconnectButton = | 2117 NSView* disconnectButton = |
2082 [self hoverButtonWithRect:viewRect | 2118 [self hoverButtonWithRect:viewRect |
2083 text:l10n_util::GetNSString( | 2119 text:l10n_util::GetNSString( |
2084 IDS_PROFILES_DISCONNECT_BUTTON) | 2120 IDS_PROFILES_DISCONNECT_BUTTON) |
2085 imageResourceId:IDR_ICON_PROFILES_MENU_DISCONNECT | 2121 imageResourceId:IDR_ICON_PROFILES_MENU_DISCONNECT |
2086 action:@selector(disconnectProfile:)]; | 2122 action:@selector(disconnectProfile:)]; |
2087 [container addSubview:disconnectButton]; | 2123 [container addSubview:disconnectButton]; |
2088 yOffset = NSMaxY([disconnectButton frame]); | 2124 yOffset = NSMaxY([disconnectButton frame]); |
2089 | 2125 |
2090 NSBox* separator = [self horizontalSeparatorWithFrame: | 2126 NSBox* separator = [self horizontalSeparatorWithFrame: |
2091 NSMakeRect(0, yOffset, kFixedSwitchUserViewWidth, 0)]; | 2127 NSMakeRect(0, yOffset, kFixedSwitchUserViewWidth, 0)]; |
2092 [container addSubview:separator]; | 2128 [container addSubview:separator]; |
2093 yOffset = NSMaxY([separator frame]); | 2129 yOffset = NSMaxY([separator frame]); |
2094 | 2130 |
2095 // Adds "Add person" button. | 2131 // Adds "Add person" button. |
2096 viewRect.origin.y = yOffset; | 2132 viewRect.origin.y = yOffset; |
2097 NSButton* addPersonButton = | 2133 NSView* addPersonButton = |
2098 [self hoverButtonWithRect:viewRect | 2134 [self hoverButtonWithRect:viewRect |
2099 text:l10n_util::GetNSString( | 2135 text:l10n_util::GetNSString( |
2100 IDS_PROFILES_ADD_PERSON_BUTTON) | 2136 IDS_PROFILES_ADD_PERSON_BUTTON) |
2101 imageResourceId:IDR_ICON_PROFILES_MENU_AVATAR | 2137 imageResourceId:IDR_ICON_PROFILES_MENU_AVATAR |
2102 action:@selector(showUserManager:)]; | 2138 action:@selector(showUserManager:)]; |
2103 [container addSubview:addPersonButton]; | 2139 [container addSubview:addPersonButton]; |
2104 yOffset = NSMaxY([addPersonButton frame]); | 2140 yOffset = NSMaxY([addPersonButton frame]); |
2105 | 2141 |
2106 separator = [self horizontalSeparatorWithFrame: | 2142 separator = [self horizontalSeparatorWithFrame: |
2107 NSMakeRect(0, yOffset, kFixedSwitchUserViewWidth, 0)]; | 2143 NSMakeRect(0, yOffset, kFixedSwitchUserViewWidth, 0)]; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2139 } | 2175 } |
2140 | 2176 |
2141 // Called when clicked on the settings link. | 2177 // Called when clicked on the settings link. |
2142 - (BOOL)textView:(NSTextView*)textView | 2178 - (BOOL)textView:(NSTextView*)textView |
2143 clickedOnLink:(id)link | 2179 clickedOnLink:(id)link |
2144 atIndex:(NSUInteger)charIndex { | 2180 atIndex:(NSUInteger)charIndex { |
2145 chrome::ShowSettings(browser_); | 2181 chrome::ShowSettings(browser_); |
2146 return YES; | 2182 return YES; |
2147 } | 2183 } |
2148 | 2184 |
2149 - (NSButton*)hoverButtonWithRect:(NSRect)rect | 2185 - (NSView*)hoverButtonWithRect:(NSRect)rect |
2150 text:(NSString*)text | 2186 text:(NSString*)text |
2151 imageResourceId:(int)imageResourceId | 2187 imageResourceId:(int)imageResourceId |
2152 action:(SEL)action { | 2188 action:(SEL)action { |
2153 base::scoped_nsobject<BackgroundColorHoverButton> button( | 2189 base::scoped_nsobject<BackgroundColorHoverButton> button( |
2154 [[BackgroundColorHoverButton alloc] | 2190 [[BackgroundColorHoverButton alloc] |
2155 initWithFrame:rect | 2191 initWithFrame:NSMakeRect(0, 0, rect.size.width, rect.size.height) |
2156 imageTitleSpacing:kImageTitleSpacing | 2192 imageTitleSpacing:kImageTitleSpacing |
2157 backgroundColor:GetDialogBackgroundColor()]); | 2193 backgroundColor:GetDialogBackgroundColor()]); |
2158 | 2194 |
2159 [button setTitle:text]; | 2195 [button setTitle:text]; |
2160 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | 2196 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
2161 NSImage* image = rb->GetNativeImageNamed(imageResourceId).ToNSImage(); | 2197 NSImage* image = rb->GetNativeImageNamed(imageResourceId).ToNSImage(); |
2162 [button setDefaultImage:image]; | 2198 [button setDefaultImage:image]; |
2163 [button setHoverImage:image]; | 2199 [button setHoverImage:image]; |
2164 [button setPressedImage:image]; | 2200 [button setPressedImage:image]; |
2165 [button setImagePosition:NSImageLeft]; | 2201 [button setImagePosition:NSImageLeft]; |
2166 [button setAlignment:NSLeftTextAlignment]; | 2202 [button setAlignment:NSLeftTextAlignment]; |
2167 [button setBordered:NO]; | 2203 [button setBordered:NO]; |
2168 [button setTarget:self]; | 2204 [button setTarget:self]; |
2169 [button setAction:action]; | 2205 [button setAction:action]; |
2170 | 2206 |
2171 return button.autorelease(); | 2207 base::scoped_nsobject<BackgroundColorHoverButtonContainer> container( |
2208 [[BackgroundColorHoverButtonContainer alloc] | |
2209 initWithFrame:rect | |
2210 button:button]); | |
2211 | |
2212 return container.autorelease(); | |
2172 } | 2213 } |
2173 | 2214 |
2174 - (NSButton*)linkButtonWithTitle:(NSString*)title | 2215 - (NSButton*)linkButtonWithTitle:(NSString*)title |
2175 frameOrigin:(NSPoint)frameOrigin | 2216 frameOrigin:(NSPoint)frameOrigin |
2176 action:(SEL)action { | 2217 action:(SEL)action { |
2177 base::scoped_nsobject<NSButton> link( | 2218 base::scoped_nsobject<NSButton> link( |
2178 [[HyperlinkButtonCell buttonWithString:title] retain]); | 2219 [[HyperlinkButtonCell buttonWithString:title] retain]); |
2179 | 2220 |
2180 [[link cell] setShouldUnderline:NO]; | 2221 [[link cell] setShouldUnderline:NO]; |
2181 [[link cell] setTextColor:gfx::SkColorToCalibratedNSColor( | 2222 [[link cell] setTextColor:gfx::SkColorToCalibratedNSColor( |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2259 } | 2300 } |
2260 | 2301 |
2261 - (bool)shouldShowGoIncognito { | 2302 - (bool)shouldShowGoIncognito { |
2262 bool incognitoAvailable = | 2303 bool incognitoAvailable = |
2263 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 2304 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
2264 IncognitoModePrefs::DISABLED; | 2305 IncognitoModePrefs::DISABLED; |
2265 return incognitoAvailable && !browser_->profile()->IsGuestSession(); | 2306 return incognitoAvailable && !browser_->profile()->IsGuestSession(); |
2266 } | 2307 } |
2267 | 2308 |
2268 @end | 2309 @end |
OLD | NEW |