Do not use plain string iterals.
This commit is contained in:
parent
61b69a4e8a
commit
192014cc3f
1 changed files with 14 additions and 4 deletions
|
@ -17,17 +17,26 @@
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
const char* kExceptIframe = "except-iframe";
|
||||||
|
const char* kManualEnableIframe = "manual-enable-iframe";
|
||||||
|
const char* kDisable = "disable";
|
||||||
|
const char* kEnableNodeIntegration = "enable-node-integration";
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
AtomRendererClient::AtomRendererClient()
|
AtomRendererClient::AtomRendererClient()
|
||||||
: node_integration_(ALL),
|
: node_integration_(ALL),
|
||||||
main_frame_(NULL) {
|
main_frame_(NULL) {
|
||||||
// Translate the token.
|
// Translate the token.
|
||||||
std::string token = CommandLine::ForCurrentProcess()->
|
std::string token = CommandLine::ForCurrentProcess()->
|
||||||
GetSwitchValueASCII(switches::kNodeIntegration);
|
GetSwitchValueASCII(switches::kNodeIntegration);
|
||||||
if (token == "except-iframe")
|
if (token == kExceptIframe)
|
||||||
node_integration_ = EXCEPT_IFRAME;
|
node_integration_ = EXCEPT_IFRAME;
|
||||||
else if (token == "manual-enable-iframe")
|
else if (token == kManualEnableIframe)
|
||||||
node_integration_ = MANUAL_ENABLE_IFRAME;
|
node_integration_ = MANUAL_ENABLE_IFRAME;
|
||||||
else if (token == "disable")
|
else if (token == kDisable)
|
||||||
node_integration_ = DISABLE;
|
node_integration_ = DISABLE;
|
||||||
|
|
||||||
if (IsNodeBindingEnabled()) {
|
if (IsNodeBindingEnabled()) {
|
||||||
|
@ -146,7 +155,8 @@ bool AtomRendererClient::IsNodeBindingEnabled(WebKit::WebFrame* frame) {
|
||||||
return true;
|
return true;
|
||||||
else if (node_integration_ == MANUAL_ENABLE_IFRAME &&
|
else if (node_integration_ == MANUAL_ENABLE_IFRAME &&
|
||||||
frame != NULL &&
|
frame != NULL &&
|
||||||
frame->uniqueName().utf8().find("-enable-node") == std::string::npos)
|
frame->uniqueName().utf8().find(kEnableNodeIntegration)
|
||||||
|
== std::string::npos)
|
||||||
return false;
|
return false;
|
||||||
else if (node_integration_ == EXCEPT_IFRAME && frame != NULL)
|
else if (node_integration_ == EXCEPT_IFRAME && frame != NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue