OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/aura/root_window_host_mac.h" | 5 #include "ui/aura/root_window_host_mac.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/mac/bundle_locations.h" | 10 #include "base/mac/bundle_locations.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 // event dispatch and the Aura event processing. | 25 // event dispatch and the Aura event processing. |
26 class RootWindowHostMac : public RootWindowHost, | 26 class RootWindowHostMac : public RootWindowHost, |
27 public RootWindowHostMacDelegate { | 27 public RootWindowHostMacDelegate { |
28 public: | 28 public: |
29 explicit RootWindowHostMac(const gfx::Rect& bounds); | 29 explicit RootWindowHostMac(const gfx::Rect& bounds); |
30 virtual ~RootWindowHostMac(); | 30 virtual ~RootWindowHostMac(); |
31 | 31 |
32 // RootWindowHost: | 32 // RootWindowHost: |
33 virtual void SetRootWindow(RootWindow* root_window) OVERRIDE; | 33 virtual void SetRootWindow(RootWindow* root_window) OVERRIDE; |
34 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; | 34 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; |
| 35 virtual gfx::AcceleratedWidget GetAcceleratedWidgetUsedForEvents() OVERRIDE; |
35 virtual void Show() OVERRIDE; | 36 virtual void Show() OVERRIDE; |
36 virtual void ToggleFullScreen() OVERRIDE; | 37 virtual void ToggleFullScreen() OVERRIDE; |
37 virtual gfx::Size GetSize() const OVERRIDE; | 38 virtual gfx::Size GetSize() const OVERRIDE; |
38 virtual void SetSize(const gfx::Size& size) OVERRIDE; | 39 virtual void SetSize(const gfx::Size& size) OVERRIDE; |
39 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; | 40 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; |
40 virtual void SetCapture() OVERRIDE; | 41 virtual void SetCapture() OVERRIDE; |
41 virtual void ReleaseCapture() OVERRIDE; | 42 virtual void ReleaseCapture() OVERRIDE; |
42 virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE; | 43 virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE; |
43 virtual void ShowCursor(bool show) OVERRIDE; | 44 virtual void ShowCursor(bool show) OVERRIDE; |
44 virtual gfx::Point QueryMouseLocation() OVERRIDE; | 45 virtual gfx::Point QueryMouseLocation() OVERRIDE; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 117 |
117 RootWindowMac* window = static_cast<RootWindowMac*>([controller_ window]); | 118 RootWindowMac* window = static_cast<RootWindowMac*>([controller_ window]); |
118 DCHECK([window respondsToSelector:@selector(setHostDelegate:)]); | 119 DCHECK([window respondsToSelector:@selector(setHostDelegate:)]); |
119 [window setHostDelegate:this]; | 120 [window setHostDelegate:this]; |
120 } | 121 } |
121 | 122 |
122 gfx::AcceleratedWidget RootWindowHostMac::GetAcceleratedWidget() { | 123 gfx::AcceleratedWidget RootWindowHostMac::GetAcceleratedWidget() { |
123 return [[controller_ window] contentView]; | 124 return [[controller_ window] contentView]; |
124 } | 125 } |
125 | 126 |
| 127 gfx::AcceleratedWidget RootWindowHostMac:: |
| 128 GetAcceleratedWidgetUsedForEvents() { |
| 129 return [[controller_ window] contentView]; |
| 130 } |
| 131 |
126 void RootWindowHostMac::Show() { | 132 void RootWindowHostMac::Show() { |
127 [controller_ showWindow:controller_]; | 133 [controller_ showWindow:controller_]; |
128 } | 134 } |
129 | 135 |
130 void RootWindowHostMac::ToggleFullScreen() { | 136 void RootWindowHostMac::ToggleFullScreen() { |
131 } | 137 } |
132 | 138 |
133 gfx::Size RootWindowHostMac::GetSize() const { | 139 gfx::Size RootWindowHostMac::GetSize() const { |
134 NSSize size = [[[controller_ window] contentView] bounds].size; | 140 NSSize size = [[[controller_ window] contentView] bounds].size; |
135 return gfx::Size(NSSizeToCGSize(size)); | 141 return gfx::Size(NSSizeToCGSize(size)); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 | 221 |
216 void RootWindowHostMac::SetLocation(const gfx::Rect& bounds) { | 222 void RootWindowHostMac::SetLocation(const gfx::Rect& bounds) { |
217 NSRect screen = [[NSScreen mainScreen] visibleFrame]; | 223 NSRect screen = [[NSScreen mainScreen] visibleFrame]; |
218 NSPoint origin = NSMakePoint(screen.origin.x + bounds.x(), | 224 NSPoint origin = NSMakePoint(screen.origin.x + bounds.x(), |
219 screen.origin.y + screen.size.height - | 225 screen.origin.y + screen.size.height - |
220 bounds.y() - bounds.height()); | 226 bounds.y() - bounds.height()); |
221 [[controller_ window] setFrameOrigin:origin]; | 227 [[controller_ window] setFrameOrigin:origin]; |
222 } | 228 } |
223 | 229 |
224 } // namespace aura | 230 } // namespace aura |
OLD | NEW |