[go: nahoru, domu]

blob: e7d12c863d83f5ee8fa218fa6d8f480db4925522 [file] [log] [blame]
// Copyright 2020 The Chromium Authors
// 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_