Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: chrome/browser/apps/ephemeral_app_service.cc

Issue 284103002: Replace "external_install" boolean parameter with explicit enumeration in ExtensionUninstall method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address issue exposed by failing unit test. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 } 187 }
188 188
189 ExtensionService* service = 189 ExtensionService* service =
190 ExtensionSystem::Get(profile_)->extension_service(); 190 ExtensionSystem::Get(profile_)->extension_service();
191 DCHECK(service); 191 DCHECK(service);
192 // Execute the replacement policies and remove apps marked for deletion. 192 // Execute the replacement policies and remove apps marked for deletion.
193 if (!app_launch_times.empty()) { 193 if (!app_launch_times.empty()) {
194 GetAppsToRemove(app_count, app_launch_times, &remove_app_ids); 194 GetAppsToRemove(app_count, app_launch_times, &remove_app_ids);
195 for (std::set<std::string>::const_iterator id = remove_app_ids.begin(); 195 for (std::set<std::string>::const_iterator id = remove_app_ids.begin();
196 id != remove_app_ids.end(); ++id) { 196 id != remove_app_ids.end(); ++id) {
197 if (service->UninstallExtension(*id, false, NULL)) 197 if (service->UninstallExtension(
198 *id,
199 ExtensionService::UNINSTALL_REASON_ORPHANED_EPHEMERAL_EXTENSION,
200 NULL)) {
198 --app_count; 201 --app_count;
202 }
199 } 203 }
200 } 204 }
201 205
202 ephemeral_app_count_ = app_count; 206 ephemeral_app_count_ = app_count;
203 } 207 }
204 208
205 // static 209 // static
206 void EphemeralAppService::GetAppsToRemove( 210 void EphemeralAppService::GetAppsToRemove(
207 int app_count, 211 int app_count,
208 const LaunchTimeAppMap& app_launch_times, 212 const LaunchTimeAppMap& app_launch_times,
(...skipping 15 matching lines...) Expand all
224 // Remove ephemeral apps that have been inactive for a while or if the cache 228 // Remove ephemeral apps that have been inactive for a while or if the cache
225 // is larger than the desired size. 229 // is larger than the desired size.
226 if (it->first < inactive_threshold || app_count > kMaxEphemeralAppsCount) { 230 if (it->first < inactive_threshold || app_count > kMaxEphemeralAppsCount) {
227 remove_app_ids->insert(it->second); 231 remove_app_ids->insert(it->second);
228 --app_count; 232 --app_count;
229 } else { 233 } else {
230 break; 234 break;
231 } 235 }
232 } 236 }
233 } 237 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698