| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/views/widget/native_widget_win.h" | 5 #include "ui/views/widget/native_widget_win.h" |
| 6 | 6 |
| 7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 | 749 |
| 750 void NativeWidgetWin::CloseNow() { | 750 void NativeWidgetWin::CloseNow() { |
| 751 // We may already have been destroyed if the selection resulted in a tab | 751 // We may already have been destroyed if the selection resulted in a tab |
| 752 // switch which will have reactivated the browser window and closed us, so | 752 // switch which will have reactivated the browser window and closed us, so |
| 753 // we need to check to see if we're still a window before trying to destroy | 753 // we need to check to see if we're still a window before trying to destroy |
| 754 // ourself. | 754 // ourself. |
| 755 if (IsWindow()) | 755 if (IsWindow()) |
| 756 DestroyWindow(hwnd()); | 756 DestroyWindow(hwnd()); |
| 757 } | 757 } |
| 758 | 758 |
| 759 void NativeWidgetWin::EnableClose(bool enable) { |
| 760 // Disable the native frame's close button regardless of whether or not the |
| 761 // native frame is in use, since this also affects the system menu. |
| 762 EnableMenuItem(GetSystemMenu(GetNativeView(), false), SC_CLOSE, enable); |
| 763 SendFrameChanged(GetNativeView()); |
| 764 } |
| 765 |
| 759 void NativeWidgetWin::Show() { | 766 void NativeWidgetWin::Show() { |
| 760 if (!IsWindow()) | 767 if (!IsWindow()) |
| 761 return; | 768 return; |
| 762 | 769 |
| 763 ShowWindow(SW_SHOWNOACTIVATE); | 770 ShowWindow(SW_SHOWNOACTIVATE); |
| 764 SetInitialFocus(); | 771 SetInitialFocus(); |
| 765 } | 772 } |
| 766 | 773 |
| 767 void NativeWidgetWin::Hide() { | 774 void NativeWidgetWin::Hide() { |
| 768 if (IsWindow()) { | 775 if (IsWindow()) { |
| (...skipping 1721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2490 return (GetKeyState(VK_LBUTTON) & 0x80) || | 2497 return (GetKeyState(VK_LBUTTON) & 0x80) || |
| 2491 (GetKeyState(VK_RBUTTON) & 0x80) || | 2498 (GetKeyState(VK_RBUTTON) & 0x80) || |
| 2492 (GetKeyState(VK_MBUTTON) & 0x80) || | 2499 (GetKeyState(VK_MBUTTON) & 0x80) || |
| 2493 (GetKeyState(VK_XBUTTON1) & 0x80) || | 2500 (GetKeyState(VK_XBUTTON1) & 0x80) || |
| 2494 (GetKeyState(VK_XBUTTON2) & 0x80); | 2501 (GetKeyState(VK_XBUTTON2) & 0x80); |
| 2495 } | 2502 } |
| 2496 | 2503 |
| 2497 } // namespace internal | 2504 } // namespace internal |
| 2498 | 2505 |
| 2499 } // namespace views | 2506 } // namespace views |
| OLD | NEW |