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
3 // found in the LICENSE file.
5 #include <Cocoa/Cocoa.h>
7 #include "ui/aura/window_tree_host.h"
8 #include "ui/aura/window_tree_host_mac.h"
12 WindowTreeHostMac::WindowTreeHostMac(const gfx::Rect& bounds) {
15 initWithContentRect:NSRectFromCGRect(bounds.ToCGRect())
16 styleMask:NSBorderlessWindowMask
17 backing:NSBackingStoreBuffered
20 OnAcceleratedWidgetAvailable();
23 WindowTreeHostMac::~WindowTreeHostMac() {
27 EventSource* WindowTreeHostMac::GetEventSource() {
32 gfx::AcceleratedWidget WindowTreeHostMac::GetAcceleratedWidget() {
33 return [window_ contentView];
35 void WindowTreeHostMac::ShowImpl() {
36 [window_ makeKeyAndOrderFront:nil];
39 void WindowTreeHostMac::HideImpl() {
40 [window_ orderOut:nil];
43 void WindowTreeHostMac::ToggleFullScreen() {
46 gfx::Rect WindowTreeHostMac::GetBounds() const {
47 return gfx::Rect(NSRectToCGRect([window_ frame]));
50 void WindowTreeHostMac::SetBounds(const gfx::Rect& bounds) {
51 [window_ setFrame:NSRectFromCGRect(bounds.ToCGRect()) display:YES animate:NO];
54 gfx::Insets WindowTreeHostMac::GetInsets() const {
59 void WindowTreeHostMac::SetInsets(const gfx::Insets& insets) {
63 gfx::Point WindowTreeHostMac::GetLocationOnNativeScreen() const {
65 return gfx::Point(0, 0);
68 void WindowTreeHostMac::SetCapture() {
72 void WindowTreeHostMac::ReleaseCapture() {
76 bool WindowTreeHostMac::ConfineCursorToRootWindow() {
80 void WindowTreeHostMac::UnConfineCursor() {
84 void WindowTreeHostMac::SetCursorNative(gfx::NativeCursor cursor_type) {
88 void WindowTreeHostMac::MoveCursorToNative(const gfx::Point& location) {
92 void WindowTreeHostMac::OnCursorVisibilityChangedNative(bool show) {
96 void WindowTreeHostMac::OnDeviceScaleFactorChanged(float device_scale_factor) {
101 WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds) {
102 return new WindowTreeHostMac(bounds);
106 gfx::Size WindowTreeHost::GetNativeScreenSize() {
108 return gfx::Size(1024, 768);