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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 // TODO(ajwong): Cookies are not properly isolated for | 46 // TODO(ajwong): Cookies are not properly isolated for |
47 // chrome-extension:// scheme. (http://crbug.com/158386). | 47 // chrome-extension:// scheme. (http://crbug.com/158386). |
48 // | 48 // |
49 // However, no isolated apps actually can write to kExtensionScheme | 49 // However, no isolated apps actually can write to kExtensionScheme |
50 // origins. Thus, it is benign to delete from the | 50 // origins. Thus, it is benign to delete from the |
51 // RequestContextForExtensions because there's nothing stored there. We | 51 // RequestContextForExtensions because there's nothing stored there. We |
52 // preserve this code path without checking for isolation because it's | 52 // preserve this code path without checking for isolation because it's |
53 // simpler than special casing. This code should go away once we merge | 53 // simpler than special casing. This code should go away once we merge |
54 // the various URLRequestContexts (http://crbug.com/159193). | 54 // the various URLRequestContexts (http://crbug.com/159193). |
55 partition->ClearDataForOrigin( | 55 partition->ClearDataForOrigin( |
56 StoragePartition::REMOVE_DATA_MASK_ALL & | 56 ~StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE, |
57 (~StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE), | |
58 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL, | 57 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL, |
59 origin, | 58 origin, |
60 profile->GetRequestContextForExtensions()); | 59 profile->GetRequestContextForExtensions()); |
61 } else { | 60 } else { |
62 // We don't need to worry about the media request context because that | 61 // We don't need to worry about the media request context because that |
63 // shares the same cookie store as the main request context. | 62 // shares the same cookie store as the main request context. |
64 partition->ClearDataForOrigin( | 63 partition->ClearDataForOrigin( |
65 StoragePartition::REMOVE_DATA_MASK_ALL & | 64 ~StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE, |
66 (~StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE), | |
67 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL, | 65 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL, |
68 origin, | 66 origin, |
69 partition->GetURLRequestContext()); | 67 partition->GetURLRequestContext()); |
70 } | 68 } |
71 } | 69 } |
72 | 70 |
73 void OnNeedsToGarbageCollectIsolatedStorage(WeakPtr<ExtensionService> es) { | 71 void OnNeedsToGarbageCollectIsolatedStorage(WeakPtr<ExtensionService> es) { |
74 if (!es) | 72 if (!es) |
75 return; | 73 return; |
76 ExtensionPrefs::Get(es->profile())->SetNeedsStorageGarbageCollection(true); | 74 ExtensionPrefs::Get(es->profile())->SetNeedsStorageGarbageCollection(true); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 #if defined(ENABLE_EXTENSIONS) | 107 #if defined(ENABLE_EXTENSIONS) |
110 // Begin removal of the settings for the current extension. | 108 // Begin removal of the settings for the current extension. |
111 // StorageFrontend may not exist in unit tests. | 109 // StorageFrontend may not exist in unit tests. |
112 StorageFrontend* frontend = StorageFrontend::Get(profile); | 110 StorageFrontend* frontend = StorageFrontend::Get(profile); |
113 if (frontend) | 111 if (frontend) |
114 frontend->DeleteStorageSoon(extension->id()); | 112 frontend->DeleteStorageSoon(extension->id()); |
115 #endif // defined(ENABLE_EXTENSIONS) | 113 #endif // defined(ENABLE_EXTENSIONS) |
116 } | 114 } |
117 | 115 |
118 } // namespace extensions | 116 } // namespace extensions |
OLD | NEW |