| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ash/host/ash_window_tree_host.h" | 5 #include "ash/host/ash_window_tree_host.h" |
| 6 | 6 |
| 7 #include "ash/ash_export.h" | 7 #include "ash/ash_export.h" |
| 8 #include "ash/ash_switches.h" | 8 #include "ash/ash_switches.h" |
| 9 #include "ash/host/ash_remote_window_tree_host_win.h" | 9 #include "ash/host/ash_remote_window_tree_host_win.h" |
| 10 #include "ash/host/ash_window_tree_host_init_params.h" | 10 #include "ash/host/ash_window_tree_host_init_params.h" |
| 11 #include "ash/host/root_window_transformer.h" | 11 #include "ash/host/root_window_transformer.h" |
| 12 #include "ash/host/transformer_helper.h" | 12 #include "ash/host/transformer_helper.h" |
| 13 #include "ash/ime/input_method_event_handler.h" | 13 #include "ash/ime/input_method_event_handler.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/win/windows_version.h" | 15 #include "base/win/windows_version.h" |
| 16 #include "ui/aura/window_tree_host_win.h" | 16 #include "ui/aura/window_tree_host_win.h" |
| 17 #include "ui/events/event_processor.h" | 17 #include "ui/events/event_processor.h" |
| 18 #include "ui/gfx/geometry/insets.h" | 18 #include "ui/gfx/geometry/insets.h" |
| 19 #include "ui/gfx/transform.h" | 19 #include "ui/gfx/transform.h" |
| 20 | 20 |
| 21 namespace ash { | 21 namespace ash { |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 class AshWindowTreeHostWin : public AshWindowTreeHost, | 24 class AshWindowTreeHostWin : public AshWindowTreeHost, |
| 25 public aura::WindowTreeHostWin { | 25 public aura::WindowTreeHostImpl { |
| 26 public: | 26 public: |
| 27 explicit AshWindowTreeHostWin(const gfx::Rect& initial_bounds) | 27 explicit AshWindowTreeHostWin(const gfx::Rect& initial_bounds) |
| 28 : aura::WindowTreeHostWin(initial_bounds), | 28 : aura::WindowTreeHostImpl(initial_bounds), |
| 29 fullscreen_(false), | 29 fullscreen_(false), |
| 30 saved_window_style_(0), | 30 saved_window_style_(0), |
| 31 saved_window_ex_style_(0), | 31 saved_window_ex_style_(0), |
| 32 transformer_helper_(this) { | 32 transformer_helper_(this) { |
| 33 transformer_helper_.Init(); | 33 transformer_helper_.Init(); |
| 34 } | 34 } |
| 35 ~AshWindowTreeHostWin() override {} | 35 ~AshWindowTreeHostWin() override {} |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 // AshWindowTreeHost: | 38 // AshWindowTreeHost: |
| 39 void ToggleFullScreen() override { | 39 void ToggleFullScreen() override { |
| 40 gfx::Rect target_rect; | 40 gfx::Rect target_rect; |
| 41 if (!fullscreen_) { | 41 if (!fullscreen_) { |
| 42 fullscreen_ = true; | 42 fullscreen_ = true; |
| 43 saved_window_style_ = GetWindowLong(hwnd(), GWL_STYLE); | 43 saved_window_style_ = GetWindowLong(GetAcceleratedWidget(), GWL_STYLE); |
| 44 saved_window_ex_style_ = GetWindowLong(hwnd(), GWL_EXSTYLE); | 44 saved_window_ex_style_ = |
| 45 GetWindowRect(hwnd(), &saved_window_rect_); | 45 GetWindowLong(GetAcceleratedWidget(), GWL_EXSTYLE); |
| 46 SetWindowLong(hwnd(), | 46 GetWindowRect(GetAcceleratedWidget(), &saved_window_rect_); |
| 47 SetWindowLong(GetAcceleratedWidget(), |
| 47 GWL_STYLE, | 48 GWL_STYLE, |
| 48 saved_window_style_ & ~(WS_CAPTION | WS_THICKFRAME)); | 49 saved_window_style_ & ~(WS_CAPTION | WS_THICKFRAME)); |
| 49 SetWindowLong( | 50 SetWindowLong( |
| 50 hwnd(), | 51 GetAcceleratedWidget(), |
| 51 GWL_EXSTYLE, | 52 GWL_EXSTYLE, |
| 52 saved_window_ex_style_ & ~(WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE | | 53 saved_window_ex_style_ & ~(WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE | |
| 53 WS_EX_CLIENTEDGE | WS_EX_STATICEDGE)); | 54 WS_EX_CLIENTEDGE | WS_EX_STATICEDGE)); |
| 54 | 55 |
| 55 MONITORINFO mi; | 56 MONITORINFO mi; |
| 56 mi.cbSize = sizeof(mi); | 57 mi.cbSize = sizeof(mi); |
| 57 GetMonitorInfo(MonitorFromWindow(hwnd(), MONITOR_DEFAULTTONEAREST), &mi); | 58 GetMonitorInfo( |
| 59 MonitorFromWindow(GetAcceleratedWidget(), MONITOR_DEFAULTTONEAREST), |
| 60 &mi); |
| 58 target_rect = gfx::Rect(mi.rcMonitor); | 61 target_rect = gfx::Rect(mi.rcMonitor); |
| 59 } else { | 62 } else { |
| 60 fullscreen_ = false; | 63 fullscreen_ = false; |
| 61 SetWindowLong(hwnd(), GWL_STYLE, saved_window_style_); | 64 SetWindowLong(GetAcceleratedWidget(), GWL_STYLE, saved_window_style_); |
| 62 SetWindowLong(hwnd(), GWL_EXSTYLE, saved_window_ex_style_); | 65 SetWindowLong(GetAcceleratedWidget(), GWL_EXSTYLE, |
| 66 saved_window_ex_style_); |
| 63 target_rect = gfx::Rect(saved_window_rect_); | 67 target_rect = gfx::Rect(saved_window_rect_); |
| 64 } | 68 } |
| 65 SetWindowPos(hwnd(), | 69 SetWindowPos(GetAcceleratedWidget(), |
| 66 NULL, | 70 NULL, |
| 67 target_rect.x(), | 71 target_rect.x(), |
| 68 target_rect.y(), | 72 target_rect.y(), |
| 69 target_rect.width(), | 73 target_rect.width(), |
| 70 target_rect.height(), | 74 target_rect.height(), |
| 71 SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); | 75 SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); |
| 72 } | 76 } |
| 73 bool ConfineCursorToRootWindow() override { return false; } | 77 bool ConfineCursorToRootWindow() override { return false; } |
| 74 void UnConfineCursor() override { NOTIMPLEMENTED(); } | 78 void UnConfineCursor() override { NOTIMPLEMENTED(); } |
| 75 void SetRootWindowTransformer( | 79 void SetRootWindowTransformer( |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 const AshWindowTreeHostInitParams& init_params) { | 134 const AshWindowTreeHostInitParams& init_params) { |
| 131 if (base::win::GetVersion() >= base::win::VERSION_WIN7 && | 135 if (base::win::GetVersion() >= base::win::VERSION_WIN7 && |
| 132 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 136 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 133 ash::switches::kForceAshToDesktop)) | 137 ash::switches::kForceAshToDesktop)) |
| 134 return new AshRemoteWindowTreeHostWin(init_params.remote_hwnd); | 138 return new AshRemoteWindowTreeHostWin(init_params.remote_hwnd); |
| 135 | 139 |
| 136 return new AshWindowTreeHostWin(init_params.initial_bounds); | 140 return new AshWindowTreeHostWin(init_params.initial_bounds); |
| 137 } | 141 } |
| 138 | 142 |
| 139 } // namespace ash | 143 } // namespace ash |
| OLD | NEW |