This commit is contained in:
Mark Pilgrim
2020-04-22 14:36:27 -07:00
committed by bridiver
parent 2dec6e0089
commit 80d44b5b88
9 changed files with 45 additions and 51 deletions
@@ -0,0 +1,28 @@
/* Copyright (c) 2020 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_PROFILES_RENDERER_UPDATER_H_
#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_PROFILES_RENDERER_UPDATER_H_
#define BRAVE_GET_GUEST_VIEW_DEFAULT_CONTENT_SETTING_RULES \
rules->fingerprinting_rules.push_back(ContentSettingPatternSource( \
ContentSettingsPattern::Wildcard(), ContentSettingsPattern::Wildcard(), \
base::Value::FromUniquePtrValue( \
content_settings::ContentSettingToValue(CONTENT_SETTING_ALLOW)), \
std::string(), incognito)); \
rules->farbling_rules.push_back(ContentSettingPatternSource( \
ContentSettingsPattern::Wildcard(), ContentSettingsPattern::Wildcard(), \
base::Value::FromUniquePtrValue( \
content_settings::ContentSettingToValue(CONTENT_SETTING_DEFAULT)), \
std::string(), incognito)); \
rules->brave_shields_rules.push_back(ContentSettingPatternSource( \
ContentSettingsPattern::Wildcard(), ContentSettingsPattern::Wildcard(), \
base::Value::FromUniquePtrValue( \
content_settings::ContentSettingToValue(CONTENT_SETTING_ALLOW)), \
std::string(), incognito));
#include "../../../../../chrome/browser/profiles/renderer_updater.cc"
#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_PROFILES_RENDERER_UPDATER_H_
@@ -6,7 +6,7 @@
#ifndef BRAVE_CHROMIUM_SRC_THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_CONTENT_SETTINGS_CLIENT_H_
#define BRAVE_CHROMIUM_SRC_THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_CONTENT_SETTINGS_CLIENT_H_
#include "brave/common/brave_farbling_constants.h"
#include "brave/third_party/blink/renderer/brave_farbling_constants.h"
#define BRAVE_WEB_CONTENT_SETTINGS_CLIENT_H \
virtual bool AllowAutoplay(bool default_value) { return default_value; } \
@@ -6,9 +6,10 @@
#include "third_party/blink/renderer/core/dom/document.h"
#include "base/strings/string_number_conversions.h"
#include "brave/renderer/brave_content_settings_agent_impl_farbling_helper.h"
#include "brave/third_party/blink/renderer/brave_farbling_constants.h"
#include "crypto/hmac.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "third_party/blink/public/platform/web_content_settings_client.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
@@ -60,9 +61,10 @@ double BraveSessionCache::GetFudgeFactor() {
scoped_refptr<blink::StaticBitmapImage> BraveSessionCache::PerturbPixels(
blink::LocalFrame* frame,
scoped_refptr<blink::StaticBitmapImage> image_bitmap) {
if (!frame)
if (!frame || !frame->GetContentSettingsClient()) {
return image_bitmap;
switch (GetBraveFarblingLevel(frame)) {
}
switch (frame->GetContentSettingsClient()->GetBraveFarblingLevel()) {
case BraveFarblingLevel::OFF:
break;
case BraveFarblingLevel::BALANCED: {
-1
View File
@@ -53,7 +53,6 @@ source_set("common") {
"brave_content_client.h",
"brave_features.cc",
"brave_features.h",
"brave_farbling_constants.h",
"brave_isolated_worlds.h",
"brave_paths.cc",
"brave_paths.h",
@@ -1,26 +1,12 @@
diff --git a/chrome/browser/profiles/renderer_updater.cc b/chrome/browser/profiles/renderer_updater.cc
index ce50c9ee3f9290b50b4a5704e8eec9dc91db3082..f25cc28043eae41f88f8dc273e98ba6181fc589c 100644
index ce50c9ee3f9290b50b4a5704e8eec9dc91db3082..5f39cd1420b433ca5321b18dfc6a3cdc5d2c8128 100644
--- a/chrome/browser/profiles/renderer_updater.cc
+++ b/chrome/browser/profiles/renderer_updater.cc
@@ -55,6 +55,21 @@ void GetGuestViewDefaultContentSettingRules(
@@ -55,6 +55,7 @@ void GetGuestViewDefaultContentSettingRules(
base::Value::FromUniquePtrValue(
content_settings::ContentSettingToValue(CONTENT_SETTING_BLOCK)),
std::string(), incognito));
+ rules->fingerprinting_rules.push_back(ContentSettingPatternSource(
+ ContentSettingsPattern::Wildcard(), ContentSettingsPattern::Wildcard(),
+ base::Value::FromUniquePtrValue(
+ content_settings::ContentSettingToValue(CONTENT_SETTING_ALLOW)),
+ std::string(), incognito));
+ rules->farbling_rules.push_back(ContentSettingPatternSource(
+ ContentSettingsPattern::Wildcard(), ContentSettingsPattern::Wildcard(),
+ base::Value::FromUniquePtrValue(
+ content_settings::ContentSettingToValue(CONTENT_SETTING_DEFAULT)),
+ std::string(), incognito));
+ rules->brave_shields_rules.push_back(ContentSettingPatternSource(
+ ContentSettingsPattern::Wildcard(), ContentSettingsPattern::Wildcard(),
+ base::Value::FromUniquePtrValue(
+ content_settings::ContentSettingToValue(CONTENT_SETTING_ALLOW)),
+ std::string(), incognito));
+ BRAVE_GET_GUEST_VIEW_DEFAULT_CONTENT_SETTING_RULES
}
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
+1 -1
View File
@@ -10,7 +10,7 @@
#include <vector>
#include "base/strings/string16.h"
#include "brave/common/brave_farbling_constants.h"
#include "brave/third_party/blink/renderer/brave_farbling_constants.h"
#include "chrome/renderer/content_settings_agent_impl.h"
#include "components/content_settings/core/common/content_settings.h"
#include "components/content_settings/core/common/content_settings_types.h"
@@ -1,24 +0,0 @@
/* Copyright 2019 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef BRAVE_RENDERER_BRAVE_CONTENT_SETTINGS_AGENT_IMPL_FARBLING_HELPER_H_
#define BRAVE_RENDERER_BRAVE_CONTENT_SETTINGS_AGENT_IMPL_FARBLING_HELPER_H_
#include "brave/common/brave_farbling_constants.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/public/platform/web_content_settings_client.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/platform/bindings/script_state.h"
static BraveFarblingLevel GetBraveFarblingLevel(blink::LocalFrame* frame) {
if (!frame || !frame->GetContentSettingsClient()) {
return BraveFarblingLevel::OFF;
}
return frame->GetContentSettingsClient()->GetBraveFarblingLevel();
}
#endif // BRAVE_RENDERER_BRAVE_CONTENT_SETTINGS_AGENT_IMPL_FARBLING_HELPER_H_
+4 -1
View File
@@ -4,8 +4,11 @@
# You can obtain one at http://mozilla.org/MPL/2.0/.
source_set("renderer") {
sources = [
"brave_farbling_constants.h",
]
deps = [
"//brave/components/brave_drm:brave_drm_blink",
]
}
@@ -3,8 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef BRAVE_COMMON_BRAVE_FARBLING_CONSTANTS_H_
#define BRAVE_COMMON_BRAVE_FARBLING_CONSTANTS_H_
#ifndef BRAVE_THIRD_PARTY_BLINK_RENDERER_BRAVE_FARBLING_CONSTANTS_H_
#define BRAVE_THIRD_PARTY_BLINK_RENDERER_BRAVE_FARBLING_CONSTANTS_H_
enum BraveFarblingLevel {
BALANCED = 0,
@@ -12,4 +12,4 @@ enum BraveFarblingLevel {
MAXIMUM
};
#endif // BRAVE_COMMON_BRAVE_FARBLING_CONSTANTS_H_
#endif // BRAVE_THIRD_PARTY_BLINK_RENDERER_BRAVE_FARBLING_CONSTANTS_H_