OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/content_settings/chrome_content_settings_utils.h" | 5 #include "chrome/browser/content_settings/chrome_content_settings_utils.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "chrome/browser/browser_process.h" | |
9 #include "components/rappor/rappor_utils.h" | |
8 | 10 |
9 namespace content_settings { | 11 namespace content_settings { |
10 | 12 |
11 void RecordMixedScriptAction(MixedScriptAction action) { | 13 void RecordMixedScriptAction(MixedScriptAction action) { |
12 UMA_HISTOGRAM_ENUMERATION("ContentSettings.MixedScript", action, | 14 UMA_HISTOGRAM_ENUMERATION("ContentSettings.MixedScript", action, |
13 MIXED_SCRIPT_ACTION_COUNT); | 15 MIXED_SCRIPT_ACTION_COUNT); |
14 } | 16 } |
15 | 17 |
18 void RecordMixedScriptActionWithRAPPOR(MixedScriptAction action, | |
19 const GURL& url) { | |
20 RecordMixedScriptAction(action); | |
felt
2015/06/12 00:18:25
A second method seems fine, but can you avoid call
lgarron
2015/06/12 00:30:18
I chose "with RAPPOR" instead of "using RAPPOR", h
| |
21 | |
22 std::string metric; | |
23 switch (action) { | |
24 case MIXED_SCRIPT_ACTION_DISPLAYED_SHIELD: | |
25 metric = "ContentSettings.MixedScript.DisplayedShield"; | |
26 break; | |
27 case MIXED_SCRIPT_ACTION_CLICKED_ALLOW: | |
28 metric = "ContentSettings.MixedScript.UserClickedAllow"; | |
29 break; | |
30 default: | |
31 NOTREACHED(); | |
32 } | |
33 | |
34 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), | |
35 metric, | |
36 url); | |
37 } | |
38 | |
16 } // namespace content_settings | 39 } // namespace content_settings |
OLD | NEW |