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 <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/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 206 initWithFrame:[exitLabelPlaceholder_ frame]]); | 206 initWithFrame:[exitLabelPlaceholder_ frame]]); |
| 207 [exitLabel_.get() | 207 [exitLabel_.get() |
| 208 setAutoresizingMask:[exitLabelPlaceholder_ autoresizingMask]]; | 208 setAutoresizingMask:[exitLabelPlaceholder_ autoresizingMask]]; |
| 209 [exitLabel_.get() setHidden:[exitLabelPlaceholder_ isHidden]]; | 209 [exitLabel_.get() setHidden:[exitLabelPlaceholder_ isHidden]]; |
| 210 [[exitLabelPlaceholder_ superview] replaceSubview:exitLabelPlaceholder_ | 210 [[exitLabelPlaceholder_ superview] replaceSubview:exitLabelPlaceholder_ |
| 211 with:exitLabel_.get()]; | 211 with:exitLabel_.get()]; |
| 212 exitLabelPlaceholder_ = nil; // Now released. | 212 exitLabelPlaceholder_ = nil; // Now released. |
| 213 [exitLabel_.get() setDelegate:self]; | 213 [exitLabel_.get() setDelegate:self]; |
| 214 | 214 |
| 215 NSString* exitLinkText; | 215 NSString* exitLinkText; |
| 216 NSString* exitUnlinkedText; | 216 NSString* exitLinkedText; |
| 217 if (bubbleType_ == | 217 if (bubbleType_ == |
| 218 EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_MOUSELOCK_EXIT_INSTRUCTION || | 218 EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_MOUSELOCK_EXIT_INSTRUCTION || |
| 219 bubbleType_ == EXCLUSIVE_ACCESS_BUBBLE_TYPE_MOUSELOCK_EXIT_INSTRUCTION) { | 219 bubbleType_ == EXCLUSIVE_ACCESS_BUBBLE_TYPE_MOUSELOCK_EXIT_INSTRUCTION) { |
| 220 exitLinkText = @""; | 220 exitLinkText = @""; |
| 221 exitUnlinkedText = | 221 exitLinkedText = |
| 222 [@" " stringByAppendingString:l10n_util::GetNSStringF( | 222 [@" " stringByAppendingString:l10n_util::GetNSStringF( |
| 223 IDS_FULLSCREEN_PRESS_ESC_TO_EXIT, | 223 IDS_FULLSCREEN_PRESS_ESC_TO_EXIT, |
| 224 l10n_util::GetStringUTF16( | 224 l10n_util::GetStringUTF16( |
| 225 IDS_APP_ESC_KEY))]; | 225 IDS_APP_ESC_KEY))]; |
| 226 } else { | 226 } else { |
| 227 exitLinkText = l10n_util::GetNSString(IDS_EXIT_FULLSCREEN_MODE); | 227 exitLinkText = l10n_util::GetNSString(IDS_EXIT_FULLSCREEN_MODE); |
| 228 exitUnlinkedText = | 228 exitLinkedText = [NSString stringWithFormat:@"%@ %@", exitLinkText, |
| 229 [@" " stringByAppendingString:l10n_util::GetNSStringF( | 229 l10n_util::GetNSStringF( |
|
Alexei Svitkine (slow)
2015/01/26 18:11:19
Please make a local var for this part.
| |
| 230 IDS_EXIT_FULLSCREEN_MODE_ACCELERATOR, | 230 IDS_EXIT_FULLSCREEN_MODE_ACCELERATOR, |
| 231 l10n_util::GetStringUTF16( | 231 l10n_util::GetStringUTF16(IDS_APP_ESC_KEY))]; |
| 232 IDS_APP_ESC_KEY))]; | |
| 233 } | 232 } |
| 234 | 233 |
| 235 NSFont* font = [NSFont | 234 NSFont* font = [NSFont |
| 236 systemFontOfSize:[NSFont | 235 systemFontOfSize:[NSFont |
| 237 systemFontSizeForControlSize:NSRegularControlSize]]; | 236 systemFontSizeForControlSize:NSRegularControlSize]]; |
| 238 [(HyperlinkTextView*)exitLabel_.get() setMessageAndLink:exitUnlinkedText | 237 [exitLabel_.get() setMessage:exitLinkedText |
| 239 withLink:exitLinkText | 238 withFont:font |
| 240 atOffset:0 | 239 messageColor:[NSColor blackColor]]; |
| 241 font:font | 240 if ([exitLinkText length] != 0) { |
|
Alexei Svitkine (slow)
2015/01/26 18:11:19
No if?
| |
| 242 messageColor:[NSColor blackColor] | 241 [exitLabel_.get() addLinkRange:NSMakeRange(0, [exitLinkText length]) |
| 243 linkColor:[NSColor blueColor]]; | 242 withName:@"" |
| 243 linkColor:[NSColor blueColor]]; | |
| 244 } | |
| 244 [exitLabel_.get() setAlignment:NSRightTextAlignment]; | 245 [exitLabel_.get() setAlignment:NSRightTextAlignment]; |
| 245 | 246 |
| 246 NSRect labelFrame = [exitLabel_ frame]; | 247 NSRect labelFrame = [exitLabel_ frame]; |
| 247 | 248 |
| 248 // NSTextView's sizeToFit: method seems to enjoy wrapping lines. Temporarily | 249 // NSTextView's sizeToFit: method seems to enjoy wrapping lines. Temporarily |
| 249 // set the size large to force it not to. | 250 // set the size large to force it not to. |
| 250 NSRect windowFrame = [[self window] frame]; | 251 NSRect windowFrame = [[self window] frame]; |
| 251 [exitLabel_ setFrameSize:windowFrame.size]; | 252 [exitLabel_ setFrameSize:windowFrame.size]; |
| 252 NSLayoutManager* layoutManager = [exitLabel_ layoutManager]; | 253 NSLayoutManager* layoutManager = [exitLabel_ layoutManager]; |
| 253 NSTextContainer* textContainer = [exitLabel_ textContainer]; | 254 NSTextContainer* textContainer = [exitLabel_ textContainer]; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 323 - (void)hideSoon { | 324 - (void)hideSoon { |
| 324 hideTimer_.reset( | 325 hideTimer_.reset( |
| 325 [[NSTimer scheduledTimerWithTimeInterval:kInitialDelay | 326 [[NSTimer scheduledTimerWithTimeInterval:kInitialDelay |
| 326 target:self | 327 target:self |
| 327 selector:@selector(hideTimerFired:) | 328 selector:@selector(hideTimerFired:) |
| 328 userInfo:nil | 329 userInfo:nil |
| 329 repeats:NO] retain]); | 330 repeats:NO] retain]); |
| 330 } | 331 } |
| 331 | 332 |
| 332 @end | 333 @end |
| OLD | NEW |