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

Add CobaltContentRendererClient #4661

Merged
merged 2 commits into from
Jan 9, 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
1 change: 1 addition & 0 deletions cobalt/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ if (!is_android) {
defines = []

deps = [
"//cobalt/renderer:renderer",
"//cobalt/user_agent",
"//content/public/app",
"//content/shell:content_shell_app",
Expand Down
1 change: 1 addition & 0 deletions cobalt/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ shared_library("libcobalt_content_shell_content_view") {
# TODO(b/375655377): remove testonly
testonly = true
deps = [
"//cobalt/renderer:renderer",
"//cobalt/user_agent",

# TODO: what can be removed in the dependencies?
Expand Down
7 changes: 7 additions & 0 deletions cobalt/cobalt_main_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

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

namespace cobalt {
Expand All @@ -29,6 +30,12 @@ CobaltMainDelegate::CreateContentBrowserClient() {
return browser_client_.get();
}

content::ContentRendererClient*
CobaltMainDelegate::CreateContentRendererClient() {
renderer_client_ = std::make_unique<CobaltContentRendererClient>();
return renderer_client_.get();
}

absl::optional<int> CobaltMainDelegate::PostEarlyInitialization(
InvokedIn invoked_in) {
content::RenderFrameHost::AllowInjectingJavaScript();
Expand Down
5 changes: 5 additions & 0 deletions cobalt/cobalt_main_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#define COBALT_COBALT_MAIN_DELEGATE_H_

#include "build/build_config.h"
#include "cobalt/renderer/cobalt_content_renderer_client.h"
#include "content/shell/app/shell_main_delegate.h"

namespace cobalt {
Expand All @@ -29,9 +30,13 @@ class CobaltMainDelegate : public content::ShellMainDelegate {

// ContentMainDelegate implementation:
content::ContentBrowserClient* CreateContentBrowserClient() override;
content::ContentRendererClient* CreateContentRendererClient() override;
absl::optional<int> PostEarlyInitialization(InvokedIn invoked_in) override;

~CobaltMainDelegate() override;

private:
std::unique_ptr<CobaltContentRendererClient> renderer_client_;
};

} // namespace cobalt
Expand Down
15 changes: 15 additions & 0 deletions cobalt/common/shell_switches.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright 2025 The Cobalt Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "cobalt/common/shell_switches.h"

#include "base/command_line.h"

namespace switches {

// Exposes the window.internals object to JavaScript for interactive development
// and debugging of web tests that rely on it.
const char kExposeInternalsForTesting[] = "expose-internals-for-testing";

} // namespace switches
18 changes: 18 additions & 0 deletions cobalt/common/shell_switches.h
johnxwork marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2025 The Cobalt Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Defines all the Cobalt command-line switches.

#ifndef COBALT_COMMON_SHELL_SWITCHES_H_
#define COBALT_COMMON_SHELL_SWITCHES_H_

#include "build/build_config.h"

namespace switches {

extern const char kExposeInternalsForTesting[];

} // namespace switches

#endif // COBALT_COMMON_SHELL_SWITCHES_H_
32 changes: 32 additions & 0 deletions cobalt/renderer/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# 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("renderer") {
sources = [
"cobalt_content_renderer_client.cc",
"cobalt_content_renderer_client.h",
]

deps = [
"//components/cdm/renderer",
"//components/network_hints/renderer",
"//components/web_cache/renderer",
"//content/public/common",
"//content/public/renderer",
"//content/test:content_test_mojo_bindings",
"//media/mojo:buildflags",
"//starboard:starboard_headers_only",
"//v8",
]
}
Loading
Loading