| 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 | 8 |
| 9 #include "ash/ash_constants.h" | 9 #include "ash/ash_constants.h" |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| (...skipping 1809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1820 gfx::Point(), | 1820 gfx::Point(), |
| 1821 false, | 1821 false, |
| 1822 ui::GetMenuSourceTypeForEvent(event)); | 1822 ui::GetMenuSourceTypeForEvent(event)); |
| 1823 return true; | 1823 return true; |
| 1824 } | 1824 } |
| 1825 | 1825 |
| 1826 void ShelfView::ShowContextMenuForView(views::View* source, | 1826 void ShelfView::ShowContextMenuForView(views::View* source, |
| 1827 const gfx::Point& point, | 1827 const gfx::Point& point, |
| 1828 ui::MenuSourceType source_type) { | 1828 ui::MenuSourceType source_type) { |
| 1829 int view_index = view_model_->GetIndexOfView(source); | 1829 int view_index = view_model_->GetIndexOfView(source); |
| 1830 // TODO(simon.hong81): Create LauncherContextMenu for applist in its | |
| 1831 // ShelfItemDelegate. | |
| 1832 if (view_index != -1 && model_->items()[view_index].type == TYPE_APP_LIST) { | |
| 1833 view_index = -1; | |
| 1834 } | |
| 1835 | |
| 1836 if (view_index == -1) { | 1830 if (view_index == -1) { |
| 1837 Shell::GetInstance()->ShowContextMenu(point, source_type); | 1831 Shell::GetInstance()->ShowContextMenu(point, source_type); |
| 1838 return; | 1832 return; |
| 1839 } | 1833 } |
| 1834 |
| 1840 scoped_ptr<ui::MenuModel> menu_model; | 1835 scoped_ptr<ui::MenuModel> menu_model; |
| 1841 ShelfItemDelegate* item_delegate = item_manager_->GetShelfItemDelegate( | 1836 ShelfItemDelegate* item_delegate = item_manager_->GetShelfItemDelegate( |
| 1842 model_->items()[view_index].id); | 1837 model_->items()[view_index].id); |
| 1843 menu_model.reset(item_delegate->CreateContextMenu( | 1838 menu_model.reset(item_delegate->CreateContextMenu( |
| 1844 source->GetWidget()->GetNativeView()->GetRootWindow())); | 1839 source->GetWidget()->GetNativeView()->GetRootWindow())); |
| 1845 if (!menu_model) | 1840 if (!menu_model) |
| 1846 return; | 1841 return; |
| 1847 | 1842 |
| 1848 base::AutoReset<LauncherID> reseter( | 1843 base::AutoReset<LauncherID> reseter( |
| 1849 &context_menu_id_, | 1844 &context_menu_id_, |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2022 break; | 2017 break; |
| 2023 case ash::SHELF_ALIGNMENT_TOP: | 2018 case ash::SHELF_ALIGNMENT_TOP: |
| 2024 distance = coordinate.y() - bounds.bottom(); | 2019 distance = coordinate.y() - bounds.bottom(); |
| 2025 break; | 2020 break; |
| 2026 } | 2021 } |
| 2027 return distance > 0 ? distance : 0; | 2022 return distance > 0 ? distance : 0; |
| 2028 } | 2023 } |
| 2029 | 2024 |
| 2030 } // namespace internal | 2025 } // namespace internal |
| 2031 } // namespace ash | 2026 } // namespace ash |
| OLD | NEW |