OLD | NEW |
| (Empty) |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
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 IOS_CRNET_CRNET_NET_LOG_H_ | |
6 #define IOS_CRNET_CRNET_NET_LOG_H_ | |
7 | |
8 #include "base/memory/scoped_ptr.h" | |
9 #include "base/threading/thread_checker.h" | |
10 #include "net/log/net_log.h" | |
11 | |
12 namespace base { | |
13 class FilePath; | |
14 class DictionaryValue; | |
15 } | |
16 | |
17 namespace net { | |
18 class WriteToFileNetLogObserver; | |
19 } | |
20 | |
21 // CrNet-specific NetLog subclass. | |
22 // This class can be used as a NetLog where needed; it logs all log entries to | |
23 // the file specified in Start(). | |
24 class CrNetNetLog : public net::NetLog { | |
25 public: | |
26 enum Mode { | |
27 LOG_ALL_BYTES, | |
28 LOG_STRIP_PRIVATE_DATA, | |
29 }; | |
30 | |
31 CrNetNetLog(); | |
32 ~CrNetNetLog() override; | |
33 | |
34 // Starts logging to the file named |log_file|. If |mode| is LOG_ALL_BYTES, | |
35 // logs all network traffic, including raw bytes. If |mode| is | |
36 // LOG_STRIP_PRIVATE_DATA, strips cookies and other private data, and does | |
37 // not log raw bytes. | |
38 bool Start(const base::FilePath& log_file, Mode mode); | |
39 | |
40 // Stops logging. | |
41 void Stop(); | |
42 | |
43 private: | |
44 // Underlying file writer. This observer observes NetLog events and writes | |
45 // them back to the file this class is logging to. | |
46 scoped_ptr<net::WriteToFileNetLogObserver> write_to_file_observer_; | |
47 | |
48 base::ThreadChecker thread_checker_; | |
49 }; | |
50 | |
51 #endif // IOS_CRNET_CRNET_NET_LOG_H | |
OLD | NEW |