Commit 1b4b5576 authored by Peter E Conn's avatar Peter E Conn Committed by Commit Bot

🤝 Add static factory method constructor to Origin.

The factory doesn't do anything at the moment, but I'm going to move
downstream over to use this method before further changes.

Bug: 1018672
Change-Id: I35092af3d0659733eca3587d33ef064c49ca4f8a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1881166Reviewed-by: default avatarRichard Knoll <knollr@chromium.org>
Commit-Queue: Peter Conn <peconn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709837}
parent e9d335e0
......@@ -8,6 +8,8 @@ import android.net.Uri;
import org.chromium.chrome.browser.util.UrlConstants;
import androidx.annotation.Nullable;
/**
* A class to canonically represent a web origin in Java. In comparison to
* {@link org.chromium.net.GURLUtils#getOrigin} it can be used before native is loaded and lets us
......@@ -67,6 +69,23 @@ public class Origin {
mOrigin = origin;
}
/**
* Constructs a canonical Origin from an Uri.
*/
@Nullable
public static Origin create(Uri uri) {
// This method will return null in the near future.
return new Origin(uri);
}
/**
* Constructs a canonical Origin from a String.
*/
@Nullable
public static Origin create(String uri) {
return create(Uri.parse(uri));
}
/**
* Returns whether the Origin is valid.
*/
......
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