| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/cocoa/tab_window_controller.h" | 5 #import "chrome/browser/cocoa/tab_window_controller.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #import "chrome/browser/cocoa/tab_strip_view.h" | 8 #import "chrome/browser/cocoa/tab_strip_view.h" |
| 9 | 9 |
| 10 @interface TabWindowController(PRIVATE) | 10 @interface TabWindowController(PRIVATE) |
| 11 - (void)setUseOverlay:(BOOL)useOverlay; | 11 - (void)setUseOverlay:(BOOL)useOverlay; |
| 12 @end | 12 @end |
| 13 | 13 |
| 14 @implementation TabWindowController | 14 @implementation TabWindowController |
| 15 @synthesize tabStripView = tabStripView_; | 15 @synthesize tabStripView = tabStripView_; |
| 16 @synthesize tabContentArea = tabContentArea_; | 16 @synthesize tabContentArea = tabContentArea_; |
| 17 | 17 |
| 18 - (id)initWithWindow:(NSWindow *)window { |
| 19 if ((self = [super initWithWindow:window]) != nil) { |
| 20 lockedTabs_.reset([[NSMutableSet alloc] initWithCapacity:10]); |
| 21 } |
| 22 return self; |
| 23 } |
| 24 |
| 18 - (void)windowDidLoad { | 25 - (void)windowDidLoad { |
| 19 if ([self isNormalWindow]) { | 26 if ([self isNormalWindow]) { |
| 20 // Place the tab bar above the content box and add it to the view hierarchy | 27 // Place the tab bar above the content box and add it to the view hierarchy |
| 21 // as a sibling of the content view so it can overlap with the window frame. | 28 // as a sibling of the content view so it can overlap with the window frame. |
| 22 NSRect tabFrame = [tabContentArea_ frame]; | 29 NSRect tabFrame = [tabContentArea_ frame]; |
| 23 tabFrame.origin = NSMakePoint(0, NSMaxY(tabFrame)); | 30 tabFrame.origin = NSMakePoint(0, NSMaxY(tabFrame)); |
| 24 tabFrame.size.height = NSHeight([tabStripView_ frame]); | 31 tabFrame.size.height = NSHeight([tabStripView_ frame]); |
| 25 [tabStripView_ setFrame:tabFrame]; | 32 [tabStripView_ setFrame:tabFrame]; |
| 26 [[[[self window] contentView] superview] addSubview:tabStripView_]; | 33 [[[[self window] contentView] superview] addSubview:tabStripView_]; |
| 27 } else { | 34 } else { |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 NOTIMPLEMENTED(); | 176 NOTIMPLEMENTED(); |
| 170 return @""; | 177 return @""; |
| 171 } | 178 } |
| 172 | 179 |
| 173 - (BOOL)isNormalWindow { | 180 - (BOOL)isNormalWindow { |
| 174 // subclass must implement | 181 // subclass must implement |
| 175 NOTIMPLEMENTED(); | 182 NOTIMPLEMENTED(); |
| 176 return YES; | 183 return YES; |
| 177 } | 184 } |
| 178 | 185 |
| 186 - (BOOL)isTabDraggable:(NSView*)tabView { |
| 187 return ![lockedTabs_ containsObject:tabView]; |
| 188 } |
| 189 |
| 190 - (void)setTab:(NSView*)tabView isDraggable:(BOOL)draggable { |
| 191 if (draggable) |
| 192 [lockedTabs_ removeObject:tabView]; |
| 193 else |
| 194 [lockedTabs_ addObject:tabView]; |
| 195 } |
| 196 |
| 179 @end | 197 @end |
| OLD | NEW |