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/apps_model_builder.h" | 5 #include "chrome/browser/ui/app_list/apps_model_builder.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 } | 201 } |
202 case chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED: { | 202 case chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED: { |
203 ResortApps(); | 203 ResortApps(); |
204 break; | 204 break; |
205 } | 205 } |
206 case chrome::NOTIFICATION_APP_INSTALLED_TO_APPLIST: { | 206 case chrome::NOTIFICATION_APP_INSTALLED_TO_APPLIST: { |
207 highlight_app_id_ = *content::Details<const std::string>(details).ptr(); | 207 highlight_app_id_ = *content::Details<const std::string>(details).ptr(); |
208 HighlightApp(); | 208 HighlightApp(); |
209 break; | 209 break; |
210 } | 210 } |
211 case chrome::NOTIFICATION_PREF_CHANGED: { | |
212 ResortApps(); | |
213 break; | |
214 } | |
215 default: | 211 default: |
216 NOTREACHED(); | 212 NOTREACHED(); |
217 } | 213 } |
218 } | 214 } |
219 | 215 |
| 216 void AppsModelBuilder::OnPreferenceChanged(PrefServiceBase* service, |
| 217 const std::string& pref_name) { |
| 218 ResortApps(); |
| 219 } |
| 220 |
220 void AppsModelBuilder::ListItemsAdded(size_t start, size_t count) { | 221 void AppsModelBuilder::ListItemsAdded(size_t start, size_t count) { |
221 } | 222 } |
222 | 223 |
223 void AppsModelBuilder::ListItemsRemoved(size_t start, size_t count) { | 224 void AppsModelBuilder::ListItemsRemoved(size_t start, size_t count) { |
224 } | 225 } |
225 | 226 |
226 void AppsModelBuilder::ListItemMoved(size_t index, size_t target_index) { | 227 void AppsModelBuilder::ListItemMoved(size_t index, size_t target_index) { |
227 if (ignore_changes_) | 228 if (ignore_changes_) |
228 return; | 229 return; |
229 | 230 |
230 ExtensionAppItem* prev = target_index > 0 ? GetAppAt(target_index - 1) : NULL; | 231 ExtensionAppItem* prev = target_index > 0 ? GetAppAt(target_index - 1) : NULL; |
231 ExtensionAppItem* next = target_index + 1 < model_->item_count() ? | 232 ExtensionAppItem* next = target_index + 1 < model_->item_count() ? |
232 GetAppAt(target_index + 1) : NULL; | 233 GetAppAt(target_index + 1) : NULL; |
233 GetAppAt(target_index)->Move(prev, next); | 234 GetAppAt(target_index)->Move(prev, next); |
234 } | 235 } |
235 | 236 |
236 void AppsModelBuilder::ListItemsChanged(size_t start, size_t count) { | 237 void AppsModelBuilder::ListItemsChanged(size_t start, size_t count) { |
237 NOTREACHED(); | 238 NOTREACHED(); |
238 } | 239 } |
OLD | NEW |