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..4b85f2bf27164f351dcd9b9efca27cb0ab5a54cc 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(); |
@@ -343,9 +346,11 @@ void TabSpecificContentSettings::OnContentBlockedWithDetail( |
if (type == CONTENT_SETTINGS_TYPE_MIXEDSCRIPT) { |
content_settings::RecordMixedScriptAction( |
content_settings::MIXED_SCRIPT_ACTION_DISPLAYED_SHIELD); |
+ GURL url(details); |
+ DCHECK(url.is_valid()); |
content_settings::RecordMixedScriptActionWithRAPPOR( |
- content_settings::MIXED_SCRIPT_ACTION_DISPLAYED_SHIELD, |
- GURL(base::UTF16ToUTF8(details))); |
+ rappor_service_, |
+ content_settings::MIXED_SCRIPT_ACTION_DISPLAYED_SHIELD, url); |
} |
} |
} |
@@ -838,9 +843,14 @@ void TabSpecificContentSettings::BlockAllContentForTesting() { |
content_settings::ContentSettingsRegistry::GetInstance(); |
for (const content_settings::ContentSettingsInfo* info : *registry) { |
ContentSettingsType type = info->website_settings_info()->type(); |
- if (type != CONTENT_SETTINGS_TYPE_GEOLOCATION && |
- type != CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC && |
- type != CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) { |
+ if (type == CONTENT_SETTINGS_TYPE_MIXEDSCRIPT) { |
+ // For mixed script, OnContentBlockedWithDetail() expects a valid |
+ // URL in the |details| argument. |
+ OnContentBlockedWithDetail(CONTENT_SETTINGS_TYPE_MIXEDSCRIPT, |
estark
2016/06/12 17:12:16
note: an alternative could be to make OnContentBlo
|
+ base::ASCIIToUTF16("http://example.test")); |
+ } else if (type != CONTENT_SETTINGS_TYPE_GEOLOCATION && |
+ type != CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC && |
+ type != CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) { |
OnContentBlocked(type); |
} |
} |
@@ -859,3 +869,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; |
+} |