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

Unified Diff: net/cronet/android/url_request_context_peer.h

Issue 145213003: Initial upload of cronet for Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: NET_EXPORT RequestPriorityToString to avoid buildbot errors. Created 6 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
Index: net/cronet/android/url_request_context_peer.h
diff --git a/net/cronet/android/url_request_context_peer.h b/net/cronet/android/url_request_context_peer.h
new file mode 100644
index 0000000000000000000000000000000000000000..2e3c8e5d30ef8fca9b4526989f487e463d16de48
--- /dev/null
+++ b/net/cronet/android/url_request_context_peer.h
@@ -0,0 +1,79 @@
+// Copyright 2014 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 NET_CRONET_ANDROID_URL_REQUEST_CONTEXT_PEER_H_
+#define NET_CRONET_ANDROID_URL_REQUEST_CONTEXT_PEER_H_
+
+#include "base/threading/thread.h"
+#include "net/url_request/url_request_context.h"
+#include "net/url_request/url_request_context_getter.h"
mmenke 2014/02/27 23:06:02 base/compiler_specific.h and base/macros.h for DIS
mmenke 2014/02/27 23:06:02 Add scoped_ptr, ref_counted, NetLog, NetworkChange
mef 2014/03/03 19:15:13 Done.
mef 2014/03/03 19:15:13 Done.
+
+/*
+ * Implementation of the Chromium NetLog observer interface.
+ */
mmenke 2014/02/27 23:06:02 C++ style comment?
mef 2014/03/03 19:15:13 Done.
+class NetLogObserver : public net::NetLog::ThreadSafeObserver {
+ public:
+ explicit NetLogObserver(int log_level) {
+ log_level_ = log_level;
+ }
+
+ virtual ~NetLogObserver() {
+ }
+
+ virtual void OnAddEntry(const net::NetLog::Entry& entry) OVERRIDE;
+ private:
mmenke 2014/02/27 23:06:02 Blank line before private.
mef 2014/03/03 19:15:13 Done.
+ int log_level_;
+};
+
+/*
+ * Fully configured |URLRequestContext|.
+ */
mmenke 2014/02/27 23:06:02 C++ style comment?
mef 2014/03/03 19:15:13 Done.
+class URLRequestContextPeer : public net::URLRequestContextGetter {
+ public:
+ class URLRequestContextPeerDelegate
+ : public base::RefCountedThreadSafe<URLRequestContextPeerDelegate> {
+ public:
+ virtual void OnContextInitialized(URLRequestContextPeer* context) = 0;
+
+ protected:
+ friend class base::RefCountedThreadSafe<URLRequestContextPeerDelegate>;
+
+ virtual ~URLRequestContextPeerDelegate() {}
+ };
+
+ URLRequestContextPeer(URLRequestContextPeerDelegate* delegate,
+ std::string user_agent, int log_level,
+ const char* version);
+ void Initialize();
+
+ const std::string &GetUserAgent(const GURL &url) const;
mmenke 2014/02/27 23:06:02 std::string& ...
mef 2014/03/03 19:15:13 Done.
+
+ int logging_level() const;
+
+ const char* version() const;
mmenke 2014/02/27 23:06:02 When using this naming style, functions must be in
mef 2014/03/03 19:15:13 Done.
+
+ public:
mmenke 2014/02/27 23:06:02 not needed.
mef 2014/03/03 19:15:13 Done.
+ virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE;
+ virtual scoped_refptr<base::SingleThreadTaskRunner>
+ GetNetworkTaskRunner() const OVERRIDE;
mmenke 2014/02/27 23:06:02 These two are the "// net::URLRequestContextGetter
mef 2014/03/03 19:15:13 Done.
+
+ private:
+ scoped_refptr<URLRequestContextPeerDelegate> delegate_;
+ scoped_ptr<net::URLRequestContext> context_;
+ int logging_level_;
+ const char* version_;
+ std::string user_agent_;
+ base::Thread* network_thread_;
+ scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_;
+ scoped_ptr<NetLogObserver> netlog_observer_;
+
+ virtual ~URLRequestContextPeer();
+
+ // Initializes |context_| on the IO thread.
+ void InitializeURLRequestContext();
+
+ DISALLOW_EVIL_CONSTRUCTORS(URLRequestContextPeer);
mmenke 2014/02/27 23:06:02 DISALLOW_COPY_AND_ASSIGN?
mef 2014/03/03 19:15:13 Done.
+};
+
+#endif // NET_CRONET_ANDROID_URL_REQUEST_CONTEXT_PEER_H_

Powered by Google App Engine
This is Rietveld 408576698