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 27 matching lines...) Expand all Loading... | |
38 virtual void SetSize(const gfx::Size& size) OVERRIDE; | 38 virtual void SetSize(const gfx::Size& size) OVERRIDE; |
39 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; | 39 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; |
40 virtual void SetCapture() OVERRIDE; | 40 virtual void SetCapture() OVERRIDE; |
41 virtual void ReleaseCapture() OVERRIDE; | 41 virtual void ReleaseCapture() OVERRIDE; |
42 virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE; | 42 virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE; |
43 virtual void ShowCursor(bool show) OVERRIDE; | 43 virtual void ShowCursor(bool show) OVERRIDE; |
44 virtual gfx::Point QueryMouseLocation() OVERRIDE; | 44 virtual gfx::Point QueryMouseLocation() OVERRIDE; |
45 virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE; | 45 virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE; |
46 virtual bool ConfineCursorToRootWindow() OVERRIDE; | 46 virtual bool ConfineCursorToRootWindow() OVERRIDE; |
47 virtual void UnConfineCursor() OVERRIDE; | 47 virtual void UnConfineCursor() OVERRIDE; |
48 virtual bool GrabWindowSnapshot( | |
49 std::vector<unsigned char>* png_representation, | |
50 const gfx::Rect& snapshot_bounds) OVERRIDE; | |
48 | 51 |
49 // RootWindowHostMacDelegate: | 52 // RootWindowHostMacDelegate: |
50 virtual void SendEvent(const base::NativeEvent& native_event) OVERRIDE; | 53 virtual void SendEvent(const base::NativeEvent& native_event) OVERRIDE; |
51 | 54 |
52 // Set the initial location of the root window. The origin of |bounds| is | 55 // Set the initial location of the root window. The origin of |bounds| is |
53 // top-left. This gets converted to bottom-left to match Mac coordinates on | 56 // top-left. This gets converted to bottom-left to match Mac coordinates on |
54 // the main screen. | 57 // the main screen. |
55 void SetLocation(const gfx::Rect& bounds); | 58 void SetLocation(const gfx::Rect& bounds); |
56 | 59 |
57 private: | 60 private: |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
162 void RootWindowHostMac::MoveCursorTo(const gfx::Point& location) { | 165 void RootWindowHostMac::MoveCursorTo(const gfx::Point& location) { |
163 } | 166 } |
164 | 167 |
165 bool RootWindowHostMac::ConfineCursorToRootWindow() { | 168 bool RootWindowHostMac::ConfineCursorToRootWindow() { |
166 return false; | 169 return false; |
167 } | 170 } |
168 | 171 |
169 void RootWindowHostMac::UnConfineCursor() { | 172 void RootWindowHostMac::UnConfineCursor() { |
170 } | 173 } |
171 | 174 |
175 bool RootWindowHostMac::GrabWindowSnapshot( | |
176 std::vector<unsigned char>* png_representation, | |
177 const gfx::Rect& snapshot_bounds) { | |
178 return false; | |
Daniel Erat
2012/05/14 23:17:40
NOTIMPLEMENTED()
Jun Mukai
2012/05/15 22:39:24
Done.
| |
179 } | |
180 | |
172 void RootWindowHostMac::SendEvent(const base::NativeEvent& native_event) { | 181 void RootWindowHostMac::SendEvent(const base::NativeEvent& native_event) { |
173 ui::EventType type = ui::EventTypeFromNative(native_event); | 182 ui::EventType type = ui::EventTypeFromNative(native_event); |
174 switch (type) { | 183 switch (type) { |
175 case ui::ET_MOUSE_PRESSED: | 184 case ui::ET_MOUSE_PRESSED: |
176 case ui::ET_MOUSE_DRAGGED: | 185 case ui::ET_MOUSE_DRAGGED: |
177 case ui::ET_MOUSE_RELEASED: | 186 case ui::ET_MOUSE_RELEASED: |
178 case ui::ET_MOUSE_MOVED: | 187 case ui::ET_MOUSE_MOVED: |
179 case ui::ET_MOUSE_ENTERED: | 188 case ui::ET_MOUSE_ENTERED: |
180 case ui::ET_MOUSE_EXITED: { | 189 case ui::ET_MOUSE_EXITED: { |
181 MouseEvent mouse_event(native_event); | 190 MouseEvent mouse_event(native_event); |
(...skipping 23 matching lines...) Expand all Loading... | |
205 | 214 |
206 void RootWindowHostMac::SetLocation(const gfx::Rect& bounds) { | 215 void RootWindowHostMac::SetLocation(const gfx::Rect& bounds) { |
207 NSRect screen = [[NSScreen mainScreen] visibleFrame]; | 216 NSRect screen = [[NSScreen mainScreen] visibleFrame]; |
208 NSPoint origin = NSMakePoint(screen.origin.x + bounds.x(), | 217 NSPoint origin = NSMakePoint(screen.origin.x + bounds.x(), |
209 screen.origin.y + screen.size.height - | 218 screen.origin.y + screen.size.height - |
210 bounds.y() - bounds.height()); | 219 bounds.y() - bounds.height()); |
211 [[controller_ window] setFrameOrigin:origin]; | 220 [[controller_ window] setFrameOrigin:origin]; |
212 } | 221 } |
213 | 222 |
214 } // namespace aura | 223 } // namespace aura |
OLD | NEW |