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" |
11 | 11 |
12 using namespace std; | 12 using namespace std; |
13 | 13 |
14 namespace WebTestRunner { | 14 namespace WebTestRunner { |
15 | 15 |
16 WebPermissions::WebPermissions() | 16 WebPermissions::WebPermissions() |
17 : m_delegate(0) | 17 : m_delegate(0) |
18 { | 18 { |
19 reset(); | 19 reset(); |
20 } | 20 } |
21 | 21 |
22 WebPermissions::~WebPermissions() | 22 WebPermissions::~WebPermissions() |
23 { | 23 { |
24 } | 24 } |
25 | 25 |
26 bool WebPermissions::allowImage(blink::WebFrame*, bool enabledPerSettings, const
blink::WebURL& imageURL) | 26 bool WebPermissions::allowImage(blink::WebLocalFrame*, |
27 { | 27 bool enabledPerSettings, |
| 28 const blink::WebURL& imageURL) { |
28 return allowImage(enabledPerSettings, imageURL); | 29 return allowImage(enabledPerSettings, imageURL); |
29 } | 30 } |
30 | 31 |
31 bool WebPermissions::allowScriptFromSource(blink::WebFrame*, bool enabledPerSett
ings, const blink::WebURL& scriptURL) | 32 bool WebPermissions::allowScriptFromSource(blink::WebLocalFrame*, |
32 { | 33 bool enabledPerSettings, |
| 34 const blink::WebURL& scriptURL) { |
33 return allowScriptFromSource(enabledPerSettings, scriptURL); | 35 return allowScriptFromSource(enabledPerSettings, scriptURL); |
34 } | 36 } |
35 | 37 |
36 bool WebPermissions::allowStorage(blink::WebFrame*, bool temp) | 38 bool WebPermissions::allowStorage(blink::WebLocalFrame*, bool temp) { |
37 { | |
38 return allowStorage(temp); | 39 return allowStorage(temp); |
39 } | 40 } |
40 | 41 |
41 bool WebPermissions::allowPlugins(blink::WebFrame*, bool enabledPerSettings) | 42 bool WebPermissions::allowPlugins(blink::WebLocalFrame*, |
42 { | 43 bool enabledPerSettings) { |
43 return enabledPerSettings && m_pluginsAllowed; | 44 return enabledPerSettings && m_pluginsAllowed; |
44 } | 45 } |
45 | 46 |
46 bool WebPermissions::allowDisplayingInsecureContent(blink::WebFrame*, bool enabl
edPerSettings, const blink::WebSecurityOrigin& temp1, const blink::WebURL& temp2
) | 47 bool WebPermissions::allowDisplayingInsecureContent( |
47 { | 48 blink::WebLocalFrame*, |
| 49 bool enabledPerSettings, |
| 50 const blink::WebSecurityOrigin& temp1, |
| 51 const blink::WebURL& temp2) { |
48 return allowDisplayingInsecureContent(enabledPerSettings, temp1, temp2); | 52 return allowDisplayingInsecureContent(enabledPerSettings, temp1, temp2); |
49 } | 53 } |
50 | 54 |
51 bool WebPermissions::allowRunningInsecureContent(blink::WebFrame*, bool enabledP
erSettings, const blink::WebSecurityOrigin& temp1, const blink::WebURL& temp2) | 55 bool WebPermissions::allowRunningInsecureContent( |
52 { | 56 blink::WebLocalFrame*, |
| 57 bool enabledPerSettings, |
| 58 const blink::WebSecurityOrigin& temp1, |
| 59 const blink::WebURL& temp2) { |
53 return allowRunningInsecureContent(enabledPerSettings, temp1, temp2); | 60 return allowRunningInsecureContent(enabledPerSettings, temp1, temp2); |
54 } | 61 } |
55 | 62 |
56 bool WebPermissions::allowImage(bool enabledPerSettings, const blink::WebURL& im
ageURL) | 63 bool WebPermissions::allowImage(bool enabledPerSettings, const blink::WebURL& im
ageURL) |
57 { | 64 { |
58 bool allowed = enabledPerSettings && m_imagesAllowed; | 65 bool allowed = enabledPerSettings && m_imagesAllowed; |
59 if (m_dumpCallbacks && m_delegate) | 66 if (m_dumpCallbacks && m_delegate) |
60 m_delegate->printMessage(std::string("PERMISSION CLIENT: allowImage(") +
normalizeLayoutTestURL(imageURL.spec()) + "): " + (allowed ? "true" : "false")
+ "\n"); | 67 m_delegate->printMessage(std::string("PERMISSION CLIENT: allowImage(") +
normalizeLayoutTestURL(imageURL.spec()) + "): " + (allowed ? "true" : "false")
+ "\n"); |
61 return allowed; | 68 return allowed; |
62 } | 69 } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 m_dumpCallbacks = false; | 141 m_dumpCallbacks = false; |
135 m_imagesAllowed = true; | 142 m_imagesAllowed = true; |
136 m_scriptsAllowed = true; | 143 m_scriptsAllowed = true; |
137 m_storageAllowed = true; | 144 m_storageAllowed = true; |
138 m_pluginsAllowed = true; | 145 m_pluginsAllowed = true; |
139 m_displayingInsecureContentAllowed = false; | 146 m_displayingInsecureContentAllowed = false; |
140 m_runningInsecureContentAllowed = false; | 147 m_runningInsecureContentAllowed = false; |
141 } | 148 } |
142 | 149 |
143 } | 150 } |
OLD | NEW |