diff --git a/filenames.gni b/filenames.gni index 9b99a4e1f0c..e298a275018 100644 --- a/filenames.gni +++ b/filenames.gni @@ -79,8 +79,8 @@ filenames = { "shell/browser/api/atom_api_power_monitor.h", "shell/browser/api/atom_api_power_save_blocker.cc", "shell/browser/api/atom_api_power_save_blocker.h", - "shell/browser/api/atom_api_protocol_ns.cc", - "shell/browser/api/atom_api_protocol_ns.h", + "shell/browser/api/atom_api_protocol.cc", + "shell/browser/api/atom_api_protocol.h", "shell/browser/api/atom_api_screen.cc", "shell/browser/api/atom_api_screen.h", "shell/browser/api/atom_api_session.cc", @@ -93,8 +93,8 @@ filenames = { "shell/browser/api/atom_api_top_level_window.h", "shell/browser/api/atom_api_tray.cc", "shell/browser/api/atom_api_tray.h", - "shell/browser/api/atom_api_url_request_ns.cc", - "shell/browser/api/atom_api_url_request_ns.h", + "shell/browser/api/atom_api_url_request.cc", + "shell/browser/api/atom_api_url_request.h", "shell/browser/api/atom_api_view.cc", "shell/browser/api/atom_api_view.h", "shell/browser/api/atom_api_web_contents.cc", @@ -103,8 +103,8 @@ filenames = { "shell/browser/api/atom_api_web_contents_mac.mm", "shell/browser/api/atom_api_web_contents_view.cc", "shell/browser/api/atom_api_web_contents_view.h", - "shell/browser/api/atom_api_web_request_ns.cc", - "shell/browser/api/atom_api_web_request_ns.h", + "shell/browser/api/atom_api_web_request.cc", + "shell/browser/api/atom_api_web_request.h", "shell/browser/api/atom_api_web_view_manager.cc", "shell/browser/api/atom_api_browser_window.cc", "shell/browser/api/atom_api_browser_window.h", diff --git a/shell/browser/api/atom_api_net.cc b/shell/browser/api/atom_api_net.cc index fbaebc9a641..c0a946884a4 100644 --- a/shell/browser/api/atom_api_net.cc +++ b/shell/browser/api/atom_api_net.cc @@ -7,7 +7,7 @@ #include "native_mate/dictionary.h" #include "native_mate/handle.h" #include "services/network/public/cpp/features.h" -#include "shell/browser/api/atom_api_url_request_ns.h" +#include "shell/browser/api/atom_api_url_request.h" #include "shell/common/node_includes.h" @@ -36,7 +36,7 @@ void Net::BuildPrototype(v8::Isolate* isolate, v8::Local Net::URLRequest(v8::Isolate* isolate) { v8::Local constructor; - constructor = URLRequestNS::GetConstructor(isolate); + constructor = URLRequest::GetConstructor(isolate); return constructor->GetFunction(isolate->GetCurrentContext()) .ToLocalChecked(); } @@ -48,7 +48,7 @@ v8::Local Net::URLRequest(v8::Isolate* isolate) { namespace { using electron::api::Net; -using electron::api::URLRequestNS; +using electron::api::URLRequest; void Initialize(v8::Local exports, v8::Local unused, @@ -56,7 +56,7 @@ void Initialize(v8::Local exports, void* priv) { v8::Isolate* isolate = context->GetIsolate(); - URLRequestNS::SetConstructor(isolate, base::BindRepeating(URLRequestNS::New)); + URLRequest::SetConstructor(isolate, base::BindRepeating(URLRequest::New)); mate::Dictionary dict(isolate, exports); dict.Set("net", Net::Create(isolate)); diff --git a/shell/browser/api/atom_api_protocol_ns.cc b/shell/browser/api/atom_api_protocol.cc similarity index 77% rename from shell/browser/api/atom_api_protocol_ns.cc rename to shell/browser/api/atom_api_protocol.cc index 83963c24d87..27d391bc02a 100644 --- a/shell/browser/api/atom_api_protocol_ns.cc +++ b/shell/browser/api/atom_api_protocol.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. -#include "shell/browser/api/atom_api_protocol_ns.h" +#include "shell/browser/api/atom_api_protocol.h" #include #include @@ -159,15 +159,14 @@ std::string ErrorCodeToString(ProtocolError error) { } // namespace -ProtocolNS::ProtocolNS(v8::Isolate* isolate, - AtomBrowserContext* browser_context) { +Protocol::Protocol(v8::Isolate* isolate, AtomBrowserContext* browser_context) { Init(isolate); AttachAsUserData(browser_context); } -ProtocolNS::~ProtocolNS() = default; +Protocol::~Protocol() = default; -void ProtocolNS::RegisterURLLoaderFactories( +void Protocol::RegisterURLLoaderFactories( content::ContentBrowserClient::NonNetworkURLLoaderFactoryMap* factories) { for (const auto& it : handlers_) { factories->emplace(it.first, std::make_unique( @@ -175,47 +174,47 @@ void ProtocolNS::RegisterURLLoaderFactories( } } -ProtocolError ProtocolNS::RegisterProtocol(ProtocolType type, - const std::string& scheme, - const ProtocolHandler& handler) { +ProtocolError Protocol::RegisterProtocol(ProtocolType type, + const std::string& scheme, + const ProtocolHandler& handler) { const bool added = base::TryEmplace(handlers_, scheme, type, handler).second; return added ? ProtocolError::OK : ProtocolError::REGISTERED; } -void ProtocolNS::UnregisterProtocol(const std::string& scheme, - gin::Arguments* args) { +void Protocol::UnregisterProtocol(const std::string& scheme, + gin::Arguments* args) { const bool removed = handlers_.erase(scheme) != 0; const auto error = removed ? ProtocolError::OK : ProtocolError::NOT_REGISTERED; HandleOptionalCallback(args, error); } -bool ProtocolNS::IsProtocolRegistered(const std::string& scheme) { +bool Protocol::IsProtocolRegistered(const std::string& scheme) { return base::Contains(handlers_, scheme); } -ProtocolError ProtocolNS::InterceptProtocol(ProtocolType type, - const std::string& scheme, - const ProtocolHandler& handler) { +ProtocolError Protocol::InterceptProtocol(ProtocolType type, + const std::string& scheme, + const ProtocolHandler& handler) { const bool added = base::TryEmplace(intercept_handlers_, scheme, type, handler).second; return added ? ProtocolError::OK : ProtocolError::INTERCEPTED; } -void ProtocolNS::UninterceptProtocol(const std::string& scheme, - gin::Arguments* args) { +void Protocol::UninterceptProtocol(const std::string& scheme, + gin::Arguments* args) { const bool removed = intercept_handlers_.erase(scheme) != 0; const auto error = removed ? ProtocolError::OK : ProtocolError::NOT_INTERCEPTED; HandleOptionalCallback(args, error); } -bool ProtocolNS::IsProtocolIntercepted(const std::string& scheme) { +bool Protocol::IsProtocolIntercepted(const std::string& scheme) { return base::Contains(intercept_handlers_, scheme); } -v8::Local ProtocolNS::IsProtocolHandled(const std::string& scheme, - gin::Arguments* args) { +v8::Local Protocol::IsProtocolHandled(const std::string& scheme, + gin::Arguments* args) { node::Environment* env = node::Environment::GetCurrent(args->isolate()); EmitDeprecationWarning( env, @@ -236,8 +235,8 @@ v8::Local ProtocolNS::IsProtocolHandled(const std::string& scheme, base::Contains(kBuiltinSchemes, scheme)); } -void ProtocolNS::HandleOptionalCallback(gin::Arguments* args, - ProtocolError error) { +void Protocol::HandleOptionalCallback(gin::Arguments* args, + ProtocolError error) { CompletionCallback callback; if (args->GetNext(&callback)) { node::Environment* env = node::Environment::GetCurrent(args->isolate()); @@ -254,46 +253,45 @@ void ProtocolNS::HandleOptionalCallback(gin::Arguments* args, } // static -gin::Handle ProtocolNS::Create( - v8::Isolate* isolate, - AtomBrowserContext* browser_context) { - return gin::CreateHandle(isolate, new ProtocolNS(isolate, browser_context)); +gin::Handle Protocol::Create(v8::Isolate* isolate, + AtomBrowserContext* browser_context) { + return gin::CreateHandle(isolate, new Protocol(isolate, browser_context)); } // static -void ProtocolNS::BuildPrototype(v8::Isolate* isolate, - v8::Local prototype) { +void Protocol::BuildPrototype(v8::Isolate* isolate, + v8::Local prototype) { prototype->SetClassName(gin::StringToV8(isolate, "Protocol")); gin_helper::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate()) .SetMethod("registerStringProtocol", - &ProtocolNS::RegisterProtocolFor) + &Protocol::RegisterProtocolFor) .SetMethod("registerBufferProtocol", - &ProtocolNS::RegisterProtocolFor) + &Protocol::RegisterProtocolFor) .SetMethod("registerFileProtocol", - &ProtocolNS::RegisterProtocolFor) + &Protocol::RegisterProtocolFor) .SetMethod("registerHttpProtocol", - &ProtocolNS::RegisterProtocolFor) + &Protocol::RegisterProtocolFor) .SetMethod("registerStreamProtocol", - &ProtocolNS::RegisterProtocolFor) + &Protocol::RegisterProtocolFor) .SetMethod("registerProtocol", - &ProtocolNS::RegisterProtocolFor) - .SetMethod("unregisterProtocol", &ProtocolNS::UnregisterProtocol) - .SetMethod("isProtocolRegistered", &ProtocolNS::IsProtocolRegistered) - .SetMethod("isProtocolHandled", &ProtocolNS::IsProtocolHandled) + &Protocol::RegisterProtocolFor) + .SetMethod("unregisterProtocol", &Protocol::UnregisterProtocol) + .SetMethod("isProtocolRegistered", &Protocol::IsProtocolRegistered) + .SetMethod("isProtocolHandled", &Protocol::IsProtocolHandled) .SetMethod("interceptStringProtocol", - &ProtocolNS::InterceptProtocolFor) + &Protocol::InterceptProtocolFor) .SetMethod("interceptBufferProtocol", - &ProtocolNS::InterceptProtocolFor) + &Protocol::InterceptProtocolFor) .SetMethod("interceptFileProtocol", - &ProtocolNS::InterceptProtocolFor) + &Protocol::InterceptProtocolFor) .SetMethod("interceptHttpProtocol", - &ProtocolNS::InterceptProtocolFor) + &Protocol::InterceptProtocolFor) .SetMethod("interceptStreamProtocol", - &ProtocolNS::InterceptProtocolFor) + &Protocol::InterceptProtocolFor) .SetMethod("interceptProtocol", - &ProtocolNS::InterceptProtocolFor) - .SetMethod("uninterceptProtocol", &ProtocolNS::UninterceptProtocol) - .SetMethod("isProtocolIntercepted", &ProtocolNS::IsProtocolIntercepted); + &Protocol::InterceptProtocolFor) + .SetMethod("uninterceptProtocol", &Protocol::UninterceptProtocol) + .SetMethod("isProtocolIntercepted", &Protocol::IsProtocolIntercepted); } } // namespace api diff --git a/shell/browser/api/atom_api_protocol_ns.h b/shell/browser/api/atom_api_protocol.h similarity index 87% rename from shell/browser/api/atom_api_protocol_ns.h rename to shell/browser/api/atom_api_protocol.h index b8cd623c573..20d6c09b469 100644 --- a/shell/browser/api/atom_api_protocol_ns.h +++ b/shell/browser/api/atom_api_protocol.h @@ -2,8 +2,8 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. -#ifndef SHELL_BROWSER_API_ATOM_API_PROTOCOL_NS_H_ -#define SHELL_BROWSER_API_ATOM_API_PROTOCOL_NS_H_ +#ifndef SHELL_BROWSER_API_ATOM_API_PROTOCOL_H_ +#define SHELL_BROWSER_API_ATOM_API_PROTOCOL_H_ #include #include @@ -35,10 +35,10 @@ enum class ProtocolError { }; // Protocol implementation based on network services. -class ProtocolNS : public mate::TrackableObject { +class Protocol : public mate::TrackableObject { public: - static gin::Handle Create(v8::Isolate* isolate, - AtomBrowserContext* browser_context); + static gin::Handle Create(v8::Isolate* isolate, + AtomBrowserContext* browser_context); static void BuildPrototype(v8::Isolate* isolate, v8::Local prototype); @@ -50,8 +50,8 @@ class ProtocolNS : public mate::TrackableObject { const HandlersMap& intercept_handlers() const { return intercept_handlers_; } private: - ProtocolNS(v8::Isolate* isolate, AtomBrowserContext* browser_context); - ~ProtocolNS() override; + Protocol(v8::Isolate* isolate, AtomBrowserContext* browser_context); + ~Protocol() override; // Callback types. using CompletionCallback = @@ -99,4 +99,4 @@ class ProtocolNS : public mate::TrackableObject { } // namespace electron -#endif // SHELL_BROWSER_API_ATOM_API_PROTOCOL_NS_H_ +#endif // SHELL_BROWSER_API_ATOM_API_PROTOCOL_H_ diff --git a/shell/browser/api/atom_api_session.cc b/shell/browser/api/atom_api_session.cc index b471121c236..d05239e2cae 100644 --- a/shell/browser/api/atom_api_session.cc +++ b/shell/browser/api/atom_api_session.cc @@ -45,8 +45,8 @@ #include "shell/browser/api/atom_api_data_pipe_holder.h" #include "shell/browser/api/atom_api_download_item.h" #include "shell/browser/api/atom_api_net_log.h" -#include "shell/browser/api/atom_api_protocol_ns.h" -#include "shell/browser/api/atom_api_web_request_ns.h" +#include "shell/browser/api/atom_api_protocol.h" +#include "shell/browser/api/atom_api_web_request.h" #include "shell/browser/atom_browser_context.h" #include "shell/browser/atom_browser_main_parts.h" #include "shell/browser/atom_permission_manager.h" @@ -588,7 +588,7 @@ v8::Local Session::Cookies(v8::Isolate* isolate) { v8::Local Session::Protocol(v8::Isolate* isolate) { if (protocol_.IsEmpty()) { v8::Local handle; - handle = ProtocolNS::Create(isolate, browser_context()).ToV8(); + handle = Protocol::Create(isolate, browser_context()).ToV8(); protocol_.Reset(isolate, handle); } return v8::Local::New(isolate, protocol_); @@ -596,7 +596,7 @@ v8::Local Session::Protocol(v8::Isolate* isolate) { v8::Local Session::WebRequest(v8::Isolate* isolate) { if (web_request_.IsEmpty()) { - auto handle = WebRequestNS::Create(isolate, browser_context()); + auto handle = WebRequest::Create(isolate, browser_context()); web_request_.Reset(isolate, handle.ToV8()); } return v8::Local::New(isolate, web_request_); @@ -732,7 +732,7 @@ namespace { using electron::api::Cookies; using electron::api::NetLog; -using electron::api::ProtocolNS; +using electron::api::Protocol; using electron::api::Session; v8::Local FromPartition(const std::string& partition, @@ -761,9 +761,9 @@ void Initialize(v8::Local exports, dict.Set( "NetLog", NetLog::GetConstructor(isolate)->GetFunction(context).ToLocalChecked()); - dict.Set("Protocol", ProtocolNS::GetConstructor(isolate) - ->GetFunction(context) - .ToLocalChecked()); + dict.Set( + "Protocol", + Protocol::GetConstructor(isolate)->GetFunction(context).ToLocalChecked()); dict.SetMethod("fromPartition", &FromPartition); } diff --git a/shell/browser/api/atom_api_url_request_ns.cc b/shell/browser/api/atom_api_url_request.cc similarity index 80% rename from shell/browser/api/atom_api_url_request_ns.cc rename to shell/browser/api/atom_api_url_request.cc index 664a39dc8fe..45289eb9e5c 100644 --- a/shell/browser/api/atom_api_url_request_ns.cc +++ b/shell/browser/api/atom_api_url_request.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. -#include "shell/browser/api/atom_api_url_request_ns.h" +#include "shell/browser/api/atom_api_url_request.h" #include @@ -84,7 +84,7 @@ const net::NetworkTrafficAnnotationTag kTrafficAnnotation = // Common class for streaming data. class UploadDataPipeGetter { public: - explicit UploadDataPipeGetter(URLRequestNS* request) : request_(request) {} + explicit UploadDataPipeGetter(URLRequest* request) : request_(request) {} virtual ~UploadDataPipeGetter() = default; virtual void AttachToRequestBody(network::ResourceRequestBody* body) = 0; @@ -101,7 +101,7 @@ class UploadDataPipeGetter { } private: - URLRequestNS* request_; + URLRequest* request_; DISALLOW_COPY_AND_ASSIGN(UploadDataPipeGetter); }; @@ -110,7 +110,7 @@ class UploadDataPipeGetter { class MultipartDataPipeGetter : public UploadDataPipeGetter, public network::mojom::DataPipeGetter { public: - explicit MultipartDataPipeGetter(URLRequestNS* request) + explicit MultipartDataPipeGetter(URLRequest* request) : UploadDataPipeGetter(request) {} ~MultipartDataPipeGetter() override = default; @@ -141,7 +141,7 @@ class MultipartDataPipeGetter : public UploadDataPipeGetter, class ChunkedDataPipeGetter : public UploadDataPipeGetter, public network::mojom::ChunkedDataPipeGetter { public: - explicit ChunkedDataPipeGetter(URLRequestNS* request) + explicit ChunkedDataPipeGetter(URLRequest* request) : UploadDataPipeGetter(request) {} ~ChunkedDataPipeGetter() override = default; @@ -166,7 +166,7 @@ class ChunkedDataPipeGetter : public UploadDataPipeGetter, mojo::ReceiverSet receiver_set_; }; -URLRequestNS::URLRequestNS(gin::Arguments* args) : weak_factory_(this) { +URLRequest::URLRequest(gin::Arguments* args) : weak_factory_(this) { request_ = std::make_unique(); gin_helper::Dictionary dict; if (args->GetNext(&dict)) { @@ -190,17 +190,17 @@ URLRequestNS::URLRequestNS(gin::Arguments* args) : weak_factory_(this) { InitWithArgs(args); } -URLRequestNS::~URLRequestNS() = default; +URLRequest::~URLRequest() = default; -bool URLRequestNS::NotStarted() const { +bool URLRequest::NotStarted() const { return request_state_ == 0; } -bool URLRequestNS::Finished() const { +bool URLRequest::Finished() const { return request_state_ & STATE_FINISHED; } -void URLRequestNS::Cancel() { +void URLRequest::Cancel() { // Cancel only once. if (request_state_ & (STATE_CANCELED | STATE_CLOSED)) return; @@ -215,7 +215,7 @@ void URLRequestNS::Cancel() { Close(); } -void URLRequestNS::Close() { +void URLRequest::Close() { if (!(request_state_ & STATE_CLOSED)) { request_state_ |= STATE_CLOSED; if (response_state_ & STATE_STARTED) { @@ -228,7 +228,7 @@ void URLRequestNS::Close() { loader_.reset(); } -bool URLRequestNS::Write(v8::Local data, bool is_last) { +bool URLRequest::Write(v8::Local data, bool is_last) { if (request_state_ & (STATE_FINISHED | STATE_ERROR)) return false; @@ -243,12 +243,12 @@ bool URLRequestNS::Write(v8::Local data, bool is_last) { network::ResourceRequest* request_ref = request_.get(); loader_ = network::SimpleURLLoader::Create(std::move(request_), kTrafficAnnotation); - loader_->SetOnResponseStartedCallback(base::Bind( - &URLRequestNS::OnResponseStarted, weak_factory_.GetWeakPtr())); + loader_->SetOnResponseStartedCallback( + base::Bind(&URLRequest::OnResponseStarted, weak_factory_.GetWeakPtr())); loader_->SetOnRedirectCallback( - base::Bind(&URLRequestNS::OnRedirect, weak_factory_.GetWeakPtr())); - loader_->SetOnUploadProgressCallback(base::Bind( - &URLRequestNS::OnUploadProgress, weak_factory_.GetWeakPtr())); + base::Bind(&URLRequest::OnRedirect, weak_factory_.GetWeakPtr())); + loader_->SetOnUploadProgressCallback( + base::Bind(&URLRequest::OnUploadProgress, weak_factory_.GetWeakPtr())); // Create upload data pipe if we have data to write. if (length > 0) { @@ -286,14 +286,14 @@ bool URLRequestNS::Write(v8::Local data, bool is_last) { return true; } -void URLRequestNS::FollowRedirect() { +void URLRequest::FollowRedirect() { if (request_state_ & (STATE_CANCELED | STATE_CLOSED)) return; follow_redirect_ = true; } -bool URLRequestNS::SetExtraHeader(const std::string& name, - const std::string& value) { +bool URLRequest::SetExtraHeader(const std::string& name, + const std::string& value) { if (!request_) return false; if (!net::HttpUtil::IsValidHeaderName(name)) @@ -304,17 +304,17 @@ bool URLRequestNS::SetExtraHeader(const std::string& name, return true; } -void URLRequestNS::RemoveExtraHeader(const std::string& name) { +void URLRequest::RemoveExtraHeader(const std::string& name) { if (request_) request_->headers.RemoveHeader(name); } -void URLRequestNS::SetChunkedUpload(bool is_chunked_upload) { +void URLRequest::SetChunkedUpload(bool is_chunked_upload) { if (request_) is_chunked_upload_ = is_chunked_upload; } -gin::Dictionary URLRequestNS::GetUploadProgress() { +gin::Dictionary URLRequest::GetUploadProgress() { gin::Dictionary progress = gin::Dictionary::CreateEmpty(isolate()); if (loader_) { if (request_) @@ -330,36 +330,36 @@ gin::Dictionary URLRequestNS::GetUploadProgress() { return progress; } -int URLRequestNS::StatusCode() const { +int URLRequest::StatusCode() const { if (response_headers_) return response_headers_->response_code(); return -1; } -std::string URLRequestNS::StatusMessage() const { +std::string URLRequest::StatusMessage() const { if (response_headers_) return response_headers_->GetStatusText(); return ""; } -net::HttpResponseHeaders* URLRequestNS::RawResponseHeaders() const { +net::HttpResponseHeaders* URLRequest::RawResponseHeaders() const { return response_headers_.get(); } -uint32_t URLRequestNS::ResponseHttpVersionMajor() const { +uint32_t URLRequest::ResponseHttpVersionMajor() const { if (response_headers_) return response_headers_->GetHttpVersion().major_value(); return 0; } -uint32_t URLRequestNS::ResponseHttpVersionMinor() const { +uint32_t URLRequest::ResponseHttpVersionMinor() const { if (response_headers_) return response_headers_->GetHttpVersion().minor_value(); return 0; } -void URLRequestNS::OnDataReceived(base::StringPiece data, - base::OnceClosure resume) { +void URLRequest::OnDataReceived(base::StringPiece data, + base::OnceClosure resume) { // In case we received an unexpected event from Chromium net, don't emit any // data event after request cancel/error/close. if (!(request_state_ & STATE_ERROR) && !(response_state_ & STATE_ERROR)) { @@ -372,9 +372,9 @@ void URLRequestNS::OnDataReceived(base::StringPiece data, std::move(resume).Run(); } -void URLRequestNS::OnRetry(base::OnceClosure start_retry) {} +void URLRequest::OnRetry(base::OnceClosure start_retry) {} -void URLRequestNS::OnComplete(bool success) { +void URLRequest::OnComplete(bool success) { if (success) { // In case we received an unexpected event from Chromium net, don't emit any // data event after request cancel/error/close. @@ -400,7 +400,7 @@ void URLRequestNS::OnComplete(bool success) { Close(); } -void URLRequestNS::OnResponseStarted( +void URLRequest::OnResponseStarted( const GURL& final_url, const network::mojom::URLResponseHead& response_head) { // Don't emit any event after request cancel. @@ -412,7 +412,7 @@ void URLRequestNS::OnResponseStarted( Emit("response"); } -void URLRequestNS::OnRedirect( +void URLRequest::OnRedirect( const net::RedirectInfo& redirect_info, const network::mojom::URLResponseHead& response_head, std::vector* to_be_removed_headers) { @@ -455,12 +455,12 @@ void URLRequestNS::OnRedirect( } } -void URLRequestNS::OnUploadProgress(uint64_t position, uint64_t total) { +void URLRequest::OnUploadProgress(uint64_t position, uint64_t total) { upload_position_ = position; upload_total_ = total; } -void URLRequestNS::OnWrite(MojoResult result) { +void URLRequest::OnWrite(MojoResult result) { if (result != MOJO_RESULT_OK) return; @@ -470,17 +470,17 @@ void URLRequestNS::OnWrite(MojoResult result) { DoWrite(); } -void URLRequestNS::DoWrite() { +void URLRequest::DoWrite() { DCHECK(producer_); DCHECK(!pending_writes_.empty()); producer_->Write( std::make_unique( pending_writes_.front(), mojo::StringDataSource::AsyncWritingMode:: STRING_STAYS_VALID_UNTIL_COMPLETION), - base::BindOnce(&URLRequestNS::OnWrite, weak_factory_.GetWeakPtr())); + base::BindOnce(&URLRequest::OnWrite, weak_factory_.GetWeakPtr())); } -void URLRequestNS::StartWriting() { +void URLRequest::StartWriting() { if (!last_chunk_written_ || size_callback_.is_null()) return; @@ -491,17 +491,17 @@ void URLRequestNS::StartWriting() { DoWrite(); } -void URLRequestNS::Pin() { +void URLRequest::Pin() { if (wrapper_.IsEmpty()) { wrapper_.Reset(isolate(), GetWrapper()); } } -void URLRequestNS::Unpin() { +void URLRequest::Unpin() { wrapper_.Reset(); } -void URLRequestNS::EmitError(EventType type, base::StringPiece message) { +void URLRequest::EmitError(EventType type, base::StringPiece message) { if (type == EventType::kRequest) request_state_ |= STATE_FAILED; else @@ -512,7 +512,7 @@ void URLRequestNS::EmitError(EventType type, base::StringPiece message) { } template -void URLRequestNS::EmitEvent(EventType type, Args... args) { +void URLRequest::EmitEvent(EventType type, Args... args) { const char* method = type == EventType::kRequest ? "_emitRequestEvent" : "_emitResponseEvent"; v8::HandleScope handle_scope(isolate()); @@ -520,30 +520,30 @@ void URLRequestNS::EmitEvent(EventType type, Args... args) { } // static -mate::WrappableBase* URLRequestNS::New(gin::Arguments* args) { - return new URLRequestNS(args); +mate::WrappableBase* URLRequest::New(gin::Arguments* args) { + return new URLRequest(args); } // static -void URLRequestNS::BuildPrototype(v8::Isolate* isolate, - v8::Local prototype) { +void URLRequest::BuildPrototype(v8::Isolate* isolate, + v8::Local prototype) { prototype->SetClassName(gin::StringToV8(isolate, "URLRequest")); gin_helper::Destroyable::MakeDestroyable(isolate, prototype); gin_helper::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate()) - .SetMethod("write", &URLRequestNS::Write) - .SetMethod("cancel", &URLRequestNS::Cancel) - .SetMethod("setExtraHeader", &URLRequestNS::SetExtraHeader) - .SetMethod("removeExtraHeader", &URLRequestNS::RemoveExtraHeader) - .SetMethod("setChunkedUpload", &URLRequestNS::SetChunkedUpload) - .SetMethod("followRedirect", &URLRequestNS::FollowRedirect) - .SetMethod("getUploadProgress", &URLRequestNS::GetUploadProgress) - .SetProperty("notStarted", &URLRequestNS::NotStarted) - .SetProperty("finished", &URLRequestNS::Finished) - .SetProperty("statusCode", &URLRequestNS::StatusCode) - .SetProperty("statusMessage", &URLRequestNS::StatusMessage) - .SetProperty("rawResponseHeaders", &URLRequestNS::RawResponseHeaders) - .SetProperty("httpVersionMajor", &URLRequestNS::ResponseHttpVersionMajor) - .SetProperty("httpVersionMinor", &URLRequestNS::ResponseHttpVersionMinor); + .SetMethod("write", &URLRequest::Write) + .SetMethod("cancel", &URLRequest::Cancel) + .SetMethod("setExtraHeader", &URLRequest::SetExtraHeader) + .SetMethod("removeExtraHeader", &URLRequest::RemoveExtraHeader) + .SetMethod("setChunkedUpload", &URLRequest::SetChunkedUpload) + .SetMethod("followRedirect", &URLRequest::FollowRedirect) + .SetMethod("getUploadProgress", &URLRequest::GetUploadProgress) + .SetProperty("notStarted", &URLRequest::NotStarted) + .SetProperty("finished", &URLRequest::Finished) + .SetProperty("statusCode", &URLRequest::StatusCode) + .SetProperty("statusMessage", &URLRequest::StatusMessage) + .SetProperty("rawResponseHeaders", &URLRequest::RawResponseHeaders) + .SetProperty("httpVersionMajor", &URLRequest::ResponseHttpVersionMajor) + .SetProperty("httpVersionMinor", &URLRequest::ResponseHttpVersionMinor); } } // namespace api diff --git a/shell/browser/api/atom_api_url_request_ns.h b/shell/browser/api/atom_api_url_request.h similarity index 89% rename from shell/browser/api/atom_api_url_request_ns.h rename to shell/browser/api/atom_api_url_request.h index 433f97f27e3..7c380e7c09e 100644 --- a/shell/browser/api/atom_api_url_request_ns.h +++ b/shell/browser/api/atom_api_url_request.h @@ -2,8 +2,8 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. -#ifndef SHELL_BROWSER_API_ATOM_API_URL_REQUEST_NS_H_ -#define SHELL_BROWSER_API_ATOM_API_URL_REQUEST_NS_H_ +#ifndef SHELL_BROWSER_API_ATOM_API_URL_REQUEST_H_ +#define SHELL_BROWSER_API_ATOM_API_URL_REQUEST_H_ #include #include @@ -25,8 +25,8 @@ namespace api { class UploadDataPipeGetter; -class URLRequestNS : public mate::EventEmitter, - public network::SimpleURLLoaderStreamConsumer { +class URLRequest : public mate::EventEmitter, + public network::SimpleURLLoaderStreamConsumer { public: static mate::WrappableBase* New(gin::Arguments* args); @@ -34,8 +34,8 @@ class URLRequestNS : public mate::EventEmitter, v8::Local prototype); protected: - explicit URLRequestNS(gin::Arguments* args); - ~URLRequestNS() override; + explicit URLRequest(gin::Arguments* args); + ~URLRequest() override; bool NotStarted() const; bool Finished() const; @@ -132,13 +132,13 @@ class URLRequestNS : public mate::EventEmitter, // Used by pin/unpin to manage lifetime. v8::Global wrapper_; - base::WeakPtrFactory weak_factory_; + base::WeakPtrFactory weak_factory_; - DISALLOW_COPY_AND_ASSIGN(URLRequestNS); + DISALLOW_COPY_AND_ASSIGN(URLRequest); }; } // namespace api } // namespace electron -#endif // SHELL_BROWSER_API_ATOM_API_URL_REQUEST_NS_H_ +#endif // SHELL_BROWSER_API_ATOM_API_URL_REQUEST_H_ diff --git a/shell/browser/api/atom_api_web_request_ns.cc b/shell/browser/api/atom_api_web_request.cc similarity index 75% rename from shell/browser/api/atom_api_web_request_ns.cc rename to shell/browser/api/atom_api_web_request.cc index a2a06aa557b..d35dce38940 100644 --- a/shell/browser/api/atom_api_web_request_ns.cc +++ b/shell/browser/api/atom_api_web_request.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. -#include "shell/browser/api/atom_api_web_request_ns.h" +#include "shell/browser/api/atom_api_web_request.h" #include #include @@ -79,12 +79,12 @@ namespace api { namespace { -const char* kUserDataKey = "WebRequestNS"; +const char* kUserDataKey = "WebRequest"; -// BrowserContext <=> WebRequestNS relationship. +// BrowserContext <=> WebRequest relationship. struct UserData : public base::SupportsUserData::Data { - explicit UserData(WebRequestNS* data) : data(data) {} - WebRequestNS* data; + explicit UserData(WebRequest* data) : data(data) {} + WebRequest* data; }; // Test whether the URL of |request| matches |patterns|. @@ -212,72 +212,72 @@ void ReadFromResponse(v8::Isolate* isolate, } // namespace -gin::WrapperInfo WebRequestNS::kWrapperInfo = {gin::kEmbedderNativeGin}; +gin::WrapperInfo WebRequest::kWrapperInfo = {gin::kEmbedderNativeGin}; -WebRequestNS::SimpleListenerInfo::SimpleListenerInfo( +WebRequest::SimpleListenerInfo::SimpleListenerInfo( std::set patterns_, SimpleListener listener_) : url_patterns(std::move(patterns_)), listener(listener_) {} -WebRequestNS::SimpleListenerInfo::SimpleListenerInfo() = default; -WebRequestNS::SimpleListenerInfo::~SimpleListenerInfo() = default; +WebRequest::SimpleListenerInfo::SimpleListenerInfo() = default; +WebRequest::SimpleListenerInfo::~SimpleListenerInfo() = default; -WebRequestNS::ResponseListenerInfo::ResponseListenerInfo( +WebRequest::ResponseListenerInfo::ResponseListenerInfo( std::set patterns_, ResponseListener listener_) : url_patterns(std::move(patterns_)), listener(listener_) {} -WebRequestNS::ResponseListenerInfo::ResponseListenerInfo() = default; -WebRequestNS::ResponseListenerInfo::~ResponseListenerInfo() = default; +WebRequest::ResponseListenerInfo::ResponseListenerInfo() = default; +WebRequest::ResponseListenerInfo::~ResponseListenerInfo() = default; -WebRequestNS::WebRequestNS(v8::Isolate* isolate, - content::BrowserContext* browser_context) +WebRequest::WebRequest(v8::Isolate* isolate, + content::BrowserContext* browser_context) : browser_context_(browser_context) { browser_context_->SetUserData(kUserDataKey, std::make_unique(this)); } -WebRequestNS::~WebRequestNS() { +WebRequest::~WebRequest() { browser_context_->RemoveUserData(kUserDataKey); } -gin::ObjectTemplateBuilder WebRequestNS::GetObjectTemplateBuilder( +gin::ObjectTemplateBuilder WebRequest::GetObjectTemplateBuilder( v8::Isolate* isolate) { - return gin::Wrappable::GetObjectTemplateBuilder(isolate) + return gin::Wrappable::GetObjectTemplateBuilder(isolate) .SetMethod("onBeforeRequest", - &WebRequestNS::SetResponseListener) + &WebRequest::SetResponseListener) .SetMethod("onBeforeSendHeaders", - &WebRequestNS::SetResponseListener) + &WebRequest::SetResponseListener) .SetMethod("onHeadersReceived", - &WebRequestNS::SetResponseListener) + &WebRequest::SetResponseListener) .SetMethod("onSendHeaders", - &WebRequestNS::SetSimpleListener) + &WebRequest::SetSimpleListener) .SetMethod("onBeforeRedirect", - &WebRequestNS::SetSimpleListener) + &WebRequest::SetSimpleListener) .SetMethod("onResponseStarted", - &WebRequestNS::SetSimpleListener) + &WebRequest::SetSimpleListener) .SetMethod("onErrorOccurred", - &WebRequestNS::SetSimpleListener) - .SetMethod("onCompleted", &WebRequestNS::SetSimpleListener); + &WebRequest::SetSimpleListener) + .SetMethod("onCompleted", &WebRequest::SetSimpleListener); } -const char* WebRequestNS::GetTypeName() { +const char* WebRequest::GetTypeName() { return "WebRequest"; } -bool WebRequestNS::HasListener() const { +bool WebRequest::HasListener() const { return !(simple_listeners_.empty() && response_listeners_.empty()); } -int WebRequestNS::OnBeforeRequest(extensions::WebRequestInfo* info, - const network::ResourceRequest& request, - net::CompletionOnceCallback callback, - GURL* new_url) { +int WebRequest::OnBeforeRequest(extensions::WebRequestInfo* info, + const network::ResourceRequest& request, + net::CompletionOnceCallback callback, + GURL* new_url) { return HandleResponseEvent(kOnBeforeRequest, info, std::move(callback), new_url, request); } -int WebRequestNS::OnBeforeSendHeaders(extensions::WebRequestInfo* info, - const network::ResourceRequest& request, - BeforeSendHeadersCallback callback, - net::HttpRequestHeaders* headers) { +int WebRequest::OnBeforeSendHeaders(extensions::WebRequestInfo* info, + const network::ResourceRequest& request, + BeforeSendHeadersCallback callback, + net::HttpRequestHeaders* headers) { return HandleResponseEvent( kOnBeforeSendHeaders, info, base::BindOnce(std::move(callback), std::set(), @@ -285,7 +285,7 @@ int WebRequestNS::OnBeforeSendHeaders(extensions::WebRequestInfo* info, headers, request, *headers); } -int WebRequestNS::OnHeadersReceived( +int WebRequest::OnHeadersReceived( extensions::WebRequestInfo* info, const network::ResourceRequest& request, net::CompletionOnceCallback callback, @@ -299,53 +299,53 @@ int WebRequestNS::OnHeadersReceived( request); } -void WebRequestNS::OnSendHeaders(extensions::WebRequestInfo* info, - const network::ResourceRequest& request, - const net::HttpRequestHeaders& headers) { +void WebRequest::OnSendHeaders(extensions::WebRequestInfo* info, + const network::ResourceRequest& request, + const net::HttpRequestHeaders& headers) { HandleSimpleEvent(kOnSendHeaders, info, request, headers); } -void WebRequestNS::OnBeforeRedirect(extensions::WebRequestInfo* info, - const network::ResourceRequest& request, - const GURL& new_location) { +void WebRequest::OnBeforeRedirect(extensions::WebRequestInfo* info, + const network::ResourceRequest& request, + const GURL& new_location) { HandleSimpleEvent(kOnBeforeRedirect, info, request, new_location); } -void WebRequestNS::OnResponseStarted(extensions::WebRequestInfo* info, - const network::ResourceRequest& request) { +void WebRequest::OnResponseStarted(extensions::WebRequestInfo* info, + const network::ResourceRequest& request) { HandleSimpleEvent(kOnResponseStarted, info, request); } -void WebRequestNS::OnErrorOccurred(extensions::WebRequestInfo* info, - const network::ResourceRequest& request, - int net_error) { +void WebRequest::OnErrorOccurred(extensions::WebRequestInfo* info, + const network::ResourceRequest& request, + int net_error) { callbacks_.erase(info->id); HandleSimpleEvent(kOnErrorOccurred, info, request, net_error); } -void WebRequestNS::OnCompleted(extensions::WebRequestInfo* info, - const network::ResourceRequest& request, - int net_error) { +void WebRequest::OnCompleted(extensions::WebRequestInfo* info, + const network::ResourceRequest& request, + int net_error) { callbacks_.erase(info->id); HandleSimpleEvent(kOnCompleted, info, request, net_error); } -template -void WebRequestNS::SetSimpleListener(gin::Arguments* args) { +template +void WebRequest::SetSimpleListener(gin::Arguments* args) { SetListener(event, &simple_listeners_, args); } -template -void WebRequestNS::SetResponseListener(gin::Arguments* args) { +template +void WebRequest::SetResponseListener(gin::Arguments* args) { SetListener(event, &response_listeners_, args); } template -void WebRequestNS::SetListener(Event event, - Listeners* listeners, - gin::Arguments* args) { +void WebRequest::SetListener(Event event, + Listeners* listeners, + gin::Arguments* args) { v8::Local arg; // { urls }. @@ -393,9 +393,9 @@ void WebRequestNS::SetListener(Event event, } template -void WebRequestNS::HandleSimpleEvent(SimpleEvent event, - extensions::WebRequestInfo* request_info, - Args... args) { +void WebRequest::HandleSimpleEvent(SimpleEvent event, + extensions::WebRequestInfo* request_info, + Args... args) { const auto iter = simple_listeners_.find(event); if (iter == std::end(simple_listeners_)) return; @@ -412,11 +412,11 @@ void WebRequestNS::HandleSimpleEvent(SimpleEvent event, } template -int WebRequestNS::HandleResponseEvent(ResponseEvent event, - extensions::WebRequestInfo* request_info, - net::CompletionOnceCallback callback, - Out out, - Args... args) { +int WebRequest::HandleResponseEvent(ResponseEvent event, + extensions::WebRequestInfo* request_info, + net::CompletionOnceCallback callback, + Out out, + Args... args) { const auto iter = response_listeners_.find(event); if (iter == std::end(response_listeners_)) return net::OK; @@ -433,16 +433,16 @@ int WebRequestNS::HandleResponseEvent(ResponseEvent event, FillDetails(&details, request_info, args...); ResponseCallback response = - base::BindOnce(&WebRequestNS::OnListenerResult, - base::Unretained(this), request_info->id, out); + base::BindOnce(&WebRequest::OnListenerResult, base::Unretained(this), + request_info->id, out); info.listener.Run(gin::ConvertToV8(isolate, details), std::move(response)); return net::ERR_IO_PENDING; } template -void WebRequestNS::OnListenerResult(uint64_t id, - T out, - v8::Local response) { +void WebRequest::OnListenerResult(uint64_t id, + T out, + v8::Local response) { const auto iter = callbacks_.find(id); if (iter == std::end(callbacks_)) return; @@ -468,10 +468,10 @@ void WebRequestNS::OnListenerResult(uint64_t id, } // static -gin::Handle WebRequestNS::FromOrCreate( +gin::Handle WebRequest::FromOrCreate( v8::Isolate* isolate, content::BrowserContext* browser_context) { - gin::Handle handle = From(isolate, browser_context); + gin::Handle handle = From(isolate, browser_context); if (handle.IsEmpty()) { // Make sure the |Session| object has the |webRequest| property created. v8::Local web_request = @@ -485,24 +485,24 @@ gin::Handle WebRequestNS::FromOrCreate( } // static -gin::Handle WebRequestNS::Create( +gin::Handle WebRequest::Create( v8::Isolate* isolate, content::BrowserContext* browser_context) { DCHECK(From(isolate, browser_context).IsEmpty()) - << "WebRequestNS already created"; - return gin::CreateHandle(isolate, new WebRequestNS(isolate, browser_context)); + << "WebRequest already created"; + return gin::CreateHandle(isolate, new WebRequest(isolate, browser_context)); } // static -gin::Handle WebRequestNS::From( +gin::Handle WebRequest::From( v8::Isolate* isolate, content::BrowserContext* browser_context) { if (!browser_context) - return gin::Handle(); + return gin::Handle(); auto* user_data = static_cast(browser_context->GetUserData(kUserDataKey)); if (!user_data) - return gin::Handle(); + return gin::Handle(); return gin::CreateHandle(isolate, user_data->data); } diff --git a/shell/browser/api/atom_api_web_request_ns.h b/shell/browser/api/atom_api_web_request.h similarity index 89% rename from shell/browser/api/atom_api_web_request_ns.h rename to shell/browser/api/atom_api_web_request.h index d4d3be8a3af..bd7bbf62429 100644 --- a/shell/browser/api/atom_api_web_request_ns.h +++ b/shell/browser/api/atom_api_web_request.h @@ -2,8 +2,8 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. -#ifndef SHELL_BROWSER_API_ATOM_API_WEB_REQUEST_NS_H_ -#define SHELL_BROWSER_API_ATOM_API_WEB_REQUEST_NS_H_ +#ifndef SHELL_BROWSER_API_ATOM_API_WEB_REQUEST_H_ +#define SHELL_BROWSER_API_ATOM_API_WEB_REQUEST_H_ #include #include @@ -23,7 +23,7 @@ namespace electron { namespace api { -class WebRequestNS : public gin::Wrappable, public WebRequestAPI { +class WebRequest : public gin::Wrappable, public WebRequestAPI { public: static gin::WrapperInfo kWrapperInfo; @@ -31,19 +31,18 @@ class WebRequestNS : public gin::Wrappable, public WebRequestAPI { // is no one. // Note that the lifetime of WebRequest object is managed by Session, instead // of the caller. - static gin::Handle FromOrCreate( + static gin::Handle FromOrCreate( v8::Isolate* isolate, content::BrowserContext* browser_context); // Return a new WebRequest object, this should only be called by Session. - static gin::Handle Create( + static gin::Handle Create( v8::Isolate* isolate, content::BrowserContext* browser_context); // Find the WebRequest object attached to |browser_context|. - static gin::Handle From( - v8::Isolate* isolate, - content::BrowserContext* browser_context); + static gin::Handle From(v8::Isolate* isolate, + content::BrowserContext* browser_context); // gin::Wrappable: gin::ObjectTemplateBuilder GetObjectTemplateBuilder( @@ -51,8 +50,8 @@ class WebRequestNS : public gin::Wrappable, public WebRequestAPI { const char* GetTypeName() override; private: - WebRequestNS(v8::Isolate* isolate, content::BrowserContext* browser_context); - ~WebRequestNS() override; + WebRequest(v8::Isolate* isolate, content::BrowserContext* browser_context); + ~WebRequest() override; // WebRequestAPI: bool HasListener() const override; @@ -155,4 +154,4 @@ class WebRequestNS : public gin::Wrappable, public WebRequestAPI { } // namespace electron -#endif // SHELL_BROWSER_API_ATOM_API_WEB_REQUEST_NS_H_ +#endif // SHELL_BROWSER_API_ATOM_API_WEB_REQUEST_H_ diff --git a/shell/browser/atom_browser_client.cc b/shell/browser/atom_browser_client.cc index af7f0adaf28..cdf6bc522d9 100644 --- a/shell/browser/atom_browser_client.cc +++ b/shell/browser/atom_browser_client.cc @@ -50,10 +50,10 @@ #include "services/network/public/cpp/resource_request_body.h" #include "shell/app/manifests.h" #include "shell/browser/api/atom_api_app.h" -#include "shell/browser/api/atom_api_protocol_ns.h" +#include "shell/browser/api/atom_api_protocol.h" #include "shell/browser/api/atom_api_session.h" #include "shell/browser/api/atom_api_web_contents.h" -#include "shell/browser/api/atom_api_web_request_ns.h" +#include "shell/browser/api/atom_api_web_request.h" #include "shell/browser/atom_autofill_driver_factory.h" #include "shell/browser/atom_browser_context.h" #include "shell/browser/atom_browser_main_parts.h" @@ -956,7 +956,7 @@ void AtomBrowserClient::RegisterNonNetworkNavigationURLLoaderFactories( NonNetworkURLLoaderFactoryMap* factories) { content::WebContents* web_contents = content::WebContents::FromFrameTreeNodeId(frame_tree_node_id); - api::ProtocolNS* protocol = api::ProtocolNS::FromWrappedClass( + api::Protocol* protocol = api::Protocol::FromWrappedClass( v8::Isolate::GetCurrent(), web_contents->GetBrowserContext()); if (protocol) protocol->RegisterURLLoaderFactories(factories); @@ -972,7 +972,7 @@ void AtomBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactories( content::WebContents* web_contents = content::WebContents::FromRenderFrameHost(frame_host); if (web_contents) { - api::ProtocolNS* protocol = api::ProtocolNS::FromWrappedClass( + api::Protocol* protocol = api::Protocol::FromWrappedClass( v8::Isolate::GetCurrent(), web_contents->GetBrowserContext()); if (protocol) protocol->RegisterURLLoaderFactories(factories); @@ -990,10 +990,10 @@ bool AtomBrowserClient::WillCreateURLLoaderFactory( header_client, bool* bypass_redirect_checks) { v8::Isolate* isolate = v8::Isolate::GetCurrent(); - api::ProtocolNS* protocol = - api::ProtocolNS::FromWrappedClass(isolate, browser_context); + api::Protocol* protocol = + api::Protocol::FromWrappedClass(isolate, browser_context); DCHECK(protocol); - auto web_request = api::WebRequestNS::FromOrCreate(isolate, browser_context); + auto web_request = api::WebRequest::FromOrCreate(isolate, browser_context); DCHECK(web_request.get()); auto proxied_receiver = std::move(*factory_receiver); diff --git a/shell/browser/net/proxying_url_loader_factory.h b/shell/browser/net/proxying_url_loader_factory.h index d3e62c88ffc..ec7d0c6a9d1 100644 --- a/shell/browser/net/proxying_url_loader_factory.h +++ b/shell/browser/net/proxying_url_loader_factory.h @@ -23,7 +23,7 @@ namespace electron { -// Defines the interface for WebRequest API, implemented by api::WebRequestNS. +// Defines the interface for WebRequest API, implemented by api::WebRequest. class WebRequestAPI { public: virtual ~WebRequestAPI() {} @@ -236,12 +236,12 @@ class ProxyingURLLoaderFactory void RemoveRequest(int32_t network_service_request_id, uint64_t request_id); void MaybeDeleteThis(); - // Passed from api::WebRequestNS. + // Passed from api::WebRequest. WebRequestAPI* web_request_api_; - // This is passed from api::ProtocolNS. + // This is passed from api::Protocol. // - // The ProtocolNS instance lives through the lifetime of BrowserContenxt, + // The Protocol instance lives through the lifetime of BrowserContenxt, // which is guarenteed to cover the lifetime of URLLoaderFactory, so the // reference is guarenteed to be valid. //