Chromium Code Reviews| 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/extensions/extension_installed_bubble_controlle r.h" | 5 #import "chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controlle r.h" |
| 6 | 6 |
| 7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #include "base/mac/bundle_locations.h" | 8 #include "base/mac/bundle_locations.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 437 | 437 |
| 438 int sync_promo_height = 0; | 438 int sync_promo_height = 0; |
| 439 if ([self showSyncPromo]) { | 439 if ([self showSyncPromo]) { |
| 440 // First calculate the height of the sign-in promo. | 440 // First calculate the height of the sign-in promo. |
| 441 NSFont* font = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]; | 441 NSFont* font = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]; |
| 442 | 442 |
| 443 NSString* link(l10n_util::GetNSStringWithFixup( | 443 NSString* link(l10n_util::GetNSStringWithFixup( |
| 444 IDS_EXTENSION_INSTALLED_SIGNIN_PROMO_LINK)); | 444 IDS_EXTENSION_INSTALLED_SIGNIN_PROMO_LINK)); |
| 445 NSString* message(l10n_util::GetNSStringWithFixup( | 445 NSString* message(l10n_util::GetNSStringWithFixup( |
| 446 IDS_EXTENSION_INSTALLED_SIGNIN_PROMO)); | 446 IDS_EXTENSION_INSTALLED_SIGNIN_PROMO)); |
| 447 if ([link length] != 0) { | |
|
Alexei Svitkine (slow)
2015/01/23 18:41:02
When would the link length be 0?
Alexei Svitkine (slow)
2015/01/23 19:14:18
I don't think this error handling is necessary - I
| |
| 448 message = [link stringByAppendingString:message]; | |
| 449 } | |
| 447 | 450 |
| 448 HyperlinkTextView* view = promo_.get(); | 451 HyperlinkTextView* view = promo_.get(); |
| 449 [view setMessageAndLink:message | 452 [view setMessage:message withFont:font messageColor:[NSColor blackColor]]; |
| 450 withLink:link | 453 if ([link length] != 0) { |
|
Alexei Svitkine (slow)
2015/01/23 18:41:01
Ditto.
| |
| 451 atOffset:0 | 454 [view addLinkRange:NSMakeRange(0, [link length]) |
| 452 font:font | 455 withName:@"" |
| 453 messageColor:[NSColor blackColor] | 456 linkColor:gfx::SkColorToCalibratedNSColor( |
| 454 linkColor:gfx::SkColorToCalibratedNSColor( | 457 chrome_style::GetLinkColor())]; |
| 455 chrome_style::GetLinkColor())]; | 458 } |
| 456 | 459 |
| 457 // HACK! The TextView does not report correct height even after you stuff | 460 // HACK! The TextView does not report correct height even after you stuff |
| 458 // it with text (it tells you it is single-line even if it is multiline), so | 461 // it with text (it tells you it is single-line even if it is multiline), so |
| 459 // here the hidden howToUse_ TextField is temporarily repurposed to | 462 // here the hidden howToUse_ TextField is temporarily repurposed to |
| 460 // calculate the correct height for the TextView. | 463 // calculate the correct height for the TextView. |
| 461 [[howToUse_ cell] setAttributedStringValue:[promo_ attributedString]]; | 464 [[howToUse_ cell] setAttributedStringValue:[promo_ attributedString]]; |
| 462 [GTMUILocalizerAndLayoutTweaker | 465 [GTMUILocalizerAndLayoutTweaker |
| 463 sizeToFitFixedWidthTextField:howToUse_]; | 466 sizeToFitFixedWidthTextField:howToUse_]; |
| 464 sync_promo_height = NSHeight([howToUse_ frame]); | 467 sync_promo_height = NSHeight([howToUse_ frame]); |
| 465 } | 468 } |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 697 install_ui->OpenAppInstalledUI(extension_->id()); | 700 install_ui->OpenAppInstalledUI(extension_->id()); |
| 698 } | 701 } |
| 699 | 702 |
| 700 - (void)awakeFromNib { | 703 - (void)awakeFromNib { |
| 701 if (bundle_) | 704 if (bundle_) |
| 702 return; | 705 return; |
| 703 [self initializeLabel]; | 706 [self initializeLabel]; |
| 704 } | 707 } |
| 705 | 708 |
| 706 @end | 709 @end |
| OLD | NEW |