| 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_win.h" | 5 #include "ui/aura/root_window_host_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| 11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 12 #include "ui/aura/client/capture_client.h" | 12 #include "ui/aura/client/capture_client.h" |
| 13 #include "ui/aura/client/cursor_client.h" | 13 #include "ui/aura/client/cursor_client.h" |
| 14 #include "ui/aura/root_window.h" | 14 #include "ui/aura/root_window.h" |
| 15 #include "ui/base/cursor/cursor_loader_win.h" | 15 #include "ui/base/cursor/cursor_loader_win.h" |
| 16 #include "ui/base/events/event.h" | 16 #include "ui/base/events/event.h" |
| 17 #include "ui/base/view_prop.h" | 17 #include "ui/base/view_prop.h" |
| 18 #include "ui/gfx/display.h" | 18 #include "ui/gfx/display.h" |
| 19 #include "ui/gfx/insets.h" |
| 19 #include "ui/gfx/screen.h" | 20 #include "ui/gfx/screen.h" |
| 20 | 21 |
| 21 using std::max; | 22 using std::max; |
| 22 using std::min; | 23 using std::min; |
| 23 | 24 |
| 24 namespace aura { | 25 namespace aura { |
| 25 namespace { | 26 namespace { |
| 26 | 27 |
| 27 bool use_popup_as_root_window_for_test = false; | 28 bool use_popup_as_root_window_for_test = false; |
| 28 | 29 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 140 |
| 140 // Explicity call OnHostResized when the scale has changed because | 141 // Explicity call OnHostResized when the scale has changed because |
| 141 // the window size may not have changed. | 142 // the window size may not have changed. |
| 142 float current_scale = delegate_->GetDeviceScaleFactor(); | 143 float current_scale = delegate_->GetDeviceScaleFactor(); |
| 143 float new_scale = gfx::Screen::GetScreenFor(delegate_->AsRootWindow())-> | 144 float new_scale = gfx::Screen::GetScreenFor(delegate_->AsRootWindow())-> |
| 144 GetDisplayNearestWindow(delegate_->AsRootWindow()).device_scale_factor(); | 145 GetDisplayNearestWindow(delegate_->AsRootWindow()).device_scale_factor(); |
| 145 if (current_scale != new_scale) | 146 if (current_scale != new_scale) |
| 146 delegate_->OnHostResized(bounds.size()); | 147 delegate_->OnHostResized(bounds.size()); |
| 147 } | 148 } |
| 148 | 149 |
| 150 gfx::Insets RootWindowHostWin::GetInsets() const { |
| 151 return gfx::Insets(); |
| 152 } |
| 153 |
| 154 void RootWindowHostWin::SetInsets(const gfx::Insets& insets) { |
| 155 } |
| 156 |
| 149 gfx::Point RootWindowHostWin::GetLocationOnNativeScreen() const { | 157 gfx::Point RootWindowHostWin::GetLocationOnNativeScreen() const { |
| 150 RECT r; | 158 RECT r; |
| 151 GetClientRect(hwnd(), &r); | 159 GetClientRect(hwnd(), &r); |
| 152 return gfx::Point(r.left, r.top); | 160 return gfx::Point(r.left, r.top); |
| 153 } | 161 } |
| 154 | 162 |
| 155 | 163 |
| 156 void RootWindowHostWin::SetCursor(gfx::NativeCursor native_cursor) { | 164 void RootWindowHostWin::SetCursor(gfx::NativeCursor native_cursor) { |
| 157 // Custom web cursors are handled directly. | 165 // Custom web cursors are handled directly. |
| 158 if (native_cursor == ui::kCursorCustom) | 166 if (native_cursor == ui::kCursorCustom) |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 namespace test { | 319 namespace test { |
| 312 | 320 |
| 313 // static | 321 // static |
| 314 void SetUsePopupAsRootWindowForTest(bool use) { | 322 void SetUsePopupAsRootWindowForTest(bool use) { |
| 315 use_popup_as_root_window_for_test = use; | 323 use_popup_as_root_window_for_test = use; |
| 316 } | 324 } |
| 317 | 325 |
| 318 } // namespace test | 326 } // namespace test |
| 319 | 327 |
| 320 } // namespace aura | 328 } // namespace aura |
| OLD | NEW |