Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / xwalk / application / browser / application_service.cc
index c0395c5..6316ce1 100644 (file)
@@ -223,7 +223,14 @@ bool ApplicationService::Update(const std::string& id,
     return false;
   }
 
-  if (old_application->Version()->CompareTo(
+  if (
+#if defined(OS_TIZEN)
+      // For Tizen WGT package, downgrade to a lower version or reinstall
+      // is permitted when using Tizen WRT, Crosswalk runtime need to follow
+      // this behavior on Tizen platform.
+      package->type() != Package::WGT &&
+#endif
+      old_application->Version()->CompareTo(
           *(new_application->Version())) >= 0) {
     LOG(INFO) << "The version number of new XPK/WGT package "
                  "should be higher than "
@@ -324,18 +331,12 @@ bool ApplicationService::Uninstall(const std::string& id) {
     result = false;
   }
 
-  content::StoragePartition* partition =
-      content::BrowserContext::GetStoragePartitionForSite(
-          runtime_context_, application->GetBaseURLFromApplicationId(id));
-  partition->ClearDataForOrigin(
-      content::StoragePartition::REMOVE_DATA_MASK_ALL,
-      content::StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL,
-      application->URL(),
-      partition->GetURLRequestContext());
-
-  base::FilePath path;
-  PathService::Get(xwalk::DIR_WGT_STORAGE_PATH, &path);
-  RemoveWidgetStorageFiles(path, id);
+  // Clear databases, the directory clean up will happen next time Crosswalk
+  // startup by ApplicationStorageImpl::CollectGarbageApplications.
+  content::BrowserContext::AsyncObliterateStoragePartition(
+      runtime_context_,
+      application->GetBaseURLFromApplicationId(id),
+      base::Bind(&base::DoNothing));
 
   FOR_EACH_OBSERVER(Observer, observers_, OnApplicationUninstalled(id));