Commit 36ee0ad7 authored by Paul Dyson's avatar Paul Dyson Committed by Commit Bot

Add a new scheme for logging apps in UKM.

Add the scheme "app" for logging apps.

Bug: 841671
Change-Id: I05af14327dba5ad422b9784205229f914641aa1a
Reviewed-on: https://chromium-review.googlesource.com/1053342
Commit-Queue: Paul Dyson <pdyson@chromium.org>
Reviewed-by: default avatarSteven Holte <holte@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569952}
parent 1861e3d4
...@@ -31,9 +31,11 @@ namespace { ...@@ -31,9 +31,11 @@ namespace {
// Note: kChromeUIScheme is defined in content, which this code can't // Note: kChromeUIScheme is defined in content, which this code can't
// depend on - since it's used by iOS too. kExtensionScheme is defined // depend on - since it's used by iOS too. kExtensionScheme is defined
// in extensions which also isn't always available here. // in extensions which also isn't always available here. kAppScheme
// will be defined in code that isn't available here.
const char kChromeUIScheme[] = "chrome"; const char kChromeUIScheme[] = "chrome";
const char kExtensionScheme[] = "chrome-extension"; const char kExtensionScheme[] = "chrome-extension";
const char kAppScheme[] = "app";
const base::Feature kUkmSamplingRateFeature{"UkmSamplingRate", const base::Feature kUkmSamplingRateFeature{"UkmSamplingRate",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
...@@ -78,7 +80,7 @@ size_t GetMaxEntries() { ...@@ -78,7 +80,7 @@ size_t GetMaxEntries() {
bool HasSupportedScheme(const GURL& url) { bool HasSupportedScheme(const GURL& url) {
return url.SchemeIsHTTPOrHTTPS() || url.SchemeIs(url::kFtpScheme) || return url.SchemeIsHTTPOrHTTPS() || url.SchemeIs(url::kFtpScheme) ||
url.SchemeIs(url::kAboutScheme) || url.SchemeIs(kChromeUIScheme) || url.SchemeIs(url::kAboutScheme) || url.SchemeIs(kChromeUIScheme) ||
url.SchemeIs(kExtensionScheme); url.SchemeIs(kExtensionScheme) || url.SchemeIs(kAppScheme);
} }
// True if we should record the initial_url field of the UKM Source proto. // True if we should record the initial_url field of the UKM Source proto.
......
...@@ -937,6 +937,7 @@ TEST_F(UkmServiceTest, SupportedSchemes) { ...@@ -937,6 +937,7 @@ TEST_F(UkmServiceTest, SupportedSchemes) {
{"ftp://google.ca/", true}, {"ftp://google.ca/", true},
{"about:blank", true}, {"about:blank", true},
{"chrome://version/", true}, {"chrome://version/", true},
{"app://play/abcdefghijklmnopqrstuvwxyzabcdef/", true},
// chrome-extension are controlled by TestIsWebstoreExtension, above. // chrome-extension are controlled by TestIsWebstoreExtension, above.
{"chrome-extension://bhcnanendmgjjeghamaccjnochlnhcgj/", true}, {"chrome-extension://bhcnanendmgjjeghamaccjnochlnhcgj/", true},
{"chrome-extension://abcdefghijklmnopqrstuvwxyzabcdef/", false}, {"chrome-extension://abcdefghijklmnopqrstuvwxyzabcdef/", false},
...@@ -996,6 +997,7 @@ TEST_F(UkmServiceTest, SupportedSchemesNoExtensions) { ...@@ -996,6 +997,7 @@ TEST_F(UkmServiceTest, SupportedSchemesNoExtensions) {
{"ftp://google.ca/", true}, {"ftp://google.ca/", true},
{"about:blank", true}, {"about:blank", true},
{"chrome://version/", true}, {"chrome://version/", true},
{"app://play/abcdefghijklmnopqrstuvwxyzabcdef/", true},
{"chrome-extension://bhcnanendmgjjeghamaccjnochlnhcgj/", false}, {"chrome-extension://bhcnanendmgjjeghamaccjnochlnhcgj/", false},
{"chrome-extension://abcdefghijklmnopqrstuvwxyzabcdef/", false}, {"chrome-extension://abcdefghijklmnopqrstuvwxyzabcdef/", false},
{"file:///tmp/", false}, {"file:///tmp/", false},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment