| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/test_runner/web_content_settings.h" | 5 #include "components/test_runner/web_content_settings.h" |
| 6 | 6 |
| 7 #include "components/test_runner/test_common.h" | 7 #include "components/test_runner/test_common.h" |
| 8 #include "components/test_runner/web_test_delegate.h" | 8 #include "components/test_runner/web_test_delegate.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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 NormalizeLayoutTestURL(scriptURL.spec()) + "): " + | 46 NormalizeLayoutTestURL(scriptURL.spec()) + "): " + |
| 47 (allowed ? "true" : "false") + "\n"); | 47 (allowed ? "true" : "false") + "\n"); |
| 48 } | 48 } |
| 49 return allowed; | 49 return allowed; |
| 50 } | 50 } |
| 51 | 51 |
| 52 bool WebContentSettings::allowStorage(bool) { | 52 bool WebContentSettings::allowStorage(bool) { |
| 53 return storage_allowed_; | 53 return storage_allowed_; |
| 54 } | 54 } |
| 55 | 55 |
| 56 bool WebContentSettings::allowKeygen(bool enabled_per_settings) { |
| 57 return enabled_per_settings && keygen_allowed_; |
| 58 } |
| 59 |
| 56 bool WebContentSettings::allowPlugins(bool enabled_per_settings) { | 60 bool WebContentSettings::allowPlugins(bool enabled_per_settings) { |
| 57 return enabled_per_settings && plugins_allowed_; | 61 return enabled_per_settings && plugins_allowed_; |
| 58 } | 62 } |
| 59 | 63 |
| 60 bool WebContentSettings::allowDisplayingInsecureContent( | 64 bool WebContentSettings::allowDisplayingInsecureContent( |
| 61 bool enabled_per_settings, | 65 bool enabled_per_settings, |
| 62 const blink::WebSecurityOrigin&, | 66 const blink::WebSecurityOrigin&, |
| 63 const blink::WebURL&) { | 67 const blink::WebURL&) { |
| 64 return enabled_per_settings || displaying_insecure_content_allowed_; | 68 return enabled_per_settings || displaying_insecure_content_allowed_; |
| 65 } | 69 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 80 } | 84 } |
| 81 | 85 |
| 82 void WebContentSettings::SetScriptsAllowed(bool scripts_allowed) { | 86 void WebContentSettings::SetScriptsAllowed(bool scripts_allowed) { |
| 83 scripts_allowed_ = scripts_allowed; | 87 scripts_allowed_ = scripts_allowed; |
| 84 } | 88 } |
| 85 | 89 |
| 86 void WebContentSettings::SetStorageAllowed(bool storage_allowed) { | 90 void WebContentSettings::SetStorageAllowed(bool storage_allowed) { |
| 87 storage_allowed_ = storage_allowed; | 91 storage_allowed_ = storage_allowed; |
| 88 } | 92 } |
| 89 | 93 |
| 94 void WebContentSettings::SetKeygenAllowed(bool keygen_allowed) { |
| 95 keygen_allowed_ = keygen_allowed; |
| 96 } |
| 97 |
| 90 void WebContentSettings::SetPluginsAllowed(bool plugins_allowed) { | 98 void WebContentSettings::SetPluginsAllowed(bool plugins_allowed) { |
| 91 plugins_allowed_ = plugins_allowed; | 99 plugins_allowed_ = plugins_allowed; |
| 92 } | 100 } |
| 93 | 101 |
| 94 void WebContentSettings::SetDisplayingInsecureContentAllowed(bool allowed) { | 102 void WebContentSettings::SetDisplayingInsecureContentAllowed(bool allowed) { |
| 95 displaying_insecure_content_allowed_ = allowed; | 103 displaying_insecure_content_allowed_ = allowed; |
| 96 } | 104 } |
| 97 | 105 |
| 98 void WebContentSettings::SetRunningInsecureContentAllowed(bool allowed) { | 106 void WebContentSettings::SetRunningInsecureContentAllowed(bool allowed) { |
| 99 running_insecure_content_allowed_ = allowed; | 107 running_insecure_content_allowed_ = allowed; |
| 100 } | 108 } |
| 101 | 109 |
| 102 void WebContentSettings::SetDelegate(WebTestDelegate* delegate) { | 110 void WebContentSettings::SetDelegate(WebTestDelegate* delegate) { |
| 103 delegate_ = delegate; | 111 delegate_ = delegate; |
| 104 } | 112 } |
| 105 | 113 |
| 106 void WebContentSettings::SetDumpCallbacks(bool dump_callbacks) { | 114 void WebContentSettings::SetDumpCallbacks(bool dump_callbacks) { |
| 107 dump_callbacks_ = dump_callbacks; | 115 dump_callbacks_ = dump_callbacks; |
| 108 } | 116 } |
| 109 | 117 |
| 110 void WebContentSettings::Reset() { | 118 void WebContentSettings::Reset() { |
| 111 dump_callbacks_ = false; | 119 dump_callbacks_ = false; |
| 112 images_allowed_ = true; | 120 images_allowed_ = true; |
| 113 media_allowed_ = true; | 121 media_allowed_ = true; |
| 114 scripts_allowed_ = true; | 122 scripts_allowed_ = true; |
| 115 storage_allowed_ = true; | 123 storage_allowed_ = true; |
| 124 keygen_allowed_ = true; |
| 116 plugins_allowed_ = true; | 125 plugins_allowed_ = true; |
| 117 displaying_insecure_content_allowed_ = false; | 126 displaying_insecure_content_allowed_ = false; |
| 118 running_insecure_content_allowed_ = false; | 127 running_insecure_content_allowed_ = false; |
| 119 } | 128 } |
| 120 | 129 |
| 121 } // namespace test_runner | 130 } // namespace test_runner |
| OLD | NEW |