Skip to content

Commit

Permalink
Merge pull request #19765 from brave/cr118
Browse files Browse the repository at this point in the history
Upgrade from Chromium 117 to Chromium 118
  • Loading branch information
emerick committed Sep 28, 2023
1 parent 11284b6 commit e564b9c
Show file tree
Hide file tree
Showing 526 changed files with 40,197 additions and 2,568 deletions.
2 changes: 2 additions & 0 deletions android/features/tab_ui/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ android_library("java") {
"//chrome/android/features/tab_ui:tab_suggestions_java",
"//chrome/browser/android/lifecycle:java",
"//chrome/browser/browser_controls/android:java",
"//chrome/browser/commerce/merchant_viewer/android:java",
"//chrome/browser/flags:java",
"//chrome/browser/preferences:java",
"//chrome/browser/tabmodel:java",
"//chrome/browser/ui/android/layouts:java",
"//chrome/browser/ui/android/theme:java",
"//chrome/browser/ui/android/toolbar:java",
"//chrome/browser/ui/messages/android:java",
Expand Down
10 changes: 1 addition & 9 deletions android/java/apk_for_test.flags
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,6 @@
public <init>(...);
}

-keep class org.chromium.chrome.browser.omnibox.suggestions.editurl.EditUrlSuggestionProcessor {
public <init>(...);
*** mHasClearedOmniboxForFocus;
}

-keep class org.chromium.chrome.browser.omnibox.suggestions.editurl.BraveEditUrlSuggestionProcessor {
public <init>(...);
}

-keep class org.chromium.chrome.browser.sync.settings.ManageSyncSettings {
*** mGoogleActivityControls;
*** mSyncEncryption;
Expand Down Expand Up @@ -586,6 +577,7 @@
*** mIsTablet;
*** mNativeInitialized;
*** mIsLocationBarFocusedFromNtpScroll;
*** mShouldClearOmniboxOnFocus;
*** mContext;
*** mBrandedColorScheme;
*** mAssistantVoiceSearchServiceSupplier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void alwaysOnTriggered() {
}
});
// Set a handler for SafeBrowsing. It has to be done only once for a process lifetime.
SafeBrowsingApiBridge.setHandler(BraveSafeBrowsingApiHandler.getInstance());
SafeBrowsingApiBridge.setSafetyNetApiHandler(BraveSafeBrowsingApiHandler.getInstance());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.RecyclerView.OnScrollListener;

import org.chromium.base.Log;
import org.chromium.base.supplier.ObservableSupplierImpl;
Expand All @@ -40,6 +41,7 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.function.Consumer;

class BraveBookmarkManagerMediator
extends BookmarkManagerMediator implements BraveBookmarkDelegate {
Expand All @@ -61,12 +63,12 @@ class BraveBookmarkManagerMediator
BookmarkUndoController bookmarkUndoController, ModelList modelList,
BookmarkUiPrefs bookmarkUiPrefs, Runnable hideKeyboardRunnable,
BookmarkImageFetcher bookmarkImageFetcher, ShoppingService shoppingService,
SnackbarManager snackbarManager) {
SnackbarManager snackbarManager, Consumer<OnScrollListener> onScrollListenerConsumer) {
super(context, bookmarkModel, bookmarkOpener, selectableListLayout, selectionDelegate,
recyclerView, dragReorderableRecyclerViewAdapter, largeIconBridge, isDialogUi,
isIncognito, backPressStateSupplier, profile, bookmarkUndoController, modelList,
bookmarkUiPrefs, hideKeyboardRunnable, bookmarkImageFetcher, shoppingService,
snackbarManager);
snackbarManager, onScrollListenerConsumer);
}

public void setWindow(ActivityWindowAndroid window) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ class BraveBookmarkToolbarCoordinator extends BookmarkToolbarCoordinator {
DragReorderableRecyclerViewAdapter dragReorderableRecyclerViewAdapter,
boolean isDialogUi, OneshotSupplier<BookmarkDelegate> bookmarkDelegateSupplier,
BookmarkModel bookmarkModel, BookmarkOpener bookmarkOpener,
BookmarkUiPrefs bookmarkUiPrefs, ModalDialogManager modalDialogManager) {
BookmarkUiPrefs bookmarkUiPrefs, ModalDialogManager modalDialogManager,
Runnable endSearchRunnable) {
super(context, selectableListLayout, selectionDelegate, searchDelegate,
dragReorderableRecyclerViewAdapter, isDialogUi, bookmarkDelegateSupplier,
bookmarkModel, bookmarkOpener, bookmarkUiPrefs, modalDialogManager);
bookmarkModel, bookmarkOpener, bookmarkUiPrefs, modalDialogManager,
endSearchRunnable);

if (mToolbar instanceof BraveBookmarkToolbar) {
((BraveBookmarkToolbar) mToolbar).setBraveBookmarkDelegate(bookmarkDelegateSupplier);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1092,11 +1092,11 @@ public void initialize(NewTabPageManager manager, Activity activity, Delegate ti
FeedSurfaceScrollDelegate scrollDelegate, TouchEnabledDelegate touchEnabledDelegate,
UiConfig uiConfig, ActivityLifecycleDispatcher lifecycleDispatcher, NewTabPageUma uma,
boolean isIncognito, WindowAndroid windowAndroid, boolean isNtpAsHomeSurfaceEnabled,
boolean isSurfacePolishEnabled, boolean isSurfacePolishOmniboxSizeEnabled) {
boolean isSurfacePolishEnabled, boolean isSurfacePolishOmniboxColorEnabled) {
super.initialize(manager, activity, tileGroupDelegate, searchProviderHasLogo,
searchProviderIsGoogle, scrollDelegate, touchEnabledDelegate, uiConfig,
lifecycleDispatcher, uma, isIncognito, windowAndroid, isNtpAsHomeSurfaceEnabled,
isSurfacePolishEnabled, isSurfacePolishOmniboxSizeEnabled);
isSurfacePolishEnabled, isSurfacePolishOmniboxColorEnabled);

assert mMvTilesContainerLayout != null : "Something has changed in the upstream!";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.chromium.chrome.browser.share.ShareDelegate;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tabmodel.IncognitoStateProvider;
import org.chromium.chrome.browser.tabmodel.TabModelSelector;
import org.chromium.chrome.browser.tabmodel.TabWindowManager;
import org.chromium.components.omnibox.action.OmniboxActionDelegate;
import org.chromium.ui.base.WindowAndroid;
Expand Down Expand Up @@ -66,7 +67,8 @@ public BraveLocationBarCoordinator(View locationBarLayout, View autocompleteAnch
@Nullable BackPressManager backPressManager,
@NonNull OmniboxSuggestionsDropdownScrollListener
omniboxSuggestionsDropdownScrollListener,
@Nullable OpenHistoryClustersDelegate openHistoryClustersDelegate) {
@Nullable OpenHistoryClustersDelegate openHistoryClustersDelegate,
@Nullable ObservableSupplier<TabModelSelector> tabModelSelectorSupplier) {
super(locationBarLayout, autocompleteAnchorView, profileObservableSupplier,
privacyPreferencesManager, locationBarDataProvider, actionModeCallback,
windowDelegate, windowAndroid, activityTabSupplier, modalDialogManagerSupplier,
Expand All @@ -76,7 +78,8 @@ public BraveLocationBarCoordinator(View locationBarLayout, View autocompleteAnch
tabWindowManagerSupplier, bookmarkState, isToolbarMicEnabledSupplier,
merchantTrustSignalsCoordinatorSupplier, omniboxActionDelegate,
browserControlsVisibilityDelegate, reportExceptionCallback, backPressManager,
omniboxSuggestionsDropdownScrollListener, openHistoryClustersDelegate);
omniboxSuggestionsDropdownScrollListener, openHistoryClustersDelegate,
tabModelSelectorSupplier);

if (mLocationBarMediator instanceof BraveLocationBarMediator) {
mQRButton = locationBarLayout.findViewById(R.id.qr_button);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

import androidx.core.widget.ImageViewCompat;

import org.chromium.chrome.browser.omnibox.status.StatusView;

public class BraveLocationBarLayout extends LocationBarLayout {
private ImageButton mQRButton;

Expand All @@ -25,6 +27,14 @@ public BraveLocationBarLayout(Context context, AttributeSet attrs, int layoutId)
mQRButton = findViewById(R.id.qr_button);
}

@Override
protected void onFinishInflate() {
super.onFinishInflate();

StatusView statusView = findViewById(R.id.location_bar_status);
statusView.setBackgroundDrawable(null);
}

void setQRButtonTint(ColorStateList colorStateList) {
ImageViewCompat.setImageTintList(mQRButton, colorStateList);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import org.chromium.base.supplier.ObservableSupplier;
Expand All @@ -20,6 +21,7 @@
import org.chromium.chrome.browser.locale.LocaleManager;
import org.chromium.chrome.browser.privacy.settings.PrivacyPreferencesManager;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.tabmodel.TabModelSelector;
import org.chromium.chrome.browser.theme.ThemeUtils;
import org.chromium.chrome.browser.ui.theme.BrandedColorScheme;
import org.chromium.components.search_engines.TemplateUrlService;
Expand All @@ -36,6 +38,7 @@ public class BraveLocationBarMediator extends LocationBarMediator {
private boolean mIsTablet;
private boolean mNativeInitialized;
private boolean mIsLocationBarFocusedFromNtpScroll;
private boolean mShouldClearOmniboxOnFocus;
private Context mContext;
private @BrandedColorScheme int mBrandedColorScheme = BrandedColorScheme.APP_DEFAULT;

Expand All @@ -52,12 +55,13 @@ public BraveLocationBarMediator(@NonNull Context context,
@NonNull LensController lensController,
@NonNull SaveOfflineButtonState saveOfflineButtonState, @NonNull OmniboxUma omniboxUma,
@NonNull BooleanSupplier isToolbarMicEnabledSupplier,
@NonNull OmniboxSuggestionsDropdownEmbedderImpl dropdownEmbedder) {
@NonNull OmniboxSuggestionsDropdownEmbedderImpl dropdownEmbedder,
@Nullable ObservableSupplier<TabModelSelector> tabModelSelectorSupplier) {
super(context, locationBarLayout, locationBarDataProvider, profileSupplier,
privacyPreferencesManager, overrideUrlLoadingDelegate, localeManager,
templateUrlServiceSupplier, backKeyBehavior, windowAndroid, isTablet,
searchEngineLogoUtils, lensController, saveOfflineButtonState, omniboxUma,
isToolbarMicEnabledSupplier, dropdownEmbedder);
isToolbarMicEnabledSupplier, dropdownEmbedder, tabModelSelectorSupplier);
}

public static Class<OmniboxUma> getOmniboxUmaClass() {
Expand Down Expand Up @@ -165,4 +169,11 @@ private void openQRCodeDialog() {
"BraveLocationBarQRDialogFragment");
}
}

@Override
/*package */ void onUrlFocusChange(boolean hasFocus) {
// We don't want to clear omnibox for focus.
mShouldClearOmniboxOnFocus = false;
super.onUrlFocusChange(hasFocus);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
import org.chromium.chrome.browser.tabmodel.TabModelSelector;
import org.chromium.chrome.browser.tasks.tab_management.TabGroupUi;
import org.chromium.chrome.browser.tasks.tab_management.TabManagementDelegateProvider;
import org.chromium.chrome.browser.tasks.tab_management.TabUiFeatureUtilities;
import org.chromium.chrome.browser.theme.TopUiThemeColorProvider;
import org.chromium.chrome.browser.toolbar.bottom.BottomControlsCoordinator;
import org.chromium.chrome.browser.toolbar.bottom.BottomToolbarConfiguration;
Expand Down Expand Up @@ -211,16 +210,13 @@ public void enableBottomControls() {
(ViewStub) mActivity.findViewById(R.id.bottom_controls_stub);
mBottomControls =
(BraveScrollingBottomViewResourceFrameLayout) bottomControlsStub.inflate();
if (TabUiFeatureUtilities.isTabGroupsAndroidEnabled(mActivity)) {
mTabGroupUi = TabManagementDelegateProvider.getDelegate().createTabGroupUi(
mActivity, mBottomControls.findViewById(R.id.bottom_container_slot),
mBrowserControlsSizer, mIncognitoStateProvider, mScrimCoordinator,
mOmniboxFocusStateSupplier, mBottomSheetController,
mActivityLifecycleDispatcher, mIsWarmOnResumeSupplier, mTabModelSelector,
mTabContentManager, mCompositorViewHolder,
mCompositorViewHolder::getDynamicResourceLoader, mTabCreatorManager,
mLayoutStateProviderSupplier, mSnackbarManager);
}
mTabGroupUi = TabManagementDelegateProvider.getDelegate().createTabGroupUi(mActivity,
mBottomControls.findViewById(R.id.bottom_container_slot), mBrowserControlsSizer,
mIncognitoStateProvider, mScrimCoordinator, mOmniboxFocusStateSupplier,
mBottomSheetController, mActivityLifecycleDispatcher, mIsWarmOnResumeSupplier,
mTabModelSelector, mTabContentManager, mCompositorViewHolder,
mCompositorViewHolder::getDynamicResourceLoader, mTabCreatorManager,
mLayoutStateProviderSupplier, mSnackbarManager);
mBottomControlsCoordinatorSupplier.set(new BraveBottomControlsCoordinator(
mLayoutStateProviderSupplier,
BottomTabSwitcherActionMenuCoordinator.createOnLongClickListener(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import org.chromium.chrome.browser.omnibox.OmniboxFocusReason;
import org.chromium.chrome.browser.tabmodel.IncognitoStateProvider;
import org.chromium.chrome.browser.tasks.ReturnToChromeUtil;
import org.chromium.chrome.browser.tasks.tab_management.TabUiFeatureUtilities;
import org.chromium.chrome.browser.theme.ThemeColorProvider;
import org.chromium.chrome.browser.toolbar.HomeButton;
import org.chromium.chrome.browser.toolbar.LocationBarModel;
Expand Down Expand Up @@ -277,15 +276,7 @@ public void onStartedHiding(@LayoutType int layoutType) {
*/
void setBottomToolbarVisible(boolean isVisible) {
if (mTabSwitcherModeCoordinator != null) {
try {
ChromeActivity activity = BraveActivity.getBraveActivity();
mTabSwitcherModeCoordinator.showToolbarOnTop(
!isVisible, TabUiFeatureUtilities.isGridTabSwitcherEnabled(activity));
} catch (BraveActivity.BraveActivityNotFoundException e) {
Log.e(TAG, "setBottomToolbarVisible " + e);
mTabSwitcherModeCoordinator.showToolbarOnTop(
!isVisible, TabUiFeatureUtilities.isGridTabSwitcherEnabled(mContext));
}
mTabSwitcherModeCoordinator.showToolbarOnTop(!isVisible, true);
}
mBrowsingModeCoordinator.onVisibilityChanged(isVisible);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ class BraveTabSwitcherModeTTCoordinator extends TabSwitcherModeTTCoordinator {
private MenuButtonCoordinator mBraveMenuButtonCoordinator;

BraveTabSwitcherModeTTCoordinator(ViewStub tabSwitcherToolbarStub,
ViewStub tabSwitcherFullscreenToolbarStub, MenuButtonCoordinator menuButtonCoordinator,
boolean isGridTabSwitcherEnabled, boolean isTabToGtsAnimationEnabled,
MenuButtonCoordinator menuButtonCoordinator, boolean isTabToGtsAnimationEnabled,
BooleanSupplier isIncognitoModeEnabledSupplier,
ToolbarColorObserverManager toolbarColorObserverManager) {
super(tabSwitcherToolbarStub, tabSwitcherFullscreenToolbarStub, menuButtonCoordinator,
isGridTabSwitcherEnabled, isTabToGtsAnimationEnabled,
super(tabSwitcherToolbarStub, menuButtonCoordinator, isTabToGtsAnimationEnabled,
isIncognitoModeEnabledSupplier, toolbarColorObserverManager);

mBraveMenuButtonCoordinator = menuButtonCoordinator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class BraveTopToolbarCoordinator extends TopToolbarCoordinator {
private ObservableSupplier<Integer> mConstraintsProxy;

public BraveTopToolbarCoordinator(ToolbarControlContainer controlContainer,
ViewStub toolbarStub, ViewStub fullscreenToolbarStub, ToolbarLayout toolbarLayout,
ViewStub toolbarStub, ToolbarLayout toolbarLayout,
ToolbarDataProvider toolbarDataProvider, ToolbarTabController tabController,
UserEducationHelper userEducationHelper, List<ButtonDataProvider> buttonDataProviders,
OneshotSupplier<LayoutStateProvider> layoutStateProviderSupplier,
Expand All @@ -61,9 +61,8 @@ public BraveTopToolbarCoordinator(ToolbarControlContainer controlContainer,
ButtonDataProvider identityDiscController, Callback<Runnable> invalidatorCallback,
Supplier<ButtonData> identityDiscButtonSupplier,
Supplier<ResourceManager> resourceManagerSupplier,
BooleanSupplier isIncognitoModeEnabledSupplier, boolean isGridTabSwitcherEnabled,
boolean isTabToGtsAnimationEnabled, boolean isStartSurfaceEnabled,
boolean isTabGroupsAndroidContinuationEnabled, HistoryDelegate historyDelegate,
BooleanSupplier isIncognitoModeEnabledSupplier, boolean isTabToGtsAnimationEnabled,
boolean isStartSurfaceEnabled, HistoryDelegate historyDelegate,
BooleanSupplier partnerHomepageEnabledSupplier, OfflineDownloader offlineDownloader,
boolean initializeWithIncognitoColors,
Callback<LoadUrlParams> startSurfaceLogoClickedCallback,
Expand All @@ -72,19 +71,18 @@ public BraveTopToolbarCoordinator(ToolbarControlContainer controlContainer,
BrowserStateBrowserControlsVisibilityDelegate
browserStateBrowserControlsVisibilityDelegate,
boolean shouldCreateLogoInStartToolbar, FullscreenManager fullscreenManager) {
super(controlContainer, toolbarStub, fullscreenToolbarStub, toolbarLayout,
toolbarDataProvider, tabController, userEducationHelper, buttonDataProviders,
layoutStateProviderSupplier, normalThemeColorProvider, overviewThemeColorProvider,
super(controlContainer, toolbarStub, toolbarLayout, toolbarDataProvider, tabController,
userEducationHelper, buttonDataProviders, layoutStateProviderSupplier,
normalThemeColorProvider, overviewThemeColorProvider,
browsingModeMenuButtonCoordinator, overviewModeMenuButtonCoordinator,
appMenuButtonHelperSupplier, tabModelSelectorSupplier, homepageEnabledSupplier,
identityDiscController, invalidatorCallback, identityDiscButtonSupplier,
resourceManagerSupplier, isIncognitoModeEnabledSupplier, isGridTabSwitcherEnabled,
isTabToGtsAnimationEnabled, isStartSurfaceEnabled,
isTabGroupsAndroidContinuationEnabled, historyDelegate,
partnerHomepageEnabledSupplier, offlineDownloader, initializeWithIncognitoColors,
startSurfaceLogoClickedCallback, isStartSurfaceRefactorEnabled, constraintsSupplier,
compositorInMotionSupplier, browserStateBrowserControlsVisibilityDelegate,
shouldCreateLogoInStartToolbar, fullscreenManager);
resourceManagerSupplier, isIncognitoModeEnabledSupplier, isTabToGtsAnimationEnabled,
isStartSurfaceEnabled, historyDelegate, partnerHomepageEnabledSupplier,
offlineDownloader, initializeWithIncognitoColors, startSurfaceLogoClickedCallback,
isStartSurfaceRefactorEnabled, constraintsSupplier, compositorInMotionSupplier,
browserStateBrowserControlsVisibilityDelegate, shouldCreateLogoInStartToolbar,
fullscreenManager);

mBraveToolbarLayout = toolbarLayout;
mBraveMenuButtonCoordinator = browsingModeMenuButtonCoordinator;
Expand All @@ -94,8 +92,7 @@ public BraveTopToolbarCoordinator(ToolbarControlContainer controlContainer,
if (!isStartSurfaceEnabled) {
mTabSwitcherModeCoordinator = new BraveTabSwitcherModeTTCoordinator(
controlContainer.getRootView().findViewById(R.id.tab_switcher_toolbar_stub),
fullscreenToolbarStub, overviewModeMenuButtonCoordinator,
isGridTabSwitcherEnabled, isTabToGtsAnimationEnabled,
overviewModeMenuButtonCoordinator, isTabToGtsAnimationEnabled,
isIncognitoModeEnabledSupplier, mToolbarColorObserverManager);
}
}
Expand Down
Loading

0 comments on commit e564b9c

Please sign in to comment.