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

Side by Side Diff: Source/core/storage/DOMWindowStorage.cpp

Issue 805773004: Create DOMWindowStorage as a DOMWindowLifecycleObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years 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 | « Source/core/storage/DOMWindowStorage.h ('k') | Source/web/FrameLoaderClientImpl.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "core/storage/DOMWindowStorage.h"
7
8 #include "core/dom/Document.h"
9 #include "core/events/Event.h"
10 #include "core/frame/LocalDOMWindow.h"
11 #include "core/page/Page.h"
12
13 namespace blink {
14
15 DOMWindowStorage::DOMWindowStorage(Document& document)
16 : DOMWindowLifecycleObserver(document.domWindow())
17 , m_document(document)
18 {
19 }
20
21 DOMWindowStorage::~DOMWindowStorage()
22 {
23 }
24
25 // static
26 const char* DOMWindowStorage::supplementName()
27 {
28 return "DOMWindowStorage";
29 }
30
31 // static
32 DOMWindowStorage& DOMWindowStorage::from(Document& document)
33 {
34 DOMWindowStorage* controller = static_cast<DOMWindowStorage*>(WillBeHeapSupp lement<Document>::from(document, supplementName()));
michaeln 2014/12/16 00:12:11 I'm not familiar with how 'supplements' are typica
35 if (!controller) {
36 controller = new DOMWindowStorage(document);
37 DocumentSupplement::provideTo(document, supplementName(), adoptPtrWillBe Noop(controller));
38 }
39 return *controller;
40 }
41
42 void DOMWindowStorage::didAddEventListener(LocalDOMWindow* window, const AtomicS tring& eventType)
43 {
44 if (eventType == EventTypeNames::storage) {
45 // Creating these blink::Storage objects informs the system that we'd li ke to receive
46 // notifications about storage events that might be triggered in other p rocesses. Rather
47 // than subscribe to these notifications explicitly, we subscribe to the m implicitly to
48 // simplify the work done by the system.
49 window->localStorage(IGNORE_EXCEPTION);
50 window->sessionStorage(IGNORE_EXCEPTION);
51 }
52 }
53
54 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/storage/DOMWindowStorage.h ('k') | Source/web/FrameLoaderClientImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698