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

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

Issue 2791803002: mash: Move LauncherItemController to ash, rename ShelfItemDelegate. (Closed)
Patch Set: Move shelf_item_delegate to ash/public/cpp, cleanup. Created 3 years, 8 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 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after
1576 void ShelfView::ShelfItemMoved(int start_index, int target_index) { 1576 void ShelfView::ShelfItemMoved(int start_index, int target_index) {
1577 view_model_->Move(start_index, target_index); 1577 view_model_->Move(start_index, target_index);
1578 // When cancelling a drag due to a shelf item being added, the currently 1578 // When cancelling a drag due to a shelf item being added, the currently
1579 // dragged item is moved back to its initial position. AnimateToIdealBounds 1579 // dragged item is moved back to its initial position. AnimateToIdealBounds
1580 // will be called again when the new item is added to the |view_model_| but 1580 // will be called again when the new item is added to the |view_model_| but
1581 // at this time the |view_model_| is inconsistent with the |model_|. 1581 // at this time the |view_model_| is inconsistent with the |model_|.
1582 if (!cancelling_drag_model_changed_) 1582 if (!cancelling_drag_model_changed_)
1583 AnimateToIdealBounds(); 1583 AnimateToIdealBounds();
1584 } 1584 }
1585 1585
1586 void ShelfView::OnSetShelfItemDelegate(ShelfID, mojom::ShelfItemDelegate*) {} 1586 void ShelfView::OnSetShelfItemDelegate(ShelfID, ShelfItemDelegate*) {}
1587 1587
1588 void ShelfView::AfterItemSelected( 1588 void ShelfView::AfterItemSelected(
1589 const ShelfItem& item, 1589 const ShelfItem& item,
1590 views::Button* sender, 1590 views::Button* sender,
1591 std::unique_ptr<ui::Event> event, 1591 std::unique_ptr<ui::Event> event,
1592 views::InkDrop* ink_drop, 1592 views::InkDrop* ink_drop,
1593 ShelfAction action, 1593 ShelfAction action,
1594 base::Optional<std::vector<mojom::MenuItemPtr>> menu_items) { 1594 base::Optional<std::vector<mojom::MenuItemPtr>> menu_items) {
1595 shelf_button_pressed_metric_tracker_.ButtonPressed(*event, sender, action); 1595 shelf_button_pressed_metric_tracker_.ButtonPressed(*event, sender, action);
1596 1596
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1756 1756
1757 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { 1757 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const {
1758 const gfx::Rect bounds = GetBoundsInScreen(); 1758 const gfx::Rect bounds = GetBoundsInScreen();
1759 int distance = wm_shelf_->SelectValueForShelfAlignment( 1759 int distance = wm_shelf_->SelectValueForShelfAlignment(
1760 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), 1760 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(),
1761 bounds.x() - coordinate.x()); 1761 bounds.x() - coordinate.x());
1762 return distance > 0 ? distance : 0; 1762 return distance > 0 ? distance : 0;
1763 } 1763 }
1764 1764
1765 } // namespace ash 1765 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698