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

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

Issue 2787693002: Remove more dead app list code. (Closed)
Patch Set: updated comment Created 3 years, 8 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 | « ui/app_list/app_list_model.h ('k') | ui/app_list/app_list_switches.cc » ('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 #include <utility> 8 #include <utility>
9 9
10 #include "ui/app_list/app_list_folder_item.h" 10 #include "ui/app_list/app_list_folder_item.h"
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 285
286 // crbug.com/368111: Upon uninstall of 2nd-to-last folder item, reparent last 286 // crbug.com/368111: Upon uninstall of 2nd-to-last folder item, reparent last
287 // item to top; this will remove the folder. 287 // item to top; this will remove the folder.
288 AppListFolderItem* folder = FindFolderItem(folder_id); 288 AppListFolderItem* folder = FindFolderItem(folder_id);
289 if (folder && folder->ChildItemCount() == 1u) { 289 if (folder && folder->ChildItemCount() == 1u) {
290 AppListItem* last_item = folder->item_list()->item_at(0); 290 AppListItem* last_item = folder->item_list()->item_at(0);
291 MoveItemToFolderAt(last_item, "", folder->position()); 291 MoveItemToFolderAt(last_item, "", folder->position());
292 } 292 }
293 } 293 }
294 294
295 void AppListModel::NotifyExtensionPreferenceChanged() {
296 for (size_t i = 0; i < top_level_item_list_->item_count(); ++i)
297 top_level_item_list_->item_at(i)->OnExtensionPreferenceChanged();
298 }
299
300 void AppListModel::SetFoldersEnabled(bool folders_enabled) { 295 void AppListModel::SetFoldersEnabled(bool folders_enabled) {
301 folders_enabled_ = folders_enabled; 296 folders_enabled_ = folders_enabled;
302 if (folders_enabled) 297 if (folders_enabled)
303 return; 298 return;
304 // Remove child items from folders. 299 // Remove child items from folders.
305 std::vector<std::string> folder_ids; 300 std::vector<std::string> folder_ids;
306 for (size_t i = 0; i < top_level_item_list_->item_count(); ++i) { 301 for (size_t i = 0; i < top_level_item_list_->item_count(); ++i) {
307 AppListItem* item = top_level_item_list_->item_at(i); 302 AppListItem* item = top_level_item_list_->item_at(i);
308 if (item->GetItemType() != AppListFolderItem::kItemType) 303 if (item->GetItemType() != AppListFolderItem::kItemType)
309 continue; 304 continue;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 folder->item_list()->RemoveItem(item->id()); 440 folder->item_list()->RemoveItem(item->id());
446 result->set_folder_id(""); 441 result->set_folder_id("");
447 if (folder->item_list()->item_count() == 0) { 442 if (folder->item_list()->item_count() == 0) {
448 DVLOG(2) << "Deleting empty folder: " << folder->ToDebugString(); 443 DVLOG(2) << "Deleting empty folder: " << folder->ToDebugString();
449 DeleteItem(folder_id); 444 DeleteItem(folder_id);
450 } 445 }
451 return result; 446 return result;
452 } 447 }
453 448
454 } // namespace app_list 449 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/app_list_model.h ('k') | ui/app_list/app_list_switches.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698