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/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 item | |
| 442 // is pressed on the overflow shelf, we want to hide the overflow bubble, | |
| 443 // which is associated with the main shelf. Button presses on the main shelf | |
| 444 // cause the overflow bubble to close itself via PointerWatcher functionality. | |
| 445 if (main_shelf_) { | |
| 446 if (main_shelf_->IsShowingOverflowBubble()) | |
|
msw
2017/04/06 23:37:19
optional nit: combine the nested if statements:
if
sammiequon
2017/04/06 23:55:22
Done.
| |
| 447 main_shelf_->ToggleOverflowBubble(); | |
| 448 } | |
| 449 | |
| 441 // Record the index for the last pressed shelf item. | 450 // Record the index for the last pressed shelf item. |
| 442 last_pressed_index_ = view_model_->GetIndexOfView(sender); | 451 last_pressed_index_ = view_model_->GetIndexOfView(sender); |
| 443 DCHECK_LT(-1, last_pressed_index_); | 452 DCHECK_LT(-1, last_pressed_index_); |
| 444 | 453 |
| 445 // Place new windows on the same display as the button. | 454 // Place new windows on the same display as the button. |
| 446 WmWindow* window = WmWindow::Get(sender->GetWidget()->GetNativeWindow()); | 455 WmWindow* window = WmWindow::Get(sender->GetWidget()->GetNativeWindow()); |
| 447 scoped_root_window_for_new_windows_.reset( | 456 scoped_root_window_for_new_windows_.reset( |
| 448 new ScopedRootWindowForNewWindows(window->GetRootWindow())); | 457 new ScopedRootWindowForNewWindows(window->GetRootWindow())); |
| 449 | 458 |
| 450 // Slow down activation animations if shift key is pressed. | 459 // Slow down activation animations if shift key is pressed. |
| (...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1757 | 1766 |
| 1758 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { | 1767 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { |
| 1759 const gfx::Rect bounds = GetBoundsInScreen(); | 1768 const gfx::Rect bounds = GetBoundsInScreen(); |
| 1760 int distance = wm_shelf_->SelectValueForShelfAlignment( | 1769 int distance = wm_shelf_->SelectValueForShelfAlignment( |
| 1761 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), | 1770 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), |
| 1762 bounds.x() - coordinate.x()); | 1771 bounds.x() - coordinate.x()); |
| 1763 return distance > 0 ? distance : 0; | 1772 return distance > 0 ? distance : 0; |
| 1764 } | 1773 } |
| 1765 | 1774 |
| 1766 } // namespace ash | 1775 } // namespace ash |
| OLD | NEW |