Move local_ai/browser/ and local_ai/common to local_ai/core/ (#34068)

* Move local_ai/browser/ to local_ai/core/

Split the local_ai component directory to separate core
(platform-agnostic) code from content-dependent code that
will follow in subsequent PRs. This removes the browser/
subdirectory since all local_ai code runs in the browser
process.

* Move local_ai/common/ to local_ai/core/
This commit is contained in:
Anthony Tseng
2026-02-20 01:10:45 +00:00
committed by GitHub
parent 9357207fb9
commit 29ab381dc1
15 changed files with 25 additions and 36 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ source_set("browser_process") {
deps = [
"//brave/components/brave_ads/buildflags",
"//brave/components/brave_vpn/common/buildflags",
"//brave/components/local_ai/common",
"//brave/components/local_ai/core",
"//brave/components/request_otr/common/buildflags",
"//brave/components/speedreader/common/buildflags",
"//brave/components/tor/buildflags",
+1 -2
View File
@@ -58,8 +58,7 @@ include_rules += [
"+brave/components/email_aliases/browser",
"+brave/components/global_privacy_control",
"+brave/components/google_sign_in_permission",
"+brave/components/local_ai/browser",
"+brave/components/local_ai/common",
"+brave/components/local_ai/core",
"+brave/components/ntp_background_images/browser",
"+brave/components/ntp_background_images/common",
"+brave/components/ntp_background_images/buildflags",
+1 -1
View File
@@ -26,7 +26,7 @@
#include "brave/components/de_amp/common/features.h"
#include "brave/components/debounce/core/common/features.h"
#include "brave/components/google_sign_in_permission/features.h"
#include "brave/components/local_ai/common/features.h"
#include "brave/components/local_ai/core/features.h"
#include "brave/components/playlist/core/common/features.h"
#include "brave/components/psst/buildflags/buildflags.h"
#include "brave/components/request_otr/common/buildflags/buildflags.h"
+1 -1
View File
@@ -12,7 +12,7 @@ source_set("component_updater") {
deps = [
"//base",
"//brave/components/constants",
"//brave/components/local_ai/browser",
"//brave/components/local_ai/core",
"//chrome/common",
"//components/component_updater",
"//components/prefs",
@@ -2,7 +2,7 @@ include_rules = [
"+brave/components/brave_component_updater/browser",
"+brave/components/brave_origin/buildflags",
"+brave/components/brave_user_agent/browser",
"+brave/components/local_ai/browser",
"+brave/components/local_ai/core",
"+brave/components/psst/buildflags",
"+brave/components/brave_wallet",
"+brave/components/p3a",
@@ -15,7 +15,7 @@
#include "brave/browser/brave_browser_process.h"
#include "brave/components/brave_user_agent/browser/brave_user_agent_component_installer.h"
#include "brave/components/brave_wallet/common/buildflags/buildflags.h"
#include "brave/components/local_ai/browser/local_models_updater.h"
#include "brave/components/local_ai/core/local_models_updater.h"
#include "brave/components/p3a/component_installer.h"
#include "brave/components/p3a/p3a_service.h"
#include "brave/components/psst/buildflags/buildflags.h"
+1 -1
View File
@@ -35,7 +35,7 @@ test("brave_components_unittests") {
"//brave/components/component_updater:unit_tests",
"//brave/components/email_aliases:unit_tests",
"//brave/components/json:unit_tests",
"//brave/components/local_ai/browser:unit_tests",
"//brave/components/local_ai/core:unit_tests",
"//brave/components/static_redirect_helper:unit_tests",
"//brave/components/update_client:unit_tests",
"//brave/components/url_sanitizer/core/browser:unit_tests",
-13
View File
@@ -1,13 +0,0 @@
# Copyright (c) 2024 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/.
source_set("common") {
sources = [
"features.cc",
"features.h",
]
deps = [ "//base" ]
}
@@ -3,8 +3,12 @@
# 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/.
static_library("browser") {
static_library("core") {
assert_no_deps = [ "//content/public/*" ]
sources = [
"features.cc",
"features.h",
"local_models_updater.cc",
"local_models_updater.h",
]
@@ -13,7 +17,6 @@ static_library("browser") {
deps = [
"//brave/components/brave_component_updater/browser:public",
"//brave/components/local_ai/common",
"//components/component_updater",
"//components/component_updater:component_updater_paths",
"//components/update_client",
@@ -26,11 +29,10 @@ source_set("unit_tests") {
sources = [ "local_models_updater_unittest.cc" ]
deps = [
":browser",
":core",
"//base",
"//base/test:test_support",
"//brave/components/brave_component_updater/browser:test_support",
"//brave/components/local_ai/common",
"//components/component_updater:test_support",
"//testing/gmock",
"//testing/gtest",
@@ -1,4 +1,5 @@
include_rules = [
"!content/public",
"+components/component_updater",
"+components/update_client",
"+crypto",
@@ -3,7 +3,7 @@
* 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/. */
#include "brave/components/local_ai/common/features.h"
#include "brave/components/local_ai/core/features.h"
namespace local_ai::features {
@@ -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 https://mozilla.org/MPL/2.0/. */
#ifndef BRAVE_COMPONENTS_LOCAL_AI_COMMON_FEATURES_H_
#define BRAVE_COMPONENTS_LOCAL_AI_COMMON_FEATURES_H_
#ifndef BRAVE_COMPONENTS_LOCAL_AI_CORE_FEATURES_H_
#define BRAVE_COMPONENTS_LOCAL_AI_CORE_FEATURES_H_
#include "base/feature_list.h"
@@ -14,4 +14,4 @@ BASE_DECLARE_FEATURE(kLocalAIModels);
} // namespace local_ai::features
#endif // BRAVE_COMPONENTS_LOCAL_AI_COMMON_FEATURES_H_
#endif // BRAVE_COMPONENTS_LOCAL_AI_CORE_FEATURES_H_
@@ -3,7 +3,7 @@
* 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/. */
#include "brave/components/local_ai/browser/local_models_updater.h"
#include "brave/components/local_ai/core/local_models_updater.h"
#include <array>
#include <cstdint>
@@ -22,7 +22,7 @@
#include "base/values.h"
#include "base/version.h"
#include "brave/components/brave_component_updater/browser/brave_on_demand_updater.h"
#include "brave/components/local_ai/common/features.h"
#include "brave/components/local_ai/core/features.h"
#include "components/component_updater/component_installer.h"
#include "components/component_updater/component_updater_paths.h"
#include "components/component_updater/component_updater_service.h"
@@ -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 https://mozilla.org/MPL/2.0/. */
#ifndef BRAVE_COMPONENTS_LOCAL_AI_BROWSER_LOCAL_MODELS_UPDATER_H_
#define BRAVE_COMPONENTS_LOCAL_AI_BROWSER_LOCAL_MODELS_UPDATER_H_
#ifndef BRAVE_COMPONENTS_LOCAL_AI_CORE_LOCAL_MODELS_UPDATER_H_
#define BRAVE_COMPONENTS_LOCAL_AI_CORE_LOCAL_MODELS_UPDATER_H_
#include <cstdint>
#include <string>
@@ -96,4 +96,4 @@ void ManageLocalModelsComponentRegistration(
} // namespace local_ai
#endif // BRAVE_COMPONENTS_LOCAL_AI_BROWSER_LOCAL_MODELS_UPDATER_H_
#endif // BRAVE_COMPONENTS_LOCAL_AI_CORE_LOCAL_MODELS_UPDATER_H_
@@ -3,7 +3,7 @@
* 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/. */
#include "brave/components/local_ai/browser/local_models_updater.h"
#include "brave/components/local_ai/core/local_models_updater.h"
#include <memory>
@@ -20,7 +20,7 @@
#include "base/values.h"
#include "base/version.h"
#include "brave/components/brave_component_updater/browser/mock_on_demand_updater.h"
#include "brave/components/local_ai/common/features.h"
#include "brave/components/local_ai/core/features.h"
#include "components/component_updater/component_updater_paths.h"
#include "components/component_updater/mock_component_updater_service.h"
#include "testing/gmock/include/gmock/gmock.h"