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 "ui/compositor/test/test_compositor_host.h" | 5 #include "ui/compositor/test/test_compositor_host.h" |
6 | 6 |
7 #import <AppKit/NSApplication.h> | 7 #import <AppKit/NSApplication.h> |
8 #import <AppKit/NSOpenGL.h> | 8 #import <AppKit/NSOpenGL.h> |
9 #import <AppKit/NSView.h> | 9 #import <AppKit/NSView.h> |
10 #import <AppKit/NSWindow.h> | 10 #import <AppKit/NSWindow.h> |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 window_ = [[NSWindow alloc] | 123 window_ = [[NSWindow alloc] |
124 initWithContentRect:NSMakeRect(bounds_.x(), | 124 initWithContentRect:NSMakeRect(bounds_.x(), |
125 bounds_.y(), | 125 bounds_.y(), |
126 bounds_.width(), | 126 bounds_.width(), |
127 bounds_.height()) | 127 bounds_.height()) |
128 styleMask:NSBorderlessWindowMask | 128 styleMask:NSBorderlessWindowMask |
129 backing:NSBackingStoreBuffered | 129 backing:NSBackingStoreBuffered |
130 defer:NO]; | 130 defer:NO]; |
131 base::scoped_nsobject<AcceleratedTestView> view( | 131 base::scoped_nsobject<AcceleratedTestView> view( |
132 [[AcceleratedTestView alloc] init]); | 132 [[AcceleratedTestView alloc] init]); |
133 compositor_.reset(new ui::Compositor(view, | 133 compositor_.reset(new ui::Compositor(context_factory_, |
134 context_factory_, | |
135 base::ThreadTaskRunnerHandle::Get())); | 134 base::ThreadTaskRunnerHandle::Get())); |
| 135 compositor_->OnAcceleratedWidgetAvailable(view); |
136 compositor_->SetScaleAndSize(1.0f, bounds_.size()); | 136 compositor_->SetScaleAndSize(1.0f, bounds_.size()); |
137 [view setCompositor:compositor_.get()]; | 137 [view setCompositor:compositor_.get()]; |
138 [window_ setContentView:view]; | 138 [window_ setContentView:view]; |
139 [window_ orderFront:nil]; | 139 [window_ orderFront:nil]; |
140 } | 140 } |
141 | 141 |
142 ui::Compositor* TestCompositorHostMac::GetCompositor() { | 142 ui::Compositor* TestCompositorHostMac::GetCompositor() { |
143 return compositor_.get(); | 143 return compositor_.get(); |
144 } | 144 } |
145 | 145 |
146 // static | 146 // static |
147 TestCompositorHost* TestCompositorHost::Create( | 147 TestCompositorHost* TestCompositorHost::Create( |
148 const gfx::Rect& bounds, | 148 const gfx::Rect& bounds, |
149 ui::ContextFactory* context_factory) { | 149 ui::ContextFactory* context_factory) { |
150 return new TestCompositorHostMac(bounds, context_factory); | 150 return new TestCompositorHostMac(bounds, context_factory); |
151 } | 151 } |
152 | 152 |
153 } // namespace ui | 153 } // namespace ui |
OLD | NEW |