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 |
(...skipping 12 matching lines...) Expand all Loading... |
23 static const char kIndexedDB[] = "indexeddb"; | 23 static const char kIndexedDB[] = "indexeddb"; |
24 static const char kLocalStorage[] = "local_storage"; | 24 static const char kLocalStorage[] = "local_storage"; |
25 static const char kShaderCache[] = "shader_cache"; | 25 static const char kShaderCache[] = "shader_cache"; |
26 static const char kWebSQL[] = "websql"; | 26 static const char kWebSQL[] = "websql"; |
27 static const char kServiceWorkers[] = "service_workers"; | 27 static const char kServiceWorkers[] = "service_workers"; |
28 static const char kCacheStorage[] = "cache_storage"; | 28 static const char kCacheStorage[] = "cache_storage"; |
29 static const char kAll[] = "all"; | 29 static const char kAll[] = "all"; |
30 } | 30 } |
31 | 31 |
32 StorageHandler::StorageHandler() | 32 StorageHandler::StorageHandler() |
33 : host_(nullptr) { | 33 : DevToolsDomainHandler(Storage::Metainfo::domainName), |
| 34 host_(nullptr) { |
34 } | 35 } |
35 | 36 |
36 StorageHandler::~StorageHandler() = default; | 37 StorageHandler::~StorageHandler() = default; |
37 | 38 |
38 void StorageHandler::Wire(UberDispatcher* dispatcher) { | 39 void StorageHandler::Wire(UberDispatcher* dispatcher) { |
39 Storage::Dispatcher::wire(dispatcher, this); | 40 Storage::Dispatcher::wire(dispatcher, this); |
40 } | 41 } |
41 | 42 |
42 void StorageHandler::SetRenderFrameHost(RenderFrameHostImpl* host) { | |
43 host_ = host; | |
44 } | |
45 | |
46 Response StorageHandler::Disable() { | |
47 return Response::OK(); | |
48 } | |
49 | |
50 Response StorageHandler::ClearDataForOrigin( | 43 Response StorageHandler::ClearDataForOrigin( |
51 const std::string& origin, | 44 const std::string& origin, |
52 const std::string& storage_types) { | 45 const std::string& storage_types) { |
53 if (!host_) | 46 if (!host_) |
54 return Response::InternalError(); | 47 return Response::InternalError(); |
55 | 48 |
56 StoragePartition* partition = host_->GetProcess()->GetStoragePartition(); | 49 StoragePartition* partition = host_->GetProcess()->GetStoragePartition(); |
57 std::vector<std::string> types = base::SplitString( | 50 std::vector<std::string> types = base::SplitString( |
58 storage_types, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); | 51 storage_types, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); |
59 std::unordered_set<std::string> set(types.begin(), types.end()); | 52 std::unordered_set<std::string> set(types.begin(), types.end()); |
(...skipping 26 matching lines...) Expand all Loading... |
86 remove_mask, | 79 remove_mask, |
87 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL, | 80 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL, |
88 GURL(origin), | 81 GURL(origin), |
89 partition->GetURLRequestContext(), | 82 partition->GetURLRequestContext(), |
90 base::Bind(&base::DoNothing)); | 83 base::Bind(&base::DoNothing)); |
91 return Response::OK(); | 84 return Response::OK(); |
92 } | 85 } |
93 | 86 |
94 } // namespace protocol | 87 } // namespace protocol |
95 } // namespace content | 88 } // namespace content |
OLD | NEW |