diff options
author | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-15 10:15:40 +0000 |
---|---|---|
committer | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-15 10:15:40 +0000 |
commit | 8a2c0ed88a756f3353337f8aa8ac3d6a63efeabf (patch) | |
tree | 984404df75ec8115b7d8d0f755f876b5cbc9a7b9 | |
parent | 788b03210fc26a7ef3b0ad37b6022626715f01f0 (diff) | |
download | chromium_src-8a2c0ed88a756f3353337f8aa8ac3d6a63efeabf.zip chromium_src-8a2c0ed88a756f3353337f8aa8ac3d6a63efeabf.tar.gz chromium_src-8a2c0ed88a756f3353337f8aa8ac3d6a63efeabf.tar.bz2 |
Reverting due to compile failure on multiple bots.
Revert 114615 - chrome.clear: Increasing granularity of public API
http://codereview.chromium.org/7717023 added more granular options to
BrowsingDataRemover. This CL exposes those options to the chrome.clear
extension API. Among other things, this means that chrome.clear.cookies()
will _only_ clear cookies, not cookies and site data.
At the moment, clearing any quota managed data type will clear them all.
That is being addressed in http://codereview.chromium.org/7839029/
but is independent from changing the public interface.
BUG=94334
TEST=browser_tests
Review URL: http://codereview.chromium.org/8008012
TBR=mkwst@chromium.org
Review URL: http://codereview.chromium.org/8949014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114619 0039d316-1c4b-4281-b951-d872f2087c98
19 files changed, 275 insertions, 2068 deletions
diff --git a/chrome/browser/browsing_data_remover.h b/chrome/browser/browsing_data_remover.h index 8e2bbf7..0257815 100644 --- a/chrome/browser/browsing_data_remover.h +++ b/chrome/browser/browsing_data_remover.h @@ -128,7 +128,7 @@ class BrowsingDataRemover : public content::NotificationObserver, private: // The clear API needs to be able to toggle removing_ in order to test that // only one BrowsingDataRemover instance can be called at a time. - FRIEND_TEST_ALL_PREFIXES(ExtensionClearTest, OneAtATime); + FRIEND_TEST_ALL_PREFIXES(ExtensionApiTest, ClearOneAtATime); enum CacheState { STATE_NONE, diff --git a/chrome/browser/extensions/extension_clear_api.cc b/chrome/browser/extensions/extension_clear_api.cc index a522509..71a6bb1 100644 --- a/chrome/browser/extensions/extension_clear_api.cc +++ b/chrome/browser/extensions/extension_clear_api.cc @@ -12,6 +12,7 @@ #include "base/values.h" #include "chrome/browser/browsing_data_remover.h" +#include "chrome/browser/extensions/extension_clear_api_constants.h" #include "chrome/browser/plugin_data_remover_helper.h" #include "chrome/browser/plugin_prefs.h" #include "chrome/browser/profiles/profile.h" @@ -22,31 +23,28 @@ using content::BrowserThread; -namespace extension_clear_api_constants { +namespace keys = extension_clear_api_constants; -// Keys. -const char kAppCacheKey[] = "appcache"; -const char kCacheKey[] = "cache"; -const char kCookiesKey[] = "cookies"; -const char kDownloadsKey[] = "downloads"; -const char kFileSystemsKey[] = "fileSystems"; -const char kFormDataKey[] = "formData"; -const char kHistoryKey[] = "history"; -const char kIndexedDBKey[] = "indexedDB"; -const char kPluginDataKey[] = "pluginData"; -const char kLocalStorageKey[] = "localStorage"; -const char kPasswordsKey[] = "passwords"; -const char kWebSQLKey[] = "webSQL"; - -// Errors! -const char kOneAtATimeError[] = "Only one 'clear' API call can run at a time."; +namespace { -} // namespace extension_clear_api_constants +// Converts the JavaScript API's string input ("last_week") into the +// appropriate BrowsingDataRemover::TimePeriod (in this case, +// BrowsingDataRemover::LAST_WEEK). +bool ParseTimePeriod(const std::string& parse, + BrowsingDataRemover::TimePeriod* period) { + if (parse == keys::kHourEnum) + *period = BrowsingDataRemover::LAST_HOUR; + else if (parse == keys::kDayEnum) + *period = BrowsingDataRemover::LAST_DAY; + else if (parse == keys::kWeekEnum) + *period = BrowsingDataRemover::LAST_WEEK; + else if (parse == keys::kMonthEnum) + *period = BrowsingDataRemover::FOUR_WEEKS; + else if (parse == keys::kEverythingEnum) + *period = BrowsingDataRemover::EVERYTHING; + else + return false; -namespace { -// Converts the JavaScript API's numeric input (miliseconds since epoch) into an -// appropriate base::Time that we can pass into the BrowsingDataRemove. -bool ParseTimeFromValue(const double& ms_since_epoch, base::Time* time) { return true; } @@ -64,30 +62,21 @@ bool DataRemovalRequested(base::DictionaryValue* dict, std::string key) { // appropriate removal mask for the BrowsingDataRemover object. int ParseRemovalMask(base::DictionaryValue* value) { int GetRemovalMask = 0; - if (DataRemovalRequested(value, extension_clear_api_constants::kAppCacheKey)) - GetRemovalMask |= BrowsingDataRemover::REMOVE_APPCACHE; - if (DataRemovalRequested(value, extension_clear_api_constants::kCacheKey)) + if (DataRemovalRequested(value, keys::kCacheKey)) GetRemovalMask |= BrowsingDataRemover::REMOVE_CACHE; - if (DataRemovalRequested(value, extension_clear_api_constants::kCookiesKey)) - GetRemovalMask |= BrowsingDataRemover::REMOVE_COOKIES; - if (DataRemovalRequested(value, extension_clear_api_constants::kDownloadsKey)) + if (DataRemovalRequested(value, keys::kDownloadsKey)) GetRemovalMask |= BrowsingDataRemover::REMOVE_DOWNLOADS; - if (DataRemovalRequested(value, extension_clear_api_constants::kPasswordsKey)) - GetRemovalMask |= BrowsingDataRemover::REMOVE_FILE_SYSTEMS; - if (DataRemovalRequested(value, extension_clear_api_constants::kFormDataKey)) + if (DataRemovalRequested(value, keys::kFormDataKey)) GetRemovalMask |= BrowsingDataRemover::REMOVE_FORM_DATA; - if (DataRemovalRequested(value, extension_clear_api_constants::kHistoryKey)) + if (DataRemovalRequested(value, keys::kHistoryKey)) GetRemovalMask |= BrowsingDataRemover::REMOVE_HISTORY; - if (DataRemovalRequested(value, extension_clear_api_constants::kPasswordsKey)) - GetRemovalMask |= BrowsingDataRemover::REMOVE_INDEXEDDB; - if (DataRemovalRequested(value, extension_clear_api_constants::kPasswordsKey)) - GetRemovalMask |= BrowsingDataRemover::REMOVE_LOCAL_STORAGE; - if (DataRemovalRequested(value, extension_clear_api_constants::kPasswordsKey)) - GetRemovalMask |= BrowsingDataRemover::REMOVE_PLUGIN_DATA; - if (DataRemovalRequested(value, extension_clear_api_constants::kPasswordsKey)) + if (DataRemovalRequested(value, keys::kPasswordsKey)) GetRemovalMask |= BrowsingDataRemover::REMOVE_PASSWORDS; - if (DataRemovalRequested(value, extension_clear_api_constants::kPasswordsKey)) - GetRemovalMask |= BrowsingDataRemover::REMOVE_WEBSQL; + + // When we talk users about "cookies", we mean not just cookies, but pretty + // much everything associated with an origin. + if (DataRemovalRequested(value, keys::kCookiesKey)) + GetRemovalMask |= BrowsingDataRemover::REMOVE_SITE_DATA; return GetRemovalMask; } @@ -103,19 +92,14 @@ void BrowsingDataExtensionFunction::OnBrowsingDataRemoverDone() { bool BrowsingDataExtensionFunction::RunImpl() { if (BrowsingDataRemover::is_removing()) { - error_ = extension_clear_api_constants::kOneAtATimeError; + error_ = keys::kOneAtATimeError; return false; } - double ms_since_epoch; - EXTENSION_FUNCTION_VALIDATE(args_->GetDouble(0, &ms_since_epoch)); - // base::Time takes a double that represents seconds since epoch. JavaScript - // gives developers milliseconds, so do a quick conversion before populating - // the object. Also, Time::FromDoubleT converts double time 0 to empty Time - // object. So we need to do special handling here. - remove_since_ = (ms_since_epoch == 0) ? - base::Time::UnixEpoch() : - base::Time::FromDoubleT(ms_since_epoch / 1000.0); + // Parse the |timeframe| argument to generate the TimePeriod. + std::string timeframe; + EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &timeframe)); + EXTENSION_FUNCTION_VALIDATE(ParseTimePeriod(timeframe, &period_)); removal_mask_ = GetRemovalMask(); @@ -156,7 +140,7 @@ void BrowsingDataExtensionFunction::StartRemoving() { // we've generated above. We can use a raw pointer here, as the browsing data // remover is responsible for deleting itself once data removal is complete. BrowsingDataRemover* remover = new BrowsingDataRemover( - GetCurrentBrowser()->profile(), remove_since_, base::Time::Now()); + GetCurrentBrowser()->profile(), period_, base::Time::Now()); remover->AddObserver(this); remover->Remove(removal_mask_); } @@ -170,26 +154,18 @@ int ClearBrowsingDataFunction::GetRemovalMask() const { return 0; } -int ClearAppCacheFunction::GetRemovalMask() const { - return BrowsingDataRemover::REMOVE_APPCACHE; -} - int ClearCacheFunction::GetRemovalMask() const { return BrowsingDataRemover::REMOVE_CACHE; } int ClearCookiesFunction::GetRemovalMask() const { - return BrowsingDataRemover::REMOVE_COOKIES; + return BrowsingDataRemover::REMOVE_SITE_DATA; } int ClearDownloadsFunction::GetRemovalMask() const { return BrowsingDataRemover::REMOVE_DOWNLOADS; } -int ClearFileSystemsFunction::GetRemovalMask() const { - return BrowsingDataRemover::REMOVE_FILE_SYSTEMS; -} - int ClearFormDataFunction::GetRemovalMask() const { return BrowsingDataRemover::REMOVE_FORM_DATA; } @@ -198,22 +174,6 @@ int ClearHistoryFunction::GetRemovalMask() const { return BrowsingDataRemover::REMOVE_HISTORY; } -int ClearIndexedDBFunction::GetRemovalMask() const { - return BrowsingDataRemover::REMOVE_INDEXEDDB; -} - -int ClearLocalStorageFunction::GetRemovalMask() const { - return BrowsingDataRemover::REMOVE_LOCAL_STORAGE; -} - -int ClearPluginDataFunction::GetRemovalMask() const { - return BrowsingDataRemover::REMOVE_PLUGIN_DATA; -} - int ClearPasswordsFunction::GetRemovalMask() const { - return BrowsingDataRemover::REMOVE_PASSWORDS; -} - -int ClearWebSQLFunction::GetRemovalMask() const { - return BrowsingDataRemover::REMOVE_WEBSQL; + return BrowsingDataRemover::REMOVE_CACHE; } diff --git a/chrome/browser/extensions/extension_clear_api.h b/chrome/browser/extensions/extension_clear_api.h index bd58aae..69a4a52 100644 --- a/chrome/browser/extensions/extension_clear_api.h +++ b/chrome/browser/extensions/extension_clear_api.h @@ -17,27 +17,6 @@ class PluginPrefs; -namespace extension_clear_api_constants { - -// Keys. -extern const char kAppCacheKey[]; -extern const char kCacheKey[]; -extern const char kCookiesKey[]; -extern const char kDownloadsKey[]; -extern const char kFileSystemsKey[]; -extern const char kFormDataKey[]; -extern const char kHistoryKey[]; -extern const char kIndexedDBKey[]; -extern const char kPluginDataKey[]; -extern const char kLocalStorageKey[]; -extern const char kPasswordsKey[]; -extern const char kWebSQLKey[]; - -// Errors! -extern const char kOneAtATimeError[]; - -} // namespace extension_clear_api_constants - // This serves as a base class from which the browsing data API functions will // inherit. Each needs to be an observer of BrowsingDataRemover events, and each // will handle those events in the same way (by calling the passed-in callback @@ -68,22 +47,10 @@ class BrowsingDataExtensionFunction : public AsyncExtensionFunction, // Called when we're ready to start removing data. void StartRemoving(); - base::Time remove_since_; + BrowsingDataRemover::TimePeriod period_; int removal_mask_; }; -class ClearAppCacheFunction : public BrowsingDataExtensionFunction { - public: - ClearAppCacheFunction() {} - virtual ~ClearAppCacheFunction() {} - - protected: - // BrowsingDataTypeExtensionFunction interface method. - virtual int GetRemovalMask() const OVERRIDE; - - DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.appcache") -}; - class ClearBrowsingDataFunction : public BrowsingDataExtensionFunction { public: ClearBrowsingDataFunction() {} @@ -132,18 +99,6 @@ class ClearDownloadsFunction : public BrowsingDataExtensionFunction { DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.downloads") }; -class ClearFileSystemsFunction : public BrowsingDataExtensionFunction { - public: - ClearFileSystemsFunction() {} - virtual ~ClearFileSystemsFunction() {} - - protected: - // BrowsingDataTypeExtensionFunction interface method. - virtual int GetRemovalMask() const OVERRIDE; - - DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.fileSystems") -}; - class ClearFormDataFunction : public BrowsingDataExtensionFunction { public: ClearFormDataFunction() {} @@ -168,42 +123,6 @@ class ClearHistoryFunction : public BrowsingDataExtensionFunction { DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.history") }; -class ClearIndexedDBFunction : public BrowsingDataExtensionFunction { - public: - ClearIndexedDBFunction() {} - virtual ~ClearIndexedDBFunction() {} - - protected: - // BrowsingDataTypeExtensionFunction interface method. - virtual int GetRemovalMask() const OVERRIDE; - - DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.indexedDB") -}; - -class ClearLocalStorageFunction : public BrowsingDataExtensionFunction { - public: - ClearLocalStorageFunction() {} - virtual ~ClearLocalStorageFunction() {} - - protected: - // BrowsingDataTypeExtensionFunction interface method. - virtual int GetRemovalMask() const OVERRIDE; - - DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.localStorage") -}; - -class ClearPluginDataFunction : public BrowsingDataExtensionFunction { - public: - ClearPluginDataFunction() {} - virtual ~ClearPluginDataFunction() {} - - protected: - // BrowsingDataTypeExtensionFunction interface method. - virtual int GetRemovalMask() const OVERRIDE; - - DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.pluginData") -}; - class ClearPasswordsFunction : public BrowsingDataExtensionFunction { public: ClearPasswordsFunction() {} @@ -216,15 +135,4 @@ class ClearPasswordsFunction : public BrowsingDataExtensionFunction { DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.passwords") }; -class ClearWebSQLFunction : public BrowsingDataExtensionFunction { - public: - ClearWebSQLFunction() {} - virtual ~ClearWebSQLFunction() {} - - protected: - // BrowsingDataTypeExtensionFunction interface method. - virtual int GetRemovalMask() const OVERRIDE; - - DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.webSQL") -}; #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_CLEAR_API_H_ diff --git a/chrome/browser/extensions/extension_clear_api_constants.cc b/chrome/browser/extensions/extension_clear_api_constants.cc new file mode 100644 index 0000000..4c547ab --- /dev/null +++ b/chrome/browser/extensions/extension_clear_api_constants.cc @@ -0,0 +1,27 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/extensions/extension_clear_api_constants.h" + +namespace extension_clear_api_constants { + +// Keys. +const char kCacheKey[] = "cache"; +const char kCookiesKey[] = "cookies"; +const char kDownloadsKey[] = "downloads"; +const char kFormDataKey[] = "formData"; +const char kHistoryKey[] = "history"; +const char kPasswordsKey[] = "passwords"; + +// Timeframe "enum" values. +const char kHourEnum[] = "last_hour"; +const char kDayEnum[] = "last_day"; +const char kWeekEnum[] = "last_week"; +const char kMonthEnum[] = "last_month"; +const char kEverythingEnum[] = "everything"; + +// Errors! +const char kOneAtATimeError[] = "Only one 'clear' API call can run at a time."; + +} // namespace extension_clear_api_constants diff --git a/chrome/browser/extensions/extension_clear_api_constants.h b/chrome/browser/extensions/extension_clear_api_constants.h new file mode 100644 index 0000000..b405556 --- /dev/null +++ b/chrome/browser/extensions/extension_clear_api_constants.h @@ -0,0 +1,33 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Constants used for the Cookies API. + +#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_CLEAR_API_CONSTANTS_H_ +#define CHROME_BROWSER_EXTENSIONS_EXTENSION_CLEAR_API_CONSTANTS_H_ +#pragma once + +namespace extension_clear_api_constants { + +// Keys. +extern const char kCacheKey[]; +extern const char kCookiesKey[]; +extern const char kDownloadsKey[]; +extern const char kFormDataKey[]; +extern const char kHistoryKey[]; +extern const char kPasswordsKey[]; + +// Timeframe "enum" values. +extern const char kHourEnum[]; +extern const char kDayEnum[]; +extern const char kWeekEnum[]; +extern const char kMonthEnum[]; +extern const char kEverythingEnum[]; + +// Errors! +extern const char kOneAtATimeError[]; + +} // namespace extension_clear_api_constants + +#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_CLEAR_API_CONSTANTS_H_ diff --git a/chrome/browser/extensions/extension_clear_apitest.cc b/chrome/browser/extensions/extension_clear_apitest.cc new file mode 100644 index 0000000..e295ba0 --- /dev/null +++ b/chrome/browser/extensions/extension_clear_apitest.cc @@ -0,0 +1,23 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/command_line.h" +#include "chrome/browser/browsing_data_remover.h" +#include "chrome/browser/extensions/extension_apitest.h" +#include "chrome/common/chrome_switches.h" + +IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Clear) { + CommandLine::ForCurrentProcess()->AppendSwitch( + switches::kEnableExperimentalExtensionApis); + + ASSERT_TRUE(RunExtensionTest("clear/api")) << message_; +} + +IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ClearOneAtATime) { + CommandLine::ForCurrentProcess()->AppendSwitch( + switches::kEnableExperimentalExtensionApis); + BrowsingDataRemover::set_removing(true); + ASSERT_TRUE(RunExtensionTest("clear/one_at_a_time")) << message_; + BrowsingDataRemover::set_removing(false); +} diff --git a/chrome/browser/extensions/extension_clear_test.cc b/chrome/browser/extensions/extension_clear_test.cc deleted file mode 100644 index c39b3c7..0000000 --- a/chrome/browser/extensions/extension_clear_test.cc +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/extensions/extension_clear_api.h" - -#include <string> - -#include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" -#include "base/string_util.h" -#include "base/stringprintf.h" -#include "base/values.h" -#include "chrome/browser/browsing_data_remover.h" -#include "chrome/browser/extensions/extension_function_test_utils.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/browser.h" -#include "chrome/common/chrome_notification_types.h" -#include "chrome/test/base/in_process_browser_test.h" -#include "content/public/browser/notification_service.h" - -using namespace extension_function_test_utils; - -namespace { - -const char kClearEverythingArguments[] = "[1000, {" - "\"appcache\": true, \"cache\": true, \"cookies\": true, " - "\"downloads\": true, \"fileSystems\": true, \"formData\": true, " - "\"history\": true, \"indexedDB\": true, \"localStorage\": true, " - "\"pluginData\": true, \"passwords\": true, \"webSQL\": true" - "}]"; - -class ExtensionClearTest : public InProcessBrowserTest, - public content::NotificationObserver { - public: - base::Time GetBeginTime() { - return called_with_details_->removal_begin; - } - - int GetRemovalMask() { - return called_with_details_->removal_mask; - } - - protected: - virtual void SetUpOnMainThread() { - called_with_details_.reset(new BrowsingDataRemover::NotificationDetails()); - registrar_.Add(this, chrome::NOTIFICATION_BROWSING_DATA_REMOVED, - content::Source<Profile>(browser()->profile())); - } - - // content::NotificationObserver implementation. - virtual void Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE { - DCHECK_EQ(type, chrome::NOTIFICATION_BROWSING_DATA_REMOVED); - - // We're not taking ownership of the details object, but storing a copy of - // it locally. - called_with_details_.reset(new BrowsingDataRemover::NotificationDetails( - *content::Details<BrowsingDataRemover::NotificationDetails>( - details).ptr())); - - registrar_.RemoveAll(); - } - - private: - scoped_ptr<BrowsingDataRemover::NotificationDetails> called_with_details_; - content::NotificationRegistrar registrar_; -}; - -} // namespace - -IN_PROC_BROWSER_TEST_F(ExtensionClearTest, OneAtATime) { - BrowsingDataRemover::set_removing(true); - EXPECT_TRUE(MatchPattern( - RunFunctionAndReturnError( - new ClearBrowsingDataFunction(), - kClearEverythingArguments, - browser()), - extension_clear_api_constants::kOneAtATimeError)); - BrowsingDataRemover::set_removing(false); - - EXPECT_EQ(base::Time(), GetBeginTime()); - EXPECT_EQ(-1, GetRemovalMask()); -} - -IN_PROC_BROWSER_TEST_F(ExtensionClearTest, ClearBrowsingDataEverything) { - EXPECT_EQ(NULL, RunFunctionAndReturnResult(new ClearBrowsingDataFunction(), - kClearEverythingArguments, browser())); - - EXPECT_EQ(base::Time::FromDoubleT(1.0), GetBeginTime()); - EXPECT_EQ((BrowsingDataRemover::REMOVE_SITE_DATA | - BrowsingDataRemover::REMOVE_CACHE | - BrowsingDataRemover::REMOVE_DOWNLOADS | - BrowsingDataRemover::REMOVE_FORM_DATA | - BrowsingDataRemover::REMOVE_HISTORY | - BrowsingDataRemover::REMOVE_PASSWORDS) & - // We can't remove plugin data inside a test profile. - ~BrowsingDataRemover::REMOVE_PLUGIN_DATA, GetRemovalMask()); -} diff --git a/chrome/browser/extensions/extension_function_dispatcher.cc b/chrome/browser/extensions/extension_function_dispatcher.cc index bda138f..433ee75 100644 --- a/chrome/browser/extensions/extension_function_dispatcher.cc +++ b/chrome/browser/extensions/extension_function_dispatcher.cc @@ -185,18 +185,12 @@ void FactoryRegistry::ResetFunctions() { // Browsing Data. RegisterFunction<ClearBrowsingDataFunction>(); - RegisterFunction<ClearAppCacheFunction>(); RegisterFunction<ClearCacheFunction>(); RegisterFunction<ClearCookiesFunction>(); RegisterFunction<ClearDownloadsFunction>(); - RegisterFunction<ClearFileSystemsFunction>(); RegisterFunction<ClearFormDataFunction>(); RegisterFunction<ClearHistoryFunction>(); - RegisterFunction<ClearIndexedDBFunction>(); - RegisterFunction<ClearLocalStorageFunction>(); - RegisterFunction<ClearPluginDataFunction>(); RegisterFunction<ClearPasswordsFunction>(); - RegisterFunction<ClearWebSQLFunction>(); // Bookmarks. RegisterFunction<GetBookmarksFunction>(); diff --git a/chrome/browser/extensions/extension_function_test_utils.cc b/chrome/browser/extensions/extension_function_test_utils.cc index 442013d..9953807 100644 --- a/chrome/browser/extensions/extension_function_test_utils.cc +++ b/chrome/browser/extensions/extension_function_test_utils.cc @@ -138,8 +138,8 @@ base::Value* RunFunctionAndReturnResult(UIThreadExtensionFunction* function, RunFunction(function, args, browser, flags); EXPECT_TRUE(function->GetError().empty()) << "Unexpected error: " << function->GetError(); - return (function->GetResultValue() == NULL) ? NULL : - function->GetResultValue()->DeepCopy(); + EXPECT_TRUE(function->GetResultValue()) << "No result value found"; + return function->GetResultValue()->DeepCopy(); } // This helps us be able to wait until an AsyncExtensionFunction calls diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index f9fbc5b..cc7b31a 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -2521,7 +2521,7 @@ 'browser/extensions/extension_browsertest.h', 'browser/extensions/extension_browsertests_misc.cc', 'browser/extensions/extension_chrome_auth_private_apitest.cc', - 'browser/extensions/extension_clear_test.cc', + 'browser/extensions/extension_clear_apitest.cc', 'browser/extensions/extension_content_settings_apitest.cc', 'browser/extensions/extension_context_menu_apitest.cc', 'browser/extensions/extension_context_menu_browsertest.cc', diff --git a/chrome/common/extensions/api/extension_api.json b/chrome/common/extensions/api/extension_api.json index 6b73644..3b43aac 100644 --- a/chrome/common/extensions/api/extension_api.json +++ b/chrome/common/extensions/api/extension_api.json @@ -8784,9 +8784,10 @@ "namespace": "experimental.clear", "types": [ { - "id": "RemovalRange", - "type": "number", - "description": "Remove data accumulated on or after this date, represented in milliseconds since the epoch ('Date().GetTime()')" + "id": "TimePeriod", + "type": "string", + "enum": ["last_hour", "last_day", "last_week", "last_month", "everything"], + "description": "The timeframe inside of which to delete browsing data. Passing 'last_day', for example, will delete all browsing data that was touched between 24 hours ago and right now, inclusive." } ], "functions": [ @@ -8796,19 +8797,14 @@ "type": "function", "parameters": [ { - "$ref": "RemovalRange", - "name": "since" + "$ref": "TimePeriod", + "name": "period" }, { "name": "dataToRemove", "type": "object", "description": "An object whose properties specify which browsing data types ought to be cleared. You may set as many or as few as you like in a single call, each is optional (defaulting to <code>false</code>).", "properties": { - "appcache": { - "type": "boolean", - "optional": true, - "description": "Should websites' appcaches be cleared?" - }, "cache": { "type": "boolean", "optional": true, @@ -8824,11 +8820,6 @@ "optional": true, "description": "Should the browser's download list be cleared?" }, - "fileSystems": { - "type": "boolean", - "optional": true, - "description": "Should websites' file systems be cleared?" - }, "formData": { "type": "boolean", "optional": true, @@ -8839,30 +8830,10 @@ "optional": true, "description": "Should the browser's history be cleared?" }, - "indexedDB": { - "type": "boolean", - "optional": true, - "description": "Should websites' IndexedDB data be cleared?" - }, - "localStorage": { - "type": "boolean", - "optional": true, - "description": "Should websites' local storage data be cleared?" - }, - "pluginData": { - "type": "boolean", - "optional": true, - "description": "Should plugins' data be cleared?" - }, "passwords": { "type": "boolean", "optional": true, "description": "Should the stored passwords be cleared?" - }, - "webSQL": { - "type": "boolean", - "optional": true, - "description": "Should websites' WebSQL data be cleared?" } } }, @@ -8876,36 +8847,18 @@ ] }, { - "name": "appcache", - "description": "Clears websites' appcache data.", - "type": "function", - "parameters": [ - { - "$ref": "RemovalRange", - "name": "since" - }, - { - "name": "callback", - "type": "function", - "description": "Called when websites' appcache data has been cleared.", - "optional": true, - "parameters": [] - } - ] - }, - { "name": "cache", "description": "Clears the browser's cache.", "type": "function", "parameters": [ { - "$ref": "RemovalRange", - "name": "since" + "$ref": "TimePeriod", + "name": "period" }, { "name": "callback", "type": "function", - "description": "Called when the browser's cache has been cleared.", + "description": "Called when the browser's cache has cleared.", "optional": true, "parameters": [] } @@ -8913,17 +8866,17 @@ }, { "name": "cookies", - "description": "Clears the browser's cookies.", + "description": "Clears the browser's cookies and site data.", "type": "function", "parameters": [ { - "$ref": "RemovalRange", - "name": "since" + "$ref": "TimePeriod", + "name": "period" }, { "name": "callback", "type": "function", - "description": "Called when the browser's cookies have been cleared.", + "description": "Called when the browser's cookies and site data have been cleared.", "optional": true, "parameters": [] } @@ -8935,8 +8888,8 @@ "type": "function", "parameters": [ { - "$ref": "RemovalRange", - "name": "since" + "$ref": "TimePeriod", + "name": "period" }, { "name": "callback", @@ -8948,31 +8901,13 @@ ] }, { - "name": "fileSystems", - "description": "Clears websites' file system data.", - "type": "function", - "parameters": [ - { - "$ref": "RemovalRange", - "name": "since" - }, - { - "name": "callback", - "type": "function", - "description": "Called when websites' file systems have been cleared.", - "optional": true, - "parameters": [] - } - ] - }, - { "name": "formData", "description": "Clears the browser's stored form data (autofill).", "type": "function", "parameters": [ { - "$ref": "RemovalRange", - "name": "since" + "$ref": "TimePeriod", + "name": "period" }, { "name": "callback", @@ -8989,8 +8924,8 @@ "type": "function", "parameters": [ { - "$ref": "RemovalRange", - "name": "since" + "$ref": "TimePeriod", + "name": "period" }, { "name": "callback", @@ -9002,67 +8937,13 @@ ] }, { - "name": "indexedDB", - "description": "Clears websites' IndexedDB data.", - "type": "function", - "parameters": [ - { - "$ref": "RemovalRange", - "name": "since" - }, - { - "name": "callback", - "type": "function", - "description": "Called when websites' IndexedDB data has been cleared.", - "optional": true, - "parameters": [] - } - ] - }, - { - "name": "localStorage", - "description": "Clears websites' local storage data.", - "type": "function", - "parameters": [ - { - "$ref": "RemovalRange", - "name": "since" - }, - { - "name": "callback", - "type": "function", - "description": "Called when websites' local storage has been cleared.", - "optional": true, - "parameters": [] - } - ] - }, - { - "name": "lsoData", - "description": "Clears plugins' Local Storage Object data.", - "type": "function", - "parameters": [ - { - "$ref": "RemovalRange", - "name": "since" - }, - { - "name": "callback", - "type": "function", - "description": "Called when plugins' Local Storage Data has been cleared.", - "optional": true, - "parameters": [] - } - ] - }, - { "name": "passwords", "description": "Clears the browser's stored passwords.", "type": "function", "parameters": [ { - "$ref": "RemovalRange", - "name": "since" + "$ref": "TimePeriod", + "name": "period" }, { "name": "callback", @@ -9072,24 +8953,6 @@ "parameters": [] } ] - }, - { - "name": "webSQL", - "description": "Clears websites' WebSQL data.", - "type": "function", - "parameters": [ - { - "$ref": "RemovalRange", - "name": "since" - }, - { - "name": "callback", - "type": "function", - "description": "Called when websites' WebSQL databases have been cleared.", - "optional": true, - "parameters": [] - } - ] } ] }, diff --git a/chrome/common/extensions/docs/experimental.clear.html b/chrome/common/extensions/docs/experimental.clear.html index 294fecd..7f50ea6 100644 --- a/chrome/common/extensions/docs/experimental.clear.html +++ b/chrome/common/extensions/docs/experimental.clear.html @@ -323,8 +323,6 @@ <a href="#global-methods">Methods</a> <ol> <li> - <a href="#method-appcache">appcache</a> - </li><li> <a href="#method-browsingData">browsingData</a> </li><li> <a href="#method-cache">cache</a> @@ -333,21 +331,11 @@ </li><li> <a href="#method-downloads">downloads</a> </li><li> - <a href="#method-fileSystems">fileSystems</a> - </li><li> <a href="#method-formData">formData</a> </li><li> <a href="#method-history">history</a> </li><li> - <a href="#method-indexedDB">indexedDB</a> - </li><li> - <a href="#method-localStorage">localStorage</a> - </li><li> - <a href="#method-lsoData">lsoData</a> - </li><li> <a href="#method-passwords">passwords</a> - </li><li> - <a href="#method-webSQL">webSQL</a> </li> </ol> </li> @@ -429,206 +417,6 @@ <!-- iterates over all functions --> <div class="apiItem"> - <a name="method-appcache"></a> <!-- method-anchor --> - <h4>appcache</h4> - - <div class="summary"><span style="display: none; ">void</span> - <!-- Note: intentionally longer 80 columns --> - <span>chrome.experimental.clear.appcache</span>(<span class="null"><span style="display: none; ">, </span><span>TimePeriod</span> - <var><span>period</span></var></span><span class="optional"><span>, </span><span>function</span> - <var><span>callback</span></var></span>)</div> - - <div class="description"> - <p class="todo" style="display: none; ">Undocumented.</p> - <p>Clears websites' appcache data.</p> - - <!-- PARAMETERS --> - <h4>Parameters</h4> - <dl> - <div> - <div> - <dt> - <var>period</var> - <em> - - <!-- TYPE --> - <div style="display:inline"> - ( - <span class="optional" style="display: none; ">optional</span> - <span class="enum" style="display: none; ">enumerated</span> - <span id="typeTemplate"> - <span> - <a href="experimental.clear.html#type-TimePeriod">TimePeriod</a> - </span> - <span style="display: none; "> - <span> - array of <span><span></span></span> - </span> - <span>paramType</span> - <span></span> - </span> - </span> - ) - </div> - - </em> - </dt> - <dd class="todo"> - Undocumented. - </dd> - <dd style="display: none; "> - Description of this parameter from the json schema. - </dd> - <dd style="display: none; "> - This parameter was added in version - <b><span></span></b>. - You must omit this parameter in earlier versions, - and you may omit it in any version. If you require this - parameter, the manifest key - <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> - can ensure that your extension won't be run in an earlier browser version. - </dd> - - <!-- OBJECT PROPERTIES --> - <dd style="display: none; "> - <dl> - <div> - <div> - </div> - </div> - </dl> - </dd> - - <!-- OBJECT METHODS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- OBJECT EVENT FIELDS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- FUNCTION PARAMETERS --> - <dd style="display: none; "> - <div></div> - </dd> - - </div> - </div><div> - <div> - <dt> - <var>callback</var> - <em> - - <!-- TYPE --> - <div style="display:inline"> - ( - <span class="optional">optional</span> - <span class="enum" style="display: none; ">enumerated</span> - <span id="typeTemplate"> - <span style="display: none; "> - <a> Type</a> - </span> - <span> - <span style="display: none; "> - array of <span><span></span></span> - </span> - <span>function</span> - <span style="display: none; "></span> - </span> - </span> - ) - </div> - - </em> - </dt> - <dd class="todo" style="display: none; "> - Undocumented. - </dd> - <dd>Called when websites' appcache data has been cleared.</dd> - <dd style="display: none; "> - This parameter was added in version - <b><span></span></b>. - You must omit this parameter in earlier versions, - and you may omit it in any version. If you require this - parameter, the manifest key - <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> - can ensure that your extension won't be run in an earlier browser version. - </dd> - - <!-- OBJECT PROPERTIES --> - <dd style="display: none; "> - <dl> - <div> - <div> - </div> - </div> - </dl> - </dd> - - <!-- OBJECT METHODS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- OBJECT EVENT FIELDS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- FUNCTION PARAMETERS --> - <dd style="display: none; "> - <div></div> - </dd> - - </div> - </div> - </dl> - - <!-- RETURNS --> - <h4 style="display: none; ">Returns</h4> - <dl> - <div style="display: none; "> - <div> - </div> - </div> - </dl> - - <!-- CALLBACK --> - <div> - <div> - <h4>Callback function</h4> - <p style="display: none; "> - The callback <em>parameter</em> should specify a function - that looks like this: - </p> - <p> - If you specify the <em>callback</em> parameter, it should - specify a function that looks like this: - </p> - - <!-- Note: intentionally longer 80 columns --> - <pre>function(<span></span>) <span class="subdued">{...}</span>;</pre> - <dl> - <div style="display: none; "> - <div> - </div> - </div> - </dl> - </div> - </div> - - <!-- MIN_VERSION --> - <p style="display: none; "> - This function was added in version <b><span></span></b>. - If you require this function, the manifest key - <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> - can ensure that your extension won't be run in an earlier browser version. - </p> - </div> <!-- /description --> - - </div><div class="apiItem"> <a name="method-browsingData"></a> <!-- method-anchor --> <h4>browsingData</h4> @@ -764,74 +552,6 @@ <div> <div> <dt> - <var>appcache</var> - <em> - - <!-- TYPE --> - <div style="display:inline"> - ( - <span class="optional">optional</span> - <span class="enum" style="display: none; ">enumerated</span> - <span id="typeTemplate"> - <span style="display: none; "> - <a> Type</a> - </span> - <span> - <span style="display: none; "> - array of <span><span></span></span> - </span> - <span>boolean</span> - <span style="display: none; "></span> - </span> - </span> - ) - </div> - - </em> - </dt> - <dd class="todo" style="display: none; "> - Undocumented. - </dd> - <dd>Should websites' appcaches be cleared?</dd> - <dd style="display: none; "> - This parameter was added in version - <b><span></span></b>. - You must omit this parameter in earlier versions, - and you may omit it in any version. If you require this - parameter, the manifest key - <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> - can ensure that your extension won't be run in an earlier browser version. - </dd> - - <!-- OBJECT PROPERTIES --> - <dd style="display: none; "> - <dl> - <div> - <div> - </div> - </div> - </dl> - </dd> - - <!-- OBJECT METHODS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- OBJECT EVENT FIELDS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- FUNCTION PARAMETERS --> - <dd style="display: none; "> - <div></div> - </dd> - - </div> - </div><div> - <div> - <dt> <var>cache</var> <em> @@ -1036,74 +756,6 @@ </div><div> <div> <dt> - <var>fileSystems</var> - <em> - - <!-- TYPE --> - <div style="display:inline"> - ( - <span class="optional">optional</span> - <span class="enum" style="display: none; ">enumerated</span> - <span id="typeTemplate"> - <span style="display: none; "> - <a> Type</a> - </span> - <span> - <span style="display: none; "> - array of <span><span></span></span> - </span> - <span>boolean</span> - <span style="display: none; "></span> - </span> - </span> - ) - </div> - - </em> - </dt> - <dd class="todo" style="display: none; "> - Undocumented. - </dd> - <dd>Should websites' file systems be cleared?</dd> - <dd style="display: none; "> - This parameter was added in version - <b><span></span></b>. - You must omit this parameter in earlier versions, - and you may omit it in any version. If you require this - parameter, the manifest key - <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> - can ensure that your extension won't be run in an earlier browser version. - </dd> - - <!-- OBJECT PROPERTIES --> - <dd style="display: none; "> - <dl> - <div> - <div> - </div> - </div> - </dl> - </dd> - - <!-- OBJECT METHODS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- OBJECT EVENT FIELDS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- FUNCTION PARAMETERS --> - <dd style="display: none; "> - <div></div> - </dd> - - </div> - </div><div> - <div> - <dt> <var>formData</var> <em> @@ -1240,210 +892,6 @@ </div><div> <div> <dt> - <var>indexedDB</var> - <em> - - <!-- TYPE --> - <div style="display:inline"> - ( - <span class="optional">optional</span> - <span class="enum" style="display: none; ">enumerated</span> - <span id="typeTemplate"> - <span style="display: none; "> - <a> Type</a> - </span> - <span> - <span style="display: none; "> - array of <span><span></span></span> - </span> - <span>boolean</span> - <span style="display: none; "></span> - </span> - </span> - ) - </div> - - </em> - </dt> - <dd class="todo" style="display: none; "> - Undocumented. - </dd> - <dd>Should websites' IndexedDB data be cleared?</dd> - <dd style="display: none; "> - This parameter was added in version - <b><span></span></b>. - You must omit this parameter in earlier versions, - and you may omit it in any version. If you require this - parameter, the manifest key - <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> - can ensure that your extension won't be run in an earlier browser version. - </dd> - - <!-- OBJECT PROPERTIES --> - <dd style="display: none; "> - <dl> - <div> - <div> - </div> - </div> - </dl> - </dd> - - <!-- OBJECT METHODS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- OBJECT EVENT FIELDS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- FUNCTION PARAMETERS --> - <dd style="display: none; "> - <div></div> - </dd> - - </div> - </div><div> - <div> - <dt> - <var>localStorage</var> - <em> - - <!-- TYPE --> - <div style="display:inline"> - ( - <span class="optional">optional</span> - <span class="enum" style="display: none; ">enumerated</span> - <span id="typeTemplate"> - <span style="display: none; "> - <a> Type</a> - </span> - <span> - <span style="display: none; "> - array of <span><span></span></span> - </span> - <span>boolean</span> - <span style="display: none; "></span> - </span> - </span> - ) - </div> - - </em> - </dt> - <dd class="todo" style="display: none; "> - Undocumented. - </dd> - <dd>Should websites' local storage data be cleared?</dd> - <dd style="display: none; "> - This parameter was added in version - <b><span></span></b>. - You must omit this parameter in earlier versions, - and you may omit it in any version. If you require this - parameter, the manifest key - <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> - can ensure that your extension won't be run in an earlier browser version. - </dd> - - <!-- OBJECT PROPERTIES --> - <dd style="display: none; "> - <dl> - <div> - <div> - </div> - </div> - </dl> - </dd> - - <!-- OBJECT METHODS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- OBJECT EVENT FIELDS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- FUNCTION PARAMETERS --> - <dd style="display: none; "> - <div></div> - </dd> - - </div> - </div><div> - <div> - <dt> - <var>lsoData</var> - <em> - - <!-- TYPE --> - <div style="display:inline"> - ( - <span class="optional">optional</span> - <span class="enum" style="display: none; ">enumerated</span> - <span id="typeTemplate"> - <span style="display: none; "> - <a> Type</a> - </span> - <span> - <span style="display: none; "> - array of <span><span></span></span> - </span> - <span>boolean</span> - <span style="display: none; "></span> - </span> - </span> - ) - </div> - - </em> - </dt> - <dd class="todo" style="display: none; "> - Undocumented. - </dd> - <dd>Should plugins' Local Shared Object data be cleared?</dd> - <dd style="display: none; "> - This parameter was added in version - <b><span></span></b>. - You must omit this parameter in earlier versions, - and you may omit it in any version. If you require this - parameter, the manifest key - <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> - can ensure that your extension won't be run in an earlier browser version. - </dd> - - <!-- OBJECT PROPERTIES --> - <dd style="display: none; "> - <dl> - <div> - <div> - </div> - </div> - </dl> - </dd> - - <!-- OBJECT METHODS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- OBJECT EVENT FIELDS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- FUNCTION PARAMETERS --> - <dd style="display: none; "> - <div></div> - </dd> - - </div> - </div><div> - <div> - <dt> <var>passwords</var> <em> @@ -1509,74 +957,6 @@ </dd> </div> - </div><div> - <div> - <dt> - <var>webSQL</var> - <em> - - <!-- TYPE --> - <div style="display:inline"> - ( - <span class="optional">optional</span> - <span class="enum" style="display: none; ">enumerated</span> - <span id="typeTemplate"> - <span style="display: none; "> - <a> Type</a> - </span> - <span> - <span style="display: none; "> - array of <span><span></span></span> - </span> - <span>boolean</span> - <span style="display: none; "></span> - </span> - </span> - ) - </div> - - </em> - </dt> - <dd class="todo" style="display: none; "> - Undocumented. - </dd> - <dd>Should websites' WebSQL data be cleared?</dd> - <dd style="display: none; "> - This parameter was added in version - <b><span></span></b>. - You must omit this parameter in earlier versions, - and you may omit it in any version. If you require this - parameter, the manifest key - <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> - can ensure that your extension won't be run in an earlier browser version. - </dd> - - <!-- OBJECT PROPERTIES --> - <dd style="display: none; "> - <dl> - <div> - <div> - </div> - </div> - </dl> - </dd> - - <!-- OBJECT METHODS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- OBJECT EVENT FIELDS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- FUNCTION PARAMETERS --> - <dd style="display: none; "> - <div></div> - </dd> - - </div> </div> </dl> </dd> @@ -1828,7 +1208,7 @@ <dd class="todo" style="display: none; "> Undocumented. </dd> - <dd>Called when the browser's cache has been cleared.</dd> + <dd>Called when the browser's cache has cleared.</dd> <dd style="display: none; "> This parameter was added in version <b><span></span></b>. @@ -1922,7 +1302,7 @@ <div class="description"> <p class="todo" style="display: none; ">Undocumented.</p> - <p>Clears the browser's cookies.</p> + <p>Clears the browser's cookies and site data.</p> <!-- PARAMETERS --> <h4>Parameters</h4> @@ -2028,7 +1408,7 @@ <dd class="todo" style="display: none; "> Undocumented. </dd> - <dd>Called when the browser's cookies have been cleared.</dd> + <dd>Called when the browser's cookies and site data have been cleared.</dd> <dd style="display: none; "> This parameter was added in version <b><span></span></b>. @@ -2311,206 +1691,6 @@ </div> <!-- /description --> </div><div class="apiItem"> - <a name="method-fileSystems"></a> <!-- method-anchor --> - <h4>fileSystems</h4> - - <div class="summary"><span style="display: none; ">void</span> - <!-- Note: intentionally longer 80 columns --> - <span>chrome.experimental.clear.fileSystems</span>(<span class="null"><span style="display: none; ">, </span><span>TimePeriod</span> - <var><span>period</span></var></span><span class="optional"><span>, </span><span>function</span> - <var><span>callback</span></var></span>)</div> - - <div class="description"> - <p class="todo" style="display: none; ">Undocumented.</p> - <p>Clears websites' file system data.</p> - - <!-- PARAMETERS --> - <h4>Parameters</h4> - <dl> - <div> - <div> - <dt> - <var>period</var> - <em> - - <!-- TYPE --> - <div style="display:inline"> - ( - <span class="optional" style="display: none; ">optional</span> - <span class="enum" style="display: none; ">enumerated</span> - <span id="typeTemplate"> - <span> - <a href="experimental.clear.html#type-TimePeriod">TimePeriod</a> - </span> - <span style="display: none; "> - <span> - array of <span><span></span></span> - </span> - <span>paramType</span> - <span></span> - </span> - </span> - ) - </div> - - </em> - </dt> - <dd class="todo"> - Undocumented. - </dd> - <dd style="display: none; "> - Description of this parameter from the json schema. - </dd> - <dd style="display: none; "> - This parameter was added in version - <b><span></span></b>. - You must omit this parameter in earlier versions, - and you may omit it in any version. If you require this - parameter, the manifest key - <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> - can ensure that your extension won't be run in an earlier browser version. - </dd> - - <!-- OBJECT PROPERTIES --> - <dd style="display: none; "> - <dl> - <div> - <div> - </div> - </div> - </dl> - </dd> - - <!-- OBJECT METHODS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- OBJECT EVENT FIELDS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- FUNCTION PARAMETERS --> - <dd style="display: none; "> - <div></div> - </dd> - - </div> - </div><div> - <div> - <dt> - <var>callback</var> - <em> - - <!-- TYPE --> - <div style="display:inline"> - ( - <span class="optional">optional</span> - <span class="enum" style="display: none; ">enumerated</span> - <span id="typeTemplate"> - <span style="display: none; "> - <a> Type</a> - </span> - <span> - <span style="display: none; "> - array of <span><span></span></span> - </span> - <span>function</span> - <span style="display: none; "></span> - </span> - </span> - ) - </div> - - </em> - </dt> - <dd class="todo" style="display: none; "> - Undocumented. - </dd> - <dd>Called when websites' file systems have been cleared.</dd> - <dd style="display: none; "> - This parameter was added in version - <b><span></span></b>. - You must omit this parameter in earlier versions, - and you may omit it in any version. If you require this - parameter, the manifest key - <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> - can ensure that your extension won't be run in an earlier browser version. - </dd> - - <!-- OBJECT PROPERTIES --> - <dd style="display: none; "> - <dl> - <div> - <div> - </div> - </div> - </dl> - </dd> - - <!-- OBJECT METHODS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- OBJECT EVENT FIELDS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- FUNCTION PARAMETERS --> - <dd style="display: none; "> - <div></div> - </dd> - - </div> - </div> - </dl> - - <!-- RETURNS --> - <h4 style="display: none; ">Returns</h4> - <dl> - <div style="display: none; "> - <div> - </div> - </div> - </dl> - - <!-- CALLBACK --> - <div> - <div> - <h4>Callback function</h4> - <p style="display: none; "> - The callback <em>parameter</em> should specify a function - that looks like this: - </p> - <p> - If you specify the <em>callback</em> parameter, it should - specify a function that looks like this: - </p> - - <!-- Note: intentionally longer 80 columns --> - <pre>function(<span></span>) <span class="subdued">{...}</span>;</pre> - <dl> - <div style="display: none; "> - <div> - </div> - </div> - </dl> - </div> - </div> - - <!-- MIN_VERSION --> - <p style="display: none; "> - This function was added in version <b><span></span></b>. - If you require this function, the manifest key - <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> - can ensure that your extension won't be run in an earlier browser version. - </p> - </div> <!-- /description --> - - </div><div class="apiItem"> <a name="method-formData"></a> <!-- method-anchor --> <h4>formData</h4> @@ -2911,606 +2091,6 @@ </div> <!-- /description --> </div><div class="apiItem"> - <a name="method-indexedDB"></a> <!-- method-anchor --> - <h4>indexedDB</h4> - - <div class="summary"><span style="display: none; ">void</span> - <!-- Note: intentionally longer 80 columns --> - <span>chrome.experimental.clear.indexedDB</span>(<span class="null"><span style="display: none; ">, </span><span>TimePeriod</span> - <var><span>period</span></var></span><span class="optional"><span>, </span><span>function</span> - <var><span>callback</span></var></span>)</div> - - <div class="description"> - <p class="todo" style="display: none; ">Undocumented.</p> - <p>Clears websites' IndexedDB data.</p> - - <!-- PARAMETERS --> - <h4>Parameters</h4> - <dl> - <div> - <div> - <dt> - <var>period</var> - <em> - - <!-- TYPE --> - <div style="display:inline"> - ( - <span class="optional" style="display: none; ">optional</span> - <span class="enum" style="display: none; ">enumerated</span> - <span id="typeTemplate"> - <span> - <a href="experimental.clear.html#type-TimePeriod">TimePeriod</a> - </span> - <span style="display: none; "> - <span> - array of <span><span></span></span> - </span> - <span>paramType</span> - <span></span> - </span> - </span> - ) - </div> - - </em> - </dt> - <dd class="todo"> - Undocumented. - </dd> - <dd style="display: none; "> - Description of this parameter from the json schema. - </dd> - <dd style="display: none; "> - This parameter was added in version - <b><span></span></b>. - You must omit this parameter in earlier versions, - and you may omit it in any version. If you require this - parameter, the manifest key - <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> - can ensure that your extension won't be run in an earlier browser version. - </dd> - - <!-- OBJECT PROPERTIES --> - <dd style="display: none; "> - <dl> - <div> - <div> - </div> - </div> - </dl> - </dd> - - <!-- OBJECT METHODS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- OBJECT EVENT FIELDS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- FUNCTION PARAMETERS --> - <dd style="display: none; "> - <div></div> - </dd> - - </div> - </div><div> - <div> - <dt> - <var>callback</var> - <em> - - <!-- TYPE --> - <div style="display:inline"> - ( - <span class="optional">optional</span> - <span class="enum" style="display: none; ">enumerated</span> - <span id="typeTemplate"> - <span style="display: none; "> - <a> Type</a> - </span> - <span> - <span style="display: none; "> - array of <span><span></span></span> - </span> - <span>function</span> - <span style="display: none; "></span> - </span> - </span> - ) - </div> - - </em> - </dt> - <dd class="todo" style="display: none; "> - Undocumented. - </dd> - <dd>Called when websites' IndexedDB data has been cleared.</dd> - <dd style="display: none; "> - This parameter was added in version - <b><span></span></b>. - You must omit this parameter in earlier versions, - and you may omit it in any version. If you require this - parameter, the manifest key - <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> - can ensure that your extension won't be run in an earlier browser version. - </dd> - - <!-- OBJECT PROPERTIES --> - <dd style="display: none; "> - <dl> - <div> - <div> - </div> - </div> - </dl> - </dd> - - <!-- OBJECT METHODS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- OBJECT EVENT FIELDS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- FUNCTION PARAMETERS --> - <dd style="display: none; "> - <div></div> - </dd> - - </div> - </div> - </dl> - - <!-- RETURNS --> - <h4 style="display: none; ">Returns</h4> - <dl> - <div style="display: none; "> - <div> - </div> - </div> - </dl> - - <!-- CALLBACK --> - <div> - <div> - <h4>Callback function</h4> - <p style="display: none; "> - The callback <em>parameter</em> should specify a function - that looks like this: - </p> - <p> - If you specify the <em>callback</em> parameter, it should - specify a function that looks like this: - </p> - - <!-- Note: intentionally longer 80 columns --> - <pre>function(<span></span>) <span class="subdued">{...}</span>;</pre> - <dl> - <div style="display: none; "> - <div> - </div> - </div> - </dl> - </div> - </div> - - <!-- MIN_VERSION --> - <p style="display: none; "> - This function was added in version <b><span></span></b>. - If you require this function, the manifest key - <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> - can ensure that your extension won't be run in an earlier browser version. - </p> - </div> <!-- /description --> - - </div><div class="apiItem"> - <a name="method-localStorage"></a> <!-- method-anchor --> - <h4>localStorage</h4> - - <div class="summary"><span style="display: none; ">void</span> - <!-- Note: intentionally longer 80 columns --> - <span>chrome.experimental.clear.localStorage</span>(<span class="null"><span style="display: none; ">, </span><span>TimePeriod</span> - <var><span>period</span></var></span><span class="optional"><span>, </span><span>function</span> - <var><span>callback</span></var></span>)</div> - - <div class="description"> - <p class="todo" style="display: none; ">Undocumented.</p> - <p>Clears websites' local storage data.</p> - - <!-- PARAMETERS --> - <h4>Parameters</h4> - <dl> - <div> - <div> - <dt> - <var>period</var> - <em> - - <!-- TYPE --> - <div style="display:inline"> - ( - <span class="optional" style="display: none; ">optional</span> - <span class="enum" style="display: none; ">enumerated</span> - <span id="typeTemplate"> - <span> - <a href="experimental.clear.html#type-TimePeriod">TimePeriod</a> - </span> - <span style="display: none; "> - <span> - array of <span><span></span></span> - </span> - <span>paramType</span> - <span></span> - </span> - </span> - ) - </div> - - </em> - </dt> - <dd class="todo"> - Undocumented. - </dd> - <dd style="display: none; "> - Description of this parameter from the json schema. - </dd> - <dd style="display: none; "> - This parameter was added in version - <b><span></span></b>. - You must omit this parameter in earlier versions, - and you may omit it in any version. If you require this - parameter, the manifest key - <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> - can ensure that your extension won't be run in an earlier browser version. - </dd> - - <!-- OBJECT PROPERTIES --> - <dd style="display: none; "> - <dl> - <div> - <div> - </div> - </div> - </dl> - </dd> - - <!-- OBJECT METHODS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- OBJECT EVENT FIELDS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- FUNCTION PARAMETERS --> - <dd style="display: none; "> - <div></div> - </dd> - - </div> - </div><div> - <div> - <dt> - <var>callback</var> - <em> - - <!-- TYPE --> - <div style="display:inline"> - ( - <span class="optional">optional</span> - <span class="enum" style="display: none; ">enumerated</span> - <span id="typeTemplate"> - <span style="display: none; "> - <a> Type</a> - </span> - <span> - <span style="display: none; "> - array of <span><span></span></span> - </span> - <span>function</span> - <span style="display: none; "></span> - </span> - </span> - ) - </div> - - </em> - </dt> - <dd class="todo" style="display: none; "> - Undocumented. - </dd> - <dd>Called when websites' local storage has been cleared.</dd> - <dd style="display: none; "> - This parameter was added in version - <b><span></span></b>. - You must omit this parameter in earlier versions, - and you may omit it in any version. If you require this - parameter, the manifest key - <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> - can ensure that your extension won't be run in an earlier browser version. - </dd> - - <!-- OBJECT PROPERTIES --> - <dd style="display: none; "> - <dl> - <div> - <div> - </div> - </div> - </dl> - </dd> - - <!-- OBJECT METHODS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- OBJECT EVENT FIELDS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- FUNCTION PARAMETERS --> - <dd style="display: none; "> - <div></div> - </dd> - - </div> - </div> - </dl> - - <!-- RETURNS --> - <h4 style="display: none; ">Returns</h4> - <dl> - <div style="display: none; "> - <div> - </div> - </div> - </dl> - - <!-- CALLBACK --> - <div> - <div> - <h4>Callback function</h4> - <p style="display: none; "> - The callback <em>parameter</em> should specify a function - that looks like this: - </p> - <p> - If you specify the <em>callback</em> parameter, it should - specify a function that looks like this: - </p> - - <!-- Note: intentionally longer 80 columns --> - <pre>function(<span></span>) <span class="subdued">{...}</span>;</pre> - <dl> - <div style="display: none; "> - <div> - </div> - </div> - </dl> - </div> - </div> - - <!-- MIN_VERSION --> - <p style="display: none; "> - This function was added in version <b><span></span></b>. - If you require this function, the manifest key - <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> - can ensure that your extension won't be run in an earlier browser version. - </p> - </div> <!-- /description --> - - </div><div class="apiItem"> - <a name="method-lsoData"></a> <!-- method-anchor --> - <h4>lsoData</h4> - - <div class="summary"><span style="display: none; ">void</span> - <!-- Note: intentionally longer 80 columns --> - <span>chrome.experimental.clear.lsoData</span>(<span class="null"><span style="display: none; ">, </span><span>TimePeriod</span> - <var><span>period</span></var></span><span class="optional"><span>, </span><span>function</span> - <var><span>callback</span></var></span>)</div> - - <div class="description"> - <p class="todo" style="display: none; ">Undocumented.</p> - <p>Clears plugins' Local Storage Object data.</p> - - <!-- PARAMETERS --> - <h4>Parameters</h4> - <dl> - <div> - <div> - <dt> - <var>period</var> - <em> - - <!-- TYPE --> - <div style="display:inline"> - ( - <span class="optional" style="display: none; ">optional</span> - <span class="enum" style="display: none; ">enumerated</span> - <span id="typeTemplate"> - <span> - <a href="experimental.clear.html#type-TimePeriod">TimePeriod</a> - </span> - <span style="display: none; "> - <span> - array of <span><span></span></span> - </span> - <span>paramType</span> - <span></span> - </span> - </span> - ) - </div> - - </em> - </dt> - <dd class="todo"> - Undocumented. - </dd> - <dd style="display: none; "> - Description of this parameter from the json schema. - </dd> - <dd style="display: none; "> - This parameter was added in version - <b><span></span></b>. - You must omit this parameter in earlier versions, - and you may omit it in any version. If you require this - parameter, the manifest key - <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> - can ensure that your extension won't be run in an earlier browser version. - </dd> - - <!-- OBJECT PROPERTIES --> - <dd style="display: none; "> - <dl> - <div> - <div> - </div> - </div> - </dl> - </dd> - - <!-- OBJECT METHODS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- OBJECT EVENT FIELDS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- FUNCTION PARAMETERS --> - <dd style="display: none; "> - <div></div> - </dd> - - </div> - </div><div> - <div> - <dt> - <var>callback</var> - <em> - - <!-- TYPE --> - <div style="display:inline"> - ( - <span class="optional">optional</span> - <span class="enum" style="display: none; ">enumerated</span> - <span id="typeTemplate"> - <span style="display: none; "> - <a> Type</a> - </span> - <span> - <span style="display: none; "> - array of <span><span></span></span> - </span> - <span>function</span> - <span style="display: none; "></span> - </span> - </span> - ) - </div> - - </em> - </dt> - <dd class="todo" style="display: none; "> - Undocumented. - </dd> - <dd>Called when plugins' Local Storage Data has been cleared.</dd> - <dd style="display: none; "> - This parameter was added in version - <b><span></span></b>. - You must omit this parameter in earlier versions, - and you may omit it in any version. If you require this - parameter, the manifest key - <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> - can ensure that your extension won't be run in an earlier browser version. - </dd> - - <!-- OBJECT PROPERTIES --> - <dd style="display: none; "> - <dl> - <div> - <div> - </div> - </div> - </dl> - </dd> - - <!-- OBJECT METHODS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- OBJECT EVENT FIELDS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- FUNCTION PARAMETERS --> - <dd style="display: none; "> - <div></div> - </dd> - - </div> - </div> - </dl> - - <!-- RETURNS --> - <h4 style="display: none; ">Returns</h4> - <dl> - <div style="display: none; "> - <div> - </div> - </div> - </dl> - - <!-- CALLBACK --> - <div> - <div> - <h4>Callback function</h4> - <p style="display: none; "> - The callback <em>parameter</em> should specify a function - that looks like this: - </p> - <p> - If you specify the <em>callback</em> parameter, it should - specify a function that looks like this: - </p> - - <!-- Note: intentionally longer 80 columns --> - <pre>function(<span></span>) <span class="subdued">{...}</span>;</pre> - <dl> - <div style="display: none; "> - <div> - </div> - </div> - </dl> - </div> - </div> - - <!-- MIN_VERSION --> - <p style="display: none; "> - This function was added in version <b><span></span></b>. - If you require this function, the manifest key - <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> - can ensure that your extension won't be run in an earlier browser version. - </p> - </div> <!-- /description --> - - </div><div class="apiItem"> <a name="method-passwords"></a> <!-- method-anchor --> <h4>passwords</h4> @@ -3710,206 +2290,6 @@ </p> </div> <!-- /description --> - </div><div class="apiItem"> - <a name="method-webSQL"></a> <!-- method-anchor --> - <h4>webSQL</h4> - - <div class="summary"><span style="display: none; ">void</span> - <!-- Note: intentionally longer 80 columns --> - <span>chrome.experimental.clear.webSQL</span>(<span class="null"><span style="display: none; ">, </span><span>TimePeriod</span> - <var><span>period</span></var></span><span class="optional"><span>, </span><span>function</span> - <var><span>callback</span></var></span>)</div> - - <div class="description"> - <p class="todo" style="display: none; ">Undocumented.</p> - <p>Clears websites' WebSQL data.</p> - - <!-- PARAMETERS --> - <h4>Parameters</h4> - <dl> - <div> - <div> - <dt> - <var>period</var> - <em> - - <!-- TYPE --> - <div style="display:inline"> - ( - <span class="optional" style="display: none; ">optional</span> - <span class="enum" style="display: none; ">enumerated</span> - <span id="typeTemplate"> - <span> - <a href="experimental.clear.html#type-TimePeriod">TimePeriod</a> - </span> - <span style="display: none; "> - <span> - array of <span><span></span></span> - </span> - <span>paramType</span> - <span></span> - </span> - </span> - ) - </div> - - </em> - </dt> - <dd class="todo"> - Undocumented. - </dd> - <dd style="display: none; "> - Description of this parameter from the json schema. - </dd> - <dd style="display: none; "> - This parameter was added in version - <b><span></span></b>. - You must omit this parameter in earlier versions, - and you may omit it in any version. If you require this - parameter, the manifest key - <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> - can ensure that your extension won't be run in an earlier browser version. - </dd> - - <!-- OBJECT PROPERTIES --> - <dd style="display: none; "> - <dl> - <div> - <div> - </div> - </div> - </dl> - </dd> - - <!-- OBJECT METHODS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- OBJECT EVENT FIELDS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- FUNCTION PARAMETERS --> - <dd style="display: none; "> - <div></div> - </dd> - - </div> - </div><div> - <div> - <dt> - <var>callback</var> - <em> - - <!-- TYPE --> - <div style="display:inline"> - ( - <span class="optional">optional</span> - <span class="enum" style="display: none; ">enumerated</span> - <span id="typeTemplate"> - <span style="display: none; "> - <a> Type</a> - </span> - <span> - <span style="display: none; "> - array of <span><span></span></span> - </span> - <span>function</span> - <span style="display: none; "></span> - </span> - </span> - ) - </div> - - </em> - </dt> - <dd class="todo" style="display: none; "> - Undocumented. - </dd> - <dd>Called when websites' WebSQL databases have been cleared.</dd> - <dd style="display: none; "> - This parameter was added in version - <b><span></span></b>. - You must omit this parameter in earlier versions, - and you may omit it in any version. If you require this - parameter, the manifest key - <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> - can ensure that your extension won't be run in an earlier browser version. - </dd> - - <!-- OBJECT PROPERTIES --> - <dd style="display: none; "> - <dl> - <div> - <div> - </div> - </div> - </dl> - </dd> - - <!-- OBJECT METHODS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- OBJECT EVENT FIELDS --> - <dd style="display: none; "> - <div></div> - </dd> - - <!-- FUNCTION PARAMETERS --> - <dd style="display: none; "> - <div></div> - </dd> - - </div> - </div> - </dl> - - <!-- RETURNS --> - <h4 style="display: none; ">Returns</h4> - <dl> - <div style="display: none; "> - <div> - </div> - </div> - </dl> - - <!-- CALLBACK --> - <div> - <div> - <h4>Callback function</h4> - <p style="display: none; "> - The callback <em>parameter</em> should specify a function - that looks like this: - </p> - <p> - If you specify the <em>callback</em> parameter, it should - specify a function that looks like this: - </p> - - <!-- Note: intentionally longer 80 columns --> - <pre>function(<span></span>) <span class="subdued">{...}</span>;</pre> - <dl> - <div style="display: none; "> - <div> - </div> - </div> - </dl> - </div> - </div> - - <!-- MIN_VERSION --> - <p style="display: none; "> - This function was added in version <b><span></span></b>. - If you require this function, the manifest key - <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> - can ensure that your extension won't be run in an earlier browser version. - </p> - </div> <!-- /description --> - </div> <!-- /apiItem --> </div> <!-- /apiGroup --> diff --git a/chrome/common/extensions/docs/samples.json b/chrome/common/extensions/docs/samples.json index 3cacc8f..54a1c3b 100644 --- a/chrome/common/extensions/docs/samples.json +++ b/chrome/common/extensions/docs/samples.json @@ -40,19 +40,13 @@ "chrome.experimental.app.notify": "experimental.app.html#method-notify", "chrome.experimental.app.resetLaunchIcon": "experimental.app.html#method-resetLaunchIcon", "chrome.experimental.app.setLaunchIcon": "experimental.app.html#method-setLaunchIcon", - "chrome.experimental.clear.appcache": "experimental.clear.html#method-appcache", "chrome.experimental.clear.browsingData": "experimental.clear.html#method-browsingData", "chrome.experimental.clear.cache": "experimental.clear.html#method-cache", "chrome.experimental.clear.cookies": "experimental.clear.html#method-cookies", "chrome.experimental.clear.downloads": "experimental.clear.html#method-downloads", - "chrome.experimental.clear.fileSystems": "experimental.clear.html#method-fileSystems", "chrome.experimental.clear.formData": "experimental.clear.html#method-formData", "chrome.experimental.clear.history": "experimental.clear.html#method-history", - "chrome.experimental.clear.indexedDB": "experimental.clear.html#method-indexedDB", - "chrome.experimental.clear.localStorage": "experimental.clear.html#method-localStorage", - "chrome.experimental.clear.lsoData": "experimental.clear.html#method-lsoData", "chrome.experimental.clear.passwords": "experimental.clear.html#method-passwords", - "chrome.experimental.clear.webSQL": "experimental.clear.html#method-webSQL", "chrome.experimental.debugger.attach": "experimental.debugger.html#method-attach", "chrome.experimental.debugger.detach": "experimental.debugger.html#method-detach", "chrome.experimental.debugger.onDetach": "experimental.debugger.html#event-onDetach", diff --git a/chrome/test/data/extensions/api_test/clear/api/background.html b/chrome/test/data/extensions/api_test/clear/api/background.html new file mode 100644 index 0000000..ec9baec --- /dev/null +++ b/chrome/test/data/extensions/api_test/clear/api/background.html @@ -0,0 +1,6 @@ +<!-- + * Copyright (c) 2011 The Chromium Authors. All rights reserved. Use of this + * source code is governed by a BSD-style license that can be found in the + * LICENSE file. +--> +<script src="background.js"></script> diff --git a/chrome/test/data/extensions/api_test/clear/api/background.js b/chrome/test/data/extensions/api_test/clear/api/background.js new file mode 100644 index 0000000..08b78a8 --- /dev/null +++ b/chrome/test/data/extensions/api_test/clear/api/background.js @@ -0,0 +1,42 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +var allTypes = { + cache: true, + cookies: true, + downloads: true, + formData: true, + history: true, + passwords: true +}; +chrome.test.runTests([ + function testClearEverything() { + chrome.experimental.clear.browsingData("everything", allTypes, + chrome.test.callbackPass()); + }, + function testClearCache() { + chrome.experimental.clear.cache( + "everything", chrome.test.callbackPass()); + }, + function testClearCookies() { + chrome.experimental.clear.cookies( + "everything", chrome.test.callbackPass()); + }, + function testClearHistory() { + chrome.experimental.clear.history( + "everything", chrome.test.callbackPass()); + }, + function testClearPasswords() { + chrome.experimental.clear.passwords( + "everything", chrome.test.callbackPass()); + }, + function testClearDownloads() { + chrome.experimental.clear.downloads( + "everything", chrome.test.callbackPass()); + }, + function testClearFormData() { + chrome.experimental.clear.formData( + "everything", chrome.test.callbackPass()); + } +]); diff --git a/chrome/test/data/extensions/api_test/clear/api/manifest.json b/chrome/test/data/extensions/api_test/clear/api/manifest.json new file mode 100644 index 0000000..ecaa41d --- /dev/null +++ b/chrome/test/data/extensions/api_test/clear/api/manifest.json @@ -0,0 +1,11 @@ +{ + "name": "chrome.clear API Test", + "version": "0.1", + "manifest_version": 2, + "description": "end-to-end browser test for chrome.experimental.clear API", + "background_page": "background.html", + "permissions": [ + "experimental", + "clear" + ] +} diff --git a/chrome/test/data/extensions/api_test/clear/one_at_a_time/background.html b/chrome/test/data/extensions/api_test/clear/one_at_a_time/background.html new file mode 100644 index 0000000..ec9baec --- /dev/null +++ b/chrome/test/data/extensions/api_test/clear/one_at_a_time/background.html @@ -0,0 +1,6 @@ +<!-- + * Copyright (c) 2011 The Chromium Authors. All rights reserved. Use of this + * source code is governed by a BSD-style license that can be found in the + * LICENSE file. +--> +<script src="background.js"></script> diff --git a/chrome/test/data/extensions/api_test/clear/one_at_a_time/background.js b/chrome/test/data/extensions/api_test/clear/one_at_a_time/background.js new file mode 100644 index 0000000..6684cd5 --- /dev/null +++ b/chrome/test/data/extensions/api_test/clear/one_at_a_time/background.js @@ -0,0 +1,49 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +var allTypes = { + cache: true, + cookies: true, + downloads: true, + formData: true, + history: true, + passwords: true +}; +chrome.test.runTests([ + function testEverything() { + chrome.experimental.clear.browsingData("everything", allTypes, + chrome.test.callbackFail( + 'Only one \'clear\' API call can run at a time.')); + }, + function testClearCache() { + chrome.experimental.clear.cache("everything", + chrome.test.callbackFail( + 'Only one \'clear\' API call can run at a time.')); + }, + function testClearCookies() { + chrome.experimental.clear.cookies("everything", + chrome.test.callbackFail( + 'Only one \'clear\' API call can run at a time.')); + }, + function testClearHistory() { + chrome.experimental.clear.history("everything", + chrome.test.callbackFail( + 'Only one \'clear\' API call can run at a time.')); + }, + function testClearPasswords() { + chrome.experimental.clear.passwords("everything", + chrome.test.callbackFail( + 'Only one \'clear\' API call can run at a time.')); + }, + function testClearDownloads() { + chrome.experimental.clear.downloads("everything", + chrome.test.callbackFail( + 'Only one \'clear\' API call can run at a time.')); + }, + function testClearFormData() { + chrome.experimental.clear.formData("everything", + chrome.test.callbackFail( + 'Only one \'clear\' API call can run at a time.')); + } +]); diff --git a/chrome/test/data/extensions/api_test/clear/one_at_a_time/manifest.json b/chrome/test/data/extensions/api_test/clear/one_at_a_time/manifest.json new file mode 100644 index 0000000..c06f819 --- /dev/null +++ b/chrome/test/data/extensions/api_test/clear/one_at_a_time/manifest.json @@ -0,0 +1,11 @@ +{ + "name": "chrome.clear API Test: One at a time.", + "version": "0.1", + "manifest_version": 2, + "description": "Checks that chrome.experimental.clear APIs can only be called if one's not already running.", + "background_page": "background.html", + "permissions": [ + "experimental", + "clear" + ] +} |