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

Move sources to a new browser dir and build target #4754

Merged
merged 3 commits into from
Jan 23, 2025
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
29 changes: 1 addition & 28 deletions cobalt/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,15 @@ if (!is_android) {

sources = [
"cobalt.cc",
"cobalt_browser_interface_binders.cc",
"cobalt_browser_interface_binders.h",
"cobalt_content_browser_client.cc",
"cobalt_content_browser_client.h",
"cobalt_main_delegate.cc",
"cobalt_main_delegate.h",
"cobalt_web_contents_observer.cc",
"cobalt_web_contents_observer.h",
]

defines = []

deps = [
":embed_polyfilled_javascript",
"//cobalt/browser",
"//cobalt/renderer:renderer",
"//cobalt/services/crash_annotator",
"//cobalt/services/crash_annotator/public/mojom",
"//cobalt/user_agent",
"//components/js_injection/browser:browser",
"//content/public/app",
"//content/shell:content_shell_app",
"//content/shell:content_shell_lib",
Expand Down Expand Up @@ -86,23 +76,6 @@ action("cobalt_build_info") {
]
}

config("embed_polyfilled_javascript_config") {
include_dirs = [ root_gen_dir ]
}

# TODO(b/390710539): migrate to GRIT
action("embed_polyfilled_javascript") {
script = "//cobalt/build/generate_data_header.py"
outputs = [ "$target_gen_dir/embedded_resources/embedded_js.h" ]
public_configs = [ ":embed_polyfilled_javascript_config" ]

args = [
"CobaltJavaScriptPolyfill",
rebase_path(outputs[0], root_build_dir),
rebase_path("embedded_resources", root_build_dir),
]
}

if (is_android) {
test("cobalt_unittests") {
testonly = true
Expand Down
14 changes: 1 addition & 13 deletions cobalt/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,11 @@ shared_library("libcobalt_content_shell_content_view") {
testonly = true
deps = [
":content_shell_jni_headers",
"//cobalt:embed_polyfilled_javascript",
"//cobalt/browser",
"//cobalt/renderer:renderer",
"//cobalt/services/crash_annotator",
"//cobalt/services/crash_annotator/public/mojom",
"//cobalt/user_agent",

# TODO: what can be removed in the dependencies?
"//components/crash/content/browser",
"//components/js_injection/browser:browser",
"//content/shell:content_shell_app",
"//content/shell:content_shell_lib",
"//content/shell:pak",
Expand All @@ -268,16 +264,8 @@ shared_library("libcobalt_content_shell_content_view") {
]
}
sources = [
# TODO(cobalt, b/383301493): move browser-related source files under a
# //cobalt/browser directory and define a "browser" build target there.
"//cobalt/cobalt_browser_interface_binders.cc",
"//cobalt/cobalt_browser_interface_binders.h",
"//cobalt/cobalt_content_browser_client.cc",
"//cobalt/cobalt_content_browser_client.h",
"//cobalt/cobalt_main_delegate.cc",
"//cobalt/cobalt_main_delegate.h",
"//cobalt/cobalt_web_contents_observer.cc",
"//cobalt/cobalt_web_contents_observer.h",
"cobalt_library_loader.cc",
]
configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
Expand Down
55 changes: 55 additions & 0 deletions cobalt/browser/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Copyright 2025 The Cobalt Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

source_set("browser") {
# TODO(cobalt, b/375655377): remove testonly declaration, needed because of
# content_shell_lib.
testonly = true

sources = [
"cobalt_browser_interface_binders.cc",
andrewsavage1 marked this conversation as resolved.
Show resolved Hide resolved
"cobalt_browser_interface_binders.h",
"cobalt_content_browser_client.cc",
"cobalt_content_browser_client.h",
"cobalt_web_contents_observer.cc",
"cobalt_web_contents_observer.h",
]

deps = [
":embed_polyfilled_javascript",
"//cobalt/services/crash_annotator",
"//cobalt/services/crash_annotator/public/mojom",
"//cobalt/user_agent",
"//components/js_injection/browser:browser",
"//content/public/browser",
"//content/shell:content_shell_lib",
]
}

config("embed_polyfilled_javascript_config") {
include_dirs = [ root_gen_dir ]
}

# TODO(cobalt, b/390710539): migrate to GRIT.
action("embed_polyfilled_javascript") {
script = "//cobalt/build/generate_data_header.py"
outputs = [ "$target_gen_dir/embedded_resources/embedded_js.h" ]
public_configs = [ ":embed_polyfilled_javascript_config" ]

args = [
"CobaltJavaScriptPolyfill",
rebase_path(outputs[0], root_build_dir),
rebase_path("embedded_resources", root_build_dir),
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "cobalt/cobalt_browser_interface_binders.h"
#include "cobalt/browser/cobalt_browser_interface_binders.h"

#include "base/functional/bind.h"
#include "cobalt/services/crash_annotator/crash_annotator_service.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COBALT_COBALT_BROWSER_INTERFACE_BINDERS_H_
#define COBALT_COBALT_BROWSER_INTERFACE_BINDERS_H_
#ifndef COBALT_BROWSER_COBALT_BROWSER_INTERFACE_BINDERS_H_
#define COBALT_BROWSER_COBALT_BROWSER_INTERFACE_BINDERS_H_

#include "mojo/public/cpp/bindings/binder_map.h"

Expand All @@ -30,4 +30,4 @@ void PopulateCobaltFrameBinders(

} // namespace cobalt

#endif // COBALT_COBALT_BROWSER_INTERFACE_BINDERS_H_
#endif // COBALT_BROWSER_COBALT_BROWSER_INTERFACE_BINDERS_H_
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "cobalt/cobalt_content_browser_client.h"
#include "cobalt/browser/cobalt_content_browser_client.h"

#include <string>

#include "cobalt/cobalt_browser_interface_binders.h"
#include "cobalt/browser/cobalt_browser_interface_binders.h"
#include "cobalt/user_agent/user_agent_platform_info.h"
#include "content/public/common/user_agent.h"
#include "third_party/blink/public/common/web_preferences/web_preferences.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COBALT_COBALT_CONTENT_BROWSER_CLIENT_H_
#define COBALT_COBALT_CONTENT_BROWSER_CLIENT_H_
#ifndef COBALT_BROWSER_COBALT_CONTENT_BROWSER_CLIENT_H_
#define COBALT_BROWSER_COBALT_CONTENT_BROWSER_CLIENT_H_

#include "cobalt/cobalt_web_contents_observer.h"
#include "cobalt/browser/cobalt_web_contents_observer.h"
#include "content/public/browser/web_contents.h"
#include "content/shell/browser/shell_content_browser_client.h"

Expand Down Expand Up @@ -54,4 +54,4 @@ class CobaltContentBrowserClient : public content::ShellContentBrowserClient {

} // namespace cobalt

#endif // COBALT_COBALT_CONTENT_BROWSER_CLIENT_H_
#endif // COBALT_BROWSER_COBALT_CONTENT_BROWSER_CLIENT_H_
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "cobalt/cobalt_web_contents_observer.h"
#include "cobalt/browser/cobalt_web_contents_observer.h"

#include "base/strings/utf_string_conversions.h"
#include "cobalt/embedded_resources/embedded_js.h"
#include "cobalt/browser/embedded_resources/embedded_js.h"

namespace cobalt {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COBALT_COBALT_WEB_CONTENTS_OBSERVER_H_
#define COBALT_COBALT_WEB_CONTENTS_OBSERVER_H_
#ifndef COBALT_BROWSER_COBALT_WEB_CONTENTS_OBSERVER_H_
#define COBALT_BROWSER_COBALT_WEB_CONTENTS_OBSERVER_H_

#include "content/public/browser/web_contents_observer.h"
#include "content/shell/browser/shell_content_browser_client.h"
Expand All @@ -36,4 +36,4 @@ class CobaltWebContentsObserver : public content::WebContentsObserver {

} // namespace cobalt

#endif // COBALT_COBALT_WEB_CONTENTS_OBSERVER_H_
#endif // COBALT_BROWSER_COBALT_WEB_CONTENTS_OBSERVER_H_
2 changes: 1 addition & 1 deletion cobalt/cobalt_main_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

#include "cobalt/cobalt_main_delegate.h"
#include "cobalt/cobalt_content_browser_client.h"
#include "cobalt/browser/cobalt_content_browser_client.h"
#include "cobalt/renderer/cobalt_content_renderer_client.h"
#include "content/public/browser/render_frame_host.h"

Expand Down
Loading