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

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

Issue 20656002: Add profile selector menu to app list. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, remove dead code in app_list_menu_views, add ui assets Created 7 years, 3 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/apps_model_builder.h" 5 #include "chrome/browser/ui/app_list/apps_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/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 if (ShouldDisplayInAppLauncher(profile_, *app)) 165 if (ShouldDisplayInAppLauncher(profile_, *app))
166 apps->push_back(new ExtensionAppItem(profile_, 166 apps->push_back(new ExtensionAppItem(profile_,
167 (*app)->id(), 167 (*app)->id(),
168 controller_, 168 controller_,
169 "", 169 "",
170 gfx::ImageSkia(), 170 gfx::ImageSkia(),
171 (*app)->is_platform_app())); 171 (*app)->is_platform_app()));
172 } 172 }
173 } 173 }
174 174
175 void AppsModelBuilder::SetProfile(Profile* profile) {
176 profile_ = profile;
177 model_->DeleteAll();
178 if (tracker_) {
179 tracker_->RemoveObserver(this);
180 tracker_ = extensions::InstallTrackerFactory::GetForProfile(profile_);
koz (OOO until 15th September) 2013/09/09 22:58:07 It's a bit tricky that we have tracker_->RemoveObs
calamity 2013/09/10 22:50:46 Removed the Build() method and changed SetProfile(
181 }
182 Build();
183 }
184
175 void AppsModelBuilder::PopulateApps() { 185 void AppsModelBuilder::PopulateApps() {
176 ExtensionService* service = 186 ExtensionService* service =
177 extensions::ExtensionSystem::Get(profile_)->extension_service(); 187 extensions::ExtensionSystem::Get(profile_)->extension_service();
178 if (!service) 188 if (!service)
179 return; 189 return;
180 190
181 Apps apps; 191 Apps apps;
182 AddApps(service->extensions(), &apps); 192 AddApps(service->extensions(), &apps);
183 AddApps(service->disabled_extensions(), &apps); 193 AddApps(service->disabled_extensions(), &apps);
184 AddApps(service->terminated_extensions(), &apps); 194 AddApps(service->terminated_extensions(), &apps);
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 325
316 ExtensionAppItem* prev = target_index > 0 ? GetAppAt(target_index - 1) : NULL; 326 ExtensionAppItem* prev = target_index > 0 ? GetAppAt(target_index - 1) : NULL;
317 ExtensionAppItem* next = target_index + 1 < model_->item_count() ? 327 ExtensionAppItem* next = target_index + 1 < model_->item_count() ?
318 GetAppAt(target_index + 1) : NULL; 328 GetAppAt(target_index + 1) : NULL;
319 GetAppAt(target_index)->Move(prev, next); 329 GetAppAt(target_index)->Move(prev, next);
320 } 330 }
321 331
322 void AppsModelBuilder::ListItemsChanged(size_t start, size_t count) { 332 void AppsModelBuilder::ListItemsChanged(size_t start, size_t count) {
323 NOTREACHED(); 333 NOTREACHED();
324 } 334 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698