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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
431 shelf_button_pressed_metric_tracker_.ButtonPressed(event, sender, | 431 shelf_button_pressed_metric_tracker_.ButtonPressed(event, sender, |
432 SHELF_ACTION_NONE); | 432 SHELF_ACTION_NONE); |
433 return; | 433 return; |
434 } | 434 } |
435 | 435 |
436 // None of the checks in ShouldEventActivateButton() affects overflow button. | 436 // None of the checks in ShouldEventActivateButton() affects overflow button. |
437 // So, it is safe to be checked after handling overflow button. | 437 // So, it is safe to be checked after handling overflow button. |
438 if (!ShouldEventActivateButton(sender, event)) | 438 if (!ShouldEventActivateButton(sender, event)) |
439 return; | 439 return; |
440 | 440 |
441 // If this is the overflow shelf, |main_shelf_| will not be null. When an app | |
msw
2017/04/06 21:57:50
nit: s/app/item/
sammiequon
2017/04/06 23:03:11
Done.
| |
442 // is pressed on the overflow shelf, we want to hide the overflow bubble, | |
443 // which is associated with the main shelf. | |
444 if (main_shelf_) { | |
msw
2017/04/06 21:57:50
For my own curiosity, how does the overflow bubble
sammiequon
2017/04/06 23:03:11
The overview bubble listens for pointer events and
msw
2017/04/06 23:19:03
Okay, what you have is fine, just add something li
sammiequon
2017/04/06 23:34:46
Done.
| |
445 if (main_shelf_->IsShowingOverflowBubble()) | |
446 main_shelf_->ToggleOverflowBubble(); | |
msw
2017/04/06 21:57:50
I wonder, can closing the overflow bubble in this
sammiequon
2017/04/06 23:03:11
Hmm, I did not notice sender being used below and
msw
2017/04/06 23:19:03
This is probably fine as-is, given the aync Widget
sammiequon
2017/04/06 23:34:46
Acknowledged. Moved back to the regular location.
| |
447 } | |
448 | |
441 // Record the index for the last pressed shelf item. | 449 // Record the index for the last pressed shelf item. |
442 last_pressed_index_ = view_model_->GetIndexOfView(sender); | 450 last_pressed_index_ = view_model_->GetIndexOfView(sender); |
443 DCHECK_LT(-1, last_pressed_index_); | 451 DCHECK_LT(-1, last_pressed_index_); |
444 | 452 |
445 // Place new windows on the same display as the button. | 453 // Place new windows on the same display as the button. |
446 WmWindow* window = WmWindow::Get(sender->GetWidget()->GetNativeWindow()); | 454 WmWindow* window = WmWindow::Get(sender->GetWidget()->GetNativeWindow()); |
447 scoped_root_window_for_new_windows_.reset( | 455 scoped_root_window_for_new_windows_.reset( |
448 new ScopedRootWindowForNewWindows(window->GetRootWindow())); | 456 new ScopedRootWindowForNewWindows(window->GetRootWindow())); |
449 | 457 |
450 // Slow down activation animations if shift key is pressed. | 458 // Slow down activation animations if shift key is pressed. |
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1757 | 1765 |
1758 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { | 1766 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { |
1759 const gfx::Rect bounds = GetBoundsInScreen(); | 1767 const gfx::Rect bounds = GetBoundsInScreen(); |
1760 int distance = wm_shelf_->SelectValueForShelfAlignment( | 1768 int distance = wm_shelf_->SelectValueForShelfAlignment( |
1761 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), | 1769 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), |
1762 bounds.x() - coordinate.x()); | 1770 bounds.x() - coordinate.x()); |
1763 return distance > 0 ? distance : 0; | 1771 return distance > 0 ? distance : 0; |
1764 } | 1772 } |
1765 | 1773 |
1766 } // namespace ash | 1774 } // namespace ash |
OLD | NEW |