OLD | NEW |
| (Empty) |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef WebContentSettingsClient_h | |
6 #define WebContentSettingsClient_h | |
7 | |
8 #include "public/platform/WebContentSettingCallbacks.h" | |
9 | |
10 namespace blink { | |
11 | |
12 class WebSecurityOrigin; | |
13 class WebString; | |
14 class WebURL; | |
15 | |
16 class WebContentSettingsClient { | |
17 public: | |
18 // Controls whether access to Web Databases is allowed for this frame. | |
19 virtual bool allowDatabase(const WebString& name, | |
20 const WebString& displayName, | |
21 unsigned estimatedSize) { | |
22 return true; | |
23 } | |
24 | |
25 // Controls whether access to File System is allowed for this frame. | |
26 virtual bool requestFileSystemAccessSync() { return true; } | |
27 | |
28 // Controls whether access to File System is allowed for this frame. | |
29 virtual void requestFileSystemAccessAsync( | |
30 const WebContentSettingCallbacks& callbacks) { | |
31 WebContentSettingCallbacks permissionCallbacks(callbacks); | |
32 permissionCallbacks.doAllow(); | |
33 } | |
34 | |
35 // Controls whether images are allowed for this frame. | |
36 virtual bool allowImage(bool enabledPerSettings, const WebURL& imageURL) { | |
37 return enabledPerSettings; | |
38 } | |
39 | |
40 // Controls whether access to Indexed DB are allowed for this frame. | |
41 virtual bool allowIndexedDB(const WebString& name, const WebSecurityOrigin&) { | |
42 return true; | |
43 } | |
44 | |
45 // Controls whether plugins are allowed for this frame. | |
46 virtual bool allowPlugins(bool enabledPerSettings) { | |
47 return enabledPerSettings; | |
48 } | |
49 | |
50 // Controls whether scripts are allowed to execute for this frame. | |
51 virtual bool allowScript(bool enabledPerSettings) { | |
52 return enabledPerSettings; | |
53 } | |
54 | |
55 // Controls whether scripts loaded from the given URL are allowed to execute | |
56 // for this frame. | |
57 virtual bool allowScriptFromSource(bool enabledPerSettings, | |
58 const WebURL& scriptURL) { | |
59 return enabledPerSettings; | |
60 } | |
61 | |
62 // Controls whether insecure scripts are allowed to execute for this frame. | |
63 virtual bool allowRunningInsecureContent(bool enabledPerSettings, | |
64 const WebSecurityOrigin&, | |
65 const WebURL&) { | |
66 return enabledPerSettings; | |
67 } | |
68 | |
69 // Controls whether HTML5 Web Storage is allowed for this frame. | |
70 // If local is true, then this is for local storage, otherwise it's for | |
71 // session storage. | |
72 virtual bool allowStorage(bool local) { return true; } | |
73 | |
74 // Controls whether access to read the clipboard is allowed for this frame. | |
75 virtual bool allowReadFromClipboard(bool defaultValue) { | |
76 return defaultValue; | |
77 } | |
78 | |
79 // Controls whether access to write the clipboard is allowed for this frame. | |
80 virtual bool allowWriteToClipboard(bool defaultValue) { return defaultValue; } | |
81 | |
82 // Controls whether enabling Web Components API for this frame. | |
83 virtual bool allowWebComponents(bool defaultValue) { return defaultValue; } | |
84 | |
85 // Controls whether to enable MutationEvents for this frame. | |
86 // The common use case of this method is actually to selectively disable | |
87 // MutationEvents, but it's been named for consistency with the rest of the | |
88 // interface. | |
89 virtual bool allowMutationEvents(bool defaultValue) { return defaultValue; } | |
90 | |
91 // Controls whether autoplay is allowed for this frame. | |
92 virtual bool allowAutoplay(bool defaultValue) { return defaultValue; } | |
93 | |
94 // Reports that passive mixed content was found at the provided URL. | |
95 virtual void passiveInsecureContentFound(const WebURL&) {} | |
96 | |
97 // Notifies the client that the frame would have instantiated a plugin if | |
98 // plugins were enabled. | |
99 virtual void didNotAllowPlugins() {} | |
100 | |
101 // Notifies the client that the frame would have executed script if script | |
102 // were enabled. | |
103 virtual void didNotAllowScript() {} | |
104 | |
105 virtual ~WebContentSettingsClient() {} | |
106 }; | |
107 | |
108 } // namespace blink | |
109 | |
110 #endif // WebContentSettingsClient_h | |
OLD | NEW |