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

Unified Diff: views/window/native_window_win.cc

Issue 6976040: Revert 86914 - Move a bunch of functions from Window onto Widget. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 7 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 | « views/window/native_window_win.h ('k') | views/window/window.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/window/native_window_win.cc
===================================================================
--- views/window/native_window_win.cc (revision 86938)
+++ views/window/native_window_win.cc (working copy)
@@ -1175,6 +1175,53 @@
kMonitorEdgePadding, 0);
}
+void NativeWindowWin::HideWindow() {
+ // We can just call the function implemented by the widget.
+ Hide();
+}
+
+void NativeWindowWin::Activate() {
+ if (IsMinimized())
+ ::ShowWindow(GetNativeView(), SW_RESTORE);
+ ::SetWindowPos(GetNativeView(), HWND_TOP, 0, 0, 0, 0,
+ SWP_NOSIZE | SWP_NOMOVE);
+ SetForegroundWindow(GetNativeView());
+}
+
+void NativeWindowWin::Deactivate() {
+ HWND hwnd = ::GetNextWindow(GetNativeView(), GW_HWNDNEXT);
+ if (hwnd)
+ ::SetForegroundWindow(hwnd);
+}
+
+void NativeWindowWin::Maximize() {
+ ExecuteSystemMenuCommand(SC_MAXIMIZE);
+}
+
+void NativeWindowWin::Minimize() {
+ ExecuteSystemMenuCommand(SC_MINIMIZE);
+}
+
+void NativeWindowWin::Restore() {
+ ExecuteSystemMenuCommand(SC_RESTORE);
+}
+
+bool NativeWindowWin::IsActive() const {
+ return is_active_;
+}
+
+bool NativeWindowWin::IsVisible() const {
+ return !!::IsWindowVisible(GetNativeView());
+}
+
+bool NativeWindowWin::IsMaximized() const {
+ return !!::IsZoomed(GetNativeView());
+}
+
+bool NativeWindowWin::IsMinimized() const {
+ return !!::IsIconic(GetNativeView());
+}
+
void NativeWindowWin::SetFullscreen(bool fullscreen) {
if (fullscreen_ == fullscreen)
return; // Nothing to do.
@@ -1236,6 +1283,11 @@
return fullscreen_;
}
+void NativeWindowWin::SetAlwaysOnTop(bool always_on_top) {
+ ::SetWindowPos(GetNativeView(), always_on_top ? HWND_TOPMOST : HWND_NOTOPMOST,
+ 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
+}
+
void NativeWindowWin::SetUseDragFrame(bool use_drag_frame) {
if (use_drag_frame) {
// Make the frame slightly transparent during the drag operation.
@@ -1264,6 +1316,10 @@
ResetWindowRegion(true);
}
+gfx::NativeWindow NativeWindowWin::GetNativeWindow() const {
+ return GetNativeView();
+}
+
bool NativeWindowWin::ShouldUseNativeFrame() const {
return NativeWidgetWin::IsAeroGlassEnabled();
}
@@ -1298,15 +1354,6 @@
}
////////////////////////////////////////////////////////////////////////////////
-// NativeWindowWin, NativeWidgetWin overrides:
-
-bool NativeWindowWin::IsActive() const {
- // TODO(beng): evaluate whether or not this is needed. NativeWidgetWin checks
- // active-state with the OS using GetWindowInfo().
- return is_active_;
-}
-
-////////////////////////////////////////////////////////////////////////////////
// NativeWindowWin, private:
void NativeWindowWin::RestoreEnabledIfNecessary() {
@@ -1409,6 +1456,11 @@
return DefWindowProc(GetNativeView(), WM_NCACTIVATE, active, 0);
}
+void NativeWindowWin::ExecuteSystemMenuCommand(int command) {
+ if (command)
+ SendMessage(GetNativeView(), WM_SYSCOMMAND, command, 0);
+}
+
////////////////////////////////////////////////////////////////////////////////
// NativeWindow, public:
« no previous file with comments | « views/window/native_window_win.h ('k') | views/window/window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698