| 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 28 matching lines...) Expand all Loading... |
| 39 pagination_model_.RemoveObserver(this); | 39 pagination_model_.RemoveObserver(this); |
| 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 std::vector<views::View*> custom_page_views = |
| 50 view_delegate->CreateCustomPageWebViews(GetLocalBounds().size()); |
| 51 for (std::vector<views::View*>::const_iterator it = |
| 52 custom_page_views.begin(); |
| 53 it != custom_page_views.end(); |
| 54 ++it) { |
| 55 AddLauncherPage(*it, IDR_APP_LIST_NOTIFICATIONS_ICON); |
| 56 } |
| 57 |
| 49 start_page_view_ = new StartPageView(app_list_main_view_, view_delegate); | 58 start_page_view_ = new StartPageView(app_list_main_view_, view_delegate); |
| 50 AddLauncherPage(start_page_view_, 0, NAMED_PAGE_START); | 59 AddLauncherPage(start_page_view_, 0, NAMED_PAGE_START); |
| 51 } else { | 60 } else { |
| 52 search_results_view_ = | 61 search_results_view_ = |
| 53 new SearchResultListView(app_list_main_view_, view_delegate); | 62 new SearchResultListView(app_list_main_view_, view_delegate); |
| 54 AddLauncherPage(search_results_view_, 0, NAMED_PAGE_SEARCH_RESULTS); | 63 AddLauncherPage(search_results_view_, 0, NAMED_PAGE_SEARCH_RESULTS); |
| 55 search_results_view_->SetResults(model->results()); | 64 search_results_view_->SetResults(model->results()); |
| 56 } | 65 } |
| 57 | 66 |
| 58 apps_container_view_ = new AppsContainerView(app_list_main_view_, model); | 67 apps_container_view_ = new AppsContainerView(app_list_main_view_, model); |
| 59 | 68 |
| 60 AddLauncherPage( | 69 AddLauncherPage( |
| 61 apps_container_view_, IDR_APP_LIST_APPS_ICON, NAMED_PAGE_APPS); | 70 apps_container_view_, IDR_APP_LIST_APPS_ICON, NAMED_PAGE_APPS); |
| 62 | 71 |
| 63 if (app_list::switches::IsExperimentalAppListEnabled()) { | |
| 64 std::vector<views::View*> custom_page_views = | |
| 65 view_delegate->CreateCustomPageWebViews(GetLocalBounds().size()); | |
| 66 for (std::vector<views::View*>::const_iterator it = | |
| 67 custom_page_views.begin(); | |
| 68 it != custom_page_views.end(); | |
| 69 ++it) { | |
| 70 AddLauncherPage(*it, IDR_APP_LIST_NOTIFICATIONS_ICON); | |
| 71 } | |
| 72 } | |
| 73 | |
| 74 int initial_page_index = app_list::switches::IsExperimentalAppListEnabled() | 72 int initial_page_index = app_list::switches::IsExperimentalAppListEnabled() |
| 75 ? GetPageIndexForNamedPage(NAMED_PAGE_START) | 73 ? GetPageIndexForNamedPage(NAMED_PAGE_START) |
| 76 : GetPageIndexForNamedPage(NAMED_PAGE_APPS); | 74 : GetPageIndexForNamedPage(NAMED_PAGE_APPS); |
| 77 | 75 |
| 78 page_before_search_ = initial_page_index; | 76 page_before_search_ = initial_page_index; |
| 79 pagination_model_.SelectPage(initial_page_index, false); | 77 pagination_model_.SelectPage(initial_page_index, false); |
| 80 | 78 |
| 81 // Needed to update the main search box visibility. | 79 // Needed to update the main search box visibility. |
| 82 ActivePageChanged(false); | 80 ActivePageChanged(false); |
| 83 } | 81 } |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 } | 299 } |
| 302 | 300 |
| 303 void ContentsView::TransitionStarted() { | 301 void ContentsView::TransitionStarted() { |
| 304 } | 302 } |
| 305 | 303 |
| 306 void ContentsView::TransitionChanged() { | 304 void ContentsView::TransitionChanged() { |
| 307 UpdatePageBounds(); | 305 UpdatePageBounds(); |
| 308 } | 306 } |
| 309 | 307 |
| 310 } // namespace app_list | 308 } // namespace app_list |
| OLD | NEW |