OLD | NEW |
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_window_controller.h" | 5 #import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" | 8 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" |
9 #import "chrome/browser/ui/cocoa/themed_window.h" | 9 #import "chrome/browser/ui/cocoa/themed_window.h" |
10 #import "ui/base/cocoa/focus_tracker.h" | 10 #import "ui/base/cocoa/focus_tracker.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 if ([self parentWindow]) | 35 if ([self parentWindow]) |
36 return [[[self parentWindow] windowController] themePatternPhase]; | 36 return [[[self parentWindow] windowController] themePatternPhase]; |
37 return NSZeroPoint; | 37 return NSZeroPoint; |
38 } | 38 } |
39 | 39 |
40 @end | 40 @end |
41 | 41 |
42 @implementation TabWindowController | 42 @implementation TabWindowController |
43 @synthesize tabContentArea = tabContentArea_; | 43 @synthesize tabContentArea = tabContentArea_; |
44 | 44 |
45 - (id)initWithWindow:(NSWindow*)window { | |
46 if ((self = [super initWithWindow:window]) != nil) { | |
47 lockedTabs_.reset([[NSMutableSet alloc] initWithCapacity:10]); | |
48 } | |
49 return self; | |
50 } | |
51 | |
52 // Add the top tab strop to the window, above the content box and add it to the | 45 // Add the top tab strop to the window, above the content box and add it to the |
53 // view hierarchy as a sibling of the content view so it can overlap with the | 46 // view hierarchy as a sibling of the content view so it can overlap with the |
54 // window frame. | 47 // window frame. |
55 - (void)addTabStripToWindow { | 48 - (void)addTabStripToWindow { |
56 NSRect contentFrame = [tabContentArea_ frame]; | 49 NSRect contentFrame = [tabContentArea_ frame]; |
57 NSRect tabFrame = | 50 NSRect tabFrame = |
58 NSMakeRect(0, NSMaxY(contentFrame), | 51 NSMakeRect(0, NSMaxY(contentFrame), |
59 NSWidth(contentFrame), | 52 NSWidth(contentFrame), |
60 NSHeight([tabStripView_ frame])); | 53 NSHeight([tabStripView_ frame])); |
61 [tabStripView_ setFrame:tabFrame]; | 54 [tabStripView_ setFrame:tabFrame]; |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 return @""; | 256 return @""; |
264 } | 257 } |
265 | 258 |
266 - (BOOL)hasTabStrip { | 259 - (BOOL)hasTabStrip { |
267 // Subclasses should implement this. | 260 // Subclasses should implement this. |
268 NOTIMPLEMENTED(); | 261 NOTIMPLEMENTED(); |
269 return YES; | 262 return YES; |
270 } | 263 } |
271 | 264 |
272 - (BOOL)isTabDraggable:(NSView*)tabView { | 265 - (BOOL)isTabDraggable:(NSView*)tabView { |
273 return ![lockedTabs_ containsObject:tabView]; | 266 // Subclasses should implement this. |
274 } | 267 NOTIMPLEMENTED(); |
275 | 268 return YES; |
276 - (void)setTab:(NSView*)tabView isDraggable:(BOOL)draggable { | |
277 if (draggable) | |
278 [lockedTabs_ removeObject:tabView]; | |
279 else | |
280 [lockedTabs_ addObject:tabView]; | |
281 } | 269 } |
282 | 270 |
283 // Tell the window that it needs to call performClose: as soon as the current | 271 // Tell the window that it needs to call performClose: as soon as the current |
284 // drag is complete. This prevents a window (and its overlay) from going away | 272 // drag is complete. This prevents a window (and its overlay) from going away |
285 // during a drag. | 273 // during a drag. |
286 - (void)deferPerformClose { | 274 - (void)deferPerformClose { |
287 closeDeferred_ = YES; | 275 closeDeferred_ = YES; |
288 } | 276 } |
289 | 277 |
290 // Called when the size of the window content area has changed. Override to | 278 // Called when the size of the window content area has changed. Override to |
291 // position specific views. Base class implementation does nothing. | 279 // position specific views. Base class implementation does nothing. |
292 - (void)layoutSubviews { | 280 - (void)layoutSubviews { |
293 NOTIMPLEMENTED(); | 281 NOTIMPLEMENTED(); |
294 } | 282 } |
295 | 283 |
296 @end | 284 @end |
OLD | NEW |