OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/gfx/canvas_paint.h" | 10 #include "app/gfx/canvas_paint.h" |
(...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1352 | 1352 |
1353 namespace { | 1353 namespace { |
1354 // static | 1354 // static |
1355 static BOOL CALLBACK WindowCallbackProc(HWND hwnd, LPARAM lParam) { | 1355 static BOOL CALLBACK WindowCallbackProc(HWND hwnd, LPARAM lParam) { |
1356 // This is safer than calling GetWindowUserData, since it looks specifically | 1356 // This is safer than calling GetWindowUserData, since it looks specifically |
1357 // for the RootView window property which should be unique. | 1357 // for the RootView window property which should be unique. |
1358 RootView* root_view = GetRootViewForHWND(hwnd); | 1358 RootView* root_view = GetRootViewForHWND(hwnd); |
1359 if (!root_view) | 1359 if (!root_view) |
1360 return TRUE; | 1360 return TRUE; |
1361 | 1361 |
1362 Widget* widget = root_view->GetWidget(); | 1362 Window::CloseSecondaryWidget(root_view->GetWidget()); |
1363 if (!widget) | |
1364 return TRUE; | |
1365 | |
1366 // If the toplevel HWND is a Window, close it if it's identified as a | |
1367 // secondary window. | |
1368 Window* window = widget->GetWindow(); | |
1369 if (window) { | |
1370 if (!window->IsAppWindow()) | |
1371 window->Close(); | |
1372 } else { | |
1373 // If it's not a Window, then close it anyway since it probably is | |
1374 // secondary. | |
1375 widget->Close(); | |
1376 } | |
1377 return TRUE; | 1363 return TRUE; |
1378 } | 1364 } |
1379 } // namespace | 1365 } // namespace |
1380 | 1366 |
1381 void Window::CloseAllSecondaryWindows() { | 1367 void Window::CloseAllSecondaryWindows() { |
1382 EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc, 0); | 1368 EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc, 0); |
1383 } | 1369 } |
1384 | 1370 |
1385 } // namespace views | 1371 } // namespace views |
OLD | NEW |