OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 NET_LOG_NET_LOG_CAPTURE_MODE_H_ | 5 #ifndef NET_LOG_NET_LOG_CAPTURE_MODE_H_ |
6 #define NET_LOG_NET_LOG_CAPTURE_MODE_H_ | 6 #define NET_LOG_NET_LOG_CAPTURE_MODE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 // include_cookies_and_credentials() --> true | 41 // include_cookies_and_credentials() --> true |
42 // include_socket_bytes() --> false | 42 // include_socket_bytes() --> false |
43 static NetLogCaptureMode IncludeCookiesAndCredentials(); | 43 static NetLogCaptureMode IncludeCookiesAndCredentials(); |
44 | 44 |
45 // Constructs a capture mode which logs the data sent/received from sockets. | 45 // Constructs a capture mode which logs the data sent/received from sockets. |
46 // enabled() --> true | 46 // enabled() --> true |
47 // include_cookies_and_credentials() --> true | 47 // include_cookies_and_credentials() --> true |
48 // include_socket_bytes() --> true | 48 // include_socket_bytes() --> true |
49 static NetLogCaptureMode IncludeSocketBytes(); | 49 static NetLogCaptureMode IncludeSocketBytes(); |
50 | 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. | 51 // If enabled() is true, then _something_ is being captured. |
57 bool enabled() const; | 52 bool enabled() const; |
58 | 53 |
59 // If include_cookies_and_credentials() is true , then it is OK to log | 54 // If include_cookies_and_credentials() is true , then it is OK to log |
60 // events which contain cookies, credentials or other privacy sensitive data. | 55 // events which contain cookies, credentials or other privacy sensitive data. |
61 bool include_cookies_and_credentials() const; | 56 bool include_cookies_and_credentials() const; |
62 | 57 |
63 // If include_socket_bytes() is true, then it is OK to output the actual | 58 // 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. | 59 // bytes read/written from the network, even if it contains private data. |
65 bool include_socket_bytes() const; | 60 bool include_socket_bytes() const; |
66 | 61 |
67 bool operator==(NetLogCaptureMode mode) const; | 62 bool operator==(NetLogCaptureMode mode) const; |
68 bool operator!=(NetLogCaptureMode mode) const; | 63 bool operator!=(NetLogCaptureMode mode) const; |
69 | 64 |
70 int32_t ToInternalValueForTesting() const; | 65 int32_t ToInternalValueForTesting() const; |
71 | 66 |
72 private: | 67 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); | 68 explicit NetLogCaptureMode(uint32_t value); |
78 | 69 |
79 static NetLogCaptureMode FromInternalValue(int32_t value); | |
80 int32_t ToInternalValue() const; | |
81 | |
82 int32_t value_; | 70 int32_t value_; |
83 }; | 71 }; |
84 | 72 |
85 } // namespace net | 73 } // namespace net |
86 | 74 |
87 #endif // NET_LOG_NET_LOG_CAPTURE_MODE_H_ | 75 #endif // NET_LOG_NET_LOG_CAPTURE_MODE_H_ |
OLD | NEW |