| 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 "chrome/browser/render_widget_host_hwnd.h" | 5 #include "chrome/browser/render_widget_host_hwnd.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/gfx/bitmap_header.h" | 8 #include "base/gfx/bitmap_header.h" |
| 9 #include "base/gfx/rect.h" | 9 #include "base/gfx/rect.h" |
| 10 #include "base/histogram.h" | 10 #include "base/histogram.h" |
| (...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 } | 717 } |
| 718 | 718 |
| 719 if (!handled_by_webcontents) { | 719 if (!handled_by_webcontents) { |
| 720 render_widget_host_->ForwardWheelEvent( | 720 render_widget_host_->ForwardWheelEvent( |
| 721 WebMouseWheelEvent(m_hWnd, message, wparam, lparam)); | 721 WebMouseWheelEvent(m_hWnd, message, wparam, lparam)); |
| 722 } | 722 } |
| 723 handled = TRUE; | 723 handled = TRUE; |
| 724 return 0; | 724 return 0; |
| 725 } | 725 } |
| 726 | 726 |
| 727 LRESULT RenderWidgetHostHWND::OnNcCalcSize(UINT message, WPARAM w_param, | |
| 728 LPARAM l_param, BOOL& handled) { | |
| 729 // Handle WM_NCCALCSIZE and make scrollbar size to 0. | |
| 730 // Here we indicate that the entire window area is our | |
| 731 // client area. The assumption is that we won't have a border | |
| 732 // or any other non-client widget. | |
| 733 return 0; | |
| 734 } | |
| 735 | |
| 736 LRESULT RenderWidgetHostHWND::OnSize(UINT message, WPARAM w_param, | |
| 737 LPARAM l_param, BOOL& handled) { | |
| 738 // Set arbitrary but valid scroll information so that | |
| 739 // our window will get WS_VSCROLL and WS_HSCROLL style. | |
| 740 | |
| 741 // TODO(joshia): The correct thing to do here is to get | |
| 742 // the correct scroll information from the renderer and | |
| 743 // set it here. | |
| 744 SCROLLINFO si = {0}; | |
| 745 si.cbSize = sizeof(si); | |
| 746 si.fMask = SIF_ALL; | |
| 747 | |
| 748 si.nMin = 1; | |
| 749 si.nMax = 100; | |
| 750 si.nPage = 10; | |
| 751 si.nTrackPos = 50; | |
| 752 | |
| 753 SetScrollInfo(SB_HORZ, &si, FALSE); | |
| 754 SetScrollInfo(SB_VERT, &si, FALSE); | |
| 755 | |
| 756 handled = FALSE; | |
| 757 return 0; | |
| 758 } | |
| 759 | |
| 760 LRESULT RenderWidgetHostHWND::OnMouseActivate(UINT, WPARAM, LPARAM, | 727 LRESULT RenderWidgetHostHWND::OnMouseActivate(UINT, WPARAM, LPARAM, |
| 761 BOOL& handled) { | 728 BOOL& handled) { |
| 762 // We handle WM_MOUSEACTIVATE to set focus to the underlying plugin | 729 // We handle WM_MOUSEACTIVATE to set focus to the underlying plugin |
| 763 // child window. This is to ensure that keyboard events are received | 730 // child window. This is to ensure that keyboard events are received |
| 764 // by the plugin. The correct way to fix this would be send over | 731 // by the plugin. The correct way to fix this would be send over |
| 765 // an event to the renderer which would then eventually send over | 732 // an event to the renderer which would then eventually send over |
| 766 // a setFocus call to the plugin widget. This would ensure that | 733 // a setFocus call to the plugin widget. This would ensure that |
| 767 // the renderer (webkit) knows about the plugin widget receiving | 734 // the renderer (webkit) knows about the plugin widget receiving |
| 768 // focus. | 735 // focus. |
| 769 // TODO(iyengar) Do the right thing as per the above comment. | 736 // TODO(iyengar) Do the right thing as per the above comment. |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 847 | 814 |
| 848 return TRUE; | 815 return TRUE; |
| 849 } | 816 } |
| 850 | 817 |
| 851 void RenderWidgetHostHWND::ShutdownHost() { | 818 void RenderWidgetHostHWND::ShutdownHost() { |
| 852 shutdown_factory_.RevokeAll(); | 819 shutdown_factory_.RevokeAll(); |
| 853 render_widget_host_->Shutdown(); | 820 render_widget_host_->Shutdown(); |
| 854 // Do not touch any members at this point, |this| has been deleted. | 821 // Do not touch any members at this point, |this| has been deleted. |
| 855 } | 822 } |
| 856 | 823 |
| OLD | NEW |