Commit f9994cef authored by Albert Chaulk's avatar Albert Chaulk Committed by Commit Bot

Allow cast extensions to go fullscreen

We need to implement a couple WebContentsDelegate functions in order to
enable fullscreen behaviours

Bug: b/128926264
Test: desktop cast_shell build w/ embedded video page
Change-Id: I7c5e95fb4f59b3369b35f770dcccff647bf7f899
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1585104Reviewed-by: default avatarDaniel Nicoara <dnicoara@chromium.org>
Reviewed-by: default avatarAlex Sakhartchouk <alexst@chromium.org>
Commit-Queue: Alex Sakhartchouk <alexst@chromium.org>
Cr-Commit-Position: refs/heads/master@{#662622}
parent e8638a1a
...@@ -105,4 +105,27 @@ void CastExtensionHost::Observe(int type, ...@@ -105,4 +105,27 @@ void CastExtensionHost::Observe(int type,
LoadInitialURL(); LoadInitialURL();
} }
void CastExtensionHost::EnterFullscreenModeForTab(
content::WebContents* web_contents,
const GURL& origin,
const blink::WebFullscreenOptions& options) {
SetFullscreen(web_contents, true);
}
void CastExtensionHost::ExitFullscreenModeForTab(
content::WebContents* web_contents) {
SetFullscreen(web_contents, false);
}
bool CastExtensionHost::IsFullscreenForTabOrPending(
const content::WebContents* web_contents) const {
return is_fullscreen_;
}
void CastExtensionHost::SetFullscreen(content::WebContents* web_contents,
bool value) {
if (value == is_fullscreen_)
return;
is_fullscreen_ = value;
web_contents->GetRenderViewHost()->GetWidget()->SynchronizeVisualProperties();
}
} // namespace chromecast } // namespace chromecast
...@@ -45,8 +45,17 @@ class CastExtensionHost : public extensions::ExtensionHost, ...@@ -45,8 +45,17 @@ class CastExtensionHost : public extensions::ExtensionHost,
const base::string16& message, const base::string16& message,
int32_t line_no, int32_t line_no,
const base::string16& source_id) override; const base::string16& source_id) override;
void EnterFullscreenModeForTab(
content::WebContents* web_contents,
const GURL& origin,
const blink::WebFullscreenOptions& options) override;
void ExitFullscreenModeForTab(content::WebContents*) override;
bool IsFullscreenForTabOrPending(
const content::WebContents* web_contents) const override;
private: private:
void SetFullscreen(content::WebContents* web_contents, bool value);
// content::NotificationObserver implementation: // content::NotificationObserver implementation:
void Observe(int type, void Observe(int type,
const content::NotificationSource& source, const content::NotificationSource& source,
...@@ -54,6 +63,7 @@ class CastExtensionHost : public extensions::ExtensionHost, ...@@ -54,6 +63,7 @@ class CastExtensionHost : public extensions::ExtensionHost,
content::NotificationRegistrar registrar_; content::NotificationRegistrar registrar_;
content::BrowserContext* const browser_context_; content::BrowserContext* const browser_context_;
bool is_fullscreen_ = false;
DISALLOW_COPY_AND_ASSIGN(CastExtensionHost); DISALLOW_COPY_AND_ASSIGN(CastExtensionHost);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment