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

Side by Side Diff: ash/shelf/shelf_bezel_event_filter.cc

Issue 2095193002: clang-format all of //ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « ash/shelf/shelf_bezel_event_filter.h ('k') | ash/shelf/shelf_button.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/shelf/shelf_bezel_event_filter.h" 5 #include "ash/shelf/shelf_bezel_event_filter.h"
6 6
7 #include "ash/shelf/shelf_layout_manager.h" 7 #include "ash/shelf/shelf_layout_manager.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ui/aura/window.h" 9 #include "ui/aura/window.h"
10 #include "ui/display/display.h" 10 #include "ui/display/display.h"
11 #include "ui/display/screen.h" 11 #include "ui/display/screen.h"
12 #include "ui/wm/core/coordinate_conversion.h" 12 #include "ui/wm/core/coordinate_conversion.h"
13 13
14 namespace ash { 14 namespace ash {
15 15
16 ShelfBezelEventFilter::ShelfBezelEventFilter( 16 ShelfBezelEventFilter::ShelfBezelEventFilter(ShelfLayoutManager* shelf)
17 ShelfLayoutManager* shelf) 17 : shelf_(shelf), in_touch_drag_(false) {
18 : shelf_(shelf),
19 in_touch_drag_(false) {
20 Shell::GetInstance()->AddPreTargetHandler(this); 18 Shell::GetInstance()->AddPreTargetHandler(this);
21 } 19 }
22 20
23 ShelfBezelEventFilter::~ShelfBezelEventFilter() { 21 ShelfBezelEventFilter::~ShelfBezelEventFilter() {
24 Shell::GetInstance()->RemovePreTargetHandler(this); 22 Shell::GetInstance()->RemovePreTargetHandler(this);
25 } 23 }
26 24
27 void ShelfBezelEventFilter::OnGestureEvent( 25 void ShelfBezelEventFilter::OnGestureEvent(ui::GestureEvent* event) {
28 ui::GestureEvent* event) {
29 gfx::Point point_in_screen(event->location()); 26 gfx::Point point_in_screen(event->location());
30 aura::Window* target = static_cast<aura::Window*>(event->target()); 27 aura::Window* target = static_cast<aura::Window*>(event->target());
31 ::wm::ConvertPointToScreen(target, &point_in_screen); 28 ::wm::ConvertPointToScreen(target, &point_in_screen);
32 gfx::Rect screen = display::Screen::GetScreen() 29 gfx::Rect screen = display::Screen::GetScreen()
33 ->GetDisplayNearestPoint(point_in_screen) 30 ->GetDisplayNearestPoint(point_in_screen)
34 .bounds(); 31 .bounds();
35 if ((!screen.Contains(point_in_screen) && 32 if ((!screen.Contains(point_in_screen) &&
36 IsShelfOnBezel(screen, point_in_screen)) || 33 IsShelfOnBezel(screen, point_in_screen)) ||
37 in_touch_drag_) { 34 in_touch_drag_) {
38 if (gesture_handler_.ProcessGestureEvent(*event, target)) { 35 if (gesture_handler_.ProcessGestureEvent(*event, target)) {
(...skipping 14 matching lines...) Expand all
53 } 50 }
54 51
55 bool ShelfBezelEventFilter::IsShelfOnBezel(const gfx::Rect& screen, 52 bool ShelfBezelEventFilter::IsShelfOnBezel(const gfx::Rect& screen,
56 const gfx::Point& point) const { 53 const gfx::Point& point) const {
57 return shelf_->SelectValueForShelfAlignment(point.y() >= screen.bottom(), 54 return shelf_->SelectValueForShelfAlignment(point.y() >= screen.bottom(),
58 point.x() <= screen.x(), 55 point.x() <= screen.x(),
59 point.x() >= screen.right()); 56 point.x() >= screen.right());
60 } 57 }
61 58
62 } // namespace ash 59 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_bezel_event_filter.h ('k') | ash/shelf/shelf_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698