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

Side by Side Diff: chrome/browser/extensions/extension_sync_service.cc

Issue 405433003: Apps&Extensions for supervised users: Allow the custodian to remotely uninstall extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: other UNINSTALL_REASON_SYNC occurrences 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 | Annotate | Revision Log
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/extensions/extension_sync_service.h" 5 #include "chrome/browser/extensions/extension_sync_service.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 const Extension* extension = extension_service_->GetInstalledExtension(id); 442 const Extension* extension = extension_service_->GetInstalledExtension(id);
443 443
444 // TODO(bolms): we should really handle this better. The particularly bad 444 // TODO(bolms): we should really handle this better. The particularly bad
445 // case is where an app becomes an extension or vice versa, and we end up with 445 // case is where an app becomes an extension or vice versa, and we end up with
446 // a zombie extension that won't go away. 446 // a zombie extension that won't go away.
447 if (extension && !IsCorrectSyncType(*extension, type)) 447 if (extension && !IsCorrectSyncType(*extension, type))
448 return true; 448 return true;
449 449
450 // Handle uninstalls first. 450 // Handle uninstalls first.
451 if (extension_sync_data.uninstalled()) { 451 if (extension_sync_data.uninstalled()) {
452 if (!extension_service_->UninstallExtensionHelper( 452 ExtensionService::UninstallReason reason =
453 extension_service_, id, ExtensionService::UNINSTALL_REASON_SYNC)) { 453 extension_sync_data.installed_by_custodian() ?
454 LOG(WARNING) << "Could not uninstall extension " << id 454 ExtensionService::UNINSTALL_REASON_SYNC_BY_CUSTODIAN :
455 << " for sync"; 455 ExtensionService::UNINSTALL_REASON_SYNC;
456 if (!extension_service_->UninstallExtensionHelper(extension_service_,
457 id, reason)) {
458 LOG(WARNING) << "Could not uninstall extension " << id << " for sync";
456 } 459 }
457 return true; 460 return true;
458 } 461 }
459 462
460 // Extension from sync was uninstalled by the user as external extensions. 463 // Extension from sync was uninstalled by the user as external extensions.
461 // Honor user choice and skip installation/enabling. 464 // Honor user choice and skip installation/enabling.
462 if (extensions::ExtensionPrefs::Get(profile_) 465 if (extensions::ExtensionPrefs::Get(profile_)
463 ->IsExternalExtensionUninstalled(id)) { 466 ->IsExternalExtensionUninstalled(id)) {
464 LOG(WARNING) << "Extension with id " << id 467 LOG(WARNING) << "Extension with id " << id
465 << " from sync was uninstalled as external extension"; 468 << " from sync was uninstalled as external extension";
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 app_sync_bundle_.SyncChangeIfNeeded(extension); 551 app_sync_bundle_.SyncChangeIfNeeded(extension);
549 else if (extension_service_->is_ready() && !flare_.is_null()) 552 else if (extension_service_->is_ready() && !flare_.is_null())
550 flare_.Run(syncer::APPS); 553 flare_.Run(syncer::APPS);
551 } else if (extensions::util::ShouldSyncExtension(&extension, profile_)) { 554 } else if (extensions::util::ShouldSyncExtension(&extension, profile_)) {
552 if (extension_sync_bundle_.IsSyncing()) 555 if (extension_sync_bundle_.IsSyncing())
553 extension_sync_bundle_.SyncChangeIfNeeded(extension); 556 extension_sync_bundle_.SyncChangeIfNeeded(extension);
554 else if (extension_service_->is_ready() && !flare_.is_null()) 557 else if (extension_service_->is_ready() && !flare_.is_null())
555 flare_.Run(syncer::EXTENSIONS); 558 flare_.Run(syncer::EXTENSIONS);
556 } 559 }
557 } 560 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698