| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 // Triggers icon loading for given |scale_factor|. | 62 // Triggers icon loading for given |scale_factor|. |
| 63 item_->icon().GetRepresentation(scale); | 63 item_->icon().GetRepresentation(scale); |
| 64 } | 64 } |
| 65 | 65 |
| 66 ~IconLoader() override { item_->RemoveObserver(this); } | 66 ~IconLoader() override { item_->RemoveObserver(this); } |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 // AppListItemObserver overrides: | 69 // AppListItemObserver overrides: |
| 70 void ItemIconChanged() override { | 70 void ItemIconChanged() override { |
| 71 owner_->OnItemIconLoaded(this); | 71 owner_->OnIconLoaderFinished(this); |
| 72 // Note that IconLoader is released here. | 72 // Note that IconLoader is released here. |
| 73 } | 73 } |
| 74 | 74 |
| 75 void ItemBeingDestroyed() override { |
| 76 owner_->OnIconLoaderFinished(this); |
| 77 // Note that IconLoader is released here. |
| 78 } |
| 79 |
| 75 AppListMainView* owner_; | 80 AppListMainView* owner_; |
| 76 AppListItem* item_; | 81 AppListItem* item_; |
| 77 | 82 |
| 78 DISALLOW_COPY_AND_ASSIGN(IconLoader); | 83 DISALLOW_COPY_AND_ASSIGN(IconLoader); |
| 79 }; | 84 }; |
| 80 | 85 |
| 81 //////////////////////////////////////////////////////////////////////////////// | 86 //////////////////////////////////////////////////////////////////////////////// |
| 82 // AppListMainView: | 87 // AppListMainView: |
| 83 | 88 |
| 84 AppListMainView::AppListMainView(AppListViewDelegate* delegate) | 89 AppListMainView::AppListMainView(AppListViewDelegate* delegate) |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 continue; | 223 continue; |
| 219 | 224 |
| 220 pending_icon_loaders_.push_back(new IconLoader(this, item, scale_factor)); | 225 pending_icon_loaders_.push_back(new IconLoader(this, item, scale_factor)); |
| 221 } | 226 } |
| 222 } | 227 } |
| 223 | 228 |
| 224 void AppListMainView::OnIconLoadingWaitTimer() { | 229 void AppListMainView::OnIconLoadingWaitTimer() { |
| 225 GetWidget()->Show(); | 230 GetWidget()->Show(); |
| 226 } | 231 } |
| 227 | 232 |
| 228 void AppListMainView::OnItemIconLoaded(IconLoader* loader) { | 233 void AppListMainView::OnIconLoaderFinished(IconLoader* loader) { |
| 229 ScopedVector<IconLoader>::iterator it = std::find( | 234 ScopedVector<IconLoader>::iterator it = std::find( |
| 230 pending_icon_loaders_.begin(), pending_icon_loaders_.end(), loader); | 235 pending_icon_loaders_.begin(), pending_icon_loaders_.end(), loader); |
| 231 DCHECK(it != pending_icon_loaders_.end()); | 236 DCHECK(it != pending_icon_loaders_.end()); |
| 232 pending_icon_loaders_.erase(it); | 237 pending_icon_loaders_.erase(it); |
| 233 | 238 |
| 234 if (pending_icon_loaders_.empty() && icon_loading_wait_timer_.IsRunning()) { | 239 if (pending_icon_loaders_.empty() && icon_loading_wait_timer_.IsRunning()) { |
| 235 icon_loading_wait_timer_.Stop(); | 240 icon_loading_wait_timer_.Stop(); |
| 236 GetWidget()->Show(); | 241 GetWidget()->Show(); |
| 237 } | 242 } |
| 238 } | 243 } |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 contents_view_->search_results_page_view()->SetSelection(select); | 328 contents_view_->search_results_page_view()->SetSelection(select); |
| 324 } | 329 } |
| 325 | 330 |
| 326 void AppListMainView::OnResultInstalled(SearchResult* result) { | 331 void AppListMainView::OnResultInstalled(SearchResult* result) { |
| 327 // Clears the search to show the apps grid. The last installed app | 332 // Clears the search to show the apps grid. The last installed app |
| 328 // should be highlighted and made visible already. | 333 // should be highlighted and made visible already. |
| 329 search_box_view_->ClearSearch(); | 334 search_box_view_->ClearSearch(); |
| 330 } | 335 } |
| 331 | 336 |
| 332 } // namespace app_list | 337 } // namespace app_list |
| OLD | NEW |