OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/field_trial.h" | 5 #include "base/field_trial.h" |
6 #include "base/histogram.h" | 6 #include "base/histogram.h" |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/sha2.h" | 8 #include "base/sha2.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "net/base/base64.h" | 10 #include "net/base/base64.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 dictionaries_.erase(it->first); | 58 dictionaries_.erase(it->first); |
59 } | 59 } |
60 global_ = NULL; | 60 global_ = NULL; |
61 } | 61 } |
62 | 62 |
63 // static | 63 // static |
64 bool SdchManager::BlacklistDomain(const GURL& url) { | 64 bool SdchManager::BlacklistDomain(const GURL& url) { |
65 if (!global_ ) | 65 if (!global_ ) |
66 return false; | 66 return false; |
67 std::string domain(url.host()); | 67 std::string domain(url.host()); |
68 UMA_HISTOGRAM_TIMES(L"Sdch.UptimeBeforeBlacklisting", | 68 UMA_HISTOGRAM_MEDIUM_TIMES(L"Sdch.UptimeBeforeBlacklisting_M", |
69 Time::Now() - FieldTrialList::application_start_time()); | 69 Time::Now() - FieldTrialList::application_start_time()); |
70 global_->blacklisted_domains_.insert(url.host()); | 70 global_->blacklisted_domains_.insert(url.host()); |
71 return true; | 71 return true; |
72 } | 72 } |
73 | 73 |
74 void SdchManager::EnableSdchSupport(const std::string& domain) { | 74 void SdchManager::EnableSdchSupport(const std::string& domain) { |
75 // We presume that there is a SDCH manager instance. | 75 // We presume that there is a SDCH manager instance. |
76 global_->supported_domain_ = domain; | 76 global_->supported_domain_ = domain; |
77 global_->sdch_enabled_ = true; | 77 global_->sdch_enabled_ = true; |
78 } | 78 } |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 return false; | 447 return false; |
448 return restriction[prefix_length - 1] == '/' || path[prefix_length] == '/'; | 448 return restriction[prefix_length - 1] == '/' || path[prefix_length] == '/'; |
449 } | 449 } |
450 | 450 |
451 // static | 451 // static |
452 bool SdchManager::Dictionary::DomainMatch(const GURL& gurl, | 452 bool SdchManager::Dictionary::DomainMatch(const GURL& gurl, |
453 const std::string& restriction) { | 453 const std::string& restriction) { |
454 // TODO(jar): This is not precisely a domain match definition. | 454 // TODO(jar): This is not precisely a domain match definition. |
455 return gurl.DomainIs(restriction.data(), restriction.size()); | 455 return gurl.DomainIs(restriction.data(), restriction.size()); |
456 } | 456 } |
OLD | NEW |