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/callback.h" | 9 #include "base/callback.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 search_box_view_(NULL), | 83 search_box_view_(NULL), |
84 contents_view_(NULL) { | 84 contents_view_(NULL) { |
85 // Starts icon loading early. | 85 // Starts icon loading early. |
86 PreloadIcons(pagination_model, anchor); | 86 PreloadIcons(pagination_model, anchor); |
87 | 87 |
88 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, | 88 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, |
89 kInnerPadding, | 89 kInnerPadding, |
90 kInnerPadding, | 90 kInnerPadding, |
91 kInnerPadding)); | 91 kInnerPadding)); |
92 | 92 |
93 search_box_view_ = new SearchBoxView(this, delegate); | 93 search_box_view_ = new SearchBoxView(this, delegate, model_); |
94 AddChildView(search_box_view_); | 94 AddChildView(search_box_view_); |
95 | 95 |
96 contents_view_ = new ContentsView(this, pagination_model); | 96 contents_view_ = new ContentsView(this, pagination_model, model_); |
97 AddChildView(contents_view_); | 97 AddChildView(contents_view_); |
98 | 98 |
99 search_box_view_->set_contents_view(contents_view_); | 99 search_box_view_->set_contents_view(contents_view_); |
100 | 100 |
101 #if defined(USE_AURA) | 101 #if defined(USE_AURA) |
102 contents_view_->SetPaintToLayer(true); | 102 contents_view_->SetPaintToLayer(true); |
103 contents_view_->SetFillsBoundsOpaquely(false); | 103 contents_view_->SetFillsBoundsOpaquely(false); |
104 contents_view_->layer()->SetMasksToBounds(true); | 104 contents_view_->layer()->SetMasksToBounds(true); |
105 #endif | 105 #endif |
106 | |
107 search_box_view_->SetModel(model_->search_box()); | |
108 contents_view_->SetModel(model_); | |
109 } | 106 } |
110 | 107 |
111 AppListMainView::~AppListMainView() { | 108 AppListMainView::~AppListMainView() { |
112 pending_icon_loaders_.clear(); | 109 pending_icon_loaders_.clear(); |
113 } | 110 } |
114 | 111 |
115 void AppListMainView::ShowAppListWhenReady() { | 112 void AppListMainView::ShowAppListWhenReady() { |
116 if (pending_icon_loaders_.empty()) { | 113 if (pending_icon_loaders_.empty()) { |
117 icon_loading_wait_timer_.Stop(); | 114 icon_loading_wait_timer_.Stop(); |
118 GetWidget()->Show(); | 115 GetWidget()->Show(); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 delegate_->InvokeSearchResultAction(result, action_index, event_flags); | 223 delegate_->InvokeSearchResultAction(result, action_index, event_flags); |
227 } | 224 } |
228 | 225 |
229 void AppListMainView::OnResultInstalled(SearchResult* result) { | 226 void AppListMainView::OnResultInstalled(SearchResult* result) { |
230 // Clears the search to show the apps grid. The last installed app | 227 // Clears the search to show the apps grid. The last installed app |
231 // should be highlighted and made visible already. | 228 // should be highlighted and made visible already. |
232 search_box_view_->ClearSearch(); | 229 search_box_view_->ClearSearch(); |
233 } | 230 } |
234 | 231 |
235 } // namespace app_list | 232 } // namespace app_list |
OLD | NEW |