Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / ui / aura / window_tree_host_mac.mm
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.
4
5 #include <Cocoa/Cocoa.h>
6
7 #include "ui/aura/window_tree_host_mac.h"
8 #include "ui/aura/window_tree_host.h"
9 #include "ui/aura/window_tree_host_delegate.h"
10
11 namespace aura {
12
13 WindowTreeHostMac::WindowTreeHostMac(const gfx::Rect& bounds) {
14   window_.reset(
15       [[NSWindow alloc]
16           initWithContentRect:NSRectFromCGRect(bounds.ToCGRect())
17                     styleMask:NSBorderlessWindowMask
18                       backing:NSBackingStoreBuffered
19                         defer:NO]);
20   CreateCompositor(GetAcceleratedWidget());
21 }
22
23 WindowTreeHostMac::~WindowTreeHostMac() {
24 }
25
26 RootWindow* WindowTreeHostMac::GetRootWindow() {
27   return delegate_->AsRootWindow();
28 }
29
30 gfx::AcceleratedWidget WindowTreeHostMac::GetAcceleratedWidget() {
31   return [window_ contentView];
32 }
33 void WindowTreeHostMac::Show() {
34   [window_ makeKeyAndOrderFront:nil];
35 }
36
37 void WindowTreeHostMac::Hide() {
38   [window_ orderOut:nil];
39 }
40
41 void WindowTreeHostMac::ToggleFullScreen() {
42 }
43
44 gfx::Rect WindowTreeHostMac::GetBounds() const {
45   return gfx::Rect(NSRectToCGRect([window_ frame]));
46 }
47
48 void WindowTreeHostMac::SetBounds(const gfx::Rect& bounds) {
49   [window_ setFrame:NSRectFromCGRect(bounds.ToCGRect()) display:YES animate:NO];
50 }
51
52 gfx::Insets WindowTreeHostMac::GetInsets() const {
53   NOTIMPLEMENTED();
54   return gfx::Insets();
55 }
56
57 void WindowTreeHostMac::SetInsets(const gfx::Insets& insets) {
58   NOTIMPLEMENTED();
59 }
60
61 gfx::Point WindowTreeHostMac::GetLocationOnNativeScreen() const {
62   NOTIMPLEMENTED();
63   return gfx::Point(0, 0);
64 }
65
66 void WindowTreeHostMac::SetCapture() {
67   NOTIMPLEMENTED();
68 }
69
70 void WindowTreeHostMac::ReleaseCapture() {
71   NOTIMPLEMENTED();
72 }
73
74 bool WindowTreeHostMac::QueryMouseLocation(gfx::Point* location_return) {
75   NOTIMPLEMENTED();
76   return false;
77 }
78
79 bool WindowTreeHostMac::ConfineCursorToRootWindow() {
80   return false;
81 }
82
83 void WindowTreeHostMac::UnConfineCursor() {
84   NOTIMPLEMENTED();
85 }
86
87 void WindowTreeHostMac::SetCursorNative(gfx::NativeCursor cursor_type) {
88   NOTIMPLEMENTED();
89 }
90
91 void WindowTreeHostMac::MoveCursorToNative(const gfx::Point& location) {
92   NOTIMPLEMENTED();
93 }
94
95 void WindowTreeHostMac::OnCursorVisibilityChangedNative(bool show) {
96   NOTIMPLEMENTED();
97 }
98
99 void WindowTreeHostMac::PostNativeEvent(const base::NativeEvent& event) {
100   NOTIMPLEMENTED();
101 }
102
103 void WindowTreeHostMac::OnDeviceScaleFactorChanged(float device_scale_factor) {
104   NOTIMPLEMENTED();
105 }
106
107 void WindowTreeHostMac::PrepareForShutdown() {
108   NOTIMPLEMENTED();
109 }
110
111 // static
112 WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds) {
113   return new WindowTreeHostMac(bounds);
114 }
115
116 // static
117 gfx::Size WindowTreeHost::GetNativeScreenSize() {
118   NOTIMPLEMENTED();
119   return gfx::Size(1024, 768);
120 }
121
122 }  // namespace aura