| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/app_list_main_view.h" | 5 #include "ui/app_list/views/app_list_main_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0))); | 55 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0))); |
| 56 model_->AddObserver(this); | 56 model_->AddObserver(this); |
| 57 } | 57 } |
| 58 | 58 |
| 59 AppListMainView::~AppListMainView() { | 59 AppListMainView::~AppListMainView() { |
| 60 model_->RemoveObserver(this); | 60 model_->RemoveObserver(this); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void AppListMainView::Init(gfx::NativeView parent, | 63 void AppListMainView::Init(gfx::NativeView parent, |
| 64 int initial_apps_page, | 64 int initial_apps_page, |
| 65 SearchBoxView* search_box_view) { | 65 SearchBoxView* search_box_view, |
| 66 AppListView* app_list_view) { |
| 66 search_box_view_ = search_box_view; | 67 search_box_view_ = search_box_view; |
| 68 app_list_view_ = app_list_view; |
| 67 AddContentsViews(); | 69 AddContentsViews(); |
| 68 | 70 |
| 69 // Switch the apps grid view to the specified page. | 71 // Switch the apps grid view to the specified page. |
| 70 app_list::PaginationModel* pagination_model = GetAppsPaginationModel(); | 72 app_list::PaginationModel* pagination_model = GetAppsPaginationModel(); |
| 71 if (pagination_model->is_valid_page(initial_apps_page)) | 73 if (pagination_model->is_valid_page(initial_apps_page)) |
| 72 pagination_model->SelectPage(initial_apps_page, false); | 74 pagination_model->SelectPage(initial_apps_page, false); |
| 73 | 75 |
| 74 OnSearchEngineIsGoogleChanged(model_->search_engine_is_google()); | 76 OnSearchEngineIsGoogleChanged(model_->search_engine_is_google()); |
| 75 } | 77 } |
| 76 | 78 |
| 77 void AppListMainView::AddContentsViews() { | 79 void AppListMainView::AddContentsViews() { |
| 78 DCHECK(search_box_view_); | 80 DCHECK(search_box_view_); |
| 79 | 81 contents_view_ = new ContentsView(this, app_list_view_); |
| 80 contents_view_ = new ContentsView(this); | |
| 81 contents_view_->Init(model_); | 82 contents_view_->Init(model_); |
| 82 AddChildView(contents_view_); | 83 AddChildView(contents_view_); |
| 83 | 84 |
| 84 search_box_view_->set_contents_view(contents_view_); | 85 search_box_view_->set_contents_view(contents_view_); |
| 85 | 86 |
| 86 contents_view_->SetPaintToLayer(); | 87 contents_view_->SetPaintToLayer(); |
| 87 contents_view_->layer()->SetFillsBoundsOpaquely(false); | 88 contents_view_->layer()->SetFillsBoundsOpaquely(false); |
| 88 contents_view_->layer()->SetMasksToBounds(true); | 89 contents_view_->layer()->SetMasksToBounds(true); |
| 89 | 90 |
| 90 // Clear the old query and start search. | 91 // Clear the old query and start search. |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 contents_view_->search_results_page_view()->SetSelection(select); | 214 contents_view_->search_results_page_view()->SetSelection(select); |
| 214 } | 215 } |
| 215 | 216 |
| 216 void AppListMainView::OnResultInstalled(SearchResult* result) { | 217 void AppListMainView::OnResultInstalled(SearchResult* result) { |
| 217 // Clears the search to show the apps grid. The last installed app | 218 // Clears the search to show the apps grid. The last installed app |
| 218 // should be highlighted and made visible already. | 219 // should be highlighted and made visible already. |
| 219 search_box_view_->ClearSearch(); | 220 search_box_view_->ClearSearch(); |
| 220 } | 221 } |
| 221 | 222 |
| 222 } // namespace app_list | 223 } // namespace app_list |
| OLD | NEW |