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 authored Sep 27, 2023
2 parents 77c10bb + 438a3eb commit 4220271
Show file tree
Hide file tree
Showing 529 changed files with 40,210 additions and 2,574 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 @@ -590,6 +581,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 @@ -16,7 +16,6 @@
import org.chromium.chrome.browser.omnibox.LocationBarDataProvider;
import org.chromium.chrome.browser.omnibox.UrlBarEditingTextStateProvider;
import org.chromium.chrome.browser.omnibox.suggestions.basic.BasicSuggestionProcessor.BookmarkState;
import org.chromium.chrome.browser.omnibox.suggestions.brave_search.BraveSearchBannerProcessor;
import org.chromium.chrome.browser.omnibox.suggestions.history_clusters.HistoryClustersProcessor.OpenHistoryClustersDelegate;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
Expand Down Expand Up @@ -57,28 +56,28 @@ public BraveAutocompleteMediator(@NonNull Context context,
}

@Override
public void onTextChanged(String textWithoutAutocomplete, String textWithAutocomplete) {
public void onTextChanged(String textWithoutAutocomplete) {
if (ProfileManager.isInitialized()
&& !UserPrefs.get(Profile.getLastUsedRegularProfile())
.getBoolean(AUTOCOMPLETE_ENABLED)) {
return;
}

super.onTextChanged(textWithoutAutocomplete, textWithAutocomplete);
super.onTextChanged(textWithoutAutocomplete);
}

@Override
public void onUrlFocusChange(boolean hasFocus) {
public void onOmniboxSessionStateChange(boolean activated) {
if (!mNativeInitialized) return;

super.onUrlFocusChange(hasFocus);
super.onOmniboxSessionStateChange(activated);
}

@Override
public void removeBraveSearchSuggestion() {
if (mDropdownViewInfoListManager instanceof BraveDropdownItemViewInfoListManager) {
((BraveDropdownItemViewInfoListManager) mDropdownViewInfoListManager)
.removeSuggestionsForGroup(BraveSearchBannerProcessor.BRAVE_SEARCH_PROMO_GROUP);
.removeBraveSearchSuggestion();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@

class BraveAutocompleteMediatorBase {
void loadUrlForOmniboxMatch(int matchIndex, @NonNull AutocompleteMatch suggestion,
@NonNull GURL url, long inputStart, boolean inVisibleSuggestionList) {
@NonNull GURL url, long inputStart, boolean inVisibleSuggestionList,
boolean openInNewTab) {
BraveReflectionUtil.InvokeMethod(AutocompleteMediator.class, this, "loadUrlForOmniboxMatch",
int.class, matchIndex, AutocompleteMatch.class, suggestion, GURL.class, url,
long.class, inputStart, boolean.class, inVisibleSuggestionList);
long.class, inputStart, boolean.class, inVisibleSuggestionList, boolean.class,
openInNewTab);
if (suggestion.getType() == OmniboxSuggestionType.SEARCH_WHAT_YOU_TYPED
|| suggestion.getType() == OmniboxSuggestionType.SEARCH_SUGGEST) {
Context context = (Context) BraveReflectionUtil.getField(
Expand Down
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
Loading

0 comments on commit 4220271

Please sign in to comment.