Chromium Code Reviews| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 m_state->setBoolean(DOMStorageAgentState::domStorageAgentEnabled, true); | 99 m_state->setBoolean(DOMStorageAgentState::domStorageAgentEnabled, true); |
| 100 m_instrumentingAgents->setInspectorDOMStorageAgent(this); | 100 m_instrumentingAgents->setInspectorDOMStorageAgent(this); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void InspectorDOMStorageAgent::disable(ErrorString*) | 103 void InspectorDOMStorageAgent::disable(ErrorString*) |
| 104 { | 104 { |
| 105 m_instrumentingAgents->setInspectorDOMStorageAgent(0); | 105 m_instrumentingAgents->setInspectorDOMStorageAgent(0); |
| 106 m_state->setBoolean(DOMStorageAgentState::domStorageAgentEnabled, false); | 106 m_state->setBoolean(DOMStorageAgentState::domStorageAgentEnabled, false); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void InspectorDOMStorageAgent::getDOMStorageItem(ErrorString* errorString, const RefPtr<JSONObject>& storageId, const String& key, bool* exists, String* value) | |
| 110 { | |
| 111 Frame* frame; | |
| 112 OwnPtr<StorageArea> storageArea = findStorageArea(errorString, storageId, fr ame); | |
| 113 if (!storageArea) | |
| 114 return; | |
| 115 | |
| 116 ExceptionCode ec = 0; | |
| 117 *exists = storageArea->contains(key, ec, frame); | |
| 118 if (hadException(ec, errorString)) | |
| 119 return; | |
| 120 | |
| 121 if (*exists) { | |
| 122 ec = 0; | |
|
apavlov
2013/07/31 12:51:35
This is not required, since hadException() would h
| |
| 123 *value = storageArea->getItem(key, ec, frame); | |
| 124 hadException(ec, errorString); | |
| 125 } | |
| 126 } | |
| 127 | |
| 109 void InspectorDOMStorageAgent::getDOMStorageItems(ErrorString* errorString, cons t RefPtr<JSONObject>& storageId, RefPtr<TypeBuilder::Array<TypeBuilder::Array<St ring> > >& items) | 128 void InspectorDOMStorageAgent::getDOMStorageItems(ErrorString* errorString, cons t RefPtr<JSONObject>& storageId, RefPtr<TypeBuilder::Array<TypeBuilder::Array<St ring> > >& items) |
| 110 { | 129 { |
| 111 Frame* frame; | 130 Frame* frame; |
| 112 OwnPtr<StorageArea> storageArea = findStorageArea(errorString, storageId, fr ame); | 131 OwnPtr<StorageArea> storageArea = findStorageArea(errorString, storageId, fr ame); |
| 113 if (!storageArea) | 132 if (!storageArea) |
| 114 return; | 133 return; |
| 115 | 134 |
| 116 RefPtr<TypeBuilder::Array<TypeBuilder::Array<String> > > storageItems = Type Builder::Array<TypeBuilder::Array<String> >::create(); | 135 RefPtr<TypeBuilder::Array<TypeBuilder::Array<String> > > storageItems = Type Builder::Array<TypeBuilder::Array<String> >::create(); |
| 117 | 136 |
| 118 ExceptionCode ec = 0; | 137 ExceptionCode ec = 0; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 } | 242 } |
| 224 targetFrame = frame; | 243 targetFrame = frame; |
| 225 | 244 |
| 226 if (isLocalStorage) | 245 if (isLocalStorage) |
| 227 return StorageNamespace::localStorageArea(frame->document()->securityOri gin()); | 246 return StorageNamespace::localStorageArea(frame->document()->securityOri gin()); |
| 228 return m_pageAgent->page()->sessionStorage()->storageArea(frame->document()- >securityOrigin()); | 247 return m_pageAgent->page()->sessionStorage()->storageArea(frame->document()- >securityOrigin()); |
| 229 } | 248 } |
| 230 | 249 |
| 231 } // namespace WebCore | 250 } // namespace WebCore |
| 232 | 251 |
| OLD | NEW |