| 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 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 using std::min; | 23 using std::min; |
| 24 | 24 |
| 25 namespace aura { | 25 namespace aura { |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 bool use_popup_as_root_window_for_test = false; | 28 bool use_popup_as_root_window_for_test = false; |
| 29 | 29 |
| 30 } // namespace | 30 } // namespace |
| 31 | 31 |
| 32 // static | 32 // static |
| 33 WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds) { | 33 WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds, |
| 34 return new WindowTreeHostWin(bounds); | 34 ui::ContextFactory* context_factory) { |
| 35 return new WindowTreeHostWin(bounds, context_factory); |
| 35 } | 36 } |
| 36 | 37 |
| 37 // static | 38 // static |
| 38 gfx::Size WindowTreeHost::GetNativeScreenSize() { | 39 gfx::Size WindowTreeHost::GetNativeScreenSize() { |
| 39 return gfx::Size(GetSystemMetrics(SM_CXSCREEN), | 40 return gfx::Size(GetSystemMetrics(SM_CXSCREEN), |
| 40 GetSystemMetrics(SM_CYSCREEN)); | 41 GetSystemMetrics(SM_CYSCREEN)); |
| 41 } | 42 } |
| 42 | 43 |
| 43 WindowTreeHostWin::WindowTreeHostWin(const gfx::Rect& bounds) | 44 WindowTreeHostWin::WindowTreeHostWin(const gfx::Rect& bounds, |
| 45 ui::ContextFactory* context_factory) |
| 44 : has_capture_(false) { | 46 : has_capture_(false) { |
| 45 if (use_popup_as_root_window_for_test) | 47 if (use_popup_as_root_window_for_test) |
| 46 set_window_style(WS_POPUP); | 48 set_window_style(WS_POPUP); |
| 47 Init(NULL, bounds); | 49 Init(NULL, bounds); |
| 48 SetWindowText(hwnd(), L"aura::RootWindow!"); | 50 SetWindowText(hwnd(), L"aura::RootWindow!"); |
| 49 CreateCompositor(GetAcceleratedWidget()); | 51 CreateCompositor(GetAcceleratedWidget(), context_factory); |
| 50 } | 52 } |
| 51 | 53 |
| 52 WindowTreeHostWin::~WindowTreeHostWin() { | 54 WindowTreeHostWin::~WindowTreeHostWin() { |
| 53 DestroyCompositor(); | 55 DestroyCompositor(); |
| 54 DestroyDispatcher(); | 56 DestroyDispatcher(); |
| 55 DestroyWindow(hwnd()); | 57 DestroyWindow(hwnd()); |
| 56 } | 58 } |
| 57 | 59 |
| 58 ui::EventSource* WindowTreeHostWin::GetEventSource() { | 60 ui::EventSource* WindowTreeHostWin::GetEventSource() { |
| 59 return this; | 61 return this; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 namespace test { | 231 namespace test { |
| 230 | 232 |
| 231 // static | 233 // static |
| 232 void SetUsePopupAsRootWindowForTest(bool use) { | 234 void SetUsePopupAsRootWindowForTest(bool use) { |
| 233 use_popup_as_root_window_for_test = use; | 235 use_popup_as_root_window_for_test = use; |
| 234 } | 236 } |
| 235 | 237 |
| 236 } // namespace test | 238 } // namespace test |
| 237 | 239 |
| 238 } // namespace aura | 240 } // namespace aura |
| OLD | NEW |