Skip to content

Commit

Permalink
Upgrade from Chromium 118 to Chromium 119 (1.60.x) (#20654)
Browse files Browse the repository at this point in the history
* Enable History datatype for Sync (#20329)

* Reverted PR#16705 (Sync all history)

* Reverted PR#16478 (Display history sync diagnostic info)

* Reverted PR#20071 (Disable history sync datatype to fallback to typed urls datatype)

* Added overrides for HistoryModelTypeController and HistoryDeleteDirectivesModelTypeController to work
when encrypt everything option is on

* Add patch to sync history delete directives and history entities together

* Added unit test for LowPriorityUserTypes

* Enable encryption of history sync entities

* Added test for precondition state of history datatype controllers

* Modified: clean out HistoryDeleteDirectiveSpecifics::UrlDirective::url field, as it is unencrypted

* Added test to ensure we don't send url at HistoryDeleteDirectiveSpecifics::UrlDirective

* Modified ModelTypeTest.EncryptableUserTypes test to check History type

* Removed 'path_excludes' for the files removed in the current PR

---------

Co-authored-by: Darnell Andries <[email protected]>

* Fix #33746: Cleanup Brave-Core iOS chromium_src overrides & initialization code (#20598)

- Cleanup Brave-Core IOS Chromium_SRC overrides.
- Add new cleaner Chromium_SRC overrides and simplify app launch logic.

* Don't redefine static_assert (#20440)

(Instead, we make sure the static_assert passes here by locally restoring
kCoarseResolutionMicroseconds back to its original Chromium value.)

* Use `PrefService` with `MigrateObsoleteProfilePrefs` (#20396)

Upstream is changing `MigrateObsoleteProfilePrefs` to take a
`PrefService` pointer, rather than `Profile`, as this is more expressive
of the data actually being accessed.

This change aligns all places where we have procedures similar to
`MigrateObsoleteProfilePrefs`, to receive a `PrefService*` instance as
well.

Chromium change:
https://chromium.googlesource.com/chromium/src/+/d848587fe1f19123940de4e4c0cec328bc23001f

commit d848587fe1f19123940de4e4c0cec328bc23001f
Author: Mikel Astiz <[email protected]>
Date:   Mon Oct 2 09:28:03 2023 +0000

    [sync] Remove legacy SyncRequested pref

    It has been practically unused for some time, and most of it is dead
    code ever since the feature toggle was cleaned up in
    https://crrev.com/c/4886256.

    On Ash, it needs to be migrated to a newly-introduced preference
    tailored to the actual underlying need, which is being able to remember
    that the server returned DISABLE_SYNC_ON_CLIENT (i.e. the user reset
    sync via dashboard).

    Change-Id: I0239447173b32d7d007ebf733dde23a5de1859e1
    Bug: 1443446, 1219990

* Ignore formatting for crates under `third_party` (#20390)

This changes adds a patch to add brave's own third party crates path to
the list of rust paths to be ignored during formatting.

* Merge pull request #20642 from brave/ios/bugfix/sync_all_history

* Merge pull request #20664 from brave/cr119-followup-disable-power-bookmarks

Disable kPowerBookmarksSidePanel feature flag

* [Android] Fix for private tab badge padding

Chromium change:
https://source.chromium.org/chromium/chromium/src/+/37d04b2089c15cb152a8a559887a7d10c66572be

[APS] Update tooltip visibility and remove hover highlight for StatusView

- Remove tooltip when StatusIconView is not visible.
- remove hover highlight when StatusIconView is not visible(e.g. default engine is not Google).
- remove hover highlight when VerboseStatusText is visible(e.g. offline).

demo(default engine not Google): https://drive.google.com/file/d/1DPIhHtWN4RnjPvkysyCSfV_gd73ZMjPb/view?usp=sharing

demo(offline)
https://drive.google.com/file/d/1-1Y_t59i8AcxFv6sLpBE-kG2tsSGoi4s/view?usp=sharing

TODO: relocate the logic in StatusView to StatusViewBinder or StatusProperties.

Bug: 1476816, 1476802

* Merge pull request #20314 from brave/cr119

Upgrade from Chromium 118 to Chromium 119

---------

Co-authored-by: AlexeyBarabash <[email protected]>
Co-authored-by: Darnell Andries <[email protected]>
Co-authored-by: Brandon-T <[email protected]>
Co-authored-by: Arthur Edelstein <[email protected]>
Co-authored-by: cdesouza-chromium <[email protected]>
Co-authored-by: Soner YUKSEL <[email protected]>
Co-authored-by: Artem Samoilenko <[email protected]>
  • Loading branch information
8 people authored Oct 26, 2023
1 parent e52d8e9 commit 8b2b815
Show file tree
Hide file tree
Showing 562 changed files with 6,167 additions and 3,882 deletions.
3 changes: 1 addition & 2 deletions android/brave_java_sources.gni
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import("//brave/android/features/tab_ui/brave_tab_management_java_sources.gni")
import("//brave/android/feed/brave_feed_java_sources.gni")
import(
"//brave/android/java/org/chromium/chrome/browser/vpn/billing/sources.gni")
import("//brave/base/brave_base_shared_preferences_java.gni")
import("//brave/browser/brave_ads/android/java_sources.gni")
import("//brave/browser/flags/brave_flags_java_sources.gni")
import("//brave/browser/incognito/android/java_sources.gni")
import("//brave/browser/preferences/brave_preferences_java_sources.gni")
import("//brave/browser/share/android/java_sources.gni")
import("//brave/components/embedder_support/android/java_sources.gni")
import("//brave/components/permissions/android/java_sources.gni")
Expand Down Expand Up @@ -300,7 +300,6 @@ brave_java_sources = [
"../../brave/android/java/org/chromium/chrome/browser/onboarding/v2/HighlightView.java",
"../../brave/android/java/org/chromium/chrome/browser/onboarding/v2/OnboardingV2Fragment.java",
"../../brave/android/java/org/chromium/chrome/browser/onboarding/v2/OnboardingV2PagerAdapter.java",
"../../brave/android/java/org/chromium/chrome/browser/paint_preview/BraveStartupPaintPreviewHelper.java",
"../../brave/android/java/org/chromium/chrome/browser/partnercustomizations/CloseBraveManager.java",
"../../brave/android/java/org/chromium/chrome/browser/password_manager/settings/BravePasswordSettingsBase.java",
"../../brave/android/java/org/chromium/chrome/browser/playlist/PlaylistHostActivity.java",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import androidx.annotation.Px;

import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.jank_tracker.JankTracker;
import org.chromium.base.supplier.Supplier;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.feedback.HelpAndFeedbackLauncher;
Expand All @@ -38,26 +39,58 @@ public class BraveFeedSurfaceCoordinator extends FeedSurfaceCoordinator {
// Own members.
private @Nullable FrameLayout mFrameLayoutForPolicy;

public BraveFeedSurfaceCoordinator(Activity activity, SnackbarManager snackbarManager,
WindowAndroid windowAndroid, @Nullable SnapScrollHelper snapScrollHelper,
@Nullable View ntpHeader, @Px int toolbarHeight, boolean showDarkBackground,
FeedSurfaceDelegate delegate, Profile profile, boolean isPlaceholderShownInitially,
public BraveFeedSurfaceCoordinator(
Activity activity,
SnackbarManager snackbarManager,
WindowAndroid windowAndroid,
@Nullable JankTracker jankTracker,
@Nullable SnapScrollHelper snapScrollHelper,
@Nullable View ntpHeader,
@Px int toolbarHeight,
boolean showDarkBackground,
FeedSurfaceDelegate delegate,
Profile profile,
boolean isPlaceholderShownInitially,
BottomSheetController bottomSheetController,
Supplier<ShareDelegate> shareDelegateSupplier,
@Nullable ScrollableContainerDelegate externalScrollableContainerDelegate,
@NewTabPageLaunchOrigin int launchOrigin,
PrivacyPreferencesManagerImpl privacyPreferencesManager,
@NonNull Supplier<Toolbar> toolbarSupplier, @SurfaceType int surfaceType,
long embeddingSurfaceCreatedTimeNs, @Nullable FeedSwipeRefreshLayout swipeRefreshLayout,
boolean overScrollDisabled, @Nullable ViewGroup viewportView,
FeedActionDelegate actionDelegate, HelpAndFeedbackLauncher helpAndFeedbackLauncher,
@NonNull Supplier<Toolbar> toolbarSupplier,
@SurfaceType int surfaceType,
long embeddingSurfaceCreatedTimeNs,
@Nullable FeedSwipeRefreshLayout swipeRefreshLayout,
boolean overScrollDisabled,
@Nullable ViewGroup viewportView,
FeedActionDelegate actionDelegate,
HelpAndFeedbackLauncher helpAndFeedbackLauncher,
TabModelSelector tabModelSelector) {
super(activity, snackbarManager, windowAndroid, snapScrollHelper, ntpHeader, toolbarHeight,
showDarkBackground, delegate, profile, isPlaceholderShownInitially,
bottomSheetController, shareDelegateSupplier, externalScrollableContainerDelegate,
launchOrigin, privacyPreferencesManager, toolbarSupplier, surfaceType,
embeddingSurfaceCreatedTimeNs, swipeRefreshLayout, overScrollDisabled, viewportView,
actionDelegate, helpAndFeedbackLauncher, tabModelSelector);
super(
activity,
snackbarManager,
windowAndroid,
jankTracker,
snapScrollHelper,
ntpHeader,
toolbarHeight,
showDarkBackground,
delegate,
profile,
isPlaceholderShownInitially,
bottomSheetController,
shareDelegateSupplier,
externalScrollableContainerDelegate,
launchOrigin,
privacyPreferencesManager,
toolbarSupplier,
surfaceType,
embeddingSurfaceCreatedTimeNs,
swipeRefreshLayout,
overScrollDisabled,
viewportView,
actionDelegate,
helpAndFeedbackLauncher,
tabModelSelector);
}

public void createFrameLayoutForPolicy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,32 @@
import androidx.annotation.Nullable;

import org.chromium.chrome.browser.feed.sort_ui.FeedOptionsCoordinator;
import org.chromium.components.browser_ui.widget.displaystyle.UiConfig;
import org.chromium.ui.modelutil.PropertyModel;

public class BraveFeedSurfaceMediator extends FeedSurfaceMediator {
// To delete in bytecode, members from parent class will be used instead.
private FeedSurfaceCoordinator mCoordinator;
private SnapScrollHelper mSnapScrollHelper;

BraveFeedSurfaceMediator(FeedSurfaceCoordinator coordinator, Context context,
@Nullable SnapScrollHelper snapScrollHelper, PropertyModel headerModel,
@FeedSurfaceCoordinator.StreamTabId int openingTabId, FeedActionDelegate actionDelegate,
FeedOptionsCoordinator optionsCoordinator) {
super(coordinator, context, snapScrollHelper, headerModel, openingTabId, actionDelegate,
optionsCoordinator);
BraveFeedSurfaceMediator(
FeedSurfaceCoordinator coordinator,
Context context,
@Nullable SnapScrollHelper snapScrollHelper,
PropertyModel headerModel,
@FeedSurfaceCoordinator.StreamTabId int openingTabId,
FeedActionDelegate actionDelegate,
FeedOptionsCoordinator optionsCoordinator,
@Nullable UiConfig uiConfig) {
super(
coordinator,
context,
snapScrollHelper,
headerModel,
openingTabId,
actionDelegate,
optionsCoordinator,
uiConfig);
}

@Override
Expand Down Expand Up @@ -51,7 +64,12 @@ void updateContent() {
}
}

public void destroyPropertiesForStream() {
assert false : "destroyPropertiesForStream should be redirected to parent in bytecode!";
@Override
public void onTemplateURLServiceChanged() {
if (!FeedFeatures.isFeedEnabled()) {
// We don't need any special handling since feed is disabled.
return;
}
super.onTemplateURLServiceChanged();
}
}
16 changes: 8 additions & 8 deletions android/java/apk_for_test.flags
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,13 @@
public <init>(...);
}

-keep class org.chromium.chrome.browser.preferences.ChromePreferenceKeyChecker {
*** getInstance(...);
-keep class org.chromium.base.shared_preferences.StrictPreferenceKeyChecker {
<init>(...);
*** isKeyInUse(...);
}

-keep class org.chromium.base.shared_preferences.BraveStrictPreferenceKeyChecker {
<init>(...);
}

-keep class org.chromium.chrome.browser.toolbar.BraveToolbarManager {
Expand Down Expand Up @@ -409,7 +414,6 @@
<init>(...);
*** mCoordinator;
*** mSnapScrollHelper;
*** destroyPropertiesForStream(...);
}

-keep class org.chromium.chrome.browser.feed.BraveFeedSurfaceMediator {
Expand Down Expand Up @@ -525,6 +529,7 @@
-keep class org.chromium.chrome.browser.omnibox.suggestions.AutocompleteMediator {
*** mNativeInitialized;
*** mDropdownViewInfoListManager;
*** mDropdownViewInfoListBuilder;
public <init>(...);
}

Expand Down Expand Up @@ -719,11 +724,6 @@
*** updateVisibility(...);
}


-keep class org.chromium.chrome.browser.paint_preview.StartupPaintPreviewHelper {
*** isEnabled(...);
}

-keep class org.chromium.chrome.browser.document.ChromeLauncherActivity {
public <init>(...);
}
Expand Down
69 changes: 69 additions & 0 deletions android/java/org/chromium/base/BravePreferenceKeys.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

package org.chromium.base;

import java.util.Arrays;
import java.util.List;

public final class BravePreferenceKeys {
public static final String BRAVE_BOTTOM_TOOLBAR_ENABLED_KEY =
"brave_bottom_toolbar_enabled_key";
Expand Down Expand Up @@ -56,4 +59,70 @@ public final class BravePreferenceKeys {
public static final String BRAVE_DEFERRED_DEEPLINK_PLAYLIST =
"brave_deferred_deeplink_playlist";
public static final String BRAVE_DEFERRED_DEEPLINK_VPN = "brave_deferred_deeplink_vpn";
public static final String BRAVE_CLOSE_TABS_ON_EXIT = "close_tabs_on_exit";
public static final String BRAVE_CLEAR_ON_EXIT = "clear_on_exit";
public static final String BRAVE_QUICK_ACTION_SEARCH_AND_BOOKMARK_WIDGET_TILES =
"org.chromium.chrome.browser.widget.quickactionsearchandbookmark.QuickActionSearchAndBookmarkWidgetProvider.TILES";

// These are dynamic keys
public static final String BRAVE_RECYCLERVIEW_POSITION = "recyclerview_visible_position_";
public static final String BRAVE_RECYCLERVIEW_OFFSET_POSITION = "recyclerview_offset_position_";

/*
* Returns the list of Brave's preference keys.
*/
private static List<String> getKeysInUse() {
return Arrays.asList(
BRAVE_BOTTOM_TOOLBAR_ENABLED_KEY,
BRAVE_BOTTOM_TOOLBAR_SET_KEY,
BRAVE_USE_CUSTOM_TABS,
BRAVE_APP_OPEN_COUNT,
BRAVE_ROLE_MANAGER_DIALOG_COUNT,
BRAVE_IS_DEFAULT,
BRAVE_WAS_DEFAULT_ASK_COUNT,
BRAVE_SET_DEFAULT_BOTTOM_SHEET_COUNT,
BRAVE_DEFAULT_DONT_ASK,
BRAVE_UPDATE_EXTRA_PARAM,
BRAVE_NOTIFICATION_PREF_NAME,
BRAVE_MILLISECONDS_NAME,
BRAVE_DOWNLOADS_AUTOMATICALLY_OPEN_WHEN_POSSIBLE,
BRAVE_DOWNLOADS_DOWNLOAD_PROGRESS_NOTIFICATION_BUBBLE,
BRAVE_DOUBLE_RESTART,
BRAVE_TAB_GROUPS_ENABLED,
BRAVE_DISABLE_SHARING_HUB,
BRAVE_NEWS_CARDS_VISITED,
BRAVE_NEWS_CHANGE_SOURCE,
BRAVE_NEWS_FEED_HASH,
BRAVE_NEWS_PREF_SHOW_NEWS,
BRAVE_NEWS_PREF_TURN_ON_NEWS,
BRAVE_USE_BIOMETRICS_FOR_WALLET,
BRAVE_BIOMETRICS_FOR_WALLET_IV,
BRAVE_BIOMETRICS_FOR_WALLET_ENCRYPTED,
BRAVE_AD_FREE_CALLOUT_DIALOG,
BRAVE_OPENED_YOUTUBE,
SHOULD_SHOW_COOKIE_CONSENT_NOTICE,
LOADED_SITE_COUNT,
BRAVE_BACKGROUND_VIDEO_PLAYBACK_CONVERTED_TO_FEATURE,
BRAVE_APP_OPEN_COUNT_FOR_WIDGET_PROMO,
BRAVE_DEFERRED_DEEPLINK_PLAYLIST,
BRAVE_DEFERRED_DEEPLINK_VPN,
BRAVE_CLOSE_TABS_ON_EXIT,
BRAVE_CLEAR_ON_EXIT,
BRAVE_QUICK_ACTION_SEARCH_AND_BOOKMARK_WIDGET_TILES);
}

/*
* Checks if preference key is among Brave's dynamic keys.
*/
private static boolean isBraveDynamicKeyInUse(String key) {
return key.startsWith(BRAVE_RECYCLERVIEW_POSITION)
|| key.startsWith(BRAVE_RECYCLERVIEW_OFFSET_POSITION);
}

/*
* Checks if preference key is used in Brave.
*/
public static boolean isBraveKeyInUse(String key) {
return getKeysInUse().contains(key) || isBraveDynamicKeyInUse(key);
}
}
37 changes: 4 additions & 33 deletions android/java/org/chromium/chrome/browser/BraveIntentHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,57 +5,28 @@

package org.chromium.chrome.browser;

import android.app.Activity;
import android.app.SearchManager;
import android.content.Intent;
import android.net.Uri;
import android.text.TextUtils;

import org.chromium.base.IntentUtils;
import org.chromium.base.Log;
import org.chromium.base.ThreadUtils;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.search_engines.TemplateUrlServiceFactory;
import org.chromium.chrome.browser.util.BraveConstants;
import org.chromium.content_public.browser.BrowserStartupController;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;

public class BraveIntentHandler extends IntentHandler {
public class BraveIntentHandler {
private static final String TAG = "BraveIntentHandler";

private static final String CONNECTION_INFO_HELP_URL =
public static final String CONNECTION_INFO_HELP_URL =
"https://support.google.com/chrome?p=android_connection_info";
private static final String BRAVE_CONNECTION_INFO_HELP_URL =
public static final String BRAVE_CONNECTION_INFO_HELP_URL =
"https://support.brave.com/hc/en-us/articles/360018185871-How-do-I-check-if-a-site-s-connection-is-secure-";

public BraveIntentHandler(Activity activity, IntentHandlerDelegate delegate) {
super(activity, delegate);
}

@Override
public boolean onNewIntent(Intent intent) {
// Redirect requests if necessary
String url = getUrlFromIntent(intent);
if (url != null && url.equals(CONNECTION_INFO_HELP_URL)) {
intent.setData(Uri.parse(BRAVE_CONNECTION_INFO_HELP_URL));
}
String appLinkAction = intent.getAction();
Uri appLinkData = intent.getData();

if (Intent.ACTION_VIEW.equals(appLinkAction) && appLinkData != null) {
String lastPathSegment = appLinkData.getLastPathSegment();
if (lastPathSegment != null
&& (lastPathSegment.equalsIgnoreCase(BraveConstants.DEEPLINK_ANDROID_PLAYLIST)
|| lastPathSegment.equalsIgnoreCase(
BraveConstants.DEEPLINK_ANDROID_VPN))) {
return false;
}
}
return super.onNewIntent(intent);
}

/**
* Helper method to extract the raw URL from the intent, without further processing.
* The URL may be in multiple locations.
Expand All @@ -64,7 +35,7 @@ public boolean onNewIntent(Intent intent) {
*/
protected static String extractUrlFromIntent(Intent intent) {
if (intent == null) return null;
String url = getUrlFromVoiceSearchResult(intent);
String url = IntentHandler.getUrlFromVoiceSearchResult(intent);
if (url == null) url = getUrlForCustomTab(intent);
if (url == null) url = getUrlForWebapp(intent);
if (url == null) url = intent.getDataString();
Expand Down
Loading

0 comments on commit 8b2b815

Please sign in to comment.