| 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 | 9 |
| 9 #include "base/logging.h" | 10 #include "base/logging.h" |
| 10 #include "grit/ui_resources.h" | 11 #include "grit/ui_resources.h" |
| 11 #include "ui/app_list/app_list_constants.h" | 12 #include "ui/app_list/app_list_constants.h" |
| 12 #include "ui/app_list/app_list_switches.h" | 13 #include "ui/app_list/app_list_switches.h" |
| 13 #include "ui/app_list/app_list_view_delegate.h" | 14 #include "ui/app_list/app_list_view_delegate.h" |
| 14 #include "ui/app_list/views/app_list_folder_view.h" | 15 #include "ui/app_list/views/app_list_folder_view.h" |
| 15 #include "ui/app_list/views/app_list_main_view.h" | 16 #include "ui/app_list/views/app_list_main_view.h" |
| 16 #include "ui/app_list/views/apps_container_view.h" | 17 #include "ui/app_list/views/apps_container_view.h" |
| 17 #include "ui/app_list/views/apps_grid_view.h" | 18 #include "ui/app_list/views/apps_grid_view.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 pagination_model_.RemoveObserver(this); | 50 pagination_model_.RemoveObserver(this); |
| 50 if (contents_switcher_view_) | 51 if (contents_switcher_view_) |
| 51 pagination_model_.RemoveObserver(contents_switcher_view_); | 52 pagination_model_.RemoveObserver(contents_switcher_view_); |
| 52 } | 53 } |
| 53 | 54 |
| 54 void ContentsView::InitNamedPages(AppListModel* model, | 55 void ContentsView::InitNamedPages(AppListModel* model, |
| 55 AppListViewDelegate* view_delegate) { | 56 AppListViewDelegate* view_delegate) { |
| 56 DCHECK(model); | 57 DCHECK(model); |
| 57 | 58 |
| 58 if (app_list::switches::IsExperimentalAppListEnabled()) { | 59 if (app_list::switches::IsExperimentalAppListEnabled()) { |
| 59 views::View* custom_page_view = | 60 std::vector<views::View*> custom_page_views = |
| 60 view_delegate->CreateCustomPageWebView(GetLocalBounds().size()); | 61 view_delegate->CreateCustomPageWebViews(GetLocalBounds().size()); |
| 61 if (custom_page_view) | 62 for (std::vector<views::View*>::const_iterator it = |
| 62 AddLauncherPage(custom_page_view, IDR_APP_LIST_NOTIFICATIONS_ICON); | 63 custom_page_views.begin(); |
| 64 it != custom_page_views.end(); |
| 65 ++it) { |
| 66 AddLauncherPage(*it, IDR_APP_LIST_NOTIFICATIONS_ICON); |
| 67 } |
| 63 | 68 |
| 64 start_page_view_ = new StartPageView(app_list_main_view_, view_delegate); | 69 start_page_view_ = new StartPageView(app_list_main_view_, view_delegate); |
| 65 AddLauncherPage( | 70 AddLauncherPage( |
| 66 start_page_view_, IDR_APP_LIST_SEARCH_ICON, NAMED_PAGE_START); | 71 start_page_view_, IDR_APP_LIST_SEARCH_ICON, NAMED_PAGE_START); |
| 67 } else { | 72 } else { |
| 68 search_results_view_ = | 73 search_results_view_ = |
| 69 new SearchResultListView(app_list_main_view_, view_delegate); | 74 new SearchResultListView(app_list_main_view_, view_delegate); |
| 70 AddLauncherPage(search_results_view_, 0, NAMED_PAGE_SEARCH_RESULTS); | 75 AddLauncherPage(search_results_view_, 0, NAMED_PAGE_SEARCH_RESULTS); |
| 71 search_results_view_->SetResults(model->results()); | 76 search_results_view_->SetResults(model->results()); |
| 72 } | 77 } |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 if (std::abs(offset) > kMinScrollToSwitchPage) { | 398 if (std::abs(offset) > kMinScrollToSwitchPage) { |
| 394 if (!GetAppsPaginationModel()->has_transition()) { | 399 if (!GetAppsPaginationModel()->has_transition()) { |
| 395 GetAppsPaginationModel()->SelectPageRelative(offset > 0 ? -1 : 1, true); | 400 GetAppsPaginationModel()->SelectPageRelative(offset > 0 ? -1 : 1, true); |
| 396 } | 401 } |
| 397 event->SetHandled(); | 402 event->SetHandled(); |
| 398 event->StopPropagation(); | 403 event->StopPropagation(); |
| 399 } | 404 } |
| 400 } | 405 } |
| 401 | 406 |
| 402 } // namespace app_list | 407 } // namespace app_list |
| OLD | NEW |