diff --git a/atom/browser/api/atom_api_url_request.cc b/atom/browser/api/atom_api_url_request.cc index c4df35dda383..4b0ebedb5ad4 100644 --- a/atom/browser/api/atom_api_url_request.cc +++ b/atom/browser/api/atom_api_url_request.cc @@ -256,7 +256,7 @@ void URLRequest::Cancel() { } 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. if (!request_state_.NotStarted()) { // Cannot change headers after send. @@ -322,7 +322,7 @@ void URLRequest::OnAuthenticationRequired( } void URLRequest::OnResponseStarted( - scoped_refptr response_headers) { + scoped_refptr response_headers) { if (request_state_.Canceled() || request_state_.Failed() || request_state_.Closed()) { @@ -335,7 +335,7 @@ void URLRequest::OnResponseStarted( } void URLRequest::OnResponseData( - scoped_refptr buffer) { + scoped_refptr buffer) { if (request_state_.Canceled() || request_state_.Closed() || request_state_.Failed() || diff --git a/atom/browser/api/atom_api_url_request.h b/atom/browser/api/atom_api_url_request.h index 1dcb90139199..1ccbb3610d27 100644 --- a/atom/browser/api/atom_api_url_request.h +++ b/atom/browser/api/atom_api_url_request.h @@ -95,14 +95,14 @@ class URLRequest : public mate::EventEmitter { static mate::WrappableBase* New(mate::Arguments* args); static void BuildPrototype( - v8::Isolate* isolate, - v8::Local prototype); + v8::Isolate* isolate, + v8::Local prototype); // Methods for reporting events into JavaScript. void OnAuthenticationRequired( - scoped_refptr auth_info); + scoped_refptr auth_info); void OnResponseStarted( - scoped_refptr response_headers); + scoped_refptr response_headers); void OnResponseData(scoped_refptr data); void OnResponseCompleted(); void OnRequestError(const std::string& error); @@ -110,7 +110,7 @@ class URLRequest : public mate::EventEmitter { protected: explicit URLRequest(v8::Isolate* isolate, - v8::Local wrapper); + v8::Local wrapper); ~URLRequest() override; private: diff --git a/atom/browser/net/atom_url_request.cc b/atom/browser/net/atom_url_request.cc index bbe835e92642..2870e6dda595 100644 --- a/atom/browser/net/atom_url_request.cc +++ b/atom/browser/net/atom_url_request.cc @@ -14,7 +14,6 @@ #include "net/base/upload_bytes_element_reader.h" - namespace { const int kBufferSize = 4096; } // namespace @@ -23,21 +22,19 @@ namespace atom { namespace internal { - class UploadOwnedIOBufferElementReader : public net::UploadBytesElementReader { public: explicit UploadOwnedIOBufferElementReader( - scoped_refptr buffer) - : net::UploadBytesElementReader(buffer->data(), buffer->size()) - , buffer_(buffer) { + scoped_refptr buffer) + : net::UploadBytesElementReader(buffer->data(), buffer->size()), + buffer_(buffer) { } ~UploadOwnedIOBufferElementReader() override { } - static UploadOwnedIOBufferElementReader* CreateWithBuffer( - scoped_refptr buffer) { + scoped_refptr buffer) { return new UploadOwnedIOBufferElementReader(std::move(buffer)); } @@ -127,7 +124,7 @@ void AtomURLRequest::Cancel() const { } void AtomURLRequest::SetExtraHeader(const std::string& name, - const std::string& value) const { + const std::string& value) const { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); content::BrowserThread::PostTask( content::BrowserThread::IO, @@ -143,8 +140,9 @@ void AtomURLRequest::RemoveExtraHeader(const std::string& name) const { base::Bind(&AtomURLRequest::DoRemoveExtraHeader, this, name)); } -void AtomURLRequest::PassLoginInformation(const base::string16& username, - const base::string16& password) const { +void AtomURLRequest::PassLoginInformation( + const base::string16& username, + const base::string16& password) const { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); if (username.empty() || password.empty()) { content::BrowserThread::PostTask( @@ -158,8 +156,8 @@ void AtomURLRequest::PassLoginInformation(const base::string16& username, } void AtomURLRequest::DoWriteBuffer( - scoped_refptr buffer, - bool is_last) { + scoped_refptr buffer, + bool is_last) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); if (is_chunked_upload_) { @@ -223,8 +221,9 @@ void AtomURLRequest::DoRemoveExtraHeader(const std::string& name) const { request_->RemoveRequestHeaderByName(name); } -void AtomURLRequest::DoSetAuth(const base::string16& username, - const base::string16& password) const { +void AtomURLRequest::DoSetAuth( + const base::string16& username, + const base::string16& password) const { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); request_->SetAuth(net::AuthCredentials(username, password)); } @@ -234,8 +233,9 @@ void AtomURLRequest::DoCancelAuth() const { request_->CancelAuth(); } -void AtomURLRequest::OnAuthRequired(net::URLRequest* request, - net::AuthChallengeInfo* auth_info) { +void AtomURLRequest::OnAuthRequired( + net::URLRequest* request, + net::AuthChallengeInfo* auth_info) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); content::BrowserThread::PostTask( @@ -351,7 +351,7 @@ bool AtomURLRequest::CopyAndPostBuffer(int bytes_read) { void AtomURLRequest::InformDelegateAuthenticationRequired( - scoped_refptr auth_info) const { + scoped_refptr auth_info) const { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); if (delegate_) delegate_->OnAuthenticationRequired(auth_info); @@ -365,7 +365,7 @@ void AtomURLRequest::InformDelegateResponseStarted( } void AtomURLRequest::InformDelegateResponseData( - scoped_refptr data) const { + scoped_refptr data) const { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); // Transfer ownership of the data buffer, data will be released @@ -382,7 +382,7 @@ void AtomURLRequest::InformDelegateResponseCompleted() const { } void AtomURLRequest::InformDelegateRequestErrorOccured( - const std::string& error) const { + const std::string& error) const { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); if (delegate_) @@ -390,7 +390,7 @@ void AtomURLRequest::InformDelegateRequestErrorOccured( } void AtomURLRequest::InformDelegateResponseErrorOccured( - const std::string& error) const { + const std::string& error) const { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); if (delegate_) diff --git a/atom/browser/net/atom_url_request.h b/atom/browser/net/atom_url_request.h index b16258e5e81e..8d182a7da5dd 100644 --- a/atom/browser/net/atom_url_request.h +++ b/atom/browser/net/atom_url_request.h @@ -25,27 +25,26 @@ class AtomURLRequest : public base::RefCountedThreadSafe, public net::URLRequest::Delegate { public: static scoped_refptr Create( - AtomBrowserContext* browser_context, - const std::string& method, - const std::string& url, - base::WeakPtr delegate); + AtomBrowserContext* browser_context, + const std::string& method, + const std::string& url, + base::WeakPtr delegate); bool Write(scoped_refptr buffer, - bool is_last); + bool is_last); void SetChunkedUpload(bool is_chunked_upload); void Cancel() const; void SetExtraHeader(const std::string& name, const std::string& value) const; void RemoveExtraHeader(const std::string& name) const; void PassLoginInformation(const base::string16& username, - const base::string16& password) const; + const base::string16& password) const; protected: // Overrides of net::URLRequest::Delegate void OnAuthRequired(net::URLRequest* request, - net::AuthChallengeInfo* auth_info) override; + net::AuthChallengeInfo* auth_info) override; void OnResponseStarted(net::URLRequest* request) override; - void OnReadCompleted(net::URLRequest* request, - int bytes_read) override; + void OnReadCompleted(net::URLRequest* request, int bytes_read) override; private: friend class base::RefCountedThreadSafe; @@ -63,18 +62,18 @@ class AtomURLRequest : public base::RefCountedThreadSafe, const std::string& value) const; void DoRemoveExtraHeader(const std::string& name) const; void DoSetAuth(const base::string16& username, - const base::string16& password) const; + const base::string16& password) const; void DoCancelAuth() const; void ReadResponse(); bool CopyAndPostBuffer(int bytes_read); void InformDelegateAuthenticationRequired( - scoped_refptr auth_info) const; + scoped_refptr auth_info) const; void InformDelegateResponseStarted( - scoped_refptr) const; + scoped_refptr) const; void InformDelegateResponseData( - scoped_refptr data) const; + scoped_refptr data) const; void InformDelegateResponseCompleted() const; void InformDelegateRequestErrorOccured(const std::string& error) const; void InformDelegateResponseErrorOccured(const std::string& error) const; diff --git a/atom/common/native_mate_converters/net_converter.h b/atom/common/native_mate_converters/net_converter.h index 4ef9a7f33932..e3ba6b60cc94 100644 --- a/atom/common/native_mate_converters/net_converter.h +++ b/atom/common/native_mate_converters/net_converter.h @@ -36,8 +36,9 @@ struct Converter> { template<> struct Converter> { - static v8::Local ToV8(v8::Isolate* isolate, - scoped_refptr headers); + static v8::Local ToV8( + v8::Isolate* isolate, + scoped_refptr headers); }; } // namespace mate