Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Unified Diff: content/child/url_loader_client_impl.h

Issue 2597873002: Move URLLoaderClientImpl to a separate file (Closed)
Patch Set: fix Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/child/url_loader_client_impl.h
diff --git a/content/child/url_loader_client_impl.h b/content/child/url_loader_client_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..3710c074c367cd8791ced8cf9d742834afc6a4c8
--- /dev/null
+++ b/content/child/url_loader_client_impl.h
@@ -0,0 +1,70 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_CHILD_URL_LOADER_CLIENT_IMPL_H_
+#define CONTENT_CHILD_URL_LOADER_CLIENT_IMPL_H_
+
+#include <stdint.h>
+#include "base/callback_forward.h"
+#include "base/memory/ref_counted.h"
+#include "content/common/content_export.h"
+#include "content/common/url_loader.mojom.h"
+#include "ipc/ipc_message.h"
+#include "mojo/public/cpp/bindings/associated_binding.h"
+#include "mojo/public/cpp/system/data_pipe.h"
+
+namespace base {
+class SingleThreadTaskRunner;
+} // namespace base
+
+namespace mojo {
+class AssociatedGroup;
+} // namespace mojo
+
+namespace net {
+struct RedirectInfo;
+} // namespace net
+
+namespace content {
+class ResourceDispatcher;
+class URLResponseBodyConsumer;
+struct ResourceRequestCompletionStatus;
+struct ResourceResponseHead;
+
+class CONTENT_EXPORT URLLoaderClientImpl final : public mojom::URLLoaderClient {
+ public:
+ URLLoaderClientImpl(int request_id,
+ ResourceDispatcher* resource_dispatcher,
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner);
+ ~URLLoaderClientImpl() override;
+
+ void Bind(mojom::URLLoaderClientAssociatedPtrInfo* client_ptr_info,
+ mojo::AssociatedGroup* associated_group);
+
+ // mojom::URLLoaderClient implementation
+ void OnReceiveResponse(const ResourceResponseHead& response_head,
+ mojom::DownloadedTempFilePtr downloaded_file) override;
+ void OnReceiveRedirect(const net::RedirectInfo& redirect_info,
+ const ResourceResponseHead& response_head) override;
+ void OnDataDownloaded(int64_t data_len, int64_t encoded_data_len) override;
+ void OnTransferSizeUpdated(int32_t transfer_size_diff) override;
+ void OnStartLoadingResponseBody(
+ mojo::ScopedDataPipeConsumerHandle body) override;
+ void OnComplete(const ResourceRequestCompletionStatus& status) override;
+
+private:
+ void Dispatch(const IPC::Message& message);
+
+ mojo::AssociatedBinding<mojom::URLLoaderClient> binding_;
+ scoped_refptr<URLResponseBodyConsumer> body_consumer_;
+ mojom::DownloadedTempFilePtr downloaded_file_;
+ const int request_id_;
+ bool has_received_response_ = false;
+ ResourceDispatcher* const resource_dispatcher_;
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
+};
+
+} // namespace content
+
+#endif // CONTENT_CHILD_URL_LOADER_CLIENT_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698