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 "ui/app_list/views/contents_view.h" | 5 #include "ui/app_list/views/contents_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 if (contents_switcher_view_) | 40 if (contents_switcher_view_) |
41 pagination_model_.RemoveObserver(contents_switcher_view_); | 41 pagination_model_.RemoveObserver(contents_switcher_view_); |
42 } | 42 } |
43 | 43 |
44 void ContentsView::InitNamedPages(AppListModel* model, | 44 void ContentsView::InitNamedPages(AppListModel* model, |
45 AppListViewDelegate* view_delegate) { | 45 AppListViewDelegate* view_delegate) { |
46 DCHECK(model); | 46 DCHECK(model); |
47 | 47 |
48 if (app_list::switches::IsExperimentalAppListEnabled()) { | 48 if (app_list::switches::IsExperimentalAppListEnabled()) { |
49 start_page_view_ = new StartPageView(app_list_main_view_, view_delegate); | 49 start_page_view_ = new StartPageView(app_list_main_view_, view_delegate); |
50 AddLauncherPage( | 50 AddLauncherPage(start_page_view_, 0, NAMED_PAGE_START); |
51 start_page_view_, IDR_APP_LIST_SEARCH_ICON, NAMED_PAGE_START); | |
52 } else { | 51 } else { |
53 search_results_view_ = | 52 search_results_view_ = |
54 new SearchResultListView(app_list_main_view_, view_delegate); | 53 new SearchResultListView(app_list_main_view_, view_delegate); |
55 AddLauncherPage(search_results_view_, 0, NAMED_PAGE_SEARCH_RESULTS); | 54 AddLauncherPage(search_results_view_, 0, NAMED_PAGE_SEARCH_RESULTS); |
56 search_results_view_->SetResults(model->results()); | 55 search_results_view_->SetResults(model->results()); |
57 } | 56 } |
58 | 57 |
59 apps_container_view_ = new AppsContainerView(app_list_main_view_, model); | 58 apps_container_view_ = new AppsContainerView(app_list_main_view_, model); |
60 | 59 |
61 AddLauncherPage( | 60 AddLauncherPage( |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 } | 237 } |
239 | 238 |
240 void ContentsView::AddBlankPageForTesting() { | 239 void ContentsView::AddBlankPageForTesting() { |
241 AddLauncherPage(new views::View, 0); | 240 AddLauncherPage(new views::View, 0); |
242 } | 241 } |
243 | 242 |
244 int ContentsView::AddLauncherPage(views::View* view, int resource_id) { | 243 int ContentsView::AddLauncherPage(views::View* view, int resource_id) { |
245 int page_index = view_model_->view_size(); | 244 int page_index = view_model_->view_size(); |
246 AddChildView(view); | 245 AddChildView(view); |
247 view_model_->Add(view, page_index); | 246 view_model_->Add(view, page_index); |
248 if (contents_switcher_view_) | 247 if (contents_switcher_view_ && resource_id) |
249 contents_switcher_view_->AddSwitcherButton(resource_id, page_index); | 248 contents_switcher_view_->AddSwitcherButton(resource_id, page_index); |
250 pagination_model_.SetTotalPages(view_model_->view_size()); | 249 pagination_model_.SetTotalPages(view_model_->view_size()); |
251 return page_index; | 250 return page_index; |
252 } | 251 } |
253 | 252 |
254 int ContentsView::AddLauncherPage(views::View* view, | 253 int ContentsView::AddLauncherPage(views::View* view, |
255 int resource_id, | 254 int resource_id, |
256 NamedPage named_page) { | 255 NamedPage named_page) { |
257 int page_index = AddLauncherPage(view, resource_id); | 256 int page_index = AddLauncherPage(view, resource_id); |
258 named_page_to_view_.insert(std::pair<NamedPage, int>(named_page, page_index)); | 257 named_page_to_view_.insert(std::pair<NamedPage, int>(named_page, page_index)); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 } | 301 } |
303 | 302 |
304 void ContentsView::TransitionStarted() { | 303 void ContentsView::TransitionStarted() { |
305 } | 304 } |
306 | 305 |
307 void ContentsView::TransitionChanged() { | 306 void ContentsView::TransitionChanged() { |
308 UpdatePageBounds(); | 307 UpdatePageBounds(); |
309 } | 308 } |
310 | 309 |
311 } // namespace app_list | 310 } // namespace app_list |
OLD | NEW |