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