Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 "content/browser/renderer_host/legacy_render_widget_host_win.h" | 5 #include "content/browser/renderer_host/legacy_render_widget_host_win.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
| 10 #include "content/browser/accessibility/browser_accessibility_manager_win.h" | 10 #include "content/browser/accessibility/browser_accessibility_manager_win.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 69 ::EnableWindow(hwnd(), TRUE); | 69 ::EnableWindow(hwnd(), TRUE); |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 HWND LegacyRenderWidgetHostHWND::GetParent() { | 73 HWND LegacyRenderWidgetHostHWND::GetParent() { |
| 74 return ::GetParent(hwnd()); | 74 return ::GetParent(hwnd()); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void LegacyRenderWidgetHostHWND::Show() { | 77 void LegacyRenderWidgetHostHWND::Show() { |
| 78 ::ShowWindow(hwnd(), SW_SHOW); | 78 ::ShowWindow(hwnd(), SW_SHOW); |
| 79 if (direct_manipulation_helper_) | |
| 80 direct_manipulation_helper_->Activate(hwnd()); | |
| 81 } | 79 } |
| 82 | 80 |
| 83 void LegacyRenderWidgetHostHWND::Hide() { | 81 void LegacyRenderWidgetHostHWND::Hide() { |
| 84 ::ShowWindow(hwnd(), SW_HIDE); | 82 ::ShowWindow(hwnd(), SW_HIDE); |
| 85 } | 83 } |
| 86 | 84 |
| 87 void LegacyRenderWidgetHostHWND::SetBounds(const gfx::Rect& bounds) { | 85 void LegacyRenderWidgetHostHWND::SetBounds(const gfx::Rect& bounds) { |
| 88 gfx::Rect bounds_in_pixel = gfx::win::DIPToScreenRect(bounds); | 86 gfx::Rect bounds_in_pixel = gfx::win::DIPToScreenRect(bounds); |
| 89 ::SetWindowPos(hwnd(), NULL, bounds_in_pixel.x(), bounds_in_pixel.y(), | 87 ::SetWindowPos(hwnd(), NULL, bounds_in_pixel.x(), bounds_in_pixel.y(), |
| 90 bounds_in_pixel.width(), bounds_in_pixel.height(), | 88 bounds_in_pixel.width(), bounds_in_pixel.height(), |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 390 // Additionally others check if the window WS_VSCROLL/WS_HSCROLL styles and | 388 // Additionally others check if the window WS_VSCROLL/WS_HSCROLL styles and |
| 391 // generate the legacy WM_VSCROLL/WM_HSCROLL messages. | 389 // generate the legacy WM_VSCROLL/WM_HSCROLL messages. |
| 392 // We add these styles to ensure that trackpad/trackpoint scrolling | 390 // We add these styles to ensure that trackpad/trackpoint scrolling |
| 393 // work. | 391 // work. |
| 394 long current_style = ::GetWindowLong(hwnd(), GWL_STYLE); | 392 long current_style = ::GetWindowLong(hwnd(), GWL_STYLE); |
| 395 ::SetWindowLong(hwnd(), GWL_STYLE, | 393 ::SetWindowLong(hwnd(), GWL_STYLE, |
| 396 current_style | WS_VSCROLL | WS_HSCROLL); | 394 current_style | WS_VSCROLL | WS_HSCROLL); |
| 397 return 0; | 395 return 0; |
| 398 } | 396 } |
| 399 | 397 |
| 398 LRESULT LegacyRenderWidgetHostHWND::OnWindowPosChanged(UINT message, | |
| 399 WPARAM w_param, | |
| 400 LPARAM l_param) { | |
| 401 WINDOWPOS* window_pos = reinterpret_cast<WINDOWPOS*>(l_param); | |
| 402 if (direct_manipulation_helper_) { | |
| 403 if (window_pos->flags & SWP_SHOWWINDOW) { | |
| 404 direct_manipulation_helper_->Activate(hwnd()); | |
| 405 } else if (window_pos->flags & SWP_HIDEWINDOW) { | |
| 406 direct_manipulation_helper_->Deactivate(hwnd()); | |
| 407 } | |
| 408 } | |
| 409 return 0; | |
|
sky
2015/08/14 20:56:37
Do you need the SetMsgHandled(FALSE); ?
ananta
2015/08/14 21:04:30
Done.
| |
| 410 } | |
| 411 | |
| 400 } // namespace content | 412 } // namespace content |
| OLD | NEW |