File: annotation_control_provider.cc

package info (click to toggle)
chromium 139.0.7258.127-2
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 6,122,156 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 (119 lines) | stat: -rw-r--r-- 4,971 bytes parent folder | download | duplicates (6)
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
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/policy/annotations/annotation_control_provider.h"

#include "base/containers/flat_map.h"
#include "components/policy/policy_constants.h"

namespace {

constexpr char kAutofillQueryAnnotationHash[] = "88863520";
constexpr char kAutofillUploadAnnotationHash[] = "104798869";
constexpr char kCalendarGetEventsAnnotationHash[] = "86429515";
constexpr char kChromeFeedbackReportAppAnnotationHash[] = "134729048";
constexpr char kChromePluginVmApiAnnotationHash[] = "28498700";
constexpr char kDomainReliabilityReportUploadAnnotationHash[] = "108804096";
constexpr char kQuickAnswersLoaderAnnotationHash[] = "46208118";
constexpr char kRemotingLogToServerAnnotationHash[] = "99742369";
constexpr char kSafeBrowsingBinaryUploadAppAnnotationHash[] = "4306022";
constexpr char kSignedInProfileAvatarAnnotationHash[] = "108903331";
constexpr char kWallpaperDownloadGooglePhotoAnnotationHash[] = "50127013";
constexpr char kWebrtcEventLogUploaderAnnotationHash[] = "24186190";
constexpr char kWebrtcLogUploadAnnotationHash[] = "62443804";

}  // namespace

namespace policy {

AnnotationControlProvider::AnnotationControlProvider() = default;
AnnotationControlProvider::~AnnotationControlProvider() = default;

base::flat_map<std::string, AnnotationControl>
AnnotationControlProvider::GetControls() {
  // Lazy init.
  if (annotation_controls_.empty()) {
    Load();
  }

  return annotation_controls_;
}

// Setup annotation to policy mappings with some hand-picked network
// annotations. Annotations are keyed by hash codes which are generated at
// compile time. There is also a helper script to generate these hash codes at:
// `tools/traffic_annotation/scripts/auditor/README.md`
void AnnotationControlProvider::Load() {
  // autofill_query
  // Note: This one is purposefully incorrect to allow for initial testing. It
  //       should have the same policies as 'autofill_upload' below.
  annotation_controls_[kAutofillQueryAnnotationHash] =
      AnnotationControl().Add(key::kPasswordManagerEnabled, base::Value(false));

  // autofill_upload
  annotation_controls_[kAutofillUploadAnnotationHash] =
      AnnotationControl()
          .Add(key::kPasswordManagerEnabled, base::Value(false))
          .Add(key::kAutofillAddressEnabled, base::Value(false))
          .Add(key::kAutofillCreditCardEnabled, base::Value(false));

  // calendar_get_events
  annotation_controls_[kCalendarGetEventsAnnotationHash] =
      AnnotationControl().Add(key::kCalendarIntegrationEnabled,
                              base::Value(false));

  // chrome_feedback_report_app
  annotation_controls_[kChromeFeedbackReportAppAnnotationHash] =
      AnnotationControl().Add(key::kUserFeedbackAllowed, base::Value(false));

  // chrome_plugin_vm_api
  annotation_controls_[kChromePluginVmApiAnnotationHash] =
      AnnotationControl().Add(key::kUserPluginVmAllowed, base::Value(false));

  // domain_reliability_report_upload
  annotation_controls_[kDomainReliabilityReportUploadAnnotationHash] =
      AnnotationControl().Add(key::kDomainReliabilityAllowed,
                              base::Value(false));

  // quick_answers_loader
  annotation_controls_[kQuickAnswersLoaderAnnotationHash] =
      AnnotationControl()
          .Add(key::kQuickAnswersDefinitionEnabled, base::Value(false))
          .Add(key::kQuickAnswersUnitConversionEnabled, base::Value(false));

  // remoting_log_to_server
  annotation_controls_[kRemotingLogToServerAnnotationHash] =
      AnnotationControl()
          .Add(key::kRemoteAccessHostAllowEnterpriseRemoteSupportConnections,
               base::Value(false))
          .Add(key::kRemoteAccessHostAllowRemoteSupportConnections,
               base::Value(false));

  // safe_browsing_binary_upload_app
  annotation_controls_[kSafeBrowsingBinaryUploadAppAnnotationHash] =
      AnnotationControl().Add(key::kAdvancedProtectionAllowed,
                              base::Value(false));

  // signed_in_profile_avatar
  annotation_controls_[kSignedInProfileAvatarAnnotationHash] =
      AnnotationControl().Add(key::kUserAvatarCustomizationSelectorsEnabled,
                              base::Value(false));

  // wallpaper_download_google_photo
  annotation_controls_[kWallpaperDownloadGooglePhotoAnnotationHash] =
      AnnotationControl().Add(key::kWallpaperGooglePhotosIntegrationEnabled,
                              base::Value(false));

  // webrtc_event_log_uploader
  annotation_controls_[kWebrtcEventLogUploaderAnnotationHash] =
      AnnotationControl().Add(key::kWebRtcEventLogCollectionAllowed,
                              base::Value(false));

  // webrtc_log_upload
  annotation_controls_[kWebrtcLogUploadAnnotationHash] =
      AnnotationControl().Add(key::kWebRtcTextLogCollectionAllowed,
                              base::Value(false));
}

}  // namespace policy