| 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/window_tree_host_win.h" | 5 #include "ui/aura/window_tree_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/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "ui/aura/client/cursor_client.h" | 12 #include "ui/aura/client/cursor_client.h" |
| 13 #include "ui/aura/window_event_dispatcher.h" | 13 #include "ui/aura/window_event_dispatcher.h" |
| 14 #include "ui/base/cursor/cursor_loader_win.h" | 14 #include "ui/base/cursor/cursor_loader_win.h" |
| 15 #include "ui/base/view_prop.h" | 15 #include "ui/base/view_prop.h" |
| 16 #include "ui/compositor/compositor.h" | 16 #include "ui/compositor/compositor.h" |
| 17 #include "ui/events/event.h" | 17 #include "ui/events/event.h" |
| 18 #include "ui/gfx/display.h" | 18 #include "ui/gfx/display.h" |
| 19 #include "ui/gfx/insets.h" | 19 #include "ui/gfx/insets.h" |
| 20 #include "ui/gfx/native_widget_types.h" | 20 #include "ui/gfx/native_widget_types.h" |
| 21 #include "ui/gfx/screen.h" | 21 #include "ui/gfx/screen.h" |
| 22 #include "ui/platform_window/win/win_window.h" | 22 #include "ui/platform_window/platform_window_factory.h" |
| 23 #include "ui/platform_window/types/platform_window.h" |
| 23 | 24 |
| 24 using std::max; | 25 using std::max; |
| 25 using std::min; | 26 using std::min; |
| 26 | 27 |
| 27 namespace aura { | 28 namespace aura { |
| 28 namespace { | 29 namespace { |
| 29 | 30 |
| 30 bool use_popup_as_root_window_for_test = false; | 31 bool use_popup_as_root_window_for_test = false; |
| 31 | 32 |
| 32 } // namespace | 33 } // namespace |
| 33 | 34 |
| 34 // static | 35 // static |
| 35 WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds) { | 36 WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds) { |
| 36 return new WindowTreeHostWin(bounds); | 37 return new WindowTreeHostWin(bounds); |
| 37 } | 38 } |
| 38 | 39 |
| 39 // static | 40 // static |
| 40 gfx::Size WindowTreeHost::GetNativeScreenSize() { | 41 gfx::Size WindowTreeHost::GetNativeScreenSize() { |
| 41 return gfx::Size(GetSystemMetrics(SM_CXSCREEN), | 42 return gfx::Size(GetSystemMetrics(SM_CXSCREEN), |
| 42 GetSystemMetrics(SM_CYSCREEN)); | 43 GetSystemMetrics(SM_CYSCREEN)); |
| 43 } | 44 } |
| 44 | 45 |
| 45 WindowTreeHostWin::WindowTreeHostWin(const gfx::Rect& bounds) | 46 WindowTreeHostWin::WindowTreeHostWin(const gfx::Rect& bounds) |
| 46 : has_capture_(false), | 47 : has_capture_(false), |
| 47 widget_(gfx::kNullAcceleratedWidget), | 48 widget_(gfx::kNullAcceleratedWidget), |
| 48 window_(new ui::WinWindow(this, bounds)) { | 49 window_(ui::PlatformWindowFactory::GetInstance()->CreatePlatformWindow( |
| 50 this, |
| 51 bounds)) { |
| 52 CHECK(window_); |
| 49 } | 53 } |
| 50 | 54 |
| 51 WindowTreeHostWin::~WindowTreeHostWin() { | 55 WindowTreeHostWin::~WindowTreeHostWin() { |
| 52 DestroyCompositor(); | 56 DestroyCompositor(); |
| 53 DestroyDispatcher(); | 57 DestroyDispatcher(); |
| 54 window_.reset(); | 58 window_.reset(); |
| 55 } | 59 } |
| 56 | 60 |
| 57 ui::EventSource* WindowTreeHostWin::GetEventSource() { | 61 ui::EventSource* WindowTreeHostWin::GetEventSource() { |
| 58 return this; | 62 return this; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 widget_ = widget; | 168 widget_ = widget; |
| 165 CreateCompositor(widget); | 169 CreateCompositor(widget); |
| 166 } | 170 } |
| 167 | 171 |
| 168 void WindowTreeHostWin::OnActivationChanged(bool active) { | 172 void WindowTreeHostWin::OnActivationChanged(bool active) { |
| 169 if (active) | 173 if (active) |
| 170 OnHostActivated(); | 174 OnHostActivated(); |
| 171 } | 175 } |
| 172 | 176 |
| 173 } // namespace aura | 177 } // namespace aura |
| OLD | NEW |