| 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 "base/win/windows_version.h" | 7 #include "base/win/windows_version.h" |
| 8 | 8 |
| 9 namespace gfx { | 9 namespace gfx { |
| 10 namespace win { | 10 namespace win { |
| 11 | 11 |
| 12 // static | 12 // static |
| 13 std::unique_ptr<DirectManipulationHelper> | 13 std::unique_ptr<DirectManipulationHelper> |
| 14 DirectManipulationHelper::CreateInstance() { | 14 DirectManipulationHelper::CreateInstance() { |
| 15 std::unique_ptr<DirectManipulationHelper> instance; | 15 std::unique_ptr<DirectManipulationHelper> instance; |
| 16 | 16 |
| 17 if (base::win::GetVersion() >= base::win::VERSION_WIN10) | 17 if (base::win::GetVersion() >= base::win::VERSION_WIN10) |
| 18 instance.reset(new DirectManipulationHelper); | 18 instance.reset(new DirectManipulationHelper); |
| 19 | 19 |
| 20 return instance; | 20 return instance; |
| 21 } | 21 } |
| 22 | 22 |
| 23 DirectManipulationHelper::DirectManipulationHelper() {} | 23 DirectManipulationHelper::DirectManipulationHelper() {} |
| 24 | 24 |
| 25 DirectManipulationHelper::~DirectManipulationHelper() {} | 25 DirectManipulationHelper::~DirectManipulationHelper() { |
| 26 if (view_port_outer_) |
| 27 view_port_outer_->Abandon(); |
| 28 } |
| 26 | 29 |
| 27 void DirectManipulationHelper::Initialize(HWND window) { | 30 void DirectManipulationHelper::Initialize(HWND window) { |
| 28 DCHECK(::IsWindow(window)); | 31 DCHECK(::IsWindow(window)); |
| 29 | 32 |
| 30 // TODO(ananta) | 33 // TODO(ananta) |
| 31 // Remove the CHECK statements here and below and replace them with logs | 34 // Remove the CHECK statements here and below and replace them with logs |
| 32 // when this code stabilizes. | 35 // when this code stabilizes. |
| 33 HRESULT hr = manager_.CreateInstance(CLSID_DirectManipulationManager, | 36 HRESULT hr = manager_.CreateInstance(CLSID_DirectManipulationManager, |
| 34 nullptr, CLSCTX_INPROC_SERVER); | 37 nullptr, CLSCTX_INPROC_SERVER); |
| 35 CHECK(SUCCEEDED(hr)); | 38 CHECK(SUCCEEDED(hr)); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 HRESULT hr = view_port_outer_->SetContact(DIRECTMANIPULATION_MOUSEFOCUS); | 108 HRESULT hr = view_port_outer_->SetContact(DIRECTMANIPULATION_MOUSEFOCUS); |
| 106 if (SUCCEEDED(hr)) { | 109 if (SUCCEEDED(hr)) { |
| 107 BOOL handled = FALSE; | 110 BOOL handled = FALSE; |
| 108 manager_->ProcessInput(&msg, &handled); | 111 manager_->ProcessInput(&msg, &handled); |
| 109 view_port_outer_->ReleaseContact(DIRECTMANIPULATION_MOUSEFOCUS); | 112 view_port_outer_->ReleaseContact(DIRECTMANIPULATION_MOUSEFOCUS); |
| 110 } | 113 } |
| 111 } | 114 } |
| 112 | 115 |
| 113 } // namespace win. | 116 } // namespace win. |
| 114 } // namespace gfx. | 117 } // namespace gfx. |
| OLD | NEW |