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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 AppListItem* item, | 50 AppListItem* item, |
51 float scale) | 51 float scale) |
52 : owner_(owner), | 52 : owner_(owner), |
53 item_(item) { | 53 item_(item) { |
54 item_->AddObserver(this); | 54 item_->AddObserver(this); |
55 | 55 |
56 // Triggers icon loading for given |scale_factor|. | 56 // Triggers icon loading for given |scale_factor|. |
57 item_->icon().GetRepresentation(scale); | 57 item_->icon().GetRepresentation(scale); |
58 } | 58 } |
59 | 59 |
60 virtual ~IconLoader() { | 60 ~IconLoader() override { item_->RemoveObserver(this); } |
61 item_->RemoveObserver(this); | |
62 } | |
63 | 61 |
64 private: | 62 private: |
65 // AppListItemObserver overrides: | 63 // AppListItemObserver overrides: |
66 virtual void ItemIconChanged() override { | 64 void ItemIconChanged() override { |
67 owner_->OnItemIconLoaded(this); | 65 owner_->OnItemIconLoaded(this); |
68 // Note that IconLoader is released here. | 66 // Note that IconLoader is released here. |
69 } | 67 } |
70 | 68 |
71 AppListMainView* owner_; | 69 AppListMainView* owner_; |
72 AppListItem* item_; | 70 AppListItem* item_; |
73 | 71 |
74 DISALLOW_COPY_AND_ASSIGN(IconLoader); | 72 DISALLOW_COPY_AND_ASSIGN(IconLoader); |
75 }; | 73 }; |
76 | 74 |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 // Resubmit the query via a posted task so that all observers for the | 302 // Resubmit the query via a posted task so that all observers for the |
305 // uninstall notification are notified. | 303 // uninstall notification are notified. |
306 base::MessageLoop::current()->PostTask( | 304 base::MessageLoop::current()->PostTask( |
307 FROM_HERE, | 305 FROM_HERE, |
308 base::Bind(&AppListMainView::QueryChanged, | 306 base::Bind(&AppListMainView::QueryChanged, |
309 weak_ptr_factory_.GetWeakPtr(), | 307 weak_ptr_factory_.GetWeakPtr(), |
310 search_box_view_)); | 308 search_box_view_)); |
311 } | 309 } |
312 | 310 |
313 } // namespace app_list | 311 } // namespace app_list |
OLD | NEW |