| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/ui/views/constrained_window_views.h" | |
| 6 | |
| 7 #include "ui/views/widget/native_widget_win.h" | |
| 8 | |
| 9 namespace { | |
| 10 bool IsNonClientHitTestCode(UINT hittest) { | |
| 11 return hittest != HTCLIENT && hittest != HTNOWHERE && hittest != HTCLOSE; | |
| 12 } | |
| 13 } | |
| 14 | |
| 15 class NativeConstrainedWindowWin : public NativeConstrainedWindow, | |
| 16 public views::NativeWidgetWin { | |
| 17 public: | |
| 18 explicit NativeConstrainedWindowWin(NativeConstrainedWindowDelegate* delegate) | |
| 19 : views::NativeWidgetWin(delegate->AsNativeWidgetDelegate()), | |
| 20 delegate_(delegate) { | |
| 21 } | |
| 22 | |
| 23 virtual ~NativeConstrainedWindowWin() { | |
| 24 } | |
| 25 | |
| 26 private: | |
| 27 // Overridden from NativeConstrainedWindow: | |
| 28 virtual views::NativeWidget* AsNativeWidget() OVERRIDE { | |
| 29 return this; | |
| 30 } | |
| 31 | |
| 32 // Overridden from views::NativeWidgetWin: | |
| 33 virtual void OnFinalMessage(HWND window) OVERRIDE { | |
| 34 delegate_->OnNativeConstrainedWindowDestroyed(); | |
| 35 NativeWidgetWin::OnFinalMessage(window); | |
| 36 } | |
| 37 virtual bool PreHandleMSG(UINT message, | |
| 38 WPARAM w_param, | |
| 39 LPARAM l_param, | |
| 40 LRESULT* result) OVERRIDE { | |
| 41 if (message == WM_MOUSEACTIVATE && | |
| 42 IsNonClientHitTestCode(static_cast<UINT>(LOWORD(l_param)))) { | |
| 43 delegate_->OnNativeConstrainedWindowMouseActivate(); | |
| 44 } | |
| 45 return false; | |
| 46 } | |
| 47 | |
| 48 NativeConstrainedWindowDelegate* delegate_; | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(NativeConstrainedWindowWin); | |
| 51 }; | |
| 52 | |
| 53 //////////////////////////////////////////////////////////////////////////////// | |
| 54 // NativeConstrainedWindow, public: | |
| 55 | |
| 56 // static | |
| 57 NativeConstrainedWindow* NativeConstrainedWindow::CreateNativeConstrainedWindow( | |
| 58 NativeConstrainedWindowDelegate* delegate) { | |
| 59 return new NativeConstrainedWindowWin(delegate); | |
| 60 } | |
| OLD | NEW |