OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/views/cocoa/bridged_native_widget.h" | 5 #import "ui/views/cocoa/bridged_native_widget.h" |
6 | 6 |
7 #import <objc/runtime.h> | 7 #import <objc/runtime.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1252 } | 1252 } |
1253 | 1253 |
1254 void BridgedNativeWidget::CreateCompositor() { | 1254 void BridgedNativeWidget::CreateCompositor() { |
1255 DCHECK(!compositor_); | 1255 DCHECK(!compositor_); |
1256 DCHECK(!compositor_widget_); | 1256 DCHECK(!compositor_widget_); |
1257 DCHECK(ViewsDelegate::GetInstance()); | 1257 DCHECK(ViewsDelegate::GetInstance()); |
1258 | 1258 |
1259 ui::ContextFactory* context_factory = | 1259 ui::ContextFactory* context_factory = |
1260 ViewsDelegate::GetInstance()->GetContextFactory(); | 1260 ViewsDelegate::GetInstance()->GetContextFactory(); |
1261 DCHECK(context_factory); | 1261 DCHECK(context_factory); |
| 1262 ui::ContextFactoryPrivate* context_factory_private = |
| 1263 ViewsDelegate::GetInstance()->GetContextFactoryPrivate(); |
1262 | 1264 |
1263 AddCompositorSuperview(); | 1265 AddCompositorSuperview(); |
1264 | 1266 |
1265 compositor_widget_.reset(new ui::AcceleratedWidgetMac()); | 1267 compositor_widget_.reset(new ui::AcceleratedWidgetMac()); |
1266 compositor_.reset( | 1268 compositor_.reset(new ui::Compositor(context_factory, context_factory_private, |
1267 new ui::Compositor(context_factory, GetCompositorTaskRunner())); | 1269 GetCompositorTaskRunner())); |
1268 compositor_->SetAcceleratedWidget(compositor_widget_->accelerated_widget()); | 1270 compositor_->SetAcceleratedWidget(compositor_widget_->accelerated_widget()); |
1269 compositor_widget_->SetNSView(this); | 1271 compositor_widget_->SetNSView(this); |
1270 } | 1272 } |
1271 | 1273 |
1272 void BridgedNativeWidget::InitCompositor() { | 1274 void BridgedNativeWidget::InitCompositor() { |
1273 DCHECK(layer()); | 1275 DCHECK(layer()); |
1274 float scale_factor = GetDeviceScaleFactorFromView(compositor_superview_); | 1276 float scale_factor = GetDeviceScaleFactorFromView(compositor_superview_); |
1275 gfx::Size size_in_dip = GetClientAreaSize(); | 1277 gfx::Size size_in_dip = GetClientAreaSize(); |
1276 compositor_->SetScaleAndSize(scale_factor, | 1278 compositor_->SetScaleAndSize(scale_factor, |
1277 ConvertSizeToPixel(scale_factor, size_in_dip)); | 1279 ConvertSizeToPixel(scale_factor, size_in_dip)); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1418 [bridged_view_ setMouseDownCanMoveWindow:draggable]; | 1420 [bridged_view_ setMouseDownCanMoveWindow:draggable]; |
1419 // AppKit will not update its cache of mouseDownCanMoveWindow unless something | 1421 // AppKit will not update its cache of mouseDownCanMoveWindow unless something |
1420 // changes. Previously we tried adding an NSView and removing it, but for some | 1422 // changes. Previously we tried adding an NSView and removing it, but for some |
1421 // reason it required reposting the mouse-down event, and didn't always work. | 1423 // reason it required reposting the mouse-down event, and didn't always work. |
1422 // Calling the below seems to be an effective solution. | 1424 // Calling the below seems to be an effective solution. |
1423 [window_ setMovableByWindowBackground:NO]; | 1425 [window_ setMovableByWindowBackground:NO]; |
1424 [window_ setMovableByWindowBackground:YES]; | 1426 [window_ setMovableByWindowBackground:YES]; |
1425 } | 1427 } |
1426 | 1428 |
1427 } // namespace views | 1429 } // namespace views |
OLD | NEW |