chromium/third_party/metrics_proto/extension_install.proto

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto2";

option optimize_for = LITE_RUNTIME;
option java_package = "org.chromium.components.metrics";

option java_outer_classname = "ExtensionInstallProtos";

package metrics;

// Stores information about an extension installed on a user's machine.
// Next tag: 17.
message ExtensionInstallProto {
  // The type of extension item this is.
  enum Type {
    UNKNOWN_TYPE = 0;            // Unknown (hopefully never used)
    EXTENSION = 1;               // A browser extension
    THEME = 2;                   // A browser theme
    USER_SCRIPT = 3;             // An extension converted from a user script
    HOSTED_APP = 4;              // A hosted app
    LEGACY_PACKAGED_APP = 5;     // A (deprecated) v1 packaged app
    PLATFORM_APP = 6;            // A platform app
    SHARED_MODULE = 7;           // A shared module
    LOGIN_SCREEN_EXTENSION = 8;  // An extension running on the login screen
  }
  optional Type type = 1;

  // The source of the extension.
  enum InstallLocation {
    UNKNOWN_LOCATION = 0;  // Unknown (hopefully never used)
    INTERNAL = 1;  // A crx file from the internal Extensions directory; most
                   // webstore-installed extensions fall into this category.
    EXTERNAL_PREF = 2;  // A crx file from an external directory (via prefs).
    EXTERNAL_REGISTRY = 3;  // A crx file from an external directory (via the
                            // Windows registry)
    UNPACKED = 4;   // An unpacked extension loaded from chrome://extensions.
    COMPONENT = 5;  // An internal component extension.
    EXTERNAL_PREF_DOWNLOAD = 6;    // A crx file from an external directory (via
                                   // prefs), downloaded from an update URL.
    EXTERNAL_POLICY_DOWNLOAD = 7;  // A crx file from an external directory (via
                                   // admin policies), downloaded from an update
                                   // URL.
    COMMAND_LINE = 8;  // Loaded from the commandline (e.g. --load-extension).
    EXTERNAL_POLICY = 9;  // A crx file from an external directory (via admin
                          // policies), cached locally and installed from the
                          // cache.
    EXTERNAL_COMPONENT = 10;  // A component extension that was downloaded
                              // externally via an update url.
  }
  optional InstallLocation install_location = 2;

  // The manifest version in the extension. Note: this refers to the
  // Chrome-required versioning of the manifest, not the extension version.
  // Currently, it is always 1 or 2.
  optional int32 manifest_version = 3;

  // The associated UI action in the extension. Each extension can have at most
  // one type of action.
  enum ActionType {
    NO_ACTION = 0;
    BROWSER_ACTION = 1;
    PAGE_ACTION = 2;
    SYSTEM_INDICATOR = 3;
  }
  optional ActionType action_type = 4;

  // If the extension has been granted file access.
  optional bool has_file_access = 5;

  // If the extension has been granted permission to run in incognito contexts.
  optional bool has_incognito_access = 6;

  // If the extension originated from the Chrome Web Store according to the
  // prefs.
  // This differs from install_location, which specifies from where the location
  // on the user’s machine from where the install originated, but not whether
  // the extension is hosted in the store. For instance, sideloaded extensions
  // that are specified via ID in the registry are downloaded from the store.
  optional bool is_from_store = 7;

  // If the extension automatically updates from the Chrome Web Store.
  optional bool updates_from_store = 8;

  // If the extension is a bookmark app that was generated from a web page. This
  // is distinct from install_location above, which specifies from where on the
  // user’s machine the install originated.
  // Deprecated: This field is no longer populated as bookmark apps are no
  // longer supported.
  optional bool is_from_bookmark = 9;

  // If the extension was created from a user script. This is distinct from
  // install_location above, which specifies from where on the user’s machine
  // the install originated.
  optional bool is_converted_from_user_script = 10;

  // If the extension was installed by default when the profile was created.
  // These extensions are specified by Chrome.
  optional bool is_default_installed = 11;

  // If the extension was installed by an OEM. This differs from
  // "is_default_installed", since these extensions are specified by the OEM
  // rather than by Chrome. These are specified in a file that is created as
  // part of the creation of the Chrome image, and can be specific to different
  // OEMs.
  optional bool is_oem_installed = 12;

  // The type of background page this extension has. Each extension can have at
  // most one type of background presence.
  enum BackgroundScriptType {
    NO_BACKGROUND_SCRIPT = 0;        // The extension has no background page.
    PERSISTENT_BACKGROUND_PAGE = 1;  // The extension has a persistent
                                     // background page.
    EVENT_PAGE = 2;                  // The extension has a (lazy) event page.
    SERVICE_WORKER = 3;              // The extension has a service worker based
                                     // background context.
  }
  optional BackgroundScriptType background_script_type = 13;

  // The reasons an extension may be disabled.
  enum DisableReason {
    USER_ACTION = 0;              // The user disabled the extension.
    PERMISSIONS_INCREASE = 1;     // The extension increased permissions.
    RELOAD = 2;                   // The extension is reloading.
    UNSUPPORTED_REQUIREMENT = 3;  // The extension has requirements that weren't
                                  // met (e.g. graphics capabilities).
    SIDELOAD_WIPEOUT = 4;         // The extension was disabled in the sideload
                                  // wipeout.
    UNKNOWN_FROM_SYNC = 5;        // The extension was disabled by sync.
    NOT_VERIFIED = 6;             // The extension couldn't be verified.
    GREYLIST = 7;                 // The extension was found on the greylist.
    CORRUPTED = 8;  // The extension install was corrupted according to content
                    // verification.
    REMOTE_INSTALL = 9;  // The extension was installed remotely and hasn't been
                         // enabled.
    EXTERNAL_EXTENSION = 10;  // The extension was sideloaded and hasn't been
                              // enabled.
    UPDATE_REQUIRED_BY_POLICY = 11;    // Policy requires an unmet minimum
                                       // version.
    CUSTODIAN_APPROVAL_REQUIRED = 12;  // The extension is pending custodian
                                       // approval for a supervised user.
    BLOCKED_BY_POLICY = 13;  // The extension is disabled because it's blocked
                             // by enterprise policy.
    // The extension is being reinstalled.
    REINSTALL = 16;
    // The extension has been disabled because it's not allowlisted and the Safe
    // Browsing allowlist is enforced in the user profile.
    NOT_ALLOWLISTED = 17;
    // The extension is disabled because it is not in 1st party ash keep list
    // and the 1st party ash extension keep list is enforced in ash.
    NOT_ASH_KEEPLISTED = 18;
    // Policy requires the extension to be published and available for download
    // from the web store.
    PUBLISHED_IN_STORE_REQUIRED_BY_POLICY = 19;
    // The extension is using an unsupported manifest version.
    UNSUPPORTED_MANIFEST_VERSION = 20;
  }
  // Any DisableReasons in effect for the extension. An empty list means the
  // extension is not disabled. Note that an extension that is not disabled may
  // nonetheless not be running, e.g., terminated because the extension process
  // was killed.
  repeated DisableReason disable_reasons = 14;

  // The state of the extension in the safe browsing blacklist.
  // The numeric values here match the values of the respective enum in
  // ClientCRXListInfoResponse proto.
  enum BlacklistState {
    // The extension is not in the blacklist.
    NOT_BLACKLISTED = 0;
    // The extension is malware.
    BLACKLISTED_MALWARE = 1;
    // The extension has a serious security vulnerability.
    BLACKLISTED_SECURITY_VULNERABILITY = 2;
    // The extension violated CWS policy.
    BLACKLISTED_CWS_POLICY_VIOLATION = 3;
    // The extension is considered potentially unwanted.
    BLACKLISTED_POTENTIALLY_UNWANTED = 4;
    // Used when we couldn't connect to server, e.g. when offline.
    BLACKLISTED_UNKNOWN = 5;
  }
  optional BlacklistState blacklist_state = 15;

  // Whether the extension was installed in the current sampling period. This
  // is useful if trying to use extension installation in conjunction with other
  // metrics (e.g. page load). Since some of the metrics from this period will
  // have the extension installed and others won't, these records can be
  // discarded for that analysis.
  optional bool installed_in_this_sample_period = 16;
}