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