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

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

Issue 2918313002: Implement new referrer policies (Closed)
Patch Set: ios fix Created 3 years, 6 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 : kDoNotSupportReferrerPolicyLegacyKeywords, 209 : kDoNotSupportReferrerPolicyLegacyKeywords,
210 &referrer_policy)) { 210 &referrer_policy)) {
211 AddConsoleMessage(ConsoleMessage::Create( 211 AddConsoleMessage(ConsoleMessage::Create(
212 kRenderingMessageSource, kErrorMessageLevel, 212 kRenderingMessageSource, kErrorMessageLevel,
213 "Failed to set referrer policy: The value '" + policies + 213 "Failed to set referrer policy: The value '" + policies +
214 "' is not one of " + 214 "' is not one of " +
215 (support_legacy_keywords 215 (support_legacy_keywords
216 ? "'always', 'default', 'never', 'origin-when-crossorigin', " 216 ? "'always', 'default', 'never', 'origin-when-crossorigin', "
217 : "") + 217 : "") +
218 "'no-referrer', 'no-referrer-when-downgrade', 'origin', " 218 "'no-referrer', 'no-referrer-when-downgrade', 'origin', "
219 "'origin-when-cross-origin', or 'unsafe-url'. The referrer policy " 219 "'origin-when-cross-origin', 'same-origin', 'strict-origin', "
220 "'strict-origin-when-cross-origin', or 'unsafe-url'. The referrer "
221 "policy "
220 "has been left unchanged.")); 222 "has been left unchanged."));
221 return; 223 return;
222 } 224 }
223 225
224 SetReferrerPolicy(referrer_policy); 226 SetReferrerPolicy(referrer_policy);
225 } 227 }
226 228
227 void ExecutionContext::SetReferrerPolicy(ReferrerPolicy referrer_policy) { 229 void ExecutionContext::SetReferrerPolicy(ReferrerPolicy referrer_policy) {
228 // When a referrer policy has already been set, the latest value takes 230 // When a referrer policy has already been set, the latest value takes
229 // precedence. 231 // precedence.
230 UseCounter::Count(this, UseCounter::kSetReferrerPolicy); 232 UseCounter::Count(this, UseCounter::kSetReferrerPolicy);
231 if (referrer_policy_ != kReferrerPolicyDefault) 233 if (referrer_policy_ != kReferrerPolicyDefault)
232 UseCounter::Count(this, UseCounter::kResetReferrerPolicy); 234 UseCounter::Count(this, UseCounter::kResetReferrerPolicy);
233 235
234 referrer_policy_ = referrer_policy; 236 referrer_policy_ = referrer_policy;
235 } 237 }
236 238
237 void ExecutionContext::RemoveURLFromMemoryCache(const KURL& url) { 239 void ExecutionContext::RemoveURLFromMemoryCache(const KURL& url) {
238 GetMemoryCache()->RemoveURLFromCache(url); 240 GetMemoryCache()->RemoveURLFromCache(url);
239 } 241 }
240 242
241 DEFINE_TRACE(ExecutionContext) { 243 DEFINE_TRACE(ExecutionContext) {
242 visitor->Trace(public_url_manager_); 244 visitor->Trace(public_url_manager_);
243 visitor->Trace(pending_exceptions_); 245 visitor->Trace(pending_exceptions_);
244 ContextLifecycleNotifier::Trace(visitor); 246 ContextLifecycleNotifier::Trace(visitor);
245 Supplementable<ExecutionContext>::Trace(visitor); 247 Supplementable<ExecutionContext>::Trace(visitor);
246 } 248 }
247 249
248 } // namespace blink 250 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698