Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/wm/gestures/shelf_gesture_handler.h" | 5 #include "ash/wm/gestures/shelf_gesture_handler.h" |
| 6 | 6 |
| 7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
| 8 #include "ash/session_state_delegate.h" | 8 #include "ash/session_state_delegate.h" |
| 9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
| 10 #include "ash/shelf/shelf_types.h" | 10 #include "ash/shelf/shelf_types.h" |
| 11 #include "ash/shelf/shelf_widget.h" | 11 #include "ash/shelf/shelf_widget.h" |
| 12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 13 #include "ash/system/status_area_widget.h" | 13 #include "ash/system/status_area_widget.h" |
| 14 #include "ash/wm/gestures/tray_gesture_handler.h" | 14 #include "ash/wm/gestures/tray_gesture_handler.h" |
| 15 #include "ash/wm/window_properties.h" | |
| 15 #include "ash/wm/window_util.h" | 16 #include "ash/wm/window_util.h" |
| 16 #include "ui/aura/window.h" | 17 #include "ui/aura/window.h" |
| 17 #include "ui/compositor/layer.h" | 18 #include "ui/compositor/layer.h" |
| 18 #include "ui/compositor/scoped_layer_animation_settings.h" | 19 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 19 #include "ui/gfx/transform.h" | 20 #include "ui/gfx/transform.h" |
| 20 #include "ui/views/widget/widget.h" | 21 #include "ui/views/widget/widget.h" |
| 21 | 22 |
| 22 namespace ash { | 23 namespace ash { |
| 23 namespace internal { | 24 namespace internal { |
| 24 | 25 |
| 25 ShelfGestureHandler::ShelfGestureHandler() | 26 ShelfGestureHandler::ShelfGestureHandler() |
| 26 : drag_in_progress_(false) { | 27 : drag_in_progress_(false) { |
| 27 } | 28 } |
| 28 | 29 |
| 29 ShelfGestureHandler::~ShelfGestureHandler() { | 30 ShelfGestureHandler::~ShelfGestureHandler() { |
| 30 } | 31 } |
| 31 | 32 |
| 32 bool ShelfGestureHandler::ProcessGestureEvent(const ui::GestureEvent& event) { | 33 bool ShelfGestureHandler::ProcessGestureEvent(const ui::GestureEvent& event) { |
| 33 Shell* shell = Shell::GetInstance(); | 34 Shell* shell = Shell::GetInstance(); |
| 34 if (!shell->session_state_delegate()->HasActiveUser() || | 35 if (!shell->session_state_delegate()->HasActiveUser() || |
| 35 shell->session_state_delegate()->IsScreenLocked()) { | 36 shell->session_state_delegate()->IsScreenLocked()) { |
| 36 // The gestures are disabled in the lock/login screen. | 37 // The gestures are disabled in the lock/login screen. |
| 37 return false; | 38 return false; |
| 38 } | 39 } |
| 39 | 40 |
| 40 // The gesture are disabled for fullscreen windows. | 41 // The gesture are disabled for fullscreen windows. |
| 41 aura::Window* active = wm::GetActiveWindow(); | 42 aura::Window* active = wm::GetActiveWindow(); |
| 42 if (active && wm::IsWindowFullscreen(active)) | 43 if (active && |
| 44 wm::IsWindowFullscreen(active) && | |
| 45 !active->GetProperty(kFullscreenUsesMinimalChromeKey)) | |
|
pkotwicz
2013/05/16 19:11:49
For the sake of consistency, shouldn't you use Get
rharrison
2013/05/16 20:28:31
Done.
| |
| 43 return false; | 46 return false; |
| 44 | 47 |
| 45 // TODO(oshima): Find the root window controller from event's location. | 48 // TODO(oshima): Find the root window controller from event's location. |
| 46 ShelfLayoutManager* shelf = | 49 ShelfLayoutManager* shelf = |
| 47 Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager(); | 50 Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager(); |
| 48 if (event.type() == ui::ET_GESTURE_SCROLL_BEGIN) { | 51 if (event.type() == ui::ET_GESTURE_SCROLL_BEGIN) { |
| 49 drag_in_progress_ = true; | 52 drag_in_progress_ = true; |
| 50 shelf->StartGestureDrag(event); | 53 shelf->StartGestureDrag(event); |
| 51 return true; | 54 return true; |
| 52 } | 55 } |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 79 return true; | 82 return true; |
| 80 } | 83 } |
| 81 | 84 |
| 82 // Unexpected event. Reset the state and let the event fall through. | 85 // Unexpected event. Reset the state and let the event fall through. |
| 83 shelf->CancelGestureDrag(); | 86 shelf->CancelGestureDrag(); |
| 84 return false; | 87 return false; |
| 85 } | 88 } |
| 86 | 89 |
| 87 } // namespace internal | 90 } // namespace internal |
| 88 } // namespace ash | 91 } // namespace ash |
| OLD | NEW |