Fix OOP <webview> resize and autosize.
[chromium-blink-merge.git] / ui / aura / window_tree_host_mac.mm
blob4734bf01c6982c90d05fd3ea7fa95faa49043592
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();
20   OnAcceleratedWidgetAvailable();
23 WindowTreeHostMac::~WindowTreeHostMac() {
24   DestroyDispatcher();
27 EventSource* WindowTreeHostMac::GetEventSource() {
28   NOTIMPLEMENTED();
29   return nil;
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 {
55   NOTIMPLEMENTED();
56   return gfx::Insets();
59 void WindowTreeHostMac::SetInsets(const gfx::Insets& insets) {
60   NOTIMPLEMENTED();
63 gfx::Point WindowTreeHostMac::GetLocationOnNativeScreen() const {
64   NOTIMPLEMENTED();
65   return gfx::Point(0, 0);
68 void WindowTreeHostMac::SetCapture() {
69   NOTIMPLEMENTED();
72 void WindowTreeHostMac::ReleaseCapture() {
73   NOTIMPLEMENTED();
76 bool WindowTreeHostMac::ConfineCursorToRootWindow() {
77   return false;
80 void WindowTreeHostMac::UnConfineCursor() {
81   NOTIMPLEMENTED();
84 void WindowTreeHostMac::SetCursorNative(gfx::NativeCursor cursor_type) {
85   NOTIMPLEMENTED();
88 void WindowTreeHostMac::MoveCursorToNative(const gfx::Point& location) {
89   NOTIMPLEMENTED();
92 void WindowTreeHostMac::OnCursorVisibilityChangedNative(bool show) {
93   NOTIMPLEMENTED();
96 void WindowTreeHostMac::OnDeviceScaleFactorChanged(float device_scale_factor) {
97   NOTIMPLEMENTED();
100 // static
101 WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds) {
102   return new WindowTreeHostMac(bounds);
105 // static
106 gfx::Size WindowTreeHost::GetNativeScreenSize() {
107   NOTIMPLEMENTED();
108   return gfx::Size(1024, 768);
111 }  // namespace aura