summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorlazyboy <lazyboy@chromium.org>2015-04-26 07:58:32 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-26 14:58:38 +0000
commitd5b8383fee525645421ec70fb031dc5066feadb6 (patch)
tree347ea1ede1754b2edac463e0389680d8926111e6 /extensions
parent92ee1b3492e0b12a24e7641fd37b5ac9ebb4363b (diff)
downloadchromium_src-d5b8383fee525645421ec70fb031dc5066feadb6.zip
chromium_src-d5b8383fee525645421ec70fb031dc5066feadb6.tar.gz
chromium_src-d5b8383fee525645421ec70fb031dc5066feadb6.tar.bz2
Move clear cache code from chrome/ (ChromeWVGDelegate) to extensions/ (WVGuest)
since browsing_data/ is now under components/ BUG=471287 Test=None, internal only change without visible side effects. Review URL: https://codereview.chromium.org/1056793002 Cr-Commit-Position: refs/heads/master@{#326985}
Diffstat (limited to 'extensions')
-rw-r--r--extensions/DEPS1
-rw-r--r--extensions/browser/BUILD.gn1
-rw-r--r--extensions/browser/guest_view/web_view/web_view_guest.cc30
-rw-r--r--extensions/browser/guest_view/web_view/web_view_guest_delegate.h4
-rw-r--r--extensions/extensions.gyp1
5 files changed, 24 insertions, 13 deletions
diff --git a/extensions/DEPS b/extensions/DEPS
index a5faa35..285b7d3 100644
--- a/extensions/DEPS
+++ b/extensions/DEPS
@@ -1,5 +1,6 @@
include_rules = [
# Do not add Chrome dependencies. Much work went into removing them.
+ "+components/browsing_data",
"+components/crx_file",
"+components/url_matcher",
"-content",
diff --git a/extensions/browser/BUILD.gn b/extensions/browser/BUILD.gn
index 9ecb71e..6a643160 100644
--- a/extensions/browser/BUILD.gn
+++ b/extensions/browser/BUILD.gn
@@ -44,6 +44,7 @@ source_set("browser") {
"//extensions")
deps += [
+ "//components/browsing_data",
"//components/onc",
"//components/storage_monitor",
"//components/update_client",
diff --git a/extensions/browser/guest_view/web_view/web_view_guest.cc b/extensions/browser/guest_view/web_view/web_view_guest.cc
index f29e12f..721cb11 100644
--- a/extensions/browser/guest_view/web_view/web_view_guest.cc
+++ b/extensions/browser/guest_view/web_view/web_view_guest.cc
@@ -7,6 +7,8 @@
#include "base/message_loop/message_loop.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
+#include "components/browsing_data/storage_partition_http_cache_data_remover.h"
+#include "components/web_cache/browser/web_cache_manager.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_security_policy.h"
@@ -705,15 +707,25 @@ bool WebViewGuest::ClearData(base::Time remove_since,
return false;
if (removal_mask & webview::WEB_VIEW_REMOVE_DATA_MASK_CACHE) {
- if (web_view_guest_delegate_) {
- // First clear http cache data and then clear the rest in
- // |ClearDataInternal|.
- web_view_guest_delegate_->ClearCache(
- remove_since, base::Bind(&WebViewGuest::ClearDataInternal,
- weak_ptr_factory_.GetWeakPtr(), remove_since,
- removal_mask, callback));
- return true;
- }
+ // First clear http cache data and then clear the rest in
+ // |ClearDataInternal|.
+ int render_process_id = web_contents()->GetRenderProcessHost()->GetID();
+ // We need to clear renderer cache separately for our process because
+ // StoragePartitionHttpCacheDataRemover::ClearData() does not clear that.
+ web_cache::WebCacheManager::GetInstance()->Remove(render_process_id);
+ web_cache::WebCacheManager::GetInstance()->ClearCacheForProcess(
+ render_process_id);
+
+ base::Closure cache_removal_done_callback = base::Bind(
+ &WebViewGuest::ClearDataInternal, weak_ptr_factory_.GetWeakPtr(),
+ remove_since, removal_mask, callback);
+ // StoragePartitionHttpCacheDataRemover removes itself when it is done.
+ // components/, move |ClearCache| to WebViewGuest: http//crbug.com/471287.
+ browsing_data::StoragePartitionHttpCacheDataRemover::CreateForRange(
+ partition, remove_since, base::Time::Now())
+ ->Remove(cache_removal_done_callback);
+
+ return true;
}
ClearDataInternal(remove_since, removal_mask, callback);
diff --git a/extensions/browser/guest_view/web_view/web_view_guest_delegate.h b/extensions/browser/guest_view/web_view/web_view_guest_delegate.h
index 7b1dd56..473ffd3d 100644
--- a/extensions/browser/guest_view/web_view/web_view_guest_delegate.h
+++ b/extensions/browser/guest_view/web_view/web_view_guest_delegate.h
@@ -32,10 +32,6 @@ class WebViewGuestDelegate {
typedef std::vector<linked_ptr<api::web_view_internal::ContextMenuItem> >
MenuItemVector;
- // Clears http cache for this guest's StoragePartition.
- virtual void ClearCache(base::Time remove_since,
- const base::Closure& callback) = 0;
-
// Called when context menu operation was handled.
virtual bool HandleContextMenu(const content::ContextMenuParams& params) = 0;
diff --git a/extensions/extensions.gyp b/extensions/extensions.gyp
index 4c12f71..a057839 100644
--- a/extensions/extensions.gyp
+++ b/extensions/extensions.gyp
@@ -124,6 +124,7 @@
'dependencies': [
'../base/base.gyp:base',
'../base/base.gyp:base_prefs',
+ '../components/components.gyp:browsing_data',
'../components/components.gyp:device_event_log_component',
'../components/components.gyp:keyed_service_content',
'../components/components.gyp:keyed_service_core',