Commit 2031b910 authored by chaopeng's avatar chaopeng Committed by Commit Bot

Move direct_manipulation to ui/base/win

This patch is preparing for the new implementation of Direct
Manipulation API. In the patch, we move direct_manipulation.h|cc to
ui/base/win, change related macros, includes and run git cl format.

Bug: 647140
Change-Id: Ib3acccf84737ae6c25be27ad0d2776ab005c5fd3
Reviewed-on: https://chromium-review.googlesource.com/896704Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Jianpeng Chao <chaopeng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533805}
parent 76299305
...@@ -19,11 +19,11 @@ ...@@ -19,11 +19,11 @@
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "ui/accessibility/platform/ax_system_caret_win.h" #include "ui/accessibility/platform/ax_system_caret_win.h"
#include "ui/base/view_prop.h" #include "ui/base/view_prop.h"
#include "ui/base/win/direct_manipulation.h"
#include "ui/base/win/internal_constants.h" #include "ui/base/win/internal_constants.h"
#include "ui/base/win/window_event_target.h" #include "ui/base/win/window_event_target.h"
#include "ui/display/win/screen_win.h" #include "ui/display/win/screen_win.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
#include "ui/gfx/win/direct_manipulation.h"
namespace content { namespace content {
...@@ -140,7 +140,7 @@ bool LegacyRenderWidgetHostHWND::Init() { ...@@ -140,7 +140,7 @@ bool LegacyRenderWidgetHostHWND::Init() {
// Direct Manipulation is enabled on Windows 10+. The CreateInstance function // Direct Manipulation is enabled on Windows 10+. The CreateInstance function
// returns NULL if Direct Manipulation is not available. // returns NULL if Direct Manipulation is not available.
direct_manipulation_helper_ = direct_manipulation_helper_ =
gfx::win::DirectManipulationHelper::CreateInstance(); ui::win::DirectManipulationHelper::CreateInstance();
if (direct_manipulation_helper_) if (direct_manipulation_helper_)
direct_manipulation_helper_->Initialize(hwnd()); direct_manipulation_helper_->Initialize(hwnd());
......
...@@ -17,16 +17,13 @@ ...@@ -17,16 +17,13 @@
#include "content/common/content_export.h" #include "content/common/content_export.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
namespace gfx {
namespace win {
class DirectManipulationHelper;
} // namespace win
} // namespace gfx
namespace ui { namespace ui {
class AXSystemCaretWin; class AXSystemCaretWin;
class WindowEventTarget; class WindowEventTarget;
} namespace win {
class DirectManipulationHelper;
} // namespace win
} // namespace ui
namespace content { namespace content {
class RenderWidgetHostViewAura; class RenderWidgetHostViewAura;
...@@ -170,7 +167,7 @@ class CONTENT_EXPORT LegacyRenderWidgetHostHWND ...@@ -170,7 +167,7 @@ class CONTENT_EXPORT LegacyRenderWidgetHostHWND
// This class provides functionality to register the legacy window as a // This class provides functionality to register the legacy window as a
// Direct Manipulation consumer. This allows us to support smooth scroll // Direct Manipulation consumer. This allows us to support smooth scroll
// in Chrome on Windows 10. // in Chrome on Windows 10.
std::unique_ptr<gfx::win::DirectManipulationHelper> std::unique_ptr<ui::win::DirectManipulationHelper>
direct_manipulation_helper_; direct_manipulation_helper_;
DISALLOW_COPY_AND_ASSIGN(LegacyRenderWidgetHostHWND); DISALLOW_COPY_AND_ASSIGN(LegacyRenderWidgetHostHWND);
......
...@@ -291,6 +291,8 @@ component("base") { ...@@ -291,6 +291,8 @@ component("base") {
"win/accessibility_misc_utils.cc", "win/accessibility_misc_utils.cc",
"win/accessibility_misc_utils.h", "win/accessibility_misc_utils.h",
"win/atl_module.h", "win/atl_module.h",
"win/direct_manipulation.cc",
"win/direct_manipulation.h",
"win/foreground_helper.cc", "win/foreground_helper.cc",
"win/foreground_helper.h", "win/foreground_helper.h",
"win/hidden_window.cc", "win/hidden_window.cc",
......
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "ui/gfx/win/direct_manipulation.h" #include "ui/base/win/direct_manipulation.h"
#include <objbase.h> #include <objbase.h>
#include "base/win/windows_version.h" #include "base/win/windows_version.h"
namespace gfx { namespace ui {
namespace win { namespace win {
// static // static
...@@ -17,7 +17,7 @@ DirectManipulationHelper::CreateInstance() { ...@@ -17,7 +17,7 @@ DirectManipulationHelper::CreateInstance() {
// TODO(dtapuska): Do not create a DirectManipulationHelper on any windows // TODO(dtapuska): Do not create a DirectManipulationHelper on any windows
// versions as it only causes issues. High Precision Touchpad events seem to // versions as it only causes issues. High Precision Touchpad events seem to
// always be sent to apps with recent Windows 10 versions. This class should // always be sent to apps with recent Windows 10 versions. This class should
// eventually be removed. See crbug.com/647038. // eventually be removed. See https://crbug.com/647038.
return nullptr; return nullptr;
} }
...@@ -60,14 +60,14 @@ void DirectManipulationHelper::Initialize(HWND window) { ...@@ -60,14 +60,14 @@ void DirectManipulationHelper::Initialize(HWND window) {
// Enable the desired configuration for each viewport. // Enable the desired configuration for each viewport.
// //
DIRECTMANIPULATION_CONFIGURATION configuration = DIRECTMANIPULATION_CONFIGURATION configuration =
DIRECTMANIPULATION_CONFIGURATION_INTERACTION DIRECTMANIPULATION_CONFIGURATION_INTERACTION |
| DIRECTMANIPULATION_CONFIGURATION_TRANSLATION_X DIRECTMANIPULATION_CONFIGURATION_TRANSLATION_X |
| DIRECTMANIPULATION_CONFIGURATION_TRANSLATION_Y DIRECTMANIPULATION_CONFIGURATION_TRANSLATION_Y |
| DIRECTMANIPULATION_CONFIGURATION_TRANSLATION_INERTIA DIRECTMANIPULATION_CONFIGURATION_TRANSLATION_INERTIA |
| DIRECTMANIPULATION_CONFIGURATION_RAILS_X DIRECTMANIPULATION_CONFIGURATION_RAILS_X |
| DIRECTMANIPULATION_CONFIGURATION_RAILS_Y DIRECTMANIPULATION_CONFIGURATION_RAILS_Y |
| DIRECTMANIPULATION_CONFIGURATION_SCALING DIRECTMANIPULATION_CONFIGURATION_SCALING |
| DIRECTMANIPULATION_CONFIGURATION_SCALING_INERTIA; DIRECTMANIPULATION_CONFIGURATION_SCALING_INERTIA;
hr = view_port_outer_->ActivateConfiguration(configuration); hr = view_port_outer_->ActivateConfiguration(configuration);
CHECK(SUCCEEDED(hr)); CHECK(SUCCEEDED(hr));
...@@ -103,9 +103,11 @@ void DirectManipulationHelper::Deactivate(HWND window) { ...@@ -103,9 +103,11 @@ void DirectManipulationHelper::Deactivate(HWND window) {
manager_->Deactivate(window); manager_->Deactivate(window);
} }
void DirectManipulationHelper:: HandleMouseWheel(HWND window, UINT message, void DirectManipulationHelper::HandleMouseWheel(HWND window,
WPARAM w_param, LPARAM l_param) { UINT message,
MSG msg = { window, message, w_param, l_param}; WPARAM w_param,
LPARAM l_param) {
MSG msg = {window, message, w_param, l_param};
HRESULT hr = view_port_outer_->SetContact(DIRECTMANIPULATION_MOUSEFOCUS); HRESULT hr = view_port_outer_->SetContact(DIRECTMANIPULATION_MOUSEFOCUS);
if (SUCCEEDED(hr)) { if (SUCCEEDED(hr)) {
...@@ -116,4 +118,4 @@ void DirectManipulationHelper:: HandleMouseWheel(HWND window, UINT message, ...@@ -116,4 +118,4 @@ void DirectManipulationHelper:: HandleMouseWheel(HWND window, UINT message,
} }
} // namespace win. } // namespace win.
} // namespace gfx. } // namespace ui.
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef UI_GFX_WIN_DIRECT_MANIPULATION_H_ #ifndef UI_WIN_DIRECT_MANIPULATION_H_
#define UI_GFX_WIN_DIRECT_MANIPULATION_H_ #define UI_WIN_DIRECT_MANIPULATION_H_
#include <directmanipulation.h> #include <directmanipulation.h>
#include <wrl/client.h> #include <wrl/client.h>
...@@ -11,10 +11,10 @@ ...@@ -11,10 +11,10 @@
#include <memory> #include <memory>
#include "base/macros.h" #include "base/macros.h"
#include "ui/base/ui_base_export.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
#include "ui/gfx/gfx_export.h"
namespace gfx { namespace ui {
namespace win { namespace win {
// Windows 10 provides a new API called Direct Manipulation which generates // Windows 10 provides a new API called Direct Manipulation which generates
...@@ -39,7 +39,7 @@ namespace win { ...@@ -39,7 +39,7 @@ namespace win {
// Direct Manipulation consumer. We don't rely on Direct manipulation // Direct Manipulation consumer. We don't rely on Direct manipulation
// to do the smooth scrolling in the background thread as documented on // to do the smooth scrolling in the background thread as documented on
// msdn. // msdn.
class GFX_EXPORT DirectManipulationHelper { class UI_BASE_EXPORT DirectManipulationHelper {
public: public:
// Creates an instance of this class if Direct Manipulation is enabled on // Creates an instance of this class if Direct Manipulation is enabled on
// the platform. If not returns NULL. // the platform. If not returns NULL.
...@@ -63,8 +63,10 @@ class GFX_EXPORT DirectManipulationHelper { ...@@ -63,8 +63,10 @@ class GFX_EXPORT DirectManipulationHelper {
// Passes the WM_MOUSEWHEEL messages to Direct Manipulation. This is for // Passes the WM_MOUSEWHEEL messages to Direct Manipulation. This is for
// logistics purposes. // logistics purposes.
void HandleMouseWheel(HWND window, UINT message, WPARAM w_param, void HandleMouseWheel(HWND window,
LPARAM l_param); UINT message,
WPARAM w_param,
LPARAM l_param);
~DirectManipulationHelper(); ~DirectManipulationHelper();
...@@ -81,6 +83,6 @@ class GFX_EXPORT DirectManipulationHelper { ...@@ -81,6 +83,6 @@ class GFX_EXPORT DirectManipulationHelper {
}; };
} // namespace win } // namespace win
} // namespace gfx } // namespace ui
#endif // UI_GFX_WIN_DIRECT_MANIPULATION_H_ #endif // UI_WIN_DIRECT_MANIPULATION_H_
...@@ -172,8 +172,6 @@ jumbo_component("gfx") { ...@@ -172,8 +172,6 @@ jumbo_component("gfx") {
"utf16_indexing.h", "utf16_indexing.h",
"vsync_provider.cc", "vsync_provider.cc",
"vsync_provider.h", "vsync_provider.h",
"win/direct_manipulation.cc",
"win/direct_manipulation.h",
"win/direct_write.cc", "win/direct_write.cc",
"win/direct_write.h", "win/direct_write.h",
"win/hwnd_util.cc", "win/hwnd_util.cc",
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "ui/base/ime/text_input_type.h" #include "ui/base/ime/text_input_type.h"
#include "ui/base/ui_base_features.h" #include "ui/base/ui_base_features.h"
#include "ui/base/view_prop.h" #include "ui/base/view_prop.h"
#include "ui/base/win/direct_manipulation.h"
#include "ui/base/win/internal_constants.h" #include "ui/base/win/internal_constants.h"
#include "ui/base/win/lock_state.h" #include "ui/base/win/lock_state.h"
#include "ui/base/win/mouse_wheel_util.h" #include "ui/base/win/mouse_wheel_util.h"
...@@ -48,7 +49,6 @@ ...@@ -48,7 +49,6 @@
#include "ui/gfx/icon_util.h" #include "ui/gfx/icon_util.h"
#include "ui/gfx/path.h" #include "ui/gfx/path.h"
#include "ui/gfx/path_win.h" #include "ui/gfx/path_win.h"
#include "ui/gfx/win/direct_manipulation.h"
#include "ui/gfx/win/hwnd_util.h" #include "ui/gfx/win/hwnd_util.h"
#include "ui/gfx/win/rendering_window_manager.h" #include "ui/gfx/win/rendering_window_manager.h"
#include "ui/native_theme/native_theme_win.h" #include "ui/native_theme/native_theme_win.h"
...@@ -416,7 +416,7 @@ void HWNDMessageHandler::Init(HWND parent, const gfx::Rect& bounds) { ...@@ -416,7 +416,7 @@ void HWNDMessageHandler::Init(HWND parent, const gfx::Rect& bounds) {
// Direct Manipulation is enabled on Windows 10+. The CreateInstance function // Direct Manipulation is enabled on Windows 10+. The CreateInstance function
// returns NULL if Direct Manipulation is not available. // returns NULL if Direct Manipulation is not available.
direct_manipulation_helper_ = direct_manipulation_helper_ =
gfx::win::DirectManipulationHelper::CreateInstance(); ui::win::DirectManipulationHelper::CreateInstance();
if (direct_manipulation_helper_) if (direct_manipulation_helper_)
direct_manipulation_helper_->Initialize(hwnd()); direct_manipulation_helper_->Initialize(hwnd());
......
...@@ -34,9 +34,6 @@ ...@@ -34,9 +34,6 @@
namespace gfx { namespace gfx {
class ImageSkia; class ImageSkia;
class Insets; class Insets;
namespace win {
class DirectManipulationHelper;
} // namespace win
} // namespace gfx } // namespace gfx
namespace ui { namespace ui {
...@@ -44,7 +41,10 @@ class AXSystemCaretWin; ...@@ -44,7 +41,10 @@ class AXSystemCaretWin;
class InputMethod; class InputMethod;
class TextInputClient; class TextInputClient;
class ViewProp; class ViewProp;
} namespace win {
class DirectManipulationHelper;
} // namespace win
} // namespace ui
namespace views { namespace views {
...@@ -737,7 +737,7 @@ class VIEWS_EXPORT HWNDMessageHandler : public gfx::WindowImpl, ...@@ -737,7 +737,7 @@ class VIEWS_EXPORT HWNDMessageHandler : public gfx::WindowImpl,
// This class provides functionality to register the legacy window as a // This class provides functionality to register the legacy window as a
// Direct Manipulation consumer. This allows us to support smooth scroll // Direct Manipulation consumer. This allows us to support smooth scroll
// in Chrome on Windows 10. // in Chrome on Windows 10.
std::unique_ptr<gfx::win::DirectManipulationHelper> std::unique_ptr<ui::win::DirectManipulationHelper>
direct_manipulation_helper_; direct_manipulation_helper_;
// The location where the user clicked on the caption. We cache this when we // The location where the user clicked on the caption. We cache this when we
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment