| 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 {
|
| + return value_ != NONE;
|
| +}
|
| +
|
| +bool NetLogCaptureMode::include_private_data() const {
|
| + return value_ > DEFAULT;
|
| +}
|
| +
|
| +bool NetLogCaptureMode::include_socket_bytes() const {
|
| + return value_ == ALL;
|
| +}
|
| +
|
| +NetLogCaptureMode NetLogCaptureMode::Max(NetLogCaptureMode mode1,
|
| + 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
|
|
|