| 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(std::vector<unsigned char>* png_representation, |
| 49 const gfx::Rect& snapshot_bounds) OVERRIDE; |
| 48 | 50 |
| 49 // RootWindowHostMacDelegate: | 51 // RootWindowHostMacDelegate: |
| 50 virtual void SendEvent(const base::NativeEvent& native_event) OVERRIDE; | 52 virtual void SendEvent(const base::NativeEvent& native_event) OVERRIDE; |
| 51 | 53 |
| 52 // Set the initial location of the root window. The origin of |bounds| is | 54 // 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 | 55 // top-left. This gets converted to bottom-left to match Mac coordinates on |
| 54 // the main screen. | 56 // the main screen. |
| 55 void SetLocation(const gfx::Rect& bounds); | 57 void SetLocation(const gfx::Rect& bounds); |
| 56 | 58 |
| 57 private: | 59 private: |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 void RootWindowHostMac::MoveCursorTo(const gfx::Point& location) { | 164 void RootWindowHostMac::MoveCursorTo(const gfx::Point& location) { |
| 163 } | 165 } |
| 164 | 166 |
| 165 bool RootWindowHostMac::ConfineCursorToRootWindow() { | 167 bool RootWindowHostMac::ConfineCursorToRootWindow() { |
| 166 return false; | 168 return false; |
| 167 } | 169 } |
| 168 | 170 |
| 169 void RootWindowHostMac::UnConfineCursor() { | 171 void RootWindowHostMac::UnConfineCursor() { |
| 170 } | 172 } |
| 171 | 173 |
| 174 bool RootWindowHostMac::GrabSnapshot( |
| 175 std::vector<unsigned char>* png_representation, |
| 176 const gfx::Rect& snapshot_bounds) { |
| 177 NOTIMPLEMENTED(); |
| 178 return false; |
| 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 |