Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade from Chromium 87 to Chromium 88.0.4324.79 (1.19.x). #7518

Merged
merged 16 commits into from
Jan 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ java_cpp_enum("brave_android_java_enums_srcjar") {
}

java_cpp_template("brave_config_java") {
package_path = "org/chromium/chrome/browser"
sources = [ "//brave/build/android/java/templates/BraveConfig.template" ]
defines = [
"BRAVE_ANDROID_DEVELOPER_OPTIONS_CODE=\"$brave_android_developer_options_code\"",
Expand Down
3 changes: 2 additions & 1 deletion android/brave_java_sources.gni
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ brave_java_sources = [
"../../brave/android/java/org/chromium/chrome/browser/download/settings/BraveDownloadSettings.java",
"../../brave/android/java/org/chromium/chrome/browser/externalnav/BraveExternalNavigationHandler.java",
"../../brave/android/java/org/chromium/chrome/browser/feedback/BraveHelpAndFeedbackLauncherImpl.java",
"../../brave/android/java/org/chromium/chrome/browser/help/BraveHelpAndFeedback.java",
"../../brave/android/java/org/chromium/chrome/browser/help/BraveHelpAndFeedbackLauncher.java",
"../../brave/android/java/org/chromium/chrome/browser/homepage/BraveHomepageManager.java",
"../../brave/android/java/org/chromium/chrome/browser/homepage/settings/BraveHomepageSettings.java",
"../../brave/android/java/org/chromium/chrome/browser/informers/BraveP3AInformers.java",
Expand Down Expand Up @@ -165,6 +165,7 @@ brave_java_sources = [
"../../brave/android/java/org/chromium/chrome/browser/toolbar/bottom/BottomToolbarVariationManager.java",
"../../brave/android/java/org/chromium/chrome/browser/toolbar/bottom/BraveBottomControlsCoordinator.java",
"../../brave/android/java/org/chromium/chrome/browser/toolbar/bottom/BraveBottomControlsMediator.java",
"../../brave/android/java/org/chromium/chrome/browser/toolbar/bottom/BraveScrollingBottomViewResourceFrameLayout.java",
"../../brave/android/java/org/chromium/chrome/browser/toolbar/bottom/BrowsingModeBottomToolbarCoordinator.java",
"../../brave/android/java/org/chromium/chrome/browser/toolbar/bottom/BrowsingModeBottomToolbarLinearLayout.java",
"../../brave/android/java/org/chromium/chrome/browser/toolbar/bottom/BrowsingModeBottomToolbarMediator.java",
Expand Down
9 changes: 6 additions & 3 deletions android/java/apk_for_test.flags
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,15 @@
}

-keep class org.chromium.chrome.browser.toolbar.ToolbarManager {
*** mBottomControlsCoordinator;
*** mBottomControlsCoordinatorSupplier;
*** mCallbackController;
*** mBrowserControlsSizer;
*** mFullscreenManager;
*** mActivityTabProvider;
*** mAppThemeColorProvider;
*** mShareDelegateSupplier;
*** mScrimCoordinator;
*** mActivity;
*** mShowStartSurfaceSupplier;
*** mOverviewModeBehaviorSupplier;
*** mMenuButtonCoordinator;
*** mToolbarTabController;
*** mLocationBar;
Expand Down Expand Up @@ -128,3 +127,7 @@
-keep class org.chromium.chrome.browser.download.MimeUtils {
*** canAutoOpenMimeType(...);
}

-keep class org.chromium.chrome.browser.app.ChromeActivity {
*** mTabModelProfileSupplier;
}
11 changes: 2 additions & 9 deletions android/java/org/chromium/chrome/browser/BraveAppHooks.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,16 @@

package org.chromium.chrome.browser;

import org.chromium.chrome.browser.feedback.BraveHelpAndFeedbackLauncherImpl;
import org.chromium.chrome.browser.feedback.HelpAndFeedbackLauncher;
import org.chromium.chrome.browser.help.BraveHelpAndFeedback;
import org.chromium.chrome.browser.help.HelpAndFeedback;
import org.chromium.chrome.browser.help.BraveHelpAndFeedbackLauncher;
import org.chromium.chrome.browser.partnerbookmarks.PartnerBookmark;
import org.chromium.chrome.browser.partnercustomizations.BravePartnerBrowserCustomizations;
import org.chromium.chrome.browser.partnercustomizations.PartnerBrowserCustomizations;

public class BraveAppHooks extends AppHooksImpl {
@Override
public HelpAndFeedback createHelpAndFeedback() {
return new BraveHelpAndFeedback();
}

@Override
public HelpAndFeedbackLauncher createHelpAndFeedbackLauncher() {
return new BraveHelpAndFeedbackLauncherImpl();
return new BraveHelpAndFeedbackLauncher();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TabImpl;
import org.chromium.chrome.browser.ui.favicon.IconType;
import org.chromium.chrome.browser.ui.favicon.LargeIconBridge;
import org.chromium.components.browser_ui.widget.RoundedIconGenerator;
import org.chromium.components.favicon.IconType;
import org.chromium.components.favicon.LargeIconBridge;
import org.chromium.url.GURL;

import java.math.BigDecimal;
Expand Down
17 changes: 12 additions & 5 deletions android/java/org/chromium/chrome/browser/app/BraveActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.chromium.base.IntentUtils;
import org.chromium.base.Log;
import org.chromium.base.annotations.JNINamespace;
import org.chromium.base.supplier.ObservableSupplier;
import org.chromium.base.task.PostTask;
import org.chromium.base.task.TaskTraits;
import org.chromium.chrome.R;
Expand Down Expand Up @@ -63,11 +64,13 @@
import org.chromium.chrome.browser.preferences.BravePreferenceKeys;
import org.chromium.chrome.browser.preferences.Pref;
import org.chromium.chrome.browser.preferences.SharedPreferencesManager;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.rate.RateDialogFragment;
import org.chromium.chrome.browser.rate.RateUtils;
import org.chromium.chrome.browser.settings.BraveRewardsPreferences;
import org.chromium.chrome.browser.settings.BraveSearchEngineUtils;
import org.chromium.chrome.browser.share.ShareDelegate;
import org.chromium.chrome.browser.share.ShareDelegateImpl.ShareOrigin;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TabImpl;
import org.chromium.chrome.browser.tab.TabLaunchType;
Expand All @@ -83,6 +86,7 @@
import org.chromium.components.bookmarks.BookmarkId;
import org.chromium.components.bookmarks.BookmarkType;
import org.chromium.components.embedder_support.util.UrlConstants;
import org.chromium.components.embedder_support.util.UrlUtilities;
import org.chromium.components.search_engines.TemplateUrl;
import org.chromium.components.user_prefs.UserPrefs;
import org.chromium.ui.widget.Toast;
Expand Down Expand Up @@ -123,6 +127,10 @@ public abstract class BraveActivity<C extends ChromeActivityComponent> extends C
public static final String ANDROID_PACKAGE_NAME = "android";
public static final String BRAVE_BLOG_URL = "http://www.brave.com/blog";

// Explicitly declare this variable to avoid build errors.
// It will be removed in asm and parent variable will be used instead.
protected ObservableSupplier<Profile> mTabModelProfileSupplier;

private static final List<String> yandexRegions =
Arrays.asList("AM", "AZ", "BY", "KG", "KZ", "MD", "RU", "TJ", "TM", "UZ");

Expand All @@ -143,7 +151,7 @@ public boolean onMenuOrKeyboardAction(int id, boolean fromMenu) {
// Handle items replaced by Brave.
if (id == R.id.info_menu_id && currentTab != null) {
ShareDelegate shareDelegate = (ShareDelegate) getShareDelegateSupplier().get();
shareDelegate.share(currentTab, false);
shareDelegate.share(currentTab, false, ShareOrigin.OVERFLOW_MENU);
return true;
}

Expand Down Expand Up @@ -382,7 +390,7 @@ private void checkForNotificationData() {
case RetentionNotificationUtil.BRAVE_STATS_TIME:
if (getActivityTab() != null
&& getActivityTab().getUrlString() != null
&& !NewTabPage.isNTPUrl(getActivityTab().getUrlString())) {
&& !UrlUtilities.isNTPUrl(getActivityTab().getUrlString())) {
getTabCreator(false).launchUrl(UrlConstants.NTP_URL, TabLaunchType.FROM_CHROME_UI);
}
break;
Expand All @@ -399,7 +407,7 @@ public void checkForBraveStats() {
if (OnboardingPrefManager.getInstance().isBraveStatsEnabled()) {
BraveStatsUtil.showBraveStats();
} else {
if (!NewTabPage.isNTPUrl(getActivityTab().getUrlString())) {
if (!UrlUtilities.isNTPUrl(getActivityTab().getUrlString())) {
OnboardingPrefManager.getInstance().setFromNotification(true);
getTabCreator(false).launchUrl(UrlConstants.NTP_URL, TabLaunchType.FROM_CHROME_UI);
} else {
Expand Down Expand Up @@ -497,9 +505,8 @@ private void handleBraveSetDefaultBrowserDialog() {
View layout = inflater.inflate(R.layout.brave_set_default_browser_dialog,
(ViewGroup) findViewById(R.id.brave_set_default_browser_toast_container));

Toast toast = new Toast(context);
Toast toast = new Toast(context, layout);
toast.setDuration(Toast.LENGTH_LONG);
toast.setView(layout);
toast.setGravity(Gravity.TOP, 0, 40);
toast.show();
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(BRAVE_BLOG_URL));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.chromium.chrome.browser.toolbar.menu_button.BraveMenuButtonCoordinator;
import org.chromium.chrome.browser.ui.appmenu.AppMenuDelegate;
import org.chromium.chrome.browser.ui.appmenu.AppMenuHandler;
import org.chromium.ui.modaldialog.ModalDialogManager;

public class BraveTabbedAppMenuPropertiesDelegate extends TabbedAppMenuPropertiesDelegate {
private Menu mMenu;
Expand All @@ -43,10 +44,11 @@ public BraveTabbedAppMenuPropertiesDelegate(Context context,
TabModelSelector tabModelSelector, ToolbarManager toolbarManager, View decorView,
AppMenuDelegate appMenuDelegate,
OneshotSupplier<OverviewModeBehavior> overviewModeBehaviorSupplier,
ObservableSupplier<BookmarkBridge> bookmarkBridgeSupplier) {
ObservableSupplier<BookmarkBridge> bookmarkBridgeSupplier,
ModalDialogManager modalDialogManager) {
super(context, activityTabProvider, multiWindowModeStateDispatcher, tabModelSelector,
toolbarManager, decorView, appMenuDelegate, overviewModeBehaviorSupplier,
bookmarkBridgeSupplier);
bookmarkBridgeSupplier, modalDialogManager);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@

import org.chromium.base.Log;
import org.chromium.chrome.browser.feedback.FeedbackCollector;
import org.chromium.chrome.browser.feedback.HelpAndFeedbackLauncherImpl;

import javax.annotation.Nonnull;

public class BraveHelpAndFeedback extends HelpAndFeedback {
public class BraveHelpAndFeedbackLauncher extends HelpAndFeedbackLauncherImpl {
protected static final String FALLBACK_SUPPORT_URL = "https://community.brave.com/";
private static final String TAG = "BraveHelpAndFeedback";
private static final String TAG = "BraveHelpAndFeedbackLauncher";

@Override
protected void show(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@
import org.chromium.base.Log;
import org.chromium.base.ThreadUtils;
import org.chromium.base.task.AsyncTask;
import org.chromium.chrome.browser.app.BraveActivity;
import org.chromium.chrome.browser.BraveAdsNativeHelper;
import org.chromium.chrome.browser.BraveFeatureList;
import org.chromium.chrome.browser.app.BraveActivity;
import org.chromium.chrome.browser.brave_stats.BraveStatsUtil;
import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.notifications.BraveSetDefaultBrowserNotificationService;
import org.chromium.chrome.browser.ntp.NewTabPage;
import org.chromium.chrome.browser.onboarding.OnboardingPrefManager;
import org.chromium.chrome.browser.preferences.BravePref;
import org.chromium.components.user_prefs.UserPrefs;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.tab.TabLaunchType;
import org.chromium.components.embedder_support.util.UrlConstants;
import org.chromium.components.embedder_support.util.UrlUtilities;
import org.chromium.components.user_prefs.UserPrefs;

public class RetentionNotificationPublisher extends BroadcastReceiver {
private static final String NOTIFICATION_CHANNEL_NAME = "brave";
Expand Down Expand Up @@ -58,7 +58,7 @@ public void onReceive(Context context, Intent intent) {
case RetentionNotificationUtil.BRAVE_STATS_TIME:
if (braveActivity.getActivityTab() != null
&& braveActivity.getActivityTab().getUrlString() != null
&& !NewTabPage.isNTPUrl(braveActivity.getActivityTab().getUrlString())) {
&& !UrlUtilities.isNTPUrl(braveActivity.getActivityTab().getUrlString())) {
braveActivity.getTabCreator(false).launchUrl(UrlConstants.NTP_URL, TabLaunchType.FROM_CHROME_UI);
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import org.chromium.chrome.browser.omnibox.suggestions.UrlBarDelegate;
import org.chromium.chrome.browser.share.ShareDelegate;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.ui.favicon.LargeIconBridge;
import org.chromium.components.favicon.LargeIconBridge;

public class BraveEditUrlSuggestionProcessor extends EditUrlSuggestionProcessor {
private boolean mHasClearedOmniboxForFocus;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@

@JNINamespace("chrome::android")
public class BraveShieldsContentSettings {
static public final String RESOURCE_IDENTIFIER_ADS = "ads";
static public final String RESOURCE_IDENTIFIER_ADS = "shieldsAds";
static public final String RESOURCE_IDENTIFIER_TRACKERS = "trackers";
static public final String RESOURCE_IDENTIFIER_ADS_TRACKERS = "ads_trackers";
static public final String RESOURCE_IDENTIFIER_DATA_SAVED = "data_saved";
static public final String RESOURCE_IDENTIFIER_HTTP_UPGRADABLE_RESOURCES = "httpUpgradableResources";
static public final String RESOURCE_IDENTIFIER_BRAVE_SHIELDS = "braveShields";
static public final String RESOURCE_IDENTIFIER_FINGERPRINTING = "fingerprinting";
static public final String RESOURCE_IDENTIFIER_COOKIES = "cookies";
static public final String RESOURCE_IDENTIFIER_COOKIES = "shieldsCookies";
static public final String RESOURCE_IDENTIFIER_REFERRERS = "referrers";
static public final String RESOURCE_IDENTIFIER_JAVASCRIPTS = "javascript";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public boolean onPreferenceClick(Preference preference) {
RateDialogFragment mRateDialogFragment = new RateDialogFragment();
mRateDialogFragment.setCancelable(false);
mRateDialogFragment.setArguments(bundle);
mRateDialogFragment.show(getActivity().getSupportFragmentManager(), "RateDialogFragment");
mRateDialogFragment.show(getParentFragmentManager(), "RateDialogFragment");
return true;
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,19 @@
import org.chromium.chrome.browser.compositor.bottombar.ephemeraltab.EphemeralTabCoordinator;
import org.chromium.chrome.browser.compositor.layouts.OverviewModeBehavior;
import org.chromium.chrome.browser.contextualsearch.ContextualSearchManager;
import org.chromium.chrome.browser.intent.IntentMetadata;
import org.chromium.chrome.browser.layouts.LayoutStateProvider;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.share.ShareDelegate;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tabmodel.TabModelSelector;
import org.chromium.chrome.browser.toolbar.bottom.BottomToolbarConfiguration;
import org.chromium.chrome.features.start_surface.StartSurface;

public class BraveTabbedRootUiCoordinator extends TabbedRootUiCoordinator {
public BraveTabbedRootUiCoordinator(ChromeActivity activity,
Callback<Boolean> onOmniboxFocusChangedListener,
ObservableSupplier<Boolean> intentWithEffect,
OneshotSupplier<IntentMetadata> intentMetadataOneshotSupplier,
ObservableSupplier<ShareDelegate> shareDelegateSupplier,
ActivityTabProvider tabProvider,
ObservableSupplierImpl<EphemeralTabCoordinator> ephemeralTabCoordinatorSupplier,
Expand All @@ -34,11 +37,14 @@ public BraveTabbedRootUiCoordinator(ChromeActivity activity,
OneshotSupplier<OverviewModeBehavior> overviewModeBehaviorSupplier,
Supplier<ContextualSearchManager> contextualSearchManagerSupplier,
ObservableSupplier<TabModelSelector> tabModelSelectorSupplier,
OneshotSupplier<StartSurface> startSurfaceSupplier) {
super(activity, onOmniboxFocusChangedListener, intentWithEffect, shareDelegateSupplier,
tabProvider, ephemeralTabCoordinatorSupplier, profileSupplier,
bookmarkBridgeSupplier, overviewModeBehaviorSupplier,
contextualSearchManagerSupplier, tabModelSelectorSupplier, startSurfaceSupplier);
OneshotSupplier<StartSurface> startSurfaceSupplier,
OneshotSupplier<LayoutStateProvider> layoutStateProviderOneshotSupplier,
Supplier<Tab> startSurfaceParentTabSupplier) {
super(activity, onOmniboxFocusChangedListener, intentMetadataOneshotSupplier,
shareDelegateSupplier, tabProvider, ephemeralTabCoordinatorSupplier,
profileSupplier, bookmarkBridgeSupplier, overviewModeBehaviorSupplier,
contextualSearchManagerSupplier, tabModelSelectorSupplier, startSurfaceSupplier,
layoutStateProviderOneshotSupplier, startSurfaceParentTabSupplier);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,36 @@
package org.chromium.chrome.browser.toolbar;

import android.content.Context;
import android.content.res.ColorStateList;
import android.util.AttributeSet;

import androidx.core.content.ContextCompat;

import org.chromium.chrome.R;
import org.chromium.chrome.browser.homepage.HomepageManager;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.chrome.browser.toolbar.ThemeColorProvider.TintObserver;

/**
* Brave's extension of HomeButton.
*/
public class BraveHomeButton extends HomeButton {
private Context mContext;
public class BraveHomeButton extends HomeButton implements TintObserver {
private ThemeColorProvider mThemeColorProvider;

public BraveHomeButton(Context context, AttributeSet attrs) {
super(context, attrs);
mContext = context;
}

/**
* Override to swap icon to new_tab_icon and enable the button when
* homepage is disabled.
*/
public void setThemeColorProvider(ThemeColorProvider themeColorProvider) {
mThemeColorProvider = themeColorProvider;
mThemeColorProvider.addTintObserver(this);
}

@Override
public void updateButtonEnabledState(Tab tab) {
super.updateButtonEnabledState(tab);

final boolean isHomepageEnabled = HomepageManager.isHomepageEnabled();
if (!isHomepageEnabled) {
setImageDrawable(ContextCompat.getDrawable(mContext, R.drawable.new_tab_icon));
setEnabled(true);
} else { // swap back to home button icon
setImageDrawable(ContextCompat.getDrawable(mContext, R.drawable.btn_toolbar_home));
public void onTintChanged(ColorStateList tint, boolean useLight) {
ApiCompatibilityUtils.setImageTintList(this, tint);
}

public void destroy() {
if (mThemeColorProvider != null) {
mThemeColorProvider.removeTintObserver(this);
mThemeColorProvider = null;
}
}
}
Loading