| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
| 10 #include "base/mac_util.h" | 10 #include "base/mac_util.h" |
| 11 #include "base/mac/scoped_cftyperef.h" | 11 #include "base/mac/scoped_cftyperef.h" |
| 12 #include "base/scoped_callback_factory.h" | 12 #include "base/scoped_callback_factory.h" |
| 13 #include "base/sys_string_conversions.h" | 13 #include "base/sys_string_conversions.h" |
| 14 #include "chrome/app/chrome_command_ids.h" | 14 #include "chrome/app/chrome_command_ids.h" |
| 15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 16 #import "chrome/browser/debugger/devtools_window.h" | 16 #import "chrome/browser/debugger/devtools_window.h" |
| 17 #include "chrome/browser/prefs/pref_service.h" | 17 #include "chrome/browser/prefs/pref_service.h" |
| 18 #include "chrome/browser/renderer_host/backing_store_mac.h" | 18 #include "chrome/browser/renderer_host/backing_store_mac.h" |
| 19 #include "chrome/browser/renderer_host/render_view_host.h" | 19 #include "chrome/browser/renderer_host/render_view_host.h" |
| 20 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" | 20 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" |
| 21 #include "chrome/browser/tab_contents/tab_contents.h" | 21 #include "chrome/browser/tab_contents/tab_contents.h" |
| 22 #include "chrome/browser/tab_contents/thumbnail_generator.h" | 22 #include "chrome/browser/tab_contents/thumbnail_generator.h" |
| 23 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" | 23 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" |
| 24 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 24 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 25 #import "chrome/browser/ui/cocoa/tab_strip_controller.h" | 25 #import "chrome/browser/ui/cocoa/tab_strip_controller.h" |
| 26 #import "chrome/browser/ui/cocoa/tab_strip_model_observer_bridge.h" | 26 #import "chrome/browser/ui/cocoa/tab_strip_model_observer_bridge.h" |
| 27 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 27 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 28 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
| 29 #include "gfx/scoped_cg_context_state_mac.h" |
| 29 #include "grit/app_resources.h" | 30 #include "grit/app_resources.h" |
| 30 #include "skia/ext/skia_utils_mac.h" | 31 #include "skia/ext/skia_utils_mac.h" |
| 31 #include "third_party/skia/include/utils/mac/SkCGUtils.h" | 32 #include "third_party/skia/include/utils/mac/SkCGUtils.h" |
| 32 | 33 |
| 33 const int kTopGradientHeight = 15; | 34 const int kTopGradientHeight = 15; |
| 34 | 35 |
| 35 NSString* const kAnimationIdKey = @"AnimationId"; | 36 NSString* const kAnimationIdKey = @"AnimationId"; |
| 36 NSString* const kAnimationIdFadeIn = @"FadeIn"; | 37 NSString* const kAnimationIdFadeIn = @"FadeIn"; |
| 37 NSString* const kAnimationIdFadeOut = @"FadeOut"; | 38 NSString* const kAnimationIdFadeOut = @"FadeOut"; |
| 38 | 39 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 } | 216 } |
| 216 return bottomOffset; | 217 return bottomOffset; |
| 217 } | 218 } |
| 218 | 219 |
| 219 - (void)drawBackingStore:(BackingStoreMac*)backing_store | 220 - (void)drawBackingStore:(BackingStoreMac*)backing_store |
| 220 inRect:(CGRect)destRect | 221 inRect:(CGRect)destRect |
| 221 context:(CGContextRef)context { | 222 context:(CGContextRef)context { |
| 222 // TODO(thakis): Add a sublayer for each accelerated surface in the rwhv. | 223 // TODO(thakis): Add a sublayer for each accelerated surface in the rwhv. |
| 223 // Until then, accelerated layers (CoreAnimation NPAPI plugins, compositor) | 224 // Until then, accelerated layers (CoreAnimation NPAPI plugins, compositor) |
| 224 // won't show up in tabpose. | 225 // won't show up in tabpose. |
| 226 gfx::ScopedCGContextSaveGState CGContextSaveGState(context); |
| 227 CGContextSetInterpolationQuality(context, kCGInterpolationHigh); |
| 225 if (backing_store->cg_layer()) { | 228 if (backing_store->cg_layer()) { |
| 226 CGContextDrawLayerInRect(context, destRect, backing_store->cg_layer()); | 229 CGContextDrawLayerInRect(context, destRect, backing_store->cg_layer()); |
| 227 } else { | 230 } else { |
| 228 base::mac::ScopedCFTypeRef<CGImageRef> image( | 231 base::mac::ScopedCFTypeRef<CGImageRef> image( |
| 229 CGBitmapContextCreateImage(backing_store->cg_bitmap())); | 232 CGBitmapContextCreateImage(backing_store->cg_bitmap())); |
| 230 CGContextDrawImage(context, destRect, image); | 233 CGContextDrawImage(context, destRect, image); |
| 231 } | 234 } |
| 232 } | 235 } |
| 233 | 236 |
| 234 - (void)drawInContext:(CGContextRef)context { | 237 - (void)drawInContext:(CGContextRef)context { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 291 |
| 289 // Fill with bg color. | 292 // Fill with bg color. |
| 290 [super drawInContext:context]; | 293 [super drawInContext:context]; |
| 291 } | 294 } |
| 292 | 295 |
| 293 if (draw_backing_store) { | 296 if (draw_backing_store) { |
| 294 // Backing store 'cache' hit! | 297 // Backing store 'cache' hit! |
| 295 [self drawBackingStore:backing_store inRect:destRect context:context]; | 298 [self drawBackingStore:backing_store inRect:destRect context:context]; |
| 296 } else if (thumbnail_) { | 299 } else if (thumbnail_) { |
| 297 // No cache hit, but the renderer returned a thumbnail to us. | 300 // No cache hit, but the renderer returned a thumbnail to us. |
| 301 gfx::ScopedCGContextSaveGState CGContextSaveGState(context); |
| 302 CGContextSetInterpolationQuality(context, kCGInterpolationHigh); |
| 298 CGContextDrawImage(context, destRect, thumbnail_.get()); | 303 CGContextDrawImage(context, destRect, thumbnail_.get()); |
| 299 } | 304 } |
| 300 } | 305 } |
| 301 | 306 |
| 302 @end | 307 @end |
| 303 | 308 |
| 304 namespace { | 309 namespace { |
| 305 | 310 |
| 306 class ScopedCAActionDisabler { | 311 class ScopedCAActionDisabler { |
| 307 public: | 312 public: |
| (...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1427 tile.set_tab_contents(contents->tab_contents()); | 1432 tile.set_tab_contents(contents->tab_contents()); |
| 1428 ThumbnailLayer* thumbLayer = [allThumbnailLayers_ objectAtIndex:index]; | 1433 ThumbnailLayer* thumbLayer = [allThumbnailLayers_ objectAtIndex:index]; |
| 1429 [thumbLayer setTabContents:contents->tab_contents()]; | 1434 [thumbLayer setTabContents:contents->tab_contents()]; |
| 1430 } | 1435 } |
| 1431 | 1436 |
| 1432 - (void)tabStripModelDeleted { | 1437 - (void)tabStripModelDeleted { |
| 1433 [self close]; | 1438 [self close]; |
| 1434 } | 1439 } |
| 1435 | 1440 |
| 1436 @end | 1441 @end |
| OLD | NEW |