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

Side by Side Diff: chrome/browser/ui/cocoa/tabs/tab_controller.mm

Issue 17593006: mac: Update clients of scoped_nsobject.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: iwyu, scoped_nsprotocol Created 7 years, 5 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 | Annotate | Revision Log
OLDNEW
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 "chrome/browser/ui/cocoa/tabs/tab_controller.h" 5 #import "chrome/browser/ui/cocoa/tabs/tab_controller.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/mac/bundle_locations.h" 9 #include "base/mac/bundle_locations.h"
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // expands to the right to fill its space. These are the amounts to expand 95 // expands to the right to fill its space. These are the amounts to expand
96 // and contract titleView_ under those conditions. We don't have to 96 // and contract titleView_ under those conditions. We don't have to
97 // explicilty save the offset between the title and the close button since 97 // explicilty save the offset between the title and the close button since
98 // we can just get that value for the close button's frame. 98 // we can just get that value for the close button's frame.
99 NSRect titleFrame = NSMakeRect(35, 6, 92, 14); 99 NSRect titleFrame = NSMakeRect(35, 6, 92, 14);
100 iconTitleXOffset_ = NSMinX(titleFrame) - NSMinX(originalIconFrame_); 100 iconTitleXOffset_ = NSMinX(titleFrame) - NSMinX(originalIconFrame_);
101 101
102 // Label. 102 // Label.
103 titleView_.reset([[NSTextField alloc] initWithFrame:titleFrame]); 103 titleView_.reset([[NSTextField alloc] initWithFrame:titleFrame]);
104 [titleView_ setAutoresizingMask:NSViewWidthSizable]; 104 [titleView_ setAutoresizingMask:NSViewWidthSizable];
105 scoped_nsobject<GTMFadeTruncatingTextFieldCell> labelCell( 105 base::scoped_nsobject<GTMFadeTruncatingTextFieldCell> labelCell(
106 [[GTMFadeTruncatingTextFieldCell alloc] initTextCell:@"Label"]); 106 [[GTMFadeTruncatingTextFieldCell alloc] initTextCell:@"Label"]);
107 [labelCell setControlSize:NSSmallControlSize]; 107 [labelCell setControlSize:NSSmallControlSize];
108 CGFloat fontSize = [NSFont systemFontSizeForControlSize:NSSmallControlSize]; 108 CGFloat fontSize = [NSFont systemFontSizeForControlSize:NSSmallControlSize];
109 NSFont* font = [NSFont fontWithName: 109 NSFont* font = [NSFont fontWithName:
110 [[labelCell font] fontName] size:fontSize]; 110 [[labelCell font] fontName] size:fontSize];
111 [labelCell setFont:font]; 111 [labelCell setFont:font];
112 [titleView_ setCell:labelCell]; 112 [titleView_ setCell:labelCell];
113 113
114 // Close button. 114 // Close button.
115 closeButton_.reset([[HoverCloseButton alloc] initWithFrame: 115 closeButton_.reset([[HoverCloseButton alloc] initWithFrame:
116 NSMakeRect(127, 4, 18, 18)]); 116 NSMakeRect(127, 4, 18, 18)]);
117 [closeButton_ setAutoresizingMask:NSViewMinXMargin]; 117 [closeButton_ setAutoresizingMask:NSViewMinXMargin];
118 [closeButton_ setTarget:self]; 118 [closeButton_ setTarget:self];
119 [closeButton_ setAction:@selector(closeTab:)]; 119 [closeButton_ setAction:@selector(closeTab:)];
120 120
121 scoped_nsobject<TabView> view([[TabView alloc] initWithFrame: 121 base::scoped_nsobject<TabView> view(
122 NSMakeRect(0, 0, 160, 25) controller:self closeButton:closeButton_]); 122 [[TabView alloc] initWithFrame:NSMakeRect(0, 0, 160, 25)
123 controller:self
124 closeButton:closeButton_]);
123 [view setAutoresizingMask:NSViewMaxXMargin | NSViewMinYMargin]; 125 [view setAutoresizingMask:NSViewMaxXMargin | NSViewMinYMargin];
124 [view addSubview:iconView_]; 126 [view addSubview:iconView_];
125 [view addSubview:titleView_]; 127 [view addSubview:titleView_];
126 [view addSubview:closeButton_]; 128 [view addSubview:closeButton_];
127 [super setView:view]; 129 [super setView:view];
128 130
129 isIconShowing_ = YES; 131 isIconShowing_ = YES;
130 NSNotificationCenter* defaultCenter = [NSNotificationCenter defaultCenter]; 132 NSNotificationCenter* defaultCenter = [NSNotificationCenter defaultCenter];
131 [defaultCenter addObserver:self 133 [defaultCenter addObserver:self
132 selector:@selector(themeChangedNotification:) 134 selector:@selector(themeChangedNotification:)
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 // TabStripDragController. 389 // TabStripDragController.
388 - (BOOL)tabCanBeDragged:(TabController*)controller { 390 - (BOOL)tabCanBeDragged:(TabController*)controller {
389 return [[target_ dragController] tabCanBeDragged:controller]; 391 return [[target_ dragController] tabCanBeDragged:controller];
390 } 392 }
391 393
392 - (void)maybeStartDrag:(NSEvent*)event forTab:(TabController*)tab { 394 - (void)maybeStartDrag:(NSEvent*)event forTab:(TabController*)tab {
393 [[target_ dragController] maybeStartDrag:event forTab:tab]; 395 [[target_ dragController] maybeStartDrag:event forTab:tab];
394 } 396 }
395 397
396 @end 398 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698