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/common/shelf/shelf_view.h" | 5 #include "ash/common/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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
469 | 469 |
470 case TYPE_APP_PANEL: | 470 case TYPE_APP_PANEL: |
471 case TYPE_DIALOG: | 471 case TYPE_DIALOG: |
472 break; | 472 break; |
473 | 473 |
474 case TYPE_UNDEFINED: | 474 case TYPE_UNDEFINED: |
475 NOTREACHED() << "ShelfItemType must be set."; | 475 NOTREACHED() << "ShelfItemType must be set."; |
476 break; | 476 break; |
477 } | 477 } |
478 | 478 |
479 // If this is the overflow shelf, |main_shelf_| will not be null. When an item | |
480 // is pressed on the overflow shelf, we want to hide the overflow bubble, | |
481 // which is associated with the main shelf. Note: this will invalidate | |
msw
2017/04/06 23:19:03
nit: remove this Note, or rephrase as "Hiding the
sammiequon
2017/04/06 23:34:46
Removed.
| |
482 // |sender| as it is a child of the overflow shelf, but it is released | |
483 // asynchronously. | |
484 if (main_shelf_) { | |
485 if (main_shelf_->IsShowingOverflowBubble()) | |
486 main_shelf_->ToggleOverflowBubble(); | |
487 } | |
488 | |
479 const int64_t display_id = window->GetDisplayNearestWindow().id(); | 489 const int64_t display_id = window->GetDisplayNearestWindow().id(); |
480 | 490 |
481 // Notify the item of its selection; handle the result in AfterItemSelected. | 491 // Notify the item of its selection; handle the result in AfterItemSelected. |
482 const ShelfItem& item = model_->items()[last_pressed_index_]; | 492 const ShelfItem& item = model_->items()[last_pressed_index_]; |
483 model_->GetShelfItemDelegate(item.id)->ItemSelected( | 493 model_->GetShelfItemDelegate(item.id)->ItemSelected( |
484 ui::Event::Clone(event), display_id, LAUNCH_FROM_UNKNOWN, | 494 ui::Event::Clone(event), display_id, LAUNCH_FROM_UNKNOWN, |
485 base::Bind(&ShelfView::AfterItemSelected, weak_factory_.GetWeakPtr(), | 495 base::Bind(&ShelfView::AfterItemSelected, weak_factory_.GetWeakPtr(), |
486 item, sender, base::Passed(ui::Event::Clone(event)), | 496 item, sender, base::Passed(ui::Event::Clone(event)), |
487 ink_drop)); | 497 ink_drop)); |
488 } | 498 } |
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1757 | 1767 |
1758 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { | 1768 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { |
1759 const gfx::Rect bounds = GetBoundsInScreen(); | 1769 const gfx::Rect bounds = GetBoundsInScreen(); |
1760 int distance = wm_shelf_->SelectValueForShelfAlignment( | 1770 int distance = wm_shelf_->SelectValueForShelfAlignment( |
1761 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), | 1771 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), |
1762 bounds.x() - coordinate.x()); | 1772 bounds.x() - coordinate.x()); |
1763 return distance > 0 ? distance : 0; | 1773 return distance > 0 ? distance : 0; |
1764 } | 1774 } |
1765 | 1775 |
1766 } // namespace ash | 1776 } // namespace ash |
OLD | NEW |