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 "content/shell/renderer/test_runner/web_permissions.h" | 5 #include "content/shell/renderer/test_runner/web_permissions.h" |
6 | 6 |
7 #include "content/shell/renderer/test_runner/WebTestDelegate.h" | |
8 #include "content/shell/renderer/test_runner/test_common.h" | 7 #include "content/shell/renderer/test_runner/test_common.h" |
| 8 #include "content/shell/renderer/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" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 WebPermissions::WebPermissions() : delegate_(0) { | 14 WebPermissions::WebPermissions() : delegate_(0) { |
15 Reset(); | 15 Reset(); |
16 } | 16 } |
17 | 17 |
18 WebPermissions::~WebPermissions() {} | 18 WebPermissions::~WebPermissions() {} |
19 | 19 |
20 bool WebPermissions::allowImage(bool enabled_per_settings, | 20 bool WebPermissions::allowImage(bool enabled_per_settings, |
21 const blink::WebURL& image_url) { | 21 const blink::WebURL& image_url) { |
22 bool allowed = enabled_per_settings && images_allowed_; | 22 bool allowed = enabled_per_settings && images_allowed_; |
23 if (dump_callbacks_ && delegate_) { | 23 if (dump_callbacks_ && delegate_) { |
24 delegate_->printMessage(std::string("PERMISSION CLIENT: allowImage(") + | 24 delegate_->PrintMessage(std::string("PERMISSION CLIENT: allowImage(") + |
25 NormalizeLayoutTestURL(image_url.spec()) + "): " + | 25 NormalizeLayoutTestURL(image_url.spec()) + "): " + |
26 (allowed ? "true" : "false") + "\n"); | 26 (allowed ? "true" : "false") + "\n"); |
27 } | 27 } |
28 return allowed; | 28 return allowed; |
29 } | 29 } |
30 | 30 |
31 bool WebPermissions::allowMedia(const blink::WebURL& image_url) { | 31 bool WebPermissions::allowMedia(const blink::WebURL& image_url) { |
32 bool allowed = media_allowed_; | 32 bool allowed = media_allowed_; |
33 if (dump_callbacks_ && delegate_) | 33 if (dump_callbacks_ && delegate_) |
34 delegate_->printMessage(std::string("PERMISSION CLIENT: allowMedia(") + | 34 delegate_->PrintMessage(std::string("PERMISSION CLIENT: allowMedia(") + |
35 NormalizeLayoutTestURL(image_url.spec()) + "): " + | 35 NormalizeLayoutTestURL(image_url.spec()) + "): " + |
36 (allowed ? "true" : "false") + "\n"); | 36 (allowed ? "true" : "false") + "\n"); |
37 return allowed; | 37 return allowed; |
38 } | 38 } |
39 | 39 |
40 bool WebPermissions::allowScriptFromSource(bool enabled_per_settings, | 40 bool WebPermissions::allowScriptFromSource(bool enabled_per_settings, |
41 const blink::WebURL& scriptURL) { | 41 const blink::WebURL& scriptURL) { |
42 bool allowed = enabled_per_settings && scripts_allowed_; | 42 bool allowed = enabled_per_settings && scripts_allowed_; |
43 if (dump_callbacks_ && delegate_) { | 43 if (dump_callbacks_ && delegate_) { |
44 delegate_->printMessage( | 44 delegate_->PrintMessage( |
45 std::string("PERMISSION CLIENT: allowScriptFromSource(") + | 45 std::string("PERMISSION CLIENT: allowScriptFromSource(") + |
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 WebPermissions::allowStorage(bool) { | 52 bool WebPermissions::allowStorage(bool) { |
53 return storage_allowed_; | 53 return storage_allowed_; |
54 } | 54 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 images_allowed_ = true; | 112 images_allowed_ = true; |
113 media_allowed_ = true; | 113 media_allowed_ = true; |
114 scripts_allowed_ = true; | 114 scripts_allowed_ = true; |
115 storage_allowed_ = true; | 115 storage_allowed_ = true; |
116 plugins_allowed_ = true; | 116 plugins_allowed_ = true; |
117 displaying_insecure_content_allowed_ = false; | 117 displaying_insecure_content_allowed_ = false; |
118 running_insecure_content_allowed_ = false; | 118 running_insecure_content_allowed_ = false; |
119 } | 119 } |
120 | 120 |
121 } // namespace content | 121 } // namespace content |
OLD | NEW |