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 NET_LOG_NET_LOG_CAPTURE_MODE_H_ | |
6 #define NET_LOG_NET_LOG_CAPTURE_MODE_H_ | |
7 | |
8 #include <stdint.h> | |
9 #include <string> | |
mmenke
2015/04/22 20:30:12
I think there should be a blank line betwee C head
| |
10 | |
11 #include "net/base/net_export.h" | |
12 | |
13 namespace net { | |
14 | |
15 // NetLogCaptureMode specifies the granularity of events that should be emitted | |
16 // to the log. It is a simple wrapper around an integer, so it should be passed | |
17 // to functions by value rather than by reference. | |
18 class NET_EXPORT NetLogCaptureMode { | |
19 public: | |
20 // NOTE: Default assignment and copy constructor are OK. | |
21 | |
22 // The default constructor creates an empty capture mode (equivalent to | |
23 // None()). | |
24 NetLogCaptureMode(); | |
25 | |
26 // Constructs a capture mode which logs NOTHING. | |
27 // enabled() --> false | |
28 // include_cookies_and_credentials() --> false | |
29 // include_socket_bytes() --> false | |
30 static NetLogCaptureMode None(); | |
31 | |
32 // Constructs a capture mode which logs basic events and event parameters. | |
33 // enabled() --> true | |
34 // include_cookies_and_credentials() --> false | |
35 // include_socket_bytes() --> false | |
36 static NetLogCaptureMode Default(); | |
37 | |
38 // Constructs a capture mode which logs basic events, and additionally makes | |
39 // no effort to strip cookies and credentials. | |
40 // enabled() --> true | |
41 // include_cookies_and_credentials() --> true | |
42 // include_socket_bytes() --> false | |
43 static NetLogCaptureMode IncludeCookiesAndCredentials(); | |
44 | |
45 // Constructs a capture mode which logs the data sent/received from sockets. | |
46 // enabled() --> true | |
47 // include_cookies_and_credentials() --> true | |
48 // include_socket_bytes() --> true | |
49 static NetLogCaptureMode IncludeSocketBytes(); | |
50 | |
51 // Returns a capture mode that contains the maximal set of capabilities | |
52 // between |mode1| and |mode2|. | |
53 static NetLogCaptureMode Max(NetLogCaptureMode mode1, | |
54 NetLogCaptureMode mode2); | |
55 | |
56 // If |enabled()| is true, then _something_ is being captured. | |
mmenke
2015/04/22 20:13:35
nit (x3): Should ||'s go around method names? Se
eroman
2015/04/22 20:24:44
I couldn't find an explanation of "|" in any of th
mmenke
2015/04/22 20:30:12
The old style guide said they had to be used aroun
eroman
2015/04/22 20:52:05
Done.
| |
57 bool enabled() const; | |
58 | |
59 // If |include_cookies_and_credentials()| is true , then it is OK to log | |
60 // events which contain cookies, credentials or other privacy sensitive data. | |
61 bool include_cookies_and_credentials() const; | |
62 | |
63 // If |include_socket_bytes()| is true, then it is OK to output the actual | |
64 // bytes read/written from the network, even if it contains private data. | |
65 bool include_socket_bytes() const; | |
66 | |
67 bool operator==(NetLogCaptureMode mode) const; | |
68 bool operator!=(NetLogCaptureMode mode) const; | |
69 | |
70 int32_t ToInternalValueForTesting() const; | |
71 | |
72 private: | |
73 // NetLog relies on the internal value of NetLogCaptureMode being an integer, | |
74 // so it can be read/written atomically across thread. | |
75 friend class NetLog; | |
76 | |
77 explicit NetLogCaptureMode(uint32_t value); | |
78 | |
79 static NetLogCaptureMode FromInternalValue(int32_t value); | |
80 int32_t ToInternalValue() const; | |
81 | |
82 int32_t value_; | |
83 }; | |
84 | |
85 } // namespace net | |
86 | |
87 #endif // NET_LOG_NET_LOG_CAPTURE_MODE_H_ | |
OLD | NEW |