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_->OnItemClosedOrIconLoaded(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_->OnItemClosedOrIconLoaded(this); | |
khmel
2016/08/23 16:26:27
This fix crash reason in my new test and I see thi
| |
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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
214 continue; | 219 continue; |
215 | 220 |
216 pending_icon_loaders_.push_back(new IconLoader(this, item, scale_factor)); | 221 pending_icon_loaders_.push_back(new IconLoader(this, item, scale_factor)); |
217 } | 222 } |
218 } | 223 } |
219 | 224 |
220 void AppListMainView::OnIconLoadingWaitTimer() { | 225 void AppListMainView::OnIconLoadingWaitTimer() { |
221 GetWidget()->Show(); | 226 GetWidget()->Show(); |
222 } | 227 } |
223 | 228 |
224 void AppListMainView::OnItemIconLoaded(IconLoader* loader) { | 229 void AppListMainView::OnItemClosedOrIconLoaded(IconLoader* loader) { |
225 ScopedVector<IconLoader>::iterator it = std::find( | 230 ScopedVector<IconLoader>::iterator it = std::find( |
226 pending_icon_loaders_.begin(), pending_icon_loaders_.end(), loader); | 231 pending_icon_loaders_.begin(), pending_icon_loaders_.end(), loader); |
227 DCHECK(it != pending_icon_loaders_.end()); | 232 DCHECK(it != pending_icon_loaders_.end()); |
228 pending_icon_loaders_.erase(it); | 233 pending_icon_loaders_.erase(it); |
229 | 234 |
230 if (pending_icon_loaders_.empty() && icon_loading_wait_timer_.IsRunning()) { | 235 if (pending_icon_loaders_.empty() && icon_loading_wait_timer_.IsRunning()) { |
231 icon_loading_wait_timer_.Stop(); | 236 icon_loading_wait_timer_.Stop(); |
232 GetWidget()->Show(); | 237 GetWidget()->Show(); |
233 } | 238 } |
234 } | 239 } |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
313 contents_view_->search_results_page_view()->SetSelection(select); | 318 contents_view_->search_results_page_view()->SetSelection(select); |
314 } | 319 } |
315 | 320 |
316 void AppListMainView::OnResultInstalled(SearchResult* result) { | 321 void AppListMainView::OnResultInstalled(SearchResult* result) { |
317 // Clears the search to show the apps grid. The last installed app | 322 // Clears the search to show the apps grid. The last installed app |
318 // should be highlighted and made visible already. | 323 // should be highlighted and made visible already. |
319 search_box_view_->ClearSearch(); | 324 search_box_view_->ClearSearch(); |
320 } | 325 } |
321 | 326 |
322 } // namespace app_list | 327 } // namespace app_list |
OLD | NEW |