diff --git a/android/android_browser_tests.gni b/android/android_browser_tests.gni index e677fa573b46..9fbe0c403380 100644 --- a/android/android_browser_tests.gni +++ b/android/android_browser_tests.gni @@ -133,22 +133,16 @@ android_only_test_deps = [ "//brave/browser/partnercustomizations:delegate_public_impl_java", "//brave/components/brave_wallet/browser:test_support", "//brave/components/cosmetic_filters/browser:browser", - "//brave/components/language/android:java", "//brave/third_party/android_deps:com_android_installreferrer_java", "//chrome:chrome_android_core", - "//chrome/android:app_hooks_java", "//chrome/android:delegate_public_impl_java", "//chrome/browser/flags:flags_android", - "//chrome/browser/lens:delegate_public_impl_java", - "//chrome/browser/locale:delegate_public_impl_java", "//chrome/browser/metrics:test_support", "//chrome/test:android_browsertests_assets", "//chrome/test:android_browsertests_java", "//chrome/test:test_support", "//chrome/test:test_support_ui_android", "//components/browser_ui/widget/android:java", - "//components/externalauth/android:google_delegate_public_impl_java", - "//components/language/android:ulp_delegate_public_java", # TODO(crbug.com/961849): This is needed for ShellManager which is what # the ChromeBrowserTestsActivity is using to build the java UI. It's diff --git a/android/brave_java_sources.gni b/android/brave_java_sources.gni index c32e8118d046..2ae17caecc1a 100644 --- a/android/brave_java_sources.gni +++ b/android/brave_java_sources.gni @@ -7,13 +7,14 @@ 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/billing/sources.gni") import("//brave/android/java/org/chromium/chrome/browser/playlist/sources.gni") -import("//brave/base/brave_base_cached_flags_java_sources.gni") import("//brave/base/brave_base_shared_preferences_java.gni") import("//brave/browser/brave_ads/android/java_sources.gni") import("//brave/browser/hub/internal/android/java/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/cached_flags/brave_components_cached_flags_java_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") @@ -539,7 +540,6 @@ brave_java_base_module_sources = [ ] brave_java_base_module_deps = [ - "//brave/components/language/android:java", "//brave/third_party/android_deps:com_wireguard_android_java", "//third_party/androidx:androidx_core_core_java", "//third_party/androidx:androidx_lifecycle_lifecycle_livedata_core_java", diff --git a/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/BraveIncognitoTabSwitcherPane.java b/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/BraveIncognitoTabSwitcherPane.java index 977f7e61ae0c..1dfe642eb34a 100644 --- a/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/BraveIncognitoTabSwitcherPane.java +++ b/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/BraveIncognitoTabSwitcherPane.java @@ -12,12 +12,14 @@ import androidx.annotation.Nullable; import org.chromium.base.BraveReflectionUtil; +import org.chromium.base.supplier.ObservableSupplier; import org.chromium.base.supplier.OneshotSupplier; import org.chromium.base.supplier.Supplier; import org.chromium.chrome.browser.hub.ResourceButtonData; import org.chromium.chrome.browser.incognito.reauth.IncognitoReauthController; import org.chromium.chrome.browser.profiles.ProfileProvider; -import org.chromium.chrome.browser.tabmodel.TabModelFilter; +import org.chromium.chrome.browser.tabmodel.TabGroupModelFilter; +import org.chromium.chrome.browser.ui.edge_to_edge.EdgeToEdgeController; import org.chromium.chrome.browser.user_education.UserEducationHelper; import org.chromium.chrome.tab_ui.R; @@ -29,11 +31,12 @@ public BraveIncognitoTabSwitcherPane( @NonNull Context context, @NonNull OneshotSupplier profileProviderSupplier, @NonNull TabSwitcherPaneCoordinatorFactory factory, - @NonNull Supplier incognitoTabModelFilterSupplier, + @NonNull Supplier incognitoTabModelFilterSupplier, @NonNull OnClickListener newTabButtonClickListener, @Nullable OneshotSupplier incognitoReauthControllerSupplier, @NonNull DoubleConsumer onToolbarAlphaChange, - @NonNull UserEducationHelper userEducationHelper) { + @NonNull UserEducationHelper userEducationHelper, + @NonNull ObservableSupplier edgeToEdgeSupplier) { super( context, profileProviderSupplier, @@ -42,7 +45,8 @@ public BraveIncognitoTabSwitcherPane( newTabButtonClickListener, incognitoReauthControllerSupplier, onToolbarAlphaChange, - userEducationHelper); + userEducationHelper, + edgeToEdgeSupplier); ResourceButtonData newReferenceButtonData = new ResourceButtonData( diff --git a/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/BraveTabSwitcherPaneBase.java b/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/BraveTabSwitcherPaneBase.java index 8338c287e86a..76409fbbbe82 100644 --- a/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/BraveTabSwitcherPaneBase.java +++ b/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/BraveTabSwitcherPaneBase.java @@ -9,12 +9,14 @@ import androidx.annotation.NonNull; +import org.chromium.base.supplier.ObservableSupplier; import org.chromium.base.supplier.OneshotSupplier; import org.chromium.chrome.browser.hub.HubContainerView; import org.chromium.chrome.browser.hub.HubLayoutAnimatorProvider; import org.chromium.chrome.browser.profiles.ProfileProvider; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tasks.tab_management.TabListCoordinator.TabListMode; +import org.chromium.chrome.browser.ui.edge_to_edge.EdgeToEdgeController; import org.chromium.chrome.browser.user_education.UserEducationHelper; import java.util.function.DoubleConsumer; @@ -26,14 +28,16 @@ public abstract class BraveTabSwitcherPaneBase extends TabSwitcherPaneBase { @NonNull TabSwitcherPaneCoordinatorFactory factory, boolean isIncognito, @NonNull DoubleConsumer onToolbarAlphaChange, - @NonNull UserEducationHelper userEducationHelper) { + @NonNull UserEducationHelper userEducationHelper, + @NonNull ObservableSupplier edgeToEdgeSupplier) { super( context, profileProviderSupplier, factory, isIncognito, onToolbarAlphaChange, - userEducationHelper); + userEducationHelper, + edgeToEdgeSupplier); } @Override diff --git a/android/features/tab_ui/java/strings/android_chrome_tab_ui_strings.grd b/android/features/tab_ui/java/strings/android_chrome_tab_ui_strings.grd index 769e2fe783ad..f9a98dff2d6c 100644 --- a/android/features/tab_ui/java/strings/android_chrome_tab_ui_strings.grd +++ b/android/features/tab_ui/java/strings/android_chrome_tab_ui_strings.grd @@ -503,20 +503,6 @@ The price of this item recently dropped from %1$s$42 to %2$s$30 - - - Get alerts for price drops? - - - You'll get an alert when there's a lower price in an open tab - - - Get notified - - - To get an alert when there's a lower price in an open tab, turn on notifications in Settings. - - Track prices on tabs @@ -803,6 +789,9 @@ New tab in group + + Share group + Rename tab group @@ -832,17 +821,39 @@ Close tab and delete group? + + Keep tab group? + + + Keep this group to add tabs later, or delete it if you no longer need it. + +If you delete it, everyone will immediately lose access to the "%1$sShopping cart" tab group, and it will be deleted from all devices. + + + Keep this group to add tabs later, or leave. + +If you leave, you will immediately lose access to the "%1$sShopping cart" tab group. + + + Keep group + + + Delete group + + + Leave group + Close Rename - - Open the tab group action menu for tab group %1$sShopping cart + + Open the tab group action menu for tab group %1$sShopping cart, color %2$sBlue. - - Open the tab group action menu for shared tab group %1$sShopping cart + + Open the tab group action menu for shared tab group %1$sShopping cart, color %2$sBlue. This will delete the group from all devices signed into %1$stest@gmail.com diff --git a/android/feed/core/java/src/org/chromium/chrome/browser/feed/BraveFeedSurfaceCoordinator.java b/android/feed/core/java/src/org/chromium/chrome/browser/feed/BraveFeedSurfaceCoordinator.java index c372164177a0..1eef8a24d752 100644 --- a/android/feed/core/java/src/org/chromium/chrome/browser/feed/BraveFeedSurfaceCoordinator.java +++ b/android/feed/core/java/src/org/chromium/chrome/browser/feed/BraveFeedSurfaceCoordinator.java @@ -23,6 +23,7 @@ import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.share.ShareDelegate; import org.chromium.chrome.browser.toolbar.top.Toolbar; +import org.chromium.chrome.browser.ui.edge_to_edge.EdgeToEdgeController; import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; import org.chromium.ui.UiUtils; @@ -58,7 +59,8 @@ public BraveFeedSurfaceCoordinator( boolean overScrollDisabled, @Nullable ViewGroup viewportView, FeedActionDelegate actionDelegate, - @NonNull ObservableSupplier tabStripHeightSupplier) { + @NonNull ObservableSupplier tabStripHeightSupplier, + ObservableSupplier edgeToEdgeControllerSupplier) { super( activity, snackbarManager, @@ -81,7 +83,8 @@ public BraveFeedSurfaceCoordinator( overScrollDisabled, viewportView, actionDelegate, - tabStripHeightSupplier); + tabStripHeightSupplier, + edgeToEdgeControllerSupplier); } public void createFrameLayoutForPolicy() { diff --git a/android/java/apk_for_test.flags b/android/java/apk_for_test.flags index 53b31c91ef29..b8d54e2e3f59 100644 --- a/android/java/apk_for_test.flags +++ b/android/java/apk_for_test.flags @@ -300,7 +300,7 @@ public (...); } --keep class org.chromium.chrome.browser.settings.SettingsLauncherImpl { +-keep class org.chromium.chrome.browser.settings.SettingsNavigationImpl { (...); } @@ -591,7 +591,7 @@ *** get(...); } --keep class org.chromium.chrome.browser.partnercustomizations.CustomizationProviderDelegateImpl { +-keep class org.chromium.chrome.browser.partnercustomizations.CustomizationProviderDelegateUpstreamImpl { public (...); } @@ -645,7 +645,7 @@ public (...); } --keep class org.chromium.chrome.browser.AppHooksImpl { +-keep class org.chromium.chrome.browser.AppHooks { public (...); } @@ -653,12 +653,12 @@ public (...); } --keep class org.chromium.base.cached_flags.CachedFlag { +-keep class org.chromium.components.cached_flags.CachedFlag { *** mDefaultValue; (...); } --keep class org.chromium.base.cached_flags.BraveCachedFlag { +-keep class org.chromium.components.cached_flags.BraveCachedFlag { (...); } @@ -745,12 +745,12 @@ public (...); } --keep class org.chromium.chrome.browser.tasks.tab_groups.TabGroupModelFilter { +-keep class org.chromium.chrome.browser.tabmodel.TabGroupModelFilterImpl { *** mIsResetting; public (...); } --keep class org.chromium.chrome.browser.tasks.tab_groups.BraveTabGroupModelFilter { +-keep class org.chromium.chrome.browser.tabmodel.BraveTabGroupModelFilter { public (...); } @@ -791,16 +791,6 @@ public (...); } --keep class org.chromium.components.language.LocaleManagerDelegateImpl { - public (...); - *** getApplicationLocale(...); - *** setApplicationLocale(...); -} - --keep class org.chromium.components.language.BraveLocaleManagerDelegateImpl { - public (...); -} - -keep class org.chromium.chrome.browser.compositor.layouts.ToolbarSwipeLayout { public (...); *** mMoveToolbar; diff --git a/android/java/org/chromium/base/BraveReflectionUtil.java b/android/java/org/chromium/base/BraveReflectionUtil.java index 58c876035f56..869ffc20b613 100644 --- a/android/java/org/chromium/base/BraveReflectionUtil.java +++ b/android/java/org/chromium/base/BraveReflectionUtil.java @@ -40,14 +40,14 @@ public static Object invokeMethod( return toInvoke.invoke(obj, args); } catch (IllegalAccessException e) { Log.e(TAG, "Illegal access for method: " + e); - assert (false); + assert false; } catch (InvocationTargetException e) { Log.e(TAG, "Method invocation error e: " + e); - assert (false); + assert false; } } catch (NoSuchMethodException e) { Log.e(TAG, "Method not found: " + e); - assert (false); + assert false; } return null; } @@ -59,10 +59,10 @@ public static Object getField(Class ownerClass, String fieldName, Object obj) { return field.get(obj); } catch (NoSuchFieldException e) { Log.e(TAG, "Field not found: " + e); - assert (false); + assert false; } catch (SecurityException | IllegalArgumentException | IllegalAccessException e) { Log.e(TAG, "Get field failed: " + e); - assert (false); + assert false; } return null; } @@ -74,10 +74,10 @@ public static void setField(Class ownerClass, String fieldName, Object obj, Obje field.set(obj, newValue); } catch (NoSuchFieldException e) { Log.e(TAG, "Field not found: " + e); - assert (false); + assert false; } catch (SecurityException | IllegalArgumentException | IllegalAccessException e) { Log.e(TAG, "Get field failed: " + e); - assert (false); + assert false; } } diff --git a/android/java/org/chromium/chrome/browser/BraveAppHooks.java b/android/java/org/chromium/chrome/browser/BraveAppHooks.java index 04065f7ea516..4d651837de33 100644 --- a/android/java/org/chromium/chrome/browser/BraveAppHooks.java +++ b/android/java/org/chromium/chrome/browser/BraveAppHooks.java @@ -7,7 +7,7 @@ import org.chromium.chrome.browser.partnerbookmarks.PartnerBookmark; -public class BraveAppHooks extends AppHooksImpl { +public class BraveAppHooks extends AppHooks { @Override public PartnerBookmark.BookmarkIterator getPartnerBookmarkIterator() { return null; diff --git a/android/java/org/chromium/chrome/browser/BraveIntentHandler.java b/android/java/org/chromium/chrome/browser/BraveIntentHandler.java index d2a4418564c0..54608d182fda 100644 --- a/android/java/org/chromium/chrome/browser/BraveIntentHandler.java +++ b/android/java/org/chromium/chrome/browser/BraveIntentHandler.java @@ -81,17 +81,17 @@ public String call() { } private static String getUrlForCustomTab(Intent intent) { - assert (false); + assert false; return null; } private static String getUrlForWebapp(Intent intent) { - assert (false); + assert false; return null; } private static boolean isJavascriptSchemeOrInvalidUrl(String url) { - assert (false); + assert false; return false; } } diff --git a/android/java/org/chromium/chrome/browser/BraveRewardsHelper.java b/android/java/org/chromium/chrome/browser/BraveRewardsHelper.java index 2901b05c3f41..2c7a856f05c9 100644 --- a/android/java/org/chromium/chrome/browser/BraveRewardsHelper.java +++ b/android/java/org/chromium/chrome/browser/BraveRewardsHelper.java @@ -352,9 +352,9 @@ public static Bitmap getCircularBitmap(Bitmap bitmap) { float r = 0; if (bitmap.getWidth() > bitmap.getHeight()) { - r = bitmap.getHeight() / 2; + r = bitmap.getHeight() / 2f; } else { - r = bitmap.getWidth() / 2; + r = bitmap.getWidth() / 2f; } paint.setAntiAlias(true); @@ -506,32 +506,31 @@ public static double probiToDouble(String probi) { /** * Expands touchable area of a small view - * @param parentView - * @param childView - * @param extraPadding: dp + * + * @param parentView Parent view. + * @param childView Child view. + * @param extraPadding Extra padding in dp. */ - public static void expandTouchArea(final View parentView, final View childView, final int extraPadding) { - parentView.post(new Runnable() { - @Override - public void run() { - Rect rect = new Rect(); - childView.getHitRect(rect); - - int pxPadding = dp2px(extraPadding); - rect.top -= pxPadding; - rect.left -= pxPadding; - rect.right += pxPadding; - rect.bottom += pxPadding; - parentView.setTouchDelegate(new TouchDelegate(rect, childView)); - } - }); + public static void expandTouchArea( + final View parentView, final View childView, final int extraPadding) { + parentView.post( + new Runnable() { + @Override + public void run() { + Rect rect = new Rect(); + childView.getHitRect(rect); + + int pxPadding = dp2px(extraPadding); + rect.top -= pxPadding; + rect.left -= pxPadding; + rect.right += pxPadding; + rect.bottom += pxPadding; + parentView.setTouchDelegate(new TouchDelegate(rect, childView)); + } + }); } - /** - * Converts DP into PX - * @param dp - * @return - */ + /** Converts DP into PX */ public static int dp2px(int dp) { DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics(); float px = dp * (metrics.densityDpi / DP_PER_INCH_MDPI); diff --git a/android/java/org/chromium/chrome/browser/BraveRewardsNativeWorker.java b/android/java/org/chromium/chrome/browser/BraveRewardsNativeWorker.java index 15a4bd900b06..99fd7e976273 100644 --- a/android/java/org/chromium/chrome/browser/BraveRewardsNativeWorker.java +++ b/android/java/org/chromium/chrome/browser/BraveRewardsNativeWorker.java @@ -81,6 +81,11 @@ private void init() { } } + /** + * A finalizer is required to ensure that the native object associated with this descriptor gets + * torn down, otherwise there would be a memory leak. + */ + @SuppressWarnings("Finalize") @Override protected void finalize() { destroy(); diff --git a/android/java/org/chromium/chrome/browser/BraveSyncWorker.java b/android/java/org/chromium/chrome/browser/BraveSyncWorker.java index 7e07c9d2af92..8ef588ccffc3 100644 --- a/android/java/org/chromium/chrome/browser/BraveSyncWorker.java +++ b/android/java/org/chromium/chrome/browser/BraveSyncWorker.java @@ -49,6 +49,11 @@ private void init() { } } + /** + * A finalizer is required to ensure that the native object associated with this descriptor gets + * torn down, otherwise there would be a memory leak. + */ + @SuppressWarnings("Finalize") @Override protected void finalize() { destroy(); diff --git a/android/java/org/chromium/chrome/browser/DormantUsersEngagementDialogFragment.java b/android/java/org/chromium/chrome/browser/DormantUsersEngagementDialogFragment.java index ce56dedf09d3..c7c30ca82cc2 100644 --- a/android/java/org/chromium/chrome/browser/DormantUsersEngagementDialogFragment.java +++ b/android/java/org/chromium/chrome/browser/DormantUsersEngagementDialogFragment.java @@ -63,25 +63,28 @@ public void onViewCreated(View view, Bundle savedInstanceState) { } Button doneButton = view.findViewById(R.id.btn_done); - doneButton.setOnClickListener((new View.OnClickListener() { - @Override - public void onClick(View v) { - try { - BraveSetDefaultBrowserUtils.setDefaultBrowser(BraveActivity.getBraveActivity()); - } catch (BraveActivity.BraveActivityNotFoundException e) { - Log.e(TAG, "onViewCreated doneButton click " + e); - } - dismiss(); - } - })); + doneButton.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View v) { + try { + BraveSetDefaultBrowserUtils.setDefaultBrowser( + BraveActivity.getBraveActivity()); + } catch (BraveActivity.BraveActivityNotFoundException e) { + Log.e(TAG, "onViewCreated doneButton click " + e); + } + dismiss(); + } + }); Button notNowButton = view.findViewById(R.id.btn_not_now); - notNowButton.setOnClickListener((new View.OnClickListener() { - @Override - public void onClick(View v) { - dismiss(); - } - })); + notNowButton.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View v) { + dismiss(); + } + }); } public void setNotificationType(String notificationType) { diff --git a/android/java/org/chromium/chrome/browser/app/BraveActivity.java b/android/java/org/chromium/chrome/browser/app/BraveActivity.java index 73afd9938b2b..7d033ec6265c 100644 --- a/android/java/org/chromium/chrome/browser/app/BraveActivity.java +++ b/android/java/org/chromium/chrome/browser/app/BraveActivity.java @@ -164,7 +164,7 @@ import org.chromium.chrome.browser.settings.BraveNewsPreferencesV2; import org.chromium.chrome.browser.settings.BraveSearchEngineUtils; import org.chromium.chrome.browser.settings.BraveWalletPreferences; -import org.chromium.chrome.browser.settings.SettingsLauncherFactory; +import org.chromium.chrome.browser.settings.SettingsNavigationFactory; import org.chromium.chrome.browser.settings.developer.BraveQAPreferences; import org.chromium.chrome.browser.share.ShareDelegate; import org.chromium.chrome.browser.share.ShareDelegate.ShareOrigin; @@ -202,7 +202,7 @@ import org.chromium.chrome.browser.vpn.utils.BraveVpnProfileUtils; import org.chromium.chrome.browser.vpn.utils.BraveVpnUtils; import org.chromium.chrome.browser.vpn.wireguard.WireguardConfigUtils; -import org.chromium.components.browser_ui.settings.SettingsLauncher; +import org.chromium.components.browser_ui.settings.SettingsNavigation; import org.chromium.components.embedder_support.util.UrlConstants; import org.chromium.components.embedder_support.util.UrlUtilities; import org.chromium.components.safe_browsing.BraveSafeBrowsingApiHandler; @@ -1535,28 +1535,28 @@ private void checkFingerPrintingOnUpgrade(boolean isFirstInstall) { } public void openBravePlaylistSettings() { - SettingsLauncher settingsLauncher = SettingsLauncherFactory.createSettingsLauncher(); - settingsLauncher.launchSettingsActivity(this, BravePlaylistPreferences.class); + SettingsNavigation settingsLauncher = SettingsNavigationFactory.createSettingsNavigation(); + settingsLauncher.startSettings(this, BravePlaylistPreferences.class); } public void openBraveNewsSettings() { - SettingsLauncher settingsLauncher = SettingsLauncherFactory.createSettingsLauncher(); - settingsLauncher.launchSettingsActivity(this, BraveNewsPreferencesV2.class); + SettingsNavigation settingsLauncher = SettingsNavigationFactory.createSettingsNavigation(); + settingsLauncher.startSettings(this, BraveNewsPreferencesV2.class); } public void openBraveContentFilteringSettings() { - SettingsLauncher settingsLauncher = SettingsLauncherFactory.createSettingsLauncher(); - settingsLauncher.launchSettingsActivity(this, ContentFilteringFragment.class); + SettingsNavigation settingsLauncher = SettingsNavigationFactory.createSettingsNavigation(); + settingsLauncher.startSettings(this, ContentFilteringFragment.class); } public void openBraveWalletSettings() { - SettingsLauncher settingsLauncher = SettingsLauncherFactory.createSettingsLauncher(); - settingsLauncher.launchSettingsActivity(this, BraveWalletPreferences.class); + SettingsNavigation settingsLauncher = SettingsNavigationFactory.createSettingsNavigation(); + settingsLauncher.startSettings(this, BraveWalletPreferences.class); } public void openBraveConnectedSitesSettings() { - SettingsLauncher settingsLauncher = SettingsLauncherFactory.createSettingsLauncher(); - settingsLauncher.launchSettingsActivity(this, BraveWalletEthereumConnectedSites.class); + SettingsNavigation settingsLauncher = SettingsNavigationFactory.createSettingsNavigation(); + settingsLauncher.startSettings(this, BraveWalletEthereumConnectedSites.class); } public void openBraveWallet(boolean fromDapp, boolean setupAction, boolean restoreAction) { @@ -1607,7 +1607,7 @@ private void checkForYandexSE() { BraveSearchEngineUtils.setDSEPrefs(yandexTemplateUrl, lastUsedRegularProfile); BraveSearchEngineUtils.setDSEPrefs( yandexTemplateUrl, - lastUsedRegularProfile.getPrimaryOTRProfile(/* createIfNeeded= */ true)); + lastUsedRegularProfile.getPrimaryOtrProfile(/* createIfNeeded= */ true)); } } } diff --git a/android/java/org/chromium/chrome/browser/app/domain/KeyringModel.java b/android/java/org/chromium/chrome/browser/app/domain/KeyringModel.java index f81bd57e81e2..35c72c635aa0 100644 --- a/android/java/org/chromium/chrome/browser/app/domain/KeyringModel.java +++ b/android/java/org/chromium/chrome/browser/app/domain/KeyringModel.java @@ -262,7 +262,7 @@ public void createWallet( null); } - private void generateWallet( + private void generateWallet( @NonNull final String password, @Nullable final String recoveryPhrase, final boolean legacyRestoreEnabled, diff --git a/android/java/org/chromium/chrome/browser/app/shimmer/ShimmerDrawable.java b/android/java/org/chromium/chrome/browser/app/shimmer/ShimmerDrawable.java index 8c635aa9d1f2..1d6d942d14fa 100644 --- a/android/java/org/chromium/chrome/browser/app/shimmer/ShimmerDrawable.java +++ b/android/java/org/chromium/chrome/browser/app/shimmer/ShimmerDrawable.java @@ -193,8 +193,10 @@ private void updateValueAnimator() { started = false; } - mValueAnimator = ValueAnimator.ofFloat( - 0f, 1f + (float) (mShimmer.repeatDelay / mShimmer.animationDuration)); + mValueAnimator = + ValueAnimator.ofFloat( + 0f, + 1f + (float) (mShimmer.repeatDelay / ((float) mShimmer.animationDuration))); mValueAnimator.setInterpolator(new LinearInterpolator()); mValueAnimator.setRepeatMode(mShimmer.repeatMode); mValueAnimator.setStartDelay(mShimmer.startDelay); diff --git a/android/java/org/chromium/chrome/browser/billing/InAppPurchaseWrapper.java b/android/java/org/chromium/chrome/browser/billing/InAppPurchaseWrapper.java index f9327920332a..7c07055b4b0d 100644 --- a/android/java/org/chromium/chrome/browser/billing/InAppPurchaseWrapper.java +++ b/android/java/org/chromium/chrome/browser/billing/InAppPurchaseWrapper.java @@ -284,46 +284,57 @@ public void queryPurchases(MutableLiveData mutableActivePurchases MutableLiveData _billingConnectionState = new MutableLiveData(); LiveData billingConnectionState = _billingConnectionState; startBillingServiceConnection(_billingConnectionState); - LiveDataUtil.observeOnce(billingConnectionState, isConnected -> { - if (isConnected) { - mBillingClient.queryPurchasesAsync( - QueryPurchasesParams.newBuilder() - .setProductType(BillingClient.ProductType.SUBS) - .build(), - (billingResult, purchases) -> { - // End connection after getting purchases - endConnection(); - - PurchaseModel activePurchaseModel = null; - if (billingResult.getResponseCode() - == BillingClient.BillingResponseCode.OK) { - for (Purchase purchase : purchases) { - if (purchase.getPurchaseState() - != Purchase.PurchaseState.PURCHASED) { - continue; - } - List productIds = purchase.getProducts(); - boolean isVPNProduct = isVPNProduct(productIds); - boolean isLeoProduct = isLeoProduct(productIds); - if (isVPNProduct && type.equals(SubscriptionProduct.VPN) || - isLeoProduct && type.equals(SubscriptionProduct.LEO)) { - activePurchaseModel = new PurchaseModel( - purchase.getPurchaseToken(), - purchase.getProducts().get(0).toString(), purchase); - break; + LiveDataUtil.observeOnce( + billingConnectionState, + isConnected -> { + if (isConnected) { + mBillingClient.queryPurchasesAsync( + QueryPurchasesParams.newBuilder() + .setProductType(BillingClient.ProductType.SUBS) + .build(), + (billingResult, purchases) -> { + // End connection after getting purchases + endConnection(); + + PurchaseModel activePurchaseModel = null; + if (billingResult.getResponseCode() + == BillingClient.BillingResponseCode.OK) { + for (Purchase purchase : purchases) { + if (purchase.getPurchaseState() + != Purchase.PurchaseState.PURCHASED) { + continue; + } + List productIds = purchase.getProducts(); + boolean isVPNProduct = isVPNProduct(productIds); + boolean isLeoProduct = isLeoProduct(productIds); + if ((isVPNProduct + && type.equals(SubscriptionProduct.VPN)) + || (isLeoProduct + && type.equals( + SubscriptionProduct.LEO))) { + activePurchaseModel = + new PurchaseModel( + purchase.getPurchaseToken(), + purchase.getProducts() + .get(0) + .toString(), + purchase); + break; + } + } + } else { + Log.e( + TAG, + "queryPurchases failed" + + billingResult.getDebugMessage()); + showToast(billingResult.getDebugMessage()); } - } - } else { - Log.e(TAG, - "queryPurchases failed" + billingResult.getDebugMessage()); - showToast(billingResult.getDebugMessage()); - } - mutableActivePurchases.postValue(activePurchaseModel); - }); - } else { - mutableActivePurchases.postValue(null); - } - }); + mutableActivePurchases.postValue(activePurchaseModel); + }); + } else { + mutableActivePurchases.postValue(null); + } + }); } public void initiatePurchase(Activity activity, ProductDetails productDetails) { diff --git a/android/java/org/chromium/chrome/browser/bookmarks/BraveBookmarkManagerMediator.java b/android/java/org/chromium/chrome/browser/bookmarks/BraveBookmarkManagerMediator.java index 929113ee1f11..bd246771a179 100644 --- a/android/java/org/chromium/chrome/browser/bookmarks/BraveBookmarkManagerMediator.java +++ b/android/java/org/chromium/chrome/browser/bookmarks/BraveBookmarkManagerMediator.java @@ -30,7 +30,6 @@ import org.chromium.components.browser_ui.widget.selectable_list.SelectableListLayout; import org.chromium.components.browser_ui.widget.selectable_list.SelectionDelegate; import org.chromium.components.commerce.core.ShoppingService; -import org.chromium.components.favicon.LargeIconBridge; import org.chromium.ui.base.ActivityWindowAndroid; import org.chromium.ui.base.WindowAndroid; import org.chromium.ui.modelutil.MVCListAdapter.ModelList; @@ -61,7 +60,6 @@ class BraveBookmarkManagerMediator SelectionDelegate selectionDelegate, RecyclerView recyclerView, DragReorderableRecyclerViewAdapter dragReorderableRecyclerViewAdapter, - LargeIconBridge largeIconBridge, boolean isDialogUi, ObservableSupplierImpl backPressStateSupplier, Profile profile, @@ -82,7 +80,6 @@ class BraveBookmarkManagerMediator selectionDelegate, recyclerView, dragReorderableRecyclerViewAdapter, - largeIconBridge, isDialogUi, backPressStateSupplier, profile, @@ -210,18 +207,21 @@ public void exportBookmarks() { } private void doExportBookmarks() { - PostTask.postTask(TaskTraits.BEST_EFFORT_MAY_BLOCK, () -> { - File downloadDir = - Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS); - int num = 1; - String exportFileName = "bookmarks.html"; - File file = new File(downloadDir, exportFileName); - while (file.exists()) { - exportFileName = "bookmarks (" + (num++) + ").html"; - file = new File(downloadDir, exportFileName); - } - doExportBookmarksOnUI(file); - }); + PostTask.postTask( + TaskTraits.BEST_EFFORT_MAY_BLOCK, + () -> { + File downloadDir = + Environment.getExternalStoragePublicDirectory( + Environment.DIRECTORY_DOWNLOADS); + int num = 1; + String exportFileName = "bookmarks.html"; + File file = new File(downloadDir, exportFileName); + while (file.exists()) { + exportFileName = "bookmarks (" + num++ + ").html"; + file = new File(downloadDir, exportFileName); + } + doExportBookmarksOnUI(file); + }); } private void doExportBookmarksOnUI(File file) { diff --git a/android/java/org/chromium/chrome/browser/bookmarks/BraveBookmarkUiPrefs.java b/android/java/org/chromium/chrome/browser/bookmarks/BraveBookmarkUiPrefs.java index 5eb46ea94889..903cb522826d 100644 --- a/android/java/org/chromium/chrome/browser/bookmarks/BraveBookmarkUiPrefs.java +++ b/android/java/org/chromium/chrome/browser/bookmarks/BraveBookmarkUiPrefs.java @@ -21,10 +21,6 @@ public BraveBookmarkUiPrefs(SharedPreferencesManager prefsManager) { /** Returns how the bookmark rows should be displayed, doesn't write anything to prefs. */ @Override public @BookmarkRowDisplayPref int getBookmarkRowDisplayPref() { - if (!BookmarkFeatures.isAndroidImprovedBookmarksEnabled()) { - return super.getBookmarkRowDisplayPref(); - } - return mPrefsManager.readInt( ChromePreferenceKeys.BOOKMARKS_VISUALS_PREF, BookmarkRowDisplayPref.COMPACT); } diff --git a/android/java/org/chromium/chrome/browser/brave_leo/BraveLeoActivity.java b/android/java/org/chromium/chrome/browser/brave_leo/BraveLeoActivity.java index 99b89eda8136..e503be208a03 100644 --- a/android/java/org/chromium/chrome/browser/brave_leo/BraveLeoActivity.java +++ b/android/java/org/chromium/chrome/browser/brave_leo/BraveLeoActivity.java @@ -103,7 +103,8 @@ protected RootUiCoordinator createRootUiCoordinator() { () -> mTabController, () -> mMinimizationManagerHolder.getMinimizationManager(), () -> mFeatureOverridesManager, - getBaseChromeLayout()); + getBaseChromeLayout(), + getEdgeToEdgeStateProvider()); return mBaseCustomTabRootUiCoordinator; } } diff --git a/android/java/org/chromium/chrome/browser/brave_leo/BraveLeoCustomTabRootUiCoordinator.java b/android/java/org/chromium/chrome/browser/brave_leo/BraveLeoCustomTabRootUiCoordinator.java index 4cdad05521a0..3df247f93914 100644 --- a/android/java/org/chromium/chrome/browser/brave_leo/BraveLeoCustomTabRootUiCoordinator.java +++ b/android/java/org/chromium/chrome/browser/brave_leo/BraveLeoCustomTabRootUiCoordinator.java @@ -42,6 +42,7 @@ import org.chromium.chrome.browser.ui.edge_to_edge.EdgeToEdgeController; import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager; import org.chromium.chrome.browser.ui.system.StatusBarColorController.StatusBarColorProvider; +import org.chromium.components.browser_ui.edge_to_edge.EdgeToEdgeStateProvider; import org.chromium.components.browser_ui.widget.MenuOrKeyboardActionController; import org.chromium.ui.base.ActivityWindowAndroid; import org.chromium.ui.base.IntentRequestTracker; @@ -88,7 +89,8 @@ public BraveLeoCustomTabRootUiCoordinator( @NonNull Supplier tabController, @NonNull Supplier minimizeDelegateSupplier, @NonNull Supplier featureOverridesManagerSupplier, - @Nullable View baseChromeLayout) { + @Nullable View baseChromeLayout, + @NonNull EdgeToEdgeStateProvider edgeToEdgeStateProvider) { super( activity, shareDelegateSupplier, @@ -126,7 +128,8 @@ public BraveLeoCustomTabRootUiCoordinator( tabController, minimizeDelegateSupplier, featureOverridesManagerSupplier, - baseChromeLayout); + baseChromeLayout, + edgeToEdgeStateProvider); } @Override diff --git a/android/java/org/chromium/chrome/browser/brave_leo/BraveLeoSettingsLauncherHelper.java b/android/java/org/chromium/chrome/browser/brave_leo/BraveLeoSettingsLauncherHelper.java index 73a9342fd9a6..31fffb822c91 100644 --- a/android/java/org/chromium/chrome/browser/brave_leo/BraveLeoSettingsLauncherHelper.java +++ b/android/java/org/chromium/chrome/browser/brave_leo/BraveLeoSettingsLauncherHelper.java @@ -12,16 +12,16 @@ import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.settings.BraveLeoPreferences; -import org.chromium.chrome.browser.settings.SettingsLauncherFactory; +import org.chromium.chrome.browser.settings.SettingsNavigationFactory; import org.chromium.chrome.browser.util.TabUtils; -import org.chromium.components.browser_ui.settings.SettingsLauncher; +import org.chromium.components.browser_ui.settings.SettingsNavigation; import org.chromium.content_public.browser.WebContents; import org.chromium.ui.base.WindowAndroid; /** Launches Brave Leo settings page or subscription. */ public class BraveLeoSettingsLauncherHelper { private static final String ACCOUNT_PAGE_URL = "https://account.brave.com/"; - private static SettingsLauncher sLauncher; + private static SettingsNavigation sLauncher; @CalledByNative private static void showBraveLeoSettings(WebContents webContents) { @@ -29,7 +29,7 @@ private static void showBraveLeoSettings(WebContents webContents) { if (context == null) { return; } - getLauncher().launchSettingsActivity(context, BraveLeoPreferences.class); + getLauncher().startSettings(context, BraveLeoPreferences.class); } @CalledByNative @@ -71,7 +71,7 @@ private static void closeActivity(WebContents webContents) { activity.finish(); } - private static SettingsLauncher getLauncher() { - return sLauncher != null ? sLauncher : SettingsLauncherFactory.createSettingsLauncher(); + private static SettingsNavigation getLauncher() { + return sLauncher != null ? sLauncher : SettingsNavigationFactory.createSettingsNavigation(); } } diff --git a/android/java/org/chromium/chrome/browser/brave_news/CardBuilderFeedCard.java b/android/java/org/chromium/chrome/browser/brave_news/CardBuilderFeedCard.java index 09c19b304a39..4b0415137a9d 100644 --- a/android/java/org/chromium/chrome/browser/brave_news/CardBuilderFeedCard.java +++ b/android/java/org/chromium/chrome/browser/brave_news/CardBuilderFeedCard.java @@ -967,9 +967,7 @@ private void addElementsToSingleLayout(ViewGroup view, int index, int itemType, promoted.setCompoundDrawablesWithIntrinsicBounds( R.drawable.ic_promoted, 0, 0, 0); - StringBuilder promotedTitle = new StringBuilder(" " - + mActivity.getResources().getString( - R.string.brave_news_promoted_title)); + promoted.setText( mActivity.getResources().getString(R.string.brave_news_promoted_title)); diff --git a/android/java/org/chromium/chrome/browser/brave_news/models/FeedItemCard.java b/android/java/org/chromium/chrome/browser/brave_news/models/FeedItemCard.java index 55172d6b2e29..adc17c0d895b 100644 --- a/android/java/org/chromium/chrome/browser/brave_news/models/FeedItemCard.java +++ b/android/java/org/chromium/chrome/browser/brave_news/models/FeedItemCard.java @@ -40,10 +40,17 @@ public void setImageByte(byte[] imageByte) { this.imageByte = imageByte; } + @SuppressWarnings("ObjectToString") @Override public String toString() { return "FeedItemCard{" - + "feedItem=" + feedItem + ", cardType=" + cardType + ", imageByte='" - + Arrays.toString(imageByte) + '\'' + '}'; + + "feedItem=" + + feedItem + + ", cardType=" + + cardType + + ", imageByte='" + + Arrays.toString(imageByte) + + '\'' + + '}'; } } diff --git a/android/java/org/chromium/chrome/browser/brave_news/models/FeedItemsCard.java b/android/java/org/chromium/chrome/browser/brave_news/models/FeedItemsCard.java index cd3fb09f586a..d38a35c6cb96 100644 --- a/android/java/org/chromium/chrome/browser/brave_news/models/FeedItemsCard.java +++ b/android/java/org/chromium/chrome/browser/brave_news/models/FeedItemsCard.java @@ -70,10 +70,18 @@ public void setDisplayAd(DisplayAd displayAd) { this.displayAd = displayAd; } + @SuppressWarnings("ObjectToString") @Override public String toString() { return "FeedItemsCard{" - + "feedItems=" + feedItems + ", cardType=" + cardType + ", displayAd=" + displayAd - + ", imageByte=" + Arrays.toString(imageByte) + '}'; + + "feedItems=" + + feedItems + + ", cardType=" + + cardType + + ", displayAd=" + + displayAd + + ", imageByte=" + + Arrays.toString(imageByte) + + '}'; } } diff --git a/android/java/org/chromium/chrome/browser/crypto_wallet/activities/BraveWalletActivity.java b/android/java/org/chromium/chrome/browser/crypto_wallet/activities/BraveWalletActivity.java index b69d43e0db83..c92fc40cca8f 100644 --- a/android/java/org/chromium/chrome/browser/crypto_wallet/activities/BraveWalletActivity.java +++ b/android/java/org/chromium/chrome/browser/crypto_wallet/activities/BraveWalletActivity.java @@ -30,9 +30,9 @@ import org.chromium.chrome.browser.crypto_wallet.util.Utils; import org.chromium.chrome.browser.crypto_wallet.util.WalletUtils; import org.chromium.chrome.browser.settings.BraveWalletPreferences; -import org.chromium.chrome.browser.settings.SettingsLauncherFactory; +import org.chromium.chrome.browser.settings.SettingsNavigationFactory; import org.chromium.components.browser_ui.modaldialog.AppModalPresenter; -import org.chromium.components.browser_ui.settings.SettingsLauncher; +import org.chromium.components.browser_ui.settings.SettingsNavigation; import org.chromium.ui.base.ActivityWindowAndroid; import org.chromium.ui.modaldialog.ModalDialogManager; @@ -74,8 +74,9 @@ public boolean onCreateOptionsMenu(Menu menu) { @Override public boolean onOptionsItemSelected(@NonNull MenuItem item) { if (item.getItemId() == R.id.settings) { - SettingsLauncher settingsLauncher = SettingsLauncherFactory.createSettingsLauncher(); - settingsLauncher.launchSettingsActivity(this, BraveWalletPreferences.class); + SettingsNavigation settingsLauncher = + SettingsNavigationFactory.createSettingsNavigation(); + settingsLauncher.startSettings(this, BraveWalletPreferences.class); return true; } else if (item.getItemId() == R.id.lock) { if (mKeyringService != null) { diff --git a/android/java/org/chromium/chrome/browser/crypto_wallet/activities/BraveWalletDAppsActivity.java b/android/java/org/chromium/chrome/browser/crypto_wallet/activities/BraveWalletDAppsActivity.java index 7fd0769e48a9..2a2bca862da9 100644 --- a/android/java/org/chromium/chrome/browser/crypto_wallet/activities/BraveWalletDAppsActivity.java +++ b/android/java/org/chromium/chrome/browser/crypto_wallet/activities/BraveWalletDAppsActivity.java @@ -66,7 +66,7 @@ public enum ActivityType { SIGN_MESSAGE_ERROR(11), FINISH(12); - private int mValue; + private final int mValue; private static Map sMap = new HashMap<>(); private ActivityType(int value) { diff --git a/android/java/org/chromium/chrome/browser/crypto_wallet/activities/NetworkSelectorActivity.java b/android/java/org/chromium/chrome/browser/crypto_wallet/activities/NetworkSelectorActivity.java index 65279da5eba3..6c749b9eeebd 100644 --- a/android/java/org/chromium/chrome/browser/crypto_wallet/activities/NetworkSelectorActivity.java +++ b/android/java/org/chromium/chrome/browser/crypto_wallet/activities/NetworkSelectorActivity.java @@ -30,7 +30,7 @@ import org.chromium.chrome.browser.crypto_wallet.util.WalletConstants; import org.chromium.chrome.browser.settings.BraveSettingsLauncherImpl; import org.chromium.chrome.browser.settings.BraveWalletAddNetworksFragment; -import org.chromium.components.browser_ui.settings.SettingsLauncher; +import org.chromium.components.browser_ui.settings.SettingsNavigation; import java.util.List; import java.util.function.Predicate; @@ -42,7 +42,7 @@ public class NetworkSelectorActivity extends BraveWalletBaseActivity private RecyclerView mRVNetworkSelector; private NetworkSelectorAdapter mNetworkSelectorAdapter; private MaterialToolbar mToolbar; - private SettingsLauncher mSettingsLauncher; + private SettingsNavigation mSettingsLauncher; private WalletModel mWalletModel; private NetworkModel mNetworkModel; @@ -142,7 +142,7 @@ private void launchAddNetwork() { fragmentArgs.putString(ADD_NETWORK_FRAGMENT_ARG_CHAIN_ID, ""); fragmentArgs.putBoolean(ADD_NETWORK_FRAGMENT_ARG_ACTIVE_NETWORK, false); Intent intent = - mSettingsLauncher.createSettingsActivityIntent( + mSettingsLauncher.createSettingsIntent( this, BraveWalletAddNetworksFragment.class, fragmentArgs); startActivity(intent); } diff --git a/android/java/org/chromium/chrome/browser/crypto_wallet/adapters/CreateAccountAdapter.java b/android/java/org/chromium/chrome/browser/crypto_wallet/adapters/CreateAccountAdapter.java index 8b8088d44283..469dff884dab 100644 --- a/android/java/org/chromium/chrome/browser/crypto_wallet/adapters/CreateAccountAdapter.java +++ b/android/java/org/chromium/chrome/browser/crypto_wallet/adapters/CreateAccountAdapter.java @@ -36,7 +36,7 @@ public CreateAccountAdapter( Context context, List cryptoAccountTypeInfos) { mCryptoAccountTypeInfos = cryptoAccountTypeInfos; this.mContext = context; - inflater = (LayoutInflater.from(context)); + inflater = LayoutInflater.from(context); mExecutor = Executors.newSingleThreadExecutor(); mHandler = new Handler(Looper.getMainLooper()); } diff --git a/android/java/org/chromium/chrome/browser/crypto_wallet/controller/DAppsWalletController.java b/android/java/org/chromium/chrome/browser/crypto_wallet/controller/DAppsWalletController.java index 11dde4b1a057..bc5d0c2d3ef7 100644 --- a/android/java/org/chromium/chrome/browser/crypto_wallet/controller/DAppsWalletController.java +++ b/android/java/org/chromium/chrome/browser/crypto_wallet/controller/DAppsWalletController.java @@ -152,7 +152,7 @@ private void setupLifeCycleUpdater() { private void showOnBoardingOrUnlock() { int dialogStyle = DAppsDialog.DAppsDialogStyle.BOTTOM; - if (mFullscreenManager != null && mFullscreenManager.getPersistentFullscreenMode() + if ((mFullscreenManager != null && mFullscreenManager.getPersistentFullscreenMode()) || shouldShowNotificationAtTop(mActivity)) { dialogStyle = DAppsDialog.DAppsDialogStyle.TOP; } diff --git a/android/java/org/chromium/chrome/browser/crypto_wallet/util/AndroidUtils.java b/android/java/org/chromium/chrome/browser/crypto_wallet/util/AndroidUtils.java index 905625442c3b..3459a73a8ef9 100644 --- a/android/java/org/chromium/chrome/browser/crypto_wallet/util/AndroidUtils.java +++ b/android/java/org/chromium/chrome/browser/crypto_wallet/util/AndroidUtils.java @@ -113,7 +113,7 @@ public static boolean canUpdateFragmentUi(Fragment frag) { */ public static int getSkeletonRowCount(int skeletonRowHeight) { int pxHeight = getScreenHeight(); - return (int) Math.floor(pxHeight / skeletonRowHeight); + return (int) Math.floor((double) (pxHeight / ((double) skeletonRowHeight))); } /** diff --git a/android/java/org/chromium/chrome/browser/crypto_wallet/util/Blockies.java b/android/java/org/chromium/chrome/browser/crypto_wallet/util/Blockies.java index 8f766bce0285..d31d9d5efead 100644 --- a/android/java/org/chromium/chrome/browser/crypto_wallet/util/Blockies.java +++ b/android/java/org/chromium/chrome/browser/crypto_wallet/util/Blockies.java @@ -141,8 +141,8 @@ private static double rand() { RAND_SEED[2] = RAND_SEED[3]; RAND_SEED[3] = (RAND_SEED[3] ^ (RAND_SEED[3] >> 19) ^ t ^ (t >> 8)); - double num = (RAND_SEED[3]); - double den = ((1 << 31)); + double num = RAND_SEED[3]; + double den = (1 << 31); return Math.abs(num / den); } diff --git a/android/java/org/chromium/chrome/browser/crypto_wallet/util/ParsedTransaction.java b/android/java/org/chromium/chrome/browser/crypto_wallet/util/ParsedTransaction.java index 6d293a39f3a6..832a3c148078 100644 --- a/android/java/org/chromium/chrome/browser/crypto_wallet/util/ParsedTransaction.java +++ b/android/java/org/chromium/chrome/browser/crypto_wallet/util/ParsedTransaction.java @@ -233,7 +233,7 @@ public static ParsedTransaction parseTransaction( if (txType == TransactionType.SOLANA_DAPP_SIGN_TRANSACTION || txType == TransactionType.SOLANA_DAPP_SIGN_AND_SEND_TRANSACTION || txType == TransactionType.SOLANA_SWAP - || txType == TransactionType.OTHER && solTxData != null) { + || (txType == TransactionType.OTHER && solTxData != null)) { if (solTxData == null) { parsedTransaction.recipient = ""; parsedTransaction.recipientLabel = ""; @@ -243,8 +243,8 @@ public static ParsedTransaction parseTransaction( parsedTransaction.symbol = ""; return parsedTransaction; } - assert (txInfo.fromAddress != null); - assert (txInfo.fromAddress.equals(account.address)); + assert txInfo.fromAddress != null; + assert txInfo.fromAddress.equals(account.address); BigDecimal lamportTransferredAmount = new BigDecimal(value); for (SolanaInstruction solanaInstruction : solTxData.instructions) { SolanaInstructionPresenter presenter = diff --git a/android/java/org/chromium/chrome/browser/crypto_wallet/util/PendingTxHelper.java b/android/java/org/chromium/chrome/browser/crypto_wallet/util/PendingTxHelper.java index d4bd22409dc8..c2b509dac82e 100644 --- a/android/java/org/chromium/chrome/browser/crypto_wallet/util/PendingTxHelper.java +++ b/android/java/org/chromium/chrome/browser/crypto_wallet/util/PendingTxHelper.java @@ -259,8 +259,8 @@ && getSelectedPendingRequest().id.equals(txInfo.id)) { mTransactionInfos.clear(); mTransactionInfos.addAll(newTransactionInfos); Collections.sort(mTransactionInfos, sortByDateComparator); - if ((_mSelectedPendingRequest.getValue() != null - && _mSelectedPendingRequest.getValue().id.equals(txInfo.id) + if (((_mSelectedPendingRequest.getValue() != null + && _mSelectedPendingRequest.getValue().id.equals(txInfo.id)) || _mSelectedPendingRequest.getValue() == null)) { postTxUpdates(); } diff --git a/android/java/org/chromium/chrome/browser/crypto_wallet/util/TransactionUtils.java b/android/java/org/chromium/chrome/browser/crypto_wallet/util/TransactionUtils.java index a11f71d1f164..645fa3bf87f8 100644 --- a/android/java/org/chromium/chrome/browser/crypto_wallet/util/TransactionUtils.java +++ b/android/java/org/chromium/chrome/browser/crypto_wallet/util/TransactionUtils.java @@ -70,8 +70,8 @@ public static int getCoinFromTxDataUnion(@NonNull final TxDataUnion txDataUnion) public static boolean isSolanaTx(TransactionInfo transactionInfo) { if (transactionInfo == null || transactionInfo.txDataUnion == null) return false; return WalletConstants.SOLANA_TRANSACTION_TYPES.contains(transactionInfo.txType) - || transactionInfo.txType == TransactionType.OTHER - && safeSolData(transactionInfo.txDataUnion) != null; + || (transactionInfo.txType == TransactionType.OTHER + && safeSolData(transactionInfo.txDataUnion) != null); } public static String getSolanaProgramIdName(String programId, Context context) { diff --git a/android/java/org/chromium/chrome/browser/custom_layout/NonSwipeableViewPager.java b/android/java/org/chromium/chrome/browser/custom_layout/NonSwipeableViewPager.java index 779b109884c8..461feca94b78 100644 --- a/android/java/org/chromium/chrome/browser/custom_layout/NonSwipeableViewPager.java +++ b/android/java/org/chromium/chrome/browser/custom_layout/NonSwipeableViewPager.java @@ -54,7 +54,7 @@ private void setViewPagerScroller() { } } - public class ViewPagerScroller extends Scroller { + public static class ViewPagerScroller extends Scroller { ViewPagerScroller(Context context) { super(context, new DecelerateInterpolator()); } diff --git a/android/java/org/chromium/chrome/browser/informers/BraveSyncAccountDeletedInformer.java b/android/java/org/chromium/chrome/browser/informers/BraveSyncAccountDeletedInformer.java index b1bc7ca9ad4d..1fbd0074c07a 100644 --- a/android/java/org/chromium/chrome/browser/informers/BraveSyncAccountDeletedInformer.java +++ b/android/java/org/chromium/chrome/browser/informers/BraveSyncAccountDeletedInformer.java @@ -14,11 +14,11 @@ import org.chromium.chrome.browser.app.BraveActivity; import org.chromium.chrome.browser.infobar.BraveInfoBarIdentifier; import org.chromium.chrome.browser.settings.BraveSyncScreensPreference; -import org.chromium.chrome.browser.settings.SettingsLauncherFactory; +import org.chromium.chrome.browser.settings.SettingsNavigationFactory; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.ui.messages.infobar.BraveSimpleConfirmInfoBarBuilder; import org.chromium.chrome.browser.ui.messages.infobar.SimpleConfirmInfoBarBuilder; -import org.chromium.components.browser_ui.settings.SettingsLauncher; +import org.chromium.components.browser_ui.settings.SettingsNavigation; public class BraveSyncAccountDeletedInformer { private static final String TAG = "SyncAccountDeleted"; @@ -59,9 +59,9 @@ public boolean onInfoBarLinkClicked() { // Pressing link `re-create the account` // Don't show the informer again disableInformer(); - SettingsLauncher settingsLauncher = - SettingsLauncherFactory.createSettingsLauncher(); - settingsLauncher.launchSettingsActivity( + SettingsNavigation settingsLauncher = + SettingsNavigationFactory.createSettingsNavigation(); + settingsLauncher.startSettings( ContextUtils.getApplicationContext(), BraveSyncScreensPreference.class); return false; diff --git a/android/java/org/chromium/chrome/browser/misc_metrics/MiscAndroidMetricsFactory.java b/android/java/org/chromium/chrome/browser/misc_metrics/MiscAndroidMetricsFactory.java index 936741eda999..8d45e74be157 100644 --- a/android/java/org/chromium/chrome/browser/misc_metrics/MiscAndroidMetricsFactory.java +++ b/android/java/org/chromium/chrome/browser/misc_metrics/MiscAndroidMetricsFactory.java @@ -44,7 +44,7 @@ public Promise getMetricsService( ConnectionErrorHandler connectionErrorHandler) { final Promise promise = new Promise<>(); - mTaskRunner.postTask( + mTaskRunner.execute( () -> { Profile profile = Utils.getProfile(false); // always use regular profile long nativeHandle = diff --git a/android/java/org/chromium/chrome/browser/multiwindow/BraveMultiInstanceManagerApi31.java b/android/java/org/chromium/chrome/browser/multiwindow/BraveMultiInstanceManagerApi31.java index 642d58910e60..80af3a449458 100644 --- a/android/java/org/chromium/chrome/browser/multiwindow/BraveMultiInstanceManagerApi31.java +++ b/android/java/org/chromium/chrome/browser/multiwindow/BraveMultiInstanceManagerApi31.java @@ -15,11 +15,11 @@ import org.chromium.chrome.browser.lifecycle.ActivityLifecycleDispatcher; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tabmodel.TabModelSelector; -import org.chromium.chrome.browser.ui.desktop_windowing.DesktopWindowStateProvider; import org.chromium.chrome.browser.ui.messages.snackbar.Snackbar; import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager; import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager.SnackbarController; import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManagerProvider; +import org.chromium.components.browser_ui.desktop_windowing.DesktopWindowStateProvider; import org.chromium.components.browser_ui.widget.MenuOrKeyboardActionController; import org.chromium.ui.modaldialog.ModalDialogManager; diff --git a/android/java/org/chromium/chrome/browser/notifications/retention/RetentionNotificationUtil.java b/android/java/org/chromium/chrome/browser/notifications/retention/RetentionNotificationUtil.java index e2122e8adfa1..68743035abbe 100644 --- a/android/java/org/chromium/chrome/browser/notifications/retention/RetentionNotificationUtil.java +++ b/android/java/org/chromium/chrome/browser/notifications/retention/RetentionNotificationUtil.java @@ -25,7 +25,6 @@ import java.util.Calendar; import java.util.Date; -import java.util.HashMap; import java.util.Map; public class RetentionNotificationUtil { @@ -47,45 +46,111 @@ public class RetentionNotificationUtil { public static final String DORMANT_USERS_DAY_25 = "dormant_users_days_25"; public static final String DORMANT_USERS_DAY_40 = "dormant_users_days_40"; - private static Map mNotificationMap = new HashMap() { - { - put(HOUR_3, - new RetentionNotification( - 3, 3 * 60, BraveChannelDefinitions.ChannelId.BRAVE_BROWSER, BRAVE_BROWSER)); - put(HOUR_24, - new RetentionNotification( - 24, 24 * 60, BraveChannelDefinitions.ChannelId.BRAVE_BROWSER, BRAVE_BROWSER)); - put(DAY_6, new RetentionNotification(6, 6 * 24 * 60, BraveChannelDefinitions.ChannelId.BRAVE_BROWSER, BRAVE_BROWSER)); - put(EVERY_SUNDAY, new RetentionNotification(7, -1, BraveChannelDefinitions.ChannelId.BRAVE_BROWSER, BRAVE_BROWSER)); - put(DAY_10, new RetentionNotification(10, 10 * 24 * 60, BraveChannelDefinitions.ChannelId.BRAVE_BROWSER, BRAVE_BROWSER)); - put(DAY_30, new RetentionNotification(30, 30 * 24 * 60, BraveChannelDefinitions.ChannelId.BRAVE_BROWSER, BRAVE_BROWSER)); - put(DAY_35, - new RetentionNotification(35, 35 * 24 * 60, - BraveChannelDefinitions.ChannelId.BRAVE_BROWSER, BRAVE_BROWSER)); - put(DEFAULT_BROWSER_1, - new RetentionNotification(17, 3 * 24 * 60, - BraveChannelDefinitions.ChannelId.BRAVE_BROWSER, BRAVE_BROWSER)); - put(DEFAULT_BROWSER_2, new RetentionNotification(18, 6 * 24 * 60, BraveChannelDefinitions.ChannelId.BRAVE_BROWSER, BRAVE_BROWSER)); - put(DEFAULT_BROWSER_3, - new RetentionNotification(19, 30 * 24 * 60, - BraveChannelDefinitions.ChannelId.BRAVE_BROWSER, BRAVE_BROWSER)); - put(DORMANT_USERS_DAY_14, - new RetentionNotification(20, 14 * 24 * 60, - BraveChannelDefinitions.ChannelId.BRAVE_BROWSER, - ContextUtils.getApplicationContext().getResources().getString( - R.string.dormant_users_engagement_notification_text_1))); - put(DORMANT_USERS_DAY_25, - new RetentionNotification(21, 25 * 24 * 60, - BraveChannelDefinitions.ChannelId.BRAVE_BROWSER, - ContextUtils.getApplicationContext().getResources().getString( - R.string.dormant_users_engagement_notification_text_2))); - put(DORMANT_USERS_DAY_40, - new RetentionNotification(22, 40 * 24 * 60, - BraveChannelDefinitions.ChannelId.BRAVE_BROWSER, - ContextUtils.getApplicationContext().getResources().getString( - R.string.dormant_users_engagement_notification_text_3))); - } - }; + private static Map mNotificationMap = + Map.ofEntries( + Map.entry( + HOUR_3, + new RetentionNotification( + 3, + 3 * 60, + BraveChannelDefinitions.ChannelId.BRAVE_BROWSER, + BRAVE_BROWSER)), + Map.entry( + HOUR_24, + new RetentionNotification( + 24, + 24 * 60, + BraveChannelDefinitions.ChannelId.BRAVE_BROWSER, + BRAVE_BROWSER)), + Map.entry( + DAY_6, + new RetentionNotification( + 6, + 6 * 24 * 60, + BraveChannelDefinitions.ChannelId.BRAVE_BROWSER, + BRAVE_BROWSER)), + Map.entry( + EVERY_SUNDAY, + new RetentionNotification( + 7, + -1, + BraveChannelDefinitions.ChannelId.BRAVE_BROWSER, + BRAVE_BROWSER)), + Map.entry( + DAY_10, + new RetentionNotification( + 10, + 10 * 24 * 60, + BraveChannelDefinitions.ChannelId.BRAVE_BROWSER, + BRAVE_BROWSER)), + Map.entry( + DAY_30, + new RetentionNotification( + 30, + 30 * 24 * 60, + BraveChannelDefinitions.ChannelId.BRAVE_BROWSER, + BRAVE_BROWSER)), + Map.entry( + DAY_35, + new RetentionNotification( + 35, + 35 * 24 * 60, + BraveChannelDefinitions.ChannelId.BRAVE_BROWSER, + BRAVE_BROWSER)), + Map.entry( + DEFAULT_BROWSER_1, + new RetentionNotification( + 17, + 3 * 24 * 60, + BraveChannelDefinitions.ChannelId.BRAVE_BROWSER, + BRAVE_BROWSER)), + Map.entry( + DEFAULT_BROWSER_2, + new RetentionNotification( + 18, + 6 * 24 * 60, + BraveChannelDefinitions.ChannelId.BRAVE_BROWSER, + BRAVE_BROWSER)), + Map.entry( + DEFAULT_BROWSER_3, + new RetentionNotification( + 19, + 30 * 24 * 60, + BraveChannelDefinitions.ChannelId.BRAVE_BROWSER, + BRAVE_BROWSER)), + Map.entry( + DORMANT_USERS_DAY_14, + new RetentionNotification( + 20, + 14 * 24 * 60, + BraveChannelDefinitions.ChannelId.BRAVE_BROWSER, + ContextUtils.getApplicationContext() + .getResources() + .getString( + R.string + .dormant_users_engagement_notification_text_1))), + Map.entry( + DORMANT_USERS_DAY_25, + new RetentionNotification( + 21, + 25 * 24 * 60, + BraveChannelDefinitions.ChannelId.BRAVE_BROWSER, + ContextUtils.getApplicationContext() + .getResources() + .getString( + R.string + .dormant_users_engagement_notification_text_2))), + Map.entry( + DORMANT_USERS_DAY_40, + new RetentionNotification( + 22, + 40 * 24 * 60, + BraveChannelDefinitions.ChannelId.BRAVE_BROWSER, + ContextUtils.getApplicationContext() + .getResources() + .getString( + R.string + .dormant_users_engagement_notification_text_3)))); public static RetentionNotification getNotificationObject(String notificationType) { return mNotificationMap.get(notificationType); diff --git a/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPage.java b/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPage.java index 29fa60664794..1936a4a8e388 100644 --- a/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPage.java +++ b/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPage.java @@ -31,6 +31,7 @@ import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.tasks.HomeSurfaceTracker; import org.chromium.chrome.browser.toolbar.top.Toolbar; +import org.chromium.chrome.browser.ui.edge_to_edge.EdgeToEdgeController; import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager; import org.chromium.chrome.browser.ui.native_page.NativePageHost; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; @@ -71,7 +72,8 @@ public BraveNewTabPage( HomeSurfaceTracker homeSurfaceTracker, ObservableSupplier tabContentManagerSupplier, ObservableSupplier tabStripHeightSupplier, - OneshotSupplier moduleRegistrySupplier) { + OneshotSupplier moduleRegistrySupplier, + ObservableSupplier edgeToEdgeControllerSupplier) { super( activity, browserControlsStateProvider, @@ -94,7 +96,8 @@ public BraveNewTabPage( homeSurfaceTracker, tabContentManagerSupplier, tabStripHeightSupplier, - moduleRegistrySupplier); + moduleRegistrySupplier, + edgeToEdgeControllerSupplier); mJankTracker = jankTracker; @@ -104,7 +107,8 @@ public BraveNewTabPage( ((BraveNewTabPageLayout) mNewTabPageLayout).setTabProvider(activityTabProvider); } - // We have no way to know exactly which service the observer is added to, so try remove on + // We have no way to know exactly which service the observer is added to, so try + // remove on // both if (tabModelSelector != null) { for (TabModel tabModel : tabModelSelector.getModels()) { @@ -129,7 +133,8 @@ protected void initializeMainView( SnackbarManager snackbarManager, boolean isInNightMode, Supplier shareDelegateSupplier, - String url) { + String url, + ObservableSupplier edgeToEdgeControllerSupplier) { // Override surface provider Profile profile = Profile.fromWebContents(mTab.getWebContents()); @@ -160,7 +165,8 @@ protected void initializeMainView( /* overScrollDisabled= */ false, /* viewportView= */ null, /* actionDelegate= */ null, - mTabStripHeightSupplier); + mTabStripHeightSupplier, + edgeToEdgeControllerSupplier); mFeedSurfaceProvider = feedSurfaceCoordinator; } diff --git a/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPageLayout.java b/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPageLayout.java index cd284068bb34..8f885c0ab907 100644 --- a/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPageLayout.java +++ b/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPageLayout.java @@ -96,14 +96,14 @@ import org.chromium.chrome.browser.rate.RateUtils; import org.chromium.chrome.browser.settings.BackgroundImagesPreferences; import org.chromium.chrome.browser.settings.BraveNewsPreferencesV2; -import org.chromium.chrome.browser.settings.SettingsLauncherFactory; +import org.chromium.chrome.browser.settings.SettingsNavigationFactory; import org.chromium.chrome.browser.suggestions.tile.BraveMostVisitedTilesLayoutBase; import org.chromium.chrome.browser.suggestions.tile.TileGroup.Delegate; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabAttributes; import org.chromium.chrome.browser.ui.native_page.TouchEnabledDelegate; import org.chromium.chrome.browser.util.TabUtils; -import org.chromium.components.browser_ui.settings.SettingsLauncher; +import org.chromium.components.browser_ui.settings.SettingsNavigation; import org.chromium.components.browser_ui.widget.displaystyle.UiConfig; import org.chromium.components.user_prefs.UserPrefs; import org.chromium.mojo.bindings.ConnectionErrorHandler; @@ -351,10 +351,9 @@ public boolean onTouch(View v, MotionEvent event) { ImageView ivNewsSettings = findViewById(R.id.news_settings_button); ivNewsSettings.setOnClickListener( view -> { - SettingsLauncher settingsLauncher = - SettingsLauncherFactory.createSettingsLauncher(); - settingsLauncher.launchSettingsActivity( - getContext(), BraveNewsPreferencesV2.class); + SettingsNavigation settingsLauncher = + SettingsNavigationFactory.createSettingsNavigation(); + settingsLauncher.startSettings(getContext(), BraveNewsPreferencesV2.class); }); mRecyclerView = findViewById(R.id.recyclerview); @@ -1179,7 +1178,6 @@ public void initialize( TouchEnabledDelegate touchEnabledDelegate, UiConfig uiConfig, ActivityLifecycleDispatcher lifecycleDispatcher, - NewTabPageUma uma, Profile profile, WindowAndroid windowAndroid, boolean isTablet, @@ -1194,7 +1192,6 @@ public void initialize( touchEnabledDelegate, uiConfig, lifecycleDispatcher, - uma, profile, windowAndroid, isTablet, @@ -1292,7 +1289,7 @@ private void initilizeSponsoredTab() { SponsoredTab sponsoredTab = new SponsoredTab(mNTPBackgroundImagesBridge); TabAttributes.from(getTab()).set(String.valueOf(getTab().getId()), sponsoredTab); } - mSponsoredTab = TabAttributes.from(getTab()).get(String.valueOf((getTab()).getId())); + mSponsoredTab = TabAttributes.from(getTab()).get(String.valueOf(getTab().getId())); if (shouldShowSuperReferral()) mNTPBackgroundImagesBridge.getTopSites(); } diff --git a/android/java/org/chromium/chrome/browser/ntp/IncognitoNewTabPageView.java b/android/java/org/chromium/chrome/browser/ntp/IncognitoNewTabPageView.java index eb40f47042fe..b5e2b0f2ac24 100644 --- a/android/java/org/chromium/chrome/browser/ntp/IncognitoNewTabPageView.java +++ b/android/java/org/chromium/chrome/browser/ntp/IncognitoNewTabPageView.java @@ -73,6 +73,11 @@ public IncognitoNewTabPageView(Context context, AttributeSet attrs) { : "Something has changed in the upstream!"; assert R.drawable.incognito_splash > 0 : "Something has changed in the upstream!"; + + // Added this check just to avoid resource is not used warning. We use own own private tab + // UI. + assert R.dimen.incognito_ntp_fading_shadow_size > 0 + : "Samothing has changed in the upstream!"; } @Override diff --git a/android/java/org/chromium/chrome/browser/omnibox/BraveLocationBarCoordinator.java b/android/java/org/chromium/chrome/browser/omnibox/BraveLocationBarCoordinator.java index 6f8d5d50a046..91298b965f9a 100644 --- a/android/java/org/chromium/chrome/browser/omnibox/BraveLocationBarCoordinator.java +++ b/android/java/org/chromium/chrome/browser/omnibox/BraveLocationBarCoordinator.java @@ -7,6 +7,7 @@ import android.view.ActionMode; import android.view.View; +import android.view.View.OnLongClickListener; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -23,7 +24,6 @@ import org.chromium.chrome.browser.omnibox.status.StatusCoordinator.PageInfoAction; import org.chromium.chrome.browser.omnibox.suggestions.OmniboxSuggestionsDropdownScrollListener; import org.chromium.chrome.browser.omnibox.suggestions.basic.BasicSuggestionProcessor.BookmarkState; -import org.chromium.chrome.browser.privacy.settings.PrivacyPreferencesManager; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.share.ShareDelegate; import org.chromium.chrome.browser.tab.Tab; @@ -38,16 +38,17 @@ import java.util.function.BooleanSupplier; public class BraveLocationBarCoordinator extends LocationBarCoordinator { - /* + /** * {@link LocationBarCoordinator#mLocationBarMediator} is private so we add a private * `mLocationBarMediator` here so this code compiles and then remove it and make {@link * LocationBarCoordinator#mLocationBarMediator} protected via asm. */ private LocationBarMediator mLocationBarMediator; - /* - * {@link LocationBarCoordinator#mUrlBar} is private so we add a private - * `mUrlBar` here so this code compiles and then remove it and make {@link - * LocationBarCoordinator#mUrlBar} protected via asm. + + /** + * {@link LocationBarCoordinator#mUrlBar} is private so we add a private `mUrlBar` here so this + * code compiles and then remove it and make {@link LocationBarCoordinator#mUrlBar} protected + * via asm. */ private View mUrlBar; @@ -57,7 +58,6 @@ public BraveLocationBarCoordinator( View locationBarLayout, View autocompleteAnchorView, ObservableSupplier profileObservableSupplier, - PrivacyPreferencesManager privacyPreferencesManager, LocationBarDataProvider locationBarDataProvider, ActionMode.Callback actionModeCallback, WindowDelegate windowDelegate, @@ -87,12 +87,13 @@ public BraveLocationBarCoordinator( omniboxSuggestionsDropdownScrollListener, @Nullable ObservableSupplier tabModelSelectorSupplier, LocationBarEmbedderUiOverrides uiOverrides, - @Nullable View baseChromeLayout) { + @Nullable View baseChromeLayout, + Supplier bottomWindowPaddingSupplier, + @Nullable OnLongClickListener onLongClickListener) { super( locationBarLayout, autocompleteAnchorView, profileObservableSupplier, - privacyPreferencesManager, locationBarDataProvider, actionModeCallback, windowDelegate, @@ -118,7 +119,9 @@ public BraveLocationBarCoordinator( omniboxSuggestionsDropdownScrollListener, tabModelSelectorSupplier, uiOverrides, - baseChromeLayout); + baseChromeLayout, + bottomWindowPaddingSupplier, + onLongClickListener); if (mUrlBar != null) { ((UrlBar) mUrlBar).setSelectAllOnFocus(true); diff --git a/android/java/org/chromium/chrome/browser/omnibox/BraveLocationBarMediator.java b/android/java/org/chromium/chrome/browser/omnibox/BraveLocationBarMediator.java index b6255501154c..2d9149456e4b 100644 --- a/android/java/org/chromium/chrome/browser/omnibox/BraveLocationBarMediator.java +++ b/android/java/org/chromium/chrome/browser/omnibox/BraveLocationBarMediator.java @@ -19,7 +19,6 @@ import org.chromium.base.supplier.OneshotSupplier; import org.chromium.chrome.browser.lens.LensController; 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; @@ -47,7 +46,6 @@ public BraveLocationBarMediator( @NonNull LocationBarDataProvider locationBarDataProvider, @NonNull LocationBarEmbedderUiOverrides embedderUiOverrides, @NonNull ObservableSupplier profileSupplier, - @NonNull PrivacyPreferencesManager privacyPreferencesManager, @NonNull OverrideUrlLoadingDelegate overrideUrlLoadingDelegate, @NonNull LocaleManager localeManager, @NonNull OneshotSupplier templateUrlServiceSupplier, @@ -66,7 +64,6 @@ public BraveLocationBarMediator( locationBarDataProvider, embedderUiOverrides, profileSupplier, - privacyPreferencesManager, overrideUrlLoadingDelegate, localeManager, templateUrlServiceSupplier, @@ -97,12 +94,8 @@ public static Class getLocaleManagerClass() { return LocaleManager.class; } - public static Class getPrivacyPreferencesManagerClass() { - return PrivacyPreferencesManager.class; - } - public static Class - getOmniboxSuggestionsDropdownEmbedderImplClass() { + getOmniboxSuggestionsDropdownEmbedderImplClass() { return OmniboxSuggestionsDropdownEmbedderImpl.class; } @@ -147,7 +140,7 @@ private boolean shouldShowQRButton() { } protected boolean shouldShowDeleteButton() { - assert (false); + assert false; return false; } diff --git a/android/java/org/chromium/chrome/browser/onboarding/OnboardingPrefManager.java b/android/java/org/chromium/chrome/browser/onboarding/OnboardingPrefManager.java index 9126241f01d8..f5108d2a0d6b 100644 --- a/android/java/org/chromium/chrome/browser/onboarding/OnboardingPrefManager.java +++ b/android/java/org/chromium/chrome/browser/onboarding/OnboardingPrefManager.java @@ -23,7 +23,6 @@ import java.util.Calendar; import java.util.Date; -import java.util.HashMap; import java.util.Map; /** @@ -269,20 +268,17 @@ public boolean showCrossPromoModal() { } public static Map searchEngineMap = - new HashMap() { - { - put(GOOGLE, SearchEngineEnum.GOOGLE); - put(BRAVE, SearchEngineEnum.BRAVE); - put(DUCKDUCKGO, SearchEngineEnum.DUCKDUCKGO); - put(QWANT, SearchEngineEnum.QWANT); - put(BING, SearchEngineEnum.BING); - put(STARTPAGE, SearchEngineEnum.STARTPAGE); - put(YANDEX, SearchEngineEnum.YANDEX); - put(ECOSIA, SearchEngineEnum.ECOSIA); - put(DAUM, SearchEngineEnum.DAUM); - put(NAVER, SearchEngineEnum.NAVER); - } - }; + Map.ofEntries( + Map.entry(GOOGLE, SearchEngineEnum.GOOGLE), + Map.entry(BRAVE, SearchEngineEnum.BRAVE), + Map.entry(DUCKDUCKGO, SearchEngineEnum.DUCKDUCKGO), + Map.entry(QWANT, SearchEngineEnum.QWANT), + Map.entry(BING, SearchEngineEnum.BING), + Map.entry(STARTPAGE, SearchEngineEnum.STARTPAGE), + Map.entry(YANDEX, SearchEngineEnum.YANDEX), + Map.entry(ECOSIA, SearchEngineEnum.ECOSIA), + Map.entry(DAUM, SearchEngineEnum.DAUM), + Map.entry(NAVER, SearchEngineEnum.NAVER)); public boolean isFromNotification() { return mSharedPreferences.getBoolean(FROM_NOTIFICATION, false); diff --git a/android/java/org/chromium/chrome/browser/onboarding/SearchEngineEnum.java b/android/java/org/chromium/chrome/browser/onboarding/SearchEngineEnum.java index f0263ac3affb..3bd38ec30874 100644 --- a/android/java/org/chromium/chrome/browser/onboarding/SearchEngineEnum.java +++ b/android/java/org/chromium/chrome/browser/onboarding/SearchEngineEnum.java @@ -27,9 +27,9 @@ public enum SearchEngineEnum { DAUM(R.drawable.daum, SearchEngineEnumConstants.SEARCH_DAUM_ID, R.string.daum_desc), NAVER(R.drawable.naver, SearchEngineEnumConstants.SEARCH_NAVER_ID, R.string.naver_desc); - private int icon; - private int id; - private int desc; + private final int icon; + private final int id; + private final int desc; SearchEngineEnum(int icon, int id, int desc) { this.icon = icon; diff --git a/android/java/org/chromium/chrome/browser/onboarding/SearchEngineOnboardingFragment.java b/android/java/org/chromium/chrome/browser/onboarding/SearchEngineOnboardingFragment.java index 4d579ebde82d..5e2201de8206 100644 --- a/android/java/org/chromium/chrome/browser/onboarding/SearchEngineOnboardingFragment.java +++ b/android/java/org/chromium/chrome/browser/onboarding/SearchEngineOnboardingFragment.java @@ -157,21 +157,26 @@ private void initializeViews(View root) { } private void setActions() { - btnSave.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - if (mSelectedSearchEngine == null) { - mSelectedSearchEngine = BraveSearchEngineUtils.getTemplateUrlByShortName( - mProfile, BraveSearchEngineUtils.getDSEShortName(mProfile, false)); - } - if (mSelectedSearchEngine != null) { - BraveSearchEngineUtils.setDSEPrefs(mSelectedSearchEngine, mProfile); - BraveSearchEngineUtils.setDSEPrefs(mSelectedSearchEngine, - mProfile.getPrimaryOTRProfile(/* createIfNeeded= */ true)); - } - getActivity().finish(); - } - }); + btnSave.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View view) { + if (mSelectedSearchEngine == null) { + mSelectedSearchEngine = + BraveSearchEngineUtils.getTemplateUrlByShortName( + mProfile, + BraveSearchEngineUtils.getDSEShortName( + mProfile, false)); + } + if (mSelectedSearchEngine != null) { + BraveSearchEngineUtils.setDSEPrefs(mSelectedSearchEngine, mProfile); + BraveSearchEngineUtils.setDSEPrefs( + mSelectedSearchEngine, + mProfile.getPrimaryOtrProfile(/* createIfNeeded= */ true)); + } + getActivity().finish(); + } + }); } private void searchEngineSelected(int position, List templateUrls) { diff --git a/android/java/org/chromium/chrome/browser/password_manager/settings/BraveExportFlow.java b/android/java/org/chromium/chrome/browser/password_manager/settings/BraveExportFlow.java index d4a46b62b0ec..3d0aa1694964 100644 --- a/android/java/org/chromium/chrome/browser/password_manager/settings/BraveExportFlow.java +++ b/android/java/org/chromium/chrome/browser/password_manager/settings/BraveExportFlow.java @@ -6,8 +6,13 @@ package org.chromium.chrome.browser.password_manager.settings; import org.chromium.base.BraveReflectionUtil; +import org.chromium.chrome.browser.access_loss.PasswordAccessLossWarningType; public class BraveExportFlow extends ExportFlow { + public BraveExportFlow(@PasswordAccessLossWarningType int warningType) { + super(warningType); + } + public void runSharePasswordsIntent() { BraveReflectionUtil.invokeMethod(ExportFlow.class, this, "runCreateFileOnDiskIntent"); } diff --git a/android/java/org/chromium/chrome/browser/password_manager/settings/BravePasswordSettingsBase.java b/android/java/org/chromium/chrome/browser/password_manager/settings/BravePasswordSettingsBase.java index 8a8940b8e7dc..33fdf5c6ebaf 100644 --- a/android/java/org/chromium/chrome/browser/password_manager/settings/BravePasswordSettingsBase.java +++ b/android/java/org/chromium/chrome/browser/password_manager/settings/BravePasswordSettingsBase.java @@ -5,10 +5,32 @@ package org.chromium.chrome.browser.password_manager.settings; +import android.view.Menu; + import org.chromium.chrome.browser.settings.BravePreferenceFragment; public abstract class BravePasswordSettingsBase extends BravePreferenceFragment { + /* + * This variable will be used instead of upstream's `PasswordSettings#mMenu`. + */ + protected Menu mMenu; + public void createCheckPasswords() { // Do nothing here as we don't have check passwords option in Brave. } + + @Override + public void onDestroy() { + super.onDestroy(); + + /* + * In `PasswordSettings` class `passwordListAvailable` method gets called before `onCreateOptionsMenu`. + * Now on pressing `back`, Seetings activity is not finished, but just returns 1 fragment back. + * This causes null pointer crash on returning to the password settings page, since `mMenu` is already not null, + * but not inflated yet by the time we call `passwordListAvailable` and we try to access `export_passwords`. + * This issue is not happening in the upstream since they use different password settings page that utilizes OS level password manager. + * So here we make sure `mMenu` is null every time we leave password settings page. + */ + mMenu = null; + } } diff --git a/android/java/org/chromium/chrome/browser/preferences/website/BraveShieldsContentSettings.java b/android/java/org/chromium/chrome/browser/preferences/website/BraveShieldsContentSettings.java index 2011be98685d..3f376610b6a2 100644 --- a/android/java/org/chromium/chrome/browser/preferences/website/BraveShieldsContentSettings.java +++ b/android/java/org/chromium/chrome/browser/preferences/website/BraveShieldsContentSettings.java @@ -69,6 +69,11 @@ private void init() { } } + /** + * A finalizer is required to ensure that the native object associated with this descriptor gets + * torn down, otherwise there would be a memory leak. + */ + @SuppressWarnings("Finalize") @Override protected void finalize() { destroy(); @@ -79,10 +84,15 @@ private void destroy() { return; } BraveShieldsContentSettingsJni.get().destroy(mNativeBraveShieldsContentSettings); + mNativeBraveShieldsContentSettings = 0; } - static public void setShields(Profile profile, String host, String resourceIndentifier, boolean value, - boolean fromTopShields) { + public static void setShields( + Profile profile, + String host, + String resourceIndentifier, + boolean value, + boolean fromTopShields) { String setting_string = (value ? BLOCK_RESOURCE : ALLOW_RESOURCE); if (resourceIndentifier.equals(RESOURCE_IDENTIFIER_BRAVE_SHIELDS)) { BraveShieldsContentSettingsJni.get().setBraveShieldsEnabled(value, host, profile); diff --git a/android/java/org/chromium/chrome/browser/qrreader/CameraSource.java b/android/java/org/chromium/chrome/browser/qrreader/CameraSource.java index e7a3d46316e7..bfdd9fd642c8 100644 --- a/android/java/org/chromium/chrome/browser/qrreader/CameraSource.java +++ b/android/java/org/chromium/chrome/browser/qrreader/CameraSource.java @@ -458,7 +458,7 @@ public int doZoom(float scale) { currentZoom = parameters.getZoom() + 1; float newZoom; if (scale > 1) { - newZoom = currentZoom + scale * (maxZoom / 10); + newZoom = currentZoom + scale * (maxZoom / 10f); } else { newZoom = currentZoom * scale; } @@ -647,20 +647,15 @@ public boolean setAutoFocusMoveCallback(@Nullable AutoFocusMoveCallback cb) { return true; } - //============================================================================================== + // ============================================================================================== // Private - //============================================================================================== + // ============================================================================================== - /** - * Only allow creation via the builder class. - */ - private CameraSource() { - } + /** Only allow creation via the builder class. */ + private CameraSource() {} - /** - * Wraps the camera1 shutter callback so that the deprecated API isn't exposed. - */ - private class PictureStartCallback implements Camera.ShutterCallback { + /** Wraps the camera1 shutter callback so that the deprecated API isn't exposed. */ + private static class PictureStartCallback implements Camera.ShutterCallback { private ShutterCallback mDelegate; @Override @@ -691,10 +686,8 @@ public void onPictureTaken(byte[] data, Camera camera) { } } - /** - * Wraps the camera1 auto focus callback so that the deprecated API isn't exposed. - */ - private class CameraAutoFocusCallback implements Camera.AutoFocusCallback { + /** Wraps the camera1 auto focus callback so that the deprecated API isn't exposed. */ + private static class CameraAutoFocusCallback implements Camera.AutoFocusCallback { private AutoFocusCallback mDelegate; @Override @@ -705,11 +698,9 @@ public void onAutoFocus(boolean success, Camera camera) { } } - /** - * Wraps the camera1 auto focus move callback so that the deprecated API isn't exposed. - */ + /** Wraps the camera1 auto focus move callback so that the deprecated API isn't exposed. */ @TargetApi(Build.VERSION_CODES.JELLY_BEAN) - private class CameraAutoFocusMoveCallback implements Camera.AutoFocusMoveCallback { + private static class CameraAutoFocusMoveCallback implements Camera.AutoFocusMoveCallback { private AutoFocusMoveCallback mDelegate; @Override @@ -764,7 +755,9 @@ private Camera createCamera() { mFocusMode)) { parameters.setFocusMode(mFocusMode); } else { - Log.i(TAG, "Camera focus mode: " + mFocusMode + " is not supported on this device."); + Log.i( + TAG, + "Camera focus mode: " + mFocusMode + " is not supported on this device."); } } @@ -776,7 +769,9 @@ private Camera createCamera() { mFlashMode)) { parameters.setFlashMode(mFlashMode); } else { - Log.i(TAG, "Camera flash mode: " + mFlashMode + " is not supported on this device."); + Log.i( + TAG, + "Camera flash mode: " + mFlashMode + " is not supported on this device."); } } @@ -1007,14 +1002,15 @@ private void setRotation(Camera camera, Camera.Parameters parameters, int camera } /** - * Creates one buffer for the camera preview callback. The size of the buffer is based off of + * Creates one buffer for the camera preview callback. The size of the buffer is based off of * the camera preview size and the format of the camera image. * * @return a new preview buffer of the appropriate size for the current camera settings */ private byte[] createPreviewBuffer(Size previewSize) { int bitsPerPixel = ImageFormat.getBitsPerPixel(ImageFormat.NV21); - long sizeInBits = previewSize.getHeight() * previewSize.getWidth() * bitsPerPixel; + long sizeInBits = + previewSize.getHeight() * (long) previewSize.getWidth() * (long) bitsPerPixel; int bufferSize = (int) Math.ceil(sizeInBits / 8.0d) + 1; // diff --git a/android/java/org/chromium/chrome/browser/rewards/BraveRewardsPanel.java b/android/java/org/chromium/chrome/browser/rewards/BraveRewardsPanel.java index 65412a214a40..a36cca4a8ece 100644 --- a/android/java/org/chromium/chrome/browser/rewards/BraveRewardsPanel.java +++ b/android/java/org/chromium/chrome/browser/rewards/BraveRewardsPanel.java @@ -388,26 +388,27 @@ private void showRewardsMainUI() { setVisibilityForLoggedOutState(); loggedOutStateText.setOnClickListener( - (new View.OnClickListener() { + new View.OnClickListener() { @Override public void onClick(View v) { TabUtils.openUrlInNewTab( false, BraveActivity.BRAVE_REWARDS_WALLET_RECONNECT_URL); dismiss(); } - })); + }); ImageView btnRewardsSettings = mPopupView.findViewById(R.id.btn_rewards_settings); - btnRewardsSettings.setOnClickListener((new View.OnClickListener() { - @Override - public void onClick(View v) { - if (mBraveActivity != null) { - mBraveActivity.openNewOrSelectExistingTab( - BraveActivity.BRAVE_REWARDS_SETTINGS_URL); - } - dismiss(); - } - })); + btnRewardsSettings.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View v) { + if (mBraveActivity != null) { + mBraveActivity.openNewOrSelectExistingTab( + BraveActivity.BRAVE_REWARDS_SETTINGS_URL); + } + dismiss(); + } + }); TextView btnSendTip = mPopupView.findViewById(R.id.btn_send_tip); btnSendTip.setOnClickListener( @@ -453,7 +454,7 @@ public void onClick(View v) { int currentYear = Calendar.getInstance().get(Calendar.YEAR); String adsMonthlyStatement = monthNameShort.replaceAll("\\.", ""); - String monthYear = new StringBuilder(monthName).append(" ").append(currentYear).toString(); + String monthYear = monthName + " " + currentYear; TextView adsMonthlyStatementText = mPopupView.findViewById(R.id.ads_monthly_statement_text); adsMonthlyStatementText.setText(adsMonthlyStatement); @@ -554,7 +555,7 @@ private void setNotificationsControls() { mNotificationLayout.findViewById(R.id.btn_close_notification); if (btnCloseNotification != null) { btnCloseNotification.setOnClickListener( - (new View.OnClickListener() { + new View.OnClickListener() { @Override public void onClick(View v) { if (mCurrentNotificationId.isEmpty()) { @@ -566,7 +567,7 @@ public void onClick(View v) { mCurrentNotificationId); } } - })); + }); } } @@ -834,8 +835,8 @@ public void onClick(View v) { @Override public void onClick(View v) { mBraveRewardsNativeWorker.deleteNotification(mCurrentNotificationId); - assert (BraveReflectionUtil.equalTypes( - mActivity.getClass(), BraveActivity.class)); + assert BraveReflectionUtil.equalTypes( + mActivity.getClass(), BraveActivity.class); BraveActivity.class .cast(mActivity) .openNewOrSelectExistingTab( @@ -955,12 +956,13 @@ public void onGetAdsAccountStatement( mPopupView.findViewById(R.id.estimated_not_connected_group).setVisibility(View.VISIBLE); TextView batAdsBalanceLearnMoreText = mPopupView.findViewById(R.id.bat_ads_balance_learn_more_text); - batAdsBalanceLearnMoreText.setOnClickListener((new View.OnClickListener() { - @Override - public void onClick(View v) { - CustomTabActivity.showInfoPage(mActivity, BRAVE_REWARDS_CHANGES_PAGE); - } - })); + batAdsBalanceLearnMoreText.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View v) { + CustomTabActivity.showInfoPage(mActivity, BRAVE_REWARDS_CHANGES_PAGE); + } + }); } else { TextView estimatedRange = mPopupView.findViewById(R.id.estimated_range); String minValue = BraveRewardsHelper.getFormattedAmount(minEarningsThisMonth); @@ -1189,12 +1191,12 @@ private void showTermsOfServiceUi() { TextView btnActionTos = mRewardsTosModal.findViewById(R.id.btn_action_tos); btnActionTos.setOnClickListener( - (new View.OnClickListener() { + new View.OnClickListener() { @Override public void onClick(View v) { mBraveRewardsNativeWorker.acceptTermsOfServiceUpdate(); } - })); + }); } @Override @@ -1231,16 +1233,16 @@ private void showSolanaEligibleUi() { AppCompatImageView modalCloseButton = mRewardsSolanaEligibleLayout.findViewById(R.id.solana_eligible_ui_modal_close); modalCloseButton.setOnClickListener( - (new View.OnClickListener() { + new View.OnClickListener() { @Override public void onClick(View v) { removeSolanaEligibleUi(); } - })); + }); LinearLayout connectButton = mRewardsSolanaEligibleLayout.findViewById(R.id.btn_connect); connectButton.setOnClickListener( - (new View.OnClickListener() { + new View.OnClickListener() { @Override public void onClick(View v) { removeSolanaEligibleUi(); @@ -1249,16 +1251,16 @@ public void onClick(View v) { BraveActivity.BRAVE_REWARDS_SETTINGS_WALLET_VERIFICATION_URL); dismiss(); } - })); + }); Button notNowButton = mRewardsSolanaEligibleLayout.findViewById(R.id.btn_not_now); notNowButton.setOnClickListener( - (new View.OnClickListener() { + new View.OnClickListener() { @Override public void onClick(View v) { removeSolanaEligibleUi(); } - })); + }); } } @@ -1401,7 +1403,7 @@ private void existingUserViewChanges() { private void mayBeShowNotitionPermissionDialog() { clickOnCloseButtonOfNotificationPermission(); clickOnTurnOnNotificationButton(); - if ((!BravePermissionUtils.hasNotificationPermission(mAnchorView.getContext())) + if (!BravePermissionUtils.hasNotificationPermission(mAnchorView.getContext()) || BraveNotificationWarningDialog.shouldShowRewardWarningDialog( mAnchorView.getContext())) { mNotificationLayout.setVisibility(View.VISIBLE); @@ -1441,42 +1443,47 @@ private void showUnverifiedLayout() { unverifiedStateLayout.findViewById(R.id.rewards_panel_unverified_on_section); TextView connectAccountButton = unverifiedStateLayout.findViewById(R.id.connect_account_button); - connectAccountButton.setOnClickListener((new View.OnClickListener() { - @Override - public void onClick(View v) { - TabUtils.openUrlInNewTab( - false, BraveActivity.BRAVE_REWARDS_SETTINGS_WALLET_VERIFICATION_URL); - dismiss(); - } - })); + connectAccountButton.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View v) { + TabUtils.openUrlInNewTab( + false, + BraveActivity.BRAVE_REWARDS_SETTINGS_WALLET_VERIFICATION_URL); + dismiss(); + } + }); View rewardsPanelUnverifiedCreatorSection = unverifiedStateLayout.findViewById(R.id.rewards_panel_unverified_creator_section); - TextView rewardsPanelUnverifiedCreatorCountText = unverifiedStateLayout.findViewById( - R.id.rewards_panel_unverified_creator_count_text); + TextView rewardsPanelUnverifiedCreatorCountText = + unverifiedStateLayout.findViewById( + R.id.rewards_panel_unverified_creator_count_text); TextView rewardsPanelUnverifiedCreatorText = unverifiedStateLayout.findViewById(R.id.rewards_panel_unverified_creator_text); View rewardsPanelUnverifiedOffSection = unverifiedStateLayout.findViewById(R.id.rewards_panel_unverified_off_section); LinearLayout rewardsSettingsButton = unverifiedStateLayout.findViewById(R.id.rewards_settings_button); - rewardsSettingsButton.setOnClickListener((new View.OnClickListener() { - @Override - public void onClick(View v) { - if (mBraveActivity != null) { - mBraveActivity.openNewOrSelectExistingTab( - BraveActivity.BRAVE_REWARDS_SETTINGS_URL); - } - dismiss(); - } - })); + rewardsSettingsButton.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View v) { + if (mBraveActivity != null) { + mBraveActivity.openNewOrSelectExistingTab( + BraveActivity.BRAVE_REWARDS_SETTINGS_URL); + } + dismiss(); + } + }); TextView learnMoreUnverifiedText = unverifiedStateLayout.findViewById(R.id.learn_more_unverified_text); - learnMoreUnverifiedText.setOnClickListener((new View.OnClickListener() { - @Override - public void onClick(View v) { - CustomTabActivity.showInfoPage(mActivity, BRAVE_REWARDS_PAGE); - } - })); + learnMoreUnverifiedText.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View v) { + CustomTabActivity.showInfoPage(mActivity, BRAVE_REWARDS_PAGE); + } + }); BraveTouchUtils.ensureMinTouchTarget(learnMoreUnverifiedText); if (BraveAdsNativeHelper.nativeIsOptedInToNotificationAds( @@ -1493,22 +1500,26 @@ public void onClick(View v) { unverifiedStateLayout.findViewById( R.id.rewards_panel_unverified_on_section_learn_more_text); rewardsPanelUnverifiedOnSectionLearnMoreText.setOnClickListener( - (new View.OnClickListener() { + new View.OnClickListener() { @Override public void onClick(View v) { CustomTabActivity.showInfoPage( mActivity, UNVERIFIED_USER_UNSUPPORTED_REGION_PAGE); } - })); + }); BraveTouchUtils.ensureMinTouchTarget(rewardsPanelUnverifiedOnSectionLearnMoreText); - String sectionText = "" - + mPopupView.getResources().getString(R.string.ready_to_start_earning_text) - + " " - + mPopupView.getResources().getString( - R.string.rewards_panel_unverified_on_section_text); - rewardsPanelUnverifiedOnSectionText.setText(Html.fromHtml(sectionText)); - connectAccountButton.setVisibility(View.VISIBLE); - rewardsPanelUnverifiedOnSectionLearnMoreText.setVisibility(View.GONE); + String sectionText = + "" + + mPopupView + .getResources() + .getString(R.string.ready_to_start_earning_text) + + " " + + mPopupView + .getResources() + .getString(R.string.rewards_panel_unverified_on_section_text); + rewardsPanelUnverifiedOnSectionText.setText(Html.fromHtml(sectionText)); + connectAccountButton.setVisibility(View.VISIBLE); + rewardsPanelUnverifiedOnSectionLearnMoreText.setVisibility(View.GONE); rewardsPanelUnverifiedOffSection.setVisibility(View.GONE); mBraveRewardsNativeWorker.getPublishersVisitedCount(); } else { @@ -1611,20 +1622,23 @@ public void onPageScrollStateChanged(int state) {} Log.e(TAG, "Failed to enlarge touch target on tab:", e); } - AppCompatImageView modalCloseButton = mBraveRewardsOnboardingView.findViewById( - R.id.brave_rewards_onboarding_layout_modal_close); + AppCompatImageView modalCloseButton = + mBraveRewardsOnboardingView.findViewById( + R.id.brave_rewards_onboarding_layout_modal_close); modalCloseButton.setOnClickListener( - (new View.OnClickListener() { + new View.OnClickListener() { @Override public void onClick(View v) { mBraveRewardsOnboardingView.setVisibility(View.GONE); panelShadow(false); mBraveRewardsNativeWorker.getExternalWallet(); } - })); - mBraveRewardsOnboardingView.findViewById(R.id.onboarding_first_screen_layout) + }); + mBraveRewardsOnboardingView + .findViewById(R.id.onboarding_first_screen_layout) .setVisibility(View.VISIBLE); - mBraveRewardsOnboardingView.findViewById(R.id.onboarding_action_layout) + mBraveRewardsOnboardingView + .findViewById(R.id.onboarding_action_layout) .setVisibility(View.GONE); BraveTouchUtils.ensureMinTouchTarget(modalCloseButton); @@ -1665,45 +1679,51 @@ private void showVbatExpireNotice() { mRewardsVbatExpireNoticeModal.findViewById(R.id.layout_vbat_connect_account); vBatConnectButtonLayout.setVisibility( mBraveRewardsNativeWorker.canConnectAccount() ? View.VISIBLE : View.GONE); - vBatConnectButtonLayout.setOnClickListener((new View.OnClickListener() { - @Override - public void onClick(View v) { - TabUtils.openUrlInNewTab( - false, BraveActivity.BRAVE_REWARDS_SETTINGS_WALLET_VERIFICATION_URL); - dismiss(); - } - })); + vBatConnectButtonLayout.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View v) { + TabUtils.openUrlInNewTab( + false, + BraveActivity.BRAVE_REWARDS_SETTINGS_WALLET_VERIFICATION_URL); + dismiss(); + } + }); Button vBatConnectButton = mRewardsVbatExpireNoticeModal.findViewById(R.id.btn_vbat_connect_account); - vBatConnectButton.setOnClickListener((new View.OnClickListener() { - @Override - public void onClick(View v) { - TabUtils.openUrlInNewTab( - false, BraveActivity.BRAVE_REWARDS_SETTINGS_WALLET_VERIFICATION_URL); - dismiss(); - } - })); + vBatConnectButton.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View v) { + TabUtils.openUrlInNewTab( + false, + BraveActivity.BRAVE_REWARDS_SETTINGS_WALLET_VERIFICATION_URL); + dismiss(); + } + }); Button vBatLearnMoreButton = mRewardsVbatExpireNoticeModal.findViewById(R.id.btn_vbat_learn_more); - vBatLearnMoreButton.setOnClickListener((new View.OnClickListener() { - @Override - public void onClick(View v) { - CustomTabActivity.showInfoPage(mActivity, BRAVE_REWARDS_CHANGES_PAGE); - } - })); + vBatLearnMoreButton.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View v) { + CustomTabActivity.showInfoPage(mActivity, BRAVE_REWARDS_CHANGES_PAGE); + } + }); AppCompatImageView vbatCloseBtn = mRewardsVbatExpireNoticeModal.findViewById(R.id.vbat_modal_close); - vbatCloseBtn.setOnClickListener((new View.OnClickListener() { - @Override - public void onClick(View v) { - if (mRewardsVbatExpireNoticeModal != null) { - mRewardsVbatExpireNoticeModal.setVisibility(View.GONE); - } - panelShadow(false); - } - })); + vbatCloseBtn.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View v) { + if (mRewardsVbatExpireNoticeModal != null) { + mRewardsVbatExpireNoticeModal.setVisibility(View.GONE); + } + panelShadow(false); + } + }); String vbatModalTitleString = ""; String vbatModalTextString = ""; @@ -1731,17 +1751,19 @@ private void showConnectAccountModal() { mConnectAccountModal.setVisibility(View.VISIBLE); Button connectAccountBtn = mConnectAccountModal.findViewById(R.id.btn_connect_account); - connectAccountBtn.setOnClickListener((new View.OnClickListener() { - @Override - public void onClick(View v) { - TabUtils.openUrlInNewTab( - false, BraveActivity.BRAVE_REWARDS_SETTINGS_WALLET_VERIFICATION_URL); - dismiss(); - } - })); + connectAccountBtn.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View v) { + TabUtils.openUrlInNewTab( + false, + BraveActivity.BRAVE_REWARDS_SETTINGS_WALLET_VERIFICATION_URL); + dismiss(); + } + }); Button dismissBtn = mConnectAccountModal.findViewById(R.id.btn_do_it_later); dismissBtn.setOnClickListener( - (new View.OnClickListener() { + new View.OnClickListener() { @Override public void onClick(View v) { if (mBraveRewardsOnboardingView != null) { @@ -1751,11 +1773,11 @@ public void onClick(View v) { panelShadow(false); mBraveRewardsNativeWorker.getExternalWallet(); } - })); + }); AppCompatImageView closeBtn = mConnectAccountModal.findViewById(R.id.connect_account_layout_modal_close); closeBtn.setOnClickListener( - (new View.OnClickListener() { + new View.OnClickListener() { @Override public void onClick(View v) { if (mBraveRewardsOnboardingView != null) { @@ -1765,7 +1787,7 @@ public void onClick(View v) { panelShadow(false); mBraveRewardsNativeWorker.getExternalWallet(); } - })); + }); } private SpannableString learnMoreSpannableString(String text) { @@ -1846,25 +1868,27 @@ private void showRewardsResponseModal(boolean isSuccess, String errorMessage) { responseErrorText.setText(errorMessage); } - responseRewardsBtn.setOnClickListener((new View.OnClickListener() { - @Override - public void onClick(View v) { - mRewardsResponseModal.setVisibility(View.GONE); - mRewardsMainLayout.setForeground(null); - panelShadow(false); - if (!isSuccess && !errorMessage.equals(WALLET_GENERATION_DISABLED_ERROR)) { - showOnBoarding(); - } - } - })); + responseRewardsBtn.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View v) { + mRewardsResponseModal.setVisibility(View.GONE); + mRewardsMainLayout.setForeground(null); + panelShadow(false); + if (!isSuccess && !errorMessage.equals(WALLET_GENERATION_DISABLED_ERROR)) { + showOnBoarding(); + } + } + }); - responseCloseBtn.setOnClickListener((new View.OnClickListener() { - @Override - public void onClick(View v) { - mRewardsResponseModal.setVisibility(View.GONE); - mRewardsMainLayout.setForeground(null); - } - })); + responseCloseBtn.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View v) { + mRewardsResponseModal.setVisibility(View.GONE); + mRewardsMainLayout.setForeground(null); + } + }); } @Override @@ -1974,7 +1998,7 @@ private void setVerifyWalletButton() { private void setVerifyWalletButtonClickEvent(View btnVerifyWallet, final int status) { btnVerifyWallet.setOnClickListener( - (new View.OnClickListener() { + new View.OnClickListener() { @Override public void onClick(View v) { BraveRewardsBalance walletBalanceObject = @@ -2003,7 +2027,7 @@ public void onClick(View v) { return; } } - })); + }); } private void openUserWalletActivity(int walletStatus) { @@ -2044,7 +2068,7 @@ public void onPublisherInfo(int tabId) { mBraveRewardsNativeWorker.getPublisherFavIconURL(mCurrentTabId); Tab currentActiveTab = BraveRewardsHelper.currentActiveChromeTabbedActivityTab(); String url = currentActiveTab != null ? currentActiveTab.getUrl().getSpec() : ""; - final String favicon_url = (publisherFavIconURL.isEmpty()) ? url : publisherFavIconURL; + final String favicon_url = publisherFavIconURL.isEmpty() ? url : publisherFavIconURL; mIconFetcher.retrieveLargeIcon(favicon_url, this); @@ -2131,7 +2155,7 @@ private void updatePublisherStatus(int pubStatus) { View refreshStatusProgress = mPopupView.findViewById(R.id.progress_refresh_status); refreshStatusProgress.setVisibility(View.GONE); refreshPublisher.setOnClickListener( - (new View.OnClickListener() { + new View.OnClickListener() { @Override public void onClick(View v) { String pubId = mBraveRewardsNativeWorker.getPublisherId(mCurrentTabId); @@ -2140,7 +2164,7 @@ public void onClick(View v) { publisherVerified.setAlpha(.3f); mBraveRewardsNativeWorker.refreshPublisher(pubId); } - })); + }); TextView btnSendTip = mPopupView.findViewById(R.id.btn_send_tip); TextView infoCreatorNotVerified = mPopupView.findViewById(R.id.info_creator_not_verified); boolean isVerified = (pubStatus != PublisherStatus.NOT_VERIFIED); diff --git a/android/java/org/chromium/chrome/browser/rewards/onboarding/RewardsOnboarding.java b/android/java/org/chromium/chrome/browser/rewards/onboarding/RewardsOnboarding.java index 1c2ed40d7d5a..52954046463f 100644 --- a/android/java/org/chromium/chrome/browser/rewards/onboarding/RewardsOnboarding.java +++ b/android/java/org/chromium/chrome/browser/rewards/onboarding/RewardsOnboarding.java @@ -219,7 +219,7 @@ public void onNothingSelected(AdapterView arg0) {} }); mContinueButton.setOnClickListener( - (new View.OnClickListener() { + new View.OnClickListener() { @Override public void onClick(View v) { if (!BravePermissionUtils.hasPermission( @@ -237,7 +237,7 @@ public void onClick(View v) { mContinueButton.setText(""); } } - })); + }); } private void shouldShowContinueProgress(boolean shouldShow) { diff --git a/android/java/org/chromium/chrome/browser/search_engines/settings/BraveSearchEnginePreference.java b/android/java/org/chromium/chrome/browser/search_engines/settings/BraveSearchEnginePreference.java index 37adfe1cbf33..a1219ee4302f 100644 --- a/android/java/org/chromium/chrome/browser/search_engines/settings/BraveSearchEnginePreference.java +++ b/android/java/org/chromium/chrome/browser/search_engines/settings/BraveSearchEnginePreference.java @@ -38,8 +38,7 @@ private Profile getProfile(boolean isPrivate) { if (!isPrivate) { return mProfile; } else { - return mProfile.getPrimaryOTRProfile( - /* createIfNeeded= */ true); + return mProfile.getPrimaryOtrProfile(/* createIfNeeded= */ true); } } } diff --git a/android/java/org/chromium/chrome/browser/set_default_browser/SetDefaultBrowserBottomSheetFragment.java b/android/java/org/chromium/chrome/browser/set_default_browser/SetDefaultBrowserBottomSheetFragment.java index 6acba34d0a7c..aa0f4548dc2d 100644 --- a/android/java/org/chromium/chrome/browser/set_default_browser/SetDefaultBrowserBottomSheetFragment.java +++ b/android/java/org/chromium/chrome/browser/set_default_browser/SetDefaultBrowserBottomSheetFragment.java @@ -63,15 +63,16 @@ public void onViewCreated(View view, Bundle savedInstanceState) { .getBehavior() .setState(BottomSheetBehavior.STATE_EXPANDED); Button nextButton = view.findViewById(R.id.btn_next); - nextButton.setOnClickListener((new View.OnClickListener() { - @Override - public void onClick(View v) { - if (getActivity() != null) { - BraveSetDefaultBrowserUtils.setDefaultBrowser(getActivity()); - } - dismiss(); - } - })); + nextButton.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View v) { + if (getActivity() != null) { + BraveSetDefaultBrowserUtils.setDefaultBrowser(getActivity()); + } + dismiss(); + } + }); CheckBox dontAskCheckBox = view.findViewById(R.id.checkbox_dont_ask); @@ -96,15 +97,16 @@ public void onClick(View v) { }); Button cancelButton = view.findViewById(R.id.btn_cancel); - cancelButton.setOnClickListener((new View.OnClickListener() { - @Override - public void onClick(View v) { - if (dontAskCheckBox.isChecked()) { - BraveSetDefaultBrowserUtils.setBraveDefaultDontAsk(); - } - dismiss(); - } - })); + cancelButton.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View v) { + if (dontAskCheckBox.isChecked()) { + BraveSetDefaultBrowserUtils.setBraveDefaultDontAsk(); + } + dismiss(); + } + }); } @Override diff --git a/android/java/org/chromium/chrome/browser/settings/BraveLeoDefaultModelPreferences.java b/android/java/org/chromium/chrome/browser/settings/BraveLeoDefaultModelPreferences.java index 0847e74bff3a..35af205cf415 100644 --- a/android/java/org/chromium/chrome/browser/settings/BraveLeoDefaultModelPreferences.java +++ b/android/java/org/chromium/chrome/browser/settings/BraveLeoDefaultModelPreferences.java @@ -41,17 +41,17 @@ public ObservableSupplier getPageTitle() { public void fetchModels() { BraveLeoMojomHelper.getInstance(getProfile()) .getModels( - (models -> { + models -> { fetchDefaultModelInitRadioButtons(models); - })); + }); } private void fetchDefaultModelInitRadioButtons(ModelWithSubtitle[] models) { BraveLeoMojomHelper.getInstance(getProfile()) .getDefaultModelKey( - (defaultModel -> { + defaultModel -> { mRadioButtons.initializeModels(models, defaultModel); - })); + }); } @Override diff --git a/android/java/org/chromium/chrome/browser/settings/BraveLeoPreferences.java b/android/java/org/chromium/chrome/browser/settings/BraveLeoPreferences.java index 9fd286f6b4c8..55fa0b069a97 100644 --- a/android/java/org/chromium/chrome/browser/settings/BraveLeoPreferences.java +++ b/android/java/org/chromium/chrome/browser/settings/BraveLeoPreferences.java @@ -75,22 +75,22 @@ public void onCreate(Bundle savedInstanceState) { private void setModel() { BraveLeoMojomHelper.getInstance(getProfile()) .getModels( - (models -> { + models -> { setDefaultModelName(models); - })); + }); } private void setDefaultModelName(ModelWithSubtitle[] models) { BraveLeoMojomHelper.getInstance(getProfile()) .getDefaultModelKey( - (model -> { + model -> { Preference pref = findPreference(PREF_DEFAULT_MODEL); if (pref == null) { Log.e(TAG, "Default model pref is null"); return; } pref.setSummary(BraveLeoUtils.getDefaultModelName(models, model)); - })); + }); } private void checkLinkPurchase() { diff --git a/android/java/org/chromium/chrome/browser/settings/BraveNewsPreferencesDetails.java b/android/java/org/chromium/chrome/browser/settings/BraveNewsPreferencesDetails.java index cbb640c0f775..fcc340ebbde3 100644 --- a/android/java/org/chromium/chrome/browser/settings/BraveNewsPreferencesDetails.java +++ b/android/java/org/chromium/chrome/browser/settings/BraveNewsPreferencesDetails.java @@ -147,14 +147,20 @@ private void initBraveNewsController() { @Override public void onChannelSubscribed(int position, Channel channel, boolean isSubscribed) { - PostTask.postTask(TaskTraits.BEST_EFFORT, () -> { - if (mBraveNewsController != null) { - newsChangeSource(); - mBraveNewsController.setChannelSubscribed(BraveNewsUtils.getLocale(), - channel.channelName, isSubscribed, - ((updatedChannel) -> { BraveNewsUtils.setFollowingChannelList(); })); - } - }); + PostTask.postTask( + TaskTraits.BEST_EFFORT, + () -> { + if (mBraveNewsController != null) { + newsChangeSource(); + mBraveNewsController.setChannelSubscribed( + BraveNewsUtils.getLocale(), + channel.channelName, + isSubscribed, + (updatedChannel) -> { + BraveNewsUtils.setFollowingChannelList(); + }); + } + }); } @Override @@ -170,68 +176,85 @@ public void onPublisherPref(String publisherId, int userEnabled) { @Override public void findFeeds(String url) { - PostTask.postTask(TaskTraits.BEST_EFFORT, () -> { - if (mBraveNewsController != null) { - Url searchUrl = new Url(); - searchUrl.url = url; - mBraveNewsController.findFeeds(searchUrl, ((results) -> { - if (!url.equals(mSearch)) return; - - boolean isExistingSource = false; - List sourceList = new ArrayList<>(); - for (FeedSearchResultItem resultItem : results) { - if (resultItem.feedUrl != null - && !BraveNewsUtils.searchPublisherForRss(resultItem.feedUrl.url)) { - sourceList.add(resultItem); - } else { - isExistingSource = true; - } - } - BraveNewsPreferencesSearchType braveNewsPreferencesSearchType; - if (sourceList.size() > 0) { - braveNewsPreferencesSearchType = BraveNewsPreferencesSearchType.NewSource; - } else if (isExistingSource) { - braveNewsPreferencesSearchType = - BraveNewsPreferencesSearchType.Init; // ExistingSource; - } else { - braveNewsPreferencesSearchType = BraveNewsPreferencesSearchType.NotFound; + PostTask.postTask( + TaskTraits.BEST_EFFORT, + () -> { + if (mBraveNewsController != null) { + Url searchUrl = new Url(); + searchUrl.url = url; + mBraveNewsController.findFeeds( + searchUrl, + (results) -> { + if (!url.equals(mSearch)) return; + + boolean isExistingSource = false; + List sourceList = new ArrayList<>(); + for (FeedSearchResultItem resultItem : results) { + if (resultItem.feedUrl != null + && !BraveNewsUtils.searchPublisherForRss( + resultItem.feedUrl.url)) { + sourceList.add(resultItem); + } else { + isExistingSource = true; + } + } + BraveNewsPreferencesSearchType braveNewsPreferencesSearchType; + if (sourceList.size() > 0) { + braveNewsPreferencesSearchType = + BraveNewsPreferencesSearchType.NewSource; + } else if (isExistingSource) { + braveNewsPreferencesSearchType = + BraveNewsPreferencesSearchType + .Init; // ExistingSource; + } else { + braveNewsPreferencesSearchType = + BraveNewsPreferencesSearchType.NotFound; + } + mAdapter.setFindFeeds( + sourceList, braveNewsPreferencesSearchType); + }); } - mAdapter.setFindFeeds(sourceList, braveNewsPreferencesSearchType); - })); - } - }); + }); } @Override public void subscribeToNewDirectFeed(int position, Url feedUrl, boolean isFromFeed) { - PostTask.postTask(TaskTraits.BEST_EFFORT, () -> { - if (mBraveNewsController != null) { - mBraveNewsController.subscribeToNewDirectFeed( - feedUrl, ((isValidFeed, isDuplicate, publishers) -> { - if (isValidFeed && publishers != null && publishers.size() > 0) { - newsChangeSource(); - BraveNewsUtils.setPublishers(publishers); - } - - if (publishers != null) { - for (Map.Entry entry : publishers.entrySet()) { - Publisher publisher = entry.getValue(); - if (publisher.feedSource.url.equalsIgnoreCase(feedUrl.url)) { - publisher.userEnabledStatus = UserEnabled.ENABLED; - if (isFromFeed) { - updateFeedSearchResultItem(position, - publisher.feedSource.url, - publisher.publisherId); - } else { - mAdapter.notifyItemChanged(position); + PostTask.postTask( + TaskTraits.BEST_EFFORT, + () -> { + if (mBraveNewsController != null) { + mBraveNewsController.subscribeToNewDirectFeed( + feedUrl, + (isValidFeed, isDuplicate, publishers) -> { + if (isValidFeed + && publishers != null + && publishers.size() > 0) { + newsChangeSource(); + BraveNewsUtils.setPublishers(publishers); + } + + if (publishers != null) { + for (Map.Entry entry : + publishers.entrySet()) { + Publisher publisher = entry.getValue(); + if (publisher.feedSource.url.equalsIgnoreCase( + feedUrl.url)) { + publisher.userEnabledStatus = UserEnabled.ENABLED; + if (isFromFeed) { + updateFeedSearchResultItem( + position, + publisher.feedSource.url, + publisher.publisherId); + } else { + mAdapter.notifyItemChanged(position); + } + break; + } } - break; } - } - } - })); - } - }); + }); + } + }); } @Override diff --git a/android/java/org/chromium/chrome/browser/settings/BraveNewsPreferencesV2.java b/android/java/org/chromium/chrome/browser/settings/BraveNewsPreferencesV2.java index 30656d4c4467..1923a8e31668 100644 --- a/android/java/org/chromium/chrome/browser/settings/BraveNewsPreferencesV2.java +++ b/android/java/org/chromium/chrome/browser/settings/BraveNewsPreferencesV2.java @@ -43,16 +43,17 @@ import org.chromium.chrome.browser.preferences.ChromeSharedPreferences; import org.chromium.chrome.browser.util.BraveConstants; import org.chromium.chrome.browser.util.BraveTouchUtils; -import org.chromium.components.browser_ui.settings.FragmentSettingsLauncher; -import org.chromium.components.browser_ui.settings.SettingsLauncher; +import org.chromium.components.browser_ui.settings.FragmentSettingsNavigation; +import org.chromium.components.browser_ui.settings.SettingsNavigation; import org.chromium.mojo.bindings.ConnectionErrorHandler; import org.chromium.mojo.system.MojoException; import java.util.List; public class BraveNewsPreferencesV2 extends BravePreferenceFragment - implements BraveNewsPreferencesDataListener, ConnectionErrorHandler, - FragmentSettingsLauncher { + implements BraveNewsPreferencesDataListener, + ConnectionErrorHandler, + FragmentSettingsNavigation { public static final String PREF_SHOW_OPTIN = "show_optin"; private LinearLayout mParentLayout; @@ -74,8 +75,8 @@ public class BraveNewsPreferencesV2 extends BravePreferenceFragment private boolean mIsPublisherAvailable; private BraveNewsController mBraveNewsController; - // SettingsLauncher injected from main Settings Activity. - private SettingsLauncher mSettingsLauncher; + // SettingsNavigation injected from main Settings Activity. + private SettingsNavigation mSettingsLauncher; private final ObservableSupplierImpl mPageTitle = new ObservableSupplierImpl<>(); @@ -258,7 +259,7 @@ private void openBraveNewsPreferencesDetails( Bundle fragmentArgs = new Bundle(); fragmentArgs.putString( BraveConstants.BRAVE_NEWS_PREFERENCES_TYPE, braveNewsPreferencesType.toString()); - mSettingsLauncher.launchSettingsActivity( + mSettingsLauncher.startSettings( getActivity(), BraveNewsPreferencesDetails.class, fragmentArgs); } @@ -328,7 +329,7 @@ public void onSuggestionsReceived() { } @Override - public void setSettingsLauncher(SettingsLauncher settingsLauncher) { + public void setSettingsNavigation(SettingsNavigation settingsLauncher) { mSettingsLauncher = settingsLauncher; } diff --git a/android/java/org/chromium/chrome/browser/settings/BraveSearchEnginesPreferences.java b/android/java/org/chromium/chrome/browser/settings/BraveSearchEnginesPreferences.java index 9ef36813f5b1..ecd8db254300 100644 --- a/android/java/org/chromium/chrome/browser/settings/BraveSearchEnginesPreferences.java +++ b/android/java/org/chromium/chrome/browser/settings/BraveSearchEnginesPreferences.java @@ -85,7 +85,7 @@ private void updateSearchEnginePreference() { searchEnginePreference.setEnabled(true); searchEnginePreference.setSummary( BraveSearchEngineUtils.getDSEShortName( - getProfile().getPrimaryOTRProfile(/* createIfNeeded= */ true), true)); + getProfile().getPrimaryOtrProfile(/* createIfNeeded= */ true), true)); mSearchSuggestions = (ChromeSwitchPreference) findPreference(PREF_SEARCH_SUGGESTIONS); mSearchSuggestions.setOnPreferenceChangeListener(this); diff --git a/android/java/org/chromium/chrome/browser/settings/BraveSettingsLauncherImpl.java b/android/java/org/chromium/chrome/browser/settings/BraveSettingsLauncherImpl.java index b37704a097e4..ca858baf4ee8 100644 --- a/android/java/org/chromium/chrome/browser/settings/BraveSettingsLauncherImpl.java +++ b/android/java/org/chromium/chrome/browser/settings/BraveSettingsLauncherImpl.java @@ -20,14 +20,16 @@ import org.chromium.chrome.browser.safe_browsing.settings.BraveStandardProtectionSettingsFragment; import org.chromium.chrome.browser.safe_browsing.settings.StandardProtectionSettingsFragment; -public class BraveSettingsLauncherImpl extends SettingsLauncherImpl { +public class BraveSettingsLauncherImpl extends SettingsNavigationImpl { public BraveSettingsLauncherImpl() { super(); } @Override - public void launchSettingsActivity(Context context, - @Nullable Class fragment, @Nullable Bundle fragmentArgs) { + public void startSettings( + Context context, + @Nullable Class fragment, + @Nullable Bundle fragmentArgs) { if (fragment != null) { // Substitute with our version of class if (fragment.equals(StandardProtectionSettingsFragment.class)) { @@ -38,15 +40,15 @@ public void launchSettingsActivity(Context context, fragment = BraveClearBrowsingDataFragmentAdvanced.class; } } - super.launchSettingsActivity(context, fragment, fragmentArgs); + super.startSettings(context, fragment, fragmentArgs); } @Override - public Intent createSettingsActivityIntent( + public Intent createSettingsIntent( Context context, @Nullable Class fragment, @Nullable Bundle fragmentArgs) { - Intent intent = super.createSettingsActivityIntent(context, fragment, fragmentArgs); + Intent intent = super.createSettingsIntent(context, fragment, fragmentArgs); intent.setClass(context, BraveSettingsActivity.class); if (!(context instanceof Activity)) { intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); diff --git a/android/java/org/chromium/chrome/browser/settings/BraveSyncScreensPreference.java b/android/java/org/chromium/chrome/browser/settings/BraveSyncScreensPreference.java index 48098314747c..7b627ea6c063 100644 --- a/android/java/org/chromium/chrome/browser/settings/BraveSyncScreensPreference.java +++ b/android/java/org/chromium/chrome/browser/settings/BraveSyncScreensPreference.java @@ -75,7 +75,7 @@ import org.chromium.chrome.browser.sync.BraveSyncDevices; import org.chromium.chrome.browser.sync.SyncServiceFactory; import org.chromium.chrome.browser.sync.settings.BraveManageSyncSettings; -import org.chromium.components.browser_ui.settings.SettingsLauncher; +import org.chromium.components.browser_ui.settings.SettingsNavigation; import org.chromium.components.sync.SyncService; import org.chromium.ui.base.DeviceFormFactor; @@ -742,8 +742,9 @@ public void onTextChanged( }); } } else if (mShowCategoriesButton == v) { - SettingsLauncher settingsLauncher = SettingsLauncherFactory.createSettingsLauncher(); - settingsLauncher.launchSettingsActivity(getContext(), BraveManageSyncSettings.class); + SettingsNavigation settingsLauncher = + SettingsNavigationFactory.createSettingsNavigation(); + settingsLauncher.startSettings(getContext(), BraveManageSyncSettings.class); } else if (mAddDeviceButton == v) { setNewChainLayout(); } else if (mDeleteAccountButton == v) { diff --git a/android/java/org/chromium/chrome/browser/settings/BraveWalletNetworksPreferenceFragment.java b/android/java/org/chromium/chrome/browser/settings/BraveWalletNetworksPreferenceFragment.java index b389ec733195..8a2322bca0e0 100644 --- a/android/java/org/chromium/chrome/browser/settings/BraveWalletNetworksPreferenceFragment.java +++ b/android/java/org/chromium/chrome/browser/settings/BraveWalletNetworksPreferenceFragment.java @@ -25,17 +25,17 @@ import org.chromium.base.supplier.ObservableSupplier; import org.chromium.base.supplier.ObservableSupplierImpl; import org.chromium.chrome.R; -import org.chromium.components.browser_ui.settings.FragmentSettingsLauncher; -import org.chromium.components.browser_ui.settings.SettingsLauncher; +import org.chromium.components.browser_ui.settings.FragmentSettingsNavigation; +import org.chromium.components.browser_ui.settings.SettingsNavigation; import org.chromium.components.browser_ui.settings.SettingsUtils; public class BraveWalletNetworksPreferenceFragment extends BravePreferenceFragment - implements FragmentSettingsLauncher, BraveWalletAddNetworksFragment.Listener { + implements FragmentSettingsNavigation, BraveWalletAddNetworksFragment.Listener { // Preference key from R.xml.brave_wallet_networks_preference. private static final String PREF_BRAVE_WALLET_NETWORKS_ADD = "pref_brave_wallet_networks_add"; - // SettingsLauncher injected from main Settings Activity. - private SettingsLauncher mSettingsLauncher; + // SettingsNavigation injected from main Settings Activity. + private SettingsNavigation mSettingsLauncher; private ActivityResultLauncher mAddNetworkActivityResultLauncher; private final ObservableSupplierImpl mPageTitle = new ObservableSupplierImpl<>(); @@ -115,7 +115,7 @@ public void onDestroy() { } @Override - public void setSettingsLauncher(SettingsLauncher settingsLauncher) { + public void setSettingsNavigation(SettingsNavigation settingsLauncher) { mSettingsLauncher = settingsLauncher; } @@ -139,7 +139,7 @@ private void launchIntent(@Nullable final String chainId, boolean activeNetwork) fragmentArgs = null; } Intent intent = - mSettingsLauncher.createSettingsActivityIntent( + mSettingsLauncher.createSettingsIntent( requireContext(), BraveWalletAddNetworksFragment.class, fragmentArgs); mAddNetworkActivityResultLauncher.launch(intent); } diff --git a/android/java/org/chromium/chrome/browser/shields/BraveShieldsHandler.java b/android/java/org/chromium/chrome/browser/shields/BraveShieldsHandler.java index e4819c5427a8..9f7d5559118b 100644 --- a/android/java/org/chromium/chrome/browser/shields/BraveShieldsHandler.java +++ b/android/java/org/chromium/chrome/browser/shields/BraveShieldsHandler.java @@ -277,12 +277,12 @@ private PopupWindow showPopupMenu(View anchorView) { mPopupView = inflater.inflate(R.layout.brave_shields_main_layout, null); setUpViews(); - //Specify the length and width through constants + // Specify the length and width through constants int width; if (ConfigurationUtils.isLandscape(mContext)) { - width = (int) ((mContext.getResources().getDisplayMetrics().widthPixels) * 0.50); + width = (int) (mContext.getResources().getDisplayMetrics().widthPixels * 0.50); } else { - width = (int) ((mContext.getResources().getDisplayMetrics().widthPixels) * 0.75); + width = (int) (mContext.getResources().getDisplayMetrics().widthPixels * 0.75); } int height = LinearLayout.LayoutParams.WRAP_CONTENT; @@ -425,7 +425,7 @@ private void setUpMainLayout() { String favIconURL = mBraveRewardsNativeWorker.getPublisherFavIconURL(mTabId); Tab currentActiveTab = mIconFetcher.getTab(); String url = currentActiveTab.getUrl().getSpec(); - final String favicon_url = (favIconURL.isEmpty()) ? url : favIconURL; + final String favicon_url = favIconURL.isEmpty() ? url : favIconURL; mIconFetcher.retrieveLargeIcon(favicon_url, this); TextView mSiteText = mMainLayout.findViewById(R.id.site_text); @@ -525,10 +525,11 @@ private void setupDetailsLayouts() { if (ChromeFeatureList.isEnabled(BraveFeatureList.HTTPS_BY_DEFAULT)) { detailsLayouts.add(BraveShieldsContentSettings.RESOURCE_IDENTIFIER_HTTPS_UPGRADE); } else { - mPopupView.findViewById(R.id.brave_shields_secondary_https_upgrade_layout_id) + mPopupView + .findViewById(R.id.brave_shields_secondary_https_upgrade_layout_id) .setVisibility(View.GONE); } - if (ChromeFeatureList.isEnabled((BraveFeatureList.BRAVE_SHOW_STRICT_FINGERPRINTING_MODE))) { + if (ChromeFeatureList.isEnabled(BraveFeatureList.BRAVE_SHOW_STRICT_FINGERPRINTING_MODE)) { detailsLayouts.add(BraveShieldsContentSettings.RESOURCE_IDENTIFIER_FINGERPRINTING); } else { mPopupView diff --git a/android/java/org/chromium/chrome/browser/shields/ContentFilteringFragment.java b/android/java/org/chromium/chrome/browser/shields/ContentFilteringFragment.java index 88fffa461aaf..4019b64b2821 100644 --- a/android/java/org/chromium/chrome/browser/shields/ContentFilteringFragment.java +++ b/android/java/org/chromium/chrome/browser/shields/ContentFilteringFragment.java @@ -29,8 +29,8 @@ import org.chromium.chrome.R; import org.chromium.chrome.browser.settings.BravePreferenceFragment; import org.chromium.chrome.browser.settings.BraveSettingsActivity; -import org.chromium.components.browser_ui.settings.FragmentSettingsLauncher; -import org.chromium.components.browser_ui.settings.SettingsLauncher; +import org.chromium.components.browser_ui.settings.FragmentSettingsNavigation; +import org.chromium.components.browser_ui.settings.SettingsNavigation; import org.chromium.mojo.bindings.ConnectionErrorHandler; import org.chromium.mojo.system.MojoException; import org.chromium.mojo_base.mojom.Value; @@ -40,7 +40,9 @@ import java.util.Arrays; public class ContentFilteringFragment extends BravePreferenceFragment - implements FragmentSettingsLauncher, BraveContentFilteringListener, ConnectionErrorHandler { + implements FragmentSettingsNavigation, + BraveContentFilteringListener, + ConnectionErrorHandler { private RecyclerView mRecyclerView; private ContentFilteringAdapter mAdapter; @@ -53,8 +55,8 @@ public class ContentFilteringFragment extends BravePreferenceFragment private boolean mIsMenuLoaded; private boolean mIsGetSubscriptionsLoaded; - // SettingsLauncher injected from main Settings Activity. - private SettingsLauncher mSettingsLauncher; + // SettingsNavigation injected from main Settings Activity. + private SettingsNavigation mSettingsLauncher; private ActivityResultLauncher mAddCustomFilterResultLauncher; private final ObservableSupplierImpl mPageTitle = new ObservableSupplierImpl<>(); @@ -141,7 +143,7 @@ public void onAddSubscriptionFilter() { isEditSelected(false); } Intent intent = - mSettingsLauncher.createSettingsActivityIntent( + mSettingsLauncher.createSettingsIntent( getActivity(), AddCustomFilterListsFragment.class, null); mAddCustomFilterResultLauncher.launch(intent); } @@ -164,7 +166,7 @@ public void onCustomFilters() { isEditSelected(false); } Intent intent = - mSettingsLauncher.createSettingsActivityIntent( + mSettingsLauncher.createSettingsIntent( getActivity(), CreateCustomFiltersFragment.class, null); getActivity().startActivity(intent); } @@ -186,7 +188,7 @@ private void checkForEmptySubscriptionFilters(boolean shouldEditVisible) { } @Override - public void setSettingsLauncher(SettingsLauncher settingsLauncher) { + public void setSettingsNavigation(SettingsNavigation settingsLauncher) { mSettingsLauncher = settingsLauncher; } diff --git a/android/java/org/chromium/chrome/browser/sync/BraveSyncDevices.java b/android/java/org/chromium/chrome/browser/sync/BraveSyncDevices.java index ec018aa48bfa..30366052090f 100644 --- a/android/java/org/chromium/chrome/browser/sync/BraveSyncDevices.java +++ b/android/java/org/chromium/chrome/browser/sync/BraveSyncDevices.java @@ -53,12 +53,17 @@ private void Init() { } } + /** + * A finalizer is required to ensure that the native object associated with this descriptor gets + * torn down, otherwise there would be a memory leak. + */ + @SuppressWarnings("Finalize") @Override protected void finalize() { - Destroy(); + destroy(); } - private void Destroy() { + private void destroy() { if (mNativeBraveSyncDevicesAndroid != 0) { BraveSyncDevicesJni.get().destroy(mNativeBraveSyncDevicesAndroid); mNativeBraveSyncDevicesAndroid = 0; @@ -98,7 +103,7 @@ protected void deviceInfoChanged() { } } - public class SyncDeviceInfo { + public static class SyncDeviceInfo { public String mName; public boolean mIsCurrentDevice; public boolean mSupportsSelfDelete; diff --git a/android/java/org/chromium/chrome/browser/tabbed_mode/BraveTabbedRootUiCoordinator.java b/android/java/org/chromium/chrome/browser/tabbed_mode/BraveTabbedRootUiCoordinator.java index 5efebe0340c6..84936cd56ac3 100644 --- a/android/java/org/chromium/chrome/browser/tabbed_mode/BraveTabbedRootUiCoordinator.java +++ b/android/java/org/chromium/chrome/browser/tabbed_mode/BraveTabbedRootUiCoordinator.java @@ -48,6 +48,7 @@ import org.chromium.chrome.browser.ui.edge_to_edge.EdgeToEdgeController; import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager; import org.chromium.chrome.browser.ui.system.StatusBarColorController.StatusBarColorProvider; +import org.chromium.components.browser_ui.edge_to_edge.EdgeToEdgeStateProvider; import org.chromium.components.browser_ui.widget.MenuOrKeyboardActionController; import org.chromium.ui.InsetObserver; import org.chromium.ui.base.ActivityWindowAndroid; @@ -106,7 +107,8 @@ public BraveTabbedRootUiCoordinator( @Nullable MultiInstanceManager multiInstanceManager, @Nullable ObservableSupplier overviewColorSupplier, @Nullable View baseChromeLayout, - @NonNull ManualFillingComponentSupplier manualFillingComponentSupplier) { + @NonNull ManualFillingComponentSupplier manualFillingComponentSupplier, + @NonNull EdgeToEdgeStateProvider edgeToEdgeStateProvider) { super( activity, onOmniboxFocusChangedListener, @@ -152,7 +154,8 @@ public BraveTabbedRootUiCoordinator( multiInstanceManager, overviewColorSupplier, baseChromeLayout, - manualFillingComponentSupplier); + manualFillingComponentSupplier, + edgeToEdgeStateProvider); mActivity = activity; mHubManagerSupplier = hubManagerSupplier; diff --git a/android/java/org/chromium/chrome/browser/toolbar/BraveToolbarManager.java b/android/java/org/chromium/chrome/browser/toolbar/BraveToolbarManager.java index 7bb59057c162..a650311a422e 100644 --- a/android/java/org/chromium/chrome/browser/toolbar/BraveToolbarManager.java +++ b/android/java/org/chromium/chrome/browser/toolbar/BraveToolbarManager.java @@ -29,7 +29,7 @@ import org.chromium.chrome.browser.bookmarks.BookmarkModel; import org.chromium.chrome.browser.brave_leo.BraveLeoActivity; import org.chromium.chrome.browser.browser_controls.BottomControlsStacker; -import org.chromium.chrome.browser.browser_controls.BrowserControlsVisibilityManager; +import org.chromium.chrome.browser.browser_controls.BrowserControlsSizer; import org.chromium.chrome.browser.browser_controls.BrowserStateBrowserControlsVisibilityDelegate; import org.chromium.chrome.browser.compositor.CompositorViewHolder; import org.chromium.chrome.browser.compositor.layouts.LayoutManagerImpl; @@ -71,10 +71,10 @@ import org.chromium.chrome.browser.toolbar.top.TopToolbarCoordinator; import org.chromium.chrome.browser.ui.appmenu.AppMenuCoordinator; import org.chromium.chrome.browser.ui.appmenu.AppMenuDelegate; -import org.chromium.chrome.browser.ui.desktop_windowing.DesktopWindowStateProvider; import org.chromium.chrome.browser.ui.edge_to_edge.EdgeToEdgeController; import org.chromium.chrome.browser.ui.system.StatusBarColorController; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; +import org.chromium.components.browser_ui.desktop_windowing.DesktopWindowStateProvider; import org.chromium.components.browser_ui.widget.scrim.ScrimCoordinator; import org.chromium.components.omnibox.action.OmniboxActionDelegate; import org.chromium.misc_metrics.mojom.MiscAndroidMetrics; @@ -128,7 +128,7 @@ public class BraveToolbarManager extends ToolbarManager { private BraveScrollingBottomViewResourceFrameLayout mBottomControls; private ObservableSupplier mEdgeToEdgeControllerSupplier; private ObservableSupplier mProfileSupplier; - private BrowserControlsVisibilityManager mBrowserControlsVisibilityManager; + private final BrowserControlsSizer mBrowserControlsSizer; private OneshotSupplierImpl mContentDelegateSupplier = new OneshotSupplierImpl<>(); private final DataSharingTabManager mDataSharingTabManager; @@ -137,7 +137,7 @@ public class BraveToolbarManager extends ToolbarManager { public BraveToolbarManager( AppCompatActivity activity, BottomControlsStacker bottomControlsStacker, - BrowserControlsVisibilityManager controlsVisibilityManager, + BrowserControlsSizer controlsSizer, FullscreenManager fullscreenManager, ObservableSupplier edgeToEdgeControllerSupplier, ToolbarControlContainer controlContainer, @@ -184,7 +184,7 @@ public BraveToolbarManager( super( activity, bottomControlsStacker, - controlsVisibilityManager, + controlsSizer, fullscreenManager, edgeToEdgeControllerSupplier, controlContainer, @@ -234,7 +234,7 @@ public BraveToolbarManager( mCompositorViewHolder = compositorViewHolder; mEdgeToEdgeControllerSupplier = edgeToEdgeControllerSupplier; mProfileSupplier = profileSupplier; - mBrowserControlsVisibilityManager = controlsVisibilityManager; + mBrowserControlsSizer = controlsSizer; mDataSharingTabManager = dataSharingTabManager; mTabModelSelectorSupplier = tabModelSelectorSupplier; @@ -275,7 +275,7 @@ public void enableBottomControls() { .createTabGroupUi( mActivity, mBottomControls.findViewById(R.id.bottom_container_slot), - mBrowserControlsVisibilityManager, + mBrowserControlsSizer, mIncognitoStateProvider, mScrimCoordinator, mOmniboxFocusStateSupplier, @@ -290,7 +290,7 @@ public void enableBottomControls() { mContentDelegateSupplier.set(mTabGroupUi); BrowserStateBrowserControlsVisibilityDelegate controlsVisibilityDelegate = - mBrowserControlsVisibilityManager.getBrowserVisibilityDelegate(); + mBrowserControlsSizer.getBrowserVisibilityDelegate(); assert controlsVisibilityDelegate != null; mBottomControlsCoordinatorSupplier.set( @@ -348,7 +348,7 @@ public void enableBottomControls() { public void initializeWithNative( @NonNull LayoutManagerImpl layoutManager, @Nullable StripLayoutHelperManager stripLayoutHelperManager, - OnClickListener tabSwitcherClickHandler, + Runnable openGridTabSwitcherHandler, OnClickListener bookmarkClickHandler, OnClickListener customTabsBackClickHandler, @Nullable ObservableSupplier archivedTabCountSupplier) { @@ -356,7 +356,7 @@ public void initializeWithNative( super.initializeWithNative( layoutManager, stripLayoutHelperManager, - tabSwitcherClickHandler, + openGridTabSwitcherHandler, bookmarkClickHandler, customTabsBackClickHandler, archivedTabCountSupplier); @@ -390,7 +390,7 @@ public void initializeWithNative( mActivity, mCompositorViewHolder.getResourceManager(), mCompositorViewHolder.getLayoutManager(), - /*tabSwitcherListener*/ tabSwitcherClickHandler, + /*tabSwitcherListener*/ v -> openGridTabSwitcherHandler.run(), /*newTabClickListener*/ wrappedNewTabClickHandler, mWindowAndroid, mTabModelSelector, @@ -470,7 +470,7 @@ protected void updateBookmarkButtonStatus() { } protected void updateReloadState(boolean tabCrashed) { - assert (false); + assert false; } private void setBottomToolbarVisible(boolean visible) { diff --git a/android/java/org/chromium/chrome/browser/toolbar/top/BraveToolbarLayoutImpl.java b/android/java/org/chromium/chrome/browser/toolbar/top/BraveToolbarLayoutImpl.java index 02f0063b6914..a49954ab38af 100644 --- a/android/java/org/chromium/chrome/browser/toolbar/top/BraveToolbarLayoutImpl.java +++ b/android/java/org/chromium/chrome/browser/toolbar/top/BraveToolbarLayoutImpl.java @@ -519,9 +519,9 @@ public void onDidFinishNavigationInPrimaryMainFrame( } if (PackageUtils.isFirstInstall(getContext()) && tab.getUrl().getSpec() != null - && (tab.getUrl() + && tab.getUrl() .getSpec() - .equals(BraveActivity.BRAVE_REWARDS_SETTINGS_URL)) + .equals(BraveActivity.BRAVE_REWARDS_SETTINGS_URL) && BraveRewardsHelper.shouldShowBraveRewardsOnboardingModal() && mBraveRewardsNativeWorker != null && !mBraveRewardsNativeWorker.isRewardsEnabled() @@ -1000,25 +1000,27 @@ public void updateDrawState(@NonNull TextPaint ds) { TextView takeQuickTourButton = braveRewardsOnboardingModalView.findViewById(R.id.take_quick_tour_button); - takeQuickTourButton.setOnClickListener((new View.OnClickListener() { - @Override - public void onClick(View v) { - BraveRewardsHelper.setShowBraveRewardsOnboardingOnce(true); - openRewardsPanel(); - dialog.dismiss(); - } - })); + takeQuickTourButton.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View v) { + BraveRewardsHelper.setShowBraveRewardsOnboardingOnce(true); + openRewardsPanel(); + dialog.dismiss(); + } + }); BraveTouchUtils.ensureMinTouchTarget(takeQuickTourButton); TextView btnBraveRewards = braveRewardsOnboardingModalView.findViewById(R.id.start_using_brave_rewards_text); - btnBraveRewards.setOnClickListener((new View.OnClickListener() { - @Override - public void onClick(View v) { - BraveRewardsHelper.setShowDeclareGeoModal(true); - openRewardsPanel(); - dialog.dismiss(); - } - })); + btnBraveRewards.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View v) { + BraveRewardsHelper.setShowDeclareGeoModal(true); + openRewardsPanel(); + dialog.dismiss(); + } + }); dialog.show(); } diff --git a/android/java/org/chromium/chrome/browser/toolbar/top/BraveTopToolbarCoordinator.java b/android/java/org/chromium/chrome/browser/toolbar/top/BraveTopToolbarCoordinator.java index 9ee5e24d9b15..f7e78ec9a0c6 100644 --- a/android/java/org/chromium/chrome/browser/toolbar/top/BraveTopToolbarCoordinator.java +++ b/android/java/org/chromium/chrome/browser/toolbar/top/BraveTopToolbarCoordinator.java @@ -8,6 +8,7 @@ import android.content.Context; import android.view.View; import android.view.View.OnClickListener; +import android.view.View.OnLongClickListener; import androidx.annotation.ColorInt; import androidx.annotation.Nullable; @@ -37,8 +38,8 @@ import org.chromium.chrome.browser.toolbar.top.ToolbarTablet.OfflineDownloader; import org.chromium.chrome.browser.toolbar.top.tab_strip.TabStripTransitionCoordinator.TabStripTransitionDelegate; import org.chromium.chrome.browser.ui.appmenu.AppMenuButtonHelper; -import org.chromium.chrome.browser.ui.desktop_windowing.DesktopWindowStateProvider; import org.chromium.chrome.browser.user_education.UserEducationHelper; +import org.chromium.components.browser_ui.desktop_windowing.DesktopWindowStateProvider; import org.chromium.ui.resources.ResourceManager; import org.chromium.ui.util.ColorUtils; @@ -85,7 +86,8 @@ public BraveTopToolbarCoordinator( FullscreenManager fullscreenManager, TabObscuringHandler tabObscuringHandler, @Nullable DesktopWindowStateProvider desktopWindowStateProvider, - OneshotSupplier tabStripTransitionDelegateSupplier) { + OneshotSupplier tabStripTransitionDelegateSupplier, + @Nullable OnLongClickListener onLongClickListener) { super( controlContainer, toolbarLayout, @@ -111,7 +113,8 @@ public BraveTopToolbarCoordinator( fullscreenManager, tabObscuringHandler, desktopWindowStateProvider, - tabStripTransitionDelegateSupplier); + tabStripTransitionDelegateSupplier, + onLongClickListener); mBraveToolbarLayout = toolbarLayout; mBraveMenuButtonCoordinator = browsingModeMenuButtonCoordinator; diff --git a/android/java/org/chromium/chrome/browser/util/BraveDbUtil.java b/android/java/org/chromium/chrome/browser/util/BraveDbUtil.java index 911408b75086..1e2c12a1d767 100644 --- a/android/java/org/chromium/chrome/browser/util/BraveDbUtil.java +++ b/android/java/org/chromium/chrome/browser/util/BraveDbUtil.java @@ -108,10 +108,11 @@ private void copyRewardsDbThread(Dialog dlg, boolean isImport) { } // Update UI - final String msg = (!TextUtils.isEmpty(erroMsg)) ? erroMsg - : "Database successfully " + (isImport ? "imported" : "exported"); - if (dlg != null) - dlg.dismiss(); + final String msg = + !TextUtils.isEmpty(erroMsg) + ? erroMsg + : "Database successfully " + (isImport ? "imported" : "exported"); + if (dlg != null) dlg.dismiss(); Context context = ContextUtils.getApplicationContext(); Toast.makeText(context, msg, Toast.LENGTH_LONG).show(); if (isImport) { diff --git a/android/java/org/chromium/chrome/browser/util/TabUtils.java b/android/java/org/chromium/chrome/browser/util/TabUtils.java index 2b1eda770a64..383d7f3b9e6f 100644 --- a/android/java/org/chromium/chrome/browser/util/TabUtils.java +++ b/android/java/org/chromium/chrome/browser/util/TabUtils.java @@ -318,11 +318,7 @@ public static void openUrlInCustomTab(Context context, String url) { context.startActivity(intent); } - /** - * Returns transition for the given tab - * - * @param tab - */ + /** Returns transition for the given tab */ public static int getTransition(Tab tab) { if (tab != null && tab.getWebContents() != null diff --git a/android/java/org/chromium/chrome/browser/vpn/BraveVpnNativeWorker.java b/android/java/org/chromium/chrome/browser/vpn/BraveVpnNativeWorker.java index fc075cbf79de..6c92ee38ff08 100644 --- a/android/java/org/chromium/chrome/browser/vpn/BraveVpnNativeWorker.java +++ b/android/java/org/chromium/chrome/browser/vpn/BraveVpnNativeWorker.java @@ -42,6 +42,11 @@ private void init() { } } + /** + * A finalizer is required to ensure that the native object associated with this descriptor gets + * torn down, otherwise there would be a memory leak. + */ + @SuppressWarnings("Finalize") @Override protected void finalize() { destroy(); diff --git a/android/java/org/chromium/chrome/browser/vpn/settings/VpnCalloutPreference.java b/android/java/org/chromium/chrome/browser/vpn/settings/VpnCalloutPreference.java index c3f0ed948580..4b497fd6daf6 100644 --- a/android/java/org/chromium/chrome/browser/vpn/settings/VpnCalloutPreference.java +++ b/android/java/org/chromium/chrome/browser/vpn/settings/VpnCalloutPreference.java @@ -40,7 +40,7 @@ public void onBindViewHolder(PreferenceViewHolder holder) { boolean isTablet = DeviceFormFactor.isNonMultiDisplayContextOnTablet(getContext()); - int width = (int) ((getContext().getResources().getDisplayMetrics().widthPixels) * 1.00); + int width = (int) (getContext().getResources().getDisplayMetrics().widthPixels * 1.00); if (isTablet || ConfigurationUtils.isLandscape(getContext())) { width = (int) dpToPx(getContext(), 390); } diff --git a/android/java/proguard.flags b/android/java/proguard.flags index 7fbe47e05f59..6e940f45d94c 100644 --- a/android/java/proguard.flags +++ b/android/java/proguard.flags @@ -55,9 +55,9 @@ -keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken --keep class org.chromium.chrome.browser.tasks.tab_groups.TabGroupModelFilter { +-keep class org.chromium.chrome.browser.tabmodel.TabGroupModelFilterImpl { *** shouldUseParentIds(...); - *** getOrCreateTabGroupId(...); + *** isTabModelRestored(...); } -keep class org.chromium.chrome.browser.password_manager.settings.ExportFlow { diff --git a/android/java/res/layout/bottom_toolbar_browsing.xml b/android/java/res/layout/bottom_toolbar_browsing.xml index 12325074b7d5..85d2fd710dc3 100644 --- a/android/java/res/layout/bottom_toolbar_browsing.xml +++ b/android/java/res/layout/bottom_toolbar_browsing.xml @@ -63,7 +63,6 @@ app:menuMaxWidth="@dimen/tab_switcher_menu_width" android:visibility="gone" android:background="?attr/selectableItemBackgroundBorderless" - android:contentDescription="@string/accessibility_toolbar_btn_tabswitcher_toggle_default" app:menuVerticalOverlapAnchor="false" /> diff --git a/android/javatests/org/chromium/chrome/browser/BraveSwipeRefreshHandlerTest.java b/android/javatests/org/chromium/chrome/browser/BraveSwipeRefreshHandlerTest.java index 0617a4fb5133..4488574d5318 100644 --- a/android/javatests/org/chromium/chrome/browser/BraveSwipeRefreshHandlerTest.java +++ b/android/javatests/org/chromium/chrome/browser/BraveSwipeRefreshHandlerTest.java @@ -64,7 +64,6 @@ private TabbedModeTabDelegateFactory createTabDelegateFactory() { () -> {}, rootUiCoordinator.getBottomSheetController(), /* chromeActivityNativeDelegate= */ cta, - /* isCustomTab= */ true, rootUiCoordinator.getBrowserControlsManager(), cta.getFullscreenManager(), /* tabCreatorManager= */ cta, diff --git a/android/javatests/org/chromium/chrome/browser/BytecodeTest.java b/android/javatests/org/chromium/chrome/browser/BytecodeTest.java index a57159a8d80c..f57693749b0d 100644 --- a/android/javatests/org/chromium/chrome/browser/BytecodeTest.java +++ b/android/javatests/org/chromium/chrome/browser/BytecodeTest.java @@ -18,6 +18,7 @@ import android.view.ActionMode; import android.view.View; import android.view.View.OnClickListener; +import android.view.View.OnLongClickListener; import android.view.ViewGroup; import android.view.ViewStub; import android.view.Window; @@ -34,7 +35,6 @@ import org.chromium.base.Callback; import org.chromium.base.FeatureMap; -import org.chromium.base.Token; import org.chromium.base.jank_tracker.JankTracker; import org.chromium.base.shared_preferences.PreferenceKeyRegistry; import org.chromium.base.shared_preferences.SharedPreferencesManager; @@ -53,8 +53,8 @@ import org.chromium.chrome.browser.bookmarks.BookmarkUiPrefs; import org.chromium.chrome.browser.bookmarks.BookmarkUndoController; import org.chromium.chrome.browser.browser_controls.BottomControlsStacker; +import org.chromium.chrome.browser.browser_controls.BrowserControlsSizer; import org.chromium.chrome.browser.browser_controls.BrowserControlsStateProvider; -import org.chromium.chrome.browser.browser_controls.BrowserControlsVisibilityManager; import org.chromium.chrome.browser.browser_controls.BrowserStateBrowserControlsVisibilityDelegate; import org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider; import org.chromium.chrome.browser.compositor.CompositorViewHolder; @@ -127,13 +127,14 @@ import org.chromium.chrome.browser.toolbar.top.ToolbarTablet.OfflineDownloader; import org.chromium.chrome.browser.ui.appmenu.AppMenuBlocker; import org.chromium.chrome.browser.ui.appmenu.AppMenuDelegate; -import org.chromium.chrome.browser.ui.desktop_windowing.DesktopWindowStateProvider; import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager; import org.chromium.chrome.browser.ui.native_page.NativePageHost; import org.chromium.chrome.browser.ui.system.StatusBarColorController; import org.chromium.chrome.browser.ui.system.StatusBarColorController.StatusBarColorProvider; import org.chromium.chrome.browser.user_education.UserEducationHelper; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; +import org.chromium.components.browser_ui.desktop_windowing.DesktopWindowStateProvider; +import org.chromium.components.browser_ui.edge_to_edge.EdgeToEdgeStateProvider; import org.chromium.components.browser_ui.site_settings.ContentSettingException; import org.chromium.components.browser_ui.site_settings.PermissionInfo; import org.chromium.components.browser_ui.site_settings.SiteSettingsCategory; @@ -151,7 +152,6 @@ import org.chromium.components.embedder_support.contextmenu.ContextMenuParams; import org.chromium.components.external_intents.ExternalNavigationDelegate; import org.chromium.components.externalauth.ExternalAuthUtils; -import org.chromium.components.favicon.LargeIconBridge; import org.chromium.components.feature_engagement.Tracker; import org.chromium.components.omnibox.AutocompleteMatch; import org.chromium.components.omnibox.action.OmniboxActionDelegate; @@ -166,7 +166,6 @@ import org.chromium.ui.base.WindowAndroid; import org.chromium.ui.base.WindowDelegate; import org.chromium.ui.modaldialog.ModalDialogManager; -import org.chromium.ui.modelutil.MVCListAdapter; import org.chromium.ui.modelutil.MVCListAdapter.ModelList; import org.chromium.ui.modelutil.PropertyModel; import org.chromium.url.GURL; @@ -286,7 +285,7 @@ public void testClassesExist() throws Exception { classExists("org/chromium/components/variations/firstrun/VariationsSeedFetcher")); Assert.assertTrue( classExists( - "org/chromium/chrome/browser/partnercustomizations/CustomizationProviderDelegateImpl")); + "org/chromium/chrome/browser/partnercustomizations/CustomizationProviderDelegateUpstreamImpl")); Assert.assertTrue( classExists( "org/chromium/chrome/browser/share/send_tab_to_self/ManageAccountDevicesLinkView")); // presubmit: ignore-long-line @@ -315,7 +314,7 @@ public void testClassesExist() throws Exception { Assert.assertTrue(classExists("org/chromium/chrome/browser/omnibox/LocationBarMediator")); Assert.assertTrue(classExists("org/chromium/chrome/browser/tasks/ReturnToChromeUtil")); Assert.assertTrue(classExists("org/chromium/chrome/browser/IntentHandler")); - Assert.assertTrue(classExists("org/chromium/base/cached_flags/CachedFlag")); + Assert.assertTrue(classExists("org/chromium/components/cached_flags/CachedFlag")); Assert.assertTrue(classExists("org/chromium/chrome/browser/logo/LogoMediator")); Assert.assertTrue( classExists("org/chromium/chrome/browser/tracing/settings/DeveloperSettings")); @@ -335,13 +334,11 @@ public void testClassesExist() throws Exception { Assert.assertTrue( classExists("org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator")); Assert.assertTrue( - classExists("org/chromium/chrome/browser/tasks/tab_groups/TabGroupModelFilter")); + classExists("org/chromium/chrome/browser/tabmodel/TabGroupModelFilterImpl")); Assert.assertTrue(classExists("org/chromium/chrome/browser/SwipeRefreshHandler")); Assert.assertTrue( classExists("org/chromium/chrome/browser/identity_disc/IdentityDiscController")); Assert.assertTrue(classExists("org/chromium/chrome/browser/bookmarks/BookmarkUiPrefs")); - Assert.assertTrue( - classExists("org/chromium/components/language/LocaleManagerDelegateImpl")); Assert.assertTrue( classExists("org/chromium/chrome/browser/multiwindow/MultiInstanceManagerApi31")); Assert.assertTrue(classExists("org/chromium/chrome/browser/multiwindow/MultiWindowUtils")); @@ -895,7 +892,6 @@ public void testMethodsForInvocationExist() throws Exception { true, ViewProvider.class, Context.class, - MVCListAdapter.ModelList.class, boolean.class)); Assert.assertTrue( methodExists( @@ -1014,7 +1010,7 @@ public void testMethodsForInvocationExist() throws Exception { Tab.class)); Assert.assertTrue( methodExists( - "org/chromium/chrome/browser/tasks/tab_groups/TabGroupModelFilter", + "org/chromium/chrome/browser/tabmodel/TabGroupModelFilterImpl", "shouldUseParentIds", MethodModifier.REGULAR, true, @@ -1022,12 +1018,11 @@ public void testMethodsForInvocationExist() throws Exception { Tab.class)); Assert.assertTrue( methodExists( - "org/chromium/chrome/browser/tasks/tab_groups/TabGroupModelFilter", - "getOrCreateTabGroupId", - MethodModifier.STATIC, + "org/chromium/chrome/browser/tabmodel/TabGroupModelFilterImpl", + "isTabModelRestored", + MethodModifier.REGULAR, true, - Token.class, - Tab.class)); + boolean.class)); Assert.assertTrue( methodExists( @@ -1113,7 +1108,7 @@ public void testConstructorsExistAndMatch() throws Exception { "org/chromium/chrome/browser/toolbar/BraveToolbarManager", AppCompatActivity.class, BottomControlsStacker.class, - BrowserControlsVisibilityManager.class, + BrowserControlsSizer.class, FullscreenManager.class, ObservableSupplier.class, ToolbarControlContainer.class, @@ -1185,7 +1180,7 @@ public void testConstructorsExistAndMatch() throws Exception { Supplier.class)); Assert.assertTrue( constructorsMatch( - "org/chromium/chrome/browser/settings/SettingsLauncherImpl", + "org/chromium/chrome/browser/settings/SettingsNavigationImpl", "org/chromium/chrome/browser/settings/BraveSettingsLauncherImpl")); Assert.assertTrue( constructorsMatch( @@ -1220,7 +1215,6 @@ public void testConstructorsExistAndMatch() throws Exception { "org/chromium/chrome/browser/omnibox/status/StatusMediator", "org/chromium/chrome/browser/omnibox/status/BraveStatusMediator", PropertyModel.class, - Resources.class, Context.class, UrlBarEditingTextStateProvider.class, boolean.class, @@ -1256,7 +1250,8 @@ public void testConstructorsExistAndMatch() throws Exception { HomeSurfaceTracker.class, ObservableSupplier.class, ObservableSupplier.class, - OneshotSupplier.class)); + OneshotSupplier.class, + ObservableSupplier.class)); Assert.assertTrue( constructorsMatch( "org/chromium/chrome/browser/toolbar/top/TopToolbarCoordinator", @@ -1285,7 +1280,8 @@ public void testConstructorsExistAndMatch() throws Exception { FullscreenManager.class, TabObscuringHandler.class, DesktopWindowStateProvider.class, - OneshotSupplier.class)); + OneshotSupplier.class, + OnLongClickListener.class)); Assert.assertTrue( constructorsMatch( "org/chromium/chrome/browser/toolbar/menu_button/MenuButtonCoordinator", @@ -1363,7 +1359,7 @@ public void testConstructorsExistAndMatch() throws Exception { Profile.class)); Assert.assertTrue( constructorsMatch( - "org/chromium/chrome/browser/partnercustomizations/CustomizationProviderDelegateImpl", + "org/chromium/chrome/browser/partnercustomizations/CustomizationProviderDelegateUpstreamImpl", "org/chromium/chrome/browser/partnercustomizations/BraveCustomizationProviderDelegateImpl")); Assert.assertTrue( constructorsMatch( @@ -1413,7 +1409,6 @@ public void testConstructorsExistAndMatch() throws Exception { View.class, View.class, ObservableSupplier.class, - BraveLocationBarMediator.getPrivacyPreferencesManagerClass(), LocationBarDataProvider.class, ActionMode.Callback.class, WindowDelegate.class, @@ -1439,7 +1434,9 @@ public void testConstructorsExistAndMatch() throws Exception { OmniboxSuggestionsDropdownScrollListener.class, ObservableSupplier.class, LocationBarEmbedderUiOverrides.class, - View.class)); + View.class, + Supplier.class, + OnLongClickListener.class)); Assert.assertTrue( constructorsMatch( "org/chromium/chrome/browser/omnibox/LocationBarMediator", @@ -1449,7 +1446,6 @@ public void testConstructorsExistAndMatch() throws Exception { LocationBarDataProvider.class, LocationBarEmbedderUiOverrides.class, ObservableSupplier.class, - BraveLocationBarMediator.getPrivacyPreferencesManagerClass(), OverrideUrlLoadingDelegate.class, BraveLocationBarMediator.getLocaleManagerClass(), OneshotSupplier.class, @@ -1464,19 +1460,19 @@ public void testConstructorsExistAndMatch() throws Exception { ObservableSupplier.class)); Assert.assertTrue( constructorsMatch( - "org/chromium/chrome/browser/AppHooksImpl", + "org/chromium/chrome/browser/AppHooks", "org/chromium/chrome/browser/BraveAppHooks")); Assert.assertTrue( constructorsMatch( - "org/chromium/base/cached_flags/CachedFlag", - "org/chromium/base/cached_flags/BraveCachedFlag", + "org/chromium/components/cached_flags/CachedFlag", + "org/chromium/components/cached_flags/BraveCachedFlag", FeatureMap.class, String.class, boolean.class)); Assert.assertTrue( constructorsMatch( - "org/chromium/base/cached_flags/CachedFlag", - "org/chromium/base/cached_flags/BraveCachedFlag", + "org/chromium/components/cached_flags/CachedFlag", + "org/chromium/components/cached_flags/BraveCachedFlag", FeatureMap.class, String.class, boolean.class, @@ -1558,7 +1554,8 @@ public void testConstructorsExistAndMatch() throws Exception { MultiInstanceManager.class, ObservableSupplier.class, View.class, - ManualFillingComponentSupplier.class)); + ManualFillingComponentSupplier.class, + EdgeToEdgeStateProvider.class)); Assert.assertTrue( constructorsMatch( "org/chromium/chrome/browser/bookmarks/BookmarkToolbar", @@ -1604,7 +1601,6 @@ public void testConstructorsExistAndMatch() throws Exception { SelectionDelegate.class, RecyclerView.class, DragReorderableRecyclerViewAdapter.class, - LargeIconBridge.class, boolean.class, ObservableSupplierImpl.class, Profile.class, @@ -1689,10 +1685,6 @@ public void testConstructorsExistAndMatch() throws Exception { boolean.class, boolean.class, PartialCustomTabHandleStrategyFactory.class)); - Assert.assertTrue( - constructorsMatch( - "org/chromium/components/language/LocaleManagerDelegateImpl", - "org/chromium/components/language/BraveLocaleManagerDelegateImpl")); Assert.assertTrue( constructorsMatch( "org/chromium/chrome/browser/compositor/layouts/ToolbarSwipeLayout", @@ -1731,7 +1723,8 @@ public void testConstructorsExistAndMatch() throws Exception { Assert.assertTrue( constructorsMatch( "org/chromium/chrome/browser/password_manager/settings/ExportFlow", - "org/chromium/chrome/browser/password_manager/settings/BraveExportFlow")); + "org/chromium/chrome/browser/password_manager/settings/BraveExportFlow", + int.class)); Assert.assertTrue( constructorsMatch( @@ -1761,7 +1754,8 @@ public void testConstructorsExistAndMatch() throws Exception { OnClickListener.class, OneshotSupplier.class, DoubleConsumer.class, - UserEducationHelper.class)); + UserEducationHelper.class, + ObservableSupplier.class)); } @Test @@ -2066,9 +2060,10 @@ public void testFieldsExist() throws Exception { "org/chromium/chrome/browser/bookmarks/BookmarkPage", "mBookmarkManagerCoordinator")); Assert.assertTrue( - fieldExists("org/chromium/base/cached_flags/CachedFlag", "mDefaultValue")); + fieldExists("org/chromium/components/cached_flags/CachedFlag", "mDefaultValue")); Assert.assertFalse( - fieldExists("org/chromium/chrome/browser/tasks/tab_groups/TabGroupModelFilter", + fieldExists( + "org/chromium/chrome/browser/tabmodel/TabGroupModelFilterImpl", "mIsResetting")); Assert.assertTrue( fieldExists("org/chromium/chrome/browser/SwipeRefreshHandler", "mSwipeType")); @@ -2227,8 +2222,8 @@ public void testSuperNames() throws Exception { "org/chromium/chrome/browser/bookmarks/BraveBookmarkBridge")); Assert.assertTrue( checkSuperName( - "org/chromium/chrome/browser/tasks/tab_groups/TabGroupModelFilter", - "org/chromium/chrome/browser/tasks/tab_groups/BraveTabGroupModelFilter")); + "org/chromium/chrome/browser/tabmodel/TabGroupModelFilterImpl", + "org/chromium/chrome/browser/tabmodel/BraveTabGroupModelFilter")); Assert.assertTrue( checkSuperName( "org/chromium/chrome/browser/media/PictureInPictureActivity", @@ -2274,15 +2269,17 @@ private boolean methodExists( if (m.getName().equals(methodName)) { if (checkTypes) { Class type = m.getReturnType(); - if (type == null && returnType != null || type != null && returnType == null - || type != null && returnType != null && !type.equals(returnType)) { + if ((type == null && returnType != null) + || (type != null && returnType == null) + || (type != null && returnType != null && !type.equals(returnType))) { return false; } Class[] types = m.getParameterTypes(); - if (types == null && parameterTypes != null - || types != null && parameterTypes == null - || types != null && parameterTypes != null - && types.length != parameterTypes.length) { + if ((types == null && parameterTypes != null) + || (types != null && parameterTypes == null) + || (types != null + && parameterTypes != null + && types.length != parameterTypes.length)) { return false; } for (int i = 0; i < (types == null ? 0 : types.length); i++) { diff --git a/app/BUILD.gn b/app/BUILD.gn index 816227f06750..bddcf89a767d 100644 --- a/app/BUILD.gn +++ b/app/BUILD.gn @@ -120,10 +120,10 @@ source_set("unit_tests") { "//base/test:test_support", "//brave/components/variations:buildflags", "//chrome/browser", + "//chrome/browser/devtools", "//chrome/browser/enterprise/connectors/analysis:features", "//chrome/browser/ui", "//chrome/browser/ui:ui_features", - "//chrome/common/companion/visual_query:flags", "//chrome/common/privacy_budget", "//components/aggregation_service", "//components/attribution_reporting", diff --git a/app/brave_strings.grd b/app/brave_strings.grd index 158a85f2f04c..851f2f7de566 100644 --- a/app/brave_strings.grd +++ b/app/brave_strings.grd @@ -654,6 +654,12 @@ Permissions you've already given to websites and apps may apply to this account. Brave is already installed for all users on your computer. + + Provides elevated privileges for $1Brave. + + + Provides system tracing services for $1Brave. If this service is disabled, performance traces created by the browser will not include system-wide events such as context switch and ready thread events. + @@ -982,6 +988,12 @@ Permissions you've already given to websites and apps may apply to this account. Any Brave data that is generated during the use of this profile (such as the creation of bookmarks, history, passwords, and other settings) can be removed by the work profile administrator. $1Learn more + + Your organization requires you to sign into Brave + + + Your organization, $1manager.com, requires you to sign into Brave + You're signed in to Brave! @@ -1086,6 +1098,9 @@ Permissions you've already given to websites and apps may apply to this account. You're already signed in as $1foo@gmail.com in another Brave profile + + To stay safer online with your parent’s choices, switch to your Brave profile where you’re already signed in as $1foo@gmail.com + $1Elisa is already signed in to this Brave profile. To keep your browsing separate, Brave can create your own profile for you. @@ -1101,9 +1116,6 @@ Permissions you've already given to websites and apps may apply to this account. To get your passwords and more on all your devices, sign in to Brave - - Sign in to Brave so that your parents can help you stay safe on the web - While you're signed in, you can use your passwords and more from your Brave sync chain in Brave. You can change this at any time in settings. @@ -1113,7 +1125,7 @@ Permissions you've already given to websites and apps may apply to this account. Sign out of Brave? - + Your passwords and other Brave data are saved in your Brave sync chain, and will be removed from this device. To use them in the future, sign back in to Brave. @@ -1125,6 +1137,12 @@ Permissions you've already given to websites and apps may apply to this account. You’ll be signed out of most sites when you close all Brave windows, except your Brave sync chain if you’re signed in to Brave. To let sites remember you, $1go to settings. + + clear the Brave data in your account + + + Your data is encrypted with your passphrase. Enter it to use and save Brave data in your Brave account. + Click to close the Brave sign-in dialog @@ -1451,6 +1469,9 @@ Permissions you've already given to websites and apps may apply to this account. To use and save Brave data in your Brave sync chain, enter your passphrase + + To use and save Brave data in your Brave sync chain, update Brave + @@ -1570,6 +1591,210 @@ Permissions you've already given to websites and apps may apply to this account. + + + + + You can pin Image Search for easy access + + + You can pin Image Search for easy access; click the Pin button at the top of the side panel + + + Pinned! Use Image Search again from the toolbar + + + Pinned! You can access Image Search again from the new button on the toolbar + + + + + Image Search Search Bubble + + + + + Copy + + + Text copied + + + Image copied + + + More options + + + My Activity + + + Dismiss + + + Translate + + + Select text + + + Copy as image + + + Save as image + + + Learn more + + + Select anything to search with Image Search or press escape to exit Image Search + + + Select anything to search with Image Search + + + Select text with Image Search + + + Image Search is not available. Try again later. + + + Exit + + + Drag to search + + + Select text to search + + + Click to search + + + Click to exit Image Search + + + Auto-detect + + + Translate screen + + + Translate from + + + Translate to + + + Recent languages + + + All languages + + + Detected + + + Detect language + + + Send feedback + + + Send feedback for search with Lens + + + Image Search + + + Close translate screen + + + Language picker + + + Original language: English$1 + + + Translated language: English$1 + + + + + New! You can translate both text and images on your screen + + + New! You can translate both text and images on your screen by selecting the "translate screen" button + + + + + Search anything on this page + + + Search any image or text with Lens + + + Select images/text to search with Lens + + + Image Search + + + Open Image Search + + + Try Image Search + + + Search with Image Search + + + Image Search + + + Search with Image Search + + + + + Cancel + + + OK + + + When you use Image Search, the page title, URL, and content, including PDFs, are sent to the server. $1Learn more + + + Identify things or places and copy or translate text. When you use Image Search, a screenshot of the page is sent to the server. $1Learn more + + + Learn more + + + Search anything on this page + + + + + + Always Show Image Search Shortcut + + + Search with Image Search + + + + + Search with Image Search + + + Always show Image Search shortcut + + + + @@ -1717,12 +1942,6 @@ Permissions you've already given to websites and apps may apply to this account. While we're setting up account access, you can still use Brave. You may not be able to access some resources until setup is complete. - - - - The Brave settings your parent chose in Family Link can help keep you safe online - - @@ -2121,7 +2340,19 @@ Permissions you've already given to websites and apps may apply to this account. Failed to run setup with elevated privileges. $1error-internal + + + + Brave Updater Service + + + Brave Updater Internal Service + + + Keeps your Brave software up to date. If this service is disabled or stopped, your Brave software will not be kept up to date, meaning security vulnerabilities that may arise cannot be fixed and features may not work. This service uninstalls itself when there is no Brave software using it. + + @@ -2181,6 +2412,13 @@ Permissions you've already given to websites and apps may apply to this account. Brave Shortcut + + + + + Cleared Brave data + + Google Chrome Beta diff --git a/app/brave_strings_override.grd b/app/brave_strings_override.grd index 66b39c0993e4..ca1adf49467b 100644 --- a/app/brave_strings_override.grd +++ b/app/brave_strings_override.grd @@ -356,6 +356,13 @@ Permissions you've already given to websites and apps may apply to this account. + + + + + + + @@ -409,6 +416,7 @@ Permissions you've already given to websites and apps may apply to this account. + @@ -426,6 +434,9 @@ Permissions you've already given to websites and apps may apply to this account. + + + diff --git a/app/certificate_manager.grdp b/app/certificate_manager.grdp index ca4e3b79cedc..5f17502ed4fd 100644 --- a/app/certificate_manager.grdp +++ b/app/certificate_manager.grdp @@ -100,6 +100,18 @@ Export all $1Trusted Certificates + + Import + + + Import to $1Trusted Certificates + + + Import and Bind + + + Import and Bind to $1Trusted Certificates + {COUNT, plural, =0 {No certificates} @@ -137,6 +149,46 @@ From extensions + + Delete "$1VeriSign Browser Certificate"? + + + + If you delete one of your own certificates, you can no longer use it to identify yourself. + + + + Error reading file + + + Error deleting certificate + + + Unable to delete certificate + + + Enter certificate password + + + Error importing certificate + + + + Unable to import certificate + + + Incorrect password + + + Incorrect password or corrupt file + + + Invalid or corrupt file + + + File uses unsupported features + + @@ -150,6 +202,9 @@ View certificate details for $1GTS Root R2 in a new dialog + + Delete certificate $1GTS Root R2 + Copy certificate hash for $1GTS Root R2 diff --git a/app/feature_defaults_unittest.cc b/app/feature_defaults_unittest.cc index b97213fdbb2c..e689ad2b5a10 100644 --- a/app/feature_defaults_unittest.cc +++ b/app/feature_defaults_unittest.cc @@ -10,10 +10,10 @@ #include "base/logging.h" #include "chrome/browser/browser_features.h" #include "chrome/browser/companion/core/features.h" +#include "chrome/browser/devtools/features.h" #include "chrome/browser/preloading/preloading_features.h" #include "chrome/browser/ui/ui_features.h" #include "chrome/common/chrome_features.h" -#include "chrome/common/companion/visual_query/features.h" #include "chrome/common/privacy_budget/privacy_budget_features.h" #include "components/aggregation_service/features.h" #include "components/attribution_reporting/features.h" @@ -94,7 +94,6 @@ TEST(FeatureDefaultsTest, DisabledFeatures) { &blink::features::kBackgroundResourceFetch, &blink::features::kBiddingAndScoringDebugReportingAPI, &blink::features::kBrowsingTopics, - &blink::features::kClientHintsFormFactors, &blink::features::kControlledFrame, &blink::features::kCssSelectorFragmentAnchor, &blink::features::kFencedFrames, @@ -123,7 +122,6 @@ TEST(FeatureDefaultsTest, DisabledFeatures) { &commerce::kShoppingList, &commerce::kShoppingPDPMetrics, &commerce::kRetailCoupons, - &companion::visual_query::features::kVisualQuerySuggestions, &compose::features::kEnableCompose, &content_settings::features::kTrackingProtection3pcd, &content_settings::features::kUserBypassUI, @@ -141,7 +139,9 @@ TEST(FeatureDefaultsTest, DisabledFeatures) { &features::kChromeLabs, &features::kChromeStructuredMetrics, &features::kCookieDeprecationFacilitatedTesting, +#if !BUILDFLAG(IS_ANDROID) &features::kDevToolsConsoleInsights, +#endif // !BUILDFLAG(IS_ANDROID) &features::kDigitalGoodsApi, &features::kDIPS, &features::kFedCm, @@ -223,10 +223,7 @@ TEST(FeatureDefaultsTest, DisabledFeatures) { &ntp_features::kNtpChromeCartModule, &omnibox::kDocumentProviderNoSetting, &omnibox::kDocumentProviderNoSyncRequirement, - &omnibox::kExpandedStateHeight, - &omnibox::kExpandedStateShape, &omnibox::kMlUrlScoring, - &omnibox::kOmniboxSteadyStateHeight, &omnibox::kRichAutocompletion, &omnibox::kStarterPackExpansion, &omnibox::kZeroSuggestPrefetching, @@ -251,7 +248,6 @@ TEST(FeatureDefaultsTest, DisabledFeatures) { &privacy_sandbox::kEnforcePrivacySandboxAttestations, &privacy_sandbox::kOverridePrivacySandboxSettingsLocalTesting, &privacy_sandbox::kPrivacySandboxFirstPartySetsUI, - &privacy_sandbox::kPrivacySandboxProactiveTopicsBlocking, &privacy_sandbox::kPrivacySandboxSettings4, &privacy_sandbox::kTrackingProtectionContentSettingUbControl, &safe_browsing::kExtensionTelemetryDisableOffstoreExtensions, diff --git a/app/generated_resources.grd b/app/generated_resources.grd index 45abdcb27a19..0d2eeef88709 100644 --- a/app/generated_resources.grd +++ b/app/generated_resources.grd @@ -845,12 +845,6 @@ are declared in tools/grit/grit_rule.gni. Translate text in image with $1Brave - - Search with Google Lens - - - Google Lens - Search page with $1Google Lens @@ -863,6 +857,9 @@ are declared in tools/grit/grit_rule.gni. Suggest password... + + Use passkey from another device + More @@ -885,6 +882,9 @@ are declared in tools/grit/grit_rule.gni. Payment methods + + Passwords and passkeys + Select password @@ -1185,12 +1185,6 @@ are declared in tools/grit/grit_rule.gni. Search Image with $1Google Lens - - Search with Google Lens - - - Google Lens - Translate Text in Image with $1Brave @@ -1206,6 +1200,9 @@ are declared in tools/grit/grit_rule.gni. Suggest Password... + + Use Passkey from Another Device + Help Improve Autofill @@ -1222,6 +1219,9 @@ are declared in tools/grit/grit_rule.gni. Payment Methods + + Passwords and Passkeys + Select Password @@ -1795,9 +1795,6 @@ are declared in tools/grit/grit_rule.gni. Performance - - Search with Google Lens - Sear&ch this page with Brave... @@ -1854,9 +1851,6 @@ are declared in tools/grit/grit_rule.gni. Performance - - Search with Google Lens - Sear&ch This Page with Brave... @@ -3735,13 +3729,16 @@ are declared in tools/grit/grit_rule.gni. You usually block notifications. To let this site notify you, click here. - + Most profiles block notifications from this site - + + Most profiles block sharing precise location for this site + + This site may be trying to trick you into allowing intrusive notifications - + Notifications from this site may be disruptive @@ -3750,7 +3747,7 @@ are declared in tools/grit/grit_rule.gni. Location blocked - + Location blocked @@ -6238,9 +6235,12 @@ Keep your key file in a safe place. You will need it to create new versions of y These extensions don't need to see and change information on this site. - + Allow extensions on $1google.com + + Extensions are not allowed on $1google.com + Extensions allowed on this site @@ -6647,9 +6647,6 @@ Keep your key file in a safe place. You will need it to create new versions of y Downloading - - Downloaded - Updating diff @@ -6668,33 +6665,6 @@ Keep your key file in a safe place. You will need it to create new versions of y Unknown - - Updater started - - - Updater sleeping - - - Update found - - - Update ready - - - Component updated - - - Component already up to date - - - Update error - - - Component downloading - - - Component updating - Sign in as @@ -6808,9 +6778,6 @@ Keep your key file in a safe place. You will need it to create new versions of y Passwords are saved to $1Brave Password Manager on this device. - - You can view and manage saved passwords in $1Brave Password Manager. - You won't need to remember this password. It will be saved to $1Brave Password Manager for $2user@gmail.com. @@ -7359,16 +7326,6 @@ Keep your key file in a safe place. You will need it to create new versions of y Always show full URLs - - - Always Show Google Lens Shortcut - - - - - Always show Google Lens shortcut - - @@ -7380,6 +7337,15 @@ Keep your key file in a safe place. You will need it to create new versions of y Add to your search + + Ask about this page + + + Generating questions about this page… + + + You can also ask things like “summarize” + Your Google Lens selection. Press enter or backspace to delete your Google Lens selection @@ -8199,6 +8165,9 @@ Keep your key file in a safe place. You will need it to create new versions of y To rearrange buttons on the toolbar, drag them + + Toolbar buttons were reset + Navigation @@ -8304,6 +8273,10 @@ Keep your key file in a safe place. You will need it to create new versions of y Drive files + + + SharePoint files + Files @@ -8316,6 +8289,10 @@ Keep your key file in a safe place. You will need it to create new versions of y From your Google Drive + + + From your Microsoft Sharepoint + From your Drive @@ -8325,6 +8302,13 @@ Keep your key file in a safe place. You will need it to create new versions of y <br> You can manage settings from the card menu or see more options in Customize Brave. + + + You’re seeing suggested files to help you easily get back to your most recent activity in Microsoft Sharepoint. + <br> + <br> + You can manage settings from the card menu or see more options in Customize Brave. + Hide for $15 hours @@ -8485,6 +8469,14 @@ Keep your key file in a safe place. You will need it to create new versions of y See more + + + Get Brave on your mobile device + + + Download Brave for iOS to access your tabs, bookmarks and passwords on your phone. + + Web browsing should be fast. Take a moment to <a href="chrome://extensions">check your extensions</a> now. @@ -8678,9 +8670,6 @@ Keep your key file in a safe place. You will need it to create new versions of y Customize Brave - - Search with Google Lens - Unpin @@ -8708,35 +8697,35 @@ Keep your key file in a safe place. You will need it to create new versions of y To easily get back to the side panel, click Pin at the top right - - You can pin Google Lens for easy access - - - You can pin Google Lens for easy access; click the Pin button at the top of the side panel - - - Pinned! Use Google Lens again from the toolbar - - - Pinned! You can access Google Lens again from the new button on the toolbar - More info - - + Save to a folder in your Brave sync chain? - - - This bookmark is saved only on this device. You can save it in your Brave sync chain. + + This bookmark is saved only to this device. If you save it to $1Account Bookmarks, this bookmark will also be saved in your account. + + + This folder is saved only to this device. If you save it to $1Account Bookmarks, this folder will also be saved in your account. - - + Save in account + + Save to a folder only on this device? + + + $1Local Bookmarks is saved only to this device. If you move this bookmark to $1Local Bookmarks, you’ll no longer get it on your other devices. + + + $1Local Bookmarks is saved only to this device. If you move this folder to $1Local Bookmarks, you’ll no longer get it on your other devices. + + + Save to device + Sort by $1Newest @@ -9083,6 +9072,9 @@ Keep your key file in a safe place. You will need it to create new versions of y Voice selection + + System text-to-speech voice + Selected. @@ -9122,12 +9114,24 @@ Keep your key file in a safe place. You will need it to create new versions of y No internet + + Can't use Read Aloud right now. + + + There are no $1English voices on your device. Connect to the internet, and try again. + Download failed To install this language, clear space on your device + + To use Read Aloud, clear space on your device + + + There are no $1English voices on your device. Clear space on your device, and try again. + preview voice for $1English @@ -9343,6 +9347,27 @@ Keep your key file in a safe place. You will need it to create new versions of y + + {NUM_TABS, plural, + =0 {No unused tabs} + =1 {Close 1 unused tab} + other {Close # unused tabs}} + + + Review and decide + + + Close unused tabs + + + These tabs have been unused for $17 or more days. + + + Your tabs are tidy! + + + No inactive tabs right now + Close unused tabs? @@ -9352,7 +9377,24 @@ Keep your key file in a safe place. You will need it to create new versions of y Close unused tabs - + + {NUM_DAYS, plural, + =0 {Visited 0 days ago} + =1 {Visited 1 day ago} + other {Visited # days ago}} + + + + + Close Unused Tabs + + + + + Close unused tabs + + + Organize tabs? @@ -9830,9 +9872,6 @@ Keep your key file in a safe place. You will need it to create new versions of y Find your reading list and bookmarks in Bookmarks and Lists - - Organize your tabs with tab groups - Unnamed group - $1"New Tab" and one other @@ -10068,6 +10107,32 @@ Keep your key file in a safe place. You will need it to create new versions of y Click “Install” + + + Search what’s on your screen with Google Lens + + + Learn more about products, places, or text you see on your screen + + + Click the address bar + + + Select the Google Lens button + + + Click and drag over images or highlight text to search + + + Add more details or ask a question about your selection to refine your search + + + Pin Google Lens to your toolbar for easy access next time + + + You can now use Google Lens to search anything you see on your screen + + @@ -11191,21 +11256,6 @@ Check your passwords anytime in $1Brave P Check for suggestions - - {NUM_TABS, plural, - =0 {No unused tabs} - =1 {Close 1 unused tab} - other {Close # unused tabs}} - - - Review and decide - - - Close unused tabs - - - These tabs have been unused for $17 or more days. - @@ -12877,8 +12927,8 @@ This can include information about installed software, files, your browser, and Stay Here - - Be Safe Online + + Be Safer Online @@ -12894,12 +12944,15 @@ This can include information about installed software, files, your browser, and Stay here - - Be safe online + + Be safer online + + To stay safer online with your parent’s choices, sign in as $1john@google.com + No thanks @@ -12909,6 +12962,9 @@ This can include information about installed software, files, your browser, and Ok + + To stay safer online with your parent’s choices, sign in to your own profile as $1john@gmail.com + Continue @@ -12956,6 +13012,13 @@ This can include information about installed software, files, your browser, and go to settings + + If you forgot your passphrase or want to change this setting, $1clear the data in your account. + + + Enter your passphrase + + Close Window @@ -13458,13 +13521,13 @@ Please help our engineers fix this problem. Tell us what happened right before y Choose another language - Page is not in $1French + Page not in $1French Open language settings - Selection is not in $1French + Selection not in $1French Translate @@ -13526,13 +13589,13 @@ Please help our engineers fix this problem. Tell us what happened right before y Choose Another Language... - Page Is Not in $1French + Page Not in $1French Open Language Settings - Selection Is Not in $1French + Selection Not in $1French Translate @@ -15790,9 +15853,6 @@ Please help our engineers fix this problem. Tell us what happened right before y Your phone - - Your phone with a USB cable - Windows Hello or external security key @@ -15884,9 +15944,6 @@ Please help our engineers fix this problem. Tell us what happened right before y Verify via your phone - - Verify via your phone with a USB cable - Check your phone @@ -15912,18 +15969,6 @@ Please help our engineers fix this problem. Tell us what happened right before y Close - - Didn't get it? - - - Connect your phone with a cable - - - Use a USB cable to connect your phone to your computer. If your phone is already connected, unplug it and plug it back in. - - - Security key request - Use a phone or tablet @@ -15940,9 +15985,6 @@ Please help our engineers fix this problem. Tell us what happened right before y Use a passkey from $1Ted's Pixel 6 Pro to sign in to $2accounts.google.com - - Unlock your phone and confirm it's you - PIN required @@ -16341,6 +16383,13 @@ Please help our engineers fix this problem. Tell us what happened right before y Brave Password Manager + + + + + Sign in to $1webauthn.io + + Bluetooth is disabled @@ -16912,136 +16961,6 @@ Please help our engineers fix this problem. Tell us what happened right before y Select an area to search with Lens - - Google Lens Search Bubble - - - Copy - - - Text copied - - - Image copied - - - More options - - - My Activity - - - Dismiss - - - Translate - - - Select text - - - Copy as image - - - Save as image - - - Learn more - - - Select anything to search with Google Lens or press escape to exit Google Lens - - - Select anything to search with Google Lens - - - Select text with Google Lens - - - Google Lens is not available. Try again later. - - - Exit - - - Drag to search - - - Select text to search - - - Click to search - - - Click to exit Google Lens - - - Search anything on this page - - - Search any image or text with Lens - - - Select images/text to search with Lens - - - Google Lens - - - Open Lens - - - Try Lens - - - Auto-detect - - - Translate screen - - - Translate from - - - Translate to - - - Recent languages - - - All languages - - - Detected - - - Detect language - - - Send feedback - - - Send feedback for search with Lens - - - Google Lens - - - - Cancel - - - OK - - - Identify things or places and copy or translate text. When you use Google Lens, a screenshot of the page is sent to Brave. $1Learn more - - - Learn more - - - New! An easy way to search what's on your screen - Thumbnail tab strip for tablet mode diff --git a/app/generated_resources_override.grd b/app/generated_resources_override.grd index abb84297c83b..67f509ca44d2 100644 --- a/app/generated_resources_override.grd +++ b/app/generated_resources_override.grd @@ -401,9 +401,12 @@ are declared in tools/grit/grit_rule.gni. - + Most profiles block notifications from this site + + Most profiles block sharing precise location for this site + @@ -608,10 +611,6 @@ are declared in tools/grit/grit_rule.gni. - - - - Customize your browser even more with extensions from the <a href="#" id="chromeWebstoreLink">Web Store</a> @@ -656,6 +655,12 @@ are declared in tools/grit/grit_rule.gni. + + + + + + diff --git a/app/os_settings_strings.grdp b/app/os_settings_strings.grdp index 575f01e6a700..fb40c7c4455b 100644 --- a/app/os_settings_strings.grdp +++ b/app/os_settings_strings.grdp @@ -1332,9 +1332,24 @@ Add action + + Remove action $1Click a mouse button + + + Assign a gesture + Add an action + + $1Pause or resume face control selected. Press Search plus Space to unselect. + + + $1Pause or resume face control not selected. Press Search plus Space to select. + + + Create key combination + Select a gesture for $1Click a mouse button @@ -1359,6 +1374,129 @@ Detection threshold + + Decrease threshold + + + Increase threshold + + + Gesture detection threshold + + + Pause or resume face control + + + Left-click the mouse + + + Double-click the mouse + + + Right-click the mouse + + + Drag and drop + + + Reset cursor to center + + + Start or stop dictation + + + Open overview of windows + + + Play or pause media + + + Scroll + + + Show or hide on-screen keyboard + + + Create custom key combination + + + Once you start scroll mode, move your head in the direction you'd like to scroll + + + Take a screenshot + + + $1ctrl + $2c + + + $1ctrl + $2alt + $3c + + + $1ctrl + $2alt + $3shift + $4c + + + $1ctrl + $2alt + $3shift + $4shift + $5c + + + shift + + + Raise eyebrows + + + Lower eyebrows + + + Squint left eye + + + Squint right eye + + + Blink both eyes + + + Look down + + + Look left + + + Look right + + + Look up + + + Shift jaw left + + + Open your mouth wide + + + Shift jaw right + + + Make a circle with your lips + + + Stretch left corner of your mouth + + + Pucker by squeezing lips together + + + Stretch right corner of your mouth + + + Smile + + + Wrinkle your nose + + + Cursor + Speed @@ -1413,6 +1551,21 @@ Reset + + Cursor settings reset + + + Cursor stability + + + You can keep the cursor stable even if you have slight head movements. This requires more effort to move the cursor. + + + Responsive + + + Stable + Flash notifications @@ -1539,6 +1692,9 @@ Limit movement on the screen + + Always show scrollbars + Text cursor blink rate @@ -1750,9 +1906,15 @@ Always + + Built-in touchpad is disabled + When a mouse is connected + + Press esc 5 times to re-enable it + Never @@ -3474,6 +3636,17 @@ Press an assigned switch or key to remove assignment. Set up button + + + Content Transfer + + + Content Transfer tool + + + Move your school account data to your personal account + + Audio @@ -3583,6 +3756,12 @@ Press an assigned switch or key to remove assignment. Device sounds + + Spatial Audio + + + Enable supported content to sound more immersive + @@ -4705,15 +4884,6 @@ Press an assigned switch or key to remove assignment. Show network address settings - - Forget this subscription? - - - By forgetting this network you will also remove the Passpoint subscription and its associated networks. - - - Your Passpoint provider will be removed from this device only. To make changes to your subscription, contact the subscription provider. - Remove this network in Passpoint subscription page? @@ -4948,9 +5118,6 @@ Press an assigned switch or key to remove assignment. Cancel forgetting subscription - - Confirm subscription removal - @@ -5410,7 +5577,7 @@ Press an assigned switch or key to remove assignment. Password - Device password or Brave sync chain password + Set up a $1Chromebook password Currently using Brave sync chain password. You can set up a $1Chromebook password to make it easier to sign in. @@ -5449,7 +5616,7 @@ Press an assigned switch or key to remove assignment. Local data recovery - Local data can be restored if you forget your password + Local data can be restored if you forget your PIN or password Disable local data recovery? @@ -7019,6 +7186,12 @@ Press & hold keyboard keys to see accent marks and special characters. This Secure connections might not always be available when using the network default. Consider selecting a different provider to ensure you're always using a secure connection. + + Make it harder for profiles with access to your internet traffic to see which sites you visit. $1ChromeOS uses a secure connection to look up a site's IP address in the DNS (Domain Name System). Secure connections are not used for some domains configured by your administrator. + + + Use a secure connection to look up a site’s IP address in the DNS (Domain Name System). This uses a managed service provider at $1https://dns.example.net/dns-query{?dns}. Secure connections are not used for some domains configured by your administrator. + System services diff --git a/app/os_settings_strings_override.grdp b/app/os_settings_strings_override.grdp index 27526450b596..7957e94c8963 100644 --- a/app/os_settings_strings_override.grdp +++ b/app/os_settings_strings_override.grdp @@ -26,5 +26,8 @@ Make it harder for profiles with access to your internet traffic to see which sites you visit. $1ChromeOS uses a secure connection to look up a site's IP address in the DNS (Domain Name System). + + Make it harder for profiles with access to your internet traffic to see which sites you visit. $1ChromeOS uses a secure connection to look up a site's IP address in the DNS (Domain Name System). Secure connections are not used for some domains configured by your administrator. + diff --git a/app/password_manager_ui_strings.grdp b/app/password_manager_ui_strings.grdp index c75746e98a15..11599913e652 100644 --- a/app/password_manager_ui_strings.grdp +++ b/app/password_manager_ui_strings.grdp @@ -4,6 +4,9 @@ Password Manager + + Keep track of your passwords and manage them in one place. + Search passwords @@ -487,10 +490,10 @@ - Use your screen lock when filling passwords + Use your fingerprint when filling passwords - If you share this device with others, you can use your screen lock to verify it's you whenever you use a saved password + If you share this device with others, you can use your fingerprint to verify it's you whenever you use a saved password @@ -946,6 +949,11 @@ To sign in with a passkey on this device again, you’ll need to verify it’s you. If you have another sign-in option, like a password, you can use it to sign in instead. + + + Continue + + Protect passwords with your screen lock @@ -953,11 +961,19 @@ If you share this device with others, you can use your screen lock to verify it's you whenever you use a saved password - - Continue - - + You're using your screen lock for filling passwords + + + Add more protection to your passwords + + + You can use your fingerprint to verify it's you whenever you use a saved password + + + You're using your fingerprint for filling passwords + + diff --git a/app/profiles_strings.grdp b/app/profiles_strings.grdp index 4dc9b55feb48..0cb43cd02fc6 100644 --- a/app/profiles_strings.grdp +++ b/app/profiles_strings.grdp @@ -136,6 +136,9 @@ Sign in to get your passwords and more on all your devices + + $1John$2Work + Other profiles @@ -167,6 +170,9 @@ Brave services settings + + Passwords and autofill + @@ -199,16 +205,16 @@ Brave Services Settings + + Passwords and Autofill + - managed by $11 + Managed by $11 Manage profiles - - Your administrator has disabled other profiles - Customize profile @@ -626,7 +632,10 @@ About this profile - This profile is managed by your organization, which can view certain kinds of information + This profile is managed by your organization, which can view certain kinds of information, including + + + This profile is managed by $1example.com, which can view certain kinds of information, including Profile information @@ -643,6 +652,9 @@ Setting up your work profile ... + + Setup may take a little longer ... + You're all set! @@ -659,7 +671,7 @@ You can try again or contact your administrator for help - Sign in to securely separate your work and personal browsing. Increase your productivity while protecting sensitive company data. + Sign in to get your bookmarks, passwords, and more on all your devices Keep existing browsing data separate from your work profile? @@ -678,11 +690,14 @@ - - + Welcome $1Charlie + + Your parent's choices will now keep you safer online + + Add @@ -798,115 +813,74 @@ Switch - - - - Your device is managed by $1example.com. Administrators can access the data in any profile on this device. - - - Your device is managed by your organization. Administrators can access the data in any profile on this device. - - - This will permanently delete your browsing data from this device. - - - Delete this profile? - - - This will permanently delete your browsing data from this device. To recover the data, turn on sync as - - Sign in to get your passwords and more on all your devices - - - - - - Your session is managed by $1example.com. Administrators can delete your profile and also monitor your network traffic. - - - Your session is managed by your organization. Administrators can delete your profile and also monitor your network traffic. - - - Choose an account - - - Use another account - - - Choose a profile - - - Can't delete this profile - - - $1Jane.Doe@gmail.com is the default account on your $2Chromebook - - - Got it - - - Delete this profile and browsing data? - - - This will permanently delete browsing data and saved desks associated with this profile from this device. The Brave sync chains in this profile may be used by other apps on your $1Chromebook. You can remove these accounts in <a is="action-link" target="_blank">$2Settings > $3Accounts</a>. - - - Let's go - - + + Your device is managed by $1example.com. Administrators can access the data in any profile on this device. + + + Your device is managed by your organization. Administrators can access the data in any profile on this device. + + + This will permanently delete your browsing data from this device. + + + Delete this profile? + + + This will permanently delete your browsing data from this device. To recover the data, turn on sync as + + Sign in to get your passwords and more on all your devices + - - - Get additional features - - - Sign in for additional features - - - All your devices - - - Easily pick up where you left off - - - Stronger security - - - Protect your passwords against phishing - - - Back up data - - - Save your bookmarks, passwords and more with sync + + Get additional features + + + Sign in for additional features + + + All your devices + + + Easily pick up where you left off + + + Stronger security + + + Protect your passwords against phishing + + + Back up data + + + Save your bookmarks, passwords and more with sync + + + Save your bookmarks and more with sync + + + + Don't sign in - - Save your bookmarks and more with sync + + Sign in - - - Don't sign in - - - Sign in - - - - - Don't Sign In - - - Sign In - - - - Your device is managed by your organization. Administrators can access the data in any profile on this device. + + + + Don't Sign In - - Your device is managed by $1example.com. Administrators can access the data in any profile on this device. + + Sign In + + Your device is managed by your organization. Administrators can access the data in any profile on this device. + + + Your device is managed by $1example.com. Administrators can access the data in any profile on this device. + @@ -923,22 +897,44 @@ - - - Save data to account + + Save items in account - - - N items are saved only to this device. To use them on your other devices, save them in your Brave sync chain. + + {ITEM_COUNT, plural, + =1 {1 item is saved only to this device. To use it on your other devices, save it in your Brave sync chain} + other {{ITEM_COUNT} items are saved only to this device. To use them on your other devices, save them in your Brave sync chain} + } + + + {PASSWORD_COUNT, plural, + =1 {1 password is saved only to this device. To use it on your other devices, save it in your Brave sync chain} + other {{PASSWORD_COUNT} passwords are saved only to this device. To use them on your other devices, save them in your Brave sync chain} + } + + + {PASSWORD_COUNT, plural, + =1 {1 password and other items are saved only to this device. To use it on your other devices, save it in your Brave sync chain} + other {{PASSWORD_COUNT} passwords and other items are saved only to this device. To use them on your other devices, save them in your Brave sync chain} + } - - Passwords + + {SELECTED_ITEMS, plural, + =0 {Passwords} + other {Passwords ({SELECTED_ITEMS})} + } - - Addresses + + {SELECTED_ITEMS, plural, + =0 {Addresses} + other {Addresses ({SELECTED_ITEMS})} + } - + Save in account + + Saving in your account... + diff --git a/app/profiles_strings_override.grdp b/app/profiles_strings_override.grdp index 3f76164abe24..35d2e49a647b 100644 --- a/app/profiles_strings_override.grdp +++ b/app/profiles_strings_override.grdp @@ -61,18 +61,9 @@ Private - - - - + - - - - - - + - diff --git a/app/settings_brave_strings.grdp b/app/settings_brave_strings.grdp index beca16bdd121..f3035909e92c 100644 --- a/app/settings_brave_strings.grdp +++ b/app/settings_brave_strings.grdp @@ -87,6 +87,18 @@ If so, please edit your saved password in Brave so it matches your new password. + + + + Brave will ask if you want to save form information, such as your birthday, age, and passport number + + + Later, Brave will ask if you want to use saved info to automatically fill forms + + + Brave can understand more types of information and autofill your forms faster. Learn more about <a target="_blank" href="$1">Brave Autofill</a></a> + + @@ -368,7 +380,7 @@ - This language is used to display the Brave UI + This language is used to display menus, settings, alerts, and other text in Brave Display Brave in this language diff --git a/app/settings_strings.grdp b/app/settings_strings.grdp index f6a2627ce51f..90ea09c65467 100644 --- a/app/settings_strings.grdp +++ b/app/settings_strings.grdp @@ -26,6 +26,9 @@ Things to consider + + When used + @@ -625,41 +628,41 @@ =1 {1 reused password} other {{NUM_REUSED} reused passwords}} - - Autofill prediction improvements - - - Brave can adapt to a form's format — for example, automatically filling your birthday as MM/DD/YYYY or DD/MM/YY. Learn more about <a target="_blank" href="$1">Brave Autofill</a></a> + + Autofill with AI - - Brave asks if you want to use saved info to fill forms + + This feature uses AI, is in early development, and won’t always get it right - - TODO: Describe how autofill adapts to user preferences + + When you fill a form, your info and the page it comes from are sent to Brave to generate suggestions - - Your info is saved on your device and isn't shared with others + + Your saved information is stored on your device - - TODO: Describe how data is used + + Data may be seen by human reviewers to improve this feature - + Saved information - - Delete annotation entry + + Saved information will appear here + + + Delete data - - The following entry will be deleted: $1Date of birth / $215/02/1989 + + $1Date of birth: $215/02/1989 - + Delete all - - Delete all entries + + Delete all data used by autofill with AI - - All the annotation entries will be deleted. This action cannot be undone + + All data will be deleted. This action cannot be undone @@ -1453,6 +1456,12 @@ + + Helps you write short-form content for things on the web, like reviews. Suggested content is based on your prompts and the content of the web page. To use this feature, right-click on a text box. + + + Helps you write short-form text for things on the web, like reviews + Offer writing help @@ -1468,12 +1477,24 @@ Never offer writing help on these sites + + Not allowed to offer writing help + No sites added Remove $1https://www.google.com from disabled sites + + Learn more about Help me write + + + Helps you write short-form text for things on the web, like reviews. Writing suggestions are based on your prompts and the content of the web page + + + When you get writing help, the page’s URL, content, and your text are sent to Brave. Don’t enter personal info (like medical or financial details) + @@ -1554,27 +1575,12 @@ - - You can block topics you don’t want shared with sites. Brave also auto-deletes your topics older than 4 weeks. - - - Learn more about ad topics - - - Learn more - List of topics estimated by Brave based on your recent browsing history List of topics you blocked that you don't want shared with sites - - Brave auto-deletes topics that are older than 4 weeks. As you keep browsing, a topic might reappear on the list. Or you can block topics you don’t want Brave to share with sites. Learn more about <a href="$1" target="_blank">managing your ad privacy in Brave.</a> - - - As you browse, whether an ad you see is personalized depends on this setting, <a href="$1" target="_blank">Site-suggested ads</a>, your <a href="$2" target="_blank">cookie settings</a>, and if the site you’re viewing personalizes ads - Whether an ad you see is personalized can depend on many things including this setting, <a href="$1" target="_blank">site-suggested ads</a>, your <a href="$2" target="_blank">cookie settings</a>, and if the site you're viewing personalizes ads. Learn more about <a href="$3" target="_blank">managing your ad privacy</a>. @@ -1633,9 +1639,6 @@ Add $1example.com - - As you browse, whether an ad you see is personalized depends on this setting, <a href="$1" target="_blank">Ad topics</a>, your <a href="$2" target="_blank">cookie settings</a>, and if the site you're viewing personalizes ads - More about site-suggested ads @@ -2095,6 +2098,9 @@ Real-time, proactive protection against dangerous sites, downloads, and extensions that's based on your browsing data getting sent to Brave + + Real-time, AI-powered protection against dangerous sites, downloads, and extensions that's based on your browsing data getting sent to Brave + Show enhanced protection details @@ -2837,6 +2843,12 @@ Isolated Web Apps cannot control smart card readers. Apps won't gain access to any smart card. + + No smart card readers found. + + + Reset all smart card reader permissions? + Sites usually show images to provide illustration, like photos for online stores or news articles @@ -3863,12 +3875,12 @@ Because this account is managed by $1example.com you will not be signed out of your Brave sync chain. Your bookmarks, history, passwords, and other settings will no longer be synced. However, your previously synced data will remain stored in your Brave sync chain and can be managed on <a href="$2" target="_blank"><a href="$2" target="_blank">Brave Dashboard</a></a>. - - Turn off sync? - Turn off sync and personalization? + + Turn off sync and personalization? + Delete and continue @@ -3906,12 +3918,12 @@ Changes to your bookmarks, history, passwords, and other settings will no longer be synced to your Brave sync chain. However, your existing data will remain stored in your Brave sync chain and can be managed on <a href="$1" target="_blank"><a href="$1" target="_blank">Brave Dashboard</a></a>. - - Your bookmarks, history, passwords, and more will no longer be synced. - This will sign you out of your Brave sync chains. Your bookmarks, history, passwords, and more will no longer be synced. + + This will sign you out of your Brave sync chains. Your parent's choices won't be able to keep you safer online. Your bookmarks, history, passwords, and more will no longer be synced. + Show profile stats @@ -4053,6 +4065,9 @@ Use everyday language to search your browsing history and find sites you visited. Only sites you visit after turning on this feature are shown in AI-powered history search results. + + Use everyday language to search your browsing history and find sites you visited + You can search your browsing history based on general page content, not only page title and URL. This gives you improved results, whether you're searching browsing history in the address bar using @history or from the History page. @@ -4065,6 +4080,39 @@ Learn more about history searches + + Use everyday language to search your browsing history. You can also ask questions and get answers based on your browsing history. + + + Answers and search results are based on the content of a page. This gives you improved results, whether you're searching browsing history in the address bar using “@history” or from the History page. + + + Only sites you visit after turning on this feature are shown in AI-powered history search results. + + + When you search browsing history, your history searches, the page content of best matches, and generated model outputs are sent to Brave and may be seen by human reviewers to improve this feature. + + + As you browse sites, their page contents are encrypted and saved to your device. AI-powered history search results and answers may become outdated if site content has changed since your last visit. This feature may also affect Brave’s performance. + + + You can search your browsing history based on general page content, not only page title and URL, and see improved results + + + You can search in the address bar using @history, as well as from the History page + + + When you search browsing history, your history search terms, page content of best matches, and generated model outputs are sent to Brave + + + As you browse sites, their page contents are encrypted and saved to your device + + + On • Use everyday language to search your browsing history and find sites you visited + + + Off • Use everyday language to search your browsing history and find sites you visited + @@ -4613,28 +4661,79 @@ Experimental AI + + AI innovations + Try out experimental AI features These features use AI, are in early development, and won’t always get it right. - - Help me write + + Reimagine Brave, supercharged with AI - - Helps you write short-form content for things on the web, like reviews. Suggested content is based on your prompts and the content of the web page. To use this feature, right-click on a text box. + + These features use AI, are in early development, and won’t always get it right + + + When you use these features, relevant data is sent to Brave in order to create AI experiences + + + Data sent to Brave may be seen by human reviewers to improve Brave AI’s technology + + + This feature uses AI, is in early development, and won’t always get it right + + Data sent to Brave may be seen by human reviewers to improve this feature + + + Tab organizer Automatically creates tab groups based on your open tabs. To use this feature, right-click on a tab and click Organize similar tabs. + + Automatically creates tab groups based on your open tabs + + + Learn more about tab organizer + + + Automatically suggests and creates groups from your open tabs, making it easier to find what you're looking for + + + When you use organize tabs, the titles and URLs of your open tabs are sent to Brave to generate suggested tab groups + + + Create themes with AI Creates custom themes based on the subject, mood, visual style, and color that you choose. To use this feature, open a new tab and click Customize Brave. + + Helps you design custom themes for Brave + + + + + Easily compare similar products + + + Learn more about comparing products + + + Helps you see similar products side-by-side and easily compare the details that matter to you + + + When you compare products, the tab titles and URLs of the products are sent to Brave + + + Comparison tables are saved in your Brave sync chain + diff --git a/app/support_tool_strings.grdp b/app/support_tool_strings.grdp index 7636c0cd14c8..b25c5268772f 100644 --- a/app/support_tool_strings.grdp +++ b/app/support_tool_strings.grdp @@ -127,12 +127,6 @@ Touch Events - - Lacros System Information - - - Lacros - ChromeOS Flex Logs diff --git a/base/android/java/src/org/chromium/base/shared_preferences/BraveStrictPreferenceKeyChecker.java b/base/android/java/src/org/chromium/base/shared_preferences/BraveStrictPreferenceKeyChecker.java index 44ed2320506d..1d39a04f9332 100644 --- a/base/android/java/src/org/chromium/base/shared_preferences/BraveStrictPreferenceKeyChecker.java +++ b/base/android/java/src/org/chromium/base/shared_preferences/BraveStrictPreferenceKeyChecker.java @@ -23,7 +23,7 @@ public void checkIsKeyInUse(String key) { } } - /* + /** * Dummy method that will be deleted form the bytecode. {@link * StrictPreferenceKeyChecker#isKeyInUse} will be used instead. */ diff --git a/browser/ai_chat/ai_chat_profile_browsertest.cc b/browser/ai_chat/ai_chat_profile_browsertest.cc index cdc6e9f3f457..c5e0317859b2 100644 --- a/browser/ai_chat/ai_chat_profile_browsertest.cc +++ b/browser/ai_chat/ai_chat_profile_browsertest.cc @@ -11,6 +11,7 @@ #include "brave/components/sidebar/browser/sidebar_item.h" #include "chrome/browser/profiles/profile_window.h" #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_util.h" +#include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/location_bar/location_bar.h" #include "chrome/browser/ui/tabs/public/tab_features.h" #include "chrome/browser/ui/views/side_panel/side_panel_registry.h" diff --git a/browser/android/BUILD.gn b/browser/android/BUILD.gn index 8e8323be02bd..1e2fc25de80c 100644 --- a/browser/android/BUILD.gn +++ b/browser/android/BUILD.gn @@ -35,6 +35,7 @@ source_set("android_browser_process") { "//chrome/android:jni_headers", "//chrome/browser:browser_process", "//chrome/browser:browser_public_dependencies", + "//chrome/browser/content_settings:content_settings_factory", "//chrome/browser/profiles:profile", "//chrome/browser/sync", "//chrome/common", diff --git a/browser/android/preferences/BUILD.gn b/browser/android/preferences/BUILD.gn index 713dd021c557..8c2e03b5987a 100644 --- a/browser/android/preferences/BUILD.gn +++ b/browser/android/preferences/BUILD.gn @@ -22,6 +22,7 @@ source_set("preferences") { "//brave/components/constants", "//chrome/browser:browser_process", "//chrome/browser:browser_public_dependencies", + "//chrome/browser/content_settings:content_settings_factory", "//chrome/browser/profiles:profile", "//chrome/common", "//components/content_settings/core/browser", diff --git a/browser/autoplay/BUILD.gn b/browser/autoplay/BUILD.gn index 0080b993e33b..847f2992a0a6 100644 --- a/browser/autoplay/BUILD.gn +++ b/browser/autoplay/BUILD.gn @@ -16,6 +16,7 @@ source_set("browser_tests") { "//brave/browser", "//brave/common", "//brave/components/constants", + "//chrome/browser/content_settings:content_settings_factory", "//chrome/common", "//chrome/test:test_support", "//chrome/test:test_support_ui", diff --git a/browser/brave_ads/ads_service_factory.cc b/browser/brave_ads/ads_service_factory.cc index c4437c71a7d4..7204fb194959 100644 --- a/browser/brave_ads/ads_service_factory.cc +++ b/browser/brave_ads/ads_service_factory.cc @@ -75,7 +75,8 @@ AdsServiceFactory::BuildServiceInstanceForBrowserContext( auto* brave_adaptive_captcha_service = brave_adaptive_captcha::BraveAdaptiveCaptchaServiceFactory::GetInstance() ->GetForProfile(profile); - auto* display_service = NotificationDisplayService::GetForProfile(profile); + auto* display_service = + NotificationDisplayServiceFactory::GetForProfile(profile); auto* delegate = new AdsServiceDelegate( profile, brave_adaptive_captcha_service, display_service, std::make_unique(*profile)); diff --git a/browser/brave_ads/android/java/org/chromium/chrome/browser/onboarding/BraveAdsOnboardingFragment.java b/browser/brave_ads/android/java/org/chromium/chrome/browser/onboarding/BraveAdsOnboardingFragment.java index e20becd5a178..f5904401856b 100644 --- a/browser/brave_ads/android/java/org/chromium/chrome/browser/onboarding/BraveAdsOnboardingFragment.java +++ b/browser/brave_ads/android/java/org/chromium/chrome/browser/onboarding/BraveAdsOnboardingFragment.java @@ -139,30 +139,34 @@ private void startCountdown() { progress = 0; - countDownTimer = new CountDownTimer(endTime * 1000, 100) { - @Override - public void onTick(long millisUntilFinished) { - setProgress(progress, endTime); - progress = progress + 100; - tvTimer.setText(String.valueOf((millisUntilFinished / 1000) + 1)); - } - - @Override - public void onFinish() { - setProgress(progress, endTime); - tvTimer.setText("0"); + countDownTimer = + new CountDownTimer((long) endTime * 1000, 100) { + @Override + public void onTick(long millisUntilFinished) { + setProgress(progress, endTime); + progress = progress + 100; + tvTimer.setText(String.valueOf((millisUntilFinished / 1000) + 1)); + } - OnboardingPrefManager.getInstance().onboardingNotification(); - new Handler().postDelayed(new Runnable() { @Override - public void run() { - assert onViewPagerAction != null; - if (onViewPagerAction != null) - onViewPagerAction.onNext(); + public void onFinish() { + setProgress(progress, endTime); + tvTimer.setText("0"); + + OnboardingPrefManager.getInstance().onboardingNotification(); + new Handler() + .postDelayed( + new Runnable() { + @Override + public void run() { + assert onViewPagerAction != null; + if (onViewPagerAction != null) + onViewPagerAction.onNext(); + } + }, + 1000); } - }, 1000); - } - }; + }; countDownTimer.start(); } diff --git a/browser/brave_content_browser_client.cc b/browser/brave_content_browser_client.cc index a37795802975..32dddb9f7b56 100644 --- a/browser/brave_content_browser_client.cc +++ b/browser/brave_content_browser_client.cc @@ -868,12 +868,13 @@ bool BraveContentBrowserClient::HandleExternalProtocol( bool has_user_gesture, const std::optional& initiating_origin, content::RenderFrameHost* initiator_document, + const net::IsolationInfo& isolation_info, mojo::PendingRemote* out_factory) { return ChromeContentBrowserClient::HandleExternalProtocol( url, web_contents_getter, frame_tree_node_id, navigation_data, is_primary_main_frame, is_in_fenced_frame_tree, sandbox_flags, page_transition, has_user_gesture, initiating_origin, initiator_document, - out_factory); + isolation_info, out_factory); } void BraveContentBrowserClient::AppendExtraCommandLineSwitches( diff --git a/browser/brave_content_browser_client.h b/browser/brave_content_browser_client.h index e362e679c18d..77165d5969e1 100644 --- a/browser/brave_content_browser_client.h +++ b/browser/brave_content_browser_client.h @@ -66,6 +66,7 @@ class BraveContentBrowserClient : public ChromeContentBrowserClient { bool has_user_gesture, const std::optional& initiating_origin, content::RenderFrameHost* initiator_document, + const net::IsolationInfo& isolation_info, mojo::PendingRemote* out_factory) override; diff --git a/browser/brave_drm_tab_helper.cc b/browser/brave_drm_tab_helper.cc index 6e0f80db04e5..91d3b99a2a67 100644 --- a/browser/brave_drm_tab_helper.cc +++ b/browser/brave_drm_tab_helper.cc @@ -16,6 +16,7 @@ #include "chrome/browser/browser_process_impl.h" #include "chrome/browser/profiles/profile.h" #include "components/prefs/pref_service.h" +#include "components/update_client/crx_update_item.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_handle.h" @@ -125,10 +126,10 @@ void BraveDrmTabHelper::OnWidevineKeySystemAccessRequest() { } } -void BraveDrmTabHelper::OnEvent(Events event, const std::string& id) { +void BraveDrmTabHelper::OnEvent(const update_client::CrxUpdateItem& item) { #if !BUILDFLAG(IS_ANDROID) - if (event == ComponentUpdateService::Observer::Events::COMPONENT_UPDATED && - id == kWidevineComponentId) { + if (item.state == update_client::ComponentState::kUpdated && + item.id == kWidevineComponentId) { #if BUILDFLAG(IS_LINUX) // Ask restart instead of reloading. Widevine is only usable after // restarting on linux. This restart permission request is only shown if diff --git a/browser/brave_drm_tab_helper.h b/browser/brave_drm_tab_helper.h index 01e9fb822894..5500faa7a711 100644 --- a/browser/brave_drm_tab_helper.h +++ b/browser/brave_drm_tab_helper.h @@ -6,8 +6,6 @@ #ifndef BRAVE_BROWSER_BRAVE_DRM_TAB_HELPER_H_ #define BRAVE_BROWSER_BRAVE_DRM_TAB_HELPER_H_ -#include - #include "base/scoped_observation.h" #include "brave/components/brave_drm/brave_drm.mojom.h" #include "components/component_updater/component_updater_service.h" @@ -39,7 +37,7 @@ class BraveDrmTabHelper final void OnWidevineKeySystemAccessRequest() override; // component_updater::ComponentUpdateService::Observer - void OnEvent(Events event, const std::string& id) override; + void OnEvent(const update_client::CrxUpdateItem& item) override; WEB_CONTENTS_USER_DATA_KEY_DECL(); diff --git a/browser/brave_rewards/BUILD.gn b/browser/brave_rewards/BUILD.gn index 271f314b98f3..0d27c3236ea6 100644 --- a/browser/brave_rewards/BUILD.gn +++ b/browser/brave_rewards/BUILD.gn @@ -51,6 +51,10 @@ source_set("brave_rewards_impl") { "//extensions/buildflags", ] + if (!is_android) { + deps += [ "//chrome/browser/ui/tabs:tab_strip" ] + } + if (enable_extensions) { sources += [ "extension_rewards_notification_service_observer.cc", diff --git a/browser/brave_search/brave_search_browsertest.cc b/browser/brave_search/brave_search_browsertest.cc index 55f6385e846f..ba3f631e5bf3 100644 --- a/browser/brave_search/brave_search_browsertest.cc +++ b/browser/brave_search/brave_search_browsertest.cc @@ -242,12 +242,12 @@ IN_PROC_BROWSER_TEST_F(BraveSearchTest, CheckForAnUndefinedFunction) { } // TODO(https://github.com/brave/brave-browser/issues/29631): Test flaky on -// master for the mac build. -#if BUILDFLAG(IS_MAC) +// master for the mac and linux build. +#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) #define MAYBE_DefaultAPIVisibleKnownHost DISABLED_DefaultAPIVisibleKnownHost #else #define MAYBE_DefaultAPIVisibleKnownHost DefaultAPIVisibleKnownHost -#endif // BUILDFLAG(IS_MAC) +#endif // BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) IN_PROC_BROWSER_TEST_F(BraveSearchTestEnabled, MAYBE_DefaultAPIVisibleKnownHost) { // Opensearch providers are only allowed in the root of a site, diff --git a/browser/brave_shields/ad_block_pref_service_factory.cc b/browser/brave_shields/ad_block_pref_service_factory.cc index 323a5d6e2363..fdba7c933fd4 100644 --- a/browser/brave_shields/ad_block_pref_service_factory.cc +++ b/browser/brave_shields/ad_block_pref_service_factory.cc @@ -61,7 +61,7 @@ AdBlockPrefServiceFactory::BuildServiceInstanceForBrowserContext( content::BrowserContext* AdBlockPrefServiceFactory::GetBrowserContextToUse( content::BrowserContext* context) const { - return chrome::GetBrowserContextRedirectedInIncognito(context); + return GetBrowserContextRedirectedInIncognito(context); } bool AdBlockPrefServiceFactory::ServiceIsCreatedWithBrowserContext() const { diff --git a/browser/brave_shields/cookie_list_opt_in_service_factory.cc b/browser/brave_shields/cookie_list_opt_in_service_factory.cc index 99bf56b91a98..d5a7544565ae 100644 --- a/browser/brave_shields/cookie_list_opt_in_service_factory.cc +++ b/browser/brave_shields/cookie_list_opt_in_service_factory.cc @@ -66,7 +66,7 @@ CookieListOptInServiceFactory::BuildServiceInstanceForBrowserContext( content::BrowserContext* CookieListOptInServiceFactory::GetBrowserContextToUse( content::BrowserContext* context) const { - return chrome::GetBrowserContextRedirectedInIncognito(context); + return GetBrowserContextRedirectedInIncognito(context); } } // namespace brave_shields diff --git a/browser/brave_shields/filter_list_service_factory.cc b/browser/brave_shields/filter_list_service_factory.cc index c43a52919112..659934aa5e70 100644 --- a/browser/brave_shields/filter_list_service_factory.cc +++ b/browser/brave_shields/filter_list_service_factory.cc @@ -65,7 +65,7 @@ FilterListServiceFactory::BuildServiceInstanceForBrowserContext( content::BrowserContext* FilterListServiceFactory::GetBrowserContextToUse( content::BrowserContext* context) const { - return chrome::GetBrowserContextRedirectedInIncognito(context); + return GetBrowserContextRedirectedInIncognito(context); } } // namespace brave_shields diff --git a/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_utils.cc b/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_utils.cc index c3cc779df93b..bdc3b83ce7c8 100644 --- a/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_utils.cc +++ b/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_utils.cc @@ -94,6 +94,11 @@ std::wstring GetBraveVpnHelperServiceName() { return name; } +std::wstring GetBraveVpnHelperServiceDescription() { + // TODO(anyone): Consider adding a description. + return std::wstring(); +} + std::wstring GetBraveVpnHelperRegistryStoragePath() { switch (chrome::GetChannel()) { case version_info::Channel::CANARY: diff --git a/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_utils.h b/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_utils.h index b9ed3f28b530..f83976091004 100644 --- a/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_utils.h +++ b/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_utils.h @@ -18,6 +18,7 @@ bool IsNetworkFiltersInstalled(); std::wstring GetBraveVPNConnectionName(); std::wstring GetBraveVpnHelperServiceDisplayName(); std::wstring GetBraveVpnHelperServiceName(); +std::wstring GetBraveVpnHelperServiceDescription(); std::wstring GetBraveVpnHelperRegistryStoragePath(); std::wstring GetBraveVpnOneTimeServiceCleanupStoragePath(); diff --git a/browser/brave_vpn/win/brave_vpn_wireguard_service/install_utils.cc b/browser/brave_vpn/win/brave_vpn_wireguard_service/install_utils.cc index 36f7742b686c..af52aaeb7100 100644 --- a/browser/brave_vpn/win/brave_vpn_wireguard_service/install_utils.cc +++ b/browser/brave_vpn/win/brave_vpn_wireguard_service/install_utils.cc @@ -176,7 +176,8 @@ bool InstallBraveWireguardService(const base::FilePath& root_dir) { GetBraveVPNWireguardServiceExecutablePath(root_dir)); installer::InstallServiceWorkItem install_service_work_item( brave_vpn::GetBraveVpnWireguardServiceName(), - brave_vpn::GetBraveVpnWireguardServiceDisplayName(), SERVICE_DEMAND_START, + brave_vpn::GetBraveVpnWireguardServiceDisplayName(), + brave_vpn::GetBraveVpnWireguardServiceDescription(), SERVICE_DEMAND_START, service_cmd, base::CommandLine(base::CommandLine::NO_PROGRAM), brave_vpn::wireguard::GetBraveVpnWireguardServiceRegistryStoragePath(), {brave_vpn::GetBraveVpnWireguardServiceClsid()}, @@ -236,7 +237,8 @@ bool InstallBraveVPNHelperService(const base::FilePath& root_dir) { base::CommandLine service_cmd(GetBraveVpnHelperServicePath(root_dir)); installer::InstallServiceWorkItem install_service_work_item( brave_vpn::GetBraveVpnHelperServiceName(), - brave_vpn::GetBraveVpnHelperServiceDisplayName(), SERVICE_DEMAND_START, + brave_vpn::GetBraveVpnHelperServiceDisplayName(), + brave_vpn::GetBraveVpnHelperServiceDescription(), SERVICE_DEMAND_START, service_cmd, base::CommandLine(base::CommandLine::NO_PROGRAM), GetBraveVpnHelperRegistryStoragePath(), {}, {}); install_service_work_item.set_best_effort(true); diff --git a/browser/brave_vpn/win/service_details.cc b/browser/brave_vpn/win/service_details.cc index 5c92425d9b1f..fb1de4508ccb 100644 --- a/browser/brave_vpn/win/service_details.cc +++ b/browser/brave_vpn/win/service_details.cc @@ -120,6 +120,11 @@ std::wstring GetBraveVpnWireguardServiceDisplayName() { NOTREACHED_NORETURN(); } +std::wstring GetBraveVpnWireguardServiceDescription() { + // TODO(anyone): Consider adding a description. + return std::wstring(); +} + std::wstring GetBraveVpnWireguardServiceName() { std::wstring name = GetBraveVpnWireguardServiceDisplayName(); std::erase_if(name, isspace); diff --git a/browser/brave_vpn/win/service_details.h b/browser/brave_vpn/win/service_details.h index e3a340b71eb1..0edfaef89a44 100644 --- a/browser/brave_vpn/win/service_details.h +++ b/browser/brave_vpn/win/service_details.h @@ -18,6 +18,7 @@ const IID& GetBraveVpnWireguardServiceIid(); std::wstring GetBraveVpnWireguardTunnelServiceName(); std::wstring GetBraveVpnWireguardServiceName(); std::wstring GetBraveVpnWireguardServiceDisplayName(); +std::wstring GetBraveVpnWireguardServiceDescription(); base::FilePath GetBraveVPNWireguardServiceExecutablePath( const base::FilePath& root_dir); } // namespace brave_vpn diff --git a/browser/brave_wallet/BUILD.gn b/browser/brave_wallet/BUILD.gn index 8cddc5580ec8..720e3a81c136 100644 --- a/browser/brave_wallet/BUILD.gn +++ b/browser/brave_wallet/BUILD.gn @@ -97,7 +97,10 @@ source_set("brave_wallet_delegate") { "brave_wallet_service_delegate_impl.cc", "brave_wallet_service_delegate_impl.h", ] - deps += [ "//chrome/browser/ui" ] + deps += [ + "//chrome/browser/ui", + "//chrome/browser/ui/tabs:tab_strip", + ] if (enable_extensions) { deps += [ ":external_wallets_importer" ] } @@ -198,6 +201,8 @@ source_set("unit_tests") { ":brave_wallet_delegate", "//brave/components/brave_wallet/common", "//brave/components/brave_wallet/common:common_constants", + "//chrome/browser/content_settings:content_settings_factory", + "//chrome/browser/ui/hid", ] if (enable_extensions) { sources += [ "external_wallets_importer_unittest.cc" ] diff --git a/browser/brave_wallet/asset_ratio_service_factory.cc b/browser/brave_wallet/asset_ratio_service_factory.cc index ba51bd96c993..60022f0dbc99 100644 --- a/browser/brave_wallet/asset_ratio_service_factory.cc +++ b/browser/brave_wallet/asset_ratio_service_factory.cc @@ -74,7 +74,7 @@ AssetRatioServiceFactory::BuildServiceInstanceForBrowserContext( content::BrowserContext* AssetRatioServiceFactory::GetBrowserContextToUse( content::BrowserContext* context) const { - return chrome::GetBrowserContextRedirectedInIncognito(context); + return GetBrowserContextRedirectedInIncognito(context); } } // namespace brave_wallet diff --git a/browser/brave_wallet/brave_wallet_ipfs_service_factory.cc b/browser/brave_wallet/brave_wallet_ipfs_service_factory.cc index 3fc319df94f5..05608b52f2cf 100644 --- a/browser/brave_wallet/brave_wallet_ipfs_service_factory.cc +++ b/browser/brave_wallet/brave_wallet_ipfs_service_factory.cc @@ -73,7 +73,7 @@ BraveWalletIpfsServiceFactory::BuildServiceInstanceForBrowserContext( content::BrowserContext* BraveWalletIpfsServiceFactory::GetBrowserContextToUse( content::BrowserContext* context) const { - return chrome::GetBrowserContextRedirectedInIncognito(context); + return GetBrowserContextRedirectedInIncognito(context); } } // namespace brave_wallet diff --git a/browser/brave_wallet/meld_integration_service_factory.cc b/browser/brave_wallet/meld_integration_service_factory.cc index 670a005ca466..36b59b345b38 100644 --- a/browser/brave_wallet/meld_integration_service_factory.cc +++ b/browser/brave_wallet/meld_integration_service_factory.cc @@ -73,7 +73,7 @@ MeldIntegrationServiceFactory::BuildServiceInstanceForBrowserContext( content::BrowserContext* MeldIntegrationServiceFactory::GetBrowserContextToUse( content::BrowserContext* context) const { - return chrome::GetBrowserContextRedirectedInIncognito(context); + return GetBrowserContextRedirectedInIncognito(context); } } // namespace brave_wallet diff --git a/browser/brave_wallet/simulation_service_factory.cc b/browser/brave_wallet/simulation_service_factory.cc index fcd41f95c34a..0f1f79cca0e8 100644 --- a/browser/brave_wallet/simulation_service_factory.cc +++ b/browser/brave_wallet/simulation_service_factory.cc @@ -79,7 +79,7 @@ SimulationServiceFactory::BuildServiceInstanceForBrowserContext( content::BrowserContext* SimulationServiceFactory::GetBrowserContextToUse( content::BrowserContext* context) const { - return chrome::GetBrowserContextRedirectedInIncognito(context); + return GetBrowserContextRedirectedInIncognito(context); } } // namespace brave_wallet diff --git a/browser/brave_wallet/swap_service_factory.cc b/browser/brave_wallet/swap_service_factory.cc index 2f5afc7ef731..fb830295c7c0 100644 --- a/browser/brave_wallet/swap_service_factory.cc +++ b/browser/brave_wallet/swap_service_factory.cc @@ -73,7 +73,7 @@ SwapServiceFactory::BuildServiceInstanceForBrowserContext( content::BrowserContext* SwapServiceFactory::GetBrowserContextToUse( content::BrowserContext* context) const { - return chrome::GetBrowserContextRedirectedInIncognito(context); + return GetBrowserContextRedirectedInIncognito(context); } } // namespace brave_wallet diff --git a/browser/component_updater/brave_component_updater_configurator.cc b/browser/component_updater/brave_component_updater_configurator.cc index bf8c878f323b..e2dd19547066 100644 --- a/browser/component_updater/brave_component_updater_configurator.cc +++ b/browser/component_updater/brave_component_updater_configurator.cc @@ -167,10 +167,6 @@ BraveConfigurator::GetPatcherFactory() { return patch_factory_; } -bool BraveConfigurator::EnabledDeltas() const { - return configurator_impl_.EnabledDeltas(); -} - bool BraveConfigurator::EnabledBackgroundDownloader() const { return configurator_impl_.EnabledBackgroundDownloader(); } diff --git a/browser/component_updater/brave_component_updater_configurator.h b/browser/component_updater/brave_component_updater_configurator.h index 5cf7054485bd..2d24de765a9d 100644 --- a/browser/component_updater/brave_component_updater_configurator.h +++ b/browser/component_updater/brave_component_updater_configurator.h @@ -61,7 +61,6 @@ class BraveConfigurator : public update_client::Configurator { override; scoped_refptr GetUnzipperFactory() override; scoped_refptr GetPatcherFactory() override; - bool EnabledDeltas() const override; bool EnabledBackgroundDownloader() const override; bool EnabledCupSigning() const override; PrefService* GetPrefService() const override; diff --git a/browser/debounce/debounce_service_factory.cc b/browser/debounce/debounce_service_factory.cc index a1b8f40d67fe..71681ad7b95b 100644 --- a/browser/debounce/debounce_service_factory.cc +++ b/browser/debounce/debounce_service_factory.cc @@ -58,7 +58,7 @@ DebounceServiceFactory::BuildServiceInstanceForBrowserContext( content::BrowserContext* DebounceServiceFactory::GetBrowserContextToUse( content::BrowserContext* context) const { - return chrome::GetBrowserContextRedirectedInIncognito(context); + return GetBrowserContextRedirectedInIncognito(context); } bool DebounceServiceFactory::ServiceIsNULLWhileTesting() const { diff --git a/browser/download/bubble/BUILD.gn b/browser/download/bubble/BUILD.gn index 1c9a63d051c0..dd6657639d53 100644 --- a/browser/download/bubble/BUILD.gn +++ b/browser/download/bubble/BUILD.gn @@ -11,6 +11,7 @@ source_set("unit_tests") { deps = [ "//base", "//chrome/browser", + "//chrome/browser/ui/download", "//chrome/test:test_support", "//components/download/public/common:test_support", "//components/offline_items_collection/core", diff --git a/browser/ephemeral_storage/BUILD.gn b/browser/ephemeral_storage/BUILD.gn index 94230091874d..ece1b43bc270 100644 --- a/browser/ephemeral_storage/BUILD.gn +++ b/browser/ephemeral_storage/BUILD.gn @@ -31,6 +31,7 @@ source_set("browser_tests") { "//brave/components/brave_shields/core/common", "//brave/components/ephemeral_storage", "//chrome/browser", + "//chrome/browser/content_settings:content_settings_factory", "//chrome/browser/ui", "//chrome/test:test_support", "//chrome/test:test_support_ui", @@ -48,6 +49,7 @@ source_set("unit_tests") { "//base/test:test_support", "//brave/components/ephemeral_storage", "//chrome/browser", + "//chrome/browser/content_settings:content_settings_factory", "//chrome/test:test_support", "//components/content_settings/core/browser", "//components/keyed_service/core", diff --git a/browser/ephemeral_storage/ephemeral_storage_service_factory.cc b/browser/ephemeral_storage/ephemeral_storage_service_factory.cc index a23904534eb1..7c1c65d1d5fb 100644 --- a/browser/ephemeral_storage/ephemeral_storage_service_factory.cc +++ b/browser/ephemeral_storage/ephemeral_storage_service_factory.cc @@ -77,7 +77,7 @@ EphemeralStorageServiceFactory::BuildServiceInstanceForBrowserContext( content::BrowserContext* EphemeralStorageServiceFactory::GetBrowserContextToUse( content::BrowserContext* context) const { - return chrome::GetBrowserContextOwnInstanceInIncognito(context); + return GetBrowserContextOwnInstanceInIncognito(context); } bool EphemeralStorageServiceFactory::ServiceIsCreatedWithBrowserContext() diff --git a/browser/ethereum_remote_client/ethereum_remote_client_service_factory.cc b/browser/ethereum_remote_client/ethereum_remote_client_service_factory.cc index 3132658d041c..3ca3b4eb53ce 100644 --- a/browser/ethereum_remote_client/ethereum_remote_client_service_factory.cc +++ b/browser/ethereum_remote_client/ethereum_remote_client_service_factory.cc @@ -53,7 +53,7 @@ EthereumRemoteClientServiceFactory::BuildServiceInstanceForBrowserContext( content::BrowserContext* EthereumRemoteClientServiceFactory::GetBrowserContextToUse( content::BrowserContext* context) const { - return chrome::GetBrowserContextRedirectedInIncognito(context); + return GetBrowserContextRedirectedInIncognito(context); } bool EthereumRemoteClientServiceFactory::ServiceIsCreatedWithBrowserContext() diff --git a/browser/extensions/BUILD.gn b/browser/extensions/BUILD.gn index 13da5af129bd..526823f77265 100644 --- a/browser/extensions/BUILD.gn +++ b/browser/extensions/BUILD.gn @@ -79,6 +79,7 @@ source_set("brave_prefs_util_impl") { deps = [ "//brave/components/brave_shields/content/browser", "//chrome/browser:browser_public_dependencies", + "//chrome/browser/content_settings:content_settings_factory", "//chrome/browser/profiles:profile", "//chrome/common/extensions/api", "//components/content_settings/core/browser:cookie_settings", diff --git a/browser/extensions/api/brave_rewards_api.cc b/browser/extensions/api/brave_rewards_api.cc index 3f65b25a034f..43ec0f2a8721 100644 --- a/browser/extensions/api/brave_rewards_api.cc +++ b/browser/extensions/api/brave_rewards_api.cc @@ -399,7 +399,7 @@ ExtensionFunction::ResponseAction BraveRewardsTipSiteFunction::Run() { auto* coordinator = GetTipPanelCoordinator(params->tab_id, browser_context()); if (!coordinator) { - return RespondNow(Error(tabs_constants::kTabNotFoundError, + return RespondNow(Error(extensions::ExtensionTabUtil::kTabNotFoundError, base::NumberToString(params->tab_id))); } diff --git a/browser/extensions/brave_component_loader.cc b/browser/extensions/brave_component_loader.cc index dff7e375792d..c18390e8e878 100644 --- a/browser/extensions/brave_component_loader.cc +++ b/browser/extensions/brave_component_loader.cc @@ -171,7 +171,7 @@ void BraveComponentLoader::UpdateBraveExtension() { brave_extension_path.Append(FILE_PATH_LITERAL("brave_extension")); auto& resource_bundle = ui::ResourceBundle::GetSharedInstance(); std::optional manifest = base::JSONReader::ReadDict( - resource_bundle.GetRawDataResource(IDR_BRAVE_EXTENSION)); + resource_bundle.LoadDataResourceString(IDR_BRAVE_EXTENSION)); CHECK(manifest) << "invalid Brave Extension manifest"; // The background page is a conditional. Replace MAYBE_background in the diff --git a/browser/farbling/BUILD.gn b/browser/farbling/BUILD.gn index ecbc449ecfdc..9d9c022c30e0 100644 --- a/browser/farbling/BUILD.gn +++ b/browser/farbling/BUILD.gn @@ -39,6 +39,7 @@ if (!is_android) { "//brave/components/webcompat/core/common", "//brave/third_party/blink/renderer", "//chrome/browser", + "//chrome/browser/content_settings:content_settings_factory", "//chrome/browser/ui", "//chrome/common", "//chrome/test:test_support", diff --git a/browser/hub/internal/android/java/src/org/chromium/chrome/browser/hub/BraveHubManagerImpl.java b/browser/hub/internal/android/java/src/org/chromium/chrome/browser/hub/BraveHubManagerImpl.java index 6f007791200d..7201c1c1b0f7 100644 --- a/browser/hub/internal/android/java/src/org/chromium/chrome/browser/hub/BraveHubManagerImpl.java +++ b/browser/hub/internal/android/java/src/org/chromium/chrome/browser/hub/BraveHubManagerImpl.java @@ -5,8 +5,8 @@ package org.chromium.chrome.browser.hub; +import android.app.Activity; import android.content.ComponentCallbacks; -import android.content.Context; import android.content.res.Configuration; import android.widget.FrameLayout.LayoutParams; @@ -21,7 +21,9 @@ import org.chromium.chrome.browser.profiles.ProfileProvider; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.toolbar.menu_button.MenuButtonCoordinator; +import org.chromium.chrome.browser.ui.edge_to_edge.EdgeToEdgeController; import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager; +import org.chromium.chrome.browser.ui.searchactivityutils.SearchActivityClient; import org.chromium.components.browser_ui.widget.MenuOrKeyboardActionController; import org.chromium.ui.base.DeviceFormFactor; @@ -30,14 +32,14 @@ * toolbar, when it is visible. */ public class BraveHubManagerImpl extends HubManagerImpl { - private Context mContext; + private Activity mActivity; private int mBottomToolbarHeight; private boolean mBottomToolbarVisible; private boolean mIsTablet; private ComponentCallbacks mComponentCallbacks; public BraveHubManagerImpl( - @NonNull Context context, + @NonNull Activity activity, @NonNull OneshotSupplier profileProviderSupplier, @NonNull PaneListBuilder paneListBuilder, @NonNull BackPressManager backPressManager, @@ -45,9 +47,11 @@ public BraveHubManagerImpl( @NonNull SnackbarManager snackbarManager, @NonNull ObservableSupplier tabSupplier, @NonNull MenuButtonCoordinator menuButtonCoordinator, - @NonNull HubShowPaneHelper hubShowPaneHelper) { + @NonNull HubShowPaneHelper hubShowPaneHelper, + @NonNull ObservableSupplier edgeToEdgeSupplier, + @NonNull SearchActivityClient searchActivityClient) { super( - context, + activity, profileProviderSupplier, paneListBuilder, backPressManager, @@ -55,11 +59,13 @@ public BraveHubManagerImpl( snackbarManager, tabSupplier, menuButtonCoordinator, - hubShowPaneHelper); + hubShowPaneHelper, + edgeToEdgeSupplier, + searchActivityClient); - mIsTablet = DeviceFormFactor.isNonMultiDisplayContextOnTablet(context); + mIsTablet = DeviceFormFactor.isNonMultiDisplayContextOnTablet(activity); - mContext = context; + mActivity = activity; mComponentCallbacks = new ComponentCallbacks() { @Override @@ -70,7 +76,7 @@ public void onConfigurationChanged(Configuration newConfig) { @Override public void onLowMemory() {} }; - mContext.registerComponentCallbacks(mComponentCallbacks); + mActivity.registerComponentCallbacks(mComponentCallbacks); } @Override @@ -99,7 +105,7 @@ public void onHubLayoutShow() { public void destroy() { super.destroy(); - mContext.unregisterComponentCallbacks(mComponentCallbacks); + mActivity.unregisterComponentCallbacks(mComponentCallbacks); } private void maybeUpdateBottomMarginForContainerView() { diff --git a/browser/hub/internal/android/res/layout/hub_toolbar_layout.xml b/browser/hub/internal/android/res/layout/hub_toolbar_layout.xml index 75b1f9b5518c..01457cbb35a7 100644 --- a/browser/hub/internal/android/res/layout/hub_toolbar_layout.xml +++ b/browser/hub/internal/android/res/layout/hub_toolbar_layout.xml @@ -8,11 +8,42 @@ You can obtain one at https://mozilla.org/MPL/2.0/. + + + + + + @@ -37,9 +68,8 @@ You can obtain one at https://mozilla.org/MPL/2.0/. style="@style/ToolbarButton" android:layout_width="wrap_content" android:layout_height="match_parent" - android:layout_gravity="center" + android:layout_gravity="center_horizontal|bottom" android:visibility="gone" - android:layout_marginBottom="3dp" app:tabIndicator="@drawable/m3_tabs_line_indicator" app:tabIndicatorFullWidth="true"/> diff --git a/browser/metrics/enabled_state_provider_unittest.cc b/browser/metrics/enabled_state_provider_unittest.cc index 38743167e4cf..f2bd2b7a8525 100644 --- a/browser/metrics/enabled_state_provider_unittest.cc +++ b/browser/metrics/enabled_state_provider_unittest.cc @@ -21,7 +21,7 @@ TEST(ChromeMetricsServicesManagerClient, MetricsReportingDisabled) { ChromeMetricsServicesManagerClient client(&local_state); const metrics::EnabledStateProvider& provider = - client.GetEnabledStateProviderForTesting(); + client.GetEnabledStateProvider(); // Reporting should never be enabled EXPECT_FALSE(provider.IsReportingEnabled()); diff --git a/browser/misc_metrics/BUILD.gn b/browser/misc_metrics/BUILD.gn index fba208caec0f..852e8d63b0dc 100644 --- a/browser/misc_metrics/BUILD.gn +++ b/browser/misc_metrics/BUILD.gn @@ -61,6 +61,7 @@ static_library("misc_metrics_impl") { deps += [ "//brave/browser/themes", "//chrome/browser/themes", + "//chrome/browser/ui/tabs:tab_strip", "//extensions/browser", ] } else { @@ -89,6 +90,7 @@ source_set("unit_tests") { "//brave/browser/misc_metrics:misc_metrics_impl", "//brave/components/misc_metrics", "//chrome/browser", + "//chrome/browser/content_settings:content_settings_factory", "//chrome/browser/search_engines", "//chrome/common", "//chrome/test:test_support", diff --git a/browser/net/BUILD.gn b/browser/net/BUILD.gn index 1d3748ec63b3..de7a3dde0387 100644 --- a/browser/net/BUILD.gn +++ b/browser/net/BUILD.gn @@ -40,6 +40,7 @@ source_set("browser_tests") { "//brave/components/tor/buildflags", "//chrome/browser", "//chrome/browser:browser_process", + "//chrome/browser/content_settings:content_settings_factory", "//chrome/browser/profiles:profile", "//chrome/browser/ui", "//chrome/browser/ui:browser_navigator_params_headers", diff --git a/browser/notifications/android/java/src/org/chromium/chrome/browser/notifications/BraveNotificationBuilder.java b/browser/notifications/android/java/src/org/chromium/chrome/browser/notifications/BraveNotificationBuilder.java index a8a507046fcb..0db49170ba7c 100644 --- a/browser/notifications/android/java/src/org/chromium/chrome/browser/notifications/BraveNotificationBuilder.java +++ b/browser/notifications/android/java/src/org/chromium/chrome/browser/notifications/BraveNotificationBuilder.java @@ -141,9 +141,10 @@ public NotificationWrapper build(NotificationMetadata metadata) { // Note: under the hood this is not a NotificationCompat builder so be mindful of the // API level of methods you call on the builder. // TODO(crbug.com/697104) We should probably use a Compat builder. - String channelId = (ApplicationStatus.hasVisibleActivities()) - ? BraveChannelDefinitions.ChannelId.BRAVE_ADS - : BraveChannelDefinitions.ChannelId.BRAVE_ADS_BACKGROUND; + String channelId = + ApplicationStatus.hasVisibleActivities() + ? BraveChannelDefinitions.ChannelId.BRAVE_ADS + : BraveChannelDefinitions.ChannelId.BRAVE_ADS_BACKGROUND; NotificationWrapperBuilder builder = NotificationWrapperBuilderFactory.createNotificationWrapperBuilder( channelId, metadata); @@ -151,8 +152,10 @@ public NotificationWrapper build(NotificationMetadata metadata) { builder.setContentIntent(mContentIntent); builder.setDeleteIntent(mDeleteIntent); - int priority = (ApplicationStatus.hasVisibleActivities()) ? Notification.PRIORITY_HIGH - : Notification.PRIORITY_LOW; + int priority = + ApplicationStatus.hasVisibleActivities() + ? Notification.PRIORITY_HIGH + : Notification.PRIORITY_LOW; builder.setPriorityBeforeO(priority); builder.setDefaults(mDefaults); if (mVibratePattern != null) builder.setVibrate(mVibratePattern); diff --git a/browser/notifications/android/java/src/org/chromium/chrome/browser/notifications/channels/BraveChannelDefinitions.java b/browser/notifications/android/java/src/org/chromium/chrome/browser/notifications/channels/BraveChannelDefinitions.java index d227a0d150df..e96d3dac4b3a 100644 --- a/browser/notifications/android/java/src/org/chromium/chrome/browser/notifications/channels/BraveChannelDefinitions.java +++ b/browser/notifications/android/java/src/org/chromium/chrome/browser/notifications/channels/BraveChannelDefinitions.java @@ -18,13 +18,13 @@ import java.util.Set; public class BraveChannelDefinitions { - public class ChannelId { + public static class ChannelId { public static final String BRAVE_ADS = "com.brave.browser.ads"; public static final String BRAVE_ADS_BACKGROUND = "com.brave.browser.ads.background"; public static final String BRAVE_BROWSER = "com.brave.browser"; } - public class ChannelGroupId { + public static class ChannelGroupId { public static final String BRAVE_ADS = "com.brave.browser.ads"; public static final String GENERAL = "general"; } diff --git a/browser/partnercustomizations/java/src/org/chromium/chrome/browser/partnercustomizations/BraveCustomizationProviderDelegateImpl.java b/browser/partnercustomizations/java/src/org/chromium/chrome/browser/partnercustomizations/BraveCustomizationProviderDelegateImpl.java index d69d33f05b76..e26ad6dd090f 100644 --- a/browser/partnercustomizations/java/src/org/chromium/chrome/browser/partnercustomizations/BraveCustomizationProviderDelegateImpl.java +++ b/browser/partnercustomizations/java/src/org/chromium/chrome/browser/partnercustomizations/BraveCustomizationProviderDelegateImpl.java @@ -6,7 +6,8 @@ package org.chromium.chrome.browser.partnercustomizations; /** Default ContextProviderPackageDelegateImpl implementation. */ -public class BraveCustomizationProviderDelegateImpl extends CustomizationProviderDelegateImpl { +public class BraveCustomizationProviderDelegateImpl + extends CustomizationProviderDelegateUpstreamImpl { @Override public String getHomepage() { return null; diff --git a/browser/permissions/BUILD.gn b/browser/permissions/BUILD.gn index 13deb4b813fc..385a22fbca79 100644 --- a/browser/permissions/BUILD.gn +++ b/browser/permissions/BUILD.gn @@ -34,6 +34,7 @@ if (!is_android) { "//brave/components/google_sign_in_permission", "//brave/components/localhost_permission", "//chrome/browser", + "//chrome/browser/content_settings:content_settings_factory", "//chrome/browser/permissions", "//chrome/browser/ui", "//chrome/test:test_support", @@ -56,6 +57,7 @@ source_set("unit_tests") { deps = [ "//brave/components/brave_wallet/browser:permission_utils", "//chrome/browser", + "//chrome/browser/content_settings:content_settings_factory", "//chrome/browser/permissions", "//chrome/test:test_support", "//components/content_settings/core/browser", diff --git a/browser/permissions/permission_lifetime_manager_factory.cc b/browser/permissions/permission_lifetime_manager_factory.cc index 59f4b150647c..61f5cf8ad6c2 100644 --- a/browser/permissions/permission_lifetime_manager_factory.cc +++ b/browser/permissions/permission_lifetime_manager_factory.cc @@ -79,7 +79,7 @@ bool PermissionLifetimeManagerFactory::ServiceIsCreatedWithBrowserContext() content::BrowserContext* PermissionLifetimeManagerFactory::GetBrowserContextToUse( content::BrowserContext* context) const { - return chrome::GetBrowserContextOwnInstanceInIncognito(context); + return GetBrowserContextOwnInstanceInIncognito(context); } void PermissionLifetimeManagerFactory::RegisterProfilePrefs( diff --git a/browser/playlist/playlist_data_source.cc b/browser/playlist/playlist_data_source.cc index 98b5032b5fa8..e5657b1be19d 100644 --- a/browser/playlist/playlist_data_source.cc +++ b/browser/playlist/playlist_data_source.cc @@ -128,7 +128,8 @@ content::URLDataSource::RangeDataResult ReadFileRange( buffer.resize(read_size); content::URLDataSource::RangeDataResult result; - result.buffer = base::RefCountedBytes::TakeVector(&buffer); + result.buffer = + base::MakeRefCounted(std::move(buffer)); result.file_size = file_length; result.range = net::HttpByteRange::Bounded( first_byte_position, first_byte_position + read_size - 1); diff --git a/browser/request_otr/request_otr_service_factory.cc b/browser/request_otr/request_otr_service_factory.cc index 2cfd5bfd76b9..2da62dcec03a 100644 --- a/browser/request_otr/request_otr_service_factory.cc +++ b/browser/request_otr/request_otr_service_factory.cc @@ -66,7 +66,7 @@ RequestOTRServiceFactory::BuildServiceInstanceForBrowserContext( content::BrowserContext* RequestOTRServiceFactory::GetBrowserContextToUse( content::BrowserContext* context) const { - return chrome::GetBrowserContextRedirectedInIncognito(context); + return GetBrowserContextRedirectedInIncognito(context); } bool RequestOTRServiceFactory::ServiceIsNULLWhileTesting() const { diff --git a/browser/resources/settings/brave_overrides/cr_icon.ts b/browser/resources/settings/brave_overrides/cr_icon.ts index 4a87a3e622dc..86516f188d57 100644 --- a/browser/resources/settings/brave_overrides/cr_icon.ts +++ b/browser/resources/settings/brave_overrides/cr_icon.ts @@ -13,15 +13,15 @@ injectStyle(CrIconElement, css`:host { --leo-icon-color: var(--iron-icon-fill-color, currentColor); }`) -const old = CrIconElement.prototype.updateIcon -CrIconElement.prototype.updateIcon = function (...args: any) { +const old = (CrIconElement.prototype as any).updateIcon_; +(CrIconElement.prototype as any).updateIcon_ = function (...args: any) { const removeAllOfType = (type: string) => { for (const node of this.shadowRoot!.querySelectorAll(type)) node.remove() } const name = iconMap[this.icon] if (name || leoIcons.has(this.icon)) { - removeAllOfType('svg') + removeAllOfType('svg') let leoIcon = this.shadowRoot!.querySelector('leo-icon') if (!leoIcon) { diff --git a/browser/search_engines/search_engine_provider_service_factory.cc b/browser/search_engines/search_engine_provider_service_factory.cc index d8fd37c6a6be..df7a10f436b5 100644 --- a/browser/search_engines/search_engine_provider_service_factory.cc +++ b/browser/search_engines/search_engine_provider_service_factory.cc @@ -80,7 +80,7 @@ SearchEngineProviderServiceFactory::BuildServiceInstanceForBrowserContext( content::BrowserContext* SearchEngineProviderServiceFactory::GetBrowserContextToUse( content::BrowserContext* context) const { - return chrome::GetBrowserContextOwnInstanceInIncognito(context); + return GetBrowserContextOwnInstanceInIncognito(context); } bool SearchEngineProviderServiceFactory::ServiceIsNULLWhileTesting() const { diff --git a/browser/speedreader/speedreader_service_factory.cc b/browser/speedreader/speedreader_service_factory.cc index 410365ca64ba..6c9aef3e049f 100644 --- a/browser/speedreader/speedreader_service_factory.cc +++ b/browser/speedreader/speedreader_service_factory.cc @@ -39,7 +39,7 @@ SpeedreaderServiceFactory::~SpeedreaderServiceFactory() = default; content::BrowserContext* SpeedreaderServiceFactory::GetBrowserContextToUse( content::BrowserContext* context) const { - return chrome::GetBrowserContextOwnInstanceInIncognito(context); + return GetBrowserContextOwnInstanceInIncognito(context); } std::unique_ptr diff --git a/browser/sync/brave_sync_alerts_service_factory.cc b/browser/sync/brave_sync_alerts_service_factory.cc index 6b755a034cb1..6c543075f667 100644 --- a/browser/sync/brave_sync_alerts_service_factory.cc +++ b/browser/sync/brave_sync_alerts_service_factory.cc @@ -46,7 +46,7 @@ BraveSyncAlertsServiceFactory::BuildServiceInstanceForBrowserContext( content::BrowserContext* BraveSyncAlertsServiceFactory::GetBrowserContextToUse( content::BrowserContext* context) const { - return chrome::GetBrowserContextRedirectedInIncognito(context); + return GetBrowserContextRedirectedInIncognito(context); } bool BraveSyncAlertsServiceFactory::ServiceIsCreatedWithBrowserContext() const { diff --git a/browser/tab_group/BUILD.gn b/browser/tabmodel/android/BUILD.gn similarity index 83% rename from browser/tab_group/BUILD.gn rename to browser/tabmodel/android/BUILD.gn index 9c05278f48fe..14a9b9f3f73c 100644 --- a/browser/tab_group/BUILD.gn +++ b/browser/tabmodel/android/BUILD.gn @@ -9,13 +9,12 @@ import("//build/config/android/rules.gni") import("//chrome/browser/buildflags.gni") android_library("java") { - sources = [ "java/src/org/chromium/chrome/browser/tasks/tab_groups/BraveTabGroupModelFilter.java" ] + sources = [ "java/src/org/chromium/chrome/browser/tabmodel/BraveTabGroupModelFilter.java" ] deps = [ "//base:base_java", "//chrome/browser/preferences:java", "//chrome/browser/tab:java", - "//chrome/browser/tab_group:java", "//chrome/browser/tabmodel:java", "//third_party/androidx:androidx_annotation_annotation_java", ] diff --git a/browser/tab_group/java/src/org/chromium/chrome/browser/tasks/tab_groups/BraveTabGroupModelFilter.java b/browser/tabmodel/android/java/src/org/chromium/chrome/browser/tabmodel/BraveTabGroupModelFilter.java similarity index 64% rename from browser/tab_group/java/src/org/chromium/chrome/browser/tasks/tab_groups/BraveTabGroupModelFilter.java rename to browser/tabmodel/android/java/src/org/chromium/chrome/browser/tabmodel/BraveTabGroupModelFilter.java index f2bd51ce988a..daf64dea18cb 100644 --- a/browser/tab_group/java/src/org/chromium/chrome/browser/tasks/tab_groups/BraveTabGroupModelFilter.java +++ b/browser/tabmodel/android/java/src/org/chromium/chrome/browser/tabmodel/BraveTabGroupModelFilter.java @@ -2,32 +2,23 @@ * 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 https://mozilla.org/MPL/2.0/. */ -package org.chromium.chrome.browser.tasks.tab_groups; - -import androidx.annotation.NonNull; +package org.chromium.chrome.browser.tabmodel; import org.chromium.base.BravePreferenceKeys; import org.chromium.base.BraveReflectionUtil; -import org.chromium.base.Token; import org.chromium.chrome.browser.preferences.ChromeSharedPreferences; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabLaunchType; -import org.chromium.chrome.browser.tabmodel.TabModel; -import org.chromium.chrome.browser.tabmodel.TabModelFilter; /** Brave's super class for {@link TabGroupModelFilter} */ -public abstract class BraveTabGroupModelFilter extends TabModelFilter { +public class BraveTabGroupModelFilter { /** - * This variable will be used instead of {@link TabGroupModelFilter}'s variable, that will be - * deleted in bytecode. + * This variable will be used instead of {@link TabGroupModelFilterImpl}'s variable, that will + * be deleted in bytecode. */ protected boolean mIsResetting; - public BraveTabGroupModelFilter(TabModel tabModel) { - super(tabModel); - } - - /** Call from {@link TabGroupModelFilter} will be redirected here via bytrcode. */ + /** Call from {@link TabGroupModelFilterImpl} will be redirected here via bytecode. */ public boolean shouldUseParentIds(Tab tab) { if (linkClicked(tab.getLaunchType()) && ChromeSharedPreferences.getInstance() @@ -39,7 +30,7 @@ && isTabModelRestored() // Otherwise just call parent. return (boolean) BraveReflectionUtil.invokeMethod( - TabGroupModelFilter.class, this, "shouldUseParentIds", Tab.class, tab); + TabGroupModelFilterImpl.class, this, "shouldUseParentIds", Tab.class, tab); } /** Determine if a launch type is the result of linked being clicked. */ @@ -47,9 +38,9 @@ private boolean linkClicked(@TabLaunchType int type) { return type == TabLaunchType.FROM_LINK || type == TabLaunchType.FROM_LONGPRESS_FOREGROUND; } - private static Token getOrCreateTabGroupId(@NonNull Tab tab) { - return (Token) + private boolean isTabModelRestored() { + return (boolean) BraveReflectionUtil.invokeMethod( - TabGroupModelFilter.class, null, "getOrCreateTabGroupId", Tab.class, tab); + TabGroupModelFilterImpl.class, this, "isTabModelRestored"); } } diff --git a/browser/test/BUILD.gn b/browser/test/BUILD.gn index 7a3ca014b152..cbf2af660699 100644 --- a/browser/test/BUILD.gn +++ b/browser/test/BUILD.gn @@ -22,6 +22,7 @@ source_set("browser_tests") { "//brave/browser", "//brave/common", "//chrome/browser", + "//chrome/browser/content_settings:content_settings_factory", "//chrome/browser/ui", "//chrome/common", "//chrome/test:test_support", diff --git a/browser/test/disabled_features/disable_client_hints_browsertest.cc b/browser/test/disabled_features/disable_client_hints_browsertest.cc index 7c017d160aff..e9a84212ce2c 100644 --- a/browser/test/disabled_features/disable_client_hints_browsertest.cc +++ b/browser/test/disabled_features/disable_client_hints_browsertest.cc @@ -38,13 +38,9 @@ constexpr char kClientHintsMetaNameAcceptCH[] = "/ch-meta-name-accept-ch.html"; const std::reference_wrapper kTestFeatures[] = { // Individual hints features - blink::features::kClientHintsDeviceMemory, blink::features::kClientHintsDeviceMemory_DEPRECATED, - blink::features::kClientHintsDPR, blink::features::kClientHintsDPR_DEPRECATED, - blink::features::kClientHintsResourceWidth, blink::features::kClientHintsResourceWidth_DEPRECATED, - blink::features::kClientHintsViewportWidth, blink::features::kClientHintsViewportWidth_DEPRECATED, blink::features::kViewportHeightClientHintHeader, }; diff --git a/browser/tor/test/BUILD.gn b/browser/tor/test/BUILD.gn index da1323129ecf..55fdb3abd133 100644 --- a/browser/tor/test/BUILD.gn +++ b/browser/tor/test/BUILD.gn @@ -68,6 +68,7 @@ source_set("browser_tests") { "//brave/components/tor:test_support", "//chrome/browser", "//chrome/browser:browser_process", + "//chrome/browser/content_settings:content_settings_factory", "//chrome/browser/search_engines", "//chrome/browser/ui", "//chrome/test:test_support", diff --git a/browser/touch_to_fill/android/internal/java/res/layout/touch_to_fill_header_item.xml b/browser/touch_to_fill/password_manager/android/internal/java/res/layout/touch_to_fill_header_item.xml similarity index 82% rename from browser/touch_to_fill/android/internal/java/res/layout/touch_to_fill_header_item.xml rename to browser/touch_to_fill/password_manager/android/internal/java/res/layout/touch_to_fill_header_item.xml index 936c52d9cef7..32d5bfee608f 100644 --- a/browser/touch_to_fill/android/internal/java/res/layout/touch_to_fill_header_item.xml +++ b/browser/touch_to_fill/password_manager/android/internal/java/res/layout/touch_to_fill_header_item.xml @@ -23,6 +23,14 @@ You can obtain one at https://mozilla.org/MPL/2.0/. android:importantForAccessibility="no" android:visibility="gone" /> + + diff --git a/browser/ui/BUILD.gn b/browser/ui/BUILD.gn index 08f53da439b8..9ba1f2247581 100644 --- a/browser/ui/BUILD.gn +++ b/browser/ui/BUILD.gn @@ -335,16 +335,23 @@ source_set("ui") { "//brave/components/misc_metrics", "//brave/components/sidebar/browser", "//brave/components/sidebar/common", + "//brave/components/speedreader/common/buildflags", "//chrome/app:generated_resources", + "//chrome/browser/content_settings:content_settings_factory", + "//chrome/browser/importer", "//chrome/browser/profiles", "//chrome/browser/search", "//chrome/browser/sync", "//chrome/browser/themes", + "//chrome/browser/ui:url_identity", "//chrome/browser/ui/browser_window", "//chrome/browser/ui/content_settings", "//chrome/browser/ui/omnibox", + "//chrome/browser/ui/prefs", + "//chrome/browser/ui/tabs:tab_menu", "//chrome/browser/ui/views/side_panel", "//chrome/browser/ui/webui/searchbox", + "//chrome/browser/ui/webui/settings", "//chrome/browser/ui/webui/side_panel/reading_list:mojo_bindings", "//chrome/common:channel_info", "//components/bookmarks/common", @@ -610,7 +617,9 @@ source_set("ui") { deps += [ "//chrome/browser/devtools", + "//chrome/browser/ui/download", "//chrome/browser/ui/exclusive_access", + "//chrome/browser/ui/javascript_dialogs", "//chrome/browser/ui/views/bubble", "//chrome/browser/ui/views/toolbar", "//components/bookmarks/browser", diff --git a/browser/ui/android/appmenu/internal/java/src/org/chromium/chrome/browser/ui/appmenu/BraveAppMenu.java b/browser/ui/android/appmenu/internal/java/src/org/chromium/chrome/browser/ui/appmenu/BraveAppMenu.java index 84d470e3ca62..4b303094d55d 100644 --- a/browser/ui/android/appmenu/internal/java/src/org/chromium/chrome/browser/ui/appmenu/BraveAppMenu.java +++ b/browser/ui/android/appmenu/internal/java/src/org/chromium/chrome/browser/ui/appmenu/BraveAppMenu.java @@ -17,14 +17,16 @@ import org.chromium.chrome.browser.ui.appmenu.internal.R; class BraveAppMenu extends AppMenu { + private static final int BOTTOM_MENU_VERTICAL_OFFSET_DP = 44; private static int sMenuHeight; private static int sNegativeVerticalOffsetNotTopAnchored; BraveAppMenu(int itemRowHeight, AppMenuHandlerImpl handler, Resources res) { super(itemRowHeight, handler, res); + final float scale = res.getDisplayMetrics().density; sNegativeVerticalOffsetNotTopAnchored = - res.getDimensionPixelSize(R.dimen.menu_negative_vertical_offset_not_top_anchored); + (int) (BOTTOM_MENU_VERTICAL_OFFSET_DP * scale + 0.5f); } @SuppressLint("VisibleForTests") diff --git a/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/status/BraveStatusMediator.java b/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/status/BraveStatusMediator.java index 495de246691e..3d2b10c37179 100644 --- a/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/status/BraveStatusMediator.java +++ b/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/status/BraveStatusMediator.java @@ -6,7 +6,6 @@ package org.chromium.chrome.browser.omnibox.status; import android.content.Context; -import android.content.res.Resources; import androidx.annotation.Nullable; @@ -27,7 +26,6 @@ public class BraveStatusMediator extends StatusMediator { public BraveStatusMediator( PropertyModel model, - Resources resources, Context context, UrlBarEditingTextStateProvider urlBarEditingTextStateProvider, boolean isTablet, @@ -42,7 +40,6 @@ public BraveStatusMediator( merchantTrustSignalsCoordinatorSupplier) { super( model, - resources, context, urlBarEditingTextStateProvider, isTablet, diff --git a/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/BraveAutocompleteCoordinator.java b/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/BraveAutocompleteCoordinator.java index 94bef9b5da70..05023bfd22a7 100644 --- a/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/BraveAutocompleteCoordinator.java +++ b/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/BraveAutocompleteCoordinator.java @@ -20,14 +20,13 @@ import org.chromium.chrome.browser.omnibox.suggestions.brave_leo.BraveLeoSuggestionViewBinder; import org.chromium.chrome.browser.omnibox.suggestions.brave_search.BraveSearchBannerViewBinder; import org.chromium.ui.ViewProvider; -import org.chromium.ui.modelutil.MVCListAdapter; import java.util.ArrayList; import java.util.List; public class BraveAutocompleteCoordinator { public ViewProvider createViewProvider( - Context context, MVCListAdapter.ModelList modelList, boolean forcePhoneStyleOmnibox) { + Context context, boolean forcePhoneStyleOmnibox) { ViewProvider provider = (ViewProvider) BraveReflectionUtil.invokeMethod( @@ -36,8 +35,6 @@ public ViewProvider createViewProvider( "createViewProvider", Context.class, context, - MVCListAdapter.ModelList.class, - modelList, boolean.class, forcePhoneStyleOmnibox); diff --git a/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/editurl/BraveEditUrlSuggestionProcessor.java b/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/editurl/BraveEditUrlSuggestionProcessor.java index 2f17409632a9..83db6cd35af1 100644 --- a/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/editurl/BraveEditUrlSuggestionProcessor.java +++ b/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/editurl/BraveEditUrlSuggestionProcessor.java @@ -39,8 +39,8 @@ public boolean doesProcessSuggestion(@NonNull AutocompleteMatch suggestion, int Tab activeTab = mTabSupplier.get(); if (position == 0 && activeTab != null - && (suggestion.getType() == OmniboxSuggestionType.URL_WHAT_YOU_TYPED - && tabMatchesSuggestion(activeTab, suggestion) + && ((suggestion.getType() == OmniboxSuggestionType.URL_WHAT_YOU_TYPED + && tabMatchesSuggestion(activeTab, suggestion)) || suggestion.getUrl().equals(activeTab.getUrl()))) { // Show edit url suggestion for typed URLs. // If url hasn't changed we still want to show the edit url suggestion. @@ -70,7 +70,6 @@ && tabMatchesSuggestion(activeTab, suggestion)) { OmniboxSuggestionType.URL_WHAT_YOU_TYPED, suggestion.getSubtypes(), suggestion.isSearchSuggestion(), - suggestion.getRelevance(), suggestion.getTransition(), suggestion.getDisplayText(), suggestion.getDisplayTextClassifications(), diff --git a/browser/ui/android/strings/android_chrome_strings.grd b/browser/ui/android/strings/android_chrome_strings.grd index f5fe0e0233bb..90bc0d41368b 100644 --- a/browser/ui/android/strings/android_chrome_strings.grd +++ b/browser/ui/android/strings/android_chrome_strings.grd @@ -594,7 +594,7 @@ For more settings that use data to improve your Brave experience, go to - Autofill Services + Autofill services Restart Brave @@ -677,15 +677,6 @@ For more settings that use data to improve your Brave experience, go to Save passwords - - Use and save passwords in your Brave sync chain - - - When on, passwords are saved in %1$sfoo@gmail.com. When off, passwords are saved only to this device. - - - When on, passwords are saved in your account. When off, passwords are saved only to this device. - Auto Sign-in @@ -875,6 +866,9 @@ For more settings that use data to improve your Brave experience, go to Passwords may stop working soon on this device. To keep using your passwords, update Google Play services. <link>Learn more</link> + + Passwords will stop working soon on this device. To keep using your passwords, update Google Play services. <link>Learn more</link> + Update @@ -902,6 +896,12 @@ For more settings that use data to improve your Brave experience, go to Update about password merge is closed + + Brave Password Manager update opened + + + Brave Password Manager update closed + Save the passwords on this device in your Brave sync chain by turning on sync @@ -960,13 +960,16 @@ For more settings that use data to improve your Brave experience, go to + Passwords may stop working soon on this device. To keep using your passwords, update Google Play services. + + Passwords will stop working soon on this device. To keep using your passwords, update Google Play services. Fix problem with saved passwords - Some passwords saved only on this device will stop working soon. You can move these passwords to Brave Password Manager. + Some passwords on this device will stop working soon. You can move these passwords to Brave Password Manager. Fix now @@ -1001,9 +1004,27 @@ For more settings that use data to improve your Brave experience, go to Take me there - + + Passwords will stop working soon + + Some passwords will stop working soon + + Passwords will stop working on this device + + + Passwords may stop working soon + + + Passwords will stop working on this device + + + Brave Password Manager will stop working soon on this device + + + Passwords will stop working soon because Google Play services isn’t available. To use passwords saved in your Brave sync chain, sign in using another device, or go to passwords.google.com. + @@ -1181,12 +1202,6 @@ For example, some websites may respond to this request by showing you ads that a - - Brave auto-deletes topics that are older than 4 weeks. As you keep browsing, a topic might reappear on the list. Or you can block topics you don’t want Brave to share with sites. Learn more about <link>managing your ad privacy in Brave.</link> - - - As you browse, whether an ad you see is personalized depends on this setting, <link1>Site-suggested ads</link1>, your <link2>cookie settings</link2>, and if the site you're viewing personalizes ads. - Blocked topic @@ -1219,9 +1234,6 @@ For example, some websites may respond to this request by showing you ads that a Sites you blocked - - As you browse, whether an ad you see is personalized depends on this setting, <link1>Ad topics</link1>, your <link2>cookie settings</link2>, and if the site you’re viewing personalizes ads - All sites @@ -1603,18 +1615,6 @@ Your Brave account may have other forms of browsing history like searches and ac Privacy guide explanation closed - - When you tap or type in the address bar or search box, you'll see suggestions from your default search engine. This is off in Private. - - - As you type, Brave sends the content of the address bar or search box to your default search engine - - - Depending on your settings, Brave may also send cookies, your current URL, and your location - - - When off, you’ll still see suggestions that Brave provides locally - @@ -2878,8 +2878,20 @@ To change this setting, BEGIN_LINKdelete the Brave da - - Standard tabs + + Tabs + + + {NUMBER_OF_TABS, plural, + =1 {%1$d1 standard tab} + other {%1$d2 standard tabs} + } + + + {NUMBER_OF_TABS, plural, + =1 {%1$d1 standard tab with new activity in shared tab groups} + other {%1$d2 standard tabs with new activity in shared tab groups} + } Private tabs @@ -2941,9 +2953,12 @@ To change this setting, BEGIN_LINKdelete the Brave da =1 {1 download pending} other {# downloads pending}} + + Blocked by your organization + {FILE_COUNT, plural, - =1 {Blocked by your organization} + =1 {1 was blocked by your organization} other {# were blocked by your organization}} @@ -3684,9 +3699,6 @@ To change this setting, BEGIN_LINKdelete the Brave da To quickly get back to sites you’ve visited, sync your tabs and history - - Sync your passwords, history & more on all devices - Sync your bookmarks, history & more on all devices @@ -3842,9 +3854,6 @@ To change this setting, BEGIN_LINKdelete the Brave da Use Brave your way - - Sync to get your passwords, bookmarks and more on your other devices - Sync to get your bookmarks, history and more on your other devices @@ -4225,6 +4234,15 @@ To change this setting, BEGIN_LINKdelete the Brave da Edit toolbar shortcut + + Move address bar to the bottom + + + Move address bar to the top + + + Copy link + @@ -4470,18 +4488,12 @@ To change this setting, BEGIN_LINKdelete the Brave da Bookmark saved - - Bookmark moved - Tracking price Get alerts if the price drops on any site - - Couldn’t update Track price - Track price @@ -4833,8 +4845,17 @@ To change this setting, BEGIN_LINKdelete the Brave da Open tabs to visit different pages at the same time - - Switch or close tabs + + {NUMBER_OF_TABS, plural, + =1 {See %1$d1 tab} + other {See %1$d2 tabs} + } + + + {NUMBER_OF_TABS, plural, + =1 {See %1$d1 tab with new activity in shared tab groups} + other {See %1$d2 tabs with new activity in shared tab groups} + } Manage account @@ -5803,14 +5824,6 @@ To change this setting, BEGIN_LINKdelete the Brave da Sign-in failed - - Connected with USB cable - - - - Disconnect when you’re done - - Connecting to your device… @@ -6252,17 +6265,26 @@ To change this setting, BEGIN_LINKdelete the Brave da Continue to %1$srp.example with %2$sidp.com + + name + + + email address + + + profile picture + - To continue, %1$sidp.com will share your name, email address, and profile picture with this site. + To continue, %1$sidp.com will share your %2$sname and email address with this site. - To continue, %1$sidp.com will share your name, email address, and profile picture with this site. See this site's <link_terms_of_service>terms of service</link_terms_of_service>. + To continue, %1$sidp.com will share your %2$sname and email address with this site. See this site's <link_terms_of_service>terms of service</link_terms_of_service>. - To continue, %1$sidp.com will share your name, email address, and profile picture with this site. See this site's <link_privacy_policy>privacy policy</link_privacy_policy>. + To continue, %1$sidp.com will share your %2$sname and email address with this site. See this site's <link_privacy_policy>privacy policy</link_privacy_policy>. - To continue, %1$sidp.com will share your name, email address, and profile picture with this site. See this site's <link_privacy_policy>privacy policy</link_privacy_policy> and <link_terms_of_service>terms of service</link_terms_of_service>. + To continue, %1$sidp.com will share your %2$sname and email address with this site. See this site's <link_privacy_policy>privacy policy</link_privacy_policy> and <link_terms_of_service>terms of service</link_terms_of_service>. @@ -6707,6 +6729,24 @@ To change this setting, BEGIN_LINKdelete the Brave da There was an error. Try again. + + %1$sJane changed tab “%2$sExample Domain” + + + %1$sJane removed tab “%2$sExample Domain” + + + %1$sJane joined “%2$sShopping” tab group + + + The “%1$sShopping” tab group is no longer available + + + Reopen + + + Manage + @@ -6753,6 +6793,48 @@ To change this setting, BEGIN_LINKdelete the Brave da Settings + + + + Search your tabs + + + Search your Private tabs + + + + + Make Brave your default browser + + + You can use Brave any time you tap links in messages, documents and other apps + + + Open Settings + + + + + Identity Check is on and can’t verify it’s you + + + Biometrics failed too many times. Lock and unlock your device to retry. + + + You can manage Identity Check in theft protection settings. <link>Go to settings</link> + + + Lock screen + + + Make Brave your default + + + Quickly open links in messages and more + + + Settings + diff --git a/browser/ui/android/strings/android_chrome_strings_override.grd b/browser/ui/android/strings/android_chrome_strings_override.grd index 70dc8ba1ea50..db08458cf86d 100644 --- a/browser/ui/android/strings/android_chrome_strings_override.grd +++ b/browser/ui/android/strings/android_chrome_strings_override.grd @@ -132,9 +132,6 @@ CHAR_LIMIT guidelines: While in Private, sites can’t use your cookies to see your browsing activity across different sites, for example, to personalize ads. Features on some sites may break. - - When you tap or type in the address bar or search box, you'll see suggestions from your default search engine. This is off in Private. - Brave Private @@ -288,6 +285,10 @@ CHAR_LIMIT guidelines: Save passkey outside Private? + + Search your Private tabs + + diff --git a/browser/ui/bookmark/bookmark_prefs_service_factory.cc b/browser/ui/bookmark/bookmark_prefs_service_factory.cc index 0b8f8e987c98..ea2aa59d3bf8 100644 --- a/browser/ui/bookmark/bookmark_prefs_service_factory.cc +++ b/browser/ui/bookmark/bookmark_prefs_service_factory.cc @@ -44,7 +44,7 @@ BookmarkPrefsServiceFactory::BuildServiceInstanceForBrowserContext( content::BrowserContext* BookmarkPrefsServiceFactory::GetBrowserContextToUse( content::BrowserContext* context) const { - return chrome::GetBrowserContextRedirectedInIncognito(context); + return GetBrowserContextRedirectedInIncognito(context); } bool BookmarkPrefsServiceFactory::ServiceIsCreatedWithBrowserContext() const { diff --git a/browser/ui/color/brave_color_mixer.cc b/browser/ui/color/brave_color_mixer.cc index cb74f4c7d3fa..164db9888c58 100644 --- a/browser/ui/color/brave_color_mixer.cc +++ b/browser/ui/color/brave_color_mixer.cc @@ -706,7 +706,7 @@ void AddBraveOmniboxPrivateThemeColorMixer(ui::ColorProvider* provider, AddOmniboxHoverSelect(mixer); - mixer[kColorPageInfoBackground] = {SK_ColorTRANSPARENT}; + mixer[kColorOmniboxIconBackground] = {SK_ColorTRANSPARENT}; } void AddBraveOmniboxColorMixer(ui::ColorProvider* provider, @@ -718,11 +718,11 @@ void AddBraveOmniboxColorMixer(ui::ColorProvider* provider, mixer[kColorOmniboxResultsUrl] = {nala::kColorTextInteractive}; // We use a shadow for the Omnibox hover effect, rather than a color change. mixer[kColorLocationBarBackgroundHovered] = {kColorLocationBarBackground}; - mixer[kColorPageInfoIconHover] = { + mixer[kColorOmniboxIconHover] = { ui::SetAlpha(kColorOmniboxText, std::ceil(0.10f * 255.0f))}; // We don't use bg color for location icon view. - mixer[kColorPageInfoBackground] = {SK_ColorTRANSPARENT}; + mixer[kColorOmniboxIconBackground] = {SK_ColorTRANSPARENT}; } void AddBravifiedTabStripColorMixer(ui::ColorProvider* provider, diff --git a/browser/ui/color/brave_color_mixers_unittest.cc b/browser/ui/color/brave_color_mixers_unittest.cc index 0bd73c8a2b01..7214eb5cb447 100644 --- a/browser/ui/color/brave_color_mixers_unittest.cc +++ b/browser/ui/color/brave_color_mixers_unittest.cc @@ -32,7 +32,7 @@ TEST_F(BraveColorMixersTest, ColorOverrideTest) { EXPECT_EQ(color_provider().GetColor(kColorToolbar), color_provider().GetColor(kColorInfoBarBackground)); - EXPECT_EQ(color_provider().GetColor(kColorPageInfoIconHover), + EXPECT_EQ(color_provider().GetColor(kColorOmniboxIconHover), SkColorSetA(color_provider().GetColor(kColorOmniboxText), std::ceil(0.10f * 255.0f))); } diff --git a/browser/ui/sidebar/sidebar_service_factory.cc b/browser/ui/sidebar/sidebar_service_factory.cc index 2a226dbb2156..8365f627962c 100644 --- a/browser/ui/sidebar/sidebar_service_factory.cc +++ b/browser/ui/sidebar/sidebar_service_factory.cc @@ -103,7 +103,7 @@ SidebarServiceFactory::BuildServiceInstanceForBrowserContext( content::BrowserContext* SidebarServiceFactory::GetBrowserContextToUse( content::BrowserContext* context) const { // sidebar items list is not shared between normal and private windows. - return chrome::GetBrowserContextOwnInstanceInIncognito(context); + return GetBrowserContextOwnInstanceInIncognito(context); } void SidebarServiceFactory::RegisterProfilePrefs( diff --git a/browser/ui/tabs/shared_pinned_tab_service.cc b/browser/ui/tabs/shared_pinned_tab_service.cc index 152fb0c904b3..8a5db4dbadfc 100644 --- a/browser/ui/tabs/shared_pinned_tab_service.cc +++ b/browser/ui/tabs/shared_pinned_tab_service.cc @@ -312,7 +312,8 @@ void SharedPinnedTabService::OnBrowserSetLastActive(Browser* browser) { if (!base::Contains(browsers_, browser)) { // Browser could be different profile or not a type we're // looking for. Let |OnBrowserAdded| decide which to look for. - DCHECK(!browser->is_type_normal() || profile_ != browser->profile()) + DCHECK(!browser->is_type_normal() || profile_ != browser->profile() || + base::Contains(closing_browsers_, browser)) << "We expect a Browser to be created before set active"; return; } diff --git a/browser/ui/toolbar/brave_app_menu_model_browsertest.cc b/browser/ui/toolbar/brave_app_menu_model_browsertest.cc index 53d935bffd8d..ab16f5d3ca62 100644 --- a/browser/ui/toolbar/brave_app_menu_model_browsertest.cc +++ b/browser/ui/toolbar/brave_app_menu_model_browsertest.cc @@ -400,14 +400,12 @@ IN_PROC_BROWSER_TEST_F(BraveAppMenuModelBrowserTest, BraveVPNMenuTest) { void CheckMenuIcons(ui::MenuModel* menu, int submenu_depth, std::u16string path = u"") { - constexpr int kIconlessCommands[] = { - // Header, with no icon - RecentTabsSubMenuModel::kDisabledRecentlyClosedHeaderCommandId}; for (size_t i = 0; i < menu->GetItemCount(); ++i) { auto command_id = menu->GetCommandIdAt(i); // Skip separators, headers, & commands which deliberately have no icons if (command_id == -1 || command_id == -2 || - base::Contains(kIconlessCommands, command_id)) { + command_id == RecentTabsSubMenuModel:: + GetDisabledRecentlyClosedHeaderCommandId()) { continue; } diff --git a/browser/ui/toolbar/brave_bookmark_context_menu_controller.h b/browser/ui/toolbar/brave_bookmark_context_menu_controller.h index e98019647910..8a77feb0cb0a 100644 --- a/browser/ui/toolbar/brave_bookmark_context_menu_controller.h +++ b/browser/ui/toolbar/brave_bookmark_context_menu_controller.h @@ -18,6 +18,10 @@ class Browser; class Profile; class PrefService; +namespace bookmarks { +class BookmarkModel; +} + class BraveBookmarkContextMenuController : public BookmarkContextMenuController { public: diff --git a/browser/ui/toolbar/brave_bookmark_context_menu_controller_unittest.cc b/browser/ui/toolbar/brave_bookmark_context_menu_controller_unittest.cc index 6c0fc6db6ed3..7c5a99e0884a 100644 --- a/browser/ui/toolbar/brave_bookmark_context_menu_controller_unittest.cc +++ b/browser/ui/toolbar/brave_bookmark_context_menu_controller_unittest.cc @@ -3,17 +3,18 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at https://mozilla.org/MPL/2.0/. */ +#include "brave/browser/ui/toolbar/brave_bookmark_context_menu_controller.h" + #include #include #include -#include "brave/browser/ui/toolbar/brave_bookmark_context_menu_controller.h" - #include "base/memory/raw_ptr.h" #include "base/values.h" #include "brave/browser/ui/bookmark/bookmark_helper.h" #include "chrome/app/chrome_command_ids.h" +#include "chrome/browser/bookmarks/bookmark_merged_surface_service_factory.h" #include "chrome/browser/bookmarks/bookmark_model_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/bookmarks/bookmark_context_menu_controller.h" @@ -42,6 +43,9 @@ class BraveBookmarkContextMenuControllerTest : public testing::Test { TestingProfile::Builder builder; builder.AddTestingFactory(BookmarkModelFactory::GetInstance(), BookmarkModelFactory::GetDefaultFactory()); + builder.AddTestingFactory( + BookmarkMergedSurfaceServiceFactory::GetInstance(), + BookmarkMergedSurfaceServiceFactory::GetDefaultFactory()); profile_ = builder.Build(); model_ = BookmarkModelFactory::GetForBrowserContext(profile_.get()); bookmarks::test::WaitForBookmarkModelToLoad(model_); diff --git a/browser/ui/views/bookmarks/brave_bookmark_context_menu_unittest.cc b/browser/ui/views/bookmarks/brave_bookmark_context_menu_unittest.cc index 415a5e0deabc..2821cd9cd158 100644 --- a/browser/ui/views/bookmarks/brave_bookmark_context_menu_unittest.cc +++ b/browser/ui/views/bookmarks/brave_bookmark_context_menu_unittest.cc @@ -14,6 +14,7 @@ #include "brave/browser/ui/bookmark/brave_bookmark_prefs.h" #include "brave/browser/ui/toolbar/brave_bookmark_context_menu_controller.h" #include "chrome/app/chrome_command_ids.h" +#include "chrome/browser/bookmarks/bookmark_merged_surface_service_factory.h" #include "chrome/browser/bookmarks/bookmark_model_factory.h" #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h" #include "chrome/browser/profiles/profile.h" @@ -43,6 +44,9 @@ class BraveBookmarkContextMenuTest : public testing::Test { profile_builder.AddTestingFactory( ManagedBookmarkServiceFactory::GetInstance(), ManagedBookmarkServiceFactory::GetDefaultFactory()); + profile_builder.AddTestingFactory( + BookmarkMergedSurfaceServiceFactory::GetInstance(), + BookmarkMergedSurfaceServiceFactory::GetDefaultFactory()); profile_ = profile_builder.Build(); model_ = BookmarkModelFactory::GetForBrowserContext(profile_.get()); diff --git a/browser/ui/views/brave_tab_search_bubble_host.cc b/browser/ui/views/brave_tab_search_bubble_host.cc index 0d901967a199..01c93f4068fd 100644 --- a/browser/ui/views/brave_tab_search_bubble_host.cc +++ b/browser/ui/views/brave_tab_search_bubble_host.cc @@ -17,9 +17,10 @@ void BraveTabSearchBubbleHost::SetBubbleArrow( bool BraveTabSearchBubbleHost::ShowTabSearchBubble( bool triggered_by_keyboard_shortcut, - int tab_index) { + tab_search::mojom::TabSearchSection section, + tab_search::mojom::TabOrganizationFeature organization_feature) { bool result = TabSearchBubbleHost::ShowTabSearchBubble( - triggered_by_keyboard_shortcut, tab_index); + triggered_by_keyboard_shortcut, section, organization_feature); if (!arrow_ || !result) { return result; } diff --git a/browser/ui/views/brave_tab_search_bubble_host.h b/browser/ui/views/brave_tab_search_bubble_host.h index 888bb89165b4..6dbf2e1e218d 100644 --- a/browser/ui/views/brave_tab_search_bubble_host.h +++ b/browser/ui/views/brave_tab_search_bubble_host.h @@ -18,8 +18,12 @@ class BraveTabSearchBubbleHost : public TabSearchBubbleHost { void SetBubbleArrow(views::BubbleBorder::Arrow arrow); // TabSearchBubbleHost: - bool ShowTabSearchBubble(bool triggered_by_keyboard_shortcut = false, - int tab_index = -1) override; + bool ShowTabSearchBubble( + bool triggered_by_keyboard_shortcut = false, + tab_search::mojom::TabSearchSection section = + tab_search::mojom::TabSearchSection::kNone, + tab_search::mojom::TabOrganizationFeature organization_feature = + tab_search::mojom::TabOrganizationFeature::kNone) override; private: std::optional arrow_; diff --git a/browser/ui/views/download/bubble/BUILD.gn b/browser/ui/views/download/bubble/BUILD.gn index 50d7baa06bd6..4e536d4c12a1 100644 --- a/browser/ui/views/download/bubble/BUILD.gn +++ b/browser/ui/views/download/bubble/BUILD.gn @@ -11,6 +11,7 @@ source_set("unit_tests") { deps = [ "//base", "//chrome/browser", + "//chrome/browser/download", "//chrome/test:test_support", "//components/download/public/common:test_support", "//components/safe_browsing/core/common", diff --git a/browser/ui/views/frame/brave_browser_view.cc b/browser/ui/views/frame/brave_browser_view.cc index 41045afdb238..b40c911bcb4a 100644 --- a/browser/ui/views/frame/brave_browser_view.cc +++ b/browser/ui/views/frame/brave_browser_view.cc @@ -783,10 +783,6 @@ void BraveBrowserView::WillShowSidePanel() { sidebar_container_view_->WillShowSidePanel(); } -void BraveBrowserView::WillDeregisterSidePanelEntry(SidePanelEntry* entry) { - sidebar_container_view_->WillDeregisterSidePanelEntry(entry); -} - void BraveBrowserView::NotifyDialogPositionRequiresUpdate() { GetBrowserViewLayout()->NotifyDialogPositionRequiresUpdate(); } diff --git a/browser/ui/views/frame/brave_browser_view.h b/browser/ui/views/frame/brave_browser_view.h index ed60dccbb57a..d85ffbc2f233 100644 --- a/browser/ui/views/frame/brave_browser_view.h +++ b/browser/ui/views/frame/brave_browser_view.h @@ -82,7 +82,6 @@ class BraveBrowserView : public BrowserView, WalletButton* GetWalletButton(); views::View* GetWalletButtonAnchorView(); void WillShowSidePanel(); - void WillDeregisterSidePanelEntry(SidePanelEntry* entry); // Triggers layout of web modal dialogs void NotifyDialogPositionRequiresUpdate(); diff --git a/browser/ui/views/frame/brave_non_client_hit_test_helper_browsertest.cc b/browser/ui/views/frame/brave_non_client_hit_test_helper_browsertest.cc index 6a53931ecf00..83e08c2dc7fd 100644 --- a/browser/ui/views/frame/brave_non_client_hit_test_helper_browsertest.cc +++ b/browser/ui/views/frame/brave_non_client_hit_test_helper_browsertest.cc @@ -17,7 +17,14 @@ using BraveNonClientHitTestHelperBrowserTest = InProcessBrowserTest; // TODO(sko) It might be good to have resizable area tests. But testing it // is pretty flaky depending on platforms. -IN_PROC_BROWSER_TEST_F(BraveNonClientHitTestHelperBrowserTest, Toolbar) { +// The test is failing on Linux CI in Chromium 131, but passes locally: +// https://github.com/brave/brave-browser/issues/41674 +#if BUILDFLAG(IS_LINUX) +#define MAYBE_Toolbar DISABLED_Toolbar +#else +#define MAYBE_Toolbar Toolbar +#endif // BUILDFLAG(IS_LINUX) +IN_PROC_BROWSER_TEST_F(BraveNonClientHitTestHelperBrowserTest, MAYBE_Toolbar) { auto* browser_view = static_cast(browser()->window()); auto* toolbar = browser_view->toolbar(); // Upstream has two more children |background_view_left_| and diff --git a/browser/ui/views/frame/vertical_tab_strip_region_view.cc b/browser/ui/views/frame/vertical_tab_strip_region_view.cc index ecebdd8fad11..d2832180a5ee 100644 --- a/browser/ui/views/frame/vertical_tab_strip_region_view.cc +++ b/browser/ui/views/frame/vertical_tab_strip_region_view.cc @@ -122,10 +122,14 @@ END_METADATA class VerticalTabSearchButton : public BraveTabSearchButton { METADATA_HEADER(VerticalTabSearchButton, BraveTabSearchButton) public: - VerticalTabSearchButton(VerticalTabStripRegionView* region_view, - TabStripController* tab_strip_controller, - Edge flat_edge) - : BraveTabSearchButton(tab_strip_controller, flat_edge) { + VerticalTabSearchButton( + VerticalTabStripRegionView* region_view, + TabStripController* tab_strip_controller, + tabs::TabDeclutterController* tab_declutter_controller, + Edge flat_edge) + : BraveTabSearchButton(tab_strip_controller, + tab_declutter_controller, + flat_edge) { SetPreferredSize( gfx::Size{ToggleButton::GetIconWidth(), ToggleButton::GetIconWidth()}); SetTooltipText(l10n_util::GetStringUTF16(IDS_TOOLTIP_TAB_SEARCH)); @@ -468,7 +472,11 @@ class VerticalTabStripRegionView::HeaderView : public views::View { // We layout the search button at the end, because there's no // way to change its bubble arrow from TOP_RIGHT at the moment. tab_search_button_ = AddChildView(std::make_unique( - region_view, region_view->tab_strip()->controller(), Edge::kNone)); + region_view, region_view->tab_strip()->controller(), + region_view_->browser() + ->browser_window_features() + ->tab_declutter_controller(), + Edge::kNone)); UpdateTabSearchButtonVisibility(); vertical_tab_on_right_.Init( diff --git a/browser/ui/views/side_panel/brave_side_panel.cc b/browser/ui/views/side_panel/brave_side_panel.cc index 0e5db9541f01..e83a2784f255 100644 --- a/browser/ui/views/side_panel/brave_side_panel.cc +++ b/browser/ui/views/side_panel/brave_side_panel.cc @@ -26,6 +26,33 @@ #include "ui/color/color_provider.h" #include "ui/views/background.h" #include "ui/views/border.h" +#include "ui/views/view_class_properties.h" + +namespace { + +// ContentParentView is the parent view for views hosted in the +// side panel. +class ContentParentView : public views::View { + METADATA_HEADER(ContentParentView, views::View) + + public: + ContentParentView() { + SetUseDefaultFillLayout(true); + SetBackground( + views::CreateThemedSolidBackground(kColorSidePanelBackground)); + SetProperty( + views::kFlexBehaviorKey, + views::FlexSpecification(views::MinimumFlexSizeRule::kScaleToZero, + views::MaximumFlexSizeRule::kUnbounded)); + } + + ~ContentParentView() override = default; +}; + +BEGIN_METADATA(ContentParentView) +END_METADATA + +} // namespace BraveSidePanel::BraveSidePanel(BrowserView* browser_view, HorizontalAlignment horizontal_alignment) @@ -50,12 +77,19 @@ BraveSidePanel::BraveSidePanel(BrowserView* browser_view, SetBackground( views::CreateThemedSolidBackground(kColorSidebarPanelHeaderBackground)); } + + content_parent_view_ = AddChildView(std::make_unique()); + content_parent_view_->SetVisible(false); } BraveSidePanel::~BraveSidePanel() { scoped_observation_.RemoveObservation(this); } +void BraveSidePanel::UpdateWidthOnEntryChanged() { + // Do nothing. +} + void BraveSidePanel::SetHorizontalAlignment(HorizontalAlignment alignment) { horizontal_alignment_ = alignment; UpdateBorder(); @@ -66,7 +100,7 @@ BraveSidePanel::HorizontalAlignment BraveSidePanel::GetHorizontalAlignment() { } bool BraveSidePanel::IsRightAligned() { - return horizontal_alignment_ == kAlignRight; + return horizontal_alignment_ == HorizontalAlignment::kRight; } void BraveSidePanel::UpdateBorder() { @@ -194,17 +228,21 @@ void BraveSidePanel::OnChildViewRemoved(View* observed_view, View* child) { } } -void BraveSidePanel::OnViewPropertyChanged(View* observed_view, - const void* key, - int64_t old_value) { - if (key == kSidePanelContentStateKey) { - SidePanelContentState new_value = static_cast( - observed_view->GetProperty(kSidePanelContentStateKey)); - if (new_value != static_cast(old_value)) { - SetVisible(new_value == SidePanelContentState::kReadyToShow || - new_value == SidePanelContentState::kShowImmediately); - } - } +void BraveSidePanel::Open(bool animated) { + UpdateVisibility(/*should_be_open=*/true); +} + +void BraveSidePanel::Close(bool animated) { + UpdateVisibility(/*should_be_open=*/false); +} + +void BraveSidePanel::UpdateVisibility(bool should_be_open) { + state_ = should_be_open ? State::kOpen : State::kClosed; + SetVisible(should_be_open); +} + +views::View* BraveSidePanel::GetContentParentView() { + return content_parent_view_; } BEGIN_METADATA(BraveSidePanel) diff --git a/browser/ui/views/side_panel/brave_side_panel.h b/browser/ui/views/side_panel/brave_side_panel.h index a39f084854b4..27f64e0cfaa0 100644 --- a/browser/ui/views/side_panel/brave_side_panel.h +++ b/browser/ui/views/side_panel/brave_side_panel.h @@ -35,35 +35,22 @@ class BraveSidePanel : public views::View, public views::ResizeAreaDelegate { METADATA_HEADER(BraveSidePanel, views::View) public: - // In the past we have been forced to rename these values, as this unscoped - // enum ends up colliding with SDK constants on MacOS builds. However as these - // constants are referred to in chromium code, renaming them causes a - // growing number of substitution overrides to be necessary across the - // codebase. As part of simplifying the overrides for this class, this - // particular shadow warning is disabled on this case alone, to permit this - // enum to be used here. -#if BUILDFLAG(IS_MAC) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wshadow" -#endif // BUILDFLAG(IS_MAC) // Determines the side from which the side panel will appear. // LTR / RTL conversions are handled in // BrowserViewLayout::LayoutSidePanelView. As such, left will always be on the // left side of the browser regardless of LTR / RTL mode. - enum HorizontalAlignment { kAlignLeft = 0, kAlignRight }; -#if BUILDFLAG(IS_MAC) -#pragma clang diagnostic pop -#endif // BUILDFLAG(IS_MAC) + enum class HorizontalAlignment { kLeft = 0, kRight }; // Same signature as chromium SidePanel - explicit BraveSidePanel(BrowserView* browser_view, - HorizontalAlignment horizontal_alignment = - HorizontalAlignment::kAlignLeft); + explicit BraveSidePanel( + BrowserView* browser_view, + HorizontalAlignment horizontal_alignment = HorizontalAlignment::kLeft); BraveSidePanel(const BraveSidePanel&) = delete; BraveSidePanel& operator=(const BraveSidePanel&) = delete; ~BraveSidePanel() override; void SetPanelWidth(int width); + void UpdateWidthOnEntryChanged(); double GetAnimationValue() const; void SetHorizontalAlignment(HorizontalAlignment alignment); HorizontalAlignment GetHorizontalAlignment(); @@ -86,17 +73,29 @@ class BraveSidePanel : public views::View, void AddedToWidget() override; void Layout(PassKey) override; + // Reflects the current state of the visibility of the side panel. + enum class State { kClosed, kOpening, kOpen, kClosing }; + State state() { return state_; } + + // These two methods are the only mechanism to change visibility of the side + // panel. `animated` is ignored in Brave entirely. + void Open(bool animated); + void Close(bool animated); + + // This is the parent view for the contents of the side panel. + views::View* GetContentParentView(); + void SetMinimumSidePanelContentsWidthForTesting(int width) {} private: friend class sidebar::SidebarBrowserTest; + // This method is the shared implementation of Open/Close. + void UpdateVisibility(bool should_be_open); + // views::ViewObserver: void OnChildViewAdded(View* observed_view, View* child) override; void OnChildViewRemoved(View* observed_view, View* child) override; - void OnViewPropertyChanged(View* observed_view, - const void* key, - int64_t old_value) override; void UpdateBorder(); void OnSidePanelWidthChanged(); @@ -106,7 +105,7 @@ class BraveSidePanel : public views::View, base::ScopedMultiSourceObservation scoped_observation_{ this}; - HorizontalAlignment horizontal_alignment_ = kAlignLeft; + HorizontalAlignment horizontal_alignment_ = HorizontalAlignment::kLeft; std::optional starting_width_on_resize_; // If this is set, use this width for panel contents during the layout @@ -118,6 +117,9 @@ class BraveSidePanel : public views::View, std::unique_ptr resize_widget_; std::unique_ptr shadow_; std::unique_ptr header_view_; + // Owned by `this` indirectly through the views tree. + raw_ptr content_parent_view_; + State state_ = State::kClosed; }; // Alias to the original `SidePanel` to the benefit of upstream code, as diff --git a/browser/ui/views/side_panel/brave_side_panel_coordinator.cc b/browser/ui/views/side_panel/brave_side_panel_coordinator.cc index 38d0c31cfefb..16295c36c53f 100644 --- a/browser/ui/views/side_panel/brave_side_panel_coordinator.cc +++ b/browser/ui/views/side_panel/brave_side_panel_coordinator.cc @@ -179,14 +179,3 @@ void BraveSidePanelCoordinator::NotifyPinnedContainerOfActiveStateChange( SidePanelCoordinator::NotifyPinnedContainerOfActiveStateChange(key, is_active); } - -void BraveSidePanelCoordinator::OnEntryWillDeregister( - SidePanelRegistry* registry, - SidePanelEntry* entry) { - SidePanelCoordinator::OnEntryWillDeregister(registry, entry); - - // This could give the opportunity to stop observing from |entry| if - // this deregister happens while tab is still live. - auto* brave_browser_view = static_cast(browser_view_); - brave_browser_view->WillDeregisterSidePanelEntry(entry); -} diff --git a/browser/ui/views/side_panel/brave_side_panel_coordinator.h b/browser/ui/views/side_panel/brave_side_panel_coordinator.h index 24347b804715..98fc1134fd4f 100644 --- a/browser/ui/views/side_panel/brave_side_panel_coordinator.h +++ b/browser/ui/views/side_panel/brave_side_panel_coordinator.h @@ -35,9 +35,6 @@ class BraveSidePanelCoordinator : public SidePanelCoordinator { const UniqueKey& unique_key, SidePanelEntry* entry, std::optional> content_view) override; - void OnEntryWillDeregister(SidePanelRegistry* registry, - SidePanelEntry* entry) override; - void NotifyPinnedContainerOfActiveStateChange(SidePanelEntryKey key, bool is_active) override; diff --git a/browser/ui/views/sidebar/sidebar_container_view.cc b/browser/ui/views/sidebar/sidebar_container_view.cc index d2aa2c3fffea..56a4b99506ab 100644 --- a/browser/ui/views/sidebar/sidebar_container_view.cc +++ b/browser/ui/views/sidebar/sidebar_container_view.cc @@ -164,9 +164,9 @@ void SidebarContainerView::SetSidebarOnLeft(bool sidebar_on_left) { sidebar_control_view_->SetSidebarOnLeft(sidebar_on_left_); DCHECK(side_panel_); - side_panel_->SetHorizontalAlignment(sidebar_on_left - ? BraveSidePanel::kAlignLeft - : BraveSidePanel::kAlignRight); + side_panel_->SetHorizontalAlignment( + sidebar_on_left ? BraveSidePanel::HorizontalAlignment::kLeft + : BraveSidePanel::HorizontalAlignment::kRight); GetEventDetectWidget()->SetSidebarOnLeft(sidebar_on_left_); } @@ -191,13 +191,6 @@ void SidebarContainerView::WillShowSidePanel() { } } -void SidebarContainerView::WillDeregisterSidePanelEntry(SidePanelEntry* entry) { - // If entry's life cycle is tied with tab, we stop observing from - // OnTabWillBeRemoved(). However, some entry could be deregistered while tab - // is live. In that case, we need to stop observing here explicitely. - StopObservingForEntry(entry); -} - bool SidebarContainerView::IsFullscreenForCurrentEntry() const { // For now, we only supports fullscreen from playlist. if (side_panel_coordinator_->GetCurrentEntryId() != @@ -809,6 +802,19 @@ void SidebarContainerView::OnEntryHidden(SidePanelEntry* entry) { } } +void SidebarContainerView::OnEntryWillHide(SidePanelEntry* entry, + SidePanelEntryHideReason reason) { + // If |entry| is panel is closed, we could deregister. And it'll be + // re-registered when panel is shown if that entry is still live in tab's + // registry. + // We only stop observing when |entry|'s panel is hidden by closing. + // If it's hidden by replacing with other panel, we shoudl not stop + // to know the timing that it's shown again. + if (reason == SidePanelEntryHideReason::kSidePanelClosed) { + StopObservingForEntry(entry); + } +} + void SidebarContainerView::OnTabWillBeRemoved(content::WebContents* contents, int index) { // At this time, we can stop observing as TabFeatures is available. diff --git a/browser/ui/views/sidebar/sidebar_container_view.h b/browser/ui/views/sidebar/sidebar_container_view.h index bac8d07555dc..c14b95343a34 100644 --- a/browser/ui/views/sidebar/sidebar_container_view.h +++ b/browser/ui/views/sidebar/sidebar_container_view.h @@ -79,7 +79,6 @@ class SidebarContainerView BraveSidePanel* side_panel() { return side_panel_; } void WillShowSidePanel(); - void WillDeregisterSidePanelEntry(SidePanelEntry* entry); bool IsFullscreenForCurrentEntry() const; void set_operation_from_active_tab_change(bool tab_change) { @@ -122,6 +121,8 @@ class SidebarContainerView // SidePanelEntryObserver: void OnEntryShown(SidePanelEntry* entry) override; void OnEntryHidden(SidePanelEntry* entry) override; + void OnEntryWillHide(SidePanelEntry* entry, + SidePanelEntryHideReason reason) override; // TabStripModelObserver: void OnTabStripModelChanged( diff --git a/browser/ui/views/tabs/brave_tab.cc b/browser/ui/views/tabs/brave_tab.cc index 309682b52b29..73aec7724d6f 100644 --- a/browser/ui/views/tabs/brave_tab.cc +++ b/browser/ui/views/tabs/brave_tab.cc @@ -208,6 +208,6 @@ void BraveTab::SetData(TabRendererData data) { if (data_changed && tabs::utils::ShouldShowVerticalTabs(controller()->GetBrowser()) && data_.pinned) { - set_group(std::nullopt); + SetGroup(std::nullopt); } } diff --git a/browser/ui/views/tabs/brave_tab_container.cc b/browser/ui/views/tabs/brave_tab_container.cc index 14bdc1636d1c..39a2cc3d7310 100644 --- a/browser/ui/views/tabs/brave_tab_container.cc +++ b/browser/ui/views/tabs/brave_tab_container.cc @@ -404,7 +404,7 @@ void BraveTabContainer::SetTabSlotVisibility() { for (Tab* tab : layout_helper_->GetTabs()) { if (std::optional group = tab->group(); group && !base::Contains(group_views_, *group)) { - tab->set_group(std::nullopt); + tab->SetGroup(std::nullopt); } } diff --git a/browser/ui/views/tabs/brave_tab_search_button.cc b/browser/ui/views/tabs/brave_tab_search_button.cc index 9615c81b44cd..803217b774ef 100644 --- a/browser/ui/views/tabs/brave_tab_search_button.cc +++ b/browser/ui/views/tabs/brave_tab_search_button.cc @@ -17,8 +17,11 @@ BraveTabSearchButton::BraveTabSearchButton( TabStripController* tab_strip_controller, + tabs::TabDeclutterController* tab_declutter_controller, Edge flat_edge) - : TabSearchButton(tab_strip_controller, flat_edge) { + : TabSearchButton(tab_strip_controller, + tab_declutter_controller, + flat_edge) { // Resetting the tab search bubble host first, to avoid a dangling in // `BraveTabSearchButton`, triggered `TabSearchBubbleHost` calling // `SetButtonController` and in the process destroying the still alive @@ -27,7 +30,7 @@ BraveTabSearchButton::BraveTabSearchButton( tab_search_bubble_host_ = nullptr; tab_search_bubble_host_ = std::make_unique( - this, tab_strip_controller->GetProfile()); + this, tab_declutter_controller, tab_strip_controller->GetProfile()); // Apply toolbar's icon color to search button. SetForegroundFrameActiveColorId(kColorToolbarButtonIcon); diff --git a/browser/ui/views/tabs/brave_tab_search_button.h b/browser/ui/views/tabs/brave_tab_search_button.h index 2da029ee3b1b..bd7c65d33375 100644 --- a/browser/ui/views/tabs/brave_tab_search_button.h +++ b/browser/ui/views/tabs/brave_tab_search_button.h @@ -13,9 +13,10 @@ class BraveTabSearchButton : public TabSearchButton { METADATA_HEADER(BraveTabSearchButton, TabSearchButton) public: - - explicit BraveTabSearchButton(TabStripController* tab_strip_controller, - Edge flat_edge); + explicit BraveTabSearchButton( + TabStripController* tab_strip_controller, + tabs::TabDeclutterController* tab_declutter_controller, + Edge flat_edge); ~BraveTabSearchButton() override; BraveTabSearchButton(const BraveTabSearchButton&) = delete; BraveTabSearchButton& operator=(const BraveTabSearchButton&) = delete; diff --git a/browser/ui/views/tabs/brave_tab_strip.cc b/browser/ui/views/tabs/brave_tab_strip.cc index 0f81a05e3070..dbdb7b2ac568 100644 --- a/browser/ui/views/tabs/brave_tab_strip.cc +++ b/browser/ui/views/tabs/brave_tab_strip.cc @@ -328,7 +328,7 @@ void BraveTabStrip::UpdateTabContainer() { auto* tab = original_container->GetTabAtModelIndex(i); // At this point, we don't have group views in the container. So before // restoring groups, clears group for tabs. - tab->set_group(std::nullopt); + tab->SetGroup(std::nullopt); tab_container_->AddTab( tab->parent()->RemoveChildViewT(tab), i, tab->data().pinned ? TabPinned::kPinned : TabPinned::kUnpinned); diff --git a/browser/ui/webui/brave_settings_ui.cc b/browser/ui/webui/brave_settings_ui.cc index d12c29315c44..c81298d8861d 100644 --- a/browser/ui/webui/brave_settings_ui.cc +++ b/browser/ui/webui/brave_settings_ui.cc @@ -93,9 +93,7 @@ using ntp_background_images::ViewCounterServiceFactory; -BraveSettingsUI::BraveSettingsUI(content::WebUI* web_ui, - const std::string& host) - : SettingsUI(web_ui) { +BraveSettingsUI::BraveSettingsUI(content::WebUI* web_ui) : SettingsUI(web_ui) { web_ui->AddMessageHandler( std::make_unique()); web_ui->AddMessageHandler(std::make_unique()); diff --git a/browser/ui/webui/brave_settings_ui.h b/browser/ui/webui/brave_settings_ui.h index ad9c3ae17e19..7f85e9f01e14 100644 --- a/browser/ui/webui/brave_settings_ui.h +++ b/browser/ui/webui/brave_settings_ui.h @@ -6,22 +6,29 @@ #ifndef BRAVE_BROWSER_UI_WEBUI_BRAVE_SETTINGS_UI_H_ #define BRAVE_BROWSER_UI_WEBUI_BRAVE_SETTINGS_UI_H_ -#include -#include - #include "brave/components/ai_chat/core/common/mojom/settings_helper.mojom.h" #include "brave/components/commands/common/commands.mojom.h" #include "chrome/browser/ui/webui/settings/settings_ui.h" +class BraveSettingsUI; + namespace content { class WebUIDataSource; } class Profile; +class BraveSettingsUIConfig + : public content::DefaultWebUIConfig { + public: + BraveSettingsUIConfig() + : DefaultWebUIConfig(content::kChromeUIScheme, + chrome::kChromeUISettingsHost) {} +}; + class BraveSettingsUI : public settings::SettingsUI { public: - BraveSettingsUI(content::WebUI* web_ui, const std::string& host); + explicit BraveSettingsUI(content::WebUI* web_ui); BraveSettingsUI(const BraveSettingsUI&) = delete; BraveSettingsUI& operator=(const BraveSettingsUI&) = delete; ~BraveSettingsUI() override; diff --git a/browser/ui/webui/brave_web_ui_controller_factory.cc b/browser/ui/webui/brave_web_ui_controller_factory.cc index dd7e8c39c815..c8de293a8d1b 100644 --- a/browser/ui/webui/brave_web_ui_controller_factory.cc +++ b/browser/ui/webui/brave_web_ui_controller_factory.cc @@ -40,10 +40,8 @@ #if !BUILDFLAG(IS_ANDROID) #include "brave/browser/brave_wallet/brave_wallet_context_utils.h" #include "brave/browser/ui/webui/brave_news_internals/brave_news_internals_ui.h" -#include "brave/browser/ui/webui/brave_settings_ui.h" #include "brave/browser/ui/webui/brave_wallet/wallet_page_ui.h" #include "brave/browser/ui/webui/new_tab_page/brave_new_tab_ui.h" -#include "brave/browser/ui/webui/private_new_tab_page/brave_private_new_tab_ui.h" #include "brave/browser/ui/webui/welcome_page/brave_welcome_ui.h" #include "brave/components/brave_news/common/features.h" #include "brave/components/brave_wallet/browser/brave_wallet_utils.h" @@ -132,13 +130,9 @@ WebUIController* NewWebUI(WebUI* web_ui, const GURL& url) { return new BraveNewsInternalsUI(web_ui, url.host()); } else if (host == kWelcomeHost && !profile->IsGuestSession()) { return new BraveWelcomeUI(web_ui, url.host()); - } else if (host == chrome::kChromeUISettingsHost) { - return new BraveSettingsUI(web_ui, url.host()); } else if (host == chrome::kChromeUINewTabHost) { - if (profile->IsIncognitoProfile() || profile->IsTor() || - profile->IsGuestSession()) { - return new BravePrivateNewTabUI(web_ui, url.host()); - } + DCHECK(!profile->IsIncognitoProfile() && !profile->IsTor() && + !profile->IsGuestSession()); return new BraveNewTabUI(web_ui, url.host()); #endif // !BUILDFLAG(IS_ANDROID) #if BUILDFLAG(ENABLE_TOR) diff --git a/browser/ui/webui/private_new_tab_page/brave_private_new_tab_ui.cc b/browser/ui/webui/private_new_tab_page/brave_private_new_tab_ui.cc index a721f82e1ecf..84d88f7252a5 100644 --- a/browser/ui/webui/private_new_tab_page/brave_private_new_tab_ui.cc +++ b/browser/ui/webui/private_new_tab_page/brave_private_new_tab_ui.cc @@ -19,8 +19,14 @@ #include "components/strings/grit/components_strings.h" #include "content/public/browser/web_ui_data_source.h" -BravePrivateNewTabUI::BravePrivateNewTabUI(content::WebUI* web_ui, - const std::string& name) +bool BravePrivateNewTabUIConfig::IsWebUIEnabled( + content::BrowserContext* browser_context) { + Profile* profile = Profile::FromBrowserContext(browser_context); + return profile->IsIncognitoProfile() || profile->IsTor() || + profile->IsGuestSession(); +} + +BravePrivateNewTabUI::BravePrivateNewTabUI(content::WebUI* web_ui) : ui::MojoWebUIController(web_ui, false) { Profile* profile = Profile::FromWebUI(web_ui); @@ -28,7 +34,7 @@ BravePrivateNewTabUI::BravePrivateNewTabUI(content::WebUI* web_ui, brave_l10n::GetLocalizedResourceUTF16String(IDS_NEW_INCOGNITO_TAB_TITLE)); content::WebUIDataSource* source = CreateAndAddWebUIDataSource( - web_ui, name, kBravePrivateNewTabGenerated, + web_ui, chrome::kChromeUINewTabHost, kBravePrivateNewTabGenerated, kBravePrivateNewTabGeneratedSize, IDR_BRAVE_PRIVATE_NEW_TAB_HTML); for (const auto& str : brave_private_new_tab::kLocalizedStrings) { diff --git a/browser/ui/webui/private_new_tab_page/brave_private_new_tab_ui.h b/browser/ui/webui/private_new_tab_page/brave_private_new_tab_ui.h index 39bbc1c33140..bad185e8c6f4 100644 --- a/browser/ui/webui/private_new_tab_page/brave_private_new_tab_ui.h +++ b/browser/ui/webui/private_new_tab_page/brave_private_new_tab_ui.h @@ -10,13 +10,29 @@ #include #include "brave/components/brave_private_new_tab_ui/common/brave_private_new_tab.mojom-forward.h" +#include "chrome/common/webui_url_constants.h" #include "content/public/browser/web_ui_controller.h" +#include "content/public/browser/webui_config.h" +#include "content/public/common/url_constants.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "ui/webui/mojo_web_ui_controller.h" +class BravePrivateNewTabUI; + +class BravePrivateNewTabUIConfig + : public content::DefaultWebUIConfig { + public: + BravePrivateNewTabUIConfig() + : DefaultWebUIConfig(content::kChromeUIScheme, + chrome::kChromeUINewTabHost) {} + + // content::WebUIConfig: + bool IsWebUIEnabled(content::BrowserContext* browser_context) override; +}; + class BravePrivateNewTabUI : public ui::MojoWebUIController { public: - BravePrivateNewTabUI(content::WebUI* web_ui, const std::string& name); + explicit BravePrivateNewTabUI(content::WebUI* web_ui); ~BravePrivateNewTabUI() override; BravePrivateNewTabUI(const BravePrivateNewTabUI&) = delete; BravePrivateNewTabUI& operator=(const BravePrivateNewTabUI&) = delete; diff --git a/browser/url_sanitizer/url_sanitizer_service_factory.cc b/browser/url_sanitizer/url_sanitizer_service_factory.cc index ac54fade185d..e8aebeae506c 100644 --- a/browser/url_sanitizer/url_sanitizer_service_factory.cc +++ b/browser/url_sanitizer/url_sanitizer_service_factory.cc @@ -66,7 +66,7 @@ bool URLSanitizerServiceFactory::ServiceIsNULLWhileTesting() const { content::BrowserContext* URLSanitizerServiceFactory::GetBrowserContextToUse( content::BrowserContext* context) const { - return chrome::GetBrowserContextRedirectedInIncognito(context); + return GetBrowserContextRedirectedInIncognito(context); } } // namespace brave diff --git a/browser/widevine/BUILD.gn b/browser/widevine/BUILD.gn index 2aa7eb2d74da..bbcafc92aee6 100644 --- a/browser/widevine/BUILD.gn +++ b/browser/widevine/BUILD.gn @@ -126,6 +126,7 @@ source_set("browser_tests") { "//components/component_updater", "//components/permissions", "//components/prefs", + "//components/update_client", "//ui/views", "//url", ] diff --git a/browser/widevine/widevine_permission_request_browsertest.cc b/browser/widevine/widevine_permission_request_browsertest.cc index a417409d0ed2..d369974f3551 100644 --- a/browser/widevine/widevine_permission_request_browsertest.cc +++ b/browser/widevine/widevine_permission_request_browsertest.cc @@ -3,11 +3,12 @@ * 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/. */ +#include "brave/browser/widevine/widevine_permission_request.h" + #include #include "base/path_service.h" #include "brave/browser/brave_drm_tab_helper.h" -#include "brave/browser/widevine/widevine_permission_request.h" #include "brave/browser/widevine/widevine_utils.h" #include "brave/components/constants/brave_paths.h" #include "brave/components/constants/pref_names.h" @@ -24,6 +25,7 @@ #include "chrome/test/base/ui_test_utils.h" #include "chrome/test/permissions/permission_request_manager_test_api.h" #include "components/prefs/pref_service.h" +#include "components/update_client/crx_update_item.h" #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test.h" #include "content/public/test/browser_test_utils.h" @@ -189,9 +191,10 @@ IN_PROC_BROWSER_TEST_F(WidevinePermissionRequestBrowserTest, content::RunAllTasksUntilIdle(); WidevinePermissionRequest::is_test_ = true; - GetBraveDrmTabHelper()->OnEvent(component_updater::ComponentUpdateService:: - Observer ::Events::COMPONENT_UPDATED, - kWidevineComponentId); + update_client::CrxUpdateItem item; + item.id = kWidevineComponentId; + item.state = update_client::ComponentState::kUpdated; + GetBraveDrmTabHelper()->OnEvent(item); content::RunAllTasksUntilIdle(); // Check two permission bubble are created. diff --git a/build/android/bytecode/BUILD.gn b/build/android/bytecode/BUILD.gn index bee93c788d76..f4dea27c3044 100644 --- a/build/android/bytecode/BUILD.gn +++ b/build/android/bytecode/BUILD.gn @@ -59,7 +59,6 @@ java_binary("java_bytecode_rewriter") { "//brave/build/android/bytecode/java/org/brave/bytecode/BraveIntentHandlerClassAdapter.java", "//brave/build/android/bytecode/java/org/brave/bytecode/BraveLaunchIntentDispatcherClassAdapter.java", "//brave/build/android/bytecode/java/org/brave/bytecode/BraveLauncherActivityClassAdapter.java", - "//brave/build/android/bytecode/java/org/brave/bytecode/BraveLocaleManagerDelegateImplClassAdapter.java", "//brave/build/android/bytecode/java/org/brave/bytecode/BraveLocationBarCoordinatorClassAdapter.java", "//brave/build/android/bytecode/java/org/brave/bytecode/BraveLocationBarLayoutClassAdapter.java", "//brave/build/android/bytecode/java/org/brave/bytecode/BraveLocationBarMediatorClassAdapter.java", diff --git a/build/android/bytecode/bytecode_rewriter.gni b/build/android/bytecode/bytecode_rewriter.gni index c16d429fa78f..5664f90f71c3 100644 --- a/build/android/bytecode/bytecode_rewriter.gni +++ b/build/android/bytecode/bytecode_rewriter.gni @@ -11,7 +11,7 @@ brave_bytecode_jars = [ "obj/brave/android/features/tab_ui/java.javac.jar", "obj/brave/android/java/org/chromium/chrome/browser/search_engines/java.javac.jar", "obj/brave/browser/notifications/java.javac.jar", - "obj/brave/browser/tab_group/java.javac.jar", + "obj/brave/browser/tabmodel/android/java.javac.jar", "obj/brave/browser/ui/android/logo/java.javac.jar", "obj/brave/browser/ui/android/omnibox/java.javac.jar", "obj/brave/browser/ui/android/theme/java.javac.jar", @@ -35,7 +35,7 @@ brave_bytecode_jars = [ "obj/chrome/browser/settings/factory_java.javac.jar", "obj/chrome/browser/settings/internal_java.javac.jar", "obj/chrome/browser/site_settings/android/java.javac.jar", - "obj/chrome/browser/tab_group/java.javac.jar", + "obj/chrome/browser/tabmodel/java.javac.jar", "obj/chrome/browser/tab_ui/android/java.javac.jar", "obj/chrome/browser/ui/android/appmenu/internal/java.javac.jar", "obj/chrome/browser/ui/android/logo/java.javac.jar", diff --git a/build/android/bytecode/java/org/brave/bytecode/BraveAppHooksClassAdapter.java b/build/android/bytecode/java/org/brave/bytecode/BraveAppHooksClassAdapter.java index 8c7da2603a81..90844345ffd3 100644 --- a/build/android/bytecode/java/org/brave/bytecode/BraveAppHooksClassAdapter.java +++ b/build/android/bytecode/java/org/brave/bytecode/BraveAppHooksClassAdapter.java @@ -8,7 +8,7 @@ import org.objectweb.asm.ClassVisitor; public class BraveAppHooksClassAdapter extends BraveClassVisitor { - static String sAppHooksClassName = "org/chromium/chrome/browser/AppHooksImpl"; + static String sAppHooksClassName = "org/chromium/chrome/browser/AppHooks"; static String sBraveAppHooksClassName = "org/chromium/chrome/browser/BraveAppHooks"; public BraveAppHooksClassAdapter(ClassVisitor visitor) { diff --git a/build/android/bytecode/java/org/brave/bytecode/BraveCachedFlagClassAdapter.java b/build/android/bytecode/java/org/brave/bytecode/BraveCachedFlagClassAdapter.java index 866fa559e5a4..31c473f76b20 100644 --- a/build/android/bytecode/java/org/brave/bytecode/BraveCachedFlagClassAdapter.java +++ b/build/android/bytecode/java/org/brave/bytecode/BraveCachedFlagClassAdapter.java @@ -8,8 +8,9 @@ import org.objectweb.asm.ClassVisitor; public class BraveCachedFlagClassAdapter extends BraveClassVisitor { - static String sCachedFlagClassName = "org/chromium/base/cached_flags/CachedFlag"; - static String sBraveCachedFlagClassName = "org/chromium/base/cached_flags/BraveCachedFlag"; + static String sCachedFlagClassName = "org/chromium/components/cached_flags/CachedFlag"; + static String sBraveCachedFlagClassName = + "org/chromium/components/cached_flags/BraveCachedFlag"; public BraveCachedFlagClassAdapter(ClassVisitor visitor) { super(visitor); diff --git a/build/android/bytecode/java/org/brave/bytecode/BraveClassAdapter.java b/build/android/bytecode/java/org/brave/bytecode/BraveClassAdapter.java index 27f277588314..f1125b39c2ab 100644 --- a/build/android/bytecode/java/org/brave/bytecode/BraveClassAdapter.java +++ b/build/android/bytecode/java/org/brave/bytecode/BraveClassAdapter.java @@ -58,7 +58,6 @@ public static ClassVisitor createAdapter(ClassVisitor chain) { chain = new BraveIntentHandlerClassAdapter(chain); chain = new BraveLauncherActivityClassAdapter(chain); chain = new BraveLaunchIntentDispatcherClassAdapter(chain); - chain = new BraveLocaleManagerDelegateImplClassAdapter(chain); chain = new BraveLocationBarCoordinatorClassAdapter(chain); chain = new BraveLocationBarLayoutClassAdapter(chain); chain = new BraveLocationBarMediatorClassAdapter(chain); diff --git a/build/android/bytecode/java/org/brave/bytecode/BraveClassVisitor.java b/build/android/bytecode/java/org/brave/bytecode/BraveClassVisitor.java index 571134c1ee29..ca1eecdb4c0d 100644 --- a/build/android/bytecode/java/org/brave/bytecode/BraveClassVisitor.java +++ b/build/android/bytecode/java/org/brave/bytecode/BraveClassVisitor.java @@ -30,7 +30,7 @@ class BraveClassVisitor extends ClassVisitor { private ClassVisitor mTarget; - class Method { + static class Method { public int access; public String name; public String desc; @@ -510,7 +510,13 @@ protected ClassNode process(ClassNode source) { } for (String annotation : annotations) { method.visibleAnnotations.add(new AnnotationNode(annotation)); - System.out.println("add " + annotation + " annotation to " + method.name + " in " + source.name); + System.out.println( + "add " + + annotation + + " annotation to " + + method.name + + " in " + + source.name); } } } diff --git a/build/android/bytecode/java/org/brave/bytecode/BraveCustomizationProviderDelegateImplClassAdapter.java b/build/android/bytecode/java/org/brave/bytecode/BraveCustomizationProviderDelegateImplClassAdapter.java index b2da654d489b..10529487de09 100644 --- a/build/android/bytecode/java/org/brave/bytecode/BraveCustomizationProviderDelegateImplClassAdapter.java +++ b/build/android/bytecode/java/org/brave/bytecode/BraveCustomizationProviderDelegateImplClassAdapter.java @@ -9,7 +9,7 @@ public class BraveCustomizationProviderDelegateImplClassAdapter extends BraveClassVisitor { static String sCustomizationProviderDelegateImplClassName = - "org/chromium/chrome/browser/partnercustomizations/CustomizationProviderDelegateImpl"; + "org/chromium/chrome/browser/partnercustomizations/CustomizationProviderDelegateUpstreamImpl"; static String sBraveCustomizationProviderDelegateImplClassName = "org/chromium/chrome/browser/partnercustomizations/BraveCustomizationProviderDelegateImpl"; diff --git a/build/android/bytecode/java/org/brave/bytecode/BraveLocaleManagerDelegateImplClassAdapter.java b/build/android/bytecode/java/org/brave/bytecode/BraveLocaleManagerDelegateImplClassAdapter.java deleted file mode 100644 index 047fc0c1344b..000000000000 --- a/build/android/bytecode/java/org/brave/bytecode/BraveLocaleManagerDelegateImplClassAdapter.java +++ /dev/null @@ -1,21 +0,0 @@ -/* Copyright (c) 2024 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 https://mozilla.org/MPL/2.0/. */ - -package org.brave.bytecode; - -import org.objectweb.asm.ClassVisitor; - -public class BraveLocaleManagerDelegateImplClassAdapter extends BraveClassVisitor { - static String sLocaleManagerDelegateImpl = - "org/chromium/components/language/LocaleManagerDelegateImpl"; - static String sBraveLocaleManagerDelegateImpl = - "org/chromium/components/language/BraveLocaleManagerDelegateImpl"; - - public BraveLocaleManagerDelegateImplClassAdapter(ClassVisitor visitor) { - super(visitor); - - redirectConstructor(sLocaleManagerDelegateImpl, sBraveLocaleManagerDelegateImpl); - } -} diff --git a/build/android/bytecode/java/org/brave/bytecode/BravePasswordSettingsBaseClassAdapter.java b/build/android/bytecode/java/org/brave/bytecode/BravePasswordSettingsBaseClassAdapter.java index bb6cc2e40238..40d0c2636b0f 100644 --- a/build/android/bytecode/java/org/brave/bytecode/BravePasswordSettingsBaseClassAdapter.java +++ b/build/android/bytecode/java/org/brave/bytecode/BravePasswordSettingsBaseClassAdapter.java @@ -18,8 +18,12 @@ public BravePasswordSettingsBaseClassAdapter(ClassVisitor visitor) { changeSuperName(sPasswordSettingsClassName, sBravePasswordSettingsBaseClassName); - changeMethodOwner(sPasswordSettingsClassName, "createCheckPasswords", + changeMethodOwner( + sPasswordSettingsClassName, + "createCheckPasswords", sBravePasswordSettingsBaseClassName); deleteMethod(sPasswordSettingsClassName, "createCheckPasswords"); + + deleteField(sPasswordSettingsClassName, "mMenu"); } } diff --git a/build/android/bytecode/java/org/brave/bytecode/BraveSettingsLauncherImplClassAdapter.java b/build/android/bytecode/java/org/brave/bytecode/BraveSettingsLauncherImplClassAdapter.java index 982b6e0ad6ce..e9b89dcbe148 100644 --- a/build/android/bytecode/java/org/brave/bytecode/BraveSettingsLauncherImplClassAdapter.java +++ b/build/android/bytecode/java/org/brave/bytecode/BraveSettingsLauncherImplClassAdapter.java @@ -8,14 +8,14 @@ import org.objectweb.asm.ClassVisitor; public class BraveSettingsLauncherImplClassAdapter extends BraveClassVisitor { - static String sSettingsLauncherImplClassName = - "org/chromium/chrome/browser/settings/SettingsLauncherImpl"; + static String sSettingsNavigationImplClassName = + "org/chromium/chrome/browser/settings/SettingsNavigationImpl"; static String sBraveSettingsLauncherImplClassName = "org/chromium/chrome/browser/settings/BraveSettingsLauncherImpl"; public BraveSettingsLauncherImplClassAdapter(ClassVisitor visitor) { super(visitor); - redirectConstructor(sSettingsLauncherImplClassName, sBraveSettingsLauncherImplClassName); + redirectConstructor(sSettingsNavigationImplClassName, sBraveSettingsLauncherImplClassName); } } diff --git a/build/android/bytecode/java/org/brave/bytecode/BraveTabGroupModelFilterClassAdapter.java b/build/android/bytecode/java/org/brave/bytecode/BraveTabGroupModelFilterClassAdapter.java index c2b4a038eefc..16afd6ec9285 100644 --- a/build/android/bytecode/java/org/brave/bytecode/BraveTabGroupModelFilterClassAdapter.java +++ b/build/android/bytecode/java/org/brave/bytecode/BraveTabGroupModelFilterClassAdapter.java @@ -9,9 +9,9 @@ public class BraveTabGroupModelFilterClassAdapter extends BraveClassVisitor { static String sTabGroupModelFilterClassName = - "org/chromium/chrome/browser/tasks/tab_groups/TabGroupModelFilter"; + "org/chromium/chrome/browser/tabmodel/TabGroupModelFilterImpl"; static String sBraveTabGroupModelFilterClassName = - "org/chromium/chrome/browser/tasks/tab_groups/BraveTabGroupModelFilter"; + "org/chromium/chrome/browser/tabmodel/BraveTabGroupModelFilter"; public BraveTabGroupModelFilterClassAdapter(ClassVisitor visitor) { super(visitor); diff --git a/build/android/config.gni b/build/android/config.gni index 1303360c1b89..0a70bd366515 100644 --- a/build/android/config.gni +++ b/build/android/config.gni @@ -26,7 +26,7 @@ brave_chrome_java_deps = [ "//brave/browser/notifications/android:brave_java", "//brave/browser/notifications/android:java", "//brave/browser/safe_browsing/android/java/src/org/chromium/chrome/browser/safe_browsing/settings:java", - "//brave/browser/tab_group:java", + "//brave/browser/tabmodel/android:java", "//brave/browser/ui/android/logo:java", "//brave/browser/ui/android/omnibox:java", "//brave/browser/ui/android/theme:java", diff --git a/build/commands/lib/util.js b/build/commands/lib/util.js index 6b539ca9f011..0402903be8d2 100644 --- a/build/commands/lib/util.js +++ b/build/commands/lib/util.js @@ -450,8 +450,8 @@ const util = { const androidResTemplateDest = path.join(config.srcDir, 'chrome', 'android', 'java', 'res_template') const androidContentPublicResSource = path.join(config.braveCoreDir, 'content', 'public', 'android', 'java', 'res') const androidContentPublicResDest = path.join(config.srcDir, 'content', 'public', 'android', 'java', 'res') - const androidTouchtoFillResSource = path.join(config.braveCoreDir, 'browser', 'touch_to_fill', 'android', 'internal', 'java', 'res') - const androidTouchtoFillResDest = path.join(config.srcDir, 'chrome', 'browser', 'touch_to_fill', 'android', 'internal', 'java', 'res') + const androidTouchtoFillResSource = path.join(config.braveCoreDir, 'browser', 'touch_to_fill', 'password_manager', 'android', 'internal', 'java', 'res') + const androidTouchtoFillResDest = path.join(config.srcDir, 'chrome', 'browser', 'touch_to_fill', 'password_manager', 'android', 'internal', 'java', 'res') const androidToolbarResSource = path.join(config.braveCoreDir, 'browser', 'ui', 'android', 'toolbar', 'java', 'res') const androidToolbarResDest = path.join(config.srcDir, 'chrome', 'browser', 'ui', 'android', 'toolbar', 'java', 'res') const androidComponentsWidgetResSource = path.join(config.braveCoreDir, 'components', 'browser_ui', 'widget', 'android', 'java', 'res') diff --git a/build/mac/download_hermetic_xcode.py b/build/mac/download_hermetic_xcode.py index 43f5092816ed..839aec19c464 100755 --- a/build/mac/download_hermetic_xcode.py +++ b/build/mac/download_hermetic_xcode.py @@ -22,11 +22,11 @@ def LoadPList(path): return plistlib.load(f) # This contains binaries from Xcode 14.3, along with the macOS 13.3 SDK -XCODE_VERSION = '15.0' +XCODE_VERSION = '16.0' HERMETIC_XCODE_BINARY = ( DEPS_PACKAGES_INTERNAL_URL + '/xcode-hermetic-toolchain/xcode-hermetic-toolchain-xcode-' + - XCODE_VERSION + '-sdk-14.0-13.3.tar.gz') + XCODE_VERSION + '-sdk-15.0-14.0.tar.gz') # The toolchain will not be downloaded if the minimum OS version is not met. 19 # is the major version number for macOS 10.15. Xcode 13.2 13C90 only runs on diff --git a/chromium_src/chrome/browser/browser_features.cc b/chromium_src/chrome/browser/browser_features.cc index 2c55d0e19f61..cea197d71be2 100644 --- a/chromium_src/chrome/browser/browser_features.cc +++ b/chromium_src/chrome/browser/browser_features.cc @@ -15,7 +15,6 @@ OVERRIDE_FEATURE_DEFAULT_STATES({{ {kBookmarkTriggerForPrerender2, base::FEATURE_DISABLED_BY_DEFAULT}, {kDestroyProfileOnBrowserClose, base::FEATURE_DISABLED_BY_DEFAULT}, - {kDevToolsConsoleInsights, base::FEATURE_DISABLED_BY_DEFAULT}, // Google has asked embedders not to enforce these pins: // https://groups.google.com/a/chromium.org/g/embedder-dev/c/XsNTwEiN1lI/m/TMXh-ZvOAAAJ {kKeyPinningComponentUpdater, base::FEATURE_DISABLED_BY_DEFAULT}, diff --git a/chromium_src/chrome/browser/content_settings/generated_notification_pref_unittest.cc b/chromium_src/chrome/browser/content_settings/generated_notification_pref_unittest.cc deleted file mode 100644 index 51141b0c51d5..000000000000 --- a/chromium_src/chrome/browser/content_settings/generated_notification_pref_unittest.cc +++ /dev/null @@ -1,14 +0,0 @@ -/* Copyright (c) 2024 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 https://mozilla.org/MPL/2.0/. */ - -#include "chrome/browser/content_settings/generated_notification_pref.h" - -#define kTpcdGrant \ - kRemoteList: \ - case SettingSource::kTpcdGrant - -#include "src/chrome/browser/content_settings/generated_notification_pref_unittest.cc" - -#undef kTpcdGrant diff --git a/chromium_src/chrome/browser/devtools/features.cc b/chromium_src/chrome/browser/devtools/features.cc new file mode 100644 index 000000000000..20147feb52a8 --- /dev/null +++ b/chromium_src/chrome/browser/devtools/features.cc @@ -0,0 +1,17 @@ +/* Copyright (c) 2022 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 https://mozilla.org/MPL/2.0/. */ + +#include "src/chrome/browser/devtools/features.cc" + +#include "base/feature_override.h" + +namespace features { +OVERRIDE_FEATURE_DEFAULT_STATES({{ +#if !BUILDFLAG(IS_ANDROID) + {kDevToolsConsoleInsights, base::FEATURE_DISABLED_BY_DEFAULT}, +#endif // !BUILDFLAG(IS_ANDROID) +}}); + +} // namespace features diff --git a/chromium_src/chrome/browser/metrics/chrome_metrics_services_manager_client.cc b/chromium_src/chrome/browser/metrics/chrome_metrics_services_manager_client.cc deleted file mode 100644 index 54467a30e3a6..000000000000 --- a/chromium_src/chrome/browser/metrics/chrome_metrics_services_manager_client.cc +++ /dev/null @@ -1,14 +0,0 @@ -/* Copyright (c) 2020 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/. */ - -#include "chrome/browser/metrics/chrome_metrics_services_manager_client.h" - -#define IsMetricsReportingEnabled IsMetricsReportingEnabled_ChromiumImpl -#include "src/chrome/browser/metrics/chrome_metrics_services_manager_client.cc" -#undef IsMetricsReportingEnabled - -bool ChromeMetricsServicesManagerClient::IsMetricsReportingEnabled() { - return false; -} diff --git a/chromium_src/chrome/browser/metrics/chrome_metrics_services_manager_client.h b/chromium_src/chrome/browser/metrics/chrome_metrics_services_manager_client.h deleted file mode 100644 index e037c880d2fb..000000000000 --- a/chromium_src/chrome/browser/metrics/chrome_metrics_services_manager_client.h +++ /dev/null @@ -1,16 +0,0 @@ -/* Copyright (c) 2020 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/. */ - -#ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICES_MANAGER_CLIENT_H_ -#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICES_MANAGER_CLIENT_H_ - -#include "components/metrics_services_manager/metrics_services_manager_client.h" - -#define IsMetricsReportingEnabled IsMetricsReportingEnabled_ChromiumImpl(); \ - virtual bool IsMetricsReportingEnabled -#include "src/chrome/browser/metrics/chrome_metrics_services_manager_client.h" // IWYU pragma: export -#undef IsMetricsReportingEnabled - -#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICES_MANAGER_CLIENT_H_ diff --git a/chromium_src/chrome/browser/page_load_metrics/page_load_metrics_initialize.cc b/chromium_src/chrome/browser/page_load_metrics/page_load_metrics_initialize.cc index 18b794cfc43e..eb1127cee6e0 100644 --- a/chromium_src/chrome/browser/page_load_metrics/page_load_metrics_initialize.cc +++ b/chromium_src/chrome/browser/page_load_metrics/page_load_metrics_initialize.cc @@ -24,8 +24,8 @@ class BravePageLoadMetricsEmbedder : public chrome::PageLoadMetricsEmbedder { protected: // page_load_metrics::PageLoadMetricsEmbedderBase: - void RegisterEmbedderObservers( - ::page_load_metrics::PageLoadTracker* tracker) override; + void RegisterObservers(page_load_metrics::PageLoadTracker* tracker, + content::NavigationHandle* navigation_handle) override; }; BravePageLoadMetricsEmbedder::BravePageLoadMetricsEmbedder( @@ -34,9 +34,10 @@ BravePageLoadMetricsEmbedder::BravePageLoadMetricsEmbedder( BravePageLoadMetricsEmbedder::~BravePageLoadMetricsEmbedder() = default; -void BravePageLoadMetricsEmbedder::RegisterEmbedderObservers( - page_load_metrics::PageLoadTracker* tracker) { - PageLoadMetricsEmbedder::RegisterEmbedderObservers(tracker); +void BravePageLoadMetricsEmbedder::RegisterObservers( + page_load_metrics::PageLoadTracker* tracker, + content::NavigationHandle* navigation_handle) { + PageLoadMetricsEmbedder::RegisterObservers(tracker, navigation_handle); tracker->AddObserver( std::make_unique< diff --git a/chromium_src/chrome/browser/search_engine_choice/search_engine_choice_service_factory.cc b/chromium_src/chrome/browser/search_engine_choice/search_engine_choice_service_factory.cc index dd984b0c5688..a089a2c343ce 100644 --- a/chromium_src/chrome/browser/search_engine_choice/search_engine_choice_service_factory.cc +++ b/chromium_src/chrome/browser/search_engine_choice/search_engine_choice_service_factory.cc @@ -15,7 +15,7 @@ content::BrowserContext* SearchEngineChoiceServiceFactory::GetBrowserContextToUse( content::BrowserContext* context) const { // To make different service for normal and incognito profile. - return chrome::GetBrowserContextOwnInstanceInIncognito(context); + return GetBrowserContextOwnInstanceInIncognito(context); } } // namespace search_engines diff --git a/chromium_src/chrome/browser/search_engines/template_url_service_factory.cc b/chromium_src/chrome/browser/search_engines/template_url_service_factory.cc index d7a7c79dfd53..2109af99907e 100644 --- a/chromium_src/chrome/browser/search_engines/template_url_service_factory.cc +++ b/chromium_src/chrome/browser/search_engines/template_url_service_factory.cc @@ -13,5 +13,5 @@ content::BrowserContext* TemplateURLServiceFactory::GetBrowserContextToUse( content::BrowserContext* context) const { // To make different service for normal and incognito profile. - return chrome::GetBrowserContextOwnInstanceInIncognito(context); + return GetBrowserContextOwnInstanceInIncognito(context); } diff --git a/chromium_src/chrome/browser/signin/account_consistency_disabled_unittest.cc b/chromium_src/chrome/browser/signin/account_consistency_disabled_unittest.cc index c36cabae3085..1aecb07862dc 100644 --- a/chromium_src/chrome/browser/signin/account_consistency_disabled_unittest.cc +++ b/chromium_src/chrome/browser/signin/account_consistency_disabled_unittest.cc @@ -3,8 +3,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "chrome/browser/signin/account_consistency_mode_manager.h" - #include #include @@ -12,6 +10,8 @@ #include "build/buildflag.h" #include "chrome/browser/prefs/browser_prefs.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/signin/account_consistency_mode_manager.h" +#include "chrome/browser/signin/account_consistency_mode_manager_factory.h" #include "chrome/test/base/testing_profile.h" #include "components/prefs/pref_notifier_impl.h" #include "components/prefs/testing_pref_store.h" @@ -75,7 +75,7 @@ TEST(AccountConsistencyDisabledTest, DiceFixAuthErrorsForAllProfiles) { EXPECT_FALSE(AccountConsistencyModeManager::IsDiceEnabledForProfile( incognito_profile)); EXPECT_FALSE( - AccountConsistencyModeManager::GetForProfile(incognito_profile)); + AccountConsistencyModeManagerFactory::GetForProfile(incognito_profile)); EXPECT_EQ( signin::AccountConsistencyMethod::kDisabled, AccountConsistencyModeManager::GetMethodForProfile(incognito_profile)); diff --git a/chromium_src/chrome/browser/android/signin/signin_manager_android.cc b/chromium_src/chrome/browser/signin/android/signin_manager_android.cc similarity index 84% rename from chromium_src/chrome/browser/android/signin/signin_manager_android.cc rename to chromium_src/chrome/browser/signin/android/signin_manager_android.cc index 28f5b2f953ea..2573e6dae173 100644 --- a/chromium_src/chrome/browser/android/signin/signin_manager_android.cc +++ b/chromium_src/chrome/browser/signin/android/signin_manager_android.cc @@ -1,9 +1,9 @@ /* Copyright (c) 2019 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/. */ + * You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "chrome/browser/android/signin/signin_manager_android.h" +#include "chrome/browser/signin/android/signin_manager_android.h" #include "base/android/callback_android.h" #include "base/android/jni_string.h" @@ -24,6 +24,6 @@ class UnusedClass { #define Java_SigninManagerImpl_create Java_BraveSigninManager_create #define Java_SigninManagerImpl_destroy Java_BraveSigninManager_destroy -#include "src/chrome/browser/android/signin/signin_manager_android.cc" +#include "src/chrome/browser/signin/android/signin_manager_android.cc" #undef Java_SigninManagerImpl_create #undef Java_SigninManagerImpl_destroy diff --git a/chromium_src/chrome/browser/ui/tabs/public/tab_features.h b/chromium_src/chrome/browser/ui/tabs/public/tab_features.h index e66118843258..f6e6a39aad69 100644 --- a/chromium_src/chrome/browser/ui/tabs/public/tab_features.h +++ b/chromium_src/chrome/browser/ui/tabs/public/tab_features.h @@ -6,9 +6,7 @@ #ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_TABS_PUBLIC_TAB_FEATURES_H_ #define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_TABS_PUBLIC_TAB_FEATURES_H_ -// Prevent PRESUBMIT from complaining about including an std header but not -// using std:: in the file: no-std-usage-because-pch-file -#include // vector->locale->ios has an Init. +#include "base/callback_list.h" #define Init(...) \ Init_ChromiumImpl(__VA_ARGS__); \ diff --git a/chromium_src/chrome/browser/ui/toolbar/app_menu_model.cc b/chromium_src/chrome/browser/ui/toolbar/app_menu_model.cc index 609f1745d1a9..f8dd972f2939 100644 --- a/chromium_src/chrome/browser/ui/toolbar/app_menu_model.cc +++ b/chromium_src/chrome/browser/ui/toolbar/app_menu_model.cc @@ -3,6 +3,8 @@ * 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/. */ +#include "chrome/browser/ui/toolbar/app_menu_model.h" + #include "brave/browser/ui/toolbar/brave_bookmark_sub_menu_model.h" #include "brave/browser/ui/toolbar/brave_recent_tabs_sub_menu_model.h" #include "brave/grit/brave_generated_resources.h" diff --git a/chromium_src/chrome/browser/ui/views/infobars/infobar_view.h b/chromium_src/chrome/browser/ui/views/infobars/infobar_view.h index 73a0ff740376..dfd27013beb2 100644 --- a/chromium_src/chrome/browser/ui/views/infobars/infobar_view.h +++ b/chromium_src/chrome/browser/ui/views/infobars/infobar_view.h @@ -10,16 +10,13 @@ #include "ui/views/focus/external_focus_tracker.h" #include "ui/views/view.h" -#define GetAccessibleNodeData \ - GetAccessibleNodeData_Unused() {} \ +#define CloseButtonPressed \ + CloseButtonPressed_Unused() {} \ friend class BraveConfirmInfoBar; \ - void GetAccessibleNodeData - -#define CloseButtonPressed virtual CloseButtonPressed + virtual void CloseButtonPressed #include "src/chrome/browser/ui/views/infobars/infobar_view.h" // IWYU pragma: export #undef CloseButtonPressed -#undef GetAccessibleNodeData #endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_ diff --git a/chromium_src/chrome/browser/ui/views/omnibox/omnibox_result_view.cc b/chromium_src/chrome/browser/ui/views/omnibox/omnibox_result_view.cc index f77711c50ff7..aa69e61143ab 100644 --- a/chromium_src/chrome/browser/ui/views/omnibox/omnibox_result_view.cc +++ b/chromium_src/chrome/browser/ui/views/omnibox/omnibox_result_view.cc @@ -5,11 +5,24 @@ #include "chrome/browser/ui/views/omnibox/omnibox_result_view.h" +#include "chrome/browser/ui/views/location_bar/location_bar_view.h" #include "ui/views/background.h" #define CreateThemedRoundedRectBackground(...) \ CreateThemedRoundedRectBackground(GetOmniboxBackgroundColorId(part_state), 0) +// For some reason since a recent change the unused variable warning started +// being triggered for `radii`. It is unfortunate that just tagging +// `[[maybe_unused]]` after the type is not allowed, so a dummy is necesary that +// can be ignored in a less than conventional way, and then the type can be +// tagged as `[[maybe_unused]]`. +#define radii \ + dummy = {}; \ + if (!dummy.IsEmpty()) { \ + } \ + [[maybe_unused]] gfx::RoundedCornersF radii + #include "src/chrome/browser/ui/views/omnibox/omnibox_result_view.cc" #undef CreateThemedRoundedRectBackground +#undef radii diff --git a/chromium_src/chrome/browser/ui/views/side_panel/search_companion/companion_page_browsertest.cc b/chromium_src/chrome/browser/ui/views/side_panel/search_companion/companion_page_browsertest.cc deleted file mode 100644 index e2d7b4dcb41c..000000000000 --- a/chromium_src/chrome/browser/ui/views/side_panel/search_companion/companion_page_browsertest.cc +++ /dev/null @@ -1,15 +0,0 @@ -/* Copyright (c) 2023 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 https://mozilla.org/MPL/2.0/. */ - -#include "net/base/features.h" - -#include "base/test/scoped_feature_list.h" - -#define InitWithFeaturesAndParameters(A, B) \ - InitWithFeaturesAndParameters(A, {net::features::kBraveHttpsByDefault}) - -#include "src/chrome/browser/ui/views/side_panel/search_companion/companion_page_browsertest.cc" - -#undef InitWithFeaturesAndParameters diff --git a/chromium_src/chrome/browser/ui/webui/chrome_web_ui_configs.cc b/chromium_src/chrome/browser/ui/webui/chrome_web_ui_configs.cc index a1aee4e5d00f..5e8d8fba744c 100644 --- a/chromium_src/chrome/browser/ui/webui/chrome_web_ui_configs.cc +++ b/chromium_src/chrome/browser/ui/webui/chrome_web_ui_configs.cc @@ -16,23 +16,49 @@ #include "brave/browser/ui/webui/brave_rewards/rewards_page_top_ui.h" #include "brave/browser/ui/webui/brave_rewards/rewards_panel_ui.h" #include "brave/browser/ui/webui/brave_rewards/tip_panel_ui.h" +#include "brave/browser/ui/webui/brave_settings_ui.h" #include "brave/browser/ui/webui/brave_shields/cookie_list_opt_in_ui.h" #include "brave/browser/ui/webui/brave_shields/shields_panel_ui.h" #include "brave/browser/ui/webui/brave_wallet/wallet_panel_ui.h" +#include "brave/browser/ui/webui/private_new_tab_page/brave_private_new_tab_ui.h" #include "brave/browser/ui/webui/speedreader/speedreader_toolbar_ui.h" #include "brave/browser/ui/webui/webcompat_reporter/webcompat_reporter_ui.h" #endif // !BUILDFLAG(IS_ANDROID) #include "brave/browser/ui/webui/brave_adblock_internals_ui.h" #include "brave/browser/ui/webui/brave_adblock_ui.h" +namespace { + +#if !BUILDFLAG(IS_ANDROID) +const GURL GetWebUIConfigURL(const char* scheme, const char* host) { + return GURL(base::StrCat({scheme, url::kStandardSchemeSeparator, host})); +} +#endif // !BUILDFLAG(IS_ANDROID) + +void RemoveOverridenWebUIs(content::WebUIConfigMap& map) { +#if !BUILDFLAG(IS_ANDROID) + // NewTabUIConfig (overriden with BravePrivateNewTabUIConfig) + map.RemoveConfig( + GetWebUIConfigURL(content::kChromeUIScheme, chrome::kChromeUINewTabHost)); + // SettingsUIConfig (overriden with BraveSettingsUIConfig) + map.RemoveConfig(GetWebUIConfigURL(content::kChromeUIScheme, + chrome::kChromeUISettingsHost)); +#endif // !BUILDFLAG(IS_ANDROID) +} + +} // namespace + void RegisterChromeWebUIConfigs() { RegisterChromeWebUIConfigs_ChromiumImpl(); auto& map = content::WebUIConfigMap::GetInstance(); + RemoveOverridenWebUIs(map); #if !BUILDFLAG(IS_ANDROID) map.AddWebUIConfig(std::make_unique()); map.AddWebUIConfig(std::make_unique()); map.AddWebUIConfig(std::make_unique()); + map.AddWebUIConfig(std::make_unique()); + map.AddWebUIConfig(std::make_unique()); map.AddWebUIConfig(std::make_unique()); map.AddWebUIConfig(std::make_unique()); map.AddWebUIConfig(std::make_unique()); diff --git a/chromium_src/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chromium_src/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc index da49f0fa81ea..7cb75d1c60ed 100644 --- a/chromium_src/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc +++ b/chromium_src/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc @@ -5,6 +5,7 @@ #include "brave/browser/ui/webui/brave_web_ui_controller_factory.h" #include "build/chromeos_buildflags.h" +#include "chrome/browser/web_applications/web_app_provider.h" // NOLINTNEXTLINE #define CHROME_BROWSER_WEB_APPLICATIONS_SYSTEM_WEB_APPS_SYSTEM_WEB_APP_MANAGER_H_ diff --git a/chromium_src/chrome/browser/ui/webui/help/version_updater_mac.mm b/chromium_src/chrome/browser/ui/webui/help/version_updater_mac.mm index 18921ba6505d..a24008cd2203 100644 --- a/chromium_src/chrome/browser/ui/webui/help/version_updater_mac.mm +++ b/chromium_src/chrome/browser/ui/webui/help/version_updater_mac.mm @@ -11,6 +11,7 @@ #include "base/memory/ptr_util.h" #include "base/memory/raw_ptr.h" #include "base/strings/escape.h" +#include "base/strings/stringprintf.h" #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" #include "brave/browser/mac/keystone_glue.h" diff --git a/chromium_src/chrome/common/companion/visual_query/features.cc b/chromium_src/chrome/common/companion/visual_query/features.cc deleted file mode 100644 index 15aca1776ecb..000000000000 --- a/chromium_src/chrome/common/companion/visual_query/features.cc +++ /dev/null @@ -1,16 +0,0 @@ -/* Copyright (c) 2023 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 https://mozilla.org/MPL/2.0/. */ - -#include "src/chrome/common/companion/visual_query/features.cc" - -#include "base/feature_override.h" - -namespace companion::visual_query::features { - -OVERRIDE_FEATURE_DEFAULT_STATES({{ - {kVisualQuerySuggestions, base::FEATURE_DISABLED_BY_DEFAULT}, -}}); - -} // namespace companion::visual_query::features diff --git a/chromium_src/chrome/common/profiler/thread_profiler_configuration.cc b/chromium_src/chrome/common/profiler/thread_profiler_configuration.cc index 2b130ae66815..c6065b7da5ab 100644 --- a/chromium_src/chrome/common/profiler/thread_profiler_configuration.cc +++ b/chromium_src/chrome/common/profiler/thread_profiler_configuration.cc @@ -13,6 +13,6 @@ #undef IsProfilerEnabledForCurrentProcessAndThread bool ThreadProfilerConfiguration::IsProfilerEnabledForCurrentProcessAndThread( - base::ProfilerThreadType thread) const { + sampling_profiler::ProfilerThreadType thread) const { return false; } diff --git a/chromium_src/chrome/common/url_constants.h b/chromium_src/chrome/common/url_constants.h index b0629f8d892a..b51d12647f5d 100644 --- a/chromium_src/chrome/common/url_constants.h +++ b/chromium_src/chrome/common/url_constants.h @@ -418,6 +418,19 @@ inline constexpr char kHistorySearchLearnMorePageURL[] = inline constexpr char16_t kHistorySearchSettingURL[] = u"chrome://settings/historySearch"; +// The URL for the Settings page to enable history search when +// AiSettingsPageRefresh flag is enabled. +inline constexpr char16_t kHistorySearchV2SettingURL[] = + u"chrome://settings/ai/historySearch"; + +// The URL for the "Learn more" page for Wallpaper Search. +inline constexpr char kWallpaperSearchLearnMorePageURL[] = + "https://support.brave.com/"; + +// The URL for the "Learn more" page for Tab Organization. +inline constexpr char kTabOrganizationLearnMorePageURL[] = + "https://support.brave.com/"; + // The URL for the "Learn more" link in the enterprise disclaimer for managed // profile in the Signin Intercept bubble. inline constexpr char kSigninInterceptManagedDisclaimerLearnMoreURL[] = @@ -457,6 +470,10 @@ inline constexpr char16_t kCwsEnhancedSafeBrowsingLearnMoreURL[] = inline constexpr char kPrivacyPolicyOnlineURLPath[] = "https://support.brave.com/"; +// The URL path to online privacy policy dark mode. +inline constexpr char kPrivacyPolicyOnlineDarkModeURLPath[] = + "https://support.brave.com/"; + #if BUILDFLAG(IS_ANDROID) // "Learn more" URL for the enhanced playback notification dialog. inline constexpr char kEnhancedPlaybackNotificationLearnMoreURL[] = diff --git a/chromium_src/chrome/elevation_service/elevator.cc b/chromium_src/chrome/elevation_service/elevator.cc index abb3793108dc..6e067a5faac6 100644 --- a/chromium_src/chrome/elevation_service/elevator.cc +++ b/chromium_src/chrome/elevation_service/elevator.cc @@ -6,13 +6,14 @@ #include "chrome/elevation_service/elevator.h" #include -#include #include +#include #include "base/path_service.h" #include "base/win/windows_types.h" #include "brave/components/brave_vpn/common/buildflags/buildflags.h" +#include "third_party/abseil-cpp/absl/cleanup/cleanup.h" #if BUILDFLAG(ENABLE_BRAVE_VPN) #include "brave/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_utils.h" diff --git a/chromium_src/chrome/install_static/brave_install_util_unittest.cc b/chromium_src/chrome/install_static/brave_install_util_unittest.cc index 170390f1ac4f..7e656fa3e2b5 100644 --- a/chromium_src/chrome/install_static/brave_install_util_unittest.cc +++ b/chromium_src/chrome/install_static/brave_install_util_unittest.cc @@ -25,65 +25,63 @@ #include "testing/gtest/include/gtest/gtest.h" using ::testing::ElementsAre; +using ::testing::Eq; +using ::testing::Optional; using ::testing::StrCaseEq; using version_info::Channel; namespace install_static { -// Tests the install_static::GetSwitchValueFromCommandLine function. -TEST(InstallStaticTest, GetSwitchValueFromCommandLineTest) { +TEST(InstallStaticTest, GetCommandLineSwitchTestTest) { // Simple case with one switch. - std::wstring value = - GetSwitchValueFromCommandLine(L"c:\\temp\\bleh.exe --type=bar", L"type"); - EXPECT_EQ(L"bar", value); + std::optional opt = + GetCommandLineSwitch(L"c:\\temp\\bleh.exe --type=bar", L"type"); + EXPECT_THAT(opt, Optional(std::wstring(L"bar"))); // Multiple switches with trailing spaces between them. - value = GetSwitchValueFromCommandLine( - L"c:\\temp\\bleh.exe --type=bar --abc=def bleh", L"abc"); - EXPECT_EQ(L"def", value); + opt = GetCommandLineSwitch(L"c:\\temp\\bleh.exe --type=bar --abc=def bleh", + L"abc"); + EXPECT_THAT(opt, Optional(std::wstring(L"def"))); // Multiple switches with trailing spaces and tabs between them. - value = GetSwitchValueFromCommandLine( + opt = GetCommandLineSwitch( L"c:\\temp\\bleh.exe --type=bar \t\t\t --abc=def bleh", L"abc"); - EXPECT_EQ(L"def", value); + EXPECT_THAT(opt, Optional(std::wstring(L"def"))); // Non existent switch. - value = GetSwitchValueFromCommandLine( - L"c:\\temp\\bleh.exe --foo=bar --abc=def bleh", L"type"); - EXPECT_EQ(L"", value); + opt = GetCommandLineSwitch(L"c:\\temp\\bleh.exe --foo=bar --abc=def bleh", + L"type"); + EXPECT_THAT(opt, std::nullopt); // Non existent switch. - value = GetSwitchValueFromCommandLine(L"c:\\temp\\bleh.exe", L"type"); - EXPECT_EQ(L"", value); + opt = GetCommandLineSwitch(L"c:\\temp\\bleh.exe", L"type"); + EXPECT_THAT(opt, std::nullopt); // Non existent switch. - value = - GetSwitchValueFromCommandLine(L"c:\\temp\\bleh.exe type=bar", L"type"); - EXPECT_EQ(L"", value); + opt = GetCommandLineSwitch(L"c:\\temp\\bleh.exe type=bar", L"type"); + EXPECT_THAT(opt, std::nullopt); // Trailing spaces after the switch. - value = GetSwitchValueFromCommandLine( - L"c:\\temp\\bleh.exe --type=bar \t\t", L"type"); - EXPECT_EQ(L"bar", value); + opt = + GetCommandLineSwitch(L"c:\\temp\\bleh.exe --type=bar \t\t", L"type"); + EXPECT_THAT(opt, Optional(std::wstring(L"bar"))); // Multiple switches with trailing spaces and tabs between them. - value = GetSwitchValueFromCommandLine( + opt = GetCommandLineSwitch( L"c:\\temp\\bleh.exe --type=bar \t\t --foo=bleh", L"foo"); - EXPECT_EQ(L"bleh", value); + EXPECT_THAT(opt, Optional(std::wstring(L"bleh"))); // Nothing after a switch. - value = GetSwitchValueFromCommandLine(L"c:\\temp\\bleh.exe --type=", L"type"); - EXPECT_TRUE(value.empty()); + opt = GetCommandLineSwitch(L"c:\\temp\\bleh.exe --type=", L"type"); + EXPECT_THAT(opt, Optional(std::wstring())); // Whitespace after a switch. - value = - GetSwitchValueFromCommandLine(L"c:\\temp\\bleh.exe --type= ", L"type"); - EXPECT_TRUE(value.empty()); + opt = GetCommandLineSwitch(L"c:\\temp\\bleh.exe --type= ", L"type"); + EXPECT_THAT(opt, Optional(std::wstring())); // Just tabs after a switch. - value = GetSwitchValueFromCommandLine(L"c:\\temp\\bleh.exe --type=\t\t\t", - L"type"); - EXPECT_TRUE(value.empty()); + opt = GetCommandLineSwitch(L"c:\\temp\\bleh.exe --type=\t\t\t", L"type"); + EXPECT_THAT(opt, Optional(std::wstring())); } TEST(InstallStaticTest, SpacesAndQuotesInCommandLineArguments) { diff --git a/chromium_src/chrome/install_static/brave_user_data_dir_win_unittest.cc b/chromium_src/chrome/install_static/brave_user_data_dir_win_unittest.cc index 011d6196d605..310d1b34ee59 100644 --- a/chromium_src/chrome/install_static/brave_user_data_dir_win_unittest.cc +++ b/chromium_src/chrome/install_static/brave_user_data_dir_win_unittest.cc @@ -54,8 +54,14 @@ class ScopedNTRegistryTestingOverride { TEST(UserDataDir, EmptyResultsInDefault) { std::wstring result, invalid; - install_static::GetUserDataDirectoryImpl(L"", kFakeInstallConstants, &result, - &invalid); + install_static::GetUserDataDirectoryImpl(L"brave.exe", kFakeInstallConstants, + &result, &invalid); + EXPECT_TRUE(EndsWith(result, kUserDataDirNameSuffix)); + EXPECT_EQ(std::wstring(), invalid); + + result = L""; + install_static::GetUserDataDirectoryImpl( + L"brave.exe --user-data-dir=", kFakeInstallConstants, &result, &invalid); EXPECT_TRUE(EndsWith(result, kUserDataDirNameSuffix)); EXPECT_EQ(std::wstring(), invalid); } @@ -63,8 +69,9 @@ TEST(UserDataDir, EmptyResultsInDefault) { TEST(UserDataDir, InvalidResultsInDefault) { std::wstring result, invalid; - install_static::GetUserDataDirectoryImpl(L"<>|:", kFakeInstallConstants, - &result, &invalid); + install_static::GetUserDataDirectoryImpl(L"brave.exe --user-data-dir=<>|:", + kFakeInstallConstants, &result, + &invalid); EXPECT_TRUE(EndsWith(result, kUserDataDirNameSuffix)); EXPECT_EQ(L"<>|:", invalid); } @@ -84,8 +91,9 @@ TEST(UserDataDir, RegistrySettingsInHKLMOverrides) { LONG rv = key.WriteValue(kUserDataDirRegistryKey, L"yyy"); ASSERT_EQ(rv, ERROR_SUCCESS); - install_static::GetUserDataDirectoryImpl(L"xxx", kFakeInstallConstants, - &result, &invalid); + install_static::GetUserDataDirectoryImpl(L"brave.exe --user-data-dir=xxx", + kFakeInstallConstants, &result, + &invalid); EXPECT_TRUE(EndsWith(result, L"\\yyy")); EXPECT_EQ(std::wstring(), invalid); @@ -106,8 +114,9 @@ TEST(UserDataDir, RegistrySettingsInHKCUOverrides) { LONG rv = key.WriteValue(kUserDataDirRegistryKey, L"yyy"); ASSERT_EQ(rv, ERROR_SUCCESS); - install_static::GetUserDataDirectoryImpl(L"xxx", kFakeInstallConstants, - &result, &invalid); + install_static::GetUserDataDirectoryImpl(L"brave.exe --user-data-dir=xxx", + kFakeInstallConstants, &result, + &invalid); EXPECT_TRUE(EndsWith(result, L"\\yyy")); EXPECT_EQ(std::wstring(), invalid); @@ -135,8 +144,9 @@ TEST(UserDataDir, RegistrySettingsInHKLMTakesPrecedenceOverHKCU) { rv = key2.WriteValue(kUserDataDirRegistryKey, L"222"); ASSERT_EQ(rv, ERROR_SUCCESS); - install_static::GetUserDataDirectoryImpl(L"xxx", kFakeInstallConstants, - &result, &invalid); + install_static::GetUserDataDirectoryImpl(L"brave.exe --user-data-dir=xxx", + kFakeInstallConstants, &result, + &invalid); EXPECT_TRUE(EndsWith(result, L"\\111")); EXPECT_EQ(std::wstring(), invalid); @@ -154,8 +164,9 @@ TEST(UserDataDir, RegistrySettingWithPathExpansionHKCU) { LONG rv = key.WriteValue(kUserDataDirRegistryKey, L"${windows}"); ASSERT_EQ(rv, ERROR_SUCCESS); - install_static::GetUserDataDirectoryImpl(L"xxx", kFakeInstallConstants, - &result, &invalid); + install_static::GetUserDataDirectoryImpl(L"brave.exe --user-data-dir=xxx", + kFakeInstallConstants, &result, + &invalid); EXPECT_EQ(strlen("X:\\WINDOWS"), result.size()); EXPECT_EQ(std::wstring::npos, result.find(L"${windows}")); diff --git a/chromium_src/chrome/renderer/chrome_content_renderer_client.cc b/chromium_src/chrome/renderer/chrome_content_renderer_client.cc index 2af32e0644cc..09e020080ff1 100644 --- a/chromium_src/chrome/renderer/chrome_content_renderer_client.cc +++ b/chromium_src/chrome/renderer/chrome_content_renderer_client.cc @@ -29,7 +29,7 @@ void RenderFrameWithBinderRegistryCreated( service_manager::BinderRegistry* registry) { new feed::RssLinkReader(render_frame, registry); #if BUILDFLAG(ENABLE_AI_CHAT) - if (ai_chat::features::IsAIChatEnabled() && !chrome::IsIncognitoProcess()) { + if (ai_chat::features::IsAIChatEnabled() && !IsIncognitoProcess()) { new ai_chat::PageContentExtractor(render_frame, registry, content::ISOLATED_WORLD_ID_GLOBAL, ISOLATED_WORLD_ID_BRAVE_INTERNAL); diff --git a/chromium_src/components/content_settings/core/browser/cookie_settings.cc b/chromium_src/components/content_settings/core/browser/cookie_settings.cc index eb958ed97595..1718ceff64b7 100644 --- a/chromium_src/components/content_settings/core/browser/cookie_settings.cc +++ b/chromium_src/components/content_settings/core/browser/cookie_settings.cc @@ -28,7 +28,7 @@ void CookieSettings::ShutdownOnUIThread() { bool CookieSettings::ShouldUseEphemeralStorage( const url::Origin& origin, const net::SiteForCookies& site_for_cookies, - const std::optional& top_frame_origin, + base::optional_ref top_frame_origin, url::Origin& storage_origin) { const bool should_use = CookieSettingsBase::ShouldUseEphemeralStorage( origin.GetURL(), site_for_cookies, top_frame_origin); diff --git a/chromium_src/components/content_settings/core/browser/cookie_settings.h b/chromium_src/components/content_settings/core/browser/cookie_settings.h index 57dbb5feaaf1..d082b11df363 100644 --- a/chromium_src/components/content_settings/core/browser/cookie_settings.h +++ b/chromium_src/components/content_settings/core/browser/cookie_settings.h @@ -20,7 +20,7 @@ ShutdownOnUIThread_ChromiumImpl(); \ bool ShouldUseEphemeralStorage( \ const url::Origin& origin, const net::SiteForCookies& site_for_cookies, \ - const std::optional& top_frame_origin, \ + base::optional_ref top_frame_origin, \ url::Origin& storage_origin); \ std::vector TakeEphemeralStorageOpaqueOrigins( \ const std::string& ephemeral_storage_domain); \ diff --git a/chromium_src/components/content_settings/core/common/cookie_settings_base.cc b/chromium_src/components/content_settings/core/common/cookie_settings_base.cc index 93cd3aea32aa..52cba9f9b7e0 100644 --- a/chromium_src/components/content_settings/core/common/cookie_settings_base.cc +++ b/chromium_src/components/content_settings/core/common/cookie_settings_base.cc @@ -78,12 +78,12 @@ CookieSettingsBase::~CookieSettingsBase() = default; bool CookieSettingsBase::ShouldUseEphemeralStorage( const GURL& url, const net::SiteForCookies& site_for_cookies, - const std::optional& top_frame_origin) const { + base::optional_ref top_frame_origin) const { if (!base::FeatureList::IsEnabled(net::features::kBraveEphemeralStorage)) return false; const GURL first_party_url = - GetFirstPartyURL(site_for_cookies, base::OptionalToPtr(top_frame_origin)); + GetFirstPartyURL(site_for_cookies, top_frame_origin.as_ptr()); if (!first_party_url.is_valid()) return false; @@ -121,7 +121,7 @@ bool CookieSettingsBase::ShouldUseEphemeralStorage( bool CookieSettingsBase::IsEphemeralCookieAccessAllowed( const GURL& url, const net::SiteForCookies& site_for_cookies, - const std::optional& top_frame_origin, + base::optional_ref top_frame_origin, net::CookieSettingOverrides overrides) const { if (ShouldUseEphemeralStorage(url, site_for_cookies, top_frame_origin)) { return true; @@ -134,7 +134,7 @@ bool CookieSettingsBase::IsEphemeralCookieAccessAllowed( bool CookieSettingsBase::IsFullCookieAccessAllowed( const GURL& url, const net::SiteForCookies& site_for_cookies, - const std::optional& top_frame_origin, + base::optional_ref top_frame_origin, net::CookieSettingOverrides overrides, CookieSettingWithMetadata* cookie_settings) const { bool allow = IsFullCookieAccessAllowed_ChromiumImpl( @@ -147,7 +147,7 @@ bool CookieSettingsBase::IsFullCookieAccessAllowed( return true; const GURL first_party_url = - GetFirstPartyURL(site_for_cookies, base::OptionalToPtr(top_frame_origin)); + GetFirstPartyURL(site_for_cookies, top_frame_origin.as_ptr()); // Determine whether a main frame is ephemeral or Shields are down. // This is required to properly handle main and nested frames depending on the diff --git a/chromium_src/components/content_settings/core/common/cookie_settings_base.h b/chromium_src/components/content_settings/core/common/cookie_settings_base.h index bd46af9aba83..faf6e1c85e81 100644 --- a/chromium_src/components/content_settings/core/common/cookie_settings_base.h +++ b/chromium_src/components/content_settings/core/common/cookie_settings_base.h @@ -13,14 +13,14 @@ #define IsCookieSessionOnly \ ShouldUseEphemeralStorage( \ const GURL& url, const net::SiteForCookies& site_for_cookies, \ - const std::optional& top_frame_origin) const; \ + base::optional_ref top_frame_origin) const; \ bool IsEphemeralCookieAccessAllowed( \ const GURL& url, const net::SiteForCookies& site_for_cookies, \ - const std::optional& top_frame_origin, \ + base::optional_ref top_frame_origin, \ net::CookieSettingOverrides overrides) const; \ bool IsFullCookieAccessAllowed_ChromiumImpl( \ const GURL& url, const net::SiteForCookies& site_for_cookies, \ - const std::optional& top_frame_origin, \ + base::optional_ref top_frame_origin, \ net::CookieSettingOverrides overrides, \ CookieSettingWithMetadata* cookie_settings = nullptr) const; \ bool ShouldBlockThirdPartyIfSettingIsExplicit( \ diff --git a/chromium_src/components/omnibox/common/omnibox_features.cc b/chromium_src/components/omnibox/common/omnibox_features.cc index b431b757817a..80e7762ebc00 100644 --- a/chromium_src/components/omnibox/common/omnibox_features.cc +++ b/chromium_src/components/omnibox/common/omnibox_features.cc @@ -12,10 +12,7 @@ namespace omnibox { OVERRIDE_FEATURE_DEFAULT_STATES({{ {kDocumentProviderNoSetting, base::FEATURE_DISABLED_BY_DEFAULT}, {kDocumentProviderNoSyncRequirement, base::FEATURE_DISABLED_BY_DEFAULT}, - {kExpandedStateHeight, base::FEATURE_DISABLED_BY_DEFAULT}, - {kExpandedStateShape, base::FEATURE_DISABLED_BY_DEFAULT}, {kMlUrlScoring, base::FEATURE_DISABLED_BY_DEFAULT}, - {kOmniboxSteadyStateHeight, base::FEATURE_DISABLED_BY_DEFAULT}, #if BUILDFLAG(IS_ANDROID) {kRetainOmniboxOnFocus, base::FEATURE_ENABLED_BY_DEFAULT}, #endif diff --git a/chromium_src/components/privacy_sandbox/privacy_sandbox_features.cc b/chromium_src/components/privacy_sandbox/privacy_sandbox_features.cc index cbc3a4c1152d..944b89386df8 100644 --- a/chromium_src/components/privacy_sandbox/privacy_sandbox_features.cc +++ b/chromium_src/components/privacy_sandbox/privacy_sandbox_features.cc @@ -14,7 +14,6 @@ OVERRIDE_FEATURE_DEFAULT_STATES({{ {kOverridePrivacySandboxSettingsLocalTesting, base::FEATURE_DISABLED_BY_DEFAULT}, {kPrivacySandboxFirstPartySetsUI, base::FEATURE_DISABLED_BY_DEFAULT}, - {kPrivacySandboxProactiveTopicsBlocking, base::FEATURE_DISABLED_BY_DEFAULT}, {kPrivacySandboxSettings4, base::FEATURE_DISABLED_BY_DEFAULT}, {kTrackingProtectionContentSettingUbControl, base::FEATURE_DISABLED_BY_DEFAULT}, diff --git a/chromium_src/components/search_engines/brave_template_url_prepopulate_data_unittest.cc b/chromium_src/components/search_engines/brave_template_url_prepopulate_data_unittest.cc index 6caf3987c5a1..53bd617ed5b4 100644 --- a/chromium_src/components/search_engines/brave_template_url_prepopulate_data_unittest.cc +++ b/chromium_src/components/search_engines/brave_template_url_prepopulate_data_unittest.cc @@ -43,21 +43,15 @@ const PrepopulatedEngine* const kBraveAddedEngines[] = { const std::unordered_set kOverriddenEnginesNames = { u"DuckDuckGo", u"Qwant"}; - -std::vector GetAllPrepopulatedEngines() { - std::vector engines = - TemplateURLPrepopulateData::GetAllPrepopulatedEngines(); - engines.insert(engines.end(), std::begin(kBraveAddedEngines), - std::end(kBraveAddedEngines)); - return engines; -} - } // namespace class BraveTemplateURLPrepopulateDataTest : public testing::Test { public: BraveTemplateURLPrepopulateDataTest() - : search_engine_choice_service_(prefs_, &local_state_) {} + : search_engine_choice_service_( + prefs_, + &local_state_, + /*is_profile_eligible_for_dse_guest_propagation=*/false) {} void SetUp() override { TemplateURLPrepopulateData::RegisterProfilePrefs(prefs_.registry()); // Real registration happens in `brave/browser/brave_profile_prefs.cc` @@ -66,6 +60,14 @@ class BraveTemplateURLPrepopulateDataTest : public testing::Test { registry->RegisterIntegerPref( prefs::kBraveDefaultSearchVersion, TemplateURLPrepopulateData::kBraveCurrentDataVersion); + + const auto engines = + TemplateURLPrepopulateData::GetAllPrepopulatedEngines(); + brave_prepopulated_engines_.insert(brave_prepopulated_engines_.end(), + engines.begin(), engines.end()); + brave_prepopulated_engines_.insert(brave_prepopulated_engines_.end(), + std::begin(kBraveAddedEngines), + std::end(kBraveAddedEngines)); } void CheckForCountry(char digit1, char digit2, int prepopulate_id) { @@ -78,10 +80,16 @@ class BraveTemplateURLPrepopulateDataTest : public testing::Test { EXPECT_EQ(fallback_t_url_data->prepopulate_id, prepopulate_id); } + const base::span + GetAllPrepopulatedEngines() { + return brave_prepopulated_engines_; + } + protected: sync_preferences::TestingPrefServiceSyncable prefs_; TestingPrefServiceSimple local_state_; search_engines::SearchEngineChoiceService search_engine_choice_service_; + std::vector brave_prepopulated_engines_; }; // Verifies that the set of all prepopulate data doesn't contain entries with @@ -89,8 +97,8 @@ class BraveTemplateURLPrepopulateDataTest : public testing::Test { // engine in the future that Brave already added. TEST_F(BraveTemplateURLPrepopulateDataTest, UniqueKeywords) { using PrepopulatedEngine = TemplateURLPrepopulateData::PrepopulatedEngine; - const std::vector all_engines = - ::GetAllPrepopulatedEngines(); + const base::span all_engines = + GetAllPrepopulatedEngines(); std::set unique_keywords; for (const PrepopulatedEngine* engine : all_engines) { ASSERT_TRUE(unique_keywords.find(engine->keyword) == unique_keywords.end()); @@ -101,8 +109,8 @@ TEST_F(BraveTemplateURLPrepopulateDataTest, UniqueKeywords) { // Verifies that engines we override are used and not the original engines. TEST_F(BraveTemplateURLPrepopulateDataTest, OverriddenEngines) { using PrepopulatedEngine = TemplateURLPrepopulateData::PrepopulatedEngine; - const std::vector all_engines = - ::GetAllPrepopulatedEngines(); + const base::span all_engines = + GetAllPrepopulatedEngines(); for (const PrepopulatedEngine* engine : all_engines) { if (kOverriddenEnginesNames.count(engine->name) > 0) ASSERT_GE(static_cast(engine->id), diff --git a/chromium_src/components/search_engines/brave_template_url_service_util_unittest.cc b/chromium_src/components/search_engines/brave_template_url_service_util_unittest.cc index d9f22732a504..0060145136f4 100644 --- a/chromium_src/components/search_engines/brave_template_url_service_util_unittest.cc +++ b/chromium_src/components/search_engines/brave_template_url_service_util_unittest.cc @@ -46,7 +46,10 @@ std::unique_ptr CreatePrepopulateTemplateURLData( class BraveTemplateURLServiceUtilTest : public testing::Test { public: BraveTemplateURLServiceUtilTest() - : search_engine_choice_service_(prefs_, &local_state_) {} + : search_engine_choice_service_( + prefs_, + &local_state_, + /*is_profile_eligible_for_dse_guest_propagation=*/false) {} void SetUp() override { TemplateURLPrepopulateData::RegisterProfilePrefs(prefs_.registry()); } diff --git a/chromium_src/components/search_engines/search_engine_utils.cc b/chromium_src/components/search_engines/search_engine_utils.cc index 04b23f5456e7..6374975f2fb3 100644 --- a/chromium_src/components/search_engines/search_engine_utils.cc +++ b/chromium_src/components/search_engines/search_engine_utils.cc @@ -24,8 +24,8 @@ SearchEngineType GetEngineType(const GURL& url) { if (SameDomain(url, GURL(engine->search_url))) { return engine->type; } - for (size_t j = 0; j < engine->alternate_urls_size; ++j) { - if (SameDomain(url, UNSAFE_TODO(GURL(engine->alternate_urls[j])))) { + for (size_t j = 0; j < engine->alternate_urls.size(); ++j) { + if (SameDomain(url, GURL(UNSAFE_TODO(engine->alternate_urls[j])))) { return engine->type; } } diff --git a/chromium_src/components/signin/public/identity_manager/identity_manager.cc b/chromium_src/components/signin/public/identity_manager/identity_manager.cc index 29e236536156..966afbd28240 100644 --- a/chromium_src/components/signin/public/identity_manager/identity_manager.cc +++ b/chromium_src/components/signin/public/identity_manager/identity_manager.cc @@ -19,7 +19,7 @@ namespace signin { AccountsInCookieJarInfo IdentityManager::GetAccountsInCookieJar() const { // accounts_in_cookie_jar_info.accounts_are_fresh must be false, // see `SyncServiceImpl::OnEngineInitialized` - return AccountsInCookieJarInfo(false, std::vector(), + return AccountsInCookieJarInfo(/*accounts_are_fresh=*/false, std::vector()); } diff --git a/chromium_src/components/update_client/update_checker.cc b/chromium_src/components/update_client/update_checker.cc index 342f0d33f95e..2a882a747a45 100644 --- a/chromium_src/components/update_client/update_checker.cc +++ b/chromium_src/components/update_client/update_checker.cc @@ -89,7 +89,6 @@ void SequentialUpdateChecker::CheckNext() { update_context_->config, update_context_->crx_cache_, update_context_->is_foreground, update_context_->is_install, ids, update_context_->crx_state_change_callback, - update_context_->notify_observers_callback, // We don't pass a context callback here because UpdateChecker doesn't use // it. This is instead done by UpdateEngine, which calls us. base::DoNothing(), update_context_->persisted_data, diff --git a/chromium_src/crypto/kdf.cc b/chromium_src/crypto/kdf.cc new file mode 100644 index 000000000000..54aa210f7474 --- /dev/null +++ b/chromium_src/crypto/kdf.cc @@ -0,0 +1,35 @@ +/* Copyright (c) 2024 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 https://mozilla.org/MPL/2.0/. */ + +#include "src/crypto/kdf.cc" + +namespace crypto::kdf { + +bool DeriveKeyScryptNoCheck(const ScryptParams& params, + base::span password, + base::span salt, + base::span result) { + OpenSSLErrStackTracer err_tracer(FROM_HERE); + int rv = + EVP_PBE_scrypt(reinterpret_cast(password.data()), + password.size(), salt.data(), salt.size(), params.cost, + params.block_size, params.parallelization, + params.max_memory_bytes, result.data(), result.size()); + + return rv == 1; +} + +bool DeriveKeyPbkdf2HmacSha256(const kdf::Pbkdf2HmacSha256Params& params, + base::span password, + base::span salt, + base::span result) { + OpenSSLErrStackTracer err_tracer(FROM_HERE); + int rv = PKCS5_PBKDF2_HMAC(base::as_chars(password).data(), password.size(), + salt.data(), salt.size(), params.iterations, + EVP_sha256(), result.size(), result.data()); + return rv == 1; +} + +} // namespace crypto::kdf diff --git a/chromium_src/crypto/kdf.h b/chromium_src/crypto/kdf.h new file mode 100644 index 000000000000..21b6911efdf3 --- /dev/null +++ b/chromium_src/crypto/kdf.h @@ -0,0 +1,36 @@ +/* Copyright (c) 2024 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 https://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_CHROMIUM_SRC_CRYPTO_KDF_H_ +#define BRAVE_CHROMIUM_SRC_CRYPTO_KDF_H_ + +#include "src/crypto/kdf.h" // IWYU pragma: export + +namespace crypto::kdf { + +// Upstream function DeriveKeyScrypt has a CHECK_EQ(rv, 1) which we don't +// want as we shouldn't crash the browser because of bad input data, so this +// is our own version of the same function but returning a bool instead of +// CHECKing. +CRYPTO_EXPORT bool DeriveKeyScryptNoCheck(const ScryptParams& params, + base::span password, + base::span salt, + base::span result); + +struct Pbkdf2HmacSha256Params { + // BoringSSL uses a uint32_t for the iteration count for PBKDF2, so we match + // that. + uint32_t iterations; +}; + +CRYPTO_EXPORT bool DeriveKeyPbkdf2HmacSha256( + const kdf::Pbkdf2HmacSha256Params& params, + base::span password, + base::span salt, + base::span result); + +} // namespace crypto::kdf + +#endif // BRAVE_CHROMIUM_SRC_CRYPTO_KDF_H_ diff --git a/chromium_src/crypto/kdf_unittest.cc b/chromium_src/crypto/kdf_unittest.cc new file mode 100644 index 000000000000..d268d9a409df --- /dev/null +++ b/chromium_src/crypto/kdf_unittest.cc @@ -0,0 +1,102 @@ +/* Copyright (c) 2024 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 https://mozilla.org/MPL/2.0/. */ + +#include "src/crypto/kdf_unittest.cc" + +TEST(KDFTest, Pbkdf2HmacSha256KnownAnswers) { + struct TestCase { + std::string password; + std::string salt; + crypto::kdf::Pbkdf2HmacSha256Params params; + size_t len; + const char* result; + }; + + constexpr auto cases = std::to_array({ + {"password", + "salt", + {1}, + 32, + "120fb6cffcf8b32c43e7225256c4f837a86548c92ccc35480805987cb70be17b"}, + {"password", + "salt", + {2}, + 32, + "ae4d0c95af6b46d32d0adff928f06dd02a303f8ef3c251dfd6e2d85a95474c43"}, + {"password", + "salt", + {4096}, + 32, + "c5e478d59288c841aa530db6845c4c8d962893a001ce4e11a4963873aa98134a"}, + }); + + for (const auto& c : cases) { + std::vector key(c.len); + ASSERT_TRUE(crypto::kdf::DeriveKeyPbkdf2HmacSha256( + c.params, base::as_byte_span(c.password), base::as_byte_span(c.salt), + key)); + + std::vector result_bytes(c.len); + ASSERT_TRUE(base::HexStringToSpan(c.result, result_bytes)); + EXPECT_EQ(key, result_bytes); + } +} + +// Test that our implementation in DeriveKeyScryptNoCheck produces results that +// match the upstream's implementation in DeriveKeyScrypt. +TEST(KDFTest, ScryptNoCheckKnownAnswers) { + struct TestCase { + std::string password; + std::string salt; + crypto::kdf::ScryptParams params; + size_t len; + const char* result; + }; + + // RFC 7914 test vectors - note that RFC 7914 does not specify + // max_memory_bytes so we just pass 0 here and let BoringSSL figure it out for + // us. + constexpr auto cases = std::to_array({ + {"password", + "NaCl", + {.cost = 1024, .block_size = 8, .parallelization = 16}, + 64, + "fdbabe1c9d3472007856e7190d01e9fe7c6ad7cbc8237830e77376634b373162" + "2eaf30d92e22a3886ff109279d9830dac727afb94a83ee6d8360cbdfa2cc0640"}, + }); + + for (const auto& c : cases) { + std::vector key(c.len); + EXPECT_TRUE(crypto::kdf::DeriveKeyScryptNoCheck( + c.params, base::as_byte_span(c.password), base::as_byte_span(c.salt), + key)); + + std::vector key_with_check(c.len); + crypto::kdf::DeriveKeyScrypt(c.params, base::as_byte_span(c.password), + base::as_byte_span(c.salt), key_with_check, + crypto::SubtlePassKey::ForTesting()); + EXPECT_EQ(key, key_with_check); + + std::vector result_bytes(c.len); + ASSERT_TRUE(base::HexStringToSpan(c.result, result_bytes)); + EXPECT_EQ(key, result_bytes); + } +} + +// Test that our implementation in DeriveKeyScryptNoCheck doesn't cause a crash +// when invalid parameter is passed in. +TEST(KDFTest, InvalidScryptNoCheckParameters) { + constexpr auto cases = std::to_array({ + // cost parameter is not a power of 2 + {.cost = 1023, .block_size = 8, .parallelization = 16}, + // TODO: others, after we document the exact constraints + }); + + for (const auto& c : cases) { + std::vector key(64); + EXPECT_FALSE(crypto::kdf::DeriveKeyScryptNoCheck( + c, base::as_byte_span("password"), base::as_byte_span("NaCl"), key)); + } +} diff --git a/chromium_src/crypto/symmetric_key.cc b/chromium_src/crypto/symmetric_key.cc deleted file mode 100644 index 4baea66ff049..000000000000 --- a/chromium_src/crypto/symmetric_key.cc +++ /dev/null @@ -1,39 +0,0 @@ -/* 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/. */ - -#include "crypto/symmetric_key.h" - -#include "src/crypto/symmetric_key.cc" - -#include "crypto/openssl_util.h" -#include "third_party/boringssl/src/include/openssl/evp.h" - -namespace crypto { - -// static -std::unique_ptr -SymmetricKey::DeriveKeyFromPasswordUsingPbkdf2Sha256( - Algorithm algorithm, - const std::string& password, - const std::string& salt, - size_t iterations, - size_t key_size_in_bits) { - if (!CheckDerivationParameters(algorithm, key_size_in_bits)) - return nullptr; - - size_t key_size_in_bytes = key_size_in_bits / 8; - - OpenSSLErrStackTracer err_tracer(FROM_HERE); - std::unique_ptr key(new SymmetricKey); - key->key_.resize(key_size_in_bytes, '\0'); - int rv = PKCS5_PBKDF2_HMAC(password.data(), password.length(), - reinterpret_cast(salt.data()), - salt.length(), static_cast(iterations), - EVP_sha256(), key_size_in_bytes, - reinterpret_cast(key->key_.data())); - return rv == 1 ? std::move(key) : nullptr; -} - -} // namespace crypto diff --git a/chromium_src/crypto/symmetric_key.h b/chromium_src/crypto/symmetric_key.h deleted file mode 100644 index 20cb5bcd8fca..000000000000 --- a/chromium_src/crypto/symmetric_key.h +++ /dev/null @@ -1,17 +0,0 @@ -/* 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/. */ - -#ifndef BRAVE_CHROMIUM_SRC_CRYPTO_SYMMETRIC_KEY_H_ -#define BRAVE_CHROMIUM_SRC_CRYPTO_SYMMETRIC_KEY_H_ - -#define DeriveKeyFromPasswordUsingPbkdf2 \ - DeriveKeyFromPasswordUsingPbkdf2Sha256( \ - Algorithm algorithm, const std::string& password, \ - const std::string& salt, size_t iterations, size_t key_size_in_bits); \ - static std::unique_ptr DeriveKeyFromPasswordUsingPbkdf2 -#include "src/crypto/symmetric_key.h" // IWYU pragma: export -#undef DeriveKeyFromPasswordUsingPbkdf2 - -#endif // BRAVE_CHROMIUM_SRC_CRYPTO_SYMMETRIC_KEY_H_ diff --git a/chromium_src/crypto/symmetric_key_unittest.cc b/chromium_src/crypto/symmetric_key_unittest.cc deleted file mode 100644 index c85c9ccb9d7c..000000000000 --- a/chromium_src/crypto/symmetric_key_unittest.cc +++ /dev/null @@ -1,55 +0,0 @@ -/* 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/. */ - -#include "src/crypto/symmetric_key_unittest.cc" - -class SymmetricKeyDeriveKeyFromPasswordUsingPbkdf2Sha256Test - : public testing::TestWithParam {}; - -TEST_P(SymmetricKeyDeriveKeyFromPasswordUsingPbkdf2Sha256Test, - DeriveKeyFromPasswordUsingPbkdf2Sha256) { - PBKDF2TestVector test_data(GetParam()); - std::unique_ptr key( - crypto::SymmetricKey::DeriveKeyFromPasswordUsingPbkdf2Sha256( - test_data.algorithm, test_data.password, test_data.salt, - test_data.rounds, test_data.key_size_in_bits)); - ASSERT_TRUE(key); - - const std::string& raw_key = key->key(); - EXPECT_EQ(test_data.key_size_in_bits / 8, raw_key.size()); - EXPECT_EQ(test_data.expected, base::ToLowerASCII(base::HexEncode( - raw_key.data(), raw_key.size()))); -} - -static const PBKDF2TestVector kTestVectorsPbkdf2Sha256[] = { - { - crypto::SymmetricKey::AES, - "password", - "salt", - 1, - 256, - "120fb6cffcf8b32c43e7225256c4f837a86548c92ccc35480805987cb70be17b", - }, - { - crypto::SymmetricKey::AES, - "password", - "salt", - 2, - 256, - "ae4d0c95af6b46d32d0adff928f06dd02a303f8ef3c251dfd6e2d85a95474c43", - }, - { - crypto::SymmetricKey::AES, - "password", - "salt", - 4096, - 256, - "c5e478d59288c841aa530db6845c4c8d962893a001ce4e11a4963873aa98134a", - }, -}; - -INSTANTIATE_TEST_SUITE_P(All, - SymmetricKeyDeriveKeyFromPasswordUsingPbkdf2Sha256Test, - testing::ValuesIn(kTestVectorsPbkdf2Sha256)); diff --git a/chromium_src/crypto/unexportable_key_software_unsecure.cc b/chromium_src/crypto/unexportable_key_software_unsecure.cc new file mode 100644 index 000000000000..41b5f55479e6 --- /dev/null +++ b/chromium_src/crypto/unexportable_key_software_unsecure.cc @@ -0,0 +1,12 @@ +/* Copyright (c) 2023 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 https://mozilla.org/MPL/2.0/. */ + +#include "crypto/signature_verifier.h" + +#define RSA_PSS_SHA256 \ + RSA_PSS_SHA256: \ + case SignatureVerifier::SignatureAlgorithm::ECDSA_SHA384 +#include "src/crypto/unexportable_key_software_unsecure.cc" +#undef RSA_PSS_SHA256 diff --git a/chromium_src/google_apis/api_key_cache.h b/chromium_src/google_apis/api_key_cache.h new file mode 100644 index 000000000000..4e4e63dde759 --- /dev/null +++ b/chromium_src/google_apis/api_key_cache.h @@ -0,0 +1,20 @@ +/* Copyright (c) 2024 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 https://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_CHROMIUM_SRC_GOOGLE_APIS_API_KEY_CACHE_H_ +#define BRAVE_CHROMIUM_SRC_GOOGLE_APIS_API_KEY_CACHE_H_ + +#define metrics_key \ + Undefined(); \ + void set_api_key_for_testing(const std::string& api_key) { \ + api_key_ = api_key; \ + } \ + const std::string& metrics_key + +#include "src/google_apis/api_key_cache.h" // IWYU pragma: export + +#undef metrics_key + +#endif // BRAVE_CHROMIUM_SRC_GOOGLE_APIS_API_KEY_CACHE_H_ diff --git a/chromium_src/google_apis/google_api_keys-inc.cc b/chromium_src/google_apis/google_api_keys.cc similarity index 83% rename from chromium_src/google_apis/google_api_keys-inc.cc rename to chromium_src/google_apis/google_api_keys.cc index 6ddd148567e0..a2d7373686d0 100644 --- a/chromium_src/google_apis/google_api_keys-inc.cc +++ b/chromium_src/google_apis/google_api_keys.cc @@ -3,12 +3,12 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "src/google_apis/google_api_keys-inc.cc" +#include "src/google_apis/google_api_keys.cc" namespace google_apis { void SetAPIKeyForTesting(const std::string& api_key) { - g_api_key_cache.Get().set_api_key_for_testing(api_key); // IN-TEST + GetApiKeyCacheInstance().set_api_key_for_testing(api_key); // IN-TEST } bool BraveHasAPIKeyConfigured() { diff --git a/chromium_src/ios/chrome/browser/main/model/browser_agent_util.mm b/chromium_src/ios/chrome/browser/main/model/browser_agent_util.mm index b22858c3d395..6a2cfc040838 100644 --- a/chromium_src/ios/chrome/browser/main/model/browser_agent_util.mm +++ b/chromium_src/ios/chrome/browser/main/model/browser_agent_util.mm @@ -13,7 +13,7 @@ void AttachBrowserAgents(Browser* browser) { SyncedWindowDelegateBrowserAgent::CreateForBrowser(browser); // Send Tab To Self is non-OTR only. - if (!browser->GetBrowserState()->IsOffTheRecord()) { + if (!browser->GetProfile()->IsOffTheRecord()) { SendTabToSelfBrowserAgent::CreateForBrowser(browser); } } diff --git a/chromium_src/ios/chrome/browser/shared/model/prefs/browser_prefs.mm b/chromium_src/ios/chrome/browser/shared/model/prefs/browser_prefs.mm index 9d676faf496e..aedfd60ecfc9 100644 --- a/chromium_src/ios/chrome/browser/shared/model/prefs/browser_prefs.mm +++ b/chromium_src/ios/chrome/browser/shared/model/prefs/browser_prefs.mm @@ -79,8 +79,7 @@ void BraveRegisterLocalStatePrefs(PrefRegistrySimple* registry) { #define BRAVE_REGISTER_LOCAL_STATE_PREFS BraveRegisterLocalStatePrefs(registry); -#define MigrateObsoleteBrowserStatePrefs \ - MigrateObsoleteBrowserStatePrefs_ChromiumImpl +#define MigrateObsoleteProfilePrefs MigrateObsoleteProfilePrefs_ChromiumImpl #define MigrateObsoleteLocalStatePrefs \ MigrateObsoleteLocalStatePrefs_ChromiumImpl @@ -88,13 +87,13 @@ void BraveRegisterLocalStatePrefs(PrefRegistrySimple* registry) { #include "src/ios/chrome/browser/shared/model/prefs/browser_prefs.mm" #undef MigrateObsoleteLocalStatePrefs -#undef MigrateObsoleteBrowserStatePrefs +#undef MigrateObsoleteProfilePrefs #undef BRAVE_REGISTER_LOCAL_STATE_PREFS #undef BRAVE_REGISTER_BROWSER_STATE_PREFS -void MigrateObsoleteBrowserStatePrefs(const base::FilePath& state_path, - PrefService* prefs) { - MigrateObsoleteBrowserStatePrefs_ChromiumImpl(state_path, prefs); +void MigrateObsoleteProfilePrefs(const base::FilePath& state_path, + PrefService* prefs) { + MigrateObsoleteProfilePrefs_ChromiumImpl(state_path, prefs); brave_ads::MigrateObsoleteProfilePrefs(prefs); brave_wallet::MigrateObsoleteProfilePrefs(prefs); diff --git a/chromium_src/ios/chrome/browser/signin/model/about_signin_internals_factory.cc b/chromium_src/ios/chrome/browser/signin/model/about_signin_internals_factory.cc index bf5b18c1ca03..10b8e31fb793 100644 --- a/chromium_src/ios/chrome/browser/signin/model/about_signin_internals_factory.cc +++ b/chromium_src/ios/chrome/browser/signin/model/about_signin_internals_factory.cc @@ -20,12 +20,6 @@ AboutSigninInternalsFactory::AboutSigninInternalsFactory() AboutSigninInternalsFactory::~AboutSigninInternalsFactory() {} -// static -AboutSigninInternals* AboutSigninInternalsFactory::GetForBrowserState( - ProfileIOS* profile) { - return GetForProfile(profile); -} - // static AboutSigninInternals* AboutSigninInternalsFactory::GetForProfile( ProfileIOS* profile) { diff --git a/chromium_src/ios/chrome/browser/sync/model/sync_service_factory.mm b/chromium_src/ios/chrome/browser/sync/model/sync_service_factory.mm index cc49a0b94f9a..ff92310fc347 100644 --- a/chromium_src/ios/chrome/browser/sync/model/sync_service_factory.mm +++ b/chromium_src/ios/chrome/browser/sync/model/sync_service_factory.mm @@ -8,13 +8,13 @@ #include "ios/chrome/browser/history/model/history_service_factory.h" #include "ios/chrome/browser/sync/model/device_info_sync_service_factory.h" -#define BRAVE_BUILD_SERVICE_INSTANCE_FOR \ - std::make_unique( \ - std::move(init_params), \ - std::make_unique( \ - DeviceInfoSyncServiceFactory::GetForBrowserState(browser_state), \ - ios::HistoryServiceFactory::GetForBrowserState( \ - browser_state, ServiceAccessType::IMPLICIT_ACCESS))); +#define BRAVE_BUILD_SERVICE_INSTANCE_FOR \ + std::make_unique( \ + std::move(init_params), \ + std::make_unique( \ + DeviceInfoSyncServiceFactory::GetForProfile(profile), \ + ios::HistoryServiceFactory::GetForProfile( \ + profile, ServiceAccessType::IMPLICIT_ACCESS))); #include "src/ios/chrome/browser/sync/model/sync_service_factory.mm" diff --git a/chromium_src/net/cookies/cookie_access_delegate.cc b/chromium_src/net/cookies/cookie_access_delegate.cc index e5405974eda2..334bc0dec1fb 100644 --- a/chromium_src/net/cookies/cookie_access_delegate.cc +++ b/chromium_src/net/cookies/cookie_access_delegate.cc @@ -18,7 +18,7 @@ bool CookieAccessDelegate::NotUsed() const { bool CookieAccessDelegate::ShouldUseEphemeralStorage( const GURL& url, const net::SiteForCookies& site_for_cookies, - const std::optional& top_frame_origin) const { + base::optional_ref top_frame_origin) const { NOTREACHED() << "Should be overridden"; } diff --git a/chromium_src/net/cookies/cookie_access_delegate.h b/chromium_src/net/cookies/cookie_access_delegate.h index 1da145917662..001b14cb9d79 100644 --- a/chromium_src/net/cookies/cookie_access_delegate.h +++ b/chromium_src/net/cookies/cookie_access_delegate.h @@ -8,16 +8,17 @@ #include +#include "base/types/optional_ref.h" #include "net/cookies/cookie_setting_override.h" #include "net/cookies/site_for_cookies.h" #include "url/gurl.h" #include "url/origin.h" -#define ShouldTreatUrlAsTrustworthy \ - NotUsed() const; \ - virtual bool ShouldUseEphemeralStorage( \ - const GURL& url, const net::SiteForCookies& site_for_cookies, \ - const std::optional& top_frame_origin) const; \ +#define ShouldTreatUrlAsTrustworthy \ + NotUsed() const; \ + virtual bool ShouldUseEphemeralStorage( \ + const GURL& url, const net::SiteForCookies& site_for_cookies, \ + base::optional_ref top_frame_origin) const; \ virtual bool ShouldTreatUrlAsTrustworthy #include "src/net/cookies/cookie_access_delegate.h" // IWYU pragma: export diff --git a/chromium_src/net/http/transport_security_state.cc b/chromium_src/net/http/transport_security_state.cc index 4c98f972f2d1..1997601fc492 100644 --- a/chromium_src/net/http/transport_security_state.cc +++ b/chromium_src/net/http/transport_security_state.cc @@ -3,12 +3,14 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at https://mozilla.org/MPL/2.0/. */ +#include "net/http/transport_security_state.h" + #include +#include "base/strings/strcat.h" #include "build/build_config.h" #include "net/base/network_anonymization_key.h" #include "net/base/registry_controlled_domains/registry_controlled_domain.h" -#include "net/http/transport_security_state.h" #include "url/gurl.h" #include "url/url_util.h" @@ -119,11 +121,12 @@ std::optional GetPartitionHashForHSTS( // page, PasswordManager. All network::NetworkContext HSTS-related public // methods will use this. std::optional -GetHostBoundPartitionHashForHSTS(const std::string& host) { +GetHostBoundPartitionHashForHSTS(std::string_view host) { if (!base::FeatureList::IsEnabled(features::kBravePartitionHSTS)) { return std::nullopt; } - SchemefulSite schemeful_site(url::Origin::Create(GURL("https://" + host))); + SchemefulSite schemeful_site( + url::Origin::Create(GURL(base::StrCat({"https://", host})))); auto network_anonymization_key = net::NetworkAnonymizationKey::CreateFromFrameSite(schemeful_site, schemeful_site); @@ -170,8 +173,8 @@ bool TransportSecurityState::ShouldUpgradeToSSL( // Use NetworkAnonymizationKey to create PartitionHash for accessing/storing // data before calling Chromium implementation bool TransportSecurityState::AddHSTSHeader(const IsolationInfo& isolation_info, - const std::string& host, - const std::string& value) { + std::string_view host, + std::string_view value) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); auto auto_reset_partition_hash = enabled_sts_hosts_.SetScopedPartitionHash( GetPartitionHashForAddingHSTS(isolation_info)); @@ -184,7 +187,7 @@ bool TransportSecurityState::AddHSTSHeader(const IsolationInfo& isolation_info, // Use NetworkAnonymizationKey to create PartitionHash for accessing/storing // data before calling Chromium implementation -void TransportSecurityState::AddHSTS(const std::string& host, +void TransportSecurityState::AddHSTS(std::string_view host, const base::Time& expiry, bool include_subdomains) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); diff --git a/chromium_src/net/http/transport_security_state.h b/chromium_src/net/http/transport_security_state.h index 88521c28cc04..af4b4143d7d9 100644 --- a/chromium_src/net/http/transport_security_state.h +++ b/chromium_src/net/http/transport_security_state.h @@ -46,11 +46,11 @@ class NET_EXPORT TransportSecurityState const std::string& host, const NetLogWithSource& net_log = NetLogWithSource()); bool AddHSTSHeader(const IsolationInfo& isolation_info, - const std::string& host, - const std::string& value); + std::string_view host, + std::string_view value); // This is used only for manual adding via net-internals page. - void AddHSTS(const std::string& host, + void AddHSTS(std::string_view host, const base::Time& expiry, bool include_subdomains); // These are used in some places where no NIK is available. diff --git a/chromium_src/services/network/cookie_access_delegate_impl.cc b/chromium_src/services/network/cookie_access_delegate_impl.cc index 844b66bd4569..df36ef3d6a68 100644 --- a/chromium_src/services/network/cookie_access_delegate_impl.cc +++ b/chromium_src/services/network/cookie_access_delegate_impl.cc @@ -17,7 +17,7 @@ bool CookieAccessDelegateImpl::NotUsed() const { bool CookieAccessDelegateImpl::ShouldUseEphemeralStorage( const GURL& url, const net::SiteForCookies& site_for_cookies, - const std::optional& top_frame_origin) const { + base::optional_ref top_frame_origin) const { if (!cookie_settings_) { return false; } diff --git a/chromium_src/services/network/cookie_access_delegate_impl.h b/chromium_src/services/network/cookie_access_delegate_impl.h index a8a8d57b993b..21ceb29a04cb 100644 --- a/chromium_src/services/network/cookie_access_delegate_impl.h +++ b/chromium_src/services/network/cookie_access_delegate_impl.h @@ -10,11 +10,11 @@ #include "net/cookies/cookie_access_delegate.h" -#define ShouldTreatUrlAsTrustworthy \ - NotUsed() const override; \ - bool ShouldUseEphemeralStorage( \ - const GURL& url, const net::SiteForCookies& site_for_cookies, \ - const std::optional& top_frame_origin) const override; \ +#define ShouldTreatUrlAsTrustworthy \ + NotUsed() const override; \ + bool ShouldUseEphemeralStorage( \ + const GURL& url, const net::SiteForCookies& site_for_cookies, \ + base::optional_ref top_frame_origin) const override; \ bool ShouldTreatUrlAsTrustworthy #include "src/services/network/cookie_access_delegate_impl.h" // IWYU pragma: export diff --git a/chromium_src/third_party/blink/common/features.cc b/chromium_src/third_party/blink/common/features.cc index 967e0b2811bb..2c4bcf4f231d 100644 --- a/chromium_src/third_party/blink/common/features.cc +++ b/chromium_src/third_party/blink/common/features.cc @@ -25,7 +25,6 @@ OVERRIDE_FEATURE_DEFAULT_STATES({{ {kBackgroundResourceFetch, base::FEATURE_DISABLED_BY_DEFAULT}, {kBiddingAndScoringDebugReportingAPI, base::FEATURE_DISABLED_BY_DEFAULT}, {kBrowsingTopics, base::FEATURE_DISABLED_BY_DEFAULT}, - {kClientHintsFormFactors, base::FEATURE_DISABLED_BY_DEFAULT}, {kControlledFrame, base::FEATURE_DISABLED_BY_DEFAULT}, {kCssSelectorFragmentAnchor, base::FEATURE_DISABLED_BY_DEFAULT}, {kFencedFrames, base::FEATURE_DISABLED_BY_DEFAULT}, diff --git a/chromium_src/third_party/blink/renderer/core/loader/mixed_content_checker.cc b/chromium_src/third_party/blink/renderer/core/loader/mixed_content_checker.cc index ec36db191be0..5492a0d94e70 100644 --- a/chromium_src/third_party/blink/renderer/core/loader/mixed_content_checker.cc +++ b/chromium_src/third_party/blink/renderer/core/loader/mixed_content_checker.cc @@ -11,13 +11,28 @@ namespace blink { namespace { +// These template specialisations are required because not all `T`s passed to +// `IsOnion` have a `Host` method that returns a `String`. Recently, +// `KURL.Host()` has been converted to return a `StringView`, which doesn't +// offer an `EndsWith` method. +template +String GetHost(const T& obj) { + return obj.Host(); +} + +template <> +String GetHost(const KURL& obj) { + return obj.Host().ToString(); +} + template bool IsOnion(const T& obj) { constexpr const char kOnion[] = ".onion"; - return obj.Host().EndsWith(kOnion) && (obj.Protocol() == url::kHttpsScheme || - obj.Protocol() == url::kHttpScheme || - obj.Protocol() == url::kWsScheme || - obj.Protocol() == url::kWssScheme); + return GetHost(obj).EndsWith(kOnion) && + (obj.Protocol() == url::kHttpsScheme || + obj.Protocol() == url::kHttpScheme || + obj.Protocol() == url::kWsScheme || + obj.Protocol() == url::kWssScheme); } } // namespace diff --git a/chromium_src/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc b/chromium_src/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc index 9999e62d0b34..7f0300426753 100644 --- a/chromium_src/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc +++ b/chromium_src/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc @@ -13,12 +13,12 @@ namespace { bool IsGoogleMaps(const blink::KURL& url) { - const auto host = url.Host(); + const auto host = url.Host().ToString(); if (!host.StartsWith("google.") && !host.Contains(".google.")) { return false; } const auto path = url.GetPath(); - return path.StartsWith("/maps/") || path == "/maps"; + return path.ToString().StartsWith("/maps/") || path == "/maps"; } } // namespace @@ -129,20 +129,20 @@ ImageData* BaseRenderingContext2D::getImageData( bool BaseRenderingContext2D::isPointInPath(ScriptState* script_state, const double x, const double y, - const String& winding_rule_string) { + const V8CanvasFillRule& winding) { if (!AllowFingerprintingFromScriptState(script_state)) return false; - return isPointInPath(x, y, winding_rule_string); + return isPointInPath(x, y, winding); } bool BaseRenderingContext2D::isPointInPath(ScriptState* script_state, Path2D* dom_path, const double x, const double y, - const String& winding_rule_string) { + const V8CanvasFillRule& winding) { if (!AllowFingerprintingFromScriptState(script_state)) return false; - return isPointInPath(dom_path, x, y, winding_rule_string); + return isPointInPath(dom_path, x, y, winding); } bool BaseRenderingContext2D::isPointInStroke(ScriptState* script_state, diff --git a/chromium_src/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.h b/chromium_src/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.h index 451601f49d98..20dac6b66b7e 100644 --- a/chromium_src/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.h +++ b/chromium_src/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.h @@ -26,9 +26,11 @@ ImageDataSettings*, ExceptionState&); \ \ bool isPointInPath(ScriptState*, const double x, const double y, \ - const String& winding = "nonzero"); \ + const V8CanvasFillRule& winding = \ + V8CanvasFillRule(V8CanvasFillRule::Enum::kNonzero)); \ bool isPointInPath(ScriptState*, Path2D*, const double x, const double y, \ - const String& winding = "nonzero"); \ + const V8CanvasFillRule& winding = \ + V8CanvasFillRule(V8CanvasFillRule::Enum::kNonzero)); \ bool isPointInStroke(ScriptState*, const double x, const double y); \ bool isPointInStroke(ScriptState*, Path2D*, const double x, const double y); \ \ diff --git a/common/profiler/thread_profile_configuration_unittest.cc b/common/profiler/thread_profile_configuration_unittest.cc index 0b1db828cfc1..dfe20c17a9f1 100644 --- a/common/profiler/thread_profile_configuration_unittest.cc +++ b/common/profiler/thread_profile_configuration_unittest.cc @@ -9,11 +9,13 @@ TEST(ThreadProfilerConfigurationTest, DisabledForAllThreads) { const auto* config = ThreadProfilerConfiguration::Get(); - for (int t = static_cast(base::ProfilerThreadType::kUnknown); - t <= static_cast(base::ProfilerThreadType::kMax); ++t) { + for (int t = + static_cast(sampling_profiler::ProfilerThreadType::kUnknown); + t <= static_cast(sampling_profiler::ProfilerThreadType::kMax); + ++t) { // This should be disabled for all threads. EXPECT_FALSE(config->IsProfilerEnabledForCurrentProcessAndThread( - static_cast(t))) + static_cast(t))) << t; } } diff --git a/components/autofill_payments_strings.grdp b/components/autofill_payments_strings.grdp index 56e7ffa06705..426e98d5104d 100644 --- a/components/autofill_payments_strings.grdp +++ b/components/autofill_payments_strings.grdp @@ -413,18 +413,9 @@ - - Confirm Card - Verification - - Enter the CVC for $1Visa - 5679. After you confirm, card details from your Brave sync chain will be shared with this site. - - - Enter the expiration date and CVC for $1Visa - 5679 to update your card details. After you confirm, card details from your Brave sync chain will be shared with this site. - CVC @@ -697,10 +688,19 @@ Save IBAN? - To autofill this IBAN next time, save it in your Brave account + To autofill this IBAN next time, save it in your Brave sync chain + + Save IBAN + + + Save IBAN opened at full height. + + + Save IBAN closed. + No thanks @@ -974,6 +974,9 @@ Continue + + Loading bank verification website + Card number: @@ -988,15 +991,37 @@ Now you can see card benefits before you pay - - Card benefits - - - Choose whether you see your card benefits at checkout (bank terms apply) - - - Card benefits + + Card benefits + + + Show which rewards and benefits are available for your cards at checkout. <a href="#" aria-description="$1">Learn about card benefits</a> + + + See card benefit terms + + + See terms here for $1 + + + + + Card benefits + + + Choose whether you see your card benefits at checkout (bank terms apply) + + + Show which rewards and benefits are available for your cards at checkout + + + <link>Learn more</link> about card benefits + + + See terms here + + @@ -1159,12 +1184,6 @@ Check out faster when your CVCs are saved. <a href="#">Delete saved security codes</a> - - Card benefits - - - Show which rewards and benefits are available for your cards at checkout <a href="#" aria-description="$1">Learn about card benefits</a> - Delete saved security codes? @@ -1174,12 +1193,6 @@ CVC saved - - See card benefit terms - - - See terms here for $1 - diff --git a/components/autofill_prediction_improvements_strings.grdp b/components/autofill_prediction_improvements_strings.grdp index 00b89c438ac5..e6134dcdf98f 100644 --- a/components/autofill_prediction_improvements_strings.grdp +++ b/components/autofill_prediction_improvements_strings.grdp @@ -1,22 +1,99 @@ + + + Autofill with AI + + + + + Fill fields with AI + + + Fill + + + , ''' + + + & 1 more field + + + & $14 more fields + + - - Save info to improved predictions + + Save your info to autofill - + No thanks - + Save + + Info you have saved and this page get sent to Brave to see if autofill can help fill this form. Data may be seen by human reviewers to improve this feature. + + + + + Brave had trouble getting your information + + + Brave didn't find info to fill this field. + - - Learn more + + Manage autofill with AI + + + + + Manage your info + + + + + Info you have saved and this page get sent to Brave to see if autofill can help fill this form. Data may be seen by human reviewers to improve this feature. + + + + + Autofill with AI is an experimental feature and won’t always get it right. $1Manage autofill with AI. + + + Press enter to manage prediction improvements + + + Use left and right keys to navigate to feedback buttons. + + + Thumbs up submits feedback that you like autofill with AI + + + Thumbs down submits feedback that you dislike autofill with AI + + + Send feedback for Autofill with AI. + + + Loading suggestions + + + Suggestions loaded + + + + + Prediction improvements + + + Turn on prediction improvements - - Prediction improvements feedback, $1Learn more. + + Go to settings diff --git a/components/autofill_strings.grdp b/components/autofill_strings.grdp index ab5960347126..0149e6c0b0fc 100644 --- a/components/autofill_strings.grdp +++ b/components/autofill_strings.grdp @@ -18,8 +18,8 @@ - - Automatic credit card filling is disabled because this form does not use a secure connection. + + Automatic payment methods filling is disabled because this form does not use a secure connection. This form is not secure. Autofill has been turned off. @@ -587,7 +587,16 @@ Password saved to this device - To save and use this password on all your devices, verify it's you + To get this password on all your devices, verify it's you + + + Clear search + + + Search passwords + + + No passwords found @@ -596,4 +605,7 @@ Municipality + + Named location + diff --git a/components/brave_shields/content/test/BUILD.gn b/components/brave_shields/content/test/BUILD.gn index 8e713da82f26..10171c337da1 100644 --- a/components/brave_shields/content/test/BUILD.gn +++ b/components/brave_shields/content/test/BUILD.gn @@ -50,6 +50,9 @@ source_set("unit_tests") { "brave_shields_util_unittest.cc", ] - deps += [ "//chrome/browser" ] + deps += [ + "//chrome/browser", + "//chrome/browser/content_settings:content_settings_factory", + ] } } diff --git a/components/brave_wallet/browser/internal/hd_key.cc b/components/brave_wallet/browser/internal/hd_key.cc index 80890bfcf776..57887b9bd336 100644 --- a/components/brave_wallet/browser/internal/hd_key.cc +++ b/components/brave_wallet/browser/internal/hd_key.cc @@ -29,6 +29,7 @@ #include "brave/third_party/bitcoin-core/src/src/base58.h" #include "brave/vendor/bat-native-tweetnacl/tweetnacl.h" #include "crypto/encryptor.h" +#include "crypto/kdf.h" #include "crypto/random.h" #include "crypto/symmetric_key.h" #include "third_party/boringssl/src/include/openssl/hmac.h" @@ -245,8 +246,6 @@ std::unique_ptr HDKey::GenerateFromV3UTC(const std::string& password, VLOG(0) << __func__ << ": missing kdf"; return nullptr; } - - std::unique_ptr derived_key = nullptr; const auto* kdfparams = crypto->FindDict("kdfparams"); if (!kdfparams) { VLOG(0) << __func__ << ": missing kdfparams"; @@ -257,8 +256,8 @@ std::unique_ptr HDKey::GenerateFromV3UTC(const std::string& password, VLOG(0) << __func__ << ": missing dklen"; return nullptr; } - if (*dklen < 32) { - VLOG(0) << __func__ << ": dklen must be >=32"; + if (*dklen != 32) { + VLOG(0) << __func__ << ": dklen must be 32"; return nullptr; } const auto* salt = kdfparams->FindString("salt"); @@ -271,6 +270,9 @@ std::unique_ptr HDKey::GenerateFromV3UTC(const std::string& password, VLOG(1) << __func__ << ": invalid salt"; return nullptr; } + + std::vector key((size_t)*dklen); + if (*kdf == "pbkdf2") { auto c = kdfparams->FindInt("c"); if (!c) { @@ -286,11 +288,13 @@ std::unique_ptr HDKey::GenerateFromV3UTC(const std::string& password, VLOG(0) << __func__ << ": prf must be hmac-sha256 when using pbkdf2"; return nullptr; } - derived_key = SymmetricKey::DeriveKeyFromPasswordUsingPbkdf2Sha256( - SymmetricKey::AES, password, - std::string(salt_bytes.begin(), salt_bytes.end()), (size_t)*c, - (size_t)*dklen * 8); - if (!derived_key) { + + crypto::kdf::Pbkdf2HmacSha256Params params = { + .iterations = base::checked_cast(*c), + }; + if (!crypto::kdf::DeriveKeyPbkdf2HmacSha256( + params, base::as_byte_span(password), + base::as_byte_span(salt_bytes), key)) { VLOG(1) << __func__ << ": pbkdf2 derivation failed"; return nullptr; } @@ -310,11 +314,15 @@ std::unique_ptr HDKey::GenerateFromV3UTC(const std::string& password, VLOG(0) << __func__ << ": missing p"; return nullptr; } - derived_key = SymmetricKey::DeriveKeyFromPasswordUsingScrypt( - SymmetricKey::AES, password, - std::string(salt_bytes.begin(), salt_bytes.end()), (size_t)*n, - (size_t)*r, (size_t)*p, 512 * 1024 * 1024, (size_t)*dklen * 8); - if (!derived_key) { + crypto::kdf::ScryptParams params = { + .cost = (size_t)*n, + .block_size = (size_t)*r, + .parallelization = (size_t)*p, + .max_memory_bytes = 512 * 1024 * 1024, + }; + if (!crypto::kdf::DeriveKeyScryptNoCheck( + params, base::as_byte_span(password), + base::as_byte_span(salt_bytes), key)) { VLOG(1) << __func__ << ": scrypt derivation failed"; return nullptr; } @@ -340,6 +348,7 @@ std::unique_ptr HDKey::GenerateFromV3UTC(const std::string& password, return nullptr; } + auto derived_key = std::make_unique(key); if (!UTCPasswordVerification(derived_key->key(), ciphertext_bytes, *mac, *dklen)) { return nullptr; diff --git a/components/brave_wallet/browser/test/BUILD.gn b/components/brave_wallet/browser/test/BUILD.gn index 413431988cde..1cb94f2a57e1 100644 --- a/components/brave_wallet/browser/test/BUILD.gn +++ b/components/brave_wallet/browser/test/BUILD.gn @@ -147,6 +147,7 @@ source_set("brave_wallet_unit_tests") { "//components/prefs", "//components/prefs:test_support", "//components/sync_preferences:test_support", + "//components/update_client", "//net:test_support", "//services/data_decoder/public/cpp:test_support", "//services/network:test_support", diff --git a/components/brave_wallet/browser/wallet_data_files_installer.cc b/components/brave_wallet/browser/wallet_data_files_installer.cc index 64b13e5e1dff..96b73cf43284 100644 --- a/components/brave_wallet/browser/wallet_data_files_installer.cc +++ b/components/brave_wallet/browser/wallet_data_files_installer.cc @@ -23,6 +23,7 @@ #include "brave/components/brave_wallet/common/common_utils.h" #include "components/component_updater/component_installer.h" #include "components/prefs/pref_service.h" +#include "components/update_client/crx_update_item.h" #include "crypto/sha2.h" namespace brave_wallet { @@ -216,14 +217,12 @@ void WalletDataFilesInstaller::OnComponentReady(const base::FilePath& path) { } void WalletDataFilesInstaller::OnEvent( - update_client::UpdateClient::Observer::Events event, - const std::string& id) { - if (id != kComponentId) { + const update_client::CrxUpdateItem& item) { + if (item.id != kComponentId) { return; } - if (event == - update_client::UpdateClient::Observer::Events::COMPONENT_UPDATE_ERROR) { + if (item.state == update_client::ComponentState::kUpdateError) { if (install_callback_) { std::move(install_callback_).Run(); } diff --git a/components/brave_wallet/browser/wallet_data_files_installer.h b/components/brave_wallet/browser/wallet_data_files_installer.h index d26777d400c1..bfb7bfb1a75a 100644 --- a/components/brave_wallet/browser/wallet_data_files_installer.h +++ b/components/brave_wallet/browser/wallet_data_files_installer.h @@ -51,8 +51,7 @@ class WalletDataFilesInstaller void OnComponentReady(const base::FilePath& path); // component_updater::ComponentUpdateService::Observer: - void OnEvent(update_client::UpdateClient::Observer::Events event, - const std::string& id) override; + void OnEvent(const update_client::CrxUpdateItem& item) override; void ResetForTesting(); diff --git a/components/brave_wallet/browser/wallet_data_files_installer_unittest.cc b/components/brave_wallet/browser/wallet_data_files_installer_unittest.cc index f02d928ddd5f..44549676194b 100644 --- a/components/brave_wallet/browser/wallet_data_files_installer_unittest.cc +++ b/components/brave_wallet/browser/wallet_data_files_installer_unittest.cc @@ -33,6 +33,7 @@ #include "components/component_updater/component_updater_paths.h" #include "components/component_updater/mock_component_updater_service.h" #include "components/sync_preferences/testing_pref_service_syncable.h" +#include "components/update_client/crx_update_item.h" #include "services/data_decoder/public/cpp/test_support/in_process_data_decoder.h" #include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" #include "services/network/test/test_url_loader_factory.h" @@ -203,12 +204,13 @@ class WalletDataFilesInstallerUnitTest : public testing::Test { } void SetOnDemandInstallCallbackWithComponentUpdateError() { + update_client::CrxUpdateItem item; + item.id = kComponentId; + item.state = update_client::ComponentState::kUpdateError; EXPECT_CALL(on_demand_updater_, EnsureInstalled(kComponentId, testing::_)) - .WillOnce([this](const std::string& id, - component_updater::Callback callback) { - installer().OnEvent(update_client::UpdateClient::Observer::Events:: - COMPONENT_UPDATE_ERROR, - kComponentId); + .WillOnce([=, this](const std::string& id, + component_updater::Callback callback) { + installer().OnEvent(item); }); } diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BraveContentSettingsResources.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BraveContentSettingsResources.java index ff2da7084491..1dacd49835f1 100644 --- a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BraveContentSettingsResources.java +++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BraveContentSettingsResources.java @@ -22,7 +22,7 @@ protected static class ResourceItem { int enabledSummary, int disabledSummary, int summaryOverrideForScreenReader) { - assert (false); + assert false; } } diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BraveSingleCategorySettings.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BraveSingleCategorySettings.java index ef96216b5518..41cdb3c7cf00 100644 --- a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BraveSingleCategorySettings.java +++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BraveSingleCategorySettings.java @@ -63,6 +63,6 @@ public void resetList() { @Override public void onAddSite(String primaryPattern, String secondaryPattern) { - assert (false); + assert false; } } diff --git a/components/browsing_data_strings.grdp b/components/browsing_data_strings.grdp index 56c9a7ee0a5a..79f642e2ca78 100644 --- a/components/browsing_data_strings.grdp +++ b/components/browsing_data_strings.grdp @@ -94,10 +94,10 @@ None - + {COUNT, plural, - =1 {1 credit card} - other {# credit cards}} + =1 {1 payment method} + other {# payment methods}} {COUNT, plural, @@ -109,30 +109,38 @@ =1 {1 suggestion} other {# suggestions}} + + {COUNT, plural, + =1 {1 suggestion (device only)} + other {# suggestions (device only)}} + {COUNT, plural, =1 {1 other suggestion} other {# other suggestions}} - + {COUNT, plural, =1 {1 other} other {# others}} - $12 credit cards (synced) + $12 payment methods (synced) - $12 credit cards, $21 address + $12 payment methods, $21 address - $12 credit cards, $21 address (synced) + $12 payment methods, $21 address (synced) - $12 credit cards, $21 address, $35 others + $12 payment methods, $21 address, $35 others - $12 credit cards, $21 address, $35 others (synced) + $12 payment methods, $21 address, $35 others (synced) + + + $12 payment methods; $21 suggestion (device only) This will sign you out of most websites. diff --git a/base/android/java/src/org/chromium/base/cached_flags/BraveCachedFlag.java b/components/cached_flags/android/java/src/org/chromium/components/cached_flags/BraveCachedFlag.java similarity index 97% rename from base/android/java/src/org/chromium/base/cached_flags/BraveCachedFlag.java rename to components/cached_flags/android/java/src/org/chromium/components/cached_flags/BraveCachedFlag.java index 037d83b18dad..e6d16ce1c98e 100644 --- a/base/android/java/src/org/chromium/base/cached_flags/BraveCachedFlag.java +++ b/components/cached_flags/android/java/src/org/chromium/components/cached_flags/BraveCachedFlag.java @@ -3,7 +3,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at https://mozilla.org/MPL/2.0/. */ -package org.chromium.base.cached_flags; +package org.chromium.components.cached_flags; import org.chromium.base.FeatureMap; diff --git a/base/brave_base_cached_flags_java_sources.gni b/components/cached_flags/brave_components_cached_flags_java_sources.gni similarity index 74% rename from base/brave_base_cached_flags_java_sources.gni rename to components/cached_flags/brave_components_cached_flags_java_sources.gni index d6a026abc05a..92fd589bf66b 100644 --- a/base/brave_base_cached_flags_java_sources.gni +++ b/components/cached_flags/brave_components_cached_flags_java_sources.gni @@ -6,4 +6,4 @@ # Since CachedFlag that we extend and ChromeFeatureList that we patch are parts of the same # component, we have to embed our class to this component. Otherwise we will have cycled # dependency. -brave_base_cached_flags_java_sources = [ "//brave/base/android/java/src/org/chromium/base/cached_flags/BraveCachedFlag.java" ] +brave_components_cached_flags_java_sources = [ "//brave/components/cached_flags/android/java/src/org/chromium/components/cached_flags/BraveCachedFlag.java" ] diff --git a/components/commerce_strings.grdp b/components/commerce_strings.grdp index 47cd6558645b..80979ccaf505 100644 --- a/components/commerce_strings.grdp +++ b/components/commerce_strings.grdp @@ -522,7 +522,7 @@ - + Copy @@ -540,8 +540,11 @@ Copied - - Valid until $12023-01-01 + + Discounts + + + Valid until %1$s2023-01-01 Commerce bottom sheet @@ -561,6 +564,9 @@ Add similar products you want to compare + + Open + Citation $11 of $23, $3Laptop, $4http://example.com @@ -642,7 +648,7 @@ Suggestions - + Your comparison table is full. Remove columns to add new ones. diff --git a/components/components_strings.grd b/components/components_strings.grd index 8419a28c81ec..9128d233d8ba 100644 --- a/components/components_strings.grd +++ b/components/components_strings.grd @@ -315,7 +315,6 @@ - @@ -345,9 +344,6 @@ - - - diff --git a/components/components_strings_override.grd b/components/components_strings_override.grd index 7fa64e8716c1..c3d2bc250ce9 100644 --- a/components/components_strings_override.grd +++ b/components/components_strings_override.grd @@ -98,8 +98,6 @@ - - diff --git a/components/compose_strings.grdp b/components/compose_strings.grdp index 8de6cfc9dde7..c0944c549df3 100644 --- a/components/compose_strings.grdp +++ b/components/compose_strings.grdp @@ -18,11 +18,11 @@ Powered by Brave - - Resume writing + + Continue writing - - Open to continue + + Open to resume Help me write. Tab and press enter to open @@ -39,6 +39,7 @@ Go to Settings + Write with more confidence anywhere on the web @@ -102,6 +103,15 @@ Your text and page content are sent to Brave and may be used to improve this feature. <a href="">Learn more</a> + + Polish + + + Elaborate + + + Formalize + Create diff --git a/components/facilitated_payments_strings.grdp b/components/facilitated_payments_strings.grdp index 2a4bc3f109bd..6b61c7ec0d6e 100644 --- a/components/facilitated_payments_strings.grdp +++ b/components/facilitated_payments_strings.grdp @@ -8,8 +8,8 @@ Pay with %1$sPix and e-Wallets - {FINANCIAL_ACCOUNT, plural, =1 {When you make purchases on Brave, see %1$sPix as an option} - other {When you make purchases on Brave, see %1$sPix and e-Wallets as options}} + {FINANCIAL_ACCOUNT, plural, =1 {When you make purchases in Brave, see %1$sPix as an option} + other {When you make purchases in Brave, see %1$sPix and e-Wallets as options}} @@ -19,6 +19,9 @@ Pix • %1$sChecking ••••%2$s1234 + + Limit per Pix R$ %1$s500 + Checking @@ -41,8 +44,17 @@ Account info is encrypted and kept private - - By continuing, you agree to have your precise device location collected and shared with your account holder for fraud prevention purposes. To turn off Pix in Brave, go to your <link1>payment settings</link1> + + To turn off Pix in Brave, go to your <link1>payment settings</link1> + + + Payment methods available to be selected for proceeding with the payment. Keyboard hidden. + + + Payment methods available to be selected for proceeding with the payment opened at full height. + + + The bottom sheet is closed. Something went wrong diff --git a/components/history_strings.grdp b/components/history_strings.grdp index d249dd53d12e..5268093b2c0c 100644 --- a/components/history_strings.grdp +++ b/components/history_strings.grdp @@ -137,6 +137,12 @@ In a few words, describe what you’re looking for, like "comfortable walking shoes" or "vegetarian pasta recipes." As you visit more sites on this device, you’ll see more results powered by AI. + + Get answers from your history, powered by AI + + + You can now also ask questions like "what was that square pizza place in Chicago?" or "what ingredients were in that eggplant pasta recipe?". Using question words like "what", "when", or "where" will help Brave give you better answers. You can also describe what you're looking for such as "comfortable walking shoes". As you visit more sites on this device, you'll see more results powered by AI. + Manage your history search setting @@ -188,6 +194,30 @@ In a few words, describe what you're searching for + + Try something like "what was that square pizza place in Chicago?" + + + Try something like "what ingredients were in that pasta recipe?" + + + Try something like "what was the time of the comedy show?" + + + Try something like "how much was the cargo bike?" + + + Summary + + + Visited Oct 4, 2024$1 + + + Sorry, can't help you with that. + + + Something went wrong. Please try again later. + diff --git a/components/language/android/BUILD.gn b/components/language/android/BUILD.gn deleted file mode 100644 index 65a377950f97..000000000000 --- a/components/language/android/BUILD.gn +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (c) 2024 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 https://mozilla.org/MPL/2.0/. - -import("//build/config/android/rules.gni") - -android_library("java") { - sources = [ "java/src/org/chromium/components/language/BraveLocaleManagerDelegateImpl.java" ] - - deps = [ - "//base:base_java", - "//components/language/android:ulp_delegate_java", - "//third_party/androidx:androidx_annotation_annotation_java", - ] -} diff --git a/components/language/android/java/src/org/chromium/components/language/BraveLocaleManagerDelegateImpl.java b/components/language/android/java/src/org/chromium/components/language/BraveLocaleManagerDelegateImpl.java deleted file mode 100644 index f510fdc6ec32..000000000000 --- a/components/language/android/java/src/org/chromium/components/language/BraveLocaleManagerDelegateImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright (c) 2024 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 https://mozilla.org/MPL/2.0/. */ - -package org.chromium.components.language; - -import android.app.LocaleManager; -import android.os.Build; -import android.os.LocaleList; -import android.text.TextUtils; - -import androidx.annotation.RequiresApi; - -import org.chromium.base.ContextUtils; -import org.chromium.base.Log; - -import java.util.Locale; - -public class BraveLocaleManagerDelegateImpl extends LocaleManagerDelegateImpl { - private static final String TAG = "in_app_language"; - - @RequiresApi(Build.VERSION_CODES.TIRAMISU) - @Override - public Locale getApplicationLocale() { - LocaleList currentAppLocales = - ContextUtils.getApplicationContext() - .getSystemService(LocaleManager.class) - .getApplicationLocales(); - if (!currentAppLocales.isEmpty()) { - return currentAppLocales.get(0); - } - return null; - } - - @RequiresApi(Build.VERSION_CODES.TIRAMISU) - @Override - public void setApplicationLocale(String languageName) { - try { - if (languageName != null && !TextUtils.isEmpty(languageName)) { - ContextUtils.getApplicationContext() - .getSystemService(LocaleManager.class) - .setApplicationLocales(new LocaleList(Locale.forLanguageTag(languageName))); - } - } catch (Exception ex) { - Log.e(TAG, "setApplicationLocale : " + ex.getMessage()); - } - } -} diff --git a/components/management_strings.grdp b/components/management_strings.grdp index 744292478281..426104c214a1 100644 --- a/components/management_strings.grdp +++ b/components/management_strings.grdp @@ -346,6 +346,9 @@ Applied browser policies in your work profile + + <a target="_blank" href="https://support.google.com/chrome/a/?p=browser_profile_details" >Learn more</a> + @@ -419,6 +422,21 @@ + + + Your administrator can change your browser setup remotely. Activity on this device may also be managed outside of Brave. + + + Learn more + + + Your browser is managed by your administrator. + + + Your browser is not managed. + + + @@ -439,4 +457,21 @@ What this means + + + + Profile management + + + Your organization, $1manager.com, requires you to sign in using a specific profile + + + Your organization requires you to sign in using a specific profile. + + + To continue, sign in to $1alice@example.com, then setup a new profile + + + Sign in + diff --git a/components/management_strings_override.grdp b/components/management_strings_override.grdp index fdad70681e5b..51f471765943 100644 --- a/components/management_strings_override.grdp +++ b/components/management_strings_override.grdp @@ -39,6 +39,9 @@ + + + diff --git a/components/new_or_sad_tab_strings.grdp b/components/new_or_sad_tab_strings.grdp index c6168b0e6e92..5cdcbd1567d1 100644 --- a/components/new_or_sad_tab_strings.grdp +++ b/components/new_or_sad_tab_strings.grdp @@ -195,17 +195,20 @@ Third-party cookies are blocked + + Opens a Help Center article in a new tab + Brave blocks sites from using third-party cookies to track you as you browse. - <br/>If site features aren’t working <a target="_blank" href="$1">try temporarily allowing third-party cookies</a>. + <br/>If site features aren’t working <a target="_blank" href="$1" aria-description="$2">try temporarily allowing third-party cookies</a>. Brave blocks sites from using third-party cookies to track you as you browse. - <br/>If site features aren’t working <a target="_blank" href="$1">try temporarily allowing third-party cookies</a>. + <br/>If site features aren’t working <a target="_blank" href="$1" aria-description="$2">try temporarily allowing third-party cookies</a>. diff --git a/components/omnibox_strings.grdp b/components/omnibox_strings.grdp index 4d00121e0493..8d28f64ffe05 100644 --- a/components/omnibox_strings.grdp +++ b/components/omnibox_strings.grdp @@ -238,17 +238,17 @@ - + Thumbs up button, press Enter to submit feedback that you like, $1The Chromium Projects http://www.chromium.org bookmark - + Thumbs up button, press Enter to submit feedback that you like this suggestion - + Thumbs down button, press Enter to open a form for submitting detailed feedback on why you dislike, $1The Chromium Projects http://www.chromium.org bookmark - + Thumbs down button, press Enter to open a form for submitting detailed feedback on why you dislike this suggestion @@ -345,25 +345,25 @@ Type @ to search $1jira.atlassian.com, office.com, salesforce.com - + For a more powerful way to search your browsing history, turn on - + History search, powered by AI - + Your searches, best matches, and their page contents are sent to Brave and may be seen by human reviewers to improve this feature. This is an experimental feature and won't always get it right. - + Learn more - + Type @history to search your browsing history - + Type @history to search your browsing history, powered by AI @@ -377,20 +377,29 @@ - + Enter a word or two - + Enter a word or two - + In a few words, describe what you're searching for - + Enter a word or two - + Enter your question or prompt + + + Last open tabs + + + Search the web + + + diff --git a/components/page_info_strings.grdp b/components/page_info_strings.grdp index 8843e8a7ebb5..ef9b14ab2272 100644 --- a/components/page_info_strings.grdp +++ b/components/page_info_strings.grdp @@ -75,13 +75,13 @@ You should not enter any sensitive information on this site (for example, passwords or credit cards), because it could be stolen by attackers. - Attackers on the site you're trying to visit might install harmful software that steals or deletes things like your password, photos, messages, or credit card number. + Attackers on the site you tried visiting might install harmful software that steals or deletes things like your passwords, photos, messages, or credit card numbers. - Attackers on the site you're trying to visit might trick you into installing software or revealing things like your password, phone, or credit card number. + Attackers on the site you tried visiting might trick you into installing software or revealing things like your passwords, phone, or credit card numbers. - Attackers on the site you're trying to visit might trick you into installing harmful software that affects the way you browse — for example, by changing your homepage or showing you extra ads on sites you visit. + Attackers on the site you tried visiting might trick you into installing harmful software that affects the way you browse — for example, by changing your homepage or showing you extra ads on sites you visit. @@ -440,6 +440,9 @@ Can ask to install web apps + + Can ask to use advanced printer features + @@ -749,23 +752,23 @@ Cookies and other site data are used to remember you, for example to sign you in or to personalize ads. To manage cookies for all sites, see $1Settings. - - Brave limits most sites from using third-party cookies. But third-party cookies are allowed on this site because it relies on them to provide basic services. Visit settings to $1manage your tracking protections. + + Brave limits most sites from using third-party cookies. But third-party cookies are allowed on this site because it relies on them to provide basic services. Visit settings to $1manage access to third-party cookies. - - Brave limits most sites from using third-party cookies to track you as you browse. Visit settings to $1manage your tracking protections. + + Brave limits most sites from using third-party cookies to track you as you browse. Visit settings to $1manage access to third-party cookies. - - You blocked sites from using third-party cookies to track you as you browse. Visit settings to $1manage your tracking protections. + + You blocked sites from using third-party cookies to track you as you browse. Visit settings to $1manage access to third-party cookies. - - Brave blocks sites from using third-party cookies to track you as you browse. Visit settings to $1manage your tracking protections. + + Brave blocks sites from using third-party cookies to track you as you browse. Visit settings to $1manage access to third-party cookies. Settings - - manage your tracking protections + + manage access to third-party cookies Block third-party cookies diff --git a/components/password_manager_strings.grdp b/components/password_manager_strings.grdp index 70bd44bf9555..96556ae96016 100644 --- a/components/password_manager_strings.grdp +++ b/components/password_manager_strings.grdp @@ -129,15 +129,29 @@ Passkey from Brave Password Manager - - Passkey from "$1Dashlane" - Passkey from Windows Hello Passkey from "$1Pixel 7" + + + Passkey • your Brave Profile + + + Passkey • iCloud Keychain + + + Passkey • Brave Password Manager + + + Passkey • Windows Hello + + + Passkey • "$1Pixel 7" + + Use a Passkey on a Different Device @@ -168,6 +182,32 @@ Use a passkey + + + Brave browser is trying to fill your password on $1google.com. + + + You're using your fingerprint for filling passwords + + + You can change whether you use your fingerprint for filling passwords in $1Settings + + + Add more protection to your passwords + + + You can use your fingerprint to verify it's you whenever you use a saved password + + + Brave browser would like to use fingerprint to autofill passwords + + + Brave browser will no longer require your fingerprint to autofill passwords + + + Brave browser is trying to show passwords + + Brave is trying to fill your password on $1google.com. @@ -240,7 +280,7 @@ To use Password Manager with your operating system, relaunch Brave and allow access to your computer's password manager. Your tabs will reopen after relaunching. - + Continue diff --git a/components/permissions_strings.grdp b/components/permissions_strings.grdp index 01d46df6948e..770413efef3f 100644 --- a/components/permissions_strings.grdp +++ b/components/permissions_strings.grdp @@ -324,6 +324,9 @@ This will otherwise be blocked by your privacy settings. This will allow the con Lock your keyboard? + + Lock your keyboard and mouse? + Lock your mouse? @@ -480,16 +483,16 @@ This will otherwise be blocked by your privacy settings. This will allow the con - Your administrator blocked your $1camera for this site + Your administrator doesn't allow $1camera for this site - $1Camera allowed + Your administrator allows $1camera for this site You have allowed $1camera on $2www.google.com - - You previously chose don’t allow for this site + + You previously didn't allow $1camera for this site To use your $1camera on this site, give Brave access @@ -508,15 +511,6 @@ This will otherwise be blocked by your privacy settings. This will allow the con camera and microphone - - - Camera - - - Microphone - - - Camera and microphone macOS diff --git a/components/plus_addresses_strings.grdp b/components/plus_addresses_strings.grdp index 476ecee80e15..70b8f45fe268 100644 --- a/components/plus_addresses_strings.grdp +++ b/components/plus_addresses_strings.grdp @@ -2,272 +2,19 @@ - - - - Create new plus addresses placeholder - - - Select Plus Address placeholder - - - Manage Plus Addresses placeholder - - - - - - Lorem Ipsum - - - Lorem ($1foo@gmail.com). - - - Lorem Ipsum or whatever - - - Cancel - - - Use address - - - Lorem ipsum dolor sit amet, consectetur adipiscing elit, <link>incididunt ut labore et</link>. - - + + Refresh - - Refreshing... - - - First time usage title placeholder. - - - First time usage feature description placeholder. - - - First time usage notice placeholder ($1foo@gmail.com), which includes the redirection link <link>link placeholder</link>. - - - Reserve error title placeholder - - - Reserve error description placeholder. - - - Reserve ok button placeholder - - - Reserver cancel button placeholder - - - - - Lorem Ipsum - - - First time usage title placeholder. - - - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua ($1foo@gmail.com). - - - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua ($1foo@gmail.com). BEGIN_LINKUt enim ad minim veniamEND_LINK - - - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. - - - Lorem ipsum dolor sit amet, consectetur adipiscing elit, BEGIN_LINKUt enim ad minim veniamEND_LINK. - - - Cancel - - - Use Address - - - Loading... - - + Refreshing... - - {count, plural, - =1 {{position} of {count} plus address} - other {{position} of {count} plus addresses}} - - - Manage Plus Address... - - - Create Plus Address... - - - Select Plus Address... - - - Select Plus Address - - - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua - - - Plus address for $1foo.com - - - - - Lorem Ipsum - - - Lorem ($1foo@gmail.com). - - - Settings - - - error-link - - - Lorem ipsum, consectetur adipiscing $1. - - - Lorem Ipsum or whatever - - - Cancel + + + Plus Addresses - - Use address - - - Refresh - - - Generating... - - - First time usage title placeholder. - - - First time usage feature description placeholder. - - - First time usage notice placeholder ($1foo@gmail.com), which includes the redirection link. $2 - - - Learn more - - - Can't get address. Try again. - - - Can't create plus address address. Try again. - - - Try again - - - - - Plus Address - - + Manage plus addresses you've created - - - - Lorem Ipsum - - - Lorem Ipsum - - - Lorem Ipsum foo@gmail.com$1 - - - Refresh plus address - - - Refresh - - - Lorem Ipsum dolor - - - Lorem Ipsum dolor ... - - - Something went wrong. Try again. - - - Something went wrong. Try again. - - - Can't create any more addresses. - - - - - Oops! We found an affiliated plus address - - - We found $1foo.com that can be used for: $2foo@bar.com Use this one instead of creating a new one. - - - Fill with existing address - - - Something went wrong - - - Can't save plus address. - - - Make sure you're online and try again - - - Try again - - - - - Placeholder Plus Address Create Suggestion IPH String - - - Placeholder Plus Address Create Suggestion IPH Screenreader String - - - Placeholder Plus Address Create Suggestion IPH String. - - - Placeholder Plus Address Create Suggestion IPH String - - - Placeholder Plus Address Create Suggestion IPH Screenreader String - - - - - Lorem Ipsum - - - Plus addresses for $1example.com - - - - - - Select Plus Address placeholder - - - Select Plus Address warning placeholder. - - - Search hint placeholder - - diff --git a/components/policy_strings.grdp b/components/policy_strings.grdp index 2c576ae71af3..5b6984d5c2a3 100644 --- a/components/policy_strings.grdp +++ b/components/policy_strings.grdp @@ -810,6 +810,15 @@ Additional details: in descending order + + Streamline how your organization manages policies + + + Brave Enterprise Core gives you a centralized tool for configuring browser policies from the cloud + + + Try Brave Enterprise Core + diff --git a/components/printing_component_strings.grdp b/components/printing_component_strings.grdp index 7a66096d36da..c586f3016916 100644 --- a/components/printing_component_strings.grdp +++ b/components/printing_component_strings.grdp @@ -383,12 +383,18 @@ Reverse order face up + + Reverse order + Same order face down Same order face up + + Same order + System specified diff --git a/components/privacy_sandbox_chrome_strings.grdp b/components/privacy_sandbox_chrome_strings.grdp index b86ee44e72e5..0ef26204da7d 100644 --- a/components/privacy_sandbox_chrome_strings.grdp +++ b/components/privacy_sandbox_chrome_strings.grdp @@ -184,27 +184,18 @@ Ad topics - - Topics of interest are based on your recent browsing history and are used by sites to show you personalized ads - Topics are based on your recent browsing history and are used by sites to show you personalized ads while protecting your identity Ad topics are just one of many things a site can use to personalize ads. Even without ad topics, sites can still show you ads but they may be less personalized. Learn more about <a href="$1" aria-description="$2" target="_blank">managing your ad privacy</a>. - - Your topics - You can block topics you don’t want shared with sites. Brave also auto-deletes your topics older than 4 weeks. Learn more When on, a list of topics appears here based on your recent browsing history - - No topics to show right now - You don't have any active topics yet @@ -223,15 +214,6 @@ Block $1Movies - - Topics you blocked - - - Add an item back if you want it in the pool of topics that Brave can choose from when estimating your interests - - - Blocked topics appear here - Add @@ -241,18 +223,6 @@ Unblock $1Movies - - More about ad topics - - - Brave notes topics of interest based on your browsing history from the last few weeks. - - - Later, a site you visit can ask Brave for your topics to personalize the ads you see. Brave shares up to 3 topics while protecting your browsing history and identity. - - - Brave auto-deletes topics that are older than 4 weeks. As you keep browsing, a topic might reappear on the list. Or you can block topics you don’t want Brave to share with sites. Learn more about managing your ad privacy in Brave. - As you browse, whether an ad you see is personalized depends on this setting, Site-suggested ads, your cookie settings, and if the site you’re viewing personalizes ads diff --git a/components/reset_password_strings.grdp b/components/reset_password_strings.grdp index cd90d1539024..c2bc4735c613 100644 --- a/components/reset_password_strings.grdp +++ b/components/reset_password_strings.grdp @@ -7,18 +7,30 @@ Reset your password now + + Password reuse is monitored by your organization + + + Password reuse is monitored by $1Brave + Reset password? You entered your password on a site that’s not managed by your organization. To protect your account, don’t reuse your password on other apps and sites. + + To maintain security, your organization doesn't allow passwords to be reused in Brave. Passwords in Brave are encrypted to protect user privacy. + You entered your password on a site that’s not managed by <strong>$1Brave</strong>. To protect your account, don’t reuse your password on other apps and sites. Reset password + + Learn about how Brave protects your passwords + Brave recommends resetting your password if you reused it on other sites. diff --git a/components/search_engine_choice_strings.grdp b/components/search_engine_choice_strings.grdp index 186de1691b23..aec322f10015 100644 --- a/components/search_engine_choice_strings.grdp +++ b/components/search_engine_choice_strings.grdp @@ -141,6 +141,6 @@ - Use for all guests + Use for all Guest profiles diff --git a/components/search_engines/brave_prepopulated_engines.cc b/components/search_engines/brave_prepopulated_engines.cc index 4a0daa7ebf8b..c1e55e05faa1 100644 --- a/components/search_engines/brave_prepopulated_engines.cc +++ b/components/search_engines/brave_prepopulated_engines.cc @@ -35,11 +35,33 @@ PrepopulatedEngine MakeBravePrepopulatedEngine(const char16_t* const name, const char* const suggest_url, SearchEngineType type, const int id) { - return {name, keyword, favicon_url, search_url, encoding, suggest_url, - nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, - nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, - nullptr, nullptr, nullptr, 0, nullptr, 0, - type, nullptr, nullptr, id}; + return {name, + keyword, + favicon_url, + search_url, + encoding, + suggest_url, + /*image_url=*/nullptr, + /*image_translate_url=*/nullptr, + /*new_tab_url=*/nullptr, + /*contextual_search_url=*/nullptr, + /*logo_url=*/nullptr, + /*doodle_url=*/nullptr, + /*search_url_post_params=*/nullptr, + /*suggest_url_post_params=*/nullptr, + /*image_url_post_params=*/nullptr, + /*side_search_param=*/nullptr, + /*side_image_search_param=*/nullptr, + /*image_translate_source_language_param_key=*/nullptr, + /*image_translate_target_language_param_key=*/nullptr, + /*image_search_branding_label=*/nullptr, + /*search_intent_params=*/{}, + /*alternate_urls=*/{}, + type, + /*preconnect_to_search_url=*/nullptr, + /*prefetch_likely_navigations=*/nullptr, + id, + /*regulatory_extensions=*/{}}; } // Maps BravePrepopulatedEngineID to Chromium's PrepopulatedEngine. @@ -87,9 +109,7 @@ PrepopulatedEngine ModifyEngineParams(const PrepopulatedEngine& engine, engine.image_translate_target_language_param_key, engine.image_search_branding_label, engine.search_intent_params, - engine.search_intent_params_size, engine.alternate_urls, - engine.alternate_urls_size, engine.type, engine.preconnect_to_search_url, engine.prefetch_likely_navigations, diff --git a/components/security_interstitials_strings.grdp b/components/security_interstitials_strings.grdp index a7213f2aee92..a30d8b36da4c 100644 --- a/components/security_interstitials_strings.grdp +++ b/components/security_interstitials_strings.grdp @@ -253,10 +253,10 @@ - Attackers on the site you're trying to visit might install harmful software that steals or deletes things like your password, photos, messages, or credit card number. Brave strongly recommends going back to safety. <a href="#" id="learn-more-link">Learn more about this warning</a> + Attackers on the site you tried visiting might install harmful software that steals or deletes things like your passwords, photos, messages, or credit card numbers. Brave strongly recommends going back to safety. <a href="#" id="learn-more-link">Learn more about this warning</a> - Brave has built-in safety features to protect you while you browse — like Google Safe Browsing, which <a href="#" id="diagnostic-link">recently found malware</a> on the site you're trying to visit. + Brave has built-in safety features to protect you while you browse — like Google Safe Browsing, which <a href="#" id="diagnostic-link">recently found malware</a> on the site you tried visiting. Even sites that are normally safe are sometimes compromised by attackers. Only visit <a href="#" id="proceed-link">this unsafe site</a> if you're sure you understand the risks. @@ -270,11 +270,11 @@ - Attackers on the site you're trying to visit might trick you into installing harmful software that affects the way you browse — for example, by changing your homepage or showing you extra ads on sites you visit. Brave strongly recommends going back to safety to avoid harm. <a href="#" id="learn-more-link">Learn more about this warning</a> + Attackers on the site you tried visiting might trick you into installing harmful software that affects the way you browse — for example, by changing your homepage or showing you extra ads on sites you visit. Brave strongly recommends going back to safety to avoid harm. <a href="#" id="learn-more-link">Learn more about this warning</a> - Brave has built-in safety features to protect you while you browse — like Google Safe Browsing, which recently <a href="#" id="diagnostic-link">found harmful software</a> on the site you're trying to visit. + Brave has built-in safety features to protect you while you browse — like Google Safe Browsing, which recently <a href="#" id="diagnostic-link">found harmful software</a> on the site you tried visiting. @@ -283,10 +283,10 @@ - Attackers on the site you're trying to visit might trick you into installing software or revealing things like your password, phone, or credit card number. Brave strongly recommends going back to safety. <a href="#" id="learn-more-link">Learn more about this warning</a> + Attackers on the site you tried visiting might trick you into installing software or revealing things like your passwords, phone, or credit card numbers. Brave strongly recommends going back to safety. <a href="#" id="learn-more-link">Learn more about this warning</a> - Brave has built-in safety features to protect you while you browse — like Google Safe Browsing, which <a href="#" id="diagnostic-link">recently found phishing</a> on the site you're trying to visit. Phishing sites pretend to be other sites to trick you.<br/><br/>Even sites that are normally safe are sometimes compromised by attackers. <a href="#" id="report-error-link">Let us know</a> if you think there's been a mistake and that this site doesn't pose a danger. + Brave has built-in safety features to protect you while you browse — like Google Safe Browsing, which <a href="#" id="diagnostic-link">recently found phishing</a> on the site you tried visiting. Phishing sites pretend to be other sites to trick you.<br/><br/>Even sites that are normally safe are sometimes compromised by attackers. <a href="#" id="report-error-link">Let us know</a> if you think there's been a mistake and that this site doesn't pose a danger. Only visit <a href="#" id="proceed-link">this unsafe site</a> if you're sure you understand the risks. diff --git a/components/signin/public/identity_manager/brave_identity_manager_unittest.cc b/components/signin/public/identity_manager/brave_identity_manager_unittest.cc index 3aea2bbe716a..57ffb79ee872 100644 --- a/components/signin/public/identity_manager/brave_identity_manager_unittest.cc +++ b/components/signin/public/identity_manager/brave_identity_manager_unittest.cc @@ -163,14 +163,6 @@ class BraveIdentityManagerTest : public testing::Test { std::make_unique(identity_manager_.get()); } - void TriggerListAccounts() { - std::vector signed_in_accounts; - std::vector signed_out_accounts; - bool accounts_are_fresh = gaia_cookie_manager_service()->ListAccounts( - &signed_in_accounts, &signed_out_accounts); - static_cast(accounts_are_fresh); - } - const CoreAccountId& primary_account_id() const { return primary_account_id_; } @@ -200,22 +192,22 @@ TEST_F(BraveIdentityManagerTest, GetAccountsInCookieJarWithNoAccounts) { SetListAccountsResponseNoAccounts(test_url_loader_factory()); - TriggerListAccounts(); + gaia_cookie_manager_service()->TriggerListAccounts(); const AccountsInCookieJarInfo& accounts_in_cookie_jar = identity_manager()->GetAccountsInCookieJar(); - EXPECT_FALSE(accounts_in_cookie_jar.accounts_are_fresh); - EXPECT_TRUE(accounts_in_cookie_jar.signed_in_accounts.empty()); - EXPECT_TRUE(accounts_in_cookie_jar.signed_out_accounts.empty()); + EXPECT_FALSE(accounts_in_cookie_jar.AreAccountsFresh()); + EXPECT_TRUE(accounts_in_cookie_jar.GetSignedInAccounts().empty()); + EXPECT_TRUE(accounts_in_cookie_jar.GetSignedOutAccounts().empty()); run_loop.Run(); - TriggerListAccounts(); + gaia_cookie_manager_service()->TriggerListAccounts(); const AccountsInCookieJarInfo updated_accounts_in_cookie_jar = identity_manager()->GetAccountsInCookieJar(); - EXPECT_FALSE(updated_accounts_in_cookie_jar.accounts_are_fresh); - EXPECT_TRUE(updated_accounts_in_cookie_jar.signed_in_accounts.empty()); - EXPECT_TRUE(updated_accounts_in_cookie_jar.signed_out_accounts.empty()); + EXPECT_FALSE(updated_accounts_in_cookie_jar.AreAccountsFresh()); + EXPECT_TRUE(updated_accounts_in_cookie_jar.GetSignedInAccounts().empty()); + EXPECT_TRUE(updated_accounts_in_cookie_jar.GetSignedOutAccounts().empty()); } TEST_F(BraveIdentityManagerTest, GetAccountsInCookieJarWithOneAccount) { @@ -226,22 +218,22 @@ TEST_F(BraveIdentityManagerTest, GetAccountsInCookieJarWithOneAccount) { SetListAccountsResponseOneAccount(kTestEmail, kTestGaiaId, test_url_loader_factory()); - TriggerListAccounts(); + gaia_cookie_manager_service()->TriggerListAccounts(); const AccountsInCookieJarInfo& accounts_in_cookie_jar = identity_manager()->GetAccountsInCookieJar(); - EXPECT_FALSE(accounts_in_cookie_jar.accounts_are_fresh); - EXPECT_TRUE(accounts_in_cookie_jar.signed_in_accounts.empty()); - EXPECT_TRUE(accounts_in_cookie_jar.signed_out_accounts.empty()); + EXPECT_FALSE(accounts_in_cookie_jar.AreAccountsFresh()); + EXPECT_TRUE(accounts_in_cookie_jar.GetSignedInAccounts().empty()); + EXPECT_TRUE(accounts_in_cookie_jar.GetSignedOutAccounts().empty()); run_loop.Run(); - TriggerListAccounts(); + gaia_cookie_manager_service()->TriggerListAccounts(); const AccountsInCookieJarInfo& updated_accounts_in_cookie_jar = identity_manager()->GetAccountsInCookieJar(); - EXPECT_FALSE(updated_accounts_in_cookie_jar.accounts_are_fresh); - EXPECT_TRUE(updated_accounts_in_cookie_jar.signed_in_accounts.empty()); - EXPECT_TRUE(updated_accounts_in_cookie_jar.signed_out_accounts.empty()); + EXPECT_FALSE(updated_accounts_in_cookie_jar.AreAccountsFresh()); + EXPECT_TRUE(updated_accounts_in_cookie_jar.GetSignedInAccounts().empty()); + EXPECT_TRUE(updated_accounts_in_cookie_jar.GetSignedOutAccounts().empty()); } TEST_F(BraveIdentityManagerTest, GetAccountsInCookieJarWithTwoAccounts) { @@ -252,22 +244,22 @@ TEST_F(BraveIdentityManagerTest, GetAccountsInCookieJarWithTwoAccounts) { SetListAccountsResponseTwoAccounts(kTestEmail, kTestGaiaId, kTestEmail2, kTestGaiaId2, test_url_loader_factory()); - TriggerListAccounts(); + gaia_cookie_manager_service()->TriggerListAccounts(); const AccountsInCookieJarInfo& accounts_in_cookie_jar = identity_manager()->GetAccountsInCookieJar(); - EXPECT_FALSE(accounts_in_cookie_jar.accounts_are_fresh); - EXPECT_TRUE(accounts_in_cookie_jar.signed_in_accounts.empty()); - EXPECT_TRUE(accounts_in_cookie_jar.signed_out_accounts.empty()); + EXPECT_FALSE(accounts_in_cookie_jar.AreAccountsFresh()); + EXPECT_TRUE(accounts_in_cookie_jar.GetSignedInAccounts().empty()); + EXPECT_TRUE(accounts_in_cookie_jar.GetSignedOutAccounts().empty()); run_loop.Run(); - TriggerListAccounts(); + gaia_cookie_manager_service()->TriggerListAccounts(); const AccountsInCookieJarInfo& updated_accounts_in_cookie_jar = identity_manager()->GetAccountsInCookieJar(); - EXPECT_FALSE(updated_accounts_in_cookie_jar.accounts_are_fresh); - EXPECT_TRUE(updated_accounts_in_cookie_jar.signed_in_accounts.empty()); - EXPECT_TRUE(updated_accounts_in_cookie_jar.signed_out_accounts.empty()); + EXPECT_FALSE(updated_accounts_in_cookie_jar.AreAccountsFresh()); + EXPECT_TRUE(updated_accounts_in_cookie_jar.GetSignedInAccounts().empty()); + EXPECT_TRUE(updated_accounts_in_cookie_jar.GetSignedOutAccounts().empty()); } } // namespace signin diff --git a/components/sync/service/brave_sync_service_impl.cc b/components/sync/service/brave_sync_service_impl.cc index e151adb8d8f4..6492eb0f3829 100644 --- a/components/sync/service/brave_sync_service_impl.cc +++ b/components/sync/service/brave_sync_service_impl.cc @@ -365,20 +365,9 @@ void BraveSyncServiceImpl::OnSyncCycleCompleted( void BraveSyncServiceImpl::UpdateP3AObjectsNumber() { synced_objects_context_.Reset(GetUserSettings()->GetSelectedTypes().size()); - for (UserSelectableType user_selected_type : - GetUserSettings()->GetSelectedTypes()) { - DataType data_type = - UserSelectableTypeToCanonicalDataType(user_selected_type); - - auto dtc_it = data_type_manager_->GetControllerMap().find(data_type); - CHECK(dtc_it != data_type_manager_->GetControllerMap().end()) - << "Missing controller for type " << DataTypeToDebugString(data_type); - - DataTypeController* controller = dtc_it->second.get(); - controller->GetTypeEntitiesCount( - base::BindOnce(&BraveSyncServiceImpl::OnGetTypeEntitiesCount, - weak_ptr_factory_.GetWeakPtr())); - } + data_type_manager_->GetEntityCountsForDebugging( + base::BindRepeating(&BraveSyncServiceImpl::OnGetTypeEntitiesCount, + weak_ptr_factory_.GetWeakPtr())); } void BraveSyncServiceImpl::OnGetTypeEntitiesCount( diff --git a/components/version_ui_strings.grdp b/components/version_ui_strings.grdp index 68bf0db48533..ae58f6018732 100644 --- a/components/version_ui_strings.grdp +++ b/components/version_ui_strings.grdp @@ -87,7 +87,13 @@ Variations Seed Type - Command-line variations + Command-line Variations + + + Copy variations string + + + Copied variations string to clipboard diff --git a/ios/app/brave_core_main.mm b/ios/app/brave_core_main.mm index 2533291675f1..e28bdbe1b11c 100644 --- a/ios/app/brave_core_main.mm +++ b/ios/app/brave_core_main.mm @@ -106,7 +106,7 @@ @interface BraveCoreMain () { std::unique_ptr _otr_browser; raw_ptr _browserList; raw_ptr _otr_browserList; - raw_ptr _mainBrowserState; + raw_ptr _main_profile; scoped_refptr _p3a_service; scoped_refptr _histogram_braveizer; } @@ -209,27 +209,26 @@ - (instancetype)initWithUserAgent:(NSString*)userAgent _webMain = std::make_unique(std::move(params)); // Initialize and set the main browser state. - ChromeBrowserState* chromeBrowserState = - GetApplicationContext() - ->GetProfileManager() - ->GetLastUsedProfileDeprecatedDoNotUse(); - _mainBrowserState = chromeBrowserState; + std::vector profiles = + GetApplicationContext()->GetProfileManager()->GetLoadedProfiles(); + ProfileIOS* last_used_profile = profiles.at(0); + _main_profile = last_used_profile; // Disable Safe-Browsing via Prefs - chromeBrowserState->GetPrefs()->SetBoolean(prefs::kSafeBrowsingEnabled, - false); + last_used_profile->GetPrefs()->SetBoolean(prefs::kSafeBrowsingEnabled, + false); // Setup main browser - _browserList = BrowserListFactory::GetForBrowserState(_mainBrowserState); - _browser = Browser::Create(_mainBrowserState, {}); + _browserList = BrowserListFactory::GetForBrowserState(_main_profile); + _browser = Browser::Create(_main_profile, {}); _browserList->AddBrowser(_browser.get()); // Setup otr browser - ChromeBrowserState* otrChromeBrowserState = - chromeBrowserState->GetOffTheRecordChromeBrowserState(); + ProfileIOS* otr_last_used_profile = + last_used_profile->GetOffTheRecordProfile(); _otr_browserList = - BrowserListFactory::GetForBrowserState(otrChromeBrowserState); - _otr_browser = Browser::Create(otrChromeBrowserState, {}); + BrowserListFactory::GetForBrowserState(otr_last_used_profile); + _otr_browser = Browser::Create(otr_last_used_profile, {}); _otr_browserList->AddBrowser(_otr_browser.get()); // Initialize the provider UI global state. @@ -254,7 +253,7 @@ - (instancetype)initWithUserAgent:(NSString*)userAgent #if BUILDFLAG(IOS_CREDENTIAL_PROVIDER_ENABLED) if (IsCredentialProviderExtensionSupported()) { - CredentialProviderServiceFactory::GetForBrowserState(_mainBrowserState); + CredentialProviderServiceFactory::GetForBrowserState(_main_profile); } #endif } @@ -275,21 +274,20 @@ - (void)dealloc { _webImageDownloader = nil; _otr_browserList = - BrowserListFactory::GetForBrowserState(_otr_browser->GetBrowserState()); + BrowserListFactory::GetForBrowserState(_otr_browser->GetProfile()); [_otr_browser->GetCommandDispatcher() prepareForShutdown]; _otr_browserList->RemoveBrowser(_otr_browser.get()); CloseAllWebStates(*_otr_browser->GetWebStateList(), WebStateList::CLOSE_NO_FLAGS); _otr_browser.reset(); - _browserList = - BrowserListFactory::GetForBrowserState(_browser->GetBrowserState()); + _browserList = BrowserListFactory::GetForBrowserState(_browser->GetProfile()); [_browser->GetCommandDispatcher() prepareForShutdown]; _browserList->RemoveBrowser(_browser.get()); CloseAllWebStates(*_browser->GetWebStateList(), WebStateList::CLOSE_NO_FLAGS); _browser.reset(); - _mainBrowserState = nullptr; + _main_profile = nullptr; _webMain.reset(); _raw_args.reset(); _argv_store = {}; @@ -360,10 +358,11 @@ static bool CustomLogHandler(int severity, - (BraveBookmarksAPI*)bookmarksAPI { if (!_bookmarksAPI) { + ProfileIOS* profile = ProfileIOS::FromBrowserState(_main_profile); bookmarks::BookmarkModel* bookmark_model = - ios::BookmarkModelFactory::GetForBrowserState(_mainBrowserState); + ios::BookmarkModelFactory::GetForProfile(profile); BookmarkUndoService* bookmark_undo_service = - ios::BookmarkUndoServiceFactory::GetForBrowserState(_mainBrowserState); + ios::BookmarkUndoServiceFactory::GetForProfile(profile); _bookmarksAPI = [[BraveBookmarksAPI alloc] initWithBookmarkModel:bookmark_model @@ -374,8 +373,7 @@ - (BraveBookmarksAPI*)bookmarksAPI { - (BraveHistoryAPI*)historyAPI { if (!_historyAPI) { - _historyAPI = - [[BraveHistoryAPI alloc] initWithBrowserState:_mainBrowserState]; + _historyAPI = [[BraveHistoryAPI alloc] initWithBrowserState:_main_profile]; } return _historyAPI; } @@ -383,10 +381,10 @@ - (BraveHistoryAPI*)historyAPI { - (BraveOpenTabsAPI*)openTabsAPI { if (!_openTabsAPI) { syncer::SyncService* sync_service_ = - SyncServiceFactory::GetForBrowserState(_mainBrowserState); + SyncServiceFactory::GetForBrowserState(_main_profile); sync_sessions::SessionSyncService* session_sync_service_ = - SessionSyncServiceFactory::GetForBrowserState(_mainBrowserState); + SessionSyncServiceFactory::GetForBrowserState(_main_profile); _openTabsAPI = [[BraveOpenTabsAPI alloc] initWithSyncService:sync_service_ @@ -399,7 +397,7 @@ - (BravePasswordAPI*)passwordAPI { if (!_passwordAPI) { scoped_refptr password_store_ = IOSChromeProfilePasswordStoreFactory::GetForBrowserState( - _mainBrowserState, ServiceAccessType::EXPLICIT_ACCESS) + _main_profile, ServiceAccessType::EXPLICIT_ACCESS) .get(); _passwordAPI = @@ -411,7 +409,7 @@ - (BravePasswordAPI*)passwordAPI { - (BraveSendTabAPI*)sendTabAPI { if (!_sendTabAPI) { send_tab_to_self::SendTabToSelfSyncService* sync_service_ = - SendTabToSelfSyncServiceFactory::GetForBrowserState(_mainBrowserState); + SendTabToSelfSyncServiceFactory::GetForProfile(_main_profile); _sendTabAPI = [[BraveSendTabAPI alloc] initWithSyncService:sync_service_]; } @@ -420,7 +418,7 @@ - (BraveSendTabAPI*)sendTabAPI { - (BraveSyncAPI*)syncAPI { if (!_syncAPI) { - _syncAPI = [[BraveSyncAPI alloc] initWithBrowserState:_mainBrowserState]; + _syncAPI = [[BraveSyncAPI alloc] initWithBrowserState:_main_profile]; } return _syncAPI; } @@ -428,7 +426,7 @@ - (BraveSyncAPI*)syncAPI { - (BraveSyncProfileServiceIOS*)syncProfileService { if (!_syncProfileService) { syncer::SyncService* sync_service_ = - SyncServiceFactory::GetForBrowserState(_mainBrowserState); + SyncServiceFactory::GetForBrowserState(_main_profile); _syncProfileService = [[BraveSyncProfileServiceIOS alloc] initWithProfileSyncService:sync_service_]; } @@ -446,7 +444,7 @@ - (BraveTabGeneratorAPI*)tabGeneratorAPI { - (WebImageDownloader*)webImageDownloader { if (!_webImageDownloader) { _webImageDownloader = [[WebImageDownloader alloc] - initWithBrowserState:_otr_browser->GetBrowserState()]; + initWithBrowserState:_otr_browser->GetProfile()]; } return _webImageDownloader; } @@ -454,7 +452,7 @@ - (WebImageDownloader*)webImageDownloader { - (BraveWalletAPI*)braveWalletAPI { if (!_braveWalletAPI) { _braveWalletAPI = - [[BraveWalletAPI alloc] initWithBrowserState:_mainBrowserState]; + [[BraveWalletAPI alloc] initWithBrowserState:_main_profile]; } return _braveWalletAPI; } @@ -468,12 +466,12 @@ - (HTTPSUpgradeExceptionsService*)httpsUpgradeExceptionsService { } - (BraveStats*)braveStats { - return [[BraveStats alloc] initWithBrowserState:_mainBrowserState]; + return [[BraveStats alloc] initWithBrowserState:_main_profile]; } - (id)ipfsAPI { if (!_ipfsAPI) { - _ipfsAPI = [[IpfsAPIImpl alloc] initWithBrowserState:_mainBrowserState]; + _ipfsAPI = [[IpfsAPIImpl alloc] initWithBrowserState:_main_profile]; } return _ipfsAPI; } @@ -503,14 +501,13 @@ - (BraveP3AUtils*)p3aUtils { - (DeAmpPrefs*)deAmpPrefs { if (!_deAmpPrefs) { _deAmpPrefs = - [[DeAmpPrefs alloc] initWithProfileState:_mainBrowserState->GetPrefs()]; + [[DeAmpPrefs alloc] initWithProfileState:_main_profile->GetPrefs()]; } return _deAmpPrefs; } - (AIChat*)aiChatAPIWithDelegate:(id)delegate { - return [[AIChat alloc] initWithChromeBrowserState:_mainBrowserState - delegate:delegate]; + return [[AIChat alloc] initWithProfileIOS:_main_profile delegate:delegate]; } + (bool)initializeICUForTesting { @@ -522,7 +519,7 @@ + (bool)initializeICUForTesting { #if BUILDFLAG(IOS_CREDENTIAL_PROVIDER_ENABLED) - (void)performFaviconsCleanup { - ChromeBrowserState* browserState = _mainBrowserState; + ProfileIOS* browserState = _main_profile; if (!browserState) { return; } diff --git a/ios/brave-ios/Sources/CredentialProviderUI/CredentialListView.swift b/ios/brave-ios/Sources/CredentialProviderUI/CredentialListView.swift index e54b490be1af..c2dc60f7ef03 100644 --- a/ios/brave-ios/Sources/CredentialProviderUI/CredentialListView.swift +++ b/ios/brave-ios/Sources/CredentialProviderUI/CredentialListView.swift @@ -209,6 +209,10 @@ extension CredentialListModel { return false } + func creationDate() -> Date { + return Date() + } + var favicon: String! var recordIdentifier: String! var gaia: String! diff --git a/ios/browser/api/ads/brave_ads.mm b/ios/browser/api/ads/brave_ads.mm index d987b1bd4a88..6132d5de1a84 100644 --- a/ios/browser/api/ads/brave_ads.mm +++ b/ios/browser/api/ads/brave_ads.mm @@ -396,13 +396,11 @@ - (void)stopNetworkMonitor { #pragma mark - Profile prefs - (void)initProfilePrefService { - ChromeBrowserState* chromeBrowserState = - GetApplicationContext() - ->GetProfileManager() - ->GetLastUsedProfileDeprecatedDoNotUse(); - CHECK(chromeBrowserState); + std::vector profiles = + GetApplicationContext()->GetProfileManager()->GetLoadedProfiles(); + ProfileIOS* last_used_profile = profiles.at(0); - _profilePrefService = chromeBrowserState->GetPrefs(); + _profilePrefService = last_used_profile->GetPrefs(); CHECK(_profilePrefService); } diff --git a/ios/browser/api/ai_chat/ai_chat+private.h b/ios/browser/api/ai_chat/ai_chat+private.h index e39d4743c551..03be66957879 100644 --- a/ios/browser/api/ai_chat/ai_chat+private.h +++ b/ios/browser/api/ai_chat/ai_chat+private.h @@ -8,12 +8,12 @@ #include "brave/ios/browser/api/ai_chat/ai_chat.h" -class ChromeBrowserState; +class ProfileIOS; @protocol AIChatDelegate; @interface AIChat (Private) -- (instancetype)initWithChromeBrowserState:(ChromeBrowserState*)browserState - delegate:(id)delegate; +- (instancetype)initWithProfileIOS:(ProfileIOS*)profile + delegate:(id)delegate; @end #endif // BRAVE_IOS_BROWSER_API_AI_CHAT_AI_CHAT_PRIVATE_H_ diff --git a/ios/browser/api/ai_chat/ai_chat.mm b/ios/browser/api/ai_chat/ai_chat.mm index 20c931903b4d..461697f02805 100644 --- a/ios/browser/api/ai_chat/ai_chat.mm +++ b/ios/browser/api/ai_chat/ai_chat.mm @@ -33,7 +33,7 @@ #include "ios/web/public/thread/web_thread.h" @interface AIChat () { - raw_ptr browser_state_; + raw_ptr profile_; raw_ptr service_; raw_ptr model_service_; raw_ptr current_conversation_; @@ -49,19 +49,17 @@ @interface AIChat () { @end @implementation AIChat -- (instancetype)initWithChromeBrowserState:(ChromeBrowserState*)browserState - delegate:(id)delegate { +- (instancetype)initWithProfileIOS:(ProfileIOS*)profile + delegate:(id)delegate { if ((self = [super init])) { - browser_state_ = browserState; + profile_ = profile; delegate_ = delegate; - model_service_ = - ai_chat::ModelServiceFactory::GetForBrowserState(browser_state_); - service_ = - ai_chat::AIChatServiceFactory::GetForBrowserState(browser_state_); + model_service_ = ai_chat::ModelServiceFactory::GetForBrowserState(profile_); + service_ = ai_chat::AIChatServiceFactory::GetForBrowserState(profile_); current_content_ = std::make_unique( - browser_state_->GetSharedURLLoaderFactory(), delegate); + profile_->GetSharedURLLoaderFactory(), delegate); [self createNewConversation]; } @@ -89,7 +87,7 @@ - (bool)isAgreementAccepted { } - (void)setIsAgreementAccepted:(bool)accepted { - ai_chat::SetUserOptedIn(user_prefs::UserPrefs::Get(browser_state_), accepted); + ai_chat::SetUserOptedIn(user_prefs::UserPrefs::Get(profile_), accepted); } - (void)changeModel:(NSString*)modelKey { diff --git a/ios/browser/api/ai_chat/ai_chat_service_factory.h b/ios/browser/api/ai_chat/ai_chat_service_factory.h index 893409747fe1..8f41a2224f79 100644 --- a/ios/browser/api/ai_chat/ai_chat_service_factory.h +++ b/ios/browser/api/ai_chat/ai_chat_service_factory.h @@ -12,7 +12,7 @@ #include "brave/components/ai_chat/core/browser/ai_chat_metrics.h" #include "components/keyed_service/ios/browser_state_keyed_service_factory.h" -class ChromeBrowserState; +class ProfileIOS; namespace base { @@ -27,7 +27,7 @@ class AIChatService; class AIChatServiceFactory : public BrowserStateKeyedServiceFactory { public: - static AIChatService* GetForBrowserState(ChromeBrowserState* browser_state); + static AIChatService* GetForBrowserState(ProfileIOS* profile); static AIChatServiceFactory* GetInstance(); AIChatServiceFactory(const AIChatServiceFactory&) = delete; diff --git a/ios/browser/api/ai_chat/ai_chat_service_factory.mm b/ios/browser/api/ai_chat/ai_chat_service_factory.mm index 323e685507d2..23c2e88dd4b4 100644 --- a/ios/browser/api/ai_chat/ai_chat_service_factory.mm +++ b/ios/browser/api/ai_chat/ai_chat_service_factory.mm @@ -25,10 +25,9 @@ namespace ai_chat { // static -AIChatService* AIChatServiceFactory::GetForBrowserState( - ChromeBrowserState* browser_state) { +AIChatService* AIChatServiceFactory::GetForBrowserState(ProfileIOS* profile) { return static_cast( - GetInstance()->GetServiceForBrowserState(browser_state, true)); + GetInstance()->GetServiceForBrowserState(profile, true)); } // static @@ -51,20 +50,20 @@ if (!features::IsAIChatEnabled()) { return nullptr; } - auto* browser_state = ChromeBrowserState::FromBrowserState(context); - if (browser_state->IsOffTheRecord()) { + auto* profile = ProfileIOS::FromBrowserState(context); + if (profile->IsOffTheRecord()) { return nullptr; } auto skus_service_getter = base::BindRepeating( - [](ChromeBrowserState* browser_state) { - return skus::SkusServiceFactory::GetForBrowserState(browser_state); + [](ProfileIOS* profile) { + return skus::SkusServiceFactory::GetForBrowserState(profile); }, - base::Unretained(browser_state)); + base::Unretained(profile)); auto credential_manager = std::make_unique( std::move(skus_service_getter), GetApplicationContext()->GetLocalState()); ModelService* model_service = - ModelServiceFactory::GetForBrowserState(browser_state); + ModelServiceFactory::GetForBrowserState(profile); return std::make_unique( model_service, std::move(credential_manager), user_prefs::UserPrefs::Get(context), ai_chat_metrics_.get(), diff --git a/ios/browser/api/ai_chat/model_service_factory.h b/ios/browser/api/ai_chat/model_service_factory.h index 491b4a6398bd..5bd022964caa 100644 --- a/ios/browser/api/ai_chat/model_service_factory.h +++ b/ios/browser/api/ai_chat/model_service_factory.h @@ -11,7 +11,7 @@ #include "base/no_destructor.h" #include "components/keyed_service/ios/browser_state_keyed_service_factory.h" -class ChromeBrowserState; +class ProfileIOS; namespace base { @@ -25,9 +25,8 @@ class ModelService; class ModelServiceFactory : public BrowserStateKeyedServiceFactory { public: - static ModelService* GetForBrowserState(ChromeBrowserState* browser_state); - static ModelService* GetForBrowserStateIfExists( - ChromeBrowserState* browser_state); + static ModelService* GetForBrowserState(ProfileIOS* profile); + static ModelService* GetForBrowserStateIfExists(ProfileIOS* profile); static ModelServiceFactory* GetInstance(); ModelServiceFactory(const ModelServiceFactory&) = delete; diff --git a/ios/browser/api/ai_chat/model_service_factory.mm b/ios/browser/api/ai_chat/model_service_factory.mm index 63b9d54a5eab..d1cda92f8050 100644 --- a/ios/browser/api/ai_chat/model_service_factory.mm +++ b/ios/browser/api/ai_chat/model_service_factory.mm @@ -14,16 +14,15 @@ #include "ios/chrome/browser/shared/model/profile/profile_ios.h" namespace ai_chat { -ModelService* ModelServiceFactory::GetForBrowserState( - ChromeBrowserState* browser_state) { +ModelService* ModelServiceFactory::GetForBrowserState(ProfileIOS* profile) { return static_cast( - GetInstance()->GetServiceForBrowserState(browser_state, true)); + GetInstance()->GetServiceForBrowserState(profile, true)); } ModelService* ModelServiceFactory::GetForBrowserStateIfExists( - ChromeBrowserState* browser_state) { + ProfileIOS* profile) { return static_cast( - GetInstance()->GetServiceForBrowserState(browser_state, false)); + GetInstance()->GetServiceForBrowserState(profile, false)); } ModelServiceFactory* ModelServiceFactory::GetInstance() { diff --git a/ios/browser/api/bookmarks/brave_bookmarks_api.mm b/ios/browser/api/bookmarks/brave_bookmarks_api.mm index 38c2ee0a3e7d..85381442ad08 100644 --- a/ios/browser/api/bookmarks/brave_bookmarks_api.mm +++ b/ios/browser/api/bookmarks/brave_bookmarks_api.mm @@ -545,12 +545,11 @@ - (void)removeObserver:(id)observer { - (bool)editingEnabled { DCHECK_CURRENTLY_ON(web::WebThread::UI); - ChromeBrowserState* browserState = - GetApplicationContext() - ->GetProfileManager() - ->GetLastUsedProfileDeprecatedDoNotUse(); + std::vector profiles = + GetApplicationContext()->GetProfileManager()->GetLoadedProfiles(); + ProfileIOS* last_used_profile = profiles.at(0); - PrefService* prefs = user_prefs::UserPrefs::Get(browserState); + PrefService* prefs = user_prefs::UserPrefs::Get(last_used_profile); return prefs->GetBoolean(bookmarks::prefs::kEditBookmarksEnabled); } diff --git a/ios/browser/api/bookmarks/exporter/bookmark_html_writer.cc b/ios/browser/api/bookmarks/exporter/bookmark_html_writer.cc index 6a80f2420316..171ddf768b93 100644 --- a/ios/browser/api/bookmarks/exporter/bookmark_html_writer.cc +++ b/ios/browser/api/bookmarks/exporter/bookmark_html_writer.cc @@ -109,7 +109,7 @@ class BookmarkFaviconFetcher : public base::SupportsUserData::Data { typedef std::map> URLFaviconMap; - BookmarkFaviconFetcher(ChromeBrowserState* browser_state, + BookmarkFaviconFetcher(ProfileIOS* profile, const base::FilePath& path, BookmarksExportObserver* observer); BookmarkFaviconFetcher(const BookmarkFaviconFetcher&) = delete; @@ -137,7 +137,7 @@ class BookmarkFaviconFetcher : public base::SupportsUserData::Data { const favicon_base::FaviconRawBitmapResult& bitmap_result); // The Profile object used for accessing FaviconService, bookmarks model. - raw_ptr browser_state_; + raw_ptr profile_; // All URLs that are extracted from bookmarks. Used to fetch favicons // for each of them. After favicon is fetched top url is removed from list. @@ -459,18 +459,18 @@ class BookmarkWriter { } // namespace BookmarkFaviconFetcher::BookmarkFaviconFetcher( - ChromeBrowserState* browser_state, + ProfileIOS* profile, const base::FilePath& path, BookmarksExportObserver* observer) - : browser_state_(browser_state), path_(path), observer_(observer) { - DCHECK(!browser_state->IsOffTheRecord()); + : profile_(profile), path_(path), observer_(observer) { + DCHECK(!profile->IsOffTheRecord()); favicons_map_.reset(new URLFaviconMap()); } void BookmarkFaviconFetcher::ExportBookmarks() { // bookmark_bar, mobile and other are children of the root node. - ExtractUrls(ios::BookmarkModelFactory::GetForBrowserState(browser_state_) - ->root_node()); + ExtractUrls( + ios::BookmarkModelFactory::GetForBrowserState(profile_)->root_node()); if (!bookmark_urls_.empty()) { FetchNextFavicon(); } else { @@ -498,7 +498,7 @@ void BookmarkFaviconFetcher::ExecuteWriter() { // for the duration of the write), as such we make a copy of the // BookmarkModel using BookmarkCodec then write from that. bookmarks::BookmarkModel* bookmark_model = - ios::BookmarkModelFactory::GetForBrowserState(browser_state_); + ios::BookmarkModelFactory::GetForBrowserState(profile_); BookmarkCodec codec; base::ThreadPool::PostTask( FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT}, @@ -506,7 +506,7 @@ void BookmarkFaviconFetcher::ExecuteWriter() { &Writer::DoWrite, base::MakeRefCounted(bookmark_model, path_, favicons_map_.release(), observer_))); - browser_state_->RemoveUserData(kBookmarkFaviconFetcherKey); + profile_->RemoveUserData(kBookmarkFaviconFetcherKey); // |this| is deleted! } @@ -521,7 +521,7 @@ bool BookmarkFaviconFetcher::FetchNextFavicon() { if (favicons_map_->end() == iter) { favicon::FaviconService* favicon_service = ios::FaviconServiceFactory::GetForBrowserState( - browser_state_, ServiceAccessType::EXPLICIT_ACCESS); + profile_, ServiceAccessType::EXPLICIT_ACCESS); favicon_service->GetRawFaviconForPageURL( GURL(url), {favicon_base::IconType::kFavicon}, gfx::kFaviconSize, /*fallback_to_host=*/false, @@ -576,17 +576,18 @@ void BookmarkWriter::ExecuteWriter() { namespace bookmark_html_writer { -void WriteBookmarks(ChromeBrowserState* browser_state, +void WriteBookmarks(ProfileIOS* profile, const base::FilePath& path, BookmarksExportObserver* observer) { // We allow only one concurrent bookmark export operation per profile. - if (browser_state->GetUserData(kBookmarkFaviconFetcherKey)) + if (profile->GetUserData(kBookmarkFaviconFetcherKey)) { return; + } auto fetcher = - std::make_unique(browser_state, path, observer); + std::make_unique(profile, path, observer); auto* fetcher_ptr = fetcher.get(); - browser_state->SetUserData(kBookmarkFaviconFetcherKey, std::move(fetcher)); + profile->SetUserData(kBookmarkFaviconFetcherKey, std::move(fetcher)); fetcher_ptr->ExportBookmarks(); } diff --git a/ios/browser/api/bookmarks/exporter/bookmark_html_writer.h b/ios/browser/api/bookmarks/exporter/bookmark_html_writer.h index b06b14ad5a10..af71c631cb49 100644 --- a/ios/browser/api/bookmarks/exporter/bookmark_html_writer.h +++ b/ios/browser/api/bookmarks/exporter/bookmark_html_writer.h @@ -6,11 +6,9 @@ #ifndef BRAVE_IOS_BROWSER_API_BOOKMARKS_EXPORTER_BOOKMARK_HTML_WRITER_H_ #define BRAVE_IOS_BROWSER_API_BOOKMARKS_EXPORTER_BOOKMARK_HTML_WRITER_H_ -#include - #include "base/values.h" -class ChromeBrowserState; +class ProfileIOS; namespace base { class FilePath; @@ -38,7 +36,7 @@ namespace bookmark_html_writer { // Firefox and IE. The results are written asynchronously to the file at |path|. // Before writing to the file favicons are fetched on the main thread. // TODO(sky): need a callback on failure. -void WriteBookmarks(ChromeBrowserState* browser_state, +void WriteBookmarks(ProfileIOS* profile, const base::FilePath& path, BookmarksExportObserver* observer); diff --git a/ios/browser/api/bookmarks/exporter/brave_bookmarks_exporter.mm b/ios/browser/api/bookmarks/exporter/brave_bookmarks_exporter.mm index af7cb6ae0466..a9df300bffdf 100644 --- a/ios/browser/api/bookmarks/exporter/brave_bookmarks_exporter.mm +++ b/ios/browser/api/bookmarks/exporter/brave_bookmarks_exporter.mm @@ -83,7 +83,7 @@ @implementation BraveBookmarksExporter - (instancetype)init { if ((self = [super init])) { // This work must be done on the UI thread because it currently relies on - // fetching information from ChromeBrowserState which is main-thread bound + // fetching information from ProfileIOS which is main-thread bound export_thread_ = web::GetUIThreadTaskRunner({}); } return self; @@ -109,14 +109,12 @@ - (void)exportToFile:(NSString*)filePath listener(BraveBookmarksExporterStateStarted); - ChromeBrowserState* chromeBrowserState = - GetApplicationContext() - ->GetProfileManager() - ->GetLastUsedProfileDeprecatedDoNotUse(); - DCHECK(chromeBrowserState); + std::vector profiles = + GetApplicationContext()->GetProfileManager()->GetLoadedProfiles(); + ProfileIOS* last_used_profile = profiles.at(0); bookmark_html_writer::WriteBookmarks( - chromeBrowserState, destination_file_path, + last_used_profile, destination_file_path, new BraveBookmarksExportObserver(listener)); }; diff --git a/ios/browser/api/bookmarks/importer/bookmarks_importer.mm b/ios/browser/api/bookmarks/importer/bookmarks_importer.mm index 13304005ac69..485a4149fd71 100644 --- a/ios/browser/api/bookmarks/importer/bookmarks_importer.mm +++ b/ios/browser/api/bookmarks/importer/bookmarks_importer.mm @@ -65,9 +65,8 @@ } // Shows the bookmarks toolbar. -void ShowBookmarkBar(ChromeBrowserState* browser_state) { - browser_state->GetPrefs()->SetBoolean(bookmarks::prefs::kShowBookmarkBar, - true); +void ShowBookmarkBar(ProfileIOS* profile) { + profile->GetPrefs()->SetBoolean(bookmarks::prefs::kShowBookmarkBar, true); } } // namespace @@ -78,12 +77,12 @@ void ShowBookmarkBar(ChromeBrowserState* browser_state) { if (bookmarks.empty()) return; - ChromeBrowserState* browser_state = - GetApplicationContext() - ->GetProfileManager() - ->GetLastUsedProfileDeprecatedDoNotUse(); + std::vector profiles = + GetApplicationContext()->GetProfileManager()->GetLoadedProfiles(); + ProfileIOS* last_used_profile = profiles.at(0); + bookmarks::BookmarkModel* model = - ios::BookmarkModelFactory::GetForBrowserState(browser_state); + ios::BookmarkModelFactory::GetForBrowserState(last_used_profile); DCHECK(model->loaded()); // If the bookmark bar is currently empty, we should import directly to it. @@ -179,5 +178,5 @@ void ShowBookmarkBar(ChromeBrowserState* browser_state) { // If the user was previously using a toolbar, we should show the bar. if (import_to_top_level && !add_all_to_top_level) - ShowBookmarkBar(browser_state); + ShowBookmarkBar(last_used_profile); } diff --git a/ios/browser/api/bookmarks/importer/brave_bookmarks_importer.mm b/ios/browser/api/bookmarks/importer/brave_bookmarks_importer.mm index c4e0fb4b4a48..b02d0f488433 100644 --- a/ios/browser/api/bookmarks/importer/brave_bookmarks_importer.mm +++ b/ios/browser/api/bookmarks/importer/brave_bookmarks_importer.mm @@ -146,7 +146,7 @@ - (void)importFromFile:(NSString*)filePath listener(BraveBookmarksImporterStateAutoCompleted, nullptr); }; - // Import into the Profile/ChromeBrowserState on the main-thread. + // Import into the Profile/ProfileIOS on the main-thread. web::GetUIThreadTaskRunner({})->PostTask( FROM_HERE, base::BindOnce(complete_import, std::move(bookmarks), top_level_folder_name, listener)); @@ -193,7 +193,7 @@ - (void)importFromArray:(NSArray*)bookmarks listener(BraveBookmarksImporterStateCompleted); }; - // Import into the Profile/ChromeBrowserState on the main-thread. + // Import into the Profile/ProfileIOS on the main-thread. __weak BraveBookmarksImporter* weakSelf = self; import_thread_->PostTask(FROM_HERE, base::BindOnce(start_import, weakSelf, bookmarks, diff --git a/ios/browser/api/brave_stats/brave_stats+private.h b/ios/browser/api/brave_stats/brave_stats+private.h index a8ae6f7df1d4..f9eaac8b0322 100644 --- a/ios/browser/api/brave_stats/brave_stats+private.h +++ b/ios/browser/api/brave_stats/brave_stats+private.h @@ -8,10 +8,10 @@ #include "brave/ios/browser/api/brave_stats/brave_stats.h" -class ChromeBrowserState; +class ProfileIOS; @interface BraveStats (Private) -- (instancetype)initWithBrowserState:(ChromeBrowserState*)browserState; +- (instancetype)initWithBrowserState:(ProfileIOS*)profile; @end #endif // BRAVE_IOS_BROWSER_API_BRAVE_STATS_BRAVE_STATS_PRIVATE_H_ diff --git a/ios/browser/api/brave_stats/brave_stats.mm b/ios/browser/api/brave_stats/brave_stats.mm index 041b5be9eab5..b6728d65b7bc 100644 --- a/ios/browser/api/brave_stats/brave_stats.mm +++ b/ios/browser/api/brave_stats/brave_stats.mm @@ -29,9 +29,9 @@ @implementation BraveStats { raw_ptr _profilePrefs; } -- (instancetype)initWithBrowserState:(ChromeBrowserState*)browserState { +- (instancetype)initWithBrowserState:(ProfileIOS*)profile { if ((self = [super init])) { - _profilePrefs = browserState->GetPrefs(); + _profilePrefs = profile->GetPrefs(); _localPrefs = GetApplicationContext()->GetLocalState(); } return self; diff --git a/ios/browser/api/brave_wallet/brave_wallet_api+private.h b/ios/browser/api/brave_wallet/brave_wallet_api+private.h index 673267c6c85b..990663a33366 100644 --- a/ios/browser/api/brave_wallet/brave_wallet_api+private.h +++ b/ios/browser/api/brave_wallet/brave_wallet_api+private.h @@ -12,10 +12,10 @@ NS_ASSUME_NONNULL_BEGIN -class ChromeBrowserState; +class ProfileIOS; @interface BraveWalletAPI (Private) -- (instancetype)initWithBrowserState:(ChromeBrowserState*)mainBrowserState; +- (instancetype)initWithBrowserState:(ProfileIOS*)profile; @end NS_ASSUME_NONNULL_END diff --git a/ios/browser/api/brave_wallet/brave_wallet_api.mm b/ios/browser/api/brave_wallet/brave_wallet_api.mm index 17a4984824a0..d4987fbcd3b4 100644 --- a/ios/browser/api/brave_wallet/brave_wallet_api.mm +++ b/ios/browser/api/brave_wallet/brave_wallet_api.mm @@ -42,15 +42,15 @@ @implementation BraveWallet @end @implementation BraveWalletAPI { - raw_ptr _mainBrowserState; // NOT OWNED + raw_ptr _profile; // NOT OWNED NSMutableDictionary*>* _providerScripts; } -- (instancetype)initWithBrowserState:(ChromeBrowserState*)mainBrowserState { +- (instancetype)initWithBrowserState:(ProfileIOS*)profile { if ((self = [super init])) { - _mainBrowserState = mainBrowserState; + _profile = profile; _providerScripts = [[NSMutableDictionary alloc] init]; } return self; @@ -66,9 +66,9 @@ - (instancetype)initWithBrowserState:(ChromeBrowserState*)mainBrowserState { ethereumProviderWithDelegate:(id)delegate isPrivateBrowsing:(bool)isPrivateBrowsing { DCHECK_CURRENTLY_ON(web::WebThread::UI); - auto* browserState = _mainBrowserState.get(); + auto* browserState = _profile.get(); if (isPrivateBrowsing) { - browserState = browserState->GetOffTheRecordChromeBrowserState(); + browserState = browserState->GetOffTheRecordProfile(); } auto* brave_wallet_service = @@ -91,9 +91,9 @@ - (instancetype)initWithBrowserState:(ChromeBrowserState*)mainBrowserState { solanaProviderWithDelegate:(id)delegate isPrivateBrowsing:(bool)isPrivateBrowsing { DCHECK_CURRENTLY_ON(web::WebThread::UI); - auto* browserState = _mainBrowserState.get(); + auto* browserState = _profile.get(); if (isPrivateBrowsing) { - browserState = browserState->GetOffTheRecordChromeBrowserState(); + browserState = browserState->GetOffTheRecordProfile(); } auto* brave_wallet_service = @@ -175,8 +175,8 @@ - (NSString*)resourceForID:(int)resource_id { } - (nullable id)walletP3A { - auto* service = brave_wallet::BraveWalletServiceFactory::GetServiceForState( - _mainBrowserState); + auto* service = + brave_wallet::BraveWalletServiceFactory::GetServiceForState(_profile); if (!service) { return nil; } diff --git a/ios/browser/api/favicon/favicon_driver.mm b/ios/browser/api/favicon/favicon_driver.mm index ab7d096b008e..0db9235a334d 100644 --- a/ios/browser/api/favicon/favicon_driver.mm +++ b/ios/browser/api/favicon/favicon_driver.mm @@ -81,13 +81,13 @@ - (instancetype)initWithWebState:(WebState*)webState { web::WebState* real_web_state = [webState internalWebState].get(); DCHECK(real_web_state); - ChromeBrowserState* original_browser_state = - ChromeBrowserState::FromBrowserState(real_web_state->GetBrowserState()); + ProfileIOS* original_profile = + ProfileIOS::FromBrowserState(real_web_state->GetBrowserState()); brave_favicon::BraveIOSWebFaviconDriver::CreateForWebState( real_web_state, ios::FaviconServiceFactory::GetForBrowserState( - original_browser_state, ServiceAccessType::EXPLICIT_ACCESS)); + original_profile, ServiceAccessType::EXPLICIT_ACCESS)); } return self; } diff --git a/ios/browser/api/favicon/favicon_loader.mm b/ios/browser/api/favicon/favicon_loader.mm index 9f4e67a7e3c4..e46b3710b8b5 100644 --- a/ios/browser/api/favicon/favicon_loader.mm +++ b/ios/browser/api/favicon/favicon_loader.mm @@ -45,29 +45,27 @@ @interface FaviconLoader () { @end @implementation FaviconLoader -- (instancetype)initWithBrowserState:(ChromeBrowserState*)browserState { +- (instancetype)initWithBrowserState:(ProfileIOS*)profile { if ((self = [super init])) { favicon_loader_ = brave_favicon::BraveIOSFaviconLoaderFactory::GetForBrowserState( - browserState); + profile); DCHECK(favicon_loader_); } return self; } + (instancetype)getForPrivateMode:(bool)privateMode { - ChromeBrowserState* browser_state = - GetApplicationContext() - ->GetProfileManager() - ->GetLastUsedProfileDeprecatedDoNotUse(); - CHECK(browser_state); + std::vector profiles = + GetApplicationContext()->GetProfileManager()->GetLoadedProfiles(); + ProfileIOS* last_used_profile = profiles.at(0); if (privateMode) { - browser_state = browser_state->GetOffTheRecordChromeBrowserState(); - CHECK(browser_state); + last_used_profile = last_used_profile->GetOffTheRecordProfile(); + CHECK(last_used_profile); } - return [[FaviconLoader alloc] initWithBrowserState:browser_state]; + return [[FaviconLoader alloc] initWithBrowserState:last_used_profile]; } - (void)faviconForPageURLOrHost:(NSURL*)url diff --git a/ios/browser/api/history/brave_history_api+private.h b/ios/browser/api/history/brave_history_api+private.h index 067cd7f25a91..0741291e227a 100644 --- a/ios/browser/api/history/brave_history_api+private.h +++ b/ios/browser/api/history/brave_history_api+private.h @@ -12,10 +12,10 @@ NS_ASSUME_NONNULL_BEGIN -class ChromeBrowserState; +class ProfileIOS; @interface BraveHistoryAPI (Private) -- (instancetype)initWithBrowserState:(ChromeBrowserState*)mainBrowserState; +- (instancetype)initWithBrowserState:(ProfileIOS*)profile; @end NS_ASSUME_NONNULL_END diff --git a/ios/browser/api/history/brave_history_api.mm b/ios/browser/api/history/brave_history_api.mm index d899a0f128b0..8ab1a023a110 100644 --- a/ios/browser/api/history/brave_history_api.mm +++ b/ios/browser/api/history/brave_history_api.mm @@ -34,11 +34,10 @@ namespace { history::WebHistoryService* WebHistoryServiceGetter( - base::WeakPtr weak_browser_state) { - DCHECK(weak_browser_state.get()) - << "Getter should not be called after ChromeBrowserState destruction."; - return ios::WebHistoryServiceFactory::GetForBrowserState( - weak_browser_state.get()); + base::WeakPtr profile) { + DCHECK(profile.get()) + << "Getter should not be called after ProfileIOS destruction."; + return ios::WebHistoryServiceFactory::GetForBrowserState(profile.get()); } } // anonymous namespace @@ -168,15 +167,15 @@ @interface BraveHistoryAPI () { @end @implementation BraveHistoryAPI { - raw_ptr _mainBrowserState; // NOT OWNED + raw_ptr _mainBrowserState; // NOT OWNED } -- (instancetype)initWithBrowserState:(ChromeBrowserState*)mainBrowserState { +- (instancetype)initWithBrowserState:(ProfileIOS*)mainBrowserState { if ((self = [super init])) { DCHECK_CURRENTLY_ON(web::WebThread::UI); _mainBrowserState = mainBrowserState; - history_service_ = ios::HistoryServiceFactory::GetForBrowserState( + history_service_ = ios::HistoryServiceFactory::GetForProfile( _mainBrowserState, ServiceAccessType::EXPLICIT_ACCESS); web_history_service_ = ios::WebHistoryServiceFactory::GetForBrowserState(_mainBrowserState); @@ -187,7 +186,7 @@ - (instancetype)initWithBrowserState:(ChromeBrowserState*)mainBrowserState { _browsingHistoryService = std::make_unique( _browsingHistoryDriver.get(), - ios::HistoryServiceFactory::GetForBrowserState( + ios::HistoryServiceFactory::GetForProfile( _mainBrowserState, ServiceAccessType::EXPLICIT_ACCESS), SyncServiceFactory::GetForBrowserState(_mainBrowserState)); } diff --git a/ios/browser/api/https_upgrades/https_upgrade_service_factory.mm b/ios/browser/api/https_upgrades/https_upgrade_service_factory.mm index aa2523c756e2..0e9442eb6e23 100644 --- a/ios/browser/api/https_upgrades/https_upgrade_service_factory.mm +++ b/ios/browser/api/https_upgrades/https_upgrade_service_factory.mm @@ -11,8 +11,8 @@ #include "ios/components/security_interstitials/https_only_mode/https_upgrade_service.h" @implementation BraveHttpsUpgradeServiceFactory -+ (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState { - auto* service = HttpsUpgradeServiceFactory::GetForBrowserState(browserState); ++ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { + auto* service = HttpsUpgradeServiceFactory::GetForProfile(profile); if (!service) { return nil; } diff --git a/ios/browser/api/ipfs/ipfs_api+private.h b/ios/browser/api/ipfs/ipfs_api+private.h index a70a663fdb2b..6a7406a79009 100644 --- a/ios/browser/api/ipfs/ipfs_api+private.h +++ b/ios/browser/api/ipfs/ipfs_api+private.h @@ -12,12 +12,12 @@ NS_ASSUME_NONNULL_BEGIN -class ChromeBrowserState; +class ProfileIOS; @interface IpfsAPIImpl : NSObject - (nullable NSURL*)resolveGatewayUrlFor:(NSURL*)input; - (nullable NSURL*)resolveGatewayUrlForNft:(NSURL*)input; -- (instancetype)initWithBrowserState:(ChromeBrowserState*)mainBrowserState; +- (instancetype)initWithBrowserState:(ProfileIOS*)profile; - (instancetype)init NS_UNAVAILABLE; @end diff --git a/ios/browser/api/ipfs/ipfs_api.mm b/ios/browser/api/ipfs/ipfs_api.mm index bc6692719097..47bb18c5002f 100644 --- a/ios/browser/api/ipfs/ipfs_api.mm +++ b/ios/browser/api/ipfs/ipfs_api.mm @@ -16,12 +16,12 @@ #include "url/gurl.h" @implementation IpfsAPIImpl { - raw_ptr _mainBrowserState; // NOT OWNED + raw_ptr _profile; // NOT OWNED } -- (instancetype)initWithBrowserState:(ChromeBrowserState*)mainBrowserState { +- (instancetype)initWithBrowserState:(ProfileIOS*)profile { if ((self = [super init])) { - _mainBrowserState = mainBrowserState; + _profile = profile; } return self; } diff --git a/ios/browser/api/omnibox/autocomplete_classifier.mm b/ios/browser/api/omnibox/autocomplete_classifier.mm index 943265424cbc..831647122e35 100644 --- a/ios/browser/api/omnibox/autocomplete_classifier.mm +++ b/ios/browser/api/omnibox/autocomplete_classifier.mm @@ -95,11 +95,12 @@ - (instancetype)initWithText:(NSString*)text @implementation BraveIOSAutocompleteClassifier + (BraveIOSAutocompleteMatch*)classify:(NSString*)text { + std::vector profiles = + GetApplicationContext()->GetProfileManager()->GetLoadedProfiles(); + ProfileIOS* last_used_profile = profiles.at(0); + AutocompleteClassifier* classifier = - ios::AutocompleteClassifierFactory::GetForBrowserState( - GetApplicationContext() - ->GetProfileManager() - ->GetLastUsedProfileDeprecatedDoNotUse()); + ios::AutocompleteClassifierFactory::GetForBrowserState(last_used_profile); if (classifier) { AutocompleteMatch match; classifier->Classify(base::SysNSStringToUTF16(text), false, false, diff --git a/ios/browser/api/sync/brave_sync_api+private.h b/ios/browser/api/sync/brave_sync_api+private.h index ca42e8f85a1a..e3847660146a 100644 --- a/ios/browser/api/sync/brave_sync_api+private.h +++ b/ios/browser/api/sync/brave_sync_api+private.h @@ -12,10 +12,10 @@ NS_ASSUME_NONNULL_BEGIN -class ChromeBrowserState; +class ProfileIOS; @interface BraveSyncAPI (Private) -- (instancetype)initWithBrowserState:(ChromeBrowserState*)mainBrowserState; +- (instancetype)initWithBrowserState:(ProfileIOS*)profile; @end NS_ASSUME_NONNULL_END diff --git a/ios/browser/api/sync/brave_sync_api.mm b/ios/browser/api/sync/brave_sync_api.mm index 2827b50b66e7..503cca380314 100644 --- a/ios/browser/api/sync/brave_sync_api.mm +++ b/ios/browser/api/sync/brave_sync_api.mm @@ -160,23 +160,23 @@ - (instancetype)initWithSyncServiceImpl: @interface BraveSyncAPI () { std::unique_ptr _worker; - raw_ptr _chromeBrowserState; + raw_ptr _profile; } @end @implementation BraveSyncAPI -- (instancetype)initWithBrowserState:(ChromeBrowserState*)mainBrowserState { +- (instancetype)initWithBrowserState:(ProfileIOS*)mainBrowserState { if ((self = [super init])) { - _chromeBrowserState = mainBrowserState; - _worker.reset(new BraveSyncWorker(_chromeBrowserState)); + _profile = mainBrowserState; + _worker.reset(new BraveSyncWorker(_profile)); } return self; } - (void)dealloc { _worker.reset(); - _chromeBrowserState = nullptr; + _profile = nullptr; } - (bool)canSyncFeatureStart { @@ -346,23 +346,23 @@ - (void)permanentlyDeleteAccount: } - (bool)isSyncAccountDeletedNoticePending { - brave_sync::Prefs brave_sync_prefs(_chromeBrowserState->GetPrefs()); + brave_sync::Prefs brave_sync_prefs(_profile->GetPrefs()); return brave_sync_prefs.IsSyncAccountDeletedNoticePending(); } - (void)setIsSyncAccountDeletedNoticePending: (bool)isSyncAccountDeletedNoticePending { - brave_sync::Prefs brave_sync_prefs(_chromeBrowserState->GetPrefs()); + brave_sync::Prefs brave_sync_prefs(_profile->GetPrefs()); brave_sync_prefs.SetSyncAccountDeletedNoticePending(false); } - (bool)isFailedDecryptSeedNoticeDismissed { - brave_sync::Prefs brave_sync_prefs(_chromeBrowserState->GetPrefs()); + brave_sync::Prefs brave_sync_prefs(_profile->GetPrefs()); return brave_sync_prefs.IsFailedDecryptSeedNoticeDismissed(); } - (void)dismissFailedDecryptSeedNotice { - brave_sync::Prefs brave_sync_prefs(_chromeBrowserState->GetPrefs()); + brave_sync::Prefs brave_sync_prefs(_profile->GetPrefs()); brave_sync_prefs.DismissFailedDecryptSeedNotice(); } @@ -371,9 +371,8 @@ - (void)deleteDevice:(NSString*)guid { } - (id)createSyncDeviceObserver:(void (^)())onDeviceInfoChanged { - auto* tracker = - DeviceInfoSyncServiceFactory::GetForBrowserState(_chromeBrowserState) - ->GetDeviceInfoTracker(); + auto* tracker = DeviceInfoSyncServiceFactory::GetForProfile(_profile) + ->GetDeviceInfoTracker(); return [[BraveSyncDeviceObserver alloc] initWithDeviceInfoTracker:tracker callback:onDeviceInfoChanged]; @@ -382,7 +381,7 @@ - (id)createSyncDeviceObserver:(void (^)())onDeviceInfoChanged { - (id)createSyncServiceObserver:(void (^)())onSyncServiceStateChanged onSyncServiceShutdown:(void (^)())onSyncServiceShutdown { auto* service = static_cast( - SyncServiceFactory::GetForBrowserState(_chromeBrowserState)); + SyncServiceFactory::GetForBrowserState(_profile)); return [[BraveSyncServiceObserver alloc] initWithSyncServiceImpl:service stateChangedCallback:onSyncServiceStateChanged diff --git a/ios/browser/api/sync/brave_sync_worker.cc b/ios/browser/api/sync/brave_sync_worker.cc index de5a780d1fe8..cfc109595526 100644 --- a/ios/browser/api/sync/brave_sync_worker.cc +++ b/ios/browser/api/sync/brave_sync_worker.cc @@ -83,8 +83,7 @@ void BraveSyncServiceTracker::OnSyncShutdown(syncer::SyncService* sync) { } } -BraveSyncWorker::BraveSyncWorker(ChromeBrowserState* browser_state) - : browser_state_(browser_state) { +BraveSyncWorker::BraveSyncWorker(ProfileIOS* profile) : profile_(profile) { DCHECK_CURRENTLY_ON(web::WebThread::UI); } @@ -112,7 +111,7 @@ bool BraveSyncWorker::RequestSync() { const syncer::DeviceInfo* BraveSyncWorker::GetLocalDeviceInfo() { DCHECK_CURRENTLY_ON(web::WebThread::UI); auto* device_info_service = - DeviceInfoSyncServiceFactory::GetForBrowserState(browser_state_); + DeviceInfoSyncServiceFactory::GetForProfile(profile_); if (!device_info_service) { return nullptr; @@ -126,7 +125,7 @@ std::vector> BraveSyncWorker::GetDeviceList() { DCHECK_CURRENTLY_ON(web::WebThread::UI); auto* device_info_service = - DeviceInfoSyncServiceFactory::GetForBrowserState(browser_state_); + DeviceInfoSyncServiceFactory::GetForProfile(profile_); if (!device_info_service) { return std::vector>(); @@ -314,7 +313,7 @@ void BraveSyncWorker::ResetSync() { sync_service->prefs().AddLeaveChainDetail(__FILE__, __LINE__, __func__); auto* device_info_service = - DeviceInfoSyncServiceFactory::GetForBrowserState(browser_state_); + DeviceInfoSyncServiceFactory::GetForProfile(profile_); DCHECK(device_info_service); brave_sync::ResetSync(sync_service, device_info_service, @@ -331,7 +330,7 @@ void BraveSyncWorker::DeleteDevice(const std::string& device_guid) { } auto* device_info_service = - DeviceInfoSyncServiceFactory::GetForBrowserState(browser_state_); + DeviceInfoSyncServiceFactory::GetForProfile(profile_); DCHECK(device_info_service); brave_sync::DeleteDevice(sync_service, device_info_service, device_guid); @@ -366,7 +365,7 @@ void BraveSyncWorker::PermanentlyDeleteAccount( syncer::BraveSyncServiceImpl* BraveSyncWorker::GetSyncService() const { DCHECK_CURRENTLY_ON(web::WebThread::UI); return static_cast( - SyncServiceFactory::GetForBrowserState(browser_state_)); + SyncServiceFactory::GetForBrowserState(profile_)); } void BraveSyncWorker::SetEncryptionPassphrase(syncer::SyncService* service) { diff --git a/ios/browser/api/sync/brave_sync_worker.h b/ios/browser/api/sync/brave_sync_worker.h index 3d5874fd312e..926fb94cab1f 100644 --- a/ios/browser/api/sync/brave_sync_worker.h +++ b/ios/browser/api/sync/brave_sync_worker.h @@ -21,7 +21,7 @@ #include "components/sync_device_info/device_info_sync_service.h" #include "components/sync_device_info/device_info_tracker.h" -class ChromeBrowserState; +class ProfileIOS; struct SyncProtocolError; namespace syncer { @@ -73,7 +73,7 @@ class BraveSyncServiceTracker : public syncer::SyncServiceObserver { class BraveSyncWorker : public syncer::SyncServiceObserver { public: - explicit BraveSyncWorker(ChromeBrowserState* browser_state_); + explicit BraveSyncWorker(ProfileIOS* profile_); BraveSyncWorker(const BraveSyncWorker&) = delete; BraveSyncWorker& operator=(const BraveSyncWorker&) = delete; ~BraveSyncWorker() override; @@ -119,7 +119,7 @@ class BraveSyncWorker : public syncer::SyncServiceObserver { std::string passphrase_; - raw_ptr browser_state_; // NOT OWNED + raw_ptr profile_; // NOT OWNED base::ScopedMultiSourceObservation sync_service_observer_{this}; diff --git a/ios/browser/api/web/ui/chrome_webview.mm b/ios/browser/api/web/ui/chrome_webview.mm index 34d4b446f9df..4c984aae35e3 100644 --- a/ios/browser/api/web/ui/chrome_webview.mm +++ b/ios/browser/api/web/ui/chrome_webview.mm @@ -164,7 +164,7 @@ void RunJavaScriptPromptDialog( @interface ChromeWebViewController () { - raw_ptr browser_state_; + raw_ptr profile_; std::unique_ptr web_state_; std::unique_ptr web_state_observer_; std::unique_ptr web_state_delegate_; @@ -178,17 +178,17 @@ @interface ChromeWebViewController () GetProfileManager() - ->GetLastUsedProfileDeprecatedDoNotUse() - ->GetOriginalChromeBrowserState(); + std::vector profiles = + GetApplicationContext()->GetProfileManager()->GetLoadedProfiles(); + ProfileIOS* last_used_profile = profiles.at(0); + + profile_ = last_used_profile->GetOriginalProfile(); if (isPrivateBrowsing) { - browser_state_ = browser_state_->GetOffTheRecordChromeBrowserState(); + profile_ = profile_->GetOffTheRecordProfile(); } - web_state_ = - web::WebState::Create(web::WebState::CreateParams(browser_state_)); + web_state_ = web::WebState::Create(web::WebState::CreateParams(profile_)); web_state_observer_ = std::make_unique(self); web_state_->AddObserver(web_state_observer_.get()); @@ -216,7 +216,7 @@ - (void)dealloc { web_state_delegate_.reset(); web_state_.reset(); dialog_presenter_.reset(); - browser_state_ = nullptr; + profile_ = nullptr; } - (WKWebView*)webView { @@ -224,7 +224,7 @@ - (WKWebView*)webView { } - (bool)isOffTheRecord { - return profile_metrics::GetBrowserProfileType(browser_state_) == + return profile_metrics::GetBrowserProfileType(profile_) == profile_metrics::BrowserProfileType::kIncognito; } diff --git a/ios/browser/api/web/web_state/web_state_native.mm b/ios/browser/api/web/web_state/web_state_native.mm index 42d5b18a97f9..f07ebed4dcc7 100644 --- a/ios/browser/api/web/web_state/web_state_native.mm +++ b/ios/browser/api/web/web_state/web_state_native.mm @@ -38,13 +38,13 @@ SyncedWindowDelegateBrowserAgent::FromBrowser(browser_)->GetSessionId(); // Create BrowserState - ChromeBrowserState* browser_state = browser->GetBrowserState(); + ProfileIOS* profile = browser->GetProfile(); if (off_the_record) { - browser_state = browser_state->GetOffTheRecordChromeBrowserState(); + profile = profile->GetOffTheRecordProfile(); } // Create WebState with parameters - web::WebState::CreateParams create_params(browser_state); + web::WebState::CreateParams create_params(profile); create_params.last_active_time = base::Time::Now(); auto web_state = web::WebState::Create(create_params); web_state->ForceRealized(); diff --git a/ios/browser/api/web_image/web_image+private.h b/ios/browser/api/web_image/web_image+private.h index df35316d53e3..e68fd6a36d1f 100644 --- a/ios/browser/api/web_image/web_image+private.h +++ b/ios/browser/api/web_image/web_image+private.h @@ -9,10 +9,10 @@ #import #include "brave/ios/browser/api/web_image/web_image.h" -class ChromeBrowserState; +class ProfileIOS; @interface WebImageDownloader (Private) -- (instancetype)initWithBrowserState:(ChromeBrowserState*)browserState; +- (instancetype)initWithBrowserState:(ProfileIOS*)profile; @end #endif // BRAVE_IOS_BROWSER_API_WEB_IMAGE_WEB_IMAGE_PRIVATE_H_ diff --git a/ios/browser/api/web_image/web_image.mm b/ios/browser/api/web_image/web_image.mm index a5e2aa844da7..20eaa341d1cc 100644 --- a/ios/browser/api/web_image/web_image.mm +++ b/ios/browser/api/web_image/web_image.mm @@ -38,10 +38,10 @@ @interface WebImageDownloader () { @end @implementation WebImageDownloader -- (instancetype)initWithBrowserState:(ChromeBrowserState*)browserState { +- (instancetype)initWithBrowserState:(ProfileIOS*)profile { if ((self = [super init])) { image_fetcher_ = std::make_unique( - browserState->GetSharedURLLoaderFactory()); + profile->GetSharedURLLoaderFactory()); } return self; } diff --git a/ios/browser/brave_wallet/asset_ratio_service_factory.cc b/ios/browser/brave_wallet/asset_ratio_service_factory.cc index 39ce45cf61cf..90695f71e8be 100644 --- a/ios/browser/brave_wallet/asset_ratio_service_factory.cc +++ b/ios/browser/brave_wallet/asset_ratio_service_factory.cc @@ -19,18 +19,17 @@ namespace brave_wallet { // static mojo::PendingRemote -AssetRatioServiceFactory::GetForBrowserState( - ChromeBrowserState* browser_state) { +AssetRatioServiceFactory::GetForBrowserState(ProfileIOS* profile) { return static_cast( - GetInstance()->GetServiceForBrowserState(browser_state, true)) + GetInstance()->GetServiceForBrowserState(profile, true)) ->MakeRemote(); } // static AssetRatioService* AssetRatioServiceFactory::GetServiceForState( - ChromeBrowserState* browser_state) { + ProfileIOS* profile) { return static_cast( - GetInstance()->GetServiceForBrowserState(browser_state, true)); + GetInstance()->GetServiceForBrowserState(profile, true)); } // static @@ -48,9 +47,9 @@ AssetRatioServiceFactory::~AssetRatioServiceFactory() = default; std::unique_ptr AssetRatioServiceFactory::BuildServiceInstanceFor( web::BrowserState* context) const { - auto* browser_state = ChromeBrowserState::FromBrowserState(context); + auto* profile = ProfileIOS::FromBrowserState(context); std::unique_ptr asset_ratio_service( - new AssetRatioService(browser_state->GetSharedURLLoaderFactory())); + new AssetRatioService(profile->GetSharedURLLoaderFactory())); return asset_ratio_service; } diff --git a/ios/browser/brave_wallet/asset_ratio_service_factory.h b/ios/browser/brave_wallet/asset_ratio_service_factory.h index 622d9fb42d1a..5b0e26f2c1b4 100644 --- a/ios/browser/brave_wallet/asset_ratio_service_factory.h +++ b/ios/browser/brave_wallet/asset_ratio_service_factory.h @@ -12,7 +12,7 @@ #include "components/keyed_service/ios/browser_state_keyed_service_factory.h" #include "mojo/public/cpp/bindings/pending_remote.h" -class ChromeBrowserState; +class ProfileIOS; class KeyedService; namespace base { @@ -30,11 +30,10 @@ class AssetRatioService; class AssetRatioServiceFactory : public BrowserStateKeyedServiceFactory { public: - // Creates the service if it doesn't exist already for |browser_state|. + // Creates the service if it doesn't exist already for |profile|. static mojo::PendingRemote GetForBrowserState( - ChromeBrowserState* browser_state); - static AssetRatioService* GetServiceForState( - ChromeBrowserState* browser_state); + ProfileIOS* profile); + static AssetRatioService* GetServiceForState(ProfileIOS* profile); static AssetRatioServiceFactory* GetInstance(); diff --git a/ios/browser/brave_wallet/brave_wallet_factory_wrappers.mm b/ios/browser/brave_wallet/brave_wallet_factory_wrappers.mm index 0882a8f2f08d..bb79a4a586e4 100644 --- a/ios/browser/brave_wallet/brave_wallet_factory_wrappers.mm +++ b/ios/browser/brave_wallet/brave_wallet_factory_wrappers.mm @@ -24,9 +24,9 @@ #endif @implementation BraveWalletAssetRatioServiceFactory -+ (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState { ++ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { auto service = - brave_wallet::AssetRatioServiceFactory::GetForBrowserState(browserState); + brave_wallet::AssetRatioServiceFactory::GetForBrowserState(profile); if (!service) { return nil; } @@ -36,9 +36,9 @@ + (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState { @end @implementation BraveWalletBitcoinWalletServiceFactory -+ (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState { ++ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { auto* brave_wallet_service = - brave_wallet::BraveWalletServiceFactory::GetServiceForState(browserState); + brave_wallet::BraveWalletServiceFactory::GetServiceForState(profile); if (!brave_wallet_service) { return nil; } @@ -51,9 +51,9 @@ + (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState { @end @implementation BraveWalletJsonRpcServiceFactory -+ (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState { ++ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { auto* brave_wallet_service = - brave_wallet::BraveWalletServiceFactory::GetServiceForState(browserState); + brave_wallet::BraveWalletServiceFactory::GetServiceForState(profile); if (!brave_wallet_service) { return nil; } @@ -65,9 +65,9 @@ + (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState { @end @implementation BraveWalletTxServiceFactory -+ (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState { ++ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { auto* brave_wallet_service = - brave_wallet::BraveWalletServiceFactory::GetServiceForState(browserState); + brave_wallet::BraveWalletServiceFactory::GetServiceForState(profile); if (!brave_wallet_service) { return nil; } @@ -79,9 +79,9 @@ + (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState { @end @implementation BraveWalletEthTxManagerProxyFactory -+ (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState { ++ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { auto* brave_wallet_service = - brave_wallet::BraveWalletServiceFactory::GetServiceForState(browserState); + brave_wallet::BraveWalletServiceFactory::GetServiceForState(profile); if (!brave_wallet_service) { return nil; } @@ -93,9 +93,9 @@ + (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState { @end @implementation BraveWalletSolanaTxManagerProxyFactory -+ (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState { ++ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { auto* brave_wallet_service = - brave_wallet::BraveWalletServiceFactory::GetServiceForState(browserState); + brave_wallet::BraveWalletServiceFactory::GetServiceForState(profile); if (!brave_wallet_service) { return nil; } @@ -107,9 +107,9 @@ + (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState { @end @implementation BraveWalletKeyringServiceFactory -+ (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState { ++ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { auto* brave_wallet_service = - brave_wallet::BraveWalletServiceFactory::GetServiceForState(browserState); + brave_wallet::BraveWalletServiceFactory::GetServiceForState(profile); if (!brave_wallet_service) { return nil; } @@ -121,10 +121,9 @@ + (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState { @end @implementation BraveWalletMeldIntegrationServiceFactory -+ (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState { ++ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { auto service = - brave_wallet::MeldIntegrationServiceFactory::GetForBrowserState( - browserState); + brave_wallet::MeldIntegrationServiceFactory::GetForBrowserState(profile); if (!service) { return nil; } @@ -134,9 +133,9 @@ + (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState { @end @implementation BraveWalletServiceFactory -+ (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState { ++ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { auto* brave_wallet_service = - brave_wallet::BraveWalletServiceFactory::GetServiceForState(browserState); + brave_wallet::BraveWalletServiceFactory::GetServiceForState(profile); if (!brave_wallet_service) { return nil; } @@ -148,9 +147,8 @@ + (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState { @end @implementation BraveWalletSwapServiceFactory -+ (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState { - auto service = - brave_wallet::SwapServiceFactory::GetForBrowserState(browserState); ++ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { + auto service = brave_wallet::SwapServiceFactory::GetForBrowserState(profile); if (!service) { return nil; } @@ -160,10 +158,9 @@ + (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState { @end @implementation BraveWalletIpfsServiceFactory -+ (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState { ++ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { auto service = - brave_wallet::BraveWalletIpfsServiceFactory::GetForBrowserState( - browserState); + brave_wallet::BraveWalletIpfsServiceFactory::GetForBrowserState(profile); if (!service) { return nil; } @@ -173,9 +170,9 @@ + (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState { @end @implementation BraveWalletZCashWalletServiceFactory -+ (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState { ++ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { auto* brave_wallet_service = - brave_wallet::BraveWalletServiceFactory::GetServiceForState(browserState); + brave_wallet::BraveWalletServiceFactory::GetServiceForState(profile); if (!brave_wallet_service) { return nil; } diff --git a/ios/browser/brave_wallet/brave_wallet_ipfs_service_factory.h b/ios/browser/brave_wallet/brave_wallet_ipfs_service_factory.h index bffd01d90603..b67b03e34577 100644 --- a/ios/browser/brave_wallet/brave_wallet_ipfs_service_factory.h +++ b/ios/browser/brave_wallet/brave_wallet_ipfs_service_factory.h @@ -12,7 +12,7 @@ #include "components/keyed_service/ios/browser_state_keyed_service_factory.h" #include "mojo/public/cpp/bindings/pending_remote.h" -class ChromeBrowserState; +class ProfileIOS; class KeyedService; namespace base { @@ -34,11 +34,10 @@ class BraveWalletIpfsServiceFactory : public BrowserStateKeyedServiceFactory { BraveWalletIpfsServiceFactory& operator=( const BraveWalletIpfsServiceFactory&) = delete; - // Creates the service if it doesn't exist already for |browser_state|. + // Creates the service if it doesn't exist already for |profile|. static mojo::PendingRemote GetForBrowserState( - ChromeBrowserState* browser_state); - static BraveWalletIpfsService* GetServiceForState( - ChromeBrowserState* browser_state); + ProfileIOS* profile); + static BraveWalletIpfsService* GetServiceForState(ProfileIOS* profile); static BraveWalletIpfsServiceFactory* GetInstance(); diff --git a/ios/browser/brave_wallet/brave_wallet_ipfs_service_factory.mm b/ios/browser/brave_wallet/brave_wallet_ipfs_service_factory.mm index 781472f87a43..2bcd55647697 100644 --- a/ios/browser/brave_wallet/brave_wallet_ipfs_service_factory.mm +++ b/ios/browser/brave_wallet/brave_wallet_ipfs_service_factory.mm @@ -18,18 +18,17 @@ // static mojo::PendingRemote -BraveWalletIpfsServiceFactory::GetForBrowserState( - ChromeBrowserState* browser_state) { +BraveWalletIpfsServiceFactory::GetForBrowserState(ProfileIOS* profile) { return static_cast( - GetInstance()->GetServiceForBrowserState(browser_state, true)) + GetInstance()->GetServiceForBrowserState(profile, true)) ->MakeRemote(); } // static BraveWalletIpfsService* BraveWalletIpfsServiceFactory::GetServiceForState( - ChromeBrowserState* browser_state) { + ProfileIOS* profile) { return static_cast( - GetInstance()->GetServiceForBrowserState(browser_state, true)); + GetInstance()->GetServiceForBrowserState(profile, true)); } // static @@ -48,9 +47,9 @@ std::unique_ptr BraveWalletIpfsServiceFactory::BuildServiceInstanceFor( web::BrowserState* context) const { - auto* browser_state = ChromeBrowserState::FromBrowserState(context); + auto* profile = ProfileIOS::FromBrowserState(context); std::unique_ptr ipfs_service( - new BraveWalletIpfsService(browser_state->GetPrefs())); + new BraveWalletIpfsService(profile->GetPrefs())); return ipfs_service; } diff --git a/ios/browser/brave_wallet/brave_wallet_service_factory.h b/ios/browser/brave_wallet/brave_wallet_service_factory.h index 668cc91b8220..5e4ee02f2b57 100644 --- a/ios/browser/brave_wallet/brave_wallet_service_factory.h +++ b/ios/browser/brave_wallet/brave_wallet_service_factory.h @@ -12,7 +12,7 @@ #include "components/keyed_service/ios/browser_state_keyed_service_factory.h" #include "mojo/public/cpp/bindings/pending_remote.h" -class ChromeBrowserState; +class ProfileIOS; class KeyedService; namespace base { @@ -30,11 +30,10 @@ class BraveWalletService; class BraveWalletServiceFactory : public BrowserStateKeyedServiceFactory { public: - // Creates the service if it doesn't exist already for |browser_state|. + // Creates the service if it doesn't exist already for |profile|. static mojo::PendingRemote GetForBrowserState( - ChromeBrowserState* browser_state); - static BraveWalletService* GetServiceForState( - ChromeBrowserState* browser_state); + ProfileIOS* profile); + static BraveWalletService* GetServiceForState(ProfileIOS* profile); static BraveWalletServiceFactory* GetInstance(); diff --git a/ios/browser/brave_wallet/brave_wallet_service_factory.mm b/ios/browser/brave_wallet/brave_wallet_service_factory.mm index 0bafbd50c1fe..87289bc75b57 100644 --- a/ios/browser/brave_wallet/brave_wallet_service_factory.mm +++ b/ios/browser/brave_wallet/brave_wallet_service_factory.mm @@ -21,9 +21,9 @@ class BraveWalletServiceDelegateIos : public BraveWalletServiceDelegate { public: - explicit BraveWalletServiceDelegateIos(ChromeBrowserState* browser_state) { - wallet_base_directory_ = browser_state->GetStatePath(); - is_private_window_ = browser_state->IsOffTheRecord(); + explicit BraveWalletServiceDelegateIos(ProfileIOS* profile) { + wallet_base_directory_ = profile->GetStatePath(); + is_private_window_ = profile->IsOffTheRecord(); } base::FilePath GetWalletBaseDirectory() override { @@ -38,9 +38,9 @@ explicit BraveWalletServiceDelegateIos(ChromeBrowserState* browser_state) { // static BraveWalletService* BraveWalletServiceFactory::GetServiceForState( - ChromeBrowserState* browser_state) { + ProfileIOS* profile) { return static_cast( - GetInstance()->GetServiceForBrowserState(browser_state, true)); + GetInstance()->GetServiceForBrowserState(profile, true)); } // static @@ -59,11 +59,11 @@ explicit BraveWalletServiceDelegateIos(ChromeBrowserState* browser_state) { std::unique_ptr BraveWalletServiceFactory::BuildServiceInstanceFor( web::BrowserState* context) const { - auto* browser_state = ChromeBrowserState::FromBrowserState(context); + auto* profile = ProfileIOS::FromBrowserState(context); std::unique_ptr service(new BraveWalletService( - browser_state->GetSharedURLLoaderFactory(), - std::make_unique(browser_state), - browser_state->GetPrefs(), GetApplicationContext()->GetLocalState())); + profile->GetSharedURLLoaderFactory(), + std::make_unique(profile), + profile->GetPrefs(), GetApplicationContext()->GetLocalState())); return service; } diff --git a/ios/browser/brave_wallet/meld_integration_service_factory.cc b/ios/browser/brave_wallet/meld_integration_service_factory.cc index 97dc7e0d335a..fa06d3b38129 100644 --- a/ios/browser/brave_wallet/meld_integration_service_factory.cc +++ b/ios/browser/brave_wallet/meld_integration_service_factory.cc @@ -21,18 +21,17 @@ namespace brave_wallet { // static mojo::PendingRemote -MeldIntegrationServiceFactory::GetForBrowserState( - ChromeBrowserState* browser_state) { +MeldIntegrationServiceFactory::GetForBrowserState(ProfileIOS* profile) { return static_cast( - GetInstance()->GetServiceForBrowserState(browser_state, true)) + GetInstance()->GetServiceForBrowserState(profile, true)) ->MakeRemote(); } // static MeldIntegrationService* MeldIntegrationServiceFactory::GetServiceForState( - ChromeBrowserState* browser_state) { + ProfileIOS* profile) { return static_cast( - GetInstance()->GetServiceForBrowserState(browser_state, true)); + GetInstance()->GetServiceForBrowserState(profile, true)); } // static @@ -51,9 +50,9 @@ MeldIntegrationServiceFactory::~MeldIntegrationServiceFactory() = default; std::unique_ptr MeldIntegrationServiceFactory::BuildServiceInstanceFor( web::BrowserState* context) const { - auto* browser_state = ChromeBrowserState::FromBrowserState(context); + auto* profile = ProfileIOS::FromBrowserState(context); return std::make_unique( - browser_state->GetSharedURLLoaderFactory()); + profile->GetSharedURLLoaderFactory()); } bool MeldIntegrationServiceFactory::ServiceIsNULLWhileTesting() const { diff --git a/ios/browser/brave_wallet/meld_integration_service_factory.h b/ios/browser/brave_wallet/meld_integration_service_factory.h index 29a86f8e9617..1276f52ce337 100644 --- a/ios/browser/brave_wallet/meld_integration_service_factory.h +++ b/ios/browser/brave_wallet/meld_integration_service_factory.h @@ -12,7 +12,7 @@ #include "components/keyed_service/ios/browser_state_keyed_service_factory.h" #include "mojo/public/cpp/bindings/pending_remote.h" -class ChromeBrowserState; +class ProfileIOS; class KeyedService; namespace base { @@ -30,11 +30,10 @@ class MeldIntegrationService; class MeldIntegrationServiceFactory : public BrowserStateKeyedServiceFactory { public: - // Creates the service if it doesn't exist already for |browser_state|. + // Creates the service if it doesn't exist already for |profile|. static mojo::PendingRemote GetForBrowserState( - ChromeBrowserState* browser_state); - static MeldIntegrationService* GetServiceForState( - ChromeBrowserState* browser_state); + ProfileIOS* profile); + static MeldIntegrationService* GetServiceForState(ProfileIOS* profile); static MeldIntegrationServiceFactory* GetInstance(); diff --git a/ios/browser/brave_wallet/swap_service_factory.cc b/ios/browser/brave_wallet/swap_service_factory.cc index 945ecacc9478..d46265b342be 100644 --- a/ios/browser/brave_wallet/swap_service_factory.cc +++ b/ios/browser/brave_wallet/swap_service_factory.cc @@ -17,9 +17,9 @@ namespace brave_wallet { // static mojo::PendingRemote SwapServiceFactory::GetForBrowserState( - ChromeBrowserState* browser_state) { + ProfileIOS* profile) { return static_cast( - GetInstance()->GetServiceForBrowserState(browser_state, true)) + GetInstance()->GetServiceForBrowserState(profile, true)) ->MakeRemote(); } @@ -38,9 +38,9 @@ SwapServiceFactory::~SwapServiceFactory() = default; std::unique_ptr SwapServiceFactory::BuildServiceInstanceFor( web::BrowserState* context) const { - auto* browser_state = ChromeBrowserState::FromBrowserState(context); + auto* profile = ProfileIOS::FromBrowserState(context); std::unique_ptr swap_service( - new SwapService(browser_state->GetSharedURLLoaderFactory())); + new SwapService(profile->GetSharedURLLoaderFactory())); return swap_service; } diff --git a/ios/browser/brave_wallet/swap_service_factory.h b/ios/browser/brave_wallet/swap_service_factory.h index 7562f8d60e08..f7982663aa02 100644 --- a/ios/browser/brave_wallet/swap_service_factory.h +++ b/ios/browser/brave_wallet/swap_service_factory.h @@ -12,7 +12,7 @@ #include "components/keyed_service/ios/browser_state_keyed_service_factory.h" #include "mojo/public/cpp/bindings/pending_remote.h" -class ChromeBrowserState; +class ProfileIOS; class KeyedService; namespace base { @@ -28,9 +28,9 @@ namespace brave_wallet { class SwapServiceFactory : public BrowserStateKeyedServiceFactory { public: - // Creates the service if it doesn't exist already for |browser_state|. + // Creates the service if it doesn't exist already for |profile|. static mojo::PendingRemote GetForBrowserState( - ChromeBrowserState* browser_state); + ProfileIOS* profile); static SwapServiceFactory* GetInstance(); diff --git a/ios/browser/debounce/debounce_service_factory+private.h b/ios/browser/debounce/debounce_service_factory+private.h index c839de38846e..9e46b3f2890a 100644 --- a/ios/browser/debounce/debounce_service_factory+private.h +++ b/ios/browser/debounce/debounce_service_factory+private.h @@ -21,15 +21,14 @@ class BrowserState; } // namespace web class KeyedService; -class ChromeBrowserState; +class ProfileIOS; namespace debounce { class DebounceService; class DebounceServiceFactory : public BrowserStateKeyedServiceFactory { public: - static debounce::DebounceService* GetServiceForState( - ChromeBrowserState* browser_state); + static debounce::DebounceService* GetServiceForState(ProfileIOS* profile); static DebounceServiceFactory* GetInstance(); diff --git a/ios/browser/debounce/debounce_service_factory.mm b/ios/browser/debounce/debounce_service_factory.mm index 2249e0189557..6bc350bf8623 100644 --- a/ios/browser/debounce/debounce_service_factory.mm +++ b/ios/browser/debounce/debounce_service_factory.mm @@ -22,10 +22,10 @@ #include "ios/web/public/browser_state.h" @implementation DebounceServiceFactory -+ (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState { ++ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { // Create and start the local data file service and component installer debounce::DebounceService* debounceService = - debounce::DebounceServiceFactory::GetServiceForState(browserState); + debounce::DebounceServiceFactory::GetServiceForState(profile); return [[DebounceService alloc] initWithDebounceService:debounceService]; } @end @@ -34,7 +34,7 @@ + (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState { // static debounce::DebounceService* DebounceServiceFactory::GetServiceForState( - ChromeBrowserState* browser_state) { + ProfileIOS* browser_state) { return static_cast( GetInstance()->GetServiceForBrowserState(browser_state, true)); } diff --git a/ios/browser/favicon/brave_ios_favicon_loader_factory.h b/ios/browser/favicon/brave_ios_favicon_loader_factory.h index 0f7e7e89994c..d80a53b90385 100644 --- a/ios/browser/favicon/brave_ios_favicon_loader_factory.h +++ b/ios/browser/favicon/brave_ios_favicon_loader_factory.h @@ -11,19 +11,17 @@ #include "base/no_destructor.h" #include "components/keyed_service/ios/browser_state_keyed_service_factory.h" -class ChromeBrowserState; +class ProfileIOS; namespace brave_favicon { class BraveFaviconLoader; // Singleton that owns all FaviconLoaders and associates them with -// ChromeBrowserState. +// ProfileIOS. class BraveIOSFaviconLoaderFactory : public BrowserStateKeyedServiceFactory { public: - static BraveFaviconLoader* GetForBrowserState( - ChromeBrowserState* browser_state); - static BraveFaviconLoader* GetForBrowserStateIfExists( - ChromeBrowserState* browser_state); + static BraveFaviconLoader* GetForBrowserState(ProfileIOS* profile); + static BraveFaviconLoader* GetForBrowserStateIfExists(ProfileIOS* profile); static BraveIOSFaviconLoaderFactory* GetInstance(); static TestingFactory GetDefaultFactory(); diff --git a/ios/browser/favicon/brave_ios_favicon_loader_factory.mm b/ios/browser/favicon/brave_ios_favicon_loader_factory.mm index 35b658f8899d..5cb414ea1894 100644 --- a/ios/browser/favicon/brave_ios_favicon_loader_factory.mm +++ b/ios/browser/favicon/brave_ios_favicon_loader_factory.mm @@ -21,26 +21,25 @@ namespace { std::unique_ptr BuildFaviconLoader(web::BrowserState* context) { - ChromeBrowserState* browser_state = - ChromeBrowserState::FromBrowserState(context); + ProfileIOS* profile = ProfileIOS::FromBrowserState(context); return std::make_unique( ios::FaviconServiceFactory::GetForBrowserState( - browser_state, ServiceAccessType::EXPLICIT_ACCESS)); + profile, ServiceAccessType::EXPLICIT_ACCESS)); } } // namespace namespace brave_favicon { BraveFaviconLoader* BraveIOSFaviconLoaderFactory::GetForBrowserState( - ChromeBrowserState* browser_state) { + ProfileIOS* profile) { return static_cast( - GetInstance()->GetServiceForBrowserState(browser_state, true)); + GetInstance()->GetServiceForBrowserState(profile, true)); } BraveFaviconLoader* BraveIOSFaviconLoaderFactory::GetForBrowserStateIfExists( - ChromeBrowserState* browser_state) { + ProfileIOS* profile) { return static_cast( - GetInstance()->GetServiceForBrowserState(browser_state, false)); + GetInstance()->GetServiceForBrowserState(profile, false)); } BraveIOSFaviconLoaderFactory* BraveIOSFaviconLoaderFactory::GetInstance() { diff --git a/ios/browser/favicon/docs.md b/ios/browser/favicon/docs.md index af3cf9d0196b..ccd9ed2b5abe 100644 --- a/ios/browser/favicon/docs.md +++ b/ios/browser/favicon/docs.md @@ -5,14 +5,14 @@ This file documents the list of changes made to the Chromium iOS Favicon impleme # Changes -[BraveIOSWebFaviconDriver.h](https://github.com/brave/brave-core/blob/master/ios/browser/favicon/brave_ios_web_favicon_driver.h): Modification of `WebFaviconDriver` to get rid of `web::WebState` and instead use `ChromeBrowserState` as iOS cannot use `web::WebState` since we do not use `CRWWebView` in our Swift code. This means we got rid of all the `WebStateObserver` and `UserData` as well, and instead store the class with the `ChromeBrowserState`. This is done via the `CreateForBrowserState` and `FromBrowserState` functions. +[BraveIOSWebFaviconDriver.h](https://github.com/brave/brave-core/blob/master/ios/browser/favicon/brave_ios_web_favicon_driver.h): Modification of `WebFaviconDriver` to get rid of `web::WebState` and instead use `ProfileIOS` as iOS cannot use `web::WebState` since we do not use `CRWWebView` in our Swift code. This means we got rid of all the `WebStateObserver` and `UserData` as well, and instead store the class with the `ProfileIOS`. This is done via the `CreateForBrowserState` and `FromBrowserState` functions. [BraveIOSWebFaviconDriver.mm](https://github.com/brave/brave-core/blob/master/ios/browser/favicon/brave_ios_web_favicon_driver.mm) The below code was added in order to setup a navigation stack for the Swift iOS WebView when navigation has just begun. ```c++ void BraveIOSWebFaviconDriver::DidStartNavigation( - ChromeBrowserState* browser_state, + ProfileIOS* profile, const GURL& page_url) { items.clear(); auto item = std::make_unique(); @@ -25,7 +25,7 @@ void BraveIOSWebFaviconDriver::DidStartNavigation( When navigation is complete, we call the below function to begin fetching the `Favicon` for the `URL` that was navigated to: ```c++ void BraveIOSWebFaviconDriver::DidFinishNavigation( - ChromeBrowserState* browser_state, + ProfileIOS* profile, const GURL& page_url) { web::NavigationItemImpl* item = !items.empty() ? items.back().get() : nullptr; DCHECK(item); diff --git a/ios/browser/keyed_service/keyed_service_factory_wrapper+private.h b/ios/browser/keyed_service/keyed_service_factory_wrapper+private.h index 756e7ccd2b55..71cd33919c0a 100644 --- a/ios/browser/keyed_service/keyed_service_factory_wrapper+private.h +++ b/ios/browser/keyed_service/keyed_service_factory_wrapper+private.h @@ -10,13 +10,13 @@ #include "brave/ios/browser/keyed_service/keyed_service_factory_wrapper.h" -class ChromeBrowserState; +class ProfileIOS; NS_ASSUME_NONNULL_BEGIN @interface KeyedServiceFactoryWrapper (Private) -+ (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState; ++ (nullable id)serviceForBrowserState:(ProfileIOS*)profile; @end diff --git a/ios/browser/keyed_service/keyed_service_factory_wrapper.mm b/ios/browser/keyed_service/keyed_service_factory_wrapper.mm index d488f791efb6..6ad1ce770538 100644 --- a/ios/browser/keyed_service/keyed_service_factory_wrapper.mm +++ b/ios/browser/keyed_service/keyed_service_factory_wrapper.mm @@ -19,16 +19,17 @@ @implementation KeyedServiceFactoryWrapper + (nullable id)getForPrivateMode:(bool)isPrivateBrowsing { DCHECK_CURRENTLY_ON(web::WebThread::UI); - auto* browserState = GetApplicationContext() - ->GetProfileManager() - ->GetLastUsedProfileDeprecatedDoNotUse(); + std::vector profiles = + GetApplicationContext()->GetProfileManager()->GetLoadedProfiles(); + ProfileIOS* last_used_profile = profiles.at(0); + if (isPrivateBrowsing) { - browserState = browserState->GetOffTheRecordChromeBrowserState(); + last_used_profile = last_used_profile->GetOffTheRecordProfile(); } - return [self serviceForBrowserState:browserState]; + return [self serviceForBrowserState:last_used_profile]; } -+ (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState { ++ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { NOTIMPLEMENTED(); return nil; } diff --git a/ios/browser/providers/BUILD.gn b/ios/browser/providers/BUILD.gn index f5b6bbc54a73..90bf85db00e9 100644 --- a/ios/browser/providers/BUILD.gn +++ b/ios/browser/providers/BUILD.gn @@ -38,6 +38,7 @@ group("brave_providers") { "//ios/chrome/browser/providers/primes:chromium_primes", "//ios/chrome/browser/providers/push_notification:chromium_push_notification", "//ios/chrome/browser/providers/risk_data:chromium_risk_data", + "//ios/chrome/browser/providers/share_kit:chromium_share_kit", "//ios/chrome/browser/providers/signin:chromium_choice", "//ios/chrome/browser/providers/signin:chromium_signin_error", "//ios/chrome/browser/providers/signin:chromium_signin_identity", diff --git a/ios/browser/skus/skus_sdk_factory_wrappers.mm b/ios/browser/skus/skus_sdk_factory_wrappers.mm index 36e6bc74d1cf..f448e614490c 100644 --- a/ios/browser/skus/skus_sdk_factory_wrappers.mm +++ b/ios/browser/skus/skus_sdk_factory_wrappers.mm @@ -15,8 +15,8 @@ #endif @implementation SkusSkusServiceFactory -+ (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState { - auto service = skus::SkusServiceFactory::GetForBrowserState(browserState); ++ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { + auto service = skus::SkusServiceFactory::GetForBrowserState(profile); if (!service) { return nil; } diff --git a/ios/browser/skus/skus_service_factory.h b/ios/browser/skus/skus_service_factory.h index 04a2cd67b923..aa4258eacce2 100644 --- a/ios/browser/skus/skus_service_factory.h +++ b/ios/browser/skus/skus_service_factory.h @@ -12,7 +12,7 @@ #include "components/keyed_service/ios/browser_state_keyed_service_factory.h" #include "mojo/public/cpp/bindings/pending_remote.h" -class ChromeBrowserState; +class ProfileIOS; class KeyedService; namespace base { @@ -30,9 +30,9 @@ class SkusService; class SkusServiceFactory : public BrowserStateKeyedServiceFactory { public: - // Creates the service if it doesn't exist already for |browser_state|. + // Creates the service if it doesn't exist already for |profile|. static mojo::PendingRemote GetForBrowserState( - ChromeBrowserState* browser_state); + ProfileIOS* profile); static SkusServiceFactory* GetInstance(); diff --git a/ios/browser/skus/skus_service_factory.mm b/ios/browser/skus/skus_service_factory.mm index 9828b5e0336f..a4ccb8eb5c8d 100644 --- a/ios/browser/skus/skus_service_factory.mm +++ b/ios/browser/skus/skus_service_factory.mm @@ -23,8 +23,8 @@ // static mojo::PendingRemote SkusServiceFactory::GetForBrowserState( - ChromeBrowserState* browser_state) { - auto* service = GetInstance()->GetServiceForBrowserState(browser_state, true); + ProfileIOS* profile) { + auto* service = GetInstance()->GetServiceForBrowserState(profile, true); if (!service) { return mojo::PendingRemote(); } @@ -51,15 +51,15 @@ return nullptr; } - auto* browser_state = ChromeBrowserState::FromBrowserState(context); - if (browser_state->IsOffTheRecord()) { + auto* profile = ProfileIOS::FromBrowserState(context); + if (profile->IsOffTheRecord()) { return nullptr; } - skus::MigrateSkusSettings(browser_state->GetPrefs(), + skus::MigrateSkusSettings(profile->GetPrefs(), GetApplicationContext()->GetLocalState()); std::unique_ptr sku_service( new skus::SkusServiceImpl(GetApplicationContext()->GetLocalState(), - browser_state->GetSharedURLLoaderFactory())); + profile->GetSharedURLLoaderFactory())); return sku_service; } diff --git a/ios/browser/ui/webui/brave_web_ui_controller_factory.mm b/ios/browser/ui/webui/brave_web_ui_controller_factory.mm index d10fd331dd4e..9b6ab56844d9 100644 --- a/ios/browser/ui/webui/brave_web_ui_controller_factory.mm +++ b/ios/browser/ui/webui/brave_web_ui_controller_factory.mm @@ -47,8 +47,8 @@ WebUIIOSFactoryFunction GetWebUIIOSFactoryFunction(const GURL& url) { } // TODO: Handle RewardsInternalUI, AdsInternalUI, AdblockInternalUI URLs here - // ChromeBrowserState* browser_state = - // ChromeBrowserState::FromWebUIIOS(web_ui); + // ProfileIOS* browser_state = + // ProfileIOS::FromWebUIIOS(web_ui); const std::string url_host = url.host(); /*if (url_host == kAdblockInternalsHost) { diff --git a/ios/browser/ui/webui/brave_webui_source.mm b/ios/browser/ui/webui/brave_webui_source.mm index 85c6b6a454d6..baaa688e9806 100644 --- a/ios/browser/ui/webui/brave_webui_source.mm +++ b/ios/browser/ui/webui/brave_webui_source.mm @@ -37,8 +37,7 @@ void CustomizeWebUIHTMLSource(web::WebUIIOS* web_ui, int html_resource_id, bool disable_trusted_types_csp) { web::WebUIIOSDataSource* source = web::WebUIIOSDataSource::Create(name); - web::WebUIIOSDataSource::Add(ChromeBrowserState::FromWebUIIOS(web_ui), - source); + web::WebUIIOSDataSource::Add(ProfileIOS::FromWebUIIOS(web_ui), source); source->UseStringsJs(); source->AddResourcePaths( diff --git a/ios/browser/ui/webui/skus/skus_internals_ui.mm b/ios/browser/ui/webui/skus/skus_internals_ui.mm index b6b2c47e934c..2a8a4c30fd38 100644 --- a/ios/browser/ui/webui/skus/skus_internals_ui.mm +++ b/ios/browser/ui/webui/skus/skus_internals_ui.mm @@ -46,8 +46,7 @@ std::size_t resource_map_size, int html_resource_id) { web::WebUIIOSDataSource* source = web::WebUIIOSDataSource::Create(name); - web::WebUIIOSDataSource::Add(ChromeBrowserState::FromWebUIIOS(web_ui), - source); + web::WebUIIOSDataSource::Add(ProfileIOS::FromWebUIIOS(web_ui), source); source->UseStringsJs(); // Add required resources. @@ -86,12 +85,12 @@ kSkusInternalsGeneratedSize, IDR_SKUS_INTERNALS_HTML); - ChromeBrowserState* browser_state = ChromeBrowserState::FromWebUIIOS(web_ui); + ProfileIOS* profile = ProfileIOS::FromWebUIIOS(web_ui); skus_service_getter_ = base::BindRepeating( - [](ChromeBrowserState* browser_state) { - return skus::SkusServiceFactory::GetForBrowserState(browser_state); + [](ProfileIOS* profile) { + return skus::SkusServiceFactory::GetForBrowserState(profile); }, - browser_state); + profile); // Bind Mojom Interface web_ui->GetWebState()->GetInterfaceBinderForMainFrame()->AddInterface( diff --git a/ios/browser/url_sanitizer/url_sanitizer_service_factory+private.h b/ios/browser/url_sanitizer/url_sanitizer_service_factory+private.h index 6f64aa2b14bf..fd84efccf837 100644 --- a/ios/browser/url_sanitizer/url_sanitizer_service_factory+private.h +++ b/ios/browser/url_sanitizer/url_sanitizer_service_factory+private.h @@ -21,15 +21,14 @@ class BrowserState; } // namespace web class KeyedService; -class ChromeBrowserState; +class ProfileIOS; namespace brave { class URLSanitizerService; class URLSanitizerServiceFactory : public BrowserStateKeyedServiceFactory { public: - static brave::URLSanitizerService* GetServiceForState( - ChromeBrowserState* browser_state); + static brave::URLSanitizerService* GetServiceForState(ProfileIOS* profile); static URLSanitizerServiceFactory* GetInstance(); diff --git a/ios/browser/url_sanitizer/url_sanitizer_service_factory.mm b/ios/browser/url_sanitizer/url_sanitizer_service_factory.mm index 4040b106247b..bc611623073d 100644 --- a/ios/browser/url_sanitizer/url_sanitizer_service_factory.mm +++ b/ios/browser/url_sanitizer/url_sanitizer_service_factory.mm @@ -24,10 +24,10 @@ #endif @implementation URLSanitizerServiceFactory -+ (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState { ++ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { // Create and start the local data file service and component installer brave::URLSanitizerService* urlSanitizer = - brave::URLSanitizerServiceFactory::GetServiceForState(browserState); + brave::URLSanitizerServiceFactory::GetServiceForState(profile); return [[URLSanitizerService alloc] initWithURLSanitizerService:urlSanitizer]; } @end @@ -36,9 +36,9 @@ + (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState { // static brave::URLSanitizerService* URLSanitizerServiceFactory::GetServiceForState( - ChromeBrowserState* browser_state) { + ProfileIOS* profile) { return static_cast( - GetInstance()->GetServiceForBrowserState(browser_state, true)); + GetInstance()->GetServiceForBrowserState(profile, true)); } // static diff --git a/package.json b/package.json index 0558d0e4148a..b3807474b6f4 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "projects": { "chrome": { "dir": "src", - "tag": "130.0.6723.58", + "tag": "132.0.6779.1", "repository": { "url": "https://github.com/brave/chromium" } @@ -227,4 +227,4 @@ "elliptic": "6.5.7", "send": "0.19.0" } -} +} \ No newline at end of file diff --git a/patches/base-BUILD.gn.patch b/patches/base-BUILD.gn.patch index 05d58f7cbb5d..be871a64a9ac 100644 --- a/patches/base-BUILD.gn.patch +++ b/patches/base-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/base/BUILD.gn b/base/BUILD.gn -index 9247e9b3f4c92e6f573898049bca784cccb4b19c..e88caf45e09e864d42be27352eff26d34562d117 100644 +index 922488fc0980d2460daf12e0011795bfa57682d1..5128b83f5ba9a5eddfafff1b46dba07019d476e2 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn -@@ -4407,6 +4407,7 @@ if (is_android) { +@@ -4439,6 +4439,7 @@ if (is_android) { "android/java/src/org/chromium/base/ValueChangedCallback.java", "android/java/src/org/chromium/base/WrappedClassLoader.java", ] @@ -10,19 +10,11 @@ index 9247e9b3f4c92e6f573898049bca784cccb4b19c..e88caf45e09e864d42be27352eff26d3 if (use_clang_profiling) { sources += [ -@@ -4871,6 +4872,7 @@ if (is_android) { +@@ -4907,6 +4908,7 @@ if (is_android) { "android/java/src/org/chromium/base/shared_preferences/SharedPreferencesManager.java", "android/java/src/org/chromium/base/shared_preferences/StrictPreferenceKeyChecker.java", ] + sources += brave_base_shared_preferences_java_sources } - android_library("base_cached_flags_java") { -@@ -4896,6 +4898,7 @@ if (is_android) { - "android/java/src/org/chromium/base/cached_flags/ValuesOverridden.java", - "android/java/src/org/chromium/base/cached_flags/ValuesReturned.java", - ] -+ sources += brave_base_cached_flags_java_sources - } - - android_aidl("process_launcher_aidl") { + # Most cached_flags code is in components/cached_flags. These classes are diff --git a/patches/base-metrics-histogram_functions.h.patch b/patches/base-metrics-histogram_functions.h.patch index fff78e9226e1..57a32d996c8a 100644 --- a/patches/base-metrics-histogram_functions.h.patch +++ b/patches/base-metrics-histogram_functions.h.patch @@ -1,5 +1,5 @@ diff --git a/base/metrics/histogram_functions.h b/base/metrics/histogram_functions.h -index 84d8945c4e027c6c362c365657becb8345e4ef74..ddc1a795964b3e953945642f9b58a62f0c873d1b 100644 +index effa04b16f8778a1ce4a7b03bc164ab01200102a..7b3a1ede2b23a4aa8d60d1bd264fb2abda050ec4 100644 --- a/base/metrics/histogram_functions.h +++ b/base/metrics/histogram_functions.h @@ -79,6 +79,7 @@ void UmaHistogramEnumeration(std::string_view name, T sample) { diff --git a/patches/base-numerics-checked_math_impl.h.patch b/patches/base-numerics-checked_math_impl.h.patch deleted file mode 100644 index 097fbf5962dd..000000000000 --- a/patches/base-numerics-checked_math_impl.h.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/base/numerics/checked_math_impl.h b/base/numerics/checked_math_impl.h -index e619956a16e0b5ed2b1ecadeeb97deb6d4df4b94..027c46ed08fac68e0cf715a172ba736e3bc9101f 100644 ---- a/base/numerics/checked_math_impl.h -+++ b/base/numerics/checked_math_impl.h -@@ -189,7 +189,7 @@ struct CheckedMulOp { - - Promotion presult = {}; - bool is_valid = true; -- if (CheckedMulFastOp::is_supported) { -+ if constexpr (CheckedMulFastOp::is_supported) { - // The fast op may be available with the promoted type. - // The casts here are safe because of the "value in range" conditional - // above. diff --git a/patches/base-test-BUILD.gn.patch b/patches/base-test-BUILD.gn.patch index b1003ffa0343..bbf9100f4519 100644 --- a/patches/base-test-BUILD.gn.patch +++ b/patches/base-test-BUILD.gn.patch @@ -1,5 +1,5 @@ diff --git a/base/test/BUILD.gn b/base/test/BUILD.gn -index d26f4d09dd3ddbb201f15f870c065b686063bb88..d9e9981ec5635714cfa5d311072ae03a78244d0f 100644 +index c37ba6534270c3c4f7c2d20e6a84824875d9a6b4..09df14d7cba4c3e2173d1c8e5978a5ac41a39676 100644 --- a/base/test/BUILD.gn +++ b/base/test/BUILD.gn @@ -346,6 +346,7 @@ static_library("test_support") { diff --git a/patches/base-threading-thread_restrictions.h.patch b/patches/base-threading-thread_restrictions.h.patch index 6463c844e476..3e88d2ceef4b 100644 --- a/patches/base-threading-thread_restrictions.h.patch +++ b/patches/base-threading-thread_restrictions.h.patch @@ -1,8 +1,8 @@ diff --git a/base/threading/thread_restrictions.h b/base/threading/thread_restrictions.h -index 0de909d74fffc91b9e3afead3204f9c8234fa131..0ca35931519b75a86ad80f3938956507f27cade9 100644 +index 149838be725f2e09274421d087ce4494ecf4bc1d..61e21d7ea50d0e2d9fd14a45053f0e61a6b9f20b 100644 --- a/base/threading/thread_restrictions.h +++ b/base/threading/thread_restrictions.h -@@ -732,6 +732,7 @@ class BASE_EXPORT ScopedAllowBaseSyncPrimitives { +@@ -736,6 +736,7 @@ class BASE_EXPORT ScopedAllowBaseSyncPrimitives { ScopedAllowBaseSyncPrimitives& operator=( const ScopedAllowBaseSyncPrimitives&) = delete; diff --git a/patches/base-trace_event-builtin_categories.h.patch b/patches/base-trace_event-builtin_categories.h.patch index c54032f22f76..666de90cbf52 100644 --- a/patches/base-trace_event-builtin_categories.h.patch +++ b/patches/base-trace_event-builtin_categories.h.patch @@ -1,8 +1,8 @@ diff --git a/base/trace_event/builtin_categories.h b/base/trace_event/builtin_categories.h -index 5bbe83c8948a2db7b3ce558e010ff38632da25cb..6a6dbf7a785d6ffb82bb6c30cca29aeac7cdcccf 100644 +index bf7628ed923556b471c9758311d6d62ea6056125..0366184b2c23574c7fc80c903e3346fea2eacbd0 100644 --- a/base/trace_event/builtin_categories.h +++ b/base/trace_event/builtin_categories.h -@@ -199,6 +199,7 @@ +@@ -200,6 +200,7 @@ X("webrtc") \ X("webrtc_stats") \ X("xr") \ diff --git a/patches/build-android-gyp-lint.py.patch b/patches/build-android-gyp-lint.py.patch index 0a714b3c31a9..bad371262b4e 100644 --- a/patches/build-android-gyp-lint.py.patch +++ b/patches/build-android-gyp-lint.py.patch @@ -1,8 +1,8 @@ diff --git a/build/android/gyp/lint.py b/build/android/gyp/lint.py -index 517ebbb47112568cfad411dcfa6b994a88eb19b1..e266d1fb5be6df59416eefabe44679c284c9e6d4 100755 +index efac6ab90ec93f9c036eb735c14e1ec8fc6aee84..3730e8c888a790f19e4ea2dcc12d00d5f7078419 100755 --- a/build/android/gyp/lint.py +++ b/build/android/gyp/lint.py -@@ -527,5 +527,6 @@ def main(): +@@ -548,5 +548,6 @@ def main(): build_utils.Touch(args.stamp) diff --git a/patches/build-android-gyp-proguard.py.patch b/patches/build-android-gyp-proguard.py.patch index f67943803a77..0beb9e39f544 100644 --- a/patches/build-android-gyp-proguard.py.patch +++ b/patches/build-android-gyp-proguard.py.patch @@ -1,8 +1,8 @@ diff --git a/build/android/gyp/proguard.py b/build/android/gyp/proguard.py -index 5dd433ae0bd92209bd0275e19e710c310e6e8793..cdfe28a2f8facb3f5a50bf0698adbdd838adf5a6 100755 +index a42ce1c8312080ac8cfa0042827c6b6fd059ae22..fcf96a1892a3e0be9312143fd15f216e3db6448d 100755 --- a/build/android/gyp/proguard.py +++ b/build/android/gyp/proguard.py -@@ -376,6 +376,7 @@ def _OptimizeWithR8(options, config_paths, libraries, dynamic_config_data): +@@ -378,6 +378,7 @@ def _OptimizeWithR8(options, config_paths, libraries, dynamic_config_data): '--pg-map-output', tmp_mapping_path, ] diff --git a/patches/build-config-android-BUILD.gn.patch b/patches/build-config-android-BUILD.gn.patch index 447f0aeb9431..98ec1c6c109c 100644 --- a/patches/build-config-android-BUILD.gn.patch +++ b/patches/build-config-android-BUILD.gn.patch @@ -1,5 +1,5 @@ diff --git a/build/config/android/BUILD.gn b/build/config/android/BUILD.gn -index 2124c74e6efd65a55e11ecb7b542e915574f2539..4806c016e2af38f267289d9aa77791b50fa6ad7b 100644 +index 9162edaf82c231bfd1e2cf9741ae698ba18a6880..115f45b3f043ab00b16fe06fbd6188b35787d5e2 100644 --- a/build/config/android/BUILD.gn +++ b/build/config/android/BUILD.gn @@ -53,6 +53,7 @@ config("compiler") { diff --git a/patches/build-config-android-internal_rules.gni.patch b/patches/build-config-android-internal_rules.gni.patch index 5db7bc40528f..953f14b98700 100644 --- a/patches/build-config-android-internal_rules.gni.patch +++ b/patches/build-config-android-internal_rules.gni.patch @@ -1,8 +1,8 @@ diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni -index ec9705d3b1beb96866173666719c42ebe620110c..b2adfe8b2325bb25b3ca26c1465d6a1aa799748a 100644 +index b849838c5642430959890e554821b4eea7916a7a..cafae6ee551f2a57e5ed9442ccf5dd27679bebb7 100644 --- a/build/config/android/internal_rules.gni +++ b/build/config/android/internal_rules.gni -@@ -4167,6 +4167,7 @@ if (enable_java_templates) { +@@ -4190,6 +4190,7 @@ if (enable_java_templates) { } else { not_needed(invoker, [ "missing_classes_allowlist" ]) } diff --git a/patches/build-config-android-rules.gni.patch b/patches/build-config-android-rules.gni.patch index 35ecd371c2ab..f8f7b18e9b3d 100644 --- a/patches/build-config-android-rules.gni.patch +++ b/patches/build-config-android-rules.gni.patch @@ -1,5 +1,5 @@ diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni -index 95c88605890462aeb97dab4dbffd80960bf1533e..4ca2fef1aa52989ead931aa6ce5e2dffb456b183 100644 +index aa6a2fe716646df02b4fe58d288ad2edda3641b6..0659f4ca0cde17f12de3520d429eda07e449aba9 100644 --- a/build/config/android/rules.gni +++ b/build/config/android/rules.gni @@ -207,6 +207,7 @@ if (!is_robolectric && enable_java_templates) { diff --git a/patches/build-rust-cargo_crate.gni.patch b/patches/build-rust-cargo_crate.gni.patch index 9318887eb2ee..9718317e0b7b 100644 --- a/patches/build-rust-cargo_crate.gni.patch +++ b/patches/build-rust-cargo_crate.gni.patch @@ -1,5 +1,5 @@ diff --git a/build/rust/cargo_crate.gni b/build/rust/cargo_crate.gni -index 72904511ee69f25e985aa201f7d9a47ccd0f1480..c1b2804791fa48dab0b4a468e0b6e40aa07d89c6 100644 +index ad5d0020c8e140d7fc92eb13e7aa44f697f1a3f3..f80c18be047063dc4a9c5dbce14a278d99444ad4 100644 --- a/build/rust/cargo_crate.gni +++ b/build/rust/cargo_crate.gni @@ -158,6 +158,7 @@ template("cargo_crate") { diff --git a/patches/build-rust-rust_target.gni.patch b/patches/build-rust-rust_target.gni.patch index 81ad6cb17c6e..9384b3208547 100644 --- a/patches/build-rust-rust_target.gni.patch +++ b/patches/build-rust-rust_target.gni.patch @@ -1,5 +1,5 @@ diff --git a/build/rust/rust_target.gni b/build/rust/rust_target.gni -index 10371f12c0a836d3e99f8fea4c1185198d4b7f0d..4a3021928b2703c1e297e5d5b8c1f941a2f0bf89 100644 +index b8b0e3a0ea1f02f5ebd72116e1d9d7f88a143514..b937393d6910ebd2e2fc6a663e207da32a2bfbeb 100644 --- a/build/rust/rust_target.gni +++ b/build/rust/rust_target.gni @@ -192,7 +192,7 @@ template("rust_target") { diff --git a/patches/chrome-BUILD.gn.patch b/patches/chrome-BUILD.gn.patch index 58f7d331a05d..751ea3f12a55 100644 --- a/patches/chrome-BUILD.gn.patch +++ b/patches/chrome-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn -index 6d355ce559b80b3a74292c29a548f6b8078e8b55..b1b3d5efbe11adaacd4d5c888af40d91d500ec7c 100644 +index e2d2446670d358346b5c7399596625087627d5e4..b08871f4036fb5ba5dc93a17a8c144df3c2420b4 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn -@@ -203,6 +203,7 @@ if (!is_android && !is_mac) { +@@ -199,6 +199,7 @@ if (!is_android && !is_mac) { "common/crash_keys.cc", "common/crash_keys.h", ] @@ -10,7 +10,7 @@ index 6d355ce559b80b3a74292c29a548f6b8078e8b55..b1b3d5efbe11adaacd4d5c888af40d91 deps += [ ":chrome_dll", -@@ -536,11 +537,12 @@ if (is_win) { +@@ -516,11 +517,12 @@ if (is_win) { args += [ "--keystone=0" ] } } @@ -24,7 +24,7 @@ index 6d355ce559b80b3a74292c29a548f6b8078e8b55..b1b3d5efbe11adaacd4d5c888af40d91 extra_substitutions = [ "CHROMIUM_BUNDLE_ID=$chrome_mac_bundle_id", "CHROMIUM_SHORT_NAME=$chrome_product_short_name", -@@ -560,6 +562,7 @@ if (is_win) { +@@ -540,6 +542,7 @@ if (is_win) { "//chrome/common:buildflags", "//chrome/common:version_header", ] @@ -32,7 +32,7 @@ index 6d355ce559b80b3a74292c29a548f6b8078e8b55..b1b3d5efbe11adaacd4d5c888af40d91 if (enable_updater) { deps += [ ":chromium_updater_privileged_helper" ] -@@ -702,6 +705,7 @@ if (is_win) { +@@ -682,6 +685,7 @@ if (is_win) { # this dependency directly copies the file into the framework's # resources directory. public_deps += [ ":chrome_framework_widevine_signature" ] @@ -40,7 +40,7 @@ index 6d355ce559b80b3a74292c29a548f6b8078e8b55..b1b3d5efbe11adaacd4d5c888af40d91 } } -@@ -745,9 +749,11 @@ if (is_win) { +@@ -725,9 +729,11 @@ if (is_win) { "--scm=0", ] } @@ -52,7 +52,7 @@ index 6d355ce559b80b3a74292c29a548f6b8078e8b55..b1b3d5efbe11adaacd4d5c888af40d91 if (is_chrome_branded && include_branded_entitlements) { # These entitlements are bound to the official Google Chrome signing # certificate and will not necessarily work in any other build. -@@ -772,6 +778,7 @@ if (is_win) { +@@ -752,6 +758,7 @@ if (is_win) { info_plist_target = invoker.info_plist_target } else { info_plist_target = ":chrome_helper_plist" @@ -60,7 +60,7 @@ index 6d355ce559b80b3a74292c29a548f6b8078e8b55..b1b3d5efbe11adaacd4d5c888af40d91 } extra_substitutions = [ -@@ -950,6 +957,7 @@ if (is_win) { +@@ -930,6 +937,7 @@ if (is_win) { if (enable_updater) { if (is_chrome_branded) { sources += [ "//third_party/updater/chrome_mac_universal_prod/cipd/${updater_product_full_name}.app" ] @@ -68,7 +68,7 @@ index 6d355ce559b80b3a74292c29a548f6b8078e8b55..b1b3d5efbe11adaacd4d5c888af40d91 } else { sources += [ "$root_out_dir/${updater_product_full_name}.app" ] -@@ -1253,6 +1261,7 @@ if (is_win) { +@@ -1235,6 +1243,7 @@ if (is_win) { "-current_version", chrome_dylib_version, ] @@ -76,7 +76,7 @@ index 6d355ce559b80b3a74292c29a548f6b8078e8b55..b1b3d5efbe11adaacd4d5c888af40d91 if (!is_component_build) { # Specify a sensible install_name for static builds. The library is -@@ -1434,6 +1443,7 @@ if (is_win) { +@@ -1416,6 +1425,7 @@ if (is_win) { group("dependencies") { public_deps = [ @@ -84,7 +84,7 @@ index 6d355ce559b80b3a74292c29a548f6b8078e8b55..b1b3d5efbe11adaacd4d5c888af40d91 "//build:branding_buildflags", "//build:chromeos_buildflags", "//chrome/browser", -@@ -1499,7 +1509,7 @@ group("dependencies") { +@@ -1471,7 +1481,7 @@ group("dependencies") { if (is_win) { process_version_rc_template("chrome_exe_version") { @@ -93,7 +93,7 @@ index 6d355ce559b80b3a74292c29a548f6b8078e8b55..b1b3d5efbe11adaacd4d5c888af40d91 output = "$target_gen_dir/chrome_exe_version.rc" } -@@ -1548,6 +1558,7 @@ group("resources") { +@@ -1520,6 +1530,7 @@ group("resources") { "//chrome/browser:resources", "//chrome/common:resources", "//chrome/renderer:resources", @@ -101,7 +101,7 @@ index 6d355ce559b80b3a74292c29a548f6b8078e8b55..b1b3d5efbe11adaacd4d5c888af40d91 ] } -@@ -1601,6 +1612,7 @@ if (!is_android) { +@@ -1573,6 +1584,7 @@ if (!is_android) { if (enable_resource_allowlist_generation) { repack_allowlist = _chrome_resource_allowlist deps = [ ":resource_allowlist" ] diff --git a/patches/chrome-android-BUILD.gn.patch b/patches/chrome-android-BUILD.gn.patch index d6ee2f914f88..5105419aebf5 100644 --- a/patches/chrome-android-BUILD.gn.patch +++ b/patches/chrome-android-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn -index 3e0a1fe57e55843795740a337a12ea7e8ef0ba3f..cc4aad1e81b8d92eede35342506b5b604c6e6db9 100644 +index 2a0f0eb53683f8d3d5635bf92c25628870f9e895..146d31a5841d5237e8901fc467148b38312fa501 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn -@@ -194,6 +194,7 @@ if (current_toolchain == default_toolchain) { +@@ -192,6 +192,7 @@ if (current_toolchain == default_toolchain) { "java/res_chromium_base/mipmap-xxxhdpi/layered_app_icon_background.png", "java/res_chromium_base/values/channel_constants.xml", ] @@ -18,7 +18,7 @@ index 3e0a1fe57e55843795740a337a12ea7e8ef0ba3f..cc4aad1e81b8d92eede35342506b5b60 } android_resources("java_overlay_resources") { -@@ -774,6 +776,7 @@ if (current_toolchain == default_toolchain) { +@@ -738,6 +740,7 @@ if (current_toolchain == default_toolchain) { ] deps += feed_deps @@ -26,23 +26,23 @@ index 3e0a1fe57e55843795740a337a12ea7e8ef0ba3f..cc4aad1e81b8d92eede35342506b5b60 srcjar_deps = [ ":chrome_android_java_enums_srcjar", -@@ -791,6 +794,7 @@ if (current_toolchain == default_toolchain) { +@@ -755,6 +758,7 @@ if (current_toolchain == default_toolchain) { "//components/sharing_message:sharing_send_message_result_generated_enum", "//components/supervised_user/core/browser:supervised_user_utils_enum_javagen", ] + srcjar_deps += brave_chrome_java_srcjar_deps # From java_sources.gni. - sources = chrome_java_sources + [ app_hooks_impl ] -@@ -923,6 +927,7 @@ if (current_toolchain == default_toolchain) { - "//components/saved_tab_groups:java", + sources = chrome_java_sources +@@ -884,6 +888,7 @@ if (current_toolchain == default_toolchain) { + "//components/saved_tab_groups/public:conversion_utils_java", "//components/segmentation_platform/internal:internal_java", ] + deps += brave_chrome_all_java_deps } action_with_pydeps("chrome_android_java_google_api_keys_srcjar") { -@@ -1558,6 +1563,7 @@ if (current_toolchain == default_toolchain) { +@@ -1526,6 +1531,7 @@ if (current_toolchain == default_toolchain) { "javatests/src/org/chromium/chrome/browser/toolbar/ToolbarSecurityIconTest.java", "javatests/src/org/chromium/chrome/browser/webapps/WebappLaunchCauseMetricsTest.java", ] @@ -50,7 +50,7 @@ index 3e0a1fe57e55843795740a337a12ea7e8ef0ba3f..cc4aad1e81b8d92eede35342506b5b60 deps = [ ":chrome_app_java_resources", ":chrome_unit_test_java_resources", -@@ -2311,6 +2317,7 @@ if (current_toolchain == default_toolchain) { +@@ -2288,6 +2294,7 @@ if (current_toolchain == default_toolchain) { "java/res_chromium_base/mipmap-xxxhdpi/layered_app_icon_background.png", "java/res_chromium_base/values/channel_constants.xml", ] @@ -58,7 +58,7 @@ index 3e0a1fe57e55843795740a337a12ea7e8ef0ba3f..cc4aad1e81b8d92eede35342506b5b60 # Dep needed to ensure override works properly. deps = [ ":chrome_base_module_resources" ] -@@ -2523,6 +2530,7 @@ if (current_toolchain == default_toolchain) { +@@ -2500,6 +2507,7 @@ if (current_toolchain == default_toolchain) { ":${_variant}_locale_pak_assets", ":${_variant}_paks", ] @@ -66,7 +66,7 @@ index 3e0a1fe57e55843795740a337a12ea7e8ef0ba3f..cc4aad1e81b8d92eede35342506b5b60 if (_is_monochrome) { deps += [ "//android_webview:locale_pak_assets" ] } -@@ -2795,6 +2803,7 @@ if (current_toolchain == default_toolchain) { +@@ -2774,6 +2782,7 @@ if (current_toolchain == default_toolchain) { "//components/payments/content/android:service_java", "//third_party/androidx:androidx_browser_browser_java", ] @@ -74,7 +74,7 @@ index 3e0a1fe57e55843795740a337a12ea7e8ef0ba3f..cc4aad1e81b8d92eede35342506b5b60 # More deps for DFMs. if (dfmify_dev_ui) { -@@ -3880,6 +3889,7 @@ generate_jni("chrome_jni_headers") { +@@ -3881,6 +3890,7 @@ generate_jni("chrome_jni_headers") { "java/src/org/chromium/chrome/browser/webapps/WebApkUpdateManager.java", "java/src/org/chromium/chrome/browser/webapps/WebappRegistry.java", ] diff --git a/patches/chrome-android-chrome_java_sources.gni.patch b/patches/chrome-android-chrome_java_sources.gni.patch index 293ed477a561..c0708868e56d 100644 --- a/patches/chrome-android-chrome_java_sources.gni.patch +++ b/patches/chrome-android-chrome_java_sources.gni.patch @@ -1,9 +1,9 @@ diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java_sources.gni -index c37da0e0f8b3e8549106ded5ad22f2c45663d690..aabd7797955889dcec37c47d901140a75bbcefa8 100644 +index 8d001a2311fdcdeade45b8e57ab54acc7a5f0094..4a2a2248823a9a40a6fa6e3a3053763f868897c0 100644 --- a/chrome/android/chrome_java_sources.gni +++ b/chrome/android/chrome_java_sources.gni -@@ -1215,3 +1215,4 @@ chrome_java_sources = [ - "java/src/org/chromium/chrome/browser/webauth/authenticator/CableAuthenticatorUSBActivity.java", +@@ -1218,3 +1218,4 @@ chrome_java_sources = [ + "java/src/org/chromium/chrome/browser/webauth/authenticator/CableAuthenticatorActivity.java", "java/src/org/chromium/chrome/browser/webshare/ShareServiceImplementationFactory.java", ] +chrome_java_sources -= ["java/src/org/chromium/chrome/browser/ntp/IncognitoNewTabPageView.java",] diff --git a/patches/chrome-android-chrome_public_apk_tmpl.gni.patch b/patches/chrome-android-chrome_public_apk_tmpl.gni.patch index 425c305fc8b4..2e7dfe91d77f 100644 --- a/patches/chrome-android-chrome_public_apk_tmpl.gni.patch +++ b/patches/chrome-android-chrome_public_apk_tmpl.gni.patch @@ -1,8 +1,8 @@ diff --git a/chrome/android/chrome_public_apk_tmpl.gni b/chrome/android/chrome_public_apk_tmpl.gni -index 22701454051942b21cdcd6c171e37579dc6166a7..129b9806c595bfab460a1054f74b73f4c65b1ba8 100644 +index b1ab5a7b2a4522ece9a277673ae95430afc4f3a6..e7071b6e2fda8ea91f56b79b0d37d1768c94d5e2 100644 --- a/chrome/android/chrome_public_apk_tmpl.gni +++ b/chrome/android/chrome_public_apk_tmpl.gni -@@ -318,6 +318,7 @@ template("chrome_common_apk_or_module_tmpl") { +@@ -319,6 +319,7 @@ template("chrome_common_apk_or_module_tmpl") { "*ic_file_download_white*", # Bottom edge seems misaligned. "*ic_lock.*", # Bottom edge seems misaligned. ] @@ -10,7 +10,7 @@ index 22701454051942b21cdcd6c171e37579dc6166a7..129b9806c595bfab460a1054f74b73f4 # Most of these, with the exception of resource_exclusion_exceptions, # are currently duplicated in system_webview_apk_tmpl.gni. -@@ -342,6 +343,7 @@ template("chrome_common_apk_or_module_tmpl") { +@@ -343,6 +344,7 @@ template("chrome_common_apk_or_module_tmpl") { proguard_enabled = true proguard_configs = [ "//chrome/android/proguard/main.flags" ] @@ -18,7 +18,7 @@ index 22701454051942b21cdcd6c171e37579dc6166a7..129b9806c595bfab460a1054f74b73f4 if (_is_monochrome) { proguard_configs += [ "//android_webview/nonembedded/java/proguard.flags" ] -@@ -762,6 +764,7 @@ template("chrome_common_apk_or_module_tmpl") { +@@ -749,6 +751,7 @@ template("chrome_common_apk_or_module_tmpl") { "version_code", "version_name", ]) diff --git a/patches/chrome-android-expectations-lint-suppressions.xml.patch b/patches/chrome-android-expectations-lint-suppressions.xml.patch index e442ee7ec2a5..c4d3f7cb8b02 100644 --- a/patches/chrome-android-expectations-lint-suppressions.xml.patch +++ b/patches/chrome-android-expectations-lint-suppressions.xml.patch @@ -1,8 +1,8 @@ diff --git a/chrome/android/expectations/lint-suppressions.xml b/chrome/android/expectations/lint-suppressions.xml -index e49e2cddb7005aabbf081b17e0f29a671802761d..0a79e777e7a2ff48d4b59a5bf7e687423c95f07a 100644 +index 814a84c9b838db7bbd52873344f366ed2f9a73e5..513b3889a4c9ae85af74515b74896909b6b2ab91 100644 --- a/chrome/android/expectations/lint-suppressions.xml +++ b/chrome/android/expectations/lint-suppressions.xml -@@ -296,4 +296,5 @@ https://chromium.googlesource.com/chromium/src/+/main/build/android/docs/lint.md +@@ -302,4 +302,5 @@ https://chromium.googlesource.com/chromium/src/+/main/build/android/docs/lint.md diff --git a/patches/chrome-android-features-tab_ui-BUILD.gn.patch b/patches/chrome-android-features-tab_ui-BUILD.gn.patch index 5a9288ef02b1..9289a4fb70a8 100644 --- a/patches/chrome-android-features-tab_ui-BUILD.gn.patch +++ b/patches/chrome-android-features-tab_ui-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/chrome/android/features/tab_ui/BUILD.gn b/chrome/android/features/tab_ui/BUILD.gn -index 0cd7e86e0cc30e6693df3ed341ec591fb9b62ceb..b9e67b25f29e544898460dd5cd3d580d46877ff5 100644 +index 15eb0b937d56a30420a5a78487d64ffd88971dd8..abe7c93379b73dfb0ce4ea9a42541d00824102d1 100644 --- a/chrome/android/features/tab_ui/BUILD.gn +++ b/chrome/android/features/tab_ui/BUILD.gn -@@ -113,6 +113,7 @@ android_resources("java_resources") { +@@ -112,6 +112,7 @@ android_resources("java_resources") { "java/res/xml/tab_archive_time_delta_preference.xml", "java/res/xml/tabs_settings.xml", ] diff --git a/patches/chrome-android-feed-core-java-src-org-chromium-chrome-browser-feed-FeedSurfaceMediator.java.patch b/patches/chrome-android-feed-core-java-src-org-chromium-chrome-browser-feed-FeedSurfaceMediator.java.patch index 86e6396917dd..0e45bef7226e 100644 --- a/patches/chrome-android-feed-core-java-src-org-chromium-chrome-browser-feed-FeedSurfaceMediator.java.patch +++ b/patches/chrome-android-feed-core-java-src-org-chromium-chrome-browser-feed-FeedSurfaceMediator.java.patch @@ -1,8 +1,8 @@ diff --git a/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedSurfaceMediator.java b/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedSurfaceMediator.java -index c8b8ece464e563ef37ab70429a10fb08451f5986..9d35d3e727fb0d5821492135e81507ff6bc9241d 100644 +index 4f48a5ce2593de9989d7c661b424cd9b1b277c48..77d4e0b97bac1cdb4b66ccdae1cdc466148c9c25 100644 --- a/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedSurfaceMediator.java +++ b/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedSurfaceMediator.java -@@ -301,7 +301,7 @@ public class FeedSurfaceMediator +@@ -303,7 +303,7 @@ public class FeedSurfaceMediator // Start is showing, update the value of Pref.ENABLE_SNIPPETS_BY_DSE here. The // value should be updated before adding an observer to prevent an extra call of // updateContent(). diff --git a/patches/chrome-android-java-AndroidManifest.xml.patch b/patches/chrome-android-java-AndroidManifest.xml.patch index 3885ccfa476b..83fd191d9526 100644 --- a/patches/chrome-android-java-AndroidManifest.xml.patch +++ b/patches/chrome-android-java-AndroidManifest.xml.patch @@ -1,5 +1,5 @@ diff --git a/chrome/android/java/AndroidManifest.xml b/chrome/android/java/AndroidManifest.xml -index f6ffd4c55f136aaeee1690d486b89e73a7909b43..1b6e1cbb7f3d4c94fa6bb8171161938b2e9f3295 100644 +index ab689d4788bf3be40731a8734af7eedfe360c2f4..d29dfc2e69d047d8ede3a3d43fa1d7c44cf4872d 100644 --- a/chrome/android/java/AndroidManifest.xml +++ b/chrome/android/java/AndroidManifest.xml @@ -28,6 +28,7 @@ by a child template that "extends" this file. @@ -20,7 +20,7 @@ index f6ffd4c55f136aaeee1690d486b89e73a7909b43..1b6e1cbb7f3d4c94fa6bb8171161938b -@@ -75,11 +78,17 @@ by a child template that "extends" this file. +@@ -79,11 +82,17 @@ by a child template that "extends" this file. @@ -38,7 +38,7 @@ index f6ffd4c55f136aaeee1690d486b89e73a7909b43..1b6e1cbb7f3d4c94fa6bb8171161938b -@@ -88,7 +97,9 @@ by a child template that "extends" this file. +@@ -92,7 +101,9 @@ by a child template that "extends" this file. @@ -48,7 +48,7 @@ index f6ffd4c55f136aaeee1690d486b89e73a7909b43..1b6e1cbb7f3d4c94fa6bb8171161938b -@@ -140,7 +151,9 @@ by a child template that "extends" this file. +@@ -144,7 +155,9 @@ by a child template that "extends" this file. @@ -58,7 +58,7 @@ index f6ffd4c55f136aaeee1690d486b89e73a7909b43..1b6e1cbb7f3d4c94fa6bb8171161938b {% block extra_uses_permissions %} {% endblock %} -@@ -351,6 +364,7 @@ by a child template that "extends" this file. +@@ -355,6 +368,7 @@ by a child template that "extends" this file. @@ -66,7 +66,7 @@ index f6ffd4c55f136aaeee1690d486b89e73a7909b43..1b6e1cbb7f3d4c94fa6bb8171161938b -@@ -1206,6 +1220,7 @@ by a child template that "extends" this file. +@@ -1194,6 +1208,7 @@ by a child template that "extends" this file. {% endif %} diff --git a/patches/chrome-android-java-src-org-chromium-chrome-browser-SwipeRefreshHandler.java.patch b/patches/chrome-android-java-src-org-chromium-chrome-browser-SwipeRefreshHandler.java.patch index 9cf5819a9f78..5f46eea82f96 100644 --- a/patches/chrome-android-java-src-org-chromium-chrome-browser-SwipeRefreshHandler.java.patch +++ b/patches/chrome-android-java-src-org-chromium-chrome-browser-SwipeRefreshHandler.java.patch @@ -1,5 +1,5 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/SwipeRefreshHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/SwipeRefreshHandler.java -index eab9f6a69e1a09fb66801465cf69503cbc92682f..2d59ac1ec9ad6bb503ff91009b425bddf881420b 100644 +index 08111da566c6a8e832c732dd9580b5a990de51d5..6c7db1687046dfd39f18fd7e16f55d3ea3a76226 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/SwipeRefreshHandler.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/SwipeRefreshHandler.java @@ -140,7 +140,7 @@ public class SwipeRefreshHandler extends TabWebContentsUserData diff --git a/patches/chrome-android-java-src-org-chromium-chrome-browser-contextmenu-ChromeContextMenuItem.java.patch b/patches/chrome-android-java-src-org-chromium-chrome-browser-contextmenu-ChromeContextMenuItem.java.patch index 203b8c60b13c..0970b47f52dd 100644 --- a/patches/chrome-android-java-src-org-chromium-chrome-browser-contextmenu-ChromeContextMenuItem.java.patch +++ b/patches/chrome-android-java-src-org-chromium-chrome-browser-contextmenu-ChromeContextMenuItem.java.patch @@ -1,5 +1,5 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuItem.java b/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuItem.java -index c09394de87cbe5a6f7b99f68fbcac681ccdcd39d..23977dbd6442164f2672149dfad726fb9606fefc 100644 +index 8051698a9f277e4cd4a255cc0b30d2f41b38da46..25bb25c47850b4ced07568c866a7c3f9cc19c142 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuItem.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuItem.java @@ -63,7 +63,7 @@ class ChromeContextMenuItem { diff --git a/patches/chrome-android-java-src-org-chromium-chrome-browser-contextmenu-ChromeContextMenuPopulator.java.patch b/patches/chrome-android-java-src-org-chromium-chrome-browser-contextmenu-ChromeContextMenuPopulator.java.patch index eae2ff9acba6..2ecebee721a3 100644 --- a/patches/chrome-android-java-src-org-chromium-chrome-browser-contextmenu-ChromeContextMenuPopulator.java.patch +++ b/patches/chrome-android-java-src-org-chromium-chrome-browser-contextmenu-ChromeContextMenuPopulator.java.patch @@ -1,8 +1,8 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java b/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java -index 05fafaeb1aa2748640849838743178b7cdabe49f..536a5dad926a446c90fc8dae621d64bf2b0ad874 100644 +index 9a27d978b5733fdcf4768d279e3e19ef717bcd0d..f04dfff4516850bbefd7c7d859c23980d6fb4c66 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java -@@ -161,7 +161,7 @@ public class ChromeContextMenuPopulator implements ContextMenuPopulator { +@@ -163,7 +163,7 @@ public class ChromeContextMenuPopulator implements ContextMenuPopulator { Action.SHARE_HIGHLIGHT, Action.REMOVE_HIGHLIGHT, Action.LEARN_MORE, @@ -11,7 +11,7 @@ index 05fafaeb1aa2748640849838743178b7cdabe49f..536a5dad926a446c90fc8dae621d64bf }) @Retention(RetentionPolicy.SOURCE) public @interface Action { -@@ -206,7 +206,7 @@ public class ChromeContextMenuPopulator implements ContextMenuPopulator { +@@ -208,7 +208,7 @@ public class ChromeContextMenuPopulator implements ContextMenuPopulator { int LEARN_MORE = 38; int OPEN_IN_NEW_TAB_IN_GROUP = 39; int OPEN_IN_NEW_WINDOW = 40; @@ -20,7 +20,7 @@ index 05fafaeb1aa2748640849838743178b7cdabe49f..536a5dad926a446c90fc8dae621d64bf } } -@@ -296,6 +296,7 @@ public class ChromeContextMenuPopulator implements ContextMenuPopulator { +@@ -300,6 +300,7 @@ public class ChromeContextMenuPopulator implements ContextMenuPopulator { if (!MailTo.isMailTo(mParams.getLinkUrl().getSpec()) && !UrlUtilities.isTelScheme(mParams.getLinkUrl())) { linkGroup.add(createListItem(Item.COPY_LINK_ADDRESS)); diff --git a/patches/chrome-android-java-src-org-chromium-chrome-browser-homepage-HomepageManager.java.patch b/patches/chrome-android-java-src-org-chromium-chrome-browser-homepage-HomepageManager.java.patch index b619c63eddae..08589b478706 100644 --- a/patches/chrome-android-java-src-org-chromium-chrome-browser-homepage-HomepageManager.java.patch +++ b/patches/chrome-android-java-src-org-chromium-chrome-browser-homepage-HomepageManager.java.patch @@ -1,5 +1,5 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/homepage/HomepageManager.java b/chrome/android/java/src/org/chromium/chrome/browser/homepage/HomepageManager.java -index 06593f15483f890dc56ba8fcccec47c8e90caaea..0e7187c5623b0cea02de34c797b449280da5bfb0 100644 +index c54f135aa83a4bc9730ab283640f486dd6de6e81..5234a99582a0b936e50ced4b9b8f9671d387b3c3 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/homepage/HomepageManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/homepage/HomepageManager.java @@ -48,7 +48,7 @@ public class HomepageManager diff --git a/patches/chrome-android-java-src-org-chromium-chrome-browser-notifications-NotificationPlatformBridge.java.patch b/patches/chrome-android-java-src-org-chromium-chrome-browser-notifications-NotificationPlatformBridge.java.patch index a3399b7d6466..e0d78a2e7b86 100644 --- a/patches/chrome-android-java-src-org-chromium-chrome-browser-notifications-NotificationPlatformBridge.java.patch +++ b/patches/chrome-android-java-src-org-chromium-chrome-browser-notifications-NotificationPlatformBridge.java.patch @@ -1,5 +1,5 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java -index 83b44aed3069ca17fe3ad82bb2f112c69c8d8aee..d5200904d0ec4fb79b2797f5895dd92b0e526113 100644 +index 0f69d6975ee9225e14ae925b5f81f127ead41403..aa56e1c8e829c517efa285ffa7021af16cd19a4d 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java @@ -141,7 +141,7 @@ public class NotificationPlatformBridge { @@ -11,7 +11,7 @@ index 83b44aed3069ca17fe3ad82bb2f112c69c8d8aee..d5200904d0ec4fb79b2797f5895dd92b public final String notificationId; public final @NotificationType int notificationType; public final String origin; -@@ -892,7 +892,7 @@ public class NotificationPlatformBridge { +@@ -893,7 +893,7 @@ public class NotificationPlatformBridge { .storeNotificationResourcesIfSuspended(notification); } diff --git a/patches/chrome-android-java-src-org-chromium-chrome-browser-privacy-settings-PrivacySettings.java.patch b/patches/chrome-android-java-src-org-chromium-chrome-browser-privacy-settings-PrivacySettings.java.patch index d695ceeb3eb3..a8460980df7c 100644 --- a/patches/chrome-android-java-src-org-chromium-chrome-browser-privacy-settings-PrivacySettings.java.patch +++ b/patches/chrome-android-java-src-org-chromium-chrome-browser-privacy-settings-PrivacySettings.java.patch @@ -1,8 +1,8 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java b/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java -index ba86bbd08ee70b82e079fb7954f3dd4e15777b19..383a81c1d75a1998c631cf880c9105a9446a35b8 100644 +index 76a5bd263d4e13edc5800c576cb3dc02031b105f..82a660a432a9be54d4b6ec9340d1455006bb0b52 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java -@@ -53,7 +53,7 @@ import org.chromium.ui.text.NoUnderlineClickableSpan; +@@ -54,7 +54,7 @@ import org.chromium.components.user_prefs.UserPrefs; import org.chromium.ui.text.SpanApplier; /** Fragment to keep track of the all the privacy related preferences. */ @@ -11,7 +11,7 @@ index ba86bbd08ee70b82e079fb7954f3dd4e15777b19..383a81c1d75a1998c631cf880c9105a9 implements Preference.OnPreferenceChangeListener { private static final String PREF_CAN_MAKE_PAYMENT = "can_make_payment"; private static final String PREF_PRELOAD_PAGES = "preload_pages"; -@@ -408,6 +408,7 @@ public class PrivacySettings extends ChromeBaseSettingsFragment +@@ -423,6 +423,7 @@ public class PrivacySettings extends ChromeBaseSettingsFragment @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { menu.clear(); @@ -19,7 +19,7 @@ index ba86bbd08ee70b82e079fb7954f3dd4e15777b19..383a81c1d75a1998c631cf880c9105a9 MenuItem help = menu.add(Menu.NONE, R.id.menu_id_targeted_help, Menu.NONE, R.string.menu_help); help.setIcon( -@@ -422,7 +423,7 @@ public class PrivacySettings extends ChromeBaseSettingsFragment +@@ -437,7 +438,7 @@ public class PrivacySettings extends ChromeBaseSettingsFragment .show(getActivity(), getString(R.string.help_context_privacy), null); return true; } diff --git a/patches/chrome-android-java-src-org-chromium-chrome-browser-sync-settings-ManageSyncSettings.java.patch b/patches/chrome-android-java-src-org-chromium-chrome-browser-sync-settings-ManageSyncSettings.java.patch index 4c9e38b7a83d..911514a7634d 100644 --- a/patches/chrome-android-java-src-org-chromium-chrome-browser-sync-settings-ManageSyncSettings.java.patch +++ b/patches/chrome-android-java-src-org-chromium-chrome-browser-sync-settings-ManageSyncSettings.java.patch @@ -1,8 +1,8 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/ManageSyncSettings.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/ManageSyncSettings.java -index 0e09dbed0837ec74dd3fef73f3d92555faa7156c..e76992f5ae4e9d92cc94c32ac6fc3efc3f9646ea 100644 +index b6e0e06784b588377166d1c1f6ed4f1c1068a486..6a3f57aa6ec84b7d4e794818b40f047ee9bd3b73 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/ManageSyncSettings.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/ManageSyncSettings.java -@@ -62,7 +62,7 @@ import org.chromium.chrome.browser.ui.signin.SigninUtils; +@@ -64,7 +64,7 @@ import org.chromium.chrome.browser.ui.signin.SigninUtils; import org.chromium.chrome.browser.ui.signin.SignoutButtonPreference; import org.chromium.chrome.browser.ui.signin.history_sync.HistorySyncHelper; import org.chromium.chrome.browser.ui.theme.ChromeSemanticColorUtils; @@ -11,12 +11,12 @@ index 0e09dbed0837ec74dd3fef73f3d92555faa7156c..e76992f5ae4e9d92cc94c32ac6fc3efc import org.chromium.components.browser_ui.settings.ChromeBasePreference; import org.chromium.components.browser_ui.settings.ChromeSwitchPreference; import org.chromium.components.browser_ui.settings.SettingsUtils; -@@ -652,7 +652,7 @@ public class ManageSyncSettings extends ChromeBaseSettingsFragment +@@ -666,7 +666,7 @@ public class ManageSyncSettings extends ChromeBaseSettingsFragment ? ConsentLevel.SIGNIN : ConsentLevel.SYNC)); // May happen if account is removed from the device while this screen is shown. - if (signedInAccountName == null) { + if (false) { - if (getActivity() != null) getActivity().finish(); + finishCurrentSettings(); return; } diff --git a/patches/chrome-android-java_sources.gni.patch b/patches/chrome-android-java_sources.gni.patch index 72aa94fea159..c1c26a93a70c 100644 --- a/patches/chrome-android-java_sources.gni.patch +++ b/patches/chrome-android-java_sources.gni.patch @@ -1,8 +1,8 @@ diff --git a/chrome/android/java_sources.gni b/chrome/android/java_sources.gni -index d73760eb6b423ea00ea07908158f79bbff3b89b2..9a0a86dac12585b3c630ca5b740503394800f24d 100644 +index 6687781711e29c8e1013a2f225cc512f787cb977..9ac3ff8785b33e62bea71ec2614793928788b757 100644 --- a/chrome/android/java_sources.gni +++ b/chrome/android/java_sources.gni -@@ -21,6 +21,7 @@ import("//chrome/common/features.gni") +@@ -20,6 +20,7 @@ import("//chrome/common/features.gni") import("//components/offline_pages/buildflags/features.gni") import("//device/vr/buildflags/buildflags.gni") diff --git a/patches/chrome-app-chrome_crash_reporter_client.cc.patch b/patches/chrome-app-chrome_crash_reporter_client.cc.patch index dde58bfba724..2b8ff9efb998 100644 --- a/patches/chrome-app-chrome_crash_reporter_client.cc.patch +++ b/patches/chrome-app-chrome_crash_reporter_client.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/app/chrome_crash_reporter_client.cc b/chrome/app/chrome_crash_reporter_client.cc -index 9fce053b65940a68fc9e6b89768d642ad63efeb9..97e68c9b4691e6e24406ca396fdb8dbcf770de78 100644 +index fba475a9c6bf96263f3b09f46a4ae5e3b8860260..e10626c8b733182bb70a9e7c293983056b7f9d96 100644 --- a/chrome/app/chrome_crash_reporter_client.cc +++ b/chrome/app/chrome_crash_reporter_client.cc @@ -176,7 +176,7 @@ bool ChromeCrashReporterClient::IsRunningUnattended() { diff --git a/patches/chrome-browser-BUILD.gn.patch b/patches/chrome-browser-BUILD.gn.patch index 501aa63e455f..19ac8bbe993e 100644 --- a/patches/chrome-browser-BUILD.gn.patch +++ b/patches/chrome-browser-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index 7f1c26990d8d43e92615bd3a5f4046d121d6ac6b..2b821a11ad5a449c0be7a58cfd858176049f24ed 100644 +index a662f8e18d5d547c0c774f06e78a9eb4c6f1f0ae..4a4b79fe69eb8ea3dbace1141488310b7f2798d4 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -2516,6 +2516,7 @@ static_library("browser") { +@@ -2530,6 +2530,7 @@ static_library("browser") { "performance_monitor/metric_evaluator_helper_posix.h", ] } @@ -10,7 +10,7 @@ index 7f1c26990d8d43e92615bd3a5f4046d121d6ac6b..2b821a11ad5a449c0be7a58cfd858176 if (!is_chromeos_ash) { sources += [ -@@ -8512,6 +8513,7 @@ static_library("browser_public_dependencies") { +@@ -8634,6 +8635,7 @@ static_library("browser_public_dependencies") { "//rlz:rlz_lib", ] } diff --git a/patches/chrome-browser-about_flags.cc.patch b/patches/chrome-browser-about_flags.cc.patch index 9981f9f000f8..df982839e1b0 100644 --- a/patches/chrome-browser-about_flags.cc.patch +++ b/patches/chrome-browser-about_flags.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc -index 3dd02e4175a3884266dd55c648976ea64837f794..f3bc36af4f342fd81a4ef8c6ee9f5e492befc933 100644 +index 0c1684bb316d3401276f8ab28b9de10686f47e87..47844efd46091e11f1b12e7225954d475dc1fed9 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc -@@ -4231,6 +4231,7 @@ const FeatureEntry::FeatureVariation +@@ -4218,6 +4218,7 @@ const FeatureEntry::FeatureVariation // // When adding a new choice, add it to the end of the list. const FeatureEntry kFeatureEntries[] = { diff --git a/patches/chrome-browser-browsing_data-chrome_browsing_data_remover_delegate.cc.patch b/patches/chrome-browser-browsing_data-chrome_browsing_data_remover_delegate.cc.patch index 3f4904804763..70364e419fac 100644 --- a/patches/chrome-browser-browsing_data-chrome_browsing_data_remover_delegate.cc.patch +++ b/patches/chrome-browser-browsing_data-chrome_browsing_data_remover_delegate.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc -index e0f4ea6b9ee0ada184f63b9f8283a27563c95742..7a27b72e8285f840512ab54ac9b981ca250c761d 100644 +index bba15cbd93207c47512ba1a15546983a189ff575..80919dfb7feb6db465fc7c86c47ccb42924fa383 100644 --- a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc +++ b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc -@@ -1629,6 +1629,7 @@ const char* ChromeBrowsingDataRemoverDelegate::GetHistogramSuffix( +@@ -1654,6 +1654,7 @@ const char* ChromeBrowsingDataRemoverDelegate::GetHistogramSuffix( return "WebrtcVideoPerfHistory"; case TracingDataType::kMediaDeviceSalts: return "MediaDeviceSalts"; diff --git a/patches/chrome-browser-extensions-BUILD.gn.patch b/patches/chrome-browser-extensions-BUILD.gn.patch index bb9af1c6dc25..7377761b825a 100644 --- a/patches/chrome-browser-extensions-BUILD.gn.patch +++ b/patches/chrome-browser-extensions-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/extensions/BUILD.gn b/chrome/browser/extensions/BUILD.gn -index 3297c631e40aa95ed19907dd89f3cc1204e6c5b8..b5ccfb47f15069c10b4d14aa515e8d78d1952535 100644 +index e95a4c339a046b9f9bc7df7445c3aea2dcd75b17..2e7b88c412bd261a5179f5f7dcf7655cfc2897a9 100644 --- a/chrome/browser/extensions/BUILD.gn +++ b/chrome/browser/extensions/BUILD.gn -@@ -1543,6 +1543,7 @@ source_set("extensions") { +@@ -1484,6 +1484,7 @@ source_set("extensions") { "//components/enterprise/data_controls/core/browser", ] } diff --git a/patches/chrome-browser-extensions-api-developer_private-extension_info_generator.cc.patch b/patches/chrome-browser-extensions-api-developer_private-extension_info_generator.cc.patch index a578d1382498..a8ef0f30f6cf 100644 --- a/patches/chrome-browser-extensions-api-developer_private-extension_info_generator.cc.patch +++ b/patches/chrome-browser-extensions-api-developer_private-extension_info_generator.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/extensions/api/developer_private/extension_info_generator.cc b/chrome/browser/extensions/api/developer_private/extension_info_generator.cc -index 3b28400ef1a8ef85df77689925d8c3e727b2c408..4de06c2f72c6ece8aeb714393daee344eeb05d59 100644 +index ec62f6c16e7944a84cee3c0450ed508511656fcf..5682c257b265dfb833f214211b906acd3e72cca9 100644 --- a/chrome/browser/extensions/api/developer_private/extension_info_generator.cc +++ b/chrome/browser/extensions/api/developer_private/extension_info_generator.cc -@@ -677,6 +677,7 @@ void ExtensionInfoGenerator::CreateExtensionInfoHelper( +@@ -678,6 +678,7 @@ void ExtensionInfoGenerator::CreateExtensionInfoHelper( info->incognito_access.is_enabled = util::CanBeIncognitoEnabled(&extension); info->incognito_access.is_active = util::IsIncognitoEnabled(extension.id(), browser_context_); diff --git a/patches/chrome-browser-extensions-api-identity-identity_get_auth_token_function.cc.patch b/patches/chrome-browser-extensions-api-identity-identity_get_auth_token_function.cc.patch index 8793b58d94ba..79cb6834f59a 100644 --- a/patches/chrome-browser-extensions-api-identity-identity_get_auth_token_function.cc.patch +++ b/patches/chrome-browser-extensions-api-identity-identity_get_auth_token_function.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/extensions/api/identity/identity_get_auth_token_function.cc b/chrome/browser/extensions/api/identity/identity_get_auth_token_function.cc -index b57fd80c4b9a95b2c8d9bdadccc9de8cab9e2cea..cd1addad287b86fbfd07b86f8ad0b323afa69e7a 100644 +index da0938c298483c3c28deac413c6c8a9356247bd3..dff529029877f182aee728bc8fe2b5df21de841b 100644 --- a/chrome/browser/extensions/api/identity/identity_get_auth_token_function.cc +++ b/chrome/browser/extensions/api/identity/identity_get_auth_token_function.cc @@ -186,6 +186,7 @@ ExtensionFunction::ResponseAction IdentityGetAuthTokenFunction::Run() { diff --git a/patches/chrome-browser-extensions-api-webrtc_logging_private-webrtc_logging_private_api.cc.patch b/patches/chrome-browser-extensions-api-webrtc_logging_private-webrtc_logging_private_api.cc.patch index f5daa25110db..8d82e7fe6f17 100644 --- a/patches/chrome-browser-extensions-api-webrtc_logging_private-webrtc_logging_private_api.cc.patch +++ b/patches/chrome-browser-extensions-api-webrtc_logging_private-webrtc_logging_private_api.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc b/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc -index 76eaec3f02e6236da44fabfeac3cbded0f2b57bf..6576408bf10ea01c2caf5ae245ab3b37b414d8c9 100644 +index 78631c3636b9adf637c09ea320f06ab529f635ad..4125aa71d53dcf48c006e06bc11ae76249692479 100644 --- a/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc +++ b/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc -@@ -89,6 +89,7 @@ content::RenderProcessHost* WebrtcLoggingPrivateFunction::RphFromRequest( +@@ -88,6 +88,7 @@ content::RenderProcessHost* WebrtcLoggingPrivateFunction::RphFromRequest( const api::webrtc_logging_private::RequestInfo& request, const std::string& security_origin, std::string* error) { diff --git a/patches/chrome-browser-extensions-chrome_component_extension_resource_manager.cc.patch b/patches/chrome-browser-extensions-chrome_component_extension_resource_manager.cc.patch index a587c1e5e950..c80f4a55f40e 100644 --- a/patches/chrome-browser-extensions-chrome_component_extension_resource_manager.cc.patch +++ b/patches/chrome-browser-extensions-chrome_component_extension_resource_manager.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/extensions/chrome_component_extension_resource_manager.cc b/chrome/browser/extensions/chrome_component_extension_resource_manager.cc -index 83fea62df6d7a70c09f433d7d967920860971320..6fe094695314dc641665ddc19d7079719dbfcd7e 100644 +index 389cc9c00d4fa685c9464e388c37224761815215..c961791046cd5c93e5c3b41f1020329b241d8d59 100644 --- a/chrome/browser/extensions/chrome_component_extension_resource_manager.cc +++ b/chrome/browser/extensions/chrome_component_extension_resource_manager.cc @@ -165,6 +165,7 @@ ChromeComponentExtensionResourceManager::Data::Data() { diff --git a/patches/chrome-browser-extensions-extension_management.cc.patch b/patches/chrome-browser-extensions-extension_management.cc.patch index 58b20c2f0427..cfc0a45cff94 100644 --- a/patches/chrome-browser-extensions-extension_management.cc.patch +++ b/patches/chrome-browser-extensions-extension_management.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/extensions/extension_management.cc b/chrome/browser/extensions/extension_management.cc -index bfe0bd55056b8b657cea2e0fefa1fe5c30fd98e2..4f025b7d22354e4d1b03e1cdaab25042d80f7bae 100644 +index a75bfab472cccd2855f121936cbe5bcec18845df..ab0b14c4d7a1786dbbca9b7e59842528bc6ff4e3 100644 --- a/chrome/browser/extensions/extension_management.cc +++ b/chrome/browser/extensions/extension_management.cc -@@ -969,6 +969,7 @@ ExtensionManagementFactory::BuildServiceInstanceForBrowserContext( +@@ -1034,6 +1034,7 @@ ExtensionManagementFactory::BuildServiceInstanceForBrowserContext( content::BrowserContext* context) const { TRACE_EVENT0("browser,startup", "ExtensionManagementFactory::BuildServiceInstanceFor"); diff --git a/patches/chrome-browser-extensions-extension_tab_util.cc.patch b/patches/chrome-browser-extensions-extension_tab_util.cc.patch index d54eb132a9ff..43d3247d80c7 100644 --- a/patches/chrome-browser-extensions-extension_tab_util.cc.patch +++ b/patches/chrome-browser-extensions-extension_tab_util.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/extensions/extension_tab_util.cc b/chrome/browser/extensions/extension_tab_util.cc -index 1687e36dd5966b67fad971fc895ebbbe63b57775..0f404e573b99ea64798a295b9a042b91a73d038b 100644 +index a896cb1079d975fc68cfaf2bd2aa4aa38e7d0af1..a1bbe5c1990b609e951e296d69eeb337c03a7443 100644 --- a/chrome/browser/extensions/extension_tab_util.cc +++ b/chrome/browser/extensions/extension_tab_util.cc -@@ -996,6 +996,7 @@ bool ExtensionTabUtil::IsKillURL(const GURL& url) { +@@ -994,6 +994,7 @@ bool ExtensionTabUtil::IsKillURL(const GURL& url) { } if (!url.SchemeIs(content::kChromeUIScheme)) { diff --git a/patches/chrome-browser-extensions-updater-chrome_update_client_config.h.patch b/patches/chrome-browser-extensions-updater-chrome_update_client_config.h.patch index 37099f680a9f..0864773ee7f9 100644 --- a/patches/chrome-browser-extensions-updater-chrome_update_client_config.h.patch +++ b/patches/chrome-browser-extensions-updater-chrome_update_client_config.h.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/extensions/updater/chrome_update_client_config.h b/chrome/browser/extensions/updater/chrome_update_client_config.h -index de6c63b9c0853df7bef89fb0121a622ea842cf4d..ee72ffd6c9f05d2ac4e9f699bdee67e32b18d3ed 100644 +index 7ac31d271b237b3cdf033340b210cc20d1f88a9c..4828d5382ad6ba87d2364647afa5e18151ab11e5 100644 --- a/chrome/browser/extensions/updater/chrome_update_client_config.h +++ b/chrome/browser/extensions/updater/chrome_update_client_config.h -@@ -86,6 +86,7 @@ class ChromeUpdateClientConfig : public update_client::Configurator { +@@ -85,6 +85,7 @@ class ChromeUpdateClientConfig : public update_client::Configurator { update_client::UpdaterStateProvider GetUpdaterStateProvider() const override; std::optional GetCrxCachePath() const override; bool IsConnectionMetered() const override; diff --git a/patches/chrome-browser-external_protocol-external_protocol_handler.cc.patch b/patches/chrome-browser-external_protocol-external_protocol_handler.cc.patch index 7d41c98eb8a2..b18e158660af 100644 --- a/patches/chrome-browser-external_protocol-external_protocol_handler.cc.patch +++ b/patches/chrome-browser-external_protocol-external_protocol_handler.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/external_protocol/external_protocol_handler.cc b/chrome/browser/external_protocol/external_protocol_handler.cc -index 3c77a50fc57b31c187bd6f6fb18c44c2917f449d..30f37dab771f449d969ed5218a8245b5f276b728 100644 +index b44735d5eedeb988445e030f9b4d64c85be1b120..d5c44d4e1d3e2f7981f89f5a20d258a0e4b9dd7c 100644 --- a/chrome/browser/external_protocol/external_protocol_handler.cc +++ b/chrome/browser/external_protocol/external_protocol_handler.cc -@@ -403,7 +403,7 @@ ExternalProtocolHandler::BlockState ExternalProtocolHandler::GetBlockState( +@@ -409,7 +409,7 @@ ExternalProtocolHandler::BlockState ExternalProtocolHandler::GetBlockState( if (scheme == "mailto") { base::UmaHistogramEnumeration(kBlockStateMetric, BlockStateMetric::kAllowedDefaultMail); diff --git a/patches/chrome-browser-hub-internal-BUILD.gn.patch b/patches/chrome-browser-hub-internal-BUILD.gn.patch index 5f4dd3676201..c944894af806 100644 --- a/patches/chrome-browser-hub-internal-BUILD.gn.patch +++ b/patches/chrome-browser-hub-internal-BUILD.gn.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/hub/internal/BUILD.gn b/chrome/browser/hub/internal/BUILD.gn -index db11b833b402e7808c2d79d6eb11914e957e937b..534dd276105252f18ab6d1b6abe7666685aaa68e 100644 +index 091cd6672c709d037f4ab9ebcc960e249c7e38d8..a315f74cc2fe52b476b3b0d6cef04f4bd1552736 100644 --- a/chrome/browser/hub/internal/BUILD.gn +++ b/chrome/browser/hub/internal/BUILD.gn @@ -43,6 +43,7 @@ android_library("java") { diff --git a/patches/chrome-browser-net-profile_network_context_service.cc.patch b/patches/chrome-browser-net-profile_network_context_service.cc.patch index da198b5aff4e..d6b4a7add2c8 100644 --- a/patches/chrome-browser-net-profile_network_context_service.cc.patch +++ b/patches/chrome-browser-net-profile_network_context_service.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/net/profile_network_context_service.cc b/chrome/browser/net/profile_network_context_service.cc -index 718110bc6d60dfc55ac35cfc316844e1bb19fcb4..51a342c2481f49900bdd521a855a645a7637de6e 100644 +index f63eddccb64da91beaaca2684ad63e5c3815e5f9..5f6cfd585807ae5a1ed66b9b118d4c909b684260 100644 --- a/chrome/browser/net/profile_network_context_service.cc +++ b/chrome/browser/net/profile_network_context_service.cc -@@ -507,6 +507,7 @@ network::mojom::CTPolicyPtr ProfileNetworkContextService::GetCTPolicy() { +@@ -588,6 +588,7 @@ network::mojom::CTPolicyPtr ProfileNetworkContextService::GetCTPolicy() { std::vector excluded_spkis( TranslateStringArray(ct_excluded_spkis)); diff --git a/patches/chrome-browser-net-system_network_context_manager.cc.patch b/patches/chrome-browser-net-system_network_context_manager.cc.patch index cdd48a44cfe6..60e2ff836861 100644 --- a/patches/chrome-browser-net-system_network_context_manager.cc.patch +++ b/patches/chrome-browser-net-system_network_context_manager.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/net/system_network_context_manager.cc b/chrome/browser/net/system_network_context_manager.cc -index afb5ce8d83b05645a19649bfe8bbdfe4512b33fe..4c341ecd0e7f9b193f972a05b1d411ad8d4a2797 100644 +index 1730a008726665c27d3275b98644cc3d1d94a670..10ceb57bf010493f9fa0050795ff22e7de17ac60 100644 --- a/chrome/browser/net/system_network_context_manager.cc +++ b/chrome/browser/net/system_network_context_manager.cc @@ -406,7 +406,7 @@ class SystemNetworkContextManager::URLLoaderFactoryForSystem diff --git a/patches/chrome-browser-notifications-BUILD.gn.patch b/patches/chrome-browser-notifications-BUILD.gn.patch index 4d2b07cf154c..6cf7405fa540 100644 --- a/patches/chrome-browser-notifications-BUILD.gn.patch +++ b/patches/chrome-browser-notifications-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/notifications/BUILD.gn b/chrome/browser/notifications/BUILD.gn -index 49db8238010480739add40efd57c06325b1abd0c..537aa8b1a59c2132720d1755b74d7cf8bdbcf061 100644 +index 338eec1164182da1f040578c9c3887e68a64935b..456b7059674089870a5d965d469fc4030cffb742 100644 --- a/chrome/browser/notifications/BUILD.gn +++ b/chrome/browser/notifications/BUILD.gn -@@ -85,6 +85,7 @@ if (is_android) { +@@ -86,6 +86,7 @@ if (is_android) { "//third_party/jni_zero:jni_zero_java", "//ui/android:ui_no_recycler_view_java", ] diff --git a/patches/chrome-browser-prefs-browser_prefs.cc.patch b/patches/chrome-browser-prefs-browser_prefs.cc.patch index 4f5f2e3a7599..cb6ce802be15 100644 --- a/patches/chrome-browser-prefs-browser_prefs.cc.patch +++ b/patches/chrome-browser-prefs-browser_prefs.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc -index 921f99a4ee22d230e0a035d15c8800d15ef8223f..6b7995dddc8560f26110dc952956ef4669fc1edc 100644 +index 203bc46e39973f810b9dd5132da645b1e92f4c92..b89dcfd127b3bd6154df37c50e526d5c42f993ae 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc -@@ -1865,6 +1865,7 @@ void RegisterLocalState(PrefRegistrySimple* registry) { +@@ -1941,6 +1941,7 @@ void RegisterLocalState(PrefRegistrySimple* registry) { registry->RegisterBooleanPref(prefs::kQRCodeGeneratorEnabled, true); // This is intentionally last. @@ -10,7 +10,7 @@ index 921f99a4ee22d230e0a035d15c8800d15ef8223f..6b7995dddc8560f26110dc952956ef46 RegisterLocalStatePrefsForMigration(registry); } -@@ -2307,6 +2308,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry, +@@ -2383,6 +2384,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry, registry->RegisterDictionaryPref(prefs::kReportingEndpoints); registry->RegisterBooleanPref(prefs::kCompactModeEnabled, false); diff --git a/patches/chrome-browser-profiles-profile.cc.patch b/patches/chrome-browser-profiles-profile.cc.patch index 81fc6b6aac08..c5dcd6632b84 100644 --- a/patches/chrome-browser-profiles-profile.cc.patch +++ b/patches/chrome-browser-profiles-profile.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc -index 76e435416e7ca956468ccbf9c222547d9e75dcaa..f426a199ce2f58f7c3b7193574c277fb5082a5ef 100644 +index a47da7ea84f90b4086736bcac8959a2540957f50..50ba82f5c6c139d9e765a7d889abfdb5fd38703b 100644 --- a/chrome/browser/profiles/profile.cc +++ b/chrome/browser/profiles/profile.cc -@@ -111,6 +111,7 @@ bool Profile::OTRProfileID::AllowsBrowserWindows() const { +@@ -101,6 +101,7 @@ bool Profile::OTRProfileID::AllowsBrowserWindows() const { // DevTools::BrowserContext, MediaRouter::Presentation, and // CaptivePortal::Signin are exceptions to this ban. if (*this == PrimaryID() || diff --git a/patches/chrome-browser-profiles-profile_attributes_entry.cc.patch b/patches/chrome-browser-profiles-profile_attributes_entry.cc.patch index 13afbd8fdc2a..b97cdb56808e 100644 --- a/patches/chrome-browser-profiles-profile_attributes_entry.cc.patch +++ b/patches/chrome-browser-profiles-profile_attributes_entry.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/profiles/profile_attributes_entry.cc b/chrome/browser/profiles/profile_attributes_entry.cc -index 9c2dc034b2055e6a24f015f94dbed1c341ad9b36..0132cb947f686d4e451a0f3ee87af6b3dd48039e 100644 +index 640b8198e61c8f3a724b283ef13b4ecf0cfbccea..07183ca537ec58e83cf0c775fd25028a4ec203b2 100644 --- a/chrome/browser/profiles/profile_attributes_entry.cc +++ b/chrome/browser/profiles/profile_attributes_entry.cc @@ -1054,6 +1054,7 @@ bool ProfileAttributesEntry::ClearValue(const char* key) { diff --git a/patches/chrome-browser-renderer_context_menu-render_view_context_menu.cc.patch b/patches/chrome-browser-renderer_context_menu-render_view_context_menu.cc.patch index 2b1e1ca25bf5..956c2928dcaf 100644 --- a/patches/chrome-browser-renderer_context_menu-render_view_context_menu.cc.patch +++ b/patches/chrome-browser-renderer_context_menu-render_view_context_menu.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/chrome/browser/renderer_context_menu/render_view_context_menu.cc -index aa0d1cc1d45fe17eb59ecceb5dd1f8a1594012a9..f0a508b0085cb149b694ade347c271dfe06bff81 100644 +index ef0bd61ba62a09bb4148429ee6d5302e1025c979..eed888522c30ec7acd15776f16b9faf25e5bc96f 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc -@@ -2411,6 +2411,7 @@ void RenderViewContextMenu::AppendSearchProvider() { +@@ -2414,6 +2414,7 @@ void RenderViewContextMenu::AppendSearchProvider() { if (!selection_navigation_url_.is_valid()) { return; } diff --git a/patches/chrome-browser-renderer_context_menu-render_view_context_menu.h.patch b/patches/chrome-browser-renderer_context_menu-render_view_context_menu.h.patch index 78bac18e9d05..8f361f98b08e 100644 --- a/patches/chrome-browser-renderer_context_menu-render_view_context_menu.h.patch +++ b/patches/chrome-browser-renderer_context_menu-render_view_context_menu.h.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.h b/chrome/browser/renderer_context_menu/render_view_context_menu.h -index 91de5780521af73eb8b41969562ac1c04a23a47f..fd6fc90ac45780e78a117624179268d3434d3191 100644 +index 0266119ae401068dbfbb7905a5a087c52b249dd7..63bd71b579e61bf5b9b164c0db6d0a8bb04eef78 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu.h +++ b/chrome/browser/renderer_context_menu/render_view_context_menu.h @@ -198,6 +198,7 @@ class RenderViewContextMenu diff --git a/patches/chrome-browser-resources-downloads-BUILD.gn.patch b/patches/chrome-browser-resources-downloads-BUILD.gn.patch index 7f7e26f93547..8f1b172aa07f 100644 --- a/patches/chrome-browser-resources-downloads-BUILD.gn.patch +++ b/patches/chrome-browser-resources-downloads-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/resources/downloads/BUILD.gn b/chrome/browser/resources/downloads/BUILD.gn -index 9e9169da0931a577476fe6367be9bd368b631373..e97ba9bc9973680d147ca3215c8ebfff47e1dc37 100644 +index f388e81c0cc50be62ac7471254730dfa54a95644..55384e1dbcfd48387791d9d82362cbfd576e9bb8 100644 --- a/chrome/browser/resources/downloads/BUILD.gn +++ b/chrome/browser/resources/downloads/BUILD.gn -@@ -76,4 +76,5 @@ build_webui("build") { +@@ -71,4 +71,5 @@ build_webui("build") { optimize_webui_host = "downloads" optimize_webui_in_files = [ "downloads.js" ] } diff --git a/patches/chrome-browser-resources-extensions-BUILD.gn.patch b/patches/chrome-browser-resources-extensions-BUILD.gn.patch index 8727f494d8a0..972e758944f7 100644 --- a/patches/chrome-browser-resources-extensions-BUILD.gn.patch +++ b/patches/chrome-browser-resources-extensions-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/resources/extensions/BUILD.gn b/chrome/browser/resources/extensions/BUILD.gn -index 35be9d4dfa2b43d3b4f3ed96147814295e5bef7e..391414e6a5822e0a75e21666146364fb93905438 100644 +index 161d8a1c09e7258b272f9c8e173affe5212030a7..f3e2e0b4952c798d701976458ee6010002c11df7 100644 --- a/chrome/browser/resources/extensions/BUILD.gn +++ b/chrome/browser/resources/extensions/BUILD.gn -@@ -100,4 +100,5 @@ build_webui("build") { +@@ -127,4 +127,5 @@ build_webui("build") { optimize_webui_host = "extensions" optimize_webui_in_files = [ "extensions.js" ] } diff --git a/patches/chrome-browser-resources-extensions-extensions.ts.patch b/patches/chrome-browser-resources-extensions-extensions.ts.patch index de3a6bc5d120..a7f0281837e1 100644 --- a/patches/chrome-browser-resources-extensions-extensions.ts.patch +++ b/patches/chrome-browser-resources-extensions-extensions.ts.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/resources/extensions/extensions.ts b/chrome/browser/resources/extensions/extensions.ts -index 0c026efc93e789ba9327dd02c90dc4de51b451b0..4e309238b2e14667687df886f561e9a94a3da12b 100644 +index 74acc182a99b7864509335588b6a60893c0661d4..60ed52f2970c5a8f263e72f6d71bec216023ebf3 100644 --- a/chrome/browser/resources/extensions/extensions.ts +++ b/chrome/browser/resources/extensions/extensions.ts @@ -2,6 +2,7 @@ diff --git a/patches/chrome-browser-resources-extensions-item_list.html.patch b/patches/chrome-browser-resources-extensions-item_list.html.patch index 60a6292341ca..33a1096787a3 100644 --- a/patches/chrome-browser-resources-extensions-item_list.html.patch +++ b/patches/chrome-browser-resources-extensions-item_list.html.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/resources/extensions/item_list.html b/chrome/browser/resources/extensions/item_list.html -index 4437b5ec9e6d02daca5d63c09e7b73f80e89f246..8ab1fa9c0911acdea50bcef183f7b2cb814c06e7 100644 +index 0142e7b64129a4b30505d8951f19d08ebef273e7..a027bc9045bcc4917702a07db9c41462fd58026d 100644 --- a/chrome/browser/resources/extensions/item_list.html +++ b/chrome/browser/resources/extensions/item_list.html -@@ -164,5 +164,6 @@ +@@ -165,5 +165,6 @@ diff --git a/patches/chrome-browser-resources-extensions-item_list.ts.patch b/patches/chrome-browser-resources-extensions-item_list.ts.patch index debf04cf7275..1c8a36bc6d99 100644 --- a/patches/chrome-browser-resources-extensions-item_list.ts.patch +++ b/patches/chrome-browser-resources-extensions-item_list.ts.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/resources/extensions/item_list.ts b/chrome/browser/resources/extensions/item_list.ts -index 379c286d3399378d6aa85a0b4a82fea164f7839e..e371a3d76e4ff5cc7dad74352c8cd441813b6b46 100644 +index 22b0f8711ef0388f249d2a206c658ffc7813ebd6..8749d81790c85b8a71dea14c8eed182c24a2aadc 100644 --- a/chrome/browser/resources/extensions/item_list.ts +++ b/chrome/browser/resources/extensions/item_list.ts @@ -16,6 +16,7 @@ import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bu diff --git a/patches/chrome-browser-resources-extensions-sidebar.html.patch b/patches/chrome-browser-resources-extensions-sidebar.html.patch index f6def6348ca8..c5a01726ffa2 100644 --- a/patches/chrome-browser-resources-extensions-sidebar.html.patch +++ b/patches/chrome-browser-resources-extensions-sidebar.html.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/resources/extensions/sidebar.html b/chrome/browser/resources/extensions/sidebar.html -index dbba22d216e5b0ff1acdc5b82eef5289a96a0ca8..21bb60f9e88bcc56a7099574f052fbb4b86bcf2b 100644 +index ff74778591b553de60c1125656f1108d70c6d868..bfa71e3cc8ddc6fee2539f87a2f24a3837913922 100644 --- a/chrome/browser/resources/extensions/sidebar.html +++ b/chrome/browser/resources/extensions/sidebar.html -@@ -74,6 +74,7 @@ cr-shared-style"> +@@ -24,6 +24,7 @@ @@ -10,8 +10,8 @@ index dbba22d216e5b0ff1acdc5b82eef5289a96a0ca8..21bb60f9e88bcc56a7099574f052fbb4
-@@ -83,3 +84,4 @@ cr-shared-style"> - inner-h-t-m-l="[[discoverMoreText_]]"> +@@ -33,3 +34,4 @@ + .innerHTML="${this.computeDiscoverMoreText_()}">
+--> diff --git a/patches/chrome-browser-resources-history-BUILD.gn.patch b/patches/chrome-browser-resources-history-BUILD.gn.patch index d60c0ce1012a..61a2bcef7d7c 100644 --- a/patches/chrome-browser-resources-history-BUILD.gn.patch +++ b/patches/chrome-browser-resources-history-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/resources/history/BUILD.gn b/chrome/browser/resources/history/BUILD.gn -index 65f4cef1706e97df2073c7cb662f345ef74db98c..14dc52b8d1fd8bc3decf1540c1dc81212c84ca7b 100644 +index 372975618eebc2d5cba0961cbca4e0113f04d60a..84234b138014b51fc288ac008ea5ba46166d054d 100644 --- a/chrome/browser/resources/history/BUILD.gn +++ b/chrome/browser/resources/history/BUILD.gn -@@ -85,4 +85,5 @@ build_webui("build") { +@@ -86,4 +86,5 @@ build_webui("build") { "lazy_load.js", ] } diff --git a/patches/chrome-browser-resources-history-history.ts.patch b/patches/chrome-browser-resources-history-history.ts.patch index c3dd4f74ee3a..73467a8b6e24 100644 --- a/patches/chrome-browser-resources-history-history.ts.patch +++ b/patches/chrome-browser-resources-history-history.ts.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/resources/history/history.ts b/chrome/browser/resources/history/history.ts -index 90cac9ef363267c6395156dec1022a3a3f617d74..d06ba2c923390e7e32b28787c806bbf4fce6ef75 100644 +index df7ce3f1cfb1adf3cad7f58cdfffb655e4547f3a..ccba80a32d4a9db2c9158dd737059cfab614e2a9 100644 --- a/chrome/browser/resources/history/history.ts +++ b/chrome/browser/resources/history/history.ts @@ -2,6 +2,7 @@ diff --git a/patches/chrome-browser-resources-history-history_item.ts.patch b/patches/chrome-browser-resources-history-history_item.ts.patch index aac7d0c50246..62921c423019 100644 --- a/patches/chrome-browser-resources-history-history_item.ts.patch +++ b/patches/chrome-browser-resources-history-history_item.ts.patch @@ -1,11 +1,11 @@ diff --git a/chrome/browser/resources/history/history_item.ts b/chrome/browser/resources/history/history_item.ts -index 0279d744c9513d40d56a3a7e6f21aee3bd90d90f..585f252a5c8d516ae5eef4368431f088e4ebfc65 100644 +index 0349af62bc595150b87232f899b978a6eb4b56a1..f4b115e5819443cf64af6d507b9f90996faaf524 100644 --- a/chrome/browser/resources/history/history_item.ts +++ b/chrome/browser/resources/history/history_item.ts -@@ -10,6 +10,7 @@ import 'chrome://resources/cr_elements/cr_icons.css.js'; +@@ -10,6 +10,7 @@ import 'chrome://resources/cr_elements/cr_icon/cr_icon.js'; + import 'chrome://resources/cr_elements/cr_icons.css.js'; import 'chrome://resources/cr_elements/cr_shared_vars.css.js'; import 'chrome://resources/js/icon.js'; - import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js'; +import './brave_history_item.js' import {HistoryResultType} from 'chrome://resources/cr_components/history/constants.js'; diff --git a/patches/chrome-browser-resources-password_manager-BUILD.gn.patch b/patches/chrome-browser-resources-password_manager-BUILD.gn.patch index e7c667097f10..e754dd85bc83 100644 --- a/patches/chrome-browser-resources-password_manager-BUILD.gn.patch +++ b/patches/chrome-browser-resources-password_manager-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/resources/password_manager/BUILD.gn b/chrome/browser/resources/password_manager/BUILD.gn -index 6ed26b34261d4ef9dc3cc79fe231ff47634bf947..639163137639fc8a7d8fc2961ec5eaa4f36b9aa4 100644 +index db130bfc91f9743c31d2042393238032c4803680..81f04d556c4f82fbd32743704e4a4bfbb9e504c2 100644 --- a/chrome/browser/resources/password_manager/BUILD.gn +++ b/chrome/browser/resources/password_manager/BUILD.gn -@@ -163,4 +163,5 @@ build_webui("build") { +@@ -168,4 +168,5 @@ build_webui("build") { "$root_gen_dir/chrome/browser/resources/settings_shared/tsc", root_build_dir) ] } diff --git a/patches/chrome-browser-resources-password_manager-password_manager.ts.patch b/patches/chrome-browser-resources-password_manager-password_manager.ts.patch index 22d46e203ba5..5540f1597cba 100644 --- a/patches/chrome-browser-resources-password_manager-password_manager.ts.patch +++ b/patches/chrome-browser-resources-password_manager-password_manager.ts.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/resources/password_manager/password_manager.ts b/chrome/browser/resources/password_manager/password_manager.ts -index a575094e9c3bd85d3510778483c99cd6984bd9aa..14e82df24eed987cae68d809ce1ec41a1d99525e 100644 +index 12ca0e4a9e9d124e32fa0282e15d2f8f719a402f..88151643da3fc5668c0f5162e6c453473ed1ef99 100644 --- a/chrome/browser/resources/password_manager/password_manager.ts +++ b/chrome/browser/resources/password_manager/password_manager.ts @@ -2,6 +2,7 @@ diff --git a/patches/chrome-browser-resources-settings-BUILD.gn.patch b/patches/chrome-browser-resources-settings-BUILD.gn.patch index b655dae90d1a..1bf8f2bff718 100644 --- a/patches/chrome-browser-resources-settings-BUILD.gn.patch +++ b/patches/chrome-browser-resources-settings-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/resources/settings/BUILD.gn b/chrome/browser/resources/settings/BUILD.gn -index 5ecfd08141976b2b4fdd3aa878d62c2973e45ba9..58cfc9ffab81ccc4ce0ba87c614daf0428d9833f 100644 +index 6099b48349c76993cd75ec3bca97e135b453437e..7bf9fede640e9f4d48d3311c1129c71914c05028 100644 --- a/chrome/browser/resources/settings/BUILD.gn +++ b/chrome/browser/resources/settings/BUILD.gn -@@ -451,4 +451,5 @@ build_webui("build") { +@@ -448,4 +448,5 @@ build_webui("build") { "$root_gen_dir/chrome/browser/resources/settings_shared/tsc", root_build_dir) ] } diff --git a/patches/chrome-browser-resources-settings-privacy_page-personalization_options.html.patch b/patches/chrome-browser-resources-settings-privacy_page-personalization_options.html.patch index 01d5ab6b7e89..7bede01313a1 100644 --- a/patches/chrome-browser-resources-settings-privacy_page-personalization_options.html.patch +++ b/patches/chrome-browser-resources-settings-privacy_page-personalization_options.html.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/resources/settings/privacy_page/personalization_options.html b/chrome/browser/resources/settings/privacy_page/personalization_options.html -index 90943cda4959b3e2eb2559652db3fb14de5af6ac..94262a26c04a8d7db5fb5d7ee7fb58fe5ab2787e 100644 +index b86ef3f0d419048dceb1b3d76cf885bbcfd84fcc..279b9bdcbd515d6c1280898455cea7800d840e91 100644 --- a/chrome/browser/resources/settings/privacy_page/personalization_options.html +++ b/chrome/browser/resources/settings/privacy_page/personalization_options.html @@ -23,7 +23,7 @@ @@ -36,7 +36,7 @@ index 90943cda4959b3e2eb2559652db3fb14de5af6ac..94262a26c04a8d7db5fb5d7ee7fb58fe @@ -44,7 +44,7 @@ index 90943cda4959b3e2eb2559652db3fb14de5af6ac..94262a26c04a8d7db5fb5d7ee7fb58fe @@ -52,7 +52,7 @@ index 90943cda4959b3e2eb2559652db3fb14de5af6ac..94262a26c04a8d7db5fb5d7ee7fb58fe diff --git a/patches/chrome-browser-resources-settings-privacy_page-personalization_options.ts.patch b/patches/chrome-browser-resources-settings-privacy_page-personalization_options.ts.patch index b23291fc45b0..7db7b97dbff2 100644 --- a/patches/chrome-browser-resources-settings-privacy_page-personalization_options.ts.patch +++ b/patches/chrome-browser-resources-settings-privacy_page-personalization_options.ts.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/resources/settings/privacy_page/personalization_options.ts b/chrome/browser/resources/settings/privacy_page/personalization_options.ts -index 7b32d6792384404027c01ae14ed294548f90ac71..4c633c877438d846132111a9ff7478d17d8b2e82 100644 +index 72337e108b378d37d7c0e82a79488a29cfedadc7..6a2a3aee4cc00edcb855713ce3252ba01a1a11e0 100644 --- a/chrome/browser/resources/settings/privacy_page/personalization_options.ts +++ b/chrome/browser/resources/settings/privacy_page/personalization_options.ts @@ -91,7 +91,7 @@ export class SettingsPersonalizationOptionsElement extends @@ -11,7 +11,7 @@ index 7b32d6792384404027c01ae14ed294548f90ac71..4c633c877438d846132111a9ff7478d1 // TODO(dbeam): make a virtual.* pref namespace and set/get this normally // (but handled differently in C++). metricsReportingPref_: { -@@ -152,7 +152,7 @@ export class SettingsPersonalizationOptionsElement extends +@@ -157,7 +157,7 @@ export class SettingsPersonalizationOptionsElement extends focusConfig: FocusConfig; syncStatus: SyncStatus; @@ -20,7 +20,7 @@ index 7b32d6792384404027c01ae14ed294548f90ac71..4c633c877438d846132111a9ff7478d1 private metricsReportingPref_: chrome.settingsPrivate.PrefObject; private showRestart_: boolean; // -@@ -209,7 +209,7 @@ export class SettingsPersonalizationOptionsElement extends +@@ -215,7 +215,7 @@ export class SettingsPersonalizationOptionsElement extends override ready() { super.ready(); @@ -29,7 +29,7 @@ index 7b32d6792384404027c01ae14ed294548f90ac71..4c633c877438d846132111a9ff7478d1 const setMetricsReportingPref = (metricsReporting: MetricsReporting) => this.setMetricsReportingPref_(metricsReporting); this.addWebUiListener('metrics-reporting-change', setMetricsReportingPref); -@@ -224,9 +224,11 @@ export class SettingsPersonalizationOptionsElement extends +@@ -230,9 +230,11 @@ export class SettingsPersonalizationOptionsElement extends this.setChromeSigninUserChoiceInfo_.bind(this)); //
@@ -41,7 +41,7 @@ index 7b32d6792384404027c01ae14ed294548f90ac71..4c633c877438d846132111a9ff7478d1 } // -@@ -255,7 +257,7 @@ export class SettingsPersonalizationOptionsElement extends +@@ -261,7 +263,7 @@ export class SettingsPersonalizationOptionsElement extends } // diff --git a/patches/chrome-browser-resources-settings-privacy_page-privacy_page.html.patch b/patches/chrome-browser-resources-settings-privacy_page-privacy_page.html.patch index c12fad7aee6f..03a2c97d9c37 100644 --- a/patches/chrome-browser-resources-settings-privacy_page-privacy_page.html.patch +++ b/patches/chrome-browser-resources-settings-privacy_page-privacy_page.html.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/resources/settings/privacy_page/privacy_page.html b/chrome/browser/resources/settings/privacy_page/privacy_page.html -index 3edf3a7f146129e487e01a03b697f4c60d565063..98c8b6884b20536aa2b96c4ffb86b0865470e06a 100644 +index cbc13c12082ec35a258f23ac2f780f6014b3bac8..2c7200df858c37d3ca86b288a288ffb4d5f0e1eb 100644 --- a/chrome/browser/resources/settings/privacy_page/privacy_page.html +++ b/chrome/browser/resources/settings/privacy_page/privacy_page.html @@ -36,6 +36,7 @@ @@ -10,7 +10,7 @@ index 3edf3a7f146129e487e01a03b697f4c60d565063..98c8b6884b20536aa2b96c4ffb86b086 @@ -18,7 +18,7 @@ index 3edf3a7f146129e487e01a03b697f4c60d565063..98c8b6884b20536aa2b96c4ffb86b086 diff --git a/patches/chrome-browser-resources-settings-privacy_page-privacy_page.ts.patch b/patches/chrome-browser-resources-settings-privacy_page-privacy_page.ts.patch index f1508af48eb7..58e7133b772a 100644 --- a/patches/chrome-browser-resources-settings-privacy_page-privacy_page.ts.patch +++ b/patches/chrome-browser-resources-settings-privacy_page-privacy_page.ts.patch @@ -1,9 +1,9 @@ diff --git a/chrome/browser/resources/settings/privacy_page/privacy_page.ts b/chrome/browser/resources/settings/privacy_page/privacy_page.ts -index ca19589fbc70408fce8ac69c4690eac95f50f309..0db8f2a862ba92ff3729097a1b62b25f748f4dcb 100644 +index 130e9e9b38a682ad1c956973e36cd3ac89eb41a7..ede6878636c9090878475f029b8c7ba553c53b2e 100644 --- a/chrome/browser/resources/settings/privacy_page/privacy_page.ts +++ b/chrome/browser/resources/settings/privacy_page/privacy_page.ts -@@ -24,6 +24,7 @@ import '../settings_shared.css.js'; - import '../site_settings/offer_writing_help_page.js'; +@@ -23,6 +23,7 @@ import '../settings_page/settings_subpage.js'; + import '../settings_shared.css.js'; import '../site_settings/settings_category_default_radio_group.js'; import '../site_settings/smart_card_readers_page.js'; +import './personalization_options.js'; diff --git a/patches/chrome-browser-resources-settings-route.ts.patch b/patches/chrome-browser-resources-settings-route.ts.patch index 19e52a21a97c..d53b5121cd73 100644 --- a/patches/chrome-browser-resources-settings-route.ts.patch +++ b/patches/chrome-browser-resources-settings-route.ts.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/resources/settings/route.ts b/chrome/browser/resources/settings/route.ts -index 287dd67692105fcf52194989e644814075170f4b..64a511e43d8da6988787acd065acf24520e378aa 100644 +index afdd3ed9f90afae64e2b025519ddd6ebcec6d2ab..1a228530c242b34e992cbbe53c000862503ef955 100644 --- a/chrome/browser/resources/settings/route.ts +++ b/chrome/browser/resources/settings/route.ts @@ -9,6 +9,7 @@ import {pageVisibility} from './page_visibility.js'; @@ -10,7 +10,7 @@ index 287dd67692105fcf52194989e644814075170f4b..64a511e43d8da6988787acd065acf245 /** * Add all of the child routes that originate from the privacy route, * regardless of whether the privacy section under basic or advanced. -@@ -318,6 +319,7 @@ function createRoutes(): SettingsRoutes { +@@ -327,6 +328,7 @@ function createRoutes(): SettingsRoutes { loadTimeData.getString('performancePageTitle')); } } diff --git a/patches/chrome-browser-resources-settings-router.ts.patch b/patches/chrome-browser-resources-settings-router.ts.patch index 1fc21a3bb83e..351d35c33537 100644 --- a/patches/chrome-browser-resources-settings-router.ts.patch +++ b/patches/chrome-browser-resources-settings-router.ts.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/resources/settings/router.ts b/chrome/browser/resources/settings/router.ts -index 1fb0b38fef0dcee31015a939fd31202e0294bca7..3abf7c2b1083ad32841b1ef5064da971f6ab1fb7 100644 +index afe6eb3c611c80833e7ceaa32368a45cf8f2dcad..9e2ae5933cb523c0cf5ab48f5bb4218abd251c42 100644 --- a/chrome/browser/resources/settings/router.ts +++ b/chrome/browser/resources/settings/router.ts -@@ -120,6 +120,7 @@ export interface SettingsRoutes { +@@ -121,6 +121,7 @@ export interface SettingsRoutes { IMPORT_DATA: Route; SIGN_OUT: Route; //
diff --git a/patches/chrome-browser-resources-settings-settings.ts.patch b/patches/chrome-browser-resources-settings-settings.ts.patch index 626bff70079b..69c07cf4c96c 100644 --- a/patches/chrome-browser-resources-settings-settings.ts.patch +++ b/patches/chrome-browser-resources-settings-settings.ts.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/resources/settings/settings.ts b/chrome/browser/resources/settings/settings.ts -index 585035dcc577fdc068df718f3fa14ff4cc62cc0f..926fffe8083772470e52bf3960ab5a4ba5c71662 100644 +index d989dfffa97e83bff34ba683d1eb65d567b9e405..05d4b8acb829755ea210de18a64c0cf6f87301c0 100644 --- a/chrome/browser/resources/settings/settings.ts +++ b/chrome/browser/resources/settings/settings.ts @@ -2,6 +2,7 @@ diff --git a/patches/chrome-browser-resources-settings-settings_page-main_page_mixin.ts.patch b/patches/chrome-browser-resources-settings-settings_page-main_page_mixin.ts.patch index cba694b5d6d5..0dfacab48e53 100644 --- a/patches/chrome-browser-resources-settings-settings_page-main_page_mixin.ts.patch +++ b/patches/chrome-browser-resources-settings-settings_page-main_page_mixin.ts.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/resources/settings/settings_page/main_page_mixin.ts b/chrome/browser/resources/settings/settings_page/main_page_mixin.ts -index 8ef2d31d03a8491e8ef70474646f662053eb21ba..ba78bc05eb1b8531a87a95ca1b0a23681f739d36 100644 +index 6c5d4cb887e6741d5d319b1103f1a5fe4fddf72e..0026b2ff4d75b1d2acb7c64bdcbbffb1448ece24 100644 --- a/chrome/browser/resources/settings/settings_page/main_page_mixin.ts +++ b/chrome/browser/resources/settings/settings_page/main_page_mixin.ts @@ -40,7 +40,7 @@ guestTopLevelRoute = routes.PRIVACY; diff --git a/patches/chrome-browser-resources-settings-site_settings_page-site_settings_page.ts.patch b/patches/chrome-browser-resources-settings-site_settings_page-site_settings_page.ts.patch index a2b65f889645..95e378e99258 100644 --- a/patches/chrome-browser-resources-settings-site_settings_page-site_settings_page.ts.patch +++ b/patches/chrome-browser-resources-settings-site_settings_page-site_settings_page.ts.patch @@ -1,12 +1,12 @@ diff --git a/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts b/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts -index a42f9b0e0ed2b752599a93e1c36e42457214a0f6..4e7a5019cf9fada7bff66dead8a0ce857101b4c5 100644 +index 148f0d9c610a632f4cdf32c565c763786c967b37..6144a6fc2d6cdd7fd7e8fbcd9ab7ac04848738bf 100644 --- a/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts +++ b/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts -@@ -8,6 +8,7 @@ - * security site settings. +@@ -9,6 +9,7 @@ */ + import 'chrome://resources/cr_elements/icons_lit.html.js'; +import '../brave_overrides/config.js' - import 'chrome://resources/cr_elements/icons.html.js'; import 'chrome://resources/cr_elements/cr_collapse/cr_collapse.js'; import 'chrome://resources/cr_elements/cr_expand_button/cr_expand_button.js'; + import 'chrome://resources/cr_elements/cr_link_row/cr_link_row.js'; diff --git a/patches/chrome-browser-resources-settings_shared-privacy_page-privacy_page_browser_proxy.ts.patch b/patches/chrome-browser-resources-settings_shared-privacy_page-privacy_page_browser_proxy.ts.patch index 88a1d3a44c07..6e10fa14dda5 100644 --- a/patches/chrome-browser-resources-settings_shared-privacy_page-privacy_page_browser_proxy.ts.patch +++ b/patches/chrome-browser-resources-settings_shared-privacy_page-privacy_page_browser_proxy.ts.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/resources/settings_shared/privacy_page/privacy_page_browser_proxy.ts b/chrome/browser/resources/settings_shared/privacy_page/privacy_page_browser_proxy.ts -index 7f39d9ea5516a06a42336028d61933328c6f3191..5cdd364a038fdb332c9d8a4d5c2aa1a4df476d2c 100644 +index bbc0426516db825d840015851d561e07018ce983..81695e0277226b33330cac2daddedc126070b802 100644 --- a/chrome/browser/resources/settings_shared/privacy_page/privacy_page_browser_proxy.ts +++ b/chrome/browser/resources/settings_shared/privacy_page/privacy_page_browser_proxy.ts -@@ -54,7 +54,7 @@ export interface SecureDnsSetting { +@@ -62,7 +62,7 @@ export interface SecureDnsSetting { } export interface PrivacyPageBrowserProxy { @@ -11,7 +11,7 @@ index 7f39d9ea5516a06a42336028d61933328c6f3191..5cdd364a038fdb332c9d8a4d5c2aa1a4 getMetricsReporting(): Promise; setMetricsReportingEnabled(enabled: boolean): void; -@@ -83,7 +83,7 @@ export interface PrivacyPageBrowserProxy { +@@ -91,7 +91,7 @@ export interface PrivacyPageBrowserProxy { } export class PrivacyPageBrowserProxyImpl implements PrivacyPageBrowserProxy { diff --git a/patches/chrome-browser-resources-side_panel-bookmarks-power_bookmarks_list.ts.patch b/patches/chrome-browser-resources-side_panel-bookmarks-power_bookmarks_list.ts.patch index 621db06a73c7..3a48f46eb593 100644 --- a/patches/chrome-browser-resources-side_panel-bookmarks-power_bookmarks_list.ts.patch +++ b/patches/chrome-browser-resources-side_panel-bookmarks-power_bookmarks_list.ts.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/resources/side_panel/bookmarks/power_bookmarks_list.ts b/chrome/browser/resources/side_panel/bookmarks/power_bookmarks_list.ts -index 1ce2ff08fa00a627e267515f58caed40dccf9eb8..c26eb69478cc1fcd0ebebc5d7aba849c3386d28b 100644 +index 0a4d1c928bc278b6e89b5b36a77f8e7bbe2e339d..fa439e05d59cfa76bbbac6579591ad659c54d564 100644 --- a/chrome/browser/resources/side_panel/bookmarks/power_bookmarks_list.ts +++ b/chrome/browser/resources/side_panel/bookmarks/power_bookmarks_list.ts @@ -3,6 +3,7 @@ diff --git a/patches/chrome-browser-resources-side_panel-read_anything-BUILD.gn.patch b/patches/chrome-browser-resources-side_panel-read_anything-BUILD.gn.patch index 1df4eb5328fb..8453dd4029e4 100644 --- a/patches/chrome-browser-resources-side_panel-read_anything-BUILD.gn.patch +++ b/patches/chrome-browser-resources-side_panel-read_anything-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/resources/side_panel/read_anything/BUILD.gn b/chrome/browser/resources/side_panel/read_anything/BUILD.gn -index d359c56e3443c7ee8b5d17688fa3dbdf77c3eefc..38e7ac4b8a20841f843135955010b0254eba0b13 100644 +index 6ca49c3d2b32ae5f030c1c906120c40f0a00a083..bf3b063f47bd4f699c53465446d60498a7d28d32 100644 --- a/chrome/browser/resources/side_panel/read_anything/BUILD.gn +++ b/chrome/browser/resources/side_panel/read_anything/BUILD.gn -@@ -65,7 +65,7 @@ build_webui("build") { +@@ -68,7 +68,7 @@ build_webui("build") { target_gen_dir) ] webui_context_type = "untrusted" diff --git a/patches/chrome-browser-resources-signin-profile_picker-profile_picker.ts.patch b/patches/chrome-browser-resources-signin-profile_picker-profile_picker.ts.patch index 875518692788..97e8feb197cd 100644 --- a/patches/chrome-browser-resources-signin-profile_picker-profile_picker.ts.patch +++ b/patches/chrome-browser-resources-signin-profile_picker-profile_picker.ts.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/resources/signin/profile_picker/profile_picker.ts b/chrome/browser/resources/signin/profile_picker/profile_picker.ts -index a034b5ea61ddf7330fac06aab88efc3d7b742303..82eb1cf69712b2ab3bd18943e2e7bd1a724e2e09 100644 +index 94ad0ce0598bc570e03ab3d8518708baec5189ce..685ec66568d2d4501d9855ee9f8b09cb1dd08e87 100644 --- a/chrome/browser/resources/signin/profile_picker/profile_picker.ts +++ b/chrome/browser/resources/signin/profile_picker/profile_picker.ts @@ -2,6 +2,7 @@ diff --git a/patches/chrome-browser-safe_browsing-BUILD.gn.patch b/patches/chrome-browser-safe_browsing-BUILD.gn.patch index 6455dce6b05e..40fa983f917b 100644 --- a/patches/chrome-browser-safe_browsing-BUILD.gn.patch +++ b/patches/chrome-browser-safe_browsing-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/safe_browsing/BUILD.gn b/chrome/browser/safe_browsing/BUILD.gn -index fd47cd395ad8e531da57dc4ca0666162f5b28caa..bca0790d681e96af37930e36b8c0adb01803e5d4 100644 +index 19cc1b47ecf4a970f930f7c0b7e802d2739d5802..d37aff1fb03b7383ee5a33ddabc9ac1a13e292a6 100644 --- a/chrome/browser/safe_browsing/BUILD.gn +++ b/chrome/browser/safe_browsing/BUILD.gn -@@ -475,6 +475,7 @@ static_library("safe_browsing") { +@@ -485,6 +485,7 @@ static_library("safe_browsing") { "//components/safe_browsing/android:safe_browsing_mobile", ] } diff --git a/patches/chrome-browser-safe_browsing-download_protection-check_client_download_request_base.cc.patch b/patches/chrome-browser-safe_browsing-download_protection-check_client_download_request_base.cc.patch index c7357f436f55..6598db0c95e3 100644 --- a/patches/chrome-browser-safe_browsing-download_protection-check_client_download_request_base.cc.patch +++ b/patches/chrome-browser-safe_browsing-download_protection-check_client_download_request_base.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/safe_browsing/download_protection/check_client_download_request_base.cc b/chrome/browser/safe_browsing/download_protection/check_client_download_request_base.cc -index 8ba985a855a17fbd3846e77a49760fbacbda8d71..a425f09679ceaa247e32f23aa335400c54672cd3 100644 +index 2334ef0d22d6eb2788dbd5b576c14d22a205b3f3..011e544273b05249ab862852f34bb5914feaa433 100644 --- a/chrome/browser/safe_browsing/download_protection/check_client_download_request_base.cc +++ b/chrome/browser/safe_browsing/download_protection/check_client_download_request_base.cc @@ -325,6 +325,7 @@ void CheckClientDownloadRequestBase::OnRequestBuilt( diff --git a/patches/chrome-browser-shell_integration_linux.cc.patch b/patches/chrome-browser-shell_integration_linux.cc.patch index 1dafa40319ba..0fa18aecfcaa 100644 --- a/patches/chrome-browser-shell_integration_linux.cc.patch +++ b/patches/chrome-browser-shell_integration_linux.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc -index b12e7409a86b78a1f23f0421e4cfc40f7c52ef44..c85d0325c368af296b8c6cb52be89879ae3909cd 100644 +index 29a951523893743ad0c22eb79f608faf6f933d02..7b97014f13308ad67c26b1059926ebc88578058e 100644 --- a/chrome/browser/shell_integration_linux.cc +++ b/chrome/browser/shell_integration_linux.cc -@@ -487,7 +487,7 @@ std::string GetIconName() { +@@ -488,7 +488,7 @@ std::string GetIconName() { #if BUILDFLAG(GOOGLE_CHROME_BRANDING) return "google-chrome"; #else // BUILDFLAG(CHROMIUM_BRANDING) diff --git a/patches/chrome-browser-signin-account_consistency_mode_manager.cc.patch b/patches/chrome-browser-signin-account_consistency_mode_manager.cc.patch index bb455291f548..9ddf9552fc7e 100644 --- a/patches/chrome-browser-signin-account_consistency_mode_manager.cc.patch +++ b/patches/chrome-browser-signin-account_consistency_mode_manager.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/signin/account_consistency_mode_manager.cc b/chrome/browser/signin/account_consistency_mode_manager.cc -index acf531439ae2c45f49f26b4cb4eb2244d33b06fd..ebe8fe337dbebfeb5df831d78829a906be2a0bd7 100644 +index 948a8e31ba7ed7c3ce6f1d3bd5f13152dccae8b8..c1ff39b0abf1ec53191ee0d1dd40d5695edf7bcc 100644 --- a/chrome/browser/signin/account_consistency_mode_manager.cc +++ b/chrome/browser/signin/account_consistency_mode_manager.cc -@@ -197,6 +197,7 @@ AccountConsistencyModeManager::ComputeAccountConsistencyMethod( +@@ -191,6 +191,7 @@ AccountConsistencyModeManager::ComputeAccountConsistencyMethod( Profile* profile) { DCHECK(ShouldBuildServiceForProfile(profile)); diff --git a/patches/chrome-browser-storage_access_api-storage_access_grant_permission_context.cc.patch b/patches/chrome-browser-storage_access_api-storage_access_grant_permission_context.cc.patch index 5b3a3416d76b..d2177f382d2e 100644 --- a/patches/chrome-browser-storage_access_api-storage_access_grant_permission_context.cc.patch +++ b/patches/chrome-browser-storage_access_api-storage_access_grant_permission_context.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/storage_access_api/storage_access_grant_permission_context.cc b/chrome/browser/storage_access_api/storage_access_grant_permission_context.cc -index 96e6d2cff17c67cbe6fd624bf66534b7a0499de4..a0a58eb041ce5dae57b0905442e8bc0becb4e603 100644 +index 38ceb5f98e704f3072a220d09d52dcc68c1e7b50..b32a4ea4e6e574571f9725a51b279a6daa92f9ae 100644 --- a/chrome/browser/storage_access_api/storage_access_grant_permission_context.cc +++ b/chrome/browser/storage_access_api/storage_access_grant_permission_context.cc -@@ -433,6 +433,7 @@ void StorageAccessGrantPermissionContext::CheckForAutoGrantOrAutoDenial( +@@ -447,6 +447,7 @@ void StorageAccessGrantPermissionContext::CheckForAutoGrantOrAutoDenial( break; } } diff --git a/patches/chrome-browser-sync-sync_service_factory.cc.patch b/patches/chrome-browser-sync-sync_service_factory.cc.patch index f8a68c67d8b7..a92d62c164dc 100644 --- a/patches/chrome-browser-sync-sync_service_factory.cc.patch +++ b/patches/chrome-browser-sync-sync_service_factory.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/sync/sync_service_factory.cc b/chrome/browser/sync/sync_service_factory.cc -index be9118475d27ca8651198121dcbec2366a77fdb7..8b8d728b218ca634f704616709514b13c600bd21 100644 +index 05aab64447726fa34c27ace700ba38ab9de6820f..e8705c5ec7952b5067f22ad11cc47ab435401512 100644 --- a/chrome/browser/sync/sync_service_factory.cc +++ b/chrome/browser/sync/sync_service_factory.cc -@@ -413,7 +413,7 @@ std::unique_ptr BuildSyncService( +@@ -414,7 +414,7 @@ std::unique_ptr BuildSyncService( } auto sync_service = diff --git a/patches/chrome-browser-tab_ui-android-BUILD.gn.patch b/patches/chrome-browser-tab_ui-android-BUILD.gn.patch index 8d33ba1eb97a..b8d8ce7f42cb 100644 --- a/patches/chrome-browser-tab_ui-android-BUILD.gn.patch +++ b/patches/chrome-browser-tab_ui-android-BUILD.gn.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/tab_ui/android/BUILD.gn b/chrome/browser/tab_ui/android/BUILD.gn -index f889ad2d2844ce64e15a6268684ecaa478316831..fae2eb47cbc248ed17294dd1aabdb2f1fcaa5664 100644 +index 2e13039e87e467c1f3ed394a2ae5fce8d21b8525..1dcb8453c41a6487c25013841855404d928b09b3 100644 --- a/chrome/browser/tab_ui/android/BUILD.gn +++ b/chrome/browser/tab_ui/android/BUILD.gn @@ -23,6 +23,7 @@ android_library("java") { @@ -9,4 +9,4 @@ index f889ad2d2844ce64e15a6268684ecaa478316831..fae2eb47cbc248ed17294dd1aabdb2f1 + sources += brave_tab_ui_sources deps = [ ":java_resources", - "//base:base_cached_flags_java", + "//base:base_java", diff --git a/patches/chrome-browser-themes-theme_service_factory.cc.patch b/patches/chrome-browser-themes-theme_service_factory.cc.patch index dc24774dd2ae..aa2d44e28660 100644 --- a/patches/chrome-browser-themes-theme_service_factory.cc.patch +++ b/patches/chrome-browser-themes-theme_service_factory.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/themes/theme_service_factory.cc b/chrome/browser/themes/theme_service_factory.cc -index 55d7ce0e353a1e5d7e3c230a58e10b9735b1d50f..3a9078c058fcd4385b8325751021cab8c045b735 100644 +index 8d3982aab2f0ccc1cbbf97d89fba31e55bf292dc..a265ddf05de8228afcd0168f6609037d8af8f322 100644 --- a/chrome/browser/themes/theme_service_factory.cc +++ b/chrome/browser/themes/theme_service_factory.cc @@ -106,6 +106,7 @@ ThemeServiceFactory::~ThemeServiceFactory() = default; diff --git a/patches/chrome-browser-ui-BUILD.gn.patch b/patches/chrome-browser-ui-BUILD.gn.patch index 104e91800dd6..52d99e06b674 100644 --- a/patches/chrome-browser-ui-BUILD.gn.patch +++ b/patches/chrome-browser-ui-BUILD.gn.patch @@ -1,16 +1,16 @@ diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn -index bc6e4008f2c5a5aa47406e4ec69b804b356c7383..949fba72967d38a7696692ca73bfc48e25175918 100644 +index 43f43997a972c36b724ae9eff3ee6c88c0636f23..2f6190882a8f38cb52251a96f9758d15a0a27064 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn -@@ -758,6 +758,7 @@ static_library("ui") { - # TODO(crbug.com/): It includes //c/b/ui/browser_dialogs.h and //c/b/ui/url_identity.h - "//chrome/browser/ui/file_system_access:impl", +@@ -735,6 +735,7 @@ static_library("ui") { + "//chrome/browser/content_settings:content_settings_util_impl", + "//chrome/browser/updates/announcement_notification:impl", ] + public_deps += [ "//brave/browser/ui" ] allow_circular_includes_from += [ "//brave/browser/ui" ] if (enable_vr && is_win) { deps += [ "//chrome/browser/vr:vr_base" ] -@@ -3823,7 +3824,10 @@ static_library("ui") { +@@ -3593,7 +3594,10 @@ static_library("ui") { ] deps += [ "//chrome/updater/app/server/win:updater_legacy_idl" ] } else { diff --git a/patches/chrome-browser-ui-actions-chrome_action_id.h.patch b/patches/chrome-browser-ui-actions-chrome_action_id.h.patch index ffb69af99abc..4ab89412280b 100644 --- a/patches/chrome-browser-ui-actions-chrome_action_id.h.patch +++ b/patches/chrome-browser-ui-actions-chrome_action_id.h.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/ui/actions/chrome_action_id.h b/chrome/browser/ui/actions/chrome_action_id.h -index f36a6ecbca4ba9f6396c9c85e71ad2f946aeb01a..e7daabc52cc33e69c2c5b7319bdaf3e4cab46885 100644 +index 3c8c3fd5b4d2c49d70bf35fca67765b61965f17d..cad5dacdff0c02c2e61e0c1c4874e11eab05d866 100644 --- a/chrome/browser/ui/actions/chrome_action_id.h +++ b/chrome/browser/ui/actions/chrome_action_id.h -@@ -540,6 +540,7 @@ +@@ -542,6 +542,7 @@ /* Side Panel items */ \ E(kActionSidePanelShowAboutThisSite) \ E(kActionSidePanelShowAssistant) \ diff --git a/patches/chrome-browser-ui-android-appmenu-internal-BUILD.gn.patch b/patches/chrome-browser-ui-android-appmenu-internal-BUILD.gn.patch index 56baf6e8044d..39b05790795d 100644 --- a/patches/chrome-browser-ui-android-appmenu-internal-BUILD.gn.patch +++ b/patches/chrome-browser-ui-android-appmenu-internal-BUILD.gn.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/ui/android/appmenu/internal/BUILD.gn b/chrome/browser/ui/android/appmenu/internal/BUILD.gn -index 00ca9a9e250635402df26382f9d7b4b6bf36084b..1ca4fa1c83bb3f8f9e57f402a5f615702150b56c 100644 +index eaece2d8ff3f93acc7e77b3ef08a3bb5aacddc1f..4b579eacdd926b3f88ae35d0f47ae910138a2125 100644 --- a/chrome/browser/ui/android/appmenu/internal/BUILD.gn +++ b/chrome/browser/ui/android/appmenu/internal/BUILD.gn @@ -21,6 +21,7 @@ android_library("java") { diff --git a/patches/chrome-browser-ui-android-appmenu-internal-java-src-org-chromium-chrome-browser-ui-appmenu-AppMenu.java.patch b/patches/chrome-browser-ui-android-appmenu-internal-java-src-org-chromium-chrome-browser-ui-appmenu-AppMenu.java.patch index c6e0ef89d324..1d899a0185d5 100644 --- a/patches/chrome-browser-ui-android-appmenu-internal-java-src-org-chromium-chrome-browser-ui-appmenu-AppMenu.java.patch +++ b/patches/chrome-browser-ui-android-appmenu-internal-java-src-org-chromium-chrome-browser-ui-appmenu-AppMenu.java.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/ui/android/appmenu/internal/java/src/org/chromium/chrome/browser/ui/appmenu/AppMenu.java b/chrome/browser/ui/android/appmenu/internal/java/src/org/chromium/chrome/browser/ui/appmenu/AppMenu.java -index 3215767dde35a6f7443df41267780e7d7bc0d856..2887e59e34012543ed33357faa452dfc23af0779 100644 +index 3faab8b9145128091edff3b5e264d9f0c8f0021b..6e50624f7613afa8b98dadb77b6e8f00362088bb 100644 --- a/chrome/browser/ui/android/appmenu/internal/java/src/org/chromium/chrome/browser/ui/appmenu/AppMenu.java +++ b/chrome/browser/ui/android/appmenu/internal/java/src/org/chromium/chrome/browser/ui/appmenu/AppMenu.java -@@ -307,6 +307,7 @@ class AppMenu implements OnItemClickListener, OnKeyListener, AppMenuClickHandler +@@ -304,6 +304,7 @@ class AppMenu implements OnItemClickListener, OnKeyListener, AppMenuClickHandler anchorView, groupDividerResourceId, anchorViewOffset); diff --git a/patches/chrome-browser-ui-android-toolbar-BUILD.gn.patch b/patches/chrome-browser-ui-android-toolbar-BUILD.gn.patch index b69f33ad6c40..9a3a39286058 100644 --- a/patches/chrome-browser-ui-android-toolbar-BUILD.gn.patch +++ b/patches/chrome-browser-ui-android-toolbar-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/ui/android/toolbar/BUILD.gn b/chrome/browser/ui/android/toolbar/BUILD.gn -index 1f40d76224d521b64894ec51167ee6d2f9eea30e..9be6d36701a1a08a2602eae795e9f5d477e751c5 100644 +index 363dccd31d12a900e4cdcb3dcdf5f07b9a8175a3..3d65c3339e71d7a6f156e5a186a97853960e5fb9 100644 --- a/chrome/browser/ui/android/toolbar/BUILD.gn +++ b/chrome/browser/ui/android/toolbar/BUILD.gn -@@ -107,6 +107,7 @@ android_library("java") { +@@ -109,6 +109,7 @@ android_library("java") { "java/src/org/chromium/chrome/browser/toolbar/top/tab_strip/HeightTransitionHandler.java", "java/src/org/chromium/chrome/browser/toolbar/top/tab_strip/TabStripTransitionCoordinator.java", ] diff --git a/patches/chrome-browser-ui-android-toolbar-java-res-layout-toolbar_phone.xml.patch b/patches/chrome-browser-ui-android-toolbar-java-res-layout-toolbar_phone.xml.patch index 9a1e85950026..4769ccdeeea3 100644 --- a/patches/chrome-browser-ui-android-toolbar-java-res-layout-toolbar_phone.xml.patch +++ b/patches/chrome-browser-ui-android-toolbar-java-res-layout-toolbar_phone.xml.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/ui/android/toolbar/java/res/layout/toolbar_phone.xml b/chrome/browser/ui/android/toolbar/java/res/layout/toolbar_phone.xml -index d91ce25ea457b34de61773d9059bae7a692809f4..c448d5463b217e1f1f0473cee96be2a3cfcb802a 100644 +index 8737a8ed9fc318c8d5793944c6f02cba314c3acc..7d2c1663b041322e52fe4b5c413b403f130d189f 100644 --- a/chrome/browser/ui/android/toolbar/java/res/layout/toolbar_phone.xml +++ b/chrome/browser/ui/android/toolbar/java/res/layout/toolbar_phone.xml @@ -38,6 +38,7 @@ found in the LICENSE file. diff --git a/patches/chrome-browser-ui-android-toolbar-java-res-layout-toolbar_tablet.xml.patch b/patches/chrome-browser-ui-android-toolbar-java-res-layout-toolbar_tablet.xml.patch index d3697c25abdb..f9257e2b28c2 100644 --- a/patches/chrome-browser-ui-android-toolbar-java-res-layout-toolbar_tablet.xml.patch +++ b/patches/chrome-browser-ui-android-toolbar-java-res-layout-toolbar_tablet.xml.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/ui/android/toolbar/java/res/layout/toolbar_tablet.xml b/chrome/browser/ui/android/toolbar/java/res/layout/toolbar_tablet.xml -index b42cdce90f03672094a77f16004064b17e8e446f..5edb2ef910e81e74a18d86df020c950b96696a69 100644 +index 1056313a7c48ec99d6118e3befd1303a04c0e243..29dc9e5e97aab151d196c6432c845ec0730dc785 100644 --- a/chrome/browser/ui/android/toolbar/java/res/layout/toolbar_tablet.xml +++ b/chrome/browser/ui/android/toolbar/java/res/layout/toolbar_tablet.xml @@ -66,6 +66,7 @@ found in the LICENSE file. diff --git a/patches/chrome-browser-ui-android-toolbar-java-src-org-chromium-chrome-browser-toolbar-top-ToolbarPhone.java.patch b/patches/chrome-browser-ui-android-toolbar-java-src-org-chromium-chrome-browser-toolbar-top-ToolbarPhone.java.patch index 7e9b5421ab35..b51ff82668c3 100644 --- a/patches/chrome-browser-ui-android-toolbar-java-src-org-chromium-chrome-browser-toolbar-top-ToolbarPhone.java.patch +++ b/patches/chrome-browser-ui-android-toolbar-java-src-org-chromium-chrome-browser-toolbar-top-ToolbarPhone.java.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarPhone.java b/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarPhone.java -index aeac917409efa2f452d95b17af915170c2d91153..47aa4520ac819933f3bbca3c4cfea444e1cf581f 100644 +index 4c4dda95361ab35d2892019989fef3bd18a528e9..976047ec51c5e41496bfaa75424bdd3a61696816 100644 --- a/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarPhone.java +++ b/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarPhone.java -@@ -435,6 +435,7 @@ public class ToolbarPhone extends ToolbarLayout +@@ -434,6 +434,7 @@ public class ToolbarPhone extends ToolbarLayout if (mOptionalButtonCoordinator != null) { mOptionalButtonCoordinator.setBackgroundColorFilter(color); } @@ -10,7 +10,7 @@ index aeac917409efa2f452d95b17af915170c2d91153..47aa4520ac819933f3bbca3c4cfea444 } private void updateModernLocationBarCorners() { -@@ -589,6 +590,7 @@ public class ToolbarPhone extends ToolbarLayout +@@ -588,6 +589,7 @@ public class ToolbarPhone extends ToolbarLayout mTrackerSupplier.get().notifyEvent(EventConstants.PARTNER_HOME_PAGE_BUTTON_PRESSED); } } @@ -18,7 +18,7 @@ index aeac917409efa2f452d95b17af915170c2d91153..47aa4520ac819933f3bbca3c4cfea444 } @Override -@@ -1047,6 +1049,7 @@ public class ToolbarPhone extends ToolbarLayout +@@ -1046,6 +1048,7 @@ public class ToolbarPhone extends ToolbarLayout * Tab Page. */ private void updateLocationBarLayoutForExpansionAnimation() { @@ -26,7 +26,7 @@ index aeac917409efa2f452d95b17af915170c2d91153..47aa4520ac819933f3bbca3c4cfea444 TraceEvent.begin("ToolbarPhone.updateLocationBarLayoutForExpansionAnimation"); if (isInTabSwitcherMode()) return; -@@ -1426,6 +1429,7 @@ public class ToolbarPhone extends ToolbarLayout +@@ -1425,6 +1428,7 @@ public class ToolbarPhone extends ToolbarLayout canvas.restore(); } @@ -34,7 +34,7 @@ index aeac917409efa2f452d95b17af915170c2d91153..47aa4520ac819933f3bbca3c4cfea444 // Draw the tab stack button and associated text if necessary. if (getTabSwitcherButtonCoordinator() != null && mUrlExpansionFraction != 1f) { // Draw the tab stack button image. -@@ -2106,6 +2110,7 @@ public class ToolbarPhone extends ToolbarLayout +@@ -2105,6 +2109,7 @@ public class ToolbarPhone extends ToolbarLayout } else { populateUrlClearExpansionAnimatorSet(animators); } diff --git a/patches/chrome-browser-ui-browser.cc.patch b/patches/chrome-browser-ui-browser.cc.patch index 5714c5ec994d..a4dfc4f0ce85 100644 --- a/patches/chrome-browser-ui-browser.cc.patch +++ b/patches/chrome-browser-ui-browser.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc -index e1ebde9b491c38cdf0bc6f574e78ac72aa997c66..757564b8cfc0e05702da4030823ba5183d7f06e1 100644 +index e87612be406274364fd125e7e89e803aa21702d8..bb8d0e5261d708475ed6c492eaa7fb7fd1c370d0 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -529,6 +529,7 @@ Browser* Browser::Create(const CreateParams& params) { diff --git a/patches/chrome-browser-ui-browser_navigator.cc.patch b/patches/chrome-browser-ui-browser_navigator.cc.patch index 09dc82580163..37ef3c195e52 100644 --- a/patches/chrome-browser-ui-browser_navigator.cc.patch +++ b/patches/chrome-browser-ui-browser_navigator.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc -index 061432f5974e1b0bcf2b5a62be5540b8ba6df12f..3c5fb01529cb93a8ba317e7fb594291239daf916 100644 +index 70d7f4fbda71c935f08bd90346849d931f5f6821..675200b674cef638e8f627256c084682dadc66c3 100644 --- a/chrome/browser/ui/browser_navigator.cc +++ b/chrome/browser/ui/browser_navigator.cc -@@ -625,6 +625,7 @@ base::WeakPtr Navigate(NavigateParams* params) { +@@ -627,6 +627,7 @@ base::WeakPtr Navigate(NavigateParams* params) { return nullptr; } } @@ -10,7 +10,7 @@ index 061432f5974e1b0bcf2b5a62be5540b8ba6df12f..3c5fb01529cb93a8ba317e7fb5942912 // Open System Apps in their standalone window if necessary. // TODO(crbug.com/40136163): Remove this code after we integrate with intent -@@ -1046,6 +1047,7 @@ bool IsURLAllowedInIncognito(const GURL& url, +@@ -1044,6 +1045,7 @@ bool IsURLAllowedInIncognito(const GURL& url, return stripped_url.is_valid() && IsURLAllowedInIncognito(stripped_url, browser_context); } diff --git a/patches/chrome-browser-ui-browser_ui_prefs.cc.patch b/patches/chrome-browser-ui-browser_ui_prefs.cc.patch index 86d2778d8b08..120a2465e43c 100644 --- a/patches/chrome-browser-ui-browser_ui_prefs.cc.patch +++ b/patches/chrome-browser-ui-browser_ui_prefs.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/ui/browser_ui_prefs.cc b/chrome/browser/ui/browser_ui_prefs.cc -index dc3191190654b7c9dfa32d5b0c92814c3b4d4480..2d00a9a5d0b30dceffbf769146a27ffbdbcbc9df 100644 +index 6beaa87108b322443497156d49c147c314b8212b..7a0fa6ef3c3a7458bbb949a7722430d99620b26c 100644 --- a/chrome/browser/ui/browser_ui_prefs.cc +++ b/chrome/browser/ui/browser_ui_prefs.cc -@@ -98,7 +98,7 @@ void RegisterBrowserUserPrefs(user_prefs::PrefRegistrySyncable* registry) { +@@ -96,7 +96,7 @@ void RegisterBrowserUserPrefs(user_prefs::PrefRegistrySyncable* registry) { registry->RegisterBooleanPref(prefs::kWebAppCreateInQuickLaunchBar, true); registry->RegisterBooleanPref( translate::prefs::kOfferTranslateEnabled, true, diff --git a/patches/chrome-browser-ui-chrome_pages.cc.patch b/patches/chrome-browser-ui-chrome_pages.cc.patch index b54dba514b74..f4c9722cf827 100644 --- a/patches/chrome-browser-ui-chrome_pages.cc.patch +++ b/patches/chrome-browser-ui-chrome_pages.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/ui/chrome_pages.cc b/chrome/browser/ui/chrome_pages.cc -index 840b3156b3e14606ec473b8f96fb738fe9e97d5d..1367fafab60d82e147d0699f262b02bca01cb09c 100644 +index bf6f4b20da6c1bac3c63fa6039189e9fe13ea031..18758e3ac719abea953c7e04d76356c7bfbfebe3 100644 --- a/chrome/browser/ui/chrome_pages.cc +++ b/chrome/browser/ui/chrome_pages.cc @@ -403,7 +403,7 @@ void ShowSlow(Browser* browser) { diff --git a/patches/chrome-browser-ui-color-BUILD.gn.patch b/patches/chrome-browser-ui-color-BUILD.gn.patch index a29a24f39f93..f75359bd7d08 100644 --- a/patches/chrome-browser-ui-color-BUILD.gn.patch +++ b/patches/chrome-browser-ui-color-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/ui/color/BUILD.gn b/chrome/browser/ui/color/BUILD.gn -index aa06f30703313055734cbd8e73be651a493aeae1..f8b81651022a9876fcba331ce64a7a1c5d838f6d 100644 +index 02d3457d65c4edf2cdbb3c37d90813b496f7945b..c7a8b1b901c2106f4d6145bb5ea9b08479122a65 100644 --- a/chrome/browser/ui/color/BUILD.gn +++ b/chrome/browser/ui/color/BUILD.gn -@@ -61,6 +61,7 @@ source_set("mixers") { +@@ -62,6 +62,7 @@ source_set("mixers") { "//ui/color:color", "//ui/color:mixers", ] diff --git a/patches/chrome-browser-ui-omnibox-chrome_omnibox_client.h.patch b/patches/chrome-browser-ui-omnibox-chrome_omnibox_client.h.patch index 6b3a92a9ace9..fbbef0005c47 100644 --- a/patches/chrome-browser-ui-omnibox-chrome_omnibox_client.h.patch +++ b/patches/chrome-browser-ui-omnibox-chrome_omnibox_client.h.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/ui/omnibox/chrome_omnibox_client.h b/chrome/browser/ui/omnibox/chrome_omnibox_client.h -index ecd15f6fcd2a2d713f9f688477d07524a2f53386..1b27de5cf6fe2305a4834f7f1c38631a34fe5e70 100644 +index e13c48e733b29acfc935b5af6cdf66b460aac116..073fcebd740101b5e6da1171e35ce597a093ef85 100644 --- a/chrome/browser/ui/omnibox/chrome_omnibox_client.h +++ b/chrome/browser/ui/omnibox/chrome_omnibox_client.h @@ -23,7 +23,7 @@ class GURL; diff --git a/patches/chrome-browser-ui-tab_helpers.cc.patch b/patches/chrome-browser-ui-tab_helpers.cc.patch index 791851421148..66de6375e60a 100644 --- a/patches/chrome-browser-ui-tab_helpers.cc.patch +++ b/patches/chrome-browser-ui-tab_helpers.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/ui/tab_helpers.cc b/chrome/browser/ui/tab_helpers.cc -index b7dacc2a46e5351d265fe36321460b50c3f3d3ef..fd76360663de51fdecd57d759f7d2bab19a091fc 100644 +index ba53ff20a7b3da331af3f3e4a8a30a02e668b16f..067609560166feb87b19d0e95f5628dc123cb4f9 100644 --- a/chrome/browser/ui/tab_helpers.cc +++ b/chrome/browser/ui/tab_helpers.cc -@@ -828,4 +828,5 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) { +@@ -817,4 +817,5 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) { // This is common code for all of us. PLEASE DO YOUR PART to keep it tidy and // organized. diff --git a/patches/chrome-browser-ui-tabs-recent_tabs_sub_menu_model.cc.patch b/patches/chrome-browser-ui-tabs-recent_tabs_sub_menu_model.cc.patch index 4423a1629946..4a747a8ddfb9 100644 --- a/patches/chrome-browser-ui-tabs-recent_tabs_sub_menu_model.cc.patch +++ b/patches/chrome-browser-ui-tabs-recent_tabs_sub_menu_model.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/ui/tabs/recent_tabs_sub_menu_model.cc b/chrome/browser/ui/tabs/recent_tabs_sub_menu_model.cc -index f31ce671fe77c84a1469e49355dccca377052bae..a951b599bd49187abd61945e3fd46a8c2761d321 100644 +index 159fdebfb81c3ff0f1b2714a700184ebd6f8db8c..738871b2d6457440fb7e95fa95ebcd55a737a118 100644 --- a/chrome/browser/ui/tabs/recent_tabs_sub_menu_model.cc +++ b/chrome/browser/ui/tabs/recent_tabs_sub_menu_model.cc -@@ -444,6 +444,7 @@ void RecentTabsSubMenuModel::BuildTabsFromOtherDevices() { +@@ -457,6 +457,7 @@ void RecentTabsSubMenuModel::BuildTabsFromOtherDevices() { DCHECK(!session->GetSessionName().empty()); std::unique_ptr device_menu_model = CreateOtherDeviceSubMenu(session, tabs_in_session); diff --git a/patches/chrome-browser-ui-tabs-recent_tabs_sub_menu_model_unittest.cc.patch b/patches/chrome-browser-ui-tabs-recent_tabs_sub_menu_model_unittest.cc.patch index 4c5aab57202b..f4153d0e0560 100644 --- a/patches/chrome-browser-ui-tabs-recent_tabs_sub_menu_model_unittest.cc.patch +++ b/patches/chrome-browser-ui-tabs-recent_tabs_sub_menu_model_unittest.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/ui/tabs/recent_tabs_sub_menu_model_unittest.cc b/chrome/browser/ui/tabs/recent_tabs_sub_menu_model_unittest.cc -index 55d69de6c8d27300153648467393f56741f0525b..e89b4f62929cf848e005641b447560f61e5896ac 100644 +index d0ac4166816514cf713d129581135fb8871e63f8..939103710846a867166193b3017359cb66e00c3a 100644 --- a/chrome/browser/ui/tabs/recent_tabs_sub_menu_model_unittest.cc +++ b/chrome/browser/ui/tabs/recent_tabs_sub_menu_model_unittest.cc -@@ -164,6 +164,7 @@ class RecentTabsSubMenuModelTest : public BrowserWithTestWindowTest { +@@ -165,6 +165,7 @@ class RecentTabsSubMenuModelTest : public BrowserWithTestWindowTest { helper->VerifyExport(session_sync_service_->GetOpenTabsUIDelegate()); } diff --git a/patches/chrome-browser-ui-tabs-tab_strip_model.h.patch b/patches/chrome-browser-ui-tabs-tab_strip_model.h.patch index c91e74de2b93..86accd82ca48 100644 --- a/patches/chrome-browser-ui-tabs-tab_strip_model.h.patch +++ b/patches/chrome-browser-ui-tabs-tab_strip_model.h.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/ui/tabs/tab_strip_model.h b/chrome/browser/ui/tabs/tab_strip_model.h -index 4d900c4a7f58c8ed0e68e4f890b2f79484ad89dc..0d2f081f130a7c7f33db2a0f020d28afff8c683d 100644 +index e96ec5acc5b037f62c47923433516e0d0f0090c5..e463c7d88deb59b35a25e71a365971c79939813e 100644 --- a/chrome/browser/ui/tabs/tab_strip_model.h +++ b/chrome/browser/ui/tabs/tab_strip_model.h -@@ -660,6 +660,7 @@ class TabStripModel : public TabGroupController { +@@ -664,6 +664,7 @@ class TabStripModel : public TabGroupController { tabs::TabModel* GetTabForWebContents( const content::WebContents* contents) const; diff --git a/patches/chrome-browser-ui-views-bookmarks-bookmark_bar_view.cc.patch b/patches/chrome-browser-ui-views-bookmarks-bookmark_bar_view.cc.patch index b6c9b1f5516a..dff4945c734a 100644 --- a/patches/chrome-browser-ui-views-bookmarks-bookmark_bar_view.cc.patch +++ b/patches/chrome-browser-ui-views-bookmarks-bookmark_bar_view.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc -index 9cecb25b41d3b6ac27c11f3c76d655b40c513a57..adcbad9b2896f5b1374003417b17ac382dc82a33 100644 +index 9c78d998670c598acfc6a92eeed30159609f851d..1fafe9e07820c3d1a4f757b686b4f494800cf6dc 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc -@@ -881,6 +881,7 @@ void BookmarkBarView::Layout(PassKey) { +@@ -885,6 +885,7 @@ void BookmarkBarView::Layout(PassKey) { x = next_x; } } diff --git a/patches/chrome-browser-ui-views-bubble-webui_bubble_manager.h.patch b/patches/chrome-browser-ui-views-bubble-webui_bubble_manager.h.patch index 5f204260fc94..8556d2313b6c 100644 --- a/patches/chrome-browser-ui-views-bubble-webui_bubble_manager.h.patch +++ b/patches/chrome-browser-ui-views-bubble-webui_bubble_manager.h.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/ui/views/bubble/webui_bubble_manager.h b/chrome/browser/ui/views/bubble/webui_bubble_manager.h -index f62127ba47a2c4e0e1533d11cae9967aee769258..f2c8cf309f491898f340d8f1c1c87b973316375a 100644 +index edd7d37a12e182cc663db4e565b8a9edb12e0c70..e90187359fc82f33135212fb627ac07d495076d0 100644 --- a/chrome/browser/ui/views/bubble/webui_bubble_manager.h +++ b/chrome/browser/ui/views/bubble/webui_bubble_manager.h -@@ -162,10 +162,12 @@ class WebUIBubbleManagerImpl : public WebUIBubbleManager { +@@ -165,9 +165,11 @@ class WebUIBubbleManagerImpl : public WebUIBubbleManager { private: // WebUIBubbleManager: @@ -10,7 +10,6 @@ index f62127ba47a2c4e0e1533d11cae9967aee769258..f2c8cf309f491898f340d8f1c1c87b97 base::WeakPtr CreateWebUIBubbleDialog( const std::optional& anchor, views::BubbleBorder::Arrow arrow) override; - WebUIContentsWrapper* GetContentsWrapper() override; + private: const raw_ptr anchor_view_; diff --git a/patches/chrome-browser-ui-views-download-download_item_view.h.patch b/patches/chrome-browser-ui-views-download-download_item_view.h.patch index 60e5e29a4831..5e1b8d19aeae 100644 --- a/patches/chrome-browser-ui-views-download-download_item_view.h.patch +++ b/patches/chrome-browser-ui-views-download-download_item_view.h.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/ui/views/download/download_item_view.h b/chrome/browser/ui/views/download/download_item_view.h -index 08f43b0b4dfd09d7bb36f4f210237ec0e9b2e3a8..14da201eccc29eb9437143664bb3212bbc4b0135 100644 +index f51b353c280195b0000a7e5e62c1d14822e18f58..9aebbce4abd7dc18b6f195ff015ed4c7e7b215de 100644 --- a/chrome/browser/ui/views/download/download_item_view.h +++ b/chrome/browser/ui/views/download/download_item_view.h -@@ -114,6 +114,7 @@ class DownloadItemView : public views::View, +@@ -116,6 +116,7 @@ class DownloadItemView : public views::View, void OnPaintBackground(gfx::Canvas* canvas) override; void OnPaint(gfx::Canvas* canvas) override; void OnThemeChanged() override; diff --git a/patches/chrome-browser-ui-views-extensions-extensions_menu_main_page_view.cc.patch b/patches/chrome-browser-ui-views-extensions-extensions_menu_main_page_view.cc.patch index e60b56768dd1..8d6358ef1bb6 100644 --- a/patches/chrome-browser-ui-views-extensions-extensions_menu_main_page_view.cc.patch +++ b/patches/chrome-browser-ui-views-extensions-extensions_menu_main_page_view.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/ui/views/extensions/extensions_menu_main_page_view.cc b/chrome/browser/ui/views/extensions/extensions_menu_main_page_view.cc -index 9a08b9d0a91bc624c3a7736e80d2016aa70faf30..e8f0bdb434e5cf8f1e8ee11322e244be95bcdab7 100644 +index a712c346c09d89eae273521e196c02c26dd6f4e5..431b98a50a8c7a3432355190ff59ddf2067ce620 100644 --- a/chrome/browser/ui/views/extensions/extensions_menu_main_page_view.cc +++ b/chrome/browser/ui/views/extensions/extensions_menu_main_page_view.cc -@@ -718,6 +718,7 @@ void ExtensionsMenuMainPageView::CreateAndInsertMenuItem( +@@ -349,6 +349,7 @@ void ExtensionsMenuMainPageView::CreateAndInsertMenuItem( ExtensionMenuItemView::SitePermissionsButtonAccess site_permissions_button_access, int index) { diff --git a/patches/chrome-browser-ui-views-extensions-extensions_menu_view_controller.cc.patch b/patches/chrome-browser-ui-views-extensions-extensions_menu_view_controller.cc.patch index 9ddbe0baac54..b2f829e06699 100644 --- a/patches/chrome-browser-ui-views-extensions-extensions_menu_view_controller.cc.patch +++ b/patches/chrome-browser-ui-views-extensions-extensions_menu_view_controller.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/ui/views/extensions/extensions_menu_view_controller.cc b/chrome/browser/ui/views/extensions/extensions_menu_view_controller.cc -index 978d23e01af7e16c3b35c6d6fc80ff7d7dfe84cb..daa9730713794591f01b36e16331ad1044d1acd5 100644 +index baf8fae25e4a1c430243559bb4f7ffbf90a583c3..c9df95d849c5259d5f6ad6049deccb43aff4ffeb 100644 --- a/chrome/browser/ui/views/extensions/extensions_menu_view_controller.cc +++ b/chrome/browser/ui/views/extensions/extensions_menu_view_controller.cc -@@ -337,6 +337,7 @@ ExtensionsMenuViewController::~ExtensionsMenuViewController() { +@@ -321,6 +321,7 @@ ExtensionsMenuViewController::~ExtensionsMenuViewController() { } void ExtensionsMenuViewController::OpenMainPage() { diff --git a/patches/chrome-browser-ui-views-frame-browser_view_layout.cc.patch b/patches/chrome-browser-ui-views-frame-browser_view_layout.cc.patch index 2e5c90097ee7..57a07efe7b87 100644 --- a/patches/chrome-browser-ui-views-frame-browser_view_layout.cc.patch +++ b/patches/chrome-browser-ui-views-frame-browser_view_layout.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/ui/views/frame/browser_view_layout.cc b/chrome/browser/ui/views/frame/browser_view_layout.cc -index cb14b46b727ca9c17e92bf490f06306c6130f327..57ee62350e263b7048eea981245749562d1365de 100644 +index 148c255ec04d34931539d056862f18372bbbe884..804b90205b1514e5873e554752bc39a89a5219c6 100644 --- a/chrome/browser/ui/views/frame/browser_view_layout.cc +++ b/chrome/browser/ui/views/frame/browser_view_layout.cc @@ -73,6 +73,7 @@ bool ConvertedHitTest(views::View* src, views::View* dst, gfx::Point* point) { diff --git a/patches/chrome-browser-ui-views-location_bar-icon_label_bubble_view.cc.patch b/patches/chrome-browser-ui-views-location_bar-icon_label_bubble_view.cc.patch index fc42d5daf35e..171c573406c4 100644 --- a/patches/chrome-browser-ui-views-location_bar-icon_label_bubble_view.cc.patch +++ b/patches/chrome-browser-ui-views-location_bar-icon_label_bubble_view.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc -index 8b844ed64ea5987ba9cc9997ac61b03e424cf9e2..8f47204f93f0dc73ec311df0d0aa248047ab5190 100644 +index 7f5f4e1d8788a72ae26af65b4704925a37594e49..93880c37df8c21809056fc3155efb534108f66d3 100644 --- a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc +++ b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc @@ -730,6 +730,7 @@ SkPath IconLabelBubbleView::GetHighlightPath() const { diff --git a/patches/chrome-browser-ui-views-location_bar-location_bar_view.cc.patch b/patches/chrome-browser-ui-views-location_bar-location_bar_view.cc.patch index cd4ad1b404f9..4f26b9d2cf43 100644 --- a/patches/chrome-browser-ui-views-location_bar-location_bar_view.cc.patch +++ b/patches/chrome-browser-ui-views-location_bar-location_bar_view.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc -index eca41f6f37b37fbec30c8d13a0c45c2f3fe44b8a..b690d15aaf13baf8232e121f9ad83e2c044576f1 100644 +index 1ba06a586f8065a371def2dde7770643fe461525..6ed91f781934e296388cc7a615232af7a4835d9e 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc -@@ -715,6 +715,7 @@ void LocationBarView::Layout(PassKey) { +@@ -716,6 +716,7 @@ void LocationBarView::Layout(PassKey) { // Indentation add padding when the permission chip is visible and replacing // the LHS icon. int text_overriding_permission_chip_indent = 0; @@ -10,7 +10,7 @@ index eca41f6f37b37fbec30c8d13a0c45c2f3fe44b8a..b690d15aaf13baf8232e121f9ad83e2c if (should_indent) { icon_left += icon_indent; text_left += text_indent; -@@ -778,6 +779,7 @@ void LocationBarView::Layout(PassKey) { +@@ -779,6 +780,7 @@ void LocationBarView::Layout(PassKey) { } selected_keyword_view_->SetCustomImage(image); } @@ -18,7 +18,7 @@ index eca41f6f37b37fbec30c8d13a0c45c2f3fe44b8a..b690d15aaf13baf8232e121f9ad83e2c } else if (location_icon_view_->GetShowText() && !ShouldChipOverrideLocationIcon()) { location_icon_view_->SetVisible(true); -@@ -802,6 +804,7 @@ void LocationBarView::Layout(PassKey) { +@@ -803,6 +805,7 @@ void LocationBarView::Layout(PassKey) { } }; @@ -26,7 +26,7 @@ index eca41f6f37b37fbec30c8d13a0c45c2f3fe44b8a..b690d15aaf13baf8232e121f9ad83e2c add_trailing_decoration(page_action_icon_container_, /*intra_item_padding=*/0); for (ContentSettingImageView* view : base::Reversed(content_setting_views_)) { -@@ -815,6 +818,7 @@ void LocationBarView::Layout(PassKey) { +@@ -816,6 +819,7 @@ void LocationBarView::Layout(PassKey) { } add_trailing_decoration(clear_all_button_, /*intra_item_padding=*/0); diff --git a/patches/chrome-browser-ui-views-location_bar-location_bar_view.h.patch b/patches/chrome-browser-ui-views-location_bar-location_bar_view.h.patch index 71a3f1c4b908..3fcbcae391d9 100644 --- a/patches/chrome-browser-ui-views-location_bar-location_bar_view.h.patch +++ b/patches/chrome-browser-ui-views-location_bar-location_bar_view.h.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.h b/chrome/browser/ui/views/location_bar/location_bar_view.h -index f0ca899760273f2472c682a2cb70eb2e0f1b0fbe..b15b687795ed896787b32e73e66f0747cf1956fe 100644 +index 0a64fe705c157022c724a6726ca31d396287693b..1393292bedd15074b5c6f986a1eab5f33aca8a95 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.h +++ b/chrome/browser/ui/views/location_bar/location_bar_view.h -@@ -121,6 +121,7 @@ class LocationBarView +@@ -122,6 +122,7 @@ class LocationBarView int GetBorderRadius() const; // Initializes the LocationBarView. @@ -10,7 +10,7 @@ index f0ca899760273f2472c682a2cb70eb2e0f1b0fbe..b15b687795ed896787b32e73e66f0747 void Init(); // True if this instance has been initialized by calling Init, which can only -@@ -178,6 +179,7 @@ class LocationBarView +@@ -179,6 +180,7 @@ class LocationBarView // Updates the controller, and, if |contents| is non-null, restores saved // state that the tab holds. @@ -18,7 +18,7 @@ index f0ca899760273f2472c682a2cb70eb2e0f1b0fbe..b15b687795ed896787b32e73e66f0747 void Update(content::WebContents* contents); // Clears the location bar's state for |contents|. -@@ -269,6 +271,7 @@ class LocationBarView +@@ -270,6 +272,7 @@ class LocationBarView GetContentSettingViewsForTest() { return content_setting_views_; } diff --git a/patches/chrome-browser-ui-views-overlay-video_overlay_window_views.cc.patch b/patches/chrome-browser-ui-views-overlay-video_overlay_window_views.cc.patch index 7a2f0d36f1e3..23df36ea6b1b 100644 --- a/patches/chrome-browser-ui-views-overlay-video_overlay_window_views.cc.patch +++ b/patches/chrome-browser-ui-views-overlay-video_overlay_window_views.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc -index 75302c9d601d6192f9a6ea5f7cfc0d5707c7f69f..580f03a9ce94896551560a90977919d29350f8a0 100644 +index 68b5bc575c6c1458d2c3351407f73a8a26f13cb2..f78a716c674bb4dbc7d96c8ae291cd6dd3af1876 100644 --- a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc +++ b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc @@ -289,7 +289,7 @@ std::unique_ptr VideoOverlayWindowViews::Create( diff --git a/patches/chrome-browser-ui-views-page_info-page_info_view_factory.cc.patch b/patches/chrome-browser-ui-views-page_info-page_info_view_factory.cc.patch index e23485e6b61d..71ac5ed5bc4b 100644 --- a/patches/chrome-browser-ui-views-page_info-page_info_view_factory.cc.patch +++ b/patches/chrome-browser-ui-views-page_info-page_info_view_factory.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/ui/views/page_info/page_info_view_factory.cc b/chrome/browser/ui/views/page_info/page_info_view_factory.cc -index 0a86475f8db193526d28e3af74a66d1fde3ba50f..68df7b2ff789935547eb9b59a444fcb9bca6499e 100644 +index caadba40700342805bfe7204d4b0c12b33d14c9c..f805716bf77182c498bf639ae07a434dad42bf1a 100644 --- a/chrome/browser/ui/views/page_info/page_info_view_factory.cc +++ b/chrome/browser/ui/views/page_info/page_info_view_factory.cc -@@ -448,6 +448,7 @@ const ui::ImageModel PageInfoViewFactory::GetPermissionIcon( +@@ -452,6 +452,7 @@ const ui::ImageModel PageInfoViewFactory::GetPermissionIcon( icon = &gfx::kNoneIcon; switch (info.type) { diff --git a/patches/chrome-browser-ui-views-profiles-avatar_toolbar_button.h.patch b/patches/chrome-browser-ui-views-profiles-avatar_toolbar_button.h.patch index d6b3cc7493aa..b4939f1b6196 100644 --- a/patches/chrome-browser-ui-views-profiles-avatar_toolbar_button.h.patch +++ b/patches/chrome-browser-ui-views-profiles-avatar_toolbar_button.h.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/ui/views/profiles/avatar_toolbar_button.h b/chrome/browser/ui/views/profiles/avatar_toolbar_button.h -index 26c914fcaee4ad496afcdbcdd0425576660c7877..cb2d40ef517c1f2b6b62e7ff20e197f56205b0ca 100644 +index 49df54a9e05165ae32c15cde88f6a8bc988cf28d..1d3fc88dbfbcfa0e9adc903915c127489e19a5ab 100644 --- a/chrome/browser/ui/views/profiles/avatar_toolbar_button.h +++ b/chrome/browser/ui/views/profiles/avatar_toolbar_button.h -@@ -153,6 +153,7 @@ class AvatarToolbarButton : public ToolbarButton { +@@ -144,6 +144,7 @@ class AvatarToolbarButton : public ToolbarButton { CreateScopedZeroDelayOverrideSigninPendingTextForTesting(); private: diff --git a/patches/chrome-browser-ui-views-profiles-profile_menu_view.h.patch b/patches/chrome-browser-ui-views-profiles-profile_menu_view.h.patch index 711e58e4a9b2..8477949c02cf 100644 --- a/patches/chrome-browser-ui-views-profiles-profile_menu_view.h.patch +++ b/patches/chrome-browser-ui-views-profiles-profile_menu_view.h.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/ui/views/profiles/profile_menu_view.h b/chrome/browser/ui/views/profiles/profile_menu_view.h -index ddfc268135aae86428ebf1a73e756fcb8695b76a..52cdeb15550bcd0c659219ce35622bb7e23fa068 100644 +index f037a9b2929b2353eb2035f231131b7a8e2eb054..d43ab1123013980697d46d2ed875f9317703fc60 100644 --- a/chrome/browser/ui/views/profiles/profile_menu_view.h +++ b/chrome/browser/ui/views/profiles/profile_menu_view.h -@@ -50,6 +50,7 @@ class ProfileMenuView : public ProfileMenuViewBase { +@@ -49,6 +49,7 @@ class ProfileMenuView : public ProfileMenuViewBase { gfx::ImageSkia GetSyncIcon() const override; private: diff --git a/patches/chrome-browser-ui-views-profiles-profile_menu_view_base.cc.patch b/patches/chrome-browser-ui-views-profiles-profile_menu_view_base.cc.patch index 85feb9b9b661..d5a15b70370e 100644 --- a/patches/chrome-browser-ui-views-profiles-profile_menu_view_base.cc.patch +++ b/patches/chrome-browser-ui-views-profiles-profile_menu_view_base.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/ui/views/profiles/profile_menu_view_base.cc b/chrome/browser/ui/views/profiles/profile_menu_view_base.cc -index 06d73cdced8d99fe3a174438de737f07a37f4b19..cc51817df5bfe1a1005cefcc6267026250bd9245 100644 +index 6cc1e99acab0447e726e59b64967add58e19c964..589f66d68dab70982219c7293dcef2d7dbdf9bec 100644 --- a/chrome/browser/ui/views/profiles/profile_menu_view_base.cc +++ b/chrome/browser/ui/views/profiles/profile_menu_view_base.cc -@@ -589,6 +589,7 @@ void ProfileMenuViewBase::BuildProfileBackgroundContainer( +@@ -602,6 +602,7 @@ void ProfileMenuViewBase::BuildProfileBackgroundContainer( identity_info_color_callback_ = base::BindRepeating( &ProfileMenuViewBase::BuildIdentityInfoColorCallback, base::Unretained(this)); diff --git a/patches/chrome-browser-ui-views-profiles-profile_menu_view_base.h.patch b/patches/chrome-browser-ui-views-profiles-profile_menu_view_base.h.patch index 373a96ba0722..7d79421ba883 100644 --- a/patches/chrome-browser-ui-views-profiles-profile_menu_view_base.h.patch +++ b/patches/chrome-browser-ui-views-profiles-profile_menu_view_base.h.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/ui/views/profiles/profile_menu_view_base.h b/chrome/browser/ui/views/profiles/profile_menu_view_base.h -index 87c736e3ec18818c53b0d30d6422305529975723..34b9e486e0bb073069c95df813182a0d07930627 100644 +index c277e5f364af7272ff56653c064405eb8552a1cd..2767540f9f15249132771563ebacd364387831f8 100644 --- a/chrome/browser/ui/views/profiles/profile_menu_view_base.h +++ b/chrome/browser/ui/views/profiles/profile_menu_view_base.h -@@ -171,6 +171,7 @@ class ProfileMenuViewBase : public content::WebContentsDelegate, +@@ -192,6 +192,7 @@ class ProfileMenuViewBase : public content::WebContentsDelegate, void set_perform_menu_actions_for_testing(bool perform_menu_actions) { perform_menu_actions_ = perform_menu_actions; } diff --git a/patches/chrome-browser-ui-views-side_panel-side_panel_coordinator.h.patch b/patches/chrome-browser-ui-views-side_panel-side_panel_coordinator.h.patch index 4c747826d150..e61cfdcceca0 100644 --- a/patches/chrome-browser-ui-views-side_panel-side_panel_coordinator.h.patch +++ b/patches/chrome-browser-ui-views-side_panel-side_panel_coordinator.h.patch @@ -1,13 +1,13 @@ diff --git a/chrome/browser/ui/views/side_panel/side_panel_coordinator.h b/chrome/browser/ui/views/side_panel/side_panel_coordinator.h -index 9b41960c2811e32def94cca9eae5c9b60867a4cf..56ea086ab0d3144858ee4199fa24eae2ce50e319 100644 +index fcdb8c76f5b0cefbffe709fd7c4915d4748909e0..a880f3fcd0472ac1f286447341c09b6941557f2a 100644 --- a/chrome/browser/ui/views/side_panel/side_panel_coordinator.h +++ b/chrome/browser/ui/views/side_panel/side_panel_coordinator.h -@@ -55,7 +55,7 @@ class View; +@@ -56,7 +56,7 @@ class View; // registry's active_entry() then global registry's. These values are reset when // the side panel is closed and |last_active_global_entry_id_| is used to // determine what entry is seen when the panel is reopened. --class SidePanelCoordinator final : public SidePanelRegistryObserver, -+class SidePanelCoordinator : public SidePanelRegistryObserver, - public TabStripModelObserver, +-class SidePanelCoordinator final : public TabStripModelObserver, ++class SidePanelCoordinator : public TabStripModelObserver, public views::ViewObserver, public PinnedToolbarActionsModel::Observer, + public SidePanelUI, diff --git a/patches/chrome-browser-ui-views-tabs-tab.cc.patch b/patches/chrome-browser-ui-views-tabs-tab.cc.patch index 2600e2c4c0b7..0c189e81bf43 100644 --- a/patches/chrome-browser-ui-views-tabs-tab.cc.patch +++ b/patches/chrome-browser-ui-views-tabs-tab.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/ui/views/tabs/tab.cc b/chrome/browser/ui/views/tabs/tab.cc -index 30ec5058583eda239a356803dcfddb265263c501..272263582b91d168bb44b6163e6b7b7755b26330 100644 +index e6c3f149b641ee6333c5437a5c35cdc64ab42d5c..665f9e5c1db2d259d15bf3d3c2682b919db8a7c8 100644 --- a/chrome/browser/ui/views/tabs/tab.cc +++ b/chrome/browser/ui/views/tabs/tab.cc -@@ -324,6 +324,7 @@ void Tab::Layout(PassKey) { +@@ -326,6 +326,7 @@ void Tab::Layout(PassKey) { // indicator, but visually it will be smaller at kFaviconSize wide. gfx::Rect favicon_bounds(start, contents_rect.y(), 0, 0); if (showing_icon_) { @@ -10,7 +10,7 @@ index 30ec5058583eda239a356803dcfddb265263c501..272263582b91d168bb44b6163e6b7b77 if (center_icon_) { // When centering the favicon, the favicon is allowed to escape the normal // contents rect. -@@ -423,6 +424,7 @@ void Tab::Layout(PassKey) { +@@ -425,6 +426,7 @@ void Tab::Layout(PassKey) { int title_right = contents_rect.right(); if (showing_alert_indicator_) { title_right = alert_indicator_button_->x() - after_title_padding; @@ -18,7 +18,7 @@ index 30ec5058583eda239a356803dcfddb265263c501..272263582b91d168bb44b6163e6b7b77 } else if (showing_close_button_) { // Allow the title to overlay the close button's empty border padding. title_right = close_x - after_title_padding; -@@ -1105,6 +1107,7 @@ void Tab::UpdateIconVisibility() { +@@ -1143,6 +1145,7 @@ void Tab::UpdateIconVisibility() { !controller_->IsLockedForOnTask() && #endif large_enough_for_close_button; diff --git a/patches/chrome-browser-ui-views-tabs-tab_group_views.cc.patch b/patches/chrome-browser-ui-views-tabs-tab_group_views.cc.patch index c6f08d39a732..22089e185e8b 100644 --- a/patches/chrome-browser-ui-views-tabs-tab_group_views.cc.patch +++ b/patches/chrome-browser-ui-views-tabs-tab_group_views.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/ui/views/tabs/tab_group_views.cc b/chrome/browser/ui/views/tabs/tab_group_views.cc -index a1a63e801871c7e5d22762278bf562d20711b8cb..e17fa9419b8f28dd519a44c2fdb4dcf6c4719355 100644 +index b5b49abff4d9ac680586d48cd7ebfc13bf36e687..2f5d84956e7c3a7aa15761f5207b10895ea0b1de 100644 --- a/chrome/browser/ui/views/tabs/tab_group_views.cc +++ b/chrome/browser/ui/views/tabs/tab_group_views.cc -@@ -164,6 +164,7 @@ TabGroupViews::GetLeadingTrailingGroupViews( +@@ -166,6 +166,7 @@ TabGroupViews::GetLeadingTrailingGroupViews( views::View* trailing_child = nullptr; gfx::Rect trailing_child_widget_bounds; diff --git a/patches/chrome-browser-ui-views-tabs-tab_strip.cc.patch b/patches/chrome-browser-ui-views-tabs-tab_strip.cc.patch index 75b428114c68..ec18f46a96b0 100644 --- a/patches/chrome-browser-ui-views-tabs-tab_strip.cc.patch +++ b/patches/chrome-browser-ui-views-tabs-tab_strip.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc -index e3571bf5261a2fb413ee29db412776792c0a5a28..c203bacce67a47bf22568e807ef2383061258751 100644 +index 756706214a2b7ce0758b5e5420966c4d70a1fa3e..7b5436912dbe4d7277420e33a4a1d6285f1a6940 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.cc +++ b/chrome/browser/ui/views/tabs/tab_strip.cc -@@ -546,6 +546,7 @@ class TabStrip::TabDragContextImpl : public TabDragContext, +@@ -547,6 +547,7 @@ class TabStrip::TabDragContextImpl : public TabDragContext, std::vector CalculateBoundsForDraggedViews( const std::vector>& views) override { @@ -10,7 +10,7 @@ index e3571bf5261a2fb413ee29db412776792c0a5a28..c203bacce67a47bf22568e807ef23830 CHECK(!views.empty(), base::NotFatalUntil::M128) << "The views vector must not be empty."; -@@ -749,6 +750,7 @@ class TabStrip::TabDragContextImpl : public TabDragContext, +@@ -750,6 +751,7 @@ class TabStrip::TabDragContextImpl : public TabDragContext, // index. std::stable_sort(orderable_children.begin(), orderable_children.end()); @@ -18,7 +18,7 @@ index e3571bf5261a2fb413ee29db412776792c0a5a28..c203bacce67a47bf22568e807ef23830 for (const ZOrderableTabContainerElement& child : orderable_children) { child.view()->Paint(paint_info); } -@@ -842,6 +844,7 @@ class TabStrip::TabDragContextImpl : public TabDragContext, +@@ -843,6 +845,7 @@ class TabStrip::TabDragContextImpl : public TabDragContext, continue; } diff --git a/patches/chrome-browser-ui-views-toolbar-app_menu.h.patch b/patches/chrome-browser-ui-views-toolbar-app_menu.h.patch index 7588d1244837..c4e5a46b8844 100644 --- a/patches/chrome-browser-ui-views-toolbar-app_menu.h.patch +++ b/patches/chrome-browser-ui-views-toolbar-app_menu.h.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/ui/views/toolbar/app_menu.h b/chrome/browser/ui/views/toolbar/app_menu.h -index a1492f99d0e440387cc7da51314addec9af81ba0..663bd4068ae94bef593380b0ce069c04db53ddac 100644 +index d1a934b2804fee3bcd3850deb441e0f7314530f7..af9c5e1cad219d2991a94fa8818576220d09847a 100644 --- a/chrome/browser/ui/views/toolbar/app_menu.h +++ b/chrome/browser/ui/views/toolbar/app_menu.h -@@ -31,7 +31,7 @@ class MenuRunner; +@@ -32,7 +32,7 @@ class MenuRunner; } // AppMenu adapts the AppMenuModel to view's menu related classes. diff --git a/patches/chrome-browser-ui-views-toolbar-toolbar_view.cc.patch b/patches/chrome-browser-ui-views-toolbar-toolbar_view.cc.patch index 68e556ab9cfd..d8b509437e8b 100644 --- a/patches/chrome-browser-ui-views-toolbar-toolbar_view.cc.patch +++ b/patches/chrome-browser-ui-views-toolbar-toolbar_view.cc.patch @@ -1,10 +1,10 @@ diff --git a/chrome/browser/ui/views/toolbar/toolbar_view.cc b/chrome/browser/ui/views/toolbar/toolbar_view.cc -index 577215577d9acfd8c55f4bbf1b32c7d82640cbbe..12627d12001018c0988c644a3386fd0284713892 100644 +index 1b494d20b63426bcad0fb488740a9bf9a10b3aaf..cf706cf12889d7f6417d67a5ac6781bd3cf7ef88 100644 --- a/chrome/browser/ui/views/toolbar/toolbar_view.cc +++ b/chrome/browser/ui/views/toolbar/toolbar_view.cc -@@ -475,6 +475,7 @@ void ToolbarView::Init() { - browser_view_, browser_->profile())); - #endif +@@ -471,6 +471,7 @@ void ToolbarView::Init() { + send_tab_to_self_button_ = + container_view_->AddChildView(std::move(send_tab_to_self_button)); + BRAVE_TOOLBAR_VIEW_INIT avatar_ = container_view_->AddChildView( diff --git a/patches/chrome-browser-ui-webui-BUILD.gn.patch b/patches/chrome-browser-ui-webui-BUILD.gn.patch index 0264118038ac..8e5d127dcc5f 100644 --- a/patches/chrome-browser-ui-webui-BUILD.gn.patch +++ b/patches/chrome-browser-ui-webui-BUILD.gn.patch @@ -1,10 +1,10 @@ diff --git a/chrome/browser/ui/webui/BUILD.gn b/chrome/browser/ui/webui/BUILD.gn -index a1640e5355f65860ea36178ea8fa863abac3c5bf..eef0bc286afc17c172110c4166267210b863eb3b 100644 +index 7d32cdea5784c54c0686f7f1d69cb0c5fa728736..6f908d63475514a5baf46040145ac0f9a3d302cb 100644 --- a/chrome/browser/ui/webui/BUILD.gn +++ b/chrome/browser/ui/webui/BUILD.gn -@@ -51,6 +51,7 @@ source_set("configs") { - if (is_chromeos_ash) { - deps += [ "//chrome/browser/ui/webui/ash/config" ] +@@ -55,6 +55,7 @@ source_set("configs") { + "//chromeos/constants", + ] } + import("//brave/browser/ui/webui/sources.gni") deps += brave_browser_ui_webui_configs_deps } diff --git a/patches/chrome-browser-ui-webui-chrome_web_ui_controller_factory.cc.patch b/patches/chrome-browser-ui-webui-chrome_web_ui_controller_factory.cc.patch index 9edfe5798c74..42cec1953158 100644 --- a/patches/chrome-browser-ui-webui-chrome_web_ui_controller_factory.cc.patch +++ b/patches/chrome-browser-ui-webui-chrome_web_ui_controller_factory.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc -index 743fd86a35a106d98c8553e20a63e20127bc3f98..c4796015433ec5886a7bd2ac243a4e3a4bb3c12c 100644 +index 279f73938d40617d2e2a3cef4ee4a4733ca5f051..de3443314cc92e73aa3e1f53fc9c3b45efe93c48 100644 --- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc +++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc -@@ -789,6 +789,7 @@ void ChromeWebUIControllerFactory::GetFaviconForURL( +@@ -400,6 +400,7 @@ void ChromeWebUIControllerFactory::GetFaviconForURL( // static ChromeWebUIControllerFactory* ChromeWebUIControllerFactory::GetInstance() { diff --git a/patches/chrome-browser-ui-webui-history-history_ui.cc.patch b/patches/chrome-browser-ui-webui-history-history_ui.cc.patch index b5bb889fe6fc..369469e492e1 100644 --- a/patches/chrome-browser-ui-webui-history-history_ui.cc.patch +++ b/patches/chrome-browser-ui-webui-history-history_ui.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/ui/webui/history/history_ui.cc b/chrome/browser/ui/webui/history/history_ui.cc -index 03498e5e09b90e8848d1c59e55a4de040d26946e..79233a3c96432601e822fe903fb8a2ab365379e7 100644 +index 0dfc36945e1c2da433d47c794b00131650337b93..0a4939829469111fc8f17bc83d7edf373a99643a 100644 --- a/chrome/browser/ui/webui/history/history_ui.cc +++ b/chrome/browser/ui/webui/history/history_ui.cc @@ -90,6 +90,7 @@ content::WebUIDataSource* CreateAndAddHistoryUIHTMLSource(Profile* profile) { diff --git a/patches/chrome-browser-ui-webui-settings-settings_localized_strings_provider.cc.patch b/patches/chrome-browser-ui-webui-settings-settings_localized_strings_provider.cc.patch index 736dbf7cdff1..de276bd4ac7c 100644 --- a/patches/chrome-browser-ui-webui-settings-settings_localized_strings_provider.cc.patch +++ b/patches/chrome-browser-ui-webui-settings-settings_localized_strings_provider.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc -index f55f05b9b7db0d30260b718111ed9e7bf6699896..4a7575015950cadb6ca8d2f1b41693161931b3b0 100644 +index 6fa32e39c7e1e0060f6f2614933fa9179c147875..21f02201f5d494862eceb1b72229c1f6893b6488 100644 --- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc +++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc -@@ -3683,6 +3683,7 @@ void AddLocalizedStrings(content::WebUIDataSource* html_source, +@@ -3778,6 +3778,7 @@ void AddLocalizedStrings(content::WebUIDataSource* html_source, policy_indicator::AddLocalizedStrings(html_source); AddSecurityKeysStrings(html_source); diff --git a/patches/chrome-browser-ui-webui-settings-site_settings_helper.cc.patch b/patches/chrome-browser-ui-webui-settings-site_settings_helper.cc.patch index ce7dde347b88..c75b3c5701ea 100644 --- a/patches/chrome-browser-ui-webui-settings-site_settings_helper.cc.patch +++ b/patches/chrome-browser-ui-webui-settings-site_settings_helper.cc.patch @@ -1,16 +1,16 @@ diff --git a/chrome/browser/ui/webui/settings/site_settings_helper.cc b/chrome/browser/ui/webui/settings/site_settings_helper.cc -index d34354c29d963cded0b9ac480847b00a31391df7..91896187382590c4ae3a69acdf98ffa5d57bd4e3 100644 +index c13e3198bdced21e8b88307ea9d7a07fb1ea9468..b9a260dbe66145c8c440a08bcc71d634ab774068 100644 --- a/chrome/browser/ui/webui/settings/site_settings_helper.cc +++ b/chrome/browser/ui/webui/settings/site_settings_helper.cc -@@ -244,6 +244,7 @@ const ContentSettingsTypeNameEntry kContentSettingsTypeGroupNames[] = { - {ContentSettingsType::TOP_LEVEL_TPCD_ORIGIN_TRIAL, nullptr}, - {ContentSettingsType::DISPLAY_MEDIA_SYSTEM_AUDIO, nullptr}, +@@ -247,6 +247,7 @@ const ContentSettingsTypeNameEntry kContentSettingsTypeGroupNames[] = { {ContentSettingsType::STORAGE_ACCESS_HEADER_ORIGIN_TRIAL, nullptr}, + // TODO(crbug.com/368266658): Implement the UI for Direct Sockets PNA. + {ContentSettingsType::DIRECT_SOCKETS_PRIVATE_NETWORK_ACCESS, nullptr}, + BRAVE_CONTENT_SETTINGS_TYPE_GROUP_NAMES_LIST }; static_assert( -@@ -486,6 +487,7 @@ bool HasRegisteredGroupName(ContentSettingsType type) { +@@ -508,6 +509,7 @@ bool HasRegisteredGroupName(ContentSettingsType type) { } ContentSettingsType ContentSettingsTypeFromGroupName(std::string_view name) { @@ -18,7 +18,7 @@ index d34354c29d963cded0b9ac480847b00a31391df7..91896187382590c4ae3a69acdf98ffa5 for (const auto& entry : kContentSettingsTypeGroupNames) { // Content setting types that aren't represented in the settings UI // will have `nullptr` as their `name`. However, converting `nullptr` -@@ -500,6 +502,7 @@ ContentSettingsType ContentSettingsTypeFromGroupName(std::string_view name) { +@@ -522,6 +524,7 @@ ContentSettingsType ContentSettingsTypeFromGroupName(std::string_view name) { } std::string_view ContentSettingsTypeToGroupName(ContentSettingsType type) { @@ -26,7 +26,7 @@ index d34354c29d963cded0b9ac480847b00a31391df7..91896187382590c4ae3a69acdf98ffa5 for (const auto& entry : kContentSettingsTypeGroupNames) { if (type == entry.type) { // Content setting types that aren't represented in the settings UI -@@ -679,6 +682,7 @@ std::string SiteSettingSourceToString(const SiteSettingSource source) { +@@ -697,6 +700,7 @@ std::string SiteSettingSourceToString(const SiteSettingSource source) { SiteSettingSource ProviderTypeToSiteSettingsSource( const ProviderType provider_type) { switch (provider_type) { @@ -34,7 +34,7 @@ index d34354c29d963cded0b9ac480847b00a31391df7..91896187382590c4ae3a69acdf98ffa5 case ProviderType::kWebuiAllowlistProvider: return SiteSettingSource::kAllowlist; case ProviderType::kPolicyProvider: -@@ -705,6 +709,7 @@ SiteSettingSource ProviderTypeToSiteSettingsSource( +@@ -723,6 +727,7 @@ SiteSettingSource ProviderTypeToSiteSettingsSource( std::string ProviderToDefaultSettingSourceString(const ProviderType provider) { switch (provider) { diff --git a/patches/chrome-chrome_repack_locales.gni.patch b/patches/chrome-chrome_repack_locales.gni.patch index af9b1c06f721..f3200f4d332a 100644 --- a/patches/chrome-chrome_repack_locales.gni.patch +++ b/patches/chrome-chrome_repack_locales.gni.patch @@ -1,8 +1,8 @@ diff --git a/chrome/chrome_repack_locales.gni b/chrome/chrome_repack_locales.gni -index e8f61e2fbf6f21602e31d76c99ea544bed9c188d..d514da4ac6700cda6c0aa798102217f5ab11b4d2 100644 +index 0ec0aa2c8efb359f2f59e0316524d751381860e6..6b6a9252f693d34465bb5b8a0fbaab153f1c1560 100644 --- a/chrome/chrome_repack_locales.gni +++ b/chrome/chrome_repack_locales.gni -@@ -41,6 +41,7 @@ template("chrome_repack_locales") { +@@ -43,6 +43,7 @@ template("chrome_repack_locales") { "${root_gen_dir}/ui/strings/ax_strings_", "${root_gen_dir}/ui/strings/ui_strings_", ] @@ -10,7 +10,7 @@ index e8f61e2fbf6f21602e31d76c99ea544bed9c188d..d514da4ac6700cda6c0aa798102217f5 if (!defined(deps)) { deps = [] } -@@ -64,6 +65,7 @@ template("chrome_repack_locales") { +@@ -68,6 +69,7 @@ template("chrome_repack_locales") { "//ui/strings:ax_strings", "//ui/strings:ui_strings", ] diff --git a/patches/chrome-common-BUILD.gn.patch b/patches/chrome-common-BUILD.gn.patch index 53dcc8c90a9e..76019c33a461 100644 --- a/patches/chrome-common-BUILD.gn.patch +++ b/patches/chrome-common-BUILD.gn.patch @@ -1,5 +1,5 @@ diff --git a/chrome/common/BUILD.gn b/chrome/common/BUILD.gn -index 830aa518d192fb9bc365f207cdd1f0e6c659fe56..20593b66255884482ea9f43c6bab1a5787fe52a4 100644 +index cc7055dc2be0258f80e04e17d57a543d9fddc6c8..d8791adeac60e734ad8ddbe2dcb6b1b62d6e3704 100644 --- a/chrome/common/BUILD.gn +++ b/chrome/common/BUILD.gn @@ -100,6 +100,7 @@ source_set("channel_info") { @@ -10,7 +10,7 @@ index 830aa518d192fb9bc365f207cdd1f0e6c659fe56..20593b66255884482ea9f43c6bab1a57 } source_set("ini_parser") { -@@ -284,6 +285,7 @@ static_library("common_lib") { +@@ -285,6 +286,7 @@ static_library("common_lib") { if (enable_ppapi) { public_deps += [ "//ppapi/shared_impl" ] } @@ -18,7 +18,7 @@ index 830aa518d192fb9bc365f207cdd1f0e6c659fe56..20593b66255884482ea9f43c6bab1a57 if (enable_extensions_core) { public_deps += [ -@@ -497,6 +499,7 @@ static_library("non_code_constants") { +@@ -498,6 +500,7 @@ static_library("non_code_constants") { if (is_win) { sources += [ "chrome_icon_resources_win.h" ] } diff --git a/patches/chrome-elevation_service-BUILD.gn.patch b/patches/chrome-elevation_service-BUILD.gn.patch index 94d50de6d920..4c006ee2affa 100644 --- a/patches/chrome-elevation_service-BUILD.gn.patch +++ b/patches/chrome-elevation_service-BUILD.gn.patch @@ -1,5 +1,5 @@ diff --git a/chrome/elevation_service/BUILD.gn b/chrome/elevation_service/BUILD.gn -index 88ed423e737ea90ba93f97da86ec6b55552bf52e..16222646243e034810a17f83faa158bd7602e92f 100644 +index 08529515b191778bfd7aefe14f6f3f1ac7d7816f..9d2158b9eda3d1455fd7149681a407ab43d071cc 100644 --- a/chrome/elevation_service/BUILD.gn +++ b/chrome/elevation_service/BUILD.gn @@ -11,6 +11,7 @@ import("//testing/test.gni") @@ -10,11 +10,11 @@ index 88ed423e737ea90ba93f97da86ec6b55552bf52e..16222646243e034810a17f83faa158bd writes_tlb = true } -@@ -105,6 +106,7 @@ source_set("lib") { +@@ -80,6 +81,7 @@ source_set("lib") { "crypt32.lib", "rpcrt4.lib", ] + deps += brave_elevation_service_lib_deps } - process_version_rc_template("version_resources") { + source_set("service_lib") { diff --git a/patches/chrome-enterprise_companion-branding.gni.patch b/patches/chrome-enterprise_companion-branding.gni.patch new file mode 100644 index 000000000000..819e4ae64287 --- /dev/null +++ b/patches/chrome-enterprise_companion-branding.gni.patch @@ -0,0 +1,9 @@ +diff --git a/chrome/enterprise_companion/branding.gni b/chrome/enterprise_companion/branding.gni +index 3e626f26396e1f2bdf68b72b4f5b8563e0650caa..66dcea75529f7f814e840724d30e6e224cbd0d59 100644 +--- a/chrome/enterprise_companion/branding.gni ++++ b/chrome/enterprise_companion/branding.gni +@@ -41,3 +41,4 @@ enterprise_companion_device_management_realtime_reporting_url = + enterprise_companion_device_management_encrypted_reporting_url = + "https://chromereporting-pa.googleapis.com/v1/record" + enterprise_companion_event_logging_url = "https://play.googleapis.com/log" ++import("//brave/chromium_src/chrome/updater/branding.gni") forward_variables_from(brave_updater_branding, "*") diff --git a/patches/chrome-installer-mini_installer-BUILD.gn.patch b/patches/chrome-installer-mini_installer-BUILD.gn.patch index 7b2739000a4f..6ec3a920090e 100644 --- a/patches/chrome-installer-mini_installer-BUILD.gn.patch +++ b/patches/chrome-installer-mini_installer-BUILD.gn.patch @@ -1,5 +1,5 @@ diff --git a/chrome/installer/mini_installer/BUILD.gn b/chrome/installer/mini_installer/BUILD.gn -index 52905752585a955297754821bf07c9e4fc79c79c..a663582adf50a294b55f6fb20ec82a79e601e657 100644 +index c490d199bf51e9bc4919e769488a5f5d57825015..b4867d29548428054e0b4a54de4a6f50dd9c6e0e 100644 --- a/chrome/installer/mini_installer/BUILD.gn +++ b/chrome/installer/mini_installer/BUILD.gn @@ -137,7 +137,7 @@ if (enable_uncompressed_archive) { @@ -11,7 +11,7 @@ index 52905752585a955297754821bf07c9e4fc79c79c..a663582adf50a294b55f6fb20ec82a79 script = "//chrome/tools/build/win/create_installer_archive.py" release_file = "chrome.release" -@@ -312,6 +312,7 @@ template("generate_mini_installer") { +@@ -311,6 +311,7 @@ template("generate_mini_installer") { no_default_deps = true ldflags += [ "/ENTRY:MainEntryPoint" ] } diff --git a/patches/chrome-renderer-BUILD.gn.patch b/patches/chrome-renderer-BUILD.gn.patch index 7a3c670be0d9..1dbde48b08ae 100644 --- a/patches/chrome-renderer-BUILD.gn.patch +++ b/patches/chrome-renderer-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/chrome/renderer/BUILD.gn b/chrome/renderer/BUILD.gn -index 3a4b21b9b90ab77b3a71d2905febac21eb54ecd1..af4afc247006c469fad73942b6ca307bb88e53ab 100644 +index 7184fd42569ec8b0bb90d11d9c73db4ec83ea9b1..ae5051bf5475aa1d53ddda7eabfae7fab999853e 100644 --- a/chrome/renderer/BUILD.gn +++ b/chrome/renderer/BUILD.gn -@@ -242,6 +242,7 @@ static_library("renderer") { +@@ -243,6 +243,7 @@ static_library("renderer") { "//v8", ] diff --git a/patches/chrome-renderer-chrome_content_renderer_client.cc.patch b/patches/chrome-renderer-chrome_content_renderer_client.cc.patch index c5501b9b3621..031198006d99 100644 --- a/patches/chrome-renderer-chrome_content_renderer_client.cc.patch +++ b/patches/chrome-renderer-chrome_content_renderer_client.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc -index ef6547e22245c8b9a5a83f25e2475541c79d1c63..4d39bceb4853a181fae43208f8737daadbe458cc 100644 +index cc8af23c1e29de764433c0b3afc7404545fd9bf7..bf9b1102114af62de0f9d0a0a874b04d5c095f58 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc -@@ -609,7 +609,7 @@ void ChromeContentRendererClient::RenderFrameCreated( +@@ -619,7 +619,7 @@ void ChromeContentRendererClient::RenderFrameCreated( extensions::ExtensionsRendererClient::Get()->dispatcher()); #endif content_settings::ContentSettingsAgentImpl* content_settings = @@ -11,7 +11,7 @@ index ef6547e22245c8b9a5a83f25e2475541c79d1c63..4d39bceb4853a181fae43208f8737daa render_frame, std::move(content_settings_delegate)); if (chrome_observer_.get()) { if (chrome_observer_->content_settings_manager()) { -@@ -792,6 +792,7 @@ void ChromeContentRendererClient::RenderFrameCreated( +@@ -811,6 +811,7 @@ void ChromeContentRendererClient::RenderFrameCreated( } #endif diff --git a/patches/chrome-renderer-chrome_content_renderer_client.h.patch b/patches/chrome-renderer-chrome_content_renderer_client.h.patch index 51a757037945..f2e9e44c1d5f 100644 --- a/patches/chrome-renderer-chrome_content_renderer_client.h.patch +++ b/patches/chrome-renderer-chrome_content_renderer_client.h.patch @@ -1,8 +1,8 @@ diff --git a/chrome/renderer/chrome_content_renderer_client.h b/chrome/renderer/chrome_content_renderer_client.h -index 7401f2aa08d2c0c3bfa8f1160ed2dbf29df26b08..4e3d4c84baf3b4d762c52f42b04cb3ce4ca3a016 100644 +index 7cfba70e165169f88043e740ffeadddb00b8b4e4..2cff6c71874c14fb50cf9e34428c24bb2df1e726 100644 --- a/chrome/renderer/chrome_content_renderer_client.h +++ b/chrome/renderer/chrome_content_renderer_client.h -@@ -257,6 +257,7 @@ class ChromeContentRendererClient +@@ -261,6 +261,7 @@ class ChromeContentRendererClient #endif private: diff --git a/patches/chrome-test-BUILD.gn.patch b/patches/chrome-test-BUILD.gn.patch index b514158d8a09..dc51f0b35b70 100644 --- a/patches/chrome-test-BUILD.gn.patch +++ b/patches/chrome-test-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn -index c53d7af88b3570e6c320b408afa449e51e355b6b..358e646daaf88e3831ff7c201aeba0ae2b94f74f 100644 +index 22324e148ee5a7253b4699c1110e82d3591fcdae..baa4ac76f6f33d712add47d4f9877f4def42baf7 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn -@@ -577,6 +577,7 @@ static_library("test_support") { +@@ -581,6 +581,7 @@ static_library("test_support") { "//ui/gl", ] diff --git a/patches/chrome-test-data-webui-settings-BUILD.gn.patch b/patches/chrome-test-data-webui-settings-BUILD.gn.patch index aae06d22855a..35953e34860a 100644 --- a/patches/chrome-test-data-webui-settings-BUILD.gn.patch +++ b/patches/chrome-test-data-webui-settings-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/chrome/test/data/webui/settings/BUILD.gn b/chrome/test/data/webui/settings/BUILD.gn -index 819191b2d5e09c31c34c1c9d06246b7acc463f1a..ed3dfaa99f9f33ce69551b53b1871d7827f04dcc 100644 +index 811c860f402ce7c420710d720365d8bafdfbd6e4..743824123874bcd8feade22b441dcce2f284086b 100644 --- a/chrome/test/data/webui/settings/BUILD.gn +++ b/chrome/test/data/webui/settings/BUILD.gn -@@ -243,6 +243,7 @@ build_webui_tests("build") { +@@ -247,6 +247,7 @@ build_webui_tests("build") { ts_definitions += [ "//tools/typescript/definitions/quick_unlock_private.d.ts" ] } diff --git a/patches/chrome-tools-build-mac-infoplist_strings_util.cc.patch b/patches/chrome-tools-build-mac-infoplist_strings_util.cc.patch index 73f5b00b79c7..702a726192a8 100644 --- a/patches/chrome-tools-build-mac-infoplist_strings_util.cc.patch +++ b/patches/chrome-tools-build-mac-infoplist_strings_util.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/tools/build/mac/infoplist_strings_util.cc b/chrome/tools/build/mac/infoplist_strings_util.cc -index 6c9f7d018ac441a44083af4b2b15dc639b0c218d..10889f3b73f984231a52d84d615c786126462309 100644 +index 04991a818f583642892e8b1d9172085f014249f2..c26956b80dec625aa792e62ea09a7e677f3ecf7e 100644 --- a/chrome/tools/build/mac/infoplist_strings_util.cc +++ b/chrome/tools/build/mac/infoplist_strings_util.cc @@ -155,6 +155,7 @@ int main(int argc, char* const argv[]) { diff --git a/patches/chrome-utility-BUILD.gn.patch b/patches/chrome-utility-BUILD.gn.patch index fef11768b6b8..2473978e981f 100644 --- a/patches/chrome-utility-BUILD.gn.patch +++ b/patches/chrome-utility-BUILD.gn.patch @@ -1,5 +1,5 @@ diff --git a/chrome/utility/BUILD.gn b/chrome/utility/BUILD.gn -index 54946c415c57c5ba1df3f643e8d79b216ac0d560..4cf3cd5caacbcfa205f88d74e20e628055255a92 100644 +index 830288a4141e3431561f9cc5f3bd5f231c617b1b..75b9befa68414de5e88187f4de401676cc8755ef 100644 --- a/chrome/utility/BUILD.gn +++ b/chrome/utility/BUILD.gn @@ -76,6 +76,8 @@ static_library("utility") { diff --git a/patches/components-browser_ui-settings-android-BUILD.gn.patch b/patches/components-browser_ui-settings-android-BUILD.gn.patch index 9e5b61b9f1bf..a9cbc13b5262 100644 --- a/patches/components-browser_ui-settings-android-BUILD.gn.patch +++ b/patches/components-browser_ui-settings-android-BUILD.gn.patch @@ -1,5 +1,5 @@ diff --git a/components/browser_ui/settings/android/BUILD.gn b/components/browser_ui/settings/android/BUILD.gn -index b6adbb6333f7a8020f45ac196b6e6905d26e113c..6031f81b8bf98b323921a893885b2b67f076c493 100644 +index 8dcf5d842176f359f8ed475b8747dff3b10ad995..b764bc3ad2fd99b1bc36ff0603917c00efd9b53b 100644 --- a/components/browser_ui/settings/android/BUILD.gn +++ b/components/browser_ui/settings/android/BUILD.gn @@ -50,6 +50,7 @@ android_library("java") { diff --git a/patches/components-browser_ui-site_settings-android-java-src-org-chromium-components-browser_ui-site_settings-ChosenObjectSettings.java.patch b/patches/components-browser_ui-site_settings-android-java-src-org-chromium-components-browser_ui-site_settings-ChosenObjectSettings.java.patch index 32b2748eb3db..66cc61fa6afd 100644 --- a/patches/components-browser_ui-site_settings-android-java-src-org-chromium-components-browser_ui-site_settings-ChosenObjectSettings.java.patch +++ b/patches/components-browser_ui-site_settings-android-java-src-org-chromium-components-browser_ui-site_settings-ChosenObjectSettings.java.patch @@ -1,5 +1,5 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/ChosenObjectSettings.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/ChosenObjectSettings.java -index 41138862a1ba3b82b4845374445a3f5c5a3e2781..72b3c012257f1ecb6bf7d30cdfe01462cf19d2a8 100644 +index bb76d688ce04f1109efdadfc7a053def6301c72e..22e2ab4e1183c03bb0899abce396297218a756a7 100644 --- a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/ChosenObjectSettings.java +++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/ChosenObjectSettings.java @@ -158,7 +158,7 @@ public class ChosenObjectSettings extends BaseSiteSettingsFragment diff --git a/patches/components-browser_ui-site_settings-android-java-src-org-chromium-components-browser_ui-site_settings-SingleCategorySettings.java.patch b/patches/components-browser_ui-site_settings-android-java-src-org-chromium-components-browser_ui-site_settings-SingleCategorySettings.java.patch index 283000ba4d2b..ed41d82d0e8c 100644 --- a/patches/components-browser_ui-site_settings-android-java-src-org-chromium-components-browser_ui-site_settings-SingleCategorySettings.java.patch +++ b/patches/components-browser_ui-site_settings-android-java-src-org-chromium-components-browser_ui-site_settings-SingleCategorySettings.java.patch @@ -1,8 +1,8 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SingleCategorySettings.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SingleCategorySettings.java -index f1d9052ab050f798c439df31408019df80457f23..f5d471b2d9ada0597f32d357523170315b4387ad 100644 +index d134fcba93953340b5ed300eaece6a29a16185bc..8b061e3de93b64b1a3b2f8354f1d0fb202a7afa7 100644 --- a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SingleCategorySettings.java +++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SingleCategorySettings.java -@@ -568,7 +568,7 @@ public class SingleCategorySettings extends BaseSiteSettingsFragment +@@ -561,7 +561,7 @@ public class SingleCategorySettings extends BaseSiteSettingsFragment if (queryHasChanged) getInfoForOrigins(); return true; } diff --git a/patches/components-browser_ui-widget-android-java-res-values-dimens.xml.patch b/patches/components-browser_ui-widget-android-java-res-values-dimens.xml.patch index 92eda545808e..b7971c0b71ba 100644 --- a/patches/components-browser_ui-widget-android-java-res-values-dimens.xml.patch +++ b/patches/components-browser_ui-widget-android-java-res-values-dimens.xml.patch @@ -1,5 +1,5 @@ diff --git a/components/browser_ui/widget/android/java/res/values/dimens.xml b/components/browser_ui/widget/android/java/res/values/dimens.xml -index e88cba8613aecff8032f72e9b3cb7ada11501ea0..f01e84f5455bcb2b11b1ae686b9eb5adad107195 100644 +index f137c56a01cdaa6f8a30c662d1e377a859a151a0..bf19766fb4ee37844d5f7a68e46b0e95d4cef5e5 100644 --- a/components/browser_ui/widget/android/java/res/values/dimens.xml +++ b/components/browser_ui/widget/android/java/res/values/dimens.xml @@ -74,7 +74,7 @@ found in the LICENSE file. diff --git a/patches/components-browsing_data-core-BUILD.gn.patch b/patches/components-browsing_data-core-BUILD.gn.patch index f880c0ff797e..04f83cc2934f 100644 --- a/patches/components-browsing_data-core-BUILD.gn.patch +++ b/patches/components-browsing_data-core-BUILD.gn.patch @@ -1,12 +1,12 @@ diff --git a/components/browsing_data/core/BUILD.gn b/components/browsing_data/core/BUILD.gn -index 9ca09f512e151ceea7efd92730d6b74592210afc..c5a96268ac4c463cbdfc18ca1ffe1c54016f467f 100644 +index aed52b1002402a106b8dbc89d2247c29b6316640..b3dc395778cd07ee5994c64cec6337d746e3847b 100644 --- a/components/browsing_data/core/BUILD.gn +++ b/components/browsing_data/core/BUILD.gn -@@ -49,6 +49,7 @@ static_library("core") { +@@ -50,6 +50,7 @@ static_library("core") { ] configs += [ "//build/config/compiler:wexit_time_destructors" ] + import("//brave/components/browsing_data/core/sources.gni") deps += brave_components_browsing_data_core_deps } - if (is_android) { + source_set("cookie_or_cache_deletion_choice") { diff --git a/patches/components-cached_flags-BUILD.gn.patch b/patches/components-cached_flags-BUILD.gn.patch new file mode 100644 index 000000000000..a162bce219e4 --- /dev/null +++ b/patches/components-cached_flags-BUILD.gn.patch @@ -0,0 +1,12 @@ +diff --git a/components/cached_flags/BUILD.gn b/components/cached_flags/BUILD.gn +index 98f420fffe7a88ce93df0193ea567c920cece06a..cea4275e54011f6d46ee195b40503fab79d44e36 100644 +--- a/components/cached_flags/BUILD.gn ++++ b/components/cached_flags/BUILD.gn +@@ -25,6 +25,7 @@ android_library("java") { + "android/java/src/org/chromium/components/cached_flags/IntCachedFieldTrialParameter.java", + "android/java/src/org/chromium/components/cached_flags/StringCachedFieldTrialParameter.java", + ] ++ sources += brave_components_cached_flags_java_sources + } + + robolectric_library("junit") { diff --git a/patches/components-component_updater-component_updater_service.h.patch b/patches/components-component_updater-component_updater_service.h.patch index 51c437cd9215..f37443b9bbcc 100644 --- a/patches/components-component_updater-component_updater_service.h.patch +++ b/patches/components-component_updater-component_updater_service.h.patch @@ -1,5 +1,5 @@ diff --git a/components/component_updater/component_updater_service.h b/components/component_updater/component_updater_service.h -index f71358e75f4ceec422ad67ced65dd6e982d1247b..18dba00532bec1df19ec023977d8e84cd480916f 100644 +index 75882c21b9e46ddb2fbb1814a5edcf40bfd612c6..9a58945dfafb6597f75c5816a2e8822ef676960a 100644 --- a/components/component_updater/component_updater_service.h +++ b/components/component_updater/component_updater_service.h @@ -205,6 +205,7 @@ class ComponentUpdateService { diff --git a/patches/components-content_settings-core-browser-content_settings_policy_provider.cc.patch b/patches/components-content_settings-core-browser-content_settings_policy_provider.cc.patch index c26f00dde1b5..8ffac1ad5880 100644 --- a/patches/components-content_settings-core-browser-content_settings_policy_provider.cc.patch +++ b/patches/components-content_settings-core-browser-content_settings_policy_provider.cc.patch @@ -1,5 +1,5 @@ diff --git a/components/content_settings/core/browser/content_settings_policy_provider.cc b/components/content_settings/core/browser/content_settings_policy_provider.cc -index 4a27147ef8825d436f2dceb9bd813d652b7dec9a..015b80fb4559e89a9d5ecc981a49c82d57165b8f 100644 +index 7639a7c467cf6179f789908afac11666d4bb7497..aba51c27959de6abda684c303ae697fcd47b863a 100644 --- a/components/content_settings/core/browser/content_settings_policy_provider.cc +++ b/components/content_settings/core/browser/content_settings_policy_provider.cc @@ -39,6 +39,7 @@ struct PrefsForManagedContentSettingsMapEntry { @@ -10,7 +10,7 @@ index 4a27147ef8825d436f2dceb9bd813d652b7dec9a..015b80fb4559e89a9d5ecc981a49c82d {prefs::kManagedAutomaticFullscreenAllowedForUrls, ContentSettingsType::AUTOMATIC_FULLSCREEN, CONTENT_SETTING_ALLOW}, {prefs::kManagedAutomaticFullscreenBlockedForUrls, -@@ -133,6 +134,7 @@ constexpr PrefsForManagedContentSettingsMapEntry +@@ -139,6 +140,7 @@ constexpr PrefsForManagedContentSettingsMapEntry }; constexpr const char* kManagedPrefs[] = { diff --git a/patches/components-content_settings-core-browser-content_settings_registry.cc.patch b/patches/components-content_settings-core-browser-content_settings_registry.cc.patch index 1f6bfd5ed499..b52797f0d2d2 100644 --- a/patches/components-content_settings-core-browser-content_settings_registry.cc.patch +++ b/patches/components-content_settings-core-browser-content_settings_registry.cc.patch @@ -1,10 +1,10 @@ diff --git a/components/content_settings/core/browser/content_settings_registry.cc b/components/content_settings/core/browser/content_settings_registry.cc -index 6d1fed50def001bfca82fbd01adfcffc8d0ac58e..1a9f90df672276f906a05e315655ff1275d29f8d 100644 +index 06431fe9ee87393ac35d048ab1d9ef6391fb1be3..e5f4cde7e535269d2abf19c2698b57b8ff347e9f 100644 --- a/components/content_settings/core/browser/content_settings_registry.cc +++ b/components/content_settings/core/browser/content_settings_registry.cc -@@ -836,6 +836,7 @@ void ContentSettingsRegistry::Init() { +@@ -838,6 +838,7 @@ void ContentSettingsRegistry::Init() { WebsiteSettingsRegistry::DESKTOP, - ContentSettingsInfo::INHERIT_IF_LESS_PERMISSIVE, + ContentSettingsInfo::INHERIT_IN_INCOGNITO, ContentSettingsInfo::EXCEPTIONS_ON_SECURE_ORIGINS_ONLY); + BRAVE_INIT } diff --git a/patches/components-content_settings-core-browser-content_settings_uma_util.cc.patch b/patches/components-content_settings-core-browser-content_settings_uma_util.cc.patch index 4ae72a1da5b3..a3a01689361e 100644 --- a/patches/components-content_settings-core-browser-content_settings_uma_util.cc.patch +++ b/patches/components-content_settings-core-browser-content_settings_uma_util.cc.patch @@ -1,8 +1,8 @@ diff --git a/components/content_settings/core/browser/content_settings_uma_util.cc b/components/content_settings/core/browser/content_settings_uma_util.cc -index 4c80092a6c62e4943f42b7830ec6da62d3277677..9271ba9e9c44474722f1b498d86b8f0e0aa126a7 100644 +index 28869099b8fa5535c3f3dc3e9948175bd2a8d8f8..85e5d918804887d43475b23f2379d6c2c51ae31b 100644 --- a/components/content_settings/core/browser/content_settings_uma_util.cc +++ b/components/content_settings/core/browser/content_settings_uma_util.cc -@@ -148,6 +148,7 @@ constexpr auto kHistogramValue = base::MakeFixedFlatMapGetApplicationClientIdForFileScanning(), diff --git a/patches/components-infobars-core-infobar_delegate.h.patch b/patches/components-infobars-core-infobar_delegate.h.patch index 870780017e51..c40366bc56b7 100644 --- a/patches/components-infobars-core-infobar_delegate.h.patch +++ b/patches/components-infobars-core-infobar_delegate.h.patch @@ -1,5 +1,5 @@ diff --git a/components/infobars/core/infobar_delegate.h b/components/infobars/core/infobar_delegate.h -index e7e679e99050937683ae3db5af422b4bab818f53..6fd9152d79163758b854a9b880b0dff897af5643 100644 +index 762aefb5cad2e579ea8562fc5f728ab402f89ce5..bb7b322e7911c286d6938f4917294be0d3deb244 100644 --- a/components/infobars/core/infobar_delegate.h +++ b/components/infobars/core/infobar_delegate.h @@ -186,6 +186,7 @@ class InfoBarDelegate { diff --git a/patches/components-metrics-BUILD.gn.patch b/patches/components-metrics-BUILD.gn.patch index 4245642da88a..61034797c85f 100644 --- a/patches/components-metrics-BUILD.gn.patch +++ b/patches/components-metrics-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/components/metrics/BUILD.gn b/components/metrics/BUILD.gn -index dff8139a6e0bbf66a1b2674e952f23edeea0b8ba..6acc4534d6b532240a9ff029c59fb4a64f46fc3b 100644 +index 1c40ebed5ea2272abf54200d80024be9a121b43c..dfc2da99ea0c7acc9f1bb3eb1eac9798169082de 100644 --- a/components/metrics/BUILD.gn +++ b/components/metrics/BUILD.gn -@@ -322,6 +322,7 @@ if (!is_cronet_build || is_ios) { +@@ -323,6 +323,7 @@ if (!is_cronet_build || is_ios) { "motherboard_metrics_provider.h", ] } diff --git a/patches/components-minidump_uploader-android-java-src-org-chromium-components-minidump_uploader-MinidumpUploader.java.patch b/patches/components-minidump_uploader-android-java-src-org-chromium-components-minidump_uploader-MinidumpUploader.java.patch index f4bf45a073ac..15a17b0cbf8e 100644 --- a/patches/components-minidump_uploader-android-java-src-org-chromium-components-minidump_uploader-MinidumpUploader.java.patch +++ b/patches/components-minidump_uploader-android-java-src-org-chromium-components-minidump_uploader-MinidumpUploader.java.patch @@ -1,5 +1,5 @@ diff --git a/components/minidump_uploader/android/java/src/org/chromium/components/minidump_uploader/MinidumpUploader.java b/components/minidump_uploader/android/java/src/org/chromium/components/minidump_uploader/MinidumpUploader.java -index e2501f92ecf3c8414d9e77c63cce9aa2aae6274b..0030af66e0f61cdadeca06bb2044a49320c74daa 100644 +index 5f30ab591586f986da1f26359d9b5cf7bb763772..a430483effebcee3887d0957f0eb81e871855daa 100644 --- a/components/minidump_uploader/android/java/src/org/chromium/components/minidump_uploader/MinidumpUploader.java +++ b/components/minidump_uploader/android/java/src/org/chromium/components/minidump_uploader/MinidumpUploader.java @@ -26,7 +26,7 @@ import java.util.zip.GZIPOutputStream; diff --git a/patches/components-omnibox-browser-BUILD.gn.patch b/patches/components-omnibox-browser-BUILD.gn.patch index 30e775765d26..9d69f80e73ef 100644 --- a/patches/components-omnibox-browser-BUILD.gn.patch +++ b/patches/components-omnibox-browser-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/components/omnibox/browser/BUILD.gn b/components/omnibox/browser/BUILD.gn -index 469daca0ec5296f95e59c4eaf80059cfc2f9314a..46ff4d70bc53acfa52fa5f5ebd515ce037f61d9d 100644 +index 2a79f8423c13e7929ecbf580107e9759d7bd7250..9cba66d426c89170b7256a53082e1afbf4937e76 100644 --- a/components/omnibox/browser/BUILD.gn +++ b/components/omnibox/browser/BUILD.gn -@@ -369,6 +369,7 @@ static_library("browser") { +@@ -370,6 +370,7 @@ static_library("browser") { "//ui/base", "//ui/gfx", ] @@ -10,7 +10,7 @@ index 469daca0ec5296f95e59c4eaf80059cfc2f9314a..46ff4d70bc53acfa52fa5f5ebd515ce0 configs += [ "//build/config/compiler:wexit_time_destructors" ] -@@ -976,6 +977,7 @@ fuzzer_test("search_suggestion_parser_fuzzer") { +@@ -972,6 +973,7 @@ fuzzer_test("search_suggestion_parser_fuzzer") { mojom("mojo_bindings") { sources = [ "omnibox.mojom" ] diff --git a/patches/components-omnibox-browser-autocomplete_controller.cc.patch b/patches/components-omnibox-browser-autocomplete_controller.cc.patch index 7c52c1c69669..436fbf1401e1 100644 --- a/patches/components-omnibox-browser-autocomplete_controller.cc.patch +++ b/patches/components-omnibox-browser-autocomplete_controller.cc.patch @@ -1,8 +1,8 @@ diff --git a/components/omnibox/browser/autocomplete_controller.cc b/components/omnibox/browser/autocomplete_controller.cc -index 0acf1d8a67d87002b04ebcb7b987fd95d13acfdc..565408a71228bf7d1636d1ac4007e75c07b5de23 100644 +index ebf7cac0bc2b0054a0e29fc30addc8a123a983f8..9efd21fd737e80d80f05f904be68e0618a50a6d6 100644 --- a/components/omnibox/browser/autocomplete_controller.cc +++ b/components/omnibox/browser/autocomplete_controller.cc -@@ -1134,6 +1134,7 @@ void AutocompleteController::InitializeAsyncProviders(int provider_types) { +@@ -1139,6 +1139,7 @@ void AutocompleteController::InitializeAsyncProviders(int provider_types) { if (provider_types & AutocompleteProvider::TYPE_SEARCH) { search_provider_ = new SearchProvider(provider_client_.get(), this); providers_.push_back(search_provider_.get()); @@ -10,7 +10,7 @@ index 0acf1d8a67d87002b04ebcb7b987fd95d13acfdc..565408a71228bf7d1636d1ac4007e75c } // Providers run in the order they're added. Add `HistoryURLProvider` after // `SearchProvider` because: -@@ -1339,6 +1340,7 @@ void AutocompleteController::UpdateResult(UpdateType update_type) { +@@ -1344,6 +1345,7 @@ void AutocompleteController::UpdateResult(UpdateType update_type) { StartStopTimer(); } diff --git a/patches/components-omnibox-browser-omnibox_edit_model.cc.patch b/patches/components-omnibox-browser-omnibox_edit_model.cc.patch index 3365905a9658..c839fa95b570 100644 --- a/patches/components-omnibox-browser-omnibox_edit_model.cc.patch +++ b/patches/components-omnibox-browser-omnibox_edit_model.cc.patch @@ -1,5 +1,5 @@ diff --git a/components/omnibox/browser/omnibox_edit_model.cc b/components/omnibox/browser/omnibox_edit_model.cc -index d299278cf223d76b6a06a782bf2e4c9950d47ef5..6678623638bab0278e449f48541b48bc18c15453 100644 +index e9a052c7dc6dd230d66fd3c7d9eaa783f1abbc3e..506db1e70f6a7120a6026d861c85c0fd64c24c98 100644 --- a/components/omnibox/browser/omnibox_edit_model.cc +++ b/components/omnibox/browser/omnibox_edit_model.cc @@ -504,6 +504,7 @@ void OmniboxEditModel::AdjustTextForCopy(int sel_min, diff --git a/patches/components-page_info-page_info.cc.patch b/patches/components-page_info-page_info.cc.patch index 2d5a104276b3..b43207c88600 100644 --- a/patches/components-page_info-page_info.cc.patch +++ b/patches/components-page_info-page_info.cc.patch @@ -1,8 +1,8 @@ diff --git a/components/page_info/page_info.cc b/components/page_info/page_info.cc -index de497055da9fda1ed7e5b95ab41ba86324bdca27..136182f2c3bef7efd345ebb885b21ae4a684270f 100644 +index 29af5213171eab79602caa1cec88f799e8ecf777..f06ce38d4f22a5e8782fdab0618711ed57ae3ff1 100644 --- a/components/page_info/page_info.cc +++ b/components/page_info/page_info.cc -@@ -1240,6 +1240,7 @@ void PageInfo::PopulatePermissionInfo(PermissionInfo& permission_info, +@@ -1247,6 +1247,7 @@ void PageInfo::PopulatePermissionInfo(PermissionInfo& permission_info, // applies to permissions listed in |kPermissionType|. bool PageInfo::ShouldShowPermission( const PageInfo::PermissionInfo& info) const { diff --git a/patches/components-permissions-BUILD.gn.patch b/patches/components-permissions-BUILD.gn.patch index 0467289ff9cb..bfb3e2f4fdc4 100644 --- a/patches/components-permissions-BUILD.gn.patch +++ b/patches/components-permissions-BUILD.gn.patch @@ -1,5 +1,5 @@ diff --git a/components/permissions/BUILD.gn b/components/permissions/BUILD.gn -index b598c95dc815e19225497736db25196a0f984b04..4dc6bba523ac358fc2bbcd5f75c96229223d5ca8 100644 +index 4efc091de0d3f8f105986886d7b19949863f61aa..ddc7cbad581fa30b45fe73ce385071cbb5e1bded 100644 --- a/components/permissions/BUILD.gn +++ b/components/permissions/BUILD.gn @@ -5,7 +5,7 @@ @@ -11,7 +11,7 @@ index b598c95dc815e19225497736db25196a0f984b04..4dc6bba523ac358fc2bbcd5f75c96229 sources = [ "constants.cc", "constants.h", -@@ -165,6 +165,7 @@ source_set("permissions") { +@@ -163,6 +163,7 @@ source_set("permissions") { if (!is_android) { deps += [ "//components/guest_view/browser" ] } diff --git a/patches/components-permissions-android-BUILD.gn.patch b/patches/components-permissions-android-BUILD.gn.patch index c66a7417a274..341c02b65e50 100644 --- a/patches/components-permissions-android-BUILD.gn.patch +++ b/patches/components-permissions-android-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/components/permissions/android/BUILD.gn b/components/permissions/android/BUILD.gn -index f25f8110a3c22ad4786382d83af0a8d06eb3d24a..a9ccd94a13bf463d9c12e28cb38e9b3fcf64968e 100644 +index 70a66425ae822b3779e83627872c126cfcfd1d00..adc9dd37703b40998ec7622cc4b5d6ceaec97064 100644 --- a/components/permissions/android/BUILD.gn +++ b/components/permissions/android/BUILD.gn -@@ -153,6 +153,7 @@ android_library("java") { +@@ -148,6 +148,7 @@ android_library("java") { "//third_party/jni_zero:jni_zero_java", "//ui/android:ui_java", ] diff --git a/patches/components-permissions-permission_manager.cc.patch b/patches/components-permissions-permission_manager.cc.patch index 901b75c42372..a9886b940dfb 100644 --- a/patches/components-permissions-permission_manager.cc.patch +++ b/patches/components-permissions-permission_manager.cc.patch @@ -1,8 +1,8 @@ diff --git a/components/permissions/permission_manager.cc b/components/permissions/permission_manager.cc -index 7841b7a574a773ca43623ffc5d658da56e7c01b8..03b050fdb1fc496c9548733e5217327b16ca81cc 100644 +index d5da5d60d7fe087ffbceaedd8c4d3ec7bc7afa55..173436e73409b96a341ee48b89948fceadfeb896 100644 --- a/components/permissions/permission_manager.cc +++ b/components/permissions/permission_manager.cc -@@ -291,6 +291,7 @@ void PermissionManager::RequestPermissionsFromCurrentDocument( +@@ -295,6 +295,7 @@ void PermissionManager::RequestPermissionsFromCurrentDocument( base::OnceCallback&)> permission_status_callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); @@ -10,7 +10,7 @@ index 7841b7a574a773ca43623ffc5d658da56e7c01b8..03b050fdb1fc496c9548733e5217327b RequestPermissionsInternal(render_frame_host, request_description, std::move(permission_status_callback)); } -@@ -342,6 +343,7 @@ PermissionManager::GetPermissionResultForCurrentDocument( +@@ -346,6 +347,7 @@ PermissionManager::GetPermissionResultForCurrentDocument( PermissionUtil::PermissionTypeToContentSettingType(permission); const GURL requesting_origin = diff --git a/patches/components-permissions-permission_request_manager.cc.patch b/patches/components-permissions-permission_request_manager.cc.patch index c85213604e2a..3eea8e9a0a62 100644 --- a/patches/components-permissions-permission_request_manager.cc.patch +++ b/patches/components-permissions-permission_request_manager.cc.patch @@ -1,5 +1,5 @@ diff --git a/components/permissions/permission_request_manager.cc b/components/permissions/permission_request_manager.cc -index 2ce0b4f56580be0b0d9f55dee146438f7b64c6ab..b296fb7c2c8eaf2651e23cedd9fb1a23335aab33 100644 +index 098634801693c6ee0a1501e5a22c873f8ab747e4..c32d67ce13ddc36ef0c1d342f69529b121dc2ad8 100644 --- a/components/permissions/permission_request_manager.cc +++ b/components/permissions/permission_request_manager.cc @@ -592,6 +592,7 @@ GURL PermissionRequestManager::GetRequestingOrigin() const { diff --git a/patches/components-permissions-permission_uma_util.cc.patch b/patches/components-permissions-permission_uma_util.cc.patch index 3c640be05798..c7f8a24f1b69 100644 --- a/patches/components-permissions-permission_uma_util.cc.patch +++ b/patches/components-permissions-permission_uma_util.cc.patch @@ -1,8 +1,8 @@ diff --git a/components/permissions/permission_uma_util.cc b/components/permissions/permission_uma_util.cc -index 4dcd5a9e808e5c6ddc477944500b3948ea7b5ea0..6b140284b5a7a8e7afd0526962c1a1ed6c7dfd0d 100644 +index 243670e70a299ad312bd52ac29f053036b7e060a..97c12a8448d6170bd41e9014aca27253e2e35fe3 100644 --- a/components/permissions/permission_uma_util.cc +++ b/components/permissions/permission_uma_util.cc -@@ -154,6 +154,7 @@ RequestTypeForUma GetUmaValueForRequestType(RequestType request_type) { +@@ -152,6 +152,7 @@ RequestTypeForUma GetUmaValueForRequestType(RequestType request_type) { #endif case RequestType::kIdentityProvider: return RequestTypeForUma::PERMISSION_IDENTITY_PROVIDER; @@ -10,7 +10,7 @@ index 4dcd5a9e808e5c6ddc477944500b3948ea7b5ea0..6b140284b5a7a8e7afd0526962c1a1ed } } -@@ -179,6 +180,7 @@ RequestTypeForUma GetUmaValueForRequests( +@@ -177,6 +178,7 @@ RequestTypeForUma GetUmaValueForRequests( return RequestTypeForUma::MULTIPLE_KEYBOARD_AND_POINTER_LOCK; } #endif diff --git a/patches/components-permissions-permission_util.cc.patch b/patches/components-permissions-permission_util.cc.patch index f8720c7b0f46..4b7b4460ccf8 100644 --- a/patches/components-permissions-permission_util.cc.patch +++ b/patches/components-permissions-permission_util.cc.patch @@ -1,8 +1,8 @@ diff --git a/components/permissions/permission_util.cc b/components/permissions/permission_util.cc -index 335d56aa7dc434cf0e3248e44f0d48eccbdc06c5..c0ac79d4b45a1c0c3e8a451d91c546729db30e6a 100644 +index befb62e853d5ee43562876b82ae60598fd5f9473..09770e25013c764eb5bdd8bf09f1f8bf840bda0d 100644 --- a/components/permissions/permission_util.cc +++ b/components/permissions/permission_util.cc -@@ -371,6 +371,7 @@ ContentSettingsType PermissionUtil::PermissionTypeToContentSettingTypeSafe( +@@ -366,6 +366,7 @@ ContentSettingsType PermissionUtil::PermissionTypeToContentSettingTypeSafe( return ContentSettingsType::WEB_APP_INSTALLATION; case PermissionType::NUM: break; diff --git a/patches/components-permissions-request_type.cc.patch b/patches/components-permissions-request_type.cc.patch index 5ae1bbd847d8..17b6321b1b84 100644 --- a/patches/components-permissions-request_type.cc.patch +++ b/patches/components-permissions-request_type.cc.patch @@ -1,8 +1,8 @@ diff --git a/components/permissions/request_type.cc b/components/permissions/request_type.cc -index e90e8ce27cbdcc571eef7a4b315269e6395ab1de..0f1ff9d7d7100f041d2e6bd211d0e65953cb25b0 100644 +index 2317ae10e006cce53bc2ac000487bcd81c2556c1..5bcbf81d45f5aec2af797d38294712f5e407466b 100644 --- a/components/permissions/request_type.cc +++ b/components/permissions/request_type.cc -@@ -470,6 +470,7 @@ const char* PermissionKeyForRequestType(permissions::RequestType request_type) { +@@ -460,6 +460,7 @@ const char* PermissionKeyForRequestType(permissions::RequestType request_type) { #endif case permissions::RequestType::kIdentityProvider: return "identity_provider"; diff --git a/patches/components-policy-resources-webui-policy_base.ts.patch b/patches/components-policy-resources-webui-policy_base.ts.patch index 57abc778cb63..cbbed9f45ed4 100644 --- a/patches/components-policy-resources-webui-policy_base.ts.patch +++ b/patches/components-policy-resources-webui-policy_base.ts.patch @@ -1,8 +1,8 @@ diff --git a/components/policy/resources/webui/policy_base.ts b/components/policy/resources/webui/policy_base.ts -index 892b42d1a8cd92a5ae47f31d7cc4670de285c14a..e9ee2d59564d4211cbc5fcc850ba769bf4aa53ba 100644 +index 24dd7cbf06582e255b8b3c997420655db4dac57b..c68afa09447d2a539e96ede9c5331d2a50fc5890 100644 --- a/components/policy/resources/webui/policy_base.ts +++ b/components/policy/resources/webui/policy_base.ts -@@ -180,7 +180,7 @@ export class Page { +@@ -187,7 +187,7 @@ export class Page { policyNames['precedence']?.policyNames, ].includes(knownPolicyNames) && knownPolicyNamesSet.has(name) ? diff --git a/patches/components-safe_browsing-core-common-safe_browsing_prefs.cc.patch b/patches/components-safe_browsing-core-common-safe_browsing_prefs.cc.patch index 1d04de85602d..d6d333fb6e85 100644 --- a/patches/components-safe_browsing-core-common-safe_browsing_prefs.cc.patch +++ b/patches/components-safe_browsing-core-common-safe_browsing_prefs.cc.patch @@ -1,5 +1,5 @@ diff --git a/components/safe_browsing/core/common/safe_browsing_prefs.cc b/components/safe_browsing/core/common/safe_browsing_prefs.cc -index 5edc7f2a71c6c52e711ff0e715e0eeba5323ba3b..fca1adfde36114c9509f48bf32cc924a9093e9e5 100644 +index 9f9126367a7ef80a2be4561ae72d587fd2095ee4..3f0d3c62056cbc4b79af76054c557e02ab0e6158 100644 --- a/components/safe_browsing/core/common/safe_browsing_prefs.cc +++ b/components/safe_browsing/core/common/safe_browsing_prefs.cc @@ -103,6 +103,7 @@ bool IsSafeBrowsingEnabled(const PrefService& prefs) { diff --git a/patches/components-search_engines-BUILD.gn.patch b/patches/components-search_engines-BUILD.gn.patch index e8e9813eacbe..64036395710e 100644 --- a/patches/components-search_engines-BUILD.gn.patch +++ b/patches/components-search_engines-BUILD.gn.patch @@ -1,11 +1,11 @@ diff --git a/components/search_engines/BUILD.gn b/components/search_engines/BUILD.gn -index 6a9a70a7c4d2d41bf576854c5be4f1cc61c3377f..4c531a189e851c018a50a8209cd835647e84d45a 100644 +index b38a5d88fd1f25d889395abbe8d712cfe69bd519..425141cffafbbfb72f989a254cc947558471c158 100644 --- a/components/search_engines/BUILD.gn +++ b/components/search_engines/BUILD.gn -@@ -265,6 +265,7 @@ json_to_struct("prepopulated_engines") { - schema_file = "prepopulated_engines_schema.json" - namespace = "TemplateURLPrepopulateData" - deps = [ ":search_engine_type" ] +@@ -271,6 +271,7 @@ json_to_struct("prepopulated_engines") { + ":search_engine_type", + "//base", + ] + additional_sources = brave_components_search_engines_sources } diff --git a/patches/components-search_engines-default_search_manager.cc.patch b/patches/components-search_engines-default_search_manager.cc.patch index 4180bc9ecb64..20a00500b9ab 100644 --- a/patches/components-search_engines-default_search_manager.cc.patch +++ b/patches/components-search_engines-default_search_manager.cc.patch @@ -1,12 +1,12 @@ diff --git a/components/search_engines/default_search_manager.cc b/components/search_engines/default_search_manager.cc -index 6b04809f0ce444161bd5ee16cd0c735a0a4176ff..6740fd176dc3c78c7cf1f7579030f82f53e1cc14 100644 +index 9e65bd6b46b47d9bfde0fc88148bda2967ef6e39..037f5fd52871b3eae1de1b0c81df99e77da7e1c6 100644 --- a/components/search_engines/default_search_manager.cc +++ b/components/search_engines/default_search_manager.cc -@@ -425,6 +425,7 @@ void DefaultSearchManager::LoadDefaultSearchEngineFromPrefs() { +@@ -330,6 +330,7 @@ void DefaultSearchManager::LoadDefaultSearchEngineFromPrefs() { // Check if default search preference is overriden by extension. if (pref->IsExtensionControlled()) { extension_default_search_ = std::move(turl_data); + LOADDEFAULTSEARCHENGINEFROMPREFS_BRAVE } else { - prefs_default_search_ = std::move(turl_data); - MergePrefsDataWithPrepopulated(); + prefs_default_search_.SetAndReconcile(std::move(turl_data)); + } diff --git a/patches/components-search_engines-prepopulated_engines.json.patch b/patches/components-search_engines-prepopulated_engines.json.patch index 451f35b76126..3dfcb9795667 100644 --- a/patches/components-search_engines-prepopulated_engines.json.patch +++ b/patches/components-search_engines-prepopulated_engines.json.patch @@ -1,5 +1,5 @@ diff --git a/components/search_engines/prepopulated_engines.json b/components/search_engines/prepopulated_engines.json -index 40a13e733cbcb351898eefb64242a3a8187d198f..a897824b6fc01a0a937d603e9a9e86664a4f37ec 100644 +index 2036ba59e62c14e230911d344a7b4590d303beb3..d03a4d52a9ef6cba28fb119c40dcf0e5c942aef4 100644 --- a/components/search_engines/prepopulated_engines.json +++ b/components/search_engines/prepopulated_engines.json @@ -116,23 +116,6 @@ @@ -52,6 +52,6 @@ index 40a13e733cbcb351898eefb64242a3a8187d198f..a897824b6fc01a0a937d603e9a9e8666 - ] - }, - - "seznam_cz": { + "seznam": { "name": "Seznam.cz", - "keyword": "seznam.cz", + "keyword": "seznam", diff --git a/patches/components-signin-internal-identity_manager-BUILD.gn.patch b/patches/components-signin-internal-identity_manager-BUILD.gn.patch index a80901cd0565..1b042beb9ba3 100644 --- a/patches/components-signin-internal-identity_manager-BUILD.gn.patch +++ b/patches/components-signin-internal-identity_manager-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/components/signin/internal/identity_manager/BUILD.gn b/components/signin/internal/identity_manager/BUILD.gn -index 25f8218823f1ab87ddd8a4f75eaf58f852385c4d..4520dfee0f6fc8cff91632aac25baaf042937764 100644 +index e1dae20229f9ba95ad218e0077b0c0116c9e42e7..98a16f8a141dfa84febcba8ec4e12be0a8d80f25 100644 --- a/components/signin/internal/identity_manager/BUILD.gn +++ b/components/signin/internal/identity_manager/BUILD.gn -@@ -141,6 +141,7 @@ source_set("identity_manager") { +@@ -142,6 +142,7 @@ source_set("identity_manager") { "device_accounts_synchronizer_impl.h", ] } diff --git a/patches/components-sync-engine-syncer_proto_util.cc.patch b/patches/components-sync-engine-syncer_proto_util.cc.patch index 2cee6f0f8b3b..6d180369781a 100644 --- a/patches/components-sync-engine-syncer_proto_util.cc.patch +++ b/patches/components-sync-engine-syncer_proto_util.cc.patch @@ -1,5 +1,5 @@ diff --git a/components/sync/engine/syncer_proto_util.cc b/components/sync/engine/syncer_proto_util.cc -index ff0a902a716f47d216d7a7d87cb4c09ad3bf87ad..a53b1d4157b9a339dfe6f30f3c8ce702a65879e3 100644 +index 527006f80fe2f94f448e0fbf1b679f25e9e6c6f1..d31307c2ba3e536ddeaba287c4da7a6129a94e9d 100644 --- a/components/sync/engine/syncer_proto_util.cc +++ b/components/sync/engine/syncer_proto_util.cc @@ -276,6 +276,7 @@ SyncerError SyncerProtoUtil::HandleClientToServerMessageResponse( diff --git a/patches/components-sync-protocol-proto_visitors.h.patch b/patches/components-sync-protocol-proto_visitors.h.patch index c80241e96340..ff40406f2694 100644 --- a/patches/components-sync-protocol-proto_visitors.h.patch +++ b/patches/components-sync-protocol-proto_visitors.h.patch @@ -1,5 +1,5 @@ diff --git a/components/sync/protocol/proto_visitors.h b/components/sync/protocol/proto_visitors.h -index 22c1daac68950b8ebd2829f5bd07eff5dc441eee..a219f7c10dec031dffad4082c8bbab38485fba20 100644 +index 2b80479f4308e450b4e5b63694c673f25967769e..6cc1f906a36356e07f75c1533a3c31f0e948dac2 100644 --- a/components/sync/protocol/proto_visitors.h +++ b/components/sync/protocol/proto_visitors.h @@ -604,6 +604,7 @@ VISIT_PROTO_FIELDS(const sync_pb::DeviceInfoSpecifics& proto) { diff --git a/patches/components-sync-protocol-protocol_sources.gni.patch b/patches/components-sync-protocol-protocol_sources.gni.patch index 96693d602d85..8d231fe1a16b 100644 --- a/patches/components-sync-protocol-protocol_sources.gni.patch +++ b/patches/components-sync-protocol-protocol_sources.gni.patch @@ -1,8 +1,8 @@ diff --git a/components/sync/protocol/protocol_sources.gni b/components/sync/protocol/protocol_sources.gni -index bdee9dcf6ea5b71c9439b13a8bc9e079fbaba6a2..4a30339c7c6db68a2c138b7198862f25c4f22157 100644 +index 1234f070b460c3e4141a6dfbe768021b07511a29..564ee7d897f4b8158698306f70fe004433548002 100644 --- a/components/sync/protocol/protocol_sources.gni +++ b/components/sync/protocol/protocol_sources.gni -@@ -84,3 +84,4 @@ sync_protocol_sources = [ +@@ -82,3 +82,4 @@ sync_protocol_sources = [ "wifi_configuration_specifics.proto", "workspace_desk_specifics.proto", ] diff --git a/patches/components-sync-service-BUILD.gn.patch b/patches/components-sync-service-BUILD.gn.patch index c92d99687252..61811aac3839 100644 --- a/patches/components-sync-service-BUILD.gn.patch +++ b/patches/components-sync-service-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/components/sync/service/BUILD.gn b/components/sync/service/BUILD.gn -index ec3e83b6a7514e2ba7b01d9c889c5e017c00307d..a92b9826b22ebd1d1be41181b25ac4370e4427d4 100644 +index 63c8082867de272251d7535faae1fcb0a3d0f48a..56a876f56c276fec1b0ba704aee8d048a1b42a33 100644 --- a/components/sync/service/BUILD.gn +++ b/components/sync/service/BUILD.gn -@@ -126,4 +126,5 @@ static_library("service") { +@@ -130,4 +130,5 @@ static_library("service") { } configs += [ "//build/config/compiler:wexit_time_destructors" ] diff --git a/patches/components-sync-service-sync_service_impl.h.patch b/patches/components-sync-service-sync_service_impl.h.patch index eaa68477f489..d4aa511ca918 100644 --- a/patches/components-sync-service-sync_service_impl.h.patch +++ b/patches/components-sync-service-sync_service_impl.h.patch @@ -1,8 +1,8 @@ diff --git a/components/sync/service/sync_service_impl.h b/components/sync/service/sync_service_impl.h -index 4926ca753a0523cb463a73da4e401cb9cc5a91dc..b4d0ba261ea99051da8873c583dff8321cdf06fa 100644 +index 8f2c0d864d01d92640c0e0b596a6409b787af2d0..46ab5bcd0a530dfc4a2f832918c108fd58e7a01b 100644 --- a/components/sync/service/sync_service_impl.h +++ b/components/sync/service/sync_service_impl.h -@@ -257,6 +257,7 @@ class SyncServiceImpl : public SyncService, +@@ -256,6 +256,7 @@ class SyncServiceImpl : public SyncService, void ReportDataTypeErrorForTest(DataType type); private: diff --git a/patches/components-translate-content-renderer-translate_agent.cc.patch b/patches/components-translate-content-renderer-translate_agent.cc.patch index 941b4eb45eb0..97a630278e89 100644 --- a/patches/components-translate-content-renderer-translate_agent.cc.patch +++ b/patches/components-translate-content-renderer-translate_agent.cc.patch @@ -1,5 +1,5 @@ diff --git a/components/translate/content/renderer/translate_agent.cc b/components/translate/content/renderer/translate_agent.cc -index 76317a2954702cf30b83cf536fd9879fd0761ab9..539ce7664698b28738359feae78d463f7620b695 100644 +index 21bc39e3c9943e735a8e29b6f480b9fd9bb2a409..34235e027ec13015f7ceb89404c8fc3d25c0e5df 100644 --- a/components/translate/content/renderer/translate_agent.cc +++ b/components/translate/content/renderer/translate_agent.cc @@ -62,7 +62,7 @@ const int kTranslateInitCheckDelayMs = 150; diff --git a/patches/components-version_ui-resources-about_version.css.patch b/patches/components-version_ui-resources-about_version.css.patch index bd1d7cc68a31..da8d2a99f324 100644 --- a/patches/components-version_ui-resources-about_version.css.patch +++ b/patches/components-version_ui-resources-about_version.css.patch @@ -1,8 +1,8 @@ diff --git a/components/version_ui/resources/about_version.css b/components/version_ui/resources/about_version.css -index 6b753d716b55d14f73b9538909648428b5b2407c..185db4fc607bc27c67e39129ea0cc8a170a34621 100644 +index 839526405ef3f4b0c313811635b1555a5b254a1c..498f855311b6f46e9c016670e26bfcc11ccedfd9 100644 --- a/components/version_ui/resources/about_version.css +++ b/components/version_ui/resources/about_version.css -@@ -135,3 +135,5 @@ body { +@@ -138,3 +138,5 @@ body { position: fixed; width: 1px; } diff --git a/patches/content-app_shim_remote_cocoa-render_widget_host_view_cocoa.mm.patch b/patches/content-app_shim_remote_cocoa-render_widget_host_view_cocoa.mm.patch index fde5a90847dc..f668bace9080 100644 --- a/patches/content-app_shim_remote_cocoa-render_widget_host_view_cocoa.mm.patch +++ b/patches/content-app_shim_remote_cocoa-render_widget_host_view_cocoa.mm.patch @@ -1,8 +1,8 @@ diff --git a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm -index 89b5fb70f4efdd961edab218971aead2b515166e..0b99d1f568488fcf298b6cd7e902bf391ab79096 100644 +index f7ead5e49e4ba93744eab12c8cb21a4f3b6a0d65..9c62d0b65747680bf366da54e5dd9ae9a1965fd3 100644 --- a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm +++ b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm -@@ -1964,6 +1964,7 @@ void ExtractUnderlines(NSAttributedString* string, +@@ -1963,6 +1963,7 @@ void ExtractUnderlines(NSAttributedString* string, } - (id)accessibilityParent { diff --git a/patches/content-browser-BUILD.gn.patch b/patches/content-browser-BUILD.gn.patch index b1db14261003..126e73b7f0cf 100644 --- a/patches/content-browser-BUILD.gn.patch +++ b/patches/content-browser-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn -index 4e163a30b7f987b0127cabf84a4610bfb81b9662..51a1990051ef1baa879f6a039889bafed98da935 100644 +index deaec752fafd74c1dfb526197ba37fd32604cbb8..d9b95b3726d9e75fbf232a1fe3fefa298882452e 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn -@@ -3543,6 +3543,7 @@ source_set("browser") { +@@ -3532,6 +3532,7 @@ source_set("browser") { "profiling_utils.cc", ] } diff --git a/patches/content-browser-gpu-gpu_internals_ui.cc.patch b/patches/content-browser-gpu-gpu_internals_ui.cc.patch index a32ac7a92963..6bc8672e43b6 100644 --- a/patches/content-browser-gpu-gpu_internals_ui.cc.patch +++ b/patches/content-browser-gpu-gpu_internals_ui.cc.patch @@ -1,8 +1,8 @@ diff --git a/content/browser/gpu/gpu_internals_ui.cc b/content/browser/gpu/gpu_internals_ui.cc -index 1395365217e79b082f4b5ff2239685eb8e017671..2faf274707f71d782306049fc283ae1b3adfbbe1 100644 +index 84471ca29aaa5eb362cbb7593396e710f607ef5d..7fec97e1676842151e5c5f3b055b2d8ad24b8067 100644 --- a/content/browser/gpu/gpu_internals_ui.cc +++ b/content/browser/gpu/gpu_internals_ui.cc -@@ -818,6 +818,7 @@ base::Value::Dict GpuMessageHandler::GetClientInfo() { +@@ -821,6 +821,7 @@ base::Value::Dict GpuMessageHandler::GetClientInfo() { std::string("Skia/" STRINGIZE(SK_MILESTONE) " " SKIA_COMMIT_HASH)); dict.Set("revision_identifier", GPU_LISTS_VERSION); diff --git a/patches/content-browser-renderer_host-navigation_controller_impl.cc.patch b/patches/content-browser-renderer_host-navigation_controller_impl.cc.patch index d792fb2976a0..f762ee4bb7c2 100644 --- a/patches/content-browser-renderer_host-navigation_controller_impl.cc.patch +++ b/patches/content-browser-renderer_host-navigation_controller_impl.cc.patch @@ -1,8 +1,8 @@ diff --git a/content/browser/renderer_host/navigation_controller_impl.cc b/content/browser/renderer_host/navigation_controller_impl.cc -index d5cfee804c3e1c0dd942c98536e3ccc41c1f2d96..2871ea44fe19dc0ec1b99294d841a1a737a090e9 100644 +index 689fa93d24769ed291d574c228f8cf19d38f33a8..3594081cbeb3d3bb560db7f042c474b87d2110a8 100644 --- a/content/browser/renderer_host/navigation_controller_impl.cc +++ b/content/browser/renderer_host/navigation_controller_impl.cc -@@ -3668,16 +3668,17 @@ base::WeakPtr NavigationControllerImpl::NavigateWithoutEntry( +@@ -3678,16 +3678,17 @@ base::WeakPtr NavigationControllerImpl::NavigateWithoutEntry( // Note: we intentionally leave the pending entry in place for renderer debug // URLs, unlike the cases below where we clear it if the navigation doesn't // proceed. diff --git a/patches/content-browser-renderer_host-navigation_request.cc.patch b/patches/content-browser-renderer_host-navigation_request.cc.patch index 84846cc80cf0..525545e7829f 100644 --- a/patches/content-browser-renderer_host-navigation_request.cc.patch +++ b/patches/content-browser-renderer_host-navigation_request.cc.patch @@ -1,8 +1,8 @@ diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc -index 22bb23e6a84d3b6686461f87e846125ad7484742..915bf2551e69045d6722f788a027bd11d3ef0fb6 100644 +index 53bba48293111e74daba50dde617fb78f1bcc7ee..bbf7d08e363677ca0f0b5fd4d2f497afdc0b2adf 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc -@@ -3465,6 +3465,7 @@ void NavigationRequest::OnRequestRedirected( +@@ -3467,6 +3467,7 @@ void NavigationRequest::OnRequestRedirected( common_params_->url = redirect_info.new_url; common_params_->method = redirect_info.new_method; common_params_->referrer->url = GURL(redirect_info.new_referrer); @@ -10,7 +10,7 @@ index 22bb23e6a84d3b6686461f87e846125ad7484742..915bf2551e69045d6722f788a027bd11 common_params_->referrer = Referrer::SanitizeForRequest( common_params_->url, *common_params_->referrer); -@@ -5237,6 +5238,7 @@ void NavigationRequest::OnStartChecksComplete( +@@ -5247,6 +5248,7 @@ void NavigationRequest::OnStartChecksComplete( headers.MergeFrom(TakeModifiedRequestHeaders()); begin_params_->headers = headers.ToString(); diff --git a/patches/content-browser-renderer_host-render_frame_host_impl.cc.patch b/patches/content-browser-renderer_host-render_frame_host_impl.cc.patch index b32e6b7accc4..9bf8f0be9f2d 100644 --- a/patches/content-browser-renderer_host-render_frame_host_impl.cc.patch +++ b/patches/content-browser-renderer_host-render_frame_host_impl.cc.patch @@ -1,8 +1,8 @@ diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index a0d5a983bb46a50dcf31afadc10f597a0e3ed15d..bd1aca4ee2bf0e65b37cb21fe40f7deb8b1f4fb4 100644 +index 503fe7f7083ded0d0e378d1bed3103111fb8e42a..a6d845bdaf2de20781ef804c010ce720c7d5e643 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -4756,6 +4756,7 @@ net::IsolationInfo RenderFrameHostImpl::ComputeIsolationInfoInternal( +@@ -4811,6 +4811,7 @@ net::IsolationInfo RenderFrameHostImpl::ComputeIsolationInfoInternal( candidate_site_for_cookies = net::SiteForCookies(top_frame_site); } @@ -10,7 +10,7 @@ index a0d5a983bb46a50dcf31afadc10f597a0e3ed15d..bd1aca4ee2bf0e65b37cb21fe40f7deb std::optional nonce = ComputeNonce(is_credentialless, fenced_frame_nonce_for_navigation); return net::IsolationInfo::Create(request_type, top_frame_origin, -@@ -4766,6 +4767,7 @@ net::IsolationInfo RenderFrameHostImpl::ComputeIsolationInfoInternal( +@@ -4821,6 +4822,7 @@ net::IsolationInfo RenderFrameHostImpl::ComputeIsolationInfoInternal( std::optional RenderFrameHostImpl::ComputeNonce( bool is_credentialless, std::optional fenced_frame_nonce_for_navigation) { @@ -18,7 +18,7 @@ index a0d5a983bb46a50dcf31afadc10f597a0e3ed15d..bd1aca4ee2bf0e65b37cb21fe40f7deb // If it's a credentialless frame tree, use its nonce even if it's within a // fenced frame tree to maintain the guarantee that a credentialless frame // tree has a unique nonce. -@@ -9109,6 +9111,8 @@ void RenderFrameHostImpl::CreateNewWindow( +@@ -9164,6 +9166,8 @@ void RenderFrameHostImpl::CreateNewWindow( dom_storage_context, params->session_storage_namespace_id); } diff --git a/patches/content-browser-web_contents-web_contents_impl.cc.patch b/patches/content-browser-web_contents-web_contents_impl.cc.patch index ddd347198806..b28afed77112 100644 --- a/patches/content-browser-web_contents-web_contents_impl.cc.patch +++ b/patches/content-browser-web_contents-web_contents_impl.cc.patch @@ -1,8 +1,8 @@ diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index c92c7744be6916e2baea1a882ff2a55fd155b580..dfdc72d280cc1abff611c79aeccabb69828e218e 100644 +index f25b2cc6c138a4e201b6ec9f74f9cb5734195f24..ecd021c5c34db5e1724a44487213e8e829d75925 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -4804,7 +4804,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -4792,7 +4792,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( // Save the window for later if we're not suppressing the opener (since it // will be shown immediately). diff --git a/patches/content-browser-webui-web_ui_impl.cc.patch b/patches/content-browser-webui-web_ui_impl.cc.patch index f087fe9453cc..5ff92f4acfd1 100644 --- a/patches/content-browser-webui-web_ui_impl.cc.patch +++ b/patches/content-browser-webui-web_ui_impl.cc.patch @@ -1,8 +1,8 @@ diff --git a/content/browser/webui/web_ui_impl.cc b/content/browser/webui/web_ui_impl.cc -index 371e45c0f4e0682658baee02687ece01ca9193ef..d074e47d646aee32e6266610994d00a376f2702b 100644 +index 57d4b607dd421fbf94ef95219e8d03787c21875c..6144757ba859ab60789ef665a821c39ea1a08f0f 100644 --- a/content/browser/webui/web_ui_impl.cc +++ b/content/browser/webui/web_ui_impl.cc -@@ -81,6 +81,7 @@ WebUIImpl::WebUIImpl(WebContents* web_contents) +@@ -122,6 +122,7 @@ WebUIImpl::WebUIImpl(WebContents* web_contents) web_contents_observer_( std::make_unique(this, web_contents_)) { DCHECK(web_contents_); diff --git a/patches/content-public-browser-BUILD.gn.patch b/patches/content-public-browser-BUILD.gn.patch index d9f1f3545b18..81ca6b8ed81f 100644 --- a/patches/content-public-browser-BUILD.gn.patch +++ b/patches/content-public-browser-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/content/public/browser/BUILD.gn b/content/public/browser/BUILD.gn -index ce71441bd76542ce30f4e339d5bf36a30876e398..c8f4718d34c6eca6ea65641a8080b5fc6f9813df 100644 +index 46add155cce7e131021e0a386ab0d9579e78610d..624facdda82cdbadab11a85c8a019e78e8338076 100644 --- a/content/public/browser/BUILD.gn +++ b/content/public/browser/BUILD.gn -@@ -739,6 +739,7 @@ source_set("browser_sources") { +@@ -741,6 +741,7 @@ source_set("browser_sources") { if (is_chromeos_lacros) { deps += [ "//chromeos/startup" ] } diff --git a/patches/content-renderer-render_frame_impl.cc.patch b/patches/content-renderer-render_frame_impl.cc.patch index df7666cffa18..9ca392a0e3c1 100644 --- a/patches/content-renderer-render_frame_impl.cc.patch +++ b/patches/content-renderer-render_frame_impl.cc.patch @@ -1,8 +1,8 @@ diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index 7b7e727c44a1477640f8702ad818f4a8607e3fb7..d355a7da45edc80cce88df1fc9fcd61feed05460 100644 +index 731064ab6b1b3856e05dec2800c0ce5768100bdb..9f4c4ba362fafcbfa412af5f71e1929f2c1e624e 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -4845,6 +4845,7 @@ bool RenderFrameImpl::ShouldUseUserAgentOverride() const { +@@ -4852,6 +4852,7 @@ bool RenderFrameImpl::ShouldUseUserAgentOverride() const { // Temporarily return early and fix properly as part of // https://crbug.com/426555. if (web_view->MainFrame()->IsWebRemoteFrame()) diff --git a/patches/content-renderer-render_thread_impl.cc.patch b/patches/content-renderer-render_thread_impl.cc.patch index db04a699a762..2ba3f15d500b 100644 --- a/patches/content-renderer-render_thread_impl.cc.patch +++ b/patches/content-renderer-render_thread_impl.cc.patch @@ -1,8 +1,8 @@ diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc -index 8fbed3f73560e4a083b016439239872b853ca4e1..73a4a259e4f46812f4a588cf037b9ba3eaaccf8a 100644 +index 15e28effa2cbfe7662a466d9a4664818d343e3d8..2c1b3a99397f084fbe52cc774daca1d780e1e8d1 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc -@@ -909,6 +909,7 @@ void RenderThreadImpl::InitializeRenderer( +@@ -904,6 +904,7 @@ void RenderThreadImpl::InitializeRenderer( } void RenderThreadImpl::RegisterSchemes() { diff --git a/patches/extensions-browser-api-web_request-extension_web_request_event_router.cc.patch b/patches/extensions-browser-api-web_request-extension_web_request_event_router.cc.patch index cede373bc9a3..903569ca29a1 100644 --- a/patches/extensions-browser-api-web_request-extension_web_request_event_router.cc.patch +++ b/patches/extensions-browser-api-web_request-extension_web_request_event_router.cc.patch @@ -1,8 +1,8 @@ diff --git a/extensions/browser/api/web_request/extension_web_request_event_router.cc b/extensions/browser/api/web_request/extension_web_request_event_router.cc -index 490310dd0a76bad341672dc0b9faf9d723db5f29..65450872c3b401d04e362d20c4808080d064e5da 100644 +index edde14392ef71ef8afb8615e5ed02b2d215cd4e4..562bf6fdb04e692e11f1089225d6c8923aba722e 100644 --- a/extensions/browser/api/web_request/extension_web_request_event_router.cc +++ b/extensions/browser/api/web_request/extension_web_request_event_router.cc -@@ -1325,6 +1325,7 @@ WebRequestEventRouter::OnAuthRequired(content::BrowserContext* browser_context, +@@ -1327,6 +1327,7 @@ WebRequestEventRouter::OnAuthRequired(content::BrowserContext* browser_context, *request)) { return AuthRequiredResponse::AUTH_REQUIRED_RESPONSE_NO_ACTION; } diff --git a/patches/google_apis-google_api_keys-inc.cc.patch b/patches/google_apis-google_api_keys-inc.cc.patch deleted file mode 100644 index f57b497238bb..000000000000 --- a/patches/google_apis-google_api_keys-inc.cc.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/google_apis/google_api_keys-inc.cc b/google_apis/google_api_keys-inc.cc -index a173c288c01fab3b1c9d3c6acafe1fb0050fcd8c..6998bc41f5289d4f68afbce2f97a0104388aaf93 100644 ---- a/google_apis/google_api_keys-inc.cc -+++ b/google_apis/google_api_keys-inc.cc -@@ -245,6 +245,7 @@ class APIKeyCache { - } - - const std::string& api_key() const { return api_key_; } -+ void set_api_key_for_testing(const std::string& api_key) { api_key_ = api_key; } - #if BUILDFLAG(SUPPORT_EXTERNAL_GOOGLE_API_KEY) - void set_api_key(const std::string& api_key) { api_key_ = api_key; } - #endif diff --git a/patches/ios-chrome-app-BUILD.gn.patch b/patches/ios-chrome-app-BUILD.gn.patch index 0a0938d5e1a6..7ff2fe725640 100644 --- a/patches/ios-chrome-app-BUILD.gn.patch +++ b/patches/ios-chrome-app-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/ios/chrome/app/BUILD.gn b/ios/chrome/app/BUILD.gn -index 110ebebe9d02608ffc1417092ee2677b53b465b3..f6b3fa6739e905239bbd49167dc050cdc0d56d38 100644 +index 2aa2d5b2ef8dafb1c490c72506c18c0be75749e0..dbe60e80a816090858f14d687427375a17e6ffef 100644 --- a/ios/chrome/app/BUILD.gn +++ b/ios/chrome/app/BUILD.gn -@@ -896,8 +896,7 @@ chrome_app("chrome") { +@@ -842,8 +842,7 @@ chrome_app("chrome") { # (see https://crbug.com/1394553 for details of the build failure). This # is a stop-gap solution. if (target_environment == "catalyst" || diff --git a/patches/ios-chrome-browser-flags-BUILD.gn.patch b/patches/ios-chrome-browser-flags-BUILD.gn.patch index b81c620a5f58..dd65aa12a3fe 100644 --- a/patches/ios-chrome-browser-flags-BUILD.gn.patch +++ b/patches/ios-chrome-browser-flags-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/ios/chrome/browser/flags/BUILD.gn b/ios/chrome/browser/flags/BUILD.gn -index 0ee67696782dfe93eac762be93fadcaac0d6b98f..060f73c44527dc17376c3bb3a23c3452bcc79f7e 100644 +index 50cd9e3f4e572f55e281760e5e04d914ec67f0a0..ff2d0cafcefe4cecde00ac417f7881aece55c365 100644 --- a/ios/chrome/browser/flags/BUILD.gn +++ b/ios/chrome/browser/flags/BUILD.gn -@@ -106,6 +106,7 @@ source_set("flags") { +@@ -108,6 +108,7 @@ source_set("flags") { if (ios_enable_screen_time) { deps += [ "//ios/chrome/browser/screen_time/model:feature_flags" ] } diff --git a/patches/ios-chrome-browser-flags-about_flags.mm.patch b/patches/ios-chrome-browser-flags-about_flags.mm.patch index d28cc66f1e0b..8333f6f2c381 100644 --- a/patches/ios-chrome-browser-flags-about_flags.mm.patch +++ b/patches/ios-chrome-browser-flags-about_flags.mm.patch @@ -1,8 +1,8 @@ diff --git a/ios/chrome/browser/flags/about_flags.mm b/ios/chrome/browser/flags/about_flags.mm -index 85e3c83260d3330ad72aad1562052b97f2b197b6..fc633a9f7cdf1ccbd8d140676ad5501bc9e8d8f2 100644 +index b0c5593997ca87d85407cf2a02c355e2fe3683c6..d26dfb9a57b055edc432e2f37478878ac1fa2a50 100644 --- a/ios/chrome/browser/flags/about_flags.mm +++ b/ios/chrome/browser/flags/about_flags.mm -@@ -1012,6 +1012,7 @@ const FeatureEntry::FeatureVariation kEphemeralCardRankerCardOverrideOptions[] = +@@ -1124,6 +1124,7 @@ const FeatureEntry::FeatureVariation kSendTabIOSPushNotificationsVariations[] = // // When adding a new choice, add it to the end of the list. const flags_ui::FeatureEntry kFeatureEntries[] = { diff --git a/patches/ios-chrome-browser-shared-model-prefs-BUILD.gn.patch b/patches/ios-chrome-browser-shared-model-prefs-BUILD.gn.patch index 70cc38186d89..d3ff69200bb6 100644 --- a/patches/ios-chrome-browser-shared-model-prefs-BUILD.gn.patch +++ b/patches/ios-chrome-browser-shared-model-prefs-BUILD.gn.patch @@ -1,11 +1,11 @@ diff --git a/ios/chrome/browser/shared/model/prefs/BUILD.gn b/ios/chrome/browser/shared/model/prefs/BUILD.gn -index f54fced81bb556a0a602afc66cd977096f453139..5eb8ce2c16f20ceba028d894ef98c31266835cf6 100644 +index 02e4f8f4b79d55dff15dd25ab78d014ffee86630..8f1b72aead71718ebfc1800268ab3fa2d9f13138 100644 --- a/ios/chrome/browser/shared/model/prefs/BUILD.gn +++ b/ios/chrome/browser/shared/model/prefs/BUILD.gn -@@ -128,6 +128,7 @@ source_set("browser_prefs") { - "//ios/web/common:features", - "//ui/base", - ] +@@ -140,6 +140,7 @@ source_set("browser_prefs") { + if (build_with_internal_optimization_guide) { + deps += [ "//components/optimization_guide/core:features" ] + } + import("//brave/chromium_src/ios/chrome/browser/shared/model/prefs/sources.gni") deps += brave_browser_prefs_deps } diff --git a/patches/ios-chrome-browser-shared-model-prefs-browser_prefs.mm.patch b/patches/ios-chrome-browser-shared-model-prefs-browser_prefs.mm.patch index aef8308a8d23..36e6c7b693fa 100644 --- a/patches/ios-chrome-browser-shared-model-prefs-browser_prefs.mm.patch +++ b/patches/ios-chrome-browser-shared-model-prefs-browser_prefs.mm.patch @@ -1,19 +1,19 @@ diff --git a/ios/chrome/browser/shared/model/prefs/browser_prefs.mm b/ios/chrome/browser/shared/model/prefs/browser_prefs.mm -index a1ea0b6a8d246371d1931258bd0d1d9151956091..0afd8bfb914fabb51970c4eb254bf355f710a9fa 100644 +index 9aafc20ca26d84604047661f0a5d0ee56363bec3..8da6a690fd25727e5a048464777c6db8779c3ee1 100644 --- a/ios/chrome/browser/shared/model/prefs/browser_prefs.mm +++ b/ios/chrome/browser/shared/model/prefs/browser_prefs.mm -@@ -712,6 +712,7 @@ void RegisterLocalStatePrefs(PrefRegistrySimple* registry) { - // List pref that stores the positions of the Safety Check module (with - // notifications opt-in) within the Magic Stack. - registry->RegisterListPref(prefs::kMagicStackSafetyCheckNotificationsShown); +@@ -778,6 +778,7 @@ void RegisterLocalStatePrefs(PrefRegistrySimple* registry) { + + registry->RegisterIntegerPref(prefs::kAddressBarSettingsNewBadgeShownCount, + 0); + BRAVE_REGISTER_LOCAL_STATE_PREFS } - void RegisterBrowserStatePrefs(user_prefs::PrefRegistrySyncable* registry) { -@@ -1053,6 +1054,7 @@ void RegisterBrowserStatePrefs(user_prefs::PrefRegistrySyncable* registry) { - registry->RegisterInt64Pref(kNtpShownBookmarksFolder, 3); - - registry->RegisterDictionaryPref(prefs::kIosPreRestoreAccountInfo); + void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { +@@ -1126,6 +1127,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { + registry->RegisterStringPref( + send_tab_to_self::prefs::kIOSSendTabToSelfLastReceivedTabURLPref, + std::string()); + BRAVE_REGISTER_BROWSER_STATE_PREFS } diff --git a/patches/ios-chrome-browser-sync-model-sync_service_factory.mm.patch b/patches/ios-chrome-browser-sync-model-sync_service_factory.mm.patch index 8b6a6a7772f6..0de17dad39c9 100644 --- a/patches/ios-chrome-browser-sync-model-sync_service_factory.mm.patch +++ b/patches/ios-chrome-browser-sync-model-sync_service_factory.mm.patch @@ -1,13 +1,13 @@ diff --git a/ios/chrome/browser/sync/model/sync_service_factory.mm b/ios/chrome/browser/sync/model/sync_service_factory.mm -index 85abb6a5525c550fdd27ea3edeba75d50807b62a..9cbb72fbcb7238c0e18ca082ad72f7f75d598372 100644 +index 95a9ef6fe58956e8b09bbf3c42a40da5cb9fceeb..d9571feeaad100399801eef256225e09b3effcb5 100644 --- a/ios/chrome/browser/sync/model/sync_service_factory.mm +++ b/ios/chrome/browser/sync/model/sync_service_factory.mm -@@ -199,7 +199,7 @@ std::unique_ptr BuildSyncService(web::BrowserState* context) { - init_params.debug_identifier = browser_state->GetProfileName(); +@@ -187,7 +187,7 @@ std::unique_ptr BuildSyncService(web::BrowserState* context) { + init_params.debug_identifier = profile->GetProfileName(); auto sync_service = - std::make_unique(std::move(init_params)); + BRAVE_BUILD_SERVICE_INSTANCE_FOR - sync_service->Initialize( - CreateControllers(browser_state, sync_service.get())); + sync_service->Initialize(CreateControllers(profile, sync_service.get())); + // TODO(crbug.com/40250371): Remove the workaround below once diff --git a/patches/net-BUILD.gn.patch b/patches/net-BUILD.gn.patch index 0c59aab67019..db605f857616 100644 --- a/patches/net-BUILD.gn.patch +++ b/patches/net-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/net/BUILD.gn b/net/BUILD.gn -index e229ec4c97bb6beeba509da8d1ab40be17d5992a..56b0227f35f7d48a35a9c4c6c9edb91bf11fd047 100644 +index a1d3a6dbf1eb623a22a6eb833bfcc770746e53c9..aad665d2e040630671d1837a017dc538629e3580 100644 --- a/net/BUILD.gn +++ b/net/BUILD.gn -@@ -1161,6 +1161,7 @@ component("net") { +@@ -1166,6 +1166,7 @@ component("net") { "reporting/reporting_uploader.h", ] } diff --git a/patches/net-cookies-canonical_cookie.cc.patch b/patches/net-cookies-canonical_cookie.cc.patch index 5358f86bcf16..a763fe2e1d02 100644 --- a/patches/net-cookies-canonical_cookie.cc.patch +++ b/patches/net-cookies-canonical_cookie.cc.patch @@ -1,5 +1,5 @@ diff --git a/net/cookies/canonical_cookie.cc b/net/cookies/canonical_cookie.cc -index 303640b1f24d01cb3fc666043ae968725c6d2b20..2e2390077d5409998f28e00b914b7d51e5e2e186 100644 +index 98dceafde0237192549d7fec50d68a33cd8f705b..057cda818013b222ce53f935e3c257f0b77afb7b 100644 --- a/net/cookies/canonical_cookie.cc +++ b/net/cookies/canonical_cookie.cc @@ -292,6 +292,7 @@ base::Time CanonicalCookie::ValidateAndAdjustExpiryDate( diff --git a/patches/net-http-transport_security_state.cc.patch b/patches/net-http-transport_security_state.cc.patch index ef37dcb27802..60c72748dc55 100644 --- a/patches/net-http-transport_security_state.cc.patch +++ b/patches/net-http-transport_security_state.cc.patch @@ -1,5 +1,5 @@ diff --git a/net/http/transport_security_state.cc b/net/http/transport_security_state.cc -index 141635e65b1c4e777491851fc0392c7737d8ebcd..200446bc457e697a89e4061d66a8826ad5aa4e7a 100644 +index 076af582136a0274ead2bdf2f1ddfb6de9c1b5ad..9a9298d68f367415a2f9abde0573ffd2cc5f5f23 100644 --- a/net/http/transport_security_state.cc +++ b/net/http/transport_security_state.cc @@ -248,6 +248,7 @@ TransportSecurityState::TransportSecurityState( diff --git a/patches/sandbox-policy-win-sandbox_win.cc.patch b/patches/sandbox-policy-win-sandbox_win.cc.patch index 1d6df8ab9e1f..10452fbb02c0 100644 --- a/patches/sandbox-policy-win-sandbox_win.cc.patch +++ b/patches/sandbox-policy-win-sandbox_win.cc.patch @@ -1,8 +1,8 @@ diff --git a/sandbox/policy/win/sandbox_win.cc b/sandbox/policy/win/sandbox_win.cc -index e6a3cd1e84b3b28c3ba9ef221257dd868f750558..26f2798e83ebf1ed4d88e8cbea8f75aef632ce19 100644 +index b550651a8a98132104d38df083717e1cb58567e4..3ba4f50a7092793f1d2e51782a8762034e15fd97 100644 --- a/sandbox/policy/win/sandbox_win.cc +++ b/sandbox/policy/win/sandbox_win.cc -@@ -709,6 +709,7 @@ ResultCode LaunchWithoutSandbox( +@@ -624,6 +624,7 @@ ResultCode LaunchWithoutSandbox( base::Process* process) { base::LaunchOptions options; options.handles_to_inherit = handles_to_inherit; diff --git a/patches/sandbox-win-BUILD.gn.patch b/patches/sandbox-win-BUILD.gn.patch index aeaabc4d26c9..0c452de0d9ab 100644 --- a/patches/sandbox-win-BUILD.gn.patch +++ b/patches/sandbox-win-BUILD.gn.patch @@ -1,5 +1,5 @@ diff --git a/sandbox/win/BUILD.gn b/sandbox/win/BUILD.gn -index 7f29a0cc2a57d2321100691245f1c0cb0341d9a2..d3390350b62d87047437c92cc05860543c066800 100644 +index a82eaae867e4afec6c4c2d610a7794257a30e1c1..c7295280516dfc2accd6061b6e62da9b190bc33a 100644 --- a/sandbox/win/BUILD.gn +++ b/sandbox/win/BUILD.gn @@ -179,6 +179,7 @@ static_library("sandbox") { diff --git a/patches/services-network-cors-cors_url_loader.cc.patch b/patches/services-network-cors-cors_url_loader.cc.patch index 025f32e1715e..3cee7ae75857 100644 --- a/patches/services-network-cors-cors_url_loader.cc.patch +++ b/patches/services-network-cors-cors_url_loader.cc.patch @@ -1,8 +1,8 @@ diff --git a/services/network/cors/cors_url_loader.cc b/services/network/cors/cors_url_loader.cc -index 7494f853fc5c64e110be441d19f7a5380a5a4d8f..74cd3ce6dd240aac1584eace39453a84588bee0c 100644 +index f39032f21f002b0c4c0159f552ecbb36ad9accdc..5d0422d0e22eddcffff0e4d03d66edf9a747e2b2 100644 --- a/services/network/cors/cors_url_loader.cc +++ b/services/network/cors/cors_url_loader.cc -@@ -896,6 +896,7 @@ void CorsURLLoader::StartRequest() { +@@ -904,6 +904,7 @@ void CorsURLLoader::StartRequest() { }; if (should_include_origin_header()) { diff --git a/patches/services-preferences-tracked-device_id_win.cc.patch b/patches/services-preferences-tracked-device_id_win.cc.patch index ccd671b7de8a..0f037b8fec3d 100644 --- a/patches/services-preferences-tracked-device_id_win.cc.patch +++ b/patches/services-preferences-tracked-device_id_win.cc.patch @@ -1,8 +1,8 @@ diff --git a/services/preferences/tracked/device_id_win.cc b/services/preferences/tracked/device_id_win.cc -index 48ce95f869c951e9d4d4b95df4bd54a6eab09311..6ed27513abc2915196f5990bf7169e2c95c5b8a0 100644 +index d59df0d9103fec697f27e1e4c5a34e33c64c0e18..e3e53553a4769783e54e86a95daff0aa0846a841 100644 --- a/services/preferences/tracked/device_id_win.cc +++ b/services/preferences/tracked/device_id_win.cc -@@ -14,6 +14,7 @@ +@@ -15,6 +15,7 @@ MachineIdStatus GetDeterministicMachineSpecificId(std::string* machine_id) { DCHECK(machine_id); diff --git a/patches/third_party-blink-common-permissions-permission_utils.cc.patch b/patches/third_party-blink-common-permissions-permission_utils.cc.patch index 378a31cbc20c..1b54300ba64d 100644 --- a/patches/third_party-blink-common-permissions-permission_utils.cc.patch +++ b/patches/third_party-blink-common-permissions-permission_utils.cc.patch @@ -1,5 +1,5 @@ diff --git a/third_party/blink/common/permissions/permission_utils.cc b/third_party/blink/common/permissions/permission_utils.cc -index 0aa40dfe497454424d7fd410e7e9ee8d6227ecd1..eb08c07ed1fe201f6bd3947d7b0903b1dbcf3e9a 100644 +index a07a4383185b065f884b840a3867efd7517cc33e..4dc7ae3001b8c7192bf1aebeef1a6ced3b49d04d 100644 --- a/third_party/blink/common/permissions/permission_utils.cc +++ b/third_party/blink/common/permissions/permission_utils.cc @@ -28,6 +28,7 @@ mojom::PermissionStatus ToPermissionStatus(const std::string& status) { diff --git a/patches/third_party-blink-public-mojom-BUILD.gn.patch b/patches/third_party-blink-public-mojom-BUILD.gn.patch index bafe1d01d275..44b8eb83f3b8 100644 --- a/patches/third_party-blink-public-mojom-BUILD.gn.patch +++ b/patches/third_party-blink-public-mojom-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/third_party/blink/public/mojom/BUILD.gn b/third_party/blink/public/mojom/BUILD.gn -index 370568de1b0259186921806818bde2400af0fab2..f4a62ae60faf1f50f4d131c61dcaca47d7e25a8b 100644 +index df2d713d0dd8b7fd998112c245a294f46986c716..4c5b900c4dbcd2c69995728c0affe12e7c6a014b 100644 --- a/third_party/blink/public/mojom/BUILD.gn +++ b/third_party/blink/public/mojom/BUILD.gn -@@ -1143,6 +1143,7 @@ mojom("mojom_platform") { +@@ -1144,6 +1144,7 @@ mojom("mojom_platform") { ] cpp_typemaps += shared_cpp_typemaps blink_cpp_typemaps += shared_cpp_typemaps diff --git a/patches/third_party-blink-renderer-bindings-generated_in_modules.gni.patch b/patches/third_party-blink-renderer-bindings-generated_in_modules.gni.patch index eb43a0424b76..6cb5531315a0 100644 --- a/patches/third_party-blink-renderer-bindings-generated_in_modules.gni.patch +++ b/patches/third_party-blink-renderer-bindings-generated_in_modules.gni.patch @@ -1,8 +1,8 @@ diff --git a/third_party/blink/renderer/bindings/generated_in_modules.gni b/third_party/blink/renderer/bindings/generated_in_modules.gni -index 38090961ab13a8da6dd324bd90e86fc7b8861dbc..05c80a21415e074724f11e391ff630d1ef88726b 100644 +index 15af06b7cad54f4889a479faf4e57c308c29833f..5618bdb056a3672229ac7e0cec114639564d6f0b 100644 --- a/third_party/blink/renderer/bindings/generated_in_modules.gni +++ b/third_party/blink/renderer/bindings/generated_in_modules.gni -@@ -3093,6 +3093,7 @@ generated_interface_sources_in_modules = [ +@@ -3113,6 +3113,7 @@ generated_interface_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_webgl_sub_image.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_webgl_sub_image.h", ] diff --git a/patches/third_party-blink-renderer-bindings-idl_in_modules.gni.patch b/patches/third_party-blink-renderer-bindings-idl_in_modules.gni.patch index 1d5fe3b85aeb..2b97e36fcc09 100644 --- a/patches/third_party-blink-renderer-bindings-idl_in_modules.gni.patch +++ b/patches/third_party-blink-renderer-bindings-idl_in_modules.gni.patch @@ -1,8 +1,8 @@ diff --git a/third_party/blink/renderer/bindings/idl_in_modules.gni b/third_party/blink/renderer/bindings/idl_in_modules.gni -index b4548d4bd436f736e29c0bf0c539bf786255acf2..2b48daaaf22b61bdae2ba79739f713c5db9a6e96 100644 +index ad1f7656cd880c5542347c8b993fc63ebd75bf7b..37e9eeba2e4bde4fbe67cff881b8e6ae54f72b58 100644 --- a/third_party/blink/renderer/bindings/idl_in_modules.gni +++ b/third_party/blink/renderer/bindings/idl_in_modules.gni -@@ -1268,6 +1268,7 @@ static_idl_files_in_modules = [ +@@ -1273,6 +1273,7 @@ static_idl_files_in_modules = [ "//third_party/blink/renderer/modules/xr/xr_webgl_layer_init.idl", "//third_party/blink/renderer/modules/xr/xr_webgl_sub_image.idl", ] diff --git a/patches/third_party-blink-renderer-bindings-scripts-bind_gen-interface.py.patch b/patches/third_party-blink-renderer-bindings-scripts-bind_gen-interface.py.patch index 3cef677eff02..a9103b12e83a 100644 --- a/patches/third_party-blink-renderer-bindings-scripts-bind_gen-interface.py.patch +++ b/patches/third_party-blink-renderer-bindings-scripts-bind_gen-interface.py.patch @@ -1,8 +1,8 @@ diff --git a/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py b/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py -index d25512891f4bc7946b4921e095a10303b9553a0b..2d327c1dd960033e35bff13cefe2fd0695a859e2 100644 +index 47d3936572d2cb9f9a3fca877db8218ad5a41022..db252dba64401f036a53ab9e0b36e4b7d991544e 100644 --- a/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py +++ b/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py -@@ -7644,3 +7644,4 @@ def generate_interfaces(task_queue): +@@ -7661,3 +7661,4 @@ def generate_interfaces(task_queue): "InitIDLInterfacesForTesting", "init_idl_interfaces_for_testing", for_testing=True) diff --git a/patches/third_party-blink-renderer-bindings-scripts-web_idl-idl_compiler.py.patch b/patches/third_party-blink-renderer-bindings-scripts-web_idl-idl_compiler.py.patch index f7af81f720e0..8b2a4a9027b9 100644 --- a/patches/third_party-blink-renderer-bindings-scripts-web_idl-idl_compiler.py.patch +++ b/patches/third_party-blink-renderer-bindings-scripts-web_idl-idl_compiler.py.patch @@ -1,8 +1,8 @@ diff --git a/third_party/blink/renderer/bindings/scripts/web_idl/idl_compiler.py b/third_party/blink/renderer/bindings/scripts/web_idl/idl_compiler.py -index 16694489cb652bc31587ed084c99d26f2f87d58a..b8a7ee4559cfd01abd0afd2b8f5f488bf37b2a63 100644 +index 3f723def6e4d2851fe58a928ed979c3284b53a0f..28c9ff0507734d6f6eec1977e2fc673d80a8627f 100644 --- a/third_party/blink/renderer/bindings/scripts/web_idl/idl_compiler.py +++ b/third_party/blink/renderer/bindings/scripts/web_idl/idl_compiler.py -@@ -1256,3 +1256,4 @@ class IdlCompiler(object): +@@ -1259,3 +1259,4 @@ class IdlCompiler(object): # the root. if old_ir.inherited is None: next_tag = assign_tags_for_tree(old_ir, next_tag) diff --git a/patches/third_party-blink-renderer-core-BUILD.gn.patch b/patches/third_party-blink-renderer-core-BUILD.gn.patch index 7bc1a7dd21b3..45e9062b7698 100644 --- a/patches/third_party-blink-renderer-core-BUILD.gn.patch +++ b/patches/third_party-blink-renderer-core-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/third_party/blink/renderer/core/BUILD.gn b/third_party/blink/renderer/core/BUILD.gn -index d6bdf90cc367cfd2dd8a6bea596593384bcde9d9..f60504ac263cc147ef39ceffc67e6b008dcf3a26 100644 +index c73b33c834353abcf2f209d5a2ee79f76e701e7d..9df289a143d66915be6fa1a8a10b970b6f7abb19 100644 --- a/third_party/blink/renderer/core/BUILD.gn +++ b/third_party/blink/renderer/core/BUILD.gn -@@ -431,6 +431,7 @@ component("core") { +@@ -432,6 +432,7 @@ component("core") { "Carbon.framework", ] } diff --git a/patches/third_party-blink-renderer-core-dom-events-event_target.cc.patch b/patches/third_party-blink-renderer-core-dom-events-event_target.cc.patch index bed529baeaa2..ea9c535cdd6e 100644 --- a/patches/third_party-blink-renderer-core-dom-events-event_target.cc.patch +++ b/patches/third_party-blink-renderer-core-dom-events-event_target.cc.patch @@ -1,8 +1,8 @@ diff --git a/third_party/blink/renderer/core/dom/events/event_target.cc b/third_party/blink/renderer/core/dom/events/event_target.cc -index e68a01cf08c039e3421f663e9e5cedbad61c4d84..f02ef337fc037b3a92c337992142a69adbd1469b 100644 +index b3063321e4ab0e132b4d5d149760e51ada707870..3d42a7780577e064141268399aced59a7dca7ce3 100644 --- a/third_party/blink/renderer/core/dom/events/event_target.cc +++ b/third_party/blink/renderer/core/dom/events/event_target.cc -@@ -648,6 +648,7 @@ bool EventTarget::AddEventListenerInternal( +@@ -647,6 +647,7 @@ bool EventTarget::AddEventListenerInternal( event_type, listener, options, ®istered_listener); if (added) { CHECK(registered_listener); @@ -10,7 +10,7 @@ index e68a01cf08c039e3421f663e9e5cedbad61c4d84..f02ef337fc037b3a92c337992142a69a if (options->hasSignal()) { // Instead of passing the entire |options| here, which could create a // circular reference due to |options| holding a Member, just -@@ -832,6 +833,7 @@ bool EventTarget::RemoveEventListenerInternal( +@@ -831,6 +832,7 @@ bool EventTarget::RemoveEventListenerInternal( ®istered_listener)) { return false; } diff --git a/patches/third_party-blink-renderer-core-frame-dom_window.h.patch b/patches/third_party-blink-renderer-core-frame-dom_window.h.patch index 4f5cb40cbc8c..3985813f2165 100644 --- a/patches/third_party-blink-renderer-core-frame-dom_window.h.patch +++ b/patches/third_party-blink-renderer-core-frame-dom_window.h.patch @@ -1,8 +1,8 @@ diff --git a/third_party/blink/renderer/core/frame/dom_window.h b/third_party/blink/renderer/core/frame/dom_window.h -index 0225048d6c1b38191537c7dd22defa39c5d2620c..afd9f04a505420bfde40024c5b6c46425a9e2229 100644 +index e4213a14a2cb81934886aa1e829f8ba38aa824ed..a164a909fbbc16475579d8e0636e30a6b1da3b28 100644 --- a/third_party/blink/renderer/core/frame/dom_window.h +++ b/third_party/blink/renderer/core/frame/dom_window.h -@@ -200,6 +200,7 @@ class CORE_EXPORT DOMWindow : public WindowProperties { +@@ -201,6 +201,7 @@ class CORE_EXPORT DOMWindow : public WindowProperties { void DisconnectFromFrame() { frame_ = nullptr; } diff --git a/patches/third_party-blink-renderer-core-frame-local_dom_window.cc.patch b/patches/third_party-blink-renderer-core-frame-local_dom_window.cc.patch index 97ba22e234aa..b3a94434ca3d 100644 --- a/patches/third_party-blink-renderer-core-frame-local_dom_window.cc.patch +++ b/patches/third_party-blink-renderer-core-frame-local_dom_window.cc.patch @@ -1,8 +1,8 @@ diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc -index fe3c23e1dd1c818b5cb07a609dbbf17763c6d583..db5284ade4b4a7089ea787a9e96e51e68b0dbede 100644 +index de0c2fab54859901352196a2e8de48d4b49e5056..7d1b611700321725abb2e0bf45b000f7ea0058fd 100644 --- a/third_party/blink/renderer/core/frame/local_dom_window.cc +++ b/third_party/blink/renderer/core/frame/local_dom_window.cc -@@ -488,6 +488,7 @@ bool LocalDOMWindow::CanExecuteScripts( +@@ -487,6 +487,7 @@ bool LocalDOMWindow::CanExecuteScripts( return false; } bool script_enabled = GetFrame()->ScriptEnabled(); diff --git a/patches/third_party-blink-renderer-core-html-canvas-html_canvas_element.cc.patch b/patches/third_party-blink-renderer-core-html-canvas-html_canvas_element.cc.patch index 9b38f1cd7240..27027ec1d180 100644 --- a/patches/third_party-blink-renderer-core-html-canvas-html_canvas_element.cc.patch +++ b/patches/third_party-blink-renderer-core-html-canvas-html_canvas_element.cc.patch @@ -1,8 +1,8 @@ diff --git a/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc b/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc -index 03adc55524d7edf35ee9e37f9a3483bc13990e33..1d567daf56d9aa1dd0b334b6c59168b93ccbf2c1 100644 +index bcec28a2a8bd050f714840d9c791694abbab2a23..9b9d24309fca6c46f61c1d7524a821c9d78c6101 100644 --- a/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc +++ b/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc -@@ -1136,6 +1136,7 @@ String HTMLCanvasElement::ToDataURLInternal( +@@ -1180,6 +1180,7 @@ String HTMLCanvasElement::ToDataURLInternal( if (!data_buffer) return String("data:,"); diff --git a/patches/third_party-blink-renderer-core-html-canvas-html_canvas_element.h.patch b/patches/third_party-blink-renderer-core-html-canvas-html_canvas_element.h.patch index f0068877fd4a..611c804015c8 100644 --- a/patches/third_party-blink-renderer-core-html-canvas-html_canvas_element.h.patch +++ b/patches/third_party-blink-renderer-core-html-canvas-html_canvas_element.h.patch @@ -1,8 +1,8 @@ diff --git a/third_party/blink/renderer/core/html/canvas/html_canvas_element.h b/third_party/blink/renderer/core/html/canvas/html_canvas_element.h -index 579277cff3b7cd2255cd0d8532bd86d649b20b21..26c717e7b97eac9fa52d32fc265cccfb6d90822e 100644 +index e2d64fb8f7f16975fde11838f420ed4ea4d76ec9..931fb438f4392274759794edcbabf39955fa107b 100644 --- a/third_party/blink/renderer/core/html/canvas/html_canvas_element.h +++ b/third_party/blink/renderer/core/html/canvas/html_canvas_element.h -@@ -320,6 +320,7 @@ class CORE_EXPORT HTMLCanvasElement final +@@ -323,6 +323,7 @@ class CORE_EXPORT HTMLCanvasElement final bool ShouldDisableAccelerationBecauseOfReadback() const; diff --git a/patches/third_party-blink-renderer-core-loader-frame_fetch_context.cc.patch b/patches/third_party-blink-renderer-core-loader-frame_fetch_context.cc.patch index a6939c07a0d2..6f568f95c724 100644 --- a/patches/third_party-blink-renderer-core-loader-frame_fetch_context.cc.patch +++ b/patches/third_party-blink-renderer-core-loader-frame_fetch_context.cc.patch @@ -1,5 +1,5 @@ diff --git a/third_party/blink/renderer/core/loader/frame_fetch_context.cc b/third_party/blink/renderer/core/loader/frame_fetch_context.cc -index 60c95eae422cee677442f6c6701a420a948bcff2..3de14851a5211f14db237edead52c85b5034efc9 100644 +index ad6f558e99a86afd074cf3e87183cf9478ee80ac..fde090894f2b39a50c47a4f22f368529a2de6298 100644 --- a/third_party/blink/renderer/core/loader/frame_fetch_context.cc +++ b/third_party/blink/renderer/core/loader/frame_fetch_context.cc @@ -520,6 +520,7 @@ void FrameFetchContext::AddClientHintsIfNecessary( diff --git a/patches/third_party-blink-renderer-core-loader-mixed_content_checker.cc.patch b/patches/third_party-blink-renderer-core-loader-mixed_content_checker.cc.patch index 4889adbb75b0..0f067e3e241f 100644 --- a/patches/third_party-blink-renderer-core-loader-mixed_content_checker.cc.patch +++ b/patches/third_party-blink-renderer-core-loader-mixed_content_checker.cc.patch @@ -1,5 +1,5 @@ diff --git a/third_party/blink/renderer/core/loader/mixed_content_checker.cc b/third_party/blink/renderer/core/loader/mixed_content_checker.cc -index 9e70370d36cdbce31457e1f1de41a356a4339359..bb54950f284f65e4ebca15c0966804d80e25b800 100644 +index 7e3ab3119f1227244f611d92e92fd5f58863ca32..b9690eae6b1c86e7745906b3a05bdec647280a66 100644 --- a/third_party/blink/renderer/core/loader/mixed_content_checker.cc +++ b/third_party/blink/renderer/core/loader/mixed_content_checker.cc @@ -274,6 +274,7 @@ bool RequestIsSubframeSubresource(Frame* frame) { diff --git a/patches/third_party-blink-renderer-core-loader-modulescript-module_script_loader.cc.patch b/patches/third_party-blink-renderer-core-loader-modulescript-module_script_loader.cc.patch index 718b4a58a37d..b696e771fc83 100644 --- a/patches/third_party-blink-renderer-core-loader-modulescript-module_script_loader.cc.patch +++ b/patches/third_party-blink-renderer-core-loader-modulescript-module_script_loader.cc.patch @@ -1,8 +1,8 @@ diff --git a/third_party/blink/renderer/core/loader/modulescript/module_script_loader.cc b/third_party/blink/renderer/core/loader/modulescript/module_script_loader.cc -index 9fad30c7c554ebfd12f2919eaf91dbd7e9334d77..f65a3286e5e1f54202fcc54d89e0e87297637430 100644 +index 3a84102a3f5436354fd3ac9ea6002f0b25b4df93..5dba96adf42c1db3fa48a50cc3bb87032cc69b73 100644 --- a/third_party/blink/renderer/core/loader/modulescript/module_script_loader.cc +++ b/third_party/blink/renderer/core/loader/modulescript/module_script_loader.cc -@@ -181,6 +181,7 @@ void ModuleScriptLoader::FetchInternal( +@@ -189,6 +189,7 @@ void ModuleScriptLoader::FetchInternal( options.initiator_info.referrer = module_request.ReferrerString(); options.initiator_info.position = module_request.GetReferrerPosition(); } diff --git a/patches/third_party-blink-renderer-core-loader-modulescript-module_tree_linker.cc.patch b/patches/third_party-blink-renderer-core-loader-modulescript-module_tree_linker.cc.patch index df5072fdb655..17b29a876e3b 100644 --- a/patches/third_party-blink-renderer-core-loader-modulescript-module_tree_linker.cc.patch +++ b/patches/third_party-blink-renderer-core-loader-modulescript-module_tree_linker.cc.patch @@ -1,8 +1,8 @@ diff --git a/third_party/blink/renderer/core/loader/modulescript/module_tree_linker.cc b/third_party/blink/renderer/core/loader/modulescript/module_tree_linker.cc -index ce143009784bed6df938aac4c150d580fe28d1dc..ac6c819091b152c1852f7b9c7a0240765c2531be 100644 +index 03d95aa708f754f4ca1e6b9b72bcb33c959240dc..cc70204e50976986315da02fe948f63ef7d2793f 100644 --- a/third_party/blink/renderer/core/loader/modulescript/module_tree_linker.cc +++ b/third_party/blink/renderer/core/loader/modulescript/module_tree_linker.cc -@@ -449,6 +449,7 @@ void ModuleTreeLinker::FetchDescendants(const ModuleScript* module_script) { +@@ -455,6 +455,7 @@ void ModuleTreeLinker::FetchDescendants(const ModuleScript* module_script) { module_script->FetchOptions().GetReferrerPolicy(), mojom::blink::FetchPriorityHint::kAuto, RenderBlockingBehavior::kNonBlocking); diff --git a/patches/third_party-blink-renderer-core-permissions_policy-permissions_policy_features.json5.patch b/patches/third_party-blink-renderer-core-permissions_policy-permissions_policy_features.json5.patch index 8cde1a4866bd..ee799ca0cbd9 100644 --- a/patches/third_party-blink-renderer-core-permissions_policy-permissions_policy_features.json5.patch +++ b/patches/third_party-blink-renderer-core-permissions_policy-permissions_policy_features.json5.patch @@ -1,8 +1,8 @@ diff --git a/third_party/blink/renderer/core/permissions_policy/permissions_policy_features.json5 b/third_party/blink/renderer/core/permissions_policy/permissions_policy_features.json5 -index 71ca06d056d951c0417e8ead1803def8a810d856..4db48d4b5517ce53eb59b045f7c8fa771a68df40 100644 +index 7026bbc1106a82b5efd770c8e2f900be949f33a2..f65fa40aa66fc51ddad85509bc595de68dcbbca5 100644 --- a/third_party/blink/renderer/core/permissions_policy/permissions_policy_features.json5 +++ b/third_party/blink/renderer/core/permissions_policy/permissions_policy_features.json5 -@@ -508,5 +508,13 @@ +@@ -514,5 +514,13 @@ name: "WindowManagement", permissions_policy_name: "window-management", }, diff --git a/patches/third_party-blink-renderer-core-script-dynamic_module_resolver.cc.patch b/patches/third_party-blink-renderer-core-script-dynamic_module_resolver.cc.patch index 42eddd0120a9..092f1dd8dc59 100644 --- a/patches/third_party-blink-renderer-core-script-dynamic_module_resolver.cc.patch +++ b/patches/third_party-blink-renderer-core-script-dynamic_module_resolver.cc.patch @@ -1,5 +1,5 @@ diff --git a/third_party/blink/renderer/core/script/dynamic_module_resolver.cc b/third_party/blink/renderer/core/script/dynamic_module_resolver.cc -index 8422194a98113822d160b134e53bdca7c634ab03..bb1534afc87f8656a9212c29ff5da8c724d18086 100644 +index c1594f238ea0513f20039a6b3ae47f330200fb80..34d41aba1b1bbc4f9bee9ba1d23f3c446b1e9374 100644 --- a/third_party/blink/renderer/core/script/dynamic_module_resolver.cc +++ b/third_party/blink/renderer/core/script/dynamic_module_resolver.cc @@ -288,6 +288,7 @@ void DynamicModuleResolver::ResolveDynamically( diff --git a/patches/third_party-blink-renderer-core-script-script_loader.cc.patch b/patches/third_party-blink-renderer-core-script-script_loader.cc.patch index ce1fc36bb3f4..6a501f93dc09 100644 --- a/patches/third_party-blink-renderer-core-script-script_loader.cc.patch +++ b/patches/third_party-blink-renderer-core-script-script_loader.cc.patch @@ -1,8 +1,8 @@ diff --git a/third_party/blink/renderer/core/script/script_loader.cc b/third_party/blink/renderer/core/script/script_loader.cc -index af40bd6fa6245d22af424072b43f5ce05f224eb4..a9ae22e25324a305b8521ce86edfe2b4982310d7 100644 +index 0bc4bf74215dc8b4c7d7e86404266d5fcf44cd04..d0b5e3635b9888a215ddf512be147494d39949eb 100644 --- a/third_party/blink/renderer/core/script/script_loader.cc +++ b/third_party/blink/renderer/core/script/script_loader.cc -@@ -756,6 +756,7 @@ PendingScript* ScriptLoader::PrepareScript( +@@ -786,6 +786,7 @@ PendingScript* ScriptLoader::PrepareScript( parser_state, credentials_mode, referrer_policy, fetch_priority_hint, render_blocking_behavior, RejectCoepUnsafeNone(false)); diff --git a/patches/third_party-blink-renderer-modules-BUILD.gn.patch b/patches/third_party-blink-renderer-modules-BUILD.gn.patch index f1f28a36df76..216253ff1d98 100644 --- a/patches/third_party-blink-renderer-modules-BUILD.gn.patch +++ b/patches/third_party-blink-renderer-modules-BUILD.gn.patch @@ -1,5 +1,5 @@ diff --git a/third_party/blink/renderer/modules/BUILD.gn b/third_party/blink/renderer/modules/BUILD.gn -index c5bd977747bcdb03320dabe554c62010a654afe1..1c5654141afdc24c195a6382148861e8b46b8e68 100644 +index fbce10f17160d4cd0bc61c3dc486434aaba10763..0c42e3cf9f71641869a36e8e438b22eefc9c4c8e 100644 --- a/third_party/blink/renderer/modules/BUILD.gn +++ b/third_party/blink/renderer/modules/BUILD.gn @@ -20,6 +20,7 @@ if (is_ios) { diff --git a/patches/third_party-blink-renderer-modules-canvas-canvas2d-base_rendering_context_2d.cc.patch b/patches/third_party-blink-renderer-modules-canvas-canvas2d-base_rendering_context_2d.cc.patch index 8c5f78b1d2fc..98bde60a6ca5 100644 --- a/patches/third_party-blink-renderer-modules-canvas-canvas2d-base_rendering_context_2d.cc.patch +++ b/patches/third_party-blink-renderer-modules-canvas-canvas2d-base_rendering_context_2d.cc.patch @@ -1,8 +1,8 @@ diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc b/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc -index 08cc3b5719df276d8fb27f59e6f28a26ee80890f..1c3772f37e2025f27b8db9d7e347bcbf4a794c03 100644 +index 4c84fe3d2dacfe8c5981e23e9383e9cbaf4cb5fe..9e6e18311a3f0b9150ec27c81de944d0461f1c56 100644 --- a/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc +++ b/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc -@@ -2740,6 +2740,7 @@ ImageData* BaseRenderingContext2D::getImageData( +@@ -2756,6 +2756,7 @@ ImageData* BaseRenderingContext2D::getImageData( perfetto::EventContext GetEventContext(); ImageData* BaseRenderingContext2D::getImageDataInternal( @@ -10,7 +10,7 @@ index 08cc3b5719df276d8fb27f59e6f28a26ee80890f..1c3772f37e2025f27b8db9d7e347bcbf int sx, int sy, int sw, -@@ -2913,6 +2914,7 @@ ImageData* BaseRenderingContext2D::getImageDataInternal( +@@ -2929,6 +2930,7 @@ ImageData* BaseRenderingContext2D::getImageDataInternal( DCHECK(!bounds.intersect(SkIRect::MakeXYWH(sx, sy, sw, sh))); } } @@ -18,7 +18,7 @@ index 08cc3b5719df276d8fb27f59e6f28a26ee80890f..1c3772f37e2025f27b8db9d7e347bcbf return image_data; } -@@ -3583,6 +3585,7 @@ TextMetrics* BaseRenderingContext2D::measureText(const String& text) { +@@ -3609,6 +3611,7 @@ TextMetrics* BaseRenderingContext2D::measureText(const String& text) { return MakeGarbageCollected(); } diff --git a/patches/third_party-blink-renderer-modules-canvas-offscreencanvas2d-offscreen_canvas_rendering_context_2d.idl.patch b/patches/third_party-blink-renderer-modules-canvas-offscreencanvas2d-offscreen_canvas_rendering_context_2d.idl.patch index 0a7d250c1fb7..25b84b67c2be 100644 --- a/patches/third_party-blink-renderer-modules-canvas-offscreencanvas2d-offscreen_canvas_rendering_context_2d.idl.patch +++ b/patches/third_party-blink-renderer-modules-canvas-offscreencanvas2d-offscreen_canvas_rendering_context_2d.idl.patch @@ -1,5 +1,5 @@ diff --git a/third_party/blink/renderer/modules/canvas/offscreencanvas2d/offscreen_canvas_rendering_context_2d.idl b/third_party/blink/renderer/modules/canvas/offscreencanvas2d/offscreen_canvas_rendering_context_2d.idl -index f4d298fe9122382e26d4c730b47d39ee36f5fe59..b0fcc25364d499f40c5d8e86ddabbdd05c92daf5 100644 +index 95017bc0b50ac339ca10c2525e1e29b242c39f16..e349d279ef5b389aa296ad2ec6bedfad20587413 100644 --- a/third_party/blink/renderer/modules/canvas/offscreencanvas2d/offscreen_canvas_rendering_context_2d.idl +++ b/third_party/blink/renderer/modules/canvas/offscreencanvas2d/offscreen_canvas_rendering_context_2d.idl @@ -67,10 +67,10 @@ diff --git a/patches/third_party-blink-renderer-modules-mediastream-media_devices.cc.patch b/patches/third_party-blink-renderer-modules-mediastream-media_devices.cc.patch index 9968aec6cff9..2db5359c2bb5 100644 --- a/patches/third_party-blink-renderer-modules-mediastream-media_devices.cc.patch +++ b/patches/third_party-blink-renderer-modules-mediastream-media_devices.cc.patch @@ -1,12 +1,12 @@ diff --git a/third_party/blink/renderer/modules/mediastream/media_devices.cc b/third_party/blink/renderer/modules/mediastream/media_devices.cc -index afe985fdadc4741829600838c74a503dddb0c687..c5d78cf378522176f96c32fdb1ca955cb2068d6d 100644 +index 53a58c78e207c6611c702a3acde3bc54fc645a8f..bae0882d6aa4f3ba1f6d49d4f405428a4286df31 100644 --- a/third_party/blink/renderer/modules/mediastream/media_devices.cc +++ b/third_party/blink/renderer/modules/mediastream/media_devices.cc -@@ -1161,6 +1161,7 @@ void MediaDevices::DevicesEnumerated( +@@ -1176,6 +1176,7 @@ void MediaDevices::DevicesEnumerated( } } + BRAVE_MEDIA_DEVICES_DEVICES_ENUMERATED RecordEnumeratedDevices(result_tracker->GetScriptState(), media_devices); result_tracker->Resolve(media_devices); - } + tracer->End(); diff --git a/patches/third_party-blink-renderer-modules-webgl-webgl2_rendering_context_base.cc.patch b/patches/third_party-blink-renderer-modules-webgl-webgl2_rendering_context_base.cc.patch index f9fe7ed8b0c6..54ca59369827 100644 --- a/patches/third_party-blink-renderer-modules-webgl-webgl2_rendering_context_base.cc.patch +++ b/patches/third_party-blink-renderer-modules-webgl-webgl2_rendering_context_base.cc.patch @@ -1,8 +1,8 @@ diff --git a/third_party/blink/renderer/modules/webgl/webgl2_rendering_context_base.cc b/third_party/blink/renderer/modules/webgl/webgl2_rendering_context_base.cc -index 0fc8eecb684bb28588c29945d26246e45b813ca1..97fd18039ff9040610dfe0102ac7db9575ed0e27 100644 +index dc9f855712328b785d14f3d205a07073bbe80fd9..a7b3206178615ec680709707ef3ffcfabc9a5256 100644 --- a/third_party/blink/renderer/modules/webgl/webgl2_rendering_context_base.cc +++ b/third_party/blink/renderer/modules/webgl/webgl2_rendering_context_base.cc -@@ -4796,6 +4796,7 @@ ScriptValue WebGL2RenderingContextBase::getParameter(ScriptState* script_state, +@@ -4797,6 +4797,7 @@ ScriptValue WebGL2RenderingContextBase::getParameter(ScriptState* script_state, GLenum pname) { if (isContextLost()) return ScriptValue::CreateNull(script_state->GetIsolate()); @@ -10,7 +10,7 @@ index 0fc8eecb684bb28588c29945d26246e45b813ca1..97fd18039ff9040610dfe0102ac7db95 switch (pname) { case GL_SHADING_LANGUAGE_VERSION: { return WebGLAny( -@@ -5408,6 +5409,7 @@ ScriptValue WebGL2RenderingContextBase::getFramebufferAttachmentParameter( +@@ -5409,6 +5410,7 @@ ScriptValue WebGL2RenderingContextBase::getFramebufferAttachmentParameter( if (isContextLost() || !ValidateGetFramebufferAttachmentParameterFunc( kFunctionName, target, attachment)) return ScriptValue::CreateNull(script_state->GetIsolate()); @@ -18,7 +18,7 @@ index 0fc8eecb684bb28588c29945d26246e45b813ca1..97fd18039ff9040610dfe0102ac7db95 WebGLFramebuffer* framebuffer_binding = GetFramebufferBinding(target); DCHECK(!framebuffer_binding || framebuffer_binding->Object()); -@@ -5626,6 +5628,7 @@ ScriptValue WebGL2RenderingContextBase::getTexParameter( +@@ -5627,6 +5629,7 @@ ScriptValue WebGL2RenderingContextBase::getTexParameter( GLenum pname) { if (isContextLost() || !ValidateTextureBinding("getTexParameter", target)) return ScriptValue::CreateNull(script_state->GetIsolate()); diff --git a/patches/third_party-blink-renderer-modules-webgl-webgl_rendering_context_base.cc.patch b/patches/third_party-blink-renderer-modules-webgl-webgl_rendering_context_base.cc.patch index 4f7066d07ab8..6e99b59ba47d 100644 --- a/patches/third_party-blink-renderer-modules-webgl-webgl_rendering_context_base.cc.patch +++ b/patches/third_party-blink-renderer-modules-webgl-webgl_rendering_context_base.cc.patch @@ -1,8 +1,8 @@ diff --git a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc -index 4f2067d37ed743e09cbfe1fb58189c8b2c3700b0..7b09e82e5cf286e0bae1f1324b55907231a7ae80 100644 +index 1d11d87b1086f7496d0e31ded5d6294213bfb3d1..900460c8383bd68858d2c83240e7f5d6c92c9671 100644 --- a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc +++ b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc -@@ -3181,6 +3181,7 @@ WebGLActiveInfo* WebGLRenderingContextBase::getActiveAttrib( +@@ -3197,6 +3197,7 @@ WebGLActiveInfo* WebGLRenderingContextBase::getActiveAttrib( GLuint index) { if (!ValidateWebGLProgramOrShader("getActiveAttrib", program)) return nullptr; @@ -10,7 +10,7 @@ index 4f2067d37ed743e09cbfe1fb58189c8b2c3700b0..7b09e82e5cf286e0bae1f1324b559072 GLuint program_id = ObjectNonZero(program); GLint max_name_length = -1; ContextGL()->GetProgramiv(program_id, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, -@@ -3212,6 +3213,7 @@ WebGLActiveInfo* WebGLRenderingContextBase::getActiveUniform( +@@ -3228,6 +3229,7 @@ WebGLActiveInfo* WebGLRenderingContextBase::getActiveUniform( GLuint index) { if (!ValidateWebGLProgramOrShader("getActiveUniform", program)) return nullptr; @@ -18,7 +18,7 @@ index 4f2067d37ed743e09cbfe1fb58189c8b2c3700b0..7b09e82e5cf286e0bae1f1324b559072 GLuint program_id = ObjectNonZero(program); GLint max_name_length = -1; ContextGL()->GetProgramiv(program_id, GL_ACTIVE_UNIFORM_MAX_LENGTH, -@@ -3242,6 +3244,7 @@ std::optional>> +@@ -3258,6 +3260,7 @@ std::optional>> WebGLRenderingContextBase::getAttachedShaders(WebGLProgram* program) { if (!ValidateWebGLProgramOrShader("getAttachedShaders", program)) return std::nullopt; @@ -26,7 +26,7 @@ index 4f2067d37ed743e09cbfe1fb58189c8b2c3700b0..7b09e82e5cf286e0bae1f1324b559072 HeapVector> shader_objects; for (GLenum shaderType : {GL_VERTEX_SHADER, GL_FRAGMENT_SHADER}) { -@@ -3256,6 +3259,7 @@ GLint WebGLRenderingContextBase::getAttribLocation(WebGLProgram* program, +@@ -3272,6 +3275,7 @@ GLint WebGLRenderingContextBase::getAttribLocation(WebGLProgram* program, const String& name) { if (!ValidateWebGLProgramOrShader("getAttribLocation", program)) return -1; @@ -34,7 +34,7 @@ index 4f2067d37ed743e09cbfe1fb58189c8b2c3700b0..7b09e82e5cf286e0bae1f1324b559072 if (!ValidateLocationLength("getAttribLocation", name)) return -1; if (!ValidateString("getAttribLocation", name)) -@@ -3289,6 +3293,7 @@ ScriptValue WebGLRenderingContextBase::getBufferParameter( +@@ -3305,6 +3309,7 @@ ScriptValue WebGLRenderingContextBase::getBufferParameter( GLenum pname) { if (isContextLost() || !ValidateBufferTarget("getBufferParameter", target)) return ScriptValue::CreateNull(script_state->GetIsolate()); @@ -42,7 +42,7 @@ index 4f2067d37ed743e09cbfe1fb58189c8b2c3700b0..7b09e82e5cf286e0bae1f1324b559072 switch (pname) { case GL_BUFFER_USAGE: { -@@ -3426,6 +3431,7 @@ ScriptValue WebGLRenderingContextBase::getFramebufferAttachmentParameter( +@@ -3442,6 +3447,7 @@ ScriptValue WebGLRenderingContextBase::getFramebufferAttachmentParameter( return ScriptValue::CreateNull(script_state->GetIsolate()); } @@ -50,7 +50,7 @@ index 4f2067d37ed743e09cbfe1fb58189c8b2c3700b0..7b09e82e5cf286e0bae1f1324b559072 if (!framebuffer_binding_ || !framebuffer_binding_->Object()) { SynthesizeGLError(GL_INVALID_OPERATION, kFunctionName, "no framebuffer bound"); -@@ -3829,6 +3835,7 @@ ScriptValue WebGLRenderingContextBase::getParameter(ScriptState* script_state, +@@ -3845,6 +3851,7 @@ ScriptValue WebGLRenderingContextBase::getParameter(ScriptState* script_state, "invalid parameter name, OES_standard_derivatives not enabled"); return ScriptValue::CreateNull(script_state->GetIsolate()); case WebGLDebugRendererInfo::kUnmaskedRendererWebgl: @@ -58,7 +58,7 @@ index 4f2067d37ed743e09cbfe1fb58189c8b2c3700b0..7b09e82e5cf286e0bae1f1324b559072 if (ExtensionEnabled(kWebGLDebugRendererInfoName)) { if (IdentifiabilityStudySettings::Get()->ShouldSampleType( blink::IdentifiableSurface::Type::kWebGLParameter)) { -@@ -3844,6 +3851,7 @@ ScriptValue WebGLRenderingContextBase::getParameter(ScriptState* script_state, +@@ -3860,6 +3867,7 @@ ScriptValue WebGLRenderingContextBase::getParameter(ScriptState* script_state, "invalid parameter name, WEBGL_debug_renderer_info not enabled"); return ScriptValue::CreateNull(script_state->GetIsolate()); case WebGLDebugRendererInfo::kUnmaskedVendorWebgl: @@ -66,7 +66,7 @@ index 4f2067d37ed743e09cbfe1fb58189c8b2c3700b0..7b09e82e5cf286e0bae1f1324b559072 if (ExtensionEnabled(kWebGLDebugRendererInfoName)) { if (IdentifiabilityStudySettings::Get()->ShouldSampleType( blink::IdentifiableSurface::Type::kWebGLParameter)) { -@@ -3979,6 +3987,7 @@ ScriptValue WebGLRenderingContextBase::getProgramParameter( +@@ -3995,6 +4003,7 @@ ScriptValue WebGLRenderingContextBase::getProgramParameter( // intended to prevent applications from entering an infinite polling loop. if (isContextLost() && pname == GL_COMPLETION_STATUS_KHR) return WebGLAny(script_state, true); @@ -74,7 +74,7 @@ index 4f2067d37ed743e09cbfe1fb58189c8b2c3700b0..7b09e82e5cf286e0bae1f1324b559072 if (!ValidateWebGLProgramOrShader("getProgramParamter", program)) { return ScriptValue::CreateNull(script_state->GetIsolate()); } -@@ -4034,6 +4043,7 @@ ScriptValue WebGLRenderingContextBase::getProgramParameter( +@@ -4050,6 +4059,7 @@ ScriptValue WebGLRenderingContextBase::getProgramParameter( String WebGLRenderingContextBase::getProgramInfoLog(WebGLProgram* program) { if (!ValidateWebGLProgramOrShader("getProgramInfoLog", program)) return String(); @@ -82,7 +82,7 @@ index 4f2067d37ed743e09cbfe1fb58189c8b2c3700b0..7b09e82e5cf286e0bae1f1324b559072 GLStringQuery query(ContextGL()); return query.Run(ObjectNonZero(program)); } -@@ -4044,6 +4054,7 @@ ScriptValue WebGLRenderingContextBase::getRenderbufferParameter( +@@ -4060,6 +4070,7 @@ ScriptValue WebGLRenderingContextBase::getRenderbufferParameter( GLenum pname) { if (isContextLost()) return ScriptValue::CreateNull(script_state->GetIsolate()); @@ -90,7 +90,7 @@ index 4f2067d37ed743e09cbfe1fb58189c8b2c3700b0..7b09e82e5cf286e0bae1f1324b559072 if (target != GL_RENDERBUFFER) { SynthesizeGLError(GL_INVALID_ENUM, "getRenderbufferParameter", "invalid target"); -@@ -4095,6 +4106,7 @@ ScriptValue WebGLRenderingContextBase::getShaderParameter( +@@ -4111,6 +4122,7 @@ ScriptValue WebGLRenderingContextBase::getShaderParameter( // intended to prevent applications from entering an infinite polling loop. if (isContextLost() && pname == GL_COMPLETION_STATUS_KHR) return WebGLAny(script_state, true); @@ -98,7 +98,7 @@ index 4f2067d37ed743e09cbfe1fb58189c8b2c3700b0..7b09e82e5cf286e0bae1f1324b559072 if (!ValidateWebGLProgramOrShader("getShaderParameter", shader)) { return ScriptValue::CreateNull(script_state->GetIsolate()); } -@@ -4126,6 +4138,7 @@ ScriptValue WebGLRenderingContextBase::getShaderParameter( +@@ -4142,6 +4154,7 @@ ScriptValue WebGLRenderingContextBase::getShaderParameter( String WebGLRenderingContextBase::getShaderInfoLog(WebGLShader* shader) { if (!ValidateWebGLProgramOrShader("getShaderInfoLog", shader)) return String(); @@ -106,7 +106,7 @@ index 4f2067d37ed743e09cbfe1fb58189c8b2c3700b0..7b09e82e5cf286e0bae1f1324b559072 GLStringQuery query(ContextGL()); return query.Run(ObjectNonZero(shader)); } -@@ -4156,6 +4169,7 @@ WebGLShaderPrecisionFormat* WebGLRenderingContextBase::getShaderPrecisionFormat( +@@ -4172,6 +4185,7 @@ WebGLShaderPrecisionFormat* WebGLRenderingContextBase::getShaderPrecisionFormat( GLint precision = 0; ContextGL()->GetShaderPrecisionFormat(shader_type, precision_type, range, &precision); @@ -114,7 +114,7 @@ index 4f2067d37ed743e09cbfe1fb58189c8b2c3700b0..7b09e82e5cf286e0bae1f1324b559072 auto* result = MakeGarbageCollected( range[0], range[1], precision); if (IdentifiabilityStudySettings::Get()->ShouldSampleType( -@@ -4168,6 +4182,7 @@ WebGLShaderPrecisionFormat* WebGLRenderingContextBase::getShaderPrecisionFormat( +@@ -4184,6 +4198,7 @@ WebGLShaderPrecisionFormat* WebGLRenderingContextBase::getShaderPrecisionFormat( String WebGLRenderingContextBase::getShaderSource(WebGLShader* shader) { if (!ValidateWebGLProgramOrShader("getShaderSource", shader)) return String(); @@ -122,7 +122,7 @@ index 4f2067d37ed743e09cbfe1fb58189c8b2c3700b0..7b09e82e5cf286e0bae1f1324b559072 return EnsureNotNull(shader->Source()); } -@@ -4193,6 +4208,7 @@ ScriptValue WebGLRenderingContextBase::getTexParameter( +@@ -4209,6 +4224,7 @@ ScriptValue WebGLRenderingContextBase::getTexParameter( GLenum pname) { if (isContextLost()) return ScriptValue::CreateNull(script_state->GetIsolate()); @@ -130,7 +130,7 @@ index 4f2067d37ed743e09cbfe1fb58189c8b2c3700b0..7b09e82e5cf286e0bae1f1324b559072 if (!ValidateTextureBinding("getTexParameter", target)) return ScriptValue::CreateNull(script_state->GetIsolate()); switch (pname) { -@@ -4227,6 +4243,7 @@ ScriptValue WebGLRenderingContextBase::getUniform( +@@ -4243,6 +4259,7 @@ ScriptValue WebGLRenderingContextBase::getUniform( const WebGLUniformLocation* uniform_location) { if (!ValidateWebGLProgramOrShader("getUniform", program)) return ScriptValue::CreateNull(script_state->GetIsolate()); @@ -138,7 +138,7 @@ index 4f2067d37ed743e09cbfe1fb58189c8b2c3700b0..7b09e82e5cf286e0bae1f1324b559072 DCHECK(uniform_location); if (!ValidateUniformLocation("getUniform", uniform_location, program)) { return ScriptValue::CreateNull(script_state->GetIsolate()); -@@ -4475,6 +4492,7 @@ WebGLUniformLocation* WebGLRenderingContextBase::getUniformLocation( +@@ -4494,6 +4511,7 @@ WebGLUniformLocation* WebGLRenderingContextBase::getUniformLocation( const String& name) { if (!ValidateWebGLProgramOrShader("getUniformLocation", program)) return nullptr; @@ -146,7 +146,7 @@ index 4f2067d37ed743e09cbfe1fb58189c8b2c3700b0..7b09e82e5cf286e0bae1f1324b559072 if (!ValidateLocationLength("getUniformLocation", name)) return nullptr; if (!ValidateString("getUniformLocation", name)) -@@ -4499,6 +4517,7 @@ ScriptValue WebGLRenderingContextBase::getVertexAttrib( +@@ -4518,6 +4536,7 @@ ScriptValue WebGLRenderingContextBase::getVertexAttrib( GLenum pname) { if (isContextLost()) return ScriptValue::CreateNull(script_state->GetIsolate()); @@ -154,7 +154,7 @@ index 4f2067d37ed743e09cbfe1fb58189c8b2c3700b0..7b09e82e5cf286e0bae1f1324b559072 if (index >= max_vertex_attribs_) { SynthesizeGLError(GL_INVALID_VALUE, "getVertexAttrib", "index out of range"); -@@ -4575,6 +4594,7 @@ int64_t WebGLRenderingContextBase::getVertexAttribOffset(GLuint index, +@@ -4594,6 +4613,7 @@ int64_t WebGLRenderingContextBase::getVertexAttribOffset(GLuint index, GLenum pname) { if (isContextLost()) return 0; @@ -162,7 +162,7 @@ index 4f2067d37ed743e09cbfe1fb58189c8b2c3700b0..7b09e82e5cf286e0bae1f1324b559072 GLvoid* result = nullptr; // NOTE: If pname is ever a value that returns more than 1 element // this will corrupt memory. -@@ -4933,6 +4953,7 @@ void WebGLRenderingContextBase::ReadPixelsHelper(GLint x, +@@ -4952,6 +4972,7 @@ void WebGLRenderingContextBase::ReadPixelsHelper(GLint x, int64_t offset) { if (isContextLost()) return; diff --git a/patches/third_party-blink-renderer-modules-websockets-websocket_channel_impl.h.patch b/patches/third_party-blink-renderer-modules-websockets-websocket_channel_impl.h.patch index 816d5bb7d6cc..dc0da5e5ca62 100644 --- a/patches/third_party-blink-renderer-modules-websockets-websocket_channel_impl.h.patch +++ b/patches/third_party-blink-renderer-modules-websockets-websocket_channel_impl.h.patch @@ -1,8 +1,8 @@ diff --git a/third_party/blink/renderer/modules/websockets/websocket_channel_impl.h b/third_party/blink/renderer/modules/websockets/websocket_channel_impl.h -index 653c5da616932dcf0ae014085a2efb01b839c642..7cd2ece1bdec900427db6d5a3140ec0c03de0a3b 100644 +index 5c8f237f387e322d425e531bca63ae3e26f8164a..3b6e13ed7eda979c6da9fdcbb0675d5c73b74d8e 100644 --- a/third_party/blink/renderer/modules/websockets/websocket_channel_impl.h +++ b/third_party/blink/renderer/modules/websockets/websocket_channel_impl.h -@@ -78,7 +78,7 @@ class WebSocketHandshakeThrottle; +@@ -79,7 +79,7 @@ class WebSocketHandshakeThrottle; // This is an implementation of WebSocketChannel. This is created on the main // thread for Document, or on the worker thread for WorkerGlobalScope. All // functions must be called on the execution context's thread. @@ -11,7 +11,7 @@ index 653c5da616932dcf0ae014085a2efb01b839c642..7cd2ece1bdec900427db6d5a3140ec0c : public WebSocketChannel, public network::mojom::blink::WebSocketHandshakeClient, public network::mojom::blink::WebSocketClient { -@@ -365,6 +365,7 @@ class MODULES_EXPORT WebSocketChannelImpl final +@@ -366,6 +366,7 @@ class MODULES_EXPORT WebSocketChannelImpl final void OnConnectionError(const base::Location& set_from, uint32_t custom_reason, const std::string& description); diff --git a/patches/third_party-blink-renderer-platform-BUILD.gn.patch b/patches/third_party-blink-renderer-platform-BUILD.gn.patch index 76675ab71e42..2e62132e9d02 100644 --- a/patches/third_party-blink-renderer-platform-BUILD.gn.patch +++ b/patches/third_party-blink-renderer-platform-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn -index 5b8e391fd8998614fca3c5224e53227e250a4bce..47a9a5e51d89c8ade2e9f908701917c8d735d16c 100644 +index 7e9b09340fb856eea3c80735a4917fff5bac11f5..01a44882648d0f2c5fccd60856c802132feb1464 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn -@@ -1923,6 +1923,7 @@ component("platform") { +@@ -1927,6 +1927,7 @@ component("platform") { configs -= [ "//build/config/compiler:default_symbols" ] configs += blink_symbols_config diff --git a/patches/third_party-blink-renderer-platform-runtime_enabled_features.json5.patch b/patches/third_party-blink-renderer-platform-runtime_enabled_features.json5.patch index 38ab532c563a..c8041a05b1e0 100644 --- a/patches/third_party-blink-renderer-platform-runtime_enabled_features.json5.patch +++ b/patches/third_party-blink-renderer-platform-runtime_enabled_features.json5.patch @@ -1,8 +1,8 @@ diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 -index 1599f1a7d009dce882943fe209bedbee9ad66dda..8c009af816a9c8b4ae45cb5c988f60e0c8ad85e7 100644 +index 9a2680bbd002c5125d7462dd62ec77b7ef8546f0..6ddbb1a616f3fd998618f20da77a050aaa169e9c 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5 -@@ -1941,6 +1941,7 @@ +@@ -1957,6 +1957,7 @@ // In-development features for the File System Access API. name: "FileSystemAccessAPIExperimental", status: "experimental", @@ -10,7 +10,7 @@ index 1599f1a7d009dce882943fe209bedbee9ad66dda..8c009af816a9c8b4ae45cb5c988f60e0 }, { // The FileSystemHandle.getCloudIdentifiers() method (see -@@ -1956,6 +1957,7 @@ +@@ -1972,6 +1973,7 @@ // Non-OPFS File System Access API. name: "FileSystemAccessLocal", status: {"Android": "test", "default": "stable"}, @@ -18,7 +18,7 @@ index 1599f1a7d009dce882943fe209bedbee9ad66dda..8c009af816a9c8b4ae45cb5c988f60e0 }, { name: "FileSystemAccessLockingScheme", -@@ -2747,6 +2749,7 @@ +@@ -2782,6 +2784,7 @@ { name: "MiddleClickAutoscroll", status: "test", @@ -26,7 +26,7 @@ index 1599f1a7d009dce882943fe209bedbee9ad66dda..8c009af816a9c8b4ae45cb5c988f60e0 }, // Killswitch. Remove after 1 or 2 stable releases. { -@@ -3827,6 +3830,7 @@ +@@ -3829,6 +3832,7 @@ { name: "Serial", status: {"Android": "", "default": "stable"}, diff --git a/patches/third_party-crashpad-crashpad-util-net-http_transport_win.cc.patch b/patches/third_party-crashpad-crashpad-util-net-http_transport_win.cc.patch index 5b8871cb0857..ab7efa0764cf 100644 --- a/patches/third_party-crashpad-crashpad-util-net-http_transport_win.cc.patch +++ b/patches/third_party-crashpad-crashpad-util-net-http_transport_win.cc.patch @@ -1,5 +1,5 @@ diff --git a/third_party/crashpad/crashpad/util/net/http_transport_win.cc b/third_party/crashpad/crashpad/util/net/http_transport_win.cc -index df444d86a1ed6872a13fd4f132f656e70857ff8a..9ba68bc385520d6ad2b9be7f728dc3672c3eb4ff 100644 +index 13856dae8281f65b92274be161ce23ec63ee120c..15bf84060f0d62f575ad7796e681d11a6b5d32db 100644 --- a/third_party/crashpad/crashpad/util/net/http_transport_win.cc +++ b/third_party/crashpad/crashpad/util/net/http_transport_win.cc @@ -159,6 +159,8 @@ bool HTTPTransportWin::ExecuteSynchronously(std::string* response_body) { diff --git a/patches/third_party-libaddressinput-chromium-chrome_metadata_source.cc.patch b/patches/third_party-libaddressinput-chromium-chrome_metadata_source.cc.patch index 8189b67a9473..3e7d20597f20 100644 --- a/patches/third_party-libaddressinput-chromium-chrome_metadata_source.cc.patch +++ b/patches/third_party-libaddressinput-chromium-chrome_metadata_source.cc.patch @@ -1,5 +1,5 @@ diff --git a/third_party/libaddressinput/chromium/chrome_metadata_source.cc b/third_party/libaddressinput/chromium/chrome_metadata_source.cc -index 2ed2488ec44b010b1e0184b4fbea35fb0fffa024..7e6eb2e332f69e9c69392e56c80a65e59959b3f0 100644 +index 5054de5bd4e403fcbaa8cdd6abae42a4f0e89692..837dbf87822842c54809589c08be3b7ef5c187c3 100644 --- a/third_party/libaddressinput/chromium/chrome_metadata_source.cc +++ b/third_party/libaddressinput/chromium/chrome_metadata_source.cc @@ -57,7 +57,7 @@ ChromeMetadataSource::Request::Request( diff --git a/patches/third_party-lit-v3_0-BUILD.gn.patch b/patches/third_party-lit-v3_0-BUILD.gn.patch index 27ada2e3d896..67e88cd4d80d 100644 --- a/patches/third_party-lit-v3_0-BUILD.gn.patch +++ b/patches/third_party-lit-v3_0-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/third_party/lit/v3_0/BUILD.gn b/third_party/lit/v3_0/BUILD.gn -index fe174a32360dd420a1c7af120e8906464f4de24b..798c034f7850926e4f3b9a80a4abe633faa248da 100644 +index 5136460fca37be70bd4b91bcda0b986b762f707f..d2e83b8d273c276dfa4ad26ad35fcac4b5898a52 100644 --- a/third_party/lit/v3_0/BUILD.gn +++ b/third_party/lit/v3_0/BUILD.gn -@@ -79,6 +79,7 @@ ts_library("build_ts") { +@@ -82,6 +82,7 @@ ts_library("build_ts") { "//ui/webui/resources/cr_components/most_visited:build_ts", "//ui/webui/resources/cr_components/theme_color_picker:build_ts", "//ui/webui/resources/cr_elements:build_ts", @@ -10,7 +10,7 @@ index fe174a32360dd420a1c7af120e8906464f4de24b..798c034f7850926e4f3b9a80a4abe633 ] composite = true in_files = [ -@@ -157,6 +158,7 @@ ts_library("build_ts") { +@@ -160,6 +161,7 @@ ts_library("build_ts") { "${node_modules}/@lit/reactive-element/reactive-element.d.ts", target_gen_dir), ] diff --git a/patches/third_party-lottie-lottie_worker.js.patch b/patches/third_party-lottie-lottie_worker.js.patch index 2259e46bbf5b..6d66662a250f 100644 --- a/patches/third_party-lottie-lottie_worker.js.patch +++ b/patches/third_party-lottie-lottie_worker.js.patch @@ -1,8 +1,8 @@ diff --git a/third_party/lottie/lottie_worker.js b/third_party/lottie/lottie_worker.js -index 29dffcca9a1fa439005be613fef042839735dd45..3a456decfd89b58e9784bde7c03ee508d22271a9 100644 +index 2f09b122f54e9f5231933591c69303ac6b4d630c..7578873a7e88beb31cbbf54f1bfa18aef5044a1c 100644 --- a/third_party/lottie/lottie_worker.js +++ b/third_party/lottie/lottie_worker.js -@@ -13455,6 +13455,7 @@ function initAnimation(animationData, initParams, canvas) { +@@ -13457,6 +13457,7 @@ function initAnimation(animationData, initParams, canvas) { }, }); diff --git a/patches/third_party-polymer-v3_0-BUILD.gn.patch b/patches/third_party-polymer-v3_0-BUILD.gn.patch index fcbfb2251a89..45a1075a9636 100644 --- a/patches/third_party-polymer-v3_0-BUILD.gn.patch +++ b/patches/third_party-polymer-v3_0-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/third_party/polymer/v3_0/BUILD.gn b/third_party/polymer/v3_0/BUILD.gn -index 2223ebf02ac6d90b5a597e6d25b989c2c8f3077b..c1855e897d60531e4e265fd65256ebff40526b78 100644 +index 2a79b9f3d8b1e74eeaf7b9add6c50ca0140c5d38..4262548de5681a78a49bc7810a51d914d0a23a91 100644 --- a/third_party/polymer/v3_0/BUILD.gn +++ b/third_party/polymer/v3_0/BUILD.gn -@@ -37,10 +37,12 @@ js_files = [ +@@ -34,10 +34,12 @@ js_files = [ # Also needed on LaCros for Print Preview. Remove once CrOS Print Preview # launches. if (is_chromeos) { @@ -15,7 +15,7 @@ index 2223ebf02ac6d90b5a597e6d25b989c2c8f3077b..c1855e897d60531e4e265fd65256ebff js_files += [ "iron-a11y-announcer/iron-a11y-announcer.js", "iron-behaviors/iron-control-state.js", -@@ -270,11 +272,13 @@ ts_library("library") { +@@ -258,11 +260,13 @@ ts_library("library") { # Also needed on LaCros for Print Preview. Remove once CrOS Print Preview # launches. if (is_chromeos) { @@ -29,7 +29,7 @@ index 2223ebf02ac6d90b5a597e6d25b989c2c8f3077b..c1855e897d60531e4e265fd65256ebff definitions += [ "components-chromium/iron-a11y-announcer/iron-a11y-announcer.d.ts", "components-chromium/iron-collapse/iron-collapse.d.ts", -@@ -301,4 +305,5 @@ ts_library("library") { +@@ -291,4 +295,5 @@ ts_library("library") { "components-chromium/paper-tooltip/paper-tooltip.d.ts", ] } diff --git a/patches/third_party-rust-anyhow-v1-BUILD.gn.patch b/patches/third_party-rust-anyhow-v1-BUILD.gn.patch index 2ff96f47f428..e1c56ac099f8 100644 --- a/patches/third_party-rust-anyhow-v1-BUILD.gn.patch +++ b/patches/third_party-rust-anyhow-v1-BUILD.gn.patch @@ -1,10 +1,10 @@ diff --git a/third_party/rust/anyhow/v1/BUILD.gn b/third_party/rust/anyhow/v1/BUILD.gn -index db07bb9536cf2497a28c32d61eb060e48699afa7..6562a086351b70f09b8907ae4b8fad23abedd99e 100644 +index e8926dc641e7ac8af137a66c0cff04473768406b..448f21503e8056c8d3ea144b74aeba01d6eb5382 100644 --- a/third_party/rust/anyhow/v1/BUILD.gn +++ b/third_party/rust/anyhow/v1/BUILD.gn @@ -48,5 +48,4 @@ cargo_crate("lib") { build_sources = - [ "//third_party/rust/chromium_crates_io/vendor/anyhow-1.0.87/build.rs" ] + [ "//third_party/rust/chromium_crates_io/vendor/anyhow-1.0.89/build.rs" ] - testonly = true } diff --git a/patches/third_party-rust-regex-v1-BUILD.gn.patch b/patches/third_party-rust-regex-v1-BUILD.gn.patch index be4a737636b0..6ab33e747ef3 100644 --- a/patches/third_party-rust-regex-v1-BUILD.gn.patch +++ b/patches/third_party-rust-regex-v1-BUILD.gn.patch @@ -1,5 +1,5 @@ diff --git a/third_party/rust/regex/v1/BUILD.gn b/third_party/rust/regex/v1/BUILD.gn -index 3351a6e5cb2491529258b27bab8e77dc004a0a0a..cac77548eebd5a36386143bf2a47ecd290cbc847 100644 +index e62951faad397e2c7503b27f0f439e20ad1e4951..00f310def122084463d8e208953904e7398fa523 100644 --- a/third_party/rust/regex/v1/BUILD.gn +++ b/third_party/rust/regex/v1/BUILD.gn @@ -68,5 +68,4 @@ cargo_crate("lib") { diff --git a/patches/third_party-rust-regex_automata-v0_4-BUILD.gn.patch b/patches/third_party-rust-regex_automata-v0_4-BUILD.gn.patch index b18ba51e2e51..558fc70f6241 100644 --- a/patches/third_party-rust-regex_automata-v0_4-BUILD.gn.patch +++ b/patches/third_party-rust-regex_automata-v0_4-BUILD.gn.patch @@ -1,5 +1,5 @@ diff --git a/third_party/rust/regex_automata/v0_4/BUILD.gn b/third_party/rust/regex_automata/v0_4/BUILD.gn -index 792a470244629f6e681deeff14f31941bc51c29c..8b00589378783e3142a227076a50e3ab8036f8d3 100644 +index 71502f7ea94052d3d4358c32d29402eb95dc2509..00950ce01684a6738c32a1ce0dfb215d95b7b800 100644 --- a/third_party/rust/regex_automata/v0_4/BUILD.gn +++ b/third_party/rust/regex_automata/v0_4/BUILD.gn @@ -135,5 +135,4 @@ cargo_crate("lib") { diff --git a/patches/third_party-rust-regex_syntax-v0_8-BUILD.gn.patch b/patches/third_party-rust-regex_syntax-v0_8-BUILD.gn.patch index 9ee3fd39564e..680d51eb6a0c 100644 --- a/patches/third_party-rust-regex_syntax-v0_8-BUILD.gn.patch +++ b/patches/third_party-rust-regex_syntax-v0_8-BUILD.gn.patch @@ -1,5 +1,5 @@ diff --git a/third_party/rust/regex_syntax/v0_8/BUILD.gn b/third_party/rust/regex_syntax/v0_8/BUILD.gn -index da1da6298e8175e149aea0be57dddf01ff24c9eb..5ea41e5057912c58686f88b9dc3ee3259cfb6c12 100644 +index da0ae7be10d5c1a599de8875badfe3e7d085167d..1a481395d2cf1e64277d4e014f64b5c9a2b8a946 100644 --- a/third_party/rust/regex_syntax/v0_8/BUILD.gn +++ b/third_party/rust/regex_syntax/v0_8/BUILD.gn @@ -79,5 +79,4 @@ cargo_crate("lib") { diff --git a/patches/third_party-rust-syn-v1-BUILD.gn.patch b/patches/third_party-rust-syn-v1-BUILD.gn.patch deleted file mode 100644 index b6dd7fc8e84e..000000000000 --- a/patches/third_party-rust-syn-v1-BUILD.gn.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/third_party/rust/syn/v1/BUILD.gn b/third_party/rust/syn/v1/BUILD.gn -index ed85ddb4e128c933f37a3f22813dcf869299bd01..090744ac53829b0da7878b93401ceca8cd8d088c 100644 ---- a/third_party/rust/syn/v1/BUILD.gn -+++ b/third_party/rust/syn/v1/BUILD.gn -@@ -99,6 +99,7 @@ cargo_crate("lib") { - "visit", - "visit-mut", - ] -+ features += [ "fold" ] - build_root = - "//third_party/rust/chromium_crates_io/vendor/syn-1.0.109/build.rs" - build_sources = -@@ -108,5 +109,4 @@ cargo_crate("lib") { - # //third_party/rust/chromium_crates_io/Cargo.toml to use - # it from first-party code. - visibility = [ "//third_party/rust/*" ] -- testonly = true - } diff --git a/patches/third_party-rust-syn-v2-BUILD.gn.patch b/patches/third_party-rust-syn-v2-BUILD.gn.patch index 504cded29bdc..0a544eb86a35 100644 --- a/patches/third_party-rust-syn-v2-BUILD.gn.patch +++ b/patches/third_party-rust-syn-v2-BUILD.gn.patch @@ -1,10 +1,10 @@ diff --git a/third_party/rust/syn/v2/BUILD.gn b/third_party/rust/syn/v2/BUILD.gn -index 8e224876385a12f32de94419476926c573589532..2af412c861019760ed49a0ef10422da5fcb3e7b1 100644 +index 2052b15dd10100be0403e77f691fa868629727de..15081dc1c3b35ef7650d7e28bfb08d7d58d79160 100644 --- a/third_party/rust/syn/v2/BUILD.gn +++ b/third_party/rust/syn/v2/BUILD.gn -@@ -98,4 +98,5 @@ cargo_crate("lib") { - "printing", - "proc-macro", +@@ -100,4 +100,5 @@ cargo_crate("lib") { + "visit", + "visit-mut", ] + features += [ "extra-traits", "visit", "visit-mut" ] } diff --git a/patches/third_party-tflite-BUILD.gn.patch b/patches/third_party-tflite-BUILD.gn.patch index 9ae82dc4372b..1616e2a566a3 100644 --- a/patches/third_party-tflite-BUILD.gn.patch +++ b/patches/third_party-tflite-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/third_party/tflite/BUILD.gn b/third_party/tflite/BUILD.gn -index ff1851f79d7f34935a9b0d4b0a3009738ee4b84b..b5ee6f5a4b21640f7674173c1fd4d0751702f47d 100644 +index 44987f7b3c13c40cad414c8beb7dc35876b3a93b..92e93b441f45e0bc66fda25f11896f23c4d245fd 100644 --- a/third_party/tflite/BUILD.gn +++ b/third_party/tflite/BUILD.gn -@@ -214,6 +214,7 @@ tflite_static_library("tflite_builtin_op_resolver") { +@@ -211,6 +211,7 @@ tflite_static_library("tflite_builtin_op_resolver") { "//services/webnn/*", "//third_party/mediapipe/*", ] diff --git a/patches/third_party/devtools-frontend/src/config-gni-devtools_grd_files.gni.patch b/patches/third_party/devtools-frontend/src/config-gni-devtools_grd_files.gni.patch index fbb713ae4e35..2381494faa55 100644 --- a/patches/third_party/devtools-frontend/src/config-gni-devtools_grd_files.gni.patch +++ b/patches/third_party/devtools-frontend/src/config-gni-devtools_grd_files.gni.patch @@ -1,8 +1,8 @@ diff --git a/config/gni/devtools_grd_files.gni b/config/gni/devtools_grd_files.gni -index e91dd7ec06daafb87b6b95d991a8de062f476406..bd7757515f1b2f3bfbd1699bf3391957077796c1 100644 +index 9c6cd978f3fb89e74ee09d5cc1bcea1e3c478cd1..ed061d54dcd1c20e10dd43a8fa27ba2c7f69824c 100644 --- a/config/gni/devtools_grd_files.gni +++ b/config/gni/devtools_grd_files.gni -@@ -2427,6 +2427,7 @@ grd_files_debug_sources = [ +@@ -2456,6 +2456,7 @@ grd_files_debug_sources = [ "front_end/ui/visual_logging/LoggingState.js", "front_end/ui/visual_logging/NonDomState.js", ] diff --git a/patches/third_party/devtools-frontend/src/front_end-core-sdk-NetworkManager.ts.patch b/patches/third_party/devtools-frontend/src/front_end-core-sdk-NetworkManager.ts.patch index dff85292f9da..45cc56611ef6 100644 --- a/patches/third_party/devtools-frontend/src/front_end-core-sdk-NetworkManager.ts.patch +++ b/patches/third_party/devtools-frontend/src/front_end-core-sdk-NetworkManager.ts.patch @@ -1,5 +1,5 @@ diff --git a/front_end/core/sdk/NetworkManager.ts b/front_end/core/sdk/NetworkManager.ts -index e9d60c5b49c1c0464aa311dee0cc0f3cb726e1bb..89f8d5739576d62075a5c4d5a44bc8dc3d95bb92 100644 +index 8735116e613d107e6f853bbe0cbbf9849bdf3aff..366cdb5c99939078ffd8e4478cade55f5c8d5da7 100644 --- a/front_end/core/sdk/NetworkManager.ts +++ b/front_end/core/sdk/NetworkManager.ts @@ -1262,6 +1262,7 @@ export class NetworkDispatcher implements ProtocolProxyApi.NetworkDispatcher { diff --git a/patches/third_party/devtools-frontend/src/front_end-panels-application-ApplicationPanelSidebar.ts.patch b/patches/third_party/devtools-frontend/src/front_end-panels-application-ApplicationPanelSidebar.ts.patch index 9257472d5113..91892171979c 100644 --- a/patches/third_party/devtools-frontend/src/front_end-panels-application-ApplicationPanelSidebar.ts.patch +++ b/patches/third_party/devtools-frontend/src/front_end-panels-application-ApplicationPanelSidebar.ts.patch @@ -1,8 +1,8 @@ diff --git a/front_end/panels/application/ApplicationPanelSidebar.ts b/front_end/panels/application/ApplicationPanelSidebar.ts -index a743c919aa4ed2d8afbad42ffcbf284770bd3a9f..85eb3fbaca6ec512be0efc00b5d51e56bea5a52e 100644 +index 451ba2af23eb677637c5f1e692d98cc0cfcd89ea..91d30dd26bb65bf294965f1f2acae8accfc6d407 100644 --- a/front_end/panels/application/ApplicationPanelSidebar.ts +++ b/front_end/panels/application/ApplicationPanelSidebar.ts -@@ -443,6 +443,7 @@ export class ApplicationPanelSidebar extends UI.Widget.VBox implements SDK.Targe +@@ -514,6 +514,7 @@ export class ApplicationPanelSidebar extends UI.Widget.VBox implements SDK.Targe // Work-around for crbug.com/1152713: Something is wrong with custom scrollbars and size containment. // @ts-ignore this.contentElement.style.contain = 'layout style'; diff --git a/patches/third_party/devtools-frontend/src/front_end-panels-network-BUILD.gn.patch b/patches/third_party/devtools-frontend/src/front_end-panels-network-BUILD.gn.patch index aed0f897df53..711dd09ed5c4 100644 --- a/patches/third_party/devtools-frontend/src/front_end-panels-network-BUILD.gn.patch +++ b/patches/third_party/devtools-frontend/src/front_end-panels-network-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/front_end/panels/network/BUILD.gn b/front_end/panels/network/BUILD.gn -index 8df5bcf644ebbf840b4722929b4aeaaf0ff43ae1..c8b3af9913269652ce5e43ac20469fc7fc436bcf 100644 +index 3113db979660cf06dc346e9446b4ae31f1a8bb2f..39e33491f196e7556923ffc283488d89eda2361f 100644 --- a/front_end/panels/network/BUILD.gn +++ b/front_end/panels/network/BUILD.gn -@@ -96,6 +96,7 @@ devtools_module("network") { +@@ -98,6 +98,7 @@ devtools_module("network") { "./components:bundle", "./forward:bundle", ] diff --git a/patches/third_party/devtools-frontend/src/front_end-panels-network-NetworkDataGridNode.ts.patch b/patches/third_party/devtools-frontend/src/front_end-panels-network-NetworkDataGridNode.ts.patch index da15b4a91f9b..ed87374fe18d 100644 --- a/patches/third_party/devtools-frontend/src/front_end-panels-network-NetworkDataGridNode.ts.patch +++ b/patches/third_party/devtools-frontend/src/front_end-panels-network-NetworkDataGridNode.ts.patch @@ -1,8 +1,8 @@ diff --git a/front_end/panels/network/NetworkDataGridNode.ts b/front_end/panels/network/NetworkDataGridNode.ts -index 3b4a4340310636ded499cb62063ff9f8ba6e44bb..c961f37d1113808fdc4b4609dfc86c32b7f859f3 100644 +index 8e515543c70916b916b2cc21d746b5862183e3d9..da9d1fccc50c7c6c611876170be5480bc1db016d 100644 --- a/front_end/panels/network/NetworkDataGridNode.ts +++ b/front_end/panels/network/NetworkDataGridNode.ts -@@ -1602,6 +1602,7 @@ export class NetworkRequestNode extends NetworkNode { +@@ -1475,6 +1475,7 @@ export class NetworkRequestNode extends NetworkNode { cellElement.appendChild(subtitleElement); } } diff --git a/patches/third_party/devtools-frontend/src/front_end-panels-network-NetworkItemView.ts.patch b/patches/third_party/devtools-frontend/src/front_end-panels-network-NetworkItemView.ts.patch index 69f972cb03c8..b89ea7cb772b 100644 --- a/patches/third_party/devtools-frontend/src/front_end-panels-network-NetworkItemView.ts.patch +++ b/patches/third_party/devtools-frontend/src/front_end-panels-network-NetworkItemView.ts.patch @@ -1,5 +1,5 @@ diff --git a/front_end/panels/network/NetworkItemView.ts b/front_end/panels/network/NetworkItemView.ts -index 2504e196a6d7ccda5fff14684eae0c1b5e189f85..30dca5160f9c82c89142e119fe55a5b60cbf7ad5 100644 +index 90769ae7840cd6bcd8c679d561c08390333661be..002e4fc731cd2f099ba9379e647a97021accfff6 100644 --- a/front_end/panels/network/NetworkItemView.ts +++ b/front_end/panels/network/NetworkItemView.ts @@ -359,3 +359,4 @@ export class NetworkItemView extends UI.TabbedPane.TabbedPane { diff --git a/patches/third_party/devtools-frontend/src/front_end-ui-legacy-themeColors.css.patch b/patches/third_party/devtools-frontend/src/front_end-ui-legacy-themeColors.css.patch index 1add147c4209..4c98e2332885 100644 --- a/patches/third_party/devtools-frontend/src/front_end-ui-legacy-themeColors.css.patch +++ b/patches/third_party/devtools-frontend/src/front_end-ui-legacy-themeColors.css.patch @@ -1,8 +1,8 @@ diff --git a/front_end/ui/legacy/themeColors.css b/front_end/ui/legacy/themeColors.css -index 07623fc6c5badb55d7e07381ceb6e91f5e69fdf5..574a8ee79f68638d29b08ba5a9823b6de07469f5 100644 +index 48f8e210d46c2145269f51429443006f66bb0377..7d603999b49439b4bc3efb0e74cefd0e56b015b1 100644 --- a/front_end/ui/legacy/themeColors.css +++ b/front_end/ui/legacy/themeColors.css -@@ -569,7 +569,7 @@ +@@ -581,7 +581,7 @@ /* Outlines */ --sys-color-outline: var(--ref-palette-neutral-variant60); diff --git a/patches/third_party/tflite/src/tensorflow-lite-simple_memory_arena.cc.patch b/patches/third_party/tflite/src/tensorflow-lite-simple_memory_arena.cc.patch deleted file mode 100644 index 9755ffb8320a..000000000000 --- a/patches/third_party/tflite/src/tensorflow-lite-simple_memory_arena.cc.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/tensorflow/lite/simple_memory_arena.cc b/tensorflow/lite/simple_memory_arena.cc -index f1299b56ac75027a683c421cb9d32c96d5fb1ed6..11e13e9d5a259496bb7090fcae038a217fc986b0 100644 ---- a/tensorflow/lite/simple_memory_arena.cc -+++ b/tensorflow/lite/simple_memory_arena.cc -@@ -34,7 +34,7 @@ limitations under the License. - #if defined(__ANDROID__) - // Android has C11 aligned_alloc only with API 28 or newer, even with C++17 or - // C11 compilation (this is a non-standard behavior). --#define TF_LITE_HAS_ALIGNED_ALLOC (__ANDROID_API__ >= 28) -+#define TF_LITE_HAS_ALIGNED_ALLOC 0 - #elif defined(__APPLE__) - // Apple does not provide aligned_alloc, even with C++17 or C11 compilation - // (this is a non-standard behavior). diff --git a/patches/tools-gritsettings-resource_ids.spec.patch b/patches/tools-gritsettings-resource_ids.spec.patch index 3e4447dadb8f..5ddfe17d4b5d 100644 --- a/patches/tools-gritsettings-resource_ids.spec.patch +++ b/patches/tools-gritsettings-resource_ids.spec.patch @@ -1,5 +1,5 @@ diff --git a/tools/gritsettings/resource_ids.spec b/tools/gritsettings/resource_ids.spec -index ee2a113e2b77873b18d60deee0a373ea335bf149..90be8efa823833d4a1177deea21abf234f0b60f2 100644 +index 38cf9d8fd803f47c57d5491648cb6ae445c1c380..b80ffaec6ee1d630168b6e3ccc93608e475f0024 100644 --- a/tools/gritsettings/resource_ids.spec +++ b/tools/gritsettings/resource_ids.spec @@ -38,6 +38,9 @@ @@ -12,31 +12,26 @@ index ee2a113e2b77873b18d60deee0a373ea335bf149..90be8efa823833d4a1177deea21abf23 "chrome/app/google_chrome_strings.grd": { "messages": [800], }, -@@ -296,11 +299,11 @@ - "includes": [3280], - }, - "<(SHARED_INTERMEDIATE_DIR)/chrome/browser/resources/extensions/resources.grd": { -- "META": {"sizes": {"includes": [90],}}, -+ "META": {"sizes": {"includes": [91],}}, - "includes": [3300], +@@ -409,7 +412,7 @@ + "includes": [4020], }, "<(SHARED_INTERMEDIATE_DIR)/chrome/browser/resources/history/resources.grd": { - "META": {"sizes": {"includes": [40]}}, + "META": {"sizes": {"includes": [46]}}, - "includes": [3320], + "includes": [4040], }, "<(SHARED_INTERMEDIATE_DIR)/chrome/browser/resources/identity_internals/resources.grd": { -@@ -438,7 +441,7 @@ - "includes": [4020], +@@ -553,7 +556,7 @@ + "includes": [4720], }, "<(SHARED_INTERMEDIATE_DIR)/chrome/browser/resources/settings/resources.grd": { - "META": {"sizes": {"includes": [500],}}, + "META": {"sizes": {"includes": [650],}}, - "includes": [4040], + "includes": [4740], }, "<(SHARED_INTERMEDIATE_DIR)/chrome/browser/resources/settings_shared/resources.grd": { -@@ -1015,6 +1018,9 @@ - "components/components_chromium_strings.grd": { +@@ -923,6 +926,9 @@ + # Big alignment at start of section. "messages": [7020], }, + "components/components_brave_strings.grd": { diff --git a/patches/tools-json_schema_compiler-cc_generator.py.patch b/patches/tools-json_schema_compiler-cc_generator.py.patch index 6e540d358968..a0765e656712 100644 --- a/patches/tools-json_schema_compiler-cc_generator.py.patch +++ b/patches/tools-json_schema_compiler-cc_generator.py.patch @@ -1,5 +1,5 @@ diff --git a/tools/json_schema_compiler/cc_generator.py b/tools/json_schema_compiler/cc_generator.py -index 1269ad43a94cad5a157fd3e71e771256b94dcdb1..df99fe47a797f6dbc4d72044a7a188140aa5766b 100644 +index 87c74ca50eb017a16eb90178714c53e632b2e522..aebd1f40b2436822409b41a781a239d00f69148f 100644 --- a/tools/json_schema_compiler/cc_generator.py +++ b/tools/json_schema_compiler/cc_generator.py @@ -30,6 +30,7 @@ class _Generator(object): diff --git a/patches/tools-metrics-histograms-metadata-histogram_suffixes_list.xml.patch b/patches/tools-metrics-histograms-metadata-histogram_suffixes_list.xml.patch index 4ddf26137a9a..765811c749cf 100644 --- a/patches/tools-metrics-histograms-metadata-histogram_suffixes_list.xml.patch +++ b/patches/tools-metrics-histograms-metadata-histogram_suffixes_list.xml.patch @@ -1,8 +1,8 @@ diff --git a/tools/metrics/histograms/metadata/histogram_suffixes_list.xml b/tools/metrics/histograms/metadata/histogram_suffixes_list.xml -index 00d660e65dde7cd6c6f1e39cce19fb01e7576c9e..278cd9b551ac596b7d3913b1105886224e483a65 100644 +index 78f2a8fc2044f9bdd2cb4e76d84e5e578f5eb3ca..8fa94795430c1638ad23178a42f2c4df31c2727d 100644 --- a/tools/metrics/histograms/metadata/histogram_suffixes_list.xml +++ b/tools/metrics/histograms/metadata/histogram_suffixes_list.xml -@@ -2631,6 +2631,7 @@ chromium-metrics-reviews@google.com. +@@ -2617,6 +2617,7 @@ chromium-metrics-reviews@google.com. diff --git a/patches/tools-metrics-histograms-metadata-page-histograms.xml.patch b/patches/tools-metrics-histograms-metadata-page-histograms.xml.patch index 49f63fd703f4..9f56ff2767d4 100644 --- a/patches/tools-metrics-histograms-metadata-page-histograms.xml.patch +++ b/patches/tools-metrics-histograms-metadata-page-histograms.xml.patch @@ -1,8 +1,8 @@ diff --git a/tools/metrics/histograms/metadata/page/histograms.xml b/tools/metrics/histograms/metadata/page/histograms.xml -index 05c13c72943201d944c348e4613ce372ac5dc6ec..c1941c1acc14b3e97e90a4e7dc36e9061796f581 100644 +index 7077ae6ab98ce2ea0a414a48f48137a364e9009c..d2c44f0ffc85bec5132267086e759064b3d4071a 100644 --- a/tools/metrics/histograms/metadata/page/histograms.xml +++ b/tools/metrics/histograms/metadata/page/histograms.xml -@@ -232,6 +232,17 @@ chromium-metrics-reviews@google.com. +@@ -241,6 +241,17 @@ chromium-metrics-reviews@google.com. diff --git a/patches/tools-web_dev_style-eslint.py.patch b/patches/tools-web_dev_style-eslint.py.patch index 82d4d8537cea..96ae494d793b 100644 --- a/patches/tools-web_dev_style-eslint.py.patch +++ b/patches/tools-web_dev_style-eslint.py.patch @@ -1,8 +1,8 @@ diff --git a/tools/web_dev_style/eslint.py b/tools/web_dev_style/eslint.py -index 18be4f4b076888f18538323096e84d52a8659a5c..f719b65aec6b0d01cdb620be23c41ec73da8c280 100755 +index 8f122a0994ba4cc0176d40639e024ff457ddd291..75a008d12dce6e972bc53bea38cc89672d27669e 100755 --- a/tools/web_dev_style/eslint.py +++ b/tools/web_dev_style/eslint.py -@@ -26,6 +26,7 @@ def Run(os_path=None, args=None): +@@ -32,6 +32,7 @@ def Run(os_path=None, args=None): ] + args) diff --git a/patches/ui-accessibility-platform-ax_platform_node_cocoa.mm.patch b/patches/ui-accessibility-platform-ax_platform_node_cocoa.mm.patch index 6df9104d9f69..2d29f44fb198 100644 --- a/patches/ui-accessibility-platform-ax_platform_node_cocoa.mm.patch +++ b/patches/ui-accessibility-platform-ax_platform_node_cocoa.mm.patch @@ -1,8 +1,8 @@ diff --git a/ui/accessibility/platform/ax_platform_node_cocoa.mm b/ui/accessibility/platform/ax_platform_node_cocoa.mm -index f5c231ecf9fdacfd6b7e009e5864cb827ca71a79..f32e2ae807cd3b21c4511d1b45647f3fa9cc0eda 100644 +index c2be9137078318ef69f22b426d01d414d853f59c..126cdf328858589f9d11983bc13114979b03b612 100644 --- a/ui/accessibility/platform/ax_platform_node_cocoa.mm +++ b/ui/accessibility/platform/ax_platform_node_cocoa.mm -@@ -2560,6 +2560,7 @@ void CollectAncestorRoles( +@@ -2640,6 +2640,7 @@ void CollectAncestorRoles( if (!_node) return nil; diff --git a/patches/ui-base-BUILD.gn.patch b/patches/ui-base-BUILD.gn.patch index 0821e92bfcbf..d514036b6382 100644 --- a/patches/ui-base-BUILD.gn.patch +++ b/patches/ui-base-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn -index 79937bebda1b3405a8acbf1559ebd994a3f7bf0b..0d1c50a52eb656bce586b82d146ac7ada7097a5d 100644 +index 8ce9bc840e32fde0f058733376e74e1238a69a7f..3c40d49e39ee3c3b1392a0910e7c472fb63bbd91 100644 --- a/ui/base/BUILD.gn +++ b/ui/base/BUILD.gn -@@ -567,6 +567,7 @@ component("base") { +@@ -568,6 +568,7 @@ component("base") { "//ui/events", "//ui/events/devices", ] diff --git a/patches/ui-webui-resources-BUILD.gn.patch b/patches/ui-webui-resources-BUILD.gn.patch index 5fdf4e748900..009246e0f41e 100644 --- a/patches/ui-webui-resources-BUILD.gn.patch +++ b/patches/ui-webui-resources-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/ui/webui/resources/BUILD.gn b/ui/webui/resources/BUILD.gn -index 17dab4ca2f900bb1a726d93630bbc974d50c4d8c..ce93d0ffcbbd7af8d641b7dfc82dbe150c379e1f 100644 +index 45a453ac7f557b7da8b8acd9b9f682bccdcaad4e..3871f4ce058d297f388a77432734cd5923e068b9 100644 --- a/ui/webui/resources/BUILD.gn +++ b/ui/webui/resources/BUILD.gn -@@ -131,6 +131,7 @@ generate_grd("build_grd") { +@@ -130,6 +130,7 @@ generate_grd("build_grd") { "$root_gen_dir/ui/webui/resources/cr_components/page_image_service/resources.grdp", ] } diff --git a/patches/ui-webui-resources-cr_elements-BUILD.gn.patch b/patches/ui-webui-resources-cr_elements-BUILD.gn.patch index d53647439e2d..459cdd3b3867 100644 --- a/patches/ui-webui-resources-cr_elements-BUILD.gn.patch +++ b/patches/ui-webui-resources-cr_elements-BUILD.gn.patch @@ -1,12 +1,12 @@ diff --git a/ui/webui/resources/cr_elements/BUILD.gn b/ui/webui/resources/cr_elements/BUILD.gn -index a2480aec8aa60f1965700cc09de3278ffaab0342..fd99d6ed01d982860e1fca93a0a13fd928b2dbfc 100644 +index c7103ae0d0a71d5f8c3371cfa85f1c3774721e1e..1c65e4e61175245c9254498c90b4a787a5c3fd0d 100644 --- a/ui/webui/resources/cr_elements/BUILD.gn +++ b/ui/webui/resources/cr_elements/BUILD.gn -@@ -223,6 +223,7 @@ build_webui("build") { - ts_composite = true - ts_deps = [ "../js:build_ts" ] - if (include_polymer) { +@@ -234,6 +234,7 @@ build_webui("build") { + "//third_party/lit/v3_0:build_ts", + ] + if (!is_android && !is_ios) { + ts_deps += ["//brave/ui/webui/resources:build_ts"] - ts_deps += [ - "//third_party/lit/v3_0:build_ts", - "//third_party/polymer/v3_0:library", + ts_deps += [ "//third_party/polymer/v3_0:library" ] + } + ts_definitions = [ diff --git a/patches/ui-webui-resources-cr_elements-cr_radio_button-cr_radio_button_style.css.patch b/patches/ui-webui-resources-cr_elements-cr_radio_button-cr_radio_button_style.css.patch index 261bfeb973dd..e6e19eb25b76 100644 --- a/patches/ui-webui-resources-cr_elements-cr_radio_button-cr_radio_button_style.css.patch +++ b/patches/ui-webui-resources-cr_elements-cr_radio_button-cr_radio_button_style.css.patch @@ -1,5 +1,5 @@ diff --git a/ui/webui/resources/cr_elements/cr_radio_button/cr_radio_button_style.css b/ui/webui/resources/cr_elements/cr_radio_button/cr_radio_button_style.css -index 26be0eb63c6710da71edffb9f7a5c796b321d72a..113aaf9463ffe59fbace67dff252c53f6fc9c979 100644 +index 09d8d3aa5c34684370deeff9e63c20d97c56d571..29803457e85eb2d5e4566ef48da244eb2d39699f 100644 --- a/ui/webui/resources/cr_elements/cr_radio_button/cr_radio_button_style.css +++ b/ui/webui/resources/cr_elements/cr_radio_button/cr_radio_button_style.css @@ -7,6 +7,8 @@ @@ -10,4 +10,4 @@ index 26be0eb63c6710da71edffb9f7a5c796b321d72a..113aaf9463ffe59fbace67dff252c53f + * #include=br-shared-style * #css_wrapper_metadata_end */ - + /* Purposefully empty since this style is generated at build time from the diff --git a/patches/ui-webui-resources-cr_elements-cr_shared_style.css.patch b/patches/ui-webui-resources-cr_elements-cr_shared_style.css.patch index 95e3027db531..2c7718e50d79 100644 --- a/patches/ui-webui-resources-cr_elements-cr_shared_style.css.patch +++ b/patches/ui-webui-resources-cr_elements-cr_shared_style.css.patch @@ -1,5 +1,5 @@ diff --git a/ui/webui/resources/cr_elements/cr_shared_style.css b/ui/webui/resources/cr_elements/cr_shared_style.css -index eefaf6d369fb2a268045cfd33973a8cced5f56cb..97e8dddd89de1d7340f306931692e377977b8951 100644 +index f1b712b919235c97f138137fd0a140b49c793606..6316dfbe43467c0da4b0df5636f2889f9e2d9b9f 100644 --- a/ui/webui/resources/cr_elements/cr_shared_style.css +++ b/ui/webui/resources/cr_elements/cr_shared_style.css @@ -8,7 +8,8 @@ @@ -11,4 +11,4 @@ index eefaf6d369fb2a268045cfd33973a8cced5f56cb..97e8dddd89de1d7340f306931692e377 + * #include=cr-hidden-style br-shared-style cr-icons * #css_wrapper_metadata_end */ - [actionable] { + /* Purposefully empty since this style is generated at build time from the diff --git a/patches/ui-webui-resources-cr_elements-cr_shared_vars.css.patch b/patches/ui-webui-resources-cr_elements-cr_shared_vars.css.patch index 75e7919df6d3..3c3315f01e0c 100644 --- a/patches/ui-webui-resources-cr_elements-cr_shared_vars.css.patch +++ b/patches/ui-webui-resources-cr_elements-cr_shared_vars.css.patch @@ -1,5 +1,5 @@ diff --git a/ui/webui/resources/cr_elements/cr_shared_vars.css b/ui/webui/resources/cr_elements/cr_shared_vars.css -index 72a597e945e8c1037f5d06867c53b2d5649aaccc..1d18efb17764c7f598ce0f5af410fef7474de2ea 100644 +index baea083e3fee5d5f8a14f7d74184cd98a38b7299..a856721cd5acd05ab80ca536620490c5dda872e4 100644 --- a/ui/webui/resources/cr_elements/cr_shared_vars.css +++ b/ui/webui/resources/cr_elements/cr_shared_vars.css @@ -4,6 +4,7 @@ diff --git a/patches/v8/BUILD.gn.patch b/patches/v8/BUILD.gn.patch index 1dc1e8f38ee5..797e27fdd5f8 100644 --- a/patches/v8/BUILD.gn.patch +++ b/patches/v8/BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/BUILD.gn b/BUILD.gn -index 87b212921bb8d51fd5457a7b4d61ee956589c282..18c6eaacd1723928019fab1ca75383da8691eceb 100644 +index a0153cdf02e4e20d5895fde3d6190437a71a0836..5a1797dbe6fa619ce3b6719e570c78f625012a60 100644 --- a/BUILD.gn +++ b/BUILD.gn -@@ -762,6 +762,7 @@ config("internal_config_base") { +@@ -784,6 +784,7 @@ config("internal_config_base") { "include", "$target_gen_dir", ] @@ -10,7 +10,7 @@ index 87b212921bb8d51fd5457a7b4d61ee956589c282..18c6eaacd1723928019fab1ca75383da } config("internal_config") { -@@ -3235,6 +3236,7 @@ v8_header_set("v8_headers") { +@@ -3261,6 +3262,7 @@ v8_header_set("v8_headers") { ":cppgc_headers", ":v8_version", ] diff --git a/patches/v8/src-codegen-compiler.cc.patch b/patches/v8/src-codegen-compiler.cc.patch index b050ed392719..91cf4f06a2cd 100644 --- a/patches/v8/src-codegen-compiler.cc.patch +++ b/patches/v8/src-codegen-compiler.cc.patch @@ -1,8 +1,8 @@ diff --git a/src/codegen/compiler.cc b/src/codegen/compiler.cc -index 4215cee6ae7335c1ffa21735202458f52faeee2c..6a0c47366e4d93ff4861e05b93158848b0b64adf 100644 +index 7c14522bb6017744a0744889226382fe53c67749..4f6963b7ef4617d33ca5b28b9adb36d1ac1de467 100644 --- a/src/codegen/compiler.cc +++ b/src/codegen/compiler.cc -@@ -3279,6 +3279,7 @@ MaybeHandle Compiler::GetFunctionFromEval( +@@ -3306,6 +3306,7 @@ MaybeHandle Compiler::GetFunctionFromEval( } } DCHECK(is_compiled_scope.is_compiled()); diff --git a/renderer/brave_content_renderer_client.cc b/renderer/brave_content_renderer_client.cc index 57be5fb2a0a5..491505b927af 100644 --- a/renderer/brave_content_renderer_client.cc +++ b/renderer/brave_content_renderer_client.cc @@ -160,7 +160,7 @@ void BraveContentRendererClient::RenderFrameCreated( } if (base::FeatureList::IsEnabled(skus::features::kSkusFeature) && - !chrome::IsIncognitoProcess()) { + !IsIncognitoProcess()) { new skus::SkusRenderFrameObserver(render_frame); } @@ -184,7 +184,7 @@ void BraveContentRendererClient::RenderFrameCreated( #if BUILDFLAG(ENABLE_PLAYLIST) if (base::FeatureList::IsEnabled(playlist::features::kPlaylist) && - !chrome::IsIncognitoProcess()) { + !IsIncognitoProcess()) { new playlist::PlaylistRenderFrameObserver( render_frame, base::BindRepeating([] { return BraveRenderThreadObserver::GetDynamicParams().playlist_enabled; diff --git a/resources/resource_ids.spec b/resources/resource_ids.spec index 8c0c471b2330..05eef4c1d235 100644 --- a/resources/resource_ids.spec +++ b/resources/resource_ids.spec @@ -1,224 +1,224 @@ -# Since recent changes upstream, Chromium is now using IDs up to ~46310 +# Since recent changes upstream, Chromium is now using IDs up to ~59570 # (see end of //out/Component/gen/tools/gritsettings/default_resource_ids), -# so let's leave some padding after that and start assigning them on 47500. +# so let's leave some padding after that and start assigning them on 59580. { "SRCDIR": "../..", "brave/common/extensions/api/brave_api_resources.grd": { - "includes": [58800], + "includes": [59580], }, "brave/components/resources/brave_components_resources.grd": { - "includes": [58810], + "includes": [59600], }, # This file is generated during the build. "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-brave_adblock/brave_adblock.grd": { "META": {"sizes": {"includes": [10]}}, - "includes": [59000], + "includes": [59670], }, # This file is generated during the build. "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-brave_new_tab/brave_new_tab.grd": { "META": {"sizes": {"includes": [50]}}, - "includes": [59010], + "includes": [59680], }, # This file is generated during the build. "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-brave_welcome/brave_welcome.grd": { "META": {"sizes": {"includes": [20]}}, - "includes": [59060], + "includes": [59730], }, # This file is generated during the build. "<(SHARED_INTERMEDIATE_DIR)/brave/browser/resources/settings/brave_settings_resources.grd": { "META": {"sizes": {"includes": [20]}}, - "includes": [59080], + "includes": [59750], }, "brave/app/brave_generated_resources.grd": { - "includes": [59100], - "messages": [59150], + "includes": [59770], + "messages": [59780], }, "brave/app/theme/brave_theme_resources.grd": { - "structures": [60100], + "structures": [60200], }, "brave/app/theme/brave_unscaled_resources.grd": { - "includes": [60200], + "includes": [60300], }, # This file is generated during the build. "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-brave_webtorrent/brave_webtorrent.grd": { "META": {"sizes": {"includes": [10]}}, - "includes": [60210], + "includes": [60310], }, "brave/components/brave_webtorrent/resources.grd": { - "includes": [60220], + "includes": [60320], }, # This file is generated during the build. "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-brave_rewards_panel/brave_rewards_panel.grd": { "META": {"sizes": {"includes": [20]}}, - "includes": [60230], + "includes": [60330], }, "brave/components/brave_rewards/resources/brave_rewards_static_resources.grd": { - "includes": [60250], + "includes": [60350], }, # This file is generated during the build. "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-brave_rewards_page/brave_rewards_page.grd": { "META": {"sizes": {"includes": [20]}}, - "includes": [60260], + "includes": [60360], }, # This file is generated during the build. "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-brave_rewards_internals/brave_rewards_internals.grd": { "META": {"sizes": {"includes": [10]}}, - "includes": [60280], + "includes": [60380], }, # This file is generated during the build. "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-brave_rewards_tip/brave_rewards_tip.grd": { "META": {"sizes": {"includes": [20]}}, - "includes": [60290], + "includes": [60390], }, "brave/components/resources/brave_components_strings.grd": { - "messages": [60310], + "messages": [60410], }, "brave/components/brave_ads/resources/bat_ads_resources.grd": { - "includes": [62850] + "includes": [63500] }, # This file is generated during the build. "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-brave_wallet_page/brave_wallet_page.grd": { "META": {"sizes": {"includes": [200]}}, - "includes": [62860], + "includes": [63510], }, # This file is generated during the build. "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-ethereum_remote_client_page/ethereum_remote_client_page.grd": { "META": {"sizes": {"includes": [10]}}, - "includes": [63060], + "includes": [63710], }, # This file is generated during the build. "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-brave_wallet_panel/brave_wallet_panel.grd": { "META": {"sizes": {"includes": [200]}}, - "includes": [63070], + "includes": [63720], }, "brave/components/brave_extension/extension/resources.grd": { - "includes": [63270], + "includes": [63920], }, # This file is generated during the build. "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-brave_extension/brave_extension.grd": { "META": {"sizes": {"includes": [10]}}, - "includes": [63370], + "includes": [63940], }, # This file is generated during the build. "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-webcompat_reporter/webcompat_reporter.grd": { "META": {"sizes": {"includes": [10]}}, - "includes": [63380], + "includes": [63950], }, # This file is generated during the build. "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-cosmetic_filters/cosmetic_filters.grd": { "META": {"sizes": {"includes": [10]}}, - "includes": [63390], + "includes": [63960], }, "brave/components/tor/resources/tor_static_resources.grd": { - "includes": [63400], + "includes": [63970], }, # This file is generated during the build. "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-tor_internals/tor_internals.grd": { "META": {"sizes": {"includes": [10]}}, - "includes": [63410], + "includes": [63980], }, # This file is generated during the build. "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-brave_wallet_script/brave_wallet_script.grd": { "META": {"sizes": {"includes": [10]}}, - "includes": [63420], + "includes": [63990], }, # This file is generated during the build. "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-brave_vpn_panel/brave_vpn_panel.grd": { "META": {"sizes": {"includes": [10]}}, - "includes": [63430], + "includes": [64000], }, # This file is generated during the build. "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-brave_shields_panel/brave_shields_panel.grd": { "META": {"sizes": {"includes": [10]}}, - "includes": [63440], + "includes": [64010], }, # This file is generated during the build. "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-trezor_bridge/trezor_bridge.grd": { "META": {"sizes": {"includes": [10]}}, - "includes": [63450], + "includes": [64020], }, # This file is generated during the build. "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-market_display/market_display.grd": { - "META": {"sizes": {"includes": [100]}}, - "includes": [63460], + "META": {"sizes": {"includes": [50]}}, + "includes": [64030], }, # This file is generated during the build. "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-brave_private_new_tab/brave_private_new_tab.grd": { "META": {"sizes": {"includes": [10]}}, - "includes": [63560], + "includes": [64080], }, "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-playlist/playlist.grd": { "META": {"sizes": {"includes": [10]}}, - "includes": [63570], + "includes": [64090], }, "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-ledger_bridge/ledger_bridge.grd": { "META": {"sizes": {"includes": [10]}}, - "includes": [63580], + "includes": [64100], }, # This file is generated during the build. "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-nft_display/nft_display.grd": { - "META": {"sizes": {"includes": [90]}}, - "includes": [63590], + "META": {"sizes": {"includes": [10]}}, + "includes": [64110], }, "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-cookie_list_opt_in/cookie_list_opt_in.grd": { "META": {"sizes": {"includes": [10]}}, - "includes": [63680], + "includes": [64120], }, "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-brave_speedreader_toolbar/brave_speedreader_toolbar.grd": { "META": {"sizes": {"includes": [10]}}, - "includes": [63690], + "includes": [64130], }, "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-brave_adblock_internals/brave_adblock_internals.grd": { "META": {"sizes": {"includes": [10]}}, - "includes": [63700], + "includes": [64140], }, "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-commands/commands.grd": { "META": {"sizes": {"includes": [10]}}, - "includes": [63710], + "includes": [64150], }, "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-brave_wallet_swap_page/brave_wallet_swap_page.grd": { - "META": {"sizes": {"includes": [150]}}, - "includes": [63720], + "META": {"sizes": {"includes": [100]}}, + "includes": [64250], }, "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-brave_wallet_send_page/brave_wallet_send_page.grd": { - "META": {"sizes": {"includes": [100]}}, - "includes": [63870], + "META": {"sizes": {"includes": [50]}}, + "includes": [64300], }, "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-brave_wallet_deposit_page/brave_wallet_deposit_page.grd": { "META": {"sizes": {"includes": [100]}}, - "includes": [63970], + "includes": [64400], }, "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-brave_wallet_fund_wallet_page/brave_wallet_fund_wallet_page.grd": { - "META": {"sizes": {"includes": [100]}}, - "includes": [64070], + "META": {"sizes": {"includes": [80]}}, + "includes": [64500], }, "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-tip_panel/tip_panel.grd": { "META": {"sizes": {"includes": [20]}}, - "includes": [64170] + "includes": [64580] }, "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-ai_chat_ui/ai_chat_ui.grd": { - "META": {"sizes": {"includes": [200]}}, - "includes": [64190], + "META": {"sizes": {"includes": [10]}}, + "includes": [64600], }, "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-skus_internals/skus_internals.grd": { "META": {"sizes": {"includes": [10]}}, - "includes": [64390], + "includes": [64610], }, "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-brave_news_internals/brave_news_internals.grd": { "META": {"sizes": {"includes": [10]}}, - "includes": [64400], + "includes": [64620], }, # This file is generated during the build. "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-line_chart_display/line_chart_display.grd": { "META": {"sizes": {"includes": [10]}}, - "includes": [64410] + "includes": [64630] }, "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-ai_rewriter_ui/ai_rewriter_ui.grd": { "META": {"sizes": {"includes": [10]}}, - "includes": [64420], + "includes": [64640], }, "<(SHARED_INTERMEDIATE_DIR)/brave/web-ui-rewards_page/rewards_page.grd": { "META": {"sizes": {"includes": [50]}}, - "includes": [64430], + "includes": [64650], }, } diff --git a/test/BUILD.gn b/test/BUILD.gn index d66a6783a620..22ec08888aef 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -270,6 +270,7 @@ test("brave_unit_tests") { "//brave/vendor/brave_base", "//chrome:dependencies", "//chrome/app:command_ids", + "//chrome/browser/content_settings:content_settings_factory", "//chrome/browser/favicon", "//chrome/browser/permissions", "//chrome/browser/sync", @@ -501,7 +502,6 @@ test("brave_unit_tests") { "//chrome/android:chrome_apk_paks", "//chrome/test/android:chrome_java_test_support_common", "//components/gcm_driver/instance_id/android:instance_id_driver_test_support_java", - "//components/search_engines/android:delegate_public_impl_java", ] if (enable_brave_vpn || enable_ai_chat) { deps += [ "//brave/components/brave_mobile_subscription/renderer/android:unit_tests" ] @@ -578,7 +578,7 @@ test("brave_unit_tests") { source_set("crypto_unittests") { testonly = true - sources = [ "//crypto/symmetric_key_unittest.cc" ] + sources = [ "//crypto/kdf_unittest.cc" ] deps = [ "//base", @@ -933,6 +933,7 @@ test("brave_browser_tests") { "//chrome/app:command_ids", "//chrome/browser", "//chrome/browser:browser_process", + "//chrome/browser/content_settings:content_settings_factory", "//chrome/browser/enterprise/connectors/analysis:features", "//chrome/browser/media/router:media_router_feature", "//chrome/browser/profiles:profile", @@ -942,6 +943,7 @@ test("brave_browser_tests") { "//chrome/browser/ui:browser_navigator_params_headers", "//chrome/browser/ui/color:color_headers", "//chrome/browser/ui/color:mixers", + "//chrome/browser/ui/hats", "//chrome/browser/ui/omnibox", "//chrome/browser/web_applications", "//chrome/test:chrome_test_launcher", @@ -1311,6 +1313,7 @@ if (is_android) { "//chrome/test/android:chrome_java_test_support_common", "//components/browser_ui/bottomsheet/android:java", "//components/browser_ui/bottomsheet/android:manager_java", + "//components/browser_ui/desktop_windowing/android:java", "//components/browser_ui/settings/android:java", "//components/browser_ui/site_settings/android:java", "//components/browser_ui/util/android:java", diff --git a/test/data/ui/snapshots/notificationadpopupbrowsertest/checkthemechanged/withemoji_0/win/snapshot.png b/test/data/ui/snapshots/notificationadpopupbrowsertest/checkthemechanged/withemoji_0/win/snapshot.png index f678db856641..5f9c2aa6c2a9 100644 Binary files a/test/data/ui/snapshots/notificationadpopupbrowsertest/checkthemechanged/withemoji_0/win/snapshot.png and b/test/data/ui/snapshots/notificationadpopupbrowsertest/checkthemechanged/withemoji_0/win/snapshot.png differ diff --git a/test/data/ui/snapshots/notificationadpopupbrowsertest/checkthemechanged/withemoji_1/win/snapshot.png b/test/data/ui/snapshots/notificationadpopupbrowsertest/checkthemechanged/withemoji_1/win/snapshot.png index 6e378dd0abe2..a9d76d841c53 100644 Binary files a/test/data/ui/snapshots/notificationadpopupbrowsertest/checkthemechanged/withemoji_1/win/snapshot.png and b/test/data/ui/snapshots/notificationadpopupbrowsertest/checkthemechanged/withemoji_1/win/snapshot.png differ diff --git a/test/data/ui/snapshots/notificationadpopupbrowsertest/checkthemechanged/withoutemoji_0/win/snapshot.png b/test/data/ui/snapshots/notificationadpopupbrowsertest/checkthemechanged/withoutemoji_0/win/snapshot.png index f9bbf8acceac..ee11b736c286 100644 Binary files a/test/data/ui/snapshots/notificationadpopupbrowsertest/checkthemechanged/withoutemoji_0/win/snapshot.png and b/test/data/ui/snapshots/notificationadpopupbrowsertest/checkthemechanged/withoutemoji_0/win/snapshot.png differ diff --git a/test/data/ui/snapshots/notificationadpopupbrowsertest/checkthemechanged/withoutemoji_1/win/snapshot.png b/test/data/ui/snapshots/notificationadpopupbrowsertest/checkthemechanged/withoutemoji_1/win/snapshot.png index 0654bc72ebbc..5f428d9822df 100644 Binary files a/test/data/ui/snapshots/notificationadpopupbrowsertest/checkthemechanged/withoutemoji_1/win/snapshot.png and b/test/data/ui/snapshots/notificationadpopupbrowsertest/checkthemechanged/withoutemoji_1/win/snapshot.png differ diff --git a/test/filters/browser_tests.filter b/test/filters/browser_tests.filter index 3acbd1d27553..7405a7596819 100644 --- a/test/filters/browser_tests.filter +++ b/test/filters/browser_tests.filter @@ -13,6 +13,16 @@ -ProductSpecificationsEntryPointControllerBrowserTest.TriggerEntryPointWithNavigation* -ProductSpecificationsEntryPointControllerWithServerClusteringBrowserTest.TriggerEntryPointWithNavigation_ServerClustering +# These tests fail because we override BraveSidePanel::UpdateWidthOnEntryChanged +# to do nothing. +-SidePanelCoordinatorTest.ChangeSidePanelWidth +-SidePanelCoordinatorTest.ChangeSidePanelWidthMaxMin +-SidePanelCoordinatorTest.ChangeSidePanelWidthRTL +-SidePanelCoordinatorTest.SidePanelWidthPreference + +# This test fails because BraveSidePanel doesn't set State::kClosing +-SidePanelCoordinatorTest.OpenWhileClosing + # These crash due to what looks like an upstream bug of # AccessibilityLabelsServiceFactory missing the dependency on # MantaServiceFactory and/or MantaServiceFactory not being registered: @@ -52,6 +62,7 @@ -All/UserAnnotationsServiceExplicitAllowlistBrowserTest.*/* -ChromeRenderFrameObserverTest.OptGuideGetsText -DependencyParserModelLoaderBrowserTest.* +-HistoryEmbeddingsRestrictedSigninBrowserTest.SearchDoesNotReceiveAnswerForRestrictedSignin -OptimizationGuideInternalsPageBrowserTest.* -OptimizationGuideKeyedServiceBrowserTest.* -OptimizationGuideKeyedServiceEnterpriseBrowserTest.* @@ -149,6 +160,9 @@ -All/FileSystemAccessPickerRequiresUserGestureTest.* -All/HostedAppJitTestBaseDefaultDisabled.JITDisabledTest -All/HostedAppJitTestBaseDefaultEnabled.JITDisabledTest +# Looks like CosmeticFiltersJSHandler::OnRemoteDisconnect is preventing this +# test from exiting cleanly when it exits via GTEST_SKIP. +-AutofillSubmissionTest/FormAutocompleteSubmissionTest.DomMutationAfterAutofill/0 -DeveloperPrivateApiTest.InspectOffscreenDocument -DynamicOriginBrowserTest.DynamicUrl -DynamicOriginBrowserTest.InvalidDynamicResourceFailsToLoad @@ -282,6 +296,14 @@ # These tests fail because we disable kDesktopPWAsLinkCapturing -All/WebAppLinkCapturingParameterizedBrowserTest.CheckLinkCaptureCombinations/* -Capturable/WebAppLinkCapturingParameterizedBrowserTest.* +-Redirection_BackgroundDisposition/WebAppLinkCapturingParameterizedBrowserTest.* +-Redirection_NavigateCurrent/WebAppLinkCapturingParameterizedBrowserTest.CheckLinkCaptureCombinations/CaptureOn_AppWnd_ScopeA2B_ServerSideViaB_ViaLink_MiddleClick_WithOpener_TargetBlank +-Redirection_NavigateCurrent/WebAppLinkCapturingParameterizedBrowserTest.CheckLinkCaptureCombinations/CaptureOn_AppWnd_ScopeA2B_ServerSideViaB_ViaLink_ShiftClick_WithOpener_TargetBlank +-Redirection_OpenInApp_NewWindowDisposition/WebAppLinkCapturingParameterizedBrowserTest.* +-Redirection_OpenInChrome/WebAppLinkCapturingParameterizedBrowserTest.* +-RightClick/WebAppLinkCapturingParameterizedBrowserTest.* +-RightClickFocusAndNavigateExisting/NavigationCapturingTestWithAppBLaunched.CheckLinkCaptureCombinations/* +-RightClickNavigateNew/WebAppLinkCapturingParameterizedBrowserTest.* -ServiceWorker/WebAppLinkCapturingParameterizedBrowserTest.* # These tests fail because kPrerender2 feature is disabled. @@ -527,12 +549,33 @@ -All/ParentApprovalHandlingByExtensionSwitchTest.GrantParentApprovalWhenExtensionSwitchBecomesEnabled/* -All/ParentApprovalHandlingByExtensionSwitchTest.GrantParentParentApprovalOnInstallationIfExtensionSwitchEnabled/* -All/ParentApprovalRequestTest.RequestToInstallApprovedExtension/WithParentalControlsOnExtensionsManagedBy* +-All/SupervisedProfilePickerHideGuestModeTest.DeleteLastSupervisedProfile/WithHideGuestModeDisabled +-All/SupervisedProfilePickerHideGuestModeTest.DeleteLastSupervisedProfile/WithHideGuestModeEnabled +-All/SupervisedProfilePickerHideGuestModeTest.DeleteSupervisedProfile/WithHideGuestModeDisabled +-All/SupervisedProfilePickerHideGuestModeTest.DeleteSupervisedProfile/WithHideGuestModeEnabled +-All/SupervisedProfilePickerHideGuestModeTest.RegularProfile_GuestModeAvailable/WithHideGuestModeDisabled +-All/SupervisedProfilePickerHideGuestModeTest.RegularProfile_GuestModeAvailable/WithHideGuestModeEnabled -All/SupervisedUserURLFilterPrerenderingTest.OnURLChecked/* -All/SupervisedUserURLFilterTest.* -AuthenticatorDialogTest.InvokeUi* -AvatarToolbarButtonWithExplicitBrowserSigninBrowserTest.AccessibilityLabels -AvatarToolbarButtonWithImprovedSigninUIBrowserTest.PassphraseErrorSignedIn -AvatarToolbarButtonWithImprovedSigninUIBrowserTest.PassphraseErrorSyncing +-AvatarToolbarButtonWithImprovedSigninUIBrowserTest.UpgradeClientError +-BatchUploadBrowserTest.ClosingBrowserWithBatchUploadShouldStillAlowYouToOpenANewOne +-BatchUploadBrowserTest.OpenBatchUpload +-BatchUploadBrowserTest.OpenedDialogThenSigninPending +-BatchUploadBrowserTest.OpenedDialogThenSignout +-BatchUploadBrowserTest.ShouldShowBatchUploadEntryPointForDataTypeAddresses +-BatchUploadBrowserTest.ShouldShowBatchUploadEntryPointForDataTypePasswords +-BatchUploadBrowserTest.SigninPendingUserShouldNotBeAbleToOpenTheDialog +-BatchUploadDialogViewBrowserTest.* +-BatchUploadDialogViewPixelTest.* +-BatchUploadWithFakeDelegateBrowserTest.CloseDialogWithCancelButton +-BatchUploadWithFakeDelegateBrowserTest.CloseDialogWithSaveButtonAllSelected +-BookmarkAccountStorageChangeDialogTest.Show +-BookmarkAccountStorageMoveDialogInteractiveTest.* +-BookmarkAccountStorageMoveDialogPixelTest.* -ContextMenuForSupervisedUsersBrowserTest.SaveLinkAsEntryIsDisabledForUrlsBlockedByAsyncCheckerForChild -ContextMenuForSupervisedUsersBrowserTest.SaveLinkAsEntryIsDisabledForUrlsNotAccessibleForChild -ContextMenuForSupervisedUsersBrowserTest.SaveLinkAsEntryIsEnabledForUrlsAllowedByAsyncCheckerForChild @@ -582,6 +625,7 @@ -SupervisedUserNavigationThrottleTest.DisallowPrerendering -SupervisedUserNavigationThrottleTest.DontBlockSubFrame -SupervisedUserNavigationThrottleTest.NoNavigationObserverBlock +-SupervisedUserPendingStateNavigationTest.* -SupervisedUserURLFilterPrerenderingTest.OnURLChecked -SupervisedUserURLFilterTest.BlockNewTabAfterLoading -SupervisedUserURLFilterTest.BlockThenUnblock @@ -641,13 +685,13 @@ -All/UpdaterServiceCookiePrefsBrowserTest.NoSpecificBlockedCookieSpecs_GuestProfile/* -All/UpdaterServiceCookiePrefsBrowserTest.NoSpecificBlockedCookieSpecs_IncognitoProfile/* -FirstPartySetsBrowserTestWithSiteLeavingSet.CookieDeleted +-NativeUnpartitionedStorageTest/NativeUnpartitionedStorageAccessWhen3PCOff.CrossOriginsAccessWithCookieBlocking/0 -RequestStorageAccessForOriginBrowserTest.* -RequestStorageAccessForOriginEnabledBrowserTest.* -RequestStorageAccessForOriginWithCHIPSBrowserTest.* -RequestStorageAccessForOriginWithFirstPartySetsBrowserTest.* -RequestStorageAccessForOriginWithFirstPartySetsDisabledBrowserTest.* --RequestStorageAccessForWithFirstPartySetsBrowserTest.PermissionQueryCrossSiteFrame --RequestStorageAccessForWithFirstPartySetsBrowserTest.Permission_AutodeniedForServiceDomain +-RequestStorageAccessForWithFirstPartySetsBrowserTest.* -StorageAccessAPIAutograntsWithFedCMBrowserTest.* -StorageAccessAPIAutograntsWithFedCMOriginTrialBrowserTest.* -StorageAccessAPIBrowserTest.Permission_Denied_WithoutInteraction/* @@ -700,6 +744,7 @@ -TpcdMetadataDevtoolsObserverBrowserTest.DoesNotEmitDevtoolsIssueForSiteNotInAllowlist -TpcdMetadataDevtoolsObserverBrowserTest.DoesNotEmitDevtoolsIssueWithBlockedCookiesSetting -TpcdMetadataDevtoolsObserverBrowserTest.EmitsDevtoolsIssues +-TpcdMetadataDevtoolsObserverBrowserTest.EmitsDevtoolsIssuesForExemption -TpcdMetadataDevtoolsObserverDisabledBrowserTest.DoesNotEmitDevtoolsIssueWithMissingFeature -TpcdOriginTrialBrowserTest.* @@ -1015,6 +1060,7 @@ # identity_manager->AreRefreshTokensLoaded() -All/AvatarToolbarButtonBrowserTestWithExplicitBrowserSignin.*/* -All/ProfileMenuViewSignoutTestWithExplicitBrowserSigninFeature.*/* +-AvatarToolbarButtonEnterpriseBadgingBrowserTest.WorkBadgeAndSyncPaused -AvatarToolbarButtonEnterpriseBadgingBrowserTest.WorkBadgeNonTransientModeAndSyncPause -AvatarToolbarButtonEnterpriseBadgingBrowserTest.WorkBadgeTransientModeAndSyncPause -AvatarToolbarButtonWithExplicitBrowserSigninBrowserTest.SigninPaused* @@ -1135,6 +1181,11 @@ -All/OpenerHeuristicCurrentInteractionGrantBrowserTest.PopupInteractionWithStorageAccessGrant/* -All/OpenerHeuristicIframeInitiatorBrowserTest.URLsInitiatedByFirstPartyIframes_HavePopupStateWithFlag/* -All/OpenerHeuristicIframeInitiatorBrowserTest.URLsInitiatedByThirdPartyIframes_HavePopupStateWithFlag/* +-All/OpenerHeuristicInteractionTypesBrowserTest.InteractionTypeIsReportedToDipsDb/* +-All/OpenerHeuristicInteractionTypesBrowserTest.PopupInteraction/* +-All/OpenerHeuristicInteractionTypesBrowserTest.PopupInteraction_IsFollowedByPostPopupCookieAccess/* +-All/OpenerHeuristicInteractionTypesBrowserTest.PopupPastInteractionIsFollowedByPostPopupCookieAccess/* +-All/OpenerHeuristicMultiplePastInteractionTypesBrowserTest.PopupPastInteractionIsReported_MostRecentInteraction/* -All/OpenerHeuristicPastInteractionGrantBrowserTest.AdTaggedPopupPastInteractionIsReported_WithStorageAccessGrant/* -All/OpenerHeuristicPastInteractionGrantBrowserTest.PopupPastInteractionIsReported_WithStorageAccessGrant/* -AllSitesFollowingFirstPartyTest.MultipleSitesIncluded @@ -1178,6 +1229,7 @@ # These tests fail because the extension name contains "Chromium" instead of # "Chrome" (the string is hard-coded into the test) -All/PluginInfoHostImplBidiTest.GetPluginInfoForPdfViewerExtension/* +-All/PluginInfoHostImplBidiTestWithCr23Override.GetPluginInfoForPdfViewerExtension/* -PluginInfoHostImplTest.GetPluginInfoForPdfInternalPlugin # These tests fail with "Check failed: value. Trying to read an unregistered @@ -1283,6 +1335,7 @@ -HttpsUpgradesBrowserTest.UrlWithHttpScheme_ShouldUpgrade/* -HttpsUpgradesBrowserTest.UrlWithHttpsScheme_ShouldLoad/HttpsFirstModeIncognito -HttpsUpgradesBrowserTest.crbug1431026/* +-HttpsUpgradesHeuristicsWithoutBalancedModeBrowserTest.UrlWithHttpScheme_BrokenSSL_SiteEngagementHeuristicWithoutBalancedMode_ShouldIgnore/0 -HttpsUpgradesPrefsBrowserTest.PrefStatesRecorded -HttpsUpgradesPrefsIncognitoEnabledBrowserTest.PrefStatesRecorded @@ -1359,6 +1412,7 @@ -RequestStorageAccessForWithFirstPartySetsBrowserTest.RequestStorageAccessForTopLevelScoping -RequestStorageAccessForWithFirstPartySetsBrowserTest.RequestStorageAccessForTopLevelScopingWhenRequestedFromSubdomain -StorageAccessAPIOriginIsolationBrowserTest.* +-StorageAccessHeadersBrowserTest.NonCookieStorage_Subresource -StorageAccessHeadersBrowserTest.RequestHeadersCookiesBlocked -StorageAccessHeadersBrowserTest.RequestHeaderRetryToActive -StorageAccessHeadersBrowserTest.RequestHeadersInactive @@ -1370,6 +1424,7 @@ -CommerceInternalsBrowserTest.InternalsPageOpen # Flaky upstream. +-All/PDFExtensionScrollTest.WithArrowLeftRightScrollToPage/* -All/PDFExtensionScrollTest.WithPageDownUp/* -All/PDFExtensionScrollTest.WithSpace/* -All/WebViewPdfTest.ContextMenuNavigationInWebView/1 @@ -1418,10 +1473,15 @@ # These tests fail because we provide our own override of the side panel which # does not enable this feature +-All/LensOverlayControllerBrowserPDFContextualizationTest.LargePdfNotIncludedInRequest/* +-All/LensOverlayControllerBrowserPDFContextualizationTest.PdfBytesIncludedInRequest/* +-All/LensOverlayControllerBrowserPDFContextualizationTest.PdfBytesInFollowUpRequest/* -All/LensOverlayControllerBrowserPDFTest.ContextMenuOpensOverlay/* -LensOverlayControllerBrowserTest.* -LensOverlayControllerBrowserFullscreenDisabled.* -LensOverlayControllerBrowserWithPixelsTest.* +-LensOverlayControllerContextualFeaturesDisabledTest.* +-LensOverlayControllerInnerHtmlEnabledTest.* -LensOverlayControllerOverlaySearchbox.OverlaySearchboxPageClassificationAndState # This test fails because we don't implement an accent color for titlebars or @@ -1540,6 +1600,9 @@ # c'tor. https://github.com/brave/brave-browser/issues/34103 -All/BrowserFrameColorProviderTest.* +# This test fails because drop shadow doesn't match. +-AccessibilityFocusHighlightBrowserTest.FocusAppearance + # These tests hang trying to SetEmptyTestingFactory for # TemplateURLServiceFactory. The hang happens in # ChromeTemplateURLServiceClient::Shutdown -> HistoryService::RemoveObserver, @@ -1589,9 +1652,6 @@ -SearchEngineRepromptBrowserTest.Reprompt/1 -TaggedOnlySearchEngineChoiceDialogBrowserTest.DialogTriggers -# This test fails because we disable kVisualQuerySuggestions --VisualQuerySuggestionsServiceBrowserTest.VisualQuerySuggestionsServiceEnabled - # Fails because we customized PIP UI. # https://github.com/brave/brave-browser/issues/35263 -PictureInPicturePixelComparisonBrowserTest.VideoPlay @@ -1652,9 +1712,16 @@ -BrowserNavigatorIwaTest.* -BrowsingDataModelBrowserTest.IsolatedWebAppUsageInDefaultStoragePartitionModel -ChromeDirectSocketsApiAvailabilityIsolatedWebAppsTest.*/* +-ChromeDirectSocketsTcpIsolatedWebAppTest.TcpConnectionToPrivateFailsWithoutPNAContentSetting +-ChromeDirectSocketsTcpIsolatedWebAppTest.TcpConnectionToPrivateFailsWithoutPNAPermission -ChromeDirectSocketsTcpIsolatedWebAppTest.TcpReadWrite -ChromeDirectSocketsTcpServerIsolatedWebAppTest.* +-ChromeDirectSocketsUdpIsolatedWebAppTest.UdpConnectionToPrivateFailsWithoutPNAContentSetting +-ChromeDirectSocketsUdpIsolatedWebAppTest.UdpConnectionToPrivateFailsWithoutPNAPermission -ChromeDirectSocketsUdpIsolatedWebAppTest.UdpReadWrite +-ChromeDirectSocketsUdpIsolatedWebAppTest.UdpServerFailsWithoutPNAContentSetting +-ChromeDirectSocketsUdpIsolatedWebAppTest.UdpServerFailsWithoutPNAPermission +-ChromeDirectSocketsUdpIsolatedWebAppTest.UdpServerPortRestrictions -ChromeDirectSocketsUdpIsolatedWebAppTest.UdpServerReadWrite -ControlledFrameDisabledTest.* -ControlledFrameNotAvailableChannels/ControlledFrameNotAvailableChannelTest.* @@ -1693,6 +1760,7 @@ -TabDesktopMediaListIwaTest.* -TabDesktopMediaListWithIwaIncludedTest.* -WebAppInternalsIwaInstallationBrowserTest.FetchUpdateManifestAndInstallIwa +-WebAppInternalsIwaInstallationBrowserTest.FetchUpdateManifestAndInstallIwaAndUpdate -WebAppTagIsolatedWebAppTest.IsolatedWebAppTaskCreated -WebAppTagIsolatedWebAppTest.IsolatedWebAppTaskTitleFallbackToAppName @@ -1711,6 +1779,7 @@ -FileSystemAccessBrowserSlowLoadTest.WaitUntilLoaded -FileSystemAccessBrowserTestForWebUI.* -FileSystemObserverTest.ErrorsAfterPermissionsAreRevoked +-FileSystemObserverTest.ErrorsAfterRevokeAllActiveGrants -FileSystemObserverTest.StorageAccess* -PageInfoBubbleViewBrowserTest.InteractedWithFileSystemSubpage @@ -1797,6 +1866,9 @@ -SendTabToSelfBubbleTest.InvokeUi_ShowDeviceList -SendTabToSelfBubbleTest.InvokeUi_ShowNoTargetDevicePromo -SendTabToSelfBubbleTest.InvokeUi_ShowSigninPromo +-SendTabToSelfToolbarIconControllerTest.DisplayNewEntry +-SendTabToSelfToolbarIconControllerTest.ReplaceExistingEntry +-SendTabToSelfToolbarIconControllerTest.StorePendingNewEntry # These test fail because kToolbarPinning is disabled -ChromeLabsMultipleFeaturesUiTest.InvokeUi_default diff --git a/test/filters/unit_tests.filter b/test/filters/unit_tests.filter index 7085d6af1f30..13d883ff4cb1 100644 --- a/test/filters/unit_tests.filter +++ b/test/filters/unit_tests.filter @@ -5,6 +5,10 @@ ## why the filter is required and create an associated tracking issue. ## +# These tests won't work without TPM hardware +-TPMMetricsProviderTest.GetMetricsFullName +-TpmIdentifierTest.TpmTest + # This test fails because of the following CHECK in identity_test_utils.cc: # identity_manager->AreRefreshTokensLoaded() -AutofillBubbleSignInPromoControllerTest.RunsCallbackUponSignInWithExistingAccount @@ -25,6 +29,12 @@ -MV2/ExtensionProtocolsTest.MetadataFolder/0 -MV3/ExtensionProtocolsTest.MetadataFolder/0 +# These tests fail because sync_helper::IsSyncable(extension) resturns false +# due to UPDATER_DEV_ENDPOINT being empty and not matching expected store URL. +-ExtensionSyncServiceCustomGalleryTest.ProcessSyncDataDeferredEnable +-ExtensionSyncServiceCustomGalleryTest.ProcessSyncDataPermissionApproval +-ExtensionSyncServiceTest.AccountExtensionTypeChangesWithSync + # This test fails because BRAVE_FINGERPRINTING_V2 and BRAVE_HTTPS_UPGRADE don't # have readable names and aren't in the test's list of types that are expected # to have no name. @@ -135,6 +145,19 @@ -RelatedWebsiteSetsSourceTest.RWS_Empty -RelatedWebsiteSetsSourceTest.SubsetsAreSorted +# These tests fail because we override PrivacySandboxSettings, specifically +# BravePrivacySandboxSettings::AreRelatedWebsiteSetsEnabled() returns false. +-All/FirstPartySetsPolicyServicePrefTest.FindEntry_* +-All/FirstPartySetsPolicyServicePrefTest.ForEachEffectiveSetEntry_* +-FirstPartySetsPolicyServiceFactoryTest.OffTheRecordProfile_DistinctAndDisabled +-FirstPartySetsPolicyServiceResumeThrottleTest.RegisterThrottleResumeCallback +-FirstPartySetsPolicyServiceTest.* + +# These tests fail because we change the default for TOP_LEVEL_STORAGE_ACCESS +# to CONTENT_SETTING_BLOCK. +-TopLevelStorageAccessPermissionContextAPIWithFirstPartySetsTest.ImplicitGrant_AutograntedWithinFPS +-TopLevelStorageAccessPermissionContextAPIWithFirstPartySetsTest.ImplicitGrant_CrossSiteFrameQueryStillAsk + # These tests crash due to TestingBraveBrowserProcess::extension_whitelist_service() # having NOTREACHED which causes an immediate crash -All/UnpackedInstallerUnitTest.WithheldHostPermissionsWithFlag/* @@ -329,6 +352,13 @@ # These tests fail because IdentityManager's primary account has no kSignin # consent level +-AccountExtensionTrackerUnitTest.AccountExtensionTypeResetWhenSignedOut +-AccountExtensionTrackerUnitTest.AccountExtensionTypeSignedIn +-AccountExtensionTrackerUnitTest.AccountExtensionTypeTransportMode +-ChromeAutofillPredictionImprovementsClientTest.EligibilityOfNotSignedInUser +-ChromeAutofillPredictionImprovementsClientTest.EligibilityOfSignedInUser +-ChromeAutofillPredictionImprovementsClientTest.EligibilityOfSignedInUserWithMlDisabled +-ChromeAutofillPredictionImprovementsClientTest.EligibilityOfSignedInUserWithMlEnabled -EnclaveAuthenticatorRequestDelegateTest.BrowserProvidedPasskeysAvailable -EnclaveManagerTest.PrimaryUserChange -ManagePasswordsUIControllerWithBrowserTestExplicitBrowserSignin.MovePasswordUponSigninWithExistingAccount @@ -419,10 +449,12 @@ -ClientSideDetectionRTLookupResponseForceRequestTest.AsyncCheckTrackerNotTriggerClassificationRequestAlreadyPhishing -ClientSideDetectionRTLookupResponseForceRequestTest.AsyncCheckTrackerNotTriggerClassificationRequestNoEnforcedPing -ClientSideDetectionRTLookupResponseForceRequestTest.AsyncCheckTrackerTriggersClassificationRequest +-ClientSideDetectionRTLookupResponseForceRequestTest.AsyncCheckTrackerTriggersClassificationRequestOnAllowlistMatch -DownloadBubblePrefsTest.EnhancedProtectionEnabled -DownloadBubbleRowViewInfoTest.ShouldShowNoticeForEnhancedProtectionScan -DownloadWarningDesktopHatsUtilsTest.ProductSpecificData_EnhancedSafeBrowsing -EnhancedProtectionDownloadTest.* +-ExternalAppRedirectCheckingTest.ShouldReportExternalAppRedirect -ImmediateDeepScanTest.ESBRequestScan -ImmediateDeepScanTest.EncryptedArchive -NotificationMetricsLoggerTest.PersistentNotificationSize @@ -468,6 +500,10 @@ -MemorySaverChipViewWithPerformanceSidePanelTest.OpensSidePanel -ReadAnythingCoordinatorScreen2xDataCollectionModeTest.OnBrowserSetLastActive_SidePanelIsVisible +# https://issues.chromium.org/issues/41484323 +-TabSearchPageHandlerDeclutterTest.TabDeclutterFindStaleTabs +-TabSearchPageHandlerDeclutterTest.TabDeclutterObserverTest + # This test fails because we insert our own bookmarks submenu into the app menu # model -TestAppMenuModelCR2023.ModelHasIcons @@ -520,9 +556,6 @@ -All/SiteSettingsHandlerTest.NotificationPermissionRevokeUkm/* -All/UnusedSitePermissionsServiceTest.UnusedSitePermissionsServiceTest/* -# This test fails because we disable kVisualQuerySuggestions --CompanionUrlBuilderTest.MsbbAndPcOn - # This test fails because we replace WebUI chrome:// scheme with brave:// -ChromeURLsTest.ContainsConfigURLs diff --git a/third_party/blink/renderer/core/brave_page_graph/page_graph.cc b/third_party/blink/renderer/core/brave_page_graph/page_graph.cc index 190ba0dd7e5b..4ed6cb767a18 100644 --- a/third_party/blink/renderer/core/brave_page_graph/page_graph.cc +++ b/third_party/blink/renderer/core/brave_page_graph/page_graph.cc @@ -941,9 +941,10 @@ void PageGraph::RegisterPageGraphJavaScriptUrl(blink::Document* document, processed_js_urls_.insert(execution_context, Vector()) .stored_value->value.push_back(ProcessedJavascriptURL{ - .script_code = blink::DecodeURLEscapeSequences( - url, blink::DecodeURLMode::kUTF8OrIsomorphic) - .Substring(kJavascriptSchemeLength), + .script_code = + blink::DecodeURLEscapeSequences( + url.GetString(), blink::DecodeURLMode::kUTF8OrIsomorphic) + .Substring(kJavascriptSchemeLength), .parent_script_id = GetExecutingScriptId(execution_context), }); } diff --git a/third_party/blink/renderer/core/farbling/brave_session_cache.cc b/third_party/blink/renderer/core/farbling/brave_session_cache.cc index 62695f70fdf9..24a96191238b 100644 --- a/third_party/blink/renderer/core/farbling/brave_session_cache.cc +++ b/third_party/blink/renderer/core/farbling/brave_session_cache.cc @@ -328,11 +328,10 @@ WTF::String BraveSessionCache::GenerateRandomString(std::string seed, CHECK(h.Sign(seed, key, sizeof key)); // initial PRNG seed based on session key and passed-in seed string uint64_t v = *reinterpret_cast(key); - UChar* destination; + base::span destination; WTF::String value = WTF::String::CreateUninitialized(length, destination); - for (wtf_size_t i = 0; i < length; i++) { - destination[i] = - kLettersForRandomStrings[v % kLettersForRandomStringsLength]; + for (auto& c : destination) { + c = kLettersForRandomStrings[v % kLettersForRandomStringsLength]; v = lfsr_next(v); } return value; diff --git a/third_party/rust/anyhow/v1/README.chromium b/third_party/rust/anyhow/v1/README.chromium index cc9966bb71c4..187b39841dcf 100644 --- a/third_party/rust/anyhow/v1/README.chromium +++ b/third_party/rust/anyhow/v1/README.chromium @@ -1,7 +1,7 @@ Name: anyhow URL: https://crates.io/crates/anyhow Description: Flexible concrete Error type built on std::error::Error -Version: 1.0.87 +Version: 1.0.89 Security Critical: yes Shipped: yes License: Apache 2.0 diff --git a/third_party/rust/bitflags/v1/BUILD.gn b/third_party/rust/bitflags/v1/BUILD.gn index ba8b668a98e0..0ebfc2c296db 100644 --- a/third_party/rust/bitflags/v1/BUILD.gn +++ b/third_party/rust/bitflags/v1/BUILD.gn @@ -3,6 +3,34 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at https://mozilla.org/MPL/2.0/. -group("lib") { - public_deps = [ "//third_party/rust/bitflags/v1:lib" ] +# @generated from third_party/rust/chromium_crates_io/BUILD.gn.hbs by +# tools/crates/gnrt. +# Do not edit! + +import("//build/rust/cargo_crate.gni") + +cargo_crate("lib") { + crate_name = "bitflags" + epoch = "1" + crate_type = "rlib" + crate_root = "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/src/lib.rs" + sources = [ + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/src/example_generated.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/src/lib.rs", + ] + inputs = [] + + build_native_rust_unit_tests = false + edition = "2018" + cargo_pkg_version = "1.3.2" + cargo_pkg_authors = "The Rust Project Developers" + cargo_pkg_name = "bitflags" + cargo_pkg_description = + "A macro to generate structures which behave like bitflags." + library_configs -= [ "//build/config/compiler:chromium_code" ] + library_configs += [ "//build/config/compiler:no_chromium_code" ] + executable_configs -= [ "//build/config/compiler:chromium_code" ] + executable_configs += [ "//build/config/compiler:no_chromium_code" ] + proc_macro_configs -= [ "//build/config/compiler:chromium_code" ] + proc_macro_configs += [ "//build/config/compiler:no_chromium_code" ] } diff --git a/third_party/rust/bitflags/v1/README.chromium b/third_party/rust/bitflags/v1/README.chromium index 0ed3abbab33c..0f0829502d38 100644 --- a/third_party/rust/bitflags/v1/README.chromium +++ b/third_party/rust/bitflags/v1/README.chromium @@ -6,4 +6,5 @@ Version: 1.3.2 Security Critical: yes Shipped: yes License: Apache 2.0 -License File: +License File: //brave/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/LICENSE-APACHE +Revision: ed185cfb1c447c1b4bd6ac021c9ec3bb02c9e2f2 diff --git a/third_party/rust/bitflags/v2/BUILD.gn b/third_party/rust/bitflags/v2/BUILD.gn index d37afeb4deee..ab8919a12829 100644 --- a/third_party/rust/bitflags/v2/BUILD.gn +++ b/third_party/rust/bitflags/v2/BUILD.gn @@ -3,6 +3,70 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at https://mozilla.org/MPL/2.0/. -group("lib") { - public_deps = [ "//third_party/rust/bitflags/v2:lib" ] +# @generated from third_party/rust/chromium_crates_io/BUILD.gn.hbs by +# tools/crates/gnrt. +# Do not edit! + +import("//build/rust/cargo_crate.gni") + +cargo_crate("lib") { + crate_name = "bitflags" + epoch = "2" + crate_type = "rlib" + crate_root = "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/lib.rs" + sources = [ + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/example_generated.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/external.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/external/arbitrary.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/external/bytemuck.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/external/serde.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/internal.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/iter.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/lib.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/parser.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/public.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/all.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/bits.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/complement.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/contains.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/difference.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/empty.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/eq.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/extend.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/flags.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/fmt.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/from_bits.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/from_bits_retain.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/from_bits_truncate.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/from_name.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/insert.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/intersection.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/intersects.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/is_all.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/is_empty.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/iter.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/parser.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/remove.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/symmetric_difference.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/union.rs", + "//brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/traits.rs", + ] + inputs = [] + + build_native_rust_unit_tests = false + edition = "2021" + cargo_pkg_version = "2.6.0" + cargo_pkg_authors = "The Rust Project Developers" + cargo_pkg_name = "bitflags" + cargo_pkg_description = + "A macro to generate structures which behave like bitflags." + library_configs -= [ "//build/config/compiler:chromium_code" ] + library_configs += [ "//build/config/compiler:no_chromium_code" ] + executable_configs -= [ "//build/config/compiler:chromium_code" ] + executable_configs += [ "//build/config/compiler:no_chromium_code" ] + proc_macro_configs -= [ "//build/config/compiler:chromium_code" ] + proc_macro_configs += [ "//build/config/compiler:no_chromium_code" ] + deps = [ "//brave/third_party/rust/serde/v1:lib" ] + features = [ "serde" ] } diff --git a/third_party/rust/bitflags/v2/README.chromium b/third_party/rust/bitflags/v2/README.chromium index 13575fa125c1..1a0f4cf54a29 100644 --- a/third_party/rust/bitflags/v2/README.chromium +++ b/third_party/rust/bitflags/v2/README.chromium @@ -6,4 +6,5 @@ Version: 2.6.0 Security Critical: yes Shipped: yes License: Apache 2.0 -License File: +License File: //brave/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/LICENSE-APACHE +Revision: 13513699141432af1dea2a6208e99e7bf21958db diff --git a/third_party/rust/chromium_crates_io/Cargo.lock b/third_party/rust/chromium_crates_io/Cargo.lock index c24ee3c4c49d..1085c704e669 100644 --- a/third_party/rust/chromium_crates_io/Cargo.lock +++ b/third_party/rust/chromium_crates_io/Cargo.lock @@ -111,7 +111,7 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.87" +version = "1.0.89" [[package]] name = "arrayref" @@ -571,7 +571,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -594,7 +594,7 @@ version = "1.0.128" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -1326,7 +1326,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.158" +version = "0.2.159" [[package]] name = "libm" @@ -1562,7 +1562,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -1859,7 +1859,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.87" dependencies = [ "unicode-ident", ] @@ -1997,7 +1997,7 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.6" +version = "1.11.0" dependencies = [ "aho-corasick", "memchr", @@ -2007,7 +2007,7 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.8" dependencies = [ "aho-corasick", "memchr", @@ -2016,7 +2016,7 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.5" [[package]] name = "rmp" @@ -2133,7 +2133,7 @@ version = "1.0.210" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -2418,6 +2418,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "syn" version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2", "quote", @@ -2426,7 +2427,7 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.77" +version = "2.0.79" dependencies = [ "proc-macro2", "quote", @@ -2557,7 +2558,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -2603,7 +2604,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" [[package]] name = "unicode-normalization" @@ -2699,7 +2700,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", "wasm-bindgen-shared", ] @@ -2719,7 +2720,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2892,7 +2893,7 @@ version = "0.7.35" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] diff --git a/third_party/rust/chromium_crates_io/Cargo.toml b/third_party/rust/chromium_crates_io/Cargo.toml index 5e1aa770afe5..007466611429 100644 --- a/third_party/rust/chromium_crates_io/Cargo.toml +++ b/third_party/rust/chromium_crates_io/Cargo.toml @@ -84,7 +84,7 @@ path = "../../../../third_party/rust/chromium_crates_io/vendor/aho-corasick-1.1. package = "aho-corasick" [patch.crates-io.anyhow_v1] -path = "../../../../third_party/rust/chromium_crates_io/vendor/anyhow-1.0.87" +path = "../../../../third_party/rust/chromium_crates_io/vendor/anyhow-1.0.89" package = "anyhow" [patch.crates-io.base64_v0_13] @@ -136,7 +136,7 @@ path = "../../../../third_party/rust/chromium_crates_io/vendor/lazy_static-1.5.0 package = "lazy_static" [patch.crates-io.libc_v0_2] -path = "../../../../third_party/rust/chromium_crates_io/vendor/libc-0.2.158" +path = "../../../../third_party/rust/chromium_crates_io/vendor/libc-0.2.159" package = "libc" [patch.crates-io.log_v0_4] @@ -152,7 +152,7 @@ path = "../../../../third_party/rust/chromium_crates_io/vendor/ppv-lite86-0.2.20 package = "ppv-lite86" [patch.crates-io.proc_macro2_v1] -path = "../../../../third_party/rust/chromium_crates_io/vendor/proc-macro2-1.0.86" +path = "../../../../third_party/rust/chromium_crates_io/vendor/proc-macro2-1.0.87" package = "proc-macro2" [patch.crates-io.quote_v1] @@ -172,15 +172,15 @@ path = "../../../../third_party/rust/chromium_crates_io/vendor/rand-0.8.5" package = "rand" [patch.crates-io.regex_v1] -path = "../../../../third_party/rust/chromium_crates_io/vendor/regex-1.10.6" +path = "../../../../third_party/rust/chromium_crates_io/vendor/regex-1.11.0" package = "regex" [patch.crates-io.regex_automata_v0_4] -path = "../../../../third_party/rust/chromium_crates_io/vendor/regex-automata-0.4.7" +path = "../../../../third_party/rust/chromium_crates_io/vendor/regex-automata-0.4.8" package = "regex-automata" [patch.crates-io.regex_syntax_v0_8] -path = "../../../../third_party/rust/chromium_crates_io/vendor/regex-syntax-0.8.4" +path = "../../../../third_party/rust/chromium_crates_io/vendor/regex-syntax-0.8.5" package = "regex-syntax" [patch.crates-io.rustc_version_v0_4] @@ -211,16 +211,12 @@ package = "serde" path = "../../../../third_party/rust/chromium_crates_io/vendor/static_assertions-1.1.0" package = "static_assertions" -[patch.crates-io.syn_v1] -path = "../../../../third_party/rust/chromium_crates_io/vendor/syn-1.0.109" -package = "syn" - [patch.crates-io.syn_v2] -path = "../../../../third_party/rust/chromium_crates_io/vendor/syn-2.0.77" +path = "../../../../third_party/rust/chromium_crates_io/vendor/syn-2.0.79" package = "syn" [patch.crates-io.unicode-ident_v1] -path = "../../../../third_party/rust/chromium_crates_io/vendor/unicode-ident-1.0.12" +path = "../../../../third_party/rust/chromium_crates_io/vendor/unicode-ident-1.0.13" package = "unicode-ident" [patch.crates-io.zcash_v1] diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/.cargo-checksum.json b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/.cargo-checksum.json new file mode 100644 index 000000000000..697c9ce2fbb4 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{}} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/.cargo_vcs_info.json b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/.cargo_vcs_info.json new file mode 100644 index 000000000000..8e82c01fc941 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/.cargo_vcs_info.json @@ -0,0 +1,5 @@ +{ + "git": { + "sha1": "ed185cfb1c447c1b4bd6ac021c9ec3bb02c9e2f2" + } +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/.github/workflows/rust.yml b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/.github/workflows/rust.yml new file mode 100644 index 000000000000..ffe0edad1b3d --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/.github/workflows/rust.yml @@ -0,0 +1,56 @@ +name: Rust + +on: [push, pull_request] + +env: + CARGO_TERM_COLOR: always + +jobs: + check: + name: Test + runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + rust: + - stable + - beta + - nightly + - 1.46.0 + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.rust }} + override: true + + - name: Default features + uses: actions-rs/cargo@v1 + with: + command: test + args: --features example_generated + + embedded: + name: Build (embedded) + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + target: thumbv6m-none-eabi + override: true + + - name: Default features + uses: actions-rs/cargo@v1 + with: + command: build + args: -Z avoid-dev-deps --features example_generated --target thumbv6m-none-eabi diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/.gitignore b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/.gitignore new file mode 100644 index 000000000000..61c33314e6d9 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/.gitignore @@ -0,0 +1,5 @@ +wip +target +Cargo.lock + +/.idea/ diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/CHANGELOG.md b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/CHANGELOG.md new file mode 100644 index 000000000000..12fea1673ac3 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/CHANGELOG.md @@ -0,0 +1,206 @@ +# 1.3.2 + +- Allow `non_snake_case` in generated flags types ([#256]) + +[#252]: https://github.com/bitflags/bitflags/pull/256 + +# 1.3.1 + +- Revert unconditional `#[repr(transparent)]` ([#252]) + +[#252]: https://github.com/bitflags/bitflags/pull/252 + +# 1.3.0 (yanked) + +- Add `#[repr(transparent)]` ([#187]) + +- End `empty` doc comment with full stop ([#202]) + +- Fix typo in crate root docs ([#206]) + +- Document from_bits_unchecked unsafety ([#207]) + +- Let `is_all` ignore extra bits ([#211]) + +- Allows empty flag definition ([#225]) + +- Making crate accessible from std ([#227]) + +- Make `from_bits` a const fn ([#229]) + +- Allow multiple bitflags structs in one macro invocation ([#235]) + +- Add named functions to perform set operations ([#244]) + +- Fix typos in method docs ([#245]) + +- Modernization of the `bitflags` macro to take advantage of newer features and 2018 idioms ([#246]) + +- Fix regression (in an unreleased feature) and simplify tests ([#247]) + +- Use `Self` and fix bug when overriding `stringify!` ([#249]) + +[#187]: https://github.com/bitflags/bitflags/pull/187 +[#202]: https://github.com/bitflags/bitflags/pull/202 +[#206]: https://github.com/bitflags/bitflags/pull/206 +[#207]: https://github.com/bitflags/bitflags/pull/207 +[#211]: https://github.com/bitflags/bitflags/pull/211 +[#225]: https://github.com/bitflags/bitflags/pull/225 +[#227]: https://github.com/bitflags/bitflags/pull/227 +[#229]: https://github.com/bitflags/bitflags/pull/229 +[#235]: https://github.com/bitflags/bitflags/pull/235 +[#244]: https://github.com/bitflags/bitflags/pull/244 +[#245]: https://github.com/bitflags/bitflags/pull/245 +[#246]: https://github.com/bitflags/bitflags/pull/246 +[#247]: https://github.com/bitflags/bitflags/pull/247 +[#249]: https://github.com/bitflags/bitflags/pull/249 + +# 1.2.1 + +- Remove extraneous `#[inline]` attributes ([#194]) + +[#194]: https://github.com/bitflags/bitflags/pull/194 + +# 1.2.0 + +- Fix typo: {Lower, Upper}Exp - {Lower, Upper}Hex ([#183]) + +- Add support for "unknown" bits ([#188]) + +[#183]: https://github.com/rust-lang-nursery/bitflags/pull/183 +[#188]: https://github.com/rust-lang-nursery/bitflags/pull/188 + +# 1.1.0 + +This is a re-release of `1.0.5`, which was yanked due to a bug in the RLS. + +# 1.0.5 + +- Use compiletest_rs flags supported by stable toolchain ([#171]) + +- Put the user provided attributes first ([#173]) + +- Make bitflags methods `const` on newer compilers ([#175]) + +[#171]: https://github.com/rust-lang-nursery/bitflags/pull/171 +[#173]: https://github.com/rust-lang-nursery/bitflags/pull/173 +[#175]: https://github.com/rust-lang-nursery/bitflags/pull/175 + +# 1.0.4 + +- Support Rust 2018 style macro imports ([#165]) + + ```rust + use bitflags::bitflags; + ``` + +[#165]: https://github.com/rust-lang-nursery/bitflags/pull/165 + +# 1.0.3 + +- Improve zero value flag handling and documentation ([#157]) + +[#157]: https://github.com/rust-lang-nursery/bitflags/pull/157 + +# 1.0.2 + +- 30% improvement in compile time of bitflags crate ([#156]) + +- Documentation improvements ([#153]) + +- Implementation cleanup ([#149]) + +[#156]: https://github.com/rust-lang-nursery/bitflags/pull/156 +[#153]: https://github.com/rust-lang-nursery/bitflags/pull/153 +[#149]: https://github.com/rust-lang-nursery/bitflags/pull/149 + +# 1.0.1 +- Add support for `pub(restricted)` specifier on the bitflags struct ([#135]) +- Optimize performance of `all()` when called from a separate crate ([#136]) + +[#135]: https://github.com/rust-lang-nursery/bitflags/pull/135 +[#136]: https://github.com/rust-lang-nursery/bitflags/pull/136 + +# 1.0.0 +- **[breaking change]** Macro now generates [associated constants](https://doc.rust-lang.org/reference/items.html#associated-constants) ([#24]) + +- **[breaking change]** Minimum supported version is Rust **1.20**, due to usage of associated constants + +- After being broken in 0.9, the `#[deprecated]` attribute is now supported again ([#112]) + +- Other improvements to unit tests and documentation ([#106] and [#115]) + +[#24]: https://github.com/rust-lang-nursery/bitflags/pull/24 +[#106]: https://github.com/rust-lang-nursery/bitflags/pull/106 +[#112]: https://github.com/rust-lang-nursery/bitflags/pull/112 +[#115]: https://github.com/rust-lang-nursery/bitflags/pull/115 + +## How to update your code to use associated constants +Assuming the following structure definition: +```rust +bitflags! { + struct Something: u8 { + const FOO = 0b01, + const BAR = 0b10 + } +} +``` +In 0.9 and older you could do: +```rust +let x = FOO.bits | BAR.bits; +``` +Now you must use: +```rust +let x = Something::FOO.bits | Something::BAR.bits; +``` + +# 0.9.1 +- Fix the implementation of `Formatting` traits when other formatting traits were present in scope ([#105]) + +[#105]: https://github.com/rust-lang-nursery/bitflags/pull/105 + +# 0.9.0 +- **[breaking change]** Use struct keyword instead of flags to define bitflag types ([#84]) + +- **[breaking change]** Terminate const items with semicolons instead of commas ([#87]) + +- Implement the `Hex`, `Octal`, and `Binary` formatting traits ([#86]) + +- Printing an empty flag value with the `Debug` trait now prints "(empty)" instead of nothing ([#85]) + +- The `bitflags!` macro can now be used inside of a fn body, to define a type local to that function ([#74]) + +[#74]: https://github.com/rust-lang-nursery/bitflags/pull/74 +[#84]: https://github.com/rust-lang-nursery/bitflags/pull/84 +[#85]: https://github.com/rust-lang-nursery/bitflags/pull/85 +[#86]: https://github.com/rust-lang-nursery/bitflags/pull/86 +[#87]: https://github.com/rust-lang-nursery/bitflags/pull/87 + +# 0.8.2 +- Update feature flag used when building bitflags as a dependency of the Rust toolchain + +# 0.8.1 +- Allow bitflags to be used as a dependency of the Rust toolchain + +# 0.8.0 +- Add support for the experimental `i128` and `u128` integer types ([#57]) +- Add set method: `flags.set(SOME_FLAG, true)` or `flags.set(SOME_FLAG, false)` ([#55]) + This may break code that defines its own set method + +[#55]: https://github.com/rust-lang-nursery/bitflags/pull/55 +[#57]: https://github.com/rust-lang-nursery/bitflags/pull/57 + +# 0.7.1 +*(yanked)* + +# 0.7.0 +- Implement the Extend trait ([#49]) +- Allow definitions inside the `bitflags!` macro to refer to items imported from other modules ([#51]) + +[#49]: https://github.com/rust-lang-nursery/bitflags/pull/49 +[#51]: https://github.com/rust-lang-nursery/bitflags/pull/51 + +# 0.6.0 +- The `no_std` feature was removed as it is now the default +- The `assignment_operators` feature was remove as it is now enabled by default +- Some clippy suggestions have been applied diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/CODE_OF_CONDUCT.md b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/CODE_OF_CONDUCT.md new file mode 100644 index 000000000000..f7add90ae355 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/CODE_OF_CONDUCT.md @@ -0,0 +1,73 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +education, socio-economic status, nationality, personal appearance, race, +religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at coc@senaite.org. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org \ No newline at end of file diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/Cargo.toml b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/Cargo.toml new file mode 100644 index 000000000000..9d54c725a1c5 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/Cargo.toml @@ -0,0 +1,58 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g., crates.io) dependencies +# +# If you believe there's an error in this file please file an +# issue against the rust-lang/cargo repository. If you're +# editing this file be aware that the upstream Cargo.toml +# will likely look very different (and much more reasonable) + +[package] +edition = "2018" +name = "bitflags" +version = "1.3.2" +authors = ["The Rust Project Developers"] +exclude = ["bors.toml"] +description = "A macro to generate structures which behave like bitflags.\n" +homepage = "https://github.com/bitflags/bitflags" +documentation = "https://docs.rs/bitflags" +readme = "README.md" +keywords = ["bit", "bitmask", "bitflags", "flags"] +categories = ["no-std"] +license = "MIT/Apache-2.0" +repository = "https://github.com/bitflags/bitflags" +[package.metadata.docs.rs] +features = ["example_generated"] +[dependencies.compiler_builtins] +version = "0.1.2" +optional = true + +[dependencies.core] +version = "1.0.0" +optional = true +package = "rustc-std-workspace-core" +[dev-dependencies.rustversion] +version = "1.0" + +[dev-dependencies.serde] +version = "1.0" + +[dev-dependencies.serde_derive] +version = "1.0" + +[dev-dependencies.serde_json] +version = "1.0" + +[dev-dependencies.trybuild] +version = "1.0" + +[dev-dependencies.walkdir] +version = "2.3" + +[features] +default = [] +example_generated = [] +rustc-dep-of-std = ["core", "compiler_builtins"] diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/Cargo.toml.orig b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/Cargo.toml.orig new file mode 100644 index 000000000000..be9e05ada459 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/Cargo.toml.orig @@ -0,0 +1,39 @@ +[package] +name = "bitflags" +# NB: When modifying, also modify: +# 1. html_root_url in lib.rs +# 2. number in readme (for breaking changes) +version = "1.3.2" +edition = "2018" +authors = ["The Rust Project Developers"] +license = "MIT/Apache-2.0" +keywords = ["bit", "bitmask", "bitflags", "flags"] +readme = "README.md" +repository = "https://github.com/bitflags/bitflags" +homepage = "https://github.com/bitflags/bitflags" +documentation = "https://docs.rs/bitflags" +categories = ["no-std"] +description = """ +A macro to generate structures which behave like bitflags. +""" +exclude = ["bors.toml"] + +[dependencies] +core = { version = '1.0.0', optional = true, package = 'rustc-std-workspace-core' } +compiler_builtins = { version = '0.1.2', optional = true } + +[dev-dependencies] +trybuild = "1.0" +rustversion = "1.0" +walkdir = "2.3" +serde = "1.0" +serde_derive = "1.0" +serde_json = "1.0" + +[features] +default = [] +example_generated = [] +rustc-dep-of-std = ["core", "compiler_builtins"] + +[package.metadata.docs.rs] +features = ["example_generated"] diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/LICENSE-APACHE b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/LICENSE-APACHE new file mode 100644 index 000000000000..16fe87b06e80 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/LICENSE-MIT b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/LICENSE-MIT new file mode 100644 index 000000000000..39d4bdb5acd3 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright (c) 2014 The Rust Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/README.md b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/README.md new file mode 100644 index 000000000000..0da0f853661b --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/README.md @@ -0,0 +1,32 @@ +bitflags +======== + +[![Rust](https://github.com/bitflags/bitflags/workflows/Rust/badge.svg)](https://github.com/bitflags/bitflags/actions) +[![Join the chat at https://gitter.im/bitflags/Lobby](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/bitflags/Lobby?utm_source=badge&utm_medium=badge&utm_content=badge) +[![Latest version](https://img.shields.io/crates/v/bitflags.svg)](https://crates.io/crates/bitflags) +[![Documentation](https://docs.rs/bitflags/badge.svg)](https://docs.rs/bitflags) +![License](https://img.shields.io/crates/l/bitflags.svg) + +A Rust macro to generate structures which behave like a set of bitflags + +- [Documentation](https://docs.rs/bitflags) +- [Release notes](https://github.com/bitflags/bitflags/releases) + +## Usage + +Add this to your `Cargo.toml`: + +```toml +[dependencies] +bitflags = "1.3" +``` + +and this to your source code: + +```rust +use bitflags::bitflags; +``` + +## Rust Version Support + +The minimum supported Rust version is 1.46 due to use of associated constants and const functions. diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/src/example_generated.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/src/example_generated.rs new file mode 100644 index 000000000000..cf188d99cb4c --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/src/example_generated.rs @@ -0,0 +1,14 @@ +//! This module shows an example of code generated by the macro. **IT MUST NOT BE USED OUTSIDE THIS +//! CRATE**. + +bitflags! { + /// This is the same `Flags` struct defined in the [crate level example](../index.html#example). + /// Note that this struct is just for documentation purposes only, it must not be used outside + /// this crate. + pub struct Flags: u32 { + const A = 0b00000001; + const B = 0b00000010; + const C = 0b00000100; + const ABC = Self::A.bits | Self::B.bits | Self::C.bits; + } +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/src/lib.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/src/lib.rs new file mode 100644 index 000000000000..935e432f1701 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/src/lib.rs @@ -0,0 +1,1729 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! A typesafe bitmask flag generator useful for sets of C-style bitmask flags. +//! It can be used for creating typesafe wrappers around C APIs. +//! +//! The `bitflags!` macro generates `struct`s that manage a set of flags. The +//! flags should only be defined for integer types, otherwise unexpected type +//! errors may occur at compile time. +//! +//! # Example +//! +//! ``` +//! use bitflags::bitflags; +//! +//! bitflags! { +//! struct Flags: u32 { +//! const A = 0b00000001; +//! const B = 0b00000010; +//! const C = 0b00000100; +//! const ABC = Self::A.bits | Self::B.bits | Self::C.bits; +//! } +//! } +//! +//! fn main() { +//! let e1 = Flags::A | Flags::C; +//! let e2 = Flags::B | Flags::C; +//! assert_eq!((e1 | e2), Flags::ABC); // union +//! assert_eq!((e1 & e2), Flags::C); // intersection +//! assert_eq!((e1 - e2), Flags::A); // set difference +//! assert_eq!(!e2, Flags::A); // set complement +//! } +//! ``` +//! +//! See [`example_generated::Flags`](./example_generated/struct.Flags.html) for documentation of code +//! generated by the above `bitflags!` expansion. +//! +//! The generated `struct`s can also be extended with type and trait +//! implementations: +//! +//! ``` +//! use std::fmt; +//! +//! use bitflags::bitflags; +//! +//! bitflags! { +//! struct Flags: u32 { +//! const A = 0b00000001; +//! const B = 0b00000010; +//! } +//! } +//! +//! impl Flags { +//! pub fn clear(&mut self) { +//! self.bits = 0; // The `bits` field can be accessed from within the +//! // same module where the `bitflags!` macro was invoked. +//! } +//! } +//! +//! impl fmt::Display for Flags { +//! fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { +//! write!(f, "hi!") +//! } +//! } +//! +//! fn main() { +//! let mut flags = Flags::A | Flags::B; +//! flags.clear(); +//! assert!(flags.is_empty()); +//! assert_eq!(format!("{}", flags), "hi!"); +//! assert_eq!(format!("{:?}", Flags::A | Flags::B), "A | B"); +//! assert_eq!(format!("{:?}", Flags::B), "B"); +//! } +//! ``` +//! +//! # Visibility +//! +//! The generated structs and their associated flag constants are not exported +//! out of the current module by default. A definition can be exported out of +//! the current module by adding `pub` before `struct`: +//! +//! ``` +//! mod example { +//! use bitflags::bitflags; +//! +//! bitflags! { +//! pub struct Flags1: u32 { +//! const A = 0b00000001; +//! } +//! +//! # pub +//! struct Flags2: u32 { +//! const B = 0b00000010; +//! } +//! } +//! } +//! +//! fn main() { +//! let flag1 = example::Flags1::A; +//! let flag2 = example::Flags2::B; // error: const `B` is private +//! } +//! ``` +//! +//! # Attributes +//! +//! Attributes can be attached to the generated `struct`s by placing them +//! before the `struct` keyword. +//! +//! ## Representations +//! +//! It's valid to add a `#[repr(C)]` or `#[repr(transparent)]` attribute to a type +//! generated by `bitflags!`. In these cases, the type is guaranteed to be a newtype. +//! +//! ``` +//! use bitflags::bitflags; +//! +//! bitflags! { +//! #[repr(transparent)] +//! struct Flags: u32 { +//! const A = 0b00000001; +//! const B = 0b00000010; +//! const C = 0b00000100; +//! } +//! } +//! ``` +//! +//! # Trait implementations +//! +//! The `Copy`, `Clone`, `PartialEq`, `Eq`, `PartialOrd`, `Ord` and `Hash` +//! traits are automatically derived for the `struct`s using the `derive` attribute. +//! Additional traits can be derived by providing an explicit `derive` +//! attribute on `struct`. +//! +//! The `Extend` and `FromIterator` traits are implemented for the `struct`s, +//! too: `Extend` adds the union of the instances of the `struct` iterated over, +//! while `FromIterator` calculates the union. +//! +//! The `Binary`, `Debug`, `LowerHex`, `Octal` and `UpperHex` traits are also +//! implemented by displaying the bits value of the internal struct. +//! +//! ## Operators +//! +//! The following operator traits are implemented for the generated `struct`s: +//! +//! - `BitOr` and `BitOrAssign`: union +//! - `BitAnd` and `BitAndAssign`: intersection +//! - `BitXor` and `BitXorAssign`: toggle +//! - `Sub` and `SubAssign`: set difference +//! - `Not`: set complement +//! +//! # Methods +//! +//! The following methods are defined for the generated `struct`s: +//! +//! - `empty`: an empty set of flags +//! - `all`: the set of all defined flags +//! - `bits`: the raw value of the flags currently stored +//! - `from_bits`: convert from underlying bit representation, unless that +//! representation contains bits that do not correspond to a +//! defined flag +//! - `from_bits_truncate`: convert from underlying bit representation, dropping +//! any bits that do not correspond to defined flags +//! - `from_bits_unchecked`: convert from underlying bit representation, keeping +//! all bits (even those not corresponding to defined +//! flags) +//! - `is_empty`: `true` if no flags are currently stored +//! - `is_all`: `true` if currently set flags exactly equal all defined flags +//! - `intersects`: `true` if there are flags common to both `self` and `other` +//! - `contains`: `true` if all of the flags in `other` are contained within `self` +//! - `insert`: inserts the specified flags in-place +//! - `remove`: removes the specified flags in-place +//! - `toggle`: the specified flags will be inserted if not present, and removed +//! if they are. +//! - `set`: inserts or removes the specified flags depending on the passed value +//! - `intersection`: returns a new set of flags, containing only the flags present +//! in both `self` and `other` (the argument to the function). +//! - `union`: returns a new set of flags, containing any flags present in +//! either `self` or `other` (the argument to the function). +//! - `difference`: returns a new set of flags, containing all flags present in +//! `self` without any of the flags present in `other` (the +//! argument to the function). +//! - `symmetric_difference`: returns a new set of flags, containing all flags +//! present in either `self` or `other` (the argument +//! to the function), but not both. +//! - `complement`: returns a new set of flags, containing all flags which are +//! not set in `self`, but which are allowed for this type. +//! +//! ## Default +//! +//! The `Default` trait is not automatically implemented for the generated structs. +//! +//! If your default value is equal to `0` (which is the same value as calling `empty()` +//! on the generated struct), you can simply derive `Default`: +//! +//! ``` +//! use bitflags::bitflags; +//! +//! bitflags! { +//! // Results in default value with bits: 0 +//! #[derive(Default)] +//! struct Flags: u32 { +//! const A = 0b00000001; +//! const B = 0b00000010; +//! const C = 0b00000100; +//! } +//! } +//! +//! fn main() { +//! let derived_default: Flags = Default::default(); +//! assert_eq!(derived_default.bits(), 0); +//! } +//! ``` +//! +//! If your default value is not equal to `0` you need to implement `Default` yourself: +//! +//! ``` +//! use bitflags::bitflags; +//! +//! bitflags! { +//! struct Flags: u32 { +//! const A = 0b00000001; +//! const B = 0b00000010; +//! const C = 0b00000100; +//! } +//! } +//! +//! // explicit `Default` implementation +//! impl Default for Flags { +//! fn default() -> Flags { +//! Flags::A | Flags::C +//! } +//! } +//! +//! fn main() { +//! let implemented_default: Flags = Default::default(); +//! assert_eq!(implemented_default, (Flags::A | Flags::C)); +//! } +//! ``` +//! +//! # Zero Flags +//! +//! Flags with a value equal to zero will have some strange behavior that one should be aware of. +//! +//! ``` +//! use bitflags::bitflags; +//! +//! bitflags! { +//! struct Flags: u32 { +//! const NONE = 0b00000000; +//! const SOME = 0b00000001; +//! } +//! } +//! +//! fn main() { +//! let empty = Flags::empty(); +//! let none = Flags::NONE; +//! let some = Flags::SOME; +//! +//! // Zero flags are treated as always present +//! assert!(empty.contains(Flags::NONE)); +//! assert!(none.contains(Flags::NONE)); +//! assert!(some.contains(Flags::NONE)); +//! +//! // Zero flags will be ignored when testing for emptiness +//! assert!(none.is_empty()); +//! } +//! ``` +//! +//! Users should generally avoid defining a flag with a value of zero. + +#![cfg_attr(not(test), no_std)] +#![doc(html_root_url = "https://docs.rs/bitflags/1.3.2")] + +#[doc(hidden)] +pub extern crate core as _core; + +/// The macro used to generate the flag structures. +/// +/// See the [crate level docs](../bitflags/index.html) for complete documentation. +/// +/// # Example +/// +/// ``` +/// use bitflags::bitflags; +/// +/// bitflags! { +/// struct Flags: u32 { +/// const A = 0b00000001; +/// const B = 0b00000010; +/// const C = 0b00000100; +/// const ABC = Self::A.bits | Self::B.bits | Self::C.bits; +/// } +/// } +/// +/// fn main() { +/// let e1 = Flags::A | Flags::C; +/// let e2 = Flags::B | Flags::C; +/// assert_eq!((e1 | e2), Flags::ABC); // union +/// assert_eq!((e1 & e2), Flags::C); // intersection +/// assert_eq!((e1 - e2), Flags::A); // set difference +/// assert_eq!(!e2, Flags::A); // set complement +/// } +/// ``` +/// +/// The generated `struct`s can also be extended with type and trait +/// implementations: +/// +/// ``` +/// use std::fmt; +/// +/// use bitflags::bitflags; +/// +/// bitflags! { +/// struct Flags: u32 { +/// const A = 0b00000001; +/// const B = 0b00000010; +/// } +/// } +/// +/// impl Flags { +/// pub fn clear(&mut self) { +/// self.bits = 0; // The `bits` field can be accessed from within the +/// // same module where the `bitflags!` macro was invoked. +/// } +/// } +/// +/// impl fmt::Display for Flags { +/// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { +/// write!(f, "hi!") +/// } +/// } +/// +/// fn main() { +/// let mut flags = Flags::A | Flags::B; +/// flags.clear(); +/// assert!(flags.is_empty()); +/// assert_eq!(format!("{}", flags), "hi!"); +/// assert_eq!(format!("{:?}", Flags::A | Flags::B), "A | B"); +/// assert_eq!(format!("{:?}", Flags::B), "B"); +/// } +/// ``` +#[macro_export(local_inner_macros)] +macro_rules! bitflags { + ( + $(#[$outer:meta])* + $vis:vis struct $BitFlags:ident: $T:ty { + $( + $(#[$inner:ident $($args:tt)*])* + const $Flag:ident = $value:expr; + )* + } + + $($t:tt)* + ) => { + $(#[$outer])* + #[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)] + $vis struct $BitFlags { + bits: $T, + } + + __impl_bitflags! { + $BitFlags: $T { + $( + $(#[$inner $($args)*])* + $Flag = $value; + )* + } + } + + bitflags! { + $($t)* + } + }; + () => {}; +} + +// A helper macro to implement the `all` function. +#[macro_export(local_inner_macros)] +#[doc(hidden)] +macro_rules! __impl_all_bitflags { + ( + $BitFlags:ident: $T:ty { + $( + $(#[$attr:ident $($args:tt)*])* + $Flag:ident = $value:expr; + )+ + } + ) => { + // See `Debug::fmt` for why this approach is taken. + #[allow(non_snake_case)] + trait __BitFlags { + $( + const $Flag: $T = 0; + )+ + } + #[allow(non_snake_case)] + impl __BitFlags for $BitFlags { + $( + __impl_bitflags! { + #[allow(deprecated)] + $(? #[$attr $($args)*])* + const $Flag: $T = Self::$Flag.bits; + } + )+ + } + Self { bits: $(::$Flag)|+ } + }; + ( + $BitFlags:ident: $T:ty { } + ) => { + Self { bits: 0 } + }; +} + +#[macro_export(local_inner_macros)] +#[doc(hidden)] +macro_rules! __impl_bitflags { + ( + $BitFlags:ident: $T:ty { + $( + $(#[$attr:ident $($args:tt)*])* + $Flag:ident = $value:expr; + )* + } + ) => { + impl $crate::_core::fmt::Debug for $BitFlags { + fn fmt(&self, f: &mut $crate::_core::fmt::Formatter) -> $crate::_core::fmt::Result { + // This convoluted approach is to handle #[cfg]-based flag + // omission correctly. For example it needs to support: + // + // #[cfg(unix)] const A: Flag = /* ... */; + // #[cfg(windows)] const B: Flag = /* ... */; + + // Unconditionally define a check for every flag, even disabled + // ones. + #[allow(non_snake_case)] + trait __BitFlags { + $( + #[inline] + fn $Flag(&self) -> bool { false } + )* + } + + // Conditionally override the check for just those flags that + // are not #[cfg]ed away. + #[allow(non_snake_case)] + impl __BitFlags for $BitFlags { + $( + __impl_bitflags! { + #[allow(deprecated)] + #[inline] + $(? #[$attr $($args)*])* + fn $Flag(&self) -> bool { + if Self::$Flag.bits == 0 && self.bits != 0 { + false + } else { + self.bits & Self::$Flag.bits == Self::$Flag.bits + } + } + } + )* + } + + let mut first = true; + $( + if ::$Flag(self) { + if !first { + f.write_str(" | ")?; + } + first = false; + f.write_str($crate::_core::stringify!($Flag))?; + } + )* + let extra_bits = self.bits & !Self::all().bits(); + if extra_bits != 0 { + if !first { + f.write_str(" | ")?; + } + first = false; + f.write_str("0x")?; + $crate::_core::fmt::LowerHex::fmt(&extra_bits, f)?; + } + if first { + f.write_str("(empty)")?; + } + Ok(()) + } + } + impl $crate::_core::fmt::Binary for $BitFlags { + fn fmt(&self, f: &mut $crate::_core::fmt::Formatter) -> $crate::_core::fmt::Result { + $crate::_core::fmt::Binary::fmt(&self.bits, f) + } + } + impl $crate::_core::fmt::Octal for $BitFlags { + fn fmt(&self, f: &mut $crate::_core::fmt::Formatter) -> $crate::_core::fmt::Result { + $crate::_core::fmt::Octal::fmt(&self.bits, f) + } + } + impl $crate::_core::fmt::LowerHex for $BitFlags { + fn fmt(&self, f: &mut $crate::_core::fmt::Formatter) -> $crate::_core::fmt::Result { + $crate::_core::fmt::LowerHex::fmt(&self.bits, f) + } + } + impl $crate::_core::fmt::UpperHex for $BitFlags { + fn fmt(&self, f: &mut $crate::_core::fmt::Formatter) -> $crate::_core::fmt::Result { + $crate::_core::fmt::UpperHex::fmt(&self.bits, f) + } + } + + #[allow(dead_code)] + impl $BitFlags { + $( + $(#[$attr $($args)*])* + pub const $Flag: Self = Self { bits: $value }; + )* + + /// Returns an empty set of flags. + #[inline] + pub const fn empty() -> Self { + Self { bits: 0 } + } + + /// Returns the set containing all flags. + #[inline] + pub const fn all() -> Self { + __impl_all_bitflags! { + $BitFlags: $T { + $( + $(#[$attr $($args)*])* + $Flag = $value; + )* + } + } + } + + /// Returns the raw value of the flags currently stored. + #[inline] + pub const fn bits(&self) -> $T { + self.bits + } + + /// Convert from underlying bit representation, unless that + /// representation contains bits that do not correspond to a flag. + #[inline] + pub const fn from_bits(bits: $T) -> $crate::_core::option::Option { + if (bits & !Self::all().bits()) == 0 { + $crate::_core::option::Option::Some(Self { bits }) + } else { + $crate::_core::option::Option::None + } + } + + /// Convert from underlying bit representation, dropping any bits + /// that do not correspond to flags. + #[inline] + pub const fn from_bits_truncate(bits: $T) -> Self { + Self { bits: bits & Self::all().bits } + } + + /// Convert from underlying bit representation, preserving all + /// bits (even those not corresponding to a defined flag). + /// + /// # Safety + /// + /// The caller of the `bitflags!` macro can chose to allow or + /// disallow extra bits for their bitflags type. + /// + /// The caller of `from_bits_unchecked()` has to ensure that + /// all bits correspond to a defined flag or that extra bits + /// are valid for this bitflags type. + #[inline] + pub const unsafe fn from_bits_unchecked(bits: $T) -> Self { + Self { bits } + } + + /// Returns `true` if no flags are currently stored. + #[inline] + pub const fn is_empty(&self) -> bool { + self.bits() == Self::empty().bits() + } + + /// Returns `true` if all flags are currently set. + #[inline] + pub const fn is_all(&self) -> bool { + Self::all().bits | self.bits == self.bits + } + + /// Returns `true` if there are flags common to both `self` and `other`. + #[inline] + pub const fn intersects(&self, other: Self) -> bool { + !(Self { bits: self.bits & other.bits}).is_empty() + } + + /// Returns `true` if all of the flags in `other` are contained within `self`. + #[inline] + pub const fn contains(&self, other: Self) -> bool { + (self.bits & other.bits) == other.bits + } + + /// Inserts the specified flags in-place. + #[inline] + pub fn insert(&mut self, other: Self) { + self.bits |= other.bits; + } + + /// Removes the specified flags in-place. + #[inline] + pub fn remove(&mut self, other: Self) { + self.bits &= !other.bits; + } + + /// Toggles the specified flags in-place. + #[inline] + pub fn toggle(&mut self, other: Self) { + self.bits ^= other.bits; + } + + /// Inserts or removes the specified flags depending on the passed value. + #[inline] + pub fn set(&mut self, other: Self, value: bool) { + if value { + self.insert(other); + } else { + self.remove(other); + } + } + + /// Returns the intersection between the flags in `self` and + /// `other`. + /// + /// Specifically, the returned set contains only the flags which are + /// present in *both* `self` *and* `other`. + /// + /// This is equivalent to using the `&` operator (e.g. + /// [`ops::BitAnd`]), as in `flags & other`. + /// + /// [`ops::BitAnd`]: https://doc.rust-lang.org/std/ops/trait.BitAnd.html + #[inline] + #[must_use] + pub const fn intersection(self, other: Self) -> Self { + Self { bits: self.bits & other.bits } + } + + /// Returns the union of between the flags in `self` and `other`. + /// + /// Specifically, the returned set contains all flags which are + /// present in *either* `self` *or* `other`, including any which are + /// present in both (see [`Self::symmetric_difference`] if that + /// is undesirable). + /// + /// This is equivalent to using the `|` operator (e.g. + /// [`ops::BitOr`]), as in `flags | other`. + /// + /// [`ops::BitOr`]: https://doc.rust-lang.org/std/ops/trait.BitOr.html + #[inline] + #[must_use] + pub const fn union(self, other: Self) -> Self { + Self { bits: self.bits | other.bits } + } + + /// Returns the difference between the flags in `self` and `other`. + /// + /// Specifically, the returned set contains all flags present in + /// `self`, except for the ones present in `other`. + /// + /// It is also conceptually equivalent to the "bit-clear" operation: + /// `flags & !other` (and this syntax is also supported). + /// + /// This is equivalent to using the `-` operator (e.g. + /// [`ops::Sub`]), as in `flags - other`. + /// + /// [`ops::Sub`]: https://doc.rust-lang.org/std/ops/trait.Sub.html + #[inline] + #[must_use] + pub const fn difference(self, other: Self) -> Self { + Self { bits: self.bits & !other.bits } + } + + /// Returns the [symmetric difference][sym-diff] between the flags + /// in `self` and `other`. + /// + /// Specifically, the returned set contains the flags present which + /// are present in `self` or `other`, but that are not present in + /// both. Equivalently, it contains the flags present in *exactly + /// one* of the sets `self` and `other`. + /// + /// This is equivalent to using the `^` operator (e.g. + /// [`ops::BitXor`]), as in `flags ^ other`. + /// + /// [sym-diff]: https://en.wikipedia.org/wiki/Symmetric_difference + /// [`ops::BitXor`]: https://doc.rust-lang.org/std/ops/trait.BitXor.html + #[inline] + #[must_use] + pub const fn symmetric_difference(self, other: Self) -> Self { + Self { bits: self.bits ^ other.bits } + } + + /// Returns the complement of this set of flags. + /// + /// Specifically, the returned set contains all the flags which are + /// not set in `self`, but which are allowed for this type. + /// + /// Alternatively, it can be thought of as the set difference + /// between [`Self::all()`] and `self` (e.g. `Self::all() - self`) + /// + /// This is equivalent to using the `!` operator (e.g. + /// [`ops::Not`]), as in `!flags`. + /// + /// [`Self::all()`]: Self::all + /// [`ops::Not`]: https://doc.rust-lang.org/std/ops/trait.Not.html + #[inline] + #[must_use] + pub const fn complement(self) -> Self { + Self::from_bits_truncate(!self.bits) + } + + } + + impl $crate::_core::ops::BitOr for $BitFlags { + type Output = Self; + + /// Returns the union of the two sets of flags. + #[inline] + fn bitor(self, other: $BitFlags) -> Self { + Self { bits: self.bits | other.bits } + } + } + + impl $crate::_core::ops::BitOrAssign for $BitFlags { + /// Adds the set of flags. + #[inline] + fn bitor_assign(&mut self, other: Self) { + self.bits |= other.bits; + } + } + + impl $crate::_core::ops::BitXor for $BitFlags { + type Output = Self; + + /// Returns the left flags, but with all the right flags toggled. + #[inline] + fn bitxor(self, other: Self) -> Self { + Self { bits: self.bits ^ other.bits } + } + } + + impl $crate::_core::ops::BitXorAssign for $BitFlags { + /// Toggles the set of flags. + #[inline] + fn bitxor_assign(&mut self, other: Self) { + self.bits ^= other.bits; + } + } + + impl $crate::_core::ops::BitAnd for $BitFlags { + type Output = Self; + + /// Returns the intersection between the two sets of flags. + #[inline] + fn bitand(self, other: Self) -> Self { + Self { bits: self.bits & other.bits } + } + } + + impl $crate::_core::ops::BitAndAssign for $BitFlags { + /// Disables all flags disabled in the set. + #[inline] + fn bitand_assign(&mut self, other: Self) { + self.bits &= other.bits; + } + } + + impl $crate::_core::ops::Sub for $BitFlags { + type Output = Self; + + /// Returns the set difference of the two sets of flags. + #[inline] + fn sub(self, other: Self) -> Self { + Self { bits: self.bits & !other.bits } + } + } + + impl $crate::_core::ops::SubAssign for $BitFlags { + /// Disables all flags enabled in the set. + #[inline] + fn sub_assign(&mut self, other: Self) { + self.bits &= !other.bits; + } + } + + impl $crate::_core::ops::Not for $BitFlags { + type Output = Self; + + /// Returns the complement of this set of flags. + #[inline] + fn not(self) -> Self { + Self { bits: !self.bits } & Self::all() + } + } + + impl $crate::_core::iter::Extend<$BitFlags> for $BitFlags { + fn extend>(&mut self, iterator: T) { + for item in iterator { + self.insert(item) + } + } + } + + impl $crate::_core::iter::FromIterator<$BitFlags> for $BitFlags { + fn from_iter>(iterator: T) -> Self { + let mut result = Self::empty(); + result.extend(iterator); + result + } + } + }; + + // Every attribute that the user writes on a const is applied to the + // corresponding const that we generate, but within the implementation of + // Debug and all() we want to ignore everything but #[cfg] attributes. In + // particular, including a #[deprecated] attribute on those items would fail + // to compile. + // https://github.com/bitflags/bitflags/issues/109 + // + // Input: + // + // ? #[cfg(feature = "advanced")] + // ? #[deprecated(note = "Use something else.")] + // ? #[doc = r"High quality documentation."] + // fn f() -> i32 { /* ... */ } + // + // Output: + // + // #[cfg(feature = "advanced")] + // fn f() -> i32 { /* ... */ } + ( + $(#[$filtered:meta])* + ? #[cfg $($cfgargs:tt)*] + $(? #[$rest:ident $($restargs:tt)*])* + fn $($item:tt)* + ) => { + __impl_bitflags! { + $(#[$filtered])* + #[cfg $($cfgargs)*] + $(? #[$rest $($restargs)*])* + fn $($item)* + } + }; + ( + $(#[$filtered:meta])* + // $next != `cfg` + ? #[$next:ident $($nextargs:tt)*] + $(? #[$rest:ident $($restargs:tt)*])* + fn $($item:tt)* + ) => { + __impl_bitflags! { + $(#[$filtered])* + // $next filtered out + $(? #[$rest $($restargs)*])* + fn $($item)* + } + }; + ( + $(#[$filtered:meta])* + fn $($item:tt)* + ) => { + $(#[$filtered])* + fn $($item)* + }; + + // Every attribute that the user writes on a const is applied to the + // corresponding const that we generate, but within the implementation of + // Debug and all() we want to ignore everything but #[cfg] attributes. In + // particular, including a #[deprecated] attribute on those items would fail + // to compile. + // https://github.com/bitflags/bitflags/issues/109 + // + // const version + // + // Input: + // + // ? #[cfg(feature = "advanced")] + // ? #[deprecated(note = "Use something else.")] + // ? #[doc = r"High quality documentation."] + // const f: i32 { /* ... */ } + // + // Output: + // + // #[cfg(feature = "advanced")] + // const f: i32 { /* ... */ } + ( + $(#[$filtered:meta])* + ? #[cfg $($cfgargs:tt)*] + $(? #[$rest:ident $($restargs:tt)*])* + const $($item:tt)* + ) => { + __impl_bitflags! { + $(#[$filtered])* + #[cfg $($cfgargs)*] + $(? #[$rest $($restargs)*])* + const $($item)* + } + }; + ( + $(#[$filtered:meta])* + // $next != `cfg` + ? #[$next:ident $($nextargs:tt)*] + $(? #[$rest:ident $($restargs:tt)*])* + const $($item:tt)* + ) => { + __impl_bitflags! { + $(#[$filtered])* + // $next filtered out + $(? #[$rest $($restargs)*])* + const $($item)* + } + }; + ( + $(#[$filtered:meta])* + const $($item:tt)* + ) => { + $(#[$filtered])* + const $($item)* + }; +} + +#[cfg(feature = "example_generated")] +pub mod example_generated; + +#[cfg(test)] +mod tests { + use std::collections::hash_map::DefaultHasher; + use std::hash::{Hash, Hasher}; + + bitflags! { + #[doc = "> The first principle is that you must not fool yourself — and"] + #[doc = "> you are the easiest person to fool."] + #[doc = "> "] + #[doc = "> - Richard Feynman"] + #[derive(Default)] + struct Flags: u32 { + const A = 0b00000001; + #[doc = " macros are way better at generating code than trans is"] + const B = 0b00000010; + const C = 0b00000100; + #[doc = "* cmr bed"] + #[doc = "* strcat table"] + #[doc = " wait what?"] + const ABC = Self::A.bits | Self::B.bits | Self::C.bits; + } + + struct _CfgFlags: u32 { + #[cfg(unix)] + const _CFG_A = 0b01; + #[cfg(windows)] + const _CFG_B = 0b01; + #[cfg(unix)] + const _CFG_C = Self::_CFG_A.bits | 0b10; + } + + struct AnotherSetOfFlags: i8 { + const ANOTHER_FLAG = -1_i8; + } + + struct LongFlags: u32 { + const LONG_A = 0b1111111111111111; + } + } + + bitflags! { + struct EmptyFlags: u32 { + } + } + + #[test] + fn test_bits() { + assert_eq!(Flags::empty().bits(), 0b00000000); + assert_eq!(Flags::A.bits(), 0b00000001); + assert_eq!(Flags::ABC.bits(), 0b00000111); + + assert_eq!(AnotherSetOfFlags::empty().bits(), 0b00); + assert_eq!(AnotherSetOfFlags::ANOTHER_FLAG.bits(), !0_i8); + + assert_eq!(EmptyFlags::empty().bits(), 0b00000000); + } + + #[test] + fn test_from_bits() { + assert_eq!(Flags::from_bits(0), Some(Flags::empty())); + assert_eq!(Flags::from_bits(0b1), Some(Flags::A)); + assert_eq!(Flags::from_bits(0b10), Some(Flags::B)); + assert_eq!(Flags::from_bits(0b11), Some(Flags::A | Flags::B)); + assert_eq!(Flags::from_bits(0b1000), None); + + assert_eq!( + AnotherSetOfFlags::from_bits(!0_i8), + Some(AnotherSetOfFlags::ANOTHER_FLAG) + ); + + assert_eq!(EmptyFlags::from_bits(0), Some(EmptyFlags::empty())); + assert_eq!(EmptyFlags::from_bits(0b1), None); + } + + #[test] + fn test_from_bits_truncate() { + assert_eq!(Flags::from_bits_truncate(0), Flags::empty()); + assert_eq!(Flags::from_bits_truncate(0b1), Flags::A); + assert_eq!(Flags::from_bits_truncate(0b10), Flags::B); + assert_eq!(Flags::from_bits_truncate(0b11), (Flags::A | Flags::B)); + assert_eq!(Flags::from_bits_truncate(0b1000), Flags::empty()); + assert_eq!(Flags::from_bits_truncate(0b1001), Flags::A); + + assert_eq!( + AnotherSetOfFlags::from_bits_truncate(0_i8), + AnotherSetOfFlags::empty() + ); + + assert_eq!(EmptyFlags::from_bits_truncate(0), EmptyFlags::empty()); + assert_eq!(EmptyFlags::from_bits_truncate(0b1), EmptyFlags::empty()); + } + + #[test] + fn test_from_bits_unchecked() { + let extra = unsafe { Flags::from_bits_unchecked(0b1000) }; + assert_eq!(unsafe { Flags::from_bits_unchecked(0) }, Flags::empty()); + assert_eq!(unsafe { Flags::from_bits_unchecked(0b1) }, Flags::A); + assert_eq!(unsafe { Flags::from_bits_unchecked(0b10) }, Flags::B); + + assert_eq!( + unsafe { Flags::from_bits_unchecked(0b11) }, + (Flags::A | Flags::B) + ); + assert_eq!( + unsafe { Flags::from_bits_unchecked(0b1000) }, + (extra | Flags::empty()) + ); + assert_eq!( + unsafe { Flags::from_bits_unchecked(0b1001) }, + (extra | Flags::A) + ); + + let extra = unsafe { EmptyFlags::from_bits_unchecked(0b1000) }; + assert_eq!( + unsafe { EmptyFlags::from_bits_unchecked(0b1000) }, + (extra | EmptyFlags::empty()) + ); + } + + #[test] + fn test_is_empty() { + assert!(Flags::empty().is_empty()); + assert!(!Flags::A.is_empty()); + assert!(!Flags::ABC.is_empty()); + + assert!(!AnotherSetOfFlags::ANOTHER_FLAG.is_empty()); + + assert!(EmptyFlags::empty().is_empty()); + assert!(EmptyFlags::all().is_empty()); + } + + #[test] + fn test_is_all() { + assert!(Flags::all().is_all()); + assert!(!Flags::A.is_all()); + assert!(Flags::ABC.is_all()); + + let extra = unsafe { Flags::from_bits_unchecked(0b1000) }; + assert!(!extra.is_all()); + assert!(!(Flags::A | extra).is_all()); + assert!((Flags::ABC | extra).is_all()); + + assert!(AnotherSetOfFlags::ANOTHER_FLAG.is_all()); + + assert!(EmptyFlags::all().is_all()); + assert!(EmptyFlags::empty().is_all()); + } + + #[test] + fn test_two_empties_do_not_intersect() { + let e1 = Flags::empty(); + let e2 = Flags::empty(); + assert!(!e1.intersects(e2)); + + assert!(AnotherSetOfFlags::ANOTHER_FLAG.intersects(AnotherSetOfFlags::ANOTHER_FLAG)); + } + + #[test] + fn test_empty_does_not_intersect_with_full() { + let e1 = Flags::empty(); + let e2 = Flags::ABC; + assert!(!e1.intersects(e2)); + } + + #[test] + fn test_disjoint_intersects() { + let e1 = Flags::A; + let e2 = Flags::B; + assert!(!e1.intersects(e2)); + } + + #[test] + fn test_overlapping_intersects() { + let e1 = Flags::A; + let e2 = Flags::A | Flags::B; + assert!(e1.intersects(e2)); + } + + #[test] + fn test_contains() { + let e1 = Flags::A; + let e2 = Flags::A | Flags::B; + assert!(!e1.contains(e2)); + assert!(e2.contains(e1)); + assert!(Flags::ABC.contains(e2)); + + assert!(AnotherSetOfFlags::ANOTHER_FLAG.contains(AnotherSetOfFlags::ANOTHER_FLAG)); + + assert!(EmptyFlags::empty().contains(EmptyFlags::empty())); + } + + #[test] + fn test_insert() { + let mut e1 = Flags::A; + let e2 = Flags::A | Flags::B; + e1.insert(e2); + assert_eq!(e1, e2); + + let mut e3 = AnotherSetOfFlags::empty(); + e3.insert(AnotherSetOfFlags::ANOTHER_FLAG); + assert_eq!(e3, AnotherSetOfFlags::ANOTHER_FLAG); + } + + #[test] + fn test_remove() { + let mut e1 = Flags::A | Flags::B; + let e2 = Flags::A | Flags::C; + e1.remove(e2); + assert_eq!(e1, Flags::B); + + let mut e3 = AnotherSetOfFlags::ANOTHER_FLAG; + e3.remove(AnotherSetOfFlags::ANOTHER_FLAG); + assert_eq!(e3, AnotherSetOfFlags::empty()); + } + + #[test] + fn test_operators() { + let e1 = Flags::A | Flags::C; + let e2 = Flags::B | Flags::C; + assert_eq!((e1 | e2), Flags::ABC); // union + assert_eq!((e1 & e2), Flags::C); // intersection + assert_eq!((e1 - e2), Flags::A); // set difference + assert_eq!(!e2, Flags::A); // set complement + assert_eq!(e1 ^ e2, Flags::A | Flags::B); // toggle + let mut e3 = e1; + e3.toggle(e2); + assert_eq!(e3, Flags::A | Flags::B); + + let mut m4 = AnotherSetOfFlags::empty(); + m4.toggle(AnotherSetOfFlags::empty()); + assert_eq!(m4, AnotherSetOfFlags::empty()); + } + + #[test] + fn test_operators_unchecked() { + let extra = unsafe { Flags::from_bits_unchecked(0b1000) }; + let e1 = Flags::A | Flags::C | extra; + let e2 = Flags::B | Flags::C; + assert_eq!((e1 | e2), (Flags::ABC | extra)); // union + assert_eq!((e1 & e2), Flags::C); // intersection + assert_eq!((e1 - e2), (Flags::A | extra)); // set difference + assert_eq!(!e2, Flags::A); // set complement + assert_eq!(!e1, Flags::B); // set complement + assert_eq!(e1 ^ e2, Flags::A | Flags::B | extra); // toggle + let mut e3 = e1; + e3.toggle(e2); + assert_eq!(e3, Flags::A | Flags::B | extra); + } + + #[test] + fn test_set_ops_basic() { + let ab = Flags::A.union(Flags::B); + let ac = Flags::A.union(Flags::C); + let bc = Flags::B.union(Flags::C); + assert_eq!(ab.bits, 0b011); + assert_eq!(bc.bits, 0b110); + assert_eq!(ac.bits, 0b101); + + assert_eq!(ab, Flags::B.union(Flags::A)); + assert_eq!(ac, Flags::C.union(Flags::A)); + assert_eq!(bc, Flags::C.union(Flags::B)); + + assert_eq!(ac, Flags::A | Flags::C); + assert_eq!(bc, Flags::B | Flags::C); + assert_eq!(ab.union(bc), Flags::ABC); + + assert_eq!(ac, Flags::A | Flags::C); + assert_eq!(bc, Flags::B | Flags::C); + + assert_eq!(ac.union(bc), ac | bc); + assert_eq!(ac.union(bc), Flags::ABC); + assert_eq!(bc.union(ac), Flags::ABC); + + assert_eq!(ac.intersection(bc), ac & bc); + assert_eq!(ac.intersection(bc), Flags::C); + assert_eq!(bc.intersection(ac), Flags::C); + + assert_eq!(ac.difference(bc), ac - bc); + assert_eq!(bc.difference(ac), bc - ac); + assert_eq!(ac.difference(bc), Flags::A); + assert_eq!(bc.difference(ac), Flags::B); + + assert_eq!(bc.complement(), !bc); + assert_eq!(bc.complement(), Flags::A); + assert_eq!(ac.symmetric_difference(bc), Flags::A.union(Flags::B)); + assert_eq!(bc.symmetric_difference(ac), Flags::A.union(Flags::B)); + } + + #[test] + fn test_set_ops_const() { + // These just test that these compile and don't cause use-site panics + // (would be possible if we had some sort of UB) + const INTERSECT: Flags = Flags::all().intersection(Flags::C); + const UNION: Flags = Flags::A.union(Flags::C); + const DIFFERENCE: Flags = Flags::all().difference(Flags::A); + const COMPLEMENT: Flags = Flags::C.complement(); + const SYM_DIFFERENCE: Flags = UNION.symmetric_difference(DIFFERENCE); + assert_eq!(INTERSECT, Flags::C); + assert_eq!(UNION, Flags::A | Flags::C); + assert_eq!(DIFFERENCE, Flags::all() - Flags::A); + assert_eq!(COMPLEMENT, !Flags::C); + assert_eq!(SYM_DIFFERENCE, (Flags::A | Flags::C) ^ (Flags::all() - Flags::A)); + } + + #[test] + fn test_set_ops_unchecked() { + let extra = unsafe { Flags::from_bits_unchecked(0b1000) }; + let e1 = Flags::A.union(Flags::C).union(extra); + let e2 = Flags::B.union(Flags::C); + assert_eq!(e1.bits, 0b1101); + assert_eq!(e1.union(e2), (Flags::ABC | extra)); + assert_eq!(e1.intersection(e2), Flags::C); + assert_eq!(e1.difference(e2), Flags::A | extra); + assert_eq!(e2.difference(e1), Flags::B); + assert_eq!(e2.complement(), Flags::A); + assert_eq!(e1.complement(), Flags::B); + assert_eq!(e1.symmetric_difference(e2), Flags::A | Flags::B | extra); // toggle + } + + #[test] + fn test_set_ops_exhaustive() { + // Define a flag that contains gaps to help exercise edge-cases, + // especially around "unknown" flags (e.g. ones outside of `all()` + // `from_bits_unchecked`). + // - when lhs and rhs both have different sets of unknown flags. + // - unknown flags at both ends, and in the middle + // - cases with "gaps". + bitflags! { + struct Test: u16 { + // Intentionally no `A` + const B = 0b000000010; + // Intentionally no `C` + const D = 0b000001000; + const E = 0b000010000; + const F = 0b000100000; + const G = 0b001000000; + // Intentionally no `H` + const I = 0b100000000; + } + } + let iter_test_flags = + || (0..=0b111_1111_1111).map(|bits| unsafe { Test::from_bits_unchecked(bits) }); + + for a in iter_test_flags() { + assert_eq!( + a.complement(), + Test::from_bits_truncate(!a.bits), + "wrong result: !({:?})", + a, + ); + assert_eq!(a.complement(), !a, "named != op: !({:?})", a); + for b in iter_test_flags() { + // Check that the named operations produce the expected bitwise + // values. + assert_eq!( + a.union(b).bits, + a.bits | b.bits, + "wrong result: `{:?}` | `{:?}`", + a, + b, + ); + assert_eq!( + a.intersection(b).bits, + a.bits & b.bits, + "wrong result: `{:?}` & `{:?}`", + a, + b, + ); + assert_eq!( + a.symmetric_difference(b).bits, + a.bits ^ b.bits, + "wrong result: `{:?}` ^ `{:?}`", + a, + b, + ); + assert_eq!( + a.difference(b).bits, + a.bits & !b.bits, + "wrong result: `{:?}` - `{:?}`", + a, + b, + ); + // Note: Difference is checked as both `a - b` and `b - a` + assert_eq!( + b.difference(a).bits, + b.bits & !a.bits, + "wrong result: `{:?}` - `{:?}`", + b, + a, + ); + // Check that the named set operations are equivalent to the + // bitwise equivalents + assert_eq!(a.union(b), a | b, "named != op: `{:?}` | `{:?}`", a, b,); + assert_eq!( + a.intersection(b), + a & b, + "named != op: `{:?}` & `{:?}`", + a, + b, + ); + assert_eq!( + a.symmetric_difference(b), + a ^ b, + "named != op: `{:?}` ^ `{:?}`", + a, + b, + ); + assert_eq!(a.difference(b), a - b, "named != op: `{:?}` - `{:?}`", a, b,); + // Note: Difference is checked as both `a - b` and `b - a` + assert_eq!(b.difference(a), b - a, "named != op: `{:?}` - `{:?}`", b, a,); + // Verify that the operations which should be symmetric are + // actually symmetric. + assert_eq!(a.union(b), b.union(a), "asymmetry: `{:?}` | `{:?}`", a, b,); + assert_eq!( + a.intersection(b), + b.intersection(a), + "asymmetry: `{:?}` & `{:?}`", + a, + b, + ); + assert_eq!( + a.symmetric_difference(b), + b.symmetric_difference(a), + "asymmetry: `{:?}` ^ `{:?}`", + a, + b, + ); + } + } + } + + #[test] + fn test_set() { + let mut e1 = Flags::A | Flags::C; + e1.set(Flags::B, true); + e1.set(Flags::C, false); + + assert_eq!(e1, Flags::A | Flags::B); + } + + #[test] + fn test_assignment_operators() { + let mut m1 = Flags::empty(); + let e1 = Flags::A | Flags::C; + // union + m1 |= Flags::A; + assert_eq!(m1, Flags::A); + // intersection + m1 &= e1; + assert_eq!(m1, Flags::A); + // set difference + m1 -= m1; + assert_eq!(m1, Flags::empty()); + // toggle + m1 ^= e1; + assert_eq!(m1, e1); + } + + #[test] + fn test_const_fn() { + const _M1: Flags = Flags::empty(); + + const M2: Flags = Flags::A; + assert_eq!(M2, Flags::A); + + const M3: Flags = Flags::C; + assert_eq!(M3, Flags::C); + } + + #[test] + fn test_extend() { + let mut flags; + + flags = Flags::empty(); + flags.extend([].iter().cloned()); + assert_eq!(flags, Flags::empty()); + + flags = Flags::empty(); + flags.extend([Flags::A, Flags::B].iter().cloned()); + assert_eq!(flags, Flags::A | Flags::B); + + flags = Flags::A; + flags.extend([Flags::A, Flags::B].iter().cloned()); + assert_eq!(flags, Flags::A | Flags::B); + + flags = Flags::B; + flags.extend([Flags::A, Flags::ABC].iter().cloned()); + assert_eq!(flags, Flags::ABC); + } + + #[test] + fn test_from_iterator() { + assert_eq!([].iter().cloned().collect::(), Flags::empty()); + assert_eq!( + [Flags::A, Flags::B].iter().cloned().collect::(), + Flags::A | Flags::B + ); + assert_eq!( + [Flags::A, Flags::ABC].iter().cloned().collect::(), + Flags::ABC + ); + } + + #[test] + fn test_lt() { + let mut a = Flags::empty(); + let mut b = Flags::empty(); + + assert!(!(a < b) && !(b < a)); + b = Flags::B; + assert!(a < b); + a = Flags::C; + assert!(!(a < b) && b < a); + b = Flags::C | Flags::B; + assert!(a < b); + } + + #[test] + fn test_ord() { + let mut a = Flags::empty(); + let mut b = Flags::empty(); + + assert!(a <= b && a >= b); + a = Flags::A; + assert!(a > b && a >= b); + assert!(b < a && b <= a); + b = Flags::B; + assert!(b > a && b >= a); + assert!(a < b && a <= b); + } + + fn hash(t: &T) -> u64 { + let mut s = DefaultHasher::new(); + t.hash(&mut s); + s.finish() + } + + #[test] + fn test_hash() { + let mut x = Flags::empty(); + let mut y = Flags::empty(); + assert_eq!(hash(&x), hash(&y)); + x = Flags::all(); + y = Flags::ABC; + assert_eq!(hash(&x), hash(&y)); + } + + #[test] + fn test_default() { + assert_eq!(Flags::empty(), Flags::default()); + } + + #[test] + fn test_debug() { + assert_eq!(format!("{:?}", Flags::A | Flags::B), "A | B"); + assert_eq!(format!("{:?}", Flags::empty()), "(empty)"); + assert_eq!(format!("{:?}", Flags::ABC), "A | B | C | ABC"); + let extra = unsafe { Flags::from_bits_unchecked(0xb8) }; + assert_eq!(format!("{:?}", extra), "0xb8"); + assert_eq!(format!("{:?}", Flags::A | extra), "A | 0xb8"); + + assert_eq!( + format!("{:?}", Flags::ABC | extra), + "A | B | C | ABC | 0xb8" + ); + + assert_eq!(format!("{:?}", EmptyFlags::empty()), "(empty)"); + } + + #[test] + fn test_binary() { + assert_eq!(format!("{:b}", Flags::ABC), "111"); + assert_eq!(format!("{:#b}", Flags::ABC), "0b111"); + let extra = unsafe { Flags::from_bits_unchecked(0b1010000) }; + assert_eq!(format!("{:b}", Flags::ABC | extra), "1010111"); + assert_eq!(format!("{:#b}", Flags::ABC | extra), "0b1010111"); + } + + #[test] + fn test_octal() { + assert_eq!(format!("{:o}", LongFlags::LONG_A), "177777"); + assert_eq!(format!("{:#o}", LongFlags::LONG_A), "0o177777"); + let extra = unsafe { LongFlags::from_bits_unchecked(0o5000000) }; + assert_eq!(format!("{:o}", LongFlags::LONG_A | extra), "5177777"); + assert_eq!(format!("{:#o}", LongFlags::LONG_A | extra), "0o5177777"); + } + + #[test] + fn test_lowerhex() { + assert_eq!(format!("{:x}", LongFlags::LONG_A), "ffff"); + assert_eq!(format!("{:#x}", LongFlags::LONG_A), "0xffff"); + let extra = unsafe { LongFlags::from_bits_unchecked(0xe00000) }; + assert_eq!(format!("{:x}", LongFlags::LONG_A | extra), "e0ffff"); + assert_eq!(format!("{:#x}", LongFlags::LONG_A | extra), "0xe0ffff"); + } + + #[test] + fn test_upperhex() { + assert_eq!(format!("{:X}", LongFlags::LONG_A), "FFFF"); + assert_eq!(format!("{:#X}", LongFlags::LONG_A), "0xFFFF"); + let extra = unsafe { LongFlags::from_bits_unchecked(0xe00000) }; + assert_eq!(format!("{:X}", LongFlags::LONG_A | extra), "E0FFFF"); + assert_eq!(format!("{:#X}", LongFlags::LONG_A | extra), "0xE0FFFF"); + } + + mod submodule { + bitflags! { + pub struct PublicFlags: i8 { + const X = 0; + } + + struct PrivateFlags: i8 { + const Y = 0; + } + } + + #[test] + fn test_private() { + let _ = PrivateFlags::Y; + } + } + + #[test] + fn test_public() { + let _ = submodule::PublicFlags::X; + } + + mod t1 { + mod foo { + pub type Bar = i32; + } + + bitflags! { + /// baz + struct Flags: foo::Bar { + const A = 0b00000001; + #[cfg(foo)] + const B = 0b00000010; + #[cfg(foo)] + const C = 0b00000010; + } + } + } + + #[test] + fn test_in_function() { + bitflags! { + struct Flags: u8 { + const A = 1; + #[cfg(any())] // false + const B = 2; + } + } + assert_eq!(Flags::all(), Flags::A); + assert_eq!(format!("{:?}", Flags::A), "A"); + } + + #[test] + fn test_deprecated() { + bitflags! { + pub struct TestFlags: u32 { + #[deprecated(note = "Use something else.")] + const ONE = 1; + } + } + } + + #[test] + fn test_pub_crate() { + mod module { + bitflags! { + pub (crate) struct Test: u8 { + const FOO = 1; + } + } + } + + assert_eq!(module::Test::FOO.bits(), 1); + } + + #[test] + fn test_pub_in_module() { + mod module { + mod submodule { + bitflags! { + // `pub (in super)` means only the module `module` will + // be able to access this. + pub (in super) struct Test: u8 { + const FOO = 1; + } + } + } + + mod test { + // Note: due to `pub (in super)`, + // this cannot be accessed directly by the testing code. + pub(super) fn value() -> u8 { + super::submodule::Test::FOO.bits() + } + } + + pub fn value() -> u8 { + test::value() + } + } + + assert_eq!(module::value(), 1) + } + + #[test] + fn test_zero_value_flags() { + bitflags! { + struct Flags: u32 { + const NONE = 0b0; + const SOME = 0b1; + } + } + + assert!(Flags::empty().contains(Flags::NONE)); + assert!(Flags::SOME.contains(Flags::NONE)); + assert!(Flags::NONE.is_empty()); + + assert_eq!(format!("{:?}", Flags::empty()), "NONE"); + assert_eq!(format!("{:?}", Flags::SOME), "SOME"); + } + + #[test] + fn test_empty_bitflags() { + bitflags! {} + } + + #[test] + fn test_u128_bitflags() { + bitflags! { + struct Flags128: u128 { + const A = 0x0000_0000_0000_0000_0000_0000_0000_0001; + const B = 0x0000_0000_0000_1000_0000_0000_0000_0000; + const C = 0x8000_0000_0000_0000_0000_0000_0000_0000; + const ABC = Self::A.bits | Self::B.bits | Self::C.bits; + } + } + + assert_eq!(Flags128::ABC, Flags128::A | Flags128::B | Flags128::C); + assert_eq!(Flags128::A.bits, 0x0000_0000_0000_0000_0000_0000_0000_0001); + assert_eq!(Flags128::B.bits, 0x0000_0000_0000_1000_0000_0000_0000_0000); + assert_eq!(Flags128::C.bits, 0x8000_0000_0000_0000_0000_0000_0000_0000); + assert_eq!( + Flags128::ABC.bits, + 0x8000_0000_0000_1000_0000_0000_0000_0001 + ); + assert_eq!(format!("{:?}", Flags128::A), "A"); + assert_eq!(format!("{:?}", Flags128::B), "B"); + assert_eq!(format!("{:?}", Flags128::C), "C"); + assert_eq!(format!("{:?}", Flags128::ABC), "A | B | C | ABC"); + } + + #[test] + fn test_serde_bitflags_serialize() { + let flags = SerdeFlags::A | SerdeFlags::B; + + let serialized = serde_json::to_string(&flags).unwrap(); + + assert_eq!(serialized, r#"{"bits":3}"#); + } + + #[test] + fn test_serde_bitflags_deserialize() { + let deserialized: SerdeFlags = serde_json::from_str(r#"{"bits":12}"#).unwrap(); + + let expected = SerdeFlags::C | SerdeFlags::D; + + assert_eq!(deserialized.bits, expected.bits); + } + + #[test] + fn test_serde_bitflags_roundtrip() { + let flags = SerdeFlags::A | SerdeFlags::B; + + let deserialized: SerdeFlags = serde_json::from_str(&serde_json::to_string(&flags).unwrap()).unwrap(); + + assert_eq!(deserialized.bits, flags.bits); + } + + bitflags! { + #[derive(serde::Serialize, serde::Deserialize)] + struct SerdeFlags: u32 { + const A = 1; + const B = 2; + const C = 4; + const D = 8; + } + } +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/basic.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/basic.rs new file mode 100644 index 000000000000..73a52bec50b6 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/basic.rs @@ -0,0 +1,20 @@ +#![no_std] + +use bitflags::bitflags; + +bitflags! { + /// baz + struct Flags: u32 { + const A = 0b00000001; + #[doc = "bar"] + const B = 0b00000010; + const C = 0b00000100; + #[doc = "foo"] + const ABC = Flags::A.bits | Flags::B.bits | Flags::C.bits; + } +} + +#[test] +fn basic() { + assert_eq!(Flags::ABC, Flags::A | Flags::B | Flags::C); +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/.gitignore b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/.gitignore new file mode 100644 index 000000000000..4dd9abc8eb25 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/.gitignore @@ -0,0 +1 @@ +*.stderr diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/impls/copy.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/impls/copy.rs new file mode 100644 index 000000000000..38f4822f5a5f --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/impls/copy.rs @@ -0,0 +1,10 @@ +use bitflags::bitflags; + +bitflags! { + #[derive(Clone, Copy)] + struct Flags: u32 { + const A = 0b00000001; + } +} + +fn main() {} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/impls/copy.stderr.beta b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/impls/copy.stderr.beta new file mode 100644 index 000000000000..0c13aa502419 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/impls/copy.stderr.beta @@ -0,0 +1,27 @@ +error[E0119]: conflicting implementations of trait `std::clone::Clone` for type `Flags` + --> $DIR/copy.rs:3:1 + | +3 | / bitflags! { +4 | | #[derive(Clone, Copy)] + | | ----- first implementation here +5 | | struct Flags: u32 { +6 | | const A = 0b00000001; +7 | | } +8 | | } + | |_^ conflicting implementation for `Flags` + | + = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `Flags` + --> $DIR/copy.rs:3:1 + | +3 | / bitflags! { +4 | | #[derive(Clone, Copy)] + | | ---- first implementation here +5 | | struct Flags: u32 { +6 | | const A = 0b00000001; +7 | | } +8 | | } + | |_^ conflicting implementation for `Flags` + | + = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/impls/eq.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/impls/eq.rs new file mode 100644 index 000000000000..4abbd630c6e1 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/impls/eq.rs @@ -0,0 +1,10 @@ +use bitflags::bitflags; + +bitflags! { + #[derive(PartialEq, Eq)] + struct Flags: u32 { + const A = 0b00000001; + } +} + +fn main() {} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/impls/eq.stderr.beta b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/impls/eq.stderr.beta new file mode 100644 index 000000000000..8a1a3b410a0e --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/impls/eq.stderr.beta @@ -0,0 +1,55 @@ +error[E0119]: conflicting implementations of trait `std::cmp::PartialEq` for type `Flags` + --> $DIR/eq.rs:3:1 + | +3 | / bitflags! { +4 | | #[derive(PartialEq, Eq)] + | | --------- first implementation here +5 | | struct Flags: u32 { +6 | | const A = 0b00000001; +7 | | } +8 | | } + | |_^ conflicting implementation for `Flags` + | + = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0119]: conflicting implementations of trait `std::cmp::Eq` for type `Flags` + --> $DIR/eq.rs:3:1 + | +3 | / bitflags! { +4 | | #[derive(PartialEq, Eq)] + | | -- first implementation here +5 | | struct Flags: u32 { +6 | | const A = 0b00000001; +7 | | } +8 | | } + | |_^ conflicting implementation for `Flags` + | + = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0119]: conflicting implementations of trait `std::marker::StructuralPartialEq` for type `Flags` + --> $DIR/eq.rs:3:1 + | +3 | / bitflags! { +4 | | #[derive(PartialEq, Eq)] + | | --------- first implementation here +5 | | struct Flags: u32 { +6 | | const A = 0b00000001; +7 | | } +8 | | } + | |_^ conflicting implementation for `Flags` + | + = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0119]: conflicting implementations of trait `std::marker::StructuralEq` for type `Flags` + --> $DIR/eq.rs:3:1 + | +3 | / bitflags! { +4 | | #[derive(PartialEq, Eq)] + | | -- first implementation here +5 | | struct Flags: u32 { +6 | | const A = 0b00000001; +7 | | } +8 | | } + | |_^ conflicting implementation for `Flags` + | + = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_defined.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_defined.rs new file mode 100644 index 000000000000..c2856b10830d --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_defined.rs @@ -0,0 +1,123 @@ +use std::{ + fmt::{ + self, + Debug, + Display, + LowerHex, + UpperHex, + Octal, + Binary, + }, + ops::{ + BitAnd, + BitOr, + BitXor, + BitAndAssign, + BitOrAssign, + BitXorAssign, + Not, + }, +}; + +use bitflags::bitflags; + +// Ideally we'd actually want this to work, but currently need something like `num`'s `Zero` +// With some design work it could be made possible +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] +struct MyInt(u8); + +impl BitAnd for MyInt { + type Output = Self; + + fn bitand(self, other: Self) -> Self { + MyInt(self.0 & other.0) + } +} + +impl BitOr for MyInt { + type Output = Self; + + fn bitor(self, other: Self) -> Self { + MyInt(self.0 | other.0) + } +} + +impl BitXor for MyInt { + type Output = Self; + + fn bitxor(self, other: Self) -> Self { + MyInt(self.0 ^ other.0) + } +} + +impl BitAndAssign for MyInt { + fn bitand_assign(&mut self, other: Self) { + self.0 &= other.0 + } +} + +impl BitOrAssign for MyInt { + fn bitor_assign(&mut self, other: Self) { + self.0 |= other.0 + } +} + +impl BitXorAssign for MyInt { + fn bitxor_assign(&mut self, other: Self) { + self.0 ^= other.0 + } +} + +impl Debug for MyInt { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + Debug::fmt(&self.0, f) + } +} + +impl Display for MyInt { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&self.0, f) + } +} + +impl LowerHex for MyInt { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + LowerHex::fmt(&self.0, f) + } +} + +impl UpperHex for MyInt { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + UpperHex::fmt(&self.0, f) + } +} + +impl Octal for MyInt { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + Octal::fmt(&self.0, f) + } +} + +impl Binary for MyInt { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + Binary::fmt(&self.0, f) + } +} + +impl Not for MyInt { + type Output = MyInt; + + fn not(self) -> Self { + MyInt(!self.0) + } +} + +bitflags! { + struct Flags128: MyInt { + const A = MyInt(0b0000_0001u8); + const B = MyInt(0b0000_0010u8); + const C = MyInt(0b0000_0100u8); + } +} + +fn main() {} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_defined.stderr.beta b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_defined.stderr.beta new file mode 100644 index 000000000000..1f0fb5cf7ad0 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_defined.stderr.beta @@ -0,0 +1,27 @@ +error[E0308]: mismatched types + --> $DIR/all_defined.rs:115:1 + | +115 | / bitflags! { +116 | | struct Flags128: MyInt { +117 | | const A = MyInt(0b0000_0001u8); +118 | | const B = MyInt(0b0000_0010u8); +119 | | const C = MyInt(0b0000_0100u8); +120 | | } +121 | | } + | |_^ expected struct `MyInt`, found integer + | + = note: this error originates in the macro `__impl_all_bitflags` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: mismatched types + --> $DIR/all_defined.rs:115:1 + | +115 | / bitflags! { +116 | | struct Flags128: MyInt { +117 | | const A = MyInt(0b0000_0001u8); +118 | | const B = MyInt(0b0000_0010u8); +119 | | const C = MyInt(0b0000_0100u8); +120 | | } +121 | | } + | |_^ expected struct `MyInt`, found integer + | + = note: this error originates in the macro `__impl_bitflags` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_missing.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_missing.rs new file mode 100644 index 000000000000..fff6b2cc1306 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_missing.rs @@ -0,0 +1,13 @@ +use bitflags::bitflags; + +struct MyInt(u8); + +bitflags! { + struct Flags128: MyInt { + const A = MyInt(0b0000_0001); + const B = MyInt(0b0000_0010); + const C = MyInt(0b0000_0100); + } +} + +fn main() {} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_missing.stderr.beta b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_missing.stderr.beta new file mode 100644 index 000000000000..ee95f8365e33 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_missing.stderr.beta @@ -0,0 +1,13 @@ +error[E0204]: the trait `Copy` may not be implemented for this type + --> $DIR/all_missing.rs:5:1 + | +5 | / bitflags! { +6 | | struct Flags128: MyInt { +7 | | const A = MyInt(0b0000_0001); +8 | | const B = MyInt(0b0000_0010); +9 | | const C = MyInt(0b0000_0100); +10 | | } +11 | | } + | |_^ this field does not implement `Copy` + | + = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/visibility/private_field.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/visibility/private_field.rs new file mode 100644 index 000000000000..a6a3912aea30 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/visibility/private_field.rs @@ -0,0 +1,13 @@ +mod example { + use bitflags::bitflags; + + bitflags! { + pub struct Flags1: u32 { + const FLAG_A = 0b00000001; + } + } +} + +fn main() { + let flag1 = example::Flags1::FLAG_A.bits; +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/visibility/private_field.stderr.beta b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/visibility/private_field.stderr.beta new file mode 100644 index 000000000000..58a04660166a --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/visibility/private_field.stderr.beta @@ -0,0 +1,10 @@ +error[E0616]: field `bits` of struct `Flags1` is private + --> $DIR/private_field.rs:12:41 + | +12 | let flag1 = example::Flags1::FLAG_A.bits; + | ^^^^ private field + | +help: a method `bits` also exists, call it with parentheses + | +12 | let flag1 = example::Flags1::FLAG_A.bits(); + | ^^ diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/visibility/private_flags.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/visibility/private_flags.rs new file mode 100644 index 000000000000..85a5b1863dd4 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/visibility/private_flags.rs @@ -0,0 +1,18 @@ +mod example { + use bitflags::bitflags; + + bitflags! { + pub struct Flags1: u32 { + const FLAG_A = 0b00000001; + } + + struct Flags2: u32 { + const FLAG_B = 0b00000010; + } + } +} + +fn main() { + let flag1 = example::Flags1::FLAG_A; + let flag2 = example::Flags2::FLAG_B; +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/visibility/private_flags.stderr.beta b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/visibility/private_flags.stderr.beta new file mode 100644 index 000000000000..d23f83209ba9 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/visibility/private_flags.stderr.beta @@ -0,0 +1,18 @@ +error[E0603]: struct `Flags2` is private + --> $DIR/private_flags.rs:17:26 + | +17 | let flag2 = example::Flags2::FLAG_B; + | ^^^^^^ private struct + | +note: the struct `Flags2` is defined here + --> $DIR/private_flags.rs:4:5 + | +4 | / bitflags! { +5 | | pub struct Flags1: u32 { +6 | | const FLAG_A = 0b00000001; +7 | | } +... | +11 | | } +12 | | } + | |_____^ + = note: this error originates in the macro `bitflags` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/visibility/pub_const.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/visibility/pub_const.rs new file mode 100644 index 000000000000..b90f0ce92d1e --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/visibility/pub_const.rs @@ -0,0 +1,9 @@ +use bitflags::bitflags; + +bitflags! { + pub struct Flags1: u32 { + pub const FLAG_A = 0b00000001; + } +} + +fn main() {} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/visibility/pub_const.stderr.beta b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/visibility/pub_const.stderr.beta new file mode 100644 index 000000000000..b01122c7ad87 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-fail/visibility/pub_const.stderr.beta @@ -0,0 +1,5 @@ +error: no rules expected the token `pub` + --> $DIR/pub_const.rs:5:9 + | +5 | pub const FLAG_A = 0b00000001; + | ^^^ no rules expected this token in macro call diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-pass/impls/convert.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-pass/impls/convert.rs new file mode 100644 index 000000000000..1f02982a8fa2 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-pass/impls/convert.rs @@ -0,0 +1,17 @@ +use bitflags::bitflags; + +bitflags! { + struct Flags: u32 { + const A = 0b00000001; + } +} + +impl From for Flags { + fn from(v: u32) -> Flags { + Flags::from_bits_truncate(v) + } +} + +fn main() { + +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-pass/impls/default.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-pass/impls/default.rs new file mode 100644 index 000000000000..a97b6536f2b5 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-pass/impls/default.rs @@ -0,0 +1,10 @@ +use bitflags::bitflags; + +bitflags! { + #[derive(Default)] + struct Flags: u32 { + const A = 0b00000001; + } +} + +fn main() {} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-pass/impls/inherent_methods.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-pass/impls/inherent_methods.rs new file mode 100644 index 000000000000..3052c460ec33 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-pass/impls/inherent_methods.rs @@ -0,0 +1,15 @@ +use bitflags::bitflags; + +bitflags! { + struct Flags: u32 { + const A = 0b00000001; + } +} + +impl Flags { + pub fn new() -> Flags { + Flags::A + } +} + +fn main() {} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-pass/redefinition/core.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-pass/redefinition/core.rs new file mode 100644 index 000000000000..47549215948d --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-pass/redefinition/core.rs @@ -0,0 +1,14 @@ +use bitflags::bitflags; + +// Checks for possible errors caused by overriding names used by `bitflags!` internally. + +mod core {} +mod _core {} + +bitflags! { + struct Test: u8 { + const A = 1; + } +} + +fn main() {} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-pass/redefinition/stringify.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-pass/redefinition/stringify.rs new file mode 100644 index 000000000000..b04f2f6a4933 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-pass/redefinition/stringify.rs @@ -0,0 +1,19 @@ +use bitflags::bitflags; + +// Checks for possible errors caused by overriding names used by `bitflags!` internally. + +#[allow(unused_macros)] +macro_rules! stringify { + ($($t:tt)*) => { "..." }; +} + +bitflags! { + struct Test: u8 { + const A = 1; + } +} + +fn main() { + // Just make sure we don't call the redefined `stringify` macro + assert_eq!(format!("{:?}", Test::A), "A"); +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-pass/repr/c.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-pass/repr/c.rs new file mode 100644 index 000000000000..6feba36ed82c --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-pass/repr/c.rs @@ -0,0 +1,10 @@ +use bitflags::bitflags; + +bitflags! { + #[repr(C)] + struct Flags: u32 { + const A = 0b00000001; + } +} + +fn main() {} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-pass/repr/transparent.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-pass/repr/transparent.rs new file mode 100644 index 000000000000..e38db4dd11b9 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-pass/repr/transparent.rs @@ -0,0 +1,10 @@ +use bitflags::bitflags; + +bitflags! { + #[repr(transparent)] + struct Flags: u32 { + const A = 0b00000001; + } +} + +fn main() {} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-pass/visibility/bits_field.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-pass/visibility/bits_field.rs new file mode 100644 index 000000000000..33a7967e629e --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-pass/visibility/bits_field.rs @@ -0,0 +1,11 @@ +use bitflags::bitflags; + +bitflags! { + pub struct Flags1: u32 { + const FLAG_A = 0b00000001; + } +} + +fn main() { + assert_eq!(0b00000001, Flags1::FLAG_A.bits); +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-pass/visibility/pub_in.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-pass/visibility/pub_in.rs new file mode 100644 index 000000000000..c11050e3baf0 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile-pass/visibility/pub_in.rs @@ -0,0 +1,19 @@ +mod a { + mod b { + use bitflags::bitflags; + + bitflags! { + pub(in crate::a) struct Flags: u32 { + const FLAG_A = 0b00000001; + } + } + } + + pub fn flags() -> u32 { + b::Flags::FLAG_A.bits() + } +} + +fn main() { + assert_eq!(0b00000001, a::flags()); +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile.rs new file mode 100644 index 000000000000..ed02d01e9ca1 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-1.3.2/tests/compile.rs @@ -0,0 +1,63 @@ +use std::{ + fs, + ffi::OsStr, + io, + path::Path, +}; + +use walkdir::WalkDir; + +#[test] +fn fail() { + prepare_stderr_files("tests/compile-fail").unwrap(); + + let t = trybuild::TestCases::new(); + t.compile_fail("tests/compile-fail/**/*.rs"); +} + +#[test] +fn pass() { + let t = trybuild::TestCases::new(); + t.pass("tests/compile-pass/**/*.rs"); +} + +// Compiler messages may change between versions +// We don't want to have to track these too closely for `bitflags`, but +// having some message to check makes sure user-facing errors are sensical. +// +// The approach we use is to run the test on all compilers, but only check stderr +// output on beta (which is the next stable release). We do this by default ignoring +// any `.stderr` files in the `compile-fail` directory, and copying `.stderr.beta` files +// when we happen to be running on a beta compiler. +fn prepare_stderr_files(path: impl AsRef) -> io::Result<()> { + for entry in WalkDir::new(path) { + let entry = entry?; + + if entry.path().extension().and_then(OsStr::to_str) == Some("beta") { + let renamed = entry.path().with_extension(""); + + // Unconditionally remove a corresponding `.stderr` file for a `.stderr.beta` + // file if it exists. On `beta` compilers, we'll recreate it. On other compilers, + // we don't want to end up checking it anyways. + if renamed.exists() { + fs::remove_file(&renamed)?; + } + + rename_beta_stderr(entry.path(), renamed)?; + } + } + + Ok(()) +} + +#[rustversion::beta] +fn rename_beta_stderr(from: impl AsRef, to: impl AsRef) -> io::Result<()> { + fs::copy(from, to)?; + + Ok(()) +} + +#[rustversion::not(beta)] +fn rename_beta_stderr(_: impl AsRef, _: impl AsRef) -> io::Result<()> { + Ok(()) +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/.cargo-checksum.json b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/.cargo-checksum.json new file mode 100644 index 000000000000..697c9ce2fbb4 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{}} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/.cargo_vcs_info.json b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/.cargo_vcs_info.json new file mode 100644 index 000000000000..3a0355912adf --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/.cargo_vcs_info.json @@ -0,0 +1,6 @@ +{ + "git": { + "sha1": "13513699141432af1dea2a6208e99e7bf21958db" + }, + "path_in_vcs": "" +} \ No newline at end of file diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/.gitignore b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/.gitignore new file mode 100644 index 000000000000..61c33314e6d9 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/.gitignore @@ -0,0 +1,5 @@ +wip +target +Cargo.lock + +/.idea/ diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/CHANGELOG.md b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/CHANGELOG.md new file mode 100644 index 000000000000..f17d469b9a1b --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/CHANGELOG.md @@ -0,0 +1,553 @@ +# 2.6.0 + +## What's Changed +* Sync CHANGELOG.md with github release notes by @dextero in https://github.com/bitflags/bitflags/pull/402 +* Update error messages and zerocopy by @KodrAus in https://github.com/bitflags/bitflags/pull/403 +* Bump minimum declared versions of dependencies by @dextero in https://github.com/bitflags/bitflags/pull/404 +* chore(deps): bump serde_derive and bytemuck versions by @joshka in https://github.com/bitflags/bitflags/pull/405 +* add OSFF Scorecard workflow by @KodrAus in https://github.com/bitflags/bitflags/pull/396 +* Update stderr messages by @KodrAus in https://github.com/bitflags/bitflags/pull/408 +* Fix typo by @waywardmonkeys in https://github.com/bitflags/bitflags/pull/410 +* Allow specifying outer attributes in impl mode by @KodrAus in https://github.com/bitflags/bitflags/pull/411 + +## New Contributors +* @dextero made their first contribution in https://github.com/bitflags/bitflags/pull/402 +* @joshka made their first contribution in https://github.com/bitflags/bitflags/pull/405 +* @waywardmonkeys made their first contribution in https://github.com/bitflags/bitflags/pull/410 + +**Full Changelog**: https://github.com/bitflags/bitflags/compare/2.5.0...2.6.0 + +# 2.5.0 + +## What's Changed +* Derive `Debug` for `Flag` by @tgross35 in https://github.com/bitflags/bitflags/pull/398 +* Support truncating or strict-named variants of parsing and formatting by @KodrAus in https://github.com/bitflags/bitflags/pull/400 + +## New Contributors +* @tgross35 made their first contribution in https://github.com/bitflags/bitflags/pull/398 + +**Full Changelog**: https://github.com/bitflags/bitflags/compare/2.4.2...2.5.0 + +# 2.4.2 + +## What's Changed +* Cargo.toml: Anchor excludes to root of the package by @jamessan in https://github.com/bitflags/bitflags/pull/387 +* Update error messages by @KodrAus in https://github.com/bitflags/bitflags/pull/390 +* Add support for impl mode structs to be repr(packed) by @GnomedDev in https://github.com/bitflags/bitflags/pull/388 +* Remove old `unused_tuple_struct_fields` lint by @dtolnay in https://github.com/bitflags/bitflags/pull/393 +* Delete use of `local_inner_macros` by @dtolnay in https://github.com/bitflags/bitflags/pull/392 + +## New Contributors +* @jamessan made their first contribution in https://github.com/bitflags/bitflags/pull/387 +* @GnomedDev made their first contribution in https://github.com/bitflags/bitflags/pull/388 + +**Full Changelog**: https://github.com/bitflags/bitflags/compare/2.4.1...2.4.2 + +# 2.4.1 + +## What's Changed +* Allow some new pedantic clippy lints by @KodrAus in https://github.com/bitflags/bitflags/pull/380 + +**Full Changelog**: https://github.com/bitflags/bitflags/compare/2.4.0...2.4.1 + +# 2.4.0 + +## What's Changed +* Remove html_root_url by @eldruin in https://github.com/bitflags/bitflags/pull/368 +* Support unnamed flags by @KodrAus in https://github.com/bitflags/bitflags/pull/371 +* Update smoke test to verify all Clippy and rustc lints by @MitMaro in https://github.com/bitflags/bitflags/pull/374 +* Specify the behavior of bitflags by @KodrAus in https://github.com/bitflags/bitflags/pull/369 + +## New Contributors +* @eldruin made their first contribution in https://github.com/bitflags/bitflags/pull/368 +* @MitMaro made their first contribution in https://github.com/bitflags/bitflags/pull/374 + +**Full Changelog**: https://github.com/bitflags/bitflags/compare/2.3.3...2.4.0 + +# 2.3.3 + +## Changes to `-=` + +The `-=` operator was incorrectly changed to truncate bits that didn't correspond to valid flags in `2.3.0`. This has +been fixed up so it once again behaves the same as `-` and `difference`. + +## Changes to `!` + +The `!` operator previously called `Self::from_bits_truncate`, which would truncate any bits that only partially +overlapped with a valid flag. It will now use `bits & Self::all().bits()`, so any bits that overlap any bits +specified by any flag will be respected. This is unlikely to have any practical implications, but enables defining +a flag like `const ALL = !0` as a way to signal that any bit pattern is a known set of flags. + +## Changes to formatting + +Zero-valued flags will never be printed. You'll either get `0x0` for empty flags using debug formatting, or the +set of flags with zero-valued flags omitted for others. + +Composite flags will no longer be redundantly printed if there are extra bits to print at the end that don't correspond +to a valid flag. + +## What's Changed +* Fix up incorrect sub assign behavior and other cleanups by @KodrAus in https://github.com/bitflags/bitflags/pull/366 + +**Full Changelog**: https://github.com/bitflags/bitflags/compare/2.3.2...2.3.3 + +# 2.3.2 + +## What's Changed +* [doc] [src/lib.rs] delete redundant path prefix by @OccupyMars2025 in https://github.com/bitflags/bitflags/pull/361 + +## New Contributors +* @OccupyMars2025 made their first contribution in https://github.com/bitflags/bitflags/pull/361 + +**Full Changelog**: https://github.com/bitflags/bitflags/compare/2.3.1...2.3.2 + +# 2.3.1 + +## What's Changed +* Fix Self in flags value expressions by @KodrAus in https://github.com/bitflags/bitflags/pull/355 + +**Full Changelog**: https://github.com/bitflags/bitflags/compare/2.3.0...2.3.1 + +# 2.3.0 + +## Major changes + +### `BitFlags` trait deprecated in favor of `Flags` trait + +This release introduces the `Flags` trait and deprecates the `BitFlags` trait. These two traits are semver compatible so if you have public API code depending on `BitFlags` you can move to `Flags` without breaking end-users. This is possible because the `BitFlags` trait was never publicly implementable, so it now carries `Flags` as a supertrait. All implementations of `Flags` additionally implement `BitFlags`. + +The `Flags` trait is a publicly implementable version of the old `BitFlags` trait. The original `BitFlags` trait carried some macro baggage that made it difficult to implement, so a new `Flags` trait has been introduced as the _One True Trait_ for interacting with flags types generically. See the the `macro_free` and `custom_derive` examples for more details. + +### `Bits` trait publicly exposed + +The `Bits` trait for the underlying storage of flags values is also now publicly implementable. This lets you define your own exotic backing storage for flags. See the `custom_bits_type` example for more details. + +## What's Changed +* Use explicit hashes for actions steps by @KodrAus in https://github.com/bitflags/bitflags/pull/350 +* Support ejecting flags types from the bitflags macro by @KodrAus in https://github.com/bitflags/bitflags/pull/351 + +**Full Changelog**: https://github.com/bitflags/bitflags/compare/2.2.1...2.3.0 + +# 2.2.1 + +## What's Changed +* Refactor attribute filtering to apply per-flag by @KodrAus in https://github.com/bitflags/bitflags/pull/345 + +**Full Changelog**: https://github.com/bitflags/bitflags/compare/2.2.0...2.2.1 + +# 2.2.0 + +## What's Changed +* Create SECURITY.md by @KodrAus in https://github.com/bitflags/bitflags/pull/338 +* add docs to describe the behavior of multi-bit flags by @nicholasbishop in https://github.com/bitflags/bitflags/pull/340 +* Add support for bytemuck by @KodrAus in https://github.com/bitflags/bitflags/pull/336 +* Add a top-level macro for filtering attributes by @KodrAus in https://github.com/bitflags/bitflags/pull/341 + +## New Contributors +* @nicholasbishop made their first contribution in https://github.com/bitflags/bitflags/pull/340 + +**Full Changelog**: https://github.com/bitflags/bitflags/compare/2.1.0...2.2.0 + +# 2.1.0 + +## What's Changed +* Add docs for the internal Field0 and examples of formatting/parsing by @KodrAus in https://github.com/bitflags/bitflags/pull/328 +* Add support for arbitrary by @KodrAus in https://github.com/bitflags/bitflags/pull/324 +* Fix up missing docs for consts within consts by @KodrAus in https://github.com/bitflags/bitflags/pull/330 +* Ignore clippy lint in generated code by @Jake-Shadle in https://github.com/bitflags/bitflags/pull/331 + +## New Contributors +* @Jake-Shadle made their first contribution in https://github.com/bitflags/bitflags/pull/331 + +**Full Changelog**: https://github.com/bitflags/bitflags/compare/2.0.2...2.1.0 + +# 2.0.2 + +## What's Changed +* Fix up missing isize and usize Bits impls by @KodrAus in https://github.com/bitflags/bitflags/pull/321 + +**Full Changelog**: https://github.com/bitflags/bitflags/compare/2.0.1...2.0.2 + +# 2.0.1 + +## What's Changed +* Fix up some docs issues by @KodrAus in https://github.com/bitflags/bitflags/pull/309 +* Make empty_flag() const. by @tormeh in https://github.com/bitflags/bitflags/pull/313 +* Fix formatting of multi-bit flags with partial overlap by @KodrAus in https://github.com/bitflags/bitflags/pull/316 + +## New Contributors +* @tormeh made their first contribution in https://github.com/bitflags/bitflags/pull/313 + +**Full Changelog**: https://github.com/bitflags/bitflags/compare/2.0.0...2.0.1 + +# 2.0.0 + +## Major changes + +This release includes some major changes over `1.x`. If you use `bitflags!` types in your public API then upgrading this library may cause breakage in your downstream users. + +### ⚠️ Serialization + +You'll need to add the `serde` Cargo feature in order to `#[derive(Serialize, Deserialize)]` on your generated flags types: + +```rust +bitflags! { + #[derive(Serialize, Deserialize)] + #[serde(transparent)] + pub struct Flags: T { + .. + } +} +``` + +where `T` is the underlying bits type you're using, such as `u32`. + +The default serialization format with `serde` **has changed** if you `#[derive(Serialize, Deserialize)]` on your generated flags types. It will now use a formatted string for human-readable formats and the underlying bits type for compact formats. + +To keep the old format, see the https://github.com/KodrAus/bitflags-serde-legacy library. + +### ⚠️ Traits + +Generated flags types now derive fewer traits. If you need to maintain backwards compatibility, you can derive the following yourself: + +```rust +#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)] +``` + +### ⚠️ Methods + +The unsafe `from_bits_unchecked` method is now a safe `from_bits_retain` method. + +You can add the following method to your generated types to keep them compatible: + +```rust +#[deprecated = "use the safe `from_bits_retain` method instead"] +pub unsafe fn from_bits_unchecked(bits: T) -> Self { + Self::from_bits_retain(bits) +} +``` + +where `T` is the underlying bits type you're using, such as `u32`. + +### ⚠️ `.bits` field + +You can now use the `.bits()` method instead of the old `.bits`. + +The representation of generated flags types has changed from a struct with the single field `bits` to a newtype. + +## What's Changed +* Fix a typo and call out MSRV bump by @KodrAus in https://github.com/bitflags/bitflags/pull/259 +* BitFlags trait by @arturoc in https://github.com/bitflags/bitflags/pull/220 +* Add a hidden trait to discourage manual impls of BitFlags by @KodrAus in https://github.com/bitflags/bitflags/pull/261 +* Sanitize `Ok` by @konsumlamm in https://github.com/bitflags/bitflags/pull/266 +* Fix bug in `Debug` implementation by @konsumlamm in https://github.com/bitflags/bitflags/pull/268 +* Fix a typo in the generated documentation by @wackbyte in https://github.com/bitflags/bitflags/pull/271 +* Use SPDX license format by @atouchet in https://github.com/bitflags/bitflags/pull/272 +* serde tests fail in CI by @arturoc in https://github.com/bitflags/bitflags/pull/277 +* Fix beta test output by @KodrAus in https://github.com/bitflags/bitflags/pull/279 +* Add example to the README.md file by @tiaanl in https://github.com/bitflags/bitflags/pull/270 +* Iterator over all the enabled options by @arturoc in https://github.com/bitflags/bitflags/pull/278 +* from_bits_(truncate) fail with composite flags by @arturoc in https://github.com/bitflags/bitflags/pull/276 +* Add more platform coverage to CI by @KodrAus in https://github.com/bitflags/bitflags/pull/280 +* rework the way cfgs are handled by @KodrAus in https://github.com/bitflags/bitflags/pull/281 +* Split generated code into two types by @KodrAus in https://github.com/bitflags/bitflags/pull/282 +* expose bitflags iters using nameable types by @KodrAus in https://github.com/bitflags/bitflags/pull/286 +* Support creating flags from their names by @KodrAus in https://github.com/bitflags/bitflags/pull/287 +* Update README.md by @KodrAus in https://github.com/bitflags/bitflags/pull/288 +* Prepare for 2.0.0-rc.1 release by @KodrAus in https://github.com/bitflags/bitflags/pull/289 +* Add missing "if" to contains doc-comment in traits.rs by @rusty-snake in https://github.com/bitflags/bitflags/pull/291 +* Forbid unsafe_code by @fintelia in https://github.com/bitflags/bitflags/pull/294 +* serde: enable no-std support by @nim65s in https://github.com/bitflags/bitflags/pull/296 +* Add a parser for flags formatted as bar-separated-values by @KodrAus in https://github.com/bitflags/bitflags/pull/297 +* Prepare for 2.0.0-rc.2 release by @KodrAus in https://github.com/bitflags/bitflags/pull/299 +* Use strip_prefix instead of starts_with + slice by @QuinnPainter in https://github.com/bitflags/bitflags/pull/301 +* Fix up some clippy lints by @KodrAus in https://github.com/bitflags/bitflags/pull/302 +* Prepare for 2.0.0-rc.3 release by @KodrAus in https://github.com/bitflags/bitflags/pull/303 +* feat: Add minimum permissions to rust.yml workflow by @gabibguti in https://github.com/bitflags/bitflags/pull/305 + +## New Contributors +* @wackbyte made their first contribution in https://github.com/bitflags/bitflags/pull/271 +* @atouchet made their first contribution in https://github.com/bitflags/bitflags/pull/272 +* @tiaanl made their first contribution in https://github.com/bitflags/bitflags/pull/270 +* @rusty-snake made their first contribution in https://github.com/bitflags/bitflags/pull/291 +* @fintelia made their first contribution in https://github.com/bitflags/bitflags/pull/294 +* @nim65s made their first contribution in https://github.com/bitflags/bitflags/pull/296 +* @QuinnPainter made their first contribution in https://github.com/bitflags/bitflags/pull/301 +* @gabibguti made their first contribution in https://github.com/bitflags/bitflags/pull/305 + +**Full Changelog**: https://github.com/bitflags/bitflags/compare/1.3.2...2.0.0 + +# 2.0.0-rc.3 + +## What's Changed +* Use strip_prefix instead of starts_with + slice by @QuinnPainter in https://github.com/bitflags/bitflags/pull/301 +* Fix up some clippy lints by @KodrAus in https://github.com/bitflags/bitflags/pull/302 + +## New Contributors +* @QuinnPainter made their first contribution in https://github.com/bitflags/bitflags/pull/301 + +**Full Changelog**: https://github.com/bitflags/bitflags/compare/2.0.0-rc.2...2.0.0-rc.3 + +# 2.0.0-rc.2 + +## Changes to `serde` serialization + +**⚠️ NOTE ⚠️** This release changes the default serialization you'll get if you `#[derive(Serialize, Deserialize)]` +on your generated flags types. It will now use a formatted string for human-readable formats and the underlying bits +type for compact formats. + +To keep the old behavior, see the [`bitflags-serde-legacy`](https://github.com/KodrAus/bitflags-serde-legacy) library. + +## What's Changed + +* Add missing "if" to contains doc-comment in traits.rs by @rusty-snake in https://github.com/bitflags/bitflags/pull/291 +* Forbid unsafe_code by @fintelia in https://github.com/bitflags/bitflags/pull/294 +* serde: enable no-std support by @nim65s in https://github.com/bitflags/bitflags/pull/296 +* Add a parser for flags formatted as bar-separated-values by @KodrAus in https://github.com/bitflags/bitflags/pull/297 + +## New Contributors +* @rusty-snake made their first contribution in https://github.com/bitflags/bitflags/pull/291 +* @fintelia made their first contribution in https://github.com/bitflags/bitflags/pull/294 +* @nim65s made their first contribution in https://github.com/bitflags/bitflags/pull/296 + +**Full Changelog**: https://github.com/bitflags/bitflags/compare/2.0.0-rc.1...2.0.0-rc.2 + +# 2.0.0-rc.1 + +This is a big release including a few years worth of work on a new `BitFlags` trait, iteration, and better macro organization for future extensibility. + +## What's Changed +* Fix a typo and call out MSRV bump by @KodrAus in https://github.com/bitflags/bitflags/pull/259 +* BitFlags trait by @arturoc in https://github.com/bitflags/bitflags/pull/220 +* Add a hidden trait to discourage manual impls of BitFlags by @KodrAus in https://github.com/bitflags/bitflags/pull/261 +* Sanitize `Ok` by @konsumlamm in https://github.com/bitflags/bitflags/pull/266 +* Fix bug in `Debug` implementation by @konsumlamm in https://github.com/bitflags/bitflags/pull/268 +* Fix a typo in the generated documentation by @wackbyte in https://github.com/bitflags/bitflags/pull/271 +* Use SPDX license format by @atouchet in https://github.com/bitflags/bitflags/pull/272 +* serde tests fail in CI by @arturoc in https://github.com/bitflags/bitflags/pull/277 +* Fix beta test output by @KodrAus in https://github.com/bitflags/bitflags/pull/279 +* Add example to the README.md file by @tiaanl in https://github.com/bitflags/bitflags/pull/270 +* Iterator over all the enabled options by @arturoc in https://github.com/bitflags/bitflags/pull/278 +* from_bits_(truncate) fail with composite flags by @arturoc in https://github.com/bitflags/bitflags/pull/276 +* Add more platform coverage to CI by @KodrAus in https://github.com/bitflags/bitflags/pull/280 +* rework the way cfgs are handled by @KodrAus in https://github.com/bitflags/bitflags/pull/281 +* Split generated code into two types by @KodrAus in https://github.com/bitflags/bitflags/pull/282 +* expose bitflags iters using nameable types by @KodrAus in https://github.com/bitflags/bitflags/pull/286 +* Support creating flags from their names by @KodrAus in https://github.com/bitflags/bitflags/pull/287 +* Update README.md by @KodrAus in https://github.com/bitflags/bitflags/pull/288 + +## New Contributors +* @wackbyte made their first contribution in https://github.com/bitflags/bitflags/pull/271 +* @atouchet made their first contribution in https://github.com/bitflags/bitflags/pull/272 +* @tiaanl made their first contribution in https://github.com/bitflags/bitflags/pull/270 + +**Full Changelog**: https://github.com/bitflags/bitflags/compare/1.3.2...2.0.0-rc.1 + +# 1.3.2 + +- Allow `non_snake_case` in generated flags types ([#256]) + +[#256]: https://github.com/bitflags/bitflags/pull/256 + +# 1.3.1 + +- Revert unconditional `#[repr(transparent)]` ([#252]) + +[#252]: https://github.com/bitflags/bitflags/pull/252 + +# 1.3.0 (yanked) + +**This release bumps the Minimum Supported Rust Version to `1.46.0`** + +- Add `#[repr(transparent)]` ([#187]) + +- End `empty` doc comment with full stop ([#202]) + +- Fix typo in crate root docs ([#206]) + +- Document from_bits_unchecked unsafety ([#207]) + +- Let `is_all` ignore extra bits ([#211]) + +- Allows empty flag definition ([#225]) + +- Making crate accessible from std ([#227]) + +- Make `from_bits` a const fn ([#229]) + +- Allow multiple bitflags structs in one macro invocation ([#235]) + +- Add named functions to perform set operations ([#244]) + +- Fix typos in method docs ([#245]) + +- Modernization of the `bitflags` macro to take advantage of newer features and 2018 idioms ([#246]) + +- Fix regression (in an unreleased feature) and simplify tests ([#247]) + +- Use `Self` and fix bug when overriding `stringify!` ([#249]) + +[#187]: https://github.com/bitflags/bitflags/pull/187 +[#202]: https://github.com/bitflags/bitflags/pull/202 +[#206]: https://github.com/bitflags/bitflags/pull/206 +[#207]: https://github.com/bitflags/bitflags/pull/207 +[#211]: https://github.com/bitflags/bitflags/pull/211 +[#225]: https://github.com/bitflags/bitflags/pull/225 +[#227]: https://github.com/bitflags/bitflags/pull/227 +[#229]: https://github.com/bitflags/bitflags/pull/229 +[#235]: https://github.com/bitflags/bitflags/pull/235 +[#244]: https://github.com/bitflags/bitflags/pull/244 +[#245]: https://github.com/bitflags/bitflags/pull/245 +[#246]: https://github.com/bitflags/bitflags/pull/246 +[#247]: https://github.com/bitflags/bitflags/pull/247 +[#249]: https://github.com/bitflags/bitflags/pull/249 + +# 1.2.1 + +- Remove extraneous `#[inline]` attributes ([#194]) + +[#194]: https://github.com/bitflags/bitflags/pull/194 + +# 1.2.0 + +- Fix typo: {Lower, Upper}Exp - {Lower, Upper}Hex ([#183]) + +- Add support for "unknown" bits ([#188]) + +[#183]: https://github.com/rust-lang-nursery/bitflags/pull/183 +[#188]: https://github.com/rust-lang-nursery/bitflags/pull/188 + +# 1.1.0 + +This is a re-release of `1.0.5`, which was yanked due to a bug in the RLS. + +# 1.0.5 + +- Use compiletest_rs flags supported by stable toolchain ([#171]) + +- Put the user provided attributes first ([#173]) + +- Make bitflags methods `const` on newer compilers ([#175]) + +[#171]: https://github.com/rust-lang-nursery/bitflags/pull/171 +[#173]: https://github.com/rust-lang-nursery/bitflags/pull/173 +[#175]: https://github.com/rust-lang-nursery/bitflags/pull/175 + +# 1.0.4 + +- Support Rust 2018 style macro imports ([#165]) + + ```rust + use bitflags::bitflags; + ``` + +[#165]: https://github.com/rust-lang-nursery/bitflags/pull/165 + +# 1.0.3 + +- Improve zero value flag handling and documentation ([#157]) + +[#157]: https://github.com/rust-lang-nursery/bitflags/pull/157 + +# 1.0.2 + +- 30% improvement in compile time of bitflags crate ([#156]) + +- Documentation improvements ([#153]) + +- Implementation cleanup ([#149]) + +[#156]: https://github.com/rust-lang-nursery/bitflags/pull/156 +[#153]: https://github.com/rust-lang-nursery/bitflags/pull/153 +[#149]: https://github.com/rust-lang-nursery/bitflags/pull/149 + +# 1.0.1 +- Add support for `pub(restricted)` specifier on the bitflags struct ([#135]) +- Optimize performance of `all()` when called from a separate crate ([#136]) + +[#135]: https://github.com/rust-lang-nursery/bitflags/pull/135 +[#136]: https://github.com/rust-lang-nursery/bitflags/pull/136 + +# 1.0.0 +- **[breaking change]** Macro now generates [associated constants](https://doc.rust-lang.org/reference/items.html#associated-constants) ([#24]) + +- **[breaking change]** Minimum supported version is Rust **1.20**, due to usage of associated constants + +- After being broken in 0.9, the `#[deprecated]` attribute is now supported again ([#112]) + +- Other improvements to unit tests and documentation ([#106] and [#115]) + +[#24]: https://github.com/rust-lang-nursery/bitflags/pull/24 +[#106]: https://github.com/rust-lang-nursery/bitflags/pull/106 +[#112]: https://github.com/rust-lang-nursery/bitflags/pull/112 +[#115]: https://github.com/rust-lang-nursery/bitflags/pull/115 + +## How to update your code to use associated constants +Assuming the following structure definition: +```rust +bitflags! { + struct Something: u8 { + const FOO = 0b01, + const BAR = 0b10 + } +} +``` +In 0.9 and older you could do: +```rust +let x = FOO.bits | BAR.bits; +``` +Now you must use: +```rust +let x = Something::FOO.bits | Something::BAR.bits; +``` + +# 0.9.1 +- Fix the implementation of `Formatting` traits when other formatting traits were present in scope ([#105]) + +[#105]: https://github.com/rust-lang-nursery/bitflags/pull/105 + +# 0.9.0 +- **[breaking change]** Use struct keyword instead of flags to define bitflag types ([#84]) + +- **[breaking change]** Terminate const items with semicolons instead of commas ([#87]) + +- Implement the `Hex`, `Octal`, and `Binary` formatting traits ([#86]) + +- Printing an empty flag value with the `Debug` trait now prints "(empty)" instead of nothing ([#85]) + +- The `bitflags!` macro can now be used inside of a fn body, to define a type local to that function ([#74]) + +[#74]: https://github.com/rust-lang-nursery/bitflags/pull/74 +[#84]: https://github.com/rust-lang-nursery/bitflags/pull/84 +[#85]: https://github.com/rust-lang-nursery/bitflags/pull/85 +[#86]: https://github.com/rust-lang-nursery/bitflags/pull/86 +[#87]: https://github.com/rust-lang-nursery/bitflags/pull/87 + +# 0.8.2 +- Update feature flag used when building bitflags as a dependency of the Rust toolchain + +# 0.8.1 +- Allow bitflags to be used as a dependency of the Rust toolchain + +# 0.8.0 +- Add support for the experimental `i128` and `u128` integer types ([#57]) +- Add set method: `flags.set(SOME_FLAG, true)` or `flags.set(SOME_FLAG, false)` ([#55]) + This may break code that defines its own set method + +[#55]: https://github.com/rust-lang-nursery/bitflags/pull/55 +[#57]: https://github.com/rust-lang-nursery/bitflags/pull/57 + +# 0.7.1 +*(yanked)* + +# 0.7.0 +- Implement the Extend trait ([#49]) +- Allow definitions inside the `bitflags!` macro to refer to items imported from other modules ([#51]) + +[#49]: https://github.com/rust-lang-nursery/bitflags/pull/49 +[#51]: https://github.com/rust-lang-nursery/bitflags/pull/51 + +# 0.6.0 +- The `no_std` feature was removed as it is now the default +- The `assignment_operators` feature was remove as it is now enabled by default +- Some clippy suggestions have been applied diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/CODE_OF_CONDUCT.md b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/CODE_OF_CONDUCT.md new file mode 100644 index 000000000000..f7add90ae355 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/CODE_OF_CONDUCT.md @@ -0,0 +1,73 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +education, socio-economic status, nationality, personal appearance, race, +religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at coc@senaite.org. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org \ No newline at end of file diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/CONTRIBUTING.md b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/CONTRIBUTING.md new file mode 100644 index 000000000000..588336398290 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/CONTRIBUTING.md @@ -0,0 +1,9 @@ +# Updating compile-fail test outputs + +`bitflags` uses the `trybuild` crate to integration test its macros. Since Rust error messages change frequently enough that `nightly` builds produce spurious failures, we only check the compiler output in `beta` builds. If you run: + +``` +TRYBUILD=overwrite cargo +beta test --all +``` + +it will run the tests and update the `trybuild` output files. diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/Cargo.toml b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/Cargo.toml new file mode 100644 index 000000000000..54c4b8264c10 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/Cargo.toml @@ -0,0 +1,96 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g., crates.io) dependencies. +# +# If you are reading this file be aware that the original Cargo.toml +# will likely look very different (and much more reasonable). +# See Cargo.toml.orig for the original contents. + +[package] +edition = "2021" +rust-version = "1.56.0" +name = "bitflags" +version = "2.6.0" +authors = ["The Rust Project Developers"] +exclude = [ + "/tests", + "/.github", +] +description = """ +A macro to generate structures which behave like bitflags. +""" +homepage = "https://github.com/bitflags/bitflags" +documentation = "https://docs.rs/bitflags" +readme = "README.md" +keywords = [ + "bit", + "bitmask", + "bitflags", + "flags", +] +categories = ["no-std"] +license = "MIT OR Apache-2.0" +repository = "https://github.com/bitflags/bitflags" + +[package.metadata.docs.rs] +features = ["example_generated"] + +[dependencies.arbitrary] +version = "1.0" +optional = true + +[dependencies.bytemuck] +version = "1.12" +optional = true + +[dependencies.compiler_builtins] +version = "0.1.2" +optional = true + +[dependencies.core] +version = "1.0.0" +optional = true +package = "rustc-std-workspace-core" + +[dependencies.serde] +version = "1.0.103" +optional = true +default-features = false + +[dev-dependencies.arbitrary] +version = "1.0" +features = ["derive"] + +[dev-dependencies.bytemuck] +version = "1.12.2" +features = ["derive"] + +[dev-dependencies.rustversion] +version = "1.0" + +[dev-dependencies.serde_derive] +version = "1.0.103" + +[dev-dependencies.serde_json] +version = "1.0" + +[dev-dependencies.serde_test] +version = "1.0.19" + +[dev-dependencies.trybuild] +version = "1.0.18" + +[dev-dependencies.zerocopy] +version = "0.7" +features = ["derive"] + +[features] +example_generated = [] +rustc-dep-of-std = [ + "core", + "compiler_builtins", +] +std = [] diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/Cargo.toml.orig b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/Cargo.toml.orig new file mode 100644 index 000000000000..d2ff718cc05e --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/Cargo.toml.orig @@ -0,0 +1,43 @@ +[package] +name = "bitflags" +# NB: When modifying, also modify the number in readme (for breaking changes) +version = "2.6.0" +edition = "2021" +rust-version = "1.56.0" +authors = ["The Rust Project Developers"] +license = "MIT OR Apache-2.0" +keywords = ["bit", "bitmask", "bitflags", "flags"] +readme = "README.md" +repository = "https://github.com/bitflags/bitflags" +homepage = "https://github.com/bitflags/bitflags" +documentation = "https://docs.rs/bitflags" +categories = ["no-std"] +description = """ +A macro to generate structures which behave like bitflags. +""" +exclude = ["/tests", "/.github"] + +[dependencies] +serde = { version = "1.0.103", optional = true, default-features = false } +arbitrary = { version = "1.0", optional = true } +bytemuck = { version = "1.12", optional = true } +core = { version = "1.0.0", optional = true, package = "rustc-std-workspace-core" } +compiler_builtins = { version = "0.1.2", optional = true } + +[dev-dependencies] +trybuild = "1.0.18" +rustversion = "1.0" +serde_derive = "1.0.103" +serde_json = "1.0" +serde_test = "1.0.19" +zerocopy = { version = "0.7", features = ["derive"] } +arbitrary = { version = "1.0", features = ["derive"] } +bytemuck = { version = "1.12.2", features = ["derive"] } + +[features] +std = [] +example_generated = [] +rustc-dep-of-std = ["core", "compiler_builtins"] + +[package.metadata.docs.rs] +features = ["example_generated"] diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/LICENSE-APACHE b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/LICENSE-APACHE new file mode 100644 index 000000000000..16fe87b06e80 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/LICENSE-MIT b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/LICENSE-MIT new file mode 100644 index 000000000000..39d4bdb5acd3 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright (c) 2014 The Rust Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/README.md b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/README.md new file mode 100644 index 000000000000..f2ad555aed8b --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/README.md @@ -0,0 +1,77 @@ +bitflags +======== + +[![Rust](https://github.com/bitflags/bitflags/workflows/Rust/badge.svg)](https://github.com/bitflags/bitflags/actions) +[![Latest version](https://img.shields.io/crates/v/bitflags.svg)](https://crates.io/crates/bitflags) +[![Documentation](https://docs.rs/bitflags/badge.svg)](https://docs.rs/bitflags) +![License](https://img.shields.io/crates/l/bitflags.svg) + +`bitflags` generates flags enums with well-defined semantics and ergonomic end-user APIs. + +You can use `bitflags` to: + +- provide more user-friendly bindings to C APIs where flags may or may not be fully known in advance. +- generate efficient options types with string parsing and formatting support. + +You can't use `bitflags` to: + +- guarantee only bits corresponding to defined flags will ever be set. `bitflags` allows access to the underlying bits type so arbitrary bits may be set. +- define bitfields. `bitflags` only generates types where set bits denote the presence of some combination of flags. + +- [Documentation](https://docs.rs/bitflags) +- [Specification](https://github.com/bitflags/bitflags/blob/main/spec.md) +- [Release notes](https://github.com/bitflags/bitflags/releases) + +## Usage + +Add this to your `Cargo.toml`: + +```toml +[dependencies] +bitflags = "2.6.0" +``` + +and this to your source code: + +```rust +use bitflags::bitflags; +``` + +## Example + +Generate a flags structure: + +```rust +use bitflags::bitflags; + +// The `bitflags!` macro generates `struct`s that manage a set of flags. +bitflags! { + /// Represents a set of flags. + #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] + struct Flags: u32 { + /// The value `A`, at bit position `0`. + const A = 0b00000001; + /// The value `B`, at bit position `1`. + const B = 0b00000010; + /// The value `C`, at bit position `2`. + const C = 0b00000100; + + /// The combination of `A`, `B`, and `C`. + const ABC = Self::A.bits() | Self::B.bits() | Self::C.bits(); + } +} + +fn main() { + let e1 = Flags::A | Flags::C; + let e2 = Flags::B | Flags::C; + assert_eq!((e1 | e2), Flags::ABC); // union + assert_eq!((e1 & e2), Flags::C); // intersection + assert_eq!((e1 - e2), Flags::A); // set difference + assert_eq!(!e2, Flags::A); // set complement +} +``` + +## Rust Version Support + +The minimum supported Rust version is documented in the `Cargo.toml` file. +This may be bumped in minor releases as necessary. diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/SECURITY.md b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/SECURITY.md new file mode 100644 index 000000000000..790ac5b59deb --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/SECURITY.md @@ -0,0 +1,13 @@ +# Security Policy + +## Supported Versions + +Security updates are applied only to the latest release. + +## Reporting a Vulnerability + +If you have discovered a security vulnerability in this project, please report it privately. **Do not disclose it as a public issue.** This gives us time to work with you to fix the issue before public exposure, reducing the chance that the exploit will be used before a patch is released. + +Please disclose it at [security advisory](https://github.com/bitflags/bitflags/security/advisories/new). + +This project is maintained by a team of volunteers on a reasonable-effort basis. As such, please give us at least 90 days to work on a fix before public exposure. diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/benches/parse.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/benches/parse.rs new file mode 100644 index 000000000000..caa9203451a1 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/benches/parse.rs @@ -0,0 +1,96 @@ +#![feature(test)] + +extern crate test; + +use std::{ + fmt::{self, Display}, + str::FromStr, +}; + +bitflags::bitflags! { + struct Flags10: u32 { + const A = 0b0000_0000_0000_0001; + const B = 0b0000_0000_0000_0010; + const C = 0b0000_0000_0000_0100; + const D = 0b0000_0000_0000_1000; + const E = 0b0000_0000_0001_0000; + const F = 0b0000_0000_0010_0000; + const G = 0b0000_0000_0100_0000; + const H = 0b0000_0000_1000_0000; + const I = 0b0000_0001_0000_0000; + const J = 0b0000_0010_0000_0000; + } +} + +impl FromStr for Flags10 { + type Err = bitflags::parser::ParseError; + + fn from_str(flags: &str) -> Result { + Ok(Flags10(flags.parse()?)) + } +} + +impl Display for Flags10 { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&self.0, f) + } +} + +#[bench] +fn format_flags_1_present(b: &mut test::Bencher) { + b.iter(|| Flags10::J.to_string()) +} + +#[bench] +fn format_flags_5_present(b: &mut test::Bencher) { + b.iter(|| (Flags10::F | Flags10::G | Flags10::H | Flags10::I | Flags10::J).to_string()) +} + +#[bench] +fn format_flags_10_present(b: &mut test::Bencher) { + b.iter(|| { + (Flags10::A + | Flags10::B + | Flags10::C + | Flags10::D + | Flags10::E + | Flags10::F + | Flags10::G + | Flags10::H + | Flags10::I + | Flags10::J) + .to_string() + }) +} + +#[bench] +fn parse_flags_1_10(b: &mut test::Bencher) { + b.iter(|| { + let flags: Flags10 = "J".parse().unwrap(); + flags + }) +} + +#[bench] +fn parse_flags_5_10(b: &mut test::Bencher) { + b.iter(|| { + let flags: Flags10 = "F | G | H | I | J".parse().unwrap(); + flags + }) +} + +#[bench] +fn parse_flags_10_10(b: &mut test::Bencher) { + b.iter(|| { + let flags: Flags10 = "A | B | C | D | E | F | G | H | I | J".parse().unwrap(); + flags + }) +} + +#[bench] +fn parse_flags_1_10_hex(b: &mut test::Bencher) { + b.iter(|| { + let flags: Flags10 = "0xFF".parse().unwrap(); + flags + }) +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/examples/custom_bits_type.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/examples/custom_bits_type.rs new file mode 100644 index 000000000000..8924bfdf31a6 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/examples/custom_bits_type.rs @@ -0,0 +1,97 @@ +use std::ops::{BitAnd, BitOr, BitXor, Not}; + +use bitflags::{Bits, Flag, Flags}; + +// Define a custom container that can be used in flags types +// Note custom bits types can't be used in `bitflags!` +// without making the trait impls `const`. This is currently +// unstable +#[derive(Clone, Copy, Debug)] +pub struct CustomBits([bool; 3]); + +impl Bits for CustomBits { + const EMPTY: Self = CustomBits([false; 3]); + + const ALL: Self = CustomBits([true; 3]); +} + +impl PartialEq for CustomBits { + fn eq(&self, other: &Self) -> bool { + self.0 == other.0 + } +} + +impl BitAnd for CustomBits { + type Output = Self; + + fn bitand(self, other: Self) -> Self { + CustomBits([ + self.0[0] & other.0[0], + self.0[1] & other.0[1], + self.0[2] & other.0[2], + ]) + } +} + +impl BitOr for CustomBits { + type Output = Self; + + fn bitor(self, other: Self) -> Self { + CustomBits([ + self.0[0] | other.0[0], + self.0[1] | other.0[1], + self.0[2] | other.0[2], + ]) + } +} + +impl BitXor for CustomBits { + type Output = Self; + + fn bitxor(self, other: Self) -> Self { + CustomBits([ + self.0[0] & other.0[0], + self.0[1] & other.0[1], + self.0[2] & other.0[2], + ]) + } +} + +impl Not for CustomBits { + type Output = Self; + + fn not(self) -> Self { + CustomBits([!self.0[0], !self.0[1], !self.0[2]]) + } +} + +#[derive(Clone, Copy, Debug)] +pub struct CustomFlags(CustomBits); + +impl CustomFlags { + pub const A: Self = CustomFlags(CustomBits([true, false, false])); + pub const B: Self = CustomFlags(CustomBits([false, true, false])); + pub const C: Self = CustomFlags(CustomBits([false, false, true])); +} + +impl Flags for CustomFlags { + const FLAGS: &'static [Flag] = &[ + Flag::new("A", Self::A), + Flag::new("B", Self::B), + Flag::new("C", Self::C), + ]; + + type Bits = CustomBits; + + fn bits(&self) -> Self::Bits { + self.0 + } + + fn from_bits_retain(bits: Self::Bits) -> Self { + CustomFlags(bits) + } +} + +fn main() { + println!("{:?}", CustomFlags::A.union(CustomFlags::C)); +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/examples/custom_derive.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/examples/custom_derive.rs new file mode 100644 index 000000000000..4239ee4d3950 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/examples/custom_derive.rs @@ -0,0 +1,23 @@ +//! An example of implementing the `BitFlags` trait manually for a flags type. + +use std::str; + +use bitflags::bitflags; + +// Define a flags type outside of the `bitflags` macro as a newtype +// It can accept custom derives for libraries `bitflags` doesn't support natively +#[derive(zerocopy::AsBytes, zerocopy::FromBytes, zerocopy::FromZeroes)] +#[repr(transparent)] +pub struct ManualFlags(u32); + +// Next: use `impl Flags` instead of `struct Flags` +bitflags! { + impl ManualFlags: u32 { + const A = 0b00000001; + const B = 0b00000010; + const C = 0b00000100; + const ABC = Self::A.bits() | Self::B.bits() | Self::C.bits(); + } +} + +fn main() {} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/examples/fmt.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/examples/fmt.rs new file mode 100644 index 000000000000..724b2074cf0c --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/examples/fmt.rs @@ -0,0 +1,49 @@ +//! An example of implementing Rust's standard formatting and parsing traits for flags types. + +use core::{fmt, str}; + +bitflags::bitflags! { + // You can `#[derive]` the `Debug` trait, but implementing it manually + // can produce output like `A | B` instead of `Flags(A | B)`. + // #[derive(Debug)] + #[derive(PartialEq, Eq)] + pub struct Flags: u32 { + const A = 1; + const B = 2; + const C = 4; + const D = 8; + } +} + +impl fmt::Debug for Flags { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + bitflags::parser::to_writer(self, f) + } +} + +impl fmt::Display for Flags { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + bitflags::parser::to_writer(self, f) + } +} + +impl str::FromStr for Flags { + type Err = bitflags::parser::ParseError; + + fn from_str(flags: &str) -> Result { + bitflags::parser::from_str(flags) + } +} + +fn main() -> Result<(), bitflags::parser::ParseError> { + let flags = Flags::A | Flags::B; + + println!("{}", flags); + + let formatted = flags.to_string(); + let parsed: Flags = formatted.parse()?; + + assert_eq!(flags, parsed); + + Ok(()) +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/examples/macro_free.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/examples/macro_free.rs new file mode 100644 index 000000000000..7563379005c8 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/examples/macro_free.rs @@ -0,0 +1,61 @@ +//! An example of implementing the `BitFlags` trait manually for a flags type. +//! +//! This example doesn't use any macros. + +use std::{fmt, str}; + +use bitflags::{Flag, Flags}; + +// First: Define your flags type. It just needs to be `Sized + 'static`. +pub struct ManualFlags(u32); + +// Not required: Define some constants for valid flags +impl ManualFlags { + pub const A: ManualFlags = ManualFlags(0b00000001); + pub const B: ManualFlags = ManualFlags(0b00000010); + pub const C: ManualFlags = ManualFlags(0b00000100); + pub const ABC: ManualFlags = ManualFlags(0b00000111); +} + +// Next: Implement the `BitFlags` trait, specifying your set of valid flags +// and iterators +impl Flags for ManualFlags { + const FLAGS: &'static [Flag] = &[ + Flag::new("A", Self::A), + Flag::new("B", Self::B), + Flag::new("C", Self::C), + ]; + + type Bits = u32; + + fn bits(&self) -> u32 { + self.0 + } + + fn from_bits_retain(bits: u32) -> Self { + Self(bits) + } +} + +// Not required: Add parsing support +impl str::FromStr for ManualFlags { + type Err = bitflags::parser::ParseError; + + fn from_str(input: &str) -> Result { + bitflags::parser::from_str(input) + } +} + +// Not required: Add formatting support +impl fmt::Display for ManualFlags { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + bitflags::parser::to_writer(self, f) + } +} + +fn main() { + println!( + "{}", + ManualFlags::A.union(ManualFlags::B).union(ManualFlags::C) + ); +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/examples/serde.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/examples/serde.rs new file mode 100644 index 000000000000..22eae2db6a50 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/examples/serde.rs @@ -0,0 +1,36 @@ +//! An example of implementing `serde::Serialize` and `serde::Deserialize`. +//! The `#[serde(transparent)]` attribute is recommended to serialize directly +//! to the underlying bits type without wrapping it in a `serde` newtype. + +#[cfg(feature = "serde")] +fn main() { + use serde_derive::*; + + bitflags::bitflags! { + #[derive(Serialize, Deserialize, Debug, PartialEq, Eq)] + #[serde(transparent)] + pub struct Flags: u32 { + const A = 1; + const B = 2; + const C = 4; + const D = 8; + } + } + + let flags = Flags::A | Flags::B; + + let serialized = serde_json::to_string(&flags).unwrap(); + + println!("{:?} -> {}", flags, serialized); + + assert_eq!(serialized, r#""A | B""#); + + let deserialized: Flags = serde_json::from_str(&serialized).unwrap(); + + println!("{} -> {:?}", serialized, flags); + + assert_eq!(deserialized, flags); +} + +#[cfg(not(feature = "serde"))] +fn main() {} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/spec.md b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/spec.md new file mode 100644 index 000000000000..43dae1d79d36 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/spec.md @@ -0,0 +1,552 @@ +# Bitflags + +`bitflags` generates flags enums with well-defined semantics and ergonomic end-user APIs. + +You can use `bitflags` to: + +- provide more user-friendly bindings to C APIs where flags may or may not be fully known in advance. +- generate efficient options types with string parsing and formatting support. + +You can't use `bitflags` to: + +- guarantee only bits corresponding to defined flags will ever be set. `bitflags` allows access to the underlying bits type so arbitrary bits may be set. +- define bitfields. `bitflags` only generates types where set bits denote the presence of some combination of flags. + +## Definitions + +This section formally defines the terminology and semantics of `bitflags`. It's organized so more fundamental concepts are introduced before those that build on them. It may be helpful to start from the bottom of the section and refer back up to concepts defined earlier. + +Examples use `bitflags` syntax with `u8` as the bits type. + +### Bits type + +A type that defines a fixed number of bits at specific locations. + +---- + +Bits types are typically fixed-width unsigned integers. For example, `u8` is a bits type that defines 8 bits; bit-0 through bit-7. + +### Bits value + +An instance of a bits type where each bit may be set (`1`) or unset (`0`). + +---- + +Some examples of bits values for the bits type `u8` are: + +```rust +0b0000_0000 +0b1111_1111 +0b1010_0101 +``` + +#### Equality + +Two bits values are equal if their bits are in the same configuration; set bits in one are set in the other, and unset bits in one are unset in the other. + +#### Operations + +Bits values define the bitwise operators and (`&`), or (`|`), exclusive-or (`^`), and negation (`!`) that apply to each of their bits. + +### Flag + +A set of bits in a bits type that may have a unique name. + +---- + +Bits are not required to be exclusive to a flag. Bits are not required to be contiguous. + +The following is a flag for `u8` with the name `A` that includes bit-0: + +```rust +const A = 0b0000_0001; +``` + +The following is a flag for `u8` with the name `B` that includes bit-0, and bit-5: + +```rust +const B = 0b0010_0001; +``` + +#### Named flag + +A flag with a name. + +---- + +The following is a named flag, where the name is `A`: + +```rust +const A = 0b0000_0001; +``` + +#### Unnamed flag + +A flag without a name. + +---- + +The following is an unnamed flag: + +```rust +const _ = 0b0000_0001; +``` + +#### Zero-bit flag + +A flag with a set of zero bits. + +---- + +The following is a zero-bit flag: + +```rust +const ZERO = 0b0000_0000; +``` + +#### Single-bit flag + +A flag with a set of one bit. + +---- + +The following are single-bit flags: + +```rust +const A = 0b0000_0001; +const B = 0b0000_0010; +``` + +#### Multi-bit flag + +A flag with a set of more than one bit. + +---- + +The following are multi-bit flags: + +```rust +const A = 0b0000_0011; +const B = 0b1111_1111; +``` + +### Flags type + +A set of defined flags over a specific bits type. + +#### Known bit + +A bit in any defined flag. + +---- + +In the following flags type: + +```rust +struct Flags { + const A = 0b0000_0001; + const B = 0b0000_0010; + const C = 0b0000_0100; +} +``` + +the known bits are: + +```rust +0b0000_0111 +``` + +#### Unknown bit + +A bit not in any defined flag. + +---- + +In the following flags type: + +```rust +struct Flags { + const A = 0b0000_0001; + const B = 0b0000_0010; + const C = 0b0000_0100; +} +``` + +the unknown bits are: + +```rust +0b1111_1000 +``` + +### Flags value + +An instance of a flags type using its specific bits value for storage. + +The flags value of a flag is one where each of its bits is set, and all others are unset. + +#### Contains + +Whether all set bits in a source flags value are also set in a target flags value. + +---- + +Given the flags value: + +```rust +0b0000_0011 +``` + +the following flags values are contained: + +```rust +0b0000_0000 +0b0000_0010 +0b0000_0001 +0b0000_0011 +``` + +but the following flags values are not contained: + +```rust +0b0000_1000 +0b0000_0110 +``` + +#### Intersects + +Whether any set bits in a source flags value are also set in a target flags value. + +---- + +Given the flags value: + +```rust +0b0000_0011 +``` + +the following flags intersect: + +```rust +0b0000_0010 +0b0000_0001 +0b1111_1111 +``` + +but the following flags values do not intersect: + +```rust +0b0000_0000 +0b1111_0000 +``` + +#### Empty + +Whether all bits in a flags value are unset. + +---- + +The following flags value is empty: + +```rust +0b0000_0000 +``` + +The following flags values are not empty: + +```rust +0b0000_0001 +0b0110_0000 +``` + +#### All + +Whether all defined flags are contained in a flags value. + +---- + +Given a flags type: + +```rust +struct Flags { + const A = 0b0000_0001; + const B = 0b0000_0010; +} +``` + +the following flags values all satisfy all: + +```rust +0b0000_0011 +0b1000_0011 +0b1111_1111 +``` + +### Operations + +Examples in this section all use the given flags type: + +```rust +struct Flags { + const A = 0b0000_0001; + const B = 0b0000_0010; + const C = 0b0000_1100; +} +``` + +#### Truncate + +Unset all unknown bits in a flags value. + +---- + +Given the flags value: + +```rust +0b1111_1111 +``` + +the result of truncation will be: + +```rust +0b0000_1111 +``` + +---- + +Truncating doesn't guarantee that a non-empty result will contain any defined flags. Given the following flags type: + +```rust +struct Flags { + const A = 0b0000_0101; +} +``` + +and the following flags value: + +```rust +0b0000_1110; +``` + +The result of truncation will be: + +```rust +0b0000_0100; +``` + +which intersects the flag `A`, but doesn't contain it. + +This behavior is possible even when only operating with flags values containing defined flags. Given the following flags type: + +```rust +struct Flags { + const A = 0b0000_0101; + const B = 0b0000_0001; +} +``` + +The result of `A ^ B` is `0b0000_0100`, which also doesn't contain any defined flag. + +---- + +If all known bits are in the set of at least one defined single-bit flag, then all operations that produce non-empty results will always contain defined flags. + +#### Union + +The bitwise or (`|`) of the bits in two flags values. + +---- + +The following are examples of the result of unioning flags values: + +```rust +0b0000_0001 | 0b0000_0010 = 0b0000_0011 +0b0000_0000 | 0b1111_1111 = 0b1111_1111 +``` + +#### Intersection + +The bitwise and (`&`) of the bits in two flags values. + +---- + +The following are examples of the result of intersecting flags values: + +```rust +0b0000_0001 & 0b0000_0010 = 0b0000_0000 +0b1111_1100 & 0b1111_0111 = 0b1111_0100 +0b1111_1111 & 0b1111_1111 = 0b1111_1111 +``` + +#### Symmetric difference + +The bitwise exclusive-or (`^`) of the bits in two flags values. + +---- + +The following are examples of the symmetric difference between two flags values: + +```rust +0b0000_0001 ^ 0b0000_0010 = 0b0000_0011 +0b0000_1111 ^ 0b0000_0011 = 0b0000_1100 +0b1100_0000 ^ 0b0011_0000 = 0b1111_0000 +``` + +#### Complement + +The bitwise negation (`!`) of the bits in a flags value, truncating the result. + +---- + +The following are examples of the complement of a flags value: + +```rust +!0b0000_0000 = 0b0000_1111 +!0b0000_1111 = 0b0000_0000 +!0b1111_1000 = 0b0000_0111 +``` + +#### Difference + +The bitwise union (`|`) of the bits in one flags value and the bitwise negation (`!`) of the bits in another. + +---- + +This operation is not equivalent to the intersection of one flags value with the complement of another (`&!`). +The former will truncate the result, where difference will not. + +---- + +The following are examples of the difference between two flags values: + +```rust +0b0000_0001 & !0b0000_0010 = 0b0000_0001 +0b0000_1101 & !0b0000_0011 = 0b0000_1100 +0b1111_1111 & !0b0000_0001 = 0b1111_1110 +``` + +### Iteration + +Yield the bits of a source flags value in a set of contained flags values. + +---- + +To be most useful, each yielded flags value should set exactly the bits of a defined flag contained in the source. Any known bits that aren't in the set of any contained flag should be yielded together as a final flags value. + +---- + +Given the following flags type: + +```rust +struct Flags { + const A = 0b0000_0001; + const B = 0b0000_0010; + const AB = 0b0000_0011; +} +``` + +and the following flags value: + +```rust +0b0000_1111 +``` + +When iterated it may yield a flags value for `A` and `B`, then a final flag with the unknown bits: + +```rust +0b0000_0001 +0b0000_0010 +0b0000_1100 +``` + +It may also yield a flags value for `AB`, then a final flag with the unknown bits: + +```rust +0b0000_0011 +0b0000_1100 +``` + +---- + +Given the following flags type: + +```rust +struct Flags { + const A = 0b0000_0011; +} +``` + +and the following flags value: + +```rust +0b0000_0001 +``` + +When iterated it will still yield a flags value for the known bit `0b0000_0001` even though it doesn't contain a flag. + +### Formatting + +Format and parse a flags value as text using the following grammar: + +- _Flags:_ (_Whitespace_ _Flag_ _Whitespace_)`|`* +- _Flag:_ _Name_ | _Hex Number_ +- _Name:_ The name of any defined flag +- _Hex Number_: `0x`([0-9a-fA-F])* +- _Whitespace_: (\s)* + +Flags values can be formatted as _Flags_ by iterating over them, formatting each yielded flags value as a _Flag_. Any yielded flags value that sets exactly the bits of a defined flag with a name should be formatted as a _Name_. Otherwise it must be formatted as a _Hex Number_. + +Formatting and parsing supports three modes: + +- **Retain**: Formatting and parsing roundtrips exactly the bits of the source flags value. This is the default behavior. +- **Truncate**: Flags values are truncated before formatting, and truncated after parsing. +- **Strict**: A _Flag_ may only be formatted and parsed as a _Name_. _Hex numbers_ are not allowed. A consequence of this is that unknown bits and any bits that aren't in a contained named flag will be ignored. This is recommended for flags values serialized across API boundaries, like web services. + +Text that is empty or whitespace is an empty flags value. + +---- + +Given the following flags type: + +```rust +struct Flags { + const A = 0b0000_0001; + const B = 0b0000_0010; + const AB = 0b0000_0011; + const C = 0b0000_1100; +} +``` + +The following are examples of how flags values can be formatted using any mode: + +```rust +0b0000_0000 = "" +0b0000_0001 = "A" +0b0000_0010 = "B" +0b0000_0011 = "A | B" +0b0000_0011 = "AB" +0b0000_1111 = "A | B | C" +``` + +Truncate mode will unset any unknown bits: + +```rust +0b1000_0000 = "" +0b1111_1111 = "A | B | C" +0b0000_1000 = "0x8" +``` + +Retain mode will include any unknown bits as a final _Flag_: + +```rust +0b1000_0000 = "0x80" +0b1111_1111 = "A | B | C | 0xf0" +0b0000_1000 = "0x8" +``` + +Strict mode will unset any unknown bits, as well as bits not contained in any defined named flags: + +```rust +0b1000_0000 = "" +0b1111_1111 = "A | B | C" +0b0000_1000 = "" +``` diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/example_generated.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/example_generated.rs new file mode 100644 index 000000000000..abb1118fa14a --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/example_generated.rs @@ -0,0 +1,65 @@ +//! This module shows an example of code generated by the macro. **IT MUST NOT BE USED OUTSIDE THIS +//! CRATE**. +//! +//! Usually, when you call the `bitflags!` macro, only the `Flags` type would be visible. In this +//! example, the `Field0`, `Iter`, and `IterRaw` types are also exposed so that you can explore +//! their APIs. The `Field0` type can be accessed as `self.0` on an instance of `Flags`. + +__declare_public_bitflags! { + /// This is the same `Flags` struct defined in the [crate level example](../index.html#example). + /// Note that this struct is just for documentation purposes only, it must not be used outside + /// this crate. + pub struct Flags +} + +__declare_internal_bitflags! { + pub struct Field0: u32 +} + +__impl_internal_bitflags! { + Field0: u32, Flags { + // Field `A`. + /// + /// This flag has the value `0b00000001`. + const A = 0b00000001; + /// Field `B`. + /// + /// This flag has the value `0b00000010`. + const B = 0b00000010; + /// Field `C`. + /// + /// This flag has the value `0b00000100`. + const C = 0b00000100; + const ABC = Self::A.bits() | Self::B.bits() | Self::C.bits(); + } +} + +__impl_public_bitflags_forward! { + Flags: u32, Field0 +} + +__impl_public_bitflags_ops! { + Flags +} + +__impl_public_bitflags_iter! { + Flags: u32, Flags +} + +__impl_public_bitflags_consts! { + Flags: u32 { + /// Field `A`. + /// + /// This flag has the value `0b00000001`. + const A = 0b00000001; + /// Field `B`. + /// + /// This flag has the value `0b00000010`. + const B = 0b00000010; + /// Field `C`. + /// + /// This flag has the value `0b00000100`. + const C = 0b00000100; + const ABC = Self::A.bits() | Self::B.bits() | Self::C.bits(); + } +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/external.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/external.rs new file mode 100644 index 000000000000..716af83c0fb2 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/external.rs @@ -0,0 +1,262 @@ +//! Conditional trait implementations for external libraries. + +/* +How do I support a new external library? + +Let's say we want to add support for `my_library`. + +First, we create a module under `external`, like `serde` with any specialized code. +Ideally, any utilities in here should just work off the `Flags` trait and maybe a +few other assumed bounds. + +Next, re-export the library from the `__private` module here. + +Next, define a macro like so: + +```rust +#[macro_export] +#[doc(hidden)] +#[cfg(feature = "serde")] +macro_rules! __impl_external_bitflags_my_library { + ( + $InternalBitFlags:ident: $T:ty, $PublicBitFlags:ident { + $( + $(#[$inner:ident $($args:tt)*])* + const $Flag:tt; + )* + } + ) => { + // Implementation goes here + }; +} + +#[macro_export] +#[doc(hidden)] +#[cfg(not(feature = "my_library"))] +macro_rules! __impl_external_bitflags_my_library { + ( + $InternalBitFlags:ident: $T:ty, $PublicBitFlags:ident { + $( + $(#[$inner:ident $($args:tt)*])* + const $Flag:tt; + )* + } + ) => {}; +} +``` + +Note that the macro is actually defined twice; once for when the `my_library` feature +is available, and once for when it's not. This is because the `__impl_external_bitflags_my_library` +macro is called in an end-user's library, not in `bitflags`. In an end-user's library we don't +know whether or not a particular feature of `bitflags` is enabled, so we unconditionally call +the macro, where the body of that macro depends on the feature flag. + +Now, we add our macro call to the `__impl_external_bitflags` macro body: + +```rust +__impl_external_bitflags_my_library! { + $InternalBitFlags: $T, $PublicBitFlags { + $( + $(#[$inner $($args)*])* + const $Flag; + )* + } +} +``` +*/ + +pub(crate) mod __private { + #[cfg(feature = "serde")] + pub use serde; + + #[cfg(feature = "arbitrary")] + pub use arbitrary; + + #[cfg(feature = "bytemuck")] + pub use bytemuck; +} + +/// Implements traits from external libraries for the internal bitflags type. +#[macro_export] +#[doc(hidden)] +macro_rules! __impl_external_bitflags { + ( + $InternalBitFlags:ident: $T:ty, $PublicBitFlags:ident { + $( + $(#[$inner:ident $($args:tt)*])* + const $Flag:tt; + )* + } + ) => { + // Any new library traits impls should be added here + // Use `serde` as an example: generate code when the feature is available, + // and a no-op when it isn't + + $crate::__impl_external_bitflags_serde! { + $InternalBitFlags: $T, $PublicBitFlags { + $( + $(#[$inner $($args)*])* + const $Flag; + )* + } + } + + $crate::__impl_external_bitflags_arbitrary! { + $InternalBitFlags: $T, $PublicBitFlags { + $( + $(#[$inner $($args)*])* + const $Flag; + )* + } + } + + $crate::__impl_external_bitflags_bytemuck! { + $InternalBitFlags: $T, $PublicBitFlags { + $( + $(#[$inner $($args)*])* + const $Flag; + )* + } + } + }; +} + +#[cfg(feature = "serde")] +pub mod serde; + +/// Implement `Serialize` and `Deserialize` for the internal bitflags type. +#[macro_export] +#[doc(hidden)] +#[cfg(feature = "serde")] +macro_rules! __impl_external_bitflags_serde { + ( + $InternalBitFlags:ident: $T:ty, $PublicBitFlags:ident { + $( + $(#[$inner:ident $($args:tt)*])* + const $Flag:tt; + )* + } + ) => { + impl $crate::__private::serde::Serialize for $InternalBitFlags { + fn serialize( + &self, + serializer: S, + ) -> $crate::__private::core::result::Result { + $crate::serde::serialize( + &$PublicBitFlags::from_bits_retain(self.bits()), + serializer, + ) + } + } + + impl<'de> $crate::__private::serde::Deserialize<'de> for $InternalBitFlags { + fn deserialize>( + deserializer: D, + ) -> $crate::__private::core::result::Result { + let flags: $PublicBitFlags = $crate::serde::deserialize(deserializer)?; + + Ok(flags.0) + } + } + }; +} + +#[macro_export] +#[doc(hidden)] +#[cfg(not(feature = "serde"))] +macro_rules! __impl_external_bitflags_serde { + ( + $InternalBitFlags:ident: $T:ty, $PublicBitFlags:ident { + $( + $(#[$inner:ident $($args:tt)*])* + const $Flag:tt; + )* + } + ) => {}; +} + +#[cfg(feature = "arbitrary")] +pub mod arbitrary; + +#[cfg(feature = "bytemuck")] +mod bytemuck; + +/// Implement `Arbitrary` for the internal bitflags type. +#[macro_export] +#[doc(hidden)] +#[cfg(feature = "arbitrary")] +macro_rules! __impl_external_bitflags_arbitrary { + ( + $InternalBitFlags:ident: $T:ty, $PublicBitFlags:ident { + $( + $(#[$inner:ident $($args:tt)*])* + const $Flag:tt; + )* + } + ) => { + impl<'a> $crate::__private::arbitrary::Arbitrary<'a> for $InternalBitFlags { + fn arbitrary( + u: &mut $crate::__private::arbitrary::Unstructured<'a>, + ) -> $crate::__private::arbitrary::Result { + $crate::arbitrary::arbitrary::<$PublicBitFlags>(u).map(|flags| flags.0) + } + } + }; +} + +#[macro_export] +#[doc(hidden)] +#[cfg(not(feature = "arbitrary"))] +macro_rules! __impl_external_bitflags_arbitrary { + ( + $InternalBitFlags:ident: $T:ty, $PublicBitFlags:ident { + $( + $(#[$inner:ident $($args:tt)*])* + const $Flag:tt; + )* + } + ) => {}; +} + +/// Implement `Pod` and `Zeroable` for the internal bitflags type. +#[macro_export] +#[doc(hidden)] +#[cfg(feature = "bytemuck")] +macro_rules! __impl_external_bitflags_bytemuck { + ( + $InternalBitFlags:ident: $T:ty, $PublicBitFlags:ident { + $( + $(#[$inner:ident $($args:tt)*])* + const $Flag:tt; + )* + } + ) => { + // SAFETY: $InternalBitFlags is guaranteed to have the same ABI as $T, + // and $T implements Pod + unsafe impl $crate::__private::bytemuck::Pod for $InternalBitFlags where + $T: $crate::__private::bytemuck::Pod + { + } + + // SAFETY: $InternalBitFlags is guaranteed to have the same ABI as $T, + // and $T implements Zeroable + unsafe impl $crate::__private::bytemuck::Zeroable for $InternalBitFlags where + $T: $crate::__private::bytemuck::Zeroable + { + } + }; +} + +#[macro_export] +#[doc(hidden)] +#[cfg(not(feature = "bytemuck"))] +macro_rules! __impl_external_bitflags_bytemuck { + ( + $InternalBitFlags:ident: $T:ty, $PublicBitFlags:ident { + $( + $(#[$inner:ident $($args:tt)*])* + const $Flag:tt; + )* + } + ) => {}; +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/external/arbitrary.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/external/arbitrary.rs new file mode 100644 index 000000000000..ea76f0a25b94 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/external/arbitrary.rs @@ -0,0 +1,33 @@ +//! Specialized fuzzing for flags types using `arbitrary`. + +use crate::Flags; + +/** +Generate some arbitrary flags value with only known bits set. +*/ +pub fn arbitrary<'a, B: Flags>(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result +where + B::Bits: arbitrary::Arbitrary<'a>, +{ + B::from_bits(u.arbitrary()?).ok_or_else(|| arbitrary::Error::IncorrectFormat) +} + +#[cfg(test)] +mod tests { + use arbitrary::Arbitrary; + + bitflags! { + #[derive(Arbitrary)] + struct Color: u32 { + const RED = 0x1; + const GREEN = 0x2; + const BLUE = 0x4; + } + } + + #[test] + fn test_arbitrary() { + let mut unstructured = arbitrary::Unstructured::new(&[0_u8; 256]); + let _color = Color::arbitrary(&mut unstructured); + } +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/external/bytemuck.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/external/bytemuck.rs new file mode 100644 index 000000000000..a0cd68c9d7e7 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/external/bytemuck.rs @@ -0,0 +1,19 @@ +#[cfg(test)] +mod tests { + use bytemuck::{Pod, Zeroable}; + + bitflags! { + #[derive(Pod, Zeroable, Clone, Copy)] + #[repr(transparent)] + struct Color: u32 { + const RED = 0x1; + const GREEN = 0x2; + const BLUE = 0x4; + } + } + + #[test] + fn test_bytemuck() { + assert_eq!(0x1, bytemuck::cast::(Color::RED)); + } +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/external/serde.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/external/serde.rs new file mode 100644 index 000000000000..be4f2edbfa17 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/external/serde.rs @@ -0,0 +1,93 @@ +//! Specialized serialization for flags types using `serde`. + +use crate::{ + parser::{self, ParseHex, WriteHex}, + Flags, +}; +use core::{fmt, str}; +use serde::{ + de::{Error, Visitor}, + Deserialize, Deserializer, Serialize, Serializer, +}; + +/** +Serialize a set of flags as a human-readable string or their underlying bits. + +Any unknown bits will be retained. +*/ +pub fn serialize(flags: &B, serializer: S) -> Result +where + B::Bits: WriteHex + Serialize, +{ + // Serialize human-readable flags as a string like `"A | B"` + if serializer.is_human_readable() { + serializer.collect_str(&parser::AsDisplay(flags)) + } + // Serialize non-human-readable flags directly as the underlying bits + else { + flags.bits().serialize(serializer) + } +} + +/** +Deserialize a set of flags from a human-readable string or their underlying bits. + +Any unknown bits will be retained. +*/ +pub fn deserialize<'de, B: Flags, D: Deserializer<'de>>(deserializer: D) -> Result +where + B::Bits: ParseHex + Deserialize<'de>, +{ + if deserializer.is_human_readable() { + // Deserialize human-readable flags by parsing them from strings like `"A | B"` + struct FlagsVisitor(core::marker::PhantomData); + + impl<'de, B: Flags> Visitor<'de> for FlagsVisitor + where + B::Bits: ParseHex, + { + type Value = B; + + fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { + formatter.write_str("a string value of `|` separated flags") + } + + fn visit_str(self, flags: &str) -> Result { + parser::from_str(flags).map_err(|e| E::custom(e)) + } + } + + deserializer.deserialize_str(FlagsVisitor(Default::default())) + } else { + // Deserialize non-human-readable flags directly from the underlying bits + let bits = B::Bits::deserialize(deserializer)?; + + Ok(B::from_bits_retain(bits)) + } +} + +#[cfg(test)] +mod tests { + use serde_test::{assert_tokens, Configure, Token::*}; + bitflags! { + #[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug, PartialEq, Eq)] + #[serde(transparent)] + struct SerdeFlags: u32 { + const A = 1; + const B = 2; + const C = 4; + const D = 8; + } + } + + #[test] + fn test_serde_bitflags_default() { + assert_tokens(&SerdeFlags::empty().readable(), &[Str("")]); + + assert_tokens(&SerdeFlags::empty().compact(), &[U32(0)]); + + assert_tokens(&(SerdeFlags::A | SerdeFlags::B).readable(), &[Str("A | B")]); + + assert_tokens(&(SerdeFlags::A | SerdeFlags::B).compact(), &[U32(1 | 2)]); + } +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/internal.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/internal.rs new file mode 100644 index 000000000000..87d01cc0cb5f --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/internal.rs @@ -0,0 +1,125 @@ +//! Generate the internal `bitflags`-facing flags type. +//! +//! The code generated here is owned by `bitflags`, but still part of its public API. +//! Changes to the types generated here need to be considered like any other public API change. + +/// Declare the `bitflags`-facing bitflags struct. +/// +/// This type is part of the `bitflags` crate's public API, but not part of the user's. +#[macro_export] +#[doc(hidden)] +macro_rules! __declare_internal_bitflags { + ( + $vis:vis struct $InternalBitFlags:ident: $T:ty + ) => { + // NOTE: The ABI of this type is _guaranteed_ to be the same as `T` + // This is relied on by some external libraries like `bytemuck` to make + // its `unsafe` trait impls sound. + #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] + #[repr(transparent)] + $vis struct $InternalBitFlags($T); + }; +} + +/// Implement functions on the private (bitflags-facing) bitflags type. +/// +/// Methods and trait implementations can be freely added here without breaking end-users. +/// If we want to expose new functionality to `#[derive]`, this is the place to do it. +#[macro_export] +#[doc(hidden)] +macro_rules! __impl_internal_bitflags { + ( + $InternalBitFlags:ident: $T:ty, $PublicBitFlags:ident { + $( + $(#[$inner:ident $($args:tt)*])* + const $Flag:tt = $value:expr; + )* + } + ) => { + // NOTE: This impl is also used to prevent using bits types from non-primitive types + // in the `bitflags` macro. If this approach is changed, this guard will need to be + // retained somehow + impl $crate::__private::PublicFlags for $PublicBitFlags { + type Primitive = $T; + type Internal = $InternalBitFlags; + } + + impl $crate::__private::core::default::Default for $InternalBitFlags { + #[inline] + fn default() -> Self { + $InternalBitFlags::empty() + } + } + + impl $crate::__private::core::fmt::Debug for $InternalBitFlags { + fn fmt(&self, f: &mut $crate::__private::core::fmt::Formatter<'_>) -> $crate::__private::core::fmt::Result { + if self.is_empty() { + // If no flags are set then write an empty hex flag to avoid + // writing an empty string. In some contexts, like serialization, + // an empty string is preferable, but it may be unexpected in + // others for a format not to produce any output. + // + // We can remove this `0x0` and remain compatible with `FromStr`, + // because an empty string will still parse to an empty set of flags, + // just like `0x0` does. + $crate::__private::core::write!(f, "{:#x}", <$T as $crate::Bits>::EMPTY) + } else { + $crate::__private::core::fmt::Display::fmt(self, f) + } + } + } + + impl $crate::__private::core::fmt::Display for $InternalBitFlags { + fn fmt(&self, f: &mut $crate::__private::core::fmt::Formatter<'_>) -> $crate::__private::core::fmt::Result { + $crate::parser::to_writer(&$PublicBitFlags(*self), f) + } + } + + impl $crate::__private::core::str::FromStr for $InternalBitFlags { + type Err = $crate::parser::ParseError; + + fn from_str(s: &str) -> $crate::__private::core::result::Result { + $crate::parser::from_str::<$PublicBitFlags>(s).map(|flags| flags.0) + } + } + + impl $crate::__private::core::convert::AsRef<$T> for $InternalBitFlags { + fn as_ref(&self) -> &$T { + &self.0 + } + } + + impl $crate::__private::core::convert::From<$T> for $InternalBitFlags { + fn from(bits: $T) -> Self { + Self::from_bits_retain(bits) + } + } + + // The internal flags type offers a similar API to the public one + + $crate::__impl_public_bitflags! { + $InternalBitFlags: $T, $PublicBitFlags { + $( + $(#[$inner $($args)*])* + const $Flag = $value; + )* + } + } + + $crate::__impl_public_bitflags_ops! { + $InternalBitFlags + } + + $crate::__impl_public_bitflags_iter! { + $InternalBitFlags: $T, $PublicBitFlags + } + + impl $InternalBitFlags { + /// Returns a mutable reference to the raw value of the flags currently stored. + #[inline] + pub fn bits_mut(&mut self) -> &mut $T { + &mut self.0 + } + } + }; +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/iter.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/iter.rs new file mode 100644 index 000000000000..7f7ce554c526 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/iter.rs @@ -0,0 +1,145 @@ +/*! +Yield the bits of a source flags value in a set of contained flags values. +*/ + +use crate::{Flag, Flags}; + +/** +An iterator over flags values. + +This iterator will yield flags values for contained, defined flags first, with any remaining bits yielded +as a final flags value. +*/ +pub struct Iter { + inner: IterNames, + done: bool, +} + +impl Iter { + pub(crate) fn new(flags: &B) -> Self { + Iter { + inner: IterNames::new(flags), + done: false, + } + } +} + +impl Iter { + // Used by the `bitflags` macro + #[doc(hidden)] + pub const fn __private_const_new(flags: &'static [Flag], source: B, remaining: B) -> Self { + Iter { + inner: IterNames::__private_const_new(flags, source, remaining), + done: false, + } + } +} + +impl Iterator for Iter { + type Item = B; + + fn next(&mut self) -> Option { + match self.inner.next() { + Some((_, flag)) => Some(flag), + None if !self.done => { + self.done = true; + + // After iterating through valid names, if there are any bits left over + // then return one final value that includes them. This makes `into_iter` + // and `from_iter` roundtrip + if !self.inner.remaining().is_empty() { + Some(B::from_bits_retain(self.inner.remaining.bits())) + } else { + None + } + } + None => None, + } + } +} + +/** +An iterator over flags values. + +This iterator only yields flags values for contained, defined, named flags. Any remaining bits +won't be yielded, but can be found with the [`IterNames::remaining`] method. +*/ +pub struct IterNames { + flags: &'static [Flag], + idx: usize, + source: B, + remaining: B, +} + +impl IterNames { + pub(crate) fn new(flags: &B) -> Self { + IterNames { + flags: B::FLAGS, + idx: 0, + remaining: B::from_bits_retain(flags.bits()), + source: B::from_bits_retain(flags.bits()), + } + } +} + +impl IterNames { + // Used by the bitflags macro + #[doc(hidden)] + pub const fn __private_const_new(flags: &'static [Flag], source: B, remaining: B) -> Self { + IterNames { + flags, + idx: 0, + remaining, + source, + } + } + + /// Get a flags value of any remaining bits that haven't been yielded yet. + /// + /// Once the iterator has finished, this method can be used to + /// check whether or not there are any bits that didn't correspond + /// to a contained, defined, named flag remaining. + pub fn remaining(&self) -> &B { + &self.remaining + } +} + +impl Iterator for IterNames { + type Item = (&'static str, B); + + fn next(&mut self) -> Option { + while let Some(flag) = self.flags.get(self.idx) { + // Short-circuit if our state is empty + if self.remaining.is_empty() { + return None; + } + + self.idx += 1; + + // Skip unnamed flags + if flag.name().is_empty() { + continue; + } + + let bits = flag.value().bits(); + + // If the flag is set in the original source _and_ it has bits that haven't + // been covered by a previous flag yet then yield it. These conditions cover + // two cases for multi-bit flags: + // + // 1. When flags partially overlap, such as `0b00000001` and `0b00000101`, we'll + // yield both flags. + // 2. When flags fully overlap, such as in convenience flags that are a shorthand for others, + // we won't yield both flags. + if self.source.contains(B::from_bits_retain(bits)) + && self.remaining.intersects(B::from_bits_retain(bits)) + { + self.remaining.remove(B::from_bits_retain(bits)); + + return Some((flag.name(), B::from_bits_retain(bits))); + } + } + + None + } +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/lib.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/lib.rs new file mode 100644 index 000000000000..a9a6aa46cc78 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/lib.rs @@ -0,0 +1,927 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +/*! +Generate types for C-style flags with ergonomic APIs. + +# Getting started + +Add `bitflags` to your `Cargo.toml`: + +```toml +[dependencies.bitflags] +version = "2.6.0" +``` + +## Generating flags types + +Use the [`bitflags`] macro to generate flags types: + +```rust +use bitflags::bitflags; + +bitflags! { + pub struct Flags: u32 { + const A = 0b00000001; + const B = 0b00000010; + const C = 0b00000100; + } +} +``` + +See the docs for the `bitflags` macro for the full syntax. + +Also see the [`example_generated`](./example_generated/index.html) module for an example of what the `bitflags` macro generates for a flags type. + +### Externally defined flags + +If you're generating flags types for an external source, such as a C API, you can define +an extra unnamed flag as a mask of all bits the external source may ever set. Usually this would be all bits (`!0`): + +```rust +# use bitflags::bitflags; +bitflags! { + pub struct Flags: u32 { + const A = 0b00000001; + const B = 0b00000010; + const C = 0b00000100; + + // The source may set any bits + const _ = !0; + } +} +``` + +Why should you do this? Generated methods like `all` and truncating operators like `!` only consider +bits in defined flags. Adding an unnamed flag makes those methods consider additional bits, +without generating additional constants for them. It helps compatibility when the external source +may start setting additional bits at any time. The [known and unknown bits](#known-and-unknown-bits) +section has more details on this behavior. + +### Custom derives + +You can derive some traits on generated flags types if you enable Cargo features. The following +libraries are currently supported: + +- `serde`: Support `#[derive(Serialize, Deserialize)]`, using text for human-readable formats, +and a raw number for binary formats. +- `arbitrary`: Support `#[derive(Arbitrary)]`, only generating flags values with known bits. +- `bytemuck`: Support `#[derive(Pod, Zeroable)]`, for casting between flags values and their +underlying bits values. + +You can also define your own flags type outside of the [`bitflags`] macro and then use it to generate methods. +This can be useful if you need a custom `#[derive]` attribute for a library that `bitflags` doesn't +natively support: + +```rust +# use std::fmt::Debug as SomeTrait; +# use bitflags::bitflags; +#[derive(SomeTrait)] +pub struct Flags(u32); + +bitflags! { + impl Flags: u32 { + const A = 0b00000001; + const B = 0b00000010; + const C = 0b00000100; + } +} +``` + +### Adding custom methods + +The [`bitflags`] macro supports attributes on generated flags types within the macro itself, while +`impl` blocks can be added outside of it: + +```rust +# use bitflags::bitflags; +bitflags! { + // Attributes can be applied to flags types + #[repr(transparent)] + #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] + pub struct Flags: u32 { + const A = 0b00000001; + const B = 0b00000010; + const C = 0b00000100; + } +} + +// Impl blocks can be added to flags types +impl Flags { + pub fn as_u64(&self) -> u64 { + self.bits() as u64 + } +} +``` + +## Working with flags values + +Use generated constants and standard bitwise operators to interact with flags values: + +```rust +# use bitflags::bitflags; +# bitflags! { +# #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] +# pub struct Flags: u32 { +# const A = 0b00000001; +# const B = 0b00000010; +# const C = 0b00000100; +# } +# } +// union +let ab = Flags::A | Flags::B; + +// intersection +let a = ab & Flags::A; + +// difference +let b = ab - Flags::A; + +// complement +let c = !ab; +``` + +See the docs for the [`Flags`] trait for more details on operators and how they behave. + +# Formatting and parsing + +`bitflags` defines a text format that can be used to convert any flags value to and from strings. + +See the [`parser`] module for more details. + +# Specification + +The terminology and behavior of generated flags types is +[specified in the source repository](https://github.com/bitflags/bitflags/blob/main/spec.md). +Details are repeated in these docs where appropriate, but is exhaustively listed in the spec. Some +things are worth calling out explicitly here. + +## Flags types, flags values, flags + +The spec and these docs use consistent terminology to refer to things in the bitflags domain: + +- **Bits type**: A type that defines a fixed number of bits at specific locations. +- **Flag**: A set of bits in a bits type that may have a unique name. +- **Flags type**: A set of defined flags over a specific bits type. +- **Flags value**: An instance of a flags type using its specific bits value for storage. + +``` +# use bitflags::bitflags; +bitflags! { + struct FlagsType: u8 { +// -- Bits type +// --------- Flags type + const A = 1; +// ----- Flag + } +} + +let flag = FlagsType::A; +// ---- Flags value +``` + +## Known and unknown bits + +Any bits in a flag you define are called _known bits_. Any other bits are _unknown bits_. +In the following flags type: + +``` +# use bitflags::bitflags; +bitflags! { + struct Flags: u8 { + const A = 1; + const B = 1 << 1; + const C = 1 << 2; + } +} +``` + +The known bits are `0b0000_0111` and the unknown bits are `0b1111_1000`. + +`bitflags` doesn't guarantee that a flags value will only ever have known bits set, but some operators +will unset any unknown bits they encounter. In a future version of `bitflags`, all operators will +unset unknown bits. + +If you're using `bitflags` for flags types defined externally, such as from C, you probably want all +bits to be considered known, in case that external source changes. You can do this using an unnamed +flag, as described in [externally defined flags](#externally-defined-flags). + +## Zero-bit flags + +Flags with no bits set should be avoided because they interact strangely with [`Flags::contains`] +and [`Flags::intersects`]. A zero-bit flag is always contained, but is never intersected. The +names of zero-bit flags can be parsed, but are never formatted. + +## Multi-bit flags + +Flags that set multiple bits should be avoided unless each bit is also in a single-bit flag. +Take the following flags type as an example: + +``` +# use bitflags::bitflags; +bitflags! { + struct Flags: u8 { + const A = 1; + const B = 1 | 1 << 1; + } +} +``` + +The result of `Flags::A ^ Flags::B` is `0b0000_0010`, which doesn't correspond to either +`Flags::A` or `Flags::B` even though it's still a known bit. +*/ + +#![cfg_attr(not(any(feature = "std", test)), no_std)] +#![cfg_attr(not(test), forbid(unsafe_code))] +#![cfg_attr(test, allow(mixed_script_confusables))] + +#[doc(inline)] +pub use traits::{Bits, Flag, Flags}; + +pub mod iter; +pub mod parser; + +mod traits; + +#[doc(hidden)] +pub mod __private { + #[allow(unused_imports)] + // Easier than conditionally checking any optional external dependencies + pub use crate::{external::__private::*, traits::__private::*}; + + pub use core; +} + +#[allow(unused_imports)] +pub use external::*; + +#[allow(deprecated)] +pub use traits::BitFlags; + +/* +How does the bitflags crate work? + +This library generates a `struct` in the end-user's crate with a bunch of constants on it that represent flags. +The difference between `bitflags` and a lot of other libraries is that we don't actually control the generated `struct` in the end. +It's part of the end-user's crate, so it belongs to them. That makes it difficult to extend `bitflags` with new functionality +because we could end up breaking valid code that was already written. + +Our solution is to split the type we generate into two: the public struct owned by the end-user, and an internal struct owned by `bitflags` (us). +To give you an example, let's say we had a crate that called `bitflags!`: + +```rust +bitflags! { + pub struct MyFlags: u32 { + const A = 1; + const B = 2; + } +} +``` + +What they'd end up with looks something like this: + +```rust +pub struct MyFlags(::InternalBitFlags); + +const _: () = { + #[repr(transparent)] + #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] + pub struct MyInternalBitFlags { + bits: u32, + } + + impl PublicFlags for MyFlags { + type Internal = InternalBitFlags; + } +}; +``` + +If we want to expose something like a new trait impl for generated flags types, we add it to our generated `MyInternalBitFlags`, +and let `#[derive]` on `MyFlags` pick up that implementation, if an end-user chooses to add one. + +The public API is generated in the `__impl_public_flags!` macro, and the internal API is generated in +the `__impl_internal_flags!` macro. + +The macros are split into 3 modules: + +- `public`: where the user-facing flags types are generated. +- `internal`: where the `bitflags`-facing flags types are generated. +- `external`: where external library traits are implemented conditionally. +*/ + +/** +Generate a flags type. + +# `struct` mode + +A declaration that begins with `$vis struct` will generate a `struct` for a flags type, along with +methods and trait implementations for it. The body of the declaration defines flags as constants, +where each constant is a flags value of the generated flags type. + +## Examples + +Generate a flags type using `u8` as the bits type: + +``` +# use bitflags::bitflags; +bitflags! { + struct Flags: u8 { + const A = 1; + const B = 1 << 1; + const C = 0b0000_0100; + } +} +``` + +Flags types are private by default and accept standard visibility modifiers. Flags themselves +are always public: + +``` +# use bitflags::bitflags; +bitflags! { + pub struct Flags: u8 { + // Constants are always `pub` + const A = 1; + } +} +``` + +Flags may refer to other flags using their [`Flags::bits`] value: + +``` +# use bitflags::bitflags; +bitflags! { + struct Flags: u8 { + const A = 1; + const B = 1 << 1; + const AB = Flags::A.bits() | Flags::B.bits(); + } +} +``` + +A single `bitflags` invocation may include zero or more flags type declarations: + +``` +# use bitflags::bitflags; +bitflags! {} + +bitflags! { + struct Flags1: u8 { + const A = 1; + } + + struct Flags2: u8 { + const A = 1; + } +} +``` + +# `impl` mode + +A declaration that begins with `impl` will only generate methods and trait implementations for the +`struct` defined outside of the `bitflags` macro. + +The struct itself must be a newtype using the bits type as its field. + +The syntax for `impl` mode is identical to `struct` mode besides the starting token. + +## Examples + +Implement flags methods and traits for a custom flags type using `u8` as its underlying bits type: + +``` +# use bitflags::bitflags; +struct Flags(u8); + +bitflags! { + impl Flags: u8 { + const A = 1; + const B = 1 << 1; + const C = 0b0000_0100; + } +} +``` + +# Named and unnamed flags + +Constants in the body of a declaration are flags. The identifier of the constant is the name of +the flag. If the identifier is `_`, then the flag is unnamed. Unnamed flags don't appear in the +generated API, but affect how bits are truncated. + +## Examples + +Adding an unnamed flag that makes all bits known: + +``` +# use bitflags::bitflags; +bitflags! { + struct Flags: u8 { + const A = 1; + const B = 1 << 1; + + const _ = !0; + } +} +``` + +Flags types may define multiple unnamed flags: + +``` +# use bitflags::bitflags; +bitflags! { + struct Flags: u8 { + const _ = 1; + const _ = 1 << 1; + } +} +``` +*/ +#[macro_export] +macro_rules! bitflags { + ( + $(#[$outer:meta])* + $vis:vis struct $BitFlags:ident: $T:ty { + $( + $(#[$inner:ident $($args:tt)*])* + const $Flag:tt = $value:expr; + )* + } + + $($t:tt)* + ) => { + // Declared in the scope of the `bitflags!` call + // This type appears in the end-user's API + $crate::__declare_public_bitflags! { + $(#[$outer])* + $vis struct $BitFlags + } + + // Workaround for: https://github.com/bitflags/bitflags/issues/320 + $crate::__impl_public_bitflags_consts! { + $BitFlags: $T { + $( + $(#[$inner $($args)*])* + const $Flag = $value; + )* + } + } + + #[allow( + dead_code, + deprecated, + unused_doc_comments, + unused_attributes, + unused_mut, + unused_imports, + non_upper_case_globals, + clippy::assign_op_pattern, + clippy::indexing_slicing, + clippy::same_name_method, + clippy::iter_without_into_iter, + )] + const _: () = { + // Declared in a "hidden" scope that can't be reached directly + // These types don't appear in the end-user's API + $crate::__declare_internal_bitflags! { + $vis struct InternalBitFlags: $T + } + + $crate::__impl_internal_bitflags! { + InternalBitFlags: $T, $BitFlags { + $( + $(#[$inner $($args)*])* + const $Flag = $value; + )* + } + } + + // This is where new library trait implementations can be added + $crate::__impl_external_bitflags! { + InternalBitFlags: $T, $BitFlags { + $( + $(#[$inner $($args)*])* + const $Flag; + )* + } + } + + $crate::__impl_public_bitflags_forward! { + $BitFlags: $T, InternalBitFlags + } + + $crate::__impl_public_bitflags_ops! { + $BitFlags + } + + $crate::__impl_public_bitflags_iter! { + $BitFlags: $T, $BitFlags + } + }; + + $crate::bitflags! { + $($t)* + } + }; + ( + $(#[$outer:meta])* + impl $BitFlags:ident: $T:ty { + $( + $(#[$inner:ident $($args:tt)*])* + const $Flag:tt = $value:expr; + )* + } + + $($t:tt)* + ) => { + $crate::__impl_public_bitflags_consts! { + $BitFlags: $T { + $( + $(#[$inner $($args)*])* + const $Flag = $value; + )* + } + } + + #[allow( + dead_code, + deprecated, + unused_doc_comments, + unused_attributes, + unused_mut, + unused_imports, + non_upper_case_globals, + clippy::assign_op_pattern, + clippy::iter_without_into_iter, + )] + const _: () = { + $crate::__impl_public_bitflags! { + $(#[$outer])* + $BitFlags: $T, $BitFlags { + $( + $(#[$inner $($args)*])* + const $Flag = $value; + )* + } + } + + $crate::__impl_public_bitflags_ops! { + $BitFlags + } + + $crate::__impl_public_bitflags_iter! { + $BitFlags: $T, $BitFlags + } + }; + + $crate::bitflags! { + $($t)* + } + }; + () => {}; +} + +/// Implement functions on bitflags types. +/// +/// We need to be careful about adding new methods and trait implementations here because they +/// could conflict with items added by the end-user. +#[macro_export] +#[doc(hidden)] +macro_rules! __impl_bitflags { + ( + $(#[$outer:meta])* + $PublicBitFlags:ident: $T:ty { + fn empty() $empty:block + fn all() $all:block + fn bits($bits0:ident) $bits:block + fn from_bits($from_bits0:ident) $from_bits:block + fn from_bits_truncate($from_bits_truncate0:ident) $from_bits_truncate:block + fn from_bits_retain($from_bits_retain0:ident) $from_bits_retain:block + fn from_name($from_name0:ident) $from_name:block + fn is_empty($is_empty0:ident) $is_empty:block + fn is_all($is_all0:ident) $is_all:block + fn intersects($intersects0:ident, $intersects1:ident) $intersects:block + fn contains($contains0:ident, $contains1:ident) $contains:block + fn insert($insert0:ident, $insert1:ident) $insert:block + fn remove($remove0:ident, $remove1:ident) $remove:block + fn toggle($toggle0:ident, $toggle1:ident) $toggle:block + fn set($set0:ident, $set1:ident, $set2:ident) $set:block + fn intersection($intersection0:ident, $intersection1:ident) $intersection:block + fn union($union0:ident, $union1:ident) $union:block + fn difference($difference0:ident, $difference1:ident) $difference:block + fn symmetric_difference($symmetric_difference0:ident, $symmetric_difference1:ident) $symmetric_difference:block + fn complement($complement0:ident) $complement:block + } + ) => { + #[allow(dead_code, deprecated, unused_attributes)] + $(#[$outer])* + impl $PublicBitFlags { + /// Get a flags value with all bits unset. + #[inline] + pub const fn empty() -> Self { + $empty + } + + /// Get a flags value with all known bits set. + #[inline] + pub const fn all() -> Self { + $all + } + + /// Get the underlying bits value. + /// + /// The returned value is exactly the bits set in this flags value. + #[inline] + pub const fn bits(&self) -> $T { + let $bits0 = self; + $bits + } + + /// Convert from a bits value. + /// + /// This method will return `None` if any unknown bits are set. + #[inline] + pub const fn from_bits(bits: $T) -> $crate::__private::core::option::Option { + let $from_bits0 = bits; + $from_bits + } + + /// Convert from a bits value, unsetting any unknown bits. + #[inline] + pub const fn from_bits_truncate(bits: $T) -> Self { + let $from_bits_truncate0 = bits; + $from_bits_truncate + } + + /// Convert from a bits value exactly. + #[inline] + pub const fn from_bits_retain(bits: $T) -> Self { + let $from_bits_retain0 = bits; + $from_bits_retain + } + + /// Get a flags value with the bits of a flag with the given name set. + /// + /// This method will return `None` if `name` is empty or doesn't + /// correspond to any named flag. + #[inline] + pub fn from_name(name: &str) -> $crate::__private::core::option::Option { + let $from_name0 = name; + $from_name + } + + /// Whether all bits in this flags value are unset. + #[inline] + pub const fn is_empty(&self) -> bool { + let $is_empty0 = self; + $is_empty + } + + /// Whether all known bits in this flags value are set. + #[inline] + pub const fn is_all(&self) -> bool { + let $is_all0 = self; + $is_all + } + + /// Whether any set bits in a source flags value are also set in a target flags value. + #[inline] + pub const fn intersects(&self, other: Self) -> bool { + let $intersects0 = self; + let $intersects1 = other; + $intersects + } + + /// Whether all set bits in a source flags value are also set in a target flags value. + #[inline] + pub const fn contains(&self, other: Self) -> bool { + let $contains0 = self; + let $contains1 = other; + $contains + } + + /// The bitwise or (`|`) of the bits in two flags values. + #[inline] + pub fn insert(&mut self, other: Self) { + let $insert0 = self; + let $insert1 = other; + $insert + } + + /// The intersection of a source flags value with the complement of a target flags value (`&!`). + /// + /// This method is not equivalent to `self & !other` when `other` has unknown bits set. + /// `remove` won't truncate `other`, but the `!` operator will. + #[inline] + pub fn remove(&mut self, other: Self) { + let $remove0 = self; + let $remove1 = other; + $remove + } + + /// The bitwise exclusive-or (`^`) of the bits in two flags values. + #[inline] + pub fn toggle(&mut self, other: Self) { + let $toggle0 = self; + let $toggle1 = other; + $toggle + } + + /// Call `insert` when `value` is `true` or `remove` when `value` is `false`. + #[inline] + pub fn set(&mut self, other: Self, value: bool) { + let $set0 = self; + let $set1 = other; + let $set2 = value; + $set + } + + /// The bitwise and (`&`) of the bits in two flags values. + #[inline] + #[must_use] + pub const fn intersection(self, other: Self) -> Self { + let $intersection0 = self; + let $intersection1 = other; + $intersection + } + + /// The bitwise or (`|`) of the bits in two flags values. + #[inline] + #[must_use] + pub const fn union(self, other: Self) -> Self { + let $union0 = self; + let $union1 = other; + $union + } + + /// The intersection of a source flags value with the complement of a target flags value (`&!`). + /// + /// This method is not equivalent to `self & !other` when `other` has unknown bits set. + /// `difference` won't truncate `other`, but the `!` operator will. + #[inline] + #[must_use] + pub const fn difference(self, other: Self) -> Self { + let $difference0 = self; + let $difference1 = other; + $difference + } + + /// The bitwise exclusive-or (`^`) of the bits in two flags values. + #[inline] + #[must_use] + pub const fn symmetric_difference(self, other: Self) -> Self { + let $symmetric_difference0 = self; + let $symmetric_difference1 = other; + $symmetric_difference + } + + /// The bitwise negation (`!`) of the bits in a flags value, truncating the result. + #[inline] + #[must_use] + pub const fn complement(self) -> Self { + let $complement0 = self; + $complement + } + } + }; +} + +/// A macro that processed the input to `bitflags!` and shuffles attributes around +/// based on whether or not they're "expression-safe". +/// +/// This macro is a token-tree muncher that works on 2 levels: +/// +/// For each attribute, we explicitly match on its identifier, like `cfg` to determine +/// whether or not it should be considered expression-safe. +/// +/// If you find yourself with an attribute that should be considered expression-safe +/// and isn't, it can be added here. +#[macro_export] +#[doc(hidden)] +macro_rules! __bitflags_expr_safe_attrs { + // Entrypoint: Move all flags and all attributes into `unprocessed` lists + // where they'll be munched one-at-a-time + ( + $(#[$inner:ident $($args:tt)*])* + { $e:expr } + ) => { + $crate::__bitflags_expr_safe_attrs! { + expr: { $e }, + attrs: { + // All attributes start here + unprocessed: [$(#[$inner $($args)*])*], + // Attributes that are safe on expressions go here + processed: [], + }, + } + }; + // Process the next attribute on the current flag + // `cfg`: The next flag should be propagated to expressions + // NOTE: You can copy this rules block and replace `cfg` with + // your attribute name that should be considered expression-safe + ( + expr: { $e:expr }, + attrs: { + unprocessed: [ + // cfg matched here + #[cfg $($args:tt)*] + $($attrs_rest:tt)* + ], + processed: [$($expr:tt)*], + }, + ) => { + $crate::__bitflags_expr_safe_attrs! { + expr: { $e }, + attrs: { + unprocessed: [ + $($attrs_rest)* + ], + processed: [ + $($expr)* + // cfg added here + #[cfg $($args)*] + ], + }, + } + }; + // Process the next attribute on the current flag + // `$other`: The next flag should not be propagated to expressions + ( + expr: { $e:expr }, + attrs: { + unprocessed: [ + // $other matched here + #[$other:ident $($args:tt)*] + $($attrs_rest:tt)* + ], + processed: [$($expr:tt)*], + }, + ) => { + $crate::__bitflags_expr_safe_attrs! { + expr: { $e }, + attrs: { + unprocessed: [ + $($attrs_rest)* + ], + processed: [ + // $other not added here + $($expr)* + ], + }, + } + }; + // Once all attributes on all flags are processed, generate the actual code + ( + expr: { $e:expr }, + attrs: { + unprocessed: [], + processed: [$(#[$expr:ident $($exprargs:tt)*])*], + }, + ) => { + $(#[$expr $($exprargs)*])* + { $e } + } +} + +/// Implement a flag, which may be a wildcard `_`. +#[macro_export] +#[doc(hidden)] +macro_rules! __bitflags_flag { + ( + { + name: _, + named: { $($named:tt)* }, + unnamed: { $($unnamed:tt)* }, + } + ) => { + $($unnamed)* + }; + ( + { + name: $Flag:ident, + named: { $($named:tt)* }, + unnamed: { $($unnamed:tt)* }, + } + ) => { + $($named)* + }; +} + +#[macro_use] +mod public; +#[macro_use] +mod internal; +#[macro_use] +mod external; + +#[cfg(feature = "example_generated")] +pub mod example_generated; + +#[cfg(test)] +mod tests; diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/parser.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/parser.rs new file mode 100644 index 000000000000..34b432da39b8 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/parser.rs @@ -0,0 +1,332 @@ +/*! +Parsing flags from text. + +Format and parse a flags value as text using the following grammar: + +- _Flags:_ (_Whitespace_ _Flag_ _Whitespace_)`|`* +- _Flag:_ _Name_ | _Hex Number_ +- _Name:_ The name of any defined flag +- _Hex Number_: `0x`([0-9a-fA-F])* +- _Whitespace_: (\s)* + +As an example, this is how `Flags::A | Flags::B | 0x0c` can be represented as text: + +```text +A | B | 0x0c +``` + +Alternatively, it could be represented without whitespace: + +```text +A|B|0x0C +``` + +Note that identifiers are *case-sensitive*, so the following is *not equivalent*: + +```text +a|b|0x0C +``` +*/ + +#![allow(clippy::let_unit_value)] + +use core::fmt::{self, Write}; + +use crate::{Bits, Flags}; + +/** +Write a flags value as text. + +Any bits that aren't part of a contained flag will be formatted as a hex number. +*/ +pub fn to_writer(flags: &B, mut writer: impl Write) -> Result<(), fmt::Error> +where + B::Bits: WriteHex, +{ + // A formatter for bitflags that produces text output like: + // + // A | B | 0xf6 + // + // The names of set flags are written in a bar-separated-format, + // followed by a hex number of any remaining bits that are set + // but don't correspond to any flags. + + // Iterate over known flag values + let mut first = true; + let mut iter = flags.iter_names(); + for (name, _) in &mut iter { + if !first { + writer.write_str(" | ")?; + } + + first = false; + writer.write_str(name)?; + } + + // Append any extra bits that correspond to flags to the end of the format + let remaining = iter.remaining().bits(); + if remaining != B::Bits::EMPTY { + if !first { + writer.write_str(" | ")?; + } + + writer.write_str("0x")?; + remaining.write_hex(writer)?; + } + + fmt::Result::Ok(()) +} + +#[cfg(feature = "serde")] +pub(crate) struct AsDisplay<'a, B>(pub(crate) &'a B); + +#[cfg(feature = "serde")] +impl<'a, B: Flags> fmt::Display for AsDisplay<'a, B> +where + B::Bits: WriteHex, +{ + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + to_writer(self.0, f) + } +} + +/** +Parse a flags value from text. + +This function will fail on any names that don't correspond to defined flags. +Unknown bits will be retained. +*/ +pub fn from_str(input: &str) -> Result +where + B::Bits: ParseHex, +{ + let mut parsed_flags = B::empty(); + + // If the input is empty then return an empty set of flags + if input.trim().is_empty() { + return Ok(parsed_flags); + } + + for flag in input.split('|') { + let flag = flag.trim(); + + // If the flag is empty then we've got missing input + if flag.is_empty() { + return Err(ParseError::empty_flag()); + } + + // If the flag starts with `0x` then it's a hex number + // Parse it directly to the underlying bits type + let parsed_flag = if let Some(flag) = flag.strip_prefix("0x") { + let bits = + ::parse_hex(flag).map_err(|_| ParseError::invalid_hex_flag(flag))?; + + B::from_bits_retain(bits) + } + // Otherwise the flag is a name + // The generated flags type will determine whether + // or not it's a valid identifier + else { + B::from_name(flag).ok_or_else(|| ParseError::invalid_named_flag(flag))? + }; + + parsed_flags.insert(parsed_flag); + } + + Ok(parsed_flags) +} + +/** +Write a flags value as text, ignoring any unknown bits. +*/ +pub fn to_writer_truncate(flags: &B, writer: impl Write) -> Result<(), fmt::Error> +where + B::Bits: WriteHex, +{ + to_writer(&B::from_bits_truncate(flags.bits()), writer) +} + +/** +Parse a flags value from text. + +This function will fail on any names that don't correspond to defined flags. +Unknown bits will be ignored. +*/ +pub fn from_str_truncate(input: &str) -> Result +where + B::Bits: ParseHex, +{ + Ok(B::from_bits_truncate(from_str::(input)?.bits())) +} + +/** +Write only the contained, defined, named flags in a flags value as text. +*/ +pub fn to_writer_strict(flags: &B, mut writer: impl Write) -> Result<(), fmt::Error> { + // This is a simplified version of `to_writer` that ignores + // any bits not corresponding to a named flag + + let mut first = true; + let mut iter = flags.iter_names(); + for (name, _) in &mut iter { + if !first { + writer.write_str(" | ")?; + } + + first = false; + writer.write_str(name)?; + } + + fmt::Result::Ok(()) +} + +/** +Parse a flags value from text. + +This function will fail on any names that don't correspond to defined flags. +This function will fail to parse hex values. +*/ +pub fn from_str_strict(input: &str) -> Result { + // This is a simplified version of `from_str` that ignores + // any bits not corresponding to a named flag + + let mut parsed_flags = B::empty(); + + // If the input is empty then return an empty set of flags + if input.trim().is_empty() { + return Ok(parsed_flags); + } + + for flag in input.split('|') { + let flag = flag.trim(); + + // If the flag is empty then we've got missing input + if flag.is_empty() { + return Err(ParseError::empty_flag()); + } + + // If the flag starts with `0x` then it's a hex number + // These aren't supported in the strict parser + if flag.starts_with("0x") { + return Err(ParseError::invalid_hex_flag("unsupported hex flag value")); + } + + let parsed_flag = B::from_name(flag).ok_or_else(|| ParseError::invalid_named_flag(flag))?; + + parsed_flags.insert(parsed_flag); + } + + Ok(parsed_flags) +} + +/** +Encode a value as a hex string. + +Implementors of this trait should not write the `0x` prefix. +*/ +pub trait WriteHex { + /// Write the value as hex. + fn write_hex(&self, writer: W) -> fmt::Result; +} + +/** +Parse a value from a hex string. +*/ +pub trait ParseHex { + /// Parse the value from hex. + fn parse_hex(input: &str) -> Result + where + Self: Sized; +} + +/// An error encountered while parsing flags from text. +#[derive(Debug)] +pub struct ParseError(ParseErrorKind); + +#[derive(Debug)] +#[allow(clippy::enum_variant_names)] +enum ParseErrorKind { + EmptyFlag, + InvalidNamedFlag { + #[cfg(not(feature = "std"))] + got: (), + #[cfg(feature = "std")] + got: String, + }, + InvalidHexFlag { + #[cfg(not(feature = "std"))] + got: (), + #[cfg(feature = "std")] + got: String, + }, +} + +impl ParseError { + /// An invalid hex flag was encountered. + pub fn invalid_hex_flag(flag: impl fmt::Display) -> Self { + let _flag = flag; + + let got = { + #[cfg(feature = "std")] + { + _flag.to_string() + } + }; + + ParseError(ParseErrorKind::InvalidHexFlag { got }) + } + + /// A named flag that doesn't correspond to any on the flags type was encountered. + pub fn invalid_named_flag(flag: impl fmt::Display) -> Self { + let _flag = flag; + + let got = { + #[cfg(feature = "std")] + { + _flag.to_string() + } + }; + + ParseError(ParseErrorKind::InvalidNamedFlag { got }) + } + + /// A hex or named flag wasn't found between separators. + pub const fn empty_flag() -> Self { + ParseError(ParseErrorKind::EmptyFlag) + } +} + +impl fmt::Display for ParseError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match &self.0 { + ParseErrorKind::InvalidNamedFlag { got } => { + let _got = got; + + write!(f, "unrecognized named flag")?; + + #[cfg(feature = "std")] + { + write!(f, " `{}`", _got)?; + } + } + ParseErrorKind::InvalidHexFlag { got } => { + let _got = got; + + write!(f, "invalid hex flag")?; + + #[cfg(feature = "std")] + { + write!(f, " `{}`", _got)?; + } + } + ParseErrorKind::EmptyFlag => { + write!(f, "encountered empty flag")?; + } + } + + Ok(()) + } +} + +#[cfg(feature = "std")] +impl std::error::Error for ParseError {} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/public.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/public.rs new file mode 100644 index 000000000000..feecdd678134 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/public.rs @@ -0,0 +1,578 @@ +//! Generate the user-facing flags type. +//! +//! The code here belongs to the end-user, so new trait implementations and methods can't be +//! added without potentially breaking users. + +/// Declare the user-facing bitflags struct. +/// +/// This type is guaranteed to be a newtype with a `bitflags`-facing type as its single field. +#[macro_export] +#[doc(hidden)] +macro_rules! __declare_public_bitflags { + ( + $(#[$outer:meta])* + $vis:vis struct $PublicBitFlags:ident + ) => { + $(#[$outer])* + $vis struct $PublicBitFlags(<$PublicBitFlags as $crate::__private::PublicFlags>::Internal); + }; +} + +/// Implement functions on the public (user-facing) bitflags type. +/// +/// We need to be careful about adding new methods and trait implementations here because they +/// could conflict with items added by the end-user. +#[macro_export] +#[doc(hidden)] +macro_rules! __impl_public_bitflags_forward { + ( + $(#[$outer:meta])* + $PublicBitFlags:ident: $T:ty, $InternalBitFlags:ident + ) => { + $crate::__impl_bitflags! { + $(#[$outer])* + $PublicBitFlags: $T { + fn empty() { + Self($InternalBitFlags::empty()) + } + + fn all() { + Self($InternalBitFlags::all()) + } + + fn bits(f) { + f.0.bits() + } + + fn from_bits(bits) { + match $InternalBitFlags::from_bits(bits) { + $crate::__private::core::option::Option::Some(bits) => $crate::__private::core::option::Option::Some(Self(bits)), + $crate::__private::core::option::Option::None => $crate::__private::core::option::Option::None, + } + } + + fn from_bits_truncate(bits) { + Self($InternalBitFlags::from_bits_truncate(bits)) + } + + fn from_bits_retain(bits) { + Self($InternalBitFlags::from_bits_retain(bits)) + } + + fn from_name(name) { + match $InternalBitFlags::from_name(name) { + $crate::__private::core::option::Option::Some(bits) => $crate::__private::core::option::Option::Some(Self(bits)), + $crate::__private::core::option::Option::None => $crate::__private::core::option::Option::None, + } + } + + fn is_empty(f) { + f.0.is_empty() + } + + fn is_all(f) { + f.0.is_all() + } + + fn intersects(f, other) { + f.0.intersects(other.0) + } + + fn contains(f, other) { + f.0.contains(other.0) + } + + fn insert(f, other) { + f.0.insert(other.0) + } + + fn remove(f, other) { + f.0.remove(other.0) + } + + fn toggle(f, other) { + f.0.toggle(other.0) + } + + fn set(f, other, value) { + f.0.set(other.0, value) + } + + fn intersection(f, other) { + Self(f.0.intersection(other.0)) + } + + fn union(f, other) { + Self(f.0.union(other.0)) + } + + fn difference(f, other) { + Self(f.0.difference(other.0)) + } + + fn symmetric_difference(f, other) { + Self(f.0.symmetric_difference(other.0)) + } + + fn complement(f) { + Self(f.0.complement()) + } + } + } + }; +} + +/// Implement functions on the public (user-facing) bitflags type. +/// +/// We need to be careful about adding new methods and trait implementations here because they +/// could conflict with items added by the end-user. +#[macro_export] +#[doc(hidden)] +macro_rules! __impl_public_bitflags { + ( + $(#[$outer:meta])* + $BitFlags:ident: $T:ty, $PublicBitFlags:ident { + $( + $(#[$inner:ident $($args:tt)*])* + const $Flag:tt = $value:expr; + )* + } + ) => { + $crate::__impl_bitflags! { + $(#[$outer])* + $BitFlags: $T { + fn empty() { + Self(<$T as $crate::Bits>::EMPTY) + } + + fn all() { + let mut truncated = <$T as $crate::Bits>::EMPTY; + let mut i = 0; + + $( + $crate::__bitflags_expr_safe_attrs!( + $(#[$inner $($args)*])* + {{ + let flag = <$PublicBitFlags as $crate::Flags>::FLAGS[i].value().bits(); + + truncated = truncated | flag; + i += 1; + }} + ); + )* + + let _ = i; + Self::from_bits_retain(truncated) + } + + fn bits(f) { + f.0 + } + + fn from_bits(bits) { + let truncated = Self::from_bits_truncate(bits).0; + + if truncated == bits { + $crate::__private::core::option::Option::Some(Self(bits)) + } else { + $crate::__private::core::option::Option::None + } + } + + fn from_bits_truncate(bits) { + Self(bits & Self::all().bits()) + } + + fn from_bits_retain(bits) { + Self(bits) + } + + fn from_name(name) { + $( + $crate::__bitflags_flag!({ + name: $Flag, + named: { + $crate::__bitflags_expr_safe_attrs!( + $(#[$inner $($args)*])* + { + if name == $crate::__private::core::stringify!($Flag) { + return $crate::__private::core::option::Option::Some(Self($PublicBitFlags::$Flag.bits())); + } + } + ); + }, + unnamed: {}, + }); + )* + + let _ = name; + $crate::__private::core::option::Option::None + } + + fn is_empty(f) { + f.bits() == <$T as $crate::Bits>::EMPTY + } + + fn is_all(f) { + // NOTE: We check against `Self::all` here, not `Self::Bits::ALL` + // because the set of all flags may not use all bits + Self::all().bits() | f.bits() == f.bits() + } + + fn intersects(f, other) { + f.bits() & other.bits() != <$T as $crate::Bits>::EMPTY + } + + fn contains(f, other) { + f.bits() & other.bits() == other.bits() + } + + fn insert(f, other) { + *f = Self::from_bits_retain(f.bits()).union(other); + } + + fn remove(f, other) { + *f = Self::from_bits_retain(f.bits()).difference(other); + } + + fn toggle(f, other) { + *f = Self::from_bits_retain(f.bits()).symmetric_difference(other); + } + + fn set(f, other, value) { + if value { + f.insert(other); + } else { + f.remove(other); + } + } + + fn intersection(f, other) { + Self::from_bits_retain(f.bits() & other.bits()) + } + + fn union(f, other) { + Self::from_bits_retain(f.bits() | other.bits()) + } + + fn difference(f, other) { + Self::from_bits_retain(f.bits() & !other.bits()) + } + + fn symmetric_difference(f, other) { + Self::from_bits_retain(f.bits() ^ other.bits()) + } + + fn complement(f) { + Self::from_bits_truncate(!f.bits()) + } + } + } + }; +} + +/// Implement iterators on the public (user-facing) bitflags type. +#[macro_export] +#[doc(hidden)] +macro_rules! __impl_public_bitflags_iter { + ( + $(#[$outer:meta])* + $BitFlags:ident: $T:ty, $PublicBitFlags:ident + ) => { + $(#[$outer])* + impl $BitFlags { + /// Yield a set of contained flags values. + /// + /// Each yielded flags value will correspond to a defined named flag. Any unknown bits + /// will be yielded together as a final flags value. + #[inline] + pub const fn iter(&self) -> $crate::iter::Iter<$PublicBitFlags> { + $crate::iter::Iter::__private_const_new( + <$PublicBitFlags as $crate::Flags>::FLAGS, + $PublicBitFlags::from_bits_retain(self.bits()), + $PublicBitFlags::from_bits_retain(self.bits()), + ) + } + + /// Yield a set of contained named flags values. + /// + /// This method is like [`iter`](#method.iter), except only yields bits in contained named flags. + /// Any unknown bits, or bits not corresponding to a contained flag will not be yielded. + #[inline] + pub const fn iter_names(&self) -> $crate::iter::IterNames<$PublicBitFlags> { + $crate::iter::IterNames::__private_const_new( + <$PublicBitFlags as $crate::Flags>::FLAGS, + $PublicBitFlags::from_bits_retain(self.bits()), + $PublicBitFlags::from_bits_retain(self.bits()), + ) + } + } + + $(#[$outer:meta])* + impl $crate::__private::core::iter::IntoIterator for $BitFlags { + type Item = $PublicBitFlags; + type IntoIter = $crate::iter::Iter<$PublicBitFlags>; + + fn into_iter(self) -> Self::IntoIter { + self.iter() + } + } + }; +} + +/// Implement traits on the public (user-facing) bitflags type. +#[macro_export] +#[doc(hidden)] +macro_rules! __impl_public_bitflags_ops { + ( + $(#[$outer:meta])* + $PublicBitFlags:ident + ) => { + + $(#[$outer])* + impl $crate::__private::core::fmt::Binary for $PublicBitFlags { + fn fmt( + &self, + f: &mut $crate::__private::core::fmt::Formatter, + ) -> $crate::__private::core::fmt::Result { + let inner = self.0; + $crate::__private::core::fmt::Binary::fmt(&inner, f) + } + } + + $(#[$outer])* + impl $crate::__private::core::fmt::Octal for $PublicBitFlags { + fn fmt( + &self, + f: &mut $crate::__private::core::fmt::Formatter, + ) -> $crate::__private::core::fmt::Result { + let inner = self.0; + $crate::__private::core::fmt::Octal::fmt(&inner, f) + } + } + + $(#[$outer])* + impl $crate::__private::core::fmt::LowerHex for $PublicBitFlags { + fn fmt( + &self, + f: &mut $crate::__private::core::fmt::Formatter, + ) -> $crate::__private::core::fmt::Result { + let inner = self.0; + $crate::__private::core::fmt::LowerHex::fmt(&inner, f) + } + } + + $(#[$outer])* + impl $crate::__private::core::fmt::UpperHex for $PublicBitFlags { + fn fmt( + &self, + f: &mut $crate::__private::core::fmt::Formatter, + ) -> $crate::__private::core::fmt::Result { + let inner = self.0; + $crate::__private::core::fmt::UpperHex::fmt(&inner, f) + } + } + + $(#[$outer])* + impl $crate::__private::core::ops::BitOr for $PublicBitFlags { + type Output = Self; + + /// The bitwise or (`|`) of the bits in two flags values. + #[inline] + fn bitor(self, other: $PublicBitFlags) -> Self { + self.union(other) + } + } + + $(#[$outer])* + impl $crate::__private::core::ops::BitOrAssign for $PublicBitFlags { + /// The bitwise or (`|`) of the bits in two flags values. + #[inline] + fn bitor_assign(&mut self, other: Self) { + self.insert(other); + } + } + + $(#[$outer])* + impl $crate::__private::core::ops::BitXor for $PublicBitFlags { + type Output = Self; + + /// The bitwise exclusive-or (`^`) of the bits in two flags values. + #[inline] + fn bitxor(self, other: Self) -> Self { + self.symmetric_difference(other) + } + } + + $(#[$outer])* + impl $crate::__private::core::ops::BitXorAssign for $PublicBitFlags { + /// The bitwise exclusive-or (`^`) of the bits in two flags values. + #[inline] + fn bitxor_assign(&mut self, other: Self) { + self.toggle(other); + } + } + + $(#[$outer])* + impl $crate::__private::core::ops::BitAnd for $PublicBitFlags { + type Output = Self; + + /// The bitwise and (`&`) of the bits in two flags values. + #[inline] + fn bitand(self, other: Self) -> Self { + self.intersection(other) + } + } + + $(#[$outer])* + impl $crate::__private::core::ops::BitAndAssign for $PublicBitFlags { + /// The bitwise and (`&`) of the bits in two flags values. + #[inline] + fn bitand_assign(&mut self, other: Self) { + *self = Self::from_bits_retain(self.bits()).intersection(other); + } + } + + $(#[$outer])* + impl $crate::__private::core::ops::Sub for $PublicBitFlags { + type Output = Self; + + /// The intersection of a source flags value with the complement of a target flags value (`&!`). + /// + /// This method is not equivalent to `self & !other` when `other` has unknown bits set. + /// `difference` won't truncate `other`, but the `!` operator will. + #[inline] + fn sub(self, other: Self) -> Self { + self.difference(other) + } + } + + $(#[$outer])* + impl $crate::__private::core::ops::SubAssign for $PublicBitFlags { + /// The intersection of a source flags value with the complement of a target flags value (`&!`). + /// + /// This method is not equivalent to `self & !other` when `other` has unknown bits set. + /// `difference` won't truncate `other`, but the `!` operator will. + #[inline] + fn sub_assign(&mut self, other: Self) { + self.remove(other); + } + } + + $(#[$outer])* + impl $crate::__private::core::ops::Not for $PublicBitFlags { + type Output = Self; + + /// The bitwise negation (`!`) of the bits in a flags value, truncating the result. + #[inline] + fn not(self) -> Self { + self.complement() + } + } + + $(#[$outer])* + impl $crate::__private::core::iter::Extend<$PublicBitFlags> for $PublicBitFlags { + /// The bitwise or (`|`) of the bits in each flags value. + fn extend>( + &mut self, + iterator: T, + ) { + for item in iterator { + self.insert(item) + } + } + } + + $(#[$outer])* + impl $crate::__private::core::iter::FromIterator<$PublicBitFlags> for $PublicBitFlags { + /// The bitwise or (`|`) of the bits in each flags value. + fn from_iter>( + iterator: T, + ) -> Self { + use $crate::__private::core::iter::Extend; + + let mut result = Self::empty(); + result.extend(iterator); + result + } + } + }; +} + +/// Implement constants on the public (user-facing) bitflags type. +#[macro_export] +#[doc(hidden)] +macro_rules! __impl_public_bitflags_consts { + ( + $(#[$outer:meta])* + $PublicBitFlags:ident: $T:ty { + $( + $(#[$inner:ident $($args:tt)*])* + const $Flag:tt = $value:expr; + )* + } + ) => { + $(#[$outer])* + impl $PublicBitFlags { + $( + $crate::__bitflags_flag!({ + name: $Flag, + named: { + $(#[$inner $($args)*])* + #[allow( + deprecated, + non_upper_case_globals, + )] + pub const $Flag: Self = Self::from_bits_retain($value); + }, + unnamed: {}, + }); + )* + } + + $(#[$outer])* + impl $crate::Flags for $PublicBitFlags { + const FLAGS: &'static [$crate::Flag<$PublicBitFlags>] = &[ + $( + $crate::__bitflags_flag!({ + name: $Flag, + named: { + $crate::__bitflags_expr_safe_attrs!( + $(#[$inner $($args)*])* + { + #[allow( + deprecated, + non_upper_case_globals, + )] + $crate::Flag::new($crate::__private::core::stringify!($Flag), $PublicBitFlags::$Flag) + } + ) + }, + unnamed: { + $crate::__bitflags_expr_safe_attrs!( + $(#[$inner $($args)*])* + { + #[allow( + deprecated, + non_upper_case_globals, + )] + $crate::Flag::new("", $PublicBitFlags::from_bits_retain($value)) + } + ) + }, + }), + )* + ]; + + type Bits = $T; + + fn bits(&self) -> $T { + $PublicBitFlags::bits(self) + } + + fn from_bits_retain(bits: $T) -> $PublicBitFlags { + $PublicBitFlags::from_bits_retain(bits) + } + } + }; +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests.rs new file mode 100644 index 000000000000..ed52ad404a52 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests.rs @@ -0,0 +1,131 @@ +mod all; +mod bits; +mod complement; +mod contains; +mod difference; +mod empty; +mod eq; +mod extend; +mod flags; +mod fmt; +mod from_bits; +mod from_bits_retain; +mod from_bits_truncate; +mod from_name; +mod insert; +mod intersection; +mod intersects; +mod is_all; +mod is_empty; +mod iter; +mod parser; +mod remove; +mod symmetric_difference; +mod union; + +bitflags! { + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)] + pub struct TestFlags: u8 { + /// 1 + const A = 1; + + /// 1 << 1 + const B = 1 << 1; + + /// 1 << 2 + const C = 1 << 2; + + /// 1 | (1 << 1) | (1 << 2) + const ABC = Self::A.bits() | Self::B.bits() | Self::C.bits(); + } + + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)] + pub struct TestFlagsInvert: u8 { + /// 1 | (1 << 1) | (1 << 2) + const ABC = Self::A.bits() | Self::B.bits() | Self::C.bits(); + + /// 1 + const A = 1; + + /// 1 << 1 + const B = 1 << 1; + + /// 1 << 2 + const C = 1 << 2; + } + + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)] + pub struct TestZero: u8 { + /// 0 + const ZERO = 0; + } + + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)] + pub struct TestZeroOne: u8 { + /// 0 + const ZERO = 0; + + /// 1 + const ONE = 1; + } + + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)] + pub struct TestUnicode: u8 { + /// 1 + const 一 = 1; + + /// 2 + const 二 = 1 << 1; + } + + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)] + pub struct TestEmpty: u8 {} + + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)] + pub struct TestOverlapping: u8 { + /// 1 | (1 << 1) + const AB = 1 | (1 << 1); + + /// (1 << 1) | (1 << 2) + const BC = (1 << 1) | (1 << 2); + } + + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)] + pub struct TestOverlappingFull: u8 { + /// 1 + const A = 1; + + /// 1 + const B = 1; + + /// 1 + const C = 1; + + /// 2 + const D = 1 << 1; + } + + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)] + pub struct TestExternal: u8 { + /// 1 + const A = 1; + + /// 1 << 1 + const B = 1 << 1; + + /// 1 << 2 + const C = 1 << 2; + + /// 1 | (1 << 1) | (1 << 2) + const ABC = Self::A.bits() | Self::B.bits() | Self::C.bits(); + + /// External + const _ = !0; + } + + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)] + pub struct TestExternalFull: u8 { + /// External + const _ = !0; + } +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/all.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/all.rs new file mode 100644 index 000000000000..cceb93a4691b --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/all.rs @@ -0,0 +1,23 @@ +use super::*; + +use crate::Flags; + +#[test] +fn cases() { + case(1 | 1 << 1 | 1 << 2, TestFlags::all); + + case(0, TestZero::all); + + case(0, TestEmpty::all); + + case(!0, TestExternal::all); +} + +#[track_caller] +fn case(expected: T::Bits, inherent: impl FnOnce() -> T) +where + ::Bits: std::fmt::Debug + PartialEq, +{ + assert_eq!(expected, inherent().bits(), "T::all()"); + assert_eq!(expected, T::all().bits(), "Flags::all()"); +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/bits.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/bits.rs new file mode 100644 index 000000000000..678f153e36b1 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/bits.rs @@ -0,0 +1,36 @@ +use super::*; + +use crate::Flags; + +#[test] +fn cases() { + case(0, TestFlags::empty(), TestFlags::bits); + + case(1, TestFlags::A, TestFlags::bits); + case(1 | 1 << 1 | 1 << 2, TestFlags::ABC, TestFlags::bits); + + case(!0, TestFlags::from_bits_retain(u8::MAX), TestFlags::bits); + case(1 << 3, TestFlags::from_bits_retain(1 << 3), TestFlags::bits); + + case(1 << 3, TestZero::from_bits_retain(1 << 3), TestZero::bits); + + case(1 << 3, TestEmpty::from_bits_retain(1 << 3), TestEmpty::bits); + + case( + 1 << 4 | 1 << 6, + TestExternal::from_bits_retain(1 << 4 | 1 << 6), + TestExternal::bits, + ); +} + +#[track_caller] +fn case( + expected: T::Bits, + value: T, + inherent: impl FnOnce(&T) -> T::Bits, +) where + T::Bits: std::fmt::Debug + PartialEq, +{ + assert_eq!(expected, inherent(&value), "{:?}.bits()", value); + assert_eq!(expected, Flags::bits(&value), "Flags::bits({:?})", value); +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/complement.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/complement.rs new file mode 100644 index 000000000000..ac7a421af0be --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/complement.rs @@ -0,0 +1,53 @@ +use super::*; + +use crate::Flags; + +#[test] +fn cases() { + case(0, TestFlags::all(), TestFlags::complement); + case(0, TestFlags::from_bits_retain(!0), TestFlags::complement); + + case(1 | 1 << 1, TestFlags::C, TestFlags::complement); + case( + 1 | 1 << 1, + TestFlags::C | TestFlags::from_bits_retain(1 << 3), + TestFlags::complement, + ); + + case( + 1 | 1 << 1 | 1 << 2, + TestFlags::empty(), + TestFlags::complement, + ); + case( + 1 | 1 << 1 | 1 << 2, + TestFlags::from_bits_retain(1 << 3), + TestFlags::complement, + ); + + case(0, TestZero::empty(), TestZero::complement); + + case(0, TestEmpty::empty(), TestEmpty::complement); + + case(1 << 2, TestOverlapping::AB, TestOverlapping::complement); + + case(!0, TestExternal::empty(), TestExternal::complement); +} + +#[track_caller] +fn case + Copy>( + expected: T::Bits, + value: T, + inherent: impl FnOnce(T) -> T, +) where + T::Bits: std::fmt::Debug + PartialEq, +{ + assert_eq!(expected, inherent(value).bits(), "{:?}.complement()", value); + assert_eq!( + expected, + Flags::complement(value).bits(), + "Flags::complement({:?})", + value + ); + assert_eq!(expected, (!value).bits(), "!{:?}", value); +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/contains.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/contains.rs new file mode 100644 index 000000000000..12428ddcb09c --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/contains.rs @@ -0,0 +1,108 @@ +use super::*; + +use crate::Flags; + +#[test] +fn cases() { + case( + TestFlags::empty(), + &[ + (TestFlags::empty(), true), + (TestFlags::A, false), + (TestFlags::B, false), + (TestFlags::C, false), + (TestFlags::from_bits_retain(1 << 3), false), + ], + TestFlags::contains, + ); + + case( + TestFlags::A, + &[ + (TestFlags::empty(), true), + (TestFlags::A, true), + (TestFlags::B, false), + (TestFlags::C, false), + (TestFlags::ABC, false), + (TestFlags::from_bits_retain(1 << 3), false), + (TestFlags::from_bits_retain(1 | (1 << 3)), false), + ], + TestFlags::contains, + ); + + case( + TestFlags::ABC, + &[ + (TestFlags::empty(), true), + (TestFlags::A, true), + (TestFlags::B, true), + (TestFlags::C, true), + (TestFlags::ABC, true), + (TestFlags::from_bits_retain(1 << 3), false), + ], + TestFlags::contains, + ); + + case( + TestFlags::from_bits_retain(1 << 3), + &[ + (TestFlags::empty(), true), + (TestFlags::A, false), + (TestFlags::B, false), + (TestFlags::C, false), + (TestFlags::from_bits_retain(1 << 3), true), + ], + TestFlags::contains, + ); + + case( + TestZero::ZERO, + &[(TestZero::ZERO, true)], + TestZero::contains, + ); + + case( + TestOverlapping::AB, + &[ + (TestOverlapping::AB, true), + (TestOverlapping::BC, false), + (TestOverlapping::from_bits_retain(1 << 1), true), + ], + TestOverlapping::contains, + ); + + case( + TestExternal::all(), + &[ + (TestExternal::A, true), + (TestExternal::B, true), + (TestExternal::C, true), + (TestExternal::from_bits_retain(1 << 5 | 1 << 7), true), + ], + TestExternal::contains, + ); +} + +#[track_caller] +fn case( + value: T, + inputs: &[(T, bool)], + mut inherent: impl FnMut(&T, T) -> bool, +) { + for (input, expected) in inputs { + assert_eq!( + *expected, + inherent(&value, *input), + "{:?}.contains({:?})", + value, + input + ); + assert_eq!( + *expected, + Flags::contains(&value, *input), + "Flags::contains({:?}, {:?})", + value, + input + ); + } +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/difference.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/difference.rs new file mode 100644 index 000000000000..6ce9c0bf1981 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/difference.rs @@ -0,0 +1,92 @@ +use super::*; + +use crate::Flags; + +#[test] +fn cases() { + case( + TestFlags::A | TestFlags::B, + &[ + (TestFlags::A, 1 << 1), + (TestFlags::B, 1), + (TestFlags::from_bits_retain(1 << 3), 1 | 1 << 1), + ], + TestFlags::difference, + ); + + case( + TestFlags::from_bits_retain(1 | 1 << 3), + &[ + (TestFlags::A, 1 << 3), + (TestFlags::from_bits_retain(1 << 3), 1), + ], + TestFlags::difference, + ); + + case( + TestExternal::from_bits_retain(!0), + &[(TestExternal::A, 0b1111_1110)], + TestExternal::difference, + ); + + assert_eq!( + 0b1111_1110, + (TestExternal::from_bits_retain(!0) & !TestExternal::A).bits() + ); + + assert_eq!( + 0b1111_1110, + (TestFlags::from_bits_retain(!0).difference(TestFlags::A)).bits() + ); + + // The `!` operator unsets bits that don't correspond to known flags + assert_eq!( + 1 << 1 | 1 << 2, + (TestFlags::from_bits_retain(!0) & !TestFlags::A).bits() + ); +} + +#[track_caller] +fn case + std::ops::SubAssign + Copy>( + value: T, + inputs: &[(T, T::Bits)], + mut inherent: impl FnMut(T, T) -> T, +) where + T::Bits: std::fmt::Debug + PartialEq + Copy, +{ + for (input, expected) in inputs { + assert_eq!( + *expected, + inherent(value, *input).bits(), + "{:?}.difference({:?})", + value, + input + ); + assert_eq!( + *expected, + Flags::difference(value, *input).bits(), + "Flags::difference({:?}, {:?})", + value, + input + ); + assert_eq!( + *expected, + (value - *input).bits(), + "{:?} - {:?}", + value, + input + ); + assert_eq!( + *expected, + { + let mut value = value; + value -= *input; + value + } + .bits(), + "{:?} -= {:?}", + value, + input, + ); + } +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/empty.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/empty.rs new file mode 100644 index 000000000000..57fb1c7cf187 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/empty.rs @@ -0,0 +1,23 @@ +use super::*; + +use crate::Flags; + +#[test] +fn cases() { + case(0, TestFlags::empty); + + case(0, TestZero::empty); + + case(0, TestEmpty::empty); + + case(0, TestExternal::empty); +} + +#[track_caller] +fn case(expected: T::Bits, inherent: impl FnOnce() -> T) +where + ::Bits: std::fmt::Debug + PartialEq, +{ + assert_eq!(expected, inherent().bits(), "T::empty()"); + assert_eq!(expected, T::empty().bits(), "Flags::empty()"); +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/eq.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/eq.rs new file mode 100644 index 000000000000..9779af7629a9 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/eq.rs @@ -0,0 +1,10 @@ +use super::*; + +#[test] +fn cases() { + assert_eq!(TestFlags::empty(), TestFlags::empty()); + assert_eq!(TestFlags::all(), TestFlags::all()); + + assert!(TestFlags::from_bits_retain(1) < TestFlags::from_bits_retain(2)); + assert!(TestFlags::from_bits_retain(2) > TestFlags::from_bits_retain(1)); +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/extend.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/extend.rs new file mode 100644 index 000000000000..869dc17fc81b --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/extend.rs @@ -0,0 +1,42 @@ +use super::*; + +#[test] +fn cases() { + let mut flags = TestFlags::empty(); + + flags.extend(TestFlags::A); + + assert_eq!(TestFlags::A, flags); + + flags.extend(TestFlags::A | TestFlags::B | TestFlags::C); + + assert_eq!(TestFlags::ABC, flags); + + flags.extend(TestFlags::from_bits_retain(1 << 5)); + + assert_eq!(TestFlags::ABC | TestFlags::from_bits_retain(1 << 5), flags); +} + +mod external { + use super::*; + + #[test] + fn cases() { + let mut flags = TestExternal::empty(); + + flags.extend(TestExternal::A); + + assert_eq!(TestExternal::A, flags); + + flags.extend(TestExternal::A | TestExternal::B | TestExternal::C); + + assert_eq!(TestExternal::ABC, flags); + + flags.extend(TestExternal::from_bits_retain(1 << 5)); + + assert_eq!( + TestExternal::ABC | TestExternal::from_bits_retain(1 << 5), + flags + ); + } +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/flags.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/flags.rs new file mode 100644 index 000000000000..7a625b312c1e --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/flags.rs @@ -0,0 +1,46 @@ +use super::*; + +use crate::Flags; + +#[test] +fn cases() { + let flags = TestFlags::FLAGS + .iter() + .map(|flag| (flag.name(), flag.value().bits())) + .collect::>(); + + assert_eq!( + vec![ + ("A", 1u8), + ("B", 1 << 1), + ("C", 1 << 2), + ("ABC", 1 | 1 << 1 | 1 << 2), + ], + flags, + ); + + assert_eq!(0, TestEmpty::FLAGS.iter().count()); +} + +mod external { + use super::*; + + #[test] + fn cases() { + let flags = TestExternal::FLAGS + .iter() + .map(|flag| (flag.name(), flag.value().bits())) + .collect::>(); + + assert_eq!( + vec![ + ("A", 1u8), + ("B", 1 << 1), + ("C", 1 << 2), + ("ABC", 1 | 1 << 1 | 1 << 2), + ("", !0), + ], + flags, + ); + } +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/fmt.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/fmt.rs new file mode 100644 index 000000000000..ed4571877dc4 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/fmt.rs @@ -0,0 +1,97 @@ +use super::*; + +#[test] +fn cases() { + case(TestFlags::empty(), "TestFlags(0x0)", "0", "0", "0", "0"); + case(TestFlags::A, "TestFlags(A)", "1", "1", "1", "1"); + case( + TestFlags::all(), + "TestFlags(A | B | C)", + "7", + "7", + "7", + "111", + ); + case( + TestFlags::from_bits_retain(1 << 3), + "TestFlags(0x8)", + "8", + "8", + "10", + "1000", + ); + case( + TestFlags::A | TestFlags::from_bits_retain(1 << 3), + "TestFlags(A | 0x8)", + "9", + "9", + "11", + "1001", + ); + + case(TestZero::ZERO, "TestZero(0x0)", "0", "0", "0", "0"); + case( + TestZero::ZERO | TestZero::from_bits_retain(1), + "TestZero(0x1)", + "1", + "1", + "1", + "1", + ); + + case(TestZeroOne::ONE, "TestZeroOne(ONE)", "1", "1", "1", "1"); + + case( + TestOverlapping::from_bits_retain(1 << 1), + "TestOverlapping(0x2)", + "2", + "2", + "2", + "10", + ); + + case( + TestExternal::from_bits_retain(1 | 1 << 1 | 1 << 3), + "TestExternal(A | B | 0x8)", + "B", + "b", + "13", + "1011", + ); + + case( + TestExternal::all(), + "TestExternal(A | B | C | 0xf8)", + "FF", + "ff", + "377", + "11111111", + ); + + case( + TestExternalFull::all(), + "TestExternalFull(0xff)", + "FF", + "ff", + "377", + "11111111", + ); +} + +#[track_caller] +fn case< + T: std::fmt::Debug + std::fmt::UpperHex + std::fmt::LowerHex + std::fmt::Octal + std::fmt::Binary, +>( + value: T, + debug: &str, + uhex: &str, + lhex: &str, + oct: &str, + bin: &str, +) { + assert_eq!(debug, format!("{:?}", value)); + assert_eq!(uhex, format!("{:X}", value)); + assert_eq!(lhex, format!("{:x}", value)); + assert_eq!(oct, format!("{:o}", value)); + assert_eq!(bin, format!("{:b}", value)); +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/from_bits.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/from_bits.rs new file mode 100644 index 000000000000..dada9aff8232 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/from_bits.rs @@ -0,0 +1,45 @@ +use super::*; + +use crate::Flags; + +#[test] +fn cases() { + case(Some(0), 0, TestFlags::from_bits); + case(Some(1), 1, TestFlags::from_bits); + case( + Some(1 | 1 << 1 | 1 << 2), + 1 | 1 << 1 | 1 << 2, + TestFlags::from_bits, + ); + + case(None, 1 << 3, TestFlags::from_bits); + case(None, 1 | 1 << 3, TestFlags::from_bits); + + case(Some(1 | 1 << 1), 1 | 1 << 1, TestOverlapping::from_bits); + + case(Some(1 << 1), 1 << 1, TestOverlapping::from_bits); + + case(Some(1 << 5), 1 << 5, TestExternal::from_bits); +} + +#[track_caller] +fn case( + expected: Option, + input: T::Bits, + inherent: impl FnOnce(T::Bits) -> Option, +) where + ::Bits: std::fmt::Debug + PartialEq, +{ + assert_eq!( + expected, + inherent(input).map(|f| f.bits()), + "T::from_bits({:?})", + input + ); + assert_eq!( + expected, + T::from_bits(input).map(|f| f.bits()), + "Flags::from_bits({:?})", + input + ); +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/from_bits_retain.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/from_bits_retain.rs new file mode 100644 index 000000000000..1ae28a663fd6 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/from_bits_retain.rs @@ -0,0 +1,38 @@ +use super::*; + +use crate::Flags; + +#[test] +fn cases() { + case(0, TestFlags::from_bits_retain); + case(1, TestFlags::from_bits_retain); + case(1 | 1 << 1 | 1 << 2, TestFlags::from_bits_retain); + + case(1 << 3, TestFlags::from_bits_retain); + case(1 | 1 << 3, TestFlags::from_bits_retain); + + case(1 | 1 << 1, TestOverlapping::from_bits_retain); + + case(1 << 1, TestOverlapping::from_bits_retain); + + case(1 << 5, TestExternal::from_bits_retain); +} + +#[track_caller] +fn case(input: T::Bits, inherent: impl FnOnce(T::Bits) -> T) +where + ::Bits: std::fmt::Debug + PartialEq, +{ + assert_eq!( + input, + inherent(input).bits(), + "T::from_bits_retain({:?})", + input + ); + assert_eq!( + input, + T::from_bits_retain(input).bits(), + "Flags::from_bits_retain({:?})", + input + ); +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/from_bits_truncate.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/from_bits_truncate.rs new file mode 100644 index 000000000000..e4f3e537c4a3 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/from_bits_truncate.rs @@ -0,0 +1,42 @@ +use super::*; + +use crate::Flags; + +#[test] +fn cases() { + case(0, 0, TestFlags::from_bits_truncate); + case(1, 1, TestFlags::from_bits_truncate); + case( + 1 | 1 << 1 | 1 << 2, + 1 | 1 << 1 | 1 << 2, + TestFlags::from_bits_truncate, + ); + + case(0, 1 << 3, TestFlags::from_bits_truncate); + case(1, 1 | 1 << 3, TestFlags::from_bits_truncate); + + case(1 | 1 << 1, 1 | 1 << 1, TestOverlapping::from_bits_truncate); + + case(1 << 1, 1 << 1, TestOverlapping::from_bits_truncate); + + case(1 << 5, 1 << 5, TestExternal::from_bits_truncate); +} + +#[track_caller] +fn case(expected: T::Bits, input: T::Bits, inherent: impl FnOnce(T::Bits) -> T) +where + ::Bits: std::fmt::Debug + PartialEq, +{ + assert_eq!( + expected, + inherent(input).bits(), + "T::from_bits_truncate({:?})", + input + ); + assert_eq!( + expected, + T::from_bits_truncate(input).bits(), + "Flags::from_bits_truncate({:?})", + input + ); +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/from_name.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/from_name.rs new file mode 100644 index 000000000000..1d9a4e48b650 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/from_name.rs @@ -0,0 +1,42 @@ +use super::*; + +use crate::Flags; + +#[test] +fn cases() { + case(Some(1), "A", TestFlags::from_name); + case(Some(1 << 1), "B", TestFlags::from_name); + case(Some(1 | 1 << 1 | 1 << 2), "ABC", TestFlags::from_name); + + case(None, "", TestFlags::from_name); + case(None, "a", TestFlags::from_name); + case(None, "0x1", TestFlags::from_name); + case(None, "A | B", TestFlags::from_name); + + case(Some(0), "ZERO", TestZero::from_name); + + case(Some(2), "二", TestUnicode::from_name); + + case(None, "_", TestExternal::from_name); + + case(None, "", TestExternal::from_name); +} + +#[track_caller] +fn case(expected: Option, input: &str, inherent: impl FnOnce(&str) -> Option) +where + ::Bits: std::fmt::Debug + PartialEq, +{ + assert_eq!( + expected, + inherent(input).map(|f| f.bits()), + "T::from_name({:?})", + input + ); + assert_eq!( + expected, + T::from_name(input).map(|f| f.bits()), + "Flags::from_name({:?})", + input + ); +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/insert.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/insert.rs new file mode 100644 index 000000000000..b18cd1723528 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/insert.rs @@ -0,0 +1,91 @@ +use super::*; + +use crate::Flags; + +#[test] +fn cases() { + case( + TestFlags::empty(), + &[ + (TestFlags::A, 1), + (TestFlags::A | TestFlags::B, 1 | 1 << 1), + (TestFlags::empty(), 0), + (TestFlags::from_bits_retain(1 << 3), 1 << 3), + ], + TestFlags::insert, + TestFlags::set, + ); + + case( + TestFlags::A, + &[ + (TestFlags::A, 1), + (TestFlags::empty(), 1), + (TestFlags::B, 1 | 1 << 1), + ], + TestFlags::insert, + TestFlags::set, + ); +} + +#[track_caller] +fn case( + value: T, + inputs: &[(T, T::Bits)], + mut inherent_insert: impl FnMut(&mut T, T), + mut inherent_set: impl FnMut(&mut T, T, bool), +) where + T::Bits: std::fmt::Debug + PartialEq + Copy, +{ + for (input, expected) in inputs { + assert_eq!( + *expected, + { + let mut value = value; + inherent_insert(&mut value, *input); + value + } + .bits(), + "{:?}.insert({:?})", + value, + input + ); + assert_eq!( + *expected, + { + let mut value = value; + Flags::insert(&mut value, *input); + value + } + .bits(), + "Flags::insert({:?}, {:?})", + value, + input + ); + + assert_eq!( + *expected, + { + let mut value = value; + inherent_set(&mut value, *input, true); + value + } + .bits(), + "{:?}.set({:?}, true)", + value, + input + ); + assert_eq!( + *expected, + { + let mut value = value; + Flags::set(&mut value, *input, true); + value + } + .bits(), + "Flags::set({:?}, {:?}, true)", + value, + input + ); + } +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/intersection.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/intersection.rs new file mode 100644 index 000000000000..10a8ae9fb6b6 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/intersection.rs @@ -0,0 +1,79 @@ +use super::*; + +use crate::Flags; + +#[test] +fn cases() { + case( + TestFlags::empty(), + &[(TestFlags::empty(), 0), (TestFlags::all(), 0)], + TestFlags::intersection, + ); + + case( + TestFlags::all(), + &[ + (TestFlags::all(), 1 | 1 << 1 | 1 << 2), + (TestFlags::A, 1), + (TestFlags::from_bits_retain(1 << 3), 0), + ], + TestFlags::intersection, + ); + + case( + TestFlags::from_bits_retain(1 << 3), + &[(TestFlags::from_bits_retain(1 << 3), 1 << 3)], + TestFlags::intersection, + ); + + case( + TestOverlapping::AB, + &[(TestOverlapping::BC, 1 << 1)], + TestOverlapping::intersection, + ); +} + +#[track_caller] +fn case + std::ops::BitAndAssign + Copy>( + value: T, + inputs: &[(T, T::Bits)], + mut inherent: impl FnMut(T, T) -> T, +) where + T::Bits: std::fmt::Debug + PartialEq + Copy, +{ + for (input, expected) in inputs { + assert_eq!( + *expected, + inherent(value, *input).bits(), + "{:?}.intersection({:?})", + value, + input + ); + assert_eq!( + *expected, + Flags::intersection(value, *input).bits(), + "Flags::intersection({:?}, {:?})", + value, + input + ); + assert_eq!( + *expected, + (value & *input).bits(), + "{:?} & {:?}", + value, + input + ); + assert_eq!( + *expected, + { + let mut value = value; + value &= *input; + value + } + .bits(), + "{:?} &= {:?}", + value, + input, + ); + } +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/intersects.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/intersects.rs new file mode 100644 index 000000000000..fe907981a2ad --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/intersects.rs @@ -0,0 +1,91 @@ +use super::*; + +use crate::Flags; + +#[test] +fn cases() { + case( + TestFlags::empty(), + &[ + (TestFlags::empty(), false), + (TestFlags::A, false), + (TestFlags::B, false), + (TestFlags::C, false), + (TestFlags::from_bits_retain(1 << 3), false), + ], + TestFlags::intersects, + ); + + case( + TestFlags::A, + &[ + (TestFlags::empty(), false), + (TestFlags::A, true), + (TestFlags::B, false), + (TestFlags::C, false), + (TestFlags::ABC, true), + (TestFlags::from_bits_retain(1 << 3), false), + (TestFlags::from_bits_retain(1 | (1 << 3)), true), + ], + TestFlags::intersects, + ); + + case( + TestFlags::ABC, + &[ + (TestFlags::empty(), false), + (TestFlags::A, true), + (TestFlags::B, true), + (TestFlags::C, true), + (TestFlags::ABC, true), + (TestFlags::from_bits_retain(1 << 3), false), + ], + TestFlags::intersects, + ); + + case( + TestFlags::from_bits_retain(1 << 3), + &[ + (TestFlags::empty(), false), + (TestFlags::A, false), + (TestFlags::B, false), + (TestFlags::C, false), + (TestFlags::from_bits_retain(1 << 3), true), + ], + TestFlags::intersects, + ); + + case( + TestOverlapping::AB, + &[ + (TestOverlapping::AB, true), + (TestOverlapping::BC, true), + (TestOverlapping::from_bits_retain(1 << 1), true), + ], + TestOverlapping::intersects, + ); +} + +#[track_caller] +fn case( + value: T, + inputs: &[(T, bool)], + mut inherent: impl FnMut(&T, T) -> bool, +) { + for (input, expected) in inputs { + assert_eq!( + *expected, + inherent(&value, *input), + "{:?}.intersects({:?})", + value, + input + ); + assert_eq!( + *expected, + Flags::intersects(&value, *input), + "Flags::intersects({:?}, {:?})", + value, + input + ); + } +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/is_all.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/is_all.rs new file mode 100644 index 000000000000..382a458f610b --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/is_all.rs @@ -0,0 +1,32 @@ +use super::*; + +use crate::Flags; + +#[test] +fn cases() { + case(false, TestFlags::empty(), TestFlags::is_all); + case(false, TestFlags::A, TestFlags::is_all); + + case(true, TestFlags::ABC, TestFlags::is_all); + + case( + true, + TestFlags::ABC | TestFlags::from_bits_retain(1 << 3), + TestFlags::is_all, + ); + + case(true, TestZero::empty(), TestZero::is_all); + + case(true, TestEmpty::empty(), TestEmpty::is_all); +} + +#[track_caller] +fn case(expected: bool, value: T, inherent: impl FnOnce(&T) -> bool) { + assert_eq!(expected, inherent(&value), "{:?}.is_all()", value); + assert_eq!( + expected, + Flags::is_all(&value), + "Flags::is_all({:?})", + value + ); +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/is_empty.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/is_empty.rs new file mode 100644 index 000000000000..92165f18e36b --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/is_empty.rs @@ -0,0 +1,31 @@ +use super::*; + +use crate::Flags; + +#[test] +fn cases() { + case(true, TestFlags::empty(), TestFlags::is_empty); + + case(false, TestFlags::A, TestFlags::is_empty); + case(false, TestFlags::ABC, TestFlags::is_empty); + case( + false, + TestFlags::from_bits_retain(1 << 3), + TestFlags::is_empty, + ); + + case(true, TestZero::empty(), TestZero::is_empty); + + case(true, TestEmpty::empty(), TestEmpty::is_empty); +} + +#[track_caller] +fn case(expected: bool, value: T, inherent: impl FnOnce(&T) -> bool) { + assert_eq!(expected, inherent(&value), "{:?}.is_empty()", value); + assert_eq!( + expected, + Flags::is_empty(&value), + "Flags::is_empty({:?})", + value + ); +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/iter.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/iter.rs new file mode 100644 index 000000000000..54b1d27d4ca2 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/iter.rs @@ -0,0 +1,209 @@ +use super::*; + +use crate::Flags; + +#[test] +#[cfg(not(miri))] // Very slow in miri +fn roundtrip() { + for a in 0u8..=255 { + for b in 0u8..=255 { + let f = TestFlags::from_bits_retain(a | b); + + assert_eq!(f, f.iter().collect::()); + assert_eq!( + TestFlags::from_bits_truncate(f.bits()), + f.iter_names().map(|(_, f)| f).collect::() + ); + + let f = TestExternal::from_bits_retain(a | b); + + assert_eq!(f, f.iter().collect::()); + } + } +} + +mod collect { + use super::*; + + #[test] + fn cases() { + assert_eq!(0, [].into_iter().collect::().bits()); + + assert_eq!(1, [TestFlags::A,].into_iter().collect::().bits()); + + assert_eq!( + 1 | 1 << 1 | 1 << 2, + [TestFlags::A, TestFlags::B | TestFlags::C,] + .into_iter() + .collect::() + .bits() + ); + + assert_eq!( + 1 | 1 << 3, + [ + TestFlags::from_bits_retain(1 << 3), + TestFlags::empty(), + TestFlags::A, + ] + .into_iter() + .collect::() + .bits() + ); + + assert_eq!( + 1 << 5 | 1 << 7, + [ + TestExternal::empty(), + TestExternal::from_bits_retain(1 << 5), + TestExternal::from_bits_retain(1 << 7), + ] + .into_iter() + .collect::() + .bits() + ); + } +} + +mod iter { + use super::*; + + #[test] + fn cases() { + case(&[], TestFlags::empty(), TestFlags::iter); + + case(&[1], TestFlags::A, TestFlags::iter); + case(&[1, 1 << 1], TestFlags::A | TestFlags::B, TestFlags::iter); + case( + &[1, 1 << 1, 1 << 3], + TestFlags::A | TestFlags::B | TestFlags::from_bits_retain(1 << 3), + TestFlags::iter, + ); + + case(&[1, 1 << 1, 1 << 2], TestFlags::ABC, TestFlags::iter); + case( + &[1, 1 << 1, 1 << 2, 1 << 3], + TestFlags::ABC | TestFlags::from_bits_retain(1 << 3), + TestFlags::iter, + ); + + case( + &[1 | 1 << 1 | 1 << 2], + TestFlagsInvert::ABC, + TestFlagsInvert::iter, + ); + + case(&[], TestZero::ZERO, TestZero::iter); + + case( + &[1, 1 << 1, 1 << 2, 0b1111_1000], + TestExternal::all(), + TestExternal::iter, + ); + } + + #[track_caller] + fn case + Copy>( + expected: &[T::Bits], + value: T, + inherent: impl FnOnce(&T) -> crate::iter::Iter, + ) where + T::Bits: std::fmt::Debug + PartialEq, + { + assert_eq!( + expected, + inherent(&value).map(|f| f.bits()).collect::>(), + "{:?}.iter()", + value + ); + assert_eq!( + expected, + Flags::iter(&value).map(|f| f.bits()).collect::>(), + "Flags::iter({:?})", + value + ); + assert_eq!( + expected, + value.into_iter().map(|f| f.bits()).collect::>(), + "{:?}.into_iter()", + value + ); + } +} + +mod iter_names { + use super::*; + + #[test] + fn cases() { + case(&[], TestFlags::empty(), TestFlags::iter_names); + + case(&[("A", 1)], TestFlags::A, TestFlags::iter_names); + case( + &[("A", 1), ("B", 1 << 1)], + TestFlags::A | TestFlags::B, + TestFlags::iter_names, + ); + case( + &[("A", 1), ("B", 1 << 1)], + TestFlags::A | TestFlags::B | TestFlags::from_bits_retain(1 << 3), + TestFlags::iter_names, + ); + + case( + &[("A", 1), ("B", 1 << 1), ("C", 1 << 2)], + TestFlags::ABC, + TestFlags::iter_names, + ); + case( + &[("A", 1), ("B", 1 << 1), ("C", 1 << 2)], + TestFlags::ABC | TestFlags::from_bits_retain(1 << 3), + TestFlags::iter_names, + ); + + case( + &[("ABC", 1 | 1 << 1 | 1 << 2)], + TestFlagsInvert::ABC, + TestFlagsInvert::iter_names, + ); + + case(&[], TestZero::ZERO, TestZero::iter_names); + + case( + &[("A", 1)], + TestOverlappingFull::A, + TestOverlappingFull::iter_names, + ); + case( + &[("A", 1), ("D", 1 << 1)], + TestOverlappingFull::A | TestOverlappingFull::D, + TestOverlappingFull::iter_names, + ); + } + + #[track_caller] + fn case( + expected: &[(&'static str, T::Bits)], + value: T, + inherent: impl FnOnce(&T) -> crate::iter::IterNames, + ) where + T::Bits: std::fmt::Debug + PartialEq, + { + assert_eq!( + expected, + inherent(&value) + .map(|(n, f)| (n, f.bits())) + .collect::>(), + "{:?}.iter_names()", + value + ); + assert_eq!( + expected, + Flags::iter_names(&value) + .map(|(n, f)| (n, f.bits())) + .collect::>(), + "Flags::iter_names({:?})", + value + ); + } +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/parser.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/parser.rs new file mode 100644 index 000000000000..fb27225ecef6 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/parser.rs @@ -0,0 +1,332 @@ +use super::*; + +use crate::{parser::*, Flags}; + +#[test] +#[cfg(not(miri))] // Very slow in miri +fn roundtrip() { + let mut s = String::new(); + + for a in 0u8..=255 { + for b in 0u8..=255 { + let f = TestFlags::from_bits_retain(a | b); + + s.clear(); + to_writer(&f, &mut s).unwrap(); + + assert_eq!(f, from_str::(&s).unwrap()); + } + } +} + +#[test] +#[cfg(not(miri))] // Very slow in miri +fn roundtrip_truncate() { + let mut s = String::new(); + + for a in 0u8..=255 { + for b in 0u8..=255 { + let f = TestFlags::from_bits_retain(a | b); + + s.clear(); + to_writer_truncate(&f, &mut s).unwrap(); + + assert_eq!( + TestFlags::from_bits_truncate(f.bits()), + from_str_truncate::(&s).unwrap() + ); + } + } +} + +#[test] +#[cfg(not(miri))] // Very slow in miri +fn roundtrip_strict() { + let mut s = String::new(); + + for a in 0u8..=255 { + for b in 0u8..=255 { + let f = TestFlags::from_bits_retain(a | b); + + s.clear(); + to_writer_strict(&f, &mut s).unwrap(); + + let mut strict = TestFlags::empty(); + for (_, flag) in f.iter_names() { + strict |= flag; + } + let f = strict; + + if let Ok(s) = from_str_strict::(&s) { + assert_eq!(f, s); + } + } + } +} + +mod from_str { + use super::*; + + #[test] + fn valid() { + assert_eq!(0, from_str::("").unwrap().bits()); + + assert_eq!(1, from_str::("A").unwrap().bits()); + assert_eq!(1, from_str::(" A ").unwrap().bits()); + assert_eq!( + 1 | 1 << 1 | 1 << 2, + from_str::("A | B | C").unwrap().bits() + ); + assert_eq!( + 1 | 1 << 1 | 1 << 2, + from_str::("A\n|\tB\r\n| C ").unwrap().bits() + ); + assert_eq!( + 1 | 1 << 1 | 1 << 2, + from_str::("A|B|C").unwrap().bits() + ); + + assert_eq!(1 << 3, from_str::("0x8").unwrap().bits()); + assert_eq!(1 | 1 << 3, from_str::("A | 0x8").unwrap().bits()); + assert_eq!( + 1 | 1 << 1 | 1 << 3, + from_str::("0x1 | 0x8 | B").unwrap().bits() + ); + + assert_eq!( + 1 | 1 << 1, + from_str::("一 | 二").unwrap().bits() + ); + } + + #[test] + fn invalid() { + assert!(from_str::("a") + .unwrap_err() + .to_string() + .starts_with("unrecognized named flag")); + assert!(from_str::("A & B") + .unwrap_err() + .to_string() + .starts_with("unrecognized named flag")); + + assert!(from_str::("0xg") + .unwrap_err() + .to_string() + .starts_with("invalid hex flag")); + assert!(from_str::("0xffffffffffff") + .unwrap_err() + .to_string() + .starts_with("invalid hex flag")); + } +} + +mod to_writer { + use super::*; + + #[test] + fn cases() { + assert_eq!("", write(TestFlags::empty())); + assert_eq!("A", write(TestFlags::A)); + assert_eq!("A | B | C", write(TestFlags::all())); + assert_eq!("0x8", write(TestFlags::from_bits_retain(1 << 3))); + assert_eq!( + "A | 0x8", + write(TestFlags::A | TestFlags::from_bits_retain(1 << 3)) + ); + + assert_eq!("", write(TestZero::ZERO)); + + assert_eq!("ABC", write(TestFlagsInvert::all())); + + assert_eq!("0x1", write(TestOverlapping::from_bits_retain(1))); + + assert_eq!("A", write(TestOverlappingFull::C)); + assert_eq!( + "A | D", + write(TestOverlappingFull::C | TestOverlappingFull::D) + ); + } + + fn write(value: F) -> String + where + F::Bits: crate::parser::WriteHex, + { + let mut s = String::new(); + + to_writer(&value, &mut s).unwrap(); + s + } +} + +mod from_str_truncate { + use super::*; + + #[test] + fn valid() { + assert_eq!(0, from_str_truncate::("").unwrap().bits()); + + assert_eq!(1, from_str_truncate::("A").unwrap().bits()); + assert_eq!(1, from_str_truncate::(" A ").unwrap().bits()); + assert_eq!( + 1 | 1 << 1 | 1 << 2, + from_str_truncate::("A | B | C").unwrap().bits() + ); + assert_eq!( + 1 | 1 << 1 | 1 << 2, + from_str_truncate::("A\n|\tB\r\n| C ") + .unwrap() + .bits() + ); + assert_eq!( + 1 | 1 << 1 | 1 << 2, + from_str_truncate::("A|B|C").unwrap().bits() + ); + + assert_eq!(0, from_str_truncate::("0x8").unwrap().bits()); + assert_eq!(1, from_str_truncate::("A | 0x8").unwrap().bits()); + assert_eq!( + 1 | 1 << 1, + from_str_truncate::("0x1 | 0x8 | B") + .unwrap() + .bits() + ); + + assert_eq!( + 1 | 1 << 1, + from_str_truncate::("一 | 二").unwrap().bits() + ); + } +} + +mod to_writer_truncate { + use super::*; + + #[test] + fn cases() { + assert_eq!("", write(TestFlags::empty())); + assert_eq!("A", write(TestFlags::A)); + assert_eq!("A | B | C", write(TestFlags::all())); + assert_eq!("", write(TestFlags::from_bits_retain(1 << 3))); + assert_eq!( + "A", + write(TestFlags::A | TestFlags::from_bits_retain(1 << 3)) + ); + + assert_eq!("", write(TestZero::ZERO)); + + assert_eq!("ABC", write(TestFlagsInvert::all())); + + assert_eq!("0x1", write(TestOverlapping::from_bits_retain(1))); + + assert_eq!("A", write(TestOverlappingFull::C)); + assert_eq!( + "A | D", + write(TestOverlappingFull::C | TestOverlappingFull::D) + ); + } + + fn write(value: F) -> String + where + F::Bits: crate::parser::WriteHex, + { + let mut s = String::new(); + + to_writer_truncate(&value, &mut s).unwrap(); + s + } +} + +mod from_str_strict { + use super::*; + + #[test] + fn valid() { + assert_eq!(0, from_str_strict::("").unwrap().bits()); + + assert_eq!(1, from_str_strict::("A").unwrap().bits()); + assert_eq!(1, from_str_strict::(" A ").unwrap().bits()); + assert_eq!( + 1 | 1 << 1 | 1 << 2, + from_str_strict::("A | B | C").unwrap().bits() + ); + assert_eq!( + 1 | 1 << 1 | 1 << 2, + from_str_strict::("A\n|\tB\r\n| C ") + .unwrap() + .bits() + ); + assert_eq!( + 1 | 1 << 1 | 1 << 2, + from_str_strict::("A|B|C").unwrap().bits() + ); + + assert_eq!( + 1 | 1 << 1, + from_str_strict::("一 | 二").unwrap().bits() + ); + } + + #[test] + fn invalid() { + assert!(from_str_strict::("a") + .unwrap_err() + .to_string() + .starts_with("unrecognized named flag")); + assert!(from_str_strict::("A & B") + .unwrap_err() + .to_string() + .starts_with("unrecognized named flag")); + + assert!(from_str_strict::("0x1") + .unwrap_err() + .to_string() + .starts_with("invalid hex flag")); + assert!(from_str_strict::("0xg") + .unwrap_err() + .to_string() + .starts_with("invalid hex flag")); + assert!(from_str_strict::("0xffffffffffff") + .unwrap_err() + .to_string() + .starts_with("invalid hex flag")); + } +} + +mod to_writer_strict { + use super::*; + + #[test] + fn cases() { + assert_eq!("", write(TestFlags::empty())); + assert_eq!("A", write(TestFlags::A)); + assert_eq!("A | B | C", write(TestFlags::all())); + assert_eq!("", write(TestFlags::from_bits_retain(1 << 3))); + assert_eq!( + "A", + write(TestFlags::A | TestFlags::from_bits_retain(1 << 3)) + ); + + assert_eq!("", write(TestZero::ZERO)); + + assert_eq!("ABC", write(TestFlagsInvert::all())); + + assert_eq!("", write(TestOverlapping::from_bits_retain(1))); + + assert_eq!("A", write(TestOverlappingFull::C)); + assert_eq!( + "A | D", + write(TestOverlappingFull::C | TestOverlappingFull::D) + ); + } + + fn write(value: F) -> String + where + F::Bits: crate::parser::WriteHex, + { + let mut s = String::new(); + + to_writer_strict(&value, &mut s).unwrap(); + s + } +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/remove.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/remove.rs new file mode 100644 index 000000000000..574b1edbf228 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/remove.rs @@ -0,0 +1,100 @@ +use super::*; + +use crate::Flags; + +#[test] +fn cases() { + case( + TestFlags::empty(), + &[ + (TestFlags::A, 0), + (TestFlags::empty(), 0), + (TestFlags::from_bits_retain(1 << 3), 0), + ], + TestFlags::remove, + TestFlags::set, + ); + + case( + TestFlags::A, + &[ + (TestFlags::A, 0), + (TestFlags::empty(), 1), + (TestFlags::B, 1), + ], + TestFlags::remove, + TestFlags::set, + ); + + case( + TestFlags::ABC, + &[ + (TestFlags::A, 1 << 1 | 1 << 2), + (TestFlags::A | TestFlags::C, 1 << 1), + ], + TestFlags::remove, + TestFlags::set, + ); +} + +#[track_caller] +fn case( + value: T, + inputs: &[(T, T::Bits)], + mut inherent_remove: impl FnMut(&mut T, T), + mut inherent_set: impl FnMut(&mut T, T, bool), +) where + T::Bits: std::fmt::Debug + PartialEq + Copy, +{ + for (input, expected) in inputs { + assert_eq!( + *expected, + { + let mut value = value; + inherent_remove(&mut value, *input); + value + } + .bits(), + "{:?}.remove({:?})", + value, + input + ); + assert_eq!( + *expected, + { + let mut value = value; + Flags::remove(&mut value, *input); + value + } + .bits(), + "Flags::remove({:?}, {:?})", + value, + input + ); + + assert_eq!( + *expected, + { + let mut value = value; + inherent_set(&mut value, *input, false); + value + } + .bits(), + "{:?}.set({:?}, false)", + value, + input + ); + assert_eq!( + *expected, + { + let mut value = value; + Flags::set(&mut value, *input, false); + value + } + .bits(), + "Flags::set({:?}, {:?}, false)", + value, + input + ); + } +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/symmetric_difference.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/symmetric_difference.rs new file mode 100644 index 000000000000..75e9123ac5da --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/symmetric_difference.rs @@ -0,0 +1,110 @@ +use super::*; + +use crate::Flags; + +#[test] +fn cases() { + case( + TestFlags::empty(), + &[ + (TestFlags::empty(), 0), + (TestFlags::all(), 1 | 1 << 1 | 1 << 2), + (TestFlags::from_bits_retain(1 << 3), 1 << 3), + ], + TestFlags::symmetric_difference, + TestFlags::toggle, + ); + + case( + TestFlags::A, + &[ + (TestFlags::empty(), 1), + (TestFlags::A, 0), + (TestFlags::all(), 1 << 1 | 1 << 2), + ], + TestFlags::symmetric_difference, + TestFlags::toggle, + ); + + case( + TestFlags::A | TestFlags::B | TestFlags::from_bits_retain(1 << 3), + &[ + (TestFlags::ABC, 1 << 2 | 1 << 3), + (TestFlags::from_bits_retain(1 << 3), 1 | 1 << 1), + ], + TestFlags::symmetric_difference, + TestFlags::toggle, + ); +} + +#[track_caller] +fn case + std::ops::BitXorAssign + Copy>( + value: T, + inputs: &[(T, T::Bits)], + mut inherent_sym_diff: impl FnMut(T, T) -> T, + mut inherent_toggle: impl FnMut(&mut T, T), +) where + T::Bits: std::fmt::Debug + PartialEq + Copy, +{ + for (input, expected) in inputs { + assert_eq!( + *expected, + inherent_sym_diff(value, *input).bits(), + "{:?}.symmetric_difference({:?})", + value, + input + ); + assert_eq!( + *expected, + Flags::symmetric_difference(value, *input).bits(), + "Flags::symmetric_difference({:?}, {:?})", + value, + input + ); + assert_eq!( + *expected, + (value ^ *input).bits(), + "{:?} ^ {:?}", + value, + input + ); + assert_eq!( + *expected, + { + let mut value = value; + value ^= *input; + value + } + .bits(), + "{:?} ^= {:?}", + value, + input, + ); + + assert_eq!( + *expected, + { + let mut value = value; + inherent_toggle(&mut value, *input); + value + } + .bits(), + "{:?}.toggle({:?})", + value, + input, + ); + + assert_eq!( + *expected, + { + let mut value = value; + Flags::toggle(&mut value, *input); + value + } + .bits(), + "{:?}.toggle({:?})", + value, + input, + ); + } +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/union.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/union.rs new file mode 100644 index 000000000000..6190681931ca --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/tests/union.rs @@ -0,0 +1,71 @@ +use super::*; + +use crate::Flags; + +#[test] +fn cases() { + case( + TestFlags::empty(), + &[ + (TestFlags::A, 1), + (TestFlags::all(), 1 | 1 << 1 | 1 << 2), + (TestFlags::empty(), 0), + (TestFlags::from_bits_retain(1 << 3), 1 << 3), + ], + TestFlags::union, + ); + + case( + TestFlags::A | TestFlags::C, + &[ + (TestFlags::A | TestFlags::B, 1 | 1 << 1 | 1 << 2), + (TestFlags::A, 1 | 1 << 2), + ], + TestFlags::union, + ); +} + +#[track_caller] +fn case + std::ops::BitOrAssign + Copy>( + value: T, + inputs: &[(T, T::Bits)], + mut inherent: impl FnMut(T, T) -> T, +) where + T::Bits: std::fmt::Debug + PartialEq + Copy, +{ + for (input, expected) in inputs { + assert_eq!( + *expected, + inherent(value, *input).bits(), + "{:?}.union({:?})", + value, + input + ); + assert_eq!( + *expected, + Flags::union(value, *input).bits(), + "Flags::union({:?}, {:?})", + value, + input + ); + assert_eq!( + *expected, + (value | *input).bits(), + "{:?} | {:?}", + value, + input + ); + assert_eq!( + *expected, + { + let mut value = value; + value |= *input; + value + } + .bits(), + "{:?} |= {:?}", + value, + input, + ); + } +} diff --git a/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/traits.rs b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/traits.rs new file mode 100644 index 000000000000..3905d7d5b002 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/bitflags-2.6.0/src/traits.rs @@ -0,0 +1,431 @@ +use core::{ + fmt, + ops::{BitAnd, BitOr, BitXor, Not}, +}; + +use crate::{ + iter, + parser::{ParseError, ParseHex, WriteHex}, +}; + +/** +A defined flags value that may be named or unnamed. +*/ +#[derive(Debug)] +pub struct Flag { + name: &'static str, + value: B, +} + +impl Flag { + /** + Define a flag. + + If `name` is non-empty then the flag is named, otherwise it's unnamed. + */ + pub const fn new(name: &'static str, value: B) -> Self { + Flag { name, value } + } + + /** + Get the name of this flag. + + If the flag is unnamed then the returned string will be empty. + */ + pub const fn name(&self) -> &'static str { + self.name + } + + /** + Get the flags value of this flag. + */ + pub const fn value(&self) -> &B { + &self.value + } + + /** + Whether the flag is named. + + If [`Flag::name`] returns a non-empty string then this method will return `true`. + */ + pub const fn is_named(&self) -> bool { + !self.name.is_empty() + } + + /** + Whether the flag is unnamed. + + If [`Flag::name`] returns a non-empty string then this method will return `false`. + */ + pub const fn is_unnamed(&self) -> bool { + self.name.is_empty() + } +} + +/** +A set of defined flags using a bits type as storage. + +## Implementing `Flags` + +This trait is implemented by the [`bitflags`](macro.bitflags.html) macro: + +``` +use bitflags::bitflags; + +bitflags! { + struct MyFlags: u8 { + const A = 1; + const B = 1 << 1; + } +} +``` + +It can also be implemented manually: + +``` +use bitflags::{Flag, Flags}; + +struct MyFlags(u8); + +impl Flags for MyFlags { + const FLAGS: &'static [Flag] = &[ + Flag::new("A", MyFlags(1)), + Flag::new("B", MyFlags(1 << 1)), + ]; + + type Bits = u8; + + fn from_bits_retain(bits: Self::Bits) -> Self { + MyFlags(bits) + } + + fn bits(&self) -> Self::Bits { + self.0 + } +} +``` + +## Using `Flags` + +The `Flags` trait can be used generically to work with any flags types. In this example, +we can count the number of defined named flags: + +``` +# use bitflags::{bitflags, Flags}; +fn defined_flags() -> usize { + F::FLAGS.iter().filter(|f| f.is_named()).count() +} + +bitflags! { + struct MyFlags: u8 { + const A = 1; + const B = 1 << 1; + const C = 1 << 2; + + const _ = !0; + } +} + +assert_eq!(3, defined_flags::()); +``` +*/ +pub trait Flags: Sized + 'static { + /// The set of defined flags. + const FLAGS: &'static [Flag]; + + /// The underlying bits type. + type Bits: Bits; + + /// Get a flags value with all bits unset. + fn empty() -> Self { + Self::from_bits_retain(Self::Bits::EMPTY) + } + + /// Get a flags value with all known bits set. + fn all() -> Self { + let mut truncated = Self::Bits::EMPTY; + + for flag in Self::FLAGS.iter() { + truncated = truncated | flag.value().bits(); + } + + Self::from_bits_retain(truncated) + } + + /// Get the underlying bits value. + /// + /// The returned value is exactly the bits set in this flags value. + fn bits(&self) -> Self::Bits; + + /// Convert from a bits value. + /// + /// This method will return `None` if any unknown bits are set. + fn from_bits(bits: Self::Bits) -> Option { + let truncated = Self::from_bits_truncate(bits); + + if truncated.bits() == bits { + Some(truncated) + } else { + None + } + } + + /// Convert from a bits value, unsetting any unknown bits. + fn from_bits_truncate(bits: Self::Bits) -> Self { + Self::from_bits_retain(bits & Self::all().bits()) + } + + /// Convert from a bits value exactly. + fn from_bits_retain(bits: Self::Bits) -> Self; + + /// Get a flags value with the bits of a flag with the given name set. + /// + /// This method will return `None` if `name` is empty or doesn't + /// correspond to any named flag. + fn from_name(name: &str) -> Option { + // Don't parse empty names as empty flags + if name.is_empty() { + return None; + } + + for flag in Self::FLAGS { + if flag.name() == name { + return Some(Self::from_bits_retain(flag.value().bits())); + } + } + + None + } + + /// Yield a set of contained flags values. + /// + /// Each yielded flags value will correspond to a defined named flag. Any unknown bits + /// will be yielded together as a final flags value. + fn iter(&self) -> iter::Iter { + iter::Iter::new(self) + } + + /// Yield a set of contained named flags values. + /// + /// This method is like [`Flags::iter`], except only yields bits in contained named flags. + /// Any unknown bits, or bits not corresponding to a contained flag will not be yielded. + fn iter_names(&self) -> iter::IterNames { + iter::IterNames::new(self) + } + + /// Whether all bits in this flags value are unset. + fn is_empty(&self) -> bool { + self.bits() == Self::Bits::EMPTY + } + + /// Whether all known bits in this flags value are set. + fn is_all(&self) -> bool { + // NOTE: We check against `Self::all` here, not `Self::Bits::ALL` + // because the set of all flags may not use all bits + Self::all().bits() | self.bits() == self.bits() + } + + /// Whether any set bits in a source flags value are also set in a target flags value. + fn intersects(&self, other: Self) -> bool + where + Self: Sized, + { + self.bits() & other.bits() != Self::Bits::EMPTY + } + + /// Whether all set bits in a source flags value are also set in a target flags value. + fn contains(&self, other: Self) -> bool + where + Self: Sized, + { + self.bits() & other.bits() == other.bits() + } + + /// The bitwise or (`|`) of the bits in two flags values. + fn insert(&mut self, other: Self) + where + Self: Sized, + { + *self = Self::from_bits_retain(self.bits()).union(other); + } + + /// The intersection of a source flags value with the complement of a target flags value (`&!`). + /// + /// This method is not equivalent to `self & !other` when `other` has unknown bits set. + /// `remove` won't truncate `other`, but the `!` operator will. + fn remove(&mut self, other: Self) + where + Self: Sized, + { + *self = Self::from_bits_retain(self.bits()).difference(other); + } + + /// The bitwise exclusive-or (`^`) of the bits in two flags values. + fn toggle(&mut self, other: Self) + where + Self: Sized, + { + *self = Self::from_bits_retain(self.bits()).symmetric_difference(other); + } + + /// Call [`Flags::insert`] when `value` is `true` or [`Flags::remove`] when `value` is `false`. + fn set(&mut self, other: Self, value: bool) + where + Self: Sized, + { + if value { + self.insert(other); + } else { + self.remove(other); + } + } + + /// The bitwise and (`&`) of the bits in two flags values. + #[must_use] + fn intersection(self, other: Self) -> Self { + Self::from_bits_retain(self.bits() & other.bits()) + } + + /// The bitwise or (`|`) of the bits in two flags values. + #[must_use] + fn union(self, other: Self) -> Self { + Self::from_bits_retain(self.bits() | other.bits()) + } + + /// The intersection of a source flags value with the complement of a target flags value (`&!`). + /// + /// This method is not equivalent to `self & !other` when `other` has unknown bits set. + /// `difference` won't truncate `other`, but the `!` operator will. + #[must_use] + fn difference(self, other: Self) -> Self { + Self::from_bits_retain(self.bits() & !other.bits()) + } + + /// The bitwise exclusive-or (`^`) of the bits in two flags values. + #[must_use] + fn symmetric_difference(self, other: Self) -> Self { + Self::from_bits_retain(self.bits() ^ other.bits()) + } + + /// The bitwise negation (`!`) of the bits in a flags value, truncating the result. + #[must_use] + fn complement(self) -> Self { + Self::from_bits_truncate(!self.bits()) + } +} + +/** +A bits type that can be used as storage for a flags type. +*/ +pub trait Bits: + Clone + + Copy + + PartialEq + + BitAnd + + BitOr + + BitXor + + Not + + Sized + + 'static +{ + /// A value with all bits unset. + const EMPTY: Self; + + /// A value with all bits set. + const ALL: Self; +} + +// Not re-exported: prevent custom `Bits` impls being used in the `bitflags!` macro, +// or they may fail to compile based on crate features +pub trait Primitive {} + +macro_rules! impl_bits { + ($($u:ty, $i:ty,)*) => { + $( + impl Bits for $u { + const EMPTY: $u = 0; + const ALL: $u = <$u>::MAX; + } + + impl Bits for $i { + const EMPTY: $i = 0; + const ALL: $i = <$u>::MAX as $i; + } + + impl ParseHex for $u { + fn parse_hex(input: &str) -> Result { + <$u>::from_str_radix(input, 16).map_err(|_| ParseError::invalid_hex_flag(input)) + } + } + + impl ParseHex for $i { + fn parse_hex(input: &str) -> Result { + <$i>::from_str_radix(input, 16).map_err(|_| ParseError::invalid_hex_flag(input)) + } + } + + impl WriteHex for $u { + fn write_hex(&self, mut writer: W) -> fmt::Result { + write!(writer, "{:x}", self) + } + } + + impl WriteHex for $i { + fn write_hex(&self, mut writer: W) -> fmt::Result { + write!(writer, "{:x}", self) + } + } + + impl Primitive for $i {} + impl Primitive for $u {} + )* + } +} + +impl_bits! { + u8, i8, + u16, i16, + u32, i32, + u64, i64, + u128, i128, + usize, isize, +} + +/// A trait for referencing the `bitflags`-owned internal type +/// without exposing it publicly. +pub trait PublicFlags { + /// The type of the underlying storage. + type Primitive: Primitive; + + /// The type of the internal field on the generated flags type. + type Internal; +} + +#[doc(hidden)] +#[deprecated(note = "use the `Flags` trait instead")] +pub trait BitFlags: ImplementedByBitFlagsMacro + Flags { + /// An iterator over enabled flags in an instance of the type. + type Iter: Iterator; + + /// An iterator over the raw names and bits for enabled flags in an instance of the type. + type IterNames: Iterator; +} + +#[allow(deprecated)] +impl BitFlags for B { + type Iter = iter::Iter; + type IterNames = iter::IterNames; +} + +impl ImplementedByBitFlagsMacro for B {} + +/// A marker trait that signals that an implementation of `BitFlags` came from the `bitflags!` macro. +/// +/// There's nothing stopping an end-user from implementing this trait, but we don't guarantee their +/// manual implementations won't break between non-breaking releases. +#[doc(hidden)] +pub trait ImplementedByBitFlagsMacro {} + +pub(crate) mod __private { + pub use super::{ImplementedByBitFlagsMacro, PublicFlags}; +} diff --git a/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/.cargo-checksum.json b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/.cargo-checksum.json new file mode 100644 index 000000000000..697c9ce2fbb4 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{}} diff --git a/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/.cargo_vcs_info.json b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/.cargo_vcs_info.json new file mode 100644 index 000000000000..3a68bc1a6add --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/.cargo_vcs_info.json @@ -0,0 +1,6 @@ +{ + "git": { + "sha1": "bfa790b8e445dc67b7ab94d75adb1a92d6296c9a" + }, + "path_in_vcs": "" +} \ No newline at end of file diff --git a/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/Cargo.toml b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/Cargo.toml new file mode 100644 index 000000000000..cd26cef0ad88 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/Cargo.toml @@ -0,0 +1,147 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g., crates.io) dependencies. +# +# If you are reading this file be aware that the original Cargo.toml +# will likely look very different (and much more reasonable). +# See Cargo.toml.orig for the original contents. + +[package] +edition = "2018" +rust-version = "1.31" +name = "syn" +version = "1.0.109" +authors = ["David Tolnay "] +include = [ + "/benches/**", + "/build.rs", + "/Cargo.toml", + "/LICENSE-APACHE", + "/LICENSE-MIT", + "/README.md", + "/src/**", + "/tests/**", +] +description = "Parser for Rust source code" +documentation = "https://docs.rs/syn" +readme = "README.md" +keywords = [ + "macros", + "syn", +] +categories = [ + "development-tools::procedural-macro-helpers", + "parser-implementations", +] +license = "MIT OR Apache-2.0" +repository = "https://github.com/dtolnay/syn" + +[package.metadata.docs.rs] +all-features = true +rustdoc-args = [ + "--cfg", + "doc_cfg", +] +targets = ["x86_64-unknown-linux-gnu"] + +[package.metadata.playground] +features = [ + "full", + "visit", + "visit-mut", + "fold", + "extra-traits", +] + +[lib] +doc-scrape-examples = false + +[[bench]] +name = "rust" +harness = false +required-features = [ + "full", + "parsing", +] + +[[bench]] +name = "file" +required-features = [ + "full", + "parsing", +] + +[dependencies.proc-macro2] +version = "1.0.46" +default-features = false + +[dependencies.quote] +version = "1.0" +optional = true +default-features = false + +[dependencies.unicode-ident] +version = "1.0" + +[dev-dependencies.anyhow] +version = "1.0" + +[dev-dependencies.automod] +version = "1.0" + +[dev-dependencies.flate2] +version = "1.0" + +[dev-dependencies.insta] +version = "1.0" + +[dev-dependencies.rayon] +version = "1.0" + +[dev-dependencies.ref-cast] +version = "1.0" + +[dev-dependencies.regex] +version = "1.0" + +[dev-dependencies.reqwest] +version = "0.11" +features = ["blocking"] + +[dev-dependencies.syn-test-suite] +version = "0" + +[dev-dependencies.tar] +version = "0.4.16" + +[dev-dependencies.termcolor] +version = "1.0" + +[dev-dependencies.walkdir] +version = "2.1" + +[features] +clone-impls = [] +default = [ + "derive", + "parsing", + "printing", + "clone-impls", + "proc-macro", +] +derive = [] +extra-traits = [] +fold = [] +full = [] +parsing = [] +printing = ["quote"] +proc-macro = [ + "proc-macro2/proc-macro", + "quote/proc-macro", +] +test = ["syn-test-suite/all-features"] +visit = [] +visit-mut = [] diff --git a/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/Cargo.toml.orig b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/Cargo.toml.orig new file mode 100644 index 000000000000..9046d9131f38 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/Cargo.toml.orig @@ -0,0 +1,91 @@ +[package] +name = "syn" +version = "1.0.109" # don't forget to update html_root_url and syn.json +authors = ["David Tolnay "] +categories = ["development-tools::procedural-macro-helpers", "parser-implementations"] +description = "Parser for Rust source code" +documentation = "https://docs.rs/syn" +edition = "2018" +include = [ + "/benches/**", + "/build.rs", + "/Cargo.toml", + "/LICENSE-APACHE", + "/LICENSE-MIT", + "/README.md", + "/src/**", + "/tests/**", +] +keywords = ["macros", "syn"] +license = "MIT OR Apache-2.0" +repository = "https://github.com/dtolnay/syn" +rust-version = "1.31" + +[features] +default = ["derive", "parsing", "printing", "clone-impls", "proc-macro"] +derive = [] +full = [] +parsing = [] +printing = ["quote"] +visit = [] +visit-mut = [] +fold = [] +clone-impls = [] +extra-traits = [] +proc-macro = ["proc-macro2/proc-macro", "quote/proc-macro"] +test = ["syn-test-suite/all-features"] + +[dependencies] +proc-macro2 = { version = "1.0.46", default-features = false } +quote = { version = "1.0", optional = true, default-features = false } +unicode-ident = "1.0" + +[dev-dependencies] +anyhow = "1.0" +automod = "1.0" +flate2 = "1.0" +insta = "1.0" +rayon = "1.0" +ref-cast = "1.0" +regex = "1.0" +reqwest = { version = "0.11", features = ["blocking"] } +syn-test-suite = { version = "0", path = "tests/features" } +tar = "0.4.16" +termcolor = "1.0" +walkdir = "2.1" + +[lib] +doc-scrape-examples = false + +[[bench]] +name = "rust" +harness = false +required-features = ["full", "parsing"] + +[[bench]] +name = "file" +required-features = ["full", "parsing"] + +[package.metadata.docs.rs] +all-features = true +targets = ["x86_64-unknown-linux-gnu"] +rustdoc-args = ["--cfg", "doc_cfg"] + +[package.metadata.playground] +features = ["full", "visit", "visit-mut", "fold", "extra-traits"] + +[workspace] +members = [ + "dev", + "examples/dump-syntax", + "examples/heapsize/example", + "examples/heapsize/heapsize", + "examples/heapsize/heapsize_derive", + "examples/lazy-static/example", + "examples/lazy-static/lazy-static", + "examples/trace-var/example", + "examples/trace-var/trace-var", + "json", + "tests/crates", + "tests/features", +] diff --git a/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/LICENSE-APACHE b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/LICENSE-APACHE new file mode 100644 index 000000000000..16fe87b06e80 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/LICENSE-MIT b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/LICENSE-MIT new file mode 100644 index 000000000000..31aa79387f27 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/LICENSE-MIT @@ -0,0 +1,23 @@ +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/README.md b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/README.md new file mode 100644 index 000000000000..eeef83dd581e --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/README.md @@ -0,0 +1,285 @@ +Parser for Rust source code +=========================== + +[github](https://github.com/dtolnay/syn) +[crates.io](https://crates.io/crates/syn) +[docs.rs](https://docs.rs/syn) +[build status](https://github.com/dtolnay/syn/actions?query=branch%3Amaster) + +Syn is a parsing library for parsing a stream of Rust tokens into a syntax tree +of Rust source code. + +Currently this library is geared toward use in Rust procedural macros, but +contains some APIs that may be useful more generally. + +- **Data structures** — Syn provides a complete syntax tree that can represent + any valid Rust source code. The syntax tree is rooted at [`syn::File`] which + represents a full source file, but there are other entry points that may be + useful to procedural macros including [`syn::Item`], [`syn::Expr`] and + [`syn::Type`]. + +- **Derives** — Of particular interest to derive macros is [`syn::DeriveInput`] + which is any of the three legal input items to a derive macro. An example + below shows using this type in a library that can derive implementations of a + user-defined trait. + +- **Parsing** — Parsing in Syn is built around [parser functions] with the + signature `fn(ParseStream) -> Result`. Every syntax tree node defined by + Syn is individually parsable and may be used as a building block for custom + syntaxes, or you may dream up your own brand new syntax without involving any + of our syntax tree types. + +- **Location information** — Every token parsed by Syn is associated with a + `Span` that tracks line and column information back to the source of that + token. These spans allow a procedural macro to display detailed error messages + pointing to all the right places in the user's code. There is an example of + this below. + +- **Feature flags** — Functionality is aggressively feature gated so your + procedural macros enable only what they need, and do not pay in compile time + for all the rest. + +[`syn::File`]: https://docs.rs/syn/1.0/syn/struct.File.html +[`syn::Item`]: https://docs.rs/syn/1.0/syn/enum.Item.html +[`syn::Expr`]: https://docs.rs/syn/1.0/syn/enum.Expr.html +[`syn::Type`]: https://docs.rs/syn/1.0/syn/enum.Type.html +[`syn::DeriveInput`]: https://docs.rs/syn/1.0/syn/struct.DeriveInput.html +[parser functions]: https://docs.rs/syn/1.0/syn/parse/index.html + +*Version requirement: Syn supports rustc 1.31 and up.* + +[*Release notes*](https://github.com/dtolnay/syn/releases) + +
+ +## Resources + +The best way to learn about procedural macros is by writing some. Consider +working through [this procedural macro workshop][workshop] to get familiar with +the different types of procedural macros. The workshop contains relevant links +into the Syn documentation as you work through each project. + +[workshop]: https://github.com/dtolnay/proc-macro-workshop + +
+ +## Example of a derive macro + +The canonical derive macro using Syn looks like this. We write an ordinary Rust +function tagged with a `proc_macro_derive` attribute and the name of the trait +we are deriving. Any time that derive appears in the user's code, the Rust +compiler passes their data structure as tokens into our macro. We get to execute +arbitrary Rust code to figure out what to do with those tokens, then hand some +tokens back to the compiler to compile into the user's crate. + +[`TokenStream`]: https://doc.rust-lang.org/proc_macro/struct.TokenStream.html + +```toml +[dependencies] +syn = "1.0" +quote = "1.0" + +[lib] +proc-macro = true +``` + +```rust +use proc_macro::TokenStream; +use quote::quote; +use syn::{parse_macro_input, DeriveInput}; + +#[proc_macro_derive(MyMacro)] +pub fn my_macro(input: TokenStream) -> TokenStream { + // Parse the input tokens into a syntax tree + let input = parse_macro_input!(input as DeriveInput); + + // Build the output, possibly using quasi-quotation + let expanded = quote! { + // ... + }; + + // Hand the output tokens back to the compiler + TokenStream::from(expanded) +} +``` + +The [`heapsize`] example directory shows a complete working implementation of a +derive macro. It works on any Rust compiler 1.31+. The example derives a +`HeapSize` trait which computes an estimate of the amount of heap memory owned +by a value. + +[`heapsize`]: examples/heapsize + +```rust +pub trait HeapSize { + /// Total number of bytes of heap memory owned by `self`. + fn heap_size_of_children(&self) -> usize; +} +``` + +The derive macro allows users to write `#[derive(HeapSize)]` on data structures +in their program. + +```rust +#[derive(HeapSize)] +struct Demo<'a, T: ?Sized> { + a: Box, + b: u8, + c: &'a str, + d: String, +} +``` + +
+ +## Spans and error reporting + +The token-based procedural macro API provides great control over where the +compiler's error messages are displayed in user code. Consider the error the +user sees if one of their field types does not implement `HeapSize`. + +```rust +#[derive(HeapSize)] +struct Broken { + ok: String, + bad: std::thread::Thread, +} +``` + +By tracking span information all the way through the expansion of a procedural +macro as shown in the `heapsize` example, token-based macros in Syn are able to +trigger errors that directly pinpoint the source of the problem. + +```console +error[E0277]: the trait bound `std::thread::Thread: HeapSize` is not satisfied + --> src/main.rs:7:5 + | +7 | bad: std::thread::Thread, + | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `HeapSize` is not implemented for `std::thread::Thread` +``` + +
+ +## Parsing a custom syntax + +The [`lazy-static`] example directory shows the implementation of a +`functionlike!(...)` procedural macro in which the input tokens are parsed using +Syn's parsing API. + +[`lazy-static`]: examples/lazy-static + +The example reimplements the popular `lazy_static` crate from crates.io as a +procedural macro. + +```rust +lazy_static! { + static ref USERNAME: Regex = Regex::new("^[a-z0-9_-]{3,16}$").unwrap(); +} +``` + +The implementation shows how to trigger custom warnings and error messages on +the macro input. + +```console +warning: come on, pick a more creative name + --> src/main.rs:10:16 + | +10 | static ref FOO: String = "lazy_static".to_owned(); + | ^^^ +``` + +
+ +## Testing + +When testing macros, we often care not just that the macro can be used +successfully but also that when the macro is provided with invalid input it +produces maximally helpful error messages. Consider using the [`trybuild`] crate +to write tests for errors that are emitted by your macro or errors detected by +the Rust compiler in the expanded code following misuse of the macro. Such tests +help avoid regressions from later refactors that mistakenly make an error no +longer trigger or be less helpful than it used to be. + +[`trybuild`]: https://github.com/dtolnay/trybuild + +
+ +## Debugging + +When developing a procedural macro it can be helpful to look at what the +generated code looks like. Use `cargo rustc -- -Zunstable-options +--pretty=expanded` or the [`cargo expand`] subcommand. + +[`cargo expand`]: https://github.com/dtolnay/cargo-expand + +To show the expanded code for some crate that uses your procedural macro, run +`cargo expand` from that crate. To show the expanded code for one of your own +test cases, run `cargo expand --test the_test_case` where the last argument is +the name of the test file without the `.rs` extension. + +This write-up by Brandon W Maister discusses debugging in more detail: +[Debugging Rust's new Custom Derive system][debugging]. + +[debugging]: https://quodlibetor.github.io/posts/debugging-rusts-new-custom-derive-system/ + +
+ +## Optional features + +Syn puts a lot of functionality behind optional features in order to optimize +compile time for the most common use cases. The following features are +available. + +- **`derive`** *(enabled by default)* — Data structures for representing the + possible input to a derive macro, including structs and enums and types. +- **`full`** — Data structures for representing the syntax tree of all valid + Rust source code, including items and expressions. +- **`parsing`** *(enabled by default)* — Ability to parse input tokens into a + syntax tree node of a chosen type. +- **`printing`** *(enabled by default)* — Ability to print a syntax tree node as + tokens of Rust source code. +- **`visit`** — Trait for traversing a syntax tree. +- **`visit-mut`** — Trait for traversing and mutating in place a syntax tree. +- **`fold`** — Trait for transforming an owned syntax tree. +- **`clone-impls`** *(enabled by default)* — Clone impls for all syntax tree + types. +- **`extra-traits`** — Debug, Eq, PartialEq, Hash impls for all syntax tree + types. +- **`proc-macro`** *(enabled by default)* — Runtime dependency on the dynamic + library libproc_macro from rustc toolchain. + +
+ +## Proc macro shim + +Syn operates on the token representation provided by the [proc-macro2] crate +from crates.io rather than using the compiler's built in proc-macro crate +directly. This enables code using Syn to execute outside of the context of a +procedural macro, such as in unit tests or build.rs, and we avoid needing +incompatible ecosystems for proc macros vs non-macro use cases. + +In general all of your code should be written against proc-macro2 rather than +proc-macro. The one exception is in the signatures of procedural macro entry +points, which are required by the language to use `proc_macro::TokenStream`. + +The proc-macro2 crate will automatically detect and use the compiler's data +structures when a procedural macro is active. + +[proc-macro2]: https://docs.rs/proc-macro2/1.0/proc_macro2/ + +
+ +#### License + + +Licensed under either of Apache License, Version +2.0 or MIT license at your option. + + +
+ + +Unless you explicitly state otherwise, any contribution intentionally submitted +for inclusion in this crate by you, as defined in the Apache-2.0 license, shall +be dual licensed as above, without any additional terms or conditions. + diff --git a/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/benches/file.rs b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/benches/file.rs new file mode 100644 index 000000000000..bd4a247df662 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/benches/file.rs @@ -0,0 +1,55 @@ +// $ cargo bench --features full,test --bench file + +#![feature(rustc_private, test)] +#![recursion_limit = "1024"] +#![allow( + clippy::items_after_statements, + clippy::missing_panics_doc, + clippy::must_use_candidate +)] + +extern crate test; + +#[macro_use] +#[path = "../tests/macros/mod.rs"] +mod macros; + +#[path = "../tests/common/mod.rs"] +mod common; +#[path = "../tests/repo/mod.rs"] +pub mod repo; + +use proc_macro2::{Span, TokenStream}; +use std::fs; +use std::str::FromStr; +use syn::parse::{ParseStream, Parser}; +use test::Bencher; + +const FILE: &str = "tests/rust/library/core/src/str/mod.rs"; + +fn get_tokens() -> TokenStream { + repo::clone_rust(); + let content = fs::read_to_string(FILE).unwrap(); + TokenStream::from_str(&content).unwrap() +} + +#[bench] +fn baseline(b: &mut Bencher) { + let tokens = get_tokens(); + b.iter(|| drop(tokens.clone())); +} + +#[bench] +fn create_token_buffer(b: &mut Bencher) { + let tokens = get_tokens(); + fn immediate_fail(_input: ParseStream) -> syn::Result<()> { + Err(syn::Error::new(Span::call_site(), "")) + } + b.iter(|| immediate_fail.parse2(tokens.clone())); +} + +#[bench] +fn parse_file(b: &mut Bencher) { + let tokens = get_tokens(); + b.iter(|| syn::parse2::(tokens.clone())); +} diff --git a/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/benches/rust.rs b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/benches/rust.rs new file mode 100644 index 000000000000..e3f8f550abb1 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/benches/rust.rs @@ -0,0 +1,170 @@ +// $ cargo bench --features full,test --bench rust +// +// Syn only, useful for profiling: +// $ RUSTFLAGS='--cfg syn_only' cargo build --release --features full,test --bench rust + +#![cfg_attr(not(syn_only), feature(rustc_private))] +#![recursion_limit = "1024"] +#![allow(clippy::cast_lossless, clippy::unnecessary_wraps)] + +#[macro_use] +#[path = "../tests/macros/mod.rs"] +mod macros; + +#[path = "../tests/common/mod.rs"] +mod common; +#[path = "../tests/repo/mod.rs"] +mod repo; + +use std::fs; +use std::time::{Duration, Instant}; + +#[cfg(not(syn_only))] +mod tokenstream_parse { + use proc_macro2::TokenStream; + use std::str::FromStr; + + pub fn bench(content: &str) -> Result<(), ()> { + TokenStream::from_str(content).map(drop).map_err(drop) + } +} + +mod syn_parse { + pub fn bench(content: &str) -> Result<(), ()> { + syn::parse_file(content).map(drop).map_err(drop) + } +} + +#[cfg(not(syn_only))] +mod librustc_parse { + extern crate rustc_data_structures; + extern crate rustc_error_messages; + extern crate rustc_errors; + extern crate rustc_parse; + extern crate rustc_session; + extern crate rustc_span; + + use rustc_data_structures::sync::Lrc; + use rustc_error_messages::FluentBundle; + use rustc_errors::{emitter::Emitter, translation::Translate, Diagnostic, Handler}; + use rustc_session::parse::ParseSess; + use rustc_span::source_map::{FilePathMapping, SourceMap}; + use rustc_span::{edition::Edition, FileName}; + + pub fn bench(content: &str) -> Result<(), ()> { + struct SilentEmitter; + + impl Emitter for SilentEmitter { + fn emit_diagnostic(&mut self, _diag: &Diagnostic) {} + fn source_map(&self) -> Option<&Lrc> { + None + } + } + + impl Translate for SilentEmitter { + fn fluent_bundle(&self) -> Option<&Lrc> { + None + } + fn fallback_fluent_bundle(&self) -> &FluentBundle { + panic!("silent emitter attempted to translate a diagnostic"); + } + } + + rustc_span::create_session_if_not_set_then(Edition::Edition2018, |_| { + let cm = Lrc::new(SourceMap::new(FilePathMapping::empty())); + let emitter = Box::new(SilentEmitter); + let handler = Handler::with_emitter(false, None, emitter); + let sess = ParseSess::with_span_handler(handler, cm); + if let Err(diagnostic) = rustc_parse::parse_crate_from_source_str( + FileName::Custom("bench".to_owned()), + content.to_owned(), + &sess, + ) { + diagnostic.cancel(); + return Err(()); + }; + Ok(()) + }) + } +} + +#[cfg(not(syn_only))] +mod read_from_disk { + pub fn bench(content: &str) -> Result<(), ()> { + _ = content; + Ok(()) + } +} + +fn exec(mut codepath: impl FnMut(&str) -> Result<(), ()>) -> Duration { + let begin = Instant::now(); + let mut success = 0; + let mut total = 0; + + walkdir::WalkDir::new("tests/rust/src") + .into_iter() + .filter_entry(repo::base_dir_filter) + .for_each(|entry| { + let entry = entry.unwrap(); + let path = entry.path(); + if path.is_dir() { + return; + } + let content = fs::read_to_string(path).unwrap(); + let ok = codepath(&content).is_ok(); + success += ok as usize; + total += 1; + if !ok { + eprintln!("FAIL {}", path.display()); + } + }); + + assert_eq!(success, total); + begin.elapsed() +} + +fn main() { + repo::clone_rust(); + + macro_rules! testcases { + ($($(#[$cfg:meta])* $name:ident,)*) => { + [ + $( + $(#[$cfg])* + (stringify!($name), $name::bench as fn(&str) -> Result<(), ()>), + )* + ] + }; + } + + #[cfg(not(syn_only))] + { + let mut lines = 0; + let mut files = 0; + exec(|content| { + lines += content.lines().count(); + files += 1; + Ok(()) + }); + eprintln!("\n{} lines in {} files", lines, files); + } + + for (name, f) in testcases!( + #[cfg(not(syn_only))] + read_from_disk, + #[cfg(not(syn_only))] + tokenstream_parse, + syn_parse, + #[cfg(not(syn_only))] + librustc_parse, + ) { + eprint!("{:20}", format!("{}:", name)); + let elapsed = exec(f); + eprintln!( + "elapsed={}.{:03}s", + elapsed.as_secs(), + elapsed.subsec_millis(), + ); + } + eprintln!(); +} diff --git a/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/build.rs b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/build.rs new file mode 100644 index 000000000000..1a2c077bf0e1 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/build.rs @@ -0,0 +1,51 @@ +use std::env; +use std::process::Command; +use std::str; + +// The rustc-cfg strings below are *not* public API. Please let us know by +// opening a GitHub issue if your build environment requires some way to enable +// these cfgs other than by executing our build script. +fn main() { + let compiler = match rustc_version() { + Some(compiler) => compiler, + None => return, + }; + + if compiler.minor < 36 { + println!("cargo:rustc-cfg=syn_omit_await_from_token_macro"); + } + + if compiler.minor < 39 { + println!("cargo:rustc-cfg=syn_no_const_vec_new"); + } + + if compiler.minor < 40 { + println!("cargo:rustc-cfg=syn_no_non_exhaustive"); + } + + if compiler.minor < 56 { + println!("cargo:rustc-cfg=syn_no_negative_literal_parse"); + } + + if !compiler.nightly { + println!("cargo:rustc-cfg=syn_disable_nightly_tests"); + } +} + +struct Compiler { + minor: u32, + nightly: bool, +} + +fn rustc_version() -> Option { + let rustc = env::var_os("RUSTC")?; + let output = Command::new(rustc).arg("--version").output().ok()?; + let version = str::from_utf8(&output.stdout).ok()?; + let mut pieces = version.split('.'); + if pieces.next() != Some("rustc 1") { + return None; + } + let minor = pieces.next()?.parse().ok()?; + let nightly = version.contains("nightly") || version.ends_with("-dev"); + Some(Compiler { minor, nightly }) +} diff --git a/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/attr.rs b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/attr.rs new file mode 100644 index 000000000000..bace94f43c85 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/attr.rs @@ -0,0 +1,662 @@ +use super::*; +use crate::punctuated::Punctuated; +use proc_macro2::TokenStream; +use std::iter; +use std::slice; + +#[cfg(feature = "parsing")] +use crate::parse::{Parse, ParseBuffer, ParseStream, Parser, Result}; +#[cfg(feature = "parsing")] +use crate::punctuated::Pair; + +ast_struct! { + /// An attribute like `#[repr(transparent)]`. + /// + /// *This type is available only if Syn is built with the `"derive"` or `"full"` + /// feature.* + /// + ///
+ /// + /// # Syntax + /// + /// Rust has six types of attributes. + /// + /// - Outer attributes like `#[repr(transparent)]`. These appear outside or + /// in front of the item they describe. + /// - Inner attributes like `#![feature(proc_macro)]`. These appear inside + /// of the item they describe, usually a module. + /// - Outer doc comments like `/// # Example`. + /// - Inner doc comments like `//! Please file an issue`. + /// - Outer block comments `/** # Example */`. + /// - Inner block comments `/*! Please file an issue */`. + /// + /// The `style` field of type `AttrStyle` distinguishes whether an attribute + /// is outer or inner. Doc comments and block comments are promoted to + /// attributes, as this is how they are processed by the compiler and by + /// `macro_rules!` macros. + /// + /// The `path` field gives the possibly colon-delimited path against which + /// the attribute is resolved. It is equal to `"doc"` for desugared doc + /// comments. The `tokens` field contains the rest of the attribute body as + /// tokens. + /// + /// ```text + /// #[derive(Copy)] #[crate::precondition x < 5] + /// ^^^^^^~~~~~~ ^^^^^^^^^^^^^^^^^^^ ~~~~~ + /// path tokens path tokens + /// ``` + /// + ///
+ /// + /// # Parsing from tokens to Attribute + /// + /// This type does not implement the [`Parse`] trait and thus cannot be + /// parsed directly by [`ParseStream::parse`]. Instead use + /// [`ParseStream::call`] with one of the two parser functions + /// [`Attribute::parse_outer`] or [`Attribute::parse_inner`] depending on + /// which you intend to parse. + /// + /// [`Parse`]: parse::Parse + /// [`ParseStream::parse`]: parse::ParseBuffer::parse + /// [`ParseStream::call`]: parse::ParseBuffer::call + /// + /// ``` + /// use syn::{Attribute, Ident, Result, Token}; + /// use syn::parse::{Parse, ParseStream}; + /// + /// // Parses a unit struct with attributes. + /// // + /// // #[path = "s.tmpl"] + /// // struct S; + /// struct UnitStruct { + /// attrs: Vec, + /// struct_token: Token![struct], + /// name: Ident, + /// semi_token: Token![;], + /// } + /// + /// impl Parse for UnitStruct { + /// fn parse(input: ParseStream) -> Result { + /// Ok(UnitStruct { + /// attrs: input.call(Attribute::parse_outer)?, + /// struct_token: input.parse()?, + /// name: input.parse()?, + /// semi_token: input.parse()?, + /// }) + /// } + /// } + /// ``` + /// + ///


+ /// + /// # Parsing from Attribute to structured arguments + /// + /// The grammar of attributes in Rust is very flexible, which makes the + /// syntax tree not that useful on its own. In particular, arguments of the + /// attribute are held in an arbitrary `tokens: TokenStream`. Macros are + /// expected to check the `path` of the attribute, decide whether they + /// recognize it, and then parse the remaining tokens according to whatever + /// grammar they wish to require for that kind of attribute. + /// + /// If the attribute you are parsing is expected to conform to the + /// conventional structured form of attribute, use [`parse_meta()`] to + /// obtain that structured representation. If the attribute follows some + /// other grammar of its own, use [`parse_args()`] to parse that into the + /// expected data structure. + /// + /// [`parse_meta()`]: Attribute::parse_meta + /// [`parse_args()`]: Attribute::parse_args + /// + ///


+ /// + /// # Doc comments + /// + /// The compiler transforms doc comments, such as `/// comment` and `/*! + /// comment */`, into attributes before macros are expanded. Each comment is + /// expanded into an attribute of the form `#[doc = r"comment"]`. + /// + /// As an example, the following `mod` items are expanded identically: + /// + /// ``` + /// # use syn::{ItemMod, parse_quote}; + /// let doc: ItemMod = parse_quote! { + /// /// Single line doc comments + /// /// We write so many! + /// /** + /// * Multi-line comments... + /// * May span many lines + /// */ + /// mod example { + /// //! Of course, they can be inner too + /// /*! And fit in a single line */ + /// } + /// }; + /// let attr: ItemMod = parse_quote! { + /// #[doc = r" Single line doc comments"] + /// #[doc = r" We write so many!"] + /// #[doc = r" + /// * Multi-line comments... + /// * May span many lines + /// "] + /// mod example { + /// #![doc = r" Of course, they can be inner too"] + /// #![doc = r" And fit in a single line "] + /// } + /// }; + /// assert_eq!(doc, attr); + /// ``` + #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] + pub struct Attribute { + pub pound_token: Token![#], + pub style: AttrStyle, + pub bracket_token: token::Bracket, + pub path: Path, + pub tokens: TokenStream, + } +} + +impl Attribute { + /// Parses the content of the attribute, consisting of the path and tokens, + /// as a [`Meta`] if possible. + /// + /// *This function is available only if Syn is built with the `"parsing"` + /// feature.* + #[cfg(feature = "parsing")] + #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] + pub fn parse_meta(&self) -> Result { + fn clone_ident_segment(segment: &PathSegment) -> PathSegment { + PathSegment { + ident: segment.ident.clone(), + arguments: PathArguments::None, + } + } + + let path = Path { + leading_colon: self + .path + .leading_colon + .as_ref() + .map(|colon| Token![::](colon.spans)), + segments: self + .path + .segments + .pairs() + .map(|pair| match pair { + Pair::Punctuated(seg, punct) => { + Pair::Punctuated(clone_ident_segment(seg), Token![::](punct.spans)) + } + Pair::End(seg) => Pair::End(clone_ident_segment(seg)), + }) + .collect(), + }; + + let parser = |input: ParseStream| parsing::parse_meta_after_path(path, input); + parse::Parser::parse2(parser, self.tokens.clone()) + } + + /// Parse the arguments to the attribute as a syntax tree. + /// + /// This is similar to `syn::parse2::(attr.tokens)` except that: + /// + /// - the surrounding delimiters are *not* included in the input to the + /// parser; and + /// - the error message has a more useful span when `tokens` is empty. + /// + /// ```text + /// #[my_attr(value < 5)] + /// ^^^^^^^^^ what gets parsed + /// ``` + /// + /// *This function is available only if Syn is built with the `"parsing"` + /// feature.* + #[cfg(feature = "parsing")] + #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] + pub fn parse_args(&self) -> Result { + self.parse_args_with(T::parse) + } + + /// Parse the arguments to the attribute using the given parser. + /// + /// *This function is available only if Syn is built with the `"parsing"` + /// feature.* + #[cfg(feature = "parsing")] + #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] + pub fn parse_args_with(&self, parser: F) -> Result { + let parser = |input: ParseStream| { + let args = enter_args(self, input)?; + parse::parse_stream(parser, &args) + }; + parser.parse2(self.tokens.clone()) + } + + /// Parses zero or more outer attributes from the stream. + /// + /// *This function is available only if Syn is built with the `"parsing"` + /// feature.* + #[cfg(feature = "parsing")] + #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] + pub fn parse_outer(input: ParseStream) -> Result> { + let mut attrs = Vec::new(); + while input.peek(Token![#]) { + attrs.push(input.call(parsing::single_parse_outer)?); + } + Ok(attrs) + } + + /// Parses zero or more inner attributes from the stream. + /// + /// *This function is available only if Syn is built with the `"parsing"` + /// feature.* + #[cfg(feature = "parsing")] + #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] + pub fn parse_inner(input: ParseStream) -> Result> { + let mut attrs = Vec::new(); + parsing::parse_inner(input, &mut attrs)?; + Ok(attrs) + } +} + +#[cfg(feature = "parsing")] +fn expected_parentheses(attr: &Attribute) -> String { + let style = match attr.style { + AttrStyle::Outer => "#", + AttrStyle::Inner(_) => "#!", + }; + + let mut path = String::new(); + for segment in &attr.path.segments { + if !path.is_empty() || attr.path.leading_colon.is_some() { + path += "::"; + } + path += &segment.ident.to_string(); + } + + format!("{}[{}(...)]", style, path) +} + +#[cfg(feature = "parsing")] +fn enter_args<'a>(attr: &Attribute, input: ParseStream<'a>) -> Result> { + if input.is_empty() { + let expected = expected_parentheses(attr); + let msg = format!("expected attribute arguments in parentheses: {}", expected); + return Err(crate::error::new2( + attr.pound_token.span, + attr.bracket_token.span, + msg, + )); + } else if input.peek(Token![=]) { + let expected = expected_parentheses(attr); + let msg = format!("expected parentheses: {}", expected); + return Err(input.error(msg)); + }; + + let content; + if input.peek(token::Paren) { + parenthesized!(content in input); + } else if input.peek(token::Bracket) { + bracketed!(content in input); + } else if input.peek(token::Brace) { + braced!(content in input); + } else { + return Err(input.error("unexpected token in attribute arguments")); + } + + if input.is_empty() { + Ok(content) + } else { + Err(input.error("unexpected token in attribute arguments")) + } +} + +ast_enum! { + /// Distinguishes between attributes that decorate an item and attributes + /// that are contained within an item. + /// + /// *This type is available only if Syn is built with the `"derive"` or `"full"` + /// feature.* + /// + /// # Outer attributes + /// + /// - `#[repr(transparent)]` + /// - `/// # Example` + /// - `/** Please file an issue */` + /// + /// # Inner attributes + /// + /// - `#![feature(proc_macro)]` + /// - `//! # Example` + /// - `/*! Please file an issue */` + #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] + pub enum AttrStyle { + Outer, + Inner(Token![!]), + } +} + +ast_enum_of_structs! { + /// Content of a compile-time structured attribute. + /// + /// *This type is available only if Syn is built with the `"derive"` or `"full"` + /// feature.* + /// + /// ## Path + /// + /// A meta path is like the `test` in `#[test]`. + /// + /// ## List + /// + /// A meta list is like the `derive(Copy)` in `#[derive(Copy)]`. + /// + /// ## NameValue + /// + /// A name-value meta is like the `path = "..."` in `#[path = + /// "sys/windows.rs"]`. + /// + /// # Syntax tree enum + /// + /// This type is a [syntax tree enum]. + /// + /// [syntax tree enum]: Expr#syntax-tree-enums + #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] + pub enum Meta { + Path(Path), + + /// A structured list within an attribute, like `derive(Copy, Clone)`. + List(MetaList), + + /// A name-value pair within an attribute, like `feature = "nightly"`. + NameValue(MetaNameValue), + } +} + +ast_struct! { + /// A structured list within an attribute, like `derive(Copy, Clone)`. + /// + /// *This type is available only if Syn is built with the `"derive"` or + /// `"full"` feature.* + #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] + pub struct MetaList { + pub path: Path, + pub paren_token: token::Paren, + pub nested: Punctuated, + } +} + +ast_struct! { + /// A name-value pair within an attribute, like `feature = "nightly"`. + /// + /// *This type is available only if Syn is built with the `"derive"` or + /// `"full"` feature.* + #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] + pub struct MetaNameValue { + pub path: Path, + pub eq_token: Token![=], + pub lit: Lit, + } +} + +impl Meta { + /// Returns the identifier that begins this structured meta item. + /// + /// For example this would return the `test` in `#[test]`, the `derive` in + /// `#[derive(Copy)]`, and the `path` in `#[path = "sys/windows.rs"]`. + pub fn path(&self) -> &Path { + match self { + Meta::Path(path) => path, + Meta::List(meta) => &meta.path, + Meta::NameValue(meta) => &meta.path, + } + } +} + +ast_enum_of_structs! { + /// Element of a compile-time attribute list. + /// + /// *This type is available only if Syn is built with the `"derive"` or `"full"` + /// feature.* + #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] + pub enum NestedMeta { + /// A structured meta item, like the `Copy` in `#[derive(Copy)]` which + /// would be a nested `Meta::Path`. + Meta(Meta), + + /// A Rust literal, like the `"new_name"` in `#[rename("new_name")]`. + Lit(Lit), + } +} + +/// Conventional argument type associated with an invocation of an attribute +/// macro. +/// +/// For example if we are developing an attribute macro that is intended to be +/// invoked on function items as follows: +/// +/// ``` +/// # const IGNORE: &str = stringify! { +/// #[my_attribute(path = "/v1/refresh")] +/// # }; +/// pub fn refresh() { +/// /* ... */ +/// } +/// ``` +/// +/// The implementation of this macro would want to parse its attribute arguments +/// as type `AttributeArgs`. +/// +/// ``` +/// # extern crate proc_macro; +/// # +/// use proc_macro::TokenStream; +/// use syn::{parse_macro_input, AttributeArgs, ItemFn}; +/// +/// # const IGNORE: &str = stringify! { +/// #[proc_macro_attribute] +/// # }; +/// pub fn my_attribute(args: TokenStream, input: TokenStream) -> TokenStream { +/// let args = parse_macro_input!(args as AttributeArgs); +/// let input = parse_macro_input!(input as ItemFn); +/// +/// /* ... */ +/// # "".parse().unwrap() +/// } +/// ``` +#[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] +pub type AttributeArgs = Vec; + +pub trait FilterAttrs<'a> { + type Ret: Iterator; + + fn outer(self) -> Self::Ret; + fn inner(self) -> Self::Ret; +} + +impl<'a> FilterAttrs<'a> for &'a [Attribute] { + type Ret = iter::Filter, fn(&&Attribute) -> bool>; + + fn outer(self) -> Self::Ret { + fn is_outer(attr: &&Attribute) -> bool { + match attr.style { + AttrStyle::Outer => true, + AttrStyle::Inner(_) => false, + } + } + self.iter().filter(is_outer) + } + + fn inner(self) -> Self::Ret { + fn is_inner(attr: &&Attribute) -> bool { + match attr.style { + AttrStyle::Inner(_) => true, + AttrStyle::Outer => false, + } + } + self.iter().filter(is_inner) + } +} + +#[cfg(feature = "parsing")] +pub mod parsing { + use super::*; + use crate::ext::IdentExt; + use crate::parse::{Parse, ParseStream, Result}; + + pub fn parse_inner(input: ParseStream, attrs: &mut Vec) -> Result<()> { + while input.peek(Token![#]) && input.peek2(Token![!]) { + attrs.push(input.call(parsing::single_parse_inner)?); + } + Ok(()) + } + + pub fn single_parse_inner(input: ParseStream) -> Result { + let content; + Ok(Attribute { + pound_token: input.parse()?, + style: AttrStyle::Inner(input.parse()?), + bracket_token: bracketed!(content in input), + path: content.call(Path::parse_mod_style)?, + tokens: content.parse()?, + }) + } + + pub fn single_parse_outer(input: ParseStream) -> Result { + let content; + Ok(Attribute { + pound_token: input.parse()?, + style: AttrStyle::Outer, + bracket_token: bracketed!(content in input), + path: content.call(Path::parse_mod_style)?, + tokens: content.parse()?, + }) + } + + // Like Path::parse_mod_style but accepts keywords in the path. + fn parse_meta_path(input: ParseStream) -> Result { + Ok(Path { + leading_colon: input.parse()?, + segments: { + let mut segments = Punctuated::new(); + while input.peek(Ident::peek_any) { + let ident = Ident::parse_any(input)?; + segments.push_value(PathSegment::from(ident)); + if !input.peek(Token![::]) { + break; + } + let punct = input.parse()?; + segments.push_punct(punct); + } + if segments.is_empty() { + return Err(input.error("expected path")); + } else if segments.trailing_punct() { + return Err(input.error("expected path segment")); + } + segments + }, + }) + } + + #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] + impl Parse for Meta { + fn parse(input: ParseStream) -> Result { + let path = input.call(parse_meta_path)?; + parse_meta_after_path(path, input) + } + } + + #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] + impl Parse for MetaList { + fn parse(input: ParseStream) -> Result { + let path = input.call(parse_meta_path)?; + parse_meta_list_after_path(path, input) + } + } + + #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] + impl Parse for MetaNameValue { + fn parse(input: ParseStream) -> Result { + let path = input.call(parse_meta_path)?; + parse_meta_name_value_after_path(path, input) + } + } + + #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] + impl Parse for NestedMeta { + fn parse(input: ParseStream) -> Result { + if input.peek(Lit) && !(input.peek(LitBool) && input.peek2(Token![=])) { + input.parse().map(NestedMeta::Lit) + } else if input.peek(Ident::peek_any) + || input.peek(Token![::]) && input.peek3(Ident::peek_any) + { + input.parse().map(NestedMeta::Meta) + } else { + Err(input.error("expected identifier or literal")) + } + } + } + + pub fn parse_meta_after_path(path: Path, input: ParseStream) -> Result { + if input.peek(token::Paren) { + parse_meta_list_after_path(path, input).map(Meta::List) + } else if input.peek(Token![=]) { + parse_meta_name_value_after_path(path, input).map(Meta::NameValue) + } else { + Ok(Meta::Path(path)) + } + } + + fn parse_meta_list_after_path(path: Path, input: ParseStream) -> Result { + let content; + Ok(MetaList { + path, + paren_token: parenthesized!(content in input), + nested: content.parse_terminated(NestedMeta::parse)?, + }) + } + + fn parse_meta_name_value_after_path(path: Path, input: ParseStream) -> Result { + Ok(MetaNameValue { + path, + eq_token: input.parse()?, + lit: input.parse()?, + }) + } +} + +#[cfg(feature = "printing")] +mod printing { + use super::*; + use proc_macro2::TokenStream; + use quote::ToTokens; + + #[cfg_attr(doc_cfg, doc(cfg(feature = "printing")))] + impl ToTokens for Attribute { + fn to_tokens(&self, tokens: &mut TokenStream) { + self.pound_token.to_tokens(tokens); + if let AttrStyle::Inner(b) = &self.style { + b.to_tokens(tokens); + } + self.bracket_token.surround(tokens, |tokens| { + self.path.to_tokens(tokens); + self.tokens.to_tokens(tokens); + }); + } + } + + #[cfg_attr(doc_cfg, doc(cfg(feature = "printing")))] + impl ToTokens for MetaList { + fn to_tokens(&self, tokens: &mut TokenStream) { + self.path.to_tokens(tokens); + self.paren_token.surround(tokens, |tokens| { + self.nested.to_tokens(tokens); + }); + } + } + + #[cfg_attr(doc_cfg, doc(cfg(feature = "printing")))] + impl ToTokens for MetaNameValue { + fn to_tokens(&self, tokens: &mut TokenStream) { + self.path.to_tokens(tokens); + self.eq_token.to_tokens(tokens); + self.lit.to_tokens(tokens); + } + } +} diff --git a/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/await.rs b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/await.rs new file mode 100644 index 000000000000..038c6a5d12cd --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/await.rs @@ -0,0 +1,2 @@ +// See include!("await.rs") in token.rs. +export_token_macro! {[await]} diff --git a/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/bigint.rs b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/bigint.rs new file mode 100644 index 000000000000..5397d6beee1d --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/bigint.rs @@ -0,0 +1,66 @@ +use std::ops::{AddAssign, MulAssign}; + +// For implementing base10_digits() accessor on LitInt. +pub struct BigInt { + digits: Vec, +} + +impl BigInt { + pub fn new() -> Self { + BigInt { digits: Vec::new() } + } + + pub fn to_string(&self) -> String { + let mut repr = String::with_capacity(self.digits.len()); + + let mut has_nonzero = false; + for digit in self.digits.iter().rev() { + has_nonzero |= *digit != 0; + if has_nonzero { + repr.push((*digit + b'0') as char); + } + } + + if repr.is_empty() { + repr.push('0'); + } + + repr + } + + fn reserve_two_digits(&mut self) { + let len = self.digits.len(); + let desired = + len + !self.digits.ends_with(&[0, 0]) as usize + !self.digits.ends_with(&[0]) as usize; + self.digits.resize(desired, 0); + } +} + +impl AddAssign for BigInt { + // Assumes increment <16. + fn add_assign(&mut self, mut increment: u8) { + self.reserve_two_digits(); + + let mut i = 0; + while increment > 0 { + let sum = self.digits[i] + increment; + self.digits[i] = sum % 10; + increment = sum / 10; + i += 1; + } + } +} + +impl MulAssign for BigInt { + // Assumes base <=16. + fn mul_assign(&mut self, base: u8) { + self.reserve_two_digits(); + + let mut carry = 0; + for digit in &mut self.digits { + let prod = *digit * base + carry; + *digit = prod % 10; + carry = prod / 10; + } + } +} diff --git a/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/buffer.rs b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/buffer.rs new file mode 100644 index 000000000000..0d5cf30d5794 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/buffer.rs @@ -0,0 +1,398 @@ +//! A stably addressed token buffer supporting efficient traversal based on a +//! cheaply copyable cursor. +//! +//! *This module is available only if Syn is built with the `"parsing"` feature.* + +// This module is heavily commented as it contains most of the unsafe code in +// Syn, and caution should be used when editing it. The public-facing interface +// is 100% safe but the implementation is fragile internally. + +#[cfg(all( + not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "wasi"))), + feature = "proc-macro" +))] +use crate::proc_macro as pm; +use crate::Lifetime; +use proc_macro2::{Delimiter, Group, Ident, Literal, Punct, Spacing, Span, TokenStream, TokenTree}; +use std::cmp::Ordering; +use std::marker::PhantomData; + +/// Internal type which is used instead of `TokenTree` to represent a token tree +/// within a `TokenBuffer`. +enum Entry { + // Mimicking types from proc-macro. + // Group entries contain the offset to the matching End entry. + Group(Group, usize), + Ident(Ident), + Punct(Punct), + Literal(Literal), + // End entries contain the offset (negative) to the start of the buffer. + End(isize), +} + +/// A buffer that can be efficiently traversed multiple times, unlike +/// `TokenStream` which requires a deep copy in order to traverse more than +/// once. +/// +/// *This type is available only if Syn is built with the `"parsing"` feature.* +pub struct TokenBuffer { + // NOTE: Do not implement clone on this - while the current design could be + // cloned, other designs which could be desirable may not be cloneable. + entries: Box<[Entry]>, +} + +impl TokenBuffer { + fn recursive_new(entries: &mut Vec, stream: TokenStream) { + for tt in stream { + match tt { + TokenTree::Ident(ident) => entries.push(Entry::Ident(ident)), + TokenTree::Punct(punct) => entries.push(Entry::Punct(punct)), + TokenTree::Literal(literal) => entries.push(Entry::Literal(literal)), + TokenTree::Group(group) => { + let group_start_index = entries.len(); + entries.push(Entry::End(0)); // we replace this below + Self::recursive_new(entries, group.stream()); + let group_end_index = entries.len(); + entries.push(Entry::End(-(group_end_index as isize))); + let group_end_offset = group_end_index - group_start_index; + entries[group_start_index] = Entry::Group(group, group_end_offset); + } + } + } + } + + /// Creates a `TokenBuffer` containing all the tokens from the input + /// `proc_macro::TokenStream`. + /// + /// *This method is available only if Syn is built with both the `"parsing"` and + /// `"proc-macro"` features.* + #[cfg(all( + not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "wasi"))), + feature = "proc-macro" + ))] + pub fn new(stream: pm::TokenStream) -> Self { + Self::new2(stream.into()) + } + + /// Creates a `TokenBuffer` containing all the tokens from the input + /// `proc_macro2::TokenStream`. + pub fn new2(stream: TokenStream) -> Self { + let mut entries = Vec::new(); + Self::recursive_new(&mut entries, stream); + entries.push(Entry::End(-(entries.len() as isize))); + Self { + entries: entries.into_boxed_slice(), + } + } + + /// Creates a cursor referencing the first token in the buffer and able to + /// traverse until the end of the buffer. + pub fn begin(&self) -> Cursor { + let ptr = self.entries.as_ptr(); + unsafe { Cursor::create(ptr, ptr.add(self.entries.len() - 1)) } + } +} + +/// A cheaply copyable cursor into a `TokenBuffer`. +/// +/// This cursor holds a shared reference into the immutable data which is used +/// internally to represent a `TokenStream`, and can be efficiently manipulated +/// and copied around. +/// +/// An empty `Cursor` can be created directly, or one may create a `TokenBuffer` +/// object and get a cursor to its first token with `begin()`. +/// +/// Two cursors are equal if they have the same location in the same input +/// stream, and have the same scope. +/// +/// *This type is available only if Syn is built with the `"parsing"` feature.* +pub struct Cursor<'a> { + // The current entry which the `Cursor` is pointing at. + ptr: *const Entry, + // This is the only `Entry::End` object which this cursor is allowed to + // point at. All other `End` objects are skipped over in `Cursor::create`. + scope: *const Entry, + // Cursor is covariant in 'a. This field ensures that our pointers are still + // valid. + marker: PhantomData<&'a Entry>, +} + +impl<'a> Cursor<'a> { + /// Creates a cursor referencing a static empty TokenStream. + pub fn empty() -> Self { + // It's safe in this situation for us to put an `Entry` object in global + // storage, despite it not actually being safe to send across threads + // (`Ident` is a reference into a thread-local table). This is because + // this entry never includes a `Ident` object. + // + // This wrapper struct allows us to break the rules and put a `Sync` + // object in global storage. + struct UnsafeSyncEntry(Entry); + unsafe impl Sync for UnsafeSyncEntry {} + static EMPTY_ENTRY: UnsafeSyncEntry = UnsafeSyncEntry(Entry::End(0)); + + Cursor { + ptr: &EMPTY_ENTRY.0, + scope: &EMPTY_ENTRY.0, + marker: PhantomData, + } + } + + /// This create method intelligently exits non-explicitly-entered + /// `None`-delimited scopes when the cursor reaches the end of them, + /// allowing for them to be treated transparently. + unsafe fn create(mut ptr: *const Entry, scope: *const Entry) -> Self { + // NOTE: If we're looking at a `End`, we want to advance the cursor + // past it, unless `ptr == scope`, which means that we're at the edge of + // our cursor's scope. We should only have `ptr != scope` at the exit + // from None-delimited groups entered with `ignore_none`. + while let Entry::End(_) = *ptr { + if ptr == scope { + break; + } + ptr = ptr.add(1); + } + + Cursor { + ptr, + scope, + marker: PhantomData, + } + } + + /// Get the current entry. + fn entry(self) -> &'a Entry { + unsafe { &*self.ptr } + } + + /// Bump the cursor to point at the next token after the current one. This + /// is undefined behavior if the cursor is currently looking at an + /// `Entry::End`. + /// + /// If the cursor is looking at an `Entry::Group`, the bumped cursor will + /// point at the first token in the group (with the same scope end). + unsafe fn bump_ignore_group(self) -> Cursor<'a> { + Cursor::create(self.ptr.offset(1), self.scope) + } + + /// While the cursor is looking at a `None`-delimited group, move it to look + /// at the first token inside instead. If the group is empty, this will move + /// the cursor past the `None`-delimited group. + /// + /// WARNING: This mutates its argument. + fn ignore_none(&mut self) { + while let Entry::Group(group, _) = self.entry() { + if group.delimiter() == Delimiter::None { + unsafe { *self = self.bump_ignore_group() }; + } else { + break; + } + } + } + + /// Checks whether the cursor is currently pointing at the end of its valid + /// scope. + pub fn eof(self) -> bool { + // We're at eof if we're at the end of our scope. + self.ptr == self.scope + } + + /// If the cursor is pointing at a `Group` with the given delimiter, returns + /// a cursor into that group and one pointing to the next `TokenTree`. + pub fn group(mut self, delim: Delimiter) -> Option<(Cursor<'a>, Span, Cursor<'a>)> { + // If we're not trying to enter a none-delimited group, we want to + // ignore them. We have to make sure to _not_ ignore them when we want + // to enter them, of course. For obvious reasons. + if delim != Delimiter::None { + self.ignore_none(); + } + + if let Entry::Group(group, end_offset) = self.entry() { + if group.delimiter() == delim { + let end_of_group = unsafe { self.ptr.add(*end_offset) }; + let inside_of_group = unsafe { Cursor::create(self.ptr.add(1), end_of_group) }; + let after_group = unsafe { Cursor::create(end_of_group, self.scope) }; + return Some((inside_of_group, group.span(), after_group)); + } + } + + None + } + + /// If the cursor is pointing at a `Ident`, returns it along with a cursor + /// pointing at the next `TokenTree`. + pub fn ident(mut self) -> Option<(Ident, Cursor<'a>)> { + self.ignore_none(); + match self.entry() { + Entry::Ident(ident) => Some((ident.clone(), unsafe { self.bump_ignore_group() })), + _ => None, + } + } + + /// If the cursor is pointing at a `Punct`, returns it along with a cursor + /// pointing at the next `TokenTree`. + pub fn punct(mut self) -> Option<(Punct, Cursor<'a>)> { + self.ignore_none(); + match self.entry() { + Entry::Punct(punct) if punct.as_char() != '\'' => { + Some((punct.clone(), unsafe { self.bump_ignore_group() })) + } + _ => None, + } + } + + /// If the cursor is pointing at a `Literal`, return it along with a cursor + /// pointing at the next `TokenTree`. + pub fn literal(mut self) -> Option<(Literal, Cursor<'a>)> { + self.ignore_none(); + match self.entry() { + Entry::Literal(literal) => Some((literal.clone(), unsafe { self.bump_ignore_group() })), + _ => None, + } + } + + /// If the cursor is pointing at a `Lifetime`, returns it along with a + /// cursor pointing at the next `TokenTree`. + pub fn lifetime(mut self) -> Option<(Lifetime, Cursor<'a>)> { + self.ignore_none(); + match self.entry() { + Entry::Punct(punct) if punct.as_char() == '\'' && punct.spacing() == Spacing::Joint => { + let next = unsafe { self.bump_ignore_group() }; + let (ident, rest) = next.ident()?; + let lifetime = Lifetime { + apostrophe: punct.span(), + ident, + }; + Some((lifetime, rest)) + } + _ => None, + } + } + + /// Copies all remaining tokens visible from this cursor into a + /// `TokenStream`. + pub fn token_stream(self) -> TokenStream { + let mut tts = Vec::new(); + let mut cursor = self; + while let Some((tt, rest)) = cursor.token_tree() { + tts.push(tt); + cursor = rest; + } + tts.into_iter().collect() + } + + /// If the cursor is pointing at a `TokenTree`, returns it along with a + /// cursor pointing at the next `TokenTree`. + /// + /// Returns `None` if the cursor has reached the end of its stream. + /// + /// This method does not treat `None`-delimited groups as transparent, and + /// will return a `Group(None, ..)` if the cursor is looking at one. + pub fn token_tree(self) -> Option<(TokenTree, Cursor<'a>)> { + let (tree, len) = match self.entry() { + Entry::Group(group, end_offset) => (group.clone().into(), *end_offset), + Entry::Literal(literal) => (literal.clone().into(), 1), + Entry::Ident(ident) => (ident.clone().into(), 1), + Entry::Punct(punct) => (punct.clone().into(), 1), + Entry::End(_) => return None, + }; + + let rest = unsafe { Cursor::create(self.ptr.add(len), self.scope) }; + Some((tree, rest)) + } + + /// Returns the `Span` of the current token, or `Span::call_site()` if this + /// cursor points to eof. + pub fn span(self) -> Span { + match self.entry() { + Entry::Group(group, _) => group.span(), + Entry::Literal(literal) => literal.span(), + Entry::Ident(ident) => ident.span(), + Entry::Punct(punct) => punct.span(), + Entry::End(_) => Span::call_site(), + } + } + + /// Skip over the next token without cloning it. Returns `None` if this + /// cursor points to eof. + /// + /// This method treats `'lifetimes` as a single token. + pub(crate) fn skip(self) -> Option> { + let len = match self.entry() { + Entry::End(_) => return None, + + // Treat lifetimes as a single tt for the purposes of 'skip'. + Entry::Punct(punct) if punct.as_char() == '\'' && punct.spacing() == Spacing::Joint => { + match unsafe { &*self.ptr.add(1) } { + Entry::Ident(_) => 2, + _ => 1, + } + } + + Entry::Group(_, end_offset) => *end_offset, + _ => 1, + }; + + Some(unsafe { Cursor::create(self.ptr.add(len), self.scope) }) + } +} + +impl<'a> Copy for Cursor<'a> {} + +impl<'a> Clone for Cursor<'a> { + fn clone(&self) -> Self { + *self + } +} + +impl<'a> Eq for Cursor<'a> {} + +impl<'a> PartialEq for Cursor<'a> { + fn eq(&self, other: &Self) -> bool { + self.ptr == other.ptr + } +} + +impl<'a> PartialOrd for Cursor<'a> { + fn partial_cmp(&self, other: &Self) -> Option { + if same_buffer(*self, *other) { + Some(self.ptr.cmp(&other.ptr)) + } else { + None + } + } +} + +pub(crate) fn same_scope(a: Cursor, b: Cursor) -> bool { + a.scope == b.scope +} + +pub(crate) fn same_buffer(a: Cursor, b: Cursor) -> bool { + unsafe { + match (&*a.scope, &*b.scope) { + (Entry::End(a_offset), Entry::End(b_offset)) => { + a.scope.offset(*a_offset) == b.scope.offset(*b_offset) + } + _ => unreachable!(), + } + } +} + +#[cfg(any(feature = "full", feature = "derive"))] +pub(crate) fn cmp_assuming_same_buffer(a: Cursor, b: Cursor) -> Ordering { + a.ptr.cmp(&b.ptr) +} + +pub(crate) fn open_span_of_group(cursor: Cursor) -> Span { + match cursor.entry() { + Entry::Group(group, _) => group.span_open(), + _ => cursor.span(), + } +} + +pub(crate) fn close_span_of_group(cursor: Cursor) -> Span { + match cursor.entry() { + Entry::Group(group, _) => group.span_close(), + _ => cursor.span(), + } +} diff --git a/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/custom_keyword.rs b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/custom_keyword.rs new file mode 100644 index 000000000000..a3ec9d4cb701 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/custom_keyword.rs @@ -0,0 +1,253 @@ +/// Define a type that supports parsing and printing a given identifier as if it +/// were a keyword. +/// +/// # Usage +/// +/// As a convention, it is recommended that this macro be invoked within a +/// module called `kw` or `keyword` and that the resulting parser be invoked +/// with a `kw::` or `keyword::` prefix. +/// +/// ``` +/// mod kw { +/// syn::custom_keyword!(whatever); +/// } +/// ``` +/// +/// The generated syntax tree node supports the following operations just like +/// any built-in keyword token. +/// +/// - [Peeking] — `input.peek(kw::whatever)` +/// +/// - [Parsing] — `input.parse::()?` +/// +/// - [Printing] — `quote!( ... #whatever_token ... )` +/// +/// - Construction from a [`Span`] — `let whatever_token = kw::whatever(sp)` +/// +/// - Field access to its span — `let sp = whatever_token.span` +/// +/// [Peeking]: crate::parse::ParseBuffer::peek +/// [Parsing]: crate::parse::ParseBuffer::parse +/// [Printing]: quote::ToTokens +/// [`Span`]: proc_macro2::Span +/// +/// # Example +/// +/// This example parses input that looks like `bool = true` or `str = "value"`. +/// The key must be either the identifier `bool` or the identifier `str`. If +/// `bool`, the value may be either `true` or `false`. If `str`, the value may +/// be any string literal. +/// +/// The symbols `bool` and `str` are not reserved keywords in Rust so these are +/// not considered keywords in the `syn::token` module. Like any other +/// identifier that is not a keyword, these can be declared as custom keywords +/// by crates that need to use them as such. +/// +/// ``` +/// use syn::{LitBool, LitStr, Result, Token}; +/// use syn::parse::{Parse, ParseStream}; +/// +/// mod kw { +/// syn::custom_keyword!(bool); +/// syn::custom_keyword!(str); +/// } +/// +/// enum Argument { +/// Bool { +/// bool_token: kw::bool, +/// eq_token: Token![=], +/// value: LitBool, +/// }, +/// Str { +/// str_token: kw::str, +/// eq_token: Token![=], +/// value: LitStr, +/// }, +/// } +/// +/// impl Parse for Argument { +/// fn parse(input: ParseStream) -> Result { +/// let lookahead = input.lookahead1(); +/// if lookahead.peek(kw::bool) { +/// Ok(Argument::Bool { +/// bool_token: input.parse::()?, +/// eq_token: input.parse()?, +/// value: input.parse()?, +/// }) +/// } else if lookahead.peek(kw::str) { +/// Ok(Argument::Str { +/// str_token: input.parse::()?, +/// eq_token: input.parse()?, +/// value: input.parse()?, +/// }) +/// } else { +/// Err(lookahead.error()) +/// } +/// } +/// } +/// ``` +#[macro_export] +macro_rules! custom_keyword { + ($ident:ident) => { + #[allow(non_camel_case_types)] + pub struct $ident { + pub span: $crate::__private::Span, + } + + #[doc(hidden)] + #[allow(dead_code, non_snake_case)] + pub fn $ident<__S: $crate::__private::IntoSpans<[$crate::__private::Span; 1]>>( + span: __S, + ) -> $ident { + $ident { + span: $crate::__private::IntoSpans::into_spans(span)[0], + } + } + + impl $crate::__private::Default for $ident { + fn default() -> Self { + $ident { + span: $crate::__private::Span::call_site(), + } + } + } + + $crate::impl_parse_for_custom_keyword!($ident); + $crate::impl_to_tokens_for_custom_keyword!($ident); + $crate::impl_clone_for_custom_keyword!($ident); + $crate::impl_extra_traits_for_custom_keyword!($ident); + }; +} + +// Not public API. +#[cfg(feature = "parsing")] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_parse_for_custom_keyword { + ($ident:ident) => { + // For peek. + impl $crate::token::CustomToken for $ident { + fn peek(cursor: $crate::buffer::Cursor) -> $crate::__private::bool { + if let $crate::__private::Some((ident, _rest)) = cursor.ident() { + ident == stringify!($ident) + } else { + false + } + } + + fn display() -> &'static $crate::__private::str { + concat!("`", stringify!($ident), "`") + } + } + + impl $crate::parse::Parse for $ident { + fn parse(input: $crate::parse::ParseStream) -> $crate::parse::Result<$ident> { + input.step(|cursor| { + if let $crate::__private::Some((ident, rest)) = cursor.ident() { + if ident == stringify!($ident) { + return $crate::__private::Ok(($ident { span: ident.span() }, rest)); + } + } + $crate::__private::Err(cursor.error(concat!( + "expected `", + stringify!($ident), + "`" + ))) + }) + } + } + }; +} + +// Not public API. +#[cfg(not(feature = "parsing"))] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_parse_for_custom_keyword { + ($ident:ident) => {}; +} + +// Not public API. +#[cfg(feature = "printing")] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_to_tokens_for_custom_keyword { + ($ident:ident) => { + impl $crate::__private::ToTokens for $ident { + fn to_tokens(&self, tokens: &mut $crate::__private::TokenStream2) { + let ident = $crate::Ident::new(stringify!($ident), self.span); + $crate::__private::TokenStreamExt::append(tokens, ident); + } + } + }; +} + +// Not public API. +#[cfg(not(feature = "printing"))] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_to_tokens_for_custom_keyword { + ($ident:ident) => {}; +} + +// Not public API. +#[cfg(feature = "clone-impls")] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_clone_for_custom_keyword { + ($ident:ident) => { + impl $crate::__private::Copy for $ident {} + + #[allow(clippy::expl_impl_clone_on_copy)] + impl $crate::__private::Clone for $ident { + fn clone(&self) -> Self { + *self + } + } + }; +} + +// Not public API. +#[cfg(not(feature = "clone-impls"))] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_clone_for_custom_keyword { + ($ident:ident) => {}; +} + +// Not public API. +#[cfg(feature = "extra-traits")] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_extra_traits_for_custom_keyword { + ($ident:ident) => { + impl $crate::__private::Debug for $ident { + fn fmt(&self, f: &mut $crate::__private::Formatter) -> $crate::__private::fmt::Result { + $crate::__private::Formatter::write_str( + f, + concat!("Keyword [", stringify!($ident), "]"), + ) + } + } + + impl $crate::__private::Eq for $ident {} + + impl $crate::__private::PartialEq for $ident { + fn eq(&self, _other: &Self) -> $crate::__private::bool { + true + } + } + + impl $crate::__private::Hash for $ident { + fn hash<__H: $crate::__private::Hasher>(&self, _state: &mut __H) {} + } + }; +} + +// Not public API. +#[cfg(not(feature = "extra-traits"))] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_extra_traits_for_custom_keyword { + ($ident:ident) => {}; +} diff --git a/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/custom_punctuation.rs b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/custom_punctuation.rs new file mode 100644 index 000000000000..118a8453daab --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/custom_punctuation.rs @@ -0,0 +1,300 @@ +/// Define a type that supports parsing and printing a multi-character symbol +/// as if it were a punctuation token. +/// +/// # Usage +/// +/// ``` +/// syn::custom_punctuation!(LeftRightArrow, <=>); +/// ``` +/// +/// The generated syntax tree node supports the following operations just like +/// any built-in punctuation token. +/// +/// - [Peeking] — `input.peek(LeftRightArrow)` +/// +/// - [Parsing] — `input.parse::()?` +/// +/// - [Printing] — `quote!( ... #lrarrow ... )` +/// +/// - Construction from a [`Span`] — `let lrarrow = LeftRightArrow(sp)` +/// +/// - Construction from multiple [`Span`] — `let lrarrow = LeftRightArrow([sp, sp, sp])` +/// +/// - Field access to its spans — `let spans = lrarrow.spans` +/// +/// [Peeking]: crate::parse::ParseBuffer::peek +/// [Parsing]: crate::parse::ParseBuffer::parse +/// [Printing]: quote::ToTokens +/// [`Span`]: proc_macro2::Span +/// +/// # Example +/// +/// ``` +/// use proc_macro2::{TokenStream, TokenTree}; +/// use syn::parse::{Parse, ParseStream, Peek, Result}; +/// use syn::punctuated::Punctuated; +/// use syn::Expr; +/// +/// syn::custom_punctuation!(PathSeparator, ); +/// +/// // expr expr expr ... +/// struct PathSegments { +/// segments: Punctuated, +/// } +/// +/// impl Parse for PathSegments { +/// fn parse(input: ParseStream) -> Result { +/// let mut segments = Punctuated::new(); +/// +/// let first = parse_until(input, PathSeparator)?; +/// segments.push_value(syn::parse2(first)?); +/// +/// while input.peek(PathSeparator) { +/// segments.push_punct(input.parse()?); +/// +/// let next = parse_until(input, PathSeparator)?; +/// segments.push_value(syn::parse2(next)?); +/// } +/// +/// Ok(PathSegments { segments }) +/// } +/// } +/// +/// fn parse_until(input: ParseStream, end: E) -> Result { +/// let mut tokens = TokenStream::new(); +/// while !input.is_empty() && !input.peek(end) { +/// let next: TokenTree = input.parse()?; +/// tokens.extend(Some(next)); +/// } +/// Ok(tokens) +/// } +/// +/// fn main() { +/// let input = r#" a::b c::d::e "#; +/// let _: PathSegments = syn::parse_str(input).unwrap(); +/// } +/// ``` +#[macro_export] +macro_rules! custom_punctuation { + ($ident:ident, $($tt:tt)+) => { + pub struct $ident { + pub spans: $crate::custom_punctuation_repr!($($tt)+), + } + + #[doc(hidden)] + #[allow(dead_code, non_snake_case)] + pub fn $ident<__S: $crate::__private::IntoSpans<$crate::custom_punctuation_repr!($($tt)+)>>( + spans: __S, + ) -> $ident { + let _validate_len = 0 $(+ $crate::custom_punctuation_len!(strict, $tt))*; + $ident { + spans: $crate::__private::IntoSpans::into_spans(spans) + } + } + + impl $crate::__private::Default for $ident { + fn default() -> Self { + $ident($crate::__private::Span::call_site()) + } + } + + $crate::impl_parse_for_custom_punctuation!($ident, $($tt)+); + $crate::impl_to_tokens_for_custom_punctuation!($ident, $($tt)+); + $crate::impl_clone_for_custom_punctuation!($ident, $($tt)+); + $crate::impl_extra_traits_for_custom_punctuation!($ident, $($tt)+); + }; +} + +// Not public API. +#[cfg(feature = "parsing")] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_parse_for_custom_punctuation { + ($ident:ident, $($tt:tt)+) => { + impl $crate::token::CustomToken for $ident { + fn peek(cursor: $crate::buffer::Cursor) -> bool { + $crate::token::parsing::peek_punct(cursor, $crate::stringify_punct!($($tt)+)) + } + + fn display() -> &'static $crate::__private::str { + concat!("`", $crate::stringify_punct!($($tt)+), "`") + } + } + + impl $crate::parse::Parse for $ident { + fn parse(input: $crate::parse::ParseStream) -> $crate::parse::Result<$ident> { + let spans: $crate::custom_punctuation_repr!($($tt)+) = + $crate::token::parsing::punct(input, $crate::stringify_punct!($($tt)+))?; + Ok($ident(spans)) + } + } + }; +} + +// Not public API. +#[cfg(not(feature = "parsing"))] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_parse_for_custom_punctuation { + ($ident:ident, $($tt:tt)+) => {}; +} + +// Not public API. +#[cfg(feature = "printing")] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_to_tokens_for_custom_punctuation { + ($ident:ident, $($tt:tt)+) => { + impl $crate::__private::ToTokens for $ident { + fn to_tokens(&self, tokens: &mut $crate::__private::TokenStream2) { + $crate::token::printing::punct($crate::stringify_punct!($($tt)+), &self.spans, tokens) + } + } + }; +} + +// Not public API. +#[cfg(not(feature = "printing"))] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_to_tokens_for_custom_punctuation { + ($ident:ident, $($tt:tt)+) => {}; +} + +// Not public API. +#[cfg(feature = "clone-impls")] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_clone_for_custom_punctuation { + ($ident:ident, $($tt:tt)+) => { + impl $crate::__private::Copy for $ident {} + + #[allow(clippy::expl_impl_clone_on_copy)] + impl $crate::__private::Clone for $ident { + fn clone(&self) -> Self { + *self + } + } + }; +} + +// Not public API. +#[cfg(not(feature = "clone-impls"))] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_clone_for_custom_punctuation { + ($ident:ident, $($tt:tt)+) => {}; +} + +// Not public API. +#[cfg(feature = "extra-traits")] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_extra_traits_for_custom_punctuation { + ($ident:ident, $($tt:tt)+) => { + impl $crate::__private::Debug for $ident { + fn fmt(&self, f: &mut $crate::__private::Formatter) -> $crate::__private::fmt::Result { + $crate::__private::Formatter::write_str(f, stringify!($ident)) + } + } + + impl $crate::__private::Eq for $ident {} + + impl $crate::__private::PartialEq for $ident { + fn eq(&self, _other: &Self) -> $crate::__private::bool { + true + } + } + + impl $crate::__private::Hash for $ident { + fn hash<__H: $crate::__private::Hasher>(&self, _state: &mut __H) {} + } + }; +} + +// Not public API. +#[cfg(not(feature = "extra-traits"))] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_extra_traits_for_custom_punctuation { + ($ident:ident, $($tt:tt)+) => {}; +} + +// Not public API. +#[doc(hidden)] +#[macro_export] +macro_rules! custom_punctuation_repr { + ($($tt:tt)+) => { + [$crate::__private::Span; 0 $(+ $crate::custom_punctuation_len!(lenient, $tt))+] + }; +} + +// Not public API. +#[doc(hidden)] +#[macro_export] +#[rustfmt::skip] +macro_rules! custom_punctuation_len { + ($mode:ident, +) => { 1 }; + ($mode:ident, +=) => { 2 }; + ($mode:ident, &) => { 1 }; + ($mode:ident, &&) => { 2 }; + ($mode:ident, &=) => { 2 }; + ($mode:ident, @) => { 1 }; + ($mode:ident, !) => { 1 }; + ($mode:ident, ^) => { 1 }; + ($mode:ident, ^=) => { 2 }; + ($mode:ident, :) => { 1 }; + ($mode:ident, ::) => { 2 }; + ($mode:ident, ,) => { 1 }; + ($mode:ident, /) => { 1 }; + ($mode:ident, /=) => { 2 }; + ($mode:ident, .) => { 1 }; + ($mode:ident, ..) => { 2 }; + ($mode:ident, ...) => { 3 }; + ($mode:ident, ..=) => { 3 }; + ($mode:ident, =) => { 1 }; + ($mode:ident, ==) => { 2 }; + ($mode:ident, >=) => { 2 }; + ($mode:ident, >) => { 1 }; + ($mode:ident, <=) => { 2 }; + ($mode:ident, <) => { 1 }; + ($mode:ident, *=) => { 2 }; + ($mode:ident, !=) => { 2 }; + ($mode:ident, |) => { 1 }; + ($mode:ident, |=) => { 2 }; + ($mode:ident, ||) => { 2 }; + ($mode:ident, #) => { 1 }; + ($mode:ident, ?) => { 1 }; + ($mode:ident, ->) => { 2 }; + ($mode:ident, <-) => { 2 }; + ($mode:ident, %) => { 1 }; + ($mode:ident, %=) => { 2 }; + ($mode:ident, =>) => { 2 }; + ($mode:ident, ;) => { 1 }; + ($mode:ident, <<) => { 2 }; + ($mode:ident, <<=) => { 3 }; + ($mode:ident, >>) => { 2 }; + ($mode:ident, >>=) => { 3 }; + ($mode:ident, *) => { 1 }; + ($mode:ident, -) => { 1 }; + ($mode:ident, -=) => { 2 }; + ($mode:ident, ~) => { 1 }; + (lenient, $tt:tt) => { 0 }; + (strict, $tt:tt) => {{ $crate::custom_punctuation_unexpected!($tt); 0 }}; +} + +// Not public API. +#[doc(hidden)] +#[macro_export] +macro_rules! custom_punctuation_unexpected { + () => {}; +} + +// Not public API. +#[doc(hidden)] +#[macro_export] +macro_rules! stringify_punct { + ($($tt:tt)+) => { + concat!($(stringify!($tt)),+) + }; +} diff --git a/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/data.rs b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/data.rs new file mode 100644 index 000000000000..3b466618f8ab --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/data.rs @@ -0,0 +1,493 @@ +use super::*; +use crate::punctuated::Punctuated; + +ast_struct! { + /// An enum variant. + /// + /// *This type is available only if Syn is built with the `"derive"` or `"full"` + /// feature.* + #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] + pub struct Variant { + /// Attributes tagged on the variant. + pub attrs: Vec, + + /// Name of the variant. + pub ident: Ident, + + /// Content stored in the variant. + pub fields: Fields, + + /// Explicit discriminant: `Variant = 1` + pub discriminant: Option<(Token![=], Expr)>, + } +} + +ast_enum_of_structs! { + /// Data stored within an enum variant or struct. + /// + /// *This type is available only if Syn is built with the `"derive"` or `"full"` + /// feature.* + /// + /// # Syntax tree enum + /// + /// This type is a [syntax tree enum]. + /// + /// [syntax tree enum]: Expr#syntax-tree-enums + #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] + pub enum Fields { + /// Named fields of a struct or struct variant such as `Point { x: f64, + /// y: f64 }`. + Named(FieldsNamed), + + /// Unnamed fields of a tuple struct or tuple variant such as `Some(T)`. + Unnamed(FieldsUnnamed), + + /// Unit struct or unit variant such as `None`. + Unit, + } +} + +ast_struct! { + /// Named fields of a struct or struct variant such as `Point { x: f64, + /// y: f64 }`. + /// + /// *This type is available only if Syn is built with the `"derive"` or + /// `"full"` feature.* + #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] + pub struct FieldsNamed { + pub brace_token: token::Brace, + pub named: Punctuated, + } +} + +ast_struct! { + /// Unnamed fields of a tuple struct or tuple variant such as `Some(T)`. + /// + /// *This type is available only if Syn is built with the `"derive"` or + /// `"full"` feature.* + #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] + pub struct FieldsUnnamed { + pub paren_token: token::Paren, + pub unnamed: Punctuated, + } +} + +impl Fields { + /// Get an iterator over the borrowed [`Field`] items in this object. This + /// iterator can be used to iterate over a named or unnamed struct or + /// variant's fields uniformly. + pub fn iter(&self) -> punctuated::Iter { + match self { + Fields::Unit => crate::punctuated::empty_punctuated_iter(), + Fields::Named(f) => f.named.iter(), + Fields::Unnamed(f) => f.unnamed.iter(), + } + } + + /// Get an iterator over the mutably borrowed [`Field`] items in this + /// object. This iterator can be used to iterate over a named or unnamed + /// struct or variant's fields uniformly. + pub fn iter_mut(&mut self) -> punctuated::IterMut { + match self { + Fields::Unit => crate::punctuated::empty_punctuated_iter_mut(), + Fields::Named(f) => f.named.iter_mut(), + Fields::Unnamed(f) => f.unnamed.iter_mut(), + } + } + + /// Returns the number of fields. + pub fn len(&self) -> usize { + match self { + Fields::Unit => 0, + Fields::Named(f) => f.named.len(), + Fields::Unnamed(f) => f.unnamed.len(), + } + } + + /// Returns `true` if there are zero fields. + pub fn is_empty(&self) -> bool { + match self { + Fields::Unit => true, + Fields::Named(f) => f.named.is_empty(), + Fields::Unnamed(f) => f.unnamed.is_empty(), + } + } +} + +impl IntoIterator for Fields { + type Item = Field; + type IntoIter = punctuated::IntoIter; + + fn into_iter(self) -> Self::IntoIter { + match self { + Fields::Unit => Punctuated::::new().into_iter(), + Fields::Named(f) => f.named.into_iter(), + Fields::Unnamed(f) => f.unnamed.into_iter(), + } + } +} + +impl<'a> IntoIterator for &'a Fields { + type Item = &'a Field; + type IntoIter = punctuated::Iter<'a, Field>; + + fn into_iter(self) -> Self::IntoIter { + self.iter() + } +} + +impl<'a> IntoIterator for &'a mut Fields { + type Item = &'a mut Field; + type IntoIter = punctuated::IterMut<'a, Field>; + + fn into_iter(self) -> Self::IntoIter { + self.iter_mut() + } +} + +ast_struct! { + /// A field of a struct or enum variant. + /// + /// *This type is available only if Syn is built with the `"derive"` or `"full"` + /// feature.* + #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] + pub struct Field { + /// Attributes tagged on the field. + pub attrs: Vec, + + /// Visibility of the field. + pub vis: Visibility, + + /// Name of the field, if any. + /// + /// Fields of tuple structs have no names. + pub ident: Option, + + pub colon_token: Option, + + /// Type of the field. + pub ty: Type, + } +} + +ast_enum_of_structs! { + /// The visibility level of an item: inherited or `pub` or + /// `pub(restricted)`. + /// + /// *This type is available only if Syn is built with the `"derive"` or `"full"` + /// feature.* + /// + /// # Syntax tree enum + /// + /// This type is a [syntax tree enum]. + /// + /// [syntax tree enum]: Expr#syntax-tree-enums + #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] + pub enum Visibility { + /// A public visibility level: `pub`. + Public(VisPublic), + + /// A crate-level visibility: `crate`. + Crate(VisCrate), + + /// A visibility level restricted to some path: `pub(self)` or + /// `pub(super)` or `pub(crate)` or `pub(in some::module)`. + Restricted(VisRestricted), + + /// An inherited visibility, which usually means private. + Inherited, + } +} + +ast_struct! { + /// A public visibility level: `pub`. + /// + /// *This type is available only if Syn is built with the `"derive"` or + /// `"full"` feature.* + #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] + pub struct VisPublic { + pub pub_token: Token![pub], + } +} + +ast_struct! { + /// A crate-level visibility: `crate`. + /// + /// *This type is available only if Syn is built with the `"derive"` or + /// `"full"` feature.* + #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] + pub struct VisCrate { + pub crate_token: Token![crate], + } +} + +ast_struct! { + /// A visibility level restricted to some path: `pub(self)` or + /// `pub(super)` or `pub(crate)` or `pub(in some::module)`. + /// + /// *This type is available only if Syn is built with the `"derive"` or + /// `"full"` feature.* + #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] + pub struct VisRestricted { + pub pub_token: Token![pub], + pub paren_token: token::Paren, + pub in_token: Option, + pub path: Box, + } +} + +#[cfg(feature = "parsing")] +pub mod parsing { + use super::*; + use crate::ext::IdentExt; + use crate::parse::discouraged::Speculative; + use crate::parse::{Parse, ParseStream, Result}; + + #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] + impl Parse for Variant { + fn parse(input: ParseStream) -> Result { + let attrs = input.call(Attribute::parse_outer)?; + let _visibility: Visibility = input.parse()?; + let ident: Ident = input.parse()?; + let fields = if input.peek(token::Brace) { + Fields::Named(input.parse()?) + } else if input.peek(token::Paren) { + Fields::Unnamed(input.parse()?) + } else { + Fields::Unit + }; + let discriminant = if input.peek(Token![=]) { + let eq_token: Token![=] = input.parse()?; + let discriminant: Expr = input.parse()?; + Some((eq_token, discriminant)) + } else { + None + }; + Ok(Variant { + attrs, + ident, + fields, + discriminant, + }) + } + } + + #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] + impl Parse for FieldsNamed { + fn parse(input: ParseStream) -> Result { + let content; + Ok(FieldsNamed { + brace_token: braced!(content in input), + named: content.parse_terminated(Field::parse_named)?, + }) + } + } + + #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] + impl Parse for FieldsUnnamed { + fn parse(input: ParseStream) -> Result { + let content; + Ok(FieldsUnnamed { + paren_token: parenthesized!(content in input), + unnamed: content.parse_terminated(Field::parse_unnamed)?, + }) + } + } + + impl Field { + /// Parses a named (braced struct) field. + #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] + pub fn parse_named(input: ParseStream) -> Result { + Ok(Field { + attrs: input.call(Attribute::parse_outer)?, + vis: input.parse()?, + ident: Some(if input.peek(Token![_]) { + input.call(Ident::parse_any) + } else { + input.parse() + }?), + colon_token: Some(input.parse()?), + ty: input.parse()?, + }) + } + + /// Parses an unnamed (tuple struct) field. + #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] + pub fn parse_unnamed(input: ParseStream) -> Result { + Ok(Field { + attrs: input.call(Attribute::parse_outer)?, + vis: input.parse()?, + ident: None, + colon_token: None, + ty: input.parse()?, + }) + } + } + + #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] + impl Parse for Visibility { + fn parse(input: ParseStream) -> Result { + // Recognize an empty None-delimited group, as produced by a $:vis + // matcher that matched no tokens. + if input.peek(token::Group) { + let ahead = input.fork(); + let group = crate::group::parse_group(&ahead)?; + if group.content.is_empty() { + input.advance_to(&ahead); + return Ok(Visibility::Inherited); + } + } + + if input.peek(Token![pub]) { + Self::parse_pub(input) + } else if input.peek(Token![crate]) { + Self::parse_crate(input) + } else { + Ok(Visibility::Inherited) + } + } + } + + impl Visibility { + fn parse_pub(input: ParseStream) -> Result { + let pub_token = input.parse::()?; + + if input.peek(token::Paren) { + let ahead = input.fork(); + + let content; + let paren_token = parenthesized!(content in ahead); + if content.peek(Token![crate]) + || content.peek(Token![self]) + || content.peek(Token![super]) + { + let path = content.call(Ident::parse_any)?; + + // Ensure there are no additional tokens within `content`. + // Without explicitly checking, we may misinterpret a tuple + // field as a restricted visibility, causing a parse error. + // e.g. `pub (crate::A, crate::B)` (Issue #720). + if content.is_empty() { + input.advance_to(&ahead); + return Ok(Visibility::Restricted(VisRestricted { + pub_token, + paren_token, + in_token: None, + path: Box::new(Path::from(path)), + })); + } + } else if content.peek(Token![in]) { + let in_token: Token![in] = content.parse()?; + let path = content.call(Path::parse_mod_style)?; + + input.advance_to(&ahead); + return Ok(Visibility::Restricted(VisRestricted { + pub_token, + paren_token, + in_token: Some(in_token), + path: Box::new(path), + })); + } + } + + Ok(Visibility::Public(VisPublic { pub_token })) + } + + fn parse_crate(input: ParseStream) -> Result { + if input.peek2(Token![::]) { + Ok(Visibility::Inherited) + } else { + Ok(Visibility::Crate(VisCrate { + crate_token: input.parse()?, + })) + } + } + + #[cfg(feature = "full")] + pub(crate) fn is_some(&self) -> bool { + match self { + Visibility::Inherited => false, + _ => true, + } + } + } +} + +#[cfg(feature = "printing")] +mod printing { + use super::*; + use crate::print::TokensOrDefault; + use proc_macro2::TokenStream; + use quote::{ToTokens, TokenStreamExt}; + + #[cfg_attr(doc_cfg, doc(cfg(feature = "printing")))] + impl ToTokens for Variant { + fn to_tokens(&self, tokens: &mut TokenStream) { + tokens.append_all(&self.attrs); + self.ident.to_tokens(tokens); + self.fields.to_tokens(tokens); + if let Some((eq_token, disc)) = &self.discriminant { + eq_token.to_tokens(tokens); + disc.to_tokens(tokens); + } + } + } + + #[cfg_attr(doc_cfg, doc(cfg(feature = "printing")))] + impl ToTokens for FieldsNamed { + fn to_tokens(&self, tokens: &mut TokenStream) { + self.brace_token.surround(tokens, |tokens| { + self.named.to_tokens(tokens); + }); + } + } + + #[cfg_attr(doc_cfg, doc(cfg(feature = "printing")))] + impl ToTokens for FieldsUnnamed { + fn to_tokens(&self, tokens: &mut TokenStream) { + self.paren_token.surround(tokens, |tokens| { + self.unnamed.to_tokens(tokens); + }); + } + } + + #[cfg_attr(doc_cfg, doc(cfg(feature = "printing")))] + impl ToTokens for Field { + fn to_tokens(&self, tokens: &mut TokenStream) { + tokens.append_all(&self.attrs); + self.vis.to_tokens(tokens); + if let Some(ident) = &self.ident { + ident.to_tokens(tokens); + TokensOrDefault(&self.colon_token).to_tokens(tokens); + } + self.ty.to_tokens(tokens); + } + } + + #[cfg_attr(doc_cfg, doc(cfg(feature = "printing")))] + impl ToTokens for VisPublic { + fn to_tokens(&self, tokens: &mut TokenStream) { + self.pub_token.to_tokens(tokens); + } + } + + #[cfg_attr(doc_cfg, doc(cfg(feature = "printing")))] + impl ToTokens for VisCrate { + fn to_tokens(&self, tokens: &mut TokenStream) { + self.crate_token.to_tokens(tokens); + } + } + + #[cfg_attr(doc_cfg, doc(cfg(feature = "printing")))] + impl ToTokens for VisRestricted { + fn to_tokens(&self, tokens: &mut TokenStream) { + self.pub_token.to_tokens(tokens); + self.paren_token.surround(tokens, |tokens| { + // TODO: If we have a path which is not "self" or "super" or + // "crate", automatically add the "in" token. + self.in_token.to_tokens(tokens); + self.path.to_tokens(tokens); + }); + } + } +} diff --git a/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/derive.rs b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/derive.rs new file mode 100644 index 000000000000..af9bb91b7a8d --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/derive.rs @@ -0,0 +1,274 @@ +use super::*; +use crate::punctuated::Punctuated; + +ast_struct! { + /// Data structure sent to a `proc_macro_derive` macro. + /// + /// *This type is available only if Syn is built with the `"derive"` feature.* + #[cfg_attr(doc_cfg, doc(cfg(feature = "derive")))] + pub struct DeriveInput { + /// Attributes tagged on the whole struct or enum. + pub attrs: Vec, + + /// Visibility of the struct or enum. + pub vis: Visibility, + + /// Name of the struct or enum. + pub ident: Ident, + + /// Generics required to complete the definition. + pub generics: Generics, + + /// Data within the struct or enum. + pub data: Data, + } +} + +ast_enum_of_structs! { + /// The storage of a struct, enum or union data structure. + /// + /// *This type is available only if Syn is built with the `"derive"` feature.* + /// + /// # Syntax tree enum + /// + /// This type is a [syntax tree enum]. + /// + /// [syntax tree enum]: Expr#syntax-tree-enums + #[cfg_attr(doc_cfg, doc(cfg(feature = "derive")))] + pub enum Data { + /// A struct input to a `proc_macro_derive` macro. + Struct(DataStruct), + + /// An enum input to a `proc_macro_derive` macro. + Enum(DataEnum), + + /// An untagged union input to a `proc_macro_derive` macro. + Union(DataUnion), + } + + do_not_generate_to_tokens +} + +ast_struct! { + /// A struct input to a `proc_macro_derive` macro. + /// + /// *This type is available only if Syn is built with the `"derive"` + /// feature.* + #[cfg_attr(doc_cfg, doc(cfg(feature = "derive")))] + pub struct DataStruct { + pub struct_token: Token![struct], + pub fields: Fields, + pub semi_token: Option, + } +} + +ast_struct! { + /// An enum input to a `proc_macro_derive` macro. + /// + /// *This type is available only if Syn is built with the `"derive"` + /// feature.* + #[cfg_attr(doc_cfg, doc(cfg(feature = "derive")))] + pub struct DataEnum { + pub enum_token: Token![enum], + pub brace_token: token::Brace, + pub variants: Punctuated, + } +} + +ast_struct! { + /// An untagged union input to a `proc_macro_derive` macro. + /// + /// *This type is available only if Syn is built with the `"derive"` + /// feature.* + #[cfg_attr(doc_cfg, doc(cfg(feature = "derive")))] + pub struct DataUnion { + pub union_token: Token![union], + pub fields: FieldsNamed, + } +} + +#[cfg(feature = "parsing")] +pub mod parsing { + use super::*; + use crate::parse::{Parse, ParseStream, Result}; + + #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] + impl Parse for DeriveInput { + fn parse(input: ParseStream) -> Result { + let attrs = input.call(Attribute::parse_outer)?; + let vis = input.parse::()?; + + let lookahead = input.lookahead1(); + if lookahead.peek(Token![struct]) { + let struct_token = input.parse::()?; + let ident = input.parse::()?; + let generics = input.parse::()?; + let (where_clause, fields, semi) = data_struct(input)?; + Ok(DeriveInput { + attrs, + vis, + ident, + generics: Generics { + where_clause, + ..generics + }, + data: Data::Struct(DataStruct { + struct_token, + fields, + semi_token: semi, + }), + }) + } else if lookahead.peek(Token![enum]) { + let enum_token = input.parse::()?; + let ident = input.parse::()?; + let generics = input.parse::()?; + let (where_clause, brace, variants) = data_enum(input)?; + Ok(DeriveInput { + attrs, + vis, + ident, + generics: Generics { + where_clause, + ..generics + }, + data: Data::Enum(DataEnum { + enum_token, + brace_token: brace, + variants, + }), + }) + } else if lookahead.peek(Token![union]) { + let union_token = input.parse::()?; + let ident = input.parse::()?; + let generics = input.parse::()?; + let (where_clause, fields) = data_union(input)?; + Ok(DeriveInput { + attrs, + vis, + ident, + generics: Generics { + where_clause, + ..generics + }, + data: Data::Union(DataUnion { + union_token, + fields, + }), + }) + } else { + Err(lookahead.error()) + } + } + } + + pub fn data_struct( + input: ParseStream, + ) -> Result<(Option, Fields, Option)> { + let mut lookahead = input.lookahead1(); + let mut where_clause = None; + if lookahead.peek(Token![where]) { + where_clause = Some(input.parse()?); + lookahead = input.lookahead1(); + } + + if where_clause.is_none() && lookahead.peek(token::Paren) { + let fields = input.parse()?; + + lookahead = input.lookahead1(); + if lookahead.peek(Token![where]) { + where_clause = Some(input.parse()?); + lookahead = input.lookahead1(); + } + + if lookahead.peek(Token![;]) { + let semi = input.parse()?; + Ok((where_clause, Fields::Unnamed(fields), Some(semi))) + } else { + Err(lookahead.error()) + } + } else if lookahead.peek(token::Brace) { + let fields = input.parse()?; + Ok((where_clause, Fields::Named(fields), None)) + } else if lookahead.peek(Token![;]) { + let semi = input.parse()?; + Ok((where_clause, Fields::Unit, Some(semi))) + } else { + Err(lookahead.error()) + } + } + + pub fn data_enum( + input: ParseStream, + ) -> Result<( + Option, + token::Brace, + Punctuated, + )> { + let where_clause = input.parse()?; + + let content; + let brace = braced!(content in input); + let variants = content.parse_terminated(Variant::parse)?; + + Ok((where_clause, brace, variants)) + } + + pub fn data_union(input: ParseStream) -> Result<(Option, FieldsNamed)> { + let where_clause = input.parse()?; + let fields = input.parse()?; + Ok((where_clause, fields)) + } +} + +#[cfg(feature = "printing")] +mod printing { + use super::*; + use crate::attr::FilterAttrs; + use crate::print::TokensOrDefault; + use proc_macro2::TokenStream; + use quote::ToTokens; + + #[cfg_attr(doc_cfg, doc(cfg(feature = "printing")))] + impl ToTokens for DeriveInput { + fn to_tokens(&self, tokens: &mut TokenStream) { + for attr in self.attrs.outer() { + attr.to_tokens(tokens); + } + self.vis.to_tokens(tokens); + match &self.data { + Data::Struct(d) => d.struct_token.to_tokens(tokens), + Data::Enum(d) => d.enum_token.to_tokens(tokens), + Data::Union(d) => d.union_token.to_tokens(tokens), + } + self.ident.to_tokens(tokens); + self.generics.to_tokens(tokens); + match &self.data { + Data::Struct(data) => match &data.fields { + Fields::Named(fields) => { + self.generics.where_clause.to_tokens(tokens); + fields.to_tokens(tokens); + } + Fields::Unnamed(fields) => { + fields.to_tokens(tokens); + self.generics.where_clause.to_tokens(tokens); + TokensOrDefault(&data.semi_token).to_tokens(tokens); + } + Fields::Unit => { + self.generics.where_clause.to_tokens(tokens); + TokensOrDefault(&data.semi_token).to_tokens(tokens); + } + }, + Data::Enum(data) => { + self.generics.where_clause.to_tokens(tokens); + data.brace_token.surround(tokens, |tokens| { + data.variants.to_tokens(tokens); + }); + } + Data::Union(data) => { + self.generics.where_clause.to_tokens(tokens); + data.fields.to_tokens(tokens); + } + } + } + } +} diff --git a/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/discouraged.rs b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/discouraged.rs new file mode 100644 index 000000000000..a46129b6a159 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/discouraged.rs @@ -0,0 +1,194 @@ +//! Extensions to the parsing API with niche applicability. + +use super::*; + +/// Extensions to the `ParseStream` API to support speculative parsing. +pub trait Speculative { + /// Advance this parse stream to the position of a forked parse stream. + /// + /// This is the opposite operation to [`ParseStream::fork`]. You can fork a + /// parse stream, perform some speculative parsing, then join the original + /// stream to the fork to "commit" the parsing from the fork to the main + /// stream. + /// + /// If you can avoid doing this, you should, as it limits the ability to + /// generate useful errors. That said, it is often the only way to parse + /// syntax of the form `A* B*` for arbitrary syntax `A` and `B`. The problem + /// is that when the fork fails to parse an `A`, it's impossible to tell + /// whether that was because of a syntax error and the user meant to provide + /// an `A`, or that the `A`s are finished and it's time to start parsing + /// `B`s. Use with care. + /// + /// Also note that if `A` is a subset of `B`, `A* B*` can be parsed by + /// parsing `B*` and removing the leading members of `A` from the + /// repetition, bypassing the need to involve the downsides associated with + /// speculative parsing. + /// + /// [`ParseStream::fork`]: ParseBuffer::fork + /// + /// # Example + /// + /// There has been chatter about the possibility of making the colons in the + /// turbofish syntax like `path::to::` no longer required by accepting + /// `path::to` in expression position. Specifically, according to [RFC + /// 2544], [`PathSegment`] parsing should always try to consume a following + /// `<` token as the start of generic arguments, and reset to the `<` if + /// that fails (e.g. the token is acting as a less-than operator). + /// + /// This is the exact kind of parsing behavior which requires the "fork, + /// try, commit" behavior that [`ParseStream::fork`] discourages. With + /// `advance_to`, we can avoid having to parse the speculatively parsed + /// content a second time. + /// + /// This change in behavior can be implemented in syn by replacing just the + /// `Parse` implementation for `PathSegment`: + /// + /// ``` + /// # use syn::ext::IdentExt; + /// use syn::parse::discouraged::Speculative; + /// # use syn::parse::{Parse, ParseStream}; + /// # use syn::{Ident, PathArguments, Result, Token}; + /// + /// pub struct PathSegment { + /// pub ident: Ident, + /// pub arguments: PathArguments, + /// } + /// # + /// # impl From for PathSegment + /// # where + /// # T: Into, + /// # { + /// # fn from(ident: T) -> Self { + /// # PathSegment { + /// # ident: ident.into(), + /// # arguments: PathArguments::None, + /// # } + /// # } + /// # } + /// + /// impl Parse for PathSegment { + /// fn parse(input: ParseStream) -> Result { + /// if input.peek(Token![super]) + /// || input.peek(Token![self]) + /// || input.peek(Token![Self]) + /// || input.peek(Token![crate]) + /// { + /// let ident = input.call(Ident::parse_any)?; + /// return Ok(PathSegment::from(ident)); + /// } + /// + /// let ident = input.parse()?; + /// if input.peek(Token![::]) && input.peek3(Token![<]) { + /// return Ok(PathSegment { + /// ident, + /// arguments: PathArguments::AngleBracketed(input.parse()?), + /// }); + /// } + /// if input.peek(Token![<]) && !input.peek(Token![<=]) { + /// let fork = input.fork(); + /// if let Ok(arguments) = fork.parse() { + /// input.advance_to(&fork); + /// return Ok(PathSegment { + /// ident, + /// arguments: PathArguments::AngleBracketed(arguments), + /// }); + /// } + /// } + /// Ok(PathSegment::from(ident)) + /// } + /// } + /// + /// # syn::parse_str::("a").unwrap(); + /// ``` + /// + /// # Drawbacks + /// + /// The main drawback of this style of speculative parsing is in error + /// presentation. Even if the lookahead is the "correct" parse, the error + /// that is shown is that of the "fallback" parse. To use the same example + /// as the turbofish above, take the following unfinished "turbofish": + /// + /// ```text + /// let _ = f<&'a fn(), for<'a> serde::>(); + /// ``` + /// + /// If this is parsed as generic arguments, we can provide the error message + /// + /// ```text + /// error: expected identifier + /// --> src.rs:L:C + /// | + /// L | let _ = f<&'a fn(), for<'a> serde::>(); + /// | ^ + /// ``` + /// + /// but if parsed using the above speculative parsing, it falls back to + /// assuming that the `<` is a less-than when it fails to parse the generic + /// arguments, and tries to interpret the `&'a` as the start of a labelled + /// loop, resulting in the much less helpful error + /// + /// ```text + /// error: expected `:` + /// --> src.rs:L:C + /// | + /// L | let _ = f<&'a fn(), for<'a> serde::>(); + /// | ^^ + /// ``` + /// + /// This can be mitigated with various heuristics (two examples: show both + /// forks' parse errors, or show the one that consumed more tokens), but + /// when you can control the grammar, sticking to something that can be + /// parsed LL(3) and without the LL(*) speculative parsing this makes + /// possible, displaying reasonable errors becomes much more simple. + /// + /// [RFC 2544]: https://github.com/rust-lang/rfcs/pull/2544 + /// [`PathSegment`]: crate::PathSegment + /// + /// # Performance + /// + /// This method performs a cheap fixed amount of work that does not depend + /// on how far apart the two streams are positioned. + /// + /// # Panics + /// + /// The forked stream in the argument of `advance_to` must have been + /// obtained by forking `self`. Attempting to advance to any other stream + /// will cause a panic. + fn advance_to(&self, fork: &Self); +} + +impl<'a> Speculative for ParseBuffer<'a> { + fn advance_to(&self, fork: &Self) { + if !crate::buffer::same_scope(self.cursor(), fork.cursor()) { + panic!("Fork was not derived from the advancing parse stream"); + } + + let (self_unexp, self_sp) = inner_unexpected(self); + let (fork_unexp, fork_sp) = inner_unexpected(fork); + if !Rc::ptr_eq(&self_unexp, &fork_unexp) { + match (fork_sp, self_sp) { + // Unexpected set on the fork, but not on `self`, copy it over. + (Some(span), None) => { + self_unexp.set(Unexpected::Some(span)); + } + // Unexpected unset. Use chain to propagate errors from fork. + (None, None) => { + fork_unexp.set(Unexpected::Chain(self_unexp)); + + // Ensure toplevel 'unexpected' tokens from the fork don't + // bubble up the chain by replacing the root `unexpected` + // pointer, only 'unexpected' tokens from existing group + // parsers should bubble. + fork.unexpected + .set(Some(Rc::new(Cell::new(Unexpected::None)))); + } + // Unexpected has been set on `self`. No changes needed. + (_, Some(_)) => {} + } + } + + // See comment on `cell` in the struct definition. + self.cell + .set(unsafe { mem::transmute::>(fork.cursor()) }); + } +} diff --git a/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/drops.rs b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/drops.rs new file mode 100644 index 000000000000..89b42d82ef1f --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/drops.rs @@ -0,0 +1,58 @@ +use std::iter; +use std::mem::ManuallyDrop; +use std::ops::{Deref, DerefMut}; +use std::option; +use std::slice; + +#[repr(transparent)] +pub(crate) struct NoDrop(ManuallyDrop); + +impl NoDrop { + pub(crate) fn new(value: T) -> Self + where + T: TrivialDrop, + { + NoDrop(ManuallyDrop::new(value)) + } +} + +impl Deref for NoDrop { + type Target = T; + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +impl DerefMut for NoDrop { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} + +pub(crate) trait TrivialDrop {} + +impl TrivialDrop for iter::Empty {} +impl<'a, T> TrivialDrop for slice::Iter<'a, T> {} +impl<'a, T> TrivialDrop for slice::IterMut<'a, T> {} +impl<'a, T> TrivialDrop for option::IntoIter<&'a T> {} +impl<'a, T> TrivialDrop for option::IntoIter<&'a mut T> {} + +#[test] +fn test_needs_drop() { + use std::mem::needs_drop; + + struct NeedsDrop; + + impl Drop for NeedsDrop { + fn drop(&mut self) {} + } + + assert!(needs_drop::()); + + // Test each of the types with a handwritten TrivialDrop impl above. + assert!(!needs_drop::>()); + assert!(!needs_drop::>()); + assert!(!needs_drop::>()); + assert!(!needs_drop::>()); + assert!(!needs_drop::>()); +} diff --git a/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/error.rs b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/error.rs new file mode 100644 index 000000000000..e301367d5e4e --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/error.rs @@ -0,0 +1,428 @@ +#[cfg(feature = "parsing")] +use crate::buffer::Cursor; +use crate::thread::ThreadBound; +use proc_macro2::{ + Delimiter, Group, Ident, LexError, Literal, Punct, Spacing, Span, TokenStream, TokenTree, +}; +#[cfg(feature = "printing")] +use quote::ToTokens; +use std::fmt::{self, Debug, Display}; +use std::iter::FromIterator; +use std::slice; +use std::vec; + +/// The result of a Syn parser. +pub type Result = std::result::Result; + +/// Error returned when a Syn parser cannot parse the input tokens. +/// +/// # Error reporting in proc macros +/// +/// The correct way to report errors back to the compiler from a procedural +/// macro is by emitting an appropriately spanned invocation of +/// [`compile_error!`] in the generated code. This produces a better diagnostic +/// message than simply panicking the macro. +/// +/// [`compile_error!`]: std::compile_error! +/// +/// When parsing macro input, the [`parse_macro_input!`] macro handles the +/// conversion to `compile_error!` automatically. +/// +/// [`parse_macro_input!`]: crate::parse_macro_input! +/// +/// ``` +/// # extern crate proc_macro; +/// # +/// use proc_macro::TokenStream; +/// use syn::{parse_macro_input, AttributeArgs, ItemFn}; +/// +/// # const IGNORE: &str = stringify! { +/// #[proc_macro_attribute] +/// # }; +/// pub fn my_attr(args: TokenStream, input: TokenStream) -> TokenStream { +/// let args = parse_macro_input!(args as AttributeArgs); +/// let input = parse_macro_input!(input as ItemFn); +/// +/// /* ... */ +/// # TokenStream::new() +/// } +/// ``` +/// +/// For errors that arise later than the initial parsing stage, the +/// [`.to_compile_error()`] or [`.into_compile_error()`] methods can be used to +/// perform an explicit conversion to `compile_error!`. +/// +/// [`.to_compile_error()`]: Error::to_compile_error +/// [`.into_compile_error()`]: Error::into_compile_error +/// +/// ``` +/// # extern crate proc_macro; +/// # +/// # use proc_macro::TokenStream; +/// # use syn::{parse_macro_input, DeriveInput}; +/// # +/// # const IGNORE: &str = stringify! { +/// #[proc_macro_derive(MyDerive)] +/// # }; +/// pub fn my_derive(input: TokenStream) -> TokenStream { +/// let input = parse_macro_input!(input as DeriveInput); +/// +/// // fn(DeriveInput) -> syn::Result +/// expand::my_derive(input) +/// .unwrap_or_else(syn::Error::into_compile_error) +/// .into() +/// } +/// # +/// # mod expand { +/// # use proc_macro2::TokenStream; +/// # use syn::{DeriveInput, Result}; +/// # +/// # pub fn my_derive(input: DeriveInput) -> Result { +/// # unimplemented!() +/// # } +/// # } +/// ``` +pub struct Error { + messages: Vec, +} + +struct ErrorMessage { + // Span is implemented as an index into a thread-local interner to keep the + // size small. It is not safe to access from a different thread. We want + // errors to be Send and Sync to play nicely with the Failure crate, so pin + // the span we're given to its original thread and assume it is + // Span::call_site if accessed from any other thread. + start_span: ThreadBound, + end_span: ThreadBound, + message: String, +} + +#[cfg(test)] +struct _Test +where + Error: Send + Sync; + +impl Error { + /// Usually the [`ParseStream::error`] method will be used instead, which + /// automatically uses the correct span from the current position of the + /// parse stream. + /// + /// Use `Error::new` when the error needs to be triggered on some span other + /// than where the parse stream is currently positioned. + /// + /// [`ParseStream::error`]: crate::parse::ParseBuffer::error + /// + /// # Example + /// + /// ``` + /// use syn::{Error, Ident, LitStr, Result, Token}; + /// use syn::parse::ParseStream; + /// + /// // Parses input that looks like `name = "string"` where the key must be + /// // the identifier `name` and the value may be any string literal. + /// // Returns the string literal. + /// fn parse_name(input: ParseStream) -> Result { + /// let name_token: Ident = input.parse()?; + /// if name_token != "name" { + /// // Trigger an error not on the current position of the stream, + /// // but on the position of the unexpected identifier. + /// return Err(Error::new(name_token.span(), "expected `name`")); + /// } + /// input.parse::()?; + /// let s: LitStr = input.parse()?; + /// Ok(s) + /// } + /// ``` + pub fn new(span: Span, message: T) -> Self { + return new(span, message.to_string()); + + fn new(span: Span, message: String) -> Error { + Error { + messages: vec![ErrorMessage { + start_span: ThreadBound::new(span), + end_span: ThreadBound::new(span), + message, + }], + } + } + } + + /// Creates an error with the specified message spanning the given syntax + /// tree node. + /// + /// Unlike the `Error::new` constructor, this constructor takes an argument + /// `tokens` which is a syntax tree node. This allows the resulting `Error` + /// to attempt to span all tokens inside of `tokens`. While you would + /// typically be able to use the `Spanned` trait with the above `Error::new` + /// constructor, implementation limitations today mean that + /// `Error::new_spanned` may provide a higher-quality error message on + /// stable Rust. + /// + /// When in doubt it's recommended to stick to `Error::new` (or + /// `ParseStream::error`)! + #[cfg(feature = "printing")] + pub fn new_spanned(tokens: T, message: U) -> Self { + return new_spanned(tokens.into_token_stream(), message.to_string()); + + fn new_spanned(tokens: TokenStream, message: String) -> Error { + let mut iter = tokens.into_iter(); + let start = iter.next().map_or_else(Span::call_site, |t| t.span()); + let end = iter.last().map_or(start, |t| t.span()); + Error { + messages: vec![ErrorMessage { + start_span: ThreadBound::new(start), + end_span: ThreadBound::new(end), + message, + }], + } + } + } + + /// The source location of the error. + /// + /// Spans are not thread-safe so this function returns `Span::call_site()` + /// if called from a different thread than the one on which the `Error` was + /// originally created. + pub fn span(&self) -> Span { + let start = match self.messages[0].start_span.get() { + Some(span) => *span, + None => return Span::call_site(), + }; + let end = match self.messages[0].end_span.get() { + Some(span) => *span, + None => return Span::call_site(), + }; + start.join(end).unwrap_or(start) + } + + /// Render the error as an invocation of [`compile_error!`]. + /// + /// The [`parse_macro_input!`] macro provides a convenient way to invoke + /// this method correctly in a procedural macro. + /// + /// [`compile_error!`]: std::compile_error! + /// [`parse_macro_input!`]: crate::parse_macro_input! + pub fn to_compile_error(&self) -> TokenStream { + self.messages + .iter() + .map(ErrorMessage::to_compile_error) + .collect() + } + + /// Render the error as an invocation of [`compile_error!`]. + /// + /// [`compile_error!`]: std::compile_error! + /// + /// # Example + /// + /// ``` + /// # extern crate proc_macro; + /// # + /// use proc_macro::TokenStream; + /// use syn::{parse_macro_input, DeriveInput, Error}; + /// + /// # const _: &str = stringify! { + /// #[proc_macro_derive(MyTrait)] + /// # }; + /// pub fn derive_my_trait(input: TokenStream) -> TokenStream { + /// let input = parse_macro_input!(input as DeriveInput); + /// my_trait::expand(input) + /// .unwrap_or_else(Error::into_compile_error) + /// .into() + /// } + /// + /// mod my_trait { + /// use proc_macro2::TokenStream; + /// use syn::{DeriveInput, Result}; + /// + /// pub(crate) fn expand(input: DeriveInput) -> Result { + /// /* ... */ + /// # unimplemented!() + /// } + /// } + /// ``` + pub fn into_compile_error(self) -> TokenStream { + self.to_compile_error() + } + + /// Add another error message to self such that when `to_compile_error()` is + /// called, both errors will be emitted together. + pub fn combine(&mut self, another: Error) { + self.messages.extend(another.messages); + } +} + +impl ErrorMessage { + fn to_compile_error(&self) -> TokenStream { + let start = self + .start_span + .get() + .cloned() + .unwrap_or_else(Span::call_site); + let end = self.end_span.get().cloned().unwrap_or_else(Span::call_site); + + // compile_error!($message) + TokenStream::from_iter(vec![ + TokenTree::Ident(Ident::new("compile_error", start)), + TokenTree::Punct({ + let mut punct = Punct::new('!', Spacing::Alone); + punct.set_span(start); + punct + }), + TokenTree::Group({ + let mut group = Group::new(Delimiter::Brace, { + TokenStream::from_iter(vec![TokenTree::Literal({ + let mut string = Literal::string(&self.message); + string.set_span(end); + string + })]) + }); + group.set_span(end); + group + }), + ]) + } +} + +#[cfg(feature = "parsing")] +pub fn new_at(scope: Span, cursor: Cursor, message: T) -> Error { + if cursor.eof() { + Error::new(scope, format!("unexpected end of input, {}", message)) + } else { + let span = crate::buffer::open_span_of_group(cursor); + Error::new(span, message) + } +} + +#[cfg(all(feature = "parsing", any(feature = "full", feature = "derive")))] +pub fn new2(start: Span, end: Span, message: T) -> Error { + return new2(start, end, message.to_string()); + + fn new2(start: Span, end: Span, message: String) -> Error { + Error { + messages: vec![ErrorMessage { + start_span: ThreadBound::new(start), + end_span: ThreadBound::new(end), + message, + }], + } + } +} + +impl Debug for Error { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + if self.messages.len() == 1 { + formatter + .debug_tuple("Error") + .field(&self.messages[0]) + .finish() + } else { + formatter + .debug_tuple("Error") + .field(&self.messages) + .finish() + } + } +} + +impl Debug for ErrorMessage { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + Debug::fmt(&self.message, formatter) + } +} + +impl Display for Error { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str(&self.messages[0].message) + } +} + +impl Clone for Error { + fn clone(&self) -> Self { + Error { + messages: self.messages.clone(), + } + } +} + +impl Clone for ErrorMessage { + fn clone(&self) -> Self { + let start = self + .start_span + .get() + .cloned() + .unwrap_or_else(Span::call_site); + let end = self.end_span.get().cloned().unwrap_or_else(Span::call_site); + ErrorMessage { + start_span: ThreadBound::new(start), + end_span: ThreadBound::new(end), + message: self.message.clone(), + } + } +} + +impl std::error::Error for Error {} + +impl From for Error { + fn from(err: LexError) -> Self { + Error::new(err.span(), "lex error") + } +} + +impl IntoIterator for Error { + type Item = Error; + type IntoIter = IntoIter; + + fn into_iter(self) -> Self::IntoIter { + IntoIter { + messages: self.messages.into_iter(), + } + } +} + +pub struct IntoIter { + messages: vec::IntoIter, +} + +impl Iterator for IntoIter { + type Item = Error; + + fn next(&mut self) -> Option { + Some(Error { + messages: vec![self.messages.next()?], + }) + } +} + +impl<'a> IntoIterator for &'a Error { + type Item = Error; + type IntoIter = Iter<'a>; + + fn into_iter(self) -> Self::IntoIter { + Iter { + messages: self.messages.iter(), + } + } +} + +pub struct Iter<'a> { + messages: slice::Iter<'a, ErrorMessage>, +} + +impl<'a> Iterator for Iter<'a> { + type Item = Error; + + fn next(&mut self) -> Option { + Some(Error { + messages: vec![self.messages.next()?.clone()], + }) + } +} + +impl Extend for Error { + fn extend>(&mut self, iter: T) { + for err in iter { + self.combine(err); + } + } +} diff --git a/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/export.rs b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/export.rs new file mode 100644 index 000000000000..f478d091ea12 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/export.rs @@ -0,0 +1,39 @@ +pub use std::clone::Clone; +pub use std::cmp::{Eq, PartialEq}; +pub use std::default::Default; +pub use std::fmt::{self, Debug, Formatter}; +pub use std::hash::{Hash, Hasher}; +pub use std::marker::Copy; +pub use std::option::Option::{None, Some}; +pub use std::result::Result::{Err, Ok}; + +#[cfg(feature = "printing")] +pub extern crate quote; + +pub use proc_macro2::{Span, TokenStream as TokenStream2}; + +#[cfg(feature = "parsing")] +pub use crate::group::{parse_braces, parse_brackets, parse_parens}; + +pub use crate::span::IntoSpans; + +#[cfg(all( + not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "wasi"))), + feature = "proc-macro" +))] +pub use proc_macro::TokenStream; + +#[cfg(feature = "printing")] +pub use quote::{ToTokens, TokenStreamExt}; + +#[allow(non_camel_case_types)] +pub type bool = help::Bool; +#[allow(non_camel_case_types)] +pub type str = help::Str; + +mod help { + pub type Bool = bool; + pub type Str = str; +} + +pub struct private(pub(crate) ()); diff --git a/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/expr.rs b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/expr.rs new file mode 100644 index 000000000000..93a59b0e20d7 --- /dev/null +++ b/third_party/rust/chromium_crates_io/vendor/syn-1.0.109/src/expr.rs @@ -0,0 +1,3558 @@ +use super::*; +use crate::punctuated::Punctuated; +#[cfg(feature = "full")] +use crate::reserved::Reserved; +use proc_macro2::{Span, TokenStream}; +#[cfg(feature = "printing")] +use quote::IdentFragment; +#[cfg(feature = "printing")] +use std::fmt::{self, Display}; +use std::hash::{Hash, Hasher}; +#[cfg(feature = "parsing")] +use std::mem; + +ast_enum_of_structs! { + /// A Rust expression. + /// + /// *This type is available only if Syn is built with the `"derive"` or `"full"` + /// feature, but most of the variants are not available unless "full" is enabled.* + /// + /// # Syntax tree enums + /// + /// This type is a syntax tree enum. In Syn this and other syntax tree enums + /// are designed to be traversed using the following rebinding idiom. + /// + /// ``` + /// # use syn::Expr; + /// # + /// # fn example(expr: Expr) { + /// # const IGNORE: &str = stringify! { + /// let expr: Expr = /* ... */; + /// # }; + /// match expr { + /// Expr::MethodCall(expr) => { + /// /* ... */ + /// } + /// Expr::Cast(expr) => { + /// /* ... */ + /// } + /// Expr::If(expr) => { + /// /* ... */ + /// } + /// + /// /* ... */ + /// # _ => {} + /// # } + /// # } + /// ``` + /// + /// We begin with a variable `expr` of type `Expr` that has no fields + /// (because it is an enum), and by matching on it and rebinding a variable + /// with the same name `expr` we effectively imbue our variable with all of + /// the data fields provided by the variant that it turned out to be. So for + /// example above if we ended up in the `MethodCall` case then we get to use + /// `expr.receiver`, `expr.args` etc; if we ended up in the `If` case we get + /// to use `expr.cond`, `expr.then_branch`, `expr.else_branch`. + /// + /// This approach avoids repeating the variant names twice on every line. + /// + /// ``` + /// # use syn::{Expr, ExprMethodCall}; + /// # + /// # fn example(expr: Expr) { + /// // Repetitive; recommend not doing this. + /// match expr { + /// Expr::MethodCall(ExprMethodCall { method, args, .. }) => { + /// # } + /// # _ => {} + /// # } + /// # } + /// ``` + /// + /// In general, the name to which a syntax tree enum variant is bound should + /// be a suitable name for the complete syntax tree enum type. + /// + /// ``` + /// # use syn::{Expr, ExprField}; + /// # + /// # fn example(discriminant: ExprField) { + /// // Binding is called `base` which is the name I would use if I were + /// // assigning `*discriminant.base` without an `if let`. + /// if let Expr::Tuple(base) = *discriminant.base { + /// # } + /// # } + /// ``` + /// + /// A sign that you may not be choosing the right variable names is if you + /// see names getting repeated in your code, like accessing + /// `receiver.receiver` or `pat.pat` or `cond.cond`. + #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] + #[cfg_attr(not(syn_no_non_exhaustive), non_exhaustive)] + pub enum Expr { + /// A slice literal expression: `[a, b, c, d]`. + Array(ExprArray), + + /// An assignment expression: `a = compute()`. + Assign(ExprAssign), + + /// A compound assignment expression: `counter += 1`. + AssignOp(ExprAssignOp), + + /// An async block: `async { ... }`. + Async(ExprAsync), + + /// An await expression: `fut.await`. + Await(ExprAwait), + + /// A binary operation: `a + b`, `a * b`. + Binary(ExprBinary), + + /// A blocked scope: `{ ... }`. + Block(ExprBlock), + + /// A box expression: `box f`. + Box(ExprBox), + + /// A `break`, with an optional label to break and an optional + /// expression. + Break(ExprBreak), + + /// A function call expression: `invoke(a, b)`. + Call(ExprCall), + + /// A cast expression: `foo as f64`. + Cast(ExprCast), + + /// A closure expression: `|a, b| a + b`. + Closure(ExprClosure), + + /// A `continue`, with an optional label. + Continue(ExprContinue), + + /// Access of a named struct field (`obj.k`) or unnamed tuple struct + /// field (`obj.0`). + Field(ExprField), + + /// A for loop: `for pat in expr { ... }`. + ForLoop(ExprForLoop), + + /// An expression contained within invisible delimiters. + /// + /// This variant is important for faithfully representing the precedence + /// of expressions and is related to `None`-delimited spans in a + /// `TokenStream`. + Group(ExprGroup), + + /// An `if` expression with an optional `else` block: `if expr { ... } + /// else { ... }`. + /// + /// The `else` branch expression may only be an `If` or `Block` + /// expression, not any of the other types of expression. + If(ExprIf), + + /// A square bracketed indexing expression: `vector[2]`. + Index(ExprIndex), + + /// A `let` guard: `let Some(x) = opt`. + Let(ExprLet), + + /// A literal in place of an expression: `1`, `"foo"`. + Lit(ExprLit), + + /// Conditionless loop: `loop { ... }`. + Loop(ExprLoop), + + /// A macro invocation expression: `format!("{}", q)`. + Macro(ExprMacro), + + /// A `match` expression: `match n { Some(n) => {}, None => {} }`. + Match(ExprMatch), + + /// A method call expression: `x.foo::(a, b)`. + MethodCall(ExprMethodCall), + + /// A parenthesized expression: `(a + b)`. + Paren(ExprParen), + + /// A path like `std::mem::replace` possibly containing generic + /// parameters and a qualified self-type. + /// + /// A plain identifier like `x` is a path of length 1. + Path(ExprPath), + + /// A range expression: `1..2`, `1..`, `..2`, `1..=2`, `..=2`. + Range(ExprRange), + + /// A referencing operation: `&a` or `&mut a`. + Reference(ExprReference), + + /// An array literal constructed from one repeated element: `[0u8; N]`. + Repeat(ExprRepeat), + + /// A `return`, with an optional value to be returned. + Return(ExprReturn), + + /// A struct literal expression: `Point { x: 1, y: 1 }`. + /// + /// The `rest` provides the value of the remaining fields as in `S { a: + /// 1, b: 1, ..rest }`. + Struct(ExprStruct), + + /// A try-expression: `expr?`. + Try(ExprTry), + + /// A try block: `try { ... }`. + TryBlock(ExprTryBlock), + + /// A tuple expression: `(a, b, c, d)`. + Tuple(ExprTuple), + + /// A type ascription expression: `foo: f64`. + Type(ExprType), + + /// A unary operation: `!x`, `*x`. + Unary(ExprUnary), + + /// An unsafe block: `unsafe { ... }`. + Unsafe(ExprUnsafe), + + /// Tokens in expression position not interpreted by Syn. + Verbatim(TokenStream), + + /// A while loop: `while expr { ... }`. + While(ExprWhile), + + /// A yield expression: `yield expr`. + Yield(ExprYield), + + // Not public API. + // + // For testing exhaustiveness in downstream code, use the following idiom: + // + // match expr { + // Expr::Array(expr) => {...} + // Expr::Assign(expr) => {...} + // ... + // Expr::Yield(expr) => {...} + // + // #[cfg_attr(test, deny(non_exhaustive_omitted_patterns))] + // _ => { /* some sane fallback */ } + // } + // + // This way we fail your tests but don't break your library when adding + // a variant. You will be notified by a test failure when a variant is + // added, so that you can add code to handle it, but your library will + // continue to compile and work for downstream users in the interim. + #[cfg(syn_no_non_exhaustive)] + #[doc(hidden)] + __NonExhaustive, + } +} + +ast_struct! { + /// A slice literal expression: `[a, b, c, d]`. + /// + /// *This type is available only if Syn is built with the `"full"` feature.* + #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] + pub struct ExprArray #full { + pub attrs: Vec, + pub bracket_token: token::Bracket, + pub elems: Punctuated, + } +} + +ast_struct! { + /// An assignment expression: `a = compute()`. + /// + /// *This type is available only if Syn is built with the `"full"` feature.* + #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] + pub struct ExprAssign #full { + pub attrs: Vec, + pub left: Box, + pub eq_token: Token![=], + pub right: Box, + } +} + +ast_struct! { + /// A compound assignment expression: `counter += 1`. + /// + /// *This type is available only if Syn is built with the `"full"` feature.* + #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] + pub struct ExprAssignOp #full { + pub attrs: Vec, + pub left: Box, + pub op: BinOp, + pub right: Box, + } +} + +ast_struct! { + /// An async block: `async { ... }`. + /// + /// *This type is available only if Syn is built with the `"full"` feature.* + #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] + pub struct ExprAsync #full { + pub attrs: Vec, + pub async_token: Token![async], + pub capture: Option, + pub block: Block, + } +} + +ast_struct! { + /// An await expression: `fut.await`. + /// + /// *This type is available only if Syn is built with the `"full"` feature.* + #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] + pub struct ExprAwait #full { + pub attrs: Vec, + pub base: Box, + pub dot_token: Token![.], + pub await_token: token::Await, + } +} + +ast_struct! { + /// A binary operation: `a + b`, `a * b`. + /// + /// *This type is available only if Syn is built with the `"derive"` or + /// `"full"` feature.* + #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] + pub struct ExprBinary { + pub attrs: Vec, + pub left: Box, + pub op: BinOp, + pub right: Box, + } +} + +ast_struct! { + /// A blocked scope: `{ ... }`. + /// + /// *This type is available only if Syn is built with the `"full"` feature.* + #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] + pub struct ExprBlock #full { + pub attrs: Vec, + pub label: Option