enabled_state_provider.cc 842 B

123456789101112131415161718192021
  1. // Copyright 2016 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. #include "components/metrics/enabled_state_provider.h"
  5. #include "base/base_switches.h"
  6. #include "base/command_line.h"
  7. namespace metrics {
  8. bool EnabledStateProvider::IsReportingEnabled() const {
  9. // Disable metrics reporting when field trials are forced, as otherwise this
  10. // would pollute experiment results in UMA. Note: This is done here and not
  11. // in IsConsentGiven() as we do not want this to affect field trial entropy
  12. // logic (i.e. high entropy source should still be used if UMA is on).
  13. return IsConsentGiven() && !base::CommandLine::ForCurrentProcess()->HasSwitch(
  14. switches::kForceFieldTrials);
  15. }
  16. } // namespace metrics