| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "config.h" | 5 #include "config.h" |
| 6 #include "modules/storage/DOMWindowStorageController.h" | 6 #include "modules/storage/DOMWindowStorageController.h" |
| 7 | 7 |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/events/Event.h" | 9 #include "core/events/Event.h" |
| 10 #include "core/frame/LocalDOMWindow.h" | 10 #include "core/frame/LocalDOMWindow.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 { | 35 { |
| 36 return "DOMWindowStorageController"; | 36 return "DOMWindowStorageController"; |
| 37 } | 37 } |
| 38 | 38 |
| 39 // static | 39 // static |
| 40 DOMWindowStorageController& DOMWindowStorageController::from(Document& document) | 40 DOMWindowStorageController& DOMWindowStorageController::from(Document& document) |
| 41 { | 41 { |
| 42 DOMWindowStorageController* controller = static_cast<DOMWindowStorageControl
ler*>(WillBeHeapSupplement<Document>::from(document, supplementName())); | 42 DOMWindowStorageController* controller = static_cast<DOMWindowStorageControl
ler*>(WillBeHeapSupplement<Document>::from(document, supplementName())); |
| 43 if (!controller) { | 43 if (!controller) { |
| 44 controller = new DOMWindowStorageController(document); | 44 controller = new DOMWindowStorageController(document); |
| 45 DocumentSupplement::provideTo(document, supplementName(), adoptPtrWillBe
Noop(controller)); | 45 WillBeHeapSupplement<Document>::provideTo(document, supplementName(), ad
optPtrWillBeNoop(controller)); |
| 46 } | 46 } |
| 47 return *controller; | 47 return *controller; |
| 48 } | 48 } |
| 49 | 49 |
| 50 void DOMWindowStorageController::didAddEventListener(LocalDOMWindow* window, con
st AtomicString& eventType) | 50 void DOMWindowStorageController::didAddEventListener(LocalDOMWindow* window, con
st AtomicString& eventType) |
| 51 { | 51 { |
| 52 if (eventType == EventTypeNames::storage) { | 52 if (eventType == EventTypeNames::storage) { |
| 53 // Creating these blink::Storage objects informs the system that we'd li
ke to receive | 53 // Creating these blink::Storage objects informs the system that we'd li
ke to receive |
| 54 // notifications about storage events that might be triggered in other p
rocesses. Rather | 54 // notifications about storage events that might be triggered in other p
rocesses. Rather |
| 55 // than subscribe to these notifications explicitly, we subscribe to the
m implicitly to | 55 // than subscribe to these notifications explicitly, we subscribe to the
m implicitly to |
| 56 // simplify the work done by the system. | 56 // simplify the work done by the system. |
| 57 DOMWindowStorage::from(*window).localStorage(IGNORE_EXCEPTION); | 57 DOMWindowStorage::from(*window).localStorage(IGNORE_EXCEPTION); |
| 58 DOMWindowStorage::from(*window).sessionStorage(IGNORE_EXCEPTION); | 58 DOMWindowStorage::from(*window).sessionStorage(IGNORE_EXCEPTION); |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 | 61 |
| 62 } // namespace blink | 62 } // namespace blink |
| OLD | NEW |