Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Side by Side Diff: ash/common/shelf/shelf_view.cc

Issue 2716403005: mash: Remove shelf app menu item objects. (Closed)
Patch Set: Address comments. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1599 matching lines...) Expand 10 before | Expand all | Expand 10 after
1610 } 1610 }
1611 1611
1612 void ShelfView::OnSetShelfItemDelegate(ShelfID id, 1612 void ShelfView::OnSetShelfItemDelegate(ShelfID id,
1613 ShelfItemDelegate* item_delegate) {} 1613 ShelfItemDelegate* item_delegate) {}
1614 1614
1615 bool ShelfView::ShowListMenuForView(const ShelfItem& item, 1615 bool ShelfView::ShowListMenuForView(const ShelfItem& item,
1616 views::View* source, 1616 views::View* source,
1617 const ui::Event& event, 1617 const ui::Event& event,
1618 views::InkDrop* ink_drop) { 1618 views::InkDrop* ink_drop) {
1619 ShelfItemDelegate* item_delegate = model_->GetShelfItemDelegate(item.id); 1619 ShelfItemDelegate* item_delegate = model_->GetShelfItemDelegate(item.id);
1620 ShelfAppMenuItemList menu_items = 1620 ShelfAppMenuItemList items = item_delegate->GetAppMenuItems(event.flags());
1621 item_delegate->GetAppMenuItems(event.flags());
1622 1621
1623 // The application list menu should only show for two or more items; return 1622 // The application list menu should only show for two or more items; return
1624 // false here to ensure that other behavior is triggered (eg. activating or 1623 // false here to ensure that other behavior is triggered (eg. activating or
1625 // minimizing a single associated window, or launching a pinned shelf item). 1624 // minimizing a single associated window, or launching a pinned shelf item).
1626 if (menu_items.size() < 2) 1625 if (items.size() < 2)
1627 return false; 1626 return false;
1628 1627
1629 ink_drop->AnimateToState(views::InkDropState::ACTIVATED); 1628 ink_drop->AnimateToState(views::InkDropState::ACTIVATED);
1630 context_menu_id_ = item.id; 1629 context_menu_id_ = item.id;
1631 ShowMenu(base::MakeUnique<ShelfApplicationMenuModel>(item.title, 1630 ShowMenu(base::MakeUnique<ShelfApplicationMenuModel>(
1632 std::move(menu_items)), 1631 item.title, std::move(items), item_delegate),
1633 source, gfx::Point(), false, ui::GetMenuSourceTypeForEvent(event), 1632 source, gfx::Point(), false, ui::GetMenuSourceTypeForEvent(event),
1634 ink_drop); 1633 ink_drop);
1635 return true; 1634 return true;
1636 } 1635 }
1637 1636
1638 void ShelfView::ShowContextMenuForView(views::View* source, 1637 void ShelfView::ShowContextMenuForView(views::View* source,
1639 const gfx::Point& point, 1638 const gfx::Point& point,
1640 ui::MenuSourceType source_type) { 1639 ui::MenuSourceType source_type) {
1641 last_pressed_index_ = -1; 1640 last_pressed_index_ = -1;
1642 1641
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1776 1775
1777 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { 1776 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const {
1778 const gfx::Rect bounds = GetBoundsInScreen(); 1777 const gfx::Rect bounds = GetBoundsInScreen();
1779 int distance = wm_shelf_->SelectValueForShelfAlignment( 1778 int distance = wm_shelf_->SelectValueForShelfAlignment(
1780 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), 1779 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(),
1781 bounds.x() - coordinate.x()); 1780 bounds.x() - coordinate.x());
1782 return distance > 0 ? distance : 0; 1781 return distance > 0 ? distance : 0;
1783 } 1782 }
1784 1783
1785 } // namespace ash 1784 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/shelf/shelf_item_delegate.h ('k') | ash/common/shelf/shelf_window_watcher_item_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698