Chromium Code Reviews| 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/launcher/launcher_view.h" | 5 #include "ash/launcher/launcher_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/ash_constants.h" | 9 #include "ash/ash_constants.h" |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 470 views::ImageButton::ALIGN_CENTER), | 470 views::ImageButton::ALIGN_CENTER), |
| 471 shelf->SelectValueForShelfAlignment( | 471 shelf->SelectValueForShelfAlignment( |
| 472 views::ImageButton::ALIGN_TOP, | 472 views::ImageButton::ALIGN_TOP, |
| 473 views::ImageButton::ALIGN_MIDDLE, | 473 views::ImageButton::ALIGN_MIDDLE, |
| 474 views::ImageButton::ALIGN_MIDDLE, | 474 views::ImageButton::ALIGN_MIDDLE, |
| 475 views::ImageButton::ALIGN_BOTTOM)); | 475 views::ImageButton::ALIGN_BOTTOM)); |
| 476 } | 476 } |
| 477 if (i >= first_visible_index_ && i <= last_visible_index_) | 477 if (i >= first_visible_index_ && i <= last_visible_index_) |
| 478 view_model_->view_at(i)->Layout(); | 478 view_model_->view_at(i)->Layout(); |
| 479 } | 479 } |
| 480 tooltip_->UpdateArrow(); | 480 tooltip_->Close(); |
|
James Cook
2013/09/13 23:54:09
The fix below to close the tooltip when its launch
| |
| 481 if (overflow_bubble_) | 481 if (overflow_bubble_) |
| 482 overflow_bubble_->Hide(); | 482 overflow_bubble_->Hide(); |
| 483 } | 483 } |
| 484 | 484 |
| 485 void LauncherView::SchedulePaintForAllButtons() { | 485 void LauncherView::SchedulePaintForAllButtons() { |
| 486 for (int i = 0; i < view_model_->view_size(); ++i) { | 486 for (int i = 0; i < view_model_->view_size(); ++i) { |
| 487 if (i >= first_visible_index_ && i <= last_visible_index_) | 487 if (i >= first_visible_index_ && i <= last_visible_index_) |
| 488 view_model_->view_at(i)->SchedulePaint(); | 488 view_model_->view_at(i)->SchedulePaint(); |
| 489 } | 489 } |
| 490 if (overflow_button_ && overflow_button_->visible()) | 490 if (overflow_button_ && overflow_button_->visible()) |
| (...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1445 // above animation finishes, CalculateIdealBounds will be called to get | 1445 // above animation finishes, CalculateIdealBounds will be called to get |
| 1446 // correct overflow range. CalculateIdealBounds could hide overflow bubble | 1446 // correct overflow range. CalculateIdealBounds could hide overflow bubble |
| 1447 // and triggers LauncherItemChanged. And since we are still in the middle | 1447 // and triggers LauncherItemChanged. And since we are still in the middle |
| 1448 // of LauncherItemRemoved, LauncherView in overflow bubble is not synced | 1448 // of LauncherItemRemoved, LauncherView in overflow bubble is not synced |
| 1449 // with LauncherModel and will crash. | 1449 // with LauncherModel and will crash. |
| 1450 if (overflow_bubble_ && overflow_bubble_->IsShowing()) { | 1450 if (overflow_bubble_ && overflow_bubble_->IsShowing()) { |
| 1451 last_hidden_index_ = std::min(last_hidden_index_, | 1451 last_hidden_index_ = std::min(last_hidden_index_, |
| 1452 view_model_->view_size() - 1); | 1452 view_model_->view_size() - 1); |
| 1453 UpdateOverflowRange(overflow_bubble_->launcher_view()); | 1453 UpdateOverflowRange(overflow_bubble_->launcher_view()); |
| 1454 } | 1454 } |
| 1455 | |
| 1456 // Close the tooltip because it isn't needed any longer and its anchor view | |
| 1457 // will be deleted soon. | |
| 1458 if (tooltip_->anchor() == view) | |
| 1459 tooltip_->Close(); | |
| 1455 } | 1460 } |
| 1456 | 1461 |
| 1457 void LauncherView::LauncherItemChanged(int model_index, | 1462 void LauncherView::LauncherItemChanged(int model_index, |
| 1458 const ash::LauncherItem& old_item) { | 1463 const ash::LauncherItem& old_item) { |
| 1459 const LauncherItem& item(model_->items()[model_index]); | 1464 const LauncherItem& item(model_->items()[model_index]); |
| 1460 if (old_item.type != item.type) { | 1465 if (old_item.type != item.type) { |
| 1461 // Type changed, swap the views. | 1466 // Type changed, swap the views. |
| 1462 model_index = CancelDrag(model_index); | 1467 model_index = CancelDrag(model_index); |
| 1463 scoped_ptr<views::View> old_view(view_model_->view_at(model_index)); | 1468 scoped_ptr<views::View> old_view(view_model_->view_at(model_index)); |
| 1464 bounds_animator_->StopAnimatingView(old_view.get()); | 1469 bounds_animator_->StopAnimatingView(old_view.get()); |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1889 break; | 1894 break; |
| 1890 case ash::SHELF_ALIGNMENT_TOP: | 1895 case ash::SHELF_ALIGNMENT_TOP: |
| 1891 distance = coordinate.y() - bounds.bottom(); | 1896 distance = coordinate.y() - bounds.bottom(); |
| 1892 break; | 1897 break; |
| 1893 } | 1898 } |
| 1894 return distance > 0 ? distance : 0; | 1899 return distance > 0 ? distance : 0; |
| 1895 } | 1900 } |
| 1896 | 1901 |
| 1897 } // namespace internal | 1902 } // namespace internal |
| 1898 } // namespace ash | 1903 } // namespace ash |
| OLD | NEW |