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,
return point_of_interest_;
}
void AddEventRewriterForTesting() override;
bool IsOnAnimationForTesting() const override { return is_on_animation_; }
void DisableMoveMagnifierDelayForTesting() override {
......@@ -236,7 +234,6 @@ class MagnificationControllerImpl : public MagnificationController,
void OnMouseEvent(ui::MouseEvent* event) override;
void OnScrollEvent(ui::ScrollEvent* event) override;
void OnTouchEvent(ui::TouchEvent* event) override;
void OnGestureEvent(ui::GestureEvent* event) override;
// ui::EventRewriter overrides:
ui::EventRewriteStatus RewriteEvent(
......@@ -363,11 +360,7 @@ MagnificationControllerImpl::MagnificationControllerImpl()
disable_move_magnifier_delay_(false) {
Shell::Get()->AddPreTargetHandler(this);
root_window_->AddObserver(this);
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
ash::switches::kAshNewTouchSupportForScreenMagnification)) {
root_window_->GetHost()->GetEventSource()->AddEventRewriter(this);
}
root_window_->GetHost()->GetEventSource()->AddEventRewriter(this);
point_of_interest_ = root_window_->bounds().CenterPoint();
......@@ -381,11 +374,7 @@ MagnificationControllerImpl::~MagnificationControllerImpl() {
if (input_method)
input_method->RemoveObserver(this);
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
ash::switches::kAshNewTouchSupportForScreenMagnification)) {
root_window_->GetHost()->GetEventSource()->RemoveEventRewriter(this);
}
root_window_->GetHost()->GetEventSource()->RemoveEventRewriter(this);
root_window_->RemoveObserver(this);
Shell::Get()->RemovePreTargetHandler(this);
......@@ -570,13 +559,6 @@ void MagnificationControllerImpl::SwitchTargetRootWindow(
root_window_->AddObserver(this);
}
void MagnificationControllerImpl::AddEventRewriterForTesting() {
DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
ash::switches::kAshNewTouchSupportForScreenMagnification));
root_window_->GetHost()->GetEventSource()->AddEventRewriter(this);
}
void MagnificationControllerImpl::AfterAnimationMoveCursorTo(
const gfx::Point& location) {
DCHECK(root_window_);
......@@ -968,43 +950,6 @@ ui::EventRewriteStatus MagnificationControllerImpl::NextDispatchEvent(
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(
const gfx::Point& point,
int x_panning_margin,
......
......@@ -94,10 +94,6 @@ class ASH_EXPORT MagnificationController {
virtual void SwitchTargetRootWindow(aura::Window* new_root_window,
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:
MagnificationController() {}
......
......@@ -798,11 +798,6 @@ TEST_F(MagnificationControllerTest, AdjustScaleFromScroll) {
// Performs pinch zoom and confirm that zoom level is changed. This test case
// also tests touch event handling.
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());
GetMagnificationController()->SetEnabled(true);
......@@ -881,11 +876,6 @@ TEST_F(MagnificationControllerTest, PinchZoom) {
}
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);
ASSERT_EQ(2.0f, GetMagnificationController()->GetScale());
......@@ -923,11 +913,6 @@ TEST_F(MagnificationControllerTest, TwoFingersScroll) {
}
TEST_F(MagnificationControllerTest, GestureLock) {
// TODO(yawano): remove this once flag is removed.
base::CommandLine::ForCurrentProcess()->AppendSwitch(
ash::switches::kAshNewTouchSupportForScreenMagnification);
GetMagnificationController()->AddEventRewriterForTesting();
GetMagnificationController()->SetEnabled(true);
ASSERT_EQ(2.0f, GetMagnificationController()->GetScale());
......
......@@ -126,10 +126,6 @@ const char kAshUiModeTablet[] = "touch_view";
const char kAshHideNotificationsForFactory[] =
"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.
const char kAshShelfColor[] = "ash-shelf-color";
const char kAshShelfColorEnabled[] = "enabled";
......
......@@ -45,7 +45,6 @@ ASH_PUBLIC_EXPORT extern const char kAshUiModeAuto[];
ASH_PUBLIC_EXPORT extern const char kAshUiModeClamshell[];
ASH_PUBLIC_EXPORT extern const char kAshUiModeTablet[];
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 kAshShelfColorEnabled[];
ASH_PUBLIC_EXPORT extern const char kAshShelfColorDisabled[];
......
......@@ -3708,13 +3708,6 @@ const FeatureEntry kFeatureEntries[] = {
flag_descriptions::kAshEnableNewOverviewUiName,
flag_descriptions::kAshEnableNewOverviewUiDescription, kOsCrOS,
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)
{"unified-consent", flag_descriptions::kUnifiedConsentName,
......
......@@ -2494,11 +2494,6 @@ const char kAshEnableUnifiedDesktopDescription[] =
"Enable unified desktop mode which allows a window to span multiple "
"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 kBulkPrintersDescription[] = "Enables the new bulk printers policy";
......
......@@ -1541,9 +1541,6 @@ extern const char kArcVpnDescription[];
extern const char kAshEnableUnifiedDesktopName[];
extern const char kAshEnableUnifiedDesktopDescription[];
extern const char kAshNewTouchSupportForScreenMagnificationName[];
extern const char kAshNewTouchSupportForScreenMagnificationDescription[];
extern const char kBulkPrintersName[];
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