Polling for remote device state.
[chromium-blink-merge.git] / ios / crnet / crnet_net_log.h
blob6bdc0766334c1db12bc7c28ed8263d32091955ac
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.
5 #ifndef IOS_CRNET_CRNET_NET_LOG_H_
6 #define IOS_CRNET_CRNET_NET_LOG_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/threading/thread_checker.h"
10 #include "net/log/net_log.h"
12 namespace base {
13 class FilePath;
14 class DictionaryValue;
17 namespace net {
18 class WriteToFileNetLogObserver;
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,
31 CrNetNetLog();
32 ~CrNetNetLog() override;
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);
40 // Stops logging.
41 void Stop();
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_;
48 base::ThreadChecker thread_checker_;
51 #endif // IOS_CRNET_CRNET_NET_LOG_H