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 #include "content/browser/renderer_host/render_widget_host_view_mac.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
6 | 6 |
7 #include <QuartzCore/QuartzCore.h> | 7 #include <QuartzCore/QuartzCore.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 2360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2371 | 2371 |
2372 // If the new window for this view is using CoreAnimation then enable | 2372 // If the new window for this view is using CoreAnimation then enable |
2373 // CoreAnimation on this view. | 2373 // CoreAnimation on this view. |
2374 if (GetCoreAnimationStatus() == CORE_ANIMATION_ENABLED_LAZY && | 2374 if (GetCoreAnimationStatus() == CORE_ANIMATION_ENABLED_LAZY && |
2375 [[newWindow contentView] wantsLayer]) { | 2375 [[newWindow contentView] wantsLayer]) { |
2376 renderWidgetHostView_->EnableCoreAnimation(); | 2376 renderWidgetHostView_->EnableCoreAnimation(); |
2377 } | 2377 } |
2378 | 2378 |
2379 NSNotificationCenter* notificationCenter = | 2379 NSNotificationCenter* notificationCenter = |
2380 [NSNotificationCenter defaultCenter]; | 2380 [NSNotificationCenter defaultCenter]; |
| 2381 |
| 2382 // Backing property notifications crash on 10.6 when building with the 10.7 |
| 2383 // SDK, see http://crbug.com/260595. |
| 2384 BOOL supportsBackingPropertiesNotification = base::mac::IsOSLionOrLater(); |
| 2385 |
2381 if (oldWindow) { | 2386 if (oldWindow) { |
2382 [notificationCenter | 2387 if (supportsBackingPropertiesNotification) { |
2383 removeObserver:self | 2388 [notificationCenter |
2384 name:NSWindowDidChangeBackingPropertiesNotification | 2389 removeObserver:self |
2385 object:oldWindow]; | 2390 name:NSWindowDidChangeBackingPropertiesNotification |
| 2391 object:oldWindow]; |
| 2392 } |
2386 [notificationCenter | 2393 [notificationCenter |
2387 removeObserver:self | 2394 removeObserver:self |
2388 name:NSWindowDidMoveNotification | 2395 name:NSWindowDidMoveNotification |
2389 object:oldWindow]; | 2396 object:oldWindow]; |
2390 [notificationCenter | 2397 [notificationCenter |
2391 removeObserver:self | 2398 removeObserver:self |
2392 name:NSWindowDidEndLiveResizeNotification | 2399 name:NSWindowDidEndLiveResizeNotification |
2393 object:oldWindow]; | 2400 object:oldWindow]; |
2394 } | 2401 } |
2395 if (newWindow) { | 2402 if (newWindow) { |
2396 [notificationCenter | 2403 if (supportsBackingPropertiesNotification) { |
2397 addObserver:self | 2404 [notificationCenter |
2398 selector:@selector(windowDidChangeBackingProperties:) | 2405 addObserver:self |
2399 name:NSWindowDidChangeBackingPropertiesNotification | 2406 selector:@selector(windowDidChangeBackingProperties:) |
2400 object:newWindow]; | 2407 name:NSWindowDidChangeBackingPropertiesNotification |
| 2408 object:newWindow]; |
| 2409 } |
2401 [notificationCenter | 2410 [notificationCenter |
2402 addObserver:self | 2411 addObserver:self |
2403 selector:@selector(windowChangedGlobalFrame:) | 2412 selector:@selector(windowChangedGlobalFrame:) |
2404 name:NSWindowDidMoveNotification | 2413 name:NSWindowDidMoveNotification |
2405 object:newWindow]; | 2414 object:newWindow]; |
2406 [notificationCenter | 2415 [notificationCenter |
2407 addObserver:self | 2416 addObserver:self |
2408 selector:@selector(windowChangedGlobalFrame:) | 2417 selector:@selector(windowChangedGlobalFrame:) |
2409 name:NSWindowDidEndLiveResizeNotification | 2418 name:NSWindowDidEndLiveResizeNotification |
2410 object:newWindow]; | 2419 object:newWindow]; |
(...skipping 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3728 return YES; | 3737 return YES; |
3729 } | 3738 } |
3730 | 3739 |
3731 - (BOOL)isOpaque { | 3740 - (BOOL)isOpaque { |
3732 if (renderWidgetHostView_->use_core_animation_) | 3741 if (renderWidgetHostView_->use_core_animation_) |
3733 return YES; | 3742 return YES; |
3734 return [super isOpaque]; | 3743 return [super isOpaque]; |
3735 } | 3744 } |
3736 | 3745 |
3737 @end | 3746 @end |
OLD | NEW |