This repository has been archived by the owner on Jul 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add telemetry for uri count and loading time.
- Loading branch information
1 parent
074593e
commit 3e4088f
Showing
4 changed files
with
117 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
app/src/common/shared/org/mozilla/vrbrowser/utils/UrlUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*- | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
package org.mozilla.vrbrowser.utils; | ||
|
||
import android.support.annotation.Nullable; | ||
|
||
|
||
// This class refers from mozilla-mobile/focus-android | ||
public class UrlUtils { | ||
|
||
public static String stripCommonSubdomains(@Nullable String host) { | ||
if (host == null) { | ||
return null; | ||
} | ||
|
||
// In contrast to desktop, we also strip mobile subdomains, | ||
// since its unlikely users are intentionally typing them | ||
int start = 0; | ||
|
||
if (host.startsWith("www.")) { | ||
start = 4; | ||
} else if (host.startsWith("mobile.")) { | ||
start = 7; | ||
} else if (host.startsWith("m.")) { | ||
start = 2; | ||
} | ||
|
||
return host.substring(start); | ||
} | ||
} |