| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "views/window/window_win.h" | 5 #include "views/window/window_win.h" |
| 6 | 6 |
| 7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 | 9 |
| 10 #include "app/theme_provider.h" | 10 #include "app/theme_provider.h" |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 } | 237 } |
| 238 | 238 |
| 239 void WindowWin::Activate() { | 239 void WindowWin::Activate() { |
| 240 if (IsMinimized()) | 240 if (IsMinimized()) |
| 241 ::ShowWindow(GetNativeView(), SW_RESTORE); | 241 ::ShowWindow(GetNativeView(), SW_RESTORE); |
| 242 ::SetWindowPos(GetNativeView(), HWND_TOP, 0, 0, 0, 0, | 242 ::SetWindowPos(GetNativeView(), HWND_TOP, 0, 0, 0, 0, |
| 243 SWP_NOSIZE | SWP_NOMOVE); | 243 SWP_NOSIZE | SWP_NOMOVE); |
| 244 SetForegroundWindow(GetNativeView()); | 244 SetForegroundWindow(GetNativeView()); |
| 245 } | 245 } |
| 246 | 246 |
| 247 void WindowWin::Deactivate() { |
| 248 HWND hwnd = ::GetNextWindow(GetNativeView(), GW_HWNDNEXT); |
| 249 if (hwnd) |
| 250 ::SetForegroundWindow(hwnd); |
| 251 } |
| 252 |
| 247 void WindowWin::Close() { | 253 void WindowWin::Close() { |
| 248 if (window_closed_) { | 254 if (window_closed_) { |
| 249 // It appears we can hit this code path if you close a modal dialog then | 255 // It appears we can hit this code path if you close a modal dialog then |
| 250 // close the last browser before the destructor is hit, which triggers | 256 // close the last browser before the destructor is hit, which triggers |
| 251 // invoking Close again. I'm short circuiting this code path to avoid | 257 // invoking Close again. I'm short circuiting this code path to avoid |
| 252 // calling into the delegate twice, which is problematic. | 258 // calling into the delegate twice, which is problematic. |
| 253 return; | 259 return; |
| 254 } | 260 } |
| 255 | 261 |
| 256 if (non_client_view_->CanClose()) { | 262 if (non_client_view_->CanClose()) { |
| (...skipping 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1508 Window::CloseSecondaryWidget(root_view->GetWidget()); | 1514 Window::CloseSecondaryWidget(root_view->GetWidget()); |
| 1509 return TRUE; | 1515 return TRUE; |
| 1510 } | 1516 } |
| 1511 } // namespace | 1517 } // namespace |
| 1512 | 1518 |
| 1513 void Window::CloseAllSecondaryWindows() { | 1519 void Window::CloseAllSecondaryWindows() { |
| 1514 EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc, 0); | 1520 EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc, 0); |
| 1515 } | 1521 } |
| 1516 | 1522 |
| 1517 } // namespace views | 1523 } // namespace views |
| OLD | NEW |