| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/gfx/win/direct_manipulation.h" | 5 #include "ui/gfx/win/direct_manipulation.h" |
| 6 | 6 |
| 7 #include <objbase.h> |
| 8 |
| 7 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
| 8 | 10 |
| 9 namespace gfx { | 11 namespace gfx { |
| 10 namespace win { | 12 namespace win { |
| 11 | 13 |
| 12 // static | 14 // static |
| 13 std::unique_ptr<DirectManipulationHelper> | 15 std::unique_ptr<DirectManipulationHelper> |
| 14 DirectManipulationHelper::CreateInstance() { | 16 DirectManipulationHelper::CreateInstance() { |
| 15 // TODO(dtapuska): Do not create a DirectManipulationHelper on any windows | 17 // TODO(dtapuska): Do not create a DirectManipulationHelper on any windows |
| 16 // versions as it only causes issues. High Precision Touchpad events seem to | 18 // versions as it only causes issues. High Precision Touchpad events seem to |
| 17 // always be sent to apps with recent Windows 10 versions. This class should | 19 // always be sent to apps with recent Windows 10 versions. This class should |
| 18 // eventually be removed. See crbug.com/647038. | 20 // eventually be removed. See crbug.com/647038. |
| 19 return nullptr; | 21 return nullptr; |
| 20 } | 22 } |
| 21 | 23 |
| 22 DirectManipulationHelper::DirectManipulationHelper() {} | 24 DirectManipulationHelper::DirectManipulationHelper() {} |
| 23 | 25 |
| 24 DirectManipulationHelper::~DirectManipulationHelper() { | 26 DirectManipulationHelper::~DirectManipulationHelper() { |
| 25 if (view_port_outer_) | 27 if (view_port_outer_) |
| 26 view_port_outer_->Abandon(); | 28 view_port_outer_->Abandon(); |
| 27 } | 29 } |
| 28 | 30 |
| 29 void DirectManipulationHelper::Initialize(HWND window) { | 31 void DirectManipulationHelper::Initialize(HWND window) { |
| 30 DCHECK(::IsWindow(window)); | 32 DCHECK(::IsWindow(window)); |
| 31 | 33 |
| 32 // TODO(ananta) | 34 // TODO(ananta) |
| 33 // Remove the CHECK statements here and below and replace them with logs | 35 // Remove the CHECK statements here and below and replace them with logs |
| 34 // when this code stabilizes. | 36 // when this code stabilizes. |
| 35 HRESULT hr = manager_.CreateInstance(CLSID_DirectManipulationManager, | 37 HRESULT hr = |
| 36 nullptr, CLSCTX_INPROC_SERVER); | 38 ::CoCreateInstance(CLSID_DirectManipulationManager, nullptr, |
| 39 CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&manager_)); |
| 37 CHECK(SUCCEEDED(hr)); | 40 CHECK(SUCCEEDED(hr)); |
| 38 | 41 |
| 39 hr = compositor_.CreateInstance(CLSID_DCompManipulationCompositor, | 42 hr = ::CoCreateInstance(CLSID_DCompManipulationCompositor, nullptr, |
| 40 nullptr, CLSCTX_INPROC_SERVER); | 43 CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&compositor_)); |
| 41 CHECK(SUCCEEDED(hr)); | 44 CHECK(SUCCEEDED(hr)); |
| 42 | 45 |
| 43 hr = manager_->GetUpdateManager(IID_PPV_ARGS(update_manager_.GetAddressOf())); | 46 hr = manager_->GetUpdateManager(IID_PPV_ARGS(update_manager_.GetAddressOf())); |
| 44 CHECK(SUCCEEDED(hr)); | 47 CHECK(SUCCEEDED(hr)); |
| 45 | 48 |
| 46 hr = compositor_->SetUpdateManager(update_manager_.Get()); | 49 hr = compositor_->SetUpdateManager(update_manager_.Get()); |
| 47 CHECK(SUCCEEDED(hr)); | 50 CHECK(SUCCEEDED(hr)); |
| 48 | 51 |
| 49 hr = compositor_.CopyTo(frame_info_.GetAddressOf()); | 52 hr = compositor_.CopyTo(frame_info_.GetAddressOf()); |
| 50 CHECK(SUCCEEDED(hr)); | 53 CHECK(SUCCEEDED(hr)); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 HRESULT hr = view_port_outer_->SetContact(DIRECTMANIPULATION_MOUSEFOCUS); | 110 HRESULT hr = view_port_outer_->SetContact(DIRECTMANIPULATION_MOUSEFOCUS); |
| 108 if (SUCCEEDED(hr)) { | 111 if (SUCCEEDED(hr)) { |
| 109 BOOL handled = FALSE; | 112 BOOL handled = FALSE; |
| 110 manager_->ProcessInput(&msg, &handled); | 113 manager_->ProcessInput(&msg, &handled); |
| 111 view_port_outer_->ReleaseContact(DIRECTMANIPULATION_MOUSEFOCUS); | 114 view_port_outer_->ReleaseContact(DIRECTMANIPULATION_MOUSEFOCUS); |
| 112 } | 115 } |
| 113 } | 116 } |
| 114 | 117 |
| 115 } // namespace win. | 118 } // namespace win. |
| 116 } // namespace gfx. | 119 } // namespace gfx. |
| OLD | NEW |