Skip to content

Commit

Permalink
Upgrade from Chromium 124 to Chromium 125 (1.66.x). (#23432)
Browse files Browse the repository at this point in the history
* Merge pull request #23049 from brave/ksmith-webui-bubble-mgr

Simplify customization of WebUIBubbleManager

* Merge pull request #22936 from brave/cr125

Upgrade from Chromium 124 to Chromium 125.

* NTP drive module was renamed to file suggestion.

Chromium change:

https://chromium.googlesource.com/chromium/src/+/1af2f445d25a6

commit 1af2f445d25a6f2e12984418df7b9a0bd09d4523
Author: Riley Tatum <rtatum@google.com>
Date:   Mon Apr 8 18:55:34 2024 +0000

    [NTP] Rename drive module to file suggestion for cleaner reuse of code

    This change is helping to prepare for another source for file
    suggestions to be added to the NTP. The other file suggestion source
    will have the same UX; therefore, it would be best to reuse as much code
    as possible.

    Code that can be used across both sources for the module, are changed
    to use the term "file_suggestion" instead of "drive". Code that is
    specific to the Drive source keeps the name "drive". This shouldn't
    change any functionality. It is just meant to make the reuse of this
    code cleaner.

    I left v1 of the module largely alone, since extra source support will
    not be added for the older version of modules .

    Bug: 329897261

* Merge pull request #23429 from brave/sko/spt-resurrect

Fix SharedPinnedTab functionality

* TabStripModel::DetachWebContentsAtForInsertion was removed.

Chromium change:

https://source.chromium.org/chromium/chromium/src/+/afdf1e54a8ef45bfd22ecabfea0012da22bba6a3

commit afdf1e54a8ef45bfd22ecabfea0012da22bba6a3
Author: Erik Chen <erikchen@chromium.org>
Date:   Mon Apr 15 20:56:17 2024 +0000

    Remove TabStripModel::DetachWebContentsAtForInsertion.

    This CL is a refactor with no intended behavior change. This CL removes
    callers of DetachWebContentsAtForInsertion. This also allows
    TabModel::RemoveContents to become private.

    Bug: 1476012

* Disables crashing upstream unit tests.

* Merge pull request #23441 from brave/maxk-fix-bookmarks-folder-color

[cr125 follow up] Fixes bookmarks folder color in the side panel.

* Merge pull request #23497 from brave/bookmarks_panel_checkboux

Fixed bookmarks panel checkbox colors

* Restore .rustfmt.toml patch accidentally removed by cr124 bump.

---------

Co-authored-by: Kevin Smith <zenparsing@gmail.com>
Co-authored-by: Sangwoo Ko <sko@brave.com>
  • Loading branch information
3 people authored May 8, 2024
1 parent b48eb65 commit 65989d9
Show file tree
Hide file tree
Showing 680 changed files with 5,071 additions and 3,063 deletions.
1 change: 1 addition & 0 deletions android/brave_java_sources.gni
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import("//brave/base/brave_base_shared_preferences_java.gni")
import("//brave/browser/brave_ads/android/java_sources.gni")
import("//brave/browser/incognito/android/java_sources.gni")
import("//brave/browser/share/android/java_sources.gni")
import("//brave/browser/tab_ui/android/brave_tab_ui_sources.gni")
import("//brave/components/embedder_support/android/java_sources.gni")
import("//brave/components/permissions/android/java_sources.gni")
import("//brave/components/safetynet/java_sources.gni")
Expand Down
1 change: 1 addition & 0 deletions android/features/tab_ui/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ android_library("java") {
"//chrome/browser/commerce/merchant_viewer/android:java",
"//chrome/browser/flags:java",
"//chrome/browser/preferences:java",
"//chrome/browser/tab_ui/android:java",
"//chrome/browser/tabmodel:java",
"//chrome/browser/ui/android/layouts:java",
"//chrome/browser/ui/android/theme:java",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
import org.chromium.base.supplier.OneshotSupplier;
import org.chromium.base.supplier.Supplier;
import org.chromium.chrome.browser.browser_controls.BrowserControlsStateProvider;
import org.chromium.chrome.browser.compositor.layouts.content.TabContentManager;
import org.chromium.chrome.browser.layouts.LayoutStateProvider;
import org.chromium.chrome.browser.lifecycle.ActivityLifecycleDispatcher;
import org.chromium.chrome.browser.tab_ui.TabContentManager;
import org.chromium.chrome.browser.tabmodel.IncognitoStateProvider;
import org.chromium.chrome.browser.tabmodel.IncognitoStateProvider.IncognitoStateObserver;
import org.chromium.chrome.browser.tabmodel.TabCreatorManager;
Expand All @@ -40,7 +40,9 @@ public class BraveTabGroupUiCoordinator extends TabGroupUiCoordinator {
private IncognitoStateProvider mIncognitoStateProvider;
private IncognitoStateObserver mIncognitoStateObserver;

public BraveTabGroupUiCoordinator(@NonNull Activity activity, @NonNull ViewGroup parentView,
public BraveTabGroupUiCoordinator(
@NonNull Activity activity,
@NonNull ViewGroup parentView,
@NonNull BrowserControlsStateProvider browserControlsStateProvider,
@NonNull IncognitoStateProvider incognitoStateProvider,
@NonNull ScrimCoordinator scrimCoordinator,
Expand All @@ -49,16 +51,29 @@ public BraveTabGroupUiCoordinator(@NonNull Activity activity, @NonNull ViewGroup
@NonNull ActivityLifecycleDispatcher activityLifecycleDispatcher,
@NonNull Supplier<Boolean> isWarmOnResumeSupplier,
@NonNull TabModelSelector tabModelSelector,
@NonNull TabContentManager tabContentManager, @NonNull ViewGroup rootView,
@NonNull TabContentManager tabContentManager,
@NonNull ViewGroup rootView,
@NonNull Supplier<DynamicResourceLoader> dynamicResourceLoaderSupplier,
@NonNull TabCreatorManager tabCreatorManager,
@NonNull OneshotSupplier<LayoutStateProvider> layoutStateProviderSupplier,
@NonNull SnackbarManager snackbarManager) {
super(activity, parentView, browserControlsStateProvider, incognitoStateProvider,
scrimCoordinator, omniboxFocusStateSupplier, bottomSheetController,
activityLifecycleDispatcher, isWarmOnResumeSupplier, tabModelSelector,
tabContentManager, rootView, dynamicResourceLoaderSupplier, tabCreatorManager,
layoutStateProviderSupplier, snackbarManager);
super(
activity,
parentView,
browserControlsStateProvider,
incognitoStateProvider,
scrimCoordinator,
omniboxFocusStateSupplier,
bottomSheetController,
activityLifecycleDispatcher,
isWarmOnResumeSupplier,
tabModelSelector,
tabContentManager,
rootView,
dynamicResourceLoaderSupplier,
tabCreatorManager,
layoutStateProviderSupplier,
snackbarManager);

mIncognitoStateProvider = incognitoStateProvider;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,11 @@
import android.content.Context;
import android.content.res.ColorStateList;

import androidx.annotation.ColorInt;
import androidx.appcompat.content.res.AppCompatResources;

import org.chromium.chrome.tab_ui.R;

public class BraveTabUiThemeProvider {
@ColorInt
public static int getTitleTextColor(Context context, boolean isIncognito, boolean isSelected) {
// These checks are just making sure that these values are still used in Chromium to avoid
// lint issues.
assert R.color.empty_state_icon_bg_background_color > 0
: "Something has changed in the upstream!";
assert R.color.empty_state_icon_bg_foreground_color > 0
: "Something has changed in the upstream!";
assert R.color.empty_state_icon_color > 0 : "Something has changed in the upstream!";
assert R.color.empty_state_icon_bg_color > 0 : "Something has changed in the upstream!";
assert R.color.empty_state_icon_tabswitcher_bg_color > 0
: "Something has changed in the upstream!";

if (isSelected) {
return context.getColor(R.color.baseline_neutral_10);
}

return TabUiThemeProvider.getTitleTextColor(context, isIncognito, isSelected);
}

public static ColorStateList getActionButtonTintList(
Context context, boolean isIncognito, boolean isSelected) {
if (isSelected) {
Expand All @@ -42,14 +21,4 @@ public static ColorStateList getActionButtonTintList(

return TabUiThemeProvider.getActionButtonTintList(context, isIncognito, isSelected);
}

@ColorInt
public static int getCardViewBackgroundColor(
Context context, boolean isIncognito, boolean isSelected) {
if (isSelected && !isIncognito) {
return context.getColor(R.color.brave_tab_view_card_selected_bg);
}

return TabUiThemeProvider.getCardViewBackgroundColor(context, isIncognito, isSelected);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -613,10 +613,13 @@
Title required
</message>
<message name="IDS_TAB_GROUP_CREATION_POSITIVE_BUTTON_TEXT" desc="Text for creating a new tab group from the merged tabs after confirming the editable details">
Create group
Done
</message>

<!-- Tab Group Parity Strings -->
<message name="IDS_ACCESSIBILITY_TAB_GROUP_COLOR_ICON_DESCRIPTION" desc="Accessibility string describing what color the current tab group color icon has. Tap this item to change the color.">
<ph name="COLOR_NAME">%1$s<ex>Blue</ex></ph> tab group color icon
</message>
<message name="IDS_ACCESSIBILITY_TAB_GROUP_COLOR_PICKER_COLOR_ITEM_GREY" desc="The accessibility string for the grey color item in the tab group color picker. Tap this item to toggle the color selection.">
Grey
</message>
Expand Down Expand Up @@ -650,6 +653,30 @@
<message name="IDS_ACCESSIBILITY_TAB_GROUP_COLOR_PICKER_COLOR_ITEM_NOT_SELECTED_DESCRIPTION" desc="Accessibility string describing that no icon is shown to indicate that this color item is the currently selected one.">
<ph name="COLOR_NAME">%1$s<ex>Blue</ex></ph> Not selected
</message>
<message name="IDS_ACCESSIBILITY_EXPAND_TAB_GROUP_WITH_COLOR" desc="The accessibility text to read when a card representing a tab group is clicked in grid tab switcher. NUMBER_OF_TABS is the number of tabs within this group. COLOR_NAME is the color of this group.">
{NUMBER_OF_TABS, plural,
=1 {Expand tab group with <ph name="TABS_COUNT_ONE">%1$d<ex>1</ex></ph> tab, color <ph name="COLOR_NAME">%2$s<ex>Blue</ex></ph>.}
other {Expand tab group with <ph name="TABS_COUNT_MANY">%1$d<ex>2</ex></ph> tabs, color <ph name="COLOR_NAME">%2$s<ex>Blue</ex></ph>.}
}
</message>
<message name="IDS_ACCESSIBILITY_EXPAND_TAB_GROUP_WITH_GROUP_NAME_WITH_COLOR" desc="The accessibility text to read when a card representing a tab group is clicked in grid tab switcher. TITLE_OF_GROUP is the title of the group. NUMBER_OF_TABS is the number of tabs within this group. COLOR_NAME is the color of this group.">
{NUMBER_OF_TABS, plural,
=1 {Expand <ph name="TITLE_OF_GROUP">%1$s<ex>Shopping cart</ex></ph> tab group with <ph name="TABS_COUNT_ONE">%2$d<ex>1</ex></ph> tab, color <ph name="COLOR_NAME">%3$s<ex>Blue</ex></ph>.}
other {Expand <ph name="TITLE_OF_GROUP">%1$s<ex>Shopping cart</ex></ph> tab group with <ph name="TABS_COUNT_MANY">%2$d<ex>2</ex></ph> tabs, color <ph name="COLOR_NAME">%3$s<ex>Blue</ex></ph>.}
}
</message>
<message name="IDS_ACCESSIBILITY_CLOSE_TAB_GROUP_BUTTON_WITH_COLOR" desc="The accessibility text to read when the close button on a card representing a tab group is focused in grid tab switcher. When this close button is tapped, all tabs within the tab group will be closed. NUMBER_OF_TABS is the number of tabs within this group. COLOR_NAME is the color of this group.">
{NUMBER_OF_TABS, plural,
=1 {Close tab group with <ph name="TABS_COUNT_ONE">%1$d<ex>1</ex></ph> tab, color <ph name="COLOR_NAME">%2$s<ex>Blue</ex></ph>.}
other {Close tab group with <ph name="TABS_COUNT_MANY">%1$d<ex>2</ex></ph> tabs, color <ph name="COLOR_NAME">%2$s<ex>Blue</ex></ph>.}
}
</message>
<message name="IDS_ACCESSIBILITY_CLOSE_TAB_GROUP_BUTTON_WITH_GROUP_NAME_WITH_COLOR" desc="The accessibility text to read when the close button on a card representing a tab group is focused in grid tab switcher. When this close button is tapped, all tabs within the tab group will be closed. TITLE_OF_GROUP is the title of the group. NUMBER_OF_TABS is the number of tabs within this group. COLOR_NAME is the color of this group.">
{NUMBER_OF_TABS, plural,
=1 {Close <ph name="TITLE_OF_GROUP">%1$s<ex>shopping</ex></ph> group with <ph name="TABS_COUNT_ONE">%2$d<ex>1</ex></ph> tab, color <ph name="COLOR_NAME">%3$s<ex>Blue</ex></ph>.}
other {Close <ph name="TITLE_OF_GROUP">%1$s<ex>shopping</ex></ph> group with <ph name="TABS_COUNT_MANY">%2$d<ex>2</ex></ph> tabs, color <ph name="COLOR_NAME">%3$s<ex>Blue</ex></ph>.}
}
</message>

<!-- Tab Group Pane Strings -->
<message name="IDS_ACCESSIBILITY_TAB_GROUPS" desc="Content description for the button to show tab groups UI.">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public BraveFeedSurfaceCoordinator(
boolean showDarkBackground,
FeedSurfaceDelegate delegate,
Profile profile,
boolean isPlaceholderShownInitially,
BottomSheetController bottomSheetController,
Supplier<ShareDelegate> shareDelegateSupplier,
@Nullable ScrollableContainerDelegate externalScrollableContainerDelegate,
Expand All @@ -75,7 +74,6 @@ public BraveFeedSurfaceCoordinator(
showDarkBackground,
delegate,
profile,
isPlaceholderShownInitially,
bottomSheetController,
shareDelegateSupplier,
externalScrollableContainerDelegate,
Expand Down
12 changes: 9 additions & 3 deletions android/java/apk_for_test.flags
Original file line number Diff line number Diff line change
Expand Up @@ -487,14 +487,20 @@
}

-keep class org.chromium.chrome.browser.tasks.tab_management.TabUiThemeProvider {
*** getTitleTextColor(...);
*** getActionButtonTintList(...);
*** getCardViewBackgroundColor(...);
}

-keep class org.chromium.chrome.browser.tasks.tab_management.BraveTabUiThemeProvider {
*** getTitleTextColor(...);
*** getActionButtonTintList(...);
}

-keep class org.chromium.chrome.browser.tab_ui.TabUiThemeUtils {
*** getTitleTextColor(...);
*** getCardViewBackgroundColor(...);
}

-keep class org.chromium.chrome.browser.tab_ui.BraveTabUiThemeUtils {
*** getTitleTextColor(...);
*** getCardViewBackgroundColor(...);
}

Expand Down
35 changes: 24 additions & 11 deletions android/java/org/chromium/chrome/browser/app/BraveActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,8 @@ public void onPreferenceChange() {

@Override
public void turnSafeBrowsingOff() {
SafeBrowsingBridge.setSafeBrowsingState(SafeBrowsingState.NO_SAFE_BROWSING);
SafeBrowsingBridge safeBrowsingBridge = new SafeBrowsingBridge(getCurrentProfile());
safeBrowsingBridge.setSafeBrowsingState(SafeBrowsingState.NO_SAFE_BROWSING);
}

@Override
Expand Down Expand Up @@ -991,8 +992,10 @@ public void finishNativeInitialization() {
}

// Make sure this option is disabled
if (PreloadPagesSettingsBridge.getState() != PreloadPagesState.NO_PRELOADING) {
PreloadPagesSettingsBridge.setState(PreloadPagesState.NO_PRELOADING);
if (PreloadPagesSettingsBridge.getState(getCurrentProfile())
!= PreloadPagesState.NO_PRELOADING) {
PreloadPagesSettingsBridge.setState(
getCurrentProfile(), PreloadPagesState.NO_PRELOADING);
}

if (BraveRewardsHelper.hasRewardsEnvChange()) {
Expand Down Expand Up @@ -2170,14 +2173,24 @@ public void addOrEditBookmark(final Tab tabToBookmark) {
// as upstream does, to keep the GmsCore process alive.
private void executeInitSafeBrowsing(long delay) {
// SafeBrowsingBridge.getSafeBrowsingState() has to be executed on a main thread
PostTask.postDelayedTask(TaskTraits.UI_DEFAULT, () -> {
if (SafeBrowsingBridge.getSafeBrowsingState() != SafeBrowsingState.NO_SAFE_BROWSING) {
// initSafeBrowsing could be executed on a background thread
PostTask.postTask(TaskTraits.USER_VISIBLE_MAY_BLOCK,
() -> { BraveSafeBrowsingApiHandler.getInstance().initSafeBrowsing(); });
}
executeInitSafeBrowsing(BraveSafeBrowsingApiHandler.SAFE_BROWSING_INIT_INTERVAL_MS);
}, delay);
PostTask.postDelayedTask(
TaskTraits.UI_DEFAULT,
() -> {
SafeBrowsingBridge safeBrowsingBridge =
new SafeBrowsingBridge(getCurrentProfile());
if (safeBrowsingBridge.getSafeBrowsingState()
!= SafeBrowsingState.NO_SAFE_BROWSING) {
// initSafeBrowsing could be executed on a background thread
PostTask.postTask(
TaskTraits.USER_VISIBLE_MAY_BLOCK,
() -> {
BraveSafeBrowsingApiHandler.getInstance().initSafeBrowsing();
});
}
executeInitSafeBrowsing(
BraveSafeBrowsingApiHandler.SAFE_BROWSING_INIT_INTERVAL_MS);
},
delay);
}

public void updateBottomSheetPosition(int orientation) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,10 @@ private void addAutofillDataMap(
}

private void fillAddressAutoFill(Context context, Map<String, AutofillId> fields) {
ArrayList<AutofillProfile> profileList =
PersonalDataManager.getInstance().getProfilesToSuggest(true);
PersonalDataManager personalDataManager =
PersonalDataManagerFactory.getForProfile(
ProfileManager.getLastUsedRegularProfile());
ArrayList<AutofillProfile> profileList = personalDataManager.getProfilesToSuggest(true);
FillResponse.Builder fillResponse = new FillResponse.Builder();
if (profileList != null && !profileList.isEmpty()) {
for (AutofillProfile profile : profileList) {
Expand Down Expand Up @@ -299,7 +301,10 @@ private void startsAutoSave(Context context) {
profile.setInfo(FieldType.ADDRESS_HOME_ZIP, postalCode);
profile.setInfo(FieldType.ADDRESS_HOME_STATE, state);

profile.setGUID(PersonalDataManager.getInstance().setProfileToLocal(profile));
PersonalDataManager personalDataManager =
PersonalDataManagerFactory.getForProfile(
ProfileManager.getLastUsedRegularProfile());
profile.setGUID(personalDataManager.setProfileToLocal(profile));
autofillAddress.updateAddress(profile);
}
mSaveCallback.onSuccess();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,31 @@ public OverrideUrlLoadingResult shouldOverrideUrlLoading(ExternalNavigationParam
}

@Override
protected OverrideUrlLoadingResult startActivity(Intent intent, boolean requiresIntentChooser,
QueryIntentActivitiesSupplier resolvingInfos, ResolveActivitySupplier resolveActivity,
GURL browserFallbackUrl, GURL intentDataUrl, ExternalNavigationParams params) {
protected OverrideUrlLoadingResult startActivity(
Intent intent,
ExternalNavigationParams params,
boolean requiresIntentChooser,
QueryIntentActivitiesSupplier resolvingInfos,
ResolveActivitySupplier resolveActivity,
GURL browserFallbackUrl,
GURL intentTargetUrl) {
boolean isYoutubeDomain =
intentDataUrl != null
? intentDataUrl.domainIs(BraveConstants.YOUTUBE_DOMAIN)
intentTargetUrl != null
? intentTargetUrl.domainIs(BraveConstants.YOUTUBE_DOMAIN)
: false;
if ((isYoutubeDomain
&& !BravePrefServiceBridge.getInstance().getPlayYTVideoInBrowserEnabled())
|| (!isYoutubeDomain
&& ContextUtils.getAppSharedPreferences()
.getBoolean(BravePrivacySettings.PREF_APP_LINKS, true))) {
return super.startActivity(intent, requiresIntentChooser, resolvingInfos,
resolveActivity, browserFallbackUrl, intentDataUrl, params);
return super.startActivity(
intent,
params,
requiresIntentChooser,
resolvingInfos,
resolveActivity,
browserFallbackUrl,
intentTargetUrl);
} else {
return OverrideUrlLoadingResult.forNoOverride();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import org.chromium.base.supplier.Supplier;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.browser_controls.BrowserControlsStateProvider;
import org.chromium.chrome.browser.compositor.layouts.content.TabContentManager;
import org.chromium.chrome.browser.feed.BraveFeedSurfaceCoordinator;
import org.chromium.chrome.browser.feed.FeedFeatures;
import org.chromium.chrome.browser.feed.FeedSurfaceCoordinator;
Expand All @@ -28,6 +27,7 @@
import org.chromium.chrome.browser.search_engines.TemplateUrlServiceFactory;
import org.chromium.chrome.browser.share.ShareDelegate;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab_ui.TabContentManager;
import org.chromium.chrome.browser.tabmodel.TabModel;
import org.chromium.chrome.browser.tabmodel.TabModelSelector;
import org.chromium.chrome.browser.tasks.HomeSurfaceTracker;
Expand Down Expand Up @@ -149,7 +149,6 @@ protected void initializeMainView(
isInNightMode,
this,
profile,
/* isPlaceholderShownInitially= */ false,
mBottomSheetController,
shareDelegateSupplier,
/* externalScrollableContainerDelegate= */ null,
Expand Down
Loading

0 comments on commit 65989d9

Please sign in to comment.