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