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

Unified Diff: chrome/browser/content_settings/tab_specific_content_settings.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: 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/content_settings/tab_specific_content_settings.cc
diff --git a/chrome/browser/content_settings/tab_specific_content_settings.cc b/chrome/browser/content_settings/tab_specific_content_settings.cc
index 0a1be6e2a15798f1ac971d429296116a33549546..173269fb59c0bb24999727d45602817ad654b039 100644
--- a/chrome/browser/content_settings/tab_specific_content_settings.cc
+++ b/chrome/browser/content_settings/tab_specific_content_settings.cc
@@ -11,6 +11,7 @@
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
+#include "chrome/browser/browser_process.h"
#include "chrome/browser/browsing_data/browsing_data_appcache_helper.h"
#include "chrome/browser/browsing_data/browsing_data_cookie_helper.h"
#include "chrome/browser/browsing_data/browsing_data_database_helper.h"
@@ -34,6 +35,7 @@
#include "components/content_settings/core/browser/content_settings_utils.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/prefs/pref_service.h"
+#include "components/rappor/rappor_service.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_details.h"
@@ -103,7 +105,8 @@ TabSpecificContentSettings::TabSpecificContentSettings(WebContents* tab)
pending_protocol_handler_setting_(CONTENT_SETTING_DEFAULT),
load_plugins_link_enabled_(true),
microphone_camera_state_(MICROPHONE_CAMERA_NOT_ACCESSED),
- observer_(this) {
+ observer_(this),
+ rappor_service_(g_browser_process->rappor_service()) {
ClearBlockedContentSettingsExceptForCookies();
ClearCookieSpecificContentSettings();
@@ -344,8 +347,9 @@ void TabSpecificContentSettings::OnContentBlockedWithDetail(
content_settings::RecordMixedScriptAction(
content_settings::MIXED_SCRIPT_ACTION_DISPLAYED_SHIELD);
content_settings::RecordMixedScriptActionWithRAPPOR(
+ rappor_service_,
content_settings::MIXED_SCRIPT_ACTION_DISPLAYED_SHIELD,
- GURL(base::UTF16ToUTF8(details)));
+ GURL(details));
felt 2016/06/10 03:41:08 A note for posterity: this code path used to only
}
}
}
@@ -844,7 +848,6 @@ void TabSpecificContentSettings::BlockAllContentForTesting() {
OnContentBlocked(type);
}
}
-
felt 2016/06/10 03:41:08 nit: why kill this line break?
estark 2016/06/10 03:55:20 Oops, undone.
// Geolocation and media must be blocked separately, as the generic
// TabSpecificContentSettings::OnContentBlocked does not apply to them.
OnGeolocationPermissionSet(web_contents()->GetLastCommittedURL(), false);
@@ -859,3 +862,8 @@ void TabSpecificContentSettings::BlockAllContentForTesting() {
media_blocked,
std::string(), std::string(), std::string(), std::string());
}
+
+void TabSpecificContentSettings::SetRapporServiceForTesting(
+ rappor::RapporService* rappor_service) {
+ rappor_service_ = rappor_service;
+}

Powered by Google App Engine
This is Rietveld 408576698