| 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/extensions/data_deleter.h" | 5 #include "chrome/browser/extensions/data_deleter.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/extension_service.h" | 7 #include "chrome/browser/extensions/extension_service.h" |
| 8 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 8 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
| 9 #include "chrome/browser/extensions/extension_util.h" | 9 #include "chrome/browser/extensions/extension_util.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 ExtensionSystem::Get(profile)->extension_service()->AsWeakPtr(), | 93 ExtensionSystem::Get(profile)->extension_service()->AsWeakPtr(), |
| 94 callback)); | 94 callback)); |
| 95 } else { | 95 } else { |
| 96 GURL launch_web_url_origin( | 96 GURL launch_web_url_origin( |
| 97 AppLaunchInfo::GetLaunchWebURL(extension).GetOrigin()); | 97 AppLaunchInfo::GetLaunchWebURL(extension).GetOrigin()); |
| 98 | 98 |
| 99 StoragePartition* partition = BrowserContext::GetStoragePartitionForSite( | 99 StoragePartition* partition = BrowserContext::GetStoragePartitionForSite( |
| 100 profile, | 100 profile, |
| 101 Extension::GetBaseURLFromExtensionId(extension->id())); | 101 Extension::GetBaseURLFromExtensionId(extension->id())); |
| 102 | 102 |
| 103 if (extension->is_hosted_app() && | 103 ExtensionSpecialStoragePolicy* storage_policy = |
| 104 !profile->GetExtensionSpecialStoragePolicy()-> | 104 profile->GetExtensionSpecialStoragePolicy(); |
| 105 IsStorageProtected(launch_web_url_origin)) { | 105 if (storage_policy->NeedsProtection(extension) && |
| 106 !storage_policy->IsStorageProtected(launch_web_url_origin)) { |
| 106 DeleteOrigin(profile, | 107 DeleteOrigin(profile, |
| 107 partition, | 108 partition, |
| 108 launch_web_url_origin, | 109 launch_web_url_origin, |
| 109 base::Bind(&base::DoNothing)); | 110 base::Bind(&base::DoNothing)); |
| 110 } | 111 } |
| 111 DeleteOrigin(profile, partition, extension->url(), callback); | 112 DeleteOrigin(profile, partition, extension->url(), callback); |
| 112 } | 113 } |
| 113 | 114 |
| 114 // Begin removal of the settings for the current extension. | 115 // Begin removal of the settings for the current extension. |
| 115 // StorageFrontend may not exist in unit tests. | 116 // StorageFrontend may not exist in unit tests. |
| 116 StorageFrontend* frontend = StorageFrontend::Get(profile); | 117 StorageFrontend* frontend = StorageFrontend::Get(profile); |
| 117 if (frontend) | 118 if (frontend) |
| 118 frontend->DeleteStorageSoon(extension->id()); | 119 frontend->DeleteStorageSoon(extension->id()); |
| 119 } | 120 } |
| 120 | 121 |
| 121 } // namespace extensions | 122 } // namespace extensions |
| OLD | NEW |