| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/website_settings/permission_bubble_controller.h
" | 5 #import "chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.h
" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/mac/bind_objc_block.h" | 9 #include "base/mac/bind_objc_block.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 DCHECK(browser_->window()); | 505 DCHECK(browser_->window()); |
| 506 return browser_->window()->GetNativeWindow(); | 506 return browser_->window()->GetNativeWindow(); |
| 507 } | 507 } |
| 508 | 508 |
| 509 - (NSView*)labelForRequest:(PermissionRequest*)request { | 509 - (NSView*)labelForRequest:(PermissionRequest*)request { |
| 510 DCHECK(request); | 510 DCHECK(request); |
| 511 base::scoped_nsobject<NSView> permissionView( | 511 base::scoped_nsobject<NSView> permissionView( |
| 512 [[NSView alloc] initWithFrame:NSZeroRect]); | 512 [[NSView alloc] initWithFrame:NSZeroRect]); |
| 513 base::scoped_nsobject<NSImageView> permissionIcon( | 513 base::scoped_nsobject<NSImageView> permissionIcon( |
| 514 [[NSImageView alloc] initWithFrame:NSZeroRect]); | 514 [[NSImageView alloc] initWithFrame:NSZeroRect]); |
| 515 [permissionIcon setImage:NSImageFromImageSkia( | 515 [permissionIcon |
| 516 gfx::CreateVectorIcon(request->GetVectorIconId(), 18, | 516 setImage:NSImageFromImageSkia(gfx::CreateVectorIcon( |
| 517 gfx::kChromeIconGrey))]; | 517 request->GetIconId(), 18, gfx::kChromeIconGrey))]; |
| 518 [permissionIcon setFrameSize:kPermissionIconSize]; | 518 [permissionIcon setFrameSize:kPermissionIconSize]; |
| 519 [permissionView addSubview:permissionIcon]; | 519 [permissionView addSubview:permissionIcon]; |
| 520 | 520 |
| 521 base::scoped_nsobject<NSTextField> permissionLabel( | 521 base::scoped_nsobject<NSTextField> permissionLabel( |
| 522 [[NSTextField alloc] initWithFrame:NSZeroRect]); | 522 [[NSTextField alloc] initWithFrame:NSZeroRect]); |
| 523 base::string16 label = request->GetMessageTextFragment(); | 523 base::string16 label = request->GetMessageTextFragment(); |
| 524 [permissionLabel setDrawsBackground:NO]; | 524 [permissionLabel setDrawsBackground:NO]; |
| 525 [permissionLabel setBezeled:NO]; | 525 [permissionLabel setBezeled:NO]; |
| 526 [permissionLabel setEditable:NO]; | 526 [permissionLabel setEditable:NO]; |
| 527 [permissionLabel setSelectable:NO]; | 527 [permissionLabel setSelectable:NO]; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 | 658 |
| 659 + (void)alignCenterOf:(NSView*)viewA verticallyToCenterOf:(NSView*)viewB { | 659 + (void)alignCenterOf:(NSView*)viewA verticallyToCenterOf:(NSView*)viewB { |
| 660 NSRect frameA = [viewA frame]; | 660 NSRect frameA = [viewA frame]; |
| 661 NSRect frameB = [viewB frame]; | 661 NSRect frameB = [viewB frame]; |
| 662 frameA.origin.y = | 662 frameA.origin.y = |
| 663 NSMinY(frameB) + std::floor((NSHeight(frameB) - NSHeight(frameA)) / 2); | 663 NSMinY(frameB) + std::floor((NSHeight(frameB) - NSHeight(frameA)) / 2); |
| 664 [viewA setFrameOrigin:frameA.origin]; | 664 [viewA setFrameOrigin:frameA.origin]; |
| 665 } | 665 } |
| 666 | 666 |
| 667 @end // implementation PermissionBubbleController | 667 @end // implementation PermissionBubbleController |
| OLD | NEW |