| 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_ && main_shelf_->IsShowingOverflowBubble()) |
| 446 main_shelf_->ToggleOverflowBubble(); |
| 447 |
| 441 // Record the index for the last pressed shelf item. | 448 // Record the index for the last pressed shelf item. |
| 442 last_pressed_index_ = view_model_->GetIndexOfView(sender); | 449 last_pressed_index_ = view_model_->GetIndexOfView(sender); |
| 443 DCHECK_LT(-1, last_pressed_index_); | 450 DCHECK_LT(-1, last_pressed_index_); |
| 444 | 451 |
| 445 // Place new windows on the same display as the button. | 452 // Place new windows on the same display as the button. |
| 446 WmWindow* window = WmWindow::Get(sender->GetWidget()->GetNativeWindow()); | 453 WmWindow* window = WmWindow::Get(sender->GetWidget()->GetNativeWindow()); |
| 447 scoped_root_window_for_new_windows_.reset( | 454 scoped_root_window_for_new_windows_.reset( |
| 448 new ScopedRootWindowForNewWindows(window->GetRootWindow())); | 455 new ScopedRootWindowForNewWindows(window->GetRootWindow())); |
| 449 | 456 |
| 450 // Slow down activation animations if shift key is pressed. | 457 // Slow down activation animations if shift key is pressed. |
| (...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1757 | 1764 |
| 1758 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { | 1765 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { |
| 1759 const gfx::Rect bounds = GetBoundsInScreen(); | 1766 const gfx::Rect bounds = GetBoundsInScreen(); |
| 1760 int distance = wm_shelf_->SelectValueForShelfAlignment( | 1767 int distance = wm_shelf_->SelectValueForShelfAlignment( |
| 1761 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), | 1768 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), |
| 1762 bounds.x() - coordinate.x()); | 1769 bounds.x() - coordinate.x()); |
| 1763 return distance > 0 ? distance : 0; | 1770 return distance > 0 ? distance : 0; |
| 1764 } | 1771 } |
| 1765 | 1772 |
| 1766 } // namespace ash | 1773 } // namespace ash |
| OLD | NEW |