| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 // We clear the search when hiding so when app list appears it is not showing | 153 // We clear the search when hiding so when app list appears it is not showing |
| 154 // search results. | 154 // search results. |
| 155 search_box_view_->ClearSearch(); | 155 search_box_view_->ClearSearch(); |
| 156 } | 156 } |
| 157 | 157 |
| 158 void AppListMainView::Close() { | 158 void AppListMainView::Close() { |
| 159 icon_loading_wait_timer_.Stop(); | 159 icon_loading_wait_timer_.Stop(); |
| 160 contents_view_->CancelDrag(); | 160 contents_view_->CancelDrag(); |
| 161 } | 161 } |
| 162 | 162 |
| 163 void AppListMainView::Prerender() { | |
| 164 contents_view_->Prerender(); | |
| 165 } | |
| 166 | |
| 167 void AppListMainView::ModelChanged() { | 163 void AppListMainView::ModelChanged() { |
| 168 pending_icon_loaders_.clear(); | 164 pending_icon_loaders_.clear(); |
| 169 model_->RemoveObserver(this); | 165 model_->RemoveObserver(this); |
| 170 model_ = delegate_->GetModel(); | 166 model_ = delegate_->GetModel(); |
| 171 model_->AddObserver(this); | 167 model_->AddObserver(this); |
| 172 search_box_view_->ModelChanged(); | 168 search_box_view_->ModelChanged(); |
| 173 delete contents_view_; | 169 delete contents_view_; |
| 174 contents_view_ = NULL; | 170 contents_view_ = NULL; |
| 175 AddContentsViews(); | 171 AddContentsViews(); |
| 176 Layout(); | 172 Layout(); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 } | 281 } |
| 286 | 282 |
| 287 void AppListMainView::ActivateApp(AppListItem* item, int event_flags) { | 283 void AppListMainView::ActivateApp(AppListItem* item, int event_flags) { |
| 288 // TODO(jennyz): Activate the folder via AppListModel notification. | 284 // TODO(jennyz): Activate the folder via AppListModel notification. |
| 289 if (item->GetItemType() == AppListFolderItem::kItemType) | 285 if (item->GetItemType() == AppListFolderItem::kItemType) |
| 290 contents_view_->ShowFolderContent(static_cast<AppListFolderItem*>(item)); | 286 contents_view_->ShowFolderContent(static_cast<AppListFolderItem*>(item)); |
| 291 else | 287 else |
| 292 item->Activate(event_flags); | 288 item->Activate(event_flags); |
| 293 } | 289 } |
| 294 | 290 |
| 295 void AppListMainView::GetShortcutPathForApp( | |
| 296 const std::string& app_id, | |
| 297 const base::Callback<void(const base::FilePath&)>& callback) { | |
| 298 delegate_->GetShortcutPathForApp(app_id, callback); | |
| 299 } | |
| 300 | |
| 301 void AppListMainView::CancelDragInActiveFolder() { | 291 void AppListMainView::CancelDragInActiveFolder() { |
| 302 contents_view_->apps_container_view() | 292 contents_view_->apps_container_view() |
| 303 ->app_list_folder_view() | 293 ->app_list_folder_view() |
| 304 ->items_grid_view() | 294 ->items_grid_view() |
| 305 ->EndDrag(true); | 295 ->EndDrag(true); |
| 306 } | 296 } |
| 307 | 297 |
| 308 void AppListMainView::QueryChanged(SearchBoxView* sender) { | 298 void AppListMainView::QueryChanged(SearchBoxView* sender) { |
| 309 base::string16 query; | 299 base::string16 query; |
| 310 base::TrimWhitespace(model_->search_box()->text(), base::TRIM_ALL, &query); | 300 base::TrimWhitespace(model_->search_box()->text(), base::TRIM_ALL, &query); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 323 contents_view_->search_results_page_view()->SetSelection(select); | 313 contents_view_->search_results_page_view()->SetSelection(select); |
| 324 } | 314 } |
| 325 | 315 |
| 326 void AppListMainView::OnResultInstalled(SearchResult* result) { | 316 void AppListMainView::OnResultInstalled(SearchResult* result) { |
| 327 // Clears the search to show the apps grid. The last installed app | 317 // Clears the search to show the apps grid. The last installed app |
| 328 // should be highlighted and made visible already. | 318 // should be highlighted and made visible already. |
| 329 search_box_view_->ClearSearch(); | 319 search_box_view_->ClearSearch(); |
| 330 } | 320 } |
| 331 | 321 |
| 332 } // namespace app_list | 322 } // namespace app_list |
| OLD | NEW |