[chromecast] Handle WebSQL database and mixer audio via CastWebContents
- Adds a CastWebContents::FromWebContents() method to retrieve
corresponding CastWebContents that wrapped the content::CastWebContents.
- Adds flags into CastWebContents::InitParams to determine whether
enabling WebSQL database and mixer audio.
Merge-With: eureka-internal/342751
Bug: internal b/144316145
Test: CQ
Change-Id: I7768e9b2d903ea79dbb3e49ca82ffe389f98d19e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1954447
Reviewed-by: Sean Topping <[email protected]>
Reviewed-by: Yuchen Liu <[email protected]>
Commit-Queue: Jiawei Li <[email protected]>
Cr-Commit-Position: refs/heads/master@{#722614}
diff --git a/chromecast/browser/cast_web_contents.h b/chromecast/browser/cast_web_contents.h
index 8b4beb9c..c11d465 100644
--- a/chromecast/browser/cast_web_contents.h
+++ b/chromecast/browser/cast_web_contents.h
@@ -188,7 +188,7 @@
// is destroyed before CastWebContents, the WeakPtr will be invalidated on
// the main UI thread.
base::WeakPtr<Delegate> delegate = nullptr;
- // Enable development mode for this CastWebCastWebContents. Whitelists
+ // Enable development mode for this CastWebContents. Whitelists
// certain functionality for the WebContents, like remote debugging and
// debugging interfaces.
bool enabled_for_dev = false;
@@ -206,6 +206,10 @@
// Background color for the WebContents view. If not provided, the color
// will fall back to the platform default.
BackgroundColor background_color = BackgroundColor::NONE;
+ // Enable WebSQL database for this CastWebContents.
+ bool enable_websql = false;
+ // Enable mixer audio support for this CastWebContents.
+ bool enable_mixer_audio = false;
InitParams();
InitParams(const InitParams& other);
@@ -224,6 +228,10 @@
static std::vector<CastWebContents*>& GetAll();
+ // Returns the CastWebContents that wraps the content::WebContents, or nullptr
+ // if the CastWebContents does not exist.
+ static CastWebContents* FromWebContents(content::WebContents* web_contents);
+
CastWebContents() = default;
virtual ~CastWebContents() = default;
@@ -341,6 +349,13 @@
const InterfaceSet& interface_set,
service_manager::InterfaceProvider* interface_provider) = 0;
+ // Returns true if WebSQL database is configured enabled for this
+ // CastWebContents.
+ virtual bool is_websql_enabled() = 0;
+
+ // Returns true if mixer audio is enabled.
+ virtual bool is_mixer_audio_enabled() = 0;
+
private:
DISALLOW_COPY_AND_ASSIGN(CastWebContents);
};