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

Side by Side Diff: net/base/sdch_manager.cc

Issue 329373002: Avoid advertising SDCH over HTTPS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reset global variables between tests. Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | net/base/sdch_manager_unittest.cc » ('j') | net/base/sdch_manager_unittest.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "net/base/sdch_manager.h" 5 #include "net/base/sdch_manager.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 Global()->exponential_blacklist_count.find(domain)) 326 Global()->exponential_blacklist_count.find(domain))
327 return 0; 327 return 0;
328 return Global()->exponential_blacklist_count[StringToLowerASCII(domain)]; 328 return Global()->exponential_blacklist_count[StringToLowerASCII(domain)];
329 } 329 }
330 330
331 bool SdchManager::IsInSupportedDomain(const GURL& url) { 331 bool SdchManager::IsInSupportedDomain(const GURL& url) {
332 DCHECK(CalledOnValidThread()); 332 DCHECK(CalledOnValidThread());
333 if (!g_sdch_enabled_ ) 333 if (!g_sdch_enabled_ )
334 return false; 334 return false;
335 335
336 if (!secure_scheme_supported() && url.SchemeIsSecure())
337 return false;
338
336 if (blacklisted_domains_.empty()) 339 if (blacklisted_domains_.empty())
337 return true; 340 return true;
338 341
339 std::string domain(StringToLowerASCII(url.host())); 342 std::string domain(StringToLowerASCII(url.host()));
340 DomainCounter::iterator it = blacklisted_domains_.find(domain); 343 DomainCounter::iterator it = blacklisted_domains_.find(domain);
341 if (blacklisted_domains_.end() == it) 344 if (blacklisted_domains_.end() == it)
342 return true; 345 return true;
343 346
344 int count = it->second - 1; 347 int count = it->second - 1;
345 if (count > 0) 348 if (count > 0)
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 case '/': 581 case '/':
579 (*output)[i] = '_'; 582 (*output)[i] = '_';
580 continue; 583 continue;
581 default: 584 default:
582 continue; 585 continue;
583 } 586 }
584 } 587 }
585 } 588 }
586 589
587 } // namespace net 590 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/base/sdch_manager_unittest.cc » ('j') | net/base/sdch_manager_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698