| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/apps/ephemeral_app_service.h" | 5 #include "chrome/browser/apps/ephemeral_app_service.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/apps/ephemeral_app_service_factory.h" | 8 #include "chrome/browser/apps/ephemeral_app_service_factory.h" |
| 9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/extensions/data_deleter.h" | 10 #include "chrome/browser/extensions/data_deleter.h" |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 } | 189 } |
| 190 | 190 |
| 191 ExtensionService* service = | 191 ExtensionService* service = |
| 192 ExtensionSystem::Get(profile_)->extension_service(); | 192 ExtensionSystem::Get(profile_)->extension_service(); |
| 193 DCHECK(service); | 193 DCHECK(service); |
| 194 // Execute the replacement policies and remove apps marked for deletion. | 194 // Execute the replacement policies and remove apps marked for deletion. |
| 195 if (!app_launch_times.empty()) { | 195 if (!app_launch_times.empty()) { |
| 196 GetAppsToRemove(app_count, app_launch_times, &remove_app_ids); | 196 GetAppsToRemove(app_count, app_launch_times, &remove_app_ids); |
| 197 for (std::set<std::string>::const_iterator id = remove_app_ids.begin(); | 197 for (std::set<std::string>::const_iterator id = remove_app_ids.begin(); |
| 198 id != remove_app_ids.end(); ++id) { | 198 id != remove_app_ids.end(); ++id) { |
| 199 if (service->UninstallExtension(*id, false, NULL)) | 199 if (service->UninstallExtension( |
| 200 *id, |
| 201 ExtensionService::kUninstallReasonOrphanedEphemeralExtension, |
| 202 NULL)) { |
| 200 --app_count; | 203 --app_count; |
| 204 } |
| 201 } | 205 } |
| 202 } | 206 } |
| 203 | 207 |
| 204 ephemeral_app_count_ = app_count; | 208 ephemeral_app_count_ = app_count; |
| 205 } | 209 } |
| 206 | 210 |
| 207 // static | 211 // static |
| 208 void EphemeralAppService::GetAppsToRemove( | 212 void EphemeralAppService::GetAppsToRemove( |
| 209 int app_count, | 213 int app_count, |
| 210 const LaunchTimeAppMap& app_launch_times, | 214 const LaunchTimeAppMap& app_launch_times, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 info->extension_id, | 279 info->extension_id, |
| 276 &error)); | 280 &error)); |
| 277 | 281 |
| 278 if (extension.get()) | 282 if (extension.get()) |
| 279 extensions::DataDeleter::StartDeleting(profile_, extension.get()); | 283 extensions::DataDeleter::StartDeleting(profile_, extension.get()); |
| 280 } | 284 } |
| 281 | 285 |
| 282 prefs->RemoveEvictedEphemeralApp(info->extension_id); | 286 prefs->RemoveEvictedEphemeralApp(info->extension_id); |
| 283 } | 287 } |
| 284 } | 288 } |
| OLD | NEW |