customtabs: Don't crash when the client AIDL is incorrect.
[chromium-blink-merge.git] / net / log / net_log_capture_mode.cc
blob606dec6e524b4eb5d91613690def7954ff18eda4
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.
5 #include "net/log/net_log_capture_mode.h"
7 #include <algorithm>
9 namespace net {
11 namespace {
13 // Integer representation for the capture mode. The numeric value is depended on
14 // for methods of NetLogCaptureMode, which expect that higher values represent a
15 // strict superset of the capabilities of lower values.
16 enum InternalValue {
17 // Log all events, but do not include the actual transferred bytes and
18 // remove cookies and HTTP credentials.
19 DEFAULT,
21 // Log all events, but do not include the actual transferred bytes as
22 // parameters for bytes sent/received events.
23 INCLUDE_COOKIES_AND_CREDENTIALS,
25 // Log everything possible, even if it is slow and memory expensive.
26 // Includes logging of transferred bytes.
27 INCLUDE_SOCKET_BYTES,
30 } // namespace
32 NetLogCaptureMode::NetLogCaptureMode() : NetLogCaptureMode(DEFAULT) {
35 NetLogCaptureMode NetLogCaptureMode::Default() {
36 return NetLogCaptureMode(DEFAULT);
39 NetLogCaptureMode NetLogCaptureMode::IncludeCookiesAndCredentials() {
40 return NetLogCaptureMode(INCLUDE_COOKIES_AND_CREDENTIALS);
43 NetLogCaptureMode NetLogCaptureMode::IncludeSocketBytes() {
44 return NetLogCaptureMode(INCLUDE_SOCKET_BYTES);
47 bool NetLogCaptureMode::include_cookies_and_credentials() const {
48 return value_ >= INCLUDE_COOKIES_AND_CREDENTIALS;
51 bool NetLogCaptureMode::include_socket_bytes() const {
52 return value_ >= INCLUDE_SOCKET_BYTES;
55 bool NetLogCaptureMode::operator==(NetLogCaptureMode mode) const {
56 return value_ == mode.value_;
59 bool NetLogCaptureMode::operator!=(NetLogCaptureMode mode) const {
60 return !(*this == mode);
63 NetLogCaptureMode::NetLogCaptureMode(uint32_t value) : value_(value) {
66 } // namespace net