| 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/win_util.h" |
| 9 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
| 10 #include "content/browser/accessibility/browser_accessibility_manager_win.h" | 11 #include "content/browser/accessibility/browser_accessibility_manager_win.h" |
| 11 #include "content/browser/accessibility/browser_accessibility_win.h" | 12 #include "content/browser/accessibility/browser_accessibility_win.h" |
| 12 #include "content/browser/renderer_host/render_widget_host_impl.h" | 13 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 13 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 14 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 14 #include "content/public/browser/browser_accessibility_state.h" | 15 #include "content/public/browser/browser_accessibility_state.h" |
| 15 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
| 16 #include "ui/base/touch/touch_enabled.h" | 17 #include "ui/base/touch/touch_enabled.h" |
| 17 #include "ui/base/view_prop.h" | 18 #include "ui/base/view_prop.h" |
| 18 #include "ui/base/win/internal_constants.h" | 19 #include "ui/base/win/internal_constants.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 SWP_NOREDRAW); | 90 SWP_NOREDRAW); |
| 90 if (direct_manipulation_helper_) | 91 if (direct_manipulation_helper_) |
| 91 direct_manipulation_helper_->SetBounds(bounds_in_pixel); | 92 direct_manipulation_helper_->SetBounds(bounds_in_pixel); |
| 92 } | 93 } |
| 93 | 94 |
| 94 void LegacyRenderWidgetHostHWND::OnFinalMessage(HWND hwnd) { | 95 void LegacyRenderWidgetHostHWND::OnFinalMessage(HWND hwnd) { |
| 95 if (host_) { | 96 if (host_) { |
| 96 host_->OnLegacyWindowDestroyed(); | 97 host_->OnLegacyWindowDestroyed(); |
| 97 host_ = NULL; | 98 host_ = NULL; |
| 98 } | 99 } |
| 100 |
| 101 // Re-enable flicks for just a moment |
| 102 base::win::EnableFlicks(hwnd); |
| 103 |
| 99 delete this; | 104 delete this; |
| 100 } | 105 } |
| 101 | 106 |
| 102 LegacyRenderWidgetHostHWND::LegacyRenderWidgetHostHWND(HWND parent) | 107 LegacyRenderWidgetHostHWND::LegacyRenderWidgetHostHWND(HWND parent) |
| 103 : mouse_tracking_enabled_(false), | 108 : mouse_tracking_enabled_(false), |
| 104 host_(NULL) { | 109 host_(NULL) { |
| 105 RECT rect = {0}; | 110 RECT rect = {0}; |
| 106 Base::Create(parent, rect, L"Chrome Legacy Window", | 111 Base::Create(parent, rect, L"Chrome Legacy Window", |
| 107 WS_CHILDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, | 112 WS_CHILDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, |
| 108 WS_EX_TRANSPARENT); | 113 WS_EX_TRANSPARENT); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 129 CHILDID_SELF); | 134 CHILDID_SELF); |
| 130 } | 135 } |
| 131 | 136 |
| 132 // Direct Manipulation is enabled on Windows 10+. The CreateInstance function | 137 // Direct Manipulation is enabled on Windows 10+. The CreateInstance function |
| 133 // returns NULL if Direct Manipulation is not available. | 138 // returns NULL if Direct Manipulation is not available. |
| 134 direct_manipulation_helper_ = | 139 direct_manipulation_helper_ = |
| 135 gfx::win::DirectManipulationHelper::CreateInstance(); | 140 gfx::win::DirectManipulationHelper::CreateInstance(); |
| 136 if (direct_manipulation_helper_) | 141 if (direct_manipulation_helper_) |
| 137 direct_manipulation_helper_->Initialize(hwnd()); | 142 direct_manipulation_helper_->Initialize(hwnd()); |
| 138 | 143 |
| 144 // Disable pen flicks (http://crbug.com/506977) |
| 145 base::win::DisableFlicks(hwnd()); |
| 146 |
| 139 return !!SUCCEEDED(hr); | 147 return !!SUCCEEDED(hr); |
| 140 } | 148 } |
| 141 | 149 |
| 142 // static | 150 // static |
| 143 ui::WindowEventTarget* LegacyRenderWidgetHostHWND::GetWindowEventTarget( | 151 ui::WindowEventTarget* LegacyRenderWidgetHostHWND::GetWindowEventTarget( |
| 144 HWND parent) { | 152 HWND parent) { |
| 145 return reinterpret_cast<ui::WindowEventTarget*>(ui::ViewProp::GetValue( | 153 return reinterpret_cast<ui::WindowEventTarget*>(ui::ViewProp::GetValue( |
| 146 parent, ui::WindowEventTarget::kWin32InputEventTarget)); | 154 parent, ui::WindowEventTarget::kWin32InputEventTarget)); |
| 147 } | 155 } |
| 148 | 156 |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 direct_manipulation_helper_->Activate(hwnd()); | 412 direct_manipulation_helper_->Activate(hwnd()); |
| 405 } else if (window_pos->flags & SWP_HIDEWINDOW) { | 413 } else if (window_pos->flags & SWP_HIDEWINDOW) { |
| 406 direct_manipulation_helper_->Deactivate(hwnd()); | 414 direct_manipulation_helper_->Deactivate(hwnd()); |
| 407 } | 415 } |
| 408 } | 416 } |
| 409 SetMsgHandled(FALSE); | 417 SetMsgHandled(FALSE); |
| 410 return 0; | 418 return 0; |
| 411 } | 419 } |
| 412 | 420 |
| 413 } // namespace content | 421 } // namespace content |
| OLD | NEW |