// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_DOMAIN_RELIABILITY_CONFIG_H_ #define COMPONENTS_DOMAIN_RELIABILITY_CONFIG_H_ #include #include #include #include "base/json/json_value_converter.h" #include "base/strings/string_piece.h" #include "components/domain_reliability/domain_reliability_export.h" #include "url/gurl.h" #include "url/origin.h" namespace domain_reliability { // The per-origin configuration that controls which requests are measured and // reported, with what frequency, and where the beacons are uploaded. struct DOMAIN_RELIABILITY_EXPORT DomainReliabilityConfig { public: DomainReliabilityConfig(); DomainReliabilityConfig(const DomainReliabilityConfig&) = delete; DomainReliabilityConfig& operator=(const DomainReliabilityConfig&) = delete; ~DomainReliabilityConfig(); // Uses the JSONValueConverter to parse the JSON for a config into a struct. static std::unique_ptr FromJSON( const base::StringPiece& json); bool IsValid() const; double GetSampleRate(bool request_successful) const; // Registers with the JSONValueConverter so it will know how to convert the // JSON for a config into the struct. static void RegisterJSONConverter( base::JSONValueConverter* converter); url::Origin origin; bool include_subdomains; // Each entry in |collectors| must have scheme https. std::vector> collectors; double success_sample_rate; double failure_sample_rate; std::vector> path_prefixes; }; } // namespace domain_reliability #endif // COMPONENTS_DOMAIN_RELIABILITY_CONFIG_H_