| 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 "base/mac/sdk_forward_declarations.h" | 8 #import "base/mac/sdk_forward_declarations.h" |
| 9 #import "chrome/browser/ui/cocoa/browser_window_layout.h" | 9 #import "chrome/browser/ui/cocoa/browser_window_layout.h" |
| 10 #import "chrome/browser/ui/cocoa/fast_resize_view.h" | 10 #import "chrome/browser/ui/cocoa/fast_resize_view.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 // followed by RenderWidgetHost::Blur(), which would result in an unexpected | 171 // followed by RenderWidgetHost::Blur(), which would result in an unexpected |
| 172 // loss of focus. | 172 // loss of focus. |
| 173 focusBeforeOverlay_.reset([[FocusTracker alloc] initWithWindow:window]); | 173 focusBeforeOverlay_.reset([[FocusTracker alloc] initWithWindow:window]); |
| 174 [window makeFirstResponder:nil]; | 174 [window makeFirstResponder:nil]; |
| 175 | 175 |
| 176 // Move the original window's tab strip view and content view to the overlay | 176 // Move the original window's tab strip view and content view to the overlay |
| 177 // window. The content view is added as a subview of the overlay window's | 177 // window. The content view is added as a subview of the overlay window's |
| 178 // content view (rather than using setContentView:) because the overlay | 178 // content view (rather than using setContentView:) because the overlay |
| 179 // window has a different content size (due to it being borderless). | 179 // window has a different content size (due to it being borderless). |
| 180 [[overlayWindow_ contentView] addSubview:[self tabStripView]]; | 180 [[overlayWindow_ contentView] addSubview:[self tabStripView]]; |
| 181 [[self tabStripView] setInATabDraggingOverlayWindow:YES]; |
| 181 [[overlayWindow_ contentView] addSubview:originalContentView_]; | 182 [[overlayWindow_ contentView] addSubview:originalContentView_]; |
| 182 | 183 |
| 183 [overlayWindow_ orderFront:nil]; | 184 [overlayWindow_ orderFront:nil]; |
| 184 } else if (!useOverlay && overlayWindow_) { | 185 } else if (!useOverlay && overlayWindow_) { |
| 185 DCHECK(originalContentView_); | 186 DCHECK(originalContentView_); |
| 186 | 187 |
| 187 // Return the original window's tab strip view and content view to their | 188 // Return the original window's tab strip view and content view to their |
| 188 // places. The TabStripView always needs to be in front of the window's | 189 // places. The TabStripView always needs to be in front of the window's |
| 189 // content view and therefore it should always be added after the content | 190 // content view and therefore it should always be added after the content |
| 190 // view is set. | 191 // view is set. |
| 191 [[window contentView] addSubview:originalContentView_ | 192 [[window contentView] addSubview:originalContentView_ |
| 192 positioned:NSWindowBelow | 193 positioned:NSWindowBelow |
| 193 relativeTo:nil]; | 194 relativeTo:nil]; |
| 194 originalContentView_.frame = [[window contentView] bounds]; | 195 originalContentView_.frame = [[window contentView] bounds]; |
| 195 [[window contentView] addSubview:[self tabStripView]]; | 196 [[window contentView] addSubview:[self tabStripView]]; |
| 197 [[self tabStripView] setInATabDraggingOverlayWindow:NO]; |
| 196 [[window contentView] updateTrackingAreas]; | 198 [[window contentView] updateTrackingAreas]; |
| 197 | 199 |
| 198 [focusBeforeOverlay_ restoreFocusInWindow:window]; | 200 [focusBeforeOverlay_ restoreFocusInWindow:window]; |
| 199 focusBeforeOverlay_.reset(); | 201 focusBeforeOverlay_.reset(); |
| 200 | 202 |
| 201 [window display]; | 203 [window display]; |
| 202 [window removeChildWindow:overlayWindow_]; | 204 [window removeChildWindow:overlayWindow_]; |
| 203 | 205 |
| 204 [overlayWindow_ orderOut:nil]; | 206 [overlayWindow_ orderOut:nil]; |
| 205 [overlayWindow_ release]; | 207 [overlayWindow_ release]; |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 [visualEffectView addSubview:tabStripBackgroundView_]; | 380 [visualEffectView addSubview:tabStripBackgroundView_]; |
| 379 } | 381 } |
| 380 | 382 |
| 381 // Called when the size of the window content area has changed. Override to | 383 // Called when the size of the window content area has changed. Override to |
| 382 // position specific views. Base class implementation does nothing. | 384 // position specific views. Base class implementation does nothing. |
| 383 - (void)layoutSubviews { | 385 - (void)layoutSubviews { |
| 384 NOTIMPLEMENTED(); | 386 NOTIMPLEMENTED(); |
| 385 } | 387 } |
| 386 | 388 |
| 387 @end | 389 @end |
| OLD | NEW |