| Index: ash/shelf/shelf_bezel_event_handler.cc
|
| diff --git a/ash/shelf/shelf_bezel_event_filter.cc b/ash/shelf/shelf_bezel_event_handler.cc
|
| similarity index 60%
|
| rename from ash/shelf/shelf_bezel_event_filter.cc
|
| rename to ash/shelf/shelf_bezel_event_handler.cc
|
| index 224180c7813851e7b49cbe43065fcd1d5ed86f89..da40409be668deaa01e6545b628e56cad93ef7b0 100644
|
| --- a/ash/shelf/shelf_bezel_event_filter.cc
|
| +++ b/ash/shelf/shelf_bezel_event_handler.cc
|
| @@ -2,30 +2,30 @@
|
| // 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_bezel_event_handler.h"
|
|
|
| -#include "ash/shelf/shelf_layout_manager.h"
|
| +#include "ash/common/shelf/wm_shelf.h"
|
| #include "ash/shell.h"
|
| #include "ui/aura/window.h"
|
| #include "ui/display/display.h"
|
| #include "ui/display/screen.h"
|
| +#include "ui/events/event.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) {
|
| +ShelfBezelEventHandler::ShelfBezelEventHandler(WmShelf* shelf)
|
| + : shelf_(shelf), in_touch_drag_(false) {
|
| Shell::GetInstance()->AddPreTargetHandler(this);
|
| }
|
|
|
| -ShelfBezelEventFilter::~ShelfBezelEventFilter() {
|
| +ShelfBezelEventHandler::~ShelfBezelEventHandler() {
|
| Shell::GetInstance()->RemovePreTargetHandler(this);
|
| }
|
|
|
| -void ShelfBezelEventFilter::OnGestureEvent(ui::GestureEvent* event) {
|
| +void ShelfBezelEventHandler::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);
|
| @@ -35,7 +35,7 @@ void ShelfBezelEventFilter::OnGestureEvent(ui::GestureEvent* event) {
|
| if ((!screen.Contains(point_in_screen) &&
|
| IsShelfOnBezel(screen, point_in_screen)) ||
|
| in_touch_drag_) {
|
| - if (shelf_layout_manager_->ProcessGestureEvent(*event)) {
|
| + if (shelf_->ProcessGestureEvent(*event)) {
|
| switch (event->type()) {
|
| case ui::ET_GESTURE_SCROLL_BEGIN:
|
| in_touch_drag_ = true;
|
| @@ -52,11 +52,19 @@ void ShelfBezelEventFilter::OnGestureEvent(ui::GestureEvent* event) {
|
| }
|
| }
|
|
|
| -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());
|
| +bool ShelfBezelEventHandler::IsShelfOnBezel(const gfx::Rect& screen,
|
| + const gfx::Point& point) const {
|
| + switch (shelf_->GetAlignment()) {
|
| + case SHELF_ALIGNMENT_BOTTOM:
|
| + case SHELF_ALIGNMENT_BOTTOM_LOCKED:
|
| + return point.y() >= screen.bottom();
|
| + case SHELF_ALIGNMENT_LEFT:
|
| + return point.x() <= screen.x();
|
| + case SHELF_ALIGNMENT_RIGHT:
|
| + return point.x() >= screen.right();
|
| + }
|
| + NOTREACHED();
|
| + return false;
|
| }
|
|
|
| } // namespace ash
|
|
|