Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: Source/testing/runner/WebPermissions.cpp

Issue 27694002: Ability to block <audio> and <video> media. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rename "video" to "media". Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 } 50 }
51 51
52 bool WebPermissions::allowImage(WebKit::WebFrame*, bool enabledPerSettings, cons t WebKit::WebURL& imageURL) 52 bool WebPermissions::allowImage(WebKit::WebFrame*, bool enabledPerSettings, cons t WebKit::WebURL& imageURL)
53 { 53 {
54 bool allowed = enabledPerSettings && m_imagesAllowed; 54 bool allowed = enabledPerSettings && m_imagesAllowed;
55 if (m_dumpCallbacks && m_delegate) 55 if (m_dumpCallbacks && m_delegate)
56 m_delegate->printMessage(std::string("PERMISSION CLIENT: allowImage(") + normalizeLayoutTestURL(imageURL.spec()) + "): " + (allowed ? "true" : "false") + "\n"); 56 m_delegate->printMessage(std::string("PERMISSION CLIENT: allowImage(") + normalizeLayoutTestURL(imageURL.spec()) + "): " + (allowed ? "true" : "false") + "\n");
57 return allowed; 57 return allowed;
58 } 58 }
59 59
60 bool WebPermissions::allowMedia(WebKit::WebFrame*, bool enabledPerSettings, cons t WebKit::WebURL& mediaURL)
61 {
62 bool allowed = enabledPerSettings && m_mediaAllowed;
63 if (m_dumpCallbacks && m_delegate)
64 m_delegate->printMessage(std::string("PERMISSION CLIENT: allowMedia(") + normalizeLayoutTestURL(mediaURL.spec()) + "): " + (allowed ? "true" : "false") + "\n");
65 return allowed;
66 }
67
60 bool WebPermissions::allowScriptFromSource(WebKit::WebFrame*, bool enabledPerSet tings, const WebKit::WebURL& scriptURL) 68 bool WebPermissions::allowScriptFromSource(WebKit::WebFrame*, bool enabledPerSet tings, const WebKit::WebURL& scriptURL)
61 { 69 {
62 bool allowed = enabledPerSettings && m_scriptsAllowed; 70 bool allowed = enabledPerSettings && m_scriptsAllowed;
63 if (m_dumpCallbacks && m_delegate) 71 if (m_dumpCallbacks && m_delegate)
64 m_delegate->printMessage(std::string("PERMISSION CLIENT: allowScriptFrom Source(") + normalizeLayoutTestURL(scriptURL.spec()) + "): " + (allowed ? "true" : "false") + "\n"); 72 m_delegate->printMessage(std::string("PERMISSION CLIENT: allowScriptFrom Source(") + normalizeLayoutTestURL(scriptURL.spec()) + "): " + (allowed ? "true" : "false") + "\n");
65 return allowed; 73 return allowed;
66 } 74 }
67 75
68 bool WebPermissions::allowStorage(WebKit::WebFrame*, bool) 76 bool WebPermissions::allowStorage(WebKit::WebFrame*, bool)
69 { 77 {
(...skipping 13 matching lines...) Expand all
83 bool WebPermissions::allowRunningInsecureContent(WebKit::WebFrame*, bool enabled PerSettings, const WebKit::WebSecurityOrigin&, const WebKit::WebURL&) 91 bool WebPermissions::allowRunningInsecureContent(WebKit::WebFrame*, bool enabled PerSettings, const WebKit::WebSecurityOrigin&, const WebKit::WebURL&)
84 { 92 {
85 return enabledPerSettings || m_runningInsecureContentAllowed; 93 return enabledPerSettings || m_runningInsecureContentAllowed;
86 } 94 }
87 95
88 void WebPermissions::setImagesAllowed(bool imagesAllowed) 96 void WebPermissions::setImagesAllowed(bool imagesAllowed)
89 { 97 {
90 m_imagesAllowed = imagesAllowed; 98 m_imagesAllowed = imagesAllowed;
91 } 99 }
92 100
101 void WebPermissions::setMediaAllowed(bool mediaAllowed)
102 {
103 m_mediaAllowed = mediaAllowed;
104 }
105
93 void WebPermissions::setScriptsAllowed(bool scriptsAllowed) 106 void WebPermissions::setScriptsAllowed(bool scriptsAllowed)
94 { 107 {
95 m_scriptsAllowed = scriptsAllowed; 108 m_scriptsAllowed = scriptsAllowed;
96 } 109 }
97 110
98 void WebPermissions::setStorageAllowed(bool storageAllowed) 111 void WebPermissions::setStorageAllowed(bool storageAllowed)
99 { 112 {
100 m_storageAllowed = storageAllowed; 113 m_storageAllowed = storageAllowed;
101 } 114 }
102 115
(...skipping 19 matching lines...) Expand all
122 135
123 void WebPermissions::setDumpCallbacks(bool dumpCallbacks) 136 void WebPermissions::setDumpCallbacks(bool dumpCallbacks)
124 { 137 {
125 m_dumpCallbacks = dumpCallbacks; 138 m_dumpCallbacks = dumpCallbacks;
126 } 139 }
127 140
128 void WebPermissions::reset() 141 void WebPermissions::reset()
129 { 142 {
130 m_dumpCallbacks = false; 143 m_dumpCallbacks = false;
131 m_imagesAllowed = true; 144 m_imagesAllowed = true;
145 m_mediaAllowed = true;
132 m_scriptsAllowed = true; 146 m_scriptsAllowed = true;
133 m_storageAllowed = true; 147 m_storageAllowed = true;
134 m_pluginsAllowed = true; 148 m_pluginsAllowed = true;
135 m_displayingInsecureContentAllowed = false; 149 m_displayingInsecureContentAllowed = false;
136 m_runningInsecureContentAllowed = false; 150 m_runningInsecureContentAllowed = false;
137 } 151 }
138 152
139 } 153 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698