| Index: chrome/browser/extensions/api/browsing_data/browsing_data_api.cc
|
| diff --git a/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc b/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc
|
| index 9b4e4a186ec12a21b4c2acf23615d60f5cb8c11a..369beee9129a9aac883d4b0621cbb9eb5affdd91 100644
|
| --- a/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc
|
| +++ b/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc
|
| @@ -269,9 +269,7 @@ bool BrowsingDataRemoverFunction::RunAsync() {
|
| base::Time::UnixEpoch() :
|
| base::Time::FromDoubleT(ms_since_epoch / 1000.0);
|
|
|
| - removal_mask_ = GetRemovalMask();
|
| - if (bad_message())
|
| - return false;
|
| + EXTENSION_FUNCTION_VALIDATE(GetRemovalMask(&removal_mask_));
|
|
|
| // Check for prohibited data types.
|
| if (!IsRemovalPermitted(removal_mask_, GetProfile()->GetPrefs())) {
|
| @@ -365,87 +363,96 @@ int BrowsingDataRemoverFunction::ParseOriginTypeMask(
|
| return mask;
|
| }
|
|
|
| -// Parses the |dataToRemove| argument to generate the removal mask. Sets
|
| -// |bad_message_| (like EXTENSION_FUNCTION_VALIDATE would if this were a bool
|
| -// method) if 'dataToRemove' is not present or any data-type keys don't have
|
| -// supported (boolean) values.
|
| -int BrowsingDataRemoveFunction::GetRemovalMask() {
|
| +// Parses the |dataToRemove| argument to generate the removal mask.
|
| +// Returns false if parse was not successful, i.e. if 'dataToRemove' is not
|
| +// present or any data-type keys don't have supported (boolean) values.
|
| +bool BrowsingDataRemoveFunction::GetRemovalMask(int* removal_mask) {
|
| base::DictionaryValue* data_to_remove;
|
| - if (!args_->GetDictionary(1, &data_to_remove)) {
|
| - set_bad_message(true);
|
| - return 0;
|
| - }
|
| -
|
| - int removal_mask = 0;
|
| + if (!args_->GetDictionary(1, &data_to_remove))
|
| + return false;
|
|
|
| + *removal_mask = 0;
|
| for (base::DictionaryValue::Iterator i(*data_to_remove);
|
| !i.IsAtEnd();
|
| i.Advance()) {
|
| bool selected = false;
|
| - if (!i.value().GetAsBoolean(&selected)) {
|
| - set_bad_message(true);
|
| - return 0;
|
| - }
|
| + if (!i.value().GetAsBoolean(&selected))
|
| + return false;
|
| if (selected)
|
| - removal_mask |= MaskForKey(i.key().c_str());
|
| + *removal_mask |= MaskForKey(i.key().c_str());
|
| }
|
|
|
| - return removal_mask;
|
| + return true;
|
| }
|
|
|
| -int BrowsingDataRemoveAppcacheFunction::GetRemovalMask() {
|
| - return BrowsingDataRemover::REMOVE_APPCACHE;
|
| +bool BrowsingDataRemoveAppcacheFunction::GetRemovalMask(int* removal_mask) {
|
| + *removal_mask = BrowsingDataRemover::REMOVE_APPCACHE;
|
| + return true;
|
| }
|
|
|
| -int BrowsingDataRemoveCacheFunction::GetRemovalMask() {
|
| - return BrowsingDataRemover::REMOVE_CACHE;
|
| +bool BrowsingDataRemoveCacheFunction::GetRemovalMask(int* removal_mask) {
|
| + *removal_mask = BrowsingDataRemover::REMOVE_CACHE;
|
| + return true;
|
| }
|
|
|
| -int BrowsingDataRemoveCookiesFunction::GetRemovalMask() {
|
| - return BrowsingDataRemover::REMOVE_COOKIES |
|
| - BrowsingDataRemover::REMOVE_CHANNEL_IDS;
|
| +bool BrowsingDataRemoveCookiesFunction::GetRemovalMask(int* removal_mask) {
|
| + *removal_mask = BrowsingDataRemover::REMOVE_COOKIES |
|
| + BrowsingDataRemover::REMOVE_CHANNEL_IDS;
|
| + return true;
|
| }
|
|
|
| -int BrowsingDataRemoveDownloadsFunction::GetRemovalMask() {
|
| - return BrowsingDataRemover::REMOVE_DOWNLOADS;
|
| +bool BrowsingDataRemoveDownloadsFunction::GetRemovalMask(int* removal_mask) {
|
| + *removal_mask = BrowsingDataRemover::REMOVE_DOWNLOADS;
|
| + return true;
|
| }
|
|
|
| -int BrowsingDataRemoveFileSystemsFunction::GetRemovalMask() {
|
| - return BrowsingDataRemover::REMOVE_FILE_SYSTEMS;
|
| +bool BrowsingDataRemoveFileSystemsFunction::GetRemovalMask(int* removal_mask) {
|
| + *removal_mask = BrowsingDataRemover::REMOVE_FILE_SYSTEMS;
|
| + return true;
|
| }
|
|
|
| -int BrowsingDataRemoveFormDataFunction::GetRemovalMask() {
|
| - return BrowsingDataRemover::REMOVE_FORM_DATA;
|
| +bool BrowsingDataRemoveFormDataFunction::GetRemovalMask(int* removal_mask) {
|
| + *removal_mask = BrowsingDataRemover::REMOVE_FORM_DATA;
|
| + return true;
|
| }
|
|
|
| -int BrowsingDataRemoveHistoryFunction::GetRemovalMask() {
|
| - return BrowsingDataRemover::REMOVE_HISTORY;
|
| +bool BrowsingDataRemoveHistoryFunction::GetRemovalMask(int* removal_mask) {
|
| + *removal_mask = BrowsingDataRemover::REMOVE_HISTORY;
|
| + return true;
|
| }
|
|
|
| -int BrowsingDataRemoveIndexedDBFunction::GetRemovalMask() {
|
| - return BrowsingDataRemover::REMOVE_INDEXEDDB;
|
| +bool BrowsingDataRemoveIndexedDBFunction::GetRemovalMask(int* removal_mask) {
|
| + *removal_mask = BrowsingDataRemover::REMOVE_INDEXEDDB;
|
| + return true;
|
| }
|
|
|
| -int BrowsingDataRemoveLocalStorageFunction::GetRemovalMask() {
|
| - return BrowsingDataRemover::REMOVE_LOCAL_STORAGE;
|
| +bool BrowsingDataRemoveLocalStorageFunction::GetRemovalMask(int* removal_mask) {
|
| + *removal_mask = BrowsingDataRemover::REMOVE_LOCAL_STORAGE;
|
| + return true;
|
| }
|
|
|
| -int BrowsingDataRemovePluginDataFunction::GetRemovalMask() {
|
| - return BrowsingDataRemover::REMOVE_PLUGIN_DATA;
|
| +bool BrowsingDataRemovePluginDataFunction::GetRemovalMask(int* removal_mask) {
|
| + *removal_mask = BrowsingDataRemover::REMOVE_PLUGIN_DATA;
|
| + return true;
|
| }
|
|
|
| -int BrowsingDataRemovePasswordsFunction::GetRemovalMask() {
|
| - return BrowsingDataRemover::REMOVE_PASSWORDS;
|
| +bool BrowsingDataRemovePasswordsFunction::GetRemovalMask(int* removal_mask) {
|
| + *removal_mask = BrowsingDataRemover::REMOVE_PASSWORDS;
|
| + return true;
|
| }
|
|
|
| -int BrowsingDataRemoveServiceWorkersFunction::GetRemovalMask() {
|
| - return BrowsingDataRemover::REMOVE_SERVICE_WORKERS;
|
| +bool BrowsingDataRemoveServiceWorkersFunction::GetRemovalMask(
|
| + int* removal_mask) {
|
| + *removal_mask = BrowsingDataRemover::REMOVE_SERVICE_WORKERS;
|
| + return true;
|
| }
|
|
|
| -int BrowsingDataRemoveCacheStorageFunction::GetRemovalMask() {
|
| - return BrowsingDataRemover::REMOVE_CACHE_STORAGE;
|
| +bool BrowsingDataRemoveCacheStorageFunction::GetRemovalMask(int* removal_mask) {
|
| + *removal_mask = BrowsingDataRemover::REMOVE_CACHE_STORAGE;
|
| + return true;
|
| }
|
|
|
| -int BrowsingDataRemoveWebSQLFunction::GetRemovalMask() {
|
| - return BrowsingDataRemover::REMOVE_WEBSQL;
|
| +bool BrowsingDataRemoveWebSQLFunction::GetRemovalMask(int* removal_mask) {
|
| + *removal_mask = BrowsingDataRemover::REMOVE_WEBSQL;
|
| + return true;
|
| }
|
|
|