Commit c4a7df85 authored by joi@chromium.org's avatar joi@chromium.org

Fix a bad inversion of logic (see OnCanThrottleRequest) and a bug

related to how a flag was persisted.

BUG=141081,141643


Review URL: https://chromiumcodereview.appspot.com/10854069

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150928 0039d316-1c4b-4281-b951-d872f2087c98
parent 5c42eed8
......@@ -53,6 +53,10 @@ bool ChromeNetworkDelegate::g_allow_file_access_ = false;
bool ChromeNetworkDelegate::g_allow_file_access_ = true;
#endif
// This remains false unless the --disable-extensions-http-throttling
// flag is passed to the browser.
bool ChromeNetworkDelegate::g_never_throttle_requests_ = false;
namespace {
// If the |request| failed due to problems with a proxy, forward the error to
......@@ -134,7 +138,6 @@ ChromeNetworkDelegate::ChromeNetworkDelegate(
cookie_settings_(cookie_settings),
extension_info_map_(extension_info_map),
enable_referrers_(enable_referrers),
never_throttle_requests_(false),
url_blacklist_manager_(url_blacklist_manager),
cache_stats_(cache_stats) {
DCHECK(event_router);
......@@ -144,8 +147,9 @@ ChromeNetworkDelegate::ChromeNetworkDelegate(
ChromeNetworkDelegate::~ChromeNetworkDelegate() {}
// static
void ChromeNetworkDelegate::NeverThrottleRequests() {
never_throttle_requests_ = true;
g_never_throttle_requests_ = true;
}
// static
......@@ -368,11 +372,11 @@ bool ChromeNetworkDelegate::OnCanAccessFile(const net::URLRequest& request,
bool ChromeNetworkDelegate::OnCanThrottleRequest(
const net::URLRequest& request) const {
if (never_throttle_requests_) {
if (g_never_throttle_requests_) {
return false;
}
return request.first_party_for_cookies().scheme() !=
return request.first_party_for_cookies().scheme() ==
chrome::kExtensionScheme;
}
......
......@@ -49,8 +49,9 @@ class ChromeNetworkDelegate : public net::NetworkDelegate {
chrome_browser_net::CacheStats* cache_stats);
virtual ~ChromeNetworkDelegate();
// Causes |OnCanThrottleRequest| to never return true.
void NeverThrottleRequests();
// Causes |OnCanThrottleRequest| to always return false, for all
// instances of this object.
static void NeverThrottleRequests();
// Binds |enable_referrers| to |pref_service| and moves it to the IO thread.
// This method should be called on the UI thread.
......@@ -115,15 +116,20 @@ class ChromeNetworkDelegate : public net::NetworkDelegate {
// Weak, owned by our owner.
BooleanPrefMember* enable_referrers_;
// True if OnCanThrottleRequest should always return false.
bool never_throttle_requests_;
// Weak, owned by our owner.
const policy::URLBlacklistManager* url_blacklist_manager_;
// When true, allow access to all file:// URLs.
static bool g_allow_file_access_;
// True if OnCanThrottleRequest should always return false.
//
// Note: This needs to be static as the instance of
// ChromeNetworkDelegate used may change over time, and we need to
// set this variable once at start-up time. It is effectively
// static anyway since it is based on a command-line flag.
static bool g_never_throttle_requests_;
// Pointer to IOThread global, should outlive ChromeNetworkDelegate.
chrome_browser_net::CacheStats* cache_stats_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment