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

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

Issue 1373773003: Implement 'window.isSecureContext'. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: document. Created 5 years, 2 months 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 * Copyright (C) 2012 Google Inc. All Rights Reserved. 3 * Copyright (C) 2012 Google Inc. 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 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 class PublicURLManager; 56 class PublicURLManager;
57 class SecurityOrigin; 57 class SecurityOrigin;
58 class ScriptCallStack; 58 class ScriptCallStack;
59 59
60 class CORE_EXPORT ExecutionContext 60 class CORE_EXPORT ExecutionContext
61 : public ContextLifecycleNotifier, public WillBeHeapSupplementable<Execution Context> { 61 : public ContextLifecycleNotifier, public WillBeHeapSupplementable<Execution Context> {
62 WTF_MAKE_NONCOPYABLE(ExecutionContext); 62 WTF_MAKE_NONCOPYABLE(ExecutionContext);
63 public: 63 public:
64 DECLARE_VIRTUAL_TRACE(); 64 DECLARE_VIRTUAL_TRACE();
65 65
66 // Used to specify whether |isPrivilegedContext| should walk the 66 // Used to specify whether |isSecureContext| should walk the
67 // ancestor tree to decide whether to restrict usage of a powerful 67 // ancestor tree to decide whether to restrict usage of a powerful
68 // feature. 68 // feature.
69 enum PrivilegeContextCheck { 69 enum SecureContextCheck {
70 StandardPrivilegeCheck, 70 StandardSecureContextCheck,
71 WebCryptoPrivilegeCheck 71 WebCryptoSecureContextCheck
72 }; 72 };
73 73
74 virtual bool isDocument() const { return false; } 74 virtual bool isDocument() const { return false; }
75 virtual bool isWorkerGlobalScope() const { return false; } 75 virtual bool isWorkerGlobalScope() const { return false; }
76 virtual bool isDedicatedWorkerGlobalScope() const { return false; } 76 virtual bool isDedicatedWorkerGlobalScope() const { return false; }
77 virtual bool isSharedWorkerGlobalScope() const { return false; } 77 virtual bool isSharedWorkerGlobalScope() const { return false; }
78 virtual bool isServiceWorkerGlobalScope() const { return false; } 78 virtual bool isServiceWorkerGlobalScope() const { return false; }
79 virtual bool isCompositorWorkerGlobalScope() const { return false; } 79 virtual bool isCompositorWorkerGlobalScope() const { return false; }
80 virtual bool isJSExecutionForbidden() const { return false; } 80 virtual bool isJSExecutionForbidden() const { return false; }
81 81
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 String suboriginName(); 149 String suboriginName();
150 150
151 // Methods related to window interaction. It should be used to manage window 151 // Methods related to window interaction. It should be used to manage window
152 // focusing and window creation permission for an ExecutionContext. 152 // focusing and window creation permission for an ExecutionContext.
153 void allowWindowInteraction(); 153 void allowWindowInteraction();
154 void consumeWindowInteraction(); 154 void consumeWindowInteraction();
155 bool isWindowInteractionAllowed() const; 155 bool isWindowInteractionAllowed() const;
156 156
157 // Decides whether this context is privileged, as described in 157 // Decides whether this context is privileged, as described in
158 // https://w3c.github.io/webappsec/specs/powerfulfeatures/#settings-privileg ed. 158 // https://w3c.github.io/webappsec/specs/powerfulfeatures/#settings-privileg ed.
159 virtual bool isPrivilegedContext(String& errorMessage, const PrivilegeContex tCheck = StandardPrivilegeCheck) const = 0; 159 virtual bool isSecureContext(String& errorMessage, const SecureContextCheck = StandardSecureContextCheck) const = 0;
160 160
161 virtual void setReferrerPolicy(ReferrerPolicy); 161 virtual void setReferrerPolicy(ReferrerPolicy);
162 ReferrerPolicy referrerPolicy() const { return m_referrerPolicy; } 162 ReferrerPolicy referrerPolicy() const { return m_referrerPolicy; }
163 163
164 protected: 164 protected:
165 ExecutionContext(); 165 ExecutionContext();
166 virtual ~ExecutionContext(); 166 virtual ~ExecutionContext();
167 167
168 virtual const KURL& virtualURL() const = 0; 168 virtual const KURL& virtualURL() const = 0;
169 virtual KURL virtualCompleteURL(const String&) const = 0; 169 virtual KURL virtualCompleteURL(const String&) const = 0;
(...skipping 29 matching lines...) Expand all
199 199
200 Deque<OwnPtr<SuspendableTask>> m_suspendedTasks; 200 Deque<OwnPtr<SuspendableTask>> m_suspendedTasks;
201 bool m_isRunSuspendableTasksScheduled; 201 bool m_isRunSuspendableTasksScheduled;
202 202
203 ReferrerPolicy m_referrerPolicy; 203 ReferrerPolicy m_referrerPolicy;
204 }; 204 };
205 205
206 } // namespace blink 206 } // namespace blink
207 207
208 #endif // ExecutionContext_h 208 #endif // ExecutionContext_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/core/dom/Fullscreen.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698