| 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/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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 247 |
| 248 return topOffset; | 248 return topOffset; |
| 249 } | 249 } |
| 250 | 250 |
| 251 - (int)bottomOffset { | 251 - (int)bottomOffset { |
| 252 int bottomOffset = 0; | 252 int bottomOffset = 0; |
| 253 TabContentsWrapper* devToolsContents = | 253 TabContentsWrapper* devToolsContents = |
| 254 DevToolsWindow::GetDevToolsContents(contents_->web_contents()); | 254 DevToolsWindow::GetDevToolsContents(contents_->web_contents()); |
| 255 if (devToolsContents && devToolsContents->web_contents() && | 255 if (devToolsContents && devToolsContents->web_contents() && |
| 256 devToolsContents->web_contents()->GetRenderViewHost() && | 256 devToolsContents->web_contents()->GetRenderViewHost() && |
| 257 devToolsContents->web_contents()->GetRenderViewHost()->view()) { | 257 devToolsContents->web_contents()->GetRenderViewHost()->GetView()) { |
| 258 // The devtool's size might not be up-to-date, but since its height doesn't | 258 // The devtool's size might not be up-to-date, but since its height doesn't |
| 259 // change on window resize, and since most users don't use devtools, this is | 259 // change on window resize, and since most users don't use devtools, this is |
| 260 // good enough. | 260 // good enough. |
| 261 bottomOffset += | 261 bottomOffset += |
| 262 devToolsContents->web_contents()->GetRenderViewHost()->view()-> | 262 devToolsContents->web_contents()->GetRenderViewHost()->GetView()-> |
| 263 GetViewBounds().height(); | 263 GetViewBounds().height(); |
| 264 bottomOffset += 1; // :-( Divider line between web contents and devtools. | 264 bottomOffset += 1; // :-( Divider line between web contents and devtools. |
| 265 } | 265 } |
| 266 return bottomOffset; | 266 return bottomOffset; |
| 267 } | 267 } |
| 268 | 268 |
| 269 - (void)drawInContext:(CGContextRef)context { | 269 - (void)drawInContext:(CGContextRef)context { |
| 270 RenderWidgetHost* rwh = contents_->web_contents()->GetRenderViewHost(); | 270 RenderWidgetHost* rwh = contents_->web_contents()->GetRenderViewHost(); |
| 271 // NULL if renderer crashed. | 271 // NULL if renderer crashed. |
| 272 content::RenderWidgetHostView* rwhv = rwh ? rwh->view() : NULL; | 272 content::RenderWidgetHostView* rwhv = rwh ? rwh->GetView() : NULL; |
| 273 if (!rwhv) { | 273 if (!rwhv) { |
| 274 // TODO(thakis): Maybe draw a sad tab layer? | 274 // TODO(thakis): Maybe draw a sad tab layer? |
| 275 [super drawInContext:context]; | 275 [super drawInContext:context]; |
| 276 return; | 276 return; |
| 277 } | 277 } |
| 278 | 278 |
| 279 // The size of the TabContent's RenderWidgetHost might not fit to the | 279 // The size of the TabContent's RenderWidgetHost might not fit to the |
| 280 // current browser window at all, for example if the window was resized while | 280 // current browser window at all, for example if the window was resized while |
| 281 // this TabContents object was not an active tab. | 281 // this TabContents object was not an active tab. |
| 282 // Compute the required size ourselves. Leave room for eventual infobars and | 282 // Compute the required size ourselves. Leave room for eventual infobars and |
| (...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1665 tile.set_tab_contents(contents); | 1665 tile.set_tab_contents(contents); |
| 1666 ThumbnailLayer* thumbLayer = [allThumbnailLayers_ objectAtIndex:index]; | 1666 ThumbnailLayer* thumbLayer = [allThumbnailLayers_ objectAtIndex:index]; |
| 1667 [thumbLayer setTabContents:contents]; | 1667 [thumbLayer setTabContents:contents]; |
| 1668 } | 1668 } |
| 1669 | 1669 |
| 1670 - (void)tabStripModelDeleted { | 1670 - (void)tabStripModelDeleted { |
| 1671 [self close]; | 1671 [self close]; |
| 1672 } | 1672 } |
| 1673 | 1673 |
| 1674 @end | 1674 @end |
| OLD | NEW |