File: chrome_browsing_data_remover_constants.h

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (146 lines) | stat: -rw-r--r-- 6,844 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_BROWSING_DATA_CHROME_BROWSING_DATA_REMOVER_CONSTANTS_H_
#define CHROME_BROWSER_BROWSING_DATA_CHROME_BROWSING_DATA_REMOVER_CONSTANTS_H_

#include <stdint.h>

#include "build/build_config.h"
#include "chrome/common/buildflags.h"
#include "content/public/browser/browsing_data_remover.h"
#include "extensions/buildflags/buildflags.h"

namespace chrome_browsing_data_remover {
// This is an extension of content::BrowsingDataRemover::RemoveDataMask which
// includes all datatypes therefrom and adds additional Chrome-specific ones.
using DataType = uint64_t;
  // Embedder can start adding datatypes after the last platform datatype.
constexpr DataType DATA_TYPE_EMBEDDER_BEGIN =
    content::BrowsingDataRemover::DATA_TYPE_CONTENT_END << 1;

// Chrome-specific datatypes.
constexpr DataType DATA_TYPE_HISTORY = DATA_TYPE_EMBEDDER_BEGIN;
constexpr DataType DATA_TYPE_FORM_DATA = DATA_TYPE_EMBEDDER_BEGIN << 1;
constexpr DataType DATA_TYPE_PASSWORDS = DATA_TYPE_EMBEDDER_BEGIN << 2;
#if BUILDFLAG(IS_ANDROID)
constexpr DataType DATA_TYPE_WEB_APP_DATA = DATA_TYPE_EMBEDDER_BEGIN << 3;
#endif
constexpr DataType DATA_TYPE_SITE_USAGE_DATA = DATA_TYPE_EMBEDDER_BEGIN << 4;
constexpr DataType DATA_TYPE_DURABLE_PERMISSION = DATA_TYPE_EMBEDDER_BEGIN << 5;
constexpr DataType DATA_TYPE_EXTERNAL_PROTOCOL_DATA = DATA_TYPE_EMBEDDER_BEGIN
                                                      << 6;
constexpr DataType DATA_TYPE_HOSTED_APP_DATA_TEST_ONLY =
    DATA_TYPE_EMBEDDER_BEGIN << 7;
constexpr DataType DATA_TYPE_CONTENT_SETTINGS = DATA_TYPE_EMBEDDER_BEGIN << 8;
constexpr DataType DATA_TYPE_BOOKMARKS = DATA_TYPE_EMBEDDER_BEGIN << 9;
constexpr DataType DATA_TYPE_ISOLATED_ORIGINS = DATA_TYPE_EMBEDDER_BEGIN << 10;
constexpr DataType DATA_TYPE_ACCOUNT_PASSWORDS = DATA_TYPE_EMBEDDER_BEGIN << 11;
constexpr DataType DATA_TYPE_LOCAL_CUSTOM_DICTIONARY = DATA_TYPE_EMBEDDER_BEGIN
                                                       << 12;
constexpr DataType DATA_TYPE_ISOLATED_WEB_APP_COOKIES = DATA_TYPE_EMBEDDER_BEGIN
                                                        << 13;
constexpr DataType DATA_TYPE_READING_LIST = DATA_TYPE_EMBEDDER_BEGIN << 14;
constexpr DataType DATA_TYPE_TABS = DATA_TYPE_EMBEDDER_BEGIN << 15;
constexpr DataType DATA_TYPE_SEARCH_ENGINE_CHOICE = DATA_TYPE_EMBEDDER_BEGIN
                                                    << 16;

// Group datatypes.

// "Site data" includes storage backend accessible to websites and some
// additional metadata kept by the browser (e.g. site usage data).
constexpr DataType DATA_TYPE_SITE_DATA =
    content::BrowsingDataRemover::DATA_TYPE_COOKIES |
    content::BrowsingDataRemover::DATA_TYPE_DOM_STORAGE |
    content::BrowsingDataRemover::DATA_TYPE_MEDIA_LICENSES |
#if BUILDFLAG(IS_ANDROID)
    DATA_TYPE_WEB_APP_DATA |
#endif
    DATA_TYPE_SITE_USAGE_DATA | DATA_TYPE_DURABLE_PERMISSION |
    DATA_TYPE_EXTERNAL_PROTOCOL_DATA | DATA_TYPE_ISOLATED_ORIGINS |
    DATA_TYPE_ISOLATED_WEB_APP_COOKIES |
    content::BrowsingDataRemover::DATA_TYPE_PRIVACY_SANDBOX |
    content::BrowsingDataRemover::DATA_TYPE_DEVICE_BOUND_SESSIONS;

// Datatypes protected by Important Sites.
constexpr DataType IMPORTANT_SITES_DATA_TYPES =
    DATA_TYPE_SITE_DATA | content::BrowsingDataRemover::DATA_TYPE_CACHE;

// Datatypes that can be deleted partially per URL / origin / domain,
// whichever makes sense.
constexpr DataType FILTERABLE_DATA_TYPES =
    DATA_TYPE_SITE_DATA | content::BrowsingDataRemover::DATA_TYPE_CACHE |
    content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS |
    content::BrowsingDataRemover::DATA_TYPE_RELATED_WEBSITE_SETS_PERMISSIONS |
    content::BrowsingDataRemover::DATA_TYPE_PREFETCH_CACHE |
    content::BrowsingDataRemover::DATA_TYPE_PRERENDER_CACHE;

// Datatypes with account-scoped data that needs to be removed
// before Google cookies are deleted.
constexpr DataType DEFERRED_COOKIE_DELETION_DATA_TYPES =
    DATA_TYPE_ACCOUNT_PASSWORDS;

// Includes all the available remove options. Meant to be used by clients
// that wish to wipe as much data as possible from a Profile, to make it
// look like a new Profile. Does not delete account-scoped data like
// passwords but will remove access to account-scoped data by signing the
// user out.
constexpr DataType ALL_DATA_TYPES =
    DATA_TYPE_SITE_DATA |  //
    content::BrowsingDataRemover::DATA_TYPE_CACHE |
    content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS |
    DATA_TYPE_FORM_DATA |                //
    DATA_TYPE_HISTORY |                  //
    DATA_TYPE_PASSWORDS |                //
    DATA_TYPE_CONTENT_SETTINGS |         //
    DATA_TYPE_BOOKMARKS |                //
    DATA_TYPE_LOCAL_CUSTOM_DICTIONARY |  //
    DATA_TYPE_READING_LIST |             //
    DATA_TYPE_SEARCH_ENGINE_CHOICE;

// Includes all available remove options. Meant to be used when the Profile
// is scheduled to be deleted, and all possible data should be wiped from
// disk as soon as possible.
constexpr DataType WIPE_PROFILE =
    ALL_DATA_TYPES | content::BrowsingDataRemover::DATA_TYPE_NO_CHECKS;

// This is an extension of content::BrowsingDataRemover::OriginType which
// includes all origin types therefrom and adds additional Chrome-specific
// ones.
using OriginType = uint64_t;
// Embedder can start adding origin types after the last
// platform origin type.
constexpr OriginType ORIGIN_TYPE_EMBEDDER_BEGIN =
    content::BrowsingDataRemover::ORIGIN_TYPE_CONTENT_END << 1;

#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
// Packaged apps and extensions (chrome-extension://*).
constexpr OriginType ORIGIN_TYPE_EXTENSION = ORIGIN_TYPE_EMBEDDER_BEGIN;
#endif

  // All origin types.
constexpr OriginType ALL_ORIGIN_TYPES =
    content::BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB |
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
    ORIGIN_TYPE_EXTENSION |
#endif
    content::BrowsingDataRemover::ORIGIN_TYPE_PROTECTED_WEB;

// Important sites protect a small set of sites from the deletion of certain
// datatypes. Therefore, those datatypes must be filterable by
// url/origin/domain.
static_assert((IMPORTANT_SITES_DATA_TYPES & ~FILTERABLE_DATA_TYPES) == 0,
              "All important sites datatypes must be filterable.");

static_assert((DEFERRED_COOKIE_DELETION_DATA_TYPES & FILTERABLE_DATA_TYPES) ==
                  0,
              "Deferred deletion is currently not implemented for filterable "
              "data types");

static_assert((DEFERRED_COOKIE_DELETION_DATA_TYPES & WIPE_PROFILE) == 0,
              "Account data should not be included in deletions that remove "
              "all local data");
}  // namespace chrome_browsing_data_remover

#endif  // CHROME_BROWSER_BROWSING_DATA_CHROME_BROWSING_DATA_REMOVER_CONSTANTS_H_