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

Unified Diff: components/domain_reliability/config.h

Issue 252613002: Domain Reliability: More security review. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: ;_; Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/domain_reliability/beacon.cc ('k') | components/domain_reliability/config.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/domain_reliability/config.h
diff --git a/components/domain_reliability/config.h b/components/domain_reliability/config.h
index 8fd1ce8f207dff95e5dc2c614c6f8eecf194e4a5..1ba3c7ab28553b8b24da518e7c88f3f758308ec8 100644
--- a/components/domain_reliability/config.h
+++ b/components/domain_reliability/config.h
@@ -23,6 +23,8 @@ namespace domain_reliability {
// with what frequency, and where the beacons are uploaded.
class DOMAIN_RELIABILITY_EXPORT DomainReliabilityConfig {
public:
+ static const size_t kInvalidResourceIndex;
+
// A particular resource named in the config -- includes a set of URL
// patterns that the resource will match, along with sample rates for
// successful and unsuccessful requests.
@@ -33,12 +35,11 @@ class DOMAIN_RELIABILITY_EXPORT DomainReliabilityConfig {
// Returns whether |url_string| matches at least one of the |url_patterns|
// in this Resource.
- bool MatchesUrlString(const std::string& url_string) const;
+ bool MatchesUrl(const GURL& url) const;
// Returns whether a request (that was successful if |success| is true)
- // should be reported (with a full beacon). (The output is random; it
- // compares a random number to |success_sample_rate| or
- // |failure_sample_rate|.)
+ // should be reported with a full beacon. (The output is non-deterministic;
+ // it |success_sample_rate| or |failure_sample_rate| to a random number.)
bool DecideIfShouldReportRequest(bool success) const;
// Registers with the JSONValueConverter so it will know how to convert the
@@ -93,11 +94,13 @@ class DOMAIN_RELIABILITY_EXPORT DomainReliabilityConfig {
bool IsValid() const;
+ // Checks whether |now| is past the expiration time provided in the config.
bool IsExpired(base::Time now) const;
// Finds the index (in resources) of the first Resource that matches a
- // particular URL. Returns -1 if the URL is not matched by any Resources.
- int GetResourceIndexForUrl(const GURL& url) const;
+ // particular URL. Returns kInvalidResourceIndex if it is not matched by any
+ // Resources.
+ size_t GetResourceIndexForUrl(const GURL& url) const;
// Registers with the JSONValueConverter so it will know how to convert the
// JSON for a config into the struct.
« no previous file with comments | « components/domain_reliability/beacon.cc ('k') | components/domain_reliability/config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698