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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/content_settings/cookie_settings.h" | 9 #include "chrome/browser/content_settings/cookie_settings.h" |
| 10 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 10 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 162 net::URLRequest* request, | 162 net::URLRequest* request, |
| 163 const net::CompletionCallback& callback, | 163 const net::CompletionCallback& callback, |
| 164 GURL* new_url) { | 164 GURL* new_url) { |
| 165 #if defined(ENABLE_CONFIGURATION_POLICY) | 165 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 166 // TODO(joaodasilva): This prevents extensions from seeing URLs that are | 166 // TODO(joaodasilva): This prevents extensions from seeing URLs that are |
| 167 // blocked. However, an extension might redirect the request to another URL, | 167 // blocked. However, an extension might redirect the request to another URL, |
| 168 // which is not blocked. | 168 // which is not blocked. |
| 169 if (url_blacklist_manager_ && | 169 if (url_blacklist_manager_ && |
| 170 url_blacklist_manager_->IsURLBlocked(request->url())) { | 170 url_blacklist_manager_->IsURLBlocked(request->url())) { |
| 171 // URL access blocked by policy. | 171 // URL access blocked by policy. |
| 172 scoped_refptr<net::NetLog::EventParameters> params; | |
| 173 params = new net::NetLogStringParameter("url", request->url().spec()); | |
| 174 request->net_log().AddEvent( | 172 request->net_log().AddEvent( |
| 175 net::NetLog::TYPE_CHROME_POLICY_ABORTED_REQUEST, params); | 173 net::NetLog::TYPE_CHROME_POLICY_ABORTED_REQUEST, |
| 174 net::NetLog::StringCallback("url", &request->url().spec())); | |
|
eroman
2012/06/14 18:04:31
nit: might want to use possibly_invalid_spec() jus
mmenke
2012/06/14 18:49:42
Done.
| |
| 176 return net::ERR_NETWORK_ACCESS_DENIED; | 175 return net::ERR_NETWORK_ACCESS_DENIED; |
| 177 } | 176 } |
| 178 #endif | 177 #endif |
| 179 | 178 |
| 180 ForwardRequestStatus(REQUEST_STARTED, request, profile_); | 179 ForwardRequestStatus(REQUEST_STARTED, request, profile_); |
| 181 | 180 |
| 182 if (!enable_referrers_->GetValue()) | 181 if (!enable_referrers_->GetValue()) |
| 183 request->set_referrer(std::string()); | 182 request->set_referrer(std::string()); |
| 184 return ExtensionWebRequestEventRouter::GetInstance()->OnBeforeRequest( | 183 return ExtensionWebRequestEventRouter::GetInstance()->OnBeforeRequest( |
| 185 profile_, extension_info_map_.get(), request, callback, new_url); | 184 profile_, extension_info_map_.get(), request, callback, new_url); |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 372 chrome::kExtensionScheme; | 371 chrome::kExtensionScheme; |
| 373 } | 372 } |
| 374 | 373 |
| 375 int ChromeNetworkDelegate::OnBeforeSocketStreamConnect( | 374 int ChromeNetworkDelegate::OnBeforeSocketStreamConnect( |
| 376 net::SocketStream* socket, | 375 net::SocketStream* socket, |
| 377 const net::CompletionCallback& callback) { | 376 const net::CompletionCallback& callback) { |
| 378 #if defined(ENABLE_CONFIGURATION_POLICY) | 377 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 379 if (url_blacklist_manager_ && | 378 if (url_blacklist_manager_ && |
| 380 url_blacklist_manager_->IsURLBlocked(socket->url())) { | 379 url_blacklist_manager_->IsURLBlocked(socket->url())) { |
| 381 // URL access blocked by policy. | 380 // URL access blocked by policy. |
| 382 scoped_refptr<net::NetLog::EventParameters> params; | |
| 383 params = new net::NetLogStringParameter("url", socket->url().spec()); | |
| 384 socket->net_log()->AddEvent( | 381 socket->net_log()->AddEvent( |
| 385 net::NetLog::TYPE_CHROME_POLICY_ABORTED_REQUEST, params); | 382 net::NetLog::TYPE_CHROME_POLICY_ABORTED_REQUEST, |
| 383 net::NetLog::StringCallback("url", &socket->url().spec())); | |
|
eroman
2012/06/14 18:04:31
ditto.
mmenke
2012/06/14 18:49:42
Done.
| |
| 386 return net::ERR_NETWORK_ACCESS_DENIED; | 384 return net::ERR_NETWORK_ACCESS_DENIED; |
| 387 } | 385 } |
| 388 #endif | 386 #endif |
| 389 return net::OK; | 387 return net::OK; |
| 390 } | 388 } |
| OLD | NEW |