OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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/root_window_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 RootWindowHostMac::RootWindowHostMac(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 RootWindowHostMac::~RootWindowHostMac() { |
| 24 } |
| 25 |
| 26 RootWindow* RootWindowHostMac::GetRootWindow() { |
| 27 return delegate_->AsRootWindow(); |
| 28 } |
| 29 |
| 30 gfx::AcceleratedWidget RootWindowHostMac::GetAcceleratedWidget() { |
| 31 return [window_ contentView]; |
| 32 } |
| 33 void RootWindowHostMac::Show() { |
| 34 [window_ makeKeyAndOrderFront:nil]; |
| 35 } |
| 36 |
| 37 void RootWindowHostMac::Hide() { |
| 38 [window_ orderOut:nil]; |
| 39 } |
| 40 |
| 41 void RootWindowHostMac::ToggleFullScreen() { |
| 42 } |
| 43 |
| 44 gfx::Rect RootWindowHostMac::GetBounds() const { |
| 45 return gfx::Rect(NSRectToCGRect([window_ frame])); |
| 46 } |
| 47 |
| 48 void RootWindowHostMac::SetBounds(const gfx::Rect& bounds) { |
| 49 [window_ setFrame:NSRectFromCGRect(bounds.ToCGRect()) display:YES animate:NO]; |
| 50 } |
| 51 |
| 52 gfx::Insets RootWindowHostMac::GetInsets() const { |
| 53 NOTIMPLEMENTED(); |
| 54 return gfx::Insets(); |
| 55 } |
| 56 |
| 57 void RootWindowHostMac::SetInsets(const gfx::Insets& insets) { |
| 58 NOTIMPLEMENTED(); |
| 59 } |
| 60 |
| 61 gfx::Point RootWindowHostMac::GetLocationOnNativeScreen() const { |
| 62 NOTIMPLEMENTED(); |
| 63 return gfx::Point(0, 0); |
| 64 } |
| 65 |
| 66 void RootWindowHostMac::SetCapture() { |
| 67 NOTIMPLEMENTED(); |
| 68 } |
| 69 |
| 70 void RootWindowHostMac::ReleaseCapture() { |
| 71 NOTIMPLEMENTED(); |
| 72 } |
| 73 |
| 74 void RootWindowHostMac::SetCursor(gfx::NativeCursor cursor_type) { |
| 75 NOTIMPLEMENTED(); |
| 76 } |
| 77 |
| 78 bool RootWindowHostMac::QueryMouseLocation(gfx::Point* location_return) { |
| 79 NOTIMPLEMENTED(); |
| 80 return false; |
| 81 } |
| 82 |
| 83 bool RootWindowHostMac::ConfineCursorToRootWindow() { |
| 84 return false; |
| 85 } |
| 86 |
| 87 void RootWindowHostMac::UnConfineCursor() { |
| 88 NOTIMPLEMENTED(); |
| 89 } |
| 90 |
| 91 void RootWindowHostMac::OnCursorVisibilityChanged(bool show) { |
| 92 NOTIMPLEMENTED(); |
| 93 } |
| 94 |
| 95 void RootWindowHostMac::MoveCursorTo(const gfx::Point& location) { |
| 96 NOTIMPLEMENTED(); |
| 97 } |
| 98 |
| 99 void RootWindowHostMac::PostNativeEvent(const base::NativeEvent& event) { |
| 100 NOTIMPLEMENTED(); |
| 101 } |
| 102 |
| 103 void RootWindowHostMac::OnDeviceScaleFactorChanged(float device_scale_factor) { |
| 104 NOTIMPLEMENTED(); |
| 105 } |
| 106 |
| 107 void RootWindowHostMac::PrepareForShutdown() { |
| 108 NOTIMPLEMENTED(); |
| 109 } |
| 110 |
| 111 // static |
| 112 RootWindowHost* RootWindowHost::Create(const gfx::Rect& bounds) { |
| 113 return new RootWindowHostMac(bounds); |
| 114 } |
| 115 |
| 116 // static |
| 117 gfx::Size RootWindowHost::GetNativeScreenSize() { |
| 118 NOTIMPLEMENTED(); |
| 119 return gfx::Size(1024, 768); |
| 120 } |
| 121 |
| 122 } // namespace aura |
OLD | NEW |