summaryrefslogtreecommitdiffstats
path: root/chrome/browser/content_settings/chrome_content_settings_utils.cc
blob: 342fc193cc77f6b887666fde3bb3784ad5b601fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright (c) 2012 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.

#include "chrome/browser/content_settings/chrome_content_settings_utils.h"

#include "base/metrics/histogram.h"
#include "chrome/browser/browser_process.h"
#include "components/rappor/rappor_utils.h"

namespace content_settings {

void RecordMixedScriptAction(MixedScriptAction action) {
  UMA_HISTOGRAM_ENUMERATION("ContentSettings.MixedScript", action,
                            MIXED_SCRIPT_ACTION_COUNT);
}

void RecordMixedScriptActionWithRAPPOR(MixedScriptAction action,
                                       const GURL& url) {
  std::string metric;
  switch (action) {
    case MIXED_SCRIPT_ACTION_DISPLAYED_SHIELD:
      metric = "ContentSettings.MixedScript.DisplayedShield";
      break;
    case MIXED_SCRIPT_ACTION_CLICKED_ALLOW:
      metric = "ContentSettings.MixedScript.UserClickedAllow";
      break;
    default:
      NOTREACHED();
  }

  rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(),
                                          metric,
                                          url);
}

}  // namespace content_settings