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 CobaltRenderFrameObserver comments, style fix #4868

Merged
merged 1 commit into from
Feb 7, 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
6 changes: 5 additions & 1 deletion cobalt/renderer/cobalt_render_frame_observer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ void CobaltRenderFrameObserver::OnDestruct() {
}

void CobaltRenderFrameObserver::DidClearWindowObject() {
auto& cmd = *base::CommandLine::ForCurrentProcess();
const auto& cmd = *base::CommandLine::ForCurrentProcess();
if (cmd.HasSwitch(switches::kExposeInternalsForTesting)) {
// The internals object is injected here so that window.internals is exposed
// to JavaScript at initial load of the web app, when the frame navigates
// from the initial empty document to the actual document. This approach is
// borrowed from content shell.
blink::WebTestingSupport::InjectInternalsObject(
render_frame()->GetWebFrame());
}
Expand Down
8 changes: 8 additions & 0 deletions cobalt/renderer/cobalt_render_frame_observer.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

namespace cobalt {

// Enables Cobalt-specific responses to notifications of changes to the frame.
class CobaltRenderFrameObserver : public content::RenderFrameObserver {
public:
explicit CobaltRenderFrameObserver(content::RenderFrame* render_frame);
Expand All @@ -30,7 +31,14 @@ class CobaltRenderFrameObserver : public content::RenderFrameObserver {
delete;

private:
// content::RenderFrameObserver impl.

// Overridden so that the observer has the same lifetime as the RenderFrame.
void OnDestruct() override;

// Overridden for Cobalt-specific responses to this particular notification.
// See blink::WebLocalFrameClient.DidClearWindowObject() for details about
// when it's sent.
void DidClearWindowObject() override;
};

Expand Down
Loading