Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove check_includes = false from browser/android/preferences #25686

Merged
merged 2 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ browser/brave_browser_process.h @bridiver
components/brave_component_updater/browser/brave_component.h @bridiver @antonok-edm
components/brave_component_updater/browser/local_data_files_observer.h @bridiver @antonok-edm

# BravePrefServiceBridge is deprecated
browser/android/preferences/brave_pref_service_bridge.cc @bridiver

# sources.gni - see docs/gni_sources.md
**/sources.gni @brave/sources-gni-reviewers
**/*_sources.gni @brave/sources-gni-reviewers
Expand Down
2 changes: 1 addition & 1 deletion browser/about_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
#endif

#if BUILDFLAG(IS_ANDROID)
#include "brave/browser/android/preferences/features.h"
#include "brave/browser/android/background_video/features.h"
#include "brave/browser/android/safe_browsing/features.h"
#else
#include "brave/components/commander/common/features.h"
Expand Down
36 changes: 36 additions & 0 deletions browser/android/background_video/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright (c) 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 https://mozilla.org/MPL/2.0/.

import("//brave/components/ai_chat/core/common/buildflags/buildflags.gni")
import("//build/config/android/rules.gni")

source_set("background_video") {
sources = [
"background_video_playback_tab_helper.cc",
"background_video_playback_tab_helper.h",
]

public_deps = [ "//content/public/browser" ]

deps = [
":features",
"//base",
"//brave/components/brave_shields/content/browser",
"//brave/components/constants",
"//chrome/browser/profiles:profile",
"//components/prefs",
"//net",
"//url",
]
}

source_set("features") {
sources = [
"features.cc",
"features.h",
]

public_deps = [ "//base" ]
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
/* Copyright (c) 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/. */
* You can obtain one at https://mozilla.org/MPL/2.0/. */

#include "brave/browser/android/preferences/background_video_playback_tab_helper.h"

#include <string>
#include "brave/browser/android/background_video/background_video_playback_tab_helper.h"

#include "base/strings/utf_string_conversions.h"
#include "brave/browser/android/preferences/features.h"
#include "brave/browser/android/background_video/features.h"
#include "brave/components/brave_shields/content/browser/brave_shields_util.h"
#include "brave/components/constants/pref_names.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "components/prefs/pref_service.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/navigation_handle.h"
Expand Down Expand Up @@ -51,8 +47,9 @@ bool IsBackgroundVideoPlaybackEnabled(content::WebContents* contents) {

if (!base::FeatureList::IsEnabled(
::preferences::features::kBraveBackgroundVideoPlayback) &&
!prefs->GetBoolean(kBackgroundVideoPlaybackEnabled))
!prefs->GetBoolean(kBackgroundVideoPlaybackEnabled)) {
return false;
}

content::RenderFrameHost::AllowInjectingJavaScript();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* Copyright (c) 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/. */
* You can obtain one at https://mozilla.org/MPL/2.0/. */

#ifndef BRAVE_BROWSER_ANDROID_PREFERENCES_BACKGROUND_VIDEO_PLAYBACK_TAB_HELPER_H_
#define BRAVE_BROWSER_ANDROID_PREFERENCES_BACKGROUND_VIDEO_PLAYBACK_TAB_HELPER_H_
#ifndef BRAVE_BROWSER_ANDROID_BACKGROUND_VIDEO_BACKGROUND_VIDEO_PLAYBACK_TAB_HELPER_H_
#define BRAVE_BROWSER_ANDROID_BACKGROUND_VIDEO_BACKGROUND_VIDEO_PLAYBACK_TAB_HELPER_H_

#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
Expand All @@ -27,4 +27,4 @@ class BackgroundVideoPlaybackTabHelper
WEB_CONTENTS_USER_DATA_KEY_DECL();
};

#endif // BRAVE_BROWSER_ANDROID_PREFERENCES_BACKGROUND_VIDEO_PLAYBACK_TAB_HELPER_H_
#endif // BRAVE_BROWSER_ANDROID_BACKGROUND_VIDEO_BACKGROUND_VIDEO_PLAYBACK_TAB_HELPER_H_
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* Copyright (c) 2022 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/. */
* You can obtain one at https://mozilla.org/MPL/2.0/. */

#include "brave/browser/android/preferences/features.h"
#include "brave/browser/android/background_video/features.h"

#include "base/feature_list.h"
#include "build/build_config.h"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* Copyright (c) 2022 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/. */
* You can obtain one at https://mozilla.org/MPL/2.0/. */

#ifndef BRAVE_BROWSER_ANDROID_PREFERENCES_FEATURES_H_
#define BRAVE_BROWSER_ANDROID_PREFERENCES_FEATURES_H_
#ifndef BRAVE_BROWSER_ANDROID_BACKGROUND_VIDEO_FEATURES_H_
#define BRAVE_BROWSER_ANDROID_BACKGROUND_VIDEO_FEATURES_H_

#include "base/feature_list.h"

Expand All @@ -16,4 +16,4 @@ BASE_DECLARE_FEATURE(kBraveBackgroundVideoPlayback);
} // namespace features
} // namespace preferences

#endif // BRAVE_BROWSER_ANDROID_PREFERENCES_FEATURES_H_
#endif // BRAVE_BROWSER_ANDROID_BACKGROUND_VIDEO_FEATURES_H_
27 changes: 12 additions & 15 deletions browser/android/preferences/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,27 @@ import("//brave/components/ai_chat/core/common/buildflags/buildflags.gni")
import("//build/config/android/rules.gni")

source_set("preferences") {
# Remove when https://github.com/brave/brave-browser/issues/10657 is resolved
check_includes = false
sources = [
"background_video_playback_tab_helper.cc",
"background_video_playback_tab_helper.h",
"brave_pref_service_bridge.cc",
"features.cc",
"features.h",
]
sources = [ "brave_pref_service_bridge.cc" ]

deps = [
"//base",
"//brave/build/android:jni_headers",
"//brave/common",
"//brave/components/brave_adaptive_captcha",
"//brave/components/brave_news/common",
"//brave/components/brave_perf_predictor/common",
"//brave/components/brave_referrals/common",
"//brave/components/brave_rewards/common",
"//brave/components/brave_shields/content/browser",
"//brave/components/brave_shields/core/common",
"//brave/components/brave_sync",
"//brave/components/p3a",
"//brave/components/brave_sync:prefs",
"//brave/components/constants",
"//chrome/browser:browser_process",
"//chrome/browser:browser_public_dependencies",
"//chrome/browser/profiles:profile",
"//chrome/common",
"//components/content_settings/core/browser",
"//components/content_settings/core/browser:cookie_settings",
"//components/prefs",
"//content/public/browser",
"//net",
"//third_party/blink/public/common",
"//url",
]
}
Expand Down
5 changes: 0 additions & 5 deletions browser/android/preferences/DEPS

This file was deleted.

11 changes: 5 additions & 6 deletions browser/android/preferences/brave_pref_service_bridge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,18 @@
* 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/. */

#include "brave/build/android/jni_headers/BravePrefServiceBridge_jni.h"
#include <jni.h>

#include <string>

#include "base/android/jni_string.h"
#include "brave/components/brave_adaptive_captcha/pref_names.h"
#include "brave/build/android/jni_headers/BravePrefServiceBridge_jni.h"
#include "brave/components/brave_news/common/pref_names.h"
#include "brave/components/brave_perf_predictor/common/pref_names.h"
#include "brave/components/brave_referrals/common/pref_names.h"
#include "brave/components/brave_rewards/common/pref_names.h"
#include "brave/components/brave_shields/content/browser/brave_shields_util.h"
#include "brave/components/brave_shields/core/common/pref_names.h"
#include "brave/components/brave_sync/brave_sync_prefs.h"
#include "brave/components/constants/pref_names.h"
#include "brave/components/de_amp/common/pref_names.h"
#include "brave/components/decentralized_dns/core/pref_names.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h"
Expand Down Expand Up @@ -74,6 +72,7 @@ std::string GetWebRTCIPHandlingPreference(WebRTCIPHandlingPolicy policy) {
namespace chrome {
namespace android {

// This file is deprecated, prefs should be accessed directly from Java
void JNI_BravePrefServiceBridge_SetCookiesBlockType(
JNIEnv* env,
const base::android::JavaParamRef<jstring>& type) {
Expand Down
17 changes: 7 additions & 10 deletions browser/brave_browser_main_parts.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <utility>

#include "base/command_line.h"
#include "base/path_service.h"
#include "brave/browser/browsing_data/brave_clear_browsing_data.h"
#include "brave/browser/ethereum_remote_client/buildflags/buildflags.h"
#include "brave/components/brave_component_updater/browser/brave_on_demand_updater.h"
Expand All @@ -23,10 +24,14 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_paths.h"
#include "components/component_updater/component_updater_service.h"
#include "components/prefs/pref_service.h"
#include "components/sync/base/command_line_switches.h"
#include "components/sync/service/sync_service.h"
#include "components/sync/service/sync_user_settings.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
#include "extensions/buildflags/buildflags.h"
#include "media/base/media_switches.h"

Expand All @@ -51,14 +56,12 @@
#include "brave/browser/infobars/brave_confirm_p3a_infobar_delegate.h"
#include "brave/browser/infobars/brave_sync_account_deleted_infobar_delegate.h"
#include "brave/browser/infobars/sync_cannot_run_infobar_delegate.h"
#include "brave/components/ipfs/ipfs_component_cleaner.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "components/infobars/content/content_infobar_manager.h"
#include "components/sync/service/sync_service.h"
#include "components/sync/service/sync_user_settings.h"
#include "content/public/browser/web_contents.h"
#else
#include "brave/browser/android/preferences/features.h"
#include "brave/browser/android/background_video/features.h"
#endif

#if BUILDFLAG(ETHEREUM_REMOTE_CLIENT_ENABLED) && BUILDFLAG(ENABLE_EXTENSIONS)
Expand All @@ -67,12 +70,6 @@
#include "extensions/browser/extension_system.h"
#endif

#if !BUILDFLAG(IS_ANDROID)
#include "base/path_service.h"
#include "brave/components/ipfs/ipfs_component_cleaner.h"
#include "chrome/common/chrome_paths.h"
#endif // !BUILDFLAG(IS_ANDROID)

BraveBrowserMainParts::BraveBrowserMainParts(bool is_integration_test,
StartupData* startup_data)
: ChromeBrowserMainParts(is_integration_test, startup_data) {}
Expand Down
5 changes: 2 additions & 3 deletions browser/brave_tab_helpers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

#include "brave/browser/brave_tab_helpers.h"

#include <string>
#include <string_view>
#include <memory>

#include "base/command_line.h"
#include "base/feature_list.h"
Expand Down Expand Up @@ -49,7 +48,7 @@
#endif

#if BUILDFLAG(IS_ANDROID)
#include "brave/browser/android/preferences/background_video_playback_tab_helper.h"
#include "brave/browser/android/background_video/background_video_playback_tab_helper.h"
#endif

#if !BUILDFLAG(IS_ANDROID)
Expand Down
8 changes: 8 additions & 0 deletions browser/sources.gni
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,8 @@ if (is_android) {

brave_chrome_browser_deps += [
"//brave/browser/android:android_browser_process",
"//brave/browser/android/background_video",
"//brave/browser/android/background_video:features",
"//brave/browser/android/preferences",
"//brave/browser/android/safe_browsing:buildflags",
"//brave/browser/download/android:jni_headers",
Expand Down Expand Up @@ -610,3 +612,9 @@ if (enable_widevine) {
brave_chrome_browser_allow_circular_includes_from +=
[ "//brave/browser/widevine" ]
}

# https://github.com/brave/brave-browser/issues/41486
if (is_android) {
brave_chrome_browser_allow_circular_includes_from +=
[ "//brave/browser/android/preferences" ]
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "base/feature_override.h"
#include "brave/browser/android/preferences/features.h"
#include "brave/browser/android/background_video/features.h"
#include "brave/browser/android/safe_browsing/features.h"
#include "brave/components/ai_chat/core/common/buildflags/buildflags.h"
#include "brave/components/brave_news/common/features.h"
Expand Down
Loading