fixing space formatting issues.

This commit is contained in:
ali.ibrahim 2016-10-14 10:58:16 +02:00
parent de29f2dde5
commit 9cc8bfae1c
5 changed files with 43 additions and 43 deletions

View file

@ -256,7 +256,7 @@ void URLRequest::Cancel() {
} }
bool URLRequest::SetExtraHeader(const std::string& name, bool URLRequest::SetExtraHeader(const std::string& name,
const std::string& value) { const std::string& value) {
// Request state must be in the initial non started state. // Request state must be in the initial non started state.
if (!request_state_.NotStarted()) { if (!request_state_.NotStarted()) {
// Cannot change headers after send. // Cannot change headers after send.
@ -322,7 +322,7 @@ void URLRequest::OnAuthenticationRequired(
} }
void URLRequest::OnResponseStarted( void URLRequest::OnResponseStarted(
scoped_refptr<net::HttpResponseHeaders> response_headers) { scoped_refptr<net::HttpResponseHeaders> response_headers) {
if (request_state_.Canceled() || if (request_state_.Canceled() ||
request_state_.Failed() || request_state_.Failed() ||
request_state_.Closed()) { request_state_.Closed()) {
@ -335,7 +335,7 @@ void URLRequest::OnResponseStarted(
} }
void URLRequest::OnResponseData( void URLRequest::OnResponseData(
scoped_refptr<const net::IOBufferWithSize> buffer) { scoped_refptr<const net::IOBufferWithSize> buffer) {
if (request_state_.Canceled() || if (request_state_.Canceled() ||
request_state_.Closed() || request_state_.Closed() ||
request_state_.Failed() || request_state_.Failed() ||

View file

@ -95,14 +95,14 @@ class URLRequest : public mate::EventEmitter<URLRequest> {
static mate::WrappableBase* New(mate::Arguments* args); static mate::WrappableBase* New(mate::Arguments* args);
static void BuildPrototype( static void BuildPrototype(
v8::Isolate* isolate, v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype); v8::Local<v8::FunctionTemplate> prototype);
// Methods for reporting events into JavaScript. // Methods for reporting events into JavaScript.
void OnAuthenticationRequired( void OnAuthenticationRequired(
scoped_refptr<const net::AuthChallengeInfo> auth_info); scoped_refptr<const net::AuthChallengeInfo> auth_info);
void OnResponseStarted( void OnResponseStarted(
scoped_refptr<net::HttpResponseHeaders> response_headers); scoped_refptr<net::HttpResponseHeaders> response_headers);
void OnResponseData(scoped_refptr<const net::IOBufferWithSize> data); void OnResponseData(scoped_refptr<const net::IOBufferWithSize> data);
void OnResponseCompleted(); void OnResponseCompleted();
void OnRequestError(const std::string& error); void OnRequestError(const std::string& error);
@ -110,7 +110,7 @@ class URLRequest : public mate::EventEmitter<URLRequest> {
protected: protected:
explicit URLRequest(v8::Isolate* isolate, explicit URLRequest(v8::Isolate* isolate,
v8::Local<v8::Object> wrapper); v8::Local<v8::Object> wrapper);
~URLRequest() override; ~URLRequest() override;
private: private:

View file

@ -14,7 +14,6 @@
#include "net/base/upload_bytes_element_reader.h" #include "net/base/upload_bytes_element_reader.h"
namespace { namespace {
const int kBufferSize = 4096; const int kBufferSize = 4096;
} // namespace } // namespace
@ -23,21 +22,19 @@ namespace atom {
namespace internal { namespace internal {
class UploadOwnedIOBufferElementReader : public net::UploadBytesElementReader { class UploadOwnedIOBufferElementReader : public net::UploadBytesElementReader {
public: public:
explicit UploadOwnedIOBufferElementReader( explicit UploadOwnedIOBufferElementReader(
scoped_refptr<const net::IOBufferWithSize> buffer) scoped_refptr<const net::IOBufferWithSize> buffer)
: net::UploadBytesElementReader(buffer->data(), buffer->size()) : net::UploadBytesElementReader(buffer->data(), buffer->size()),
, buffer_(buffer) { buffer_(buffer) {
} }
~UploadOwnedIOBufferElementReader() override { ~UploadOwnedIOBufferElementReader() override {
} }
static UploadOwnedIOBufferElementReader* CreateWithBuffer( static UploadOwnedIOBufferElementReader* CreateWithBuffer(
scoped_refptr<const net::IOBufferWithSize> buffer) { scoped_refptr<const net::IOBufferWithSize> buffer) {
return new UploadOwnedIOBufferElementReader(std::move(buffer)); return new UploadOwnedIOBufferElementReader(std::move(buffer));
} }
@ -127,7 +124,7 @@ void AtomURLRequest::Cancel() const {
} }
void AtomURLRequest::SetExtraHeader(const std::string& name, void AtomURLRequest::SetExtraHeader(const std::string& name,
const std::string& value) const { const std::string& value) const {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
content::BrowserThread::PostTask( content::BrowserThread::PostTask(
content::BrowserThread::IO, content::BrowserThread::IO,
@ -143,8 +140,9 @@ void AtomURLRequest::RemoveExtraHeader(const std::string& name) const {
base::Bind(&AtomURLRequest::DoRemoveExtraHeader, this, name)); base::Bind(&AtomURLRequest::DoRemoveExtraHeader, this, name));
} }
void AtomURLRequest::PassLoginInformation(const base::string16& username, void AtomURLRequest::PassLoginInformation(
const base::string16& password) const { const base::string16& username,
const base::string16& password) const {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (username.empty() || password.empty()) { if (username.empty() || password.empty()) {
content::BrowserThread::PostTask( content::BrowserThread::PostTask(
@ -158,8 +156,8 @@ void AtomURLRequest::PassLoginInformation(const base::string16& username,
} }
void AtomURLRequest::DoWriteBuffer( void AtomURLRequest::DoWriteBuffer(
scoped_refptr<const net::IOBufferWithSize> buffer, scoped_refptr<const net::IOBufferWithSize> buffer,
bool is_last) { bool is_last) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO); DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
if (is_chunked_upload_) { if (is_chunked_upload_) {
@ -223,8 +221,9 @@ void AtomURLRequest::DoRemoveExtraHeader(const std::string& name) const {
request_->RemoveRequestHeaderByName(name); request_->RemoveRequestHeaderByName(name);
} }
void AtomURLRequest::DoSetAuth(const base::string16& username, void AtomURLRequest::DoSetAuth(
const base::string16& password) const { const base::string16& username,
const base::string16& password) const {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO); DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
request_->SetAuth(net::AuthCredentials(username, password)); request_->SetAuth(net::AuthCredentials(username, password));
} }
@ -234,8 +233,9 @@ void AtomURLRequest::DoCancelAuth() const {
request_->CancelAuth(); request_->CancelAuth();
} }
void AtomURLRequest::OnAuthRequired(net::URLRequest* request, void AtomURLRequest::OnAuthRequired(
net::AuthChallengeInfo* auth_info) { net::URLRequest* request,
net::AuthChallengeInfo* auth_info) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO); DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
content::BrowserThread::PostTask( content::BrowserThread::PostTask(
@ -351,7 +351,7 @@ bool AtomURLRequest::CopyAndPostBuffer(int bytes_read) {
void AtomURLRequest::InformDelegateAuthenticationRequired( void AtomURLRequest::InformDelegateAuthenticationRequired(
scoped_refptr<net::AuthChallengeInfo> auth_info) const { scoped_refptr<net::AuthChallengeInfo> auth_info) const {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (delegate_) if (delegate_)
delegate_->OnAuthenticationRequired(auth_info); delegate_->OnAuthenticationRequired(auth_info);
@ -365,7 +365,7 @@ void AtomURLRequest::InformDelegateResponseStarted(
} }
void AtomURLRequest::InformDelegateResponseData( void AtomURLRequest::InformDelegateResponseData(
scoped_refptr<net::IOBufferWithSize> data) const { scoped_refptr<net::IOBufferWithSize> data) const {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
// Transfer ownership of the data buffer, data will be released // Transfer ownership of the data buffer, data will be released
@ -382,7 +382,7 @@ void AtomURLRequest::InformDelegateResponseCompleted() const {
} }
void AtomURLRequest::InformDelegateRequestErrorOccured( void AtomURLRequest::InformDelegateRequestErrorOccured(
const std::string& error) const { const std::string& error) const {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (delegate_) if (delegate_)
@ -390,7 +390,7 @@ void AtomURLRequest::InformDelegateRequestErrorOccured(
} }
void AtomURLRequest::InformDelegateResponseErrorOccured( void AtomURLRequest::InformDelegateResponseErrorOccured(
const std::string& error) const { const std::string& error) const {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (delegate_) if (delegate_)

View file

@ -25,27 +25,26 @@ class AtomURLRequest : public base::RefCountedThreadSafe<AtomURLRequest>,
public net::URLRequest::Delegate { public net::URLRequest::Delegate {
public: public:
static scoped_refptr<AtomURLRequest> Create( static scoped_refptr<AtomURLRequest> Create(
AtomBrowserContext* browser_context, AtomBrowserContext* browser_context,
const std::string& method, const std::string& method,
const std::string& url, const std::string& url,
base::WeakPtr<api::URLRequest> delegate); base::WeakPtr<api::URLRequest> delegate);
bool Write(scoped_refptr<const net::IOBufferWithSize> buffer, bool Write(scoped_refptr<const net::IOBufferWithSize> buffer,
bool is_last); bool is_last);
void SetChunkedUpload(bool is_chunked_upload); void SetChunkedUpload(bool is_chunked_upload);
void Cancel() const; void Cancel() const;
void SetExtraHeader(const std::string& name, const std::string& value) const; void SetExtraHeader(const std::string& name, const std::string& value) const;
void RemoveExtraHeader(const std::string& name) const; void RemoveExtraHeader(const std::string& name) const;
void PassLoginInformation(const base::string16& username, void PassLoginInformation(const base::string16& username,
const base::string16& password) const; const base::string16& password) const;
protected: protected:
// Overrides of net::URLRequest::Delegate // Overrides of net::URLRequest::Delegate
void OnAuthRequired(net::URLRequest* request, void OnAuthRequired(net::URLRequest* request,
net::AuthChallengeInfo* auth_info) override; net::AuthChallengeInfo* auth_info) override;
void OnResponseStarted(net::URLRequest* request) override; void OnResponseStarted(net::URLRequest* request) override;
void OnReadCompleted(net::URLRequest* request, void OnReadCompleted(net::URLRequest* request, int bytes_read) override;
int bytes_read) override;
private: private:
friend class base::RefCountedThreadSafe<AtomURLRequest>; friend class base::RefCountedThreadSafe<AtomURLRequest>;
@ -63,18 +62,18 @@ class AtomURLRequest : public base::RefCountedThreadSafe<AtomURLRequest>,
const std::string& value) const; const std::string& value) const;
void DoRemoveExtraHeader(const std::string& name) const; void DoRemoveExtraHeader(const std::string& name) const;
void DoSetAuth(const base::string16& username, void DoSetAuth(const base::string16& username,
const base::string16& password) const; const base::string16& password) const;
void DoCancelAuth() const; void DoCancelAuth() const;
void ReadResponse(); void ReadResponse();
bool CopyAndPostBuffer(int bytes_read); bool CopyAndPostBuffer(int bytes_read);
void InformDelegateAuthenticationRequired( void InformDelegateAuthenticationRequired(
scoped_refptr<net::AuthChallengeInfo> auth_info) const; scoped_refptr<net::AuthChallengeInfo> auth_info) const;
void InformDelegateResponseStarted( void InformDelegateResponseStarted(
scoped_refptr<net::HttpResponseHeaders>) const; scoped_refptr<net::HttpResponseHeaders>) const;
void InformDelegateResponseData( void InformDelegateResponseData(
scoped_refptr<net::IOBufferWithSize> data) const; scoped_refptr<net::IOBufferWithSize> data) const;
void InformDelegateResponseCompleted() const; void InformDelegateResponseCompleted() const;
void InformDelegateRequestErrorOccured(const std::string& error) const; void InformDelegateRequestErrorOccured(const std::string& error) const;
void InformDelegateResponseErrorOccured(const std::string& error) const; void InformDelegateResponseErrorOccured(const std::string& error) const;

View file

@ -36,8 +36,9 @@ struct Converter<scoped_refptr<net::X509Certificate>> {
template<> template<>
struct Converter<scoped_refptr<net::HttpResponseHeaders>> { struct Converter<scoped_refptr<net::HttpResponseHeaders>> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate, static v8::Local<v8::Value> ToV8(
scoped_refptr<net::HttpResponseHeaders> headers); v8::Isolate* isolate,
scoped_refptr<net::HttpResponseHeaders> headers);
}; };
} // namespace mate } // namespace mate