OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef NET_CRONET_ANDROID_URL_REQUEST_CONTEXT_PEER_H_ | |
6 #define NET_CRONET_ANDROID_URL_REQUEST_CONTEXT_PEER_H_ | |
7 | |
8 #include "base/threading/thread.h" | |
9 #include "net/url_request/url_request_context.h" | |
10 #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.
| |
11 | |
12 /* | |
13 * Implementation of the Chromium NetLog observer interface. | |
14 */ | |
mmenke
2014/02/27 23:06:02
C++ style comment?
mef
2014/03/03 19:15:13
Done.
| |
15 class NetLogObserver : public net::NetLog::ThreadSafeObserver { | |
16 public: | |
17 explicit NetLogObserver(int log_level) { | |
18 log_level_ = log_level; | |
19 } | |
20 | |
21 virtual ~NetLogObserver() { | |
22 } | |
23 | |
24 virtual void OnAddEntry(const net::NetLog::Entry& entry) OVERRIDE; | |
25 private: | |
mmenke
2014/02/27 23:06:02
Blank line before private.
mef
2014/03/03 19:15:13
Done.
| |
26 int log_level_; | |
27 }; | |
28 | |
29 /* | |
30 * Fully configured |URLRequestContext|. | |
31 */ | |
mmenke
2014/02/27 23:06:02
C++ style comment?
mef
2014/03/03 19:15:13
Done.
| |
32 class URLRequestContextPeer : public net::URLRequestContextGetter { | |
33 public: | |
34 class URLRequestContextPeerDelegate | |
35 : public base::RefCountedThreadSafe<URLRequestContextPeerDelegate> { | |
36 public: | |
37 virtual void OnContextInitialized(URLRequestContextPeer* context) = 0; | |
38 | |
39 protected: | |
40 friend class base::RefCountedThreadSafe<URLRequestContextPeerDelegate>; | |
41 | |
42 virtual ~URLRequestContextPeerDelegate() {} | |
43 }; | |
44 | |
45 URLRequestContextPeer(URLRequestContextPeerDelegate* delegate, | |
46 std::string user_agent, int log_level, | |
47 const char* version); | |
48 void Initialize(); | |
49 | |
50 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.
| |
51 | |
52 int logging_level() const; | |
53 | |
54 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.
| |
55 | |
56 public: | |
mmenke
2014/02/27 23:06:02
not needed.
mef
2014/03/03 19:15:13
Done.
| |
57 virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE; | |
58 virtual scoped_refptr<base::SingleThreadTaskRunner> | |
59 GetNetworkTaskRunner() const OVERRIDE; | |
mmenke
2014/02/27 23:06:02
These two are the "// net::URLRequestContextGetter
mef
2014/03/03 19:15:13
Done.
| |
60 | |
61 private: | |
62 scoped_refptr<URLRequestContextPeerDelegate> delegate_; | |
63 scoped_ptr<net::URLRequestContext> context_; | |
64 int logging_level_; | |
65 const char* version_; | |
66 std::string user_agent_; | |
67 base::Thread* network_thread_; | |
68 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; | |
69 scoped_ptr<NetLogObserver> netlog_observer_; | |
70 | |
71 virtual ~URLRequestContextPeer(); | |
72 | |
73 // Initializes |context_| on the IO thread. | |
74 void InitializeURLRequestContext(); | |
75 | |
76 DISALLOW_EVIL_CONSTRUCTORS(URLRequestContextPeer); | |
mmenke
2014/02/27 23:06:02
DISALLOW_COPY_AND_ASSIGN?
mef
2014/03/03 19:15:13
Done.
| |
77 }; | |
78 | |
79 #endif // NET_CRONET_ANDROID_URL_REQUEST_CONTEXT_PEER_H_ | |
OLD | NEW |