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

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

Issue 297643002: Add tiles to the experimental app list start page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix mac test Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « ui/app_list/app_list.gyp ('k') | ui/app_list/app_list_model_observer.h » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_model.h" 5 #include "ui/app_list/app_list_model.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "ui/app_list/app_list_folder_item.h" 9 #include "ui/app_list/app_list_folder_item.h"
10 #include "ui/app_list/app_list_item.h" 10 #include "ui/app_list/app_list_item.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 AppListItem* item = FindItem(id); 227 AppListItem* item = FindItem(id);
228 if (!item) 228 if (!item)
229 return; 229 return;
230 if (!item->IsInFolder()) { 230 if (!item->IsInFolder()) {
231 DCHECK_EQ(0u, item->ChildItemCount()) 231 DCHECK_EQ(0u, item->ChildItemCount())
232 << "Invalid call to DeleteItem for item with children: " << id; 232 << "Invalid call to DeleteItem for item with children: " << id;
233 FOR_EACH_OBSERVER(AppListModelObserver, 233 FOR_EACH_OBSERVER(AppListModelObserver,
234 observers_, 234 observers_,
235 OnAppListItemWillBeDeleted(item)); 235 OnAppListItemWillBeDeleted(item));
236 top_level_item_list_->DeleteItem(id); 236 top_level_item_list_->DeleteItem(id);
237 FOR_EACH_OBSERVER(AppListModelObserver, observers_, OnAppListItemDeleted());
237 return; 238 return;
238 } 239 }
239 AppListFolderItem* folder = FindFolderItem(item->folder_id()); 240 AppListFolderItem* folder = FindFolderItem(item->folder_id());
240 DCHECK(folder) << "Folder not found for item: " << item->ToDebugString(); 241 DCHECK(folder) << "Folder not found for item: " << item->ToDebugString();
241 scoped_ptr<AppListItem> child_item = RemoveItemFromFolder(folder, item); 242 scoped_ptr<AppListItem> child_item = RemoveItemFromFolder(folder, item);
242 DCHECK_EQ(item, child_item.get()); 243 DCHECK_EQ(item, child_item.get());
243 FOR_EACH_OBSERVER(AppListModelObserver, 244 FOR_EACH_OBSERVER(AppListModelObserver,
244 observers_, 245 observers_,
245 OnAppListItemWillBeDeleted(item)); 246 OnAppListItemWillBeDeleted(item));
246 child_item.reset(); // Deletes item. 247 child_item.reset(); // Deletes item.
248 FOR_EACH_OBSERVER(AppListModelObserver, observers_, OnAppListItemDeleted());
247 } 249 }
248 250
249 void AppListModel::NotifyExtensionPreferenceChanged() { 251 void AppListModel::NotifyExtensionPreferenceChanged() {
250 for (size_t i = 0; i < top_level_item_list_->item_count(); ++i) 252 for (size_t i = 0; i < top_level_item_list_->item_count(); ++i)
251 top_level_item_list_->item_at(i)->OnExtensionPreferenceChanged(); 253 top_level_item_list_->item_at(i)->OnExtensionPreferenceChanged();
252 } 254 }
253 255
254 // Private methods 256 // Private methods
255 257
256 void AppListModel::OnListItemMoved(size_t from_index, 258 void AppListModel::OnListItemMoved(size_t from_index,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 scoped_ptr<AppListItem> result = folder->item_list()->RemoveItem(item->id()); 329 scoped_ptr<AppListItem> result = folder->item_list()->RemoveItem(item->id());
328 result->set_folder_id(""); 330 result->set_folder_id("");
329 if (folder->item_list()->item_count() == 0) { 331 if (folder->item_list()->item_count() == 0) {
330 DVLOG(2) << "Deleting empty folder: " << folder->ToDebugString(); 332 DVLOG(2) << "Deleting empty folder: " << folder->ToDebugString();
331 DeleteItem(folder_id); 333 DeleteItem(folder_id);
332 } 334 }
333 return result.Pass(); 335 return result.Pass();
334 } 336 }
335 337
336 } // namespace app_list 338 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/app_list.gyp ('k') | ui/app_list/app_list_model_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698