| OLD | NEW |
| 1 // Copyright (c) 2011 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 |
| 11 #include "base/mac/mac_util.h" | 11 #include "base/mac/mac_util.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 24 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" | 24 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" |
| 25 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 25 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 26 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" | 26 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" |
| 27 #import "chrome/browser/ui/cocoa/tab_contents/favicon_util.h" | 27 #import "chrome/browser/ui/cocoa/tab_contents/favicon_util.h" |
| 28 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 28 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
| 29 #import "chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.h" | 29 #import "chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.h" |
| 30 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 30 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 31 #include "chrome/common/pref_names.h" | 31 #include "chrome/common/pref_names.h" |
| 32 #include "content/browser/renderer_host/backing_store_mac.h" | 32 #include "content/browser/renderer_host/backing_store_mac.h" |
| 33 #include "content/browser/renderer_host/render_view_host.h" | 33 #include "content/browser/renderer_host/render_view_host.h" |
| 34 #include "content/browser/renderer_host/render_widget_host_view.h" | 34 #include "content/public/browser/render_widget_host_view.h" |
| 35 #include "content/public/browser/web_contents.h" | 35 #include "content/public/browser/web_contents.h" |
| 36 #include "grit/theme_resources.h" | 36 #include "grit/theme_resources.h" |
| 37 #include "grit/ui_resources.h" | 37 #include "grit/ui_resources.h" |
| 38 #include "skia/ext/skia_utils_mac.h" | 38 #include "skia/ext/skia_utils_mac.h" |
| 39 #include "third_party/skia/include/utils/mac/SkCGUtils.h" | 39 #include "third_party/skia/include/utils/mac/SkCGUtils.h" |
| 40 #include "ui/base/resource/resource_bundle.h" | 40 #include "ui/base/resource/resource_bundle.h" |
| 41 #include "ui/gfx/image/image.h" | 41 #include "ui/gfx/image/image.h" |
| 42 #include "ui/gfx/scoped_cg_context_save_gstate_mac.h" | 42 #include "ui/gfx/scoped_cg_context_save_gstate_mac.h" |
| 43 | 43 |
| 44 using content::BrowserThread; | 44 using content::BrowserThread; |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 } else { | 280 } else { |
| 281 base::mac::ScopedCFTypeRef<CGImageRef> image( | 281 base::mac::ScopedCFTypeRef<CGImageRef> image( |
| 282 CGBitmapContextCreateImage(backing_store->cg_bitmap())); | 282 CGBitmapContextCreateImage(backing_store->cg_bitmap())); |
| 283 CGContextDrawImage(context, destRect, image); | 283 CGContextDrawImage(context, destRect, image); |
| 284 } | 284 } |
| 285 } | 285 } |
| 286 | 286 |
| 287 - (void)drawInContext:(CGContextRef)context { | 287 - (void)drawInContext:(CGContextRef)context { |
| 288 RenderWidgetHost* rwh = contents_->web_contents()->GetRenderViewHost(); | 288 RenderWidgetHost* rwh = contents_->web_contents()->GetRenderViewHost(); |
| 289 // NULL if renderer crashed. | 289 // NULL if renderer crashed. |
| 290 RenderWidgetHostView* rwhv = rwh ? rwh->view() : NULL; | 290 content::RenderWidgetHostView* rwhv = rwh ? rwh->view() : NULL; |
| 291 if (!rwhv) { | 291 if (!rwhv) { |
| 292 // TODO(thakis): Maybe draw a sad tab layer? | 292 // TODO(thakis): Maybe draw a sad tab layer? |
| 293 [super drawInContext:context]; | 293 [super drawInContext:context]; |
| 294 return; | 294 return; |
| 295 } | 295 } |
| 296 | 296 |
| 297 // 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 |
| 298 // 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 |
| 299 // this TabContents object was not an active tab. | 299 // this TabContents object was not an active tab. |
| 300 // Compute the required size ourselves. Leave room for eventual infobars and | 300 // Compute the required size ourselves. Leave room for eventual infobars and |
| (...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1683 tile.set_tab_contents(contents); | 1683 tile.set_tab_contents(contents); |
| 1684 ThumbnailLayer* thumbLayer = [allThumbnailLayers_ objectAtIndex:index]; | 1684 ThumbnailLayer* thumbLayer = [allThumbnailLayers_ objectAtIndex:index]; |
| 1685 [thumbLayer setTabContents:contents]; | 1685 [thumbLayer setTabContents:contents]; |
| 1686 } | 1686 } |
| 1687 | 1687 |
| 1688 - (void)tabStripModelDeleted { | 1688 - (void)tabStripModelDeleted { |
| 1689 [self close]; | 1689 [self close]; |
| 1690 } | 1690 } |
| 1691 | 1691 |
| 1692 @end | 1692 @end |
| OLD | NEW |