Refactor BrowsingDataRemover creation for clarity.
We currently have two constructors for BrowsingDataRemover. This CL drops down to a single, private constructor with a few more specific public Create methods.
At the same time we're making that chance, we should explicitly refer to the end of time when we want to remove all browsing data from a user's machine, rather than passing in base::Time::Now() which is vulnerable to clock skew or other simply issues of asynchronocity. The new CreateForPeriod method makes that decision explicit.
base::Time::Max() has the nice property that it automatically compares as greater than any reasonable time we might encounter. This means we don't have to update every subsystem that BrowsingDataRemover relies on: they can continue to do simple comparisons without the complications of special-casing the null Time.
BUG=144946,130732
Review URL: https://chromiumcodereview.appspot.com/10898002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@154744 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc
index 6e77ea7..b372acf 100644
--- a/chrome/browser/ui/browser_commands.cc
+++ b/chrome/browser/ui/browser_commands.cc
@@ -873,9 +873,8 @@
}
void ClearCache(Browser* browser) {
- BrowsingDataRemover* remover = new BrowsingDataRemover(browser->profile(),
- BrowsingDataRemover::EVERYTHING,
- base::Time::Now());
+ BrowsingDataRemover* remover =
+ BrowsingDataRemover::CreateForUnboundedRange(browser->profile());
remover->Remove(BrowsingDataRemover::REMOVE_CACHE,
BrowsingDataHelper::UNPROTECTED_WEB);
// BrowsingDataRemover takes care of deleting itself when done.