| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/passwords/autosignin_prompt_view_controller.h" | 5 #import "chrome/browser/ui/cocoa/passwords/autosignin_prompt_view_controller.h" |
| 6 | 6 |
| 7 #include <Carbon/Carbon.h> | 7 #include <Carbon/Carbon.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 [_okButton setAction:@selector(onOkClicked:)]; | 119 [_okButton setAction:@selector(onOkClicked:)]; |
| 120 [_okButton setKeyEquivalent:kKeyEquivalentReturn]; | 120 [_okButton setKeyEquivalent:kKeyEquivalentReturn]; |
| 121 [view addSubview:_okButton]; | 121 [view addSubview:_okButton]; |
| 122 | 122 |
| 123 _turnOffButton = BiggerDialogButton( | 123 _turnOffButton = BiggerDialogButton( |
| 124 l10n_util::GetNSString(IDS_AUTO_SIGNIN_FIRST_RUN_TURN_OFF)); | 124 l10n_util::GetNSString(IDS_AUTO_SIGNIN_FIRST_RUN_TURN_OFF)); |
| 125 [_turnOffButton setTarget:self]; | 125 [_turnOffButton setTarget:self]; |
| 126 [_turnOffButton setAction:@selector(onTurnOffClicked:)]; | 126 [_turnOffButton setAction:@selector(onTurnOffClicked:)]; |
| 127 [view addSubview:_turnOffButton]; | 127 [view addSubview:_turnOffButton]; |
| 128 | 128 |
| 129 // Invisible button to handle ESC. | |
| 130 base::scoped_nsobject<NSButton> cancel_button( | |
| 131 [[NSButton alloc] initWithFrame:NSZeroRect]); | |
| 132 [cancel_button setTarget:self]; | |
| 133 [cancel_button setAction:@selector(onEscClicked:)]; | |
| 134 [cancel_button setKeyEquivalent:kKeyEquivalentEscape]; | |
| 135 [view addSubview:cancel_button]; | |
| 136 | |
| 137 // Layout. | 129 // Layout. |
| 138 // Compute the bubble width using the title and the buttons. | 130 // Compute the bubble width using the title and the buttons. |
| 139 const CGFloat contentWidth = kDesiredBubbleWidth; | 131 const CGFloat contentWidth = kDesiredBubbleWidth; |
| 140 CGFloat curX = contentWidth - kFramePadding; | 132 CGFloat curX = contentWidth - kFramePadding; |
| 141 CGFloat curY = kFramePadding; | 133 CGFloat curY = kFramePadding; |
| 142 [_okButton setFrameOrigin:NSMakePoint(curX - NSWidth([_okButton frame]), | 134 [_okButton setFrameOrigin:NSMakePoint(curX - NSWidth([_okButton frame]), |
| 143 curY)]; | 135 curY)]; |
| 144 curX -= (NSWidth([_okButton frame]) + kRelatedControlHorizontalPadding); | 136 curX -= (NSWidth([_okButton frame]) + kRelatedControlHorizontalPadding); |
| 145 [_turnOffButton setFrameOrigin:NSMakePoint( | 137 [_turnOffButton setFrameOrigin:NSMakePoint( |
| 146 curX - NSWidth([_turnOffButton frame]), curY)]; | 138 curX - NSWidth([_turnOffButton frame]), curY)]; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 } | 189 } |
| 198 | 190 |
| 199 - (NSButton*)okButton { | 191 - (NSButton*)okButton { |
| 200 return _okButton; | 192 return _okButton; |
| 201 } | 193 } |
| 202 | 194 |
| 203 - (NSButton*)turnOffButton { | 195 - (NSButton*)turnOffButton { |
| 204 return _turnOffButton; | 196 return _turnOffButton; |
| 205 } | 197 } |
| 206 @end | 198 @end |
| OLD | NEW |