Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: ui/app_list/app_list_item_list.cc

Issue 592983002: Fix Mac App Launcher observer lifetime on AppListItemList (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: leave disabled due to other flakiness Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/app_list/app_list_service_mac.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/app_list_item_list.h" 5 #include "ui/app_list/app_list_item_list.h"
6 6
7 #include "ui/app_list/app_list_item.h" 7 #include "ui/app_list/app_list_item.h"
8 8
9 namespace app_list { 9 namespace app_list {
10 10
11 AppListItemList::AppListItemList() { 11 AppListItemList::AppListItemList() {
12 } 12 }
13 13
14 AppListItemList::~AppListItemList() { 14 AppListItemList::~AppListItemList() {
15 } 15 }
16 16
17 void AppListItemList::AddObserver(AppListItemListObserver* observer) { 17 void AppListItemList::AddObserver(AppListItemListObserver* observer) {
18 observers_.AddObserver(observer); 18 observers_.AddObserver(observer);
19 } 19 }
20 20
21 void AppListItemList::RemoveObserver(AppListItemListObserver* observer) { 21 void AppListItemList::RemoveObserver(AppListItemListObserver* observer) {
22 DCHECK(observers_.HasObserver(observer));
22 observers_.RemoveObserver(observer); 23 observers_.RemoveObserver(observer);
23 } 24 }
24 25
25 AppListItem* AppListItemList::FindItem(const std::string& id) { 26 AppListItem* AppListItemList::FindItem(const std::string& id) {
26 for (size_t i = 0; i < app_list_items_.size(); ++i) { 27 for (size_t i = 0; i < app_list_items_.size(); ++i) {
27 AppListItem* item = app_list_items_[i]; 28 AppListItem* item = app_list_items_[i];
28 if (item->id() == id) 29 if (item->id() == id)
29 return item; 30 return item;
30 } 31 }
31 return NULL; 32 return NULL;
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 else 237 else
237 cur->set_position(prev->position().CreateAfter()); 238 cur->set_position(prev->position().CreateAfter());
238 prev = cur; 239 prev = cur;
239 } 240 }
240 FOR_EACH_OBSERVER(AppListItemListObserver, 241 FOR_EACH_OBSERVER(AppListItemListObserver,
241 observers_, 242 observers_,
242 OnListItemMoved(index, index, app_list_items_[index])); 243 OnListItemMoved(index, index, app_list_items_[index]));
243 } 244 }
244 245
245 } // namespace app_list 246 } // namespace app_list
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/app_list_service_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698