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

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

Issue 1948543005: App icon from subfolder appears in the wrong place when pinning to shelf (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add unittest Created 4 years, 7 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
« no previous file with comments | « no previous file | ash/shelf/shelf_view_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after
1612 // Removing and re-inserting a view in our view model will strip the ideal 1612 // Removing and re-inserting a view in our view model will strip the ideal
1613 // bounds from the item. To avoid recalculation of everything the bounds 1613 // bounds from the item. To avoid recalculation of everything the bounds
1614 // get remembered and restored after the insertion to the previous value. 1614 // get remembered and restored after the insertion to the previous value.
1615 gfx::Rect old_ideal_bounds = view_model_->ideal_bounds(model_index); 1615 gfx::Rect old_ideal_bounds = view_model_->ideal_bounds(model_index);
1616 view_model_->Remove(model_index); 1616 view_model_->Remove(model_index);
1617 views::View* new_view = CreateViewForItem(item); 1617 views::View* new_view = CreateViewForItem(item);
1618 AddChildView(new_view); 1618 AddChildView(new_view);
1619 view_model_->Add(new_view, model_index); 1619 view_model_->Add(new_view, model_index);
1620 view_model_->set_ideal_bounds(model_index, old_ideal_bounds); 1620 view_model_->set_ideal_bounds(model_index, old_ideal_bounds);
1621 new_view->SetBoundsRect(old_view->bounds()); 1621 new_view->SetBoundsRect(old_view->bounds());
1622 if (overflow_button_ && overflow_button_->visible())
1623 AnimateToIdealBounds();
1622 return; 1624 return;
1623 } 1625 }
1624 1626
1625 views::View* view = view_model_->view_at(model_index); 1627 views::View* view = view_model_->view_at(model_index);
1626 switch (item.type) { 1628 switch (item.type) {
1627 case TYPE_BROWSER_SHORTCUT: 1629 case TYPE_BROWSER_SHORTCUT:
1628 // Fallthrough for the new Shelf since it needs to show the activation 1630 // Fallthrough for the new Shelf since it needs to show the activation
1629 // change as well. 1631 // change as well.
1630 case TYPE_APP_SHORTCUT: 1632 case TYPE_APP_SHORTCUT:
1631 case TYPE_WINDOWED_APP: 1633 case TYPE_WINDOWED_APP:
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1881 1883
1882 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { 1884 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const {
1883 const gfx::Rect bounds = GetBoundsInScreen(); 1885 const gfx::Rect bounds = GetBoundsInScreen();
1884 int distance = shelf_->SelectValueForShelfAlignment( 1886 int distance = shelf_->SelectValueForShelfAlignment(
1885 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), 1887 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(),
1886 bounds.x() - coordinate.x()); 1888 bounds.x() - coordinate.x());
1887 return distance > 0 ? distance : 0; 1889 return distance > 0 ? distance : 0;
1888 } 1890 }
1889 1891
1890 } // namespace ash 1892 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/shelf/shelf_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698