| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "content/browser/devtools/protocol/storage_handler.h" | 5 #include "content/browser/devtools/protocol/storage_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <unordered_set> | 8 #include <unordered_set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/strings/string_split.h" | 11 #include "base/strings/string_split.h" |
| 12 #include "content/browser/devtools/protocol/devtools_protocol_dispatcher.h" | 12 #include "content/browser/devtools/protocol/devtools_protocol_dispatcher.h" |
| 13 #include "content/public/browser/render_frame_host.h" | 13 #include "content/public/browser/render_frame_host.h" |
| 14 #include "content/public/browser/render_process_host.h" | 14 #include "content/public/browser/render_process_host.h" |
| 15 #include "content/public/browser/storage_partition.h" | 15 #include "content/public/browser/storage_partition.h" |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 namespace devtools { | 18 namespace devtools { |
| 19 namespace storage { | 19 namespace storage { |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 static const char kAppCache[] = "appcache"; | 22 static const char kAppCache[] = "appcache"; |
| 23 static const char kCookies[] = "cookies"; | 23 static const char kCookies[] = "cookies"; |
| 24 static const char kFileSystems[] = "filesystems"; | 24 static const char kFileSystems[] = "filesystems"; |
| 25 static const char kIndexedDB[] = "indexeddb"; | 25 static const char kIndexedDB[] = "indexeddb"; |
| 26 static const char kLocalStorage[] = "local_storage"; | 26 static const char kLocalStorage[] = "local_storage"; |
| 27 static const char kShaderCache[] = "shader_cache"; | 27 static const char kShaderCache[] = "shader_cache"; |
| 28 static const char kWebSQL[] = "websql"; | 28 static const char kWebSQL[] = "websql"; |
| 29 static const char kWebRTCIdentity[] = "webrdc_identity"; | |
| 30 static const char kServiceWorkers[] = "service_workers"; | 29 static const char kServiceWorkers[] = "service_workers"; |
| 31 static const char kCacheStorage[] = "cache_storage"; | 30 static const char kCacheStorage[] = "cache_storage"; |
| 32 static const char kAll[] = "all"; | 31 static const char kAll[] = "all"; |
| 33 } | 32 } |
| 34 | 33 |
| 35 typedef DevToolsProtocolClient::Response Response; | 34 typedef DevToolsProtocolClient::Response Response; |
| 36 | 35 |
| 37 StorageHandler::StorageHandler() | 36 StorageHandler::StorageHandler() |
| 38 : host_(nullptr) { | 37 : host_(nullptr) { |
| 39 } | 38 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 62 if (set.count(kFileSystems)) | 61 if (set.count(kFileSystems)) |
| 63 remove_mask |= StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS; | 62 remove_mask |= StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS; |
| 64 if (set.count(kIndexedDB)) | 63 if (set.count(kIndexedDB)) |
| 65 remove_mask |= StoragePartition::REMOVE_DATA_MASK_INDEXEDDB; | 64 remove_mask |= StoragePartition::REMOVE_DATA_MASK_INDEXEDDB; |
| 66 if (set.count(kLocalStorage)) | 65 if (set.count(kLocalStorage)) |
| 67 remove_mask |= StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE; | 66 remove_mask |= StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE; |
| 68 if (set.count(kShaderCache)) | 67 if (set.count(kShaderCache)) |
| 69 remove_mask |= StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE; | 68 remove_mask |= StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE; |
| 70 if (set.count(kWebSQL)) | 69 if (set.count(kWebSQL)) |
| 71 remove_mask |= StoragePartition::REMOVE_DATA_MASK_WEBSQL; | 70 remove_mask |= StoragePartition::REMOVE_DATA_MASK_WEBSQL; |
| 72 if (set.count(kWebRTCIdentity)) | |
| 73 remove_mask |= StoragePartition::REMOVE_DATA_MASK_WEBRTC_IDENTITY; | |
| 74 if (set.count(kServiceWorkers)) | 71 if (set.count(kServiceWorkers)) |
| 75 remove_mask |= StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS; | 72 remove_mask |= StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS; |
| 76 if (set.count(kCacheStorage)) | 73 if (set.count(kCacheStorage)) |
| 77 remove_mask |= StoragePartition::REMOVE_DATA_MASK_CACHE_STORAGE; | 74 remove_mask |= StoragePartition::REMOVE_DATA_MASK_CACHE_STORAGE; |
| 78 if (set.count(kAll)) | 75 if (set.count(kAll)) |
| 79 remove_mask |= StoragePartition::REMOVE_DATA_MASK_ALL; | 76 remove_mask |= StoragePartition::REMOVE_DATA_MASK_ALL; |
| 80 | 77 |
| 81 if (!remove_mask) | 78 if (!remove_mask) |
| 82 return Response::InvalidParams("No valid storage type specified"); | 79 return Response::InvalidParams("No valid storage type specified"); |
| 83 | 80 |
| 84 partition->ClearDataForOrigin( | 81 partition->ClearDataForOrigin( |
| 85 remove_mask, | 82 remove_mask, |
| 86 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL, | 83 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL, |
| 87 GURL(origin), | 84 GURL(origin), |
| 88 partition->GetURLRequestContext(), | 85 partition->GetURLRequestContext(), |
| 89 base::Bind(&base::DoNothing)); | 86 base::Bind(&base::DoNothing)); |
| 90 return Response::OK(); | 87 return Response::OK(); |
| 91 } | 88 } |
| 92 | 89 |
| 93 } // namespace storage | 90 } // namespace storage |
| 94 } // namespace devtools | 91 } // namespace devtools |
| 95 } // namespace content | 92 } // namespace content |
| OLD | NEW |