Chromium Code Reviews| 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 #include "net/log/net_log_capture_mode.h" | |
| 6 | |
| 7 #include <algorithm> | |
| 8 | |
| 9 namespace net { | |
| 10 | |
| 11 namespace { | |
| 12 | |
| 13 // Integer representation for the capture mode. The numeric value is depended on | |
| 14 // for method of NetLogCaptureMode, which expect that higher values imply more | |
| 15 // capabilities. | |
| 16 enum InternalValue { | |
| 17 // Don't log any events. | |
| 18 NONE, | |
| 19 | |
| 20 // Log all events, but do not include the actual transferred bytes and | |
| 21 // remove cookies and HTTP credentials. | |
| 22 DEFAULT, | |
| 23 | |
| 24 // Log all events, but do not include the actual transferred bytes as | |
| 25 // parameters for bytes sent/received events. | |
| 26 INCLUDE_COOKIES_AND_CREDENTIALS, | |
| 27 | |
| 28 // Log everything possible, even if it is slow and memory expensive. | |
| 29 // Includes logging of transferred bytes. | |
| 30 ALL, | |
| 31 }; | |
| 32 | |
| 33 } // namespace | |
| 34 | |
| 35 // Default constructor creates an empty capture mode. | |
| 36 NetLogCaptureMode::NetLogCaptureMode() : NetLogCaptureMode(NONE) { | |
| 37 } | |
| 38 | |
| 39 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.
| |
| 40 return value_ != NONE; | |
| 41 } | |
| 42 | |
| 43 bool NetLogCaptureMode::include_private_data() const { | |
| 44 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.
| |
| 45 } | |
| 46 | |
| 47 bool NetLogCaptureMode::include_socket_bytes() const { | |
| 48 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,
| |
| 49 } | |
| 50 | |
| 51 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
| |
| 52 NetLogCaptureMode mode2) { | |
| 53 return NetLogCaptureMode(std::max(mode1.value_, mode2.value_)); | |
| 54 } | |
| 55 | |
| 56 NetLogCaptureMode NetLogCaptureMode::None() { | |
| 57 return NetLogCaptureMode(NONE); | |
| 58 } | |
| 59 | |
| 60 NetLogCaptureMode NetLogCaptureMode::Default() { | |
| 61 return NetLogCaptureMode(DEFAULT); | |
| 62 } | |
| 63 | |
| 64 NetLogCaptureMode NetLogCaptureMode::IncludeCookiesAndCredentials() { | |
| 65 return NetLogCaptureMode(INCLUDE_COOKIES_AND_CREDENTIALS); | |
| 66 } | |
| 67 | |
| 68 NetLogCaptureMode NetLogCaptureMode::All() { | |
| 69 return NetLogCaptureMode(ALL); | |
| 70 } | |
| 71 | |
| 72 bool NetLogCaptureMode::operator==(NetLogCaptureMode mode) const { | |
| 73 return value_ == mode.value_; | |
| 74 } | |
| 75 | |
| 76 NetLogCaptureMode::NetLogCaptureMode(uint32_t value) : value_(value) { | |
| 77 } | |
| 78 | |
| 79 } // namespace net | |
| OLD | NEW |