| 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/bind.h" | 10 #include "base/bind.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |