Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/net/chrome_network_delegate.h" | 5 #include "chrome/browser/net/chrome_network_delegate.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 370 GURL* new_url) { | 370 GURL* new_url) { |
| 371 // TODO(mmenke): Remove ScopedTracker below once crbug.com/456327 is fixed. | 371 // TODO(mmenke): Remove ScopedTracker below once crbug.com/456327 is fixed. |
| 372 tracked_objects::ScopedTracker tracking_profile1( | 372 tracked_objects::ScopedTracker tracking_profile1( |
| 373 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 373 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 374 "456327 URLRequest::ChromeNetworkDelegate::OnBeforeURLRequest")); | 374 "456327 URLRequest::ChromeNetworkDelegate::OnBeforeURLRequest")); |
| 375 | 375 |
| 376 #if defined(ENABLE_CONFIGURATION_POLICY) | 376 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 377 // TODO(joaodasilva): This prevents extensions from seeing URLs that are | 377 // TODO(joaodasilva): This prevents extensions from seeing URLs that are |
| 378 // blocked. However, an extension might redirect the request to another URL, | 378 // blocked. However, an extension might redirect the request to another URL, |
| 379 // which is not blocked. | 379 // which is not blocked. |
| 380 | |
| 381 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); | |
| 380 int error = net::ERR_BLOCKED_BY_ADMINISTRATOR; | 382 int error = net::ERR_BLOCKED_BY_ADMINISTRATOR; |
| 381 if (url_blacklist_manager_ && | 383 if (info && content::IsResourceTypeFrame(info->GetResourceType()) && |
|
Andrew T Wilson (Slow)
2015/05/12 16:44:30
Under what situations might info be null? I want t
mmenke
2015/05/12 16:59:13
If a request doesn't go through the ResourceDispat
| |
| 382 url_blacklist_manager_->IsRequestBlocked(*request, &error)) { | 384 url_blacklist_manager_ && |
| 385 url_blacklist_manager_->ShouldBlockRequestForFrame( | |
| 386 request->url(), &error)) { | |
| 383 // URL access blocked by policy. | 387 // URL access blocked by policy. |
| 384 request->net_log().AddEvent( | 388 request->net_log().AddEvent( |
| 385 net::NetLog::TYPE_CHROME_POLICY_ABORTED_REQUEST, | 389 net::NetLog::TYPE_CHROME_POLICY_ABORTED_REQUEST, |
| 386 net::NetLog::StringCallback("url", | 390 net::NetLog::StringCallback("url", |
| 387 &request->url().possibly_invalid_spec())); | 391 &request->url().possibly_invalid_spec())); |
| 388 return error; | 392 return error; |
| 389 } | 393 } |
| 390 #endif | 394 #endif |
| 391 | 395 |
| 392 // TODO(mmenke): Remove ScopedTracker below once crbug.com/456327 is fixed. | 396 // TODO(mmenke): Remove ScopedTracker below once crbug.com/456327 is fixed. |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 703 return experimental_web_platform_features_enabled_; | 707 return experimental_web_platform_features_enabled_; |
| 704 } | 708 } |
| 705 | 709 |
| 706 bool ChromeNetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader( | 710 bool ChromeNetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader( |
| 707 const net::URLRequest& request, | 711 const net::URLRequest& request, |
| 708 const GURL& target_url, | 712 const GURL& target_url, |
| 709 const GURL& referrer_url) const { | 713 const GURL& referrer_url) const { |
| 710 ReportInvalidReferrerSend(target_url, referrer_url); | 714 ReportInvalidReferrerSend(target_url, referrer_url); |
| 711 return true; | 715 return true; |
| 712 } | 716 } |
| OLD | NEW |