1 // Copyright 2018 The Chromium Authors 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_SSL_SSL_KEY_LOGGER_IMPL_H_ 6 #define NET_SSL_SSL_KEY_LOGGER_IMPL_H_ 7 8 #include <memory> 9 #include <string> 10 11 #include "base/files/file.h" 12 #include "base/memory/scoped_refptr.h" 13 #include "net/base/net_export.h" 14 #include "net/ssl/ssl_key_logger.h" 15 16 namespace base { 17 class FilePath; 18 } // namespace base 19 20 namespace net { 21 22 // SSLKeyLoggerImpl is the file-based implementation of the SSLKeyLogger 23 // interface. 24 class NET_EXPORT SSLKeyLoggerImpl : public SSLKeyLogger { 25 public: 26 // Creates a new SSLKeyLoggerImpl which writes to |path|, scheduling write 27 // operations in the background. 28 explicit SSLKeyLoggerImpl(const base::FilePath& path); 29 30 // Creates a new SSLKeyLoggerImpl which writes to |file|, scheduling write 31 // operations in the background. 32 explicit SSLKeyLoggerImpl(base::File file); 33 34 SSLKeyLoggerImpl(const SSLKeyLoggerImpl&) = delete; 35 SSLKeyLoggerImpl& operator=(const SSLKeyLoggerImpl&) = delete; 36 37 ~SSLKeyLoggerImpl() override; 38 39 void WriteLine(const std::string& line) override; 40 41 private: 42 class Core; 43 scoped_refptr<Core> core_; 44 }; 45 46 } // namespace net 47 48 #endif // NET_SSL_SSL_KEY_LOGGER_IMPL_H_ 49