| 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 IOS_CRNET_CRNET_ENVIRONMENT_H_ | 5 #ifndef IOS_CRNET_CRNET_ENVIRONMENT_H_ |
| 6 #define IOS_CRNET_CRNET_ENVIRONMENT_H_ | 6 #define IOS_CRNET_CRNET_ENVIRONMENT_H_ |
| 7 | 7 |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 class CrNetHttpProtocolHandlerDelegate; | 29 class CrNetHttpProtocolHandlerDelegate; |
| 30 | 30 |
| 31 // CrNetEnvironment contains all the network stack configuration | 31 // CrNetEnvironment contains all the network stack configuration |
| 32 // and initialization. | 32 // and initialization. |
| 33 class CrNetEnvironment { | 33 class CrNetEnvironment { |
| 34 public: | 34 public: |
| 35 // Must be called on the main thread. | 35 // Must be called on the main thread. |
| 36 static void Initialize(); | 36 static void Initialize(); |
| 37 | 37 |
| 38 // |user_agent_product_name| will be used to generate the user-agent. | 38 // |user_agent_product_name| will be used to generate the user-agent. |
| 39 CrNetEnvironment(std::string user_agent_product_name); | 39 CrNetEnvironment(const std::string& user_agent_product_name); |
| 40 ~CrNetEnvironment(); | 40 ~CrNetEnvironment(); |
| 41 | 41 |
| 42 // Installs this CrNet environment so requests are intercepted. | 42 // Installs this CrNet environment so requests are intercepted. |
| 43 // Can only be called once; to enable/disable CrNet at runtime, use | 43 // Can only be called once; to enable/disable CrNet at runtime, use |
| 44 // SetHTTPProtocolHandlerRegistered. | 44 // SetHTTPProtocolHandlerRegistered. |
| 45 void Install(); | 45 void Install(); |
| 46 | 46 |
| 47 // Installs this CrNet environment into the supplied | 47 // Installs this CrNet environment into the supplied |
| 48 // NSURLSessionConfiguration. Settings are inherited from the shared | 48 // NSURLSessionConfiguration. Settings are inherited from the shared |
| 49 // NSURLSessionConfiguration, which Install() affects. | 49 // NSURLSessionConfiguration, which Install() affects. |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 scoped_ptr<net::URLRequestContext> main_context_; | 161 scoped_ptr<net::URLRequestContext> main_context_; |
| 162 scoped_ptr<CrNetHttpProtocolHandlerDelegate> http_protocol_handler_delegate_; | 162 scoped_ptr<CrNetHttpProtocolHandlerDelegate> http_protocol_handler_delegate_; |
| 163 std::string user_agent_product_name_; | 163 std::string user_agent_product_name_; |
| 164 scoped_ptr<net::NetLog> net_log_; | 164 scoped_ptr<net::NetLog> net_log_; |
| 165 scoped_ptr<net::WriteToFileNetLogObserver> net_log_observer_; | 165 scoped_ptr<net::WriteToFileNetLogObserver> net_log_observer_; |
| 166 | 166 |
| 167 DISALLOW_COPY_AND_ASSIGN(CrNetEnvironment); | 167 DISALLOW_COPY_AND_ASSIGN(CrNetEnvironment); |
| 168 }; | 168 }; |
| 169 | 169 |
| 170 #endif // IOS_CRNET_CRNET_ENVIRONMENT_H_ | 170 #endif // IOS_CRNET_CRNET_ENVIRONMENT_H_ |
| OLD | NEW |