| 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 | |
| 766 void NativeWidgetWin::Show() { | 759 void NativeWidgetWin::Show() { |
| 767 if (!IsWindow()) | 760 if (!IsWindow()) |
| 768 return; | 761 return; |
| 769 | 762 |
| 770 ShowWindow(SW_SHOWNOACTIVATE); | 763 ShowWindow(SW_SHOWNOACTIVATE); |
| 771 SetInitialFocus(); | 764 SetInitialFocus(); |
| 772 } | 765 } |
| 773 | 766 |
| 774 void NativeWidgetWin::Hide() { | 767 void NativeWidgetWin::Hide() { |
| 775 if (IsWindow()) { | 768 if (IsWindow()) { |
| (...skipping 1739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2515 return (GetKeyState(VK_LBUTTON) & 0x80) || | 2508 return (GetKeyState(VK_LBUTTON) & 0x80) || |
| 2516 (GetKeyState(VK_RBUTTON) & 0x80) || | 2509 (GetKeyState(VK_RBUTTON) & 0x80) || |
| 2517 (GetKeyState(VK_MBUTTON) & 0x80) || | 2510 (GetKeyState(VK_MBUTTON) & 0x80) || |
| 2518 (GetKeyState(VK_XBUTTON1) & 0x80) || | 2511 (GetKeyState(VK_XBUTTON1) & 0x80) || |
| 2519 (GetKeyState(VK_XBUTTON2) & 0x80); | 2512 (GetKeyState(VK_XBUTTON2) & 0x80); |
| 2520 } | 2513 } |
| 2521 | 2514 |
| 2522 } // namespace internal | 2515 } // namespace internal |
| 2523 | 2516 |
| 2524 } // namespace views | 2517 } // namespace views |
| OLD | NEW |