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 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #import "base/mac/foundation_util.h" | 10 #import "base/mac/foundation_util.h" |
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 ViewsDelegate::GetInstance()->GetContextFactory(); | 986 ViewsDelegate::GetInstance()->GetContextFactory(); |
987 DCHECK(context_factory); | 987 DCHECK(context_factory); |
988 | 988 |
989 AddCompositorSuperview(); | 989 AddCompositorSuperview(); |
990 | 990 |
991 // TODO(tapted): Get this value from GpuDataManagerImpl via ViewsDelegate. | 991 // TODO(tapted): Get this value from GpuDataManagerImpl via ViewsDelegate. |
992 bool needs_gl_finish_workaround = false; | 992 bool needs_gl_finish_workaround = false; |
993 | 993 |
994 compositor_widget_.reset( | 994 compositor_widget_.reset( |
995 new ui::AcceleratedWidgetMac(needs_gl_finish_workaround)); | 995 new ui::AcceleratedWidgetMac(needs_gl_finish_workaround)); |
996 compositor_.reset(new ui::Compositor(compositor_widget_->accelerated_widget(), | 996 compositor_.reset( |
997 context_factory, | 997 new ui::Compositor(context_factory, base::ThreadTaskRunnerHandle::Get())); |
998 base::ThreadTaskRunnerHandle::Get())); | 998 compositor_->OnAcceleratedWidgetAvailable( |
| 999 compositor_widget_->accelerated_widget()); |
999 compositor_widget_->SetNSView(this); | 1000 compositor_widget_->SetNSView(this); |
1000 } | 1001 } |
1001 | 1002 |
1002 void BridgedNativeWidget::InitCompositor() { | 1003 void BridgedNativeWidget::InitCompositor() { |
1003 DCHECK(layer()); | 1004 DCHECK(layer()); |
1004 float scale_factor = GetDeviceScaleFactorFromView(compositor_superview_); | 1005 float scale_factor = GetDeviceScaleFactorFromView(compositor_superview_); |
1005 gfx::Size size_in_dip = GetClientAreaSize(); | 1006 gfx::Size size_in_dip = GetClientAreaSize(); |
1006 compositor_->SetScaleAndSize(scale_factor, | 1007 compositor_->SetScaleAndSize(scale_factor, |
1007 ConvertSizeToPixel(scale_factor, size_in_dip)); | 1008 ConvertSizeToPixel(scale_factor, size_in_dip)); |
1008 compositor_->SetRootLayer(layer()); | 1009 compositor_->SetRootLayer(layer()); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 [bridged_view_ setMouseDownCanMoveWindow:draggable]; | 1090 [bridged_view_ setMouseDownCanMoveWindow:draggable]; |
1090 // AppKit will not update its cache of mouseDownCanMoveWindow unless something | 1091 // AppKit will not update its cache of mouseDownCanMoveWindow unless something |
1091 // changes. Previously we tried adding an NSView and removing it, but for some | 1092 // changes. Previously we tried adding an NSView and removing it, but for some |
1092 // reason it required reposting the mouse-down event, and didn't always work. | 1093 // reason it required reposting the mouse-down event, and didn't always work. |
1093 // Calling the below seems to be an effective solution. | 1094 // Calling the below seems to be an effective solution. |
1094 [window_ setMovableByWindowBackground:NO]; | 1095 [window_ setMovableByWindowBackground:NO]; |
1095 [window_ setMovableByWindowBackground:YES]; | 1096 [window_ setMovableByWindowBackground:YES]; |
1096 } | 1097 } |
1097 | 1098 |
1098 } // namespace views | 1099 } // namespace views |
OLD | NEW |