OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "base/logging.h" // for NOTREACHED() | 7 #include "base/logging.h" // for NOTREACHED() |
8 #include "base/mac/bundle_locations.h" | 8 #include "base/mac/bundle_locations.h" |
9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 // NSLink attribute on the hyperlink portion of the message. Infobars | 287 // NSLink attribute on the hyperlink portion of the message. Infobars |
288 // use a custom NSTextField subclass, which allows us to override | 288 // use a custom NSTextField subclass, which allows us to override |
289 // textView:clickedOnLink:atIndex: and intercept clicks. | 289 // textView:clickedOnLink:atIndex: and intercept clicks. |
290 // | 290 // |
291 - (void)addAdditionalControls { | 291 - (void)addAdditionalControls { |
292 // No buttons. | 292 // No buttons. |
293 [self removeButtons]; | 293 [self removeButtons]; |
294 | 294 |
295 LinkInfoBarDelegate* delegate = delegate_->AsLinkInfoBarDelegate(); | 295 LinkInfoBarDelegate* delegate = delegate_->AsLinkInfoBarDelegate(); |
296 DCHECK(delegate); | 296 DCHECK(delegate); |
297 size_t offset = std::wstring::npos; | 297 size_t offset = string16::npos; |
298 string16 message = delegate->GetMessageTextWithOffset(&offset); | 298 string16 message = delegate->GetMessageTextWithOffset(&offset); |
299 string16 link = delegate->GetLinkText(); | 299 string16 link = delegate->GetLinkText(); |
300 NSFont* font = [NSFont labelFontOfSize: | 300 NSFont* font = [NSFont labelFontOfSize: |
301 [NSFont systemFontSizeForControlSize:NSRegularControlSize]]; | 301 [NSFont systemFontSizeForControlSize:NSRegularControlSize]]; |
302 HyperlinkTextView* view = (HyperlinkTextView*)label_.get(); | 302 HyperlinkTextView* view = (HyperlinkTextView*)label_.get(); |
303 [view setMessageAndLink:base::SysUTF16ToNSString(message) | 303 [view setMessageAndLink:base::SysUTF16ToNSString(message) |
304 withLink:base::SysUTF16ToNSString(link) | 304 withLink:base::SysUTF16ToNSString(link) |
305 atOffset:offset | 305 atOffset:offset |
306 font:font | 306 font:font |
307 messageColor:[NSColor blackColor] | 307 messageColor:[NSColor blackColor] |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 LinkInfoBarController* controller = | 457 LinkInfoBarController* controller = |
458 [[LinkInfoBarController alloc] initWithDelegate:this owner:owner]; | 458 [[LinkInfoBarController alloc] initWithDelegate:this owner:owner]; |
459 return new InfoBar(controller, this); | 459 return new InfoBar(controller, this); |
460 } | 460 } |
461 | 461 |
462 InfoBar* ConfirmInfoBarDelegate::CreateInfoBar(InfoBarTabHelper* owner) { | 462 InfoBar* ConfirmInfoBarDelegate::CreateInfoBar(InfoBarTabHelper* owner) { |
463 ConfirmInfoBarController* controller = | 463 ConfirmInfoBarController* controller = |
464 [[ConfirmInfoBarController alloc] initWithDelegate:this owner:owner]; | 464 [[ConfirmInfoBarController alloc] initWithDelegate:this owner:owner]; |
465 return new InfoBar(controller, this); | 465 return new InfoBar(controller, this); |
466 } | 466 } |
OLD | NEW |