Chromium Code Reviews| Index: net/log/net_log_capture_mode.h |
| diff --git a/net/log/net_log_capture_mode.h b/net/log/net_log_capture_mode.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..029a1aef8f71118b87b338c365a31779bec06624 |
| --- /dev/null |
| +++ b/net/log/net_log_capture_mode.h |
| @@ -0,0 +1,87 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef NET_LOG_NET_LOG_CAPTURE_MODE_H_ |
| +#define NET_LOG_NET_LOG_CAPTURE_MODE_H_ |
| + |
| +#include <stdint.h> |
| +#include <string> |
|
mmenke
2015/04/22 20:30:12
I think there should be a blank line betwee C head
|
| + |
| +#include "net/base/net_export.h" |
| + |
| +namespace net { |
| + |
| +// NetLogCaptureMode specifies the granularity of events that should be emitted |
| +// to the log. It is a simple wrapper around an integer, so it should be passed |
| +// to functions by value rather than by reference. |
| +class NET_EXPORT NetLogCaptureMode { |
| + public: |
| + // NOTE: Default assignment and copy constructor are OK. |
| + |
| + // The default constructor creates an empty capture mode (equivalent to |
| + // None()). |
| + NetLogCaptureMode(); |
| + |
| + // Constructs a capture mode which logs NOTHING. |
| + // enabled() --> false |
| + // include_cookies_and_credentials() --> false |
| + // include_socket_bytes() --> false |
| + static NetLogCaptureMode None(); |
| + |
| + // Constructs a capture mode which logs basic events and event parameters. |
| + // enabled() --> true |
| + // include_cookies_and_credentials() --> false |
| + // include_socket_bytes() --> false |
| + static NetLogCaptureMode Default(); |
| + |
| + // Constructs a capture mode which logs basic events, and additionally makes |
| + // no effort to strip cookies and credentials. |
| + // enabled() --> true |
| + // include_cookies_and_credentials() --> true |
| + // include_socket_bytes() --> false |
| + static NetLogCaptureMode IncludeCookiesAndCredentials(); |
| + |
| + // Constructs a capture mode which logs the data sent/received from sockets. |
| + // enabled() --> true |
| + // include_cookies_and_credentials() --> true |
| + // include_socket_bytes() --> true |
| + static NetLogCaptureMode IncludeSocketBytes(); |
| + |
| + // Returns a capture mode that contains the maximal set of capabilities |
| + // between |mode1| and |mode2|. |
| + static NetLogCaptureMode Max(NetLogCaptureMode mode1, |
| + NetLogCaptureMode mode2); |
| + |
| + // 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.
|
| + bool enabled() const; |
| + |
| + // If |include_cookies_and_credentials()| is true , then it is OK to log |
| + // events which contain cookies, credentials or other privacy sensitive data. |
| + bool include_cookies_and_credentials() const; |
| + |
| + // If |include_socket_bytes()| is true, then it is OK to output the actual |
| + // bytes read/written from the network, even if it contains private data. |
| + bool include_socket_bytes() const; |
| + |
| + bool operator==(NetLogCaptureMode mode) const; |
| + bool operator!=(NetLogCaptureMode mode) const; |
| + |
| + int32_t ToInternalValueForTesting() const; |
| + |
| + private: |
| + // NetLog relies on the internal value of NetLogCaptureMode being an integer, |
| + // so it can be read/written atomically across thread. |
| + friend class NetLog; |
| + |
| + explicit NetLogCaptureMode(uint32_t value); |
| + |
| + static NetLogCaptureMode FromInternalValue(int32_t value); |
| + int32_t ToInternalValue() const; |
| + |
| + int32_t value_; |
| +}; |
| + |
| +} // namespace net |
| + |
| +#endif // NET_LOG_NET_LOG_CAPTURE_MODE_H_ |