1// Copyright 2017 The Chromium Authors 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; 8option java_package = "org.chromium.components.metrics"; 9 10package ukm; 11 12// Types of source ids defined by 13// https://cs.chromium.org/chromium/src/services/metrics/public/cpp/ukm_source_id.h 14// WARNING: Please update both the internal version and the Chromium version of 15// this file when new enum values are added. 16enum SourceType { 17 DEFAULT = 0; 18 NAVIGATION_ID = 1; 19 APP_ID = 2; 20 HISTORY_ID = 3; 21 WEBAPK_ID = 4; 22 PAYMENT_APP_ID = 5; 23 DESKTOP_WEB_APP_ID = 6; 24 WORKER_ID = 7; 25 NO_URL_ID = 8; 26 REDIRECT_ID = 9; 27 WEB_IDENTITY_ID = 10; 28 CHROMEOS_WEBSITE_ID = 11; 29 EXTENSION_ID = 12; 30} 31 32// Android Activity Type defined by 33// https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/flags/android/chrome_session_state.h?q=ActivityType 34enum AndroidActivityType { 35 TABBED = 0; 36 CUSTOM_TAB = 1; 37 TRUSTED_WEB_ACTIVITY = 2; 38 WEB_APP = 3; 39 WEB_APK = 4; 40 PRE_FIRST_TAB = 5; 41} 42 43// This signifies if the reported source is a navigation to the same origin as 44// the previous document. 45// Its value is "unset" for error pages and same document navigations. 46// It is "same origin" when the previous document is of the same origin as the 47// one we're navigating to. 48// Otherwise, it is "cross origin". 49enum SameOriginStatus { 50 SAME_ORIGIN_STATUS_UNSET = 0; 51 SAME_ORIGIN = 1; 52 CROSS_ORIGIN = 2; 53} 54 55enum UrlScheme { 56 URL_SCHEME_UNSUPPORTED = 0; 57 HTTP = 1; 58 HTTPS = 2; 59 FTP = 3; 60 ABOUT = 4; 61 CHROME = 5; 62 CHROME_EXTENSION = 6; 63 APP = 7; 64} 65 66message UrlInfo { 67 optional string url = 1; 68 69 // Number of URLs seen for this source before the current URL. 70 // If unset, it’s equivalent to the count of the UrlInfo before it + 1, 71 // or 0 if it’s the first UrlInfo. 72 optional int32 previous_url_count = 2; 73} 74 75message NavigationMetadata { 76 // Whether this is the same origin as the previous document, cross-origin or 77 // unset. 78 optional SameOriginStatus same_origin_status = 1; 79 80 // Whether this navigation is initiated by the renderer. 81 // Renderer-initiated navigations include navigations that were triggered 82 // from Javascript, by users interacting with the content (e.g. clicking 83 // on <a> links or submitting forms, or by client-side redirects. 84 // On the other hand, we have browser-initiated navigations, e.g. ones 85 // triggered by the user interacting with the browser's UI. 86 optional bool is_renderer_initiated = 2; 87 88 // Whether the navigation committed an error page, as a result of a network 89 // error. 90 optional bool is_error_page = 3; 91} 92 93// Next tag: 20 94message Source { 95 // An identifier for the source. This should be unique within a session. 96 optional int64 id = 1; 97 98 // The type, which is based on how the Source is created. 99 optional SourceType type = 16; 100 101 // Unique identifier (for a given client_id/session_id) for the tab this 102 // source is associated with. Should only be set for navigation sources. 103 optional int64 tab_id = 10; 104 105 // The source id of the last committed non-same-document navigation for the 106 // tab this source is in. Should only be set for navigation sources. For 107 // backward compatibility, this field will never be set to the source id of a 108 // same-document source. In cases where the last committed navigation was a 109 // same-document navigation, previous_same_document_source_id will contain 110 // the source id of that previous same document navigation, while 111 // previous_source_id will contain the source id of the last committed 112 // non-same-document navigation. For example, if a user starts on page A (a 113 // non same document page load), then performs a same document navigation to 114 // B, then navigates to C (which could be either a same document or a non same 115 // document navigation), previous_source_id will reference A, and 116 // previous_same_document_source_id will reference B. 117 optional int64 previous_source_id = 11; 118 119 // The source id for the previous same document navigation, if the 120 // previously committed source was a same document navigation. If 121 // the previously committed source was not a same document 122 // navigation, this field will be unset. 123 optional int64 previous_same_document_source_id = 14; 124 125 // For sources representing the first navigation in a new tab, this id marks 126 // the source which opened the tab. Should only be set for the first 127 // navigation source in a tab. 128 optional int64 opener_source_id = 12; 129 130 // Data about each URL associated with the Source within the record's 131 // scope, in the order that the URLs were encountered. Data may include full 132 // or partial redirect chains for main frame navigations. 133 repeated UrlInfo urls = 8; 134 135 // Data about the URL of the Document, copied from the Source message whose 136 // id matched the navigation source id of the DocumentCreated event. 137 repeated UrlInfo resolved_urls = 15; 138 139 // Whether this source is for a same document navigation. Examples of same 140 // document navigations are fragment navigations, pushState/replaceState, 141 // and same page history navigation. 142 optional bool is_same_document_navigation = 13; 143 144 // Metadata about the navigation that is set when the URL is recorded. 145 optional NavigationMetadata navigation_metadata = 17; 146 147 // The URL of the source, as recorded in history. If this URL has not been 148 // discovered by Google's crawler, it should not be recorded. 149 // Replaced by |urls| field. 150 optional string deprecated_url = 2 [deprecated = true]; 151 reserved 5; 152 reserved "deprecated_url_origin"; 153 reserved 9; 154 reserved "deprecated_url_scheme"; 155 156 // The initial URL of the source. Set in cases where the source URL changed 157 // (e.g. it was redirected), otherwise unset. If this URL has not been 158 // discovered by Google's crawler, it should not be recorded. 159 optional string deprecated_initial_url = 6 [deprecated = true]; 160 161 // Denotes the Chrome Android activity type when created. See 162 // https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/flags/android/chrome_session_state.h;l=20;drc=c14f6f4b9c44fe479a8d004576b42723b2a5feb6 163 optional AndroidActivityType android_activity_type = 18; 164 165 // Relative time of navigation for this Source, as seen by the client, and is 166 // set for sources of type ukm::SourceIdType::NAVIGATION_ID. Time of events 167 // related to this Source will generally be relative to this timestamp. The 168 // recorded navigation time is in TimeTicks, which is the relative time since 169 // the origin. The origin is platform-specific but is guaranteed to be 170 // monotonically increase within each session. 171 optional int64 navigation_time_msec = 3; 172 173 reserved 4; 174 reserved 7; 175} 176