Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(285)

Side by Side Diff: chrome/browser/content_settings/chrome_content_settings_utils.cc

Issue 2048303002: Fix broken mixed script Rappor metric and add browser test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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" 8 #include "components/rappor/rappor_service.h"
9 #include "components/rappor/rappor_utils.h" 9 #include "components/rappor/rappor_utils.h"
10 10
11 namespace content_settings { 11 namespace content_settings {
12 12
13 void RecordMixedScriptAction(MixedScriptAction action) { 13 void RecordMixedScriptAction(MixedScriptAction action) {
14 UMA_HISTOGRAM_ENUMERATION("ContentSettings.MixedScript", action, 14 UMA_HISTOGRAM_ENUMERATION("ContentSettings.MixedScript", action,
15 MIXED_SCRIPT_ACTION_COUNT); 15 MIXED_SCRIPT_ACTION_COUNT);
16 } 16 }
17 17
18 void RecordMixedScriptActionWithRAPPOR(MixedScriptAction action, 18 void RecordMixedScriptActionWithRAPPOR(rappor::RapporService* rappor_service,
19 MixedScriptAction action,
19 const GURL& url) { 20 const GURL& url) {
20 std::string metric; 21 std::string metric;
21 switch (action) { 22 switch (action) {
22 case MIXED_SCRIPT_ACTION_DISPLAYED_SHIELD: 23 case MIXED_SCRIPT_ACTION_DISPLAYED_SHIELD:
23 metric = "ContentSettings.MixedScript.DisplayedShield"; 24 metric = "ContentSettings.MixedScript.DisplayedShield";
24 break; 25 break;
25 case MIXED_SCRIPT_ACTION_CLICKED_ALLOW: 26 case MIXED_SCRIPT_ACTION_CLICKED_ALLOW:
26 metric = "ContentSettings.MixedScript.UserClickedAllow"; 27 metric = "ContentSettings.MixedScript.UserClickedAllow";
27 break; 28 break;
28 default: 29 default:
29 NOTREACHED(); 30 NOTREACHED();
30 } 31 }
31 32
32 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), 33 rappor::SampleDomainAndRegistryFromGURL(rappor_service, metric, url);
33 metric,
34 url);
35 } 34 }
36 35
37 } // namespace content_settings 36 } // namespace content_settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698