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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
251 [exitLabel_ setFrameSize:windowFrame.size]; | 251 [exitLabel_ setFrameSize:windowFrame.size]; |
252 NSLayoutManager* layoutManager = [exitLabel_ layoutManager]; | 252 NSLayoutManager* layoutManager = [exitLabel_ layoutManager]; |
253 NSTextContainer* textContainer = [exitLabel_ textContainer]; | 253 NSTextContainer* textContainer = [exitLabel_ textContainer]; |
254 [layoutManager ensureLayoutForTextContainer:textContainer]; | 254 [layoutManager ensureLayoutForTextContainer:textContainer]; |
255 NSRect textFrame = [layoutManager usedRectForTextContainer:textContainer]; | 255 NSRect textFrame = [layoutManager usedRectForTextContainer:textContainer]; |
256 | 256 |
257 textFrame.size.width = ceil(NSWidth(textFrame)); | 257 textFrame.size.width = ceil(NSWidth(textFrame)); |
258 labelFrame.origin.x += NSWidth(labelFrame) - NSWidth(textFrame); | 258 labelFrame.origin.x += NSWidth(labelFrame) - NSWidth(textFrame); |
259 labelFrame.size = textFrame.size; | 259 labelFrame.size = textFrame.size; |
260 [exitLabel_ setFrame:labelFrame]; | 260 [exitLabel_ setFrame:labelFrame]; |
261 | |
262 // Update the title of denyButton_ according to the current bubbleType_ | |
263 if (bubbleType_ == EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_BUTTONS || | |
264 bubbleType_ == | |
265 EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_MOUSELOCK_BUTTONS || | |
266 bubbleType_ == EXCLUSIVE_ACCESS_BUBBLE_TYPE_MOUSELOCK_BUTTONS) { | |
267 NSString* denyButtonText = | |
268 SysUTF16ToNSString( | |
269 exclusive_access_bubble::GetDenyButtonTextForType(bubbleType_)); | |
270 [denyButton_ setTitle: denyButtonText]; | |
Avi (use Gerrit)
2015/01/27 19:27:12
no space after :
Jialiu Lin
2015/01/27 19:51:09
Done.
| |
271 } | |
261 } | 272 } |
262 | 273 |
263 - (NSString*)getLabelText { | 274 - (NSString*)getLabelText { |
264 if (bubbleType_ == EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE) | 275 if (bubbleType_ == EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE) |
265 return @""; | 276 return @""; |
266 extensions::ExtensionRegistry* registry = | 277 extensions::ExtensionRegistry* registry = |
267 extensions::ExtensionRegistry::Get(browser_->profile()); | 278 extensions::ExtensionRegistry::Get(browser_->profile()); |
268 return SysUTF16ToNSString(exclusive_access_bubble::GetLabelTextForType( | 279 return SysUTF16ToNSString(exclusive_access_bubble::GetLabelTextForType( |
269 bubbleType_, url_, registry)); | 280 bubbleType_, url_, registry)); |
270 } | 281 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
323 - (void)hideSoon { | 334 - (void)hideSoon { |
324 hideTimer_.reset( | 335 hideTimer_.reset( |
325 [[NSTimer scheduledTimerWithTimeInterval:kInitialDelay | 336 [[NSTimer scheduledTimerWithTimeInterval:kInitialDelay |
326 target:self | 337 target:self |
327 selector:@selector(hideTimerFired:) | 338 selector:@selector(hideTimerFired:) |
328 userInfo:nil | 339 userInfo:nil |
329 repeats:NO] retain]); | 340 repeats:NO] retain]); |
330 } | 341 } |
331 | 342 |
332 @end | 343 @end |
OLD | NEW |