OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/confirm_bubble_cocoa.h" | 5 #import "chrome/browser/ui/cocoa/confirm_bubble_cocoa.h" |
6 | 6 |
7 #include "base/strings/string16.h" | 7 #include "base/strings/string16.h" |
8 #include "chrome/browser/themes/theme_service.h" | 8 #include "chrome/browser/themes/theme_service.h" |
9 #import "chrome/browser/ui/cocoa/confirm_bubble_controller.h" | 9 #import "chrome/browser/ui/cocoa/confirm_bubble_controller.h" |
10 #include "chrome/browser/ui/confirm_bubble.h" | 10 #include "chrome/browser/ui/confirm_bubble.h" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 | 208 |
209 // Add the message label (and the link label) to the second row. | 209 // Add the message label (and the link label) to the second row. |
210 left = kButtonHEdgeMargin; | 210 left = kButtonHEdgeMargin; |
211 right = NSWidth(frameRect); | 211 right = NSWidth(frameRect); |
212 bottom += height + kRelatedControlVerticalSpacing; | 212 bottom += height + kRelatedControlVerticalSpacing; |
213 height = 0; | 213 height = 0; |
214 messageLabel_.reset([[ConfirmBubbleTextView alloc] | 214 messageLabel_.reset([[ConfirmBubbleTextView alloc] |
215 initWithFrame:NSMakeRect(left, bottom, kMaxMessageWidth, 0)]); | 215 initWithFrame:NSMakeRect(left, bottom, kMaxMessageWidth, 0)]); |
216 NSString* messageText = [controller_ messageText]; | 216 NSString* messageText = [controller_ messageText]; |
217 NSMutableDictionary* attributes = [NSMutableDictionary dictionary]; | 217 NSMutableDictionary* attributes = [NSMutableDictionary dictionary]; |
218 scoped_nsobject<NSMutableAttributedString> attributedMessage( | 218 base::scoped_nsobject<NSMutableAttributedString> attributedMessage( |
219 [[NSMutableAttributedString alloc] initWithString:messageText | 219 [[NSMutableAttributedString alloc] initWithString:messageText |
220 attributes:attributes]); | 220 attributes:attributes]); |
221 NSString* linkText = [controller_ linkText]; | 221 NSString* linkText = [controller_ linkText]; |
222 if (linkText) { | 222 if (linkText) { |
223 scoped_nsobject<NSAttributedString> whiteSpace( | 223 base::scoped_nsobject<NSAttributedString> whiteSpace( |
224 [[NSAttributedString alloc] initWithString:@" "]); | 224 [[NSAttributedString alloc] initWithString:@" "]); |
225 [attributedMessage.get() appendAttributedString:whiteSpace.get()]; | 225 [attributedMessage.get() appendAttributedString:whiteSpace.get()]; |
226 [attributes setObject:[NSString string] | 226 [attributes setObject:[NSString string] |
227 forKey:NSLinkAttributeName]; | 227 forKey:NSLinkAttributeName]; |
228 scoped_nsobject<NSAttributedString> attributedLink( | 228 base::scoped_nsobject<NSAttributedString> attributedLink( |
229 [[NSAttributedString alloc] initWithString:linkText | 229 [[NSAttributedString alloc] initWithString:linkText |
230 attributes:attributes]); | 230 attributes:attributes]); |
231 [attributedMessage.get() appendAttributedString:attributedLink.get()]; | 231 [attributedMessage.get() appendAttributedString:attributedLink.get()]; |
232 } | 232 } |
233 [[messageLabel_.get() textStorage] setAttributedString:attributedMessage]; | 233 [[messageLabel_.get() textStorage] setAttributedString:attributedMessage]; |
234 [messageLabel_.get() setHorizontallyResizable:NO]; | 234 [messageLabel_.get() setHorizontallyResizable:NO]; |
235 [messageLabel_.get() setVerticallyResizable:YES]; | 235 [messageLabel_.get() setVerticallyResizable:YES]; |
236 [messageLabel_.get() setEditable:NO]; | 236 [messageLabel_.get() setEditable:NO]; |
237 [messageLabel_.get() setDrawsBackground:NO]; | 237 [messageLabel_.get() setDrawsBackground:NO]; |
238 [messageLabel_.get() setDelegate:self]; | 238 [messageLabel_.get() setDelegate:self]; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 | 294 |
295 - (void)clickCancel { | 295 - (void)clickCancel { |
296 [self cancel:self]; | 296 [self cancel:self]; |
297 } | 297 } |
298 | 298 |
299 - (void)clickLink { | 299 - (void)clickLink { |
300 [self textView:messageLabel_.get() clickedOnLink:nil atIndex:0]; | 300 [self textView:messageLabel_.get() clickedOnLink:nil atIndex:0]; |
301 } | 301 } |
302 | 302 |
303 @end | 303 @end |
OLD | NEW |