OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/shell/renderer/test_runner/WebPermissions.h" | 5 #include "content/shell/renderer/test_runner/WebPermissions.h" |
6 | 6 |
7 #include "content/shell/renderer/test_runner/TestCommon.h" | 7 #include "content/shell/renderer/test_runner/TestCommon.h" |
8 #include "content/shell/renderer/test_runner/WebTestDelegate.h" | 8 #include "content/shell/renderer/test_runner/WebTestDelegate.h" |
9 #include "third_party/WebKit/public/platform/WebCString.h" | 9 #include "third_party/WebKit/public/platform/WebCString.h" |
10 #include "third_party/WebKit/public/platform/WebURL.h" | 10 #include "third_party/WebKit/public/platform/WebURL.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 } | 24 } |
25 | 25 |
26 bool WebPermissions::allowImage(bool enabledPerSettings, const blink::WebURL& im
ageURL) | 26 bool WebPermissions::allowImage(bool enabledPerSettings, const blink::WebURL& im
ageURL) |
27 { | 27 { |
28 bool allowed = enabledPerSettings && m_imagesAllowed; | 28 bool allowed = enabledPerSettings && m_imagesAllowed; |
29 if (m_dumpCallbacks && m_delegate) | 29 if (m_dumpCallbacks && m_delegate) |
30 m_delegate->printMessage(std::string("PERMISSION CLIENT: allowImage(") +
normalizeLayoutTestURL(imageURL.spec()) + "): " + (allowed ? "true" : "false")
+ "\n"); | 30 m_delegate->printMessage(std::string("PERMISSION CLIENT: allowImage(") +
normalizeLayoutTestURL(imageURL.spec()) + "): " + (allowed ? "true" : "false")
+ "\n"); |
31 return allowed; | 31 return allowed; |
32 } | 32 } |
33 | 33 |
| 34 bool WebPermissions::allowMedia(const blink::WebURL& imageURL) |
| 35 { |
| 36 bool allowed = m_mediaAllowed; |
| 37 if (m_dumpCallbacks && m_delegate) |
| 38 m_delegate->printMessage(std::string("PERMISSION CLIENT: allowMedia(") +
normalizeLayoutTestURL(imageURL.spec()) + "): " + (allowed ? "true" : "false")
+ "\n"); |
| 39 return allowed; |
| 40 } |
| 41 |
34 bool WebPermissions::allowScriptFromSource(bool enabledPerSettings, const blink:
:WebURL& scriptURL) | 42 bool WebPermissions::allowScriptFromSource(bool enabledPerSettings, const blink:
:WebURL& scriptURL) |
35 { | 43 { |
36 bool allowed = enabledPerSettings && m_scriptsAllowed; | 44 bool allowed = enabledPerSettings && m_scriptsAllowed; |
37 if (m_dumpCallbacks && m_delegate) | 45 if (m_dumpCallbacks && m_delegate) |
38 m_delegate->printMessage(std::string("PERMISSION CLIENT: allowScriptFrom
Source(") + normalizeLayoutTestURL(scriptURL.spec()) + "): " + (allowed ? "true"
: "false") + "\n"); | 46 m_delegate->printMessage(std::string("PERMISSION CLIENT: allowScriptFrom
Source(") + normalizeLayoutTestURL(scriptURL.spec()) + "): " + (allowed ? "true"
: "false") + "\n"); |
39 return allowed; | 47 return allowed; |
40 } | 48 } |
41 | 49 |
42 bool WebPermissions::allowStorage(bool) | 50 bool WebPermissions::allowStorage(bool) |
43 { | 51 { |
(...skipping 13 matching lines...) Expand all Loading... |
57 bool WebPermissions::allowRunningInsecureContent(bool enabledPerSettings, const
blink::WebSecurityOrigin&, const blink::WebURL&) | 65 bool WebPermissions::allowRunningInsecureContent(bool enabledPerSettings, const
blink::WebSecurityOrigin&, const blink::WebURL&) |
58 { | 66 { |
59 return enabledPerSettings || m_runningInsecureContentAllowed; | 67 return enabledPerSettings || m_runningInsecureContentAllowed; |
60 } | 68 } |
61 | 69 |
62 void WebPermissions::setImagesAllowed(bool imagesAllowed) | 70 void WebPermissions::setImagesAllowed(bool imagesAllowed) |
63 { | 71 { |
64 m_imagesAllowed = imagesAllowed; | 72 m_imagesAllowed = imagesAllowed; |
65 } | 73 } |
66 | 74 |
| 75 void WebPermissions::setMediaAllowed(bool mediaAllowed) |
| 76 { |
| 77 m_mediaAllowed = mediaAllowed; |
| 78 } |
| 79 |
67 void WebPermissions::setScriptsAllowed(bool scriptsAllowed) | 80 void WebPermissions::setScriptsAllowed(bool scriptsAllowed) |
68 { | 81 { |
69 m_scriptsAllowed = scriptsAllowed; | 82 m_scriptsAllowed = scriptsAllowed; |
70 } | 83 } |
71 | 84 |
72 void WebPermissions::setStorageAllowed(bool storageAllowed) | 85 void WebPermissions::setStorageAllowed(bool storageAllowed) |
73 { | 86 { |
74 m_storageAllowed = storageAllowed; | 87 m_storageAllowed = storageAllowed; |
75 } | 88 } |
76 | 89 |
(...skipping 19 matching lines...) Expand all Loading... |
96 | 109 |
97 void WebPermissions::setDumpCallbacks(bool dumpCallbacks) | 110 void WebPermissions::setDumpCallbacks(bool dumpCallbacks) |
98 { | 111 { |
99 m_dumpCallbacks = dumpCallbacks; | 112 m_dumpCallbacks = dumpCallbacks; |
100 } | 113 } |
101 | 114 |
102 void WebPermissions::reset() | 115 void WebPermissions::reset() |
103 { | 116 { |
104 m_dumpCallbacks = false; | 117 m_dumpCallbacks = false; |
105 m_imagesAllowed = true; | 118 m_imagesAllowed = true; |
| 119 m_mediaAllowed = true; |
106 m_scriptsAllowed = true; | 120 m_scriptsAllowed = true; |
107 m_storageAllowed = true; | 121 m_storageAllowed = true; |
108 m_pluginsAllowed = true; | 122 m_pluginsAllowed = true; |
109 m_displayingInsecureContentAllowed = false; | 123 m_displayingInsecureContentAllowed = false; |
110 m_runningInsecureContentAllowed = false; | 124 m_runningInsecureContentAllowed = false; |
111 } | 125 } |
112 | 126 |
113 } // namespace content | 127 } // namespace content |
OLD | NEW |