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

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

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

Powered by Google App Engine
This is Rietveld 408576698