| 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/ash_constants.h" | 10 #include "ash/ash_constants.h" |
| (...skipping 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1642 const gfx::Point& click_point, | 1642 const gfx::Point& click_point, |
| 1643 bool context_menu, | 1643 bool context_menu, |
| 1644 ui::MenuSourceType source_type, | 1644 ui::MenuSourceType source_type, |
| 1645 views::InkDrop* ink_drop) { | 1645 views::InkDrop* ink_drop) { |
| 1646 menu_model_ = std::move(menu_model); | 1646 menu_model_ = std::move(menu_model); |
| 1647 menu_model_adapter_.reset(new views::MenuModelAdapter( | 1647 menu_model_adapter_.reset(new views::MenuModelAdapter( |
| 1648 menu_model_.get(), | 1648 menu_model_.get(), |
| 1649 base::Bind(&ShelfView::OnMenuClosed, base::Unretained(this), ink_drop))); | 1649 base::Bind(&ShelfView::OnMenuClosed, base::Unretained(this), ink_drop))); |
| 1650 | 1650 |
| 1651 closing_event_time_ = base::TimeTicks(); | 1651 closing_event_time_ = base::TimeTicks(); |
| 1652 int run_types = views::MenuRunner::ASYNC; | 1652 int run_types = 0; |
| 1653 if (context_menu) | 1653 if (context_menu) |
| 1654 run_types |= views::MenuRunner::CONTEXT_MENU; | 1654 run_types |= views::MenuRunner::CONTEXT_MENU; |
| 1655 launcher_menu_runner_.reset( | 1655 launcher_menu_runner_.reset( |
| 1656 new views::MenuRunner(menu_model_adapter_->CreateMenu(), run_types)); | 1656 new views::MenuRunner(menu_model_adapter_->CreateMenu(), run_types)); |
| 1657 | 1657 |
| 1658 // Place new windows on the same display as the button that spawned the menu. | 1658 // Place new windows on the same display as the button that spawned the menu. |
| 1659 WmWindow* window = WmWindow::Get(source->GetWidget()->GetNativeWindow()); | 1659 WmWindow* window = WmWindow::Get(source->GetWidget()->GetNativeWindow()); |
| 1660 scoped_root_window_for_new_windows_.reset( | 1660 scoped_root_window_for_new_windows_.reset( |
| 1661 new ScopedRootWindowForNewWindows(window->GetRootWindow())); | 1661 new ScopedRootWindowForNewWindows(window->GetRootWindow())); |
| 1662 | 1662 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1757 | 1757 |
| 1758 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { | 1758 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { |
| 1759 const gfx::Rect bounds = GetBoundsInScreen(); | 1759 const gfx::Rect bounds = GetBoundsInScreen(); |
| 1760 int distance = wm_shelf_->SelectValueForShelfAlignment( | 1760 int distance = wm_shelf_->SelectValueForShelfAlignment( |
| 1761 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), | 1761 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), |
| 1762 bounds.x() - coordinate.x()); | 1762 bounds.x() - coordinate.x()); |
| 1763 return distance > 0 ? distance : 0; | 1763 return distance > 0 ? distance : 0; |
| 1764 } | 1764 } |
| 1765 | 1765 |
| 1766 } // namespace ash | 1766 } // namespace ash |
| OLD | NEW |