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 1701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1712 | 1712 |
1713 bool ShelfView::ShowListMenuForView(const ShelfItem& item, | 1713 bool ShelfView::ShowListMenuForView(const ShelfItem& item, |
1714 views::View* source, | 1714 views::View* source, |
1715 const ui::Event& event) { | 1715 const ui::Event& event) { |
1716 ShelfItemDelegate* item_delegate = | 1716 ShelfItemDelegate* item_delegate = |
1717 item_manager_->GetShelfItemDelegate(item.id); | 1717 item_manager_->GetShelfItemDelegate(item.id); |
1718 list_menu_model_.reset(item_delegate->CreateApplicationMenu(event.flags())); | 1718 list_menu_model_.reset(item_delegate->CreateApplicationMenu(event.flags())); |
1719 | 1719 |
1720 // Make sure we have a menu and it has at least two items in addition to the | 1720 // Make sure we have a menu and it has at least two items in addition to the |
1721 // application title and the 3 spacing separators. | 1721 // application title and the 3 spacing separators. |
1722 if (!list_menu_model_.get() || list_menu_model_->GetItemCount() <= 5) | 1722 if (!list_menu_model_.get() || list_menu_model_->GetItemCount() <= 5) { |
1723 list_menu_model_.reset(); | |
1723 return false; | 1724 return false; |
1725 } | |
1724 | 1726 |
1725 ShowMenu(list_menu_model_.get(), | 1727 ShowMenu(list_menu_model_.get(), |
1726 source, | 1728 source, |
1727 gfx::Point(), | 1729 gfx::Point(), |
1728 false, | 1730 false, |
1729 ui::GetMenuSourceTypeForEvent(event)); | 1731 ui::GetMenuSourceTypeForEvent(event)); |
Mr4D (OOO till 08-26)
2014/08/22 23:06:15
Looking at the code I am sure that you would need
| |
1730 return true; | 1732 return true; |
1731 } | 1733 } |
1732 | 1734 |
1733 void ShelfView::ShowContextMenuForView(views::View* source, | 1735 void ShelfView::ShowContextMenuForView(views::View* source, |
1734 const gfx::Point& point, | 1736 const gfx::Point& point, |
1735 ui::MenuSourceType source_type) { | 1737 ui::MenuSourceType source_type) { |
1736 int view_index = view_model_->GetIndexOfView(source); | 1738 int view_index = view_model_->GetIndexOfView(source); |
1737 if (view_index == -1) { | 1739 if (view_index == -1) { |
1738 Shell::GetInstance()->ShowContextMenu(point, source_type); | 1740 Shell::GetInstance()->ShowContextMenu(point, source_type); |
1739 return; | 1741 return; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1917 distance = bounds.x() - coordinate.x(); | 1919 distance = bounds.x() - coordinate.x(); |
1918 break; | 1920 break; |
1919 case SHELF_ALIGNMENT_TOP: | 1921 case SHELF_ALIGNMENT_TOP: |
1920 distance = coordinate.y() - bounds.bottom(); | 1922 distance = coordinate.y() - bounds.bottom(); |
1921 break; | 1923 break; |
1922 } | 1924 } |
1923 return distance > 0 ? distance : 0; | 1925 return distance > 0 ? distance : 0; |
1924 } | 1926 } |
1925 | 1927 |
1926 } // namespace ash | 1928 } // namespace ash |
OLD | NEW |