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

Side by Side Diff: third_party/WebKit/Source/core/dom/ContextLifecycleObserver.h

Issue 2562303002: Add ContextLifecycleObserver::frame() (Closed)
Patch Set: temp Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 15 matching lines...) Expand all
26 26
27 #ifndef ContextLifecycleObserver_h 27 #ifndef ContextLifecycleObserver_h
28 #define ContextLifecycleObserver_h 28 #define ContextLifecycleObserver_h
29 29
30 #include "core/CoreExport.h" 30 #include "core/CoreExport.h"
31 #include "core/dom/ExecutionContext.h" 31 #include "core/dom/ExecutionContext.h"
32 #include "platform/LifecycleObserver.h" 32 #include "platform/LifecycleObserver.h"
33 33
34 namespace blink { 34 namespace blink {
35 35
36 class LocalFrame;
37
36 class CORE_EXPORT ContextLifecycleObserver 38 class CORE_EXPORT ContextLifecycleObserver
37 : public LifecycleObserver<ExecutionContext, ContextLifecycleObserver> { 39 : public LifecycleObserver<ExecutionContext, ContextLifecycleObserver> {
38 public: 40 public:
41 // Returns null after the observing context is detached.
39 ExecutionContext* getExecutionContext() const { return lifecycleContext(); } 42 ExecutionContext* getExecutionContext() const { return lifecycleContext(); }
40 43
44 // Returns null after the observing context is detached or if the context
45 // doesn't have a frame (i.e., if the context is not a Document).
46 LocalFrame* frame() const;
47
41 enum Type { 48 enum Type {
42 GenericType, 49 GenericType,
43 SuspendableObjectType, 50 SuspendableObjectType,
44 }; 51 };
45 52
46 Type observerType() const { return m_observerType; } 53 Type observerType() const { return m_observerType; }
47 54
48 protected: 55 protected:
49 explicit ContextLifecycleObserver(ExecutionContext* executionContext, 56 explicit ContextLifecycleObserver(ExecutionContext* executionContext,
50 Type type = GenericType) 57 Type type = GenericType)
51 : LifecycleObserver(executionContext), m_observerType(type) {} 58 : LifecycleObserver(executionContext), m_observerType(type) {}
52 59
53 private: 60 private:
54 Type m_observerType; 61 Type m_observerType;
55 }; 62 };
56 63
57 } // namespace blink 64 } // namespace blink
58 65
59 #endif // ContextLifecycleObserver_h 66 #endif // ContextLifecycleObserver_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/BUILD.gn ('k') | third_party/WebKit/Source/core/dom/ContextLifecycleObserver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698