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

Unified Diff: ui/app_list/views/contents_switcher_view.cc

Issue 554553002: Fixed experimental app list pagination indicator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/app_list/views/contents_switcher_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/views/contents_switcher_view.cc
diff --git a/ui/app_list/views/contents_switcher_view.cc b/ui/app_list/views/contents_switcher_view.cc
index 4a628639520545c7712f6e145e59a9b2c1e95ff4..7ca16a9f79591976130f429c16dfab81056e5d0e 100644
--- a/ui/app_list/views/contents_switcher_view.cc
+++ b/ui/app_list/views/contents_switcher_view.cc
@@ -61,7 +61,7 @@ void ContentsSwitcherView::AddSwitcherButton(int resource_id, int page_index) {
indicator->set_background(
views::Background::CreateSolidBackground(app_list::kPagerSelectedColor));
indicator->SetVisible(false);
- page_active_indicators_.push_back(indicator);
+ page_active_indicators_[page_index] = indicator;
// A container view that will consume space when its child is not visible.
// TODO(calamity): Remove this once BoxLayout supports space-consuming
@@ -92,12 +92,14 @@ void ContentsSwitcherView::SelectedPageChanged(int old_selected,
int new_selected) {
// Makes the indicator visible when it is first drawn and when the
// selected page is changed.
- int num_indicators = static_cast<int>(page_active_indicators_.size());
- if (old_selected >= 0 && old_selected < num_indicators)
- page_active_indicators_[old_selected]->SetVisible(false);
-
- if (new_selected >= 0 && new_selected < num_indicators)
- page_active_indicators_[new_selected]->SetVisible(true);
+ std::map<int, views::View*>::const_iterator it =
+ page_active_indicators_.find(old_selected);
+ if (it != page_active_indicators_.end())
+ it->second->SetVisible(false);
+
+ it = page_active_indicators_.find(new_selected);
+ if (it != page_active_indicators_.end())
+ it->second->SetVisible(true);
}
void ContentsSwitcherView::TransitionStarted() {
« no previous file with comments | « ui/app_list/views/contents_switcher_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698