Skip to content

Commit

Permalink
Add CobaltRenderFrameObserver comments, style fix (#4868)
Browse files Browse the repository at this point in the history
b/393406740
  • Loading branch information
hlwarriner authored Feb 7, 2025
1 parent 34e4019 commit a6a1e8a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
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

0 comments on commit a6a1e8a

Please sign in to comment.