Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm

Issue 2385063005: Make PermissionRequest::GetIconId return different types (Closed)
Patch Set: android Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 DCHECK(browser_->window()); 502 DCHECK(browser_->window());
503 return browser_->window()->GetNativeWindow(); 503 return browser_->window()->GetNativeWindow();
504 } 504 }
505 505
506 - (NSView*)labelForRequest:(PermissionRequest*)request { 506 - (NSView*)labelForRequest:(PermissionRequest*)request {
507 DCHECK(request); 507 DCHECK(request);
508 base::scoped_nsobject<NSView> permissionView( 508 base::scoped_nsobject<NSView> permissionView(
509 [[NSView alloc] initWithFrame:NSZeroRect]); 509 [[NSView alloc] initWithFrame:NSZeroRect]);
510 base::scoped_nsobject<NSImageView> permissionIcon( 510 base::scoped_nsobject<NSImageView> permissionIcon(
511 [[NSImageView alloc] initWithFrame:NSZeroRect]); 511 [[NSImageView alloc] initWithFrame:NSZeroRect]);
512 [permissionIcon setImage:NSImageFromImageSkia( 512 [permissionIcon
513 gfx::CreateVectorIcon(request->GetVectorIconId(), 18, 513 setImage:NSImageFromImageSkia(gfx::CreateVectorIcon(
514 gfx::kChromeIconGrey))]; 514 request->GetIconId(), 18, gfx::kChromeIconGrey))];
515 [permissionIcon setFrameSize:kPermissionIconSize]; 515 [permissionIcon setFrameSize:kPermissionIconSize];
516 [permissionView addSubview:permissionIcon]; 516 [permissionView addSubview:permissionIcon];
517 517
518 base::scoped_nsobject<NSTextField> permissionLabel( 518 base::scoped_nsobject<NSTextField> permissionLabel(
519 [[NSTextField alloc] initWithFrame:NSZeroRect]); 519 [[NSTextField alloc] initWithFrame:NSZeroRect]);
520 base::string16 label = request->GetMessageTextFragment(); 520 base::string16 label = request->GetMessageTextFragment();
521 [permissionLabel setDrawsBackground:NO]; 521 [permissionLabel setDrawsBackground:NO];
522 [permissionLabel setBezeled:NO]; 522 [permissionLabel setBezeled:NO];
523 [permissionLabel setEditable:NO]; 523 [permissionLabel setEditable:NO];
524 [permissionLabel setSelectable:NO]; 524 [permissionLabel setSelectable:NO];
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 654
655 + (void)alignCenterOf:(NSView*)viewA verticallyToCenterOf:(NSView*)viewB { 655 + (void)alignCenterOf:(NSView*)viewA verticallyToCenterOf:(NSView*)viewB {
656 NSRect frameA = [viewA frame]; 656 NSRect frameA = [viewA frame];
657 NSRect frameB = [viewB frame]; 657 NSRect frameB = [viewB frame];
658 frameA.origin.y = 658 frameA.origin.y =
659 NSMinY(frameB) + std::floor((NSHeight(frameB) - NSHeight(frameA)) / 2); 659 NSMinY(frameB) + std::floor((NSHeight(frameB) - NSHeight(frameA)) / 2);
660 [viewA setFrameOrigin:frameA.origin]; 660 [viewA setFrameOrigin:frameA.origin];
661 } 661 }
662 662
663 @end // implementation PermissionBubbleController 663 @end // implementation PermissionBubbleController
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698