| 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*, bool enabledPerSettings,
const blink::WebURL& imageURL) |
| 27 { | 27 { |
| 28 return allowImage(enabledPerSettings, imageURL); | 28 return allowImage(enabledPerSettings, imageURL); |
| 29 } | 29 } |
| 30 | 30 |
| 31 bool WebPermissions::allowScriptFromSource(blink::WebFrame*, bool enabledPerSett
ings, const blink::WebURL& scriptURL) | 31 bool WebPermissions::allowScriptFromSource(blink::WebLocalFrame*, bool enabledPe
rSettings, const blink::WebURL& scriptURL) |
| 32 { | 32 { |
| 33 return allowScriptFromSource(enabledPerSettings, scriptURL); | 33 return allowScriptFromSource(enabledPerSettings, scriptURL); |
| 34 } | 34 } |
| 35 | 35 |
| 36 bool WebPermissions::allowStorage(blink::WebFrame*, bool temp) | 36 bool WebPermissions::allowStorage(blink::WebLocalFrame*, bool temp) |
| 37 { | 37 { |
| 38 return allowStorage(temp); | 38 return allowStorage(temp); |
| 39 } | 39 } |
| 40 | 40 |
| 41 bool WebPermissions::allowPlugins(blink::WebFrame*, bool enabledPerSettings) | 41 bool WebPermissions::allowPlugins(blink::WebLocalFrame*, bool enabledPerSettings
) |
| 42 { | 42 { |
| 43 return enabledPerSettings && m_pluginsAllowed; | 43 return enabledPerSettings && m_pluginsAllowed; |
| 44 } | 44 } |
| 45 | 45 |
| 46 bool WebPermissions::allowDisplayingInsecureContent(blink::WebFrame*, bool enabl
edPerSettings, const blink::WebSecurityOrigin& temp1, const blink::WebURL& temp2
) | 46 bool WebPermissions::allowDisplayingInsecureContent(blink::WebLocalFrame*, bool
enabledPerSettings, const blink::WebSecurityOrigin& temp1, const blink::WebURL&
temp2) |
| 47 { | 47 { |
| 48 return allowDisplayingInsecureContent(enabledPerSettings, temp1, temp2); | 48 return allowDisplayingInsecureContent(enabledPerSettings, temp1, temp2); |
| 49 } | 49 } |
| 50 | 50 |
| 51 bool WebPermissions::allowRunningInsecureContent(blink::WebFrame*, bool enabledP
erSettings, const blink::WebSecurityOrigin& temp1, const blink::WebURL& temp2) | 51 bool WebPermissions::allowRunningInsecureContent(blink::WebLocalFrame*, bool ena
bledPerSettings, const blink::WebSecurityOrigin& temp1, const blink::WebURL& tem
p2) |
| 52 { | 52 { |
| 53 return allowRunningInsecureContent(enabledPerSettings, temp1, temp2); | 53 return allowRunningInsecureContent(enabledPerSettings, temp1, temp2); |
| 54 } | 54 } |
| 55 | 55 |
| 56 bool WebPermissions::allowImage(bool enabledPerSettings, const blink::WebURL& im
ageURL) | 56 bool WebPermissions::allowImage(bool enabledPerSettings, const blink::WebURL& im
ageURL) |
| 57 { | 57 { |
| 58 bool allowed = enabledPerSettings && m_imagesAllowed; | 58 bool allowed = enabledPerSettings && m_imagesAllowed; |
| 59 if (m_dumpCallbacks && m_delegate) | 59 if (m_dumpCallbacks && m_delegate) |
| 60 m_delegate->printMessage(std::string("PERMISSION CLIENT: allowImage(") +
normalizeLayoutTestURL(imageURL.spec()) + "): " + (allowed ? "true" : "false")
+ "\n"); | 60 m_delegate->printMessage(std::string("PERMISSION CLIENT: allowImage(") +
normalizeLayoutTestURL(imageURL.spec()) + "): " + (allowed ? "true" : "false")
+ "\n"); |
| 61 return allowed; | 61 return allowed; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 m_dumpCallbacks = false; | 134 m_dumpCallbacks = false; |
| 135 m_imagesAllowed = true; | 135 m_imagesAllowed = true; |
| 136 m_scriptsAllowed = true; | 136 m_scriptsAllowed = true; |
| 137 m_storageAllowed = true; | 137 m_storageAllowed = true; |
| 138 m_pluginsAllowed = true; | 138 m_pluginsAllowed = true; |
| 139 m_displayingInsecureContentAllowed = false; | 139 m_displayingInsecureContentAllowed = false; |
| 140 m_runningInsecureContentAllowed = false; | 140 m_runningInsecureContentAllowed = false; |
| 141 } | 141 } |
| 142 | 142 |
| 143 } | 143 } |
| OLD | NEW |