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 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 NSString* denyButtonText = | |
| 264 SysUTF16ToNSString( | |
| 265 exclusive_access_bubble::GetDenyButtonTextForType(bubbleType_)); | |
|
felt
2015/01/22 23:46:52
It looks like this is providing a bubbleType_ on t
Jialiu Lin
2015/01/23 22:55:47
Done.
| |
| 266 [denyButton_ setTitle: denyButtonText]; | |
| 261 } | 267 } |
| 262 | 268 |
| 263 - (NSString*)getLabelText { | 269 - (NSString*)getLabelText { |
| 264 if (bubbleType_ == EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE) | 270 if (bubbleType_ == EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE) |
| 265 return @""; | 271 return @""; |
| 266 extensions::ExtensionRegistry* registry = | 272 extensions::ExtensionRegistry* registry = |
| 267 extensions::ExtensionRegistry::Get(browser_->profile()); | 273 extensions::ExtensionRegistry::Get(browser_->profile()); |
| 268 return SysUTF16ToNSString(exclusive_access_bubble::GetLabelTextForType( | 274 return SysUTF16ToNSString(exclusive_access_bubble::GetLabelTextForType( |
| 269 bubbleType_, url_, registry)); | 275 bubbleType_, url_, registry)); |
| 270 } | 276 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 323 - (void)hideSoon { | 329 - (void)hideSoon { |
| 324 hideTimer_.reset( | 330 hideTimer_.reset( |
| 325 [[NSTimer scheduledTimerWithTimeInterval:kInitialDelay | 331 [[NSTimer scheduledTimerWithTimeInterval:kInitialDelay |
| 326 target:self | 332 target:self |
| 327 selector:@selector(hideTimerFired:) | 333 selector:@selector(hideTimerFired:) |
| 328 userInfo:nil | 334 userInfo:nil |
| 329 repeats:NO] retain]); | 335 repeats:NO] retain]); |
| 330 } | 336 } |
| 331 | 337 |
| 332 @end | 338 @end |
| OLD | NEW |