diff options
author | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-27 00:15:06 +0000 |
---|---|---|
committer | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-27 00:15:06 +0000 |
commit | 96d2a75e2afc65b2bed77c6808200ef89d103c52 (patch) | |
tree | 8ce04aa79e7d954fb8499a8829c9251828e652f7 /views/window/native_window_win.cc | |
parent | 03c52686ea954648d3e9091ca78ceb9fcc8b6dad (diff) | |
download | chromium_src-96d2a75e2afc65b2bed77c6808200ef89d103c52.zip chromium_src-96d2a75e2afc65b2bed77c6808200ef89d103c52.tar.gz chromium_src-96d2a75e2afc65b2bed77c6808200ef89d103c52.tar.bz2 |
Revert 86914 - Move a bunch of functions from Window onto Widget.
Many tests in browser_tests crashed with a LOG(DFATAL) message on Chrome OS:
[28862:28862:0526/153905:3290241082989:FATAL:browser_main.cc(955)] GLib-GObject: invalid (NULL) pointer instance
Backtrace:
base::debug::StackTrace::StackTrace() [0x33308d6]
logging::LogMessage::~LogMessage() [0x334df2e]
(anonymous namespace)::GLibLogHandler() [0x7c7d45]
0x2ab2a37a7fb9
0x2ab2a37a83d3
0x2ab2a313302a
0x2ab2a31315c5
views::NativeWidgetGtk::InitNativeWidget() [0x1a30dcf]
views::Widget::Init() [0x1a37fa7]
NativeTabContentsViewGtk::InitNativeTabContentsView() [0x10c6b83]
TabContentsViewViews::CreateView() [0x397ac46]
TabContents::TabContents() [0x1501e09]
Browser::TabContentsFactory() [0xc84725]
browser::Navigate() [0xc954c7]
Browser::AddSelectedTabWithURL() [0xc76d9e]
(anonymous namespace)::InitializeBrowser() [0x70be3d]
InProcessBrowserTest::CreateBrowser() [0x70d178]
InProcessBrowserTest::RunTestOnMainThreadLoop() [0x70d34a]
[...snipped...]
BUG=72040
TEST=none
Review URL: http://codereview.chromium.org/7075019
R=msw@chromium.org
TBR=ben@chromium.org
Review URL: http://codereview.chromium.org/6976040
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86939 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/window/native_window_win.cc')
-rw-r--r-- | views/window/native_window_win.cc | 70 |
1 files changed, 61 insertions, 9 deletions
diff --git a/views/window/native_window_win.cc b/views/window/native_window_win.cc index c72822a..fed8173 100644 --- a/views/window/native_window_win.cc +++ b/views/window/native_window_win.cc @@ -1175,6 +1175,53 @@ void NativeWindowWin::SetWindowBounds(const gfx::Rect& bounds, 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 @@ bool NativeWindowWin::IsFullscreen() const { 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 @@ void NativeWindowWin::UpdateFrameAfterFrameChange() { ResetWindowRegion(true); } +gfx::NativeWindow NativeWindowWin::GetNativeWindow() const { + return GetNativeView(); +} + bool NativeWindowWin::ShouldUseNativeFrame() const { return NativeWidgetWin::IsAeroGlassEnabled(); } @@ -1298,15 +1354,6 @@ void NativeWindowWin::FrameTypeChanged() { } //////////////////////////////////////////////////////////////////////////////// -// 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 @@ LRESULT NativeWindowWin::CallDefaultNCActivateHandler(BOOL active) { return DefWindowProc(GetNativeView(), WM_NCACTIVATE, active, 0); } +void NativeWindowWin::ExecuteSystemMenuCommand(int command) { + if (command) + SendMessage(GetNativeView(), WM_SYSCOMMAND, command, 0); +} + //////////////////////////////////////////////////////////////////////////////// // NativeWindow, public: |