forked from Pissandshittium/pissandshittium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcast_web_preferences.h
46 lines (33 loc) · 1.46 KB
/
cast_web_preferences.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// 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/optional.h>
#include <base/supports_user_data.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();
base::Optional<blink::mojom::AutoplayPolicy> autoplay_policy;
base::Optional<bool> hide_scrollbars;
base::Optional<bool> javascript_enabled;
base::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_