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

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

Issue 317723005: Refactor app list ContentsView to use page indices, not show states. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renamed again, and rewrote comments for AddLauncherPage. Created 6 years, 6 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/app_list_view_unittest.cc ('k') | ui/app_list/views/contents_view.h » ('j') | 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 d6b96f36689878687199c59c41fbda6de045664f..994a1fe5e44af71398c266ce9cde0d448097a50f 100644
--- a/ui/app_list/views/contents_switcher_view.cc
+++ b/ui/app_list/views/contents_switcher_view.cc
@@ -27,18 +27,24 @@ ContentsSwitcherView::ContentsSwitcherView(ContentsView* contents_view)
buttons_->SetLayoutManager(new views::BoxLayout(
views::BoxLayout::kHorizontal, 0, 0, kButtonSpacing));
- AddSwitcherButton(IDR_APP_LIST_SEARCH_ICON, ContentsView::SHOW_START_PAGE);
- AddSwitcherButton(IDR_APP_LIST_APPS_ICON, ContentsView::SHOW_APPS);
+ // TODO(mgiuca): Dynamically generate these buttons from the subviews of
+ // |contents_view|.
+ AddSwitcherButton(
+ IDR_APP_LIST_SEARCH_ICON,
+ contents_view->GetPageIndexForNamedPage(ContentsView::NAMED_PAGE_START));
+ AddSwitcherButton(
+ IDR_APP_LIST_APPS_ICON,
+ contents_view->GetPageIndexForNamedPage(ContentsView::NAMED_PAGE_APPS));
}
ContentsSwitcherView::~ContentsSwitcherView() {}
-void ContentsSwitcherView::AddSwitcherButton(int resource_id, int tag) {
+void ContentsSwitcherView::AddSwitcherButton(int resource_id, int page_index) {
views::ImageButton* button = new views::ImageButton(this);
button->SetImage(
views::CustomButton::STATE_NORMAL,
ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id));
- button->set_tag(tag);
+ button->set_tag(page_index);
buttons_->AddChildView(button);
}
@@ -60,8 +66,7 @@ void ContentsSwitcherView::Layout() {
void ContentsSwitcherView::ButtonPressed(views::Button* sender,
const ui::Event& event) {
- contents_view_->SetShowState(
- static_cast<ContentsView::ShowState>(sender->tag()));
+ contents_view_->SetActivePage(sender->tag());
}
} // namespace app_list
« no previous file with comments | « ui/app_list/views/app_list_view_unittest.cc ('k') | ui/app_list/views/contents_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698