| 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/shelf/shelf_view.h" | 5 #include "ash/shelf/shelf_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/common/ash_constants.h" | 10 #include "ash/common/ash_constants.h" |
| (...skipping 1525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1536 state->name = l10n_util::GetStringUTF16(IDS_ASH_SHELF_ACCESSIBLE_NAME); | 1536 state->name = l10n_util::GetStringUTF16(IDS_ASH_SHELF_ACCESSIBLE_NAME); |
| 1537 } | 1537 } |
| 1538 | 1538 |
| 1539 void ShelfView::ViewHierarchyChanged( | 1539 void ShelfView::ViewHierarchyChanged( |
| 1540 const ViewHierarchyChangedDetails& details) { | 1540 const ViewHierarchyChangedDetails& details) { |
| 1541 if (details.is_add && details.child == this) | 1541 if (details.is_add && details.child == this) |
| 1542 tooltip_.Init(); | 1542 tooltip_.Init(); |
| 1543 } | 1543 } |
| 1544 | 1544 |
| 1545 void ShelfView::OnGestureEvent(ui::GestureEvent* event) { | 1545 void ShelfView::OnGestureEvent(ui::GestureEvent* event) { |
| 1546 aura::Window* target_window = static_cast<views::View*>(event->target()) | 1546 if (wm_shelf_->ProcessGestureEvent(*event)) |
| 1547 ->GetWidget() | |
| 1548 ->GetNativeWindow(); | |
| 1549 if (gesture_handler_.ProcessGestureEvent(*event, target_window)) | |
| 1550 event->StopPropagation(); | 1547 event->StopPropagation(); |
| 1551 } | 1548 } |
| 1552 | 1549 |
| 1553 void ShelfView::ShelfItemAdded(int model_index) { | 1550 void ShelfView::ShelfItemAdded(int model_index) { |
| 1554 { | 1551 { |
| 1555 base::AutoReset<bool> cancelling_drag(&cancelling_drag_model_changed_, | 1552 base::AutoReset<bool> cancelling_drag(&cancelling_drag_model_changed_, |
| 1556 true); | 1553 true); |
| 1557 model_index = CancelDrag(model_index); | 1554 model_index = CancelDrag(model_index); |
| 1558 } | 1555 } |
| 1559 views::View* view = CreateViewForItem(model_->items()[model_index]); | 1556 views::View* view = CreateViewForItem(model_->items()[model_index]); |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1916 | 1913 |
| 1917 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { | 1914 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { |
| 1918 const gfx::Rect bounds = GetBoundsInScreen(); | 1915 const gfx::Rect bounds = GetBoundsInScreen(); |
| 1919 int distance = shelf_->SelectValueForShelfAlignment( | 1916 int distance = shelf_->SelectValueForShelfAlignment( |
| 1920 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), | 1917 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), |
| 1921 bounds.x() - coordinate.x()); | 1918 bounds.x() - coordinate.x()); |
| 1922 return distance > 0 ? distance : 0; | 1919 return distance > 0 ? distance : 0; |
| 1923 } | 1920 } |
| 1924 | 1921 |
| 1925 } // namespace ash | 1922 } // namespace ash |
| OLD | NEW |