Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(531)

Side by Side Diff: net/log/net_log_capture_mode.h

Issue 1122483004: Remove NetLog::GetCaptureMode() and NetLogCaptureMode::None() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mmenke_refactor
Patch Set: second attempt at fixing int --> bool warning on windows Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/log/net_log.cc ('k') | net/log/net_log_capture_mode.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "net/base/net_export.h" 11 #include "net/base/net_export.h"
12 12
13 namespace net { 13 namespace net {
14 14
15 // NetLogCaptureMode specifies the granularity of events that should be emitted 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 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. 17 // to functions by value rather than by reference.
18 class NET_EXPORT NetLogCaptureMode { 18 class NET_EXPORT NetLogCaptureMode {
19 public: 19 public:
20 // NOTE: Default assignment and copy constructor are OK. 20 // NOTE: Default assignment and copy constructor are OK.
21 21
22 // The default constructor creates an empty capture mode (equivalent to 22 // The default constructor creates a capture mode equivalent to
23 // None()). 23 // Default().
24 NetLogCaptureMode(); 24 NetLogCaptureMode();
25 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. 26 // Constructs a capture mode which logs basic events and event parameters.
33 // enabled() --> true
34 // include_cookies_and_credentials() --> false 27 // include_cookies_and_credentials() --> false
35 // include_socket_bytes() --> false 28 // include_socket_bytes() --> false
36 static NetLogCaptureMode Default(); 29 static NetLogCaptureMode Default();
37 30
38 // Constructs a capture mode which logs basic events, and additionally makes 31 // Constructs a capture mode which logs basic events, and additionally makes
39 // no effort to strip cookies and credentials. 32 // no effort to strip cookies and credentials.
40 // enabled() --> true
41 // include_cookies_and_credentials() --> true 33 // include_cookies_and_credentials() --> true
42 // include_socket_bytes() --> false 34 // include_socket_bytes() --> false
43 static NetLogCaptureMode IncludeCookiesAndCredentials(); 35 static NetLogCaptureMode IncludeCookiesAndCredentials();
44 36
45 // Constructs a capture mode which logs the data sent/received from sockets. 37 // Constructs a capture mode which logs the data sent/received from sockets.
46 // enabled() --> true
47 // include_cookies_and_credentials() --> true 38 // include_cookies_and_credentials() --> true
48 // include_socket_bytes() --> true 39 // include_socket_bytes() --> true
49 static NetLogCaptureMode IncludeSocketBytes(); 40 static NetLogCaptureMode IncludeSocketBytes();
50 41
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.
57 bool enabled() const;
58
59 // If include_cookies_and_credentials() is true , then it is OK to log 42 // If include_cookies_and_credentials() is true , then it is OK to log
60 // events which contain cookies, credentials or other privacy sensitive data. 43 // events which contain cookies, credentials or other privacy sensitive data.
61 bool include_cookies_and_credentials() const; 44 bool include_cookies_and_credentials() const;
62 45
63 // If include_socket_bytes() is true, then it is OK to output the actual 46 // 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. 47 // bytes read/written from the network, even if it contains private data.
65 bool include_socket_bytes() const; 48 bool include_socket_bytes() const;
66 49
67 bool operator==(NetLogCaptureMode mode) const; 50 bool operator==(NetLogCaptureMode mode) const;
68 bool operator!=(NetLogCaptureMode mode) const; 51 bool operator!=(NetLogCaptureMode mode) const;
69 52
70 int32_t ToInternalValueForTesting() const; 53 int32_t ToInternalValueForTesting() const;
71 54
72 private: 55 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); 56 explicit NetLogCaptureMode(uint32_t value);
78 57
79 static NetLogCaptureMode FromInternalValue(int32_t value);
80 int32_t ToInternalValue() const;
81
82 int32_t value_; 58 int32_t value_;
83 }; 59 };
84 60
85 } // namespace net 61 } // namespace net
86 62
87 #endif // NET_LOG_NET_LOG_CAPTURE_MODE_H_ 63 #endif // NET_LOG_NET_LOG_CAPTURE_MODE_H_
OLDNEW
« no previous file with comments | « net/log/net_log.cc ('k') | net/log/net_log_capture_mode.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698