Index: net/log/net_log_capture_mode.cc |
diff --git a/net/log/net_log_capture_mode.cc b/net/log/net_log_capture_mode.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d97b8f327ef649f488159539c90e3682a0d707ed |
--- /dev/null |
+++ b/net/log/net_log_capture_mode.cc |
@@ -0,0 +1,79 @@ |
+// 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. |
+ |
+#include "net/log/net_log_capture_mode.h" |
+ |
+#include <algorithm> |
+ |
+namespace net { |
+ |
+namespace { |
+ |
+// Integer representation for the capture mode. The numeric value is depended on |
+// for method of NetLogCaptureMode, which expect that higher values imply more |
+// capabilities. |
+enum InternalValue { |
+ // Don't log any events. |
+ NONE, |
+ |
+ // Log all events, but do not include the actual transferred bytes and |
+ // remove cookies and HTTP credentials. |
+ DEFAULT, |
+ |
+ // Log all events, but do not include the actual transferred bytes as |
+ // parameters for bytes sent/received events. |
+ INCLUDE_COOKIES_AND_CREDENTIALS, |
+ |
+ // Log everything possible, even if it is slow and memory expensive. |
+ // Includes logging of transferred bytes. |
+ ALL, |
+}; |
+ |
+} // namespace |
+ |
+// Default constructor creates an empty capture mode. |
+NetLogCaptureMode::NetLogCaptureMode() : NetLogCaptureMode(NONE) { |
+} |
+ |
+bool NetLogCaptureMode::enabled() const { |
mmenke
2015/04/20 15:54:38
Hrm...Under the old style guide, this naming was o
eroman
2015/04/20 21:07:19
Acknowledged. I have not made any changes.
|
+ return value_ != NONE; |
+} |
+ |
+bool NetLogCaptureMode::include_private_data() const { |
+ return value_ > DEFAULT; |
mmenke
2015/04/20 15:54:38
Seems more intuitive to use >= INCLUDE_COOKIES_AND
eroman
2015/04/20 21:07:19
Done.
|
+} |
+ |
+bool NetLogCaptureMode::include_socket_bytes() const { |
+ return value_ == ALL; |
mmenke
2015/04/20 15:54:38
Hrm... >=?
Don't expect us to include anything m
eroman
2015/04/20 21:07:19
Done. I also renamed ALL --> INCLUDE_SOCKET_BYTES,
|
+} |
+ |
+NetLogCaptureMode NetLogCaptureMode::Max(NetLogCaptureMode mode1, |
mmenke
2015/04/20 15:54:38
All static methods should be prefixed by "// stati
eroman
2015/04/20 21:07:19
I couldn't find any description of this in the sty
mmenke
2015/04/22 18:52:17
*Sigh*...Another thing that must have been removed
|
+ NetLogCaptureMode mode2) { |
+ return NetLogCaptureMode(std::max(mode1.value_, mode2.value_)); |
+} |
+ |
+NetLogCaptureMode NetLogCaptureMode::None() { |
+ return NetLogCaptureMode(NONE); |
+} |
+ |
+NetLogCaptureMode NetLogCaptureMode::Default() { |
+ return NetLogCaptureMode(DEFAULT); |
+} |
+ |
+NetLogCaptureMode NetLogCaptureMode::IncludeCookiesAndCredentials() { |
+ return NetLogCaptureMode(INCLUDE_COOKIES_AND_CREDENTIALS); |
+} |
+ |
+NetLogCaptureMode NetLogCaptureMode::All() { |
+ return NetLogCaptureMode(ALL); |
+} |
+ |
+bool NetLogCaptureMode::operator==(NetLogCaptureMode mode) const { |
+ return value_ == mode.value_; |
+} |
+ |
+NetLogCaptureMode::NetLogCaptureMode(uint32_t value) : value_(value) { |
+} |
+ |
+} // namespace net |