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

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

Issue 2385753002: [Merge-M54] Fix possible overlapping icons in shelf on sync. (Closed)
Patch Set: Created 4 years, 2 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 | chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h » ('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/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 1692 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 // get remembered and restored after the insertion to the previous value. 1703 // get remembered and restored after the insertion to the previous value.
1704 gfx::Rect old_ideal_bounds = view_model_->ideal_bounds(model_index); 1704 gfx::Rect old_ideal_bounds = view_model_->ideal_bounds(model_index);
1705 view_model_->Remove(model_index); 1705 view_model_->Remove(model_index);
1706 views::View* new_view = CreateViewForItem(item); 1706 views::View* new_view = CreateViewForItem(item);
1707 AddChildView(new_view); 1707 AddChildView(new_view);
1708 view_model_->Add(new_view, model_index); 1708 view_model_->Add(new_view, model_index);
1709 view_model_->set_ideal_bounds(model_index, old_ideal_bounds); 1709 view_model_->set_ideal_bounds(model_index, old_ideal_bounds);
1710 new_view->SetBoundsRect(old_view->bounds()); 1710 new_view->SetBoundsRect(old_view->bounds());
1711 if (overflow_button_ && overflow_button_->visible()) 1711 if (overflow_button_ && overflow_button_->visible())
1712 AnimateToIdealBounds(); 1712 AnimateToIdealBounds();
1713 else
1714 bounds_animator_->AnimateViewTo(new_view, old_ideal_bounds);
1713 return; 1715 return;
1714 } 1716 }
1715 1717
1716 views::View* view = view_model_->view_at(model_index); 1718 views::View* view = view_model_->view_at(model_index);
1717 switch (item.type) { 1719 switch (item.type) {
1718 case TYPE_BROWSER_SHORTCUT: 1720 case TYPE_BROWSER_SHORTCUT:
1719 // Fallthrough for the new Shelf since it needs to show the activation 1721 // Fallthrough for the new Shelf since it needs to show the activation
1720 // change as well. 1722 // change as well.
1721 case TYPE_APP_SHORTCUT: 1723 case TYPE_APP_SHORTCUT:
1722 case TYPE_WINDOWED_APP: 1724 case TYPE_WINDOWED_APP:
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1913 1915
1914 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { 1916 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const {
1915 const gfx::Rect bounds = GetBoundsInScreen(); 1917 const gfx::Rect bounds = GetBoundsInScreen();
1916 int distance = wm_shelf_->SelectValueForShelfAlignment( 1918 int distance = wm_shelf_->SelectValueForShelfAlignment(
1917 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), 1919 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(),
1918 bounds.x() - coordinate.x()); 1920 bounds.x() - coordinate.x());
1919 return distance > 0 ? distance : 0; 1921 return distance > 0 ? distance : 0;
1920 } 1922 }
1921 1923
1922 } // namespace ash 1924 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698