Commit d6b10e24 authored by Yuki Awano's avatar Yuki Awano Committed by Commit Bot

Remove --ash-new-touch-support-for-screen-magnification flag

- Enables new implementation of touch support for screen magnification
  by default.
- Removes the old implementation of touch support for screen
  magnification.

      around with two fingers scroll without any flag.
      Pass ash_unittests:MagnificationControllerTest

Bug: 670526
Test: Confirm that you can change zoom level with pinch gesture and pan
Change-Id: Icf25edb2bceae28323075f857c3e74c2b4526dcc
Reviewed-on: https://chromium-review.googlesource.com/903306Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Commit-Queue: Yuki Awano <yawano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534861}
parent 411345b2
...@@ -141,8 +141,6 @@ class MagnificationControllerImpl : public MagnificationController, ...@@ -141,8 +141,6 @@ class MagnificationControllerImpl : public MagnificationController,
return point_of_interest_; return point_of_interest_;
} }
void AddEventRewriterForTesting() override;
bool IsOnAnimationForTesting() const override { return is_on_animation_; } bool IsOnAnimationForTesting() const override { return is_on_animation_; }
void DisableMoveMagnifierDelayForTesting() override { void DisableMoveMagnifierDelayForTesting() override {
...@@ -236,7 +234,6 @@ class MagnificationControllerImpl : public MagnificationController, ...@@ -236,7 +234,6 @@ class MagnificationControllerImpl : public MagnificationController,
void OnMouseEvent(ui::MouseEvent* event) override; void OnMouseEvent(ui::MouseEvent* event) override;
void OnScrollEvent(ui::ScrollEvent* event) override; void OnScrollEvent(ui::ScrollEvent* event) override;
void OnTouchEvent(ui::TouchEvent* event) override; void OnTouchEvent(ui::TouchEvent* event) override;
void OnGestureEvent(ui::GestureEvent* event) override;
// ui::EventRewriter overrides: // ui::EventRewriter overrides:
ui::EventRewriteStatus RewriteEvent( ui::EventRewriteStatus RewriteEvent(
...@@ -363,11 +360,7 @@ MagnificationControllerImpl::MagnificationControllerImpl() ...@@ -363,11 +360,7 @@ MagnificationControllerImpl::MagnificationControllerImpl()
disable_move_magnifier_delay_(false) { disable_move_magnifier_delay_(false) {
Shell::Get()->AddPreTargetHandler(this); Shell::Get()->AddPreTargetHandler(this);
root_window_->AddObserver(this); root_window_->AddObserver(this);
root_window_->GetHost()->GetEventSource()->AddEventRewriter(this);
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
ash::switches::kAshNewTouchSupportForScreenMagnification)) {
root_window_->GetHost()->GetEventSource()->AddEventRewriter(this);
}
point_of_interest_ = root_window_->bounds().CenterPoint(); point_of_interest_ = root_window_->bounds().CenterPoint();
...@@ -381,11 +374,7 @@ MagnificationControllerImpl::~MagnificationControllerImpl() { ...@@ -381,11 +374,7 @@ MagnificationControllerImpl::~MagnificationControllerImpl() {
if (input_method) if (input_method)
input_method->RemoveObserver(this); input_method->RemoveObserver(this);
if (base::CommandLine::ForCurrentProcess()->HasSwitch( root_window_->GetHost()->GetEventSource()->RemoveEventRewriter(this);
ash::switches::kAshNewTouchSupportForScreenMagnification)) {
root_window_->GetHost()->GetEventSource()->RemoveEventRewriter(this);
}
root_window_->RemoveObserver(this); root_window_->RemoveObserver(this);
Shell::Get()->RemovePreTargetHandler(this); Shell::Get()->RemovePreTargetHandler(this);
...@@ -570,13 +559,6 @@ void MagnificationControllerImpl::SwitchTargetRootWindow( ...@@ -570,13 +559,6 @@ void MagnificationControllerImpl::SwitchTargetRootWindow(
root_window_->AddObserver(this); root_window_->AddObserver(this);
} }
void MagnificationControllerImpl::AddEventRewriterForTesting() {
DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
ash::switches::kAshNewTouchSupportForScreenMagnification));
root_window_->GetHost()->GetEventSource()->AddEventRewriter(this);
}
void MagnificationControllerImpl::AfterAnimationMoveCursorTo( void MagnificationControllerImpl::AfterAnimationMoveCursorTo(
const gfx::Point& location) { const gfx::Point& location) {
DCHECK(root_window_); DCHECK(root_window_);
...@@ -968,43 +950,6 @@ ui::EventRewriteStatus MagnificationControllerImpl::NextDispatchEvent( ...@@ -968,43 +950,6 @@ ui::EventRewriteStatus MagnificationControllerImpl::NextDispatchEvent(
return ui::EVENT_REWRITE_REWRITTEN; return ui::EVENT_REWRITE_REWRITTEN;
} }
void MagnificationControllerImpl::OnGestureEvent(ui::GestureEvent* event) {
// TODO(yawano): Remove old touch support implementation once the new one is
// enabled by default.
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
ash::switches::kAshNewTouchSupportForScreenMagnification)) {
return;
}
if (!IsEnabled())
return;
const ui::GestureEventDetails& details = event->details();
if (details.type() == ui::ET_GESTURE_SCROLL_UPDATE &&
details.touch_points() == 2) {
gfx::Rect viewport_rect_in_dip = GetViewportRect();
viewport_rect_in_dip.Offset(-details.scroll_x(), -details.scroll_y());
gfx::Rect viewport_rect_in_pixel =
ui::ConvertRectToPixel(root_window_->layer(), viewport_rect_in_dip);
MoveWindow(viewport_rect_in_pixel.origin(), false);
event->SetHandled();
} else if (details.type() == ui::ET_GESTURE_PINCH_UPDATE &&
details.touch_points() == 3) {
float scale = GetScale() * details.scale();
point_of_interest_ = event->root_location();
SetScale(scale, false);
event->SetHandled();
} else if (details.type() == ui::ET_GESTURE_PINCH_END &&
details.touch_points() == 3) {
float scale = GetScale();
// Jump back to exactly 1.0 if we are just a tiny bit zoomed in.
if (scale < kMinMagnifiedScaleThreshold) {
scale = kNonMagnifiedScale;
SetScale(scale, true);
}
}
}
void MagnificationControllerImpl::MoveMagnifierWindowFollowPoint( void MagnificationControllerImpl::MoveMagnifierWindowFollowPoint(
const gfx::Point& point, const gfx::Point& point,
int x_panning_margin, int x_panning_margin,
......
...@@ -94,10 +94,6 @@ class ASH_EXPORT MagnificationController { ...@@ -94,10 +94,6 @@ class ASH_EXPORT MagnificationController {
virtual void SwitchTargetRootWindow(aura::Window* new_root_window, virtual void SwitchTargetRootWindow(aura::Window* new_root_window,
bool redraw_original_root) = 0; bool redraw_original_root) = 0;
// Adds event rewriter for testing. Event rewriter is added at construction of
// the controller. But test run happens after the construction.
virtual void AddEventRewriterForTesting() = 0;
protected: protected:
MagnificationController() {} MagnificationController() {}
......
...@@ -798,11 +798,6 @@ TEST_F(MagnificationControllerTest, AdjustScaleFromScroll) { ...@@ -798,11 +798,6 @@ TEST_F(MagnificationControllerTest, AdjustScaleFromScroll) {
// Performs pinch zoom and confirm that zoom level is changed. This test case // Performs pinch zoom and confirm that zoom level is changed. This test case
// also tests touch event handling. // also tests touch event handling.
TEST_F(MagnificationControllerTest, PinchZoom) { TEST_F(MagnificationControllerTest, PinchZoom) {
// TODO(yawano): remove this once the flag is removed.
base::CommandLine::ForCurrentProcess()->AppendSwitch(
ash::switches::kAshNewTouchSupportForScreenMagnification);
GetMagnificationController()->AddEventRewriterForTesting();
ASSERT_EQ(0u, touch_event_watcher_->touch_events.size()); ASSERT_EQ(0u, touch_event_watcher_->touch_events.size());
GetMagnificationController()->SetEnabled(true); GetMagnificationController()->SetEnabled(true);
...@@ -881,11 +876,6 @@ TEST_F(MagnificationControllerTest, PinchZoom) { ...@@ -881,11 +876,6 @@ TEST_F(MagnificationControllerTest, PinchZoom) {
} }
TEST_F(MagnificationControllerTest, TwoFingersScroll) { TEST_F(MagnificationControllerTest, TwoFingersScroll) {
// TODO(yawano): remove this once the flag is removed.
base::CommandLine::ForCurrentProcess()->AppendSwitch(
ash::switches::kAshNewTouchSupportForScreenMagnification);
GetMagnificationController()->AddEventRewriterForTesting();
GetMagnificationController()->SetEnabled(true); GetMagnificationController()->SetEnabled(true);
ASSERT_EQ(2.0f, GetMagnificationController()->GetScale()); ASSERT_EQ(2.0f, GetMagnificationController()->GetScale());
...@@ -923,11 +913,6 @@ TEST_F(MagnificationControllerTest, TwoFingersScroll) { ...@@ -923,11 +913,6 @@ TEST_F(MagnificationControllerTest, TwoFingersScroll) {
} }
TEST_F(MagnificationControllerTest, GestureLock) { TEST_F(MagnificationControllerTest, GestureLock) {
// TODO(yawano): remove this once flag is removed.
base::CommandLine::ForCurrentProcess()->AppendSwitch(
ash::switches::kAshNewTouchSupportForScreenMagnification);
GetMagnificationController()->AddEventRewriterForTesting();
GetMagnificationController()->SetEnabled(true); GetMagnificationController()->SetEnabled(true);
ASSERT_EQ(2.0f, GetMagnificationController()->GetScale()); ASSERT_EQ(2.0f, GetMagnificationController()->GetScale());
......
...@@ -126,10 +126,6 @@ const char kAshUiModeTablet[] = "touch_view"; ...@@ -126,10 +126,6 @@ const char kAshUiModeTablet[] = "touch_view";
const char kAshHideNotificationsForFactory[] = const char kAshHideNotificationsForFactory[] =
"ash-hide-notifications-for-factory"; "ash-hide-notifications-for-factory";
// Enables new implementation of touch support for screen magnification.
const char kAshNewTouchSupportForScreenMagnification[] =
"ash-new-touch-support-for-screen-magnification";
// Enables the shelf color to be derived from the wallpaper. // Enables the shelf color to be derived from the wallpaper.
const char kAshShelfColor[] = "ash-shelf-color"; const char kAshShelfColor[] = "ash-shelf-color";
const char kAshShelfColorEnabled[] = "enabled"; const char kAshShelfColorEnabled[] = "enabled";
......
...@@ -45,7 +45,6 @@ ASH_PUBLIC_EXPORT extern const char kAshUiModeAuto[]; ...@@ -45,7 +45,6 @@ ASH_PUBLIC_EXPORT extern const char kAshUiModeAuto[];
ASH_PUBLIC_EXPORT extern const char kAshUiModeClamshell[]; ASH_PUBLIC_EXPORT extern const char kAshUiModeClamshell[];
ASH_PUBLIC_EXPORT extern const char kAshUiModeTablet[]; ASH_PUBLIC_EXPORT extern const char kAshUiModeTablet[];
ASH_PUBLIC_EXPORT extern const char kAshHideNotificationsForFactory[]; ASH_PUBLIC_EXPORT extern const char kAshHideNotificationsForFactory[];
ASH_PUBLIC_EXPORT extern const char kAshNewTouchSupportForScreenMagnification[];
ASH_PUBLIC_EXPORT extern const char kAshShelfColor[]; ASH_PUBLIC_EXPORT extern const char kAshShelfColor[];
ASH_PUBLIC_EXPORT extern const char kAshShelfColorEnabled[]; ASH_PUBLIC_EXPORT extern const char kAshShelfColorEnabled[];
ASH_PUBLIC_EXPORT extern const char kAshShelfColorDisabled[]; ASH_PUBLIC_EXPORT extern const char kAshShelfColorDisabled[];
......
...@@ -3708,13 +3708,6 @@ const FeatureEntry kFeatureEntries[] = { ...@@ -3708,13 +3708,6 @@ const FeatureEntry kFeatureEntries[] = {
flag_descriptions::kAshEnableNewOverviewUiName, flag_descriptions::kAshEnableNewOverviewUiName,
flag_descriptions::kAshEnableNewOverviewUiDescription, kOsCrOS, flag_descriptions::kAshEnableNewOverviewUiDescription, kOsCrOS,
SINGLE_VALUE_TYPE(ash::switches::kAshEnableNewOverviewUi)}, SINGLE_VALUE_TYPE(ash::switches::kAshEnableNewOverviewUi)},
{"ash-new-touch-support-for-screen-magnification",
flag_descriptions::kAshNewTouchSupportForScreenMagnificationName,
flag_descriptions::kAshNewTouchSupportForScreenMagnificationDescription,
kOsCrOS,
SINGLE_VALUE_TYPE(
ash::switches::kAshNewTouchSupportForScreenMagnification)},
#endif // defined(OS_CHROMEOS) #endif // defined(OS_CHROMEOS)
{"unified-consent", flag_descriptions::kUnifiedConsentName, {"unified-consent", flag_descriptions::kUnifiedConsentName,
......
...@@ -2494,11 +2494,6 @@ const char kAshEnableUnifiedDesktopDescription[] = ...@@ -2494,11 +2494,6 @@ const char kAshEnableUnifiedDesktopDescription[] =
"Enable unified desktop mode which allows a window to span multiple " "Enable unified desktop mode which allows a window to span multiple "
"displays."; "displays.";
const char kAshNewTouchSupportForScreenMagnificationName[] =
"New touch support for screen magnification";
const char kAshNewTouchSupportForScreenMagnificationDescription[] =
"Enable new implementation of touch support for screen magnification";
const char kBulkPrintersName[] = "Bulk Printers Policy"; const char kBulkPrintersName[] = "Bulk Printers Policy";
const char kBulkPrintersDescription[] = "Enables the new bulk printers policy"; const char kBulkPrintersDescription[] = "Enables the new bulk printers policy";
......
...@@ -1541,9 +1541,6 @@ extern const char kArcVpnDescription[]; ...@@ -1541,9 +1541,6 @@ extern const char kArcVpnDescription[];
extern const char kAshEnableUnifiedDesktopName[]; extern const char kAshEnableUnifiedDesktopName[];
extern const char kAshEnableUnifiedDesktopDescription[]; extern const char kAshEnableUnifiedDesktopDescription[];
extern const char kAshNewTouchSupportForScreenMagnificationName[];
extern const char kAshNewTouchSupportForScreenMagnificationDescription[];
extern const char kBulkPrintersName[]; extern const char kBulkPrintersName[];
extern const char kBulkPrintersDescription[]; extern const char kBulkPrintersDescription[];
......
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