Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 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 #include "core/frame/ContentSettingsClient.h" | |
| 6 | |
| 7 #include "platform/ContentSettingCallbacks.h" | |
| 8 #include "platform/weborigin/KURL.h" | |
| 9 #include "platform/weborigin/SecurityOrigin.h" | |
| 10 #include "public/platform/WebContentSettingCallbacks.h" | |
| 11 #include "public/platform/WebContentSettingsClient.h" | |
| 12 #include "public/platform/WebSecurityOrigin.h" | |
| 13 #include "public/platform/WebURL.h" | |
| 14 | |
| 15 namespace blink { | |
| 16 | |
| 17 ContentSettingsClient::ContentSettingsClient() = default; | |
| 18 | |
| 19 bool ContentSettingsClient::allowDatabase(const String& name, | |
| 20 const String& displayName, | |
| 21 unsigned estimatedSize) { | |
| 22 if (m_client) | |
| 23 return m_client->allowDatabase(name, displayName, estimatedSize); | |
| 24 return true; | |
| 25 } | |
| 26 | |
| 27 bool ContentSettingsClient::allowIndexedDB(const String& name, | |
| 28 SecurityOrigin* securityOrigin) { | |
| 29 if (m_client) | |
| 30 return m_client->allowIndexedDB(name, WebSecurityOrigin(securityOrigin)); | |
| 31 return true; | |
| 32 } | |
| 33 | |
| 34 bool ContentSettingsClient::requestFileSystemAccessSync() { | |
| 35 if (m_client) | |
| 36 return m_client->requestFileSystemAccessSync(); | |
| 37 return true; | |
| 38 } | |
| 39 | |
| 40 void ContentSettingsClient::requestFileSystemAccessAsync( | |
| 41 std::unique_ptr<ContentSettingCallbacks> callbacks) { | |
| 42 if (m_client) | |
| 43 m_client->requestFileSystemAccessAsync(std::move(callbacks)); | |
| 44 else | |
| 45 callbacks->onAllowed(); | |
| 46 } | |
| 47 | |
| 48 bool ContentSettingsClient::allowScript(bool enabledPerSettings) { | |
| 49 if (m_client) | |
| 50 return m_client->allowScript(enabledPerSettings); | |
| 51 return enabledPerSettings; | |
| 52 } | |
| 53 | |
| 54 bool ContentSettingsClient::allowScriptFromSource(bool enabledPerSettings, | |
| 55 const KURL& scriptURL) { | |
| 56 if (m_client) | |
| 57 return m_client->allowScriptFromSource(enabledPerSettings, scriptURL); | |
| 58 return enabledPerSettings; | |
| 59 } | |
| 60 | |
| 61 bool ContentSettingsClient::allowPlugins(bool enabledPerSettings) { | |
| 62 if (m_client) | |
| 63 return m_client->allowPlugins(enabledPerSettings); | |
| 64 return enabledPerSettings; | |
|
haraken
2017/04/04 11:25:32
Are we intending to return what's passed in if m_c
kinuko
2017/04/04 14:50:56
The given value is basically the default value and
| |
| 65 } | |
| 66 | |
| 67 bool ContentSettingsClient::allowImage(bool enabledPerSettings, | |
| 68 const KURL& imageURL) { | |
| 69 if (m_client) | |
| 70 return m_client->allowImage(enabledPerSettings, imageURL); | |
| 71 return enabledPerSettings; | |
| 72 } | |
| 73 | |
| 74 bool ContentSettingsClient::allowReadFromClipboard(bool defaultValue) { | |
| 75 if (m_client) | |
| 76 return m_client->allowReadFromClipboard(defaultValue); | |
| 77 return defaultValue; | |
| 78 } | |
| 79 | |
| 80 bool ContentSettingsClient::allowWriteToClipboard(bool defaultValue) { | |
| 81 if (m_client) | |
| 82 return m_client->allowWriteToClipboard(defaultValue); | |
| 83 return defaultValue; | |
| 84 } | |
| 85 | |
| 86 bool ContentSettingsClient::allowStorage(StorageType type) { | |
| 87 if (m_client) | |
| 88 return m_client->allowStorage(type == StorageType::kLocal); | |
| 89 return true; | |
| 90 } | |
| 91 | |
| 92 bool ContentSettingsClient::allowRunningInsecureContent(bool enabledPerSettings, | |
| 93 SecurityOrigin* origin, | |
| 94 const KURL& url) { | |
| 95 if (m_client) { | |
| 96 return m_client->allowRunningInsecureContent( | |
| 97 enabledPerSettings, WebSecurityOrigin(origin), url); | |
| 98 } | |
| 99 return enabledPerSettings; | |
| 100 } | |
| 101 | |
| 102 bool ContentSettingsClient::allowMutationEvents(bool defaultValue) { | |
| 103 if (m_client) | |
| 104 return m_client->allowMutationEvents(defaultValue); | |
| 105 return defaultValue; | |
| 106 } | |
| 107 | |
| 108 bool ContentSettingsClient::allowAutoplay(bool defaultValue) { | |
| 109 if (m_client) | |
| 110 return m_client->allowAutoplay(defaultValue); | |
| 111 return defaultValue; | |
| 112 } | |
| 113 | |
| 114 void ContentSettingsClient::passiveInsecureContentFound(const KURL& url) { | |
| 115 if (m_client) | |
| 116 return m_client->passiveInsecureContentFound(url); | |
| 117 } | |
| 118 | |
| 119 void ContentSettingsClient::didNotAllowScript() { | |
| 120 if (m_client) | |
| 121 m_client->didNotAllowScript(); | |
| 122 } | |
| 123 | |
| 124 void ContentSettingsClient::didNotAllowPlugins() { | |
| 125 if (m_client) | |
| 126 m_client->didNotAllowPlugins(); | |
| 127 } | |
| 128 | |
| 129 } // namespace blink | |
| OLD | NEW |