Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(410)

Unified Diff: ash/shelf/shelf_bezel_event_filter.cc

Issue 2237613002: mash: Migrate some misc ShelfLayoutManager deps to ash common. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move ShelfBezelEventHandler to WmShelfAura. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/shelf/shelf_bezel_event_filter.cc
diff --git a/ash/shelf/shelf_bezel_event_filter.cc b/ash/shelf/shelf_bezel_event_filter.cc
deleted file mode 100644
index 224180c7813851e7b49cbe43065fcd1d5ed86f89..0000000000000000000000000000000000000000
--- a/ash/shelf/shelf_bezel_event_filter.cc
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ash/shelf/shelf_bezel_event_filter.h"
-
-#include "ash/shelf/shelf_layout_manager.h"
-#include "ash/shell.h"
-#include "ui/aura/window.h"
-#include "ui/display/display.h"
-#include "ui/display/screen.h"
-#include "ui/gfx/geometry/point.h"
-#include "ui/gfx/geometry/rect.h"
-#include "ui/wm/core/coordinate_conversion.h"
-
-namespace ash {
-
-ShelfBezelEventFilter::ShelfBezelEventFilter(
- ShelfLayoutManager* shelf_layout_manager)
- : shelf_layout_manager_(shelf_layout_manager), in_touch_drag_(false) {
- Shell::GetInstance()->AddPreTargetHandler(this);
-}
-
-ShelfBezelEventFilter::~ShelfBezelEventFilter() {
- Shell::GetInstance()->RemovePreTargetHandler(this);
-}
-
-void ShelfBezelEventFilter::OnGestureEvent(ui::GestureEvent* event) {
- gfx::Point point_in_screen(event->location());
- aura::Window* target = static_cast<aura::Window*>(event->target());
- ::wm::ConvertPointToScreen(target, &point_in_screen);
- gfx::Rect screen = display::Screen::GetScreen()
- ->GetDisplayNearestPoint(point_in_screen)
- .bounds();
- if ((!screen.Contains(point_in_screen) &&
- IsShelfOnBezel(screen, point_in_screen)) ||
- in_touch_drag_) {
- if (shelf_layout_manager_->ProcessGestureEvent(*event)) {
- switch (event->type()) {
- case ui::ET_GESTURE_SCROLL_BEGIN:
- in_touch_drag_ = true;
- break;
- case ui::ET_GESTURE_SCROLL_END:
- case ui::ET_SCROLL_FLING_START:
- in_touch_drag_ = false;
- break;
- default:
- break;
- }
- event->StopPropagation();
- }
- }
-}
-
-bool ShelfBezelEventFilter::IsShelfOnBezel(const gfx::Rect& screen,
- const gfx::Point& point) const {
- return shelf_layout_manager_->SelectValueForShelfAlignment(
- point.y() >= screen.bottom(), point.x() <= screen.x(),
- point.x() >= screen.right());
-}
-
-} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698