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 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1643 // change as well. | 1643 // change as well. |
1644 case TYPE_APP_SHORTCUT: | 1644 case TYPE_APP_SHORTCUT: |
1645 case TYPE_WINDOWED_APP: | 1645 case TYPE_WINDOWED_APP: |
1646 case TYPE_PLATFORM_APP: | 1646 case TYPE_PLATFORM_APP: |
1647 case TYPE_DIALOG: | 1647 case TYPE_DIALOG: |
1648 case TYPE_APP_PANEL: | 1648 case TYPE_APP_PANEL: |
1649 case TYPE_IME_MENU: { | 1649 case TYPE_IME_MENU: { |
1650 CHECK_EQ(ShelfButton::kViewClassName, view->GetClassName()); | 1650 CHECK_EQ(ShelfButton::kViewClassName, view->GetClassName()); |
1651 ShelfButton* button = static_cast<ShelfButton*>(view); | 1651 ShelfButton* button = static_cast<ShelfButton*>(view); |
1652 ReflectItemStatus(item, button); | 1652 ReflectItemStatus(item, button); |
1653 // The browser shortcut is currently not a "real" item and as such the | 1653 button->SetImage(item.image); |
1654 // the image is bogous as well. We therefore keep the image as is for it. | |
1655 if (item.type != TYPE_BROWSER_SHORTCUT) | |
1656 button->SetImage(item.image); | |
1657 button->SchedulePaint(); | 1654 button->SchedulePaint(); |
1658 break; | 1655 break; |
1659 } | 1656 } |
1660 | 1657 |
1661 default: | 1658 default: |
1662 break; | 1659 break; |
1663 } | 1660 } |
1664 } | 1661 } |
1665 | 1662 |
1666 void ShelfView::ShelfItemMoved(int start_index, int target_index) { | 1663 void ShelfView::ShelfItemMoved(int start_index, int target_index) { |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1897 | 1894 |
1898 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { | 1895 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { |
1899 const gfx::Rect bounds = GetBoundsInScreen(); | 1896 const gfx::Rect bounds = GetBoundsInScreen(); |
1900 int distance = shelf_->SelectValueForShelfAlignment( | 1897 int distance = shelf_->SelectValueForShelfAlignment( |
1901 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), | 1898 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), |
1902 bounds.x() - coordinate.x()); | 1899 bounds.x() - coordinate.x()); |
1903 return distance > 0 ? distance : 0; | 1900 return distance > 0 ? distance : 0; |
1904 } | 1901 } |
1905 | 1902 |
1906 } // namespace ash | 1903 } // namespace ash |
OLD | NEW |