OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/extension_data_deleter.h" | 5 #include "chrome/browser/extensions/extension_data_deleter.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
11 #include "chrome/browser/extensions/extension_settings_backend.h" | |
12 #include "chrome/browser/extensions/extension_settings_frontend.h" | 11 #include "chrome/browser/extensions/extension_settings_frontend.h" |
13 #include "chrome/common/chrome_constants.h" | 12 #include "chrome/common/chrome_constants.h" |
14 #include "chrome/common/extensions/extension.h" | 13 #include "chrome/common/extensions/extension.h" |
15 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
16 #include "content/browser/appcache/chrome_appcache_service.h" | 15 #include "content/browser/appcache/chrome_appcache_service.h" |
17 #include "content/browser/in_process_webkit/webkit_context.h" | 16 #include "content/browser/in_process_webkit/webkit_context.h" |
18 #include "net/base/cookie_monster.h" | 17 #include "net/base/cookie_monster.h" |
19 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
20 #include "net/url_request/url_request_context.h" | 19 #include "net/url_request/url_request_context.h" |
21 #include "net/url_request/url_request_context_getter.h" | 20 #include "net/url_request/url_request_context_getter.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 BrowserThread::PostTask( | 57 BrowserThread::PostTask( |
59 BrowserThread::FILE, FROM_HERE, | 58 BrowserThread::FILE, FROM_HERE, |
60 base::Bind( | 59 base::Bind( |
61 &ExtensionDataDeleter::DeleteFileSystemOnFileThread, deleter)); | 60 &ExtensionDataDeleter::DeleteFileSystemOnFileThread, deleter)); |
62 | 61 |
63 BrowserThread::PostTask( | 62 BrowserThread::PostTask( |
64 BrowserThread::IO, FROM_HERE, | 63 BrowserThread::IO, FROM_HERE, |
65 base::Bind( | 64 base::Bind( |
66 &ExtensionDataDeleter::DeleteAppcachesOnIOThread, deleter)); | 65 &ExtensionDataDeleter::DeleteAppcachesOnIOThread, deleter)); |
67 | 66 |
68 profile->GetExtensionService()->extension_settings_frontend()->RunWithBackend( | 67 profile->GetExtensionService()->extension_settings_frontend()-> |
69 base::Bind( | 68 DeleteStorageSoon(extension_id); |
70 &ExtensionDataDeleter::DeleteExtensionSettingsOnFileThread, deleter)); | |
71 } | 69 } |
72 | 70 |
73 ExtensionDataDeleter::ExtensionDataDeleter( | 71 ExtensionDataDeleter::ExtensionDataDeleter( |
74 Profile* profile, | 72 Profile* profile, |
75 const std::string& extension_id, | 73 const std::string& extension_id, |
76 const GURL& storage_origin, | 74 const GURL& storage_origin, |
77 bool is_storage_isolated) | 75 bool is_storage_isolated) |
78 : extension_id_(extension_id) { | 76 : extension_id_(extension_id) { |
79 appcache_service_ = profile->GetAppCacheService(); | 77 appcache_service_ = profile->GetAppCacheService(); |
80 webkit_context_ = profile->GetWebKitContext(); | 78 webkit_context_ = profile->GetWebKitContext(); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 // around, and holding open file handles in this directory. | 134 // around, and holding open file handles in this directory. |
137 // See http://crbug.com/85127 | 135 // See http://crbug.com/85127 |
138 if (!isolated_app_path_.empty()) | 136 if (!isolated_app_path_.empty()) |
139 file_util::Delete(isolated_app_path_, true); | 137 file_util::Delete(isolated_app_path_, true); |
140 } | 138 } |
141 | 139 |
142 void ExtensionDataDeleter::DeleteAppcachesOnIOThread() { | 140 void ExtensionDataDeleter::DeleteAppcachesOnIOThread() { |
143 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 141 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
144 appcache_service_->DeleteAppCachesForOrigin(storage_origin_, NULL); | 142 appcache_service_->DeleteAppCachesForOrigin(storage_origin_, NULL); |
145 } | 143 } |
146 | |
147 void ExtensionDataDeleter::DeleteExtensionSettingsOnFileThread( | |
148 ExtensionSettingsBackend* backend) { | |
149 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | |
150 backend->DeleteExtensionData(extension_id_); | |
151 } | |
OLD | NEW |