| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Defines the Chrome Extensions BrowsingData API functions, which entail | 5 // Defines the Chrome Extensions BrowsingData API functions, which entail |
| 6 // clearing browsing data, and clearing the browser's cache (which, let's be | 6 // clearing browsing data, and clearing the browser's cache (which, let's be |
| 7 // honest, are the same thing), as specified in the extension API JSON. | 7 // honest, are the same thing), as specified in the extension API JSON. |
| 8 | 8 |
| 9 #include "chrome/browser/extensions/api/browsing_data/browsing_data_api.h" | 9 #include "chrome/browser/extensions/api/browsing_data/browsing_data_api.h" |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 #include <utility> |
| 12 | 13 |
| 13 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 14 #include "base/values.h" | 15 #include "base/values.h" |
| 15 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 16 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 16 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 17 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 17 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" | 18 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" |
| 18 #include "chrome/browser/plugins/plugin_data_remover_helper.h" | 19 #include "chrome/browser/plugins/plugin_data_remover_helper.h" |
| 19 #include "chrome/browser/plugins/plugin_prefs.h" | 20 #include "chrome/browser/plugins/plugin_prefs.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/ui/browser.h" | 22 #include "chrome/browser/ui/browser.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 extension_browsing_data_api_constants::kPasswordsKey, | 212 extension_browsing_data_api_constants::kPasswordsKey, |
| 212 prefs->GetBoolean(prefs::kDeletePasswords)); | 213 prefs->GetBoolean(prefs::kDeletePasswords)); |
| 213 | 214 |
| 214 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue); | 215 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue); |
| 215 result->Set(extension_browsing_data_api_constants::kOptionsKey, | 216 result->Set(extension_browsing_data_api_constants::kOptionsKey, |
| 216 options.release()); | 217 options.release()); |
| 217 result->Set(extension_browsing_data_api_constants::kDataToRemoveKey, | 218 result->Set(extension_browsing_data_api_constants::kDataToRemoveKey, |
| 218 selected.release()); | 219 selected.release()); |
| 219 result->Set(extension_browsing_data_api_constants::kDataRemovalPermittedKey, | 220 result->Set(extension_browsing_data_api_constants::kDataRemovalPermittedKey, |
| 220 permitted.release()); | 221 permitted.release()); |
| 221 SetResult(result.release()); | 222 SetResult(std::move(result)); |
| 222 return true; | 223 return true; |
| 223 } | 224 } |
| 224 | 225 |
| 225 void BrowsingDataSettingsFunction::SetDetails( | 226 void BrowsingDataSettingsFunction::SetDetails( |
| 226 base::DictionaryValue* selected_dict, | 227 base::DictionaryValue* selected_dict, |
| 227 base::DictionaryValue* permitted_dict, | 228 base::DictionaryValue* permitted_dict, |
| 228 const char* data_type, | 229 const char* data_type, |
| 229 bool is_selected) { | 230 bool is_selected) { |
| 230 bool is_permitted = | 231 bool is_permitted = |
| 231 IsRemovalPermitted(MaskForKey(data_type), GetProfile()->GetPrefs()); | 232 IsRemovalPermitted(MaskForKey(data_type), GetProfile()->GetPrefs()); |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 return BrowsingDataRemover::REMOVE_SERVICE_WORKERS; | 451 return BrowsingDataRemover::REMOVE_SERVICE_WORKERS; |
| 451 } | 452 } |
| 452 | 453 |
| 453 int BrowsingDataRemoveCacheStorageFunction::GetRemovalMask() { | 454 int BrowsingDataRemoveCacheStorageFunction::GetRemovalMask() { |
| 454 return BrowsingDataRemover::REMOVE_CACHE_STORAGE; | 455 return BrowsingDataRemover::REMOVE_CACHE_STORAGE; |
| 455 } | 456 } |
| 456 | 457 |
| 457 int BrowsingDataRemoveWebSQLFunction::GetRemovalMask() { | 458 int BrowsingDataRemoveWebSQLFunction::GetRemovalMask() { |
| 458 return BrowsingDataRemover::REMOVE_WEBSQL; | 459 return BrowsingDataRemover::REMOVE_WEBSQL; |
| 459 } | 460 } |
| OLD | NEW |