OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_PEER_H_ | 5 #ifndef COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_PEER_H_ |
6 #define COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_PEER_H_ | 6 #define COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_PEER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 virtual void OnContextInitialized(URLRequestContextPeer* context) = 0; | 49 virtual void OnContextInitialized(URLRequestContextPeer* context) = 0; |
50 | 50 |
51 protected: | 51 protected: |
52 friend class base::RefCountedThreadSafe<URLRequestContextPeerDelegate>; | 52 friend class base::RefCountedThreadSafe<URLRequestContextPeerDelegate>; |
53 | 53 |
54 virtual ~URLRequestContextPeerDelegate() {} | 54 virtual ~URLRequestContextPeerDelegate() {} |
55 }; | 55 }; |
56 | 56 |
57 URLRequestContextPeer(URLRequestContextPeerDelegate* delegate, | 57 URLRequestContextPeer(URLRequestContextPeerDelegate* delegate, |
58 std::string user_agent, | 58 std::string user_agent, |
59 int log_level, | 59 int log_level); |
60 const char* version); | |
61 void Initialize(scoped_ptr<URLRequestContextConfig> config); | 60 void Initialize(scoped_ptr<URLRequestContextConfig> config); |
62 | 61 |
63 const std::string& GetUserAgent(const GURL& url) const; | 62 const std::string& GetUserAgent(const GURL& url) const; |
64 | 63 |
65 int logging_level() const { return logging_level_; } | 64 int logging_level() const { return logging_level_; } |
66 | 65 |
67 const char* version() const { return version_; } | |
68 | |
69 // net::URLRequestContextGetter implementation: | 66 // net::URLRequestContextGetter implementation: |
70 virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE; | 67 virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE; |
71 virtual scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() | 68 virtual scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() |
72 const OVERRIDE; | 69 const OVERRIDE; |
73 | 70 |
74 void StartNetLogToFile(const std::string& file_name); | 71 void StartNetLogToFile(const std::string& file_name); |
75 void StopNetLog(); | 72 void StopNetLog(); |
76 | 73 |
77 private: | 74 private: |
78 scoped_refptr<URLRequestContextPeerDelegate> delegate_; | 75 scoped_refptr<URLRequestContextPeerDelegate> delegate_; |
79 scoped_ptr<net::URLRequestContext> context_; | 76 scoped_ptr<net::URLRequestContext> context_; |
80 int logging_level_; | 77 int logging_level_; |
81 const char* version_; | |
82 std::string user_agent_; | 78 std::string user_agent_; |
83 base::Thread* network_thread_; | 79 base::Thread* network_thread_; |
84 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; | 80 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; |
85 scoped_ptr<NetLogObserver> net_log_observer_; | 81 scoped_ptr<NetLogObserver> net_log_observer_; |
86 scoped_ptr<net::NetLogLogger> net_log_logger_; | 82 scoped_ptr<net::NetLogLogger> net_log_logger_; |
87 | 83 |
88 virtual ~URLRequestContextPeer(); | 84 virtual ~URLRequestContextPeer(); |
89 | 85 |
90 // Initializes |context_| on the IO thread. | 86 // Initializes |context_| on the IO thread. |
91 void InitializeURLRequestContext(scoped_ptr<URLRequestContextConfig> config); | 87 void InitializeURLRequestContext(scoped_ptr<URLRequestContextConfig> config); |
92 | 88 |
93 DISALLOW_COPY_AND_ASSIGN(URLRequestContextPeer); | 89 DISALLOW_COPY_AND_ASSIGN(URLRequestContextPeer); |
94 }; | 90 }; |
95 | 91 |
96 } // namespace cronet | 92 } // namespace cronet |
97 | 93 |
98 #endif // COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_PEER_H_ | 94 #endif // COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_PEER_H_ |
OLD | NEW |