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

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: Incorporated comments. 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') | no next file with comments »
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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 exponential_blacklist_count.find(domain)) 289 exponential_blacklist_count.find(domain))
290 return 0; 290 return 0;
291 return exponential_blacklist_count[StringToLowerASCII(domain)]; 291 return exponential_blacklist_count[StringToLowerASCII(domain)];
292 } 292 }
293 293
294 bool SdchManager::IsInSupportedDomain(const GURL& url) { 294 bool SdchManager::IsInSupportedDomain(const GURL& url) {
295 DCHECK(CalledOnValidThread()); 295 DCHECK(CalledOnValidThread());
296 if (!g_sdch_enabled_ ) 296 if (!g_sdch_enabled_ )
297 return false; 297 return false;
298 298
299 if (!secure_scheme_supported() && url.SchemeIsSecure())
300 return false;
301
299 if (blacklisted_domains_.empty()) 302 if (blacklisted_domains_.empty())
300 return true; 303 return true;
301 304
302 std::string domain(StringToLowerASCII(url.host())); 305 std::string domain(StringToLowerASCII(url.host()));
303 DomainCounter::iterator it = blacklisted_domains_.find(domain); 306 DomainCounter::iterator it = blacklisted_domains_.find(domain);
304 if (blacklisted_domains_.end() == it) 307 if (blacklisted_domains_.end() == it)
305 return true; 308 return true;
306 309
307 int count = it->second - 1; 310 int count = it->second - 1;
308 if (count > 0) 311 if (count > 0)
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 case '/': 550 case '/':
548 (*output)[i] = '_'; 551 (*output)[i] = '_';
549 continue; 552 continue;
550 default: 553 default:
551 continue; 554 continue;
552 } 555 }
553 } 556 }
554 } 557 }
555 558
556 } // namespace net 559 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/base/sdch_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698