| OLD | NEW |
| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 for (unsigned i = 0; i < storageArea->length(exceptionState, frame); ++i) { | 120 for (unsigned i = 0; i < storageArea->length(exceptionState, frame); ++i) { |
| 121 String name(storageArea->key(i, exceptionState, frame)); | 121 String name(storageArea->key(i, exceptionState, frame)); |
| 122 if (hadException(exceptionState, errorString)) | 122 if (hadException(exceptionState, errorString)) |
| 123 return; | 123 return; |
| 124 String value(storageArea->getItem(name, exceptionState, frame)); | 124 String value(storageArea->getItem(name, exceptionState, frame)); |
| 125 if (hadException(exceptionState, errorString)) | 125 if (hadException(exceptionState, errorString)) |
| 126 return; | 126 return; |
| 127 OwnPtr<protocol::Array<String>> entry = protocol::Array<String>::create(
); | 127 OwnPtr<protocol::Array<String>> entry = protocol::Array<String>::create(
); |
| 128 entry->addItem(name); | 128 entry->addItem(name); |
| 129 entry->addItem(value); | 129 entry->addItem(value); |
| 130 storageItems->addItem(entry.release()); | 130 storageItems->addItem(std::move(entry)); |
| 131 } | 131 } |
| 132 *items = storageItems.release(); | 132 *items = std::move(storageItems); |
| 133 } | 133 } |
| 134 | 134 |
| 135 static String toErrorString(ExceptionState& exceptionState) | 135 static String toErrorString(ExceptionState& exceptionState) |
| 136 { | 136 { |
| 137 if (exceptionState.hadException()) | 137 if (exceptionState.hadException()) |
| 138 return DOMException::getErrorName(exceptionState.code()); | 138 return DOMException::getErrorName(exceptionState.code()); |
| 139 return ""; | 139 return ""; |
| 140 } | 140 } |
| 141 | 141 |
| 142 void InspectorDOMStorageAgent::setDOMStorageItem(ErrorString* errorString, PassO
wnPtr<protocol::DOMStorage::StorageId> storageId, const String& key, const Strin
g& value) | 142 void InspectorDOMStorageAgent::setDOMStorageItem(ErrorString* errorString, PassO
wnPtr<protocol::DOMStorage::StorageId> storageId, const String& key, const Strin
g& value) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 } | 175 } |
| 176 | 176 |
| 177 void InspectorDOMStorageAgent::didDispatchDOMStorageEvent(const String& key, con
st String& oldValue, const String& newValue, StorageType storageType, SecurityOr
igin* securityOrigin) | 177 void InspectorDOMStorageAgent::didDispatchDOMStorageEvent(const String& key, con
st String& oldValue, const String& newValue, StorageType storageType, SecurityOr
igin* securityOrigin) |
| 178 { | 178 { |
| 179 if (!frontend()) | 179 if (!frontend()) |
| 180 return; | 180 return; |
| 181 | 181 |
| 182 OwnPtr<protocol::DOMStorage::StorageId> id = storageId(securityOrigin, stora
geType == LocalStorage); | 182 OwnPtr<protocol::DOMStorage::StorageId> id = storageId(securityOrigin, stora
geType == LocalStorage); |
| 183 | 183 |
| 184 if (key.isNull()) | 184 if (key.isNull()) |
| 185 frontend()->domStorageItemsCleared(id.release()); | 185 frontend()->domStorageItemsCleared(std::move(id)); |
| 186 else if (newValue.isNull()) | 186 else if (newValue.isNull()) |
| 187 frontend()->domStorageItemRemoved(id.release(), key); | 187 frontend()->domStorageItemRemoved(std::move(id), key); |
| 188 else if (oldValue.isNull()) | 188 else if (oldValue.isNull()) |
| 189 frontend()->domStorageItemAdded(id.release(), key, newValue); | 189 frontend()->domStorageItemAdded(std::move(id), key, newValue); |
| 190 else | 190 else |
| 191 frontend()->domStorageItemUpdated(id.release(), key, oldValue, newValue)
; | 191 frontend()->domStorageItemUpdated(std::move(id), key, oldValue, newValue
); |
| 192 } | 192 } |
| 193 | 193 |
| 194 StorageArea* InspectorDOMStorageAgent::findStorageArea(ErrorString* errorString,
PassOwnPtr<protocol::DOMStorage::StorageId> storageId, LocalFrame*& targetFrame
) | 194 StorageArea* InspectorDOMStorageAgent::findStorageArea(ErrorString* errorString,
PassOwnPtr<protocol::DOMStorage::StorageId> storageId, LocalFrame*& targetFrame
) |
| 195 { | 195 { |
| 196 String securityOrigin = storageId->getSecurityOrigin(); | 196 String securityOrigin = storageId->getSecurityOrigin(); |
| 197 bool isLocalStorage = storageId->getIsLocalStorage(); | 197 bool isLocalStorage = storageId->getIsLocalStorage(); |
| 198 | 198 |
| 199 if (!m_page->mainFrame()->isLocalFrame()) | 199 if (!m_page->mainFrame()->isLocalFrame()) |
| 200 return nullptr; | 200 return nullptr; |
| 201 | 201 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 213 StorageNamespace* sessionStorage = StorageNamespaceController::from(m_page)-
>sessionStorage(); | 213 StorageNamespace* sessionStorage = StorageNamespaceController::from(m_page)-
>sessionStorage(); |
| 214 if (!sessionStorage) { | 214 if (!sessionStorage) { |
| 215 if (errorString) | 215 if (errorString) |
| 216 *errorString = "SessionStorage is not supported"; | 216 *errorString = "SessionStorage is not supported"; |
| 217 return nullptr; | 217 return nullptr; |
| 218 } | 218 } |
| 219 return sessionStorage->storageArea(frame->document()->getSecurityOrigin()); | 219 return sessionStorage->storageArea(frame->document()->getSecurityOrigin()); |
| 220 } | 220 } |
| 221 | 221 |
| 222 } // namespace blink | 222 } // namespace blink |
| OLD | NEW |