OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/autofill/autofill_account_chooser.h" | 5 #import "chrome/browser/ui/cocoa/autofill/autofill_account_chooser.h" |
6 | 6 |
7 #include "base/strings/sys_string_conversions.h" | 7 #include "base/strings/sys_string_conversions.h" |
8 #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h" | 8 #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h" |
9 #include "chrome/browser/ui/chrome_style.h" | 9 #include "chrome/browser/ui/chrome_style.h" |
10 #include "chrome/browser/ui/cocoa/autofill/autofill_dialog_constants.h" | 10 #include "chrome/browser/ui/cocoa/autofill/autofill_dialog_constants.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 [icon_ setImage:iconImage]; | 100 [icon_ setImage:iconImage]; |
101 | 101 |
102 // Set title. | 102 // Set title. |
103 NSString* popupTitle = | 103 NSString* popupTitle = |
104 base::SysUTF16ToNSString(delegate_->AccountChooserText()); | 104 base::SysUTF16ToNSString(delegate_->AccountChooserText()); |
105 [popup_ setTitle:popupTitle]; | 105 [popup_ setTitle:popupTitle]; |
106 | 106 |
107 NSString* linkTitle = | 107 NSString* linkTitle = |
108 base::SysUTF16ToNSString(delegate_->SignInLinkText()); | 108 base::SysUTF16ToNSString(delegate_->SignInLinkText()); |
109 [link_ setTitle:linkTitle]; | 109 [link_ setTitle:linkTitle]; |
| 110 [link_ setEnabled:!delegate_->ShouldDisableSignInLink()]; |
110 | 111 |
111 // populate menu | 112 // populate menu |
112 NSMenu* accountMenu = [popup_ attachedMenu]; | 113 NSMenu* accountMenu = [popup_ attachedMenu]; |
113 [accountMenu removeAllItems]; | 114 [accountMenu removeAllItems]; |
114 // See menu_button.h for documentation on why this is needed. | 115 // See menu_button.h for documentation on why this is needed. |
115 [accountMenu addItemWithTitle:@"" action:nil keyEquivalent:@""]; | 116 [accountMenu addItemWithTitle:@"" action:nil keyEquivalent:@""]; |
116 ui::MenuModel* model = delegate_->MenuModelForAccountChooser(); | 117 ui::MenuModel* model = delegate_->MenuModelForAccountChooser(); |
117 if (model) { | 118 if (model) { |
118 for (int i = 0; i < model->GetItemCount(); ++i) { | 119 for (int i = 0; i < model->GetItemCount(); ++i) { |
119 AddMenuItem(accountMenu, | 120 AddMenuItem(accountMenu, |
(...skipping 22 matching lines...) Expand all Loading... |
142 frame.origin.x = NSMaxX(bounds) - NSWidth(frame); | 143 frame.origin.x = NSMaxX(bounds) - NSWidth(frame); |
143 [activeControl setFrame:frame]; | 144 [activeControl setFrame:frame]; |
144 | 145 |
145 [icon_ setFrameSize:[[icon_ image] size]]; | 146 [icon_ setFrameSize:[[icon_ image] size]]; |
146 frame.origin.x -= NSWidth([icon_ frame]) + kAroundTextPadding; | 147 frame.origin.x -= NSWidth([icon_ frame]) + kAroundTextPadding; |
147 [icon_ setFrameOrigin:frame.origin]; | 148 [icon_ setFrameOrigin:frame.origin]; |
148 } | 149 } |
149 | 150 |
150 @end | 151 @end |
151 | 152 |
OLD | NEW |