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