Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: third_party/WebKit/Source/modules/storage/InspectorDOMStorageAgent.cpp

Issue 2632553002: [DevTools] Clear local storage (Closed)
Patch Set: [DevTools] Clear local storage Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/storage/InspectorDOMStorageAgent.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. 3 * Copyright (C) 2013 Samsung Electronics. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 if (!m_isEnabled) 87 if (!m_isEnabled)
88 return Response::OK(); 88 return Response::OK();
89 m_isEnabled = false; 89 m_isEnabled = false;
90 m_state->setBoolean(DOMStorageAgentState::domStorageAgentEnabled, false); 90 m_state->setBoolean(DOMStorageAgentState::domStorageAgentEnabled, false);
91 if (StorageNamespaceController* controller = 91 if (StorageNamespaceController* controller =
92 StorageNamespaceController::from(m_page)) 92 StorageNamespaceController::from(m_page))
93 controller->setInspectorAgent(nullptr); 93 controller->setInspectorAgent(nullptr);
94 return Response::OK(); 94 return Response::OK();
95 } 95 }
96 96
97 Response InspectorDOMStorageAgent::clear(
98 std::unique_ptr<protocol::DOMStorage::StorageId> storageId) {
99 LocalFrame* frame = nullptr;
100 StorageArea* storageArea = nullptr;
101 Response response = findStorageArea(std::move(storageId), frame, storageArea);
102 if (!response.isSuccess())
103 return response;
104 DummyExceptionStateForTesting exceptionState;
105 storageArea->clear(exceptionState, frame);
106 if (exceptionState.hadException())
107 return Response::Error("Could not clear the storage");
108 return Response::OK();
109 }
110
97 Response InspectorDOMStorageAgent::getDOMStorageItems( 111 Response InspectorDOMStorageAgent::getDOMStorageItems(
98 std::unique_ptr<protocol::DOMStorage::StorageId> storageId, 112 std::unique_ptr<protocol::DOMStorage::StorageId> storageId,
99 std::unique_ptr<protocol::Array<protocol::Array<String>>>* items) { 113 std::unique_ptr<protocol::Array<protocol::Array<String>>>* items) {
100 LocalFrame* frame = nullptr; 114 LocalFrame* frame = nullptr;
101 StorageArea* storageArea = nullptr; 115 StorageArea* storageArea = nullptr;
102 Response response = findStorageArea(std::move(storageId), frame, storageArea); 116 Response response = findStorageArea(std::move(storageId), frame, storageArea);
103 if (!response.isSuccess()) 117 if (!response.isSuccess())
104 return response; 118 return response;
105 119
106 std::unique_ptr<protocol::Array<protocol::Array<String>>> storageItems = 120 std::unique_ptr<protocol::Array<protocol::Array<String>>> storageItems =
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 StorageNamespace* sessionStorage = 224 StorageNamespace* sessionStorage =
211 StorageNamespaceController::from(m_page)->sessionStorage(); 225 StorageNamespaceController::from(m_page)->sessionStorage();
212 if (!sessionStorage) 226 if (!sessionStorage)
213 return Response::Error("SessionStorage is not supported"); 227 return Response::Error("SessionStorage is not supported");
214 storageArea = 228 storageArea =
215 sessionStorage->storageArea(frame->document()->getSecurityOrigin()); 229 sessionStorage->storageArea(frame->document()->getSecurityOrigin());
216 return Response::OK(); 230 return Response::OK();
217 } 231 }
218 232
219 } // namespace blink 233 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/storage/InspectorDOMStorageAgent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698