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 GrabSnapshot( |
| 49 const gfx::Rect& snapshot_bounds, |
| 50 std::vector<unsigned char>* png_representation) 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::GrabSnapshot( |
| 176 const gfx::Rect& snapshot_bounds, |
| 177 std::vector<unsigned char>* png_representation) { |
| 178 NOTIMPLEMENTED(); |
| 179 return false; |
| 180 } |
| 181 |
172 void RootWindowHostMac::SendEvent(const base::NativeEvent& native_event) { | 182 void RootWindowHostMac::SendEvent(const base::NativeEvent& native_event) { |
173 ui::EventType type = ui::EventTypeFromNative(native_event); | 183 ui::EventType type = ui::EventTypeFromNative(native_event); |
174 switch (type) { | 184 switch (type) { |
175 case ui::ET_MOUSE_PRESSED: | 185 case ui::ET_MOUSE_PRESSED: |
176 case ui::ET_MOUSE_DRAGGED: | 186 case ui::ET_MOUSE_DRAGGED: |
177 case ui::ET_MOUSE_RELEASED: | 187 case ui::ET_MOUSE_RELEASED: |
178 case ui::ET_MOUSE_MOVED: | 188 case ui::ET_MOUSE_MOVED: |
179 case ui::ET_MOUSE_ENTERED: | 189 case ui::ET_MOUSE_ENTERED: |
180 case ui::ET_MOUSE_EXITED: { | 190 case ui::ET_MOUSE_EXITED: { |
181 MouseEvent mouse_event(native_event); | 191 MouseEvent mouse_event(native_event); |
(...skipping 23 matching lines...) Expand all Loading... |
205 | 215 |
206 void RootWindowHostMac::SetLocation(const gfx::Rect& bounds) { | 216 void RootWindowHostMac::SetLocation(const gfx::Rect& bounds) { |
207 NSRect screen = [[NSScreen mainScreen] visibleFrame]; | 217 NSRect screen = [[NSScreen mainScreen] visibleFrame]; |
208 NSPoint origin = NSMakePoint(screen.origin.x + bounds.x(), | 218 NSPoint origin = NSMakePoint(screen.origin.x + bounds.x(), |
209 screen.origin.y + screen.size.height - | 219 screen.origin.y + screen.size.height - |
210 bounds.y() - bounds.height()); | 220 bounds.y() - bounds.height()); |
211 [[controller_ window] setFrameOrigin:origin]; | 221 [[controller_ window] setFrameOrigin:origin]; |
212 } | 222 } |
213 | 223 |
214 } // namespace aura | 224 } // namespace aura |
OLD | NEW |