| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 if (should_display == does_display) | 107 if (should_display == does_display) |
| 108 continue; | 108 continue; |
| 109 | 109 |
| 110 if (should_display) { | 110 if (should_display) { |
| 111 InsertApp(CreateAppItem((*app)->id(), | 111 InsertApp(CreateAppItem((*app)->id(), |
| 112 "", | 112 "", |
| 113 gfx::ImageSkia(), | 113 gfx::ImageSkia(), |
| 114 (*app)->is_platform_app())); | 114 (*app)->is_platform_app())); |
| 115 } else { | 115 } else { |
| 116 if (service_) | 116 if (service_) |
| 117 service_->RemoveItem((*app)->id()); | 117 service_->RemoveItem((*app)->id(), false); |
| 118 else | 118 else |
| 119 model_->DeleteItem((*app)->id()); | 119 model_->DeleteItem((*app)->id()); |
| 120 } | 120 } |
| 121 } | 121 } |
| 122 } | 122 } |
| 123 | 123 |
| 124 void ExtensionAppModelBuilder::OnExtensionPreferenceChanged() { | 124 void ExtensionAppModelBuilder::OnExtensionPreferenceChanged() { |
| 125 model_->NotifyExtensionPreferenceChanged(); | 125 model_->NotifyExtensionPreferenceChanged(); |
| 126 } | 126 } |
| 127 | 127 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 item->UpdateIcon(); | 198 item->UpdateIcon(); |
| 199 } | 199 } |
| 200 | 200 |
| 201 void ExtensionAppModelBuilder::OnExtensionUninstalled( | 201 void ExtensionAppModelBuilder::OnExtensionUninstalled( |
| 202 content::BrowserContext* browser_context, | 202 content::BrowserContext* browser_context, |
| 203 const extensions::Extension* extension, | 203 const extensions::Extension* extension, |
| 204 extensions::UninstallReason reason) { | 204 extensions::UninstallReason reason) { |
| 205 if (service_) { | 205 if (service_) { |
| 206 DVLOG(2) << service_ << ": OnExtensionUninstalled: " | 206 DVLOG(2) << service_ << ": OnExtensionUninstalled: " |
| 207 << extension->id().substr(0, 8); | 207 << extension->id().substr(0, 8); |
| 208 service_->RemoveItem(extension->id()); | 208 service_->RemoveItem(extension->id(), true); |
| 209 return; | 209 return; |
| 210 } | 210 } |
| 211 model_->DeleteItem(extension->id()); | 211 model_->DeleteUninstalledItem(extension->id()); |
| 212 } | 212 } |
| 213 | 213 |
| 214 void ExtensionAppModelBuilder::OnDisabledExtensionUpdated( | 214 void ExtensionAppModelBuilder::OnDisabledExtensionUpdated( |
| 215 const Extension* extension) { | 215 const Extension* extension) { |
| 216 if (!extensions::ui_util::ShouldDisplayInAppLauncher(extension, profile_)) | 216 if (!extensions::ui_util::ShouldDisplayInAppLauncher(extension, profile_)) |
| 217 return; | 217 return; |
| 218 | 218 |
| 219 ExtensionAppItem* existing_item = GetExtensionAppItem(extension->id()); | 219 ExtensionAppItem* existing_item = GetExtensionAppItem(extension->id()); |
| 220 if (existing_item) | 220 if (existing_item) |
| 221 existing_item->Reload(); | 221 existing_item->Reload(); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 app_list::AppListItem* item = item_list->item_at(idx + 1); | 325 app_list::AppListItem* item = item_list->item_at(idx + 1); |
| 326 if (item->GetItemType() == ExtensionAppItem::kItemType) { | 326 if (item->GetItemType() == ExtensionAppItem::kItemType) { |
| 327 next = static_cast<ExtensionAppItem*>(item); | 327 next = static_cast<ExtensionAppItem*>(item); |
| 328 break; | 328 break; |
| 329 } | 329 } |
| 330 } | 330 } |
| 331 // item->Move will call set_position, overriding the item's position. | 331 // item->Move will call set_position, overriding the item's position. |
| 332 if (prev || next) | 332 if (prev || next) |
| 333 static_cast<ExtensionAppItem*>(item)->Move(prev, next); | 333 static_cast<ExtensionAppItem*>(item)->Move(prev, next); |
| 334 } | 334 } |
| OLD | NEW |