12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- // Copyright 2020 The Chromium Authors. All rights reserved.
- // Use of this source code is governed by a BSD-style license that can be
- // found in the LICENSE file.
- #ifndef CHROMECAST_BROWSER_CAST_WEB_PREFERENCES_H_
- #define CHROMECAST_BROWSER_CAST_WEB_PREFERENCES_H_
- #include "base/supports_user_data.h"
- #include "third_party/abseil-cpp/absl/types/optional.h"
- #include "third_party/blink/public/mojom/webpreferences/web_preferences.mojom.h"
- namespace chromecast {
- // Stores user provided settings for a specific WebContents. These will be used
- // to override default WebPreferences during the lifetime of the WebContents.
- class CastWebPreferences : public base::SupportsUserData::Data {
- public:
- struct Preferences {
- Preferences();
- absl::optional<blink::mojom::AutoplayPolicy> autoplay_policy;
- absl::optional<bool> hide_scrollbars;
- absl::optional<bool> javascript_enabled;
- absl::optional<bool> supports_multiple_windows;
- };
- // Unique key used to identify CastWebPreferences in WebContents' user data.
- static const void* kCastWebPreferencesDataKey;
- CastWebPreferences();
- CastWebPreferences(const CastWebPreferences&) = delete;
- CastWebPreferences& operator=(CastWebPreferences&) = delete;
- Preferences* preferences() { return &preferences_; }
- // Overrides |prefs| with any locally stored preferences.
- void Update(blink::web_pref::WebPreferences* prefs);
- private:
- Preferences preferences_;
- };
- } // namespace chromecast
- #endif // CHROMECAST_BROWSER_CAST_WEB_PREFERENCES_H_
|