| 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/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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 } | 426 } |
| 427 tooltip_.Close(); | 427 tooltip_.Close(); |
| 428 if (overflow_bubble_) | 428 if (overflow_bubble_) |
| 429 overflow_bubble_->Hide(); | 429 overflow_bubble_->Hide(); |
| 430 // For crbug.com/587931, because AppListButton layout logic is in OnPaint. | 430 // For crbug.com/587931, because AppListButton layout logic is in OnPaint. |
| 431 AppListButton* app_list_button = GetAppListButton(); | 431 AppListButton* app_list_button = GetAppListButton(); |
| 432 if (app_list_button) | 432 if (app_list_button) |
| 433 app_list_button->SchedulePaint(); | 433 app_list_button->SchedulePaint(); |
| 434 } | 434 } |
| 435 | 435 |
| 436 void ShelfView::SchedulePaintForAllButtons() { | |
| 437 for (int i = 0; i < view_model_->view_size(); ++i) { | |
| 438 if (i >= first_visible_index_ && i <= last_visible_index_) | |
| 439 view_model_->view_at(i)->SchedulePaint(); | |
| 440 } | |
| 441 if (overflow_button_ && overflow_button_->visible()) | |
| 442 overflow_button_->SchedulePaint(); | |
| 443 } | |
| 444 | |
| 445 gfx::Rect ShelfView::GetIdealBoundsOfItemIcon(ShelfID id) { | 436 gfx::Rect ShelfView::GetIdealBoundsOfItemIcon(ShelfID id) { |
| 446 int index = model_->ItemIndexByID(id); | 437 int index = model_->ItemIndexByID(id); |
| 447 if (index == -1) | 438 if (index == -1) |
| 448 return gfx::Rect(); | 439 return gfx::Rect(); |
| 449 // Map all items from overflow area to the overflow button. Note that the | 440 // Map all items from overflow area to the overflow button. Note that the |
| 450 // section between last_index_hidden_ and model_->FirstPanelIndex() is the | 441 // section between last_index_hidden_ and model_->FirstPanelIndex() is the |
| 451 // list of invisible panel items. However, these items are currently nowhere | 442 // list of invisible panel items. However, these items are currently nowhere |
| 452 // represented and get dropped instead - see (crbug.com/378907). As such there | 443 // represented and get dropped instead - see (crbug.com/378907). As such there |
| 453 // is no way to address them or place them. We therefore move them over the | 444 // is no way to address them or place them. We therefore move them over the |
| 454 // overflow button. | 445 // overflow button. |
| (...skipping 1381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1836 break; | 1827 break; |
| 1837 case SHELF_ALIGNMENT_LEFT: | 1828 case SHELF_ALIGNMENT_LEFT: |
| 1838 menu_alignment = views::MENU_ANCHOR_BUBBLE_RIGHT; | 1829 menu_alignment = views::MENU_ANCHOR_BUBBLE_RIGHT; |
| 1839 break; | 1830 break; |
| 1840 case SHELF_ALIGNMENT_RIGHT: | 1831 case SHELF_ALIGNMENT_RIGHT: |
| 1841 menu_alignment = views::MENU_ANCHOR_BUBBLE_LEFT; | 1832 menu_alignment = views::MENU_ANCHOR_BUBBLE_LEFT; |
| 1842 break; | 1833 break; |
| 1843 } | 1834 } |
| 1844 } | 1835 } |
| 1845 | 1836 |
| 1846 shelf_widget_->ForceUndimming(true); | |
| 1847 // NOTE: if you convert to HAS_MNEMONICS be sure to update menu building code. | 1837 // NOTE: if you convert to HAS_MNEMONICS be sure to update menu building code. |
| 1848 launcher_menu_runner_->RunMenuAt(source->GetWidget(), nullptr, anchor, | 1838 launcher_menu_runner_->RunMenuAt(source->GetWidget(), nullptr, anchor, |
| 1849 menu_alignment, source_type); | 1839 menu_alignment, source_type); |
| 1850 } | 1840 } |
| 1851 | 1841 |
| 1852 void ShelfView::OnMenuClosed(views::InkDrop* ink_drop) { | 1842 void ShelfView::OnMenuClosed(views::InkDrop* ink_drop) { |
| 1853 context_menu_id_ = 0; | 1843 context_menu_id_ = 0; |
| 1854 shelf_widget_->ForceUndimming(false); | |
| 1855 | 1844 |
| 1856 // Hide the hide overflow bubble after showing a context menu for its items. | 1845 // Hide the hide overflow bubble after showing a context menu for its items. |
| 1857 if (owner_overflow_bubble_) | 1846 if (owner_overflow_bubble_) |
| 1858 owner_overflow_bubble_->Hide(); | 1847 owner_overflow_bubble_->Hide(); |
| 1859 | 1848 |
| 1860 closing_event_time_ = launcher_menu_runner_->closing_event_time(); | 1849 closing_event_time_ = launcher_menu_runner_->closing_event_time(); |
| 1861 | 1850 |
| 1862 if (ink_drop) | 1851 if (ink_drop) |
| 1863 ink_drop->AnimateToState(views::InkDropState::DEACTIVATED); | 1852 ink_drop->AnimateToState(views::InkDropState::DEACTIVATED); |
| 1864 | 1853 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1913 | 1902 |
| 1914 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { | 1903 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { |
| 1915 const gfx::Rect bounds = GetBoundsInScreen(); | 1904 const gfx::Rect bounds = GetBoundsInScreen(); |
| 1916 int distance = wm_shelf_->SelectValueForShelfAlignment( | 1905 int distance = wm_shelf_->SelectValueForShelfAlignment( |
| 1917 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), | 1906 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), |
| 1918 bounds.x() - coordinate.x()); | 1907 bounds.x() - coordinate.x()); |
| 1919 return distance > 0 ? distance : 0; | 1908 return distance > 0 ? distance : 0; |
| 1920 } | 1909 } |
| 1921 | 1910 |
| 1922 } // namespace ash | 1911 } // namespace ash |
| OLD | NEW |