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

Side by Side Diff: chrome/browser/ui/app_list/extension_app_model_builder.cc

Issue 981893002: Lazily build the app list model. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix_set_enabled
Patch Set: revert ALSL Created 5 years, 9 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
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 "chrome/browser/ui/app_list/extension_app_model_builder.h" 5 #include "chrome/browser/ui/app_list/extension_app_model_builder.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 } 43 }
44 44
45 ExtensionAppModelBuilder::~ExtensionAppModelBuilder() { 45 ExtensionAppModelBuilder::~ExtensionAppModelBuilder() {
46 OnShutdown(); 46 OnShutdown();
47 OnShutdown(extension_registry_); 47 OnShutdown(extension_registry_);
48 if (!service_) 48 if (!service_)
49 model_->top_level_item_list()->RemoveObserver(this); 49 model_->top_level_item_list()->RemoveObserver(this);
50 } 50 }
51 51
52 void ExtensionAppModelBuilder::InitializeWithService( 52 void ExtensionAppModelBuilder::InitializeWithService(
53 app_list::AppListSyncableService* service) { 53 app_list::AppListSyncableService* service,
54 app_list::AppListModel* model) {
54 DCHECK(!service_ && !profile_); 55 DCHECK(!service_ && !profile_);
55 model_ = service->model(); 56 model_ = model;
56 service_ = service; 57 service_ = service;
57 profile_ = service->profile(); 58 profile_ = service->profile();
58 InitializePrefChangeRegistrars(); 59 InitializePrefChangeRegistrars();
59 60
60 BuildModel(); 61 BuildModel();
61 } 62 }
62 63
63 void ExtensionAppModelBuilder::InitializeWithProfile( 64 void ExtensionAppModelBuilder::InitializeWithProfile(
64 Profile* profile, 65 Profile* profile,
65 app_list::AppListModel* model) { 66 app_list::AppListModel* model) {
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 app_list::AppListItem* item = item_list->item_at(idx + 1); 326 app_list::AppListItem* item = item_list->item_at(idx + 1);
326 if (item->GetItemType() == ExtensionAppItem::kItemType) { 327 if (item->GetItemType() == ExtensionAppItem::kItemType) {
327 next = static_cast<ExtensionAppItem*>(item); 328 next = static_cast<ExtensionAppItem*>(item);
328 break; 329 break;
329 } 330 }
330 } 331 }
331 // item->Move will call set_position, overriding the item's position. 332 // item->Move will call set_position, overriding the item's position.
332 if (prev || next) 333 if (prev || next)
333 static_cast<ExtensionAppItem*>(item)->Move(prev, next); 334 static_cast<ExtensionAppItem*>(item)->Move(prev, next);
334 } 335 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698