| 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/api/storage/settings_frontend.h" | 7 #include "chrome/browser/extensions/api/storage/settings_frontend.h" |
| 8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 // static | 23 // static |
| 24 void DataDeleter::StartDeleting(Profile* profile, | 24 void DataDeleter::StartDeleting(Profile* profile, |
| 25 const std::string& extension_id, | 25 const std::string& extension_id, |
| 26 const GURL& storage_origin) { | 26 const GURL& storage_origin) { |
| 27 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 27 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 28 DCHECK(profile); | 28 DCHECK(profile); |
| 29 | 29 |
| 30 const GURL& site = Extension::GetBaseURLFromExtensionId(extension_id); | 30 const GURL& site = Extension::GetBaseURLFromExtensionId(extension_id); |
| 31 | 31 |
| 32 BrowserContext::GetStoragePartitionForSite(profile, site)-> | 32 StoragePartition* partition = |
| 33 ClearDataForOrigin((StoragePartition::REMOVE_DATA_MASK_ALL & | 33 BrowserContext::GetStoragePartitionForSite(profile, site); |
| 34 ~StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE), | 34 |
| 35 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL, | 35 if (storage_origin.SchemeIs(extensions::kExtensionScheme)) { |
| 36 storage_origin); | 36 // TODO(ajwong): Cookies are not properly isolated for |
| 37 // chrome-extension:// scheme. (http://crbug.com/158386). |
| 38 // |
| 39 // However, no isolated apps actually can write to kExtensionScheme |
| 40 // origins. Thus, it is benign to delete from the |
| 41 // RequestContextForExtensions because there's nothing stored there. We |
| 42 // preserve this code path without checking for isolation because it's |
| 43 // simpler than special casing. This code should go away once we merge |
| 44 // the various URLRequestContexts (http://crbug.com/159193). |
| 45 partition->ClearDataForOrigin( |
| 46 StoragePartition::REMOVE_DATA_MASK_ALL & |
| 47 (~StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE), |
| 48 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL, |
| 49 storage_origin, |
| 50 profile->GetRequestContextForExtensions()); |
| 51 } else { |
| 52 // We don't need to worry about the media request context because that |
| 53 // shares the same cookie store as the main request context. |
| 54 partition->ClearDataForOrigin( |
| 55 StoragePartition::REMOVE_DATA_MASK_ALL & |
| 56 (~StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE), |
| 57 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL, |
| 58 storage_origin, |
| 59 partition->GetURLRequestContext()); |
| 60 } |
| 37 | 61 |
| 38 // Begin removal of the settings for the current extension. | 62 // Begin removal of the settings for the current extension. |
| 39 profile->GetExtensionService()->settings_frontend()-> | 63 profile->GetExtensionService()->settings_frontend()-> |
| 40 DeleteStorageSoon(extension_id); | 64 DeleteStorageSoon(extension_id); |
| 41 } | 65 } |
| 42 | 66 |
| 43 } // namespace extensions | 67 } // namespace extensions |
| OLD | NEW |