1// Copyright 2017 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.
4
5syntax = "proto2";
6
7option optimize_for = LITE_RUNTIME;
8
9option java_outer_classname = "ExtensionInstallProtos";
10option java_package = "org.chromium.components.metrics";
11
12package metrics;
13
14// Stores information about an extension installed on a user's machine.
15// Next tag: 17.
16message ExtensionInstallProto {
17  // The type of extension item this is.
18  enum Type {
19    UNKNOWN_TYPE = 0;            // Unknown (hopefully never used)
20    EXTENSION = 1;               // A browser extension
21    THEME = 2;                   // A browser theme
22    USER_SCRIPT = 3;             // An extension converted from a user script
23    HOSTED_APP = 4;              // A hosted app
24    LEGACY_PACKAGED_APP = 5;     // A (deprecated) v1 packaged app
25    PLATFORM_APP = 6;            // A platform app
26    SHARED_MODULE = 7;           // A shared module
27    LOGIN_SCREEN_EXTENSION = 8;  // An extension running on the login screen
28  }
29  optional Type type = 1;
30
31  // The source of the extension.
32  enum InstallLocation {
33    UNKNOWN_LOCATION = 0;  // Unknown (hopefully never used)
34    INTERNAL = 1;  // A crx file from the internal Extensions directory; most
35                   // webstore-installed extensions fall into this category.
36    EXTERNAL_PREF = 2;  // A crx file from an external directory (via prefs).
37    EXTERNAL_REGISTRY = 3;  // A crx file from an external directory (via the
38                            // Windows registry)
39    UNPACKED = 4;   // An unpacked extension loaded from chrome://extensions.
40    COMPONENT = 5;  // An internal component extension.
41    EXTERNAL_PREF_DOWNLOAD = 6;    // A crx file from an external directory (via
42                                   // prefs), downloaded from an update URL.
43    EXTERNAL_POLICY_DOWNLOAD = 7;  // A crx file from an external directory (via
44                                   // admin policies), downloaded from an update
45                                   // URL.
46    COMMAND_LINE = 8;  // Loaded from the commandline (e.g. --load-extension).
47    EXTERNAL_POLICY = 9;  // A crx file from an external directory (via admin
48                          // policies), cached locally and installed from the
49                          // cache.
50    EXTERNAL_COMPONENT = 10;  // A component extension that was downloaded
51                              // externally via an update url.
52  }
53  optional InstallLocation install_location = 2;
54
55  // The manifest version in the extension. Note: this refers to the
56  // Chrome-required versioning of the manifest, not the extension version.
57  // Currently, it is always 1 or 2.
58  optional int32 manifest_version = 3;
59
60  // The associated UI action in the extension. Each extension can have at most
61  // one type of action.
62  enum ActionType {
63    NO_ACTION = 0;
64    BROWSER_ACTION = 1;
65    PAGE_ACTION = 2;
66    SYSTEM_INDICATOR = 3;
67  }
68  optional ActionType action_type = 4;
69
70  // If the extension has been granted file access.
71  optional bool has_file_access = 5;
72
73  // If the extension has been granted permission to run in incognito contexts.
74  optional bool has_incognito_access = 6;
75
76  // If the extension originated from the Chrome Web Store according to the
77  // prefs.
78  // This differs from install_location, which specifies from where the location
79  // on the user’s machine from where the install originated, but not whether
80  // the extension is hosted in the store. For instance, sideloaded extensions
81  // that are specified via ID in the registry are downloaded from the store.
82  optional bool is_from_store = 7;
83
84  // If the extension automatically updates from the Chrome Web Store.
85  optional bool updates_from_store = 8;
86
87  // If the extension is a bookmark app that was generated from a web page. This
88  // is distinct from install_location above, which specifies from where on the
89  // user’s machine the install originated.
90  optional bool is_from_bookmark = 9;
91
92  // If the extension was created from a user script. This is distinct from
93  // install_location above, which specifies from where on the user’s machine
94  // the install originated.
95  optional bool is_converted_from_user_script = 10;
96
97  // If the extension was installed by default when the profile was created.
98  // These extensions are specified by Chrome.
99  optional bool is_default_installed = 11;
100
101  // If the extension was installed by an OEM. This differs from
102  // "is_default_installed", since these extensions are specified by the OEM
103  // rather than by Chrome. These are specified in a file that is created as
104  // part of the creation of the Chrome image, and can be specific to different
105  // OEMs.
106  optional bool is_oem_installed = 12;
107
108  // The type of background page this extension has. Each extension can have at
109  // most one type of background presence.
110  enum BackgroundScriptType {
111    NO_BACKGROUND_SCRIPT = 0;        // The extension has no background page.
112    PERSISTENT_BACKGROUND_PAGE = 1;  // The extension has a persistent
113                                     // background page.
114    EVENT_PAGE = 2;                  // The extension has a (lazy) event page.
115  }
116  optional BackgroundScriptType background_script_type = 13;
117
118  // The reasons an extension may be disabled.
119  enum DisableReason {
120    USER_ACTION = 0;              // The user disabled the extension.
121    PERMISSIONS_INCREASE = 1;     // The extension increased permissions.
122    RELOAD = 2;                   // The extension is reloading.
123    UNSUPPORTED_REQUIREMENT = 3;  // The extension has requirements that weren't
124                                  // met (e.g. graphics capabilities).
125    SIDELOAD_WIPEOUT = 4;         // The extension was disabled in the sideload
126                                  // wipeout.
127    UNKNOWN_FROM_SYNC = 5;        // The extension was disabled by sync.
128    NOT_VERIFIED = 6;             // The extension couldn't be verified.
129    GREYLIST = 7;                 // The extension was found on the greylist.
130    CORRUPTED = 8;  // The extension install was corrupted according to content
131                    // verification.
132    REMOTE_INSTALL = 9;  // The extension was installed remotely and hasn't been
133                         // enabled.
134    EXTERNAL_EXTENSION = 10;  // The extension was sideloaded and hasn't been
135                              // enabled.
136    UPDATE_REQUIRED_BY_POLICY = 11;    // Policy requires an unmet minimum
137                                       // version.
138    CUSTODIAN_APPROVAL_REQUIRED = 12;  // The extension is pending custodian
139                                       // approval for a supervised user.
140    BLOCKED_BY_POLICY = 13;  // The extension is disabled because it's blocked
141                             // by enterprise policy.
142    // Deprecated: The extension is disabled because it's blocked due to mature
143    // content for supervised users.
144    DEPRECATED_BLOCKED_MATURE = 14;
145    // The extension is disabled due to having a malware attribute in the Omaha
146    // config.
147    DISABLE_REMOTELY_FOR_MALWARE = 15;
148  }
149  // Any DisableReasons in effect for the extension. An empty list means the
150  // extension is not disabled. Note that an extension that is not disabled may
151  // nonetheless not be running, e.g., terminated because the extension process
152  // was killed.
153  repeated DisableReason disable_reasons = 14;
154
155  // The state of the extension in the safe browsing blacklist.
156  // The numeric values here match the values of the respective enum in
157  // ClientCRXListInfoResponse proto.
158  enum BlacklistState {
159    // The extension is not in the blacklist.
160    NOT_BLACKLISTED = 0;
161    // The extension is malware.
162    BLACKLISTED_MALWARE = 1;
163    // The extension has a serious security vulnerability.
164    BLACKLISTED_SECURITY_VULNERABILITY = 2;
165    // The extension violated CWS policy.
166    BLACKLISTED_CWS_POLICY_VIOLATION = 3;
167    // The extension is considered potentially unwanted.
168    BLACKLISTED_POTENTIALLY_UNWANTED = 4;
169    // Used when we couldn't connect to server, e.g. when offline.
170    BLACKLISTED_UNKNOWN = 5;
171  }
172  optional BlacklistState blacklist_state = 15;
173
174  // Whether the extension was installed in the current sampling period. This
175  // is useful if trying to use extension installation in conjunction with other
176  // metrics (e.g. page load). Since some of the metrics from this period will
177  // have the extension installed and others won't, these records can be
178  // discarded for that analysis.
179  optional bool installed_in_this_sample_period = 16;
180}
181