OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef COMPONENTS_DOMAIN_RELIABILITY_CONFIG_H_ | 5 #ifndef COMPONENTS_DOMAIN_RELIABILITY_CONFIG_H_ |
6 #define COMPONENTS_DOMAIN_RELIABILITY_CONFIG_H_ | 6 #define COMPONENTS_DOMAIN_RELIABILITY_CONFIG_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 public: | 25 public: |
26 DomainReliabilityConfig(); | 26 DomainReliabilityConfig(); |
27 ~DomainReliabilityConfig(); | 27 ~DomainReliabilityConfig(); |
28 | 28 |
29 // Uses the JSONValueConverter to parse the JSON for a config into a struct. | 29 // Uses the JSONValueConverter to parse the JSON for a config into a struct. |
30 static scoped_ptr<const DomainReliabilityConfig> FromJSON( | 30 static scoped_ptr<const DomainReliabilityConfig> FromJSON( |
31 const base::StringPiece& json); | 31 const base::StringPiece& json); |
32 | 32 |
33 bool IsValid() const; | 33 bool IsValid() const; |
34 | 34 |
35 bool DecideIfShouldReportRequest(bool success) const; | 35 double GetSampleRate(bool request_successful) const; |
36 | 36 |
37 // Registers with the JSONValueConverter so it will know how to convert the | 37 // Registers with the JSONValueConverter so it will know how to convert the |
38 // JSON for a config into the struct. | 38 // JSON for a config into the struct. |
39 static void RegisterJSONConverter( | 39 static void RegisterJSONConverter( |
40 base::JSONValueConverter<DomainReliabilityConfig>* converter); | 40 base::JSONValueConverter<DomainReliabilityConfig>* converter); |
41 | 41 |
42 GURL origin; | 42 GURL origin; |
43 bool include_subdomains; | 43 bool include_subdomains; |
44 ScopedVector<GURL> collectors; | 44 ScopedVector<GURL> collectors; |
45 | 45 |
46 double success_sample_rate; | 46 double success_sample_rate; |
47 double failure_sample_rate; | 47 double failure_sample_rate; |
48 ScopedVector<std::string> path_prefixes; | 48 ScopedVector<std::string> path_prefixes; |
49 | 49 |
50 private: | 50 private: |
51 DISALLOW_COPY_AND_ASSIGN(DomainReliabilityConfig); | 51 DISALLOW_COPY_AND_ASSIGN(DomainReliabilityConfig); |
52 }; | 52 }; |
53 | 53 |
54 } // namespace domain_reliability | 54 } // namespace domain_reliability |
55 | 55 |
56 #endif // COMPONENTS_DOMAIN_RELIABILITY_CONFIG_H_ | 56 #endif // COMPONENTS_DOMAIN_RELIABILITY_CONFIG_H_ |
OLD | NEW |