OLD | NEW |
---|---|
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/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
153 (*app)->is_platform_app())); | 153 (*app)->is_platform_app())); |
154 } | 154 } |
155 } | 155 } |
156 | 156 |
157 void ExtensionAppModelBuilder::SwitchProfile(Profile* profile) { | 157 void ExtensionAppModelBuilder::SwitchProfile(Profile* profile) { |
158 if (profile_ == profile) | 158 if (profile_ == profile) |
159 return; | 159 return; |
160 profile_ = profile; | 160 profile_ = profile; |
161 | 161 |
162 // Delete any extension apps. | 162 // Delete any extension apps. |
163 app_list::AppListModel::Apps* app_list = model_->apps(); | 163 for (int p = static_cast<int>(model_->GetNumAppPages()) - 1; p >= 0; --p) { |
164 for (int i = static_cast<int>(app_list->item_count()) - 1; i >= 0; --i) { | 164 const app_list::AppListModel::AppItems& app_list = model_->GetAppItems(p); |
165 app_list::AppListItemModel* item = app_list->GetItemAt(i); | 165 for (int i = static_cast<int>(app_list.item_count()) - 1; i >= 0; --i) { |
166 if (item->GetAppType() == ExtensionAppItem::kAppType) | 166 const app_list::AppListItemModel* item = app_list.GetItemAt(i); |
167 app_list->DeleteAt(i); | 167 if (item->GetAppType() == ExtensionAppItem::kAppType) |
168 model_->DeleteItemAt(0, i); | |
koz (OOO until 15th September)
2013/10/18 05:17:17
Should this be DeleteItemAt(p, i) ?
Also, why do
stevenjb
2013/10/18 22:14:26
Yes, thanks. Done.
This code will require some re
| |
169 } | |
168 } | 170 } |
169 | 171 |
170 if (tracker_) | 172 if (tracker_) |
171 tracker_->RemoveObserver(this); | 173 tracker_->RemoveObserver(this); |
172 | 174 |
173 if (extensions::ExtensionSystem::Get(profile_)->extension_service()) | 175 if (extensions::ExtensionSystem::Get(profile_)->extension_service()) |
174 tracker_ = extensions::InstallTrackerFactory::GetForProfile(profile_); | 176 tracker_ = extensions::InstallTrackerFactory::GetForProfile(profile_); |
175 else | 177 else |
176 tracker_ = NULL; | 178 tracker_ = NULL; |
177 | 179 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
232 void ExtensionAppModelBuilder::UpdateHighlight() { | 234 void ExtensionAppModelBuilder::UpdateHighlight() { |
233 DCHECK(model_); | 235 DCHECK(model_); |
234 if (!highlighted_app_pending_ || highlight_app_id_.empty()) | 236 if (!highlighted_app_pending_ || highlight_app_id_.empty()) |
235 return; | 237 return; |
236 ExtensionAppItem* item = GetExtensionAppItem(highlight_app_id_); | 238 ExtensionAppItem* item = GetExtensionAppItem(highlight_app_id_); |
237 if (!item) | 239 if (!item) |
238 return; | 240 return; |
239 item->SetHighlighted(true); | 241 item->SetHighlighted(true); |
240 highlighted_app_pending_ = false; | 242 highlighted_app_pending_ = false; |
241 } | 243 } |
OLD | NEW |