Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Unified Diff: ui/views/win/fullscreen_handler.cc

Issue 10892014: Make HWNDMessageHandler subclass WindowImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/win/fullscreen_handler.h ('k') | ui/views/win/hwnd_message_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/win/fullscreen_handler.cc
===================================================================
--- ui/views/win/fullscreen_handler.cc (revision 153679)
+++ ui/views/win/fullscreen_handler.cc (working copy)
@@ -5,9 +5,7 @@
#include "ui/views/win/fullscreen_handler.h"
#include "base/logging.h"
-// TODO(beng): Temporary dependancy until fullscreen moves to
-// HWNDMessageHandler.
-#include "ui/views/widget/widget.h"
+#include "ui/gfx/rect.h"
#include "ui/views/win/scoped_fullscreen_visibility.h"
namespace views {
@@ -15,8 +13,8 @@
////////////////////////////////////////////////////////////////////////////////
// FullscreenHandler, public:
-FullscreenHandler::FullscreenHandler(Widget* widget)
- : widget_(widget),
+FullscreenHandler::FullscreenHandler()
+ : hwnd_(NULL),
fullscreen_(false),
metro_snap_(false) {
}
@@ -47,30 +45,28 @@
// FullscreenHandler, private:
void FullscreenHandler::SetFullscreenImpl(bool fullscreen, bool for_metro) {
- ScopedFullscreenVisibility visibility(widget_->GetNativeView());
+ ScopedFullscreenVisibility visibility(hwnd_);
// Save current window state if not already fullscreen.
if (!fullscreen_) {
// Save current window information. We force the window into restored mode
// before going fullscreen because Windows doesn't seem to hide the
// taskbar if the window is in the maximized state.
- saved_window_info_.maximized = widget_->IsMaximized();
+ saved_window_info_.maximized = !!::IsZoomed(hwnd_);
if (saved_window_info_.maximized)
- widget_->Restore();
- saved_window_info_.style =
- GetWindowLong(widget_->GetNativeView(), GWL_STYLE);
- saved_window_info_.ex_style =
- GetWindowLong(widget_->GetNativeView(), GWL_EXSTYLE);
- GetWindowRect(widget_->GetNativeView(), &saved_window_info_.window_rect);
+ ::SendMessage(hwnd_, WM_SYSCOMMAND, SC_RESTORE, 0);
+ saved_window_info_.style = GetWindowLong(hwnd_, GWL_STYLE);
+ saved_window_info_.ex_style = GetWindowLong(hwnd_, GWL_EXSTYLE);
+ GetWindowRect(hwnd_, &saved_window_info_.window_rect);
}
fullscreen_ = fullscreen;
if (fullscreen_) {
// Set new window style and size.
- SetWindowLong(widget_->GetNativeView(), GWL_STYLE,
+ SetWindowLong(hwnd_, GWL_STYLE,
saved_window_info_.style & ~(WS_CAPTION | WS_THICKFRAME));
- SetWindowLong(widget_->GetNativeView(), GWL_EXSTYLE,
+ SetWindowLong(hwnd_, GWL_EXSTYLE,
saved_window_info_.ex_style & ~(WS_EX_DLGMODALFRAME |
WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE));
@@ -79,12 +75,10 @@
if (!for_metro) {
MONITORINFO monitor_info;
monitor_info.cbSize = sizeof(monitor_info);
- GetMonitorInfo(MonitorFromWindow(widget_->GetNativeView(),
- MONITOR_DEFAULTTONEAREST),
+ GetMonitorInfo(MonitorFromWindow(hwnd_, MONITOR_DEFAULTTONEAREST),
&monitor_info);
gfx::Rect window_rect(monitor_info.rcMonitor);
- SetWindowPos(widget_->GetNativeView(), NULL,
- window_rect.x(), window_rect.y(),
+ SetWindowPos(hwnd_, NULL, window_rect.x(), window_rect.y(),
window_rect.width(), window_rect.height(),
SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
}
@@ -92,21 +86,18 @@
// Reset original window style and size. The multiple window size/moves
// here are ugly, but if SetWindowPos() doesn't redraw, the taskbar won't be
// repainted. Better-looking methods welcome.
- SetWindowLong(widget_->GetNativeView(), GWL_STYLE,
- saved_window_info_.style);
- SetWindowLong(widget_->GetNativeView(), GWL_EXSTYLE,
- saved_window_info_.ex_style);
+ SetWindowLong(hwnd_, GWL_STYLE, saved_window_info_.style);
+ SetWindowLong(hwnd_, GWL_EXSTYLE, saved_window_info_.ex_style);
if (!for_metro) {
// On restore, resize to the previous saved rect size.
gfx::Rect new_rect(saved_window_info_.window_rect);
- SetWindowPos(widget_->GetNativeView(), NULL,
- new_rect.x(), new_rect.y(),
+ SetWindowPos(hwnd_, NULL, new_rect.x(), new_rect.y(),
new_rect.width(), new_rect.height(),
SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
}
if (saved_window_info_.maximized)
- widget_->Maximize();
+ ::SendMessage(hwnd_, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
}
}
« no previous file with comments | « ui/views/win/fullscreen_handler.h ('k') | ui/views/win/hwnd_message_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698