| 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 NSLayoutManager* layoutManager = [exitLabel_ layoutManager]; | 255 NSLayoutManager* layoutManager = [exitLabel_ layoutManager]; |
| 256 NSTextContainer* textContainer = [exitLabel_ textContainer]; | 256 NSTextContainer* textContainer = [exitLabel_ textContainer]; |
| 257 [layoutManager ensureLayoutForTextContainer:textContainer]; | 257 [layoutManager ensureLayoutForTextContainer:textContainer]; |
| 258 NSRect textFrame = [layoutManager usedRectForTextContainer:textContainer]; | 258 NSRect textFrame = [layoutManager usedRectForTextContainer:textContainer]; |
| 259 | 259 |
| 260 textFrame.size.width = ceil(NSWidth(textFrame)); | 260 textFrame.size.width = ceil(NSWidth(textFrame)); |
| 261 labelFrame.origin.x += NSWidth(labelFrame) - NSWidth(textFrame); | 261 labelFrame.origin.x += NSWidth(labelFrame) - NSWidth(textFrame); |
| 262 labelFrame.size = textFrame.size; | 262 labelFrame.size = textFrame.size; |
| 263 [exitLabel_ setFrame:labelFrame]; | 263 [exitLabel_ setFrame:labelFrame]; |
| 264 | 264 |
| 265 // Update the title of denyButton_ according to the current bubbleType_, | 265 // Update the title of |allowButton_| and |denyButton_| according to the |
| 266 // or show no button at all. | 266 // current |bubbleType_|, or show no button at all. |
| 267 if (exclusive_access_bubble::ShowButtonsForType(bubbleType_)) { | 267 if (exclusive_access_bubble::ShowButtonsForType(bubbleType_)) { |
| 268 NSString* denyButtonText = | 268 NSString* denyButtonText = |
| 269 SysUTF16ToNSString( | 269 SysUTF16ToNSString( |
| 270 exclusive_access_bubble::GetDenyButtonTextForType(bubbleType_)); | 270 exclusive_access_bubble::GetDenyButtonTextForType(bubbleType_)); |
| 271 [denyButton_ setTitle:denyButtonText]; | 271 [denyButton_ setTitle:denyButtonText]; |
| 272 NSString* allowButtonText = SysUTF16ToNSString( |
| 273 exclusive_access_bubble::GetAllowButtonTextForType(bubbleType_, url_)); |
| 274 [allowButton_ setTitle:allowButtonText]; |
| 272 } else { | 275 } else { |
| 273 [self showButtons:NO]; | 276 [self showButtons:NO]; |
| 274 } | 277 } |
| 275 } | 278 } |
| 276 | 279 |
| 277 - (NSString*)getLabelText { | 280 - (NSString*)getLabelText { |
| 278 if (bubbleType_ == EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE) | 281 if (bubbleType_ == EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE) |
| 279 return @""; | 282 return @""; |
| 280 extensions::ExtensionRegistry* registry = | 283 extensions::ExtensionRegistry* registry = |
| 281 extensions::ExtensionRegistry::Get(browser_->profile()); | 284 extensions::ExtensionRegistry::Get(browser_->profile()); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 - (void)hideSoon { | 340 - (void)hideSoon { |
| 338 hideTimer_.reset( | 341 hideTimer_.reset( |
| 339 [[NSTimer scheduledTimerWithTimeInterval:kInitialDelay | 342 [[NSTimer scheduledTimerWithTimeInterval:kInitialDelay |
| 340 target:self | 343 target:self |
| 341 selector:@selector(hideTimerFired:) | 344 selector:@selector(hideTimerFired:) |
| 342 userInfo:nil | 345 userInfo:nil |
| 343 repeats:NO] retain]); | 346 repeats:NO] retain]); |
| 344 } | 347 } |
| 345 | 348 |
| 346 @end | 349 @end |
| OLD | NEW |