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