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 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1021 | 1021 |
1022 AddCompositorSuperview(); | 1022 AddCompositorSuperview(); |
1023 | 1023 |
1024 // TODO(tapted): Get this value from GpuDataManagerImpl via ViewsDelegate. | 1024 // TODO(tapted): Get this value from GpuDataManagerImpl via ViewsDelegate. |
1025 bool needs_gl_finish_workaround = false; | 1025 bool needs_gl_finish_workaround = false; |
1026 | 1026 |
1027 compositor_widget_.reset( | 1027 compositor_widget_.reset( |
1028 new ui::AcceleratedWidgetMac(needs_gl_finish_workaround)); | 1028 new ui::AcceleratedWidgetMac(needs_gl_finish_workaround)); |
1029 compositor_.reset( | 1029 compositor_.reset( |
1030 new ui::Compositor(context_factory, GetCompositorTaskRunner())); | 1030 new ui::Compositor(context_factory, GetCompositorTaskRunner())); |
1031 compositor_->SetAcceleratedWidgetAndStartCompositor( | 1031 compositor_->SetAcceleratedWidget(compositor_widget_->accelerated_widget()); |
1032 compositor_widget_->accelerated_widget()); | |
1033 compositor_widget_->SetNSView(this); | 1032 compositor_widget_->SetNSView(this); |
1034 } | 1033 } |
1035 | 1034 |
1036 void BridgedNativeWidget::InitCompositor() { | 1035 void BridgedNativeWidget::InitCompositor() { |
1037 DCHECK(layer()); | 1036 DCHECK(layer()); |
1038 float scale_factor = GetDeviceScaleFactorFromView(compositor_superview_); | 1037 float scale_factor = GetDeviceScaleFactorFromView(compositor_superview_); |
1039 gfx::Size size_in_dip = GetClientAreaSize(); | 1038 gfx::Size size_in_dip = GetClientAreaSize(); |
1040 compositor_->SetScaleAndSize(scale_factor, | 1039 compositor_->SetScaleAndSize(scale_factor, |
1041 ConvertSizeToPixel(scale_factor, size_in_dip)); | 1040 ConvertSizeToPixel(scale_factor, size_in_dip)); |
1042 compositor_->SetRootLayer(layer()); | 1041 compositor_->SetRootLayer(layer()); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 [bridged_view_ setMouseDownCanMoveWindow:draggable]; | 1179 [bridged_view_ setMouseDownCanMoveWindow:draggable]; |
1181 // AppKit will not update its cache of mouseDownCanMoveWindow unless something | 1180 // AppKit will not update its cache of mouseDownCanMoveWindow unless something |
1182 // changes. Previously we tried adding an NSView and removing it, but for some | 1181 // changes. Previously we tried adding an NSView and removing it, but for some |
1183 // reason it required reposting the mouse-down event, and didn't always work. | 1182 // reason it required reposting the mouse-down event, and didn't always work. |
1184 // Calling the below seems to be an effective solution. | 1183 // Calling the below seems to be an effective solution. |
1185 [window_ setMovableByWindowBackground:NO]; | 1184 [window_ setMovableByWindowBackground:NO]; |
1186 [window_ setMovableByWindowBackground:YES]; | 1185 [window_ setMovableByWindowBackground:YES]; |
1187 } | 1186 } |
1188 | 1187 |
1189 } // namespace views | 1188 } // namespace views |
OLD | NEW |