Put common constants in atom_constants
This commit is contained in:
parent
a2f1390b0d
commit
0f17a0163d
8 changed files with 35 additions and 9 deletions
|
@ -11,8 +11,6 @@
|
|||
|
||||
namespace atom {
|
||||
|
||||
const std::string kCorsHeader("Access-Control-Allow-Origin: *");
|
||||
|
||||
namespace internal {
|
||||
|
||||
namespace {
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
#ifndef ATOM_BROWSER_NET_JS_ASKER_H_
|
||||
#define ATOM_BROWSER_NET_JS_ASKER_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "base/callback.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
|
@ -19,7 +17,6 @@
|
|||
#include "v8/include/v8.h"
|
||||
|
||||
namespace atom {
|
||||
extern const std::string kCorsHeader;
|
||||
|
||||
using JavaScriptHandler =
|
||||
base::Callback<void(const net::URLRequest*, v8::Local<v8::Value>)>;
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include "atom/common/atom_constants.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
URLRequestAsyncAsarJob::URLRequestAsyncAsarJob(
|
||||
|
@ -36,12 +38,11 @@ void URLRequestAsyncAsarJob::StartAsync(scoped_ptr<base::Value> options) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void URLRequestAsyncAsarJob::GetResponseInfo(net::HttpResponseInfo* info) {
|
||||
std::string status("HTTP/1.1 200 OK");
|
||||
net::HttpResponseHeaders* headers = new net::HttpResponseHeaders(status);
|
||||
|
||||
headers->AddHeader(kCorsHeader);
|
||||
headers->AddHeader(kCORSHeader);
|
||||
info->headers = headers;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include "atom/common/atom_constants.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "net/base/net_errors.h"
|
||||
|
||||
|
@ -50,7 +51,7 @@ void URLRequestBufferJob::GetResponseInfo(net::HttpResponseInfo* info) {
|
|||
status.append("\0\0", 2);
|
||||
net::HttpResponseHeaders* headers = new net::HttpResponseHeaders(status);
|
||||
|
||||
headers->AddHeader(kCorsHeader);
|
||||
headers->AddHeader(kCORSHeader);
|
||||
|
||||
if (!mime_type_.empty()) {
|
||||
std::string content_type_header(net::HttpRequestHeaders::kContentType);
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include "atom/common/atom_constants.h"
|
||||
#include "net/base/net_errors.h"
|
||||
|
||||
namespace atom {
|
||||
|
@ -32,7 +33,7 @@ void URLRequestStringJob::GetResponseInfo(net::HttpResponseInfo* info) {
|
|||
std::string status("HTTP/1.1 200 OK");
|
||||
net::HttpResponseHeaders* headers = new net::HttpResponseHeaders(status);
|
||||
|
||||
headers->AddHeader(kCorsHeader);
|
||||
headers->AddHeader(kCORSHeader);
|
||||
|
||||
if (!mime_type_.empty()) {
|
||||
std::string content_type_header(net::HttpRequestHeaders::kContentType);
|
||||
|
|
11
atom/common/atom_constants.cc
Normal file
11
atom/common/atom_constants.cc
Normal file
|
@ -0,0 +1,11 @@
|
|||
// Copyright (c) 2015 GitHub, Inc.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "atom/common/atom_constants.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
const char* kCORSHeader = "Access-Control-Allow-Origin: *";
|
||||
|
||||
} // namespace atom
|
15
atom/common/atom_constants.h
Normal file
15
atom/common/atom_constants.h
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright (c) 2015 GitHub, Inc.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ATOM_COMMON_ATOM_CONSTANTS_H_
|
||||
#define ATOM_COMMON_ATOM_CONSTANTS_H_
|
||||
|
||||
namespace atom {
|
||||
|
||||
// Header to ignore CORS.
|
||||
extern const char* kCORSHeader;
|
||||
|
||||
} // namespace atom
|
||||
|
||||
#endif // ATOM_COMMON_ATOM_CONSTANTS_H_
|
|
@ -286,6 +286,8 @@
|
|||
'atom/common/asar/scoped_temporary_file.h',
|
||||
'atom/common/atom_command_line.cc',
|
||||
'atom/common/atom_command_line.h',
|
||||
'atom/common/atom_constants.cc',
|
||||
'atom/common/atom_constants.h',
|
||||
'atom/common/common_message_generator.cc',
|
||||
'atom/common/common_message_generator.h',
|
||||
'atom/common/crash_reporter/crash_reporter.cc',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue