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

Unified Diff: content/shell/renderer/test_runner/web_permissions.cc

Issue 322713002: test_runner: Migrate WebPermissions to our Chromium C++ style. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/shell/renderer/test_runner/web_permissions.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/renderer/test_runner/web_permissions.cc
diff --git a/content/shell/renderer/test_runner/WebPermissions.cpp b/content/shell/renderer/test_runner/web_permissions.cc
similarity index 13%
rename from content/shell/renderer/test_runner/WebPermissions.cpp
rename to content/shell/renderer/test_runner/web_permissions.cc
index 3e32aa2ac169c3667ef7101ae6adfcb4dd167f4e..b8d0170ec292da54bbbc805a3b256ac34df20872 100644
--- a/content/shell/renderer/test_runner/WebPermissions.cpp
+++ b/content/shell/renderer/test_runner/web_permissions.cc
@@ -2,126 +2,120 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/shell/renderer/test_runner/WebPermissions.h"
+#include "content/shell/renderer/test_runner/web_permissions.h"
#include "content/shell/renderer/test_runner/TestCommon.h"
#include "content/shell/renderer/test_runner/WebTestDelegate.h"
#include "third_party/WebKit/public/platform/WebCString.h"
#include "third_party/WebKit/public/platform/WebURL.h"
-using namespace std;
-
namespace content {
-WebPermissions::WebPermissions()
- : m_delegate(0)
-{
- reset();
+WebPermissions::WebPermissions() : delegate_(0) {
+ Reset();
}
-WebPermissions::~WebPermissions()
-{
-}
+WebPermissions::~WebPermissions() {}
-bool WebPermissions::allowImage(bool enabledPerSettings, const blink::WebURL& imageURL)
-{
- bool allowed = enabledPerSettings && m_imagesAllowed;
- if (m_dumpCallbacks && m_delegate)
- m_delegate->printMessage(std::string("PERMISSION CLIENT: allowImage(") + normalizeLayoutTestURL(imageURL.spec()) + "): " + (allowed ? "true" : "false") + "\n");
- return allowed;
+bool WebPermissions::allowImage(bool enabled_per_settings,
+ const blink::WebURL& image_url) {
+ bool allowed = enabled_per_settings && images_allowed_;
+ if (dump_callbacks_ && delegate_) {
+ delegate_->printMessage(std::string("PERMISSION CLIENT: allowImage(") +
+ normalizeLayoutTestURL(image_url.spec()) + "): " +
+ (allowed ? "true" : "false") + "\n");
+ }
+ return allowed;
}
-bool WebPermissions::allowMedia(const blink::WebURL& imageURL)
-{
- bool allowed = m_mediaAllowed;
- if (m_dumpCallbacks && m_delegate)
- m_delegate->printMessage(std::string("PERMISSION CLIENT: allowMedia(") + normalizeLayoutTestURL(imageURL.spec()) + "): " + (allowed ? "true" : "false") + "\n");
- return allowed;
+bool WebPermissions::allowMedia(const blink::WebURL& image_url) {
+ bool allowed = media_allowed_;
+ if (dump_callbacks_ && delegate_)
+ delegate_->printMessage(std::string("PERMISSION CLIENT: allowMedia(") +
+ normalizeLayoutTestURL(image_url.spec()) + "): " +
+ (allowed ? "true" : "false") + "\n");
+ return allowed;
}
-bool WebPermissions::allowScriptFromSource(bool enabledPerSettings, const blink::WebURL& scriptURL)
-{
- bool allowed = enabledPerSettings && m_scriptsAllowed;
- if (m_dumpCallbacks && m_delegate)
- m_delegate->printMessage(std::string("PERMISSION CLIENT: allowScriptFromSource(") + normalizeLayoutTestURL(scriptURL.spec()) + "): " + (allowed ? "true" : "false") + "\n");
- return allowed;
+bool WebPermissions::allowScriptFromSource(bool enabled_per_settings,
+ const blink::WebURL& scriptURL) {
+ bool allowed = enabled_per_settings && scripts_allowed_;
+ if (dump_callbacks_ && delegate_) {
+ delegate_->printMessage(
+ std::string("PERMISSION CLIENT: allowScriptFromSource(") +
+ normalizeLayoutTestURL(scriptURL.spec()) + "): " +
+ (allowed ? "true" : "false") + "\n");
+ }
+ return allowed;
}
-bool WebPermissions::allowStorage(bool)
-{
- return m_storageAllowed;
+bool WebPermissions::allowStorage(bool) {
+ return storage_allowed_;
}
-bool WebPermissions::allowPlugins(bool enabledPerSettings)
-{
- return enabledPerSettings && m_pluginsAllowed;
+bool WebPermissions::allowPlugins(bool enabled_per_settings) {
+ return enabled_per_settings && plugins_allowed_;
}
-bool WebPermissions::allowDisplayingInsecureContent(bool enabledPerSettings, const blink::WebSecurityOrigin&, const blink::WebURL&)
-{
- return enabledPerSettings || m_displayingInsecureContentAllowed;
+bool WebPermissions::allowDisplayingInsecureContent(
+ bool enabled_per_settings,
+ const blink::WebSecurityOrigin&,
+ const blink::WebURL&) {
+ return enabled_per_settings || displaying_insecure_content_allowed_;
}
-bool WebPermissions::allowRunningInsecureContent(bool enabledPerSettings, const blink::WebSecurityOrigin&, const blink::WebURL&)
-{
- return enabledPerSettings || m_runningInsecureContentAllowed;
+bool WebPermissions::allowRunningInsecureContent(
+ bool enabled_per_settings,
+ const blink::WebSecurityOrigin&,
+ const blink::WebURL&) {
+ return enabled_per_settings || running_insecure_content_allowed_;
}
-void WebPermissions::setImagesAllowed(bool imagesAllowed)
-{
- m_imagesAllowed = imagesAllowed;
+void WebPermissions::SetImagesAllowed(bool images_allowed) {
+ images_allowed_ = images_allowed;
}
-void WebPermissions::setMediaAllowed(bool mediaAllowed)
-{
- m_mediaAllowed = mediaAllowed;
+void WebPermissions::SetMediaAllowed(bool media_allowed) {
+ media_allowed_ = media_allowed;
}
-void WebPermissions::setScriptsAllowed(bool scriptsAllowed)
-{
- m_scriptsAllowed = scriptsAllowed;
+void WebPermissions::SetScriptsAllowed(bool scripts_allowed) {
+ scripts_allowed_ = scripts_allowed;
}
-void WebPermissions::setStorageAllowed(bool storageAllowed)
-{
- m_storageAllowed = storageAllowed;
+void WebPermissions::SetStorageAllowed(bool storage_allowed) {
+ storage_allowed_ = storage_allowed;
}
-void WebPermissions::setPluginsAllowed(bool pluginsAllowed)
-{
- m_pluginsAllowed = pluginsAllowed;
+void WebPermissions::SetPluginsAllowed(bool plugins_allowed) {
+ plugins_allowed_ = plugins_allowed;
}
-void WebPermissions::setDisplayingInsecureContentAllowed(bool allowed)
-{
- m_displayingInsecureContentAllowed = allowed;
+void WebPermissions::SetDisplayingInsecureContentAllowed(bool allowed) {
+ displaying_insecure_content_allowed_ = allowed;
}
-void WebPermissions::setRunningInsecureContentAllowed(bool allowed)
-{
- m_runningInsecureContentAllowed = allowed;
+void WebPermissions::SetRunningInsecureContentAllowed(bool allowed) {
+ running_insecure_content_allowed_ = allowed;
}
-void WebPermissions::setDelegate(WebTestDelegate* delegate)
-{
- m_delegate = delegate;
+void WebPermissions::SetDelegate(WebTestDelegate* delegate) {
+ delegate_ = delegate;
}
-void WebPermissions::setDumpCallbacks(bool dumpCallbacks)
-{
- m_dumpCallbacks = dumpCallbacks;
+void WebPermissions::SetDumpCallbacks(bool dump_callbacks) {
+ dump_callbacks_ = dump_callbacks;
}
-void WebPermissions::reset()
-{
- m_dumpCallbacks = false;
- m_imagesAllowed = true;
- m_mediaAllowed = true;
- m_scriptsAllowed = true;
- m_storageAllowed = true;
- m_pluginsAllowed = true;
- m_displayingInsecureContentAllowed = false;
- m_runningInsecureContentAllowed = false;
+void WebPermissions::Reset() {
+ dump_callbacks_ = false;
+ images_allowed_ = true;
+ media_allowed_ = true;
+ scripts_allowed_ = true;
+ storage_allowed_ = true;
+ plugins_allowed_ = true;
+ displaying_insecure_content_allowed_ = false;
+ running_insecure_content_allowed_ = false;
}
} // namespace content
« no previous file with comments | « content/shell/renderer/test_runner/web_permissions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698