Roll src/third_party/WebKit 9301d6f:4619053 (svn 201058:201059)
[chromium-blink-merge.git] / ui / aura / window_tree_host_mac.mm
blobb177d70f07b5529ee08b4cf894f6dbeeb5073820
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"
10 namespace aura {
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());
22 WindowTreeHostMac::~WindowTreeHostMac() {
23   DestroyDispatcher();
26 EventSource* WindowTreeHostMac::GetEventSource() {
27   NOTIMPLEMENTED();
28   return nil;
31 gfx::AcceleratedWidget WindowTreeHostMac::GetAcceleratedWidget() {
32   return [window_ contentView];
34 void WindowTreeHostMac::ShowImpl() {
35   [window_ makeKeyAndOrderFront:nil];
38 void WindowTreeHostMac::HideImpl() {
39   [window_ orderOut:nil];
42 void WindowTreeHostMac::ToggleFullScreen() {
45 gfx::Rect WindowTreeHostMac::GetBounds() const {
46   return gfx::Rect(NSRectToCGRect([window_ frame]));
49 void WindowTreeHostMac::SetBounds(const gfx::Rect& bounds) {
50   [window_ setFrame:NSRectFromCGRect(bounds.ToCGRect()) display:YES animate:NO];
53 gfx::Insets WindowTreeHostMac::GetInsets() const {
54   NOTIMPLEMENTED();
55   return gfx::Insets();
58 void WindowTreeHostMac::SetInsets(const gfx::Insets& insets) {
59   NOTIMPLEMENTED();
62 gfx::Point WindowTreeHostMac::GetLocationOnNativeScreen() const {
63   NOTIMPLEMENTED();
64   return gfx::Point(0, 0);
67 void WindowTreeHostMac::SetCapture() {
68   NOTIMPLEMENTED();
71 void WindowTreeHostMac::ReleaseCapture() {
72   NOTIMPLEMENTED();
75 bool WindowTreeHostMac::ConfineCursorToRootWindow() {
76   return false;
79 void WindowTreeHostMac::UnConfineCursor() {
80   NOTIMPLEMENTED();
83 void WindowTreeHostMac::SetCursorNative(gfx::NativeCursor cursor_type) {
84   NOTIMPLEMENTED();
87 void WindowTreeHostMac::MoveCursorToNative(const gfx::Point& location) {
88   NOTIMPLEMENTED();
91 void WindowTreeHostMac::OnCursorVisibilityChangedNative(bool show) {
92   NOTIMPLEMENTED();
95 void WindowTreeHostMac::OnDeviceScaleFactorChanged(float device_scale_factor) {
96   NOTIMPLEMENTED();
99 // static
100 WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds) {
101   return new WindowTreeHostMac(bounds);
104 // static
105 gfx::Size WindowTreeHost::GetNativeScreenSize() {
106   NOTIMPLEMENTED();
107   return gfx::Size(1024, 768);
110 }  // namespace aura