Skip to content
This repository has been archived by the owner on Mar 23, 2022. It is now read-only.

Commit

Permalink
Replace kiwi protocols with agregore
Browse files Browse the repository at this point in the history
  • Loading branch information
makew0rld committed Mar 9, 2022
1 parent 7059395 commit e6db46a
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2190,7 +2190,7 @@ public boolean handleBackPressed() {
getCurrentTabModel().closeTab(currentTab);
return true;
}
final boolean extensionUrl = currentTab.getUrl().getSpec().startsWith("chrome-extension://") || currentTab.getUrl().getSpec().startsWith("kiwi-extension://");
final boolean extensionUrl = currentTab.getUrl().getSpec().startsWith("chrome-extension://") || currentTab.getUrl().getSpec().startsWith("agregore-extension://");
if (type == TabLaunchType.FROM_CHROME_UI && extensionUrl) {
getCurrentTabModel().closeTab(currentTab);
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public static void Execute(Tab tab) {
}
if (tab != null && (tab.getUrl().getSpec().startsWith("chrome://")
|| tab.getUrl().getSpec().startsWith("chrome-extension://")
|| tab.getUrl().getSpec().startsWith("kiwi://"))) {
tab.getWebContents().evaluateJavaScript("(function() { if (!document.location.href.includes('chrome://') && !document.location.href.includes('chrome-extension://') && !document.location.href.includes('kiwi://')) { return; } " + ADAPT_TO_MOBILE_VIEWPORT + "})();", null);
|| tab.getUrl().getSpec().startsWith("agregore://"))) {
tab.getWebContents().evaluateJavaScript("(function() { if (!document.location.href.includes('chrome://') && !document.location.href.includes('chrome-extension://') && !document.location.href.includes('agregore://')) { return; } " + ADAPT_TO_MOBILE_VIEWPORT + "})();", null);
}
if (tab != null && ContextUtils.getAppSharedPreferences().getBoolean("accept_cookie_consent", true) && (tab.getUrl().getSpec().startsWith("http://") || tab.getUrl().getSpec().startsWith("https://"))) {
tab.getWebContents().evaluateJavaScript("(function(){function clickItem(elem) { elem.click(); } function acceptViaAPIs(){typeof window.__cmpui=='function'&&window.__cmpui('setAndSaveAllConsent',!0);typeof window.Didomi=='object'&&window.Didomi.setUserAgreeToAll()}window.globalObserver=null;function setupObserver(){if(!window.globalObserver){var newelem=document.createElement('style');newelem.innerHTML='.qc-cmp-showing { visibility: hidden !important; } body.didomi-popup-open { overflow: auto !important; } #didomi-host { visibility: hidden !important; }';document.body.appendChild(newelem);var MutationObserver=window.MutationObserver||window.WebKitMutationObserver;window.globalObserver=new MutationObserver(check);window.globalObserver.observe(window.document.documentElement,{childList:true,subtree:true});window.setTimeout(function(){window.globalObserver.disconnect();window.globalObserver=null},15000)}check()}function check(){window.setTimeout(function(){var listeners=[];listeners.push({selector:'#qcCmpUi',fn:acceptViaAPIs});listeners.push({selector:'#didomi-popup',fn:acceptViaAPIs});listeners.push({selector: '.accept-cookies-button,#purch-gdpr-banner__accept-button,#bbccookies-continue-button,.user-action--accept,.consent-accept,.bcpConsentOKButton,.button.accept,#footer_tc_privacy_button,button[aria-label=\"Button to collapse the message\"],.gdpr-form>.btn[value=\"Continue\"],button[on^=\"tap:\"][on$=\".accept\"],button[on^=\"tap:\"][on$=\".dismiss\"],.js-cookies-button,.app-offer__close_js,.lg-cc__button_type_action',fn: clickItem});for(var i=0,len=listeners.length,listener,elements;i<len;i++){listener=listeners[i];elements=window.document.querySelectorAll(listener.selector);for(var j=0,jLen=elements.length,element;j<jLen;j++){element=elements[j];if(!element.ready){element.ready=true;listener.fn.call(element, element)}}}},5)}window.addEventListener('DOMContentLoaded',setupObserver);check()})();", null);
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/autocomplete/in_memory_url_index_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ KeyedService* InMemoryURLIndexFactory::BuildServiceInstanceFor(
Profile* profile = Profile::FromBrowserContext(context);
SchemeSet chrome_schemes_to_whitelist;
chrome_schemes_to_whitelist.insert(content::kChromeUIScheme);
chrome_schemes_to_whitelist.insert("kiwi");
chrome_schemes_to_whitelist.insert("agregore");
InMemoryURLIndex* in_memory_url_index =
new InMemoryURLIndex(BookmarkModelFactory::GetForBrowserContext(profile),
HistoryServiceFactory::GetForProfile(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1299,11 +1299,11 @@ public void onAssistantVoiceSearchServiceChanged() {

@Override
public void loadUrlFromVoice(String url) {
if (url.startsWith("kiwi://")) {
url = UrlBarData.replaceOnce(url, "kiwi://", "chrome://");
if (url.startsWith("agregore://")) {
url = UrlBarData.replaceOnce(url, "agregore://", "chrome://");
}
if (url.startsWith("kiwi-extension://")) {
url = UrlBarData.replaceOnce(url, "kiwi-extension://", "chrome-extension://");
if (url.startsWith("agregore-extension://")) {
url = UrlBarData.replaceOnce(url, "agregore-extension://", "chrome-extension://");
}
loadUrl(url, PageTransition.TYPED, 0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -727,10 +727,10 @@ public void setGroupCollapsedState(int groupId, boolean state) {
void loadTypedOmniboxText(long eventTime) {
String urlText = mUrlBarEditingTextProvider.getTextWithAutocomplete();
if (urlText.startsWith("chrome://")) {
urlText = UrlBarData.replaceOnce(urlText, "chrome://", "kiwi://");
urlText = UrlBarData.replaceOnce(urlText, "chrome://", "agregore://");
}
if (urlText.startsWith("chrome-extension://")) {
urlText = UrlBarData.replaceOnce(urlText, "chrome-extension://", "kiwi-extension://");
urlText = UrlBarData.replaceOnce(urlText, "chrome-extension://", "agregore-extension://");
}
final String urlTextToLoad = urlText;
cancelAutocompleteRequests();
Expand Down Expand Up @@ -830,10 +830,10 @@ private void loadUrlForOmniboxMatch(int matchPosition, @NonNull AutocompleteMatc
if (url.getSpec().contains(".kiwibrowser.org"))
transition = PageTransition.AUTO_SUBFRAME;
String newUrl = url.getSpec();
if (newUrl.startsWith("kiwi://"))
newUrl = newUrl.replaceFirst("kiwi://", "chrome://");
if (newUrl.startsWith("kiwi-extension://"))
newUrl = newUrl.replaceFirst("kiwi-extension://", "chrome-extension://");
if (newUrl.startsWith("agregore://"))
newUrl = newUrl.replaceFirst("agregore://", "chrome://");
if (newUrl.startsWith("agregore-extension://"))
newUrl = newUrl.replaceFirst("agregore-extension://", "chrome-extension://");
if (suggestion.getDisplayText().startsWith("!")) {
newUrl = "https://www.duckduckgo.com/?q=" + URLEncoder.encode(suggestion.getDisplayText());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ public int getSecurityIconContentDescriptionResourceId() {
@VisibleForTesting
@ConnectionSecurityLevel
int getSecurityLevel(Tab tab, boolean isOfflinePage, @Nullable String publisherUrl) {
if (tab == null || isOfflinePage || (!TextUtils.isEmpty(tab.getUrl().getSpec()) && (tab.getUrl().getSpec().startsWith("chrome-extension") || tab.getUrl().getSpec().startsWith("devtools") || tab.getUrl().getSpec().startsWith("kiwi-extension")))) {
if (tab == null || isOfflinePage || (!TextUtils.isEmpty(tab.getUrl().getSpec()) && (tab.getUrl().getSpec().startsWith("chrome-extension") || tab.getUrl().getSpec().startsWith("devtools") || tab.getUrl().getSpec().startsWith("agregore-extension")))) {
return ConnectionSecurityLevel.NONE;
}

Expand Down Expand Up @@ -575,7 +575,7 @@ int getSecurityIconResource(int securityLevel, boolean isSmallDevice, boolean is
String currentUrl = getCurrentUrl();
if (currentUrl != null && currentUrl.startsWith("chrome-search://"))
skipIconForNeutralState = true;
if (currentUrl != null && currentUrl.startsWith("kiwi-search://"))
if (currentUrl != null && currentUrl.startsWith("agregore-search://"))
skipIconForNeutralState = true;

boolean useLockIconEnabled = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static Origin create(Uri uri) {

// This class can only correctly handle certain origins, see https://crbug.com/1019244.
String scheme = uri.getScheme();
if (!scheme.equals(UrlConstants.HTTP_SCHEME) && !scheme.equals(UrlConstants.HTTPS_SCHEME) && !scheme.equals("chrome-extension") && !scheme.equals("kiwi-extension")) {
if (!scheme.equals(UrlConstants.HTTP_SCHEME) && !scheme.equals(UrlConstants.HTTPS_SCHEME) && !scheme.equals("chrome-extension") && !scheme.equals("agregore-extension")) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class UrlUtilities {
*/
private static final HashSet<String> INTERNAL_SCHEMES =
CollectionUtil.newHashSet(UrlConstants.CHROME_SCHEME, UrlConstants.CHROME_NATIVE_SCHEME,
ContentUrlConstants.ABOUT_SCHEME, "chrome-search", "kiwi", "kiwi-search", "devtools", "chrome-extension");
ContentUrlConstants.ABOUT_SCHEME, "chrome-search", "agregore", "agregore-search", "devtools", "chrome-extension");

private static final String TEL_SCHEME = "tel";

Expand Down Expand Up @@ -121,7 +121,7 @@ public static boolean isInternalScheme(@NonNull GURL gurl) {
return true;
if (gurl.getSpec().startsWith("chrome-search://"))
return true;
if (gurl.getSpec().startsWith("kiwi-search://"))
if (gurl.getSpec().startsWith("agregore-search://"))
return true;
return INTERNAL_SCHEMES.contains(gurl.getScheme());
}
Expand Down Expand Up @@ -280,7 +280,7 @@ public static boolean isNTPUrl(GURL gurl) {
return true;
if (gurl.getSpec().startsWith("chrome-search://"))
return true;
if (gurl.getSpec().startsWith("kiwi-search://"))
if (gurl.getSpec().startsWith("agregore-search://"))
return true;
return UrlConstants.NTP_HOST.equals(gurl.getHost());
}
Expand Down Expand Up @@ -324,9 +324,9 @@ public static boolean isCanonicalizedNTPUrl(String url) {
|| TextUtils.equals(url, "chrome-search://local-ntp/local-ntp.html")
|| TextUtils.equals(url, "chrome-search://local-ntp/incognito-ntp.html")
|| TextUtils.equals(url, "chrome-search://local-ntp/new-ntp.html")
|| TextUtils.equals(url, "kiwi-search://local-ntp/local-ntp.html")
|| TextUtils.equals(url, "kiwi-search://local-ntp/incognito-ntp.html")
|| TextUtils.equals(url, "kiwi-search://local-ntp/new-ntp.html");
|| TextUtils.equals(url, "agregore-search://local-ntp/local-ntp.html")
|| TextUtils.equals(url, "agregore-search://local-ntp/incognito-ntp.html")
|| TextUtils.equals(url, "agregore-search://local-ntp/new-ntp.html");
}

public static String extractPublisherFromPublisherUrl(String publisherUrl) {
Expand Down

0 comments on commit e6db46a

Please sign in to comment.