| 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 #include "net/log/net_log_capture_mode.h" | 5 #include "net/log/net_log_capture_mode.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 namespace net { | 9 namespace net { |
| 10 | 10 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 } | 45 } |
| 46 | 46 |
| 47 NetLogCaptureMode NetLogCaptureMode::IncludeCookiesAndCredentials() { | 47 NetLogCaptureMode NetLogCaptureMode::IncludeCookiesAndCredentials() { |
| 48 return NetLogCaptureMode(INCLUDE_COOKIES_AND_CREDENTIALS); | 48 return NetLogCaptureMode(INCLUDE_COOKIES_AND_CREDENTIALS); |
| 49 } | 49 } |
| 50 | 50 |
| 51 NetLogCaptureMode NetLogCaptureMode::IncludeSocketBytes() { | 51 NetLogCaptureMode NetLogCaptureMode::IncludeSocketBytes() { |
| 52 return NetLogCaptureMode(INCLUDE_SOCKET_BYTES); | 52 return NetLogCaptureMode(INCLUDE_SOCKET_BYTES); |
| 53 } | 53 } |
| 54 | 54 |
| 55 NetLogCaptureMode NetLogCaptureMode::Max(NetLogCaptureMode mode1, | |
| 56 NetLogCaptureMode mode2) { | |
| 57 return NetLogCaptureMode(std::max(mode1.value_, mode2.value_)); | |
| 58 } | |
| 59 | |
| 60 bool NetLogCaptureMode::enabled() const { | 55 bool NetLogCaptureMode::enabled() const { |
| 61 return value_ != NONE; | 56 return value_ != NONE; |
| 62 } | 57 } |
| 63 | 58 |
| 64 bool NetLogCaptureMode::include_cookies_and_credentials() const { | 59 bool NetLogCaptureMode::include_cookies_and_credentials() const { |
| 65 return value_ >= INCLUDE_COOKIES_AND_CREDENTIALS; | 60 return value_ >= INCLUDE_COOKIES_AND_CREDENTIALS; |
| 66 } | 61 } |
| 67 | 62 |
| 68 bool NetLogCaptureMode::include_socket_bytes() const { | 63 bool NetLogCaptureMode::include_socket_bytes() const { |
| 69 return value_ >= INCLUDE_SOCKET_BYTES; | 64 return value_ >= INCLUDE_SOCKET_BYTES; |
| 70 } | 65 } |
| 71 | 66 |
| 72 bool NetLogCaptureMode::operator==(NetLogCaptureMode mode) const { | 67 bool NetLogCaptureMode::operator==(NetLogCaptureMode mode) const { |
| 73 return value_ == mode.value_; | 68 return value_ == mode.value_; |
| 74 } | 69 } |
| 75 | 70 |
| 76 bool NetLogCaptureMode::operator!=(NetLogCaptureMode mode) const { | 71 bool NetLogCaptureMode::operator!=(NetLogCaptureMode mode) const { |
| 77 return !(*this == mode); | 72 return !(*this == mode); |
| 78 } | 73 } |
| 79 | 74 |
| 80 int32_t NetLogCaptureMode::ToInternalValueForTesting() const { | 75 int32_t NetLogCaptureMode::ToInternalValueForTesting() const { |
| 81 return ToInternalValue(); | 76 return value_; |
| 82 } | 77 } |
| 83 | 78 |
| 84 NetLogCaptureMode::NetLogCaptureMode(uint32_t value) : value_(value) { | 79 NetLogCaptureMode::NetLogCaptureMode(uint32_t value) : value_(value) { |
| 85 } | 80 } |
| 86 | 81 |
| 87 NetLogCaptureMode NetLogCaptureMode::FromInternalValue(int32_t value) { | |
| 88 return NetLogCaptureMode(value); | |
| 89 } | |
| 90 | |
| 91 int32_t NetLogCaptureMode::ToInternalValue() const { | |
| 92 return value_; | |
| 93 } | |
| 94 | |
| 95 } // namespace net | 82 } // namespace net |
| OLD | NEW |