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

Side by Side Diff: chrome/browser/ui/cocoa/profiles/avatar_icon_controller.mm

Issue 1680773006: Implement Material Design for Mac toolbar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@md_master
Patch Set: Ready for review. Created 4 years, 9 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/profiles/avatar_icon_controller.h" 5 #import "chrome/browser/ui/cocoa/profiles/avatar_icon_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/mac/foundation_util.h" 9 #include "base/mac/foundation_util.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 26 matching lines...) Expand all
37 if ((self = [super initWithBrowser:browser])) { 37 if ((self = [super initWithBrowser:browser])) {
38 browser_ = browser; 38 browser_ = browser;
39 39
40 base::scoped_nsobject<NSView> container( 40 base::scoped_nsobject<NSView> container(
41 [[NSView alloc] initWithFrame:NSMakeRect( 41 [[NSView alloc] initWithFrame:NSMakeRect(
42 0, 0, profiles::kAvatarIconWidth, profiles::kAvatarIconHeight)]); 42 0, 0, profiles::kAvatarIconWidth, profiles::kAvatarIconHeight)]);
43 [container setWantsLayer:YES]; 43 [container setWantsLayer:YES];
44 [self setView:container]; 44 [self setView:container];
45 45
46 bool isModeMaterial = ui::MaterialDesignController::IsModeMaterial(); 46 bool isModeMaterial = ui::MaterialDesignController::IsModeMaterial();
47 NSRect frameRect = NSMakeRect(4, 5, profiles::kAvatarIconWidth, 47 NSRect frameRect = NSMakeRect(5, 5, profiles::kAvatarIconWidth,
48 profiles::kAvatarIconHeight); 48 profiles::kAvatarIconHeight);
49 if (!isModeMaterial) { 49 if (!isModeMaterial) {
50 frameRect.origin = NSZeroPoint; 50 frameRect.origin = NSZeroPoint;
51 } 51 }
52 button_.reset([[NSButton alloc] initWithFrame:frameRect]); 52 button_.reset([[NSButton alloc] initWithFrame:frameRect]);
53 NSButtonCell* cell = [button_ cell]; 53 NSButtonCell* cell = [button_ cell];
54 [button_ setButtonType:NSMomentaryLightButton]; 54 [button_ setButtonType:NSMomentaryLightButton];
55 55
56 [button_ setImagePosition:NSImageOnly]; 56 [button_ setImagePosition:NSImageOnly];
57 [cell setImageScaling:NSImageScaleProportionallyDown]; 57 [cell setImageScaling:NSImageScaleProportionallyDown];
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 hints:nil]; 126 hints:nil];
127 127
128 [destination unlockFocus]; 128 [destination unlockFocus];
129 129
130 return destination.autorelease(); 130 return destination.autorelease();
131 } 131 }
132 132
133 - (void)updateAvatarButtonAndLayoutParent:(BOOL)layoutParent {} 133 - (void)updateAvatarButtonAndLayoutParent:(BOOL)layoutParent {}
134 134
135 @end 135 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698