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

Unified Diff: remoting/base/chromium_url_request.h

Issue 1679023009: Add remoting::UrlRequest interface with 2 implementations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months 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
« no previous file with comments | « remoting/base/BUILD.gn ('k') | remoting/base/chromium_url_request.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/base/chromium_url_request.h
diff --git a/remoting/base/chromium_url_request.h b/remoting/base/chromium_url_request.h
new file mode 100644
index 0000000000000000000000000000000000000000..fe842c7d707391b67812cba60e996f91946478e4
--- /dev/null
+++ b/remoting/base/chromium_url_request.h
@@ -0,0 +1,55 @@
+// 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 REMOTING_BASE_CHROMIUM_URL_REQUEST_H_
+#define REMOTING_BASE_CHROMIUM_URL_REQUEST_H_
+
+#include <string>
+
+#include "base/callback.h"
+#include "base/memory/ref_counted.h"
+#include "net/url_request/url_fetcher_delegate.h"
+#include "remoting/base/url_request.h"
+
+namespace net {
+class URLRequestContextGetter;
+} // namespace net
+
+namespace remoting {
+
+// UrlRequest implementation based on net::URLFetcher.
+class ChromiumUrlRequest : public UrlRequest, public net::URLFetcherDelegate {
+ public:
+ ChromiumUrlRequest(scoped_refptr<net::URLRequestContextGetter> url_context,
+ const std::string& url);
+ ~ChromiumUrlRequest() override;
+
+ // UrlRequest interface.
+ void AddHeader(const std::string& value) override;
+ void Start(const OnResultCallback& on_result_callback) override;
+
+ private:
+ // net::URLFetcherDelegate interface.
+ void OnURLFetchComplete(const net::URLFetcher* url_fetcher) override;
+
+ scoped_ptr<net::URLFetcher> url_fetcher_;
+ OnResultCallback on_result_callback_;
+};
+
+class ChromiumUrlRequestFactory : public UrlRequestFactory {
+ public:
+ ChromiumUrlRequestFactory(
+ scoped_refptr<net::URLRequestContextGetter> url_context);
+ ~ChromiumUrlRequestFactory() override;
+
+ // UrlRequestFactory interface.
+ scoped_ptr<UrlRequest> CreateUrlRequest(const std::string& url) override;
+
+ private:
+ scoped_refptr<net::URLRequestContextGetter> url_context_;
+};
+
+} // namespace remoting
+
+#endif // REMOTING_BASE_CHROMIUM_URL_REQUEST_H_
« no previous file with comments | « remoting/base/BUILD.gn ('k') | remoting/base/chromium_url_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698