| 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/views/win/fullscreen_handler.h" | 5 #include "ui/views/win/fullscreen_handler.h" |
| 6 | 6 |
| 7 #include <memory> |
| 8 |
| 7 #include "base/logging.h" | 9 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | |
| 9 #include "base/win/win_util.h" | 10 #include "base/win/win_util.h" |
| 10 #include "ui/base/win/shell.h" | 11 #include "ui/base/win/shell.h" |
| 11 #include "ui/gfx/geometry/rect.h" | 12 #include "ui/gfx/geometry/rect.h" |
| 12 #include "ui/views/win/scoped_fullscreen_visibility.h" | 13 #include "ui/views/win/scoped_fullscreen_visibility.h" |
| 13 | 14 |
| 14 namespace views { | 15 namespace views { |
| 15 | 16 |
| 16 //////////////////////////////////////////////////////////////////////////////// | 17 //////////////////////////////////////////////////////////////////////////////// |
| 17 // FullscreenHandler, public: | 18 // FullscreenHandler, public: |
| 18 | 19 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 29 } | 30 } |
| 30 | 31 |
| 31 gfx::Rect FullscreenHandler::GetRestoreBounds() const { | 32 gfx::Rect FullscreenHandler::GetRestoreBounds() const { |
| 32 return gfx::Rect(saved_window_info_.window_rect); | 33 return gfx::Rect(saved_window_info_.window_rect); |
| 33 } | 34 } |
| 34 | 35 |
| 35 //////////////////////////////////////////////////////////////////////////////// | 36 //////////////////////////////////////////////////////////////////////////////// |
| 36 // FullscreenHandler, private: | 37 // FullscreenHandler, private: |
| 37 | 38 |
| 38 void FullscreenHandler::SetFullscreenImpl(bool fullscreen) { | 39 void FullscreenHandler::SetFullscreenImpl(bool fullscreen) { |
| 39 scoped_ptr<ScopedFullscreenVisibility> visibility; | 40 std::unique_ptr<ScopedFullscreenVisibility> visibility; |
| 40 | 41 |
| 41 // With Aero enabled disabling the visibility causes the window to disappear | 42 // With Aero enabled disabling the visibility causes the window to disappear |
| 42 // for several frames, which looks worse than doing other updates | 43 // for several frames, which looks worse than doing other updates |
| 43 // non-atomically. | 44 // non-atomically. |
| 44 if (!ui::win::IsAeroGlassEnabled()) | 45 if (!ui::win::IsAeroGlassEnabled()) |
| 45 visibility.reset(new ScopedFullscreenVisibility(hwnd_)); | 46 visibility.reset(new ScopedFullscreenVisibility(hwnd_)); |
| 46 | 47 |
| 47 // Save current window state if not already fullscreen. | 48 // Save current window state if not already fullscreen. |
| 48 if (!fullscreen_) { | 49 if (!fullscreen_) { |
| 49 // Save current window information. We force the window into restored mode | 50 // Save current window information. We force the window into restored mode |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 gfx::Rect new_rect(saved_window_info_.window_rect); | 89 gfx::Rect new_rect(saved_window_info_.window_rect); |
| 89 SetWindowPos(hwnd_, NULL, new_rect.x(), new_rect.y(), new_rect.width(), | 90 SetWindowPos(hwnd_, NULL, new_rect.x(), new_rect.y(), new_rect.width(), |
| 90 new_rect.height(), | 91 new_rect.height(), |
| 91 SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); | 92 SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); |
| 92 if (saved_window_info_.maximized) | 93 if (saved_window_info_.maximized) |
| 93 ::SendMessage(hwnd_, WM_SYSCOMMAND, SC_MAXIMIZE, 0); | 94 ::SendMessage(hwnd_, WM_SYSCOMMAND, SC_MAXIMIZE, 0); |
| 94 } | 95 } |
| 95 } | 96 } |
| 96 | 97 |
| 97 } // namespace views | 98 } // namespace views |
| OLD | NEW |