| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/window_tree_host_platform.h" | 5 #include "ui/aura/window_tree_host_platform.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 } | 91 } |
| 92 | 92 |
| 93 gfx::Rect WindowTreeHostPlatform::GetBounds() const { | 93 gfx::Rect WindowTreeHostPlatform::GetBounds() const { |
| 94 return window_ ? window_->GetBounds() : gfx::Rect(); | 94 return window_ ? window_->GetBounds() : gfx::Rect(); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void WindowTreeHostPlatform::SetBounds(const gfx::Rect& bounds) { | 97 void WindowTreeHostPlatform::SetBounds(const gfx::Rect& bounds) { |
| 98 window_->SetBounds(bounds); | 98 window_->SetBounds(bounds); |
| 99 } | 99 } |
| 100 | 100 |
| 101 gfx::Point WindowTreeHostPlatform::GetLocationOnNativeScreen() const { | 101 gfx::Point WindowTreeHostPlatform::GetLocationOnNativeScreenInPixels() const { |
| 102 return window_->GetBounds().origin(); | 102 return window_->GetBounds().origin(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 void WindowTreeHostPlatform::SetCapture() { | 105 void WindowTreeHostPlatform::SetCapture() { |
| 106 window_->SetCapture(); | 106 window_->SetCapture(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void WindowTreeHostPlatform::ReleaseCapture() { | 109 void WindowTreeHostPlatform::ReleaseCapture() { |
| 110 window_->ReleaseCapture(); | 110 window_->ReleaseCapture(); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void WindowTreeHostPlatform::SetCursorNative(gfx::NativeCursor cursor) { | 113 void WindowTreeHostPlatform::SetCursorNative(gfx::NativeCursor cursor) { |
| 114 if (cursor == current_cursor_) | 114 if (cursor == current_cursor_) |
| 115 return; | 115 return; |
| 116 current_cursor_ = cursor; | 116 current_cursor_ = cursor; |
| 117 | 117 |
| 118 #if defined(OS_WIN) | 118 #if defined(OS_WIN) |
| 119 ui::CursorLoaderWin cursor_loader; | 119 ui::CursorLoaderWin cursor_loader; |
| 120 cursor_loader.SetPlatformCursor(&cursor); | 120 cursor_loader.SetPlatformCursor(&cursor); |
| 121 #endif | 121 #endif |
| 122 | 122 |
| 123 window_->SetCursor(cursor.platform()); | 123 window_->SetCursor(cursor.platform()); |
| 124 } | 124 } |
| 125 | 125 |
| 126 void WindowTreeHostPlatform::MoveCursorToNative(const gfx::Point& location) { | 126 void WindowTreeHostPlatform::MoveCursorToNativeInPixels( |
| 127 window_->MoveCursorTo(location); | 127 const gfx::Point& location_in_pixels) { |
| 128 window_->MoveCursorTo(location_in_pixels); |
| 128 } | 129 } |
| 129 | 130 |
| 130 void WindowTreeHostPlatform::OnCursorVisibilityChangedNative(bool show) { | 131 void WindowTreeHostPlatform::OnCursorVisibilityChangedNative(bool show) { |
| 131 NOTIMPLEMENTED(); | 132 NOTIMPLEMENTED(); |
| 132 } | 133 } |
| 133 | 134 |
| 134 void WindowTreeHostPlatform::OnBoundsChanged(const gfx::Rect& new_bounds) { | 135 void WindowTreeHostPlatform::OnBoundsChanged(const gfx::Rect& new_bounds) { |
| 135 float current_scale = compositor()->device_scale_factor(); | 136 float current_scale = compositor()->device_scale_factor(); |
| 136 float new_scale = display::Screen::GetScreen() | 137 float new_scale = display::Screen::GetScreen() |
| 137 ->GetDisplayNearestWindow(window()) | 138 ->GetDisplayNearestWindow(window()) |
| 138 .device_scale_factor(); | 139 .device_scale_factor(); |
| 139 gfx::Rect old_bounds = bounds_; | 140 gfx::Rect old_bounds = bounds_; |
| 140 bounds_ = new_bounds; | 141 bounds_ = new_bounds; |
| 141 if (bounds_.origin() != old_bounds.origin()) { | 142 if (bounds_.origin() != old_bounds.origin()) { |
| 142 OnHostMoved(bounds_.origin()); | 143 OnHostMovedInPixels(bounds_.origin()); |
| 143 } | 144 } |
| 144 if (bounds_.size() != old_bounds.size() || current_scale != new_scale) { | 145 if (bounds_.size() != old_bounds.size() || current_scale != new_scale) { |
| 145 OnHostResized(bounds_.size()); | 146 OnHostResizedInPixels(bounds_.size()); |
| 146 } | 147 } |
| 147 } | 148 } |
| 148 | 149 |
| 149 void WindowTreeHostPlatform::OnDamageRect(const gfx::Rect& damage_rect) { | 150 void WindowTreeHostPlatform::OnDamageRect(const gfx::Rect& damage_rect) { |
| 150 compositor()->ScheduleRedrawRect(damage_rect); | 151 compositor()->ScheduleRedrawRect(damage_rect); |
| 151 } | 152 } |
| 152 | 153 |
| 153 void WindowTreeHostPlatform::DispatchEvent(ui::Event* event) { | 154 void WindowTreeHostPlatform::DispatchEvent(ui::Event* event) { |
| 154 TRACE_EVENT0("input", "WindowTreeHostPlatform::DispatchEvent"); | 155 TRACE_EVENT0("input", "WindowTreeHostPlatform::DispatchEvent"); |
| 155 ui::EventDispatchDetails details = SendEventToProcessor(event); | 156 ui::EventDispatchDetails details = SendEventToProcessor(event); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 DCHECK_EQ(widget, widget_); | 188 DCHECK_EQ(widget, widget_); |
| 188 widget_ = gfx::kNullAcceleratedWidget; | 189 widget_ = gfx::kNullAcceleratedWidget; |
| 189 } | 190 } |
| 190 | 191 |
| 191 void WindowTreeHostPlatform::OnActivationChanged(bool active) { | 192 void WindowTreeHostPlatform::OnActivationChanged(bool active) { |
| 192 if (active) | 193 if (active) |
| 193 OnHostActivated(); | 194 OnHostActivated(); |
| 194 } | 195 } |
| 195 | 196 |
| 196 } // namespace aura | 197 } // namespace aura |
| OLD | NEW |