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 95 to Chromium 96 (1.32.x). #10888

Merged
merged 4 commits into from
Nov 9, 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
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions android/features/tab_ui/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ android_library("java") {
sources = [
"java/src/org/chromium/chrome/browser/tasks/tab_management/BraveTabGroupUiCoordinator.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/BraveTabUiFeatureUtilities.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/BraveTabUiThemeProvider.java",
]
deps = [
"//base:base_java",
Expand All @@ -24,6 +25,7 @@ android_library("java") {
"//components/browser_ui/bottomsheet/android:java",
"//components/browser_ui/widget/android:java",
"//third_party/androidx:androidx_annotation_annotation_java",
"//third_party/androidx:androidx_appcompat_appcompat_resources_java",
"//ui/android:ui_no_recycler_view_java",
]

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* Copyright (c) 2021 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

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

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

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

import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.chrome.tab_ui.R;

public class BraveTabUiThemeProvider {
@ColorInt
public static int getTitleTextColor(Context context, boolean isIncognito, boolean isSelected) {
if (TabUiThemeProvider.themeRefactorEnabled() && isSelected) {
return ApiCompatibilityUtils.getColor(
context.getResources(), R.color.baseline_neutral_900);
}

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

public static ColorStateList getActionButtonTintList(
Context context, boolean isIncognito, boolean isSelected) {
if (TabUiThemeProvider.themeRefactorEnabled() && isSelected) {
return AppCompatResources.getColorStateList(context, R.color.baseline_neutral_900);
}

return TabUiThemeProvider.getActionButtonTintList(context, isIncognito, isSelected);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.supplier.Supplier;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.bookmarks.BookmarkBridge;
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;
import org.chromium.chrome.browser.privacy.settings.PrivacyPreferencesManagerImpl;
Expand Down Expand Up @@ -53,13 +53,13 @@ public BraveFeedSurfaceCoordinator(Activity activity, SnackbarManager snackbarMa
@NonNull Supplier<Toolbar> toolbarSupplier,
FeedLaunchReliabilityLoggingState launchReliabilityLoggingState,
@Nullable FeedSwipeRefreshLayout swipeRefreshLayout, boolean overScrollDisabled,
@Nullable ViewGroup viewportView) {
@Nullable ViewGroup viewportView, @NonNull BookmarkBridge bookmarkBridge) {
super(activity, snackbarManager, windowAndroid, snapScrollHelper, ntpHeader,
sectionHeaderView, showDarkBackground, delegate, pageNavigationDelegate, profile,
isPlaceholderShownInitially, bottomSheetController, shareDelegateSupplier,
externalScrollableContainerDelegate, launchOrigin, privacyPreferencesManager,
toolbarSupplier, launchReliabilityLoggingState, swipeRefreshLayout,
overScrollDisabled, viewportView);
overScrollDisabled, viewportView, bookmarkBridge);
}

@Override
Expand Down
10 changes: 10 additions & 0 deletions android/java/apk_for_test.flags
Original file line number Diff line number Diff line change
Expand Up @@ -420,3 +420,13 @@
-keep class org.chromium.components.browser_ui.site_settings.BraveSiteSettingsPreferencesBase {
public <init>(...);
}

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

-keep class org.chromium.chrome.browser.tasks.tab_management.BraveTabUiThemeProvider {
*** getTitleTextColor(...);
*** getActionButtonTintList(...);
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.chromium.chrome.browser.tabmodel.TabModelSelector;
import org.chromium.chrome.browser.toolbar.ToolbarManager;
import org.chromium.chrome.browser.ui.appmenu.AppMenuHandler;
import org.chromium.chrome.features.start_surface.StartSurface;
import org.chromium.ui.modaldialog.ModalDialogManager;

public class BraveAppMenuPropertiesDelegateImpl extends AppMenuPropertiesDelegateImpl {
Expand All @@ -32,9 +33,11 @@ public BraveAppMenuPropertiesDelegateImpl(Context context,
MultiWindowModeStateDispatcher multiWindowModeStateDispatcher,
TabModelSelector tabModelSelector, ToolbarManager toolbarManager, View decorView,
@Nullable OneshotSupplier<OverviewModeBehavior> overviewModeBehaviorSupplier,
@Nullable OneshotSupplier<StartSurface> startSurfaceSupplier,
ObservableSupplier<BookmarkBridge> bookmarkBridgeSupplier) {
super(context, activityTabProvider, multiWindowModeStateDispatcher, tabModelSelector,
toolbarManager, decorView, overviewModeBehaviorSupplier, bookmarkBridgeSupplier);
toolbarManager, decorView, overviewModeBehaviorSupplier, startSurfaceSupplier,
bookmarkBridgeSupplier);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager;
import org.chromium.chrome.browser.vpn.BraveVpnProfileUtils;
import org.chromium.chrome.browser.vpn.BraveVpnUtils;
import org.chromium.chrome.features.start_surface.StartSurface;
import org.chromium.ui.modaldialog.ModalDialogManager;

public class BraveTabbedAppMenuPropertiesDelegate extends TabbedAppMenuPropertiesDelegate {
Expand All @@ -54,12 +55,14 @@ public BraveTabbedAppMenuPropertiesDelegate(Context context,
TabModelSelector tabModelSelector, ToolbarManager toolbarManager, View decorView,
AppMenuDelegate appMenuDelegate,
OneshotSupplier<OverviewModeBehavior> overviewModeBehaviorSupplier,
OneshotSupplier<StartSurface> startSurfaceSupplier,
ObservableSupplier<BookmarkBridge> bookmarkBridgeSupplier,
WebFeedSnackbarController.FeedLauncher feedLauncher,
ModalDialogManager modalDialogManager, SnackbarManager snackbarManager) {
super(context, activityTabProvider, multiWindowModeStateDispatcher, tabModelSelector,
toolbarManager, decorView, appMenuDelegate, overviewModeBehaviorSupplier,
bookmarkBridgeSupplier, feedLauncher, modalDialogManager, snackbarManager);
startSurfaceSupplier, bookmarkBridgeSupplier, feedLauncher, modalDialogManager,
snackbarManager);

mAppMenuDelegate = appMenuDelegate;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package org.chromium.chrome.browser.crypto_wallet.adapters;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
Expand Down Expand Up @@ -209,6 +210,7 @@ public void resetObservers() {
}
}

@SuppressLint("NotifyDataSetChanged")
public void filter(String text) {
walletListItemModelList.clear();
if (text.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package org.chromium.chrome.browser.crypto_wallet.fragments.onboarding_fragments;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
Expand Down Expand Up @@ -107,6 +108,7 @@ private void phraseNotMatch() {
Toast.makeText(getActivity(), R.string.phrases_did_not_match, Toast.LENGTH_SHORT).show();
}

@SuppressLint("NotifyDataSetChanged")
private void resetRecoveryPhrasesViews() {
if (recoveryPhrasesAdapter != null && recoveryPhrasesRecyclerView != null) {
recoveryPhrasesAdapter = new RecoveryPhraseAdapter();
Expand Down Expand Up @@ -153,6 +155,7 @@ private void setupSelectedRecoveryPhraseRecyclerView(View view) {

OnRecoveryPhraseSelected onRecoveryPhraseSelected = new OnRecoveryPhraseSelected() {
@Override
@SuppressLint("NotifyDataSetChanged")
public void onSelectedRecoveryPhrase(String phrase) {
if (recoveryPhrasesAdapter != null) {
recoveryPhrasesAdapter.notifyDataSetChanged();
Expand All @@ -175,6 +178,7 @@ public void onSelectedRecoveryPhrase(String phrase) {

OnRecoveryPhraseSelected onSelectedRecoveryPhraseSelected = new OnRecoveryPhraseSelected() {
@Override
@SuppressLint("NotifyDataSetChanged")
public void onSelectedRecoveryPhrase(String phrase) {
if (recoveryPhrasesAdapter != null) {
recoveryPhrasesAdapter.addPhraseAtPosition(recoveryPhrases.indexOf(phrase), phrase);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.json.JSONException;
import org.json.JSONObject;

import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.ContextUtils;
import org.chromium.base.Log;
import org.chromium.base.Predicate;
Expand Down Expand Up @@ -574,7 +575,9 @@ public static void setBitmapResource(ExecutorService executor, Handler handler,
} else if (textView != null) {
textView.setCompoundDrawablesRelativeWithIntrinsicBounds(
new BitmapDrawable(context.getResources(), bitmap), null,
context.getResources().getDrawable(R.drawable.ic_carat_down), null);
ApiCompatibilityUtils.getDrawable(
context.getResources(), R.drawable.ic_carat_down),
null);
}
});
} catch (IOException exc) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package org.chromium.chrome.browser.night_mode.settings;

import static org.chromium.chrome.browser.preferences.ChromePreferenceKeys.UI_THEME_DARKEN_WEBSITES_ENABLED;
import static org.chromium.chrome.browser.preferences.ChromePreferenceKeys.UI_THEME_SETTING;

import android.os.Build;
Expand All @@ -18,6 +17,8 @@
import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.night_mode.GlobalNightModeStateProviderHolder;
import org.chromium.chrome.browser.night_mode.ThemeType;
import org.chromium.chrome.browser.night_mode.WebContentsDarkModeController;
import org.chromium.chrome.browser.night_mode.WebContentsDarkModeController.AutoDarkSettingsChangeSource;
import org.chromium.chrome.browser.ntp_background_images.NTPBackgroundImagesBridge;
import org.chromium.chrome.browser.preferences.SharedPreferencesManager;
import org.chromium.chrome.browser.profiles.Profile;
Expand All @@ -27,6 +28,8 @@ public class BraveThemePreferences extends ThemeSettingsFragment {

private static final String SUPER_REFERRAL = "super_referral";

private boolean mWebContentsDarkModeEnabled;

@Override
public void onCreatePreferences(@Nullable Bundle savedInstanceState, String rootKey) {
SettingsUtils.addPreferencesFromResource(this, R.xml.brave_theme_preferences);
Expand Down Expand Up @@ -54,15 +57,22 @@ public void onCreatePreferences(@Nullable Bundle savedInstanceState, String root
? ThemeType.DARK
: ThemeType.LIGHT;
}

mWebContentsDarkModeEnabled = WebContentsDarkModeController.isGlobalUserSettingsEnabled();
radioButtonGroupThemePreference.initialize(
sharedPreferencesManager.readInt(UI_THEME_SETTING, defaultThemePref),
sharedPreferencesManager.readBoolean(UI_THEME_DARKEN_WEBSITES_ENABLED, false));
sharedPreferencesManager.readInt(UI_THEME_SETTING, defaultThemePref),
mWebContentsDarkModeEnabled);

radioButtonGroupThemePreference.setOnPreferenceChangeListener((preference, newValue) -> {
if (ChromeFeatureList.isEnabled(
ChromeFeatureList.DARKEN_WEBSITES_CHECKBOX_IN_THEMES_SETTING)) {
sharedPreferencesManager.writeBoolean(UI_THEME_DARKEN_WEBSITES_ENABLED,
radioButtonGroupThemePreference.isDarkenWebsitesEnabled());
ChromeFeatureList.DARKEN_WEBSITES_CHECKBOX_IN_THEMES_SETTING)) {
if (radioButtonGroupThemePreference.isDarkenWebsitesEnabled()
!= mWebContentsDarkModeEnabled) {
mWebContentsDarkModeEnabled =
radioButtonGroupThemePreference.isDarkenWebsitesEnabled();
WebContentsDarkModeController.setGlobalUserSettings(
mWebContentsDarkModeEnabled);
}
}
int theme = (int) newValue;
sharedPreferencesManager.writeInt(UI_THEME_SETTING, theme);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package org.chromium.chrome.browser.notifications.retention;

import android.annotation.SuppressLint;
import android.app.AlarmManager;
import android.app.Notification;
import android.app.PendingIntent;
Expand Down Expand Up @@ -75,6 +76,7 @@ public static RetentionNotification getNotificationObject(String notificationTyp
return mNotificationMap.get(notificationType);
}

@SuppressLint("NotificationTrampoline")
public static Notification getNotification(
Context context, String notificationType, String notificationText) {
RetentionNotification retentionNotification = getNotificationObject(notificationType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import org.chromium.base.jank_tracker.JankTracker;
import org.chromium.base.supplier.ObservableSupplier;
import org.chromium.base.supplier.Supplier;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.bookmarks.BookmarkBridge;
import org.chromium.chrome.browser.browser_controls.BrowserControlsStateProvider;
import org.chromium.chrome.browser.compositor.layouts.OverviewModeBehavior;
import org.chromium.chrome.browser.feed.BraveFeedSurfaceCoordinator;
Expand Down Expand Up @@ -77,7 +79,8 @@ windowAndroid, new SnapScrollHelper(mNewTabPageManager, mNewTabPageLayout),
NewTabPageUtils.decodeOriginFromNtpUrl(url),
PrivacyPreferencesManagerImpl.getInstance(), mToolbarSupplier,
/* FeedLaunchReliabilityLoggingState */ null,
FeedSwipeRefreshLayout.create(activity), /* overScrollDisabled= */ false,
/* viewportView= */ null);
FeedSwipeRefreshLayout.create(activity, R.id.toolbar_container),
/* overScrollDisabled= */ false,
/* viewportView= */ null, new BookmarkBridge(profile));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
import android.content.Context;
import android.content.res.Resources;

import androidx.annotation.Nullable;

import org.chromium.base.supplier.OneshotSupplier;
import org.chromium.base.supplier.Supplier;
import org.chromium.chrome.browser.merchant_viewer.MerchantTrustSignalsCoordinator;
import org.chromium.chrome.browser.omnibox.LocationBarDataProvider;
import org.chromium.chrome.browser.omnibox.SearchEngineLogoUtils;
import org.chromium.chrome.browser.omnibox.UrlBarEditingTextStateProvider;
Expand All @@ -30,10 +33,14 @@ public BraveStatusMediator(PropertyModel model, Resources resources, Context con
SearchEngineLogoUtils searchEngineLogoUtils,
OneshotSupplier<TemplateUrlService> templateUrlServiceSupplier,
Supplier<Profile> profileSupplier, PageInfoIPHController pageInfoIPHController,
WindowAndroid windowAndroid) {
WindowAndroid windowAndroid,
@Nullable Supplier<MerchantTrustSignalsCoordinator>
merchantTrustSignalsCoordinatorSupplier) {
super(model, resources, context, urlBarEditingTextStateProvider, isTablet,
locationBarDataProvider, permissionDialogController, searchEngineLogoUtils,
templateUrlServiceSupplier, profileSupplier, pageInfoIPHController, windowAndroid);
templateUrlServiceSupplier, profileSupplier, pageInfoIPHController, windowAndroid,

merchantTrustSignalsCoordinatorSupplier);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class BravePrivacySettings extends PrivacySettings {
private static final String PREF_CLEAR_BROWSING_DATA = "clear_browsing_data";
private static final String PREF_PRIVACY_SANDBOX = "privacy_sandbox";
private static final String PREF_HTTPS_FIRST_MODE = "https_first_mode";
private static final String PREF_INCOGNITO_LOCK = "incognito_lock";

// brave Prefs
private static final String PREF_BRAVE_SHIELDS_GLOBALS_SECTION =
Expand Down Expand Up @@ -96,9 +97,9 @@ public class BravePrivacySettings extends PrivacySettings {
PREF_SOCIAL_BLOCKING_GOOGLE, PREF_SOCIAL_BLOCKING_FACEBOOK,
PREF_SOCIAL_BLOCKING_TWITTER, PREF_SOCIAL_BLOCKING_LINKEDIN,
PREF_OTHER_PRIVACY_SETTINGS_SECTION, // other section
PREF_WEBRTC_POLICY, PREF_SAFE_BROWSING, PREF_CAN_MAKE_PAYMENT, PREF_UNSTOPPABLE_DOMAINS,
PREF_ETH_NAMED_SERVICE, PREF_IPFS_GATEWAY, PREF_SECURE_DNS, PREF_DO_NOT_TRACK,
PREF_CLOSE_TABS_ON_EXIT, PREF_SEND_P3A, PREF_SEND_CRASH_REPORTS,
PREF_WEBRTC_POLICY, PREF_SAFE_BROWSING, PREF_INCOGNITO_LOCK, PREF_CAN_MAKE_PAYMENT,
PREF_UNSTOPPABLE_DOMAINS, PREF_ETH_NAMED_SERVICE, PREF_IPFS_GATEWAY, PREF_SECURE_DNS,
PREF_DO_NOT_TRACK, PREF_CLOSE_TABS_ON_EXIT, PREF_SEND_P3A, PREF_SEND_CRASH_REPORTS,
PREF_BRAVE_STATS_USAGE_PING, PREF_SEARCH_SUGGESTIONS, PREF_AUTOCOMPLETE_TOP_SITES,
PREF_AUTOCOMPLETE_BRAVE_SUGGESTED_SITES, PREF_USAGE_STATS, PREF_PRIVACY_SANDBOX};

Expand Down Expand Up @@ -221,7 +222,7 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
removePreferenceIfPresent(PREF_NETWORK_PREDICTIONS);
removePreferenceIfPresent(PREF_PRIVACY_SANDBOX);

updatePreferences();
updateBravePreferences();
}

// used for displaying BraveDialogPreference
Expand Down Expand Up @@ -373,7 +374,7 @@ public boolean onPreferenceChange(Preference preference, Object newValue) {
return true;
}

private void updatePreferences() {
private void updateBravePreferences() {
for (int i = 0; i < NEW_PRIVACY_PREFERENCE_ORDER.length; i++) {
if (findPreference(NEW_PRIVACY_PREFERENCE_ORDER[i]) != null) {
findPreference(NEW_PRIVACY_PREFERENCE_ORDER[i]).setOrder(i);
Expand Down
Loading