| 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/shelf_layout_manager.h" | 5 #include "ash/wm/shelf_layout_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 virtual ~AutoHideEventFilter(); | 71 virtual ~AutoHideEventFilter(); |
| 72 | 72 |
| 73 // Returns true if the last mouse event was a mouse drag. | 73 // Returns true if the last mouse event was a mouse drag. |
| 74 bool in_mouse_drag() const { return in_mouse_drag_; } | 74 bool in_mouse_drag() const { return in_mouse_drag_; } |
| 75 | 75 |
| 76 // Overridden from aura::EventFilter: | 76 // Overridden from aura::EventFilter: |
| 77 virtual bool PreHandleKeyEvent(aura::Window* target, | 77 virtual bool PreHandleKeyEvent(aura::Window* target, |
| 78 ui::KeyEvent* event) OVERRIDE; | 78 ui::KeyEvent* event) OVERRIDE; |
| 79 virtual bool PreHandleMouseEvent(aura::Window* target, | 79 virtual bool PreHandleMouseEvent(aura::Window* target, |
| 80 ui::MouseEvent* event) OVERRIDE; | 80 ui::MouseEvent* event) OVERRIDE; |
| 81 virtual ui::TouchStatus PreHandleTouchEvent( | 81 virtual ui::EventResult PreHandleTouchEvent( |
| 82 aura::Window* target, | 82 aura::Window* target, |
| 83 ui::TouchEvent* event) OVERRIDE; | 83 ui::TouchEvent* event) OVERRIDE; |
| 84 virtual ui::EventResult PreHandleGestureEvent( | 84 virtual ui::EventResult PreHandleGestureEvent( |
| 85 aura::Window* target, | 85 aura::Window* target, |
| 86 ui::GestureEvent* event) OVERRIDE; | 86 ui::GestureEvent* event) OVERRIDE; |
| 87 | 87 |
| 88 private: | 88 private: |
| 89 ShelfLayoutManager* shelf_; | 89 ShelfLayoutManager* shelf_; |
| 90 bool in_mouse_drag_; | 90 bool in_mouse_drag_; |
| 91 | 91 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 116 // shelf if the mouse down occurs on the shelf. | 116 // shelf if the mouse down occurs on the shelf. |
| 117 in_mouse_drag_ = (event->type() == ui::ET_MOUSE_DRAGGED || | 117 in_mouse_drag_ = (event->type() == ui::ET_MOUSE_DRAGGED || |
| 118 (in_mouse_drag_ && event->type() != ui::ET_MOUSE_RELEASED && | 118 (in_mouse_drag_ && event->type() != ui::ET_MOUSE_RELEASED && |
| 119 event->type() != ui::ET_MOUSE_CAPTURE_CHANGED)) && | 119 event->type() != ui::ET_MOUSE_CAPTURE_CHANGED)) && |
| 120 !shelf_->IsShelfWindow(target); | 120 !shelf_->IsShelfWindow(target); |
| 121 if (event->type() == ui::ET_MOUSE_MOVED) | 121 if (event->type() == ui::ET_MOUSE_MOVED) |
| 122 shelf_->UpdateAutoHideState(); | 122 shelf_->UpdateAutoHideState(); |
| 123 return false; // Not handled. | 123 return false; // Not handled. |
| 124 } | 124 } |
| 125 | 125 |
| 126 ui::TouchStatus ShelfLayoutManager::AutoHideEventFilter::PreHandleTouchEvent( | 126 ui::EventResult ShelfLayoutManager::AutoHideEventFilter::PreHandleTouchEvent( |
| 127 aura::Window* target, | 127 aura::Window* target, |
| 128 ui::TouchEvent* event) { | 128 ui::TouchEvent* event) { |
| 129 return ui::TOUCH_STATUS_UNKNOWN; // Not handled. | 129 return ui::ER_UNHANDLED; // Not handled. |
| 130 } | 130 } |
| 131 | 131 |
| 132 ui::EventResult | 132 ui::EventResult |
| 133 ShelfLayoutManager::AutoHideEventFilter::PreHandleGestureEvent( | 133 ShelfLayoutManager::AutoHideEventFilter::PreHandleGestureEvent( |
| 134 aura::Window* target, | 134 aura::Window* target, |
| 135 ui::GestureEvent* event) { | 135 ui::GestureEvent* event) { |
| 136 return ui::ER_UNHANDLED; // Not handled. | 136 return ui::ER_UNHANDLED; // Not handled. |
| 137 } | 137 } |
| 138 | 138 |
| 139 // ShelfLayoutManager:UpdateShelfObserver -------------------------------------- | 139 // ShelfLayoutManager:UpdateShelfObserver -------------------------------------- |
| (...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 902 int ShelfLayoutManager::GetWorkAreaSize(const State& state, int size) const { | 902 int ShelfLayoutManager::GetWorkAreaSize(const State& state, int size) const { |
| 903 if (state.visibility_state == VISIBLE) | 903 if (state.visibility_state == VISIBLE) |
| 904 return size; | 904 return size; |
| 905 if (state.visibility_state == AUTO_HIDE) | 905 if (state.visibility_state == AUTO_HIDE) |
| 906 return kAutoHideSize; | 906 return kAutoHideSize; |
| 907 return 0; | 907 return 0; |
| 908 } | 908 } |
| 909 | 909 |
| 910 } // namespace internal | 910 } // namespace internal |
| 911 } // namespace ash | 911 } // namespace ash |
| OLD | NEW |