OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/tabpose_window.h" | 5 #import "chrome/browser/ui/cocoa/tabpose_window.h" |
6 | 6 |
7 #import <QuartzCore/QuartzCore.h> | 7 #import <QuartzCore/QuartzCore.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 int bottomOffset = 0; | 253 int bottomOffset = 0; |
254 TabContentsWrapper* devToolsContents = | 254 TabContentsWrapper* devToolsContents = |
255 DevToolsWindow::GetDevToolsContents(contents_->tab_contents()); | 255 DevToolsWindow::GetDevToolsContents(contents_->tab_contents()); |
256 if (devToolsContents && devToolsContents->tab_contents() && | 256 if (devToolsContents && devToolsContents->tab_contents() && |
257 devToolsContents->tab_contents()->render_view_host() && | 257 devToolsContents->tab_contents()->render_view_host() && |
258 devToolsContents->tab_contents()->render_view_host()->view()) { | 258 devToolsContents->tab_contents()->render_view_host()->view()) { |
259 // The devtool's size might not be up-to-date, but since its height doesn't | 259 // The devtool's size might not be up-to-date, but since its height doesn't |
260 // change on window resize, and since most users don't use devtools, this is | 260 // change on window resize, and since most users don't use devtools, this is |
261 // good enough. | 261 // good enough. |
262 bottomOffset += | 262 bottomOffset += |
263 devToolsContents->render_view_host()->view()->GetViewBounds().height(); | 263 devToolsContents->tab_contents()->render_view_host()->view()-> |
| 264 GetViewBounds().height(); |
264 bottomOffset += 1; // :-( Divider line between web contents and devtools. | 265 bottomOffset += 1; // :-( Divider line between web contents and devtools. |
265 } | 266 } |
266 return bottomOffset; | 267 return bottomOffset; |
267 } | 268 } |
268 | 269 |
269 - (void)drawBackingStore:(BackingStoreMac*)backing_store | 270 - (void)drawBackingStore:(BackingStoreMac*)backing_store |
270 inRect:(CGRect)destRect | 271 inRect:(CGRect)destRect |
271 context:(CGContextRef)context { | 272 context:(CGContextRef)context { |
272 // TODO(thakis): Add a sublayer for each accelerated surface in the rwhv. | 273 // TODO(thakis): Add a sublayer for each accelerated surface in the rwhv. |
273 // Until then, accelerated layers (CoreAnimation NPAPI plugins, compositor) | 274 // Until then, accelerated layers (CoreAnimation NPAPI plugins, compositor) |
274 // won't show up in tabpose. | 275 // won't show up in tabpose. |
275 gfx::ScopedCGContextSaveGState CGContextSaveGState(context); | 276 gfx::ScopedCGContextSaveGState CGContextSaveGState(context); |
276 CGContextSetInterpolationQuality(context, kCGInterpolationHigh); | 277 CGContextSetInterpolationQuality(context, kCGInterpolationHigh); |
277 if (backing_store->cg_layer()) { | 278 if (backing_store->cg_layer()) { |
278 CGContextDrawLayerInRect(context, destRect, backing_store->cg_layer()); | 279 CGContextDrawLayerInRect(context, destRect, backing_store->cg_layer()); |
279 } else { | 280 } else { |
280 base::mac::ScopedCFTypeRef<CGImageRef> image( | 281 base::mac::ScopedCFTypeRef<CGImageRef> image( |
281 CGBitmapContextCreateImage(backing_store->cg_bitmap())); | 282 CGBitmapContextCreateImage(backing_store->cg_bitmap())); |
282 CGContextDrawImage(context, destRect, image); | 283 CGContextDrawImage(context, destRect, image); |
283 } | 284 } |
284 } | 285 } |
285 | 286 |
286 - (void)drawInContext:(CGContextRef)context { | 287 - (void)drawInContext:(CGContextRef)context { |
287 RenderWidgetHost* rwh = contents_->render_view_host(); | 288 RenderWidgetHost* rwh = contents_->tab_contents()->render_view_host(); |
288 // NULL if renderer crashed. | 289 // NULL if renderer crashed. |
289 RenderWidgetHostView* rwhv = rwh ? rwh->view() : NULL; | 290 RenderWidgetHostView* rwhv = rwh ? rwh->view() : NULL; |
290 if (!rwhv) { | 291 if (!rwhv) { |
291 // TODO(thakis): Maybe draw a sad tab layer? | 292 // TODO(thakis): Maybe draw a sad tab layer? |
292 [super drawInContext:context]; | 293 [super drawInContext:context]; |
293 return; | 294 return; |
294 } | 295 } |
295 | 296 |
296 // The size of the TabContent's RenderWidgetHost might not fit to the | 297 // The size of the TabContent's RenderWidgetHost might not fit to the |
297 // current browser window at all, for example if the window was resized while | 298 // current browser window at all, for example if the window was resized while |
(...skipping 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1682 tile.set_tab_contents(contents); | 1683 tile.set_tab_contents(contents); |
1683 ThumbnailLayer* thumbLayer = [allThumbnailLayers_ objectAtIndex:index]; | 1684 ThumbnailLayer* thumbLayer = [allThumbnailLayers_ objectAtIndex:index]; |
1684 [thumbLayer setTabContents:contents]; | 1685 [thumbLayer setTabContents:contents]; |
1685 } | 1686 } |
1686 | 1687 |
1687 - (void)tabStripModelDeleted { | 1688 - (void)tabStripModelDeleted { |
1688 [self close]; | 1689 [self close]; |
1689 } | 1690 } |
1690 | 1691 |
1691 @end | 1692 @end |
OLD | NEW |