1 // Copyright 2020 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_PRIVACY_BUDGET_IDENTIFIABILITY_STUDY_SETTINGS_PROVIDER_H_ 6 #define THIRD_PARTY_BLINK_PUBLIC_COMMON_PRIVACY_BUDGET_IDENTIFIABILITY_STUDY_SETTINGS_PROVIDER_H_ 7 8 #include "third_party/blink/public/common/common_export.h" 9 #include "third_party/blink/public/common/privacy_budget/identifiable_surface.h" 10 11 namespace blink { 12 13 class BLINK_COMMON_EXPORT IdentifiabilityStudySettingsProvider { 14 public: 15 virtual ~IdentifiabilityStudySettingsProvider(); 16 17 // Returns true if the identifiability study is active. For any specific 18 // instance of IdentifiabilityStudySettings, this answer cannot change. It 19 // will only be queried once. 20 virtual bool IsActive() const = 0; 21 22 // Returns true if any specific surface or type is blocked. Otherwise it is 23 // assumed that neither IsSurfaceBlocked() nor IsTypeBlocked() will ever 24 // return true for anything. 25 // 26 // Only meaningful if IsActive() returns true. 27 virtual bool IsAnyTypeOrSurfaceBlocked() const = 0; 28 29 // Returns true if the given surface is allowed to be sampled. 30 // 31 // If IsActive() is false, this method will not be called. 32 virtual bool IsSurfaceAllowed(IdentifiableSurface surface) const = 0; 33 34 // Returns true if the given surface type is allowed to be sampled. 35 // 36 // If IsActive() is false, this method will not be called. 37 virtual bool IsTypeAllowed(IdentifiableSurface::Type type) const = 0; 38 39 // Returns the sample rate of the given surface. 40 // 41 // If IsActive() is false, this method will return 0. 42 virtual int SampleRate(IdentifiableSurface surface) const = 0; 43 44 // Returns the sample rate of the given surface type. 45 // 46 // If IsActive() is false, this method will return 0. 47 virtual int SampleRate(IdentifiableSurface::Type type) const = 0; 48 }; 49 50 } // namespace blink 51 52 #endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_PRIVACY_BUDGET_IDENTIFIABILITY_STUDY_SETTINGS_PROVIDER_H_ 53