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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 if (icon_loading_wait_timer_.IsRunning()) | 144 if (icon_loading_wait_timer_.IsRunning()) |
145 return; | 145 return; |
146 | 146 |
147 icon_loading_wait_timer_.Start( | 147 icon_loading_wait_timer_.Start( |
148 FROM_HERE, | 148 FROM_HERE, |
149 base::TimeDelta::FromMilliseconds(kMaxIconLoadingWaitTimeInMs), | 149 base::TimeDelta::FromMilliseconds(kMaxIconLoadingWaitTimeInMs), |
150 this, &AppListMainView::OnIconLoadingWaitTimer); | 150 this, &AppListMainView::OnIconLoadingWaitTimer); |
151 } | 151 } |
152 | 152 |
153 void AppListMainView::ResetForShow() { | 153 void AppListMainView::ResetForShow() { |
154 if (switches::IsExperimentalAppListEnabled()) | 154 contents_view_->SetActiveState(AppListModel::STATE_START); |
155 contents_view_->SetActiveState(AppListModel::STATE_START); | |
156 | |
157 contents_view_->apps_container_view()->ResetForShowApps(); | 155 contents_view_->apps_container_view()->ResetForShowApps(); |
158 // We clear the search when hiding so when app list appears it is not showing | 156 // We clear the search when hiding so when app list appears it is not showing |
159 // search results. | 157 // search results. |
160 search_box_view_->ClearSearch(); | 158 search_box_view_->ClearSearch(); |
161 } | 159 } |
162 | 160 |
163 void AppListMainView::Close() { | 161 void AppListMainView::Close() { |
164 icon_loading_wait_timer_.Stop(); | 162 icon_loading_wait_timer_.Stop(); |
165 contents_view_->CancelDrag(); | 163 contents_view_->CancelDrag(); |
166 } | 164 } |
167 | 165 |
168 void AppListMainView::ModelChanged() { | 166 void AppListMainView::ModelChanged() { |
169 pending_icon_loaders_.clear(); | 167 pending_icon_loaders_.clear(); |
170 model_->RemoveObserver(this); | 168 model_->RemoveObserver(this); |
171 model_ = delegate_->GetModel(); | 169 model_ = delegate_->GetModel(); |
172 model_->AddObserver(this); | 170 model_->AddObserver(this); |
173 search_box_view_->ModelChanged(); | 171 search_box_view_->ModelChanged(); |
174 delete contents_view_; | 172 delete contents_view_; |
175 contents_view_ = NULL; | 173 contents_view_ = NULL; |
176 AddContentsViews(); | 174 AddContentsViews(); |
177 Layout(); | 175 Layout(); |
178 } | 176 } |
179 | 177 |
180 void AppListMainView::SetDragAndDropHostOfCurrentAppList( | 178 void AppListMainView::SetDragAndDropHostOfCurrentAppList( |
181 ApplicationDragAndDropHost* drag_and_drop_host) { | 179 ApplicationDragAndDropHost* drag_and_drop_host) { |
182 contents_view_->SetDragAndDropHostOfCurrentAppList(drag_and_drop_host); | 180 contents_view_->SetDragAndDropHostOfCurrentAppList(drag_and_drop_host); |
183 } | 181 } |
184 | 182 |
185 bool AppListMainView::ShouldCenterWindow() const { | |
186 return delegate_->ShouldCenterWindow(); | |
187 } | |
188 | |
189 PaginationModel* AppListMainView::GetAppsPaginationModel() { | 183 PaginationModel* AppListMainView::GetAppsPaginationModel() { |
190 return contents_view_->apps_container_view() | 184 return contents_view_->apps_container_view() |
191 ->apps_grid_view() | 185 ->apps_grid_view() |
192 ->pagination_model(); | 186 ->pagination_model(); |
193 } | 187 } |
194 | 188 |
195 void AppListMainView::PreloadIcons(gfx::NativeView parent) { | 189 void AppListMainView::PreloadIcons(gfx::NativeView parent) { |
196 float scale_factor = 1.0f; | 190 float scale_factor = 1.0f; |
197 if (parent) | 191 if (parent) |
198 scale_factor = ui::GetScaleFactorForNativeView(parent); | 192 scale_factor = ui::GetScaleFactorForNativeView(parent); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 contents_view_->search_results_page_view()->SetSelection(select); | 312 contents_view_->search_results_page_view()->SetSelection(select); |
319 } | 313 } |
320 | 314 |
321 void AppListMainView::OnResultInstalled(SearchResult* result) { | 315 void AppListMainView::OnResultInstalled(SearchResult* result) { |
322 // Clears the search to show the apps grid. The last installed app | 316 // Clears the search to show the apps grid. The last installed app |
323 // should be highlighted and made visible already. | 317 // should be highlighted and made visible already. |
324 search_box_view_->ClearSearch(); | 318 search_box_view_->ClearSearch(); |
325 } | 319 } |
326 | 320 |
327 } // namespace app_list | 321 } // namespace app_list |
OLD | NEW |