Skip to content

Commit

Permalink
Merge pull request #9361 from brave/cr92-1.27.x
Browse files Browse the repository at this point in the history
Upgrade from Chromium 91 to Chromium 92 (1.27.x).
  • Loading branch information
LaurenWags authored Jul 14, 2021
2 parents 8413a5b + 3f26a9d commit d533849
Show file tree
Hide file tree
Showing 938 changed files with 6,687 additions and 5,419 deletions.
6 changes: 4 additions & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,11 @@ disable=print-statement,
exception-escape,
comprehension-escape,
missing-function-docstring,
missing-module-docstring,
missing-module-docstring,
raise-missing-from,
invalid-name
invalid-name,
duplicate-code,
deprecated-method,

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down
2 changes: 2 additions & 0 deletions .storybook/chrome-resources-mock/js/cr.m.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export function addWebUIListener() {}
export function sendWithPromise() {}
1 change: 1 addition & 0 deletions .storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module.exports = async ({ config, mode }) => {
})
config.resolve.alias = {
...config.resolve.alias,
'chrome://resources': path.resolve(__dirname, 'chrome-resources-mock'),
'brave-ui': path.resolve(__dirname, '../node_modules/brave-ui/src'),
// Force same styled-components module for brave-core and brave-ui
// which ensure both repos code use the same singletons, e.g. ThemeContext.
Expand Down
4 changes: 4 additions & 0 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ include_rules = [
"-brave/services",
"-ios",
"-brave/third_party/bitcoin-core",

# Temporary change for the base::Optional -> absl::optional migration, to be
# removed once this rule is allowed in chromium's src/DEPS file.
"+third_party/abseil-cpp/absl/types/optional.h",
]

# Temporary workaround for massive nummber of incorrect test includes
Expand Down
2 changes: 0 additions & 2 deletions android/brave_java_resources.gni
Original file line number Diff line number Diff line change
Expand Up @@ -822,8 +822,6 @@ brave_java_resources = [
"java/res/layout/user_wallet_activity.xml",
"java/res/layout/verify_wallet_activity.xml",
"java/res/layout/wallet_coin_list_item.xml",
"java/res/layout/web_notification_big_brave_ads.xml",
"java/res/layout/web_notification_brave_ads.xml",
"java/res/layout/web_notification_icon_frame_brave.xml",
"java/res/menu/exit_settings_menu.xml",
"java/res/menu/navigation.xml",
Expand Down
3 changes: 1 addition & 2 deletions android/brave_java_sources.gni
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,10 @@ brave_java_sources = [
"../../brave/android/java/org/chromium/chrome/browser/local_database/TopSiteTable.java",
"../../brave/android/java/org/chromium/chrome/browser/night_mode/settings/BraveRadioButtonGroupThemePreference.java",
"../../brave/android/java/org/chromium/chrome/browser/night_mode/settings/BraveThemePreferences.java",
"../../brave/android/java/org/chromium/chrome/browser/notifications/BraveNotificationManagerProxyImpl.java",
"../../brave/android/java/org/chromium/chrome/browser/notifications/BraveNotificationPlatformBridge.java",
"../../brave/android/java/org/chromium/chrome/browser/notifications/BraveNotificationSettingsBridge.java",
"../../brave/android/java/org/chromium/chrome/browser/notifications/BraveOnboardingNotification.java",
"../../brave/android/java/org/chromium/chrome/browser/notifications/BraveSetDefaultBrowserNotificationService.java",
"../../brave/android/java/org/chromium/chrome/browser/notifications/channels/BraveChannelDefinitions.java",
"../../brave/android/java/org/chromium/chrome/browser/notifications/retention/RetentionNotification.java",
"../../brave/android/java/org/chromium/chrome/browser/notifications/retention/RetentionNotificationPublisher.java",
"../../brave/android/java/org/chromium/chrome/browser/notifications/retention/RetentionNotificationUtil.java",
Expand All @@ -115,6 +113,7 @@ brave_java_sources = [
"../../brave/android/java/org/chromium/chrome/browser/ntp_background_images/util/NTPUtil.java",
"../../brave/android/java/org/chromium/chrome/browser/ntp_background_images/util/NewTabPageListener.java",
"../../brave/android/java/org/chromium/chrome/browser/ntp_background_images/util/SponsoredImageUtil.java",
"../../brave/android/java/org/chromium/chrome/browser/omnibox/status/BraveStatusMediator.java",
"../../brave/android/java/org/chromium/chrome/browser/omnibox/suggestions/editurl/BraveEditUrlSuggestionProcessor.java",
"../../brave/android/java/org/chromium/chrome/browser/onboarding/BraveRewardsOnboardingFragment.java",
"../../brave/android/java/org/chromium/chrome/browser/onboarding/OnViewPagerAction.java",
Expand Down
5 changes: 5 additions & 0 deletions android/features/tab_ui/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@ android_library("java") {
"//base:base_java",
"//chrome/android:chrome_java",
"//chrome/android/features/tab_ui:java",
"//chrome/browser/android/lifecycle:java",
"//chrome/browser/flags:java",
"//chrome/browser/preferences:java",
"//chrome/browser/tabmodel:java",
"//chrome/browser/ui/android/theme:java",
"//chrome/browser/ui/messages/android:java",
"//components/browser_ui/bottomsheet/android:java",
"//components/browser_ui/widget/android:java",
"//third_party/androidx:androidx_annotation_annotation_java",
"//ui/android:ui_no_recycler_view_java",
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,53 @@

import static org.chromium.chrome.browser.tasks.tab_management.TabManagementModuleProvider.SYNTHETIC_TRIAL_POSTFIX;

import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;

import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.supplier.ObservableSupplier;
import org.chromium.base.supplier.OneshotSupplier;
import org.chromium.base.supplier.Supplier;
import org.chromium.chrome.browser.compositor.layouts.OverviewModeBehavior;
import org.chromium.chrome.browser.compositor.layouts.content.TabContentManager;
import org.chromium.chrome.browser.lifecycle.ActivityLifecycleDispatcher;
import org.chromium.chrome.browser.share.ShareDelegate;
import org.chromium.chrome.browser.tabmodel.TabCreatorManager;
import org.chromium.chrome.browser.tabmodel.TabModelSelector;
import org.chromium.chrome.browser.theme.ThemeColorProvider;
import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager;
import org.chromium.chrome.tab_ui.R;
import org.chromium.components.browser_ui.bottomsheet.BottomSheetController;
import org.chromium.components.browser_ui.widget.scrim.ScrimCoordinator;
import org.chromium.ui.resources.dynamics.DynamicResourceLoader;
import org.chromium.ui.widget.ChromeImageView;

public class BraveTabGroupUiCoordinator extends TabGroupUiCoordinator {
// To delete in bytecode, members from parent class will be used instead.
private TabGroupUiToolbarView mToolbarView;

public BraveTabGroupUiCoordinator(ViewGroup parentView, ThemeColorProvider themeColorProvider,
ScrimCoordinator scrimCoordinator,
ObservableSupplier<Boolean> omniboxFocusStateSupplier) {
super(parentView, themeColorProvider, scrimCoordinator, omniboxFocusStateSupplier);
public BraveTabGroupUiCoordinator(@NonNull Activity activity, @NonNull ViewGroup parentView,
@NonNull ThemeColorProvider themeColorProvider,
@NonNull ScrimCoordinator scrimCoordinator,
@NonNull ObservableSupplier<Boolean> omniboxFocusStateSupplier,
@NonNull BottomSheetController bottomSheetController,
@NonNull ActivityLifecycleDispatcher activityLifecycleDispatcher,
@NonNull Supplier<Boolean> isWarmOnResumeSupplier,
@NonNull TabModelSelector tabModelSelector,
@NonNull TabContentManager tabContentManager, @NonNull ViewGroup rootView,
@NonNull Supplier<DynamicResourceLoader> dynamicResourceLoaderSupplier,
@NonNull TabCreatorManager tabCreatorManager,
@NonNull Supplier<ShareDelegate> shareDelegateSupplier,
@NonNull OneshotSupplier<OverviewModeBehavior> overviewModeBehaviorSupplier,
@NonNull SnackbarManager snackbarManager) {
super(activity, parentView, themeColorProvider, scrimCoordinator, omniboxFocusStateSupplier,
bottomSheetController, activityLifecycleDispatcher, isWarmOnResumeSupplier,
tabModelSelector, tabContentManager, rootView, dynamicResourceLoaderSupplier,
tabCreatorManager, shareDelegateSupplier, overviewModeBehaviorSupplier,
snackbarManager);

assert mToolbarView != null : "Make sure mToolbarView is properly patched in bytecode.";
mToolbarView.setBackgroundColor(ApiCompatibilityUtils.getColor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

package org.chromium.chrome.browser.tasks.tab_management;

import android.content.Context;

import org.chromium.chrome.browser.flags.CachedFeatureFlags;
import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.preferences.BravePreferenceKeys;
Expand All @@ -14,17 +16,17 @@ public class BraveTabUiFeatureUtilities {
/**
* @return Whether the Grid Tab Switcher UI is enabled and available for use.
*/
public static boolean isGridTabSwitcherEnabled() {
if (!isTabGroupsAndroidEnabled()) {
public static boolean isGridTabSwitcherEnabled(Context context) {
if (!isTabGroupsAndroidEnabled(context)) {
return false;
}
return TabUiFeatureUtilities.isGridTabSwitcherEnabled();
return TabUiFeatureUtilities.isGridTabSwitcherEnabled(context);
}

/**
* @return Whether the tab group feature is enabled and available for use.
*/
public static boolean isTabGroupsAndroidEnabled() {
public static boolean isTabGroupsAndroidEnabled(Context context) {
// For backward compatibility we take value of Tab Grid feature if BRAVE_TAB_GROUPS_ENABLED
// setting hasn't been created. We don't want to rely on Tab Grid feature itself since it
// can be removed in the upstream going forward.
Expand All @@ -40,6 +42,6 @@ public static boolean isTabGroupsAndroidEnabled() {
return false;
}

return TabUiFeatureUtilities.isTabGroupsAndroidEnabled();
return TabUiFeatureUtilities.isTabGroupsAndroidEnabled(context);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.chromium.chrome.R;
import org.chromium.chrome.browser.feed.shared.FeedSurfaceDelegate;
import org.chromium.chrome.browser.native_page.NativePageNavigationDelegate;
import org.chromium.chrome.browser.ntp.NewTabPageLaunchOrigin;
import org.chromium.chrome.browser.ntp.ScrollableContainerDelegate;
import org.chromium.chrome.browser.ntp.SnapScrollHelper;
import org.chromium.chrome.browser.ntp.snippets.SectionHeaderView;
Expand All @@ -42,11 +43,12 @@ public BraveFeedSurfaceCoordinator(Activity activity, SnackbarManager snackbarMa
@Nullable NativePageNavigationDelegate pageNavigationDelegate, Profile profile,
boolean isPlaceholderShownInitially, BottomSheetController bottomSheetController,
Supplier<ShareDelegate> shareDelegateSupplier,
@Nullable ScrollableContainerDelegate externalScrollableContainerDelegate) {
@Nullable ScrollableContainerDelegate externalScrollableContainerDelegate,
TabModelSelector tabModelSelector, @NewTabPageLaunchOrigin int launchOrigin) {
super(activity, snackbarManager, windowAndroid, snapScrollHelper, ntpHeader,
sectionHeaderView, showDarkBackground, delegate, pageNavigationDelegate, profile,
isPlaceholderShownInitially, bottomSheetController, shareDelegateSupplier,
externalScrollableContainerDelegate);
externalScrollableContainerDelegate, tabModelSelector, launchOrigin);
}

@Override
Expand Down
32 changes: 31 additions & 1 deletion android/java/apk_for_test.flags
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,15 @@
}

-keep class org.chromium.chrome.browser.ntp.NewTabPage {
public <init>(...);
*** mNewTabPageLayout;
*** mFeedSurfaceProvider;
}

-keep class org.chromium.chrome.browser.ntp.BraveNewTabPage {
public <init>(...);
}

-keep class org.chromium.chrome.browser.omnibox.suggestions.editurl.EditUrlSuggestionProcessor {
*** mHasClearedOmniboxForFocus;
}
Expand Down Expand Up @@ -111,6 +116,13 @@
*** mIncognitoStateProvider;
*** mTabCountProvider;
*** mTabGroupUi;
*** mBottomSheetController;
*** mActivityLifecycleDispatcher;
*** mIsWarmOnResumeSupplier;
*** mTabContentManager;
*** mTabCreatorManager;
*** mOverviewModeBehaviorSupplier;
*** mSnackbarManager;
*** onOrientationChange(...);
*** updateButtonStatus(...);
*** updateBookmarkButtonStatus(...);
Expand All @@ -132,16 +144,18 @@
*** mToggleTabStackButton;
*** mMenuButton;
*** mShouldShowNewTabVariation;
*** mIsIncognito;
*** updateNewTabButtonVisibility(...);
*** shouldShowIncognitoToggle(...);
*** getToolbarColorForCurrentState(...);
}

-keep class org.chromium.chrome.browser.download.MimeUtils {
*** canAutoOpenMimeType(...);
}

-keep class org.chromium.chrome.browser.app.ChromeActivity {
*** mTabModelProfileSupplier;
*** mBrowserControlsManagerSupplier;
}

-keep class org.chromium.chrome.browser.tabbed_mode.TabbedRootUiCoordinator {
Expand Down Expand Up @@ -292,3 +306,19 @@
*** isGridTabSwitcherEnabled(...);
*** isTabGroupsAndroidEnabled(...);
}

-keep class org.chromium.components.browser_ui.notifications.NotificationManagerProxyImpl {
public <init>(...);
}

-keep class org.chromium.chrome.browser.notifications.BraveNotificationManagerProxyImpl {
public <init>(...);
}

-keep class org.chromium.chrome.browser.omnibox.status.StatusMediator {
public <init>(...);
}

-keep class org.chromium.chrome.browser.omnibox.status.BraveStatusMediator {
public <init>(...);
}
2 changes: 1 addition & 1 deletion android/java/org/chromium/chrome/browser/BraveUphold.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void CompleteUpholdVerification(ExternalNavigationParams params,
mBraveExternalNavigationHandler = handler;
rewardsNativeProxy = BraveRewardsNativeWorker.getInstance();

Uri uri = Uri.parse(params.getUrl());
Uri uri = Uri.parse(params.getUrl().getSpec());
rewardsNativeProxy.AddObserver(this);
String path = uri.getPath();
String query = uri.getQuery();
Expand Down
10 changes: 8 additions & 2 deletions android/java/org/chromium/chrome/browser/app/BraveActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.chromium.base.annotations.JNINamespace;
import org.chromium.base.annotations.NativeMethods;
import org.chromium.base.supplier.ObservableSupplier;
import org.chromium.base.supplier.UnownedUserDataSupplier;
import org.chromium.base.task.PostTask;
import org.chromium.base.task.TaskTraits;
import org.chromium.chrome.R;
Expand Down Expand Up @@ -69,6 +70,7 @@
import org.chromium.chrome.browser.crypto_wallet.CryptoWalletActivity;
import org.chromium.chrome.browser.dependency_injection.ChromeActivityComponent;
import org.chromium.chrome.browser.flags.ChromeSwitches;
import org.chromium.chrome.browser.fullscreen.BrowserControlsManager;
import org.chromium.chrome.browser.informers.BraveAndroidSyncDisabledInformer;
import org.chromium.chrome.browser.notifications.BraveSetDefaultBrowserNotificationService;
import org.chromium.chrome.browser.notifications.retention.RetentionNotificationUtil;
Expand All @@ -88,7 +90,7 @@
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.share.ShareDelegate.ShareOrigin;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TabImpl;
import org.chromium.chrome.browser.tab.TabLaunchType;
Expand Down Expand Up @@ -158,7 +160,7 @@ public abstract class BraveActivity<C extends ChromeActivityComponent>

// 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 UnownedUserDataSupplier<BrowserControlsManager> mBrowserControlsManagerSupplier;

private static final List<String> yandexRegions =
Arrays.asList("AM", "AZ", "BY", "KG", "KZ", "MD", "RU", "TJ", "TM", "UZ");
Expand Down Expand Up @@ -843,6 +845,10 @@ public void hideOverview(LayoutManagerChrome layoutManager) {
}
}

public ObservableSupplier<BrowserControlsManager> getBrowserControlsManagerSupplier() {
return mBrowserControlsManagerSupplier;
}

@NativeMethods
interface Natives {
void restartStatsUpdater();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.chromium.chrome.browser.bookmarks.BookmarkBridge;
import org.chromium.chrome.browser.compositor.layouts.OverviewModeBehavior;
import org.chromium.chrome.browser.feed.webfeed.WebFeedBridge;
import org.chromium.chrome.browser.feed.webfeed.WebFeedSnackbarController;
import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.multiwindow.MultiWindowModeStateDispatcher;
import org.chromium.chrome.browser.notifications.BraveSetDefaultBrowserNotificationService;
Expand All @@ -50,10 +51,13 @@ public BraveTabbedAppMenuPropertiesDelegate(Context context,
AppMenuDelegate appMenuDelegate,
OneshotSupplier<OverviewModeBehavior> overviewModeBehaviorSupplier,
ObservableSupplier<BookmarkBridge> bookmarkBridgeSupplier,
SnackbarManager snackbarManager, WebFeedBridge webFeedBridge) {
WebFeedSnackbarController.FeedLauncher feedLauncher,
ModalDialogManager modalDialogManager, SnackbarManager snackbarManager,
WebFeedBridge webFeedBridge) {
super(context, activityTabProvider, multiWindowModeStateDispatcher, tabModelSelector,
toolbarManager, decorView, appMenuDelegate, overviewModeBehaviorSupplier,
bookmarkBridgeSupplier, snackbarManager, webFeedBridge);
bookmarkBridgeSupplier, feedLauncher, modalDialogManager, snackbarManager,
webFeedBridge);

mAppMenuDelegate = appMenuDelegate;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.chromium.base.supplier.ObservableSupplier;
import org.chromium.base.supplier.OneshotSupplierImpl;
import org.chromium.base.supplier.Supplier;
import org.chromium.chrome.browser.app.BraveActivity;
import org.chromium.chrome.browser.browser_controls.BrowserControlsStateProvider;
import org.chromium.chrome.browser.compositor.LayerTitleCache;
import org.chromium.chrome.browser.compositor.layouts.content.TabContentManager;
Expand All @@ -39,28 +40,28 @@ public BraveLayoutManagerChrome(LayoutManagerHost host, ViewGroup contentContain
ObservableSupplier<TabContentManager> tabContentManagerSupplier,
Supplier<LayerTitleCache> layerTitleCacheSupplier,
OneshotSupplierImpl<OverviewModeBehavior> overviewModeBehaviorSupplier,
OneshotSupplierImpl<LayoutStateProvider> layoutStateProviderOneshotSupplier,
Supplier<TopUiThemeColorProvider> topUiThemeColorProvider) {
super(host, contentContainer, createOverviewLayout, startSurface, tabContentManagerSupplier,
layerTitleCacheSupplier, overviewModeBehaviorSupplier,
layoutStateProviderOneshotSupplier, topUiThemeColorProvider);
layerTitleCacheSupplier, overviewModeBehaviorSupplier, topUiThemeColorProvider);

mCreateOverviewLayout = createOverviewLayout && startSurface == null;
}

@Override
public void init(TabModelSelector selector, TabCreatorManager creator,
ControlContainer controlContainer, DynamicResourceLoader dynamicResourceLoader) {
ControlContainer controlContainer, DynamicResourceLoader dynamicResourceLoader,
TopUiThemeColorProvider topUiColorProvider) {
if (mCreateOverviewLayout) {
Context context = mHost.getContext();
LayoutRenderHost renderHost = mHost.getLayoutRenderHost();
final ObservableSupplier<? extends BrowserControlsStateProvider>
browserControlsSupplier = mHost.getBrowserControlsManagerSupplier();
browserControlsSupplier =
BraveActivity.getBraveActivity().getBrowserControlsManagerSupplier();
mOverviewLayout = new StackLayout(context, this, renderHost,
(ObservableSupplier<BrowserControlsStateProvider>) browserControlsSupplier);
}

super.init(selector, creator, controlContainer, dynamicResourceLoader);
super.init(selector, creator, controlContainer, dynamicResourceLoader, topUiColorProvider);
}

@Override
Expand Down
Loading

0 comments on commit d533849

Please sign in to comment.