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_ADAPTER_H_ | 5 #ifndef COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_ADAPTER_H_ |
6 #define COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_ADAPTER_H_ | 6 #define COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_ADAPTER_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 const std::string& GetUserAgent(const GURL& url) const; | 76 const std::string& GetUserAgent(const GURL& url) const; |
77 | 77 |
78 bool load_disable_cache() const { return load_disable_cache_; } | 78 bool load_disable_cache() const { return load_disable_cache_; } |
79 | 79 |
80 // net::URLRequestContextGetter implementation: | 80 // net::URLRequestContextGetter implementation: |
81 net::URLRequestContext* GetURLRequestContext() override; | 81 net::URLRequestContext* GetURLRequestContext() override; |
82 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() | 82 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() |
83 const override; | 83 const override; |
84 | 84 |
85 void StartNetLogToFile(const std::string& file_name); | 85 void StartNetLogToFile(const std::string& file_name, bool log_all); |
86 void StopNetLog(); | 86 void StopNetLog(); |
87 | 87 |
88 // Called on main Java thread to initialize URLRequestContext. | 88 // Called on main Java thread to initialize URLRequestContext. |
89 void InitRequestContextOnMainThread(); | 89 void InitRequestContextOnMainThread(); |
90 | 90 |
91 private: | 91 private: |
92 ~URLRequestContextAdapter() override; | 92 ~URLRequestContextAdapter() override; |
93 | 93 |
94 // Initializes |context_| on the Network thread. | 94 // Initializes |context_| on the Network thread. |
95 void InitRequestContextOnNetworkThread(); | 95 void InitRequestContextOnNetworkThread(); |
96 | 96 |
97 // Helper function to start writing NetLog data to file. This should only be | 97 // Helper function to start writing NetLog data to file. This should only be |
98 // run after context is initialized. | 98 // run after context is initialized. |
99 void StartNetLogToFileHelper(const std::string& file_name); | 99 void StartNetLogToFileHelper(const std::string& file_name, bool log_all); |
100 // Helper function to stop writing NetLog data to file. This should only be | 100 // Helper function to stop writing NetLog data to file. This should only be |
101 // run after context is initialized. | 101 // run after context is initialized. |
102 void StopNetLogHelper(); | 102 void StopNetLogHelper(); |
103 | 103 |
104 scoped_refptr<URLRequestContextAdapterDelegate> delegate_; | 104 scoped_refptr<URLRequestContextAdapterDelegate> delegate_; |
105 scoped_ptr<net::URLRequestContext> context_; | 105 scoped_ptr<net::URLRequestContext> context_; |
106 std::string user_agent_; | 106 std::string user_agent_; |
107 bool load_disable_cache_; | 107 bool load_disable_cache_; |
108 base::Thread* network_thread_; | 108 base::Thread* network_thread_; |
109 scoped_ptr<NetLogObserver> net_log_observer_; | 109 scoped_ptr<NetLogObserver> net_log_observer_; |
110 scoped_ptr<net::NetLogLogger> net_log_logger_; | 110 scoped_ptr<net::NetLogLogger> net_log_logger_; |
111 scoped_ptr<net::ProxyConfigService> proxy_config_service_; | 111 scoped_ptr<net::ProxyConfigService> proxy_config_service_; |
112 scoped_ptr<URLRequestContextConfig> config_; | 112 scoped_ptr<URLRequestContextConfig> config_; |
113 | 113 |
114 // A queue of tasks that need to be run after context has been initialized. | 114 // A queue of tasks that need to be run after context has been initialized. |
115 std::queue<RunAfterContextInitTask> tasks_waiting_for_context_; | 115 std::queue<RunAfterContextInitTask> tasks_waiting_for_context_; |
116 bool is_context_initialized_; | 116 bool is_context_initialized_; |
117 | 117 |
118 DISALLOW_COPY_AND_ASSIGN(URLRequestContextAdapter); | 118 DISALLOW_COPY_AND_ASSIGN(URLRequestContextAdapter); |
119 }; | 119 }; |
120 | 120 |
121 } // namespace cronet | 121 } // namespace cronet |
122 | 122 |
123 #endif // COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_ADAPTER_H_ | 123 #endif // COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_ADAPTER_H_ |
OLD | NEW |