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", |
| 175 &request->url().possibly_invalid_spec())); |
176 return net::ERR_NETWORK_ACCESS_DENIED; | 176 return net::ERR_NETWORK_ACCESS_DENIED; |
177 } | 177 } |
178 #endif | 178 #endif |
179 | 179 |
180 ForwardRequestStatus(REQUEST_STARTED, request, profile_); | 180 ForwardRequestStatus(REQUEST_STARTED, request, profile_); |
181 | 181 |
182 if (!enable_referrers_->GetValue()) | 182 if (!enable_referrers_->GetValue()) |
183 request->set_referrer(std::string()); | 183 request->set_referrer(std::string()); |
184 return ExtensionWebRequestEventRouter::GetInstance()->OnBeforeRequest( | 184 return ExtensionWebRequestEventRouter::GetInstance()->OnBeforeRequest( |
185 profile_, extension_info_map_.get(), request, callback, new_url); | 185 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; | 372 chrome::kExtensionScheme; |
373 } | 373 } |
374 | 374 |
375 int ChromeNetworkDelegate::OnBeforeSocketStreamConnect( | 375 int ChromeNetworkDelegate::OnBeforeSocketStreamConnect( |
376 net::SocketStream* socket, | 376 net::SocketStream* socket, |
377 const net::CompletionCallback& callback) { | 377 const net::CompletionCallback& callback) { |
378 #if defined(ENABLE_CONFIGURATION_POLICY) | 378 #if defined(ENABLE_CONFIGURATION_POLICY) |
379 if (url_blacklist_manager_ && | 379 if (url_blacklist_manager_ && |
380 url_blacklist_manager_->IsURLBlocked(socket->url())) { | 380 url_blacklist_manager_->IsURLBlocked(socket->url())) { |
381 // URL access blocked by policy. | 381 // 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( | 382 socket->net_log()->AddEvent( |
385 net::NetLog::TYPE_CHROME_POLICY_ABORTED_REQUEST, params); | 383 net::NetLog::TYPE_CHROME_POLICY_ABORTED_REQUEST, |
| 384 net::NetLog::StringCallback("url", |
| 385 &socket->url().possibly_invalid_spec())); |
386 return net::ERR_NETWORK_ACCESS_DENIED; | 386 return net::ERR_NETWORK_ACCESS_DENIED; |
387 } | 387 } |
388 #endif | 388 #endif |
389 return net::OK; | 389 return net::OK; |
390 } | 390 } |
OLD | NEW |