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

Side by Side Diff: third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 return kWebConnectionTypeUnknown; 289 return kWebConnectionTypeUnknown;
290 } 290 }
291 291
292 String GetReferrerPolicy(ReferrerPolicy policy) { 292 String GetReferrerPolicy(ReferrerPolicy policy) {
293 switch (policy) { 293 switch (policy) {
294 case kReferrerPolicyAlways: 294 case kReferrerPolicyAlways:
295 return protocol::Network::Request::ReferrerPolicyEnum::UnsafeUrl; 295 return protocol::Network::Request::ReferrerPolicyEnum::UnsafeUrl;
296 case kReferrerPolicyDefault: 296 case kReferrerPolicyDefault:
297 if (RuntimeEnabledFeatures::ReducedReferrerGranularityEnabled()) { 297 if (RuntimeEnabledFeatures::ReducedReferrerGranularityEnabled()) {
298 return protocol::Network::Request::ReferrerPolicyEnum:: 298 return protocol::Network::Request::ReferrerPolicyEnum::
299 NoReferrerWhenDowngradeOriginWhenCrossOrigin; 299 StrictOriginWhenCrossOrigin;
300 } else { 300 } else {
301 return protocol::Network::Request::ReferrerPolicyEnum:: 301 return protocol::Network::Request::ReferrerPolicyEnum::
302 NoReferrerWhenDowngrade; 302 NoReferrerWhenDowngrade;
303 } 303 }
304 case kReferrerPolicyNoReferrerWhenDowngrade: 304 case kReferrerPolicyNoReferrerWhenDowngrade:
305 return protocol::Network::Request::ReferrerPolicyEnum:: 305 return protocol::Network::Request::ReferrerPolicyEnum::
306 NoReferrerWhenDowngrade; 306 NoReferrerWhenDowngrade;
307 case kReferrerPolicyNever: 307 case kReferrerPolicyNever:
308 return protocol::Network::Request::ReferrerPolicyEnum::NoReferrer; 308 return protocol::Network::Request::ReferrerPolicyEnum::NoReferrer;
309 case kReferrerPolicyOrigin: 309 case kReferrerPolicyOrigin:
310 return protocol::Network::Request::ReferrerPolicyEnum::Origin; 310 return protocol::Network::Request::ReferrerPolicyEnum::Origin;
311 case kReferrerPolicyOriginWhenCrossOrigin: 311 case kReferrerPolicyOriginWhenCrossOrigin:
312 return protocol::Network::Request::ReferrerPolicyEnum:: 312 return protocol::Network::Request::ReferrerPolicyEnum::
313 OriginWhenCrossOrigin; 313 OriginWhenCrossOrigin;
314 case kReferrerPolicySameOrigin:
315 return protocol::Network::Request::ReferrerPolicyEnum::SameOrigin;
316 case kReferrerPolicyStrictOrigin:
317 return protocol::Network::Request::ReferrerPolicyEnum::StrictOrigin;
314 case kReferrerPolicyNoReferrerWhenDowngradeOriginWhenCrossOrigin: 318 case kReferrerPolicyNoReferrerWhenDowngradeOriginWhenCrossOrigin:
315 return protocol::Network::Request::ReferrerPolicyEnum:: 319 return protocol::Network::Request::ReferrerPolicyEnum::
316 NoReferrerWhenDowngradeOriginWhenCrossOrigin; 320 StrictOriginWhenCrossOrigin;
317 } 321 }
318 322
319 return protocol::Network::Request::ReferrerPolicyEnum:: 323 return protocol::Network::Request::ReferrerPolicyEnum::
320 NoReferrerWhenDowngrade; 324 NoReferrerWhenDowngrade;
321 } 325 }
322 326
323 } // namespace 327 } // namespace
324 328
325 void InspectorNetworkAgent::Restore() { 329 void InspectorNetworkAgent::Restore() {
326 if (state_->booleanProperty(NetworkAgentState::kNetworkAgentEnabled, false)) { 330 if (state_->booleanProperty(NetworkAgentState::kNetworkAgentEnabled, false)) {
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1532 inspected_frames->Root()), 1536 inspected_frames->Root()),
1533 this, 1537 this,
1534 &InspectorNetworkAgent::RemoveFinishedReplayXHRFired) {} 1538 &InspectorNetworkAgent::RemoveFinishedReplayXHRFired) {}
1535 1539
1536 void InspectorNetworkAgent::ShouldForceCORSPreflight(bool* result) { 1540 void InspectorNetworkAgent::ShouldForceCORSPreflight(bool* result) {
1537 if (state_->booleanProperty(NetworkAgentState::kCacheDisabled, false)) 1541 if (state_->booleanProperty(NetworkAgentState::kCacheDisabled, false))
1538 *result = true; 1542 *result = true;
1539 } 1543 }
1540 1544
1541 } // namespace blink 1545 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698