diff --git a/DEPS b/DEPS index 06ef028b638d..7679810c44e6 100644 --- a/DEPS +++ b/DEPS @@ -127,11 +127,6 @@ hooks = [ '--source-dir', '.', '--filter', '^[0-9]\{{1,\}}\.[0-9]\{{1,\}}\.[0-9]\{{1,\}}$'], }, - { - 'name': 'patch_ffmpeg', - 'pattern': '.', - 'action': ['vpython3', 'script/patch_ffmpeg.py'], - }, ] include_rules = [ diff --git a/android/brave_java_sources.gni b/android/brave_java_sources.gni index fb7f309a2a2d..f4a28a4c4b1a 100644 --- a/android/brave_java_sources.gni +++ b/android/brave_java_sources.gni @@ -75,6 +75,7 @@ brave_java_sources = [ "../../brave/android/java/org/chromium/chrome/browser/bookmarks/BraveBookmarkPage.java", "../../brave/android/java/org/chromium/chrome/browser/bookmarks/BraveBookmarkToolbar.java", "../../brave/android/java/org/chromium/chrome/browser/bookmarks/BraveBookmarkToolbarCoordinator.java", + "../../brave/android/java/org/chromium/chrome/browser/bookmarks/BraveBookmarkUiPrefs.java", "../../brave/android/java/org/chromium/chrome/browser/bookmarks/BraveBookmarkUtils.java", "../../brave/android/java/org/chromium/chrome/browser/brave_leo/BraveLeoActivity.java", "../../brave/android/java/org/chromium/chrome/browser/brave_leo/BraveLeoSettingsLauncherHelper.java", 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 69582fd7f808..5e31404a24b1 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 @@ -391,6 +391,23 @@ %1$s2 tabs seem related. Group them? + + + Want to close old tabs? + + + {TABS_COUNT, plural, + =1 {You have %1$s1 tab you haven't used recently} + other {You have %1$s8 tabs you haven't used recently} + } + + + Review tabs + + + Close without reviewing + + Review the suggestions. diff --git a/android/feed/core/java/src/org/chromium/chrome/browser/feed/BraveFeedSurfaceMediator.java b/android/feed/core/java/src/org/chromium/chrome/browser/feed/BraveFeedSurfaceMediator.java index 005129138bab..2411e3858d00 100644 --- a/android/feed/core/java/src/org/chromium/chrome/browser/feed/BraveFeedSurfaceMediator.java +++ b/android/feed/core/java/src/org/chromium/chrome/browser/feed/BraveFeedSurfaceMediator.java @@ -11,6 +11,7 @@ import androidx.annotation.Nullable; import org.chromium.chrome.browser.feed.sort_ui.FeedOptionsCoordinator; +import org.chromium.chrome.browser.profiles.Profile; import org.chromium.components.browser_ui.widget.displaystyle.UiConfig; import org.chromium.ui.modelutil.PropertyModel; @@ -27,7 +28,8 @@ public class BraveFeedSurfaceMediator extends FeedSurfaceMediator { @FeedSurfaceCoordinator.StreamTabId int openingTabId, FeedActionDelegate actionDelegate, FeedOptionsCoordinator optionsCoordinator, - @Nullable UiConfig uiConfig) { + @Nullable UiConfig uiConfig, + Profile profile) { super( coordinator, context, @@ -36,7 +38,8 @@ public class BraveFeedSurfaceMediator extends FeedSurfaceMediator { openingTabId, actionDelegate, optionsCoordinator, - uiConfig); + uiConfig, + profile); } @Override diff --git a/android/java/AndroidManifest.xml b/android/java/AndroidManifest.xml index ed4407f7882e..94a112772a8e 100644 --- a/android/java/AndroidManifest.xml +++ b/android/java/AndroidManifest.xml @@ -10,7 +10,7 @@ android:name="org.chromium.chrome.browser.rewards.tipping.RewardsTippingBannerActivity" android:theme="@style/TippingBraveTranslucent" android:screenOrientation="sensorPortrait" - tools:ignore="LockedOrientationActivity" + tools:ignore="LockedOrientationActivity,DiscouragedApi" android:exported="false" /> + tools:ignore="LockedOrientationActivity,DiscouragedApi"/> + tools:ignore="LockedOrientationActivity,DiscouragedApi"/> + tools:ignore="LockedOrientationActivity,DiscouragedApi"/> + tools:ignore="LockedOrientationActivity,DiscouragedApi"/> + tools:ignore="LockedOrientationActivity,DiscouragedApi"/> + tools:ignore="LockedOrientationActivity,DiscouragedApi"/> + tools:ignore="LockedOrientationActivity,DiscouragedApi"/> + tools:ignore="LockedOrientationActivity,DiscouragedApi"/> + tools:ignore="LockedOrientationActivity,DiscouragedApi"/> + tools:ignore="LockedOrientationActivity,DiscouragedApi"/> + tools:ignore="LockedOrientationActivity,DiscouragedApi"/> + tools:ignore="LockedOrientationActivity,DiscouragedApi"/> + tools:ignore="LockedOrientationActivity,DiscouragedApi"/> + tools:ignore="LockedOrientationActivity,DiscouragedApi"/> + tools:ignore="LockedOrientationActivity,DiscouragedApi"/> + tools:ignore="LockedOrientationActivity,DiscouragedApi"/> + tools:ignore="LockedOrientationActivity,DiscouragedApi"/> + tools:ignore="LockedOrientationActivity,DiscouragedApi"/> + tools:ignore="LockedOrientationActivity,DiscouragedApi"/> + tools:ignore="LockedOrientationActivity,DiscouragedApi"/> + tools:ignore="LockedOrientationActivity,DiscouragedApi"/> + tools:ignore="LockedOrientationActivity,DiscouragedApi"/> (...); -} - --keep class org.chromium.components.browser_ui.site_settings.BraveFourStateCookieSettingsPreferenceBase { - public (...); -} - -keep class org.chromium.components.browser_ui.site_settings.SiteSettings { public (...); } @@ -820,3 +813,11 @@ -keep class org.chromium.chrome.browser.identity_disc.BraveIdentityDiscController { public (...); } + +-keep class org.chromium.chrome.browser.bookmarks.BookmarkUiPrefs { + (...); +} + +-keep class org.chromium.chrome.browser.bookmarks.BraveBookmarkUiPrefs { + (...); +} diff --git a/android/java/org/chromium/chrome/browser/BraveRewardsUserWalletActivity.java b/android/java/org/chromium/chrome/browser/BraveRewardsUserWalletActivity.java index 7e6041bdb1db..fa0dceedfe23 100644 --- a/android/java/org/chromium/chrome/browser/BraveRewardsUserWalletActivity.java +++ b/android/java/org/chromium/chrome/browser/BraveRewardsUserWalletActivity.java @@ -17,10 +17,13 @@ import androidx.appcompat.app.ActionBar; import androidx.appcompat.widget.Toolbar; +import org.chromium.base.supplier.OneshotSupplier; import org.chromium.brave_rewards.mojom.WalletStatus; import org.chromium.chrome.R; import org.chromium.chrome.browser.app.BraveActivity; +import org.chromium.chrome.browser.init.ActivityProfileProvider; import org.chromium.chrome.browser.init.AsyncInitializationActivity; +import org.chromium.chrome.browser.profiles.ProfileProvider; public class BraveRewardsUserWalletActivity extends AsyncInitializationActivity implements View.OnClickListener { @@ -139,4 +142,9 @@ public boolean onOptionsItemSelected(MenuItem item) { } return super.onOptionsItemSelected(item); } + + @Override + protected OneshotSupplier createProfileProvider() { + return new ActivityProfileProvider(getLifecycleDispatcher()); + } } diff --git a/android/java/org/chromium/chrome/browser/app/BraveActivity.java b/android/java/org/chromium/chrome/browser/app/BraveActivity.java index 042c8ad48602..75b06238a290 100644 --- a/android/java/org/chromium/chrome/browser/app/BraveActivity.java +++ b/android/java/org/chromium/chrome/browser/app/BraveActivity.java @@ -159,7 +159,6 @@ import org.chromium.chrome.browser.site_settings.BraveWalletEthereumConnectedSites; import org.chromium.chrome.browser.speedreader.BraveSpeedReaderUtils; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.browser.tab.TabImpl; import org.chromium.chrome.browser.tab.TabLaunchType; import org.chromium.chrome.browser.tab.TabSelectionType; import org.chromium.chrome.browser.tabmodel.TabModel; @@ -351,7 +350,7 @@ public void onPauseWithNative() { @Override public boolean onMenuOrKeyboardAction(int id, boolean fromMenu) { - final TabImpl currentTab = (TabImpl) getActivityTab(); + final Tab currentTab = getActivityTab(); // Handle items replaced by Brave. if (id == R.id.info_menu_id && currentTab != null) { ShareDelegate shareDelegate = (ShareDelegate) getShareDelegateSupplier().get(); @@ -396,7 +395,8 @@ public boolean onMenuOrKeyboardAction(int id, boolean fromMenu) { BraveVpnUtils.openBraveVpnProfileActivity(BraveActivity.this); } } else { - BraveVpnUtils.showProgressDialog(BraveActivity.this, + BraveVpnUtils.showProgressDialog( + BraveActivity.this, getResources().getString(R.string.vpn_connect_text)); if (BraveVpnPrefUtils.isSubscriptionPurchase()) { verifySubscription(); @@ -1114,7 +1114,7 @@ public void finishNativeInitialization() { .readBoolean(BravePreferenceKeys.BRAVE_AD_FREE_CALLOUT_DIALOG, true) && getActivityTab() != null && getActivityTab().getUrl().getSpec() != null - && UrlUtilities.isNTPUrl(getActivityTab().getUrl().getSpec()) + && UrlUtilities.isNtpUrl(getActivityTab().getUrl().getSpec()) && (ChromeSharedPreferences.getInstance() .readBoolean(BravePreferenceKeys.BRAVE_OPENED_YOUTUBE, false) || ChromeSharedPreferences.getInstance() @@ -1136,8 +1136,9 @@ && getActivityTab().getUrl().getSpec() != null handleDeepLinkVpn(); } else if (!mIsDeepLink && OnboardingPrefManager.getInstance().isOnboardingSearchBoxTooltip() - && getActivityTab() != null && getActivityTab().getUrl().getSpec() != null - && UrlUtilities.isNTPUrl(getActivityTab().getUrl().getSpec())) { + && getActivityTab() != null + && getActivityTab().getUrl().getSpec() != null + && UrlUtilities.isNtpUrl(getActivityTab().getUrl().getSpec())) { showSearchBoxTooltip(); } @@ -1455,8 +1456,9 @@ private void checkForNotificationData() { checkForBraveStats(); break; case RetentionNotificationUtil.DAY_6: - if (getActivityTab() != null && getActivityTab().getUrl().getSpec() != null - && !UrlUtilities.isNTPUrl(getActivityTab().getUrl().getSpec())) { + if (getActivityTab() != null + && getActivityTab().getUrl().getSpec() != null + && !UrlUtilities.isNtpUrl(getActivityTab().getUrl().getSpec())) { getTabCreator(false).launchUrl( UrlConstants.NTP_URL, TabLaunchType.FROM_CHROME_UI); } @@ -1489,8 +1491,9 @@ public void checkForBraveStats() { if (OnboardingPrefManager.getInstance().isBraveStatsEnabled()) { BraveStatsUtil.showBraveStats(); } else { - if (getActivityTab() != null && getActivityTab().getUrl().getSpec() != null - && !UrlUtilities.isNTPUrl(getActivityTab().getUrl().getSpec())) { + if (getActivityTab() != null + && getActivityTab().getUrl().getSpec() != null + && !UrlUtilities.isNtpUrl(getActivityTab().getUrl().getSpec())) { OnboardingPrefManager.getInstance().setFromNotification(true); if (getTabCreator(false) != null) { getTabCreator(false).launchUrl( diff --git a/android/java/org/chromium/chrome/browser/bookmarks/BraveBookmarkUiPrefs.java b/android/java/org/chromium/chrome/browser/bookmarks/BraveBookmarkUiPrefs.java new file mode 100644 index 000000000000..5eb46ea94889 --- /dev/null +++ b/android/java/org/chromium/chrome/browser/bookmarks/BraveBookmarkUiPrefs.java @@ -0,0 +1,31 @@ +/* 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/. */ + +package org.chromium.chrome.browser.bookmarks; + +import org.chromium.base.shared_preferences.SharedPreferencesManager; +import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; + +/** Brave's extension for BookmarkUiPrefs. */ +public class BraveBookmarkUiPrefs extends BookmarkUiPrefs { + private final SharedPreferencesManager mPrefsManager; + + public BraveBookmarkUiPrefs(SharedPreferencesManager prefsManager) { + super(prefsManager); + + mPrefsManager = 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/bookmarks/BraveBookmarkUtils.java b/android/java/org/chromium/chrome/browser/bookmarks/BraveBookmarkUtils.java index 8293473fbbc3..ec38064424ec 100644 --- a/android/java/org/chromium/chrome/browser/bookmarks/BraveBookmarkUtils.java +++ b/android/java/org/chromium/chrome/browser/bookmarks/BraveBookmarkUtils.java @@ -80,4 +80,9 @@ public static void showBookmarkImportExportDialog(AppCompatActivity appCompatAct Log.e(TAG, "showBookmarkImportExportDialog:" + e.getMessage()); } } + + public static boolean isSpecialFolder(BookmarkModel bookmarkModel, BookmarkItem item) { + // This is to avoid the root folder to have different color and tint. + return false; + } } diff --git a/android/java/org/chromium/chrome/browser/crypto_wallet/activities/AccountDetailActivity.java b/android/java/org/chromium/chrome/browser/crypto_wallet/activities/AccountDetailActivity.java index 3a91f53b1f09..e1a155ab38fa 100644 --- a/android/java/org/chromium/chrome/browser/crypto_wallet/activities/AccountDetailActivity.java +++ b/android/java/org/chromium/chrome/browser/crypto_wallet/activities/AccountDetailActivity.java @@ -20,6 +20,7 @@ import androidx.recyclerview.widget.RecyclerView; import org.chromium.base.Log; +import org.chromium.base.supplier.OneshotSupplier; import org.chromium.brave_wallet.mojom.AccountInfo; import org.chromium.brave_wallet.mojom.BlockchainToken; import org.chromium.brave_wallet.mojom.NetworkInfo; @@ -37,6 +38,8 @@ import org.chromium.chrome.browser.crypto_wallet.util.TokenUtils; import org.chromium.chrome.browser.crypto_wallet.util.Utils; import org.chromium.chrome.browser.crypto_wallet.util.WalletUtils; +import org.chromium.chrome.browser.init.ActivityProfileProvider; +import org.chromium.chrome.browser.profiles.ProfileProvider; import org.chromium.chrome.browser.util.LiveDataUtil; import java.lang.ref.WeakReference; @@ -255,4 +258,9 @@ private void initState() { private NetworkModel getNetworkModel() { return mWalletModel.getNetworkModel(); } + + @Override + protected OneshotSupplier createProfileProvider() { + return new ActivityProfileProvider(getLifecycleDispatcher()); + } } diff --git a/android/java/org/chromium/chrome/browser/crypto_wallet/activities/BraveWalletBaseActivity.java b/android/java/org/chromium/chrome/browser/crypto_wallet/activities/BraveWalletBaseActivity.java index 159fb252b593..c50854d93d46 100644 --- a/android/java/org/chromium/chrome/browser/crypto_wallet/activities/BraveWalletBaseActivity.java +++ b/android/java/org/chromium/chrome/browser/crypto_wallet/activities/BraveWalletBaseActivity.java @@ -7,6 +7,7 @@ import android.view.MenuItem; +import org.chromium.base.supplier.OneshotSupplier; import org.chromium.brave_wallet.mojom.AssetRatioService; import org.chromium.brave_wallet.mojom.BlockchainRegistry; import org.chromium.brave_wallet.mojom.BraveWalletP3a; @@ -27,7 +28,9 @@ import org.chromium.chrome.browser.crypto_wallet.observers.KeyringServiceObserverImpl.KeyringServiceObserverImplDelegate; import org.chromium.chrome.browser.crypto_wallet.observers.TxServiceObserverImpl; import org.chromium.chrome.browser.crypto_wallet.observers.TxServiceObserverImpl.TxServiceObserverImplDelegate; +import org.chromium.chrome.browser.init.ActivityProfileProvider; import org.chromium.chrome.browser.init.AsyncInitializationActivity; +import org.chromium.chrome.browser.profiles.ProfileProvider; import org.chromium.mojo.bindings.ConnectionErrorHandler; import org.chromium.mojo.system.MojoException; @@ -273,4 +276,9 @@ public void onUnapprovedTxUpdated(TransactionInfo txInfo) {} @Override public void onTransactionStatusChanged(TransactionInfo txInfo) {} + + @Override + protected OneshotSupplier createProfileProvider() { + return new ActivityProfileProvider(getLifecycleDispatcher()); + } } 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 933cfe9c1a8f..b2f368e83415 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 @@ -17,6 +17,7 @@ import org.chromium.base.Log; import org.chromium.base.ThreadUtils; +import org.chromium.base.supplier.OneshotSupplier; import org.chromium.brave_wallet.mojom.TransactionInfo; import org.chromium.chrome.R; import org.chromium.chrome.browser.app.BraveActivity; @@ -33,6 +34,8 @@ import org.chromium.chrome.browser.crypto_wallet.listeners.TransactionConfirmationListener; import org.chromium.chrome.browser.crypto_wallet.util.PendingTxHelper; import org.chromium.chrome.browser.crypto_wallet.util.TransactionUtils; +import org.chromium.chrome.browser.init.ActivityProfileProvider; +import org.chromium.chrome.browser.profiles.ProfileProvider; import java.util.HashMap; import java.util.Map; @@ -266,4 +269,9 @@ public void onDestroy() { mPendingTxHelper.destroy(); } } + + @Override + protected OneshotSupplier createProfileProvider() { + return new ActivityProfileProvider(getLifecycleDispatcher()); + } } diff --git a/android/java/org/chromium/chrome/browser/firstrun/BraveFirstRunFlowSequencer.java b/android/java/org/chromium/chrome/browser/firstrun/BraveFirstRunFlowSequencer.java index 4dc0ff164a25..60c4de94ab5e 100644 --- a/android/java/org/chromium/chrome/browser/firstrun/BraveFirstRunFlowSequencer.java +++ b/android/java/org/chromium/chrome/browser/firstrun/BraveFirstRunFlowSequencer.java @@ -4,16 +4,21 @@ * You can obtain one at https://mozilla.org/MPL/2.0/. */ package org.chromium.chrome.browser.firstrun; + import android.app.Activity; import org.chromium.base.supplier.OneshotSupplier; -import org.chromium.chrome.browser.profiles.Profile; +import org.chromium.chrome.browser.profiles.ProfileProvider; import org.chromium.components.signin.AccountManagerFacadeProvider; public abstract class BraveFirstRunFlowSequencer extends FirstRunFlowSequencer { - public BraveFirstRunFlowSequencer(Activity activity, OneshotSupplier profileSupplier) { - super(activity, profileSupplier, - new ChildAccountStatusSupplier(AccountManagerFacadeProvider.getInstance(), + public BraveFirstRunFlowSequencer( + Activity activity, OneshotSupplier profileSupplier) { + super( + activity, + profileSupplier, + new ChildAccountStatusSupplier( + AccountManagerFacadeProvider.getInstance(), FirstRunAppRestrictionInfo.takeMaybeInitialized())); } diff --git a/android/java/org/chromium/chrome/browser/firstrun/WelcomeOnboardingActivity.java b/android/java/org/chromium/chrome/browser/firstrun/WelcomeOnboardingActivity.java index 3a57a3a791e6..82dafad53875 100644 --- a/android/java/org/chromium/chrome/browser/firstrun/WelcomeOnboardingActivity.java +++ b/android/java/org/chromium/chrome/browser/firstrun/WelcomeOnboardingActivity.java @@ -491,12 +491,13 @@ public void finishNativeInitialization() { public void triggerLayoutInflation() { super.triggerLayoutInflation(); - mFirstRunFlowSequencer = new BraveFirstRunFlowSequencer(this, getProfileSupplier()) { - @Override - public void onFlowIsKnown(Bundle freProperties) { - initializeViews(); - } - }; + mFirstRunFlowSequencer = + new BraveFirstRunFlowSequencer(this, getProfileProviderSupplier()) { + @Override + public void onFlowIsKnown(Bundle freProperties) { + initializeViews(); + } + }; mFirstRunFlowSequencer.start(); onInitialLayoutInflationComplete(); } diff --git a/android/java/org/chromium/chrome/browser/notifications/retention/RetentionNotificationPublisher.java b/android/java/org/chromium/chrome/browser/notifications/retention/RetentionNotificationPublisher.java index e3cad7e96c48..77ce8c992e90 100644 --- a/android/java/org/chromium/chrome/browser/notifications/retention/RetentionNotificationPublisher.java +++ b/android/java/org/chromium/chrome/browser/notifications/retention/RetentionNotificationPublisher.java @@ -50,7 +50,7 @@ public void onReceive(Context context, Intent intent) { case RetentionNotificationUtil.DAY_6: if (braveActivity.getActivityTab() != null && braveActivity.getActivityTab().getUrl().getSpec() != null - && !UrlUtilities.isNTPUrl( + && !UrlUtilities.isNtpUrl( braveActivity.getActivityTab().getUrl().getSpec())) { braveActivity.getTabCreator(false).launchUrl( UrlConstants.NTP_URL, TabLaunchType.FROM_CHROME_UI); diff --git a/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPage.java b/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPage.java index 76ba5ea94ff4..814588447bcb 100644 --- a/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPage.java +++ b/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPage.java @@ -34,7 +34,6 @@ import org.chromium.chrome.browser.ui.native_page.NativePageHost; import org.chromium.chrome.browser.xsurface.feed.FeedLaunchReliabilityLogger.SurfaceType; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; -import org.chromium.components.browser_ui.settings.SettingsLauncher; import org.chromium.components.search_engines.TemplateUrlService; import org.chromium.ui.base.WindowAndroid; @@ -67,7 +66,6 @@ public BraveNewTabPage( WindowAndroid windowAndroid, JankTracker jankTracker, Supplier toolbarSupplier, - SettingsLauncher settingsLauncher, HomeSurfaceTracker homeSurfaceTracker, ObservableSupplier tabContentManagerSupplier) { super( @@ -88,7 +86,6 @@ public BraveNewTabPage( windowAndroid, jankTracker, toolbarSupplier, - settingsLauncher, homeSurfaceTracker, tabContentManagerSupplier); @@ -112,8 +109,9 @@ public BraveNewTabPage( } } // Re-add to the new tab's profile - TemplateUrlService templateUrlService = TemplateUrlServiceFactory.getForProfile( - Profile.fromWebContents(mTab.getWebContents())); + TemplateUrlService templateUrlService = + TemplateUrlServiceFactory.getForProfile( + Profile.fromWebContents(mTab.getWebContents())); templateUrlService.addObserver(this); } diff --git a/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPageLayout.java b/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPageLayout.java index afb35f730396..b567b8423664 100644 --- a/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPageLayout.java +++ b/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPageLayout.java @@ -102,7 +102,6 @@ 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.tab.TabImpl; import org.chromium.chrome.browser.ui.native_page.TouchEnabledDelegate; import org.chromium.chrome.browser.util.TabUtils; import org.chromium.components.browser_ui.settings.SettingsLauncher; @@ -1292,11 +1291,11 @@ private void checkAndShowNTPImage(boolean isReset) { } private void initilizeSponsoredTab() { - if (TabAttributes.from(getTab()).get(String.valueOf(getTabImpl().getId())) == null) { + if (TabAttributes.from(getTab()).get(String.valueOf(getTab().getId())) == null) { SponsoredTab sponsoredTab = new SponsoredTab(mNTPBackgroundImagesBridge); - TabAttributes.from(getTab()).set(String.valueOf(getTabImpl().getId()), sponsoredTab); + TabAttributes.from(getTab()).set(String.valueOf(getTab().getId()), sponsoredTab); } - mSponsoredTab = TabAttributes.from(getTab()).get(String.valueOf((getTabImpl()).getId())); + mSponsoredTab = TabAttributes.from(getTab()).get(String.valueOf((getTab()).getId())); if (shouldShowSuperReferral()) mNTPBackgroundImagesBridge.getTopSites(); } @@ -1471,10 +1470,6 @@ private Tab getTab() { return mTab; } - private TabImpl getTabImpl() { - return (TabImpl) getTab(); - } - @Override public void onConnectionError(MojoException e) { if (mBraveNewsController != null) { diff --git a/android/java/org/chromium/chrome/browser/ntp_background_images/RewardsBottomSheetDialogFragment.java b/android/java/org/chromium/chrome/browser/ntp_background_images/RewardsBottomSheetDialogFragment.java index bd226bbd463e..40e501ec9951 100644 --- a/android/java/org/chromium/chrome/browser/ntp_background_images/RewardsBottomSheetDialogFragment.java +++ b/android/java/org/chromium/chrome/browser/ntp_background_images/RewardsBottomSheetDialogFragment.java @@ -39,7 +39,6 @@ import org.chromium.chrome.browser.settings.BackgroundImagesPreferences; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabAttributes; -import org.chromium.chrome.browser.tab.TabImpl; import org.chromium.chrome.browser.util.ConfigurationUtils; import org.chromium.chrome.browser.util.TabUtils; import org.chromium.ui.base.DeviceFormFactor; @@ -47,7 +46,8 @@ public class RewardsBottomSheetDialogFragment extends BottomSheetDialogFragment { private static final String TAG = "RewardsBottomSheet"; - private static final String BRAVE_TERMS_PAGE = "https://basicattentiontoken.org/user-terms-of-service/"; + private static final String BRAVE_TERMS_PAGE = + "https://basicattentiontoken.org/user-terms-of-service/"; private static final String BRAVE_REWARDS_LEARN_MORE = "https://brave.com/faq-rewards"; private int ntpType; @@ -203,9 +203,10 @@ private void reloadTab() { ChromeTabbedActivity chromeTabbedActivity = BraveRewardsHelper.getChromeTabbedActivity(); if (chromeTabbedActivity != null && chromeTabbedActivity.getActivityTab() != null) { Tab currentTab = chromeTabbedActivity.getActivityTab(); - SponsoredTab sponsoredTab = TabAttributes.from(currentTab).get(String.valueOf(((TabImpl)currentTab).getId())); + SponsoredTab sponsoredTab = + TabAttributes.from(currentTab).get(String.valueOf(currentTab.getId())); sponsoredTab.setNTPImage(SponsoredImageUtil.getBackgroundImage()); - TabAttributes.from(currentTab).set(String.valueOf(((TabImpl)currentTab).getId()), sponsoredTab); + TabAttributes.from(currentTab).set(String.valueOf(currentTab.getId()), sponsoredTab); newTabPageListener.updateNTPImage(); } } diff --git a/android/java/org/chromium/chrome/browser/omnibox/BraveLocationBarCoordinator.java b/android/java/org/chromium/chrome/browser/omnibox/BraveLocationBarCoordinator.java index 102c6c3b89a1..8adf939f8cda 100644 --- a/android/java/org/chromium/chrome/browser/omnibox/BraveLocationBarCoordinator.java +++ b/android/java/org/chromium/chrome/browser/omnibox/BraveLocationBarCoordinator.java @@ -54,44 +54,74 @@ public class BraveLocationBarCoordinator extends LocationBarCoordinator { private View mQRButton; - public BraveLocationBarCoordinator(View locationBarLayout, View autocompleteAnchorView, + public BraveLocationBarCoordinator( + View locationBarLayout, + View autocompleteAnchorView, ObservableSupplier profileObservableSupplier, PrivacyPreferencesManager privacyPreferencesManager, - LocationBarDataProvider locationBarDataProvider, ActionMode.Callback actionModeCallback, - WindowDelegate windowDelegate, WindowAndroid windowAndroid, + LocationBarDataProvider locationBarDataProvider, + ActionMode.Callback actionModeCallback, + WindowDelegate windowDelegate, + WindowAndroid windowAndroid, @NonNull Supplier activityTabSupplier, Supplier modalDialogManagerSupplier, Supplier shareDelegateSupplier, IncognitoStateProvider incognitoStateProvider, ActivityLifecycleDispatcher activityLifecycleDispatcher, OverrideUrlLoadingDelegate overrideUrlLoadingDelegate, - BackKeyBehaviorDelegate backKeyBehavior, SearchEngineLogoUtils searchEngineLogoUtils, - @NonNull PageInfoAction pageInfoAction, @NonNull Callback bringTabToFrontCallback, - @NonNull SaveOfflineButtonState saveOfflineButtonState, @NonNull OmniboxUma omniboxUma, + BackKeyBehaviorDelegate backKeyBehavior, + @NonNull PageInfoAction pageInfoAction, + @NonNull Callback bringTabToFrontCallback, + @NonNull SaveOfflineButtonState saveOfflineButtonState, + @NonNull OmniboxUma omniboxUma, @NonNull Supplier tabWindowManagerSupplier, @NonNull BookmarkState bookmarkState, @NonNull BooleanSupplier isToolbarMicEnabledSupplier, - @Nullable Supplier - merchantTrustSignalsCoordinatorSupplier, + @Nullable + Supplier + merchantTrustSignalsCoordinatorSupplier, @NonNull OmniboxActionDelegate omniboxActionDelegate, BrowserStateBrowserControlsVisibilityDelegate browserControlsVisibilityDelegate, Callback reportExceptionCallback, @Nullable BackPressManager backPressManager, - @NonNull OmniboxSuggestionsDropdownScrollListener - omniboxSuggestionsDropdownScrollListener, + @NonNull + OmniboxSuggestionsDropdownScrollListener + omniboxSuggestionsDropdownScrollListener, @Nullable OpenHistoryClustersDelegate openHistoryClustersDelegate, - @Nullable ObservableSupplier tabModelSelectorSupplier) { - super(locationBarLayout, autocompleteAnchorView, profileObservableSupplier, - privacyPreferencesManager, locationBarDataProvider, actionModeCallback, - windowDelegate, windowAndroid, activityTabSupplier, modalDialogManagerSupplier, - shareDelegateSupplier, incognitoStateProvider, activityLifecycleDispatcher, - overrideUrlLoadingDelegate, backKeyBehavior, searchEngineLogoUtils, pageInfoAction, - bringTabToFrontCallback, saveOfflineButtonState, omniboxUma, - tabWindowManagerSupplier, bookmarkState, isToolbarMicEnabledSupplier, - merchantTrustSignalsCoordinatorSupplier, omniboxActionDelegate, - browserControlsVisibilityDelegate, reportExceptionCallback, backPressManager, - omniboxSuggestionsDropdownScrollListener, openHistoryClustersDelegate, - tabModelSelectorSupplier); + @Nullable ObservableSupplier tabModelSelectorSupplier, + boolean forcePhoneStyleOmnibox) { + super( + locationBarLayout, + autocompleteAnchorView, + profileObservableSupplier, + privacyPreferencesManager, + locationBarDataProvider, + actionModeCallback, + windowDelegate, + windowAndroid, + activityTabSupplier, + modalDialogManagerSupplier, + shareDelegateSupplier, + incognitoStateProvider, + activityLifecycleDispatcher, + overrideUrlLoadingDelegate, + backKeyBehavior, + pageInfoAction, + bringTabToFrontCallback, + saveOfflineButtonState, + omniboxUma, + tabWindowManagerSupplier, + bookmarkState, + isToolbarMicEnabledSupplier, + merchantTrustSignalsCoordinatorSupplier, + omniboxActionDelegate, + browserControlsVisibilityDelegate, + reportExceptionCallback, + backPressManager, + omniboxSuggestionsDropdownScrollListener, + openHistoryClustersDelegate, + tabModelSelectorSupplier, + forcePhoneStyleOmnibox); 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 544045ab2b0a..f678caad6365 100644 --- a/android/java/org/chromium/chrome/browser/omnibox/BraveLocationBarMediator.java +++ b/android/java/org/chromium/chrome/browser/omnibox/BraveLocationBarMediator.java @@ -42,7 +42,8 @@ public class BraveLocationBarMediator extends LocationBarMediator { private Context mContext; private @BrandedColorScheme int mBrandedColorScheme = BrandedColorScheme.APP_DEFAULT; - public BraveLocationBarMediator(@NonNull Context context, + public BraveLocationBarMediator( + @NonNull Context context, @NonNull LocationBarLayout locationBarLayout, @NonNull LocationBarDataProvider locationBarDataProvider, @NonNull ObservableSupplier profileSupplier, @@ -50,18 +51,33 @@ public BraveLocationBarMediator(@NonNull Context context, @NonNull OverrideUrlLoadingDelegate overrideUrlLoadingDelegate, @NonNull LocaleManager localeManager, @NonNull OneshotSupplier templateUrlServiceSupplier, - @NonNull BackKeyBehaviorDelegate backKeyBehavior, @NonNull WindowAndroid windowAndroid, - boolean isTablet, @NonNull SearchEngineLogoUtils searchEngineLogoUtils, + @NonNull BackKeyBehaviorDelegate backKeyBehavior, + @NonNull WindowAndroid windowAndroid, + boolean isTablet, @NonNull LensController lensController, - @NonNull SaveOfflineButtonState saveOfflineButtonState, @NonNull OmniboxUma omniboxUma, + @NonNull SaveOfflineButtonState saveOfflineButtonState, + @NonNull OmniboxUma omniboxUma, @NonNull BooleanSupplier isToolbarMicEnabledSupplier, @NonNull OmniboxSuggestionsDropdownEmbedderImpl dropdownEmbedder, @Nullable ObservableSupplier tabModelSelectorSupplier) { - super(context, locationBarLayout, locationBarDataProvider, profileSupplier, - privacyPreferencesManager, overrideUrlLoadingDelegate, localeManager, - templateUrlServiceSupplier, backKeyBehavior, windowAndroid, isTablet, - searchEngineLogoUtils, lensController, saveOfflineButtonState, omniboxUma, - isToolbarMicEnabledSupplier, dropdownEmbedder, tabModelSelectorSupplier); + super( + context, + locationBarLayout, + locationBarDataProvider, + profileSupplier, + privacyPreferencesManager, + overrideUrlLoadingDelegate, + localeManager, + templateUrlServiceSupplier, + backKeyBehavior, + windowAndroid, + isTablet, + lensController, + saveOfflineButtonState, + omniboxUma, + isToolbarMicEnabledSupplier, + dropdownEmbedder, + tabModelSelectorSupplier); } public static Class getOmniboxUmaClass() { diff --git a/android/java/org/chromium/chrome/browser/playlist/PlaylistHostActivity.java b/android/java/org/chromium/chrome/browser/playlist/PlaylistHostActivity.java index 51f704346b4a..e470b65adf9f 100644 --- a/android/java/org/chromium/chrome/browser/playlist/PlaylistHostActivity.java +++ b/android/java/org/chromium/chrome/browser/playlist/PlaylistHostActivity.java @@ -28,12 +28,15 @@ import com.brave.playlist.view.bottomsheet.MoveOrCopyToPlaylistBottomSheet; import org.chromium.base.BraveFeatureList; +import org.chromium.base.supplier.OneshotSupplier; import org.chromium.chrome.R; import org.chromium.chrome.browser.flags.ChromeFeatureList; +import org.chromium.chrome.browser.init.ActivityProfileProvider; import org.chromium.chrome.browser.init.AsyncInitializationActivity; import org.chromium.chrome.browser.playlist.PlaylistServiceObserverImpl.PlaylistServiceObserverImplDelegate; import org.chromium.chrome.browser.playlist.settings.BravePlaylistPreferences; import org.chromium.chrome.browser.preferences.ChromeSharedPreferences; +import org.chromium.chrome.browser.profiles.ProfileProvider; import org.chromium.chrome.browser.util.TabUtils; import org.chromium.mojo.bindings.ConnectionErrorHandler; import org.chromium.mojo.system.MojoException; @@ -480,4 +483,9 @@ public void onDestroy() { public boolean shouldStartGpuProcess() { return true; } + + @Override + protected OneshotSupplier createProfileProvider() { + return new ActivityProfileProvider(getLifecycleDispatcher()); + } } diff --git a/android/java/org/chromium/chrome/browser/rewards/tipping/RewardsTippingBannerActivity.java b/android/java/org/chromium/chrome/browser/rewards/tipping/RewardsTippingBannerActivity.java index 814240b5457f..16cfe976a268 100644 --- a/android/java/org/chromium/chrome/browser/rewards/tipping/RewardsTippingBannerActivity.java +++ b/android/java/org/chromium/chrome/browser/rewards/tipping/RewardsTippingBannerActivity.java @@ -10,14 +10,16 @@ import android.view.View; import org.chromium.base.IntentUtils; +import org.chromium.base.supplier.OneshotSupplier; import org.chromium.chrome.R; import org.chromium.chrome.browser.BraveRewardsHelper; import org.chromium.chrome.browser.BraveRewardsNativeWorker; import org.chromium.chrome.browser.BraveRewardsObserver; +import org.chromium.chrome.browser.init.ActivityProfileProvider; import org.chromium.chrome.browser.init.AsyncInitializationActivity; +import org.chromium.chrome.browser.profiles.ProfileProvider; import org.chromium.chrome.browser.rewards.BraveRewardsBannerInfo; - public class RewardsTippingBannerActivity extends AsyncInitializationActivity implements BraveRewardsObserver { public static final String TAB_ID_EXTRA = "currentTabId"; @@ -61,4 +63,9 @@ private void showCustomUI() { public boolean shouldStartGpuProcess() { return true; } + + @Override + protected OneshotSupplier createProfileProvider() { + return new ActivityProfileProvider(getLifecycleDispatcher()); + } } diff --git a/android/java/org/chromium/chrome/browser/search_engines/BUILD.gn b/android/java/org/chromium/chrome/browser/search_engines/BUILD.gn index 6f1de73e7cad..05751567ccf3 100644 --- a/android/java/org/chromium/chrome/browser/search_engines/BUILD.gn +++ b/android/java/org/chromium/chrome/browser/search_engines/BUILD.gn @@ -19,13 +19,13 @@ android_library("java") { deps = [ ":java_resources", "//base:base_java", - "//base:jni_java", "//build/android:build_java", "//chrome/browser/profiles/android:java", "//chrome/browser/search_engines/android:java", "//components/search_engines/android:java", "//third_party/androidx:androidx_annotation_annotation_java", "//third_party/androidx:androidx_fragment_fragment_java", + "//third_party/jni_zero:jni_zero_java", ] resources_package = "org.chromium.chrome.browser.search_engines" diff --git a/android/java/org/chromium/chrome/browser/search_engines/settings/BraveBaseSearchEngineAdapter.java b/android/java/org/chromium/chrome/browser/search_engines/settings/BraveBaseSearchEngineAdapter.java index 4c58f7ec6c15..f64576fc2c12 100644 --- a/android/java/org/chromium/chrome/browser/search_engines/settings/BraveBaseSearchEngineAdapter.java +++ b/android/java/org/chromium/chrome/browser/search_engines/settings/BraveBaseSearchEngineAdapter.java @@ -42,9 +42,12 @@ public int getCount() { } public static void sortAndFilterUnnecessaryTemplateUrl( - List templateUrls, TemplateUrl defaultSearchEngine) { + List templateUrls, + TemplateUrl defaultSearchEngine, + boolean isInEeaChoiceCountry) { int recentEngineNum = 0; - long displayTime = System.currentTimeMillis() - SearchEngineAdapter.MAX_DISPLAY_TIME_SPAN_MS; + long displayTime = + System.currentTimeMillis() - SearchEngineAdapter.MAX_DISPLAY_TIME_SPAN_MS; Set templateUrlSet = new HashSet(); Iterator iterator = templateUrls.iterator(); while (iterator.hasNext()) { diff --git a/android/java/org/chromium/chrome/browser/settings/NetworkListBaseAdapter.java b/android/java/org/chromium/chrome/browser/settings/NetworkListBaseAdapter.java index 8a36ac1849b2..62838792081d 100644 --- a/android/java/org/chromium/chrome/browser/settings/NetworkListBaseAdapter.java +++ b/android/java/org/chromium/chrome/browser/settings/NetworkListBaseAdapter.java @@ -5,7 +5,7 @@ package org.chromium.chrome.browser.settings; -import static org.chromium.components.browser_ui.widget.listmenu.BasicListMenu.buildMenuListItem; +import static org.chromium.components.browser_ui.widget.BrowserUiListMenuUtils.buildMenuListItem; import android.annotation.SuppressLint; import android.content.Context; @@ -13,6 +13,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; +import android.widget.ListView; import android.widget.TextView; import androidx.annotation.NonNull; @@ -22,11 +23,11 @@ import org.chromium.brave_wallet.mojom.NetworkInfo; import org.chromium.chrome.R; -import org.chromium.components.browser_ui.widget.listmenu.BasicListMenu; -import org.chromium.components.browser_ui.widget.listmenu.ListMenu; -import org.chromium.components.browser_ui.widget.listmenu.ListMenuButton; -import org.chromium.components.browser_ui.widget.listmenu.ListMenuButtonDelegate; -import org.chromium.components.browser_ui.widget.listmenu.ListMenuItemProperties; +import org.chromium.ui.listmenu.BasicListMenu; +import org.chromium.ui.listmenu.ListMenu; +import org.chromium.ui.listmenu.ListMenuButton; +import org.chromium.ui.listmenu.ListMenuButtonDelegate; +import org.chromium.ui.listmenu.ListMenuItemProperties; import org.chromium.ui.modelutil.MVCListAdapter.ModelList; import java.util.ArrayList; @@ -124,19 +125,27 @@ public void onBindViewHolder(ViewHolder viewHolder, int i) { menuItems.add(buildMenuListItem(R.string.remove, 0, 0)); menuItems.add(buildMenuListItem(R.string.brave_wallet_add_network_set_as_active, 0, 0)); - ListMenu.Delegate delegate = (model) -> { - int textId = model.get(ListMenuItemProperties.TITLE_ID); - if (textId == R.string.edit) { - mListener.onItemClicked(info, activeNetwork); - } else if (textId == R.string.remove) { - mListener.onItemRemove(info); - } else if (textId == R.string.brave_wallet_add_network_set_as_active) { - mListener.onItemSetAsActive(info); - } - }; - ((RowViewHolder) viewHolder).setMenuButtonDelegate(() -> { - return new BasicListMenu(mContext, menuItems, delegate); - }); + ListMenu.Delegate delegate = + (model) -> { + int textId = model.get(ListMenuItemProperties.TITLE_ID); + if (textId == R.string.edit) { + mListener.onItemClicked(info, activeNetwork); + } else if (textId == R.string.remove) { + mListener.onItemRemove(info); + } else if (textId == R.string.brave_wallet_add_network_set_as_active) { + mListener.onItemSetAsActive(info); + } + }; + ((RowViewHolder) viewHolder) + .setMenuButtonDelegate( + () -> { + View contentView = + LayoutInflater.from(mContext) + .inflate(R.layout.app_menu_layout, null); + ListView listView = contentView.findViewById(R.id.app_menu_list); + return new BasicListMenu( + mContext, menuItems, contentView, listView, delegate, 0); + }); } @Override 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 3c04d1673d9b..18f1adea931b 100644 --- a/android/java/org/chromium/chrome/browser/tabbed_mode/BraveTabbedRootUiCoordinator.java +++ b/android/java/org/chromium/chrome/browser/tabbed_mode/BraveTabbedRootUiCoordinator.java @@ -32,6 +32,7 @@ import org.chromium.chrome.browser.fullscreen.FullscreenManager; import org.chromium.chrome.browser.layouts.LayoutStateProvider; import org.chromium.chrome.browser.lifecycle.ActivityLifecycleDispatcher; +import org.chromium.chrome.browser.multiwindow.MultiInstanceManager; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.share.ShareDelegate; import org.chromium.chrome.browser.tab.Tab; @@ -100,7 +101,8 @@ public BraveTabbedRootUiCoordinator( OneshotSupplier tabReparentingControllerSupplier, boolean initializeUiWithIncognitoColors, @NonNull BackPressManager backPressManager, - @Nullable Bundle savedInstanceState) { + @Nullable Bundle savedInstanceState, + @Nullable MultiInstanceManager multiInstanceManager) { super( activity, onOmniboxFocusChangedListener, @@ -144,7 +146,8 @@ public BraveTabbedRootUiCoordinator( tabReparentingControllerSupplier, initializeUiWithIncognitoColors, backPressManager, - savedInstanceState); + savedInstanceState, + multiInstanceManager); mActivity = activity; } diff --git a/android/java/org/chromium/chrome/browser/tabmodel/BraveTabCreator.java b/android/java/org/chromium/chrome/browser/tabmodel/BraveTabCreator.java index 2d19785aabfd..7da07748436a 100644 --- a/android/java/org/chromium/chrome/browser/tabmodel/BraveTabCreator.java +++ b/android/java/org/chromium/chrome/browser/tabmodel/BraveTabCreator.java @@ -11,6 +11,7 @@ import androidx.annotation.Nullable; import org.chromium.base.BraveReflectionUtil; +import org.chromium.base.supplier.OneshotSupplier; import org.chromium.base.supplier.Supplier; import org.chromium.chrome.browser.ChromeTabbedActivity; import org.chromium.chrome.browser.app.BraveActivity; @@ -20,6 +21,7 @@ import org.chromium.chrome.browser.ntp_background_images.util.SponsoredImageUtil; import org.chromium.chrome.browser.preferences.BravePref; import org.chromium.chrome.browser.profiles.Profile; +import org.chromium.chrome.browser.profiles.ProfileProvider; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabDelegateFactory; import org.chromium.chrome.browser.tab.TabLaunchType; @@ -33,8 +35,9 @@ public BraveTabCreator( Activity activity, WindowAndroid nativeWindow, Supplier tabDelegateFactory, + OneshotSupplier profileProviderSupplier, boolean incognito, - OverviewNTPCreator overviewNTPCreator, + OverviewNtpCreator overviewNTPCreator, AsyncTabParamsManager asyncTabParamsManager, Supplier tabModelSelectorSupplier, Supplier compositorViewHolderSupplier, @@ -43,6 +46,7 @@ public BraveTabCreator( activity, nativeWindow, tabDelegateFactory, + profileProviderSupplier, incognito, overviewNTPCreator, asyncTabParamsManager, diff --git a/android/java/org/chromium/chrome/browser/toolbar/BraveToolbarManager.java b/android/java/org/chromium/chrome/browser/toolbar/BraveToolbarManager.java index fcab1bb6840c..bb934d95d30a 100644 --- a/android/java/org/chromium/chrome/browser/toolbar/BraveToolbarManager.java +++ b/android/java/org/chromium/chrome/browser/toolbar/BraveToolbarManager.java @@ -32,6 +32,7 @@ import org.chromium.chrome.browser.compositor.bottombar.ephemeraltab.EphemeralTabCoordinator; import org.chromium.chrome.browser.compositor.layouts.LayoutManagerImpl; import org.chromium.chrome.browser.compositor.layouts.content.TabContentManager; +import org.chromium.chrome.browser.compositor.overlays.strip.StripLayoutHelperManager; import org.chromium.chrome.browser.findinpage.FindToolbarManager; import org.chromium.chrome.browser.fullscreen.FullscreenManager; import org.chromium.chrome.browser.homepage.HomepageManager; @@ -100,7 +101,6 @@ public class BraveToolbarManager extends ToolbarManager { private ObservableSupplierImpl mOverlayPanelVisibilitySupplier; private TabModelSelector mTabModelSelector; private IncognitoStateProvider mIncognitoStateProvider; - private TabCountProvider mTabCountProvider; private TabGroupUi mTabGroupUi; private BottomSheetController mBottomSheetController; private ActivityLifecycleDispatcher mActivityLifecycleDispatcher; @@ -241,9 +241,13 @@ mOverlayPanelVisibilitySupplier, getConstraintsProxy(), mBookmarkModelSupplier, } @Override - public void initializeWithNative(LayoutManagerImpl layoutManager, - OnClickListener tabSwitcherClickHandler, OnClickListener newTabClickHandler, - OnClickListener bookmarkClickHandler, OnClickListener customTabsBackClickHandler, + public void initializeWithNative( + @NonNull LayoutManagerImpl layoutManager, + @Nullable StripLayoutHelperManager stripLayoutHelperManager, + OnClickListener tabSwitcherClickHandler, + OnClickListener newTabClickHandler, + OnClickListener bookmarkClickHandler, + OnClickListener customTabsBackClickHandler, Supplier showStartSurfaceSupplier) { OnClickListener wrappedNewTabClickHandler = v -> { @@ -252,6 +256,7 @@ public void initializeWithNative(LayoutManagerImpl layoutManager, }; super.initializeWithNative( layoutManager, + stripLayoutHelperManager, tabSwitcherClickHandler, wrappedNewTabClickHandler, bookmarkClickHandler, @@ -260,12 +265,14 @@ public void initializeWithNative(LayoutManagerImpl layoutManager, if (isToolbarPhone() && BottomToolbarConfiguration.isBottomToolbarEnabled()) { enableBottomControls(); - Runnable closeAllTabsAction = () -> { - mTabModelSelector.getModel(mIncognitoStateProvider.isIncognitoSelected()) - .closeAllTabs(); - }; + Runnable closeAllTabsAction = + () -> { + mTabModelSelector + .getModel(mIncognitoStateProvider.isIncognitoSelected()) + .closeAllTabs(); + }; assert (mBottomControlsCoordinatorSupplier.get() - instanceof BraveBottomControlsCoordinator); + instanceof BraveBottomControlsCoordinator); ((BraveBottomControlsCoordinator) mBottomControlsCoordinatorSupplier.get()) .initializeWithNative( mActivity, @@ -274,7 +281,7 @@ public void initializeWithNative(LayoutManagerImpl layoutManager, tabSwitcherClickHandler, wrappedNewTabClickHandler, mWindowAndroid, - mTabCountProvider, + mTabModelSelector, mIncognitoStateProvider, mActivity.findViewById(R.id.control_container), closeAllTabsAction); diff --git a/android/java/org/chromium/chrome/browser/toolbar/bottom/BottomToolbarCoordinator.java b/android/java/org/chromium/chrome/browser/toolbar/bottom/BottomToolbarCoordinator.java index f9aaaca8edc9..367570d3f7ca 100644 --- a/android/java/org/chromium/chrome/browser/toolbar/bottom/BottomToolbarCoordinator.java +++ b/android/java/org/chromium/chrome/browser/toolbar/bottom/BottomToolbarCoordinator.java @@ -35,10 +35,10 @@ import org.chromium.chrome.browser.layouts.LayoutType; import org.chromium.chrome.browser.omnibox.OmniboxFocusReason; import org.chromium.chrome.browser.tabmodel.IncognitoStateProvider; +import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.tasks.ReturnToChromeUtil; import org.chromium.chrome.browser.theme.ThemeColorProvider; import org.chromium.chrome.browser.toolbar.LocationBarModel; -import org.chromium.chrome.browser.toolbar.TabCountProvider; import org.chromium.chrome.browser.toolbar.home_button.HomeButton; import org.chromium.chrome.browser.ui.appmenu.AppMenuButtonHelper; import org.chromium.chrome.browser.util.TabUtils; @@ -131,39 +131,54 @@ class BottomToolbarCoordinator implements View.OnLongClickListener { /** * Initialize the bottom toolbar with the components that had native initialization * dependencies. - *

- * Calling this must occur after the native library have completely loaded. - * @param tabSwitcherListener An {@link OnClickListener} that is triggered when the - * tab switcher button is clicked. - * @param newTabClickListener An {@link OnClickListener} that is triggered when the - * new tab button is clicked. - * @param tabCountProvider Updates the tab count number in the tab switcher button and in the - * incognito toggle tab layout. + * + *

Calling this must occur after the native library have completely loaded. + * + * @param tabSwitcherListener An {@link OnClickListener} that is triggered when the tab switcher + * button is clicked. + * @param newTabClickListener An {@link OnClickListener} that is triggered when the new tab + * button is clicked. + * @param tabModelSelector Updates the tab count number in the tab switcher button and in the + * incognito toggle tab layout. * @param incognitoStateProvider Notifies components when incognito mode is entered or exited. * @param topToolbarRoot The root {@link ViewGroup} of the top toolbar. * @param closeAllTabsAction The runnable that closes all tabs in the current tab model. */ - void initializeWithNative(OnClickListener tabSwitcherListener, - OnClickListener newTabClickListener, TabCountProvider tabCountProvider, - IncognitoStateProvider incognitoStateProvider, ViewGroup topToolbarRoot, + void initializeWithNative( + OnClickListener tabSwitcherListener, + OnClickListener newTabClickListener, + TabModelSelector tabModelSelector, + IncognitoStateProvider incognitoStateProvider, + ViewGroup topToolbarRoot, Runnable closeAllTabsAction) { - final OnClickListener closeTabsClickListener = v -> { - final boolean isIncognito = incognitoStateProvider.isIncognitoSelected(); - if (isIncognito) { - RecordUserAction.record("MobileToolbarCloseAllIncognitoTabsButtonTap"); - } else { - RecordUserAction.record("MobileToolbarCloseAllRegularTabsButtonTap"); - } + final OnClickListener closeTabsClickListener = + v -> { + final boolean isIncognito = incognitoStateProvider.isIncognitoSelected(); + if (isIncognito) { + RecordUserAction.record("MobileToolbarCloseAllIncognitoTabsButtonTap"); + } else { + RecordUserAction.record("MobileToolbarCloseAllRegularTabsButtonTap"); + } - closeAllTabsAction.run(); - }; + closeAllTabsAction.run(); + }; - mBrowsingModeCoordinator.initializeWithNative(newTabClickListener, tabSwitcherListener, - mMenuButtonHelperSupplier, tabCountProvider, mThemeColorProvider, + mBrowsingModeCoordinator.initializeWithNative( + newTabClickListener, + tabSwitcherListener, + mMenuButtonHelperSupplier, + tabModelSelector, + mThemeColorProvider, incognitoStateProvider); - mTabSwitcherModeCoordinator = new TabSwitcherBottomToolbarCoordinator(mTabSwitcherModeStub, - topToolbarRoot, incognitoStateProvider, mThemeColorProvider, newTabClickListener, - closeTabsClickListener, mMenuButtonHelperSupplier, tabCountProvider); + mTabSwitcherModeCoordinator = + new TabSwitcherBottomToolbarCoordinator( + mTabSwitcherModeStub, + topToolbarRoot, + incognitoStateProvider, + mThemeColorProvider, + newTabClickListener, + closeTabsClickListener, + mMenuButtonHelperSupplier); ChromeActivity activity = null; try { @@ -174,57 +189,72 @@ void initializeWithNative(OnClickListener tabSwitcherListener, // Do not change bottom bar if StartSurface Single Pane is enabled and HomePage is not // customized. if (!ReturnToChromeUtil.shouldShowStartSurfaceAsTheHomePage( - activity != null ? activity : mContext) + activity != null ? activity : mContext) && BottomToolbarVariationManager.shouldBottomToolbarBeVisibleInOverviewMode()) { - mLayoutStateObserver = new LayoutStateProvider.LayoutStateObserver() { - @Override - public void onStartedShowing(@LayoutType int layoutType) { - if (layoutType != LayoutType.TAB_SWITCHER) return; - - BrowsingModeBottomToolbarCoordinator browsingModeCoordinator = - (BrowsingModeBottomToolbarCoordinator) mBrowsingModeCoordinator; - browsingModeCoordinator.getSearchAccelerator().setVisibility(View.GONE); - if (BottomToolbarVariationManager.isHomeButtonOnBottom()) { - browsingModeCoordinator.getHomeButton().setVisibility(View.INVISIBLE); - } - if (BottomToolbarVariationManager.isBookmarkButtonOnBottom()) { - browsingModeCoordinator.getBookmarkButton().setVisibility(View.INVISIBLE); - } - if (BottomToolbarVariationManager.isTabSwitcherOnBottom()) { - browsingModeCoordinator.getTabSwitcherButtonView().setVisibility( - View.INVISIBLE); - } - if (BottomToolbarVariationManager.isNewTabButtonOnBottom()) { - browsingModeCoordinator.getNewTabButtonParent().setVisibility(View.VISIBLE); - } - - mBottomContainerTopShadow.setVisibility(View.GONE); - } - - @Override - public void onStartedHiding(@LayoutType int layoutType) { - if (layoutType != LayoutType.TAB_SWITCHER) return; - - BrowsingModeBottomToolbarCoordinator browsingModeCoordinator = - (BrowsingModeBottomToolbarCoordinator) mBrowsingModeCoordinator; - browsingModeCoordinator.getSearchAccelerator().setVisibility(View.VISIBLE); - if (BottomToolbarVariationManager.isHomeButtonOnBottom()) { - browsingModeCoordinator.getHomeButton().setVisibility(View.VISIBLE); - } - if (BottomToolbarVariationManager.isBookmarkButtonOnBottom()) { - browsingModeCoordinator.getBookmarkButton().setVisibility(View.VISIBLE); - } - if (BottomToolbarVariationManager.isTabSwitcherOnBottom()) { - browsingModeCoordinator.getTabSwitcherButtonView().setVisibility( - View.VISIBLE); - } - if (BottomToolbarVariationManager.isNewTabButtonOnBottom()) { - browsingModeCoordinator.getNewTabButtonParent().setVisibility(View.GONE); - } - - mBottomContainerTopShadow.setVisibility(View.VISIBLE); - } - }; + mLayoutStateObserver = + new LayoutStateProvider.LayoutStateObserver() { + @Override + public void onStartedShowing(@LayoutType int layoutType) { + if (layoutType != LayoutType.TAB_SWITCHER) return; + + BrowsingModeBottomToolbarCoordinator browsingModeCoordinator = + (BrowsingModeBottomToolbarCoordinator) mBrowsingModeCoordinator; + browsingModeCoordinator.getSearchAccelerator().setVisibility(View.GONE); + if (BottomToolbarVariationManager.isHomeButtonOnBottom()) { + browsingModeCoordinator + .getHomeButton() + .setVisibility(View.INVISIBLE); + } + if (BottomToolbarVariationManager.isBookmarkButtonOnBottom()) { + browsingModeCoordinator + .getBookmarkButton() + .setVisibility(View.INVISIBLE); + } + if (BottomToolbarVariationManager.isTabSwitcherOnBottom()) { + browsingModeCoordinator + .getTabSwitcherButtonView() + .setVisibility(View.INVISIBLE); + } + if (BottomToolbarVariationManager.isNewTabButtonOnBottom()) { + browsingModeCoordinator + .getNewTabButtonParent() + .setVisibility(View.VISIBLE); + } + + mBottomContainerTopShadow.setVisibility(View.GONE); + } + + @Override + public void onStartedHiding(@LayoutType int layoutType) { + if (layoutType != LayoutType.TAB_SWITCHER) return; + + BrowsingModeBottomToolbarCoordinator browsingModeCoordinator = + (BrowsingModeBottomToolbarCoordinator) mBrowsingModeCoordinator; + browsingModeCoordinator + .getSearchAccelerator() + .setVisibility(View.VISIBLE); + if (BottomToolbarVariationManager.isHomeButtonOnBottom()) { + browsingModeCoordinator.getHomeButton().setVisibility(View.VISIBLE); + } + if (BottomToolbarVariationManager.isBookmarkButtonOnBottom()) { + browsingModeCoordinator + .getBookmarkButton() + .setVisibility(View.VISIBLE); + } + if (BottomToolbarVariationManager.isTabSwitcherOnBottom()) { + browsingModeCoordinator + .getTabSwitcherButtonView() + .setVisibility(View.VISIBLE); + } + if (BottomToolbarVariationManager.isNewTabButtonOnBottom()) { + browsingModeCoordinator + .getNewTabButtonParent() + .setVisibility(View.GONE); + } + + mBottomContainerTopShadow.setVisibility(View.VISIBLE); + } + }; } View root = (View) topToolbarRoot.getParent(); @@ -236,18 +266,19 @@ public void onStartedHiding(@LayoutType int layoutType) { updateHomeButtonState(); mHomeButton.setOnLongClickListener(this); - final OnClickListener homeButtonListener = v -> { - if (HomepageManager.isHomepageEnabled()) { - try { - BraveActivity.getBraveActivity().setComesFromNewTab(true); - } catch (BraveActivity.BraveActivityNotFoundException e) { - Log.e(TAG, "HomeButton click " + e); - } - mOriginalHomeButtonRunnable.run(); - } else { - newTabClickListener.onClick(v); - } - }; + final OnClickListener homeButtonListener = + v -> { + if (HomepageManager.isHomepageEnabled()) { + try { + BraveActivity.getBraveActivity().setComesFromNewTab(true); + } catch (BraveActivity.BraveActivityNotFoundException e) { + Log.e(TAG, "HomeButton click " + e); + } + mOriginalHomeButtonRunnable.run(); + } else { + newTabClickListener.onClick(v); + } + }; mHomeButton.setOnClickListener(homeButtonListener); } diff --git a/android/java/org/chromium/chrome/browser/toolbar/bottom/BraveBottomControlsCoordinator.java b/android/java/org/chromium/chrome/browser/toolbar/bottom/BraveBottomControlsCoordinator.java index e294ce8a4efb..eea2235c4323 100644 --- a/android/java/org/chromium/chrome/browser/toolbar/bottom/BraveBottomControlsCoordinator.java +++ b/android/java/org/chromium/chrome/browser/toolbar/bottom/BraveBottomControlsCoordinator.java @@ -26,9 +26,9 @@ import org.chromium.chrome.browser.layouts.LayoutStateProvider; import org.chromium.chrome.browser.tab.TabObscuringHandler; import org.chromium.chrome.browser.tabmodel.IncognitoStateProvider; +import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.theme.ThemeColorProvider; import org.chromium.chrome.browser.toolbar.LocationBarModel; -import org.chromium.chrome.browser.toolbar.TabCountProvider; import org.chromium.chrome.browser.ui.appmenu.AppMenuButtonHelper; import org.chromium.ui.base.WindowAndroid; import org.chromium.ui.resources.ResourceManager; @@ -81,20 +81,40 @@ public BraveBottomControlsCoordinator( mLocationBarModel = locationBarModel; } - public void initializeWithNative(Activity activity, ResourceManager resourceManager, - LayoutManagerImpl layoutManager, OnClickListener tabSwitcherListener, - OnClickListener newTabClickListener, WindowAndroid windowAndroid, - TabCountProvider tabCountProvider, IncognitoStateProvider incognitoStateProvider, - ViewGroup topToolbarRoot, Runnable closeAllTabsAction) { + public void initializeWithNative( + Activity activity, + ResourceManager resourceManager, + LayoutManagerImpl layoutManager, + OnClickListener tabSwitcherListener, + OnClickListener newTabClickListener, + WindowAndroid windowAndroid, + TabModelSelector tabModelSelector, + IncognitoStateProvider incognitoStateProvider, + ViewGroup topToolbarRoot, + Runnable closeAllTabsAction) { if (BottomToolbarConfiguration.isBottomToolbarEnabled()) { - mBottomToolbarCoordinator = new BottomToolbarCoordinator(mRoot, - mRoot.findViewById(R.id.bottom_toolbar), mTabProvider, - mTabSwitcherLongclickListener, mThemeColorProvider, mOpenHomepageAction, - mSetUrlBarFocusAction, mLayoutStateProviderSupplier, mMenuButtonHelperSupplier, - mMediator, mBookmarkModelSupplier, mLocationBarModel); - - mBottomToolbarCoordinator.initializeWithNative(tabSwitcherListener, newTabClickListener, - tabCountProvider, incognitoStateProvider, topToolbarRoot, closeAllTabsAction); + mBottomToolbarCoordinator = + new BottomToolbarCoordinator( + mRoot, + mRoot.findViewById(R.id.bottom_toolbar), + mTabProvider, + mTabSwitcherLongclickListener, + mThemeColorProvider, + mOpenHomepageAction, + mSetUrlBarFocusAction, + mLayoutStateProviderSupplier, + mMenuButtonHelperSupplier, + mMediator, + mBookmarkModelSupplier, + mLocationBarModel); + + mBottomToolbarCoordinator.initializeWithNative( + tabSwitcherListener, + newTabClickListener, + tabModelSelector, + incognitoStateProvider, + topToolbarRoot, + closeAllTabsAction); } } diff --git a/android/java/org/chromium/chrome/browser/toolbar/bottom/BrowsingModeBottomToolbarCoordinator.java b/android/java/org/chromium/chrome/browser/toolbar/bottom/BrowsingModeBottomToolbarCoordinator.java index 8e0d6d98efdb..ba24d293ee06 100644 --- a/android/java/org/chromium/chrome/browser/toolbar/bottom/BrowsingModeBottomToolbarCoordinator.java +++ b/android/java/org/chromium/chrome/browser/toolbar/bottom/BrowsingModeBottomToolbarCoordinator.java @@ -19,11 +19,11 @@ import org.chromium.chrome.browser.ActivityTabProvider; import org.chromium.chrome.browser.app.BraveActivity; import org.chromium.chrome.browser.omaha.UpdateMenuItemHelper; -import org.chromium.chrome.browser.tab.TabImpl; +import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tabmodel.IncognitoStateProvider; +import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.theme.ThemeColorProvider; import org.chromium.chrome.browser.toolbar.BraveHomeButton; -import org.chromium.chrome.browser.toolbar.TabCountProvider; import org.chromium.chrome.browser.toolbar.TabSwitcherButtonCoordinator; import org.chromium.chrome.browser.toolbar.TabSwitcherButtonView; import org.chromium.chrome.browser.toolbar.menu_button.BraveMenuButtonCoordinator; @@ -79,8 +79,11 @@ public class BrowsingModeBottomToolbarCoordinator { private final MenuButton mMenuButton; private ThemeColorProvider mThemeColorProvider; - BrowsingModeBottomToolbarCoordinator(View root, ActivityTabProvider tabProvider, - OnClickListener homeButtonListener, OnClickListener searchAcceleratorListener, + BrowsingModeBottomToolbarCoordinator( + View root, + ActivityTabProvider tabProvider, + OnClickListener homeButtonListener, + OnClickListener searchAcceleratorListener, ObservableSupplier shareButtonListenerSupplier, OnLongClickListener tabSwitcherLongClickListener) { mModel = new BrowsingModeBottomToolbarModel(); @@ -121,19 +124,20 @@ public class BrowsingModeBottomToolbarCoordinator { if (BottomToolbarVariationManager.isBookmarkButtonOnBottom()) { mBookmarkButton.setVisibility(View.VISIBLE); getNewTabButtonParent().setVisibility(View.GONE); - OnClickListener bookmarkClickHandler = v -> { - TabImpl tab = (TabImpl) mTabProvider.get(); - try { - BraveActivity activity = BraveActivity.getBraveActivity(); - if (tab == null || activity == null) { - assert false; - return; - } - activity.addOrEditBookmark(tab); - } catch (BraveActivity.BraveActivityNotFoundException e) { - Log.e(TAG, "BookmarkButton click " + e); - } - }; + OnClickListener bookmarkClickHandler = + v -> { + Tab tab = mTabProvider.get(); + try { + BraveActivity activity = BraveActivity.getBraveActivity(); + if (tab == null || activity == null) { + assert false; + return; + } + activity.addOrEditBookmark(tab); + } catch (BraveActivity.BraveActivityNotFoundException e) { + Log.e(TAG, "BookmarkButton click " + e); + } + }; mBookmarkButton.setOnClickListener(bookmarkClickHandler); } @@ -156,19 +160,23 @@ void onVisibilityChanged(boolean isVisible) {} /** * Initialize the bottom toolbar with the components that had native initialization * dependencies. - *

- * Calling this must occur after the native library have completely loaded. - * @param tabSwitcherListener An {@link OnClickListener} that is triggered when the - * tab switcher button is clicked. - * @param menuButtonHelper An {@link AppMenuButtonHelper} that is triggered when the - * menu button is clicked. - * @param tabCountProvider Updates the tab count number in the tab switcher button. + * + *

Calling this must occur after the native library have completely loaded. + * + * @param tabSwitcherListener An {@link OnClickListener} that is triggered when the tab switcher + * button is clicked. + * @param menuButtonHelper An {@link AppMenuButtonHelper} that is triggered when the menu button + * is clicked. + * @param tabModelSelector Updates the tab count number in the tab switcher button. * @param themeColorProvider Notifies components when theme color changes. * @param incognitoStateProvider Notifies components when incognito state changes. */ - void initializeWithNative(OnClickListener newTabListener, OnClickListener tabSwitcherListener, + void initializeWithNative( + OnClickListener newTabListener, + OnClickListener tabSwitcherListener, ObservableSupplier menuButtonHelperSupplier, - TabCountProvider tabCountProvider, ThemeColorProvider themeColorProvider, + TabModelSelector tabModelSelector, + ThemeColorProvider themeColorProvider, IncognitoStateProvider incognitoStateProvider) { mThemeColorProvider = themeColorProvider; mMediator.setThemeColorProvider(themeColorProvider); @@ -190,7 +198,8 @@ void initializeWithNative(OnClickListener newTabListener, OnClickListener tabSwi if (BottomToolbarVariationManager.isTabSwitcherOnBottom()) { mTabSwitcherButtonCoordinator.setTabSwitcherListener(tabSwitcherListener); mTabSwitcherButtonCoordinator.setThemeColorProvider(themeColorProvider); - mTabSwitcherButtonCoordinator.setTabCountProvider(tabCountProvider); + mTabSwitcherButtonCoordinator.setTabCountSupplier( + tabModelSelector.getCurrentModelTabCountSupplier()); } mBookmarkButton.setThemeColorProvider(themeColorProvider); @@ -199,10 +208,12 @@ void initializeWithNative(OnClickListener newTabListener, OnClickListener tabSwi mThemeColorProvider.addTintObserver(mMenuButton); - new OneShotCallback<>(menuButtonHelperSupplier, (menuButtonHelper) -> { - assert menuButtonHelper != null; - mMenuButton.setAppMenuButtonHelper(menuButtonHelper); - }); + new OneShotCallback<>( + menuButtonHelperSupplier, + (menuButtonHelper) -> { + assert menuButtonHelper != null; + mMenuButton.setAppMenuButtonHelper(menuButtonHelper); + }); } /** diff --git a/android/java/org/chromium/chrome/browser/toolbar/bottom/TabSwitcherBottomToolbarCoordinator.java b/android/java/org/chromium/chrome/browser/toolbar/bottom/TabSwitcherBottomToolbarCoordinator.java index 96cec4ed845a..85764d7a79a6 100644 --- a/android/java/org/chromium/chrome/browser/toolbar/bottom/TabSwitcherBottomToolbarCoordinator.java +++ b/android/java/org/chromium/chrome/browser/toolbar/bottom/TabSwitcherBottomToolbarCoordinator.java @@ -19,7 +19,6 @@ import org.chromium.chrome.browser.omaha.UpdateMenuItemHelper; import org.chromium.chrome.browser.tabmodel.IncognitoStateProvider; import org.chromium.chrome.browser.theme.ThemeColorProvider; -import org.chromium.chrome.browser.toolbar.TabCountProvider; import org.chromium.chrome.browser.toolbar.menu_button.BraveMenuButtonCoordinator; import org.chromium.chrome.browser.toolbar.menu_button.MenuButton; import org.chromium.chrome.browser.toolbar.menu_button.MenuButtonState; @@ -47,24 +46,26 @@ public class TabSwitcherBottomToolbarCoordinator { /** * Build the coordinator that manages the tab switcher bottom toolbar. + * * @param stub The tab switcher bottom toolbar {@link ViewStub} to inflate. * @param topToolbarRoot The root {@link ViewGroup} of the top toolbar. * @param incognitoStateProvider Notifies components when incognito mode is entered or exited. * @param themeColorProvider Notifies components when the theme color changes. - * @param newTabClickListener An {@link OnClickListener} that is triggered when the - * new tab button is clicked. - * @param closeTabsClickListener An {@link OnClickListener} that is triggered when the - * close all tabs button is clicked. - * @param menuButtonHelper An {@link AppMenuButtonHelper} that is triggered when the - * menu button is clicked. - * @param tabCountProvider Updates the tab count number in the tab switcher button and in the - * incognito toggle tab layout. + * @param newTabClickListener An {@link OnClickListener} that is triggered when the new tab + * button is clicked. + * @param closeTabsClickListener An {@link OnClickListener} that is triggered when the close all + * tabs button is clicked. + * @param menuButtonHelper An {@link AppMenuButtonHelper} that is triggered when the menu button + * is clicked. */ - TabSwitcherBottomToolbarCoordinator(ViewStub stub, ViewGroup topToolbarRoot, - IncognitoStateProvider incognitoStateProvider, ThemeColorProvider themeColorProvider, - OnClickListener newTabClickListener, OnClickListener closeTabsClickListener, - ObservableSupplier menuButtonHelperSupplier, - TabCountProvider tabCountProvider) { + TabSwitcherBottomToolbarCoordinator( + ViewStub stub, + ViewGroup topToolbarRoot, + IncognitoStateProvider incognitoStateProvider, + ThemeColorProvider themeColorProvider, + OnClickListener newTabClickListener, + OnClickListener closeTabsClickListener, + ObservableSupplier menuButtonHelperSupplier) { final ViewGroup root = (ViewGroup) stub.inflate(); View toolbar = root.findViewById(R.id.bottom_toolbar_buttons); @@ -73,7 +74,9 @@ public class TabSwitcherBottomToolbarCoordinator { mModel = new TabSwitcherBottomToolbarModel(); - PropertyModelChangeProcessor.create(mModel, root, + PropertyModelChangeProcessor.create( + mModel, + root, new TabSwitcherBottomToolbarViewBinder( topToolbarRoot, (ViewGroup) root.getParent())); @@ -95,10 +98,12 @@ public class TabSwitcherBottomToolbarCoordinator { BraveMenuButtonCoordinator.setupPropertyModel(mMenuButton, menuButtonStateSupplier); } - new OneShotCallback<>(menuButtonHelperSupplier, (menuButtonHelper) -> { - assert menuButtonHelper != null; - mMenuButton.setAppMenuButtonHelper(menuButtonHelper); - }); + new OneShotCallback<>( + menuButtonHelperSupplier, + (menuButtonHelper) -> { + assert menuButtonHelper != null; + mMenuButton.setAppMenuButtonHelper(menuButtonHelper); + }); } /** 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 ac6fba404526..f69a7bf097e4 100644 --- a/android/java/org/chromium/chrome/browser/toolbar/top/BraveToolbarLayoutImpl.java +++ b/android/java/org/chromium/chrome/browser/toolbar/top/BraveToolbarLayoutImpl.java @@ -105,7 +105,6 @@ import org.chromium.chrome.browser.shields.BraveShieldsUtils; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabHidingType; -import org.chromium.chrome.browser.tab.TabImpl; import org.chromium.chrome.browser.tab.TabSelectionType; import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.tabmodel.TabModelSelectorTabModelObserver; @@ -416,7 +415,6 @@ protected void onNativeLibraryReady() { } } - @Override public void setTabModelSelector(TabModelSelector selector) { // We might miss events before calling setTabModelSelector, so we need // to proactively update the shields button state here, otherwise shields @@ -1253,9 +1251,10 @@ public void onUrlFocusChange(boolean hasFocus) { Context context = getContext(); String countryCode = Locale.getDefault().getCountry(); try { - if (hasFocus && PackageUtils.isFirstInstall(context) + if (hasFocus + && PackageUtils.isFirstInstall(context) && BraveActivity.getBraveActivity().getActivityTab() != null - && UrlUtilities.isNTPUrl( + && UrlUtilities.isNtpUrl( BraveActivity.getBraveActivity().getActivityTab().getUrl().getSpec()) && !OnboardingPrefManager.getInstance().hasSearchEngineOnboardingShown() && OnboardingPrefManager.getInstance().getUrlFocusCount() == 1 @@ -1372,13 +1371,15 @@ private void updateBraveShieldsButtonState(Tab tab) { } private boolean isShieldsOnForTab(Tab tab) { - if (!isNativeLibraryReady() || tab == null - || Profile.fromWebContents(((TabImpl) tab).getWebContents()) == null) { + if (!isNativeLibraryReady() + || tab == null + || Profile.fromWebContents(tab.getWebContents()) == null) { return false; } return BraveShieldsContentSettings.getShields( - Profile.fromWebContents(((TabImpl) tab).getWebContents()), tab.getUrl().getSpec(), + Profile.fromWebContents(tab.getWebContents()), + tab.getUrl().getSpec(), BraveShieldsContentSettings.RESOURCE_IDENTIFIER_BRAVE_SHIELDS); } @@ -1626,7 +1627,7 @@ protected void onDraw(Canvas canvas) { || BraveReflectionUtil.EqualTypes(this.getClass(), ToolbarPhone.class)) { updateMenuButtonState(); Tab tab = getToolbarDataProvider() != null ? getToolbarDataProvider().getTab() : null; - if (tab != null && ((TabImpl) tab).getWebContents() != null) { + if (tab != null && tab.getWebContents() != null) { updateBraveShieldsButtonState(tab); } } 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 02c77bf94793..09c2f0df1251 100644 --- a/android/java/org/chromium/chrome/browser/toolbar/top/BraveTopToolbarCoordinator.java +++ b/android/java/org/chromium/chrome/browser/toolbar/top/BraveTopToolbarCoordinator.java @@ -6,6 +6,7 @@ package org.chromium.chrome.browser.toolbar.top; import android.view.View; +import android.view.View.OnClickListener; import android.view.ViewStub; import org.chromium.base.Callback; @@ -13,11 +14,15 @@ import org.chromium.base.supplier.OneshotSupplier; import org.chromium.base.supplier.Supplier; import org.chromium.chrome.R; +import org.chromium.chrome.browser.browser_controls.BrowserControlsVisibilityManager; import org.chromium.chrome.browser.browser_controls.BrowserStateBrowserControlsVisibilityDelegate; import org.chromium.chrome.browser.fullscreen.FullscreenManager; +import org.chromium.chrome.browser.layouts.LayoutManager; import org.chromium.chrome.browser.layouts.LayoutStateProvider; +import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.theme.ThemeColorProvider; +import org.chromium.chrome.browser.theme.TopUiThemeColorProvider; import org.chromium.chrome.browser.toolbar.ButtonData; import org.chromium.chrome.browser.toolbar.ButtonDataProvider; import org.chromium.chrome.browser.toolbar.ToolbarDataProvider; @@ -27,6 +32,7 @@ import org.chromium.chrome.browser.toolbar.top.NavigationPopup.HistoryDelegate; import org.chromium.chrome.browser.toolbar.top.ToolbarTablet.OfflineDownloader; import org.chromium.chrome.browser.ui.appmenu.AppMenuButtonHelper; +import org.chromium.chrome.browser.ui.appmenu.AppMenuDelegate; import org.chromium.chrome.browser.user_education.UserEducationHelper; import org.chromium.content_public.browser.LoadUrlParams; import org.chromium.ui.resources.ResourceManager; @@ -45,6 +51,7 @@ public class BraveTopToolbarCoordinator extends TopToolbarCoordinator { private MenuButtonCoordinator mBraveMenuButtonCoordinator; private boolean mIsBottomToolbarVisible; private ObservableSupplier mConstraintsProxy; + private ObservableSupplier mTabModelSelectorSupplier; public BraveTopToolbarCoordinator(ToolbarControlContainer controlContainer, ViewStub toolbarStub, ToolbarLayout toolbarLayout, @@ -87,6 +94,7 @@ public BraveTopToolbarCoordinator(ToolbarControlContainer controlContainer, mBraveToolbarLayout = toolbarLayout; mBraveMenuButtonCoordinator = browsingModeMenuButtonCoordinator; mConstraintsProxy = constraintsSupplier; + mTabModelSelectorSupplier = tabModelSelectorSupplier; if (isToolbarPhone()) { if (!isStartSurfaceEnabled) { @@ -135,4 +143,36 @@ public void setTabSwitcherMode(boolean inTabSwitcherMode) { : View.VISIBLE); } } + + @Override + public void initializeWithNative( + Runnable layoutUpdater, + OnClickListener tabSwitcherClickHandler, + OnClickListener newTabClickHandler, + OnClickListener bookmarkClickHandler, + OnClickListener customTabsBackClickHandler, + AppMenuDelegate appMenuDelegate, + LayoutManager layoutManager, + ObservableSupplier tabSupplier, + BrowserControlsVisibilityManager browserControlsVisibilityManager, + TopUiThemeColorProvider topUiThemeColorProvider) { + super.initializeWithNative( + layoutUpdater, + tabSwitcherClickHandler, + newTabClickHandler, + bookmarkClickHandler, + customTabsBackClickHandler, + appMenuDelegate, + layoutManager, + tabSupplier, + browserControlsVisibilityManager, + topUiThemeColorProvider); + + assert mBraveToolbarLayout instanceof BraveToolbarLayoutImpl + : "Something has changed in the upstream!"; + if (mBraveToolbarLayout instanceof BraveToolbarLayoutImpl) { + ((BraveToolbarLayoutImpl) mBraveToolbarLayout) + .setTabModelSelector(mTabModelSelectorSupplier.get()); + } + } } diff --git a/android/java/org/chromium/chrome/browser/util/TabUtils.java b/android/java/org/chromium/chrome/browser/util/TabUtils.java index 409dc2cdd62a..23698fdef9e8 100644 --- a/android/java/org/chromium/chrome/browser/util/TabUtils.java +++ b/android/java/org/chromium/chrome/browser/util/TabUtils.java @@ -195,7 +195,7 @@ public static void openNewTab() { private static void openNewTab(BraveActivity braveActivity, boolean isIncognito) { if (braveActivity == null) return; braveActivity.getTabModelSelector().getModel(isIncognito).commitAllTabClosures(); - braveActivity.getTabCreator(isIncognito).launchNTP(); + braveActivity.getTabCreator(isIncognito).launchNtp(); } public static void openUrlInNewTab(boolean isIncognito, String url) { diff --git a/android/java/org/chromium/chrome/browser/vpn/activities/BraveVpnPlansActivity.java b/android/java/org/chromium/chrome/browser/vpn/activities/BraveVpnPlansActivity.java index 08be94b68450..af8d22ec61b8 100644 --- a/android/java/org/chromium/chrome/browser/vpn/activities/BraveVpnPlansActivity.java +++ b/android/java/org/chromium/chrome/browser/vpn/activities/BraveVpnPlansActivity.java @@ -19,7 +19,10 @@ import com.google.android.material.tabs.TabLayout; +import org.chromium.base.supplier.OneshotSupplier; import org.chromium.chrome.R; +import org.chromium.chrome.browser.init.ActivityProfileProvider; +import org.chromium.chrome.browser.profiles.ProfileProvider; import org.chromium.chrome.browser.util.LiveDataUtil; import org.chromium.chrome.browser.vpn.BraveVpnNativeWorker; import org.chromium.chrome.browser.vpn.adapters.BraveVpnPlanPagerAdapter; @@ -207,4 +210,9 @@ public void showRestoreMenu(boolean shouldShowRestore) { @Override public void updateProfileView() {} + + @Override + protected OneshotSupplier createProfileProvider() { + return new ActivityProfileProvider(getLifecycleDispatcher()); + } } diff --git a/android/java/org/chromium/chrome/browser/vpn/activities/BraveVpnProfileActivity.java b/android/java/org/chromium/chrome/browser/vpn/activities/BraveVpnProfileActivity.java index ac2e5f09f485..25093fd880e0 100644 --- a/android/java/org/chromium/chrome/browser/vpn/activities/BraveVpnProfileActivity.java +++ b/android/java/org/chromium/chrome/browser/vpn/activities/BraveVpnProfileActivity.java @@ -17,7 +17,10 @@ import androidx.appcompat.app.ActionBar; import androidx.appcompat.widget.Toolbar; +import org.chromium.base.supplier.OneshotSupplier; import org.chromium.chrome.R; +import org.chromium.chrome.browser.init.ActivityProfileProvider; +import org.chromium.chrome.browser.profiles.ProfileProvider; import org.chromium.chrome.browser.vpn.BraveVpnNativeWorker; import org.chromium.chrome.browser.vpn.models.BraveVpnPrefModel; import org.chromium.chrome.browser.vpn.utils.BraveVpnUtils; @@ -121,4 +124,9 @@ public void updateProfileView() { mInstallVpnButton.setText(getResources().getString(R.string.accept_connection_request)); mContactSupportButton.setVisibility(View.GONE); } + + @Override + protected OneshotSupplier createProfileProvider() { + return new ActivityProfileProvider(getLifecycleDispatcher()); + } } diff --git a/android/java/org/chromium/chrome/browser/vpn/activities/BraveVpnSupportActivity.java b/android/java/org/chromium/chrome/browser/vpn/activities/BraveVpnSupportActivity.java index 2481a4cbb7f0..bc6424db3d7b 100644 --- a/android/java/org/chromium/chrome/browser/vpn/activities/BraveVpnSupportActivity.java +++ b/android/java/org/chromium/chrome/browser/vpn/activities/BraveVpnSupportActivity.java @@ -25,23 +25,24 @@ import androidx.appcompat.widget.SwitchCompat; import androidx.appcompat.widget.Toolbar; -import org.chromium.base.supplier.OneshotSupplierImpl; +import org.chromium.base.supplier.OneshotSupplier; import org.chromium.chrome.R; import org.chromium.chrome.browser.about_settings.AboutChromeSettings; import org.chromium.chrome.browser.about_settings.AboutSettingsBridge; import org.chromium.chrome.browser.firstrun.BraveFirstRunFlowSequencer; +import org.chromium.chrome.browser.init.ActivityProfileProvider; import org.chromium.chrome.browser.init.AsyncInitializationActivity; -import org.chromium.chrome.browser.profiles.Profile; +import org.chromium.chrome.browser.profiles.ProfileProvider; import org.chromium.chrome.browser.vpn.utils.BraveVpnPrefUtils; import java.util.TimeZone; public class BraveVpnSupportActivity extends AsyncInitializationActivity { private BraveFirstRunFlowSequencer mFirstRunFlowSequencer; - private final OneshotSupplierImpl mProfileSupplier; + private final OneshotSupplier mProfileSupplier; public BraveVpnSupportActivity() { - mProfileSupplier = new OneshotSupplierImpl<>(); + mProfileSupplier = createProfileProvider(); } private void initializeViews() { @@ -144,13 +145,13 @@ public void onClick(View v) { @Override protected void triggerLayoutInflation() { - mProfileSupplier.set(Profile.getLastUsedRegularProfile()); - mFirstRunFlowSequencer = new BraveFirstRunFlowSequencer(this, mProfileSupplier) { - @Override - public void onFlowIsKnown(Bundle freProperties) { - initializeViews(); - } - }; + mFirstRunFlowSequencer = + new BraveFirstRunFlowSequencer(this, mProfileSupplier) { + @Override + public void onFlowIsKnown(Bundle freProperties) { + initializeViews(); + } + }; mFirstRunFlowSequencer.start(); onInitialLayoutInflationComplete(); } @@ -200,4 +201,9 @@ private String getCellularCarrier() { ((TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE)); return telephonyManager.getNetworkOperatorName(); } + + @Override + protected OneshotSupplier createProfileProvider() { + return new ActivityProfileProvider(getLifecycleDispatcher()); + } } diff --git a/android/java/org/chromium/chrome/browser/vpn/split_tunnel/SplitTunnelActivity.java b/android/java/org/chromium/chrome/browser/vpn/split_tunnel/SplitTunnelActivity.java index 0fc6d03f0730..fb81e7046bf2 100644 --- a/android/java/org/chromium/chrome/browser/vpn/split_tunnel/SplitTunnelActivity.java +++ b/android/java/org/chromium/chrome/browser/vpn/split_tunnel/SplitTunnelActivity.java @@ -22,8 +22,11 @@ import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; +import org.chromium.base.supplier.OneshotSupplier; import org.chromium.chrome.R; +import org.chromium.chrome.browser.init.ActivityProfileProvider; import org.chromium.chrome.browser.init.AsyncInitializationActivity; +import org.chromium.chrome.browser.profiles.ProfileProvider; import org.chromium.chrome.browser.vpn.utils.BraveVpnPrefUtils; import org.chromium.chrome.browser.vpn.utils.BraveVpnUtils; @@ -157,4 +160,9 @@ public void onApplicationCLick( public boolean shouldStartGpuProcess() { return true; } + + @Override + protected OneshotSupplier createProfileProvider() { + return new ActivityProfileProvider(getLifecycleDispatcher()); + } } diff --git a/android/java/res/layout/brave_wallet_network_item.xml b/android/java/res/layout/brave_wallet_network_item.xml index 523db3374e0b..b7a1e54fb75f 100644 --- a/android/java/res/layout/brave_wallet_network_item.xml +++ b/android/java/res/layout/brave_wallet_network_item.xml @@ -35,7 +35,7 @@ style="@style/PreferenceSummary" /> - + #F0F2FF + #FA7250 #5B2A23 - #F35333 @color/default_text_color_on_accent1_light @color/default_bg_color_baseline + @color/baseline_primary_30 @color/baseline_primary_80 @@ -22,7 +24,7 @@ #1E2029 #478AFF - #FA7250 + @color/baseline_primary_80 #FF1893 #A78AFF diff --git a/android/javatests/org/chromium/chrome/browser/BraveSwipeRefreshHandlerTest.java b/android/javatests/org/chromium/chrome/browser/BraveSwipeRefreshHandlerTest.java index 67372c67f104..72479eccf9ff 100644 --- a/android/javatests/org/chromium/chrome/browser/BraveSwipeRefreshHandlerTest.java +++ b/android/javatests/org/chromium/chrome/browser/BraveSwipeRefreshHandlerTest.java @@ -98,7 +98,7 @@ private boolean loadUrlAttemptRefresh(String url, int transition) throws Excepti () -> { try { Tab tab = - new TabBuilder() + new TabBuilder(sActivityTestRule.getProfile(false)) .setWindow( sActivityTestRule .getActivity() diff --git a/android/javatests/org/chromium/chrome/browser/BytecodeTest.java b/android/javatests/org/chromium/chrome/browser/BytecodeTest.java index 2dc2d780a437..32918be0604f 100644 --- a/android/javatests/org/chromium/chrome/browser/BytecodeTest.java +++ b/android/javatests/org/chromium/chrome/browser/BytecodeTest.java @@ -30,6 +30,7 @@ import org.chromium.base.Callback; import org.chromium.base.jank_tracker.JankTracker; import org.chromium.base.shared_preferences.PreferenceKeyRegistry; +import org.chromium.base.shared_preferences.SharedPreferencesManager; import org.chromium.base.supplier.ObservableSupplier; import org.chromium.base.supplier.ObservableSupplierImpl; import org.chromium.base.supplier.OneshotSupplier; @@ -60,6 +61,7 @@ import org.chromium.chrome.browser.lifecycle.ActivityLifecycleDispatcher; import org.chromium.chrome.browser.logo.CachedTintedBitmap; import org.chromium.chrome.browser.logo.LogoCoordinator; +import org.chromium.chrome.browser.multiwindow.MultiInstanceManager; import org.chromium.chrome.browser.multiwindow.MultiWindowModeStateDispatcher; import org.chromium.chrome.browser.new_tab_url.DseNewTabUrlManager; import org.chromium.chrome.browser.ntp.NewTabPageUma; @@ -68,7 +70,6 @@ import org.chromium.chrome.browser.omnibox.LocationBarDataProvider; import org.chromium.chrome.browser.omnibox.LocationBarLayout; import org.chromium.chrome.browser.omnibox.OverrideUrlLoadingDelegate; -import org.chromium.chrome.browser.omnibox.SearchEngineLogoUtils; import org.chromium.chrome.browser.omnibox.UrlBarEditingTextStateProvider; import org.chromium.chrome.browser.omnibox.status.PageInfoIPHController; import org.chromium.chrome.browser.omnibox.status.StatusCoordinator.PageInfoAction; @@ -83,7 +84,7 @@ import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabObscuringHandler; import org.chromium.chrome.browser.tabmodel.AsyncTabParamsManager; -import org.chromium.chrome.browser.tabmodel.ChromeTabCreator.OverviewNTPCreator; +import org.chromium.chrome.browser.tabmodel.ChromeTabCreator.OverviewNtpCreator; import org.chromium.chrome.browser.tabmodel.IncognitoStateProvider; import org.chromium.chrome.browser.tabmodel.TabCreatorManager; import org.chromium.chrome.browser.tabmodel.TabModelSelector; @@ -109,7 +110,6 @@ import org.chromium.chrome.browser.user_education.UserEducationHelper; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; -import org.chromium.components.browser_ui.settings.SettingsLauncher; 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; @@ -374,6 +374,9 @@ public void testClassesExist() throws Exception { Assert.assertTrue( classExists( "org/chromium/chrome/browser/identity_disc/BraveIdentityDiscController")); + Assert.assertTrue(classExists("org/chromium/chrome/browser/bookmarks/BookmarkUiPrefs")); + Assert.assertTrue( + classExists("org/chromium/chrome/browser/bookmarks/BraveBookmarkUiPrefs")); } @Test @@ -434,14 +437,36 @@ public void testMethodsExist() throws Exception { Assert.assertTrue( methodExists("org/chromium/chrome/browser/toolbar/top/TabSwitcherModeTopToolbar", "shouldShowIncognitoToggle", false, null)); - Assert.assertTrue(methodExists("org/chromium/chrome/browser/download/MimeUtils", - "canAutoOpenMimeType", false, null)); - Assert.assertTrue(methodExists("org/chromium/chrome/browser/bookmarks/BraveBookmarkUtils", - "addOrEditBookmark", false, null)); - Assert.assertTrue(methodExists("org/chromium/chrome/browser/bookmarks/BookmarkUtils", - "addOrEditBookmark", false, null)); - Assert.assertTrue(methodExists("org/chromium/chrome/browser/bookmarks/BraveBookmarkUtils", - "showBookmarkManagerOnPhone", false, null)); + Assert.assertTrue( + methodExists( + "org/chromium/chrome/browser/download/MimeUtils", + "canAutoOpenMimeType", + false, + null)); + Assert.assertTrue( + methodExists( + "org/chromium/chrome/browser/bookmarks/BraveBookmarkUtils", + "addOrEditBookmark", + false, + null)); + Assert.assertTrue( + methodExists( + "org/chromium/chrome/browser/bookmarks/BookmarkUtils", + "addOrEditBookmark", + false, + null)); + Assert.assertTrue( + methodExists( + "org/chromium/chrome/browser/bookmarks/BraveBookmarkUtils", + "showBookmarkManagerOnPhone", + false, + null)); + Assert.assertTrue( + methodExists( + "org/chromium/chrome/browser/bookmarks/BraveBookmarkUtils", + "isSpecialFolder", + false, + null)); Assert.assertTrue( methodExists( "org/chromium/chrome/browser/bookmarks/BookmarkUtils", @@ -676,14 +701,25 @@ public void testMethodsForInvocationExist() throws Exception { @Test @SmallTest public void testConstructorsExistAndMatch() throws Exception { - Assert.assertTrue(constructorsMatch( - "org/chromium/chrome/browser/tabbed_mode/TabbedAppMenuPropertiesDelegate", - "org/chromium/chrome/browser/appmenu/BraveTabbedAppMenuPropertiesDelegate", - Context.class, ActivityTabProvider.class, MultiWindowModeStateDispatcher.class, - TabModelSelector.class, ToolbarManager.class, View.class, AppMenuDelegate.class, - OneshotSupplier.class, OneshotSupplier.class, ObservableSupplier.class, - WebFeedSnackbarController.FeedLauncher.class, ModalDialogManager.class, - SnackbarManager.class, OneshotSupplier.class, Supplier.class)); + Assert.assertTrue( + constructorsMatch( + "org/chromium/chrome/browser/tabbed_mode/TabbedAppMenuPropertiesDelegate", + "org/chromium/chrome/browser/appmenu/BraveTabbedAppMenuPropertiesDelegate", + Context.class, + ActivityTabProvider.class, + MultiWindowModeStateDispatcher.class, + TabModelSelector.class, + ToolbarManager.class, + View.class, + AppMenuDelegate.class, + OneshotSupplier.class, + OneshotSupplier.class, + ObservableSupplier.class, + WebFeedSnackbarController.FeedLauncher.class, + ModalDialogManager.class, + SnackbarManager.class, + OneshotSupplier.class, + Supplier.class)); Assert.assertTrue( constructorsMatch( "org/chromium/chrome/browser/tabmodel/ChromeTabCreator", @@ -691,8 +727,9 @@ public void testConstructorsExistAndMatch() throws Exception { Activity.class, WindowAndroid.class, Supplier.class, + OneshotSupplier.class, boolean.class, - OverviewNTPCreator.class, + OverviewNtpCreator.class, AsyncTabParamsManager.class, Supplier.class, Supplier.class, @@ -741,18 +778,27 @@ public void testConstructorsExistAndMatch() throws Exception { "org/chromium/chrome/browser/site_settings/ChromeSiteSettingsDelegate", "org/chromium/chrome/browser/site_settings/BraveSiteSettingsDelegate", Context.class, Profile.class)); - Assert.assertTrue(constructorsMatch( - "org/chromium/components/browser_ui/notifications/NotificationManagerProxyImpl", - "org/chromium/chrome/browser/notifications/BraveNotificationManagerProxyImpl", - Context.class)); Assert.assertTrue( - constructorsMatch("org/chromium/chrome/browser/omnibox/status/StatusMediator", + constructorsMatch( + "org/chromium/components/browser_ui/notifications/NotificationManagerProxyImpl", + "org/chromium/chrome/browser/notifications/BraveNotificationManagerProxyImpl", + Context.class)); + Assert.assertTrue( + constructorsMatch( + "org/chromium/chrome/browser/omnibox/status/StatusMediator", "org/chromium/chrome/browser/omnibox/status/BraveStatusMediator", - PropertyModel.class, Resources.class, Context.class, - UrlBarEditingTextStateProvider.class, boolean.class, - LocationBarDataProvider.class, PermissionDialogController.class, - SearchEngineLogoUtils.class, OneshotSupplier.class, Supplier.class, - PageInfoIPHController.class, WindowAndroid.class, Supplier.class)); + PropertyModel.class, + Resources.class, + Context.class, + UrlBarEditingTextStateProvider.class, + boolean.class, + LocationBarDataProvider.class, + PermissionDialogController.class, + OneshotSupplier.class, + Supplier.class, + PageInfoIPHController.class, + WindowAndroid.class, + Supplier.class)); Assert.assertTrue( constructorsMatch( "org/chromium/chrome/browser/ntp/NewTabPage", @@ -774,7 +820,6 @@ public void testConstructorsExistAndMatch() throws Exception { WindowAndroid.class, JankTracker.class, Supplier.class, - SettingsLauncher.class, HomeSurfaceTracker.class, ObservableSupplier.class)); Assert.assertTrue(constructorsMatch( @@ -833,7 +878,8 @@ public void testConstructorsExistAndMatch() throws Exception { int.class, FeedActionDelegate.class, FeedOptionsCoordinator.class, - UiConfig.class)); + UiConfig.class, + Profile.class)); Assert.assertTrue( constructorsMatch( "org/chromium/chrome/browser/partnercustomizations/CustomizationProviderDelegateImpl", @@ -870,42 +916,72 @@ public void testConstructorsExistAndMatch() throws Exception { "org/chromium/chrome/browser/omnibox/suggestions/BraveDropdownItemViewInfoListManager", ModelList.class, Context.class)); - Assert.assertTrue(constructorsMatch( - "org/chromium/chrome/browser/omnibox/LocationBarCoordinator", - "org/chromium/chrome/browser/omnibox/BraveLocationBarCoordinator", View.class, - View.class, ObservableSupplier.class, - BraveLocationBarMediator.getPrivacyPreferencesManagerClass(), - LocationBarDataProvider.class, ActionMode.Callback.class, WindowDelegate.class, - WindowAndroid.class, Supplier.class, Supplier.class, Supplier.class, - IncognitoStateProvider.class, ActivityLifecycleDispatcher.class, - OverrideUrlLoadingDelegate.class, BackKeyBehaviorDelegate.class, - SearchEngineLogoUtils.class, PageInfoAction.class, Callback.class, - BraveLocationBarMediator.getSaveOfflineButtonStateClass(), - BraveLocationBarMediator.getOmniboxUmaClass(), Supplier.class, BookmarkState.class, - BooleanSupplier.class, Supplier.class, OmniboxActionDelegate.class, - BrowserStateBrowserControlsVisibilityDelegate.class, Callback.class, - BackPressManager.class, OmniboxSuggestionsDropdownScrollListener.class, - OpenHistoryClustersDelegate.class, ObservableSupplier.class)); - Assert.assertTrue(constructorsMatch( - "org/chromium/chrome/browser/omnibox/LocationBarMediator", - "org/chromium/chrome/browser/omnibox/BraveLocationBarMediator", Context.class, - LocationBarLayout.class, LocationBarDataProvider.class, ObservableSupplier.class, - BraveLocationBarMediator.getPrivacyPreferencesManagerClass(), - OverrideUrlLoadingDelegate.class, BraveLocationBarMediator.getLocaleManagerClass(), - OneshotSupplier.class, BackKeyBehaviorDelegate.class, WindowAndroid.class, - boolean.class, SearchEngineLogoUtils.class, - BraveLocationBarMediator.getLensControllerClass(), - BraveLocationBarMediator.getSaveOfflineButtonStateClass(), - BraveLocationBarMediator.getOmniboxUmaClass(), BooleanSupplier.class, - BraveLocationBarMediator.getOmniboxSuggestionsDropdownEmbedderImplClass(), - ObservableSupplier.class)); - Assert.assertTrue(constructorsMatch("org/chromium/chrome/browser/AppHooksImpl", - "org/chromium/chrome/browser/BraveAppHooks")); - Assert.assertTrue(constructorsMatch("org/chromium/chrome/browser/flags/CachedFlag", - "org/chromium/chrome/browser/flags/BraveCachedFlag", String.class, boolean.class)); - Assert.assertTrue(constructorsMatch("org/chromium/chrome/browser/flags/CachedFlag", - "org/chromium/chrome/browser/flags/BraveCachedFlag", String.class, String.class, - boolean.class)); + Assert.assertTrue( + constructorsMatch( + "org/chromium/chrome/browser/omnibox/LocationBarCoordinator", + "org/chromium/chrome/browser/omnibox/BraveLocationBarCoordinator", + View.class, + View.class, + ObservableSupplier.class, + BraveLocationBarMediator.getPrivacyPreferencesManagerClass(), + LocationBarDataProvider.class, + ActionMode.Callback.class, + WindowDelegate.class, + WindowAndroid.class, + Supplier.class, + Supplier.class, + Supplier.class, + IncognitoStateProvider.class, + ActivityLifecycleDispatcher.class, + OverrideUrlLoadingDelegate.class, + BackKeyBehaviorDelegate.class, + PageInfoAction.class, + Callback.class, + BraveLocationBarMediator.getSaveOfflineButtonStateClass(), + BraveLocationBarMediator.getOmniboxUmaClass(), + Supplier.class, + BookmarkState.class, + BooleanSupplier.class, + Supplier.class, + OmniboxActionDelegate.class, + BrowserStateBrowserControlsVisibilityDelegate.class, + Callback.class, + BackPressManager.class, + OmniboxSuggestionsDropdownScrollListener.class, + OpenHistoryClustersDelegate.class, + ObservableSupplier.class, + boolean.class)); + Assert.assertTrue( + constructorsMatch( + "org/chromium/chrome/browser/omnibox/LocationBarMediator", + "org/chromium/chrome/browser/omnibox/BraveLocationBarMediator", + Context.class, + LocationBarLayout.class, + LocationBarDataProvider.class, + ObservableSupplier.class, + BraveLocationBarMediator.getPrivacyPreferencesManagerClass(), + OverrideUrlLoadingDelegate.class, + BraveLocationBarMediator.getLocaleManagerClass(), + OneshotSupplier.class, + BackKeyBehaviorDelegate.class, + WindowAndroid.class, + boolean.class, + BraveLocationBarMediator.getLensControllerClass(), + BraveLocationBarMediator.getSaveOfflineButtonStateClass(), + BraveLocationBarMediator.getOmniboxUmaClass(), + BooleanSupplier.class, + BraveLocationBarMediator.getOmniboxSuggestionsDropdownEmbedderImplClass(), + ObservableSupplier.class)); + Assert.assertTrue( + constructorsMatch( + "org/chromium/chrome/browser/AppHooksImpl", + "org/chromium/chrome/browser/BraveAppHooks")); + Assert.assertTrue( + constructorsMatch( + "org/chromium/chrome/browser/flags/CachedFlag", + "org/chromium/chrome/browser/flags/BraveCachedFlag", + String.class, + boolean.class)); Assert.assertTrue( constructorsMatch( @@ -974,7 +1050,8 @@ public void testConstructorsExistAndMatch() throws Exception { OneshotSupplier.class, boolean.class, BackPressManager.class, - Bundle.class)); + Bundle.class, + MultiInstanceManager.class)); Assert.assertTrue(constructorsMatch("org/chromium/chrome/browser/bookmarks/BookmarkToolbar", "org/chromium/chrome/browser/bookmarks/BraveBookmarkToolbar", Context.class, AttributeSet.class)); @@ -1034,6 +1111,11 @@ public void testConstructorsExistAndMatch() throws Exception { Context.class, ActivityLifecycleDispatcher.class, ObservableSupplier.class)); + Assert.assertTrue( + constructorsMatch( + "org/chromium/chrome/browser/bookmarks/BookmarkUiPrefs", + "org/chromium/chrome/browser/bookmarks/BraveBookmarkUiPrefs", + SharedPreferencesManager.class)); } @Test @@ -1120,8 +1202,6 @@ public void testFieldsExist() throws Exception { "org/chromium/chrome/browser/toolbar/ToolbarManager", "mTabModelSelector")); Assert.assertTrue(fieldExists( "org/chromium/chrome/browser/toolbar/ToolbarManager", "mIncognitoStateProvider")); - Assert.assertTrue(fieldExists( - "org/chromium/chrome/browser/toolbar/ToolbarManager", "mTabCountProvider")); Assert.assertTrue( fieldExists("org/chromium/chrome/browser/toolbar/ToolbarManager", "mTabGroupUi")); Assert.assertTrue(fieldExists( @@ -1320,10 +1400,6 @@ public void testSuperNames() throws Exception { "org/chromium/components/browser_ui/site_settings/BraveSingleWebsiteSettings")); Assert.assertTrue(checkSuperName("org/chromium/components/browser_ui/site_settings/Website", "org/chromium/components/browser_ui/site_settings/BraveWebsite")); - Assert.assertTrue( - checkSuperName( - "org/chromium/components/browser_ui/site_settings/FourStateCookieSettingsPreference", - "org/chromium/components/browser_ui/site_settings/BraveFourStateCookieSettingsPreferenceBase")); Assert.assertTrue( checkSuperName( "org/chromium/components/browser_ui/site_settings/SiteSettings", diff --git a/app/BUILD.gn b/app/BUILD.gn index 647ef6fd80e1..a33a7ffe643f 100644 --- a/app/BUILD.gn +++ b/app/BUILD.gn @@ -103,7 +103,7 @@ source_set("browser_tests") { "//chrome/browser/ui", "//chrome/common:chrome_features", "//chrome/common:non_code_constants", - "//chrome/common/companion/visual_search:flags", + "//chrome/common/companion/visual_query:flags", "//chrome/test", "//chrome/test:test_support", "//chrome/test:test_support_ui", @@ -117,6 +117,7 @@ source_set("browser_tests") { "//components/history_clusters/core", "//components/language/core/common", "//components/lens", + "//components/metrics/structured:structured_metrics_features", "//components/network_time", "//components/omnibox/browser", "//components/optimization_guide/core", @@ -136,6 +137,7 @@ source_set("browser_tests") { "//extensions/common", "//services/device/public/cpp:device_features", "//testing/gtest", + "//ui/accessibility:ax_base", ] if (is_linux || is_win || is_mac) { diff --git a/app/DEPS b/app/DEPS index 59cadf9818bb..63f23c5e09e9 100644 --- a/app/DEPS +++ b/app/DEPS @@ -37,5 +37,6 @@ include_rules = [ "+third_party/blink/public/common", "+third_party/blink/public/mojom", "+third_party/blink/public/public_buildflags.h", + "+ui/accessibility/accessibility_features.h", "+ui/base", ] diff --git a/app/app_management_strings.grdp b/app/app_management_strings.grdp index db33d8cafb20..ff510e3b47ec 100644 --- a/app/app_management_strings.grdp +++ b/app/app_management_strings.grdp @@ -154,6 +154,9 @@ Data stored in app: $1100 MB + + App language + Manage permissions diff --git a/app/brave_main_delegate_browsertest.cc b/app/brave_main_delegate_browsertest.cc index f1dde63deb5a..7717ac48c967 100644 --- a/app/brave_main_delegate_browsertest.cc +++ b/app/brave_main_delegate_browsertest.cc @@ -15,7 +15,7 @@ #include "chrome/browser/signin/signin_features.h" #include "chrome/common/chrome_features.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/companion/visual_search/features.h" +#include "chrome/common/companion/visual_query/features.h" #include "chrome/test/base/chrome_test_utils.h" #include "components/aggregation_service/features.h" #include "components/attribution_reporting/features.h" @@ -30,6 +30,7 @@ #include "components/history_clusters/core/on_device_clustering_features.h" #include "components/language/core/common/language_experiments.h" #include "components/lens/lens_features.h" +#include "components/metrics/structured/structured_metrics_features.h" #include "components/network_time/network_time_tracker.h" #include "components/omnibox/common/omnibox_features.h" #include "components/optimization_guide/core/optimization_guide_features.h" @@ -69,6 +70,7 @@ #include "chrome/test/base/in_process_browser_test.h" #include "components/translate/core/common/translate_util.h" #include "extensions/common/extension_features.h" +#include "ui/accessibility/accessibility_features.h" #endif #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) @@ -109,210 +111,209 @@ IN_PROC_BROWSER_TEST_F(BraveMainDelegateBrowserTest, OriginTrialsTest) { IN_PROC_BROWSER_TEST_F(BraveMainDelegateBrowserTest, DisabledFeatures) { // Please, keep alphabetized const base::Feature* disabled_features[] = { - &aggregation_service::kAggregationServiceMultipleCloudProviders, + &aggregation_service::kAggregationServiceMultipleCloudProviders, #if BUILDFLAG(IS_ANDROID) - &android_webview::features::kWebViewAppsPackageNamesServerSideAllowlist, - &android_webview::features::kWebViewEnumerateDevicesCache, - &android_webview::features::kWebViewServerSideSampling, - &android_webview::features::kWebViewMeasureScreenCoverage, + &android_webview::features::kWebViewAppsPackageNamesServerSideAllowlist, + &android_webview::features::kWebViewEnumerateDevicesCache, + &android_webview::features::kWebViewServerSideSampling, + &android_webview::features::kWebViewMeasureScreenCoverage, #endif -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) - &apps::features::kDesktopPWAsLinkCapturing, -#endif - &attribution_reporting::features::kAttributionReportingTriggerConfig, - &attribution_reporting::features::kConversionMeasurement, - &autofill::features::kAutofillEnableRemadeDownstreamMetrics, - &autofill::features::test::kAutofillServerCommunication, - &autofill::features::kAutofillUpstreamAllowAdditionalEmailDomains, + &attribution_reporting::features::kAttributionReportingTriggerConfig, + &attribution_reporting::features::kAttributionReportingTriggerContextId, + &attribution_reporting::features::kConversionMeasurement, + &autofill::features::kAutofillEnableRemadeDownstreamMetrics, + &autofill::features::test::kAutofillServerCommunication, #if BUILDFLAG(IS_ANDROID) - &base::features::kCollectAndroidFrameTimelineMetrics, + &base::features::kCollectAndroidFrameTimelineMetrics, #endif - &blink::features::kAdAuctionReportingWithMacroApi, - &blink::features::kAdInterestGroupAPI, - &blink::features::kAllowURNsInIframes, - &blink::features::kAttributionReportingInBrowserMigration, - &blink::features::kBackgroundResourceFetch, - &blink::features::kBiddingAndScoringDebugReportingAPI, - &blink::features::kBrowsingTopics, - &blink::features::kBrowsingTopicsXHR, - &blink::features::kClientHintsFormFactor, - &blink::features::kClientHintsMetaEquivDelegateCH, - &blink::features::kComputePressure, - &blink::features::kCssSelectorFragmentAnchor, - &blink::features::kEventTimingReportAllEarlyEntriesOnPaintedPresentation, - &blink::features::kFencedFrames, - &blink::features::kFledge, - &blink::features::kFledgeBiddingAndAuctionServer, - &blink::features::kFledgeConsiderKAnonymity, - &blink::features::kFledgeEnforceKAnonymity, - &blink::features::kInterestGroupStorage, - &blink::features::kParakeet, - &blink::features::kPrerender2, - &blink::features::kPrivacySandboxAdsAPIs, - &blink::features::kPrivateAggregationApi, - &blink::features::kPrivateAggregationApiMultipleCloudProviders, - &blink::features::kSharedStorageAPI, - &blink::features::kSharedStorageAPIM118, - &blink::features::kSharedStorageSelectURLLimit, - &blink::features::kSpeculationRulesHeaderEnableThirdPartyOriginTrial, - &blink::features::kSpeculationRulesPrefetchFuture, - &blink::features::kSpeculationRulesPrefetchProxy, - &blink::features::kTextFragmentAnchor, - &blink::features::kWebEnvironmentIntegrity, - &commerce::kCommerceAllowOnDemandBookmarkUpdates, - &commerce::kCommerceDeveloper, - &commerce::kCommerceMerchantViewer, - &commerce::kCommercePriceTracking, - &commerce::kShoppingList, - &commerce::kShoppingPDPMetrics, - &commerce::kRetailCoupons, - &companion::features::internal::kCompanionEnabledByObservingExpsNavigations, - &companion::features::internal::kSidePanelCompanion, - &companion::features::internal::kSidePanelCompanion2, - &companion::visual_search::features::kVisualSearchSuggestions, - &content_settings::features::kTrackingProtection3pcd, - &content_settings::features::kUserBypassUI, - &enterprise_connectors::kLocalContentAnalysisEnabled, + &blink::features::kAdAuctionReportingWithMacroApi, + &blink::features::kAdInterestGroupAPI, + &blink::features::kAllowURNsInIframes, + &blink::features::kAttributionReportingInBrowserMigration, + &blink::features::kBackgroundResourceFetch, + &blink::features::kBiddingAndScoringDebugReportingAPI, + &blink::features::kBrowsingTopics, + &blink::features::kClientHintsFormFactor, + &blink::features::kClientHintsMetaEquivDelegateCH, + &blink::features::kComputePressure, + &blink::features::kCssSelectorFragmentAnchor, + &blink::features::kEventTimingReportAllEarlyEntriesOnPaintedPresentation, + &blink::features::kFencedFrames, + &blink::features::kFledge, + &blink::features::kFledgeBiddingAndAuctionServer, + &blink::features::kFledgeConsiderKAnonymity, + &blink::features::kFledgeEnforceKAnonymity, + &blink::features::kInterestGroupStorage, + &blink::features::kParakeet, + &blink::features::kPrerender2, + &blink::features::kPrivacySandboxAdsAPIs, + &blink::features::kPrivateAggregationApi, + &blink::features::kPrivateAggregationApiMultipleCloudProviders, + &blink::features::kSharedStorageAPI, + &blink::features::kSharedStorageAPIM118, + &blink::features::kSharedStorageSelectURLLimit, + &blink::features::kSpeculationRulesHeaderEnableThirdPartyOriginTrial, + &blink::features::kSpeculationRulesPrefetchFuture, + &blink::features::kTextFragmentAnchor, + &commerce::kCommerceAllowOnDemandBookmarkUpdates, + &commerce::kCommerceDeveloper, + &commerce::kCommerceMerchantViewer, + &commerce::kCommercePriceTracking, + &commerce::kShoppingList, + &commerce::kShoppingPDPMetrics, + &commerce::kRetailCoupons, + &companion::features::internal:: + kCompanionEnabledByObservingExpsNavigations, + &companion::features::internal::kSidePanelCompanion, + &companion::features::internal::kSidePanelCompanion2, + &companion::visual_query::features::kVisualQuerySuggestions, + &content_settings::features::kTrackingProtection3pcd, + &content_settings::features::kUserBypassUI, + &enterprise_connectors::kLocalContentAnalysisEnabled, #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) - &enterprise_signals::features::kDeviceSignalsConsentDialog, + &enterprise_signals::features::kDeviceSignalsConsentDialog, #endif #if !BUILDFLAG(IS_ANDROID) - &extensions_features::kExtensionsManifestV3Only, + &extensions_features::kExtensionsManifestV3Only, #endif #if BUILDFLAG(IS_WIN) - &features::kAppBoundEncryptionMetrics, + &features::kAppBoundEncryptionMetrics, #endif - &features::kAttributionFencedFrameReportingBeacon, - &features::kBookmarkTriggerForPrerender2, - &features::kChromeLabs, - &features::kChromeRefresh2023, - &features::kCookieDeprecationFacilitatedTesting, -#if !BUILDFLAG(IS_ANDROID) - &features::kCopyLinkToText, + &features::kAttributionFencedFrameReportingBeacon, + &features::kBookmarkTriggerForPrerender2, + &features::kChromeLabs, + &features::kChromeRefresh2023, + &features::kCookieDeprecationFacilitatedTesting, +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) + &features::kDesktopPWAsLinkCapturing, #endif - &features::kDigitalGoodsApi, - &features::kDIPS, - &features::kFedCm, - &features::kFedCmWithoutThirdPartyCookies, - &features::kFirstPartySets, + &features::kDigitalGoodsApi, + &features::kDIPS, + &features::kFedCm, + &features::kFedCmWithoutThirdPartyCookies, + &features::kFirstPartySets, #if !BUILDFLAG(IS_ANDROID) - &features::kHaTSWebUI, + &features::kHaTSWebUI, #endif - &features::kIdleDetection, - &features::kKAnonymityService, - &features::kKAnonymityServiceOHTTPRequests, - &features::kLegacyTechReportEnableCookieIssueReports, - &features::kLegacyTechReportTopLevelUrl, - &features::kNotificationTriggers, - &features::kOmniboxTriggerForNoStatePrefetch, - &features::kOmniboxTriggerForPrerender2, - &features::kPerformanceSettingsPreloadingSubpage, - &features::kPrivacyGuide3, + &features::kIdleDetection, + &features::kKAnonymityService, + &features::kKAnonymityServiceOHTTPRequests, + &features::kLegacyTechReportEnableCookieIssueReports, + &features::kLegacyTechReportTopLevelUrl, + &features::kNotificationTriggers, + &features::kOmniboxTriggerForNoStatePrefetch, + &features::kOmniboxTriggerForPrerender2, + &features::kPerformanceSettingsPreloadingSubpage, + &features::kPrivacyGuide3, #if BUILDFLAG(IS_ANDROID) - &features::kPrivacyGuideAndroidPostMVP, + &features::kPrivacyGuideAndroidPostMVP, #endif - &features::kPrivacyGuidePreload, + &features::kPrivacyGuidePreload, #if BUILDFLAG(IS_ANDROID) - &features::kPrivacyGuidePreloadAndroid, + &features::kPrivacyGuidePreloadAndroid, +#endif + &features::kPrivacySandboxAdsAPIsOverride, +#if !BUILDFLAG(IS_ANDROID) + &features::kReadAnything, #endif - &features::kPrivacySandboxAdsAPIsOverride, - &features::kResourceTimingForCancelledNavigationInFrame, - &features::kSCTAuditing, - &features::kServiceWorkerAutoPreload, - &features::kSignedExchangeReportingForDistributors, - &features::kSignedHTTPExchange, - &features::kSupportSearchSuggestionForPrerender2, - &features::kTabHoverCardImages, + &features::kResourceTimingForCancelledNavigationInFrame, + &features::kSCTAuditing, + &features::kServiceWorkerAutoPreload, + &features::kSignedExchangeReportingForDistributors, + &features::kSignedHTTPExchange, + &features::kSupportSearchSuggestionForPrerender2, + &features::kTabHoverCardImages, #if !BUILDFLAG(IS_ANDROID) - &features::kTrustSafetySentimentSurvey, - &features::kTrustSafetySentimentSurveyV2, + &features::kTrustSafetySentimentSurvey, + &features::kTrustSafetySentimentSurveyV2, #endif #if BUILDFLAG(IS_MAC) - &features::kUseChromiumUpdater, + &features::kUseChromiumUpdater, #endif - &features::kWebOTP, - &history::kOrganicRepeatableQueries, - &history::kSyncSegmentsData, - &history_clusters::kRenameJourneys, - &history_clusters::kSidePanelJourneys, - &history_clusters::features::kOnDeviceClustering, - &history_clusters::features::kOnDeviceClusteringKeywordFiltering, - &history_clusters::internal::kHistoryClustersInternalsPage, - &history_clusters::internal::kHistoryClustersNavigationContextClustering, - &history_clusters::internal::kJourneys, - &history_clusters::internal::kJourneysImages, - &history_clusters::internal::kJourneysNamedNewTabGroups, - &history_clusters::internal::kJourneysPersistCachesToPrefs, - &history_clusters::internal::kJourneysZeroStateFiltering, - &history_clusters::internal::kOmniboxAction, - &history_clusters::internal::kOmniboxHistoryClusterProvider, - &history_clusters::internal::kPersistedClusters, - &history_clusters::internal::kPersistContextAnnotationsInHistoryDb, + &features::kWebOTP, + &history::kOrganicRepeatableQueries, + &history::kSyncSegmentsData, + &history_clusters::kRenameJourneys, + &history_clusters::kSidePanelJourneys, + &history_clusters::features::kOnDeviceClustering, + &history_clusters::features::kOnDeviceClusteringKeywordFiltering, + &history_clusters::internal::kHistoryClustersInternalsPage, + &history_clusters::internal::kHistoryClustersNavigationContextClustering, + &history_clusters::internal::kJourneys, + &history_clusters::internal::kJourneysImages, + &history_clusters::internal::kJourneysNamedNewTabGroups, + &history_clusters::internal::kJourneysPersistCachesToPrefs, + &history_clusters::internal::kJourneysZeroStateFiltering, + &history_clusters::internal::kOmniboxAction, + &history_clusters::internal::kOmniboxHistoryClusterProvider, + &history_clusters::internal::kPersistedClusters, + &history_clusters::internal::kPersistContextAnnotationsInHistoryDb, #if !BUILDFLAG(IS_ANDROID) - &kForYouFre, + &kForYouFre, #endif #if BUILDFLAG(ENABLE_MIRROR) - &kVerifyRequestInitiatorForMirrorHeaders, + &kVerifyRequestInitiatorForMirrorHeaders, #endif - &lens::features::kEnableLensPing, - &lens::features::kLensStandalone, - &media::kLiveCaption, - &net::features::kEnableWebTransportDraft07, - &net::features::kPartitionedCookies, - &net::features::kThirdPartyPartitionedStorageAllowedByDefault, - &net::features::kThirdPartyStoragePartitioning, - &net::features::kTpcdMetadataGrants, - &net::features::kWaitForFirstPartySetsInit, - &network::features::kFledgePst, - &network::features::kPrivateStateTokens, - &network_time::kNetworkTimeServiceQuerying, - &ntp_features::kCustomizeChromeSidePanelExtensionsCard, - &ntp_features::kCustomizeChromeWallpaperSearch, - &ntp_features::kNtpAlphaBackgroundCollections, - &ntp_features::kNtpBackgroundImageErrorDetection, - &ntp_features::kNtpChromeCartModule, - &ntp_features::kNtpHistoryClustersModule, - &ntp_features::kNtpHistoryClustersModuleDiscounts, - &ntp_features::kNtpHistoryClustersModuleLoad, - &omnibox::kDocumentProviderNoSetting, - &omnibox::kDocumentProviderNoSyncRequirement, - &omnibox::kExpandedStateHeight, - &omnibox::kExpandedStateShape, - &omnibox::kOmniboxSteadyStateHeight, - &omnibox::kRichAutocompletion, - &optimization_guide::features::kOptimizationGuideFetchingForSRP, - &optimization_guide::features::kOptimizationHints, - &optimization_guide::features::kRemoteOptimizationGuideFetching, - &optimization_guide::features:: - kRemoteOptimizationGuideFetchingAnonymousDataConsent, - &optimization_guide::features::kTextEmbeddingPageContentAnnotations, - &page_image_service::kImageService, - &page_image_service::kImageServiceSuggestPoweredImages, + &lens::features::kEnableLensPing, + &lens::features::kLensStandalone, + &media::kLiveCaption, + &metrics::structured::kEnabledStructuredMetricsService, + &metrics::structured::kNearbyShareMetrics, + &metrics::structured::kPhoneHubStructuredMetrics, + &net::features::kEnableWebTransportDraft07, + &net::features::kPartitionedCookies, + &net::features::kThirdPartyPartitionedStorageAllowedByDefault, + &net::features::kThirdPartyStoragePartitioning, + &net::features::kTpcdMetadataGrants, + &net::features::kWaitForFirstPartySetsInit, + &network::features::kFledgePst, + &network::features::kPrivateStateTokens, + &network_time::kNetworkTimeServiceQuerying, + &ntp_features::kCustomizeChromeSidePanelExtensionsCard, + &ntp_features::kCustomizeChromeWallpaperSearch, + &ntp_features::kNtpAlphaBackgroundCollections, + &ntp_features::kNtpBackgroundImageErrorDetection, + &ntp_features::kNtpChromeCartModule, + &ntp_features::kNtpHistoryClustersModule, + &ntp_features::kNtpHistoryClustersModuleDiscounts, + &ntp_features::kNtpHistoryClustersModuleLoad, + &omnibox::kDocumentProviderNoSetting, + &omnibox::kDocumentProviderNoSyncRequirement, + &omnibox::kExpandedStateHeight, + &omnibox::kExpandedStateShape, + &omnibox::kOmniboxSteadyStateHeight, + &omnibox::kRichAutocompletion, + &optimization_guide::features::kOptimizationGuideFetchingForSRP, + &optimization_guide::features::kOptimizationHints, + &optimization_guide::features::kRemoteOptimizationGuideFetching, + &optimization_guide::features:: + kRemoteOptimizationGuideFetchingAnonymousDataConsent, + &optimization_guide::features::kTextEmbeddingPageContentAnnotations, + &page_image_service::kImageService, + &page_image_service::kImageServiceSuggestPoweredImages, #if !BUILDFLAG(IS_ANDROID) - &permissions::features::kPermissionsPromptSurvey, - &permissions::features::kRecordPermissionExpirationTimestamps, + &permissions::features::kPermissionsPromptSurvey, #endif - &permissions::features::kPermissionOnDeviceNotificationPredictions, - &permissions::features::kPermissionStorageAccessAPI, - &permissions::features::kShowRelatedWebsiteSetsPermissionGrants, - &privacy_sandbox::kEnforcePrivacySandboxAttestations, - &privacy_sandbox::kOverridePrivacySandboxSettingsLocalTesting, - &privacy_sandbox::kPrivacySandboxFirstPartySetsUI, - &privacy_sandbox::kPrivacySandboxProactiveTopicsBlocking, - &privacy_sandbox::kPrivacySandboxSettings3, - &privacy_sandbox::kPrivacySandboxSettings4, - &promos_features::kIOSPromoPasswordBubble, - &safe_browsing::kExtensionTelemetryDisableOffstoreExtensions, - &safe_browsing::kExtensionTelemetryTabsApiSignal, - &segmentation_platform::features::kSegmentationPlatformCollectTabRankData, - &segmentation_platform::features::kSegmentationPlatformDeviceTier, - &segmentation_platform::features::kSegmentationPlatformFeature, - &segmentation_platform::features::kSegmentationPlatformTimeDelaySampling, - &shared_highlighting::kIOSSharedHighlightingV2, - &shared_highlighting::kSharedHighlightingManager, - &subresource_filter::kAdTagging, + &permissions::features::kPermissionOnDeviceNotificationPredictions, + &permissions::features::kPermissionStorageAccessAPI, + &permissions::features::kShowRelatedWebsiteSetsPermissionGrants, + &privacy_sandbox::kEnforcePrivacySandboxAttestations, + &privacy_sandbox::kOverridePrivacySandboxSettingsLocalTesting, + &privacy_sandbox::kPrivacySandboxFirstPartySetsUI, + &privacy_sandbox::kPrivacySandboxProactiveTopicsBlocking, + &privacy_sandbox::kPrivacySandboxSettings4, + &promos_features::kIOSPromoPasswordBubble, + &safe_browsing::kExtensionTelemetryDisableOffstoreExtensions, + &safe_browsing::kExtensionTelemetryTabsApiSignal, + &segmentation_platform::features::kSegmentationPlatformCollectTabRankData, + &segmentation_platform::features::kSegmentationPlatformDeviceTier, + &segmentation_platform::features::kSegmentationPlatformFeature, + &segmentation_platform::features::kSegmentationPlatformTimeDelaySampling, + &shared_highlighting::kIOSSharedHighlightingV2, + &shared_highlighting::kSharedHighlightingManager, + &subresource_filter::kAdTagging, #if !BUILDFLAG(IS_ANDROID) - &translate::kTFLiteLanguageDetectionEnabled, + &translate::kTFLiteLanguageDetectionEnabled, #endif }; @@ -332,8 +333,6 @@ IN_PROC_BROWSER_TEST_F(BraveMainDelegateBrowserTest, EnabledFeatures) { &features::kWinrtGeolocationImplementation, #endif #if !BUILDFLAG(IS_ANDROID) - &safe_browsing::kDownloadBubble, - &safe_browsing::kDownloadBubbleV2, &sharing_hub::kDesktopScreenshots, #endif &media::kEnableTabMuting, diff --git a/app/brave_strings.grd b/app/brave_strings.grd index 2f3fc81af82e..2a7d5c5c4a42 100644 --- a/app/brave_strings.grd +++ b/app/brave_strings.grd @@ -350,9 +350,18 @@ If you update this file, be sure also to update google_chrome_strings.grd. --> - - $1Brave - Brave - + + + + $1Brave - Brave for Testing + + + + + $1Brave - Brave + + + @@ -380,9 +389,18 @@ If you update this file, be sure also to update google_chrome_strings.grd. --> - - $1Brave - Brave - + + + + $1Brave - Brave for Testing + + + + + $1Brave - Brave + + + $1Brave - Brave Beta @@ -683,6 +701,9 @@ Permissions you've already given to websites and apps may apply to this account. Learn why Brave blocks some downloads + + This file may be dangerous$1Brave can check this download for you if you provide the password — your password stays on your device + @@ -729,6 +750,11 @@ Permissions you've already given to websites and apps may apply to this account. Brave blocked this download because you turned Safe Browsing off and the file can't be verified + + + Learn why Brave blocks some files + + @@ -999,14 +1025,17 @@ Permissions you've already given to websites and apps may apply to this account. Another account is already signed in. To keep your browsing separate, Brave can create your own profile for you. - Get the most out of Brave + Make Brave your own - Sign in to get your Brave stuff across devices + Sign in to get the most out of Brave Use Brave without an account + + Sign in to Brave? + @@ -1155,18 +1184,9 @@ Permissions you've already given to websites and apps may apply to this account. - - This extension has changed what page is shown when you start Brave. - - - The extension "$1AdBlock" has changed what page is shown when you start Brave. - ''' It also controls what page is shown when you start Brave. ''' - - ''' It also controls what page is shown when you start Brave or click the Home button. ''' - ''' It also controls what page is shown when you start Brave or search from the Omnibox. ''' @@ -1776,6 +1796,11 @@ Permissions you've already given to websites and apps may apply to this account. Installation complete. + + + Extra code: $10x80071234. + + Unable to connect to the Internet. If you use a firewall, please allowlist $1BraveUpdater.exe. @@ -1797,6 +1822,21 @@ Permissions you've already given to websites and apps may apply to this account. Installation failed because access is restricted in this country. + + Installation failed because this version of the operating system is not supported. + + + Installation failed because your computer does not meet the minimum hardware requirements. + + + Installation failed because the update server does not have any hash data for the application. + + + Installation failed because of an unsupported protocol error. + + + Installation failed because of an update server internal error. + Update check error: $1error-internal. @@ -1821,10 +1861,26 @@ Permissions you've already given to websites and apps may apply to this account. Service error: $1error-internal. + Install error: $1error-internal + + Reboot required: $1success-message-internal + + + Install error: Your network administrator has applied a Group Policy that prevents installation: $1error-internal + + + Install error: The installer filename is invalid or unsupported. + + + Install error: The installer process failed to start. + + + Install error: The installer did not complete. The installation has been aborted. + @@ -1856,6 +1912,11 @@ Permissions you've already given to websites and apps may apply to this account. + + + + To clear browsing data from this device only, while keeping it in your Brave sync chain, <a href="#" target="_blank">sign out of Brave</a>. + Google Chrome Beta diff --git a/app/brave_strings_override.grd b/app/brave_strings_override.grd index 07ef059bb88f..44078c589f1d 100644 --- a/app/brave_strings_override.grd +++ b/app/brave_strings_override.grd @@ -110,7 +110,13 @@ If you update this file, be sure also to update google_chrome_strings.grd. --> + + + + + + @@ -125,6 +131,12 @@ If you update this file, be sure also to update google_chrome_strings.grd. --> + + + + + + @@ -396,6 +408,7 @@ Permissions you've already given to websites and apps may apply to this account. - + + diff --git a/app/generated_resources.grd b/app/generated_resources.grd index 6bfaeb0a8d5d..4f42d92a988d 100644 --- a/app/generated_resources.grd +++ b/app/generated_resources.grd @@ -289,6 +289,9 @@ are declared in tools/grit/grit_rule.gni. + + + @@ -710,6 +713,9 @@ are declared in tools/grit/grit_rule.gni. C&opy video frame + + Search video frame with $1Google Lens + &Open video in new tab @@ -982,6 +988,9 @@ are declared in tools/grit/grit_rule.gni. C&opy Video Frame + + Search Video Frame with $1Google Lens + &Open Video in New Tab @@ -2097,6 +2106,9 @@ are declared in tools/grit/grit_rule.gni. This file might be a virus or malware. You can send it to Brave to check if it's unsafe. + + This file may be dangerous + This file is dangerous @@ -2288,6 +2300,9 @@ are declared in tools/grit/grit_rule.gni. Open anyway + + Check for malware + Download dangerous file @@ -2318,6 +2333,13 @@ are declared in tools/grit/grit_rule.gni. Unverified download blocked + + This file could harm your device + + + This file contains malware or comes from a suspicious site + + Downloading $152.7 MB, $2somedocument.pdf @@ -2987,6 +3009,29 @@ are declared in tools/grit/grit_rule.gni. Incorrect password. Try again. + + + Suspicious file blocked + + + Password needed + + + Check for malware + + + Download suspicious file + + + Cancel download + + + This file may be dangerous$1This check is taking longer than usual... + + + Checking for malware... + + @@ -5141,6 +5186,9 @@ are declared in tools/grit/grit_rule.gni. See device information, such as its serial number or asset ID + + Change the system keyboard layout + See network information, such as your IP or MAC address @@ -5176,6 +5224,9 @@ are declared in tools/grit/grit_rule.gni. Subscribe to ChromeOS Flex system events + + Manage ChromeOS Flex audio settings + Read ChromeOS Flex device information and data @@ -5199,6 +5250,9 @@ are declared in tools/grit/grit_rule.gni. Subscribe to ChromeOS system events + + Manage ChromeOS audio settings + Read ChromeOS device information and data @@ -5485,6 +5539,12 @@ are declared in tools/grit/grit_rule.gni. $1Gmail Checker is pinned by your administrator + + Open side panel + + + Close side panel + Manage extension @@ -5580,6 +5640,12 @@ are declared in tools/grit/grit_rule.gni. $1Gmail Checker is pinned by your Administrator + + Open Side Panel + + + Close Side Panel + Manage Extension @@ -6125,12 +6191,6 @@ Keep your key file in a safe place. You will need it to create new versions of y Is this the home page you were expecting? - - Is this the startup page you were expecting? - - - Is this the search page you were expecting? - Is this the new tab page you were expecting? @@ -6138,12 +6198,6 @@ Keep your key file in a safe place. You will need it to create new versions of y Your Internet connection is being controlled - - This extension has changed what page is shown when you search from the Omnibox. - - - The extension "$1AdBlock" has changed what page is shown when you search from the Omnibox. - This extension has changed what page is shown when you click the Home button. @@ -6154,12 +6208,6 @@ Keep your key file in a safe place. You will need it to create new versions of y ''' It also controls what page is shown when you search from the Omnibox.''' - - ''' It also controls what page is shown when you click the Home button. ''' - - - ''' It also controls what page is shown when you click the Home button or search from the Omnibox. ''' - @@ -6175,6 +6223,20 @@ Keep your key file in a safe place. You will need it to create new versions of y Deny + + + Find document scanners + + + "$1Scanner Forwarder" wants to find and access document scanners. + + + Allow + + + Deny + + An extension has changed what page is shown when you open a new tab. @@ -6222,8 +6284,8 @@ Keep your key file in a safe place. You will need it to create new versions of y {NUM_SUB_APP_INSTALLS, plural, - =1 {"{APP_NAME}Citrix" ({DOMAIN}citrix.com) would like to install the following app on this device:} - other {"{APP_NAME}Citrix" ({DOMAIN}citrix.com) would like to install the following apps on this device:} + =1 {"{APP_NAME}Citrix" would like to install the following app on this device:} + other {"{APP_NAME}Citrix" would like to install the following apps on this device:} } @@ -7272,6 +7334,9 @@ Keep your key file in a safe place. You will need it to create new versions of y Your uploaded image + + AI created theme + Upload from device @@ -7320,6 +7385,12 @@ Keep your key file in a safe place. You will need it to create new versions of y Color picker + + Unselect + + + Unselect color + Theme is set by your Organization @@ -7455,6 +7526,135 @@ Keep your key file in a safe place. You will need it to create new versions of y Find themes + + Send feedback for Create theme with AI + + + Please try again later. + + + Try again or select from one of the previously generated themes below. + + + Something went wrong. + + + Create with AI + + + Create theme with AI + + + Your recent AI themes + + + Check your internet and try again. + + + Check your internet and try again. You can still select from one of the previously generated themes below. + + + Looks like you're offline. + + + Add optional details + + + Red + + + Blue + + + Yellow + + + Green + + + Black + + + Please try again tomorrow. + + + You've reached your limit for today. + + + Create + + + Try again + + + Recent AI theme $12 + + + Recent AI theme $12 of $2 + + + Recent AI theme $12 of $2, in $3 style + + + Recent AI theme $12 of $2, with $3 mood. + + + Recent AI theme $12 of $2, in $3 style, with $4 mood. + + + Generated image $12 of $2 + + + Generated image $12 of $2, in $3 style + + + Generated image $12 of $2, with $3 mood. + + + Generated image $12 of $2, in $3 style, with $4 mood. + + + Subject + + + Choose a subject + + + Mood + + + Choose a mood + + + Style + + + Choose a style + + + Learn more about creating themes with AI. + + + Thumbs down opens a form for submitting detailed feedback on why you dislike these results. + + + Thumbs up submits feedback that you like these results. + + + Inspiration + + + Generating... + + + Generated $12 images + + + This is an experimental AI feature and won't always get it right. + + + Meadow, Oil Painting, Intellectual, Yellow + @@ -7841,6 +8041,15 @@ Keep your key file in a safe place. You will need it to create new versions of y Search for $1Office Chairs + + Tabs from other devices + + + You’re seeing tabs from other devices to help you easily get back to your most recent activity. + <br> + <br> + You can manage settings from the card menu or see more options in Customize Brave. + @@ -8013,12 +8222,36 @@ Keep your key file in a safe place. You will need it to create new versions of y Unpin + + Pin + Unpin from toolbar Pin to toolbar + + Side panel unpinned + + + Side panel pinned + + + $1Bookmarks - pinned + + + You can open most side panel features through the Brave menu + + + You can open most side panel features through the Brave menu at the top right + + + You can pin this side panel for easy access + + + To easily get back to the side panel, click Pin at the top right + @@ -8385,6 +8618,9 @@ Keep your key file in a safe place. You will need it to create new versions of y Google Lens + + Image Search + @@ -8527,9 +8763,6 @@ Keep your key file in a safe place. You will need it to create new versions of y Saving card - - Can't save card right now - Save CVC @@ -8539,12 +8772,6 @@ Keep your key file in a safe place. You will need it to create new versions of y Save payment method - - Show IBAN value - - - Hide IBAN value - Translate this page @@ -8566,24 +8793,44 @@ Keep your key file in a safe place. You will need it to create new versions of y - Organize tabs + Organize tabs? Organize tabs? - Close + Dismiss suggestion + + + Send feedback for Suggested Groups - + Organize Tabs - + Organize tabs + + Right-click on the tab group name to edit this group or click to collapse + + + Select the tab group and activate the context menu to edit + + + + + Try out experimental AI features + + + Get help organizing tabs and creating custom themes + + + Continue + @@ -8771,7 +9018,7 @@ Keep your key file in a safe place. You will need it to create new versions of y Search tabs - Organize tabs + Group related tabs Scroll towards the first tab @@ -8892,6 +9139,12 @@ Keep your key file in a safe place. You will need it to create new versions of y To get back here quickly, install $1Brave Maps by clicking the install button + + You can change how links open in App settings + + + Open App settings + Your connection is always secure unless Brave tells you otherwise @@ -9285,6 +9538,9 @@ Check your passwords anytime in $1Brave P New password received + + Fix password error + Import Passwords To Brave @@ -9476,6 +9732,9 @@ Check your passwords anytime in $1Brave P Describe the issue in detail + + Describe the issue in detail. Feedback will be sent to Brave for human review and may be used for improving or developing Brave products and services. + URL @@ -9545,12 +9804,18 @@ Check your passwords anytime in $1Brave P <Four files generated by Intel Wi-Fi firmware: csr.lst, fh_regs.lst, radio_reg.lst, monitor.lst.sysmon. The first three are binary files containing register dumps, and are asserted by Intel to contain no personal or device-identifying information. The last file is an execution trace from the Intel firmware; it has been scrubbed of any personal or device-identifying information, but is too large to display here. These files were generated in response to recent Wi-Fi problems with your device, and will be shared with Intel to help troubleshoot these problems.> + + Include my server logs. + Go to the <a href="#" id="legal-help-page-url">Legal Help page</a> to request content changes for legal reasons. Some account and system information may be sent to Brave. We will use the information you give us to help address technical issues and to improve our services, subject to our <a href="#" id="privacy-policy-url">Privacy Policy</a> and <a href="#" id="terms-of-service-url">Terms of Service</a>. Please describe the problem before sending feedback. + + Report offensive/unsafe. + Send @@ -9861,7 +10126,7 @@ Check your passwords anytime in $1Brave P New window - Organize tabs + Organize similar tabs Follow site @@ -9962,7 +10227,7 @@ Check your passwords anytime in $1Brave P New Window - Organize Tabs + Organize Similar Tabs Follow Site @@ -10065,11 +10330,11 @@ Check your passwords anytime in $1Brave P Collapse recently closed - - All Tabs + + All tabs - Organize Tabs + Organize tabs Create group @@ -10078,25 +10343,34 @@ Check your passwords anytime in $1Brave P Dismiss - Organize tabs + Check if tabs can be organized Let Brave organize your tabs - You can organize your tabs anytime + Tab group suggestions are shown when they're available, but you can check anytime - Brave can help your tabs stay organized and easy to find + You'll get tab group suggestions that group similar tabs to help you stay organized - - Turn on sync to let Brave keep your tabs organized. + + Sign in and turn on sync to let Brave suggest tab groups and keep your tabs organized + + + Turn on sync to let Brave suggest tab groups and keep your tabs organized - Turn on History sync in Settings to let Brave keep your tabs organized. + Turn on History sync in Settings to let Brave suggest tab groups and keep your tabs organized + + + Sign in to let Brave suggest tab groups and keep your tabs organized - Organize tabs + Check now + + + Let's go Turn on sync @@ -10107,33 +10381,93 @@ Check your passwords anytime in $1Brave P Sign in + + Check now if tabs can be organized + + + Let's go and organize your tabs + + + Turn on sync to let Brave suggest tab groups + + + Open settings to let Brave suggest tab groups + + + Sign in to let Brave suggest tab groups + - Organizing… + Organizing into a tab group… - Tab organization found + Tab group suggestion Something went wrong - No opportunities for tab organization found + No groups found + + + Tab group suggestions are currently unavailable. You can + + + refresh now + + + or try again later + + + You can - - Tab organization is currently unavailable + + refresh now - - You'll get more opportunities for tab organization after you open new related tabs + + or try again later after you open new similar tabs Tip: - You can organize your own tabs anytime. + You can create your own tab group. Show me how + + Launch tab group tutorial + + + This is an experimental AI feature and won't always get it right. + + + Learn more + + + Learn more about using AI tools + + + Remove $1New Tab from tab group + + + Exclude tab from suggested group + + + Refresh + + + Clear + + + Tab group name: $1My tab group + + + Thumbs down submits feedback that you dislike this tab group suggestion + + + Thumbs up submits feedback that you like this tab group suggestion + @@ -12849,29 +13183,53 @@ Please help our engineers fix this problem. Tell us what happened right before y + + MIDI devices allowed + + + MIDI devices blocked + + + This site is using your MIDI devices. + + + Always block $1example.com from using your MIDI devices. + + + Continue allowing this site to use your MIDI devices. + + + This site has been blocked from using your MIDI devices. + + + Always allow $1mail.google.com to use your MIDI devices. + + + Continue blocking this site from using your MIDI devices. + - Full control of MIDI devices allowed + Control and reprogramming of MIDI devices allowed - Full control of MIDI devices denied + Control and reprogramming of MIDI devices blocked - This page has full control of MIDI devices. + This site can control and reprogram your MIDI devices (SysEx). - Always block $1example.com from having full control of MIDI devices. + Always block $1example.com from controlling and reprogramming your MIDI devices. - Continue allowing this site to have full control of MIDI devices + Continue allowing this site to control and reprogram your MIDI devices. - This site has been blocked from having full control of MIDI devices. + This site has been blocked from controlling and reprogramming your MIDI devices (SysEx). - Always allow $1mail.google.com to have full control of MIDI devices + Always allow $1mail.google.com to control and reprogram your MIDI devices. - Continue blocking this site from having full control of MIDI devices + Continue blocking this site from controlling and reprogramming your MIDI devices. @@ -14903,22 +15261,6 @@ Please help our engineers fix this problem. Tell us what happened right before y } - - - - - Take Survey - - - - - Take survey - - - - Your feedback is important to us. - - Helpful @@ -14954,6 +15296,9 @@ Please help our engineers fix this problem. Tell us what happened right before y =1 {This file or your device doesn’t meet some of your organization’s security policies. Check with your admin on what needs to be fixed.} other {These files don't meet some of your organization’s security policies. Check with your admin on what needs to be fixed.}} + + Scan failed. This action is blocked by your administrator. + {NUM_FILES, plural, =0 {This data or your device doesn’t meet some of your organization’s security policies. Check with your admin on what needs to be fixed.} @@ -15286,16 +15631,30 @@ Please help our engineers fix this problem. Tell us what happened right before y Enables saving and recalling of tab groups. Right click a tab group to save it. Recall groups from the bookmarks bar. + + + Customize Brave Side Panel + + + Enables the ability to use Customize Brave functionality from the unified side panel on the New Tab Page. + Brave Refresh 2023 - Enables the new desktop design. + Enables the new desktop design. Customize Brave Side Panel must also be enabled. without Omnibox + + + Brave WebUI Refresh 2023 + + + Enables the new desktop design for WebUI. Brave Refresh 2023 must also be enabled. + Tab Scrolling @@ -15384,6 +15743,9 @@ Please help our engineers fix this problem. Tell us what happened right before y To continue, $1idp.com will share your name, email address, and profile picture with this site. See this site's $2privacy policy$3 and $4terms of service$5. + + Add Account + Failed signing in to $1rp.example with $2idp.example @@ -15786,35 +16148,6 @@ Please help our engineers fix this problem. Tell us what happened right before y You have enabled testing third-party cookie phaseout. This cannot be overridden by the settings page. If you want to re-enable third-party cookies, relaunch Brave with this feature disabled. - - - Lorem Ipsum - - - Lorem Ipsum - - - Use $1plus@plus.plus? - - - Lorem Ipsum or whatever - - - For $1test@example.test - - - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. - - - Dolor - - - Sit - - - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua <link>Ut enim ad minim veniam</link> for <b>$1test@example.test</b>. - - Profile @@ -15846,10 +16179,10 @@ Please help our engineers fix this problem. Tell us what happened right before y - waiting... + Waiting... - installing... + Installing... $1Gmail, waiting @@ -15874,6 +16207,54 @@ Please help our engineers fix this problem. Tell us what happened right before y You security preferences do not allow installations of Isolated Apps. $1Change your preferences + + Please wait while installation is in progress + + + Installing... + + + This application will be installed on your currently used Brave profile. $1Manage your Brave profiles + + + Manage your Brave profiles + + + Application: $1Brave Maps + + + Version: $11.0.0 + + + Do you want to continue and allow this software to make changes to your device? + + + To keep your device secure, you should only run and install software from trusted sources and developers. $1Learn more + + + Learn more + + + Continue + + + Something went wrong + + + The installation could not be completed. Please try again or close this window + + + Retry + + + Congrats! $1Brave Maps has been successfully installed on your device + + + Finish + + + Launch application + Brave is verifying the installation bundle @@ -15886,6 +16267,23 @@ Please help our engineers fix this problem. Tell us what happened right before y =1 {Checking public key and integrity block... 1 minute remaining} other {Checking public key and integrity block... # minutes remaining}} + + Brave failed to verify this installation bundle + + + This bundle might be broken or compromised. Please close this window and download it again + + + + + Thumbs down submits feedback that you dislike this. + + + Thumbs up submits feedback that you like this. + + + This is an experimental AI feature. + diff --git a/app/generated_resources_override.grd b/app/generated_resources_override.grd index e6d82361d946..e4543e0eb1ba 100644 --- a/app/generated_resources_override.grd +++ b/app/generated_resources_override.grd @@ -645,7 +645,6 @@ are declared in tools/grit/grit_rule.gni. - @@ -1179,12 +1178,6 @@ are declared in tools/grit/grit_rule.gni. Close Private - - - - - - diff --git a/app/media_live_preview_strings.grdp b/app/media_live_preview_strings.grdp new file mode 100644 index 000000000000..b477e790e24f --- /dev/null +++ b/app/media_live_preview_strings.grdp @@ -0,0 +1,40 @@ + + + + + + + + Camera + + + + Preview of your camera + + + + No camera connected + + + + Connect a camera + + + + + Microphone + + + + No microphone connected + + + + Connect a microphone + + + + System default + + + diff --git a/app/nearby_share_strings.grdp b/app/nearby_share_strings.grdp index 485938d6a35e..56474263c8f1 100644 --- a/app/nearby_share_strings.grdp +++ b/app/nearby_share_strings.grdp @@ -35,6 +35,12 @@ other {# contacts are not available. To use Nearby Share with them, add the email addresses associated with their Brave sync chains to your contacts.} } + + {COUNT, plural, + =1 {# contact is not available. To use $2Nearby Share with them, add the email address associated with their Brave sync chain to your contacts.} + other {# contacts are not available. To use $2Nearby Share with them, add the email addresses associated with their Brave sync chains to your contacts.} + } + Your contacts can share with you when they are nearby. Transfers won't start until you accept. @@ -293,6 +299,9 @@ Nearby Share settings for $1Jane Doe's device, sharing under the account $2example@gmail.com. + + $1Nearby Share settings for $2Jane Doe's device, sharing under the account $3example@gmail.com. + Nearby Share uses Bluetooth scanning to find nearby devices. diff --git a/app/os_settings_search_tag_strings.grdp b/app/os_settings_search_tag_strings.grdp index 3f3e76653a83..b536725783e9 100644 --- a/app/os_settings_search_tag_strings.grdp +++ b/app/os_settings_search_tag_strings.grdp @@ -81,6 +81,12 @@ Cellular APN + + Cellular APN settings + + + Access point name (APN) + Turn off Cellular network @@ -96,6 +102,12 @@ Download eSIM profile + + Add new APN + + + Add new Access point name + Turn on Cellular network @@ -493,7 +505,7 @@ Show Google Drive suggestions - + Local Data Recovery diff --git a/app/os_settings_strings.grdp b/app/os_settings_strings.grdp index 2839b2f864dc..1c050c37a808 100644 --- a/app/os_settings_strings.grdp +++ b/app/os_settings_strings.grdp @@ -65,6 +65,9 @@ Copy build details to clipboard + + Copied build details + Enterprise Enrolled @@ -1210,6 +1213,9 @@ + + Screen reader, magnification + Show accessibility options in Quick Settings @@ -2453,6 +2459,9 @@ Press an assigned switch or key to remove assignment. An upgrade to Debian 11 (Bullseye) is available + + An upgrade to Debian 12 (Bookworm) is available + Current version is $1Debian GNU/Linux 9 (stretch) @@ -3913,6 +3922,12 @@ Press an assigned switch or key to remove assignment. + + Wi-Fi + + + Wi-Fi, mobile data + Add Cellular... @@ -3948,6 +3963,9 @@ Press an assigned switch or key to remove assignment. Cellular details + + + This device can only connect to a specific mobile network. <a target="_blank" href="$1">Learn more</a> Instant Tethering details @@ -4004,7 +4022,7 @@ Press an assigned switch or key to remove assignment. When no devices are connected - Configure $1Chromebook Hotspot + Configure $1Chromebook hotspot Create a Wi-Fi hotspot using your $1Chromebook's mobile data to provide internet to other devices. <a target="_blank" href="$2">Learn more</a> @@ -4066,8 +4084,8 @@ Press an assigned switch or key to remove assignment. Mobile data networks - - Enabling + + Turning on... Applying changes... @@ -4084,6 +4102,9 @@ Press an assigned switch or key to remove assignment. Network + + Internet + Hotspot @@ -4362,6 +4383,9 @@ Press an assigned switch or key to remove assignment. This network is shared with you + + + Your device can't connect to this network. <a target="_blank" href="$1">Learn more</a> This network is not synced to your account. <a target="_blank" href="$1https://google.com/">Learn more</a> @@ -4374,6 +4398,9 @@ Press an assigned switch or key to remove assignment. Network out of range + + + Mobile network provider is locked Set up new network @@ -4451,10 +4478,10 @@ Press an assigned switch or key to remove assignment. Instant Tethering - No available eSIM profiles + No mobile networks set up - No available eSIM profiles. Download a new <a href="#" id="cellularEsimLink">profile.</a> + No mobile networks set up. Download a new <a href="#" id="cellularEsimLink">profile.</a> No SIM card inserted @@ -4619,6 +4646,9 @@ Press an assigned switch or key to remove assignment. Phone Hub, Nearby Share + + Phone Hub, $1Nearby Share + Connected to $1Android phone @@ -5376,7 +5406,7 @@ Press an assigned switch or key to remove assignment. Default to using voice instead of keyboard - To get responses that are more tailored to you, let Brave Assistant access a screenshot of what’s on your screen when you ask questions. Your Assistant may also use info about songs or videos that are playing. + When you ask questions, Brave Assistant provides tailored responses based on your screen Brave Assistant settings @@ -5428,6 +5458,9 @@ Press an assigned switch or key to remove assignment. Sunset to sunrise + + Current schedule is set to 6am - 6pm. To automatically update the sunset and sunrise schedule <a href="#">turn on Location access</a> + Make it easier to look at your screen or read in dim light @@ -5656,6 +5689,9 @@ Press an assigned switch or key to remove assignment. Use your IP address to determine location (default) + + Time Zone is currently set to (UTC+/-X:XX). Location access is needed to automatically update the time zone. <a href="#">Turn on Location access</a> + Use your IP address to determine location @@ -5680,16 +5716,18 @@ Press an assigned switch or key to remove assignment. Set date and time - - Turn on precise location access? + + Allow system services to use your location? - - This allows apps and websites with the location permission and ChromeOS to use the location determined by your Wi-Fi or mobile networks. <a>Learn more</a> + + This allows system services with the permission to use your location. Location may use sources like Wi-Fi, mobile networks, and sensors to help estimate your device's location. <a>Learn more</a> - + + Allow + + Cancel - Built-in Keyboard @@ -5894,6 +5932,9 @@ Press & hold keyboard keys to see accent marks and special characters. This Apps + + Notifications, Google Play + Manage your apps @@ -5991,6 +6032,24 @@ Press & hold keyboard keys to see accent marks and special characters. This App details + + Device language + + + Change app language + + + Search by countries, language, or input names + + + Suggested + + + All languages + + + Update + @@ -6257,6 +6316,15 @@ Press & hold keyboard keys to see accent marks and special characters. This Allow apps, websites, and system services to use your location. Location may use sources like Wi-Fi, mobile networks, and sensors to help estimate your device’s location. <a>Learn more</a> + + Allowed + + + Only allowed for system services + + + Blocked for all + $1ChromeOS Flex hardware support and stability @@ -6266,15 +6334,30 @@ Press & hold keyboard keys to see accent marks and special characters. This Websites + + Manage site camera permissions in Brave + Manage site microphone permissions in Brave + + No website is allowed to use your camera + No website is allowed to use your microphone Apps + + No app is allowed to use your camera + + + No app is allowed to use your microphone + + + Blocked for all + Encrypt URLs entered into the browser @@ -6321,7 +6404,7 @@ Press & hold keyboard keys to see accent marks and special characters. This System preferences - + Storage, power, language diff --git a/app/password_manager_ui_strings.grdp b/app/password_manager_ui_strings.grdp index 7b6dd82b3a07..eeb01d96ed6d 100644 --- a/app/password_manager_ui_strings.grdp +++ b/app/password_manager_ui_strings.grdp @@ -83,7 +83,7 @@ Your family members can now use your username and password when they use Brave Password Manager. Tell them to go to <b>$1</b>website.com to sign in. <a href="$2" target="_blank">Learn more</a> - To stop others from using your password, change it on <a href="$1" target="_blank">$2</a>website.com + To stop others from using your password, change it on $1<a href="https://website.com/" target="_blank">website.com</a> To stop others from using your password, open the app to change your password @@ -685,4 +685,18 @@ Passkey deleted + + Password + + + + Brave Password Manager needs access to MacOS Keychain + + + To use Brave Password Manager with macOS Keychain, relaunch Brave and allow Keychain access. Your tabs will reopen after relaunching + + + Relaunch Brave + + diff --git a/app/settings_brave_strings.grdp b/app/settings_brave_strings.grdp index 51f9d4c1402c..3a69dc93f252 100644 --- a/app/settings_brave_strings.grdp +++ b/app/settings_brave_strings.grdp @@ -150,11 +150,6 @@ Open PDFs in Brave - - - When on, you'll also be signed out of Brave - - @@ -421,4 +416,18 @@ Relaunch Brave + + + + Brave will try to upgrade navigations to HTTPS + + + Brave will warn you before loading any site using an insecure connection + + + When browsing in Private mode, Brave will warn you before loading a site using an insecure connection + + + When HTTPS isn't available, Brave will use an insecure connection without warning you + diff --git a/app/settings_brave_strings_override.grdp b/app/settings_brave_strings_override.grdp index 16c89d2a5b96..62bf4913792a 100644 --- a/app/settings_brave_strings_override.grdp +++ b/app/settings_brave_strings_override.grdp @@ -26,10 +26,7 @@ - - - - + @@ -54,4 +51,7 @@ + + When browsing in Private mode, Brave will warn you before loading a site using an insecure connection + diff --git a/app/settings_strings.grdp b/app/settings_strings.grdp index ed25be78c241..b0605066ee9a 100644 --- a/app/settings_strings.grdp +++ b/app/settings_strings.grdp @@ -516,6 +516,18 @@ Nickname can’t include numbers + + Security code + + + Your security code is on the back of your card + + + Your security code is on the front of your card + + + Optional + Add payment methods @@ -534,7 +546,7 @@ More actions for $1My Doctor's IBAN - + IBAN ending in $11234 @@ -867,6 +879,9 @@ Refresh + + Reset + Details @@ -958,6 +973,9 @@ Signs you out of most sites. You'll stay signed in to your Brave sync chain so your Family Link settings for Brave apply. + + Signs you out of most sites. You'll stay signed in to your Brave sync chain. + Clears history, including in the search box @@ -1019,6 +1037,9 @@ Last 15 minutes + + Select a time range + Notifications will be disabled @@ -1400,131 +1421,16 @@ This setting works without identifying you or allowing sites to see your browsing history, though sites can share a small amount of info as part of the verification - + Privacy Sandbox - - About Privacy Sandbox - - - Details - - - Trial features are on - - - Trial features are off - Learn about and control new technologies that aim to replace third-party cookies More - - - Trials - - - With Privacy Sandbox trials, sites can deliver the same browsing experience using less of your info. That means more privacy for you and less cross-site tracking. We'll add new trials as they're ready to test. - - - About Browser-based ad personalization - - - Browser-based ad personalization - - - Your browsing history affects the ads you see - - - Ad measurement - - - Advertisers can understand how ads perform - - - Spam & fraud reduction - - - Help sites fight fraud and distinguish bots from profiles - - - About Browser-based ad personalization - - - Sites you visit that define your interests - - - What data is used: - - - How we use this data: - - - How you can manage your data: - - - To protect your privacy, we auto-delete sites from the list that are older than 4 weeks. A site you visit again might appear on the list again. Or you can remove a site if you don’t want that site to ever define interests for you. - - - Browser-based ad personalization - - - Interests you removed - - - Add an interest or site if you think ads related to the item would be useful to you. - - - A list of interests may appear here as you browse the web - - - Interests you removed - - - You haven't removed any interests - - - Sites you visit that define your interests - - - A list of sites you visit may appear here as you browse the web - - - Sites you removed - - - You haven't removed any sites - - - For example, if you visit a site to buy shoes for a marathon, the site might define your interest as running marathons. Later, if you visit a different site to register for a race, that site can show you an ad for running shoes based on your interests. - - - To protect your privacy, we auto-delete sites from the list that are older than 4 weeks. A site you visit again might appear on the list again. Or you can remove a site if you don't want that site to ever define interests for you. - - - Ad measurement - - - When you delete your browsing history — all or for a specific site — you also delete associated measurement info. See <a href="$1" target="_blank">your browsing history</a> - - - Spam and fraud reduction - - - Spam & fraud reduction relies on private state tokens to help sites fight fraud and distinguish bots from profiles. - - - When trials are on, Spam & fraud reduction relies on private state tokens to help sites fight fraud and distinguish bots from profiles. - - - Based on your interaction with a site, like regularly signing in to an account, that site can issue a private state token to your browser. Later, if other sites you visit check for and find a valid private state token, they're more likely to treat you like a profile and not a bot. - - - Private state tokens improve privacy on the web and can't be used to find out who you are. - @@ -2225,7 +2131,10 @@ Do Not Track - Enabling "Do Not Track" means that a request will be included with your browsing traffic. Any effect depends on whether a website responds to the request, and how the request is interpreted. For example, some websites may respond to this request by showing you ads that aren't based on other websites you've visited. Many websites will still collect and use your browsing data - for example to improve security, to provide content, services, ads and recommendations on their websites, and to generate reporting statistics. <a target="_blank" href="$1">Learn more</a></a> + Enabling "Do Not Track" means that a request will be included with your browsing traffic. Any effect depends on whether a website responds to the request, and how the request is interpreted. For example, some websites may respond to this request by showing you ads that aren't based on other websites you've visited. Many websites will still collect and use your browsing data - for example to improve security, to provide content, services, ads and recommendations on their websites, and to generate reporting statistics. + + + Learn more about Do Not Track Permissions and content settings @@ -2254,6 +2163,18 @@ Use HTTPS whenever possible and get warned before loading sites that don’t support it. You can’t change this setting because you have Advanced Protection enabled. + + Warn before using insecure connections + + + See warnings before going to insecure sites (recommended) + + + See warnings before going to insecure sites in Private mode + + + Don't see any warnings before going to insecure sites + Manage certificates @@ -2273,30 +2194,24 @@ Manage - Use secure DNS + Encrypt the names of sites you visit - Determines how to connect to websites over a secure connection + Use secure Domain Name System (DNS) to prevent profiles with access to your internet traffic from seeing which sites you visit - Determines how to connect to websites over a secure connection. This uses a managed service provider at $1https://dns.example.net/dns-query{?dns} + Use secure Domain Name System (DNS) to prevent profiles with access to your internet traffic from seeing which sites you visit. This uses a managed service provider at $1https://dns.example.net/dns-query{?dns} - - With your current service provider - - - Secure DNS may not be available all the time - - - With a provider of your choice + + OS default (when available) Provider options - - With + + Select DNS provider See this provider's <a target="_blank" href="$1https://google.com/">privacy policy</a> @@ -2307,8 +2222,11 @@ This setting is disabled because parental controls are on + + Add custom DNS service provider + - Enter custom provider + Enter custom DNS query URL Enter a correctly formatted URL @@ -3079,9 +2997,6 @@ Do not allow sites to create a 3D map of your surroundings or track camera position - - Cookies and other site data - A site you visit can embed content from other sites, for example, images, ads, and text. Cookies set by these other sites are called third-party cookies. @@ -3151,89 +3066,18 @@ Sites can't use your cookies to see your browsing activity across different sites, for example, to personalize ads. Features on some sites may not work - - General settings - - - Allow all cookies - - - Show details about allowing all cookies - - - Sites can use cookies to improve your browsing experience, for example, to keep you signed in or to remember items in your shopping cart - - - Sites can use cookies to see your browsing activity across different sites, for example, to personalize ads - - - Block third-party cookies in Private - - - Show details about blocking third-party cookies in Private - - - Sites can use cookies to improve your browsing experience, for example, to keep you signed in or to remember items in your shopping cart - - - 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 not work. - While in Private, sites can't use your cookies to see your browsing activity across sites, even related sites. Your browsing activity isn't used for things like personalizing ads. Features on some sites may not work. - - Block third-party cookies - - - Show details about blocking third-party cookies - - - Sites can use cookies to improve your browsing experience, for example, to keep you signed in or to remember items in your shopping cart - - - Sites can't use your cookies to see your browsing activity across different sites, for example, to personalize ads. Features on some sites may not work. - - - Block all cookies (not recommended) - - - Show details about blocking all cookies - - - Sites can't use cookies to improve your browsing experience, for example, to keep you signed in or to remember items in your shopping cart - - - Sites can't use your cookies to see your browsing activity across different sites, for example, to personalize ads - - - Features on many sites may not work - Allow related sites to see your activity in the group A company can define a group of sites that can use cookies to share your activity in the group. This is off in Private. - - Clear cookies and site data when you close all windows - - - - Signs you out of most sites. You won't be signed out of your Brave sync chain. - - See all site data and permissions - - Sites that can always use cookies - - - Always clear cookies when windows are closed - - - Sites that can never use cookies - Tracking Protection @@ -3256,7 +3100,7 @@ Most sites should work as expected - If a site isn’t working, you can try giving it temporary permission to use third-party cookies. <a target="_blank" href="$1" aria-label="$2">Learn more</a></a> + If a site isn’t working, you can try giving it temporary permission to use third-party cookies. <a target="_blank" href="$1" aria-label="$2" aria-description="$3">Learn more</a></a> Learn more about giving a site temporary permission to use third-party cookies @@ -3279,8 +3123,8 @@ Sites allowed to use third-party cookies - - Affects the sites listed here and their subdomains. For example, adding “google.com” means that third-party cookies can also be active for mail.google.com, because it’s part of google.com. + + Affects the sites listed here. Inserting “[*.]” before a domain name creates an exception for the entire domain. For example, adding “[*.]google.com” means that third-party cookies can also be active for mail.google.com, because it’s part of google.com. Tracking Protection is temporarily unavailable. While Brave is updating this feature, sites can temporarily use third-party cookies unless you block them. <a target="_blank" href="$1" aria-label="$2">Learn more</a></a> @@ -3574,7 +3418,7 @@ Delete - Remove $1google.com + Delete site data and permissions for $1google.com Reset @@ -4484,8 +4328,32 @@ , - - - Lorem Ipsum + + + Experimental AI + + + Try out experimental AI features + + + These features use AI, are in early development, and won’t always get it right. + + + Autofill helper + + + Enables autofill helper on certain input fields + + + 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. + + + 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. diff --git a/app/settings_strings_override.grdp b/app/settings_strings_override.grdp index 7afc420a7e8c..429f808ee772 100644 --- a/app/settings_strings_override.grdp +++ b/app/settings_strings_override.grdp @@ -110,18 +110,6 @@ Browsing is faster because a site is less likely to ask you to verify you're a real profile - - Help sites fight fraud and distinguish bots from profiles - - - Spam & fraud reduction relies on private state tokens to help sites fight fraud and distinguish bots from profiles. - - - When trials are on, Spam & fraud reduction relies on private state tokens to help sites fight fraud and distinguish bots from profiles. - - - Based on your interaction with a site, like regularly signing in to an account, that site can issue a private state token to your browser. Later, if other sites you visit check for and find a valid private state token, they're more likely to treat you like a profile and not a bot. - Block third-party cookies in Private @@ -147,8 +135,17 @@ Provides Brave’s strongest account security for profiles at risk of targeted attacks + + See warnings before going to insecure sites in Private mode + + + Use secure Domain Name System (DNS) to prevent profiles with access to your internet traffic from seeing which sites you visit + - + + Use secure Domain Name System (DNS) to prevent profiles with access to your internet traffic from seeing which sites you visit. This uses a managed service provider at $1https://dns.example.net/dns-query{?dns} + + @@ -168,23 +165,12 @@ While in Private, sites can't use your cookies to see your browsing activity across sites. Your browsing activity isn't used for things like personalizing ads. Features on some sites may not work. - - Block third-party cookies in Private - - - Show details about blocking third-party cookies in Private - - - 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 not work. - While in Private, sites can't use your cookies to see your browsing activity across sites, even related sites. Your browsing activity isn't used for things like personalizing ads. Features on some sites may not work. A company can define a group of sites that can use cookies to share your activity in the group. This is off in Private. - - Most sites can’t use third-party cookies to track you as you browse and sites can’t use third-party cookies in Private mode. diff --git a/app/shared_settings_strings.grdp b/app/shared_settings_strings.grdp index dcb23b9b62ad..c3e9074e5c5d 100644 --- a/app/shared_settings_strings.grdp +++ b/app/shared_settings_strings.grdp @@ -257,6 +257,9 @@ + + Signed in to $1abcd@google.com + Syncing to $1abcd@google.com diff --git a/app/theme/brave/product_logo.svg b/app/theme/brave/product_logo.svg new file mode 100644 index 000000000000..3abcd1686807 --- /dev/null +++ b/app/theme/brave/product_logo.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/app/theme/brave/product_logo_animation.svg b/app/theme/brave/product_logo_animation.svg new file mode 100644 index 000000000000..3abcd1686807 --- /dev/null +++ b/app/theme/brave/product_logo_animation.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/app/theme/default_100_percent/brave/product_logo_name_22_white.png b/app/theme/default_100_percent/brave/product_logo_name_22_white.png new file mode 100644 index 000000000000..726953b80b8f Binary files /dev/null and b/app/theme/default_100_percent/brave/product_logo_name_22_white.png differ diff --git a/app/theme/default_200_percent/brave/product_logo_name_22_white.png b/app/theme/default_200_percent/brave/product_logo_name_22_white.png new file mode 100644 index 000000000000..251c18feddfd Binary files /dev/null and b/app/theme/default_200_percent/brave/product_logo_name_22_white.png differ diff --git a/browser/brave_ads/application_state/background_helper/background_helper_linux.cc b/browser/brave_ads/application_state/background_helper/background_helper_linux.cc index 4b08e327ea29..c1ac1577cf05 100644 --- a/browser/brave_ads/application_state/background_helper/background_helper_linux.cc +++ b/browser/brave_ads/application_state/background_helper/background_helper_linux.cc @@ -24,8 +24,8 @@ #include "chrome/browser/ui/browser_window.h" #include "ui/aura/window.h" #include "ui/aura/window_tree_host.h" -#include "ui/gfx/x/x11_atom_cache.h" -#include "ui/gfx/x/xproto_util.h" +#include "ui/gfx/x/atom_cache.h" +#include "ui/gfx/x/connection.h" namespace brave_ads { @@ -40,8 +40,8 @@ BackgroundHelperLinux::~BackgroundHelperLinux() { bool BackgroundHelperLinux::IsForeground() const { x11::Window x11_window = x11::Window::None; - x11::GetProperty(ui::GetX11RootWindow(), x11::GetAtom("_NET_ACTIVE_WINDOW"), - &x11_window); + x11::Connection::Get()->GetPropertyAs( + ui::GetX11RootWindow(), x11::GetAtom("_NET_ACTIVE_WINDOW"), &x11_window); for (auto* browser : *BrowserList::GetInstance()) { auto window = diff --git a/browser/brave_profile_prefs.cc b/browser/brave_profile_prefs.cc index da309a0251d7..e6b1d21a3232 100644 --- a/browser/brave_profile_prefs.cc +++ b/browser/brave_profile_prefs.cc @@ -422,6 +422,10 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { registry->SetDefaultPrefValue(prefs::kPrivacySandboxApisEnabledV2, base::Value(false)); + // Disable ScrollToText (Copy link to text). + registry->SetDefaultPrefValue(prefs::kScrollToTextFragmentEnabled, + base::Value(false)); + // Importer: selected data types registry->RegisterBooleanPref(kImportDialogExtensions, true); registry->RegisterBooleanPref(kImportDialogPayments, true); diff --git a/browser/content_settings/brave_content_settings_registry_unittest.cc b/browser/content_settings/brave_content_settings_registry_unittest.cc index b894778a9b8d..5e66ec540816 100644 --- a/browser/content_settings/brave_content_settings_registry_unittest.cc +++ b/browser/content_settings/brave_content_settings_registry_unittest.cc @@ -42,7 +42,8 @@ TEST_F(BraveContentSettingsRegistryTest, Properties) { registry()->Get(ContentSettingsType::BRAVE_COOKIES); ASSERT_TRUE(info); - EXPECT_THAT(info->allowlisted_schemes(), ElementsAre("chrome", "devtools")); + EXPECT_THAT(info->allowlisted_primary_schemes(), + ElementsAre("chrome", "devtools")); // Check the other properties are populated correctly. EXPECT_FALSE(info->IsSettingValid(CONTENT_SETTING_SESSION_ONLY)); diff --git a/browser/download/android/BUILD.gn b/browser/download/android/BUILD.gn index b7ce20ffc51c..0502faf94e85 100644 --- a/browser/download/android/BUILD.gn +++ b/browser/download/android/BUILD.gn @@ -13,8 +13,8 @@ android_library("java") { deps = [ ":jni_headers", "//base:base_java", - "//base:jni_java", "//chrome/browser/download/android:java", + "//third_party/jni_zero:jni_zero_java", ] } diff --git a/browser/extensions/api/settings_private/brave_prefs_util.cc b/browser/extensions/api/settings_private/brave_prefs_util.cc index c1da154c39b2..82016a10c0f8 100644 --- a/browser/extensions/api/settings_private/brave_prefs_util.cc +++ b/browser/extensions/api/settings_private/brave_prefs_util.cc @@ -93,259 +93,240 @@ const PrefsUtil::TypedPrefMap& BravePrefsUtil::GetAllowlistedKeys() { // Add Brave values to the allowlist // import data (*s_brave_allowlist)[kImportDialogExtensions] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[kImportDialogPayments] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; // Default Brave shields (*s_brave_allowlist)[kShieldsAdvancedViewEnabled] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[kShieldsStatsBadgeVisible] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; - (*s_brave_allowlist)[kAdControlType] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; - (*s_brave_allowlist)[kNoScriptControlType] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; + (*s_brave_allowlist)[kAdControlType] = settings_api::PrefType::kBoolean; + (*s_brave_allowlist)[kNoScriptControlType] = settings_api::PrefType::kBoolean; (*s_brave_allowlist)[kGoogleLoginControlType] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[brave_shields::prefs::kFBEmbedControlType] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[brave_shields::prefs::kTwitterEmbedControlType] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[brave_shields::prefs::kLinkedInEmbedControlType] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[brave_shields::prefs::kReduceLanguageEnabled] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; // Rewards/Ads prefs (*s_brave_allowlist)[brave_rewards::prefs::kEnabled] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[brave_rewards::prefs::kShowLocationBarButton] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; // Search engine prefs (*s_brave_allowlist)[prefs::kAddOpenSearchEngines] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[prefs::kSyncedDefaultPrivateSearchProviderGUID] = - settings_api::PrefType::PREF_TYPE_NUMBER; + settings_api::PrefType::kNumber; // autofill prefs (*s_brave_allowlist)[kBraveAutofillPrivateWindows] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; // appearance prefs - (*s_brave_allowlist)[kShowBookmarksButton] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; - (*s_brave_allowlist)[kShowSidePanelButton] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + (*s_brave_allowlist)[kShowBookmarksButton] = settings_api::PrefType::kBoolean; + (*s_brave_allowlist)[kShowSidePanelButton] = settings_api::PrefType::kBoolean; (*s_brave_allowlist)[brave_news::prefs::kShouldShowToolbarButton] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; - (*s_brave_allowlist)[kLocationBarIsWide] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; + (*s_brave_allowlist)[kLocationBarIsWide] = settings_api::PrefType::kBoolean; (*s_brave_allowlist)[omnibox::kAutocompleteEnabled] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[omnibox::kTopSiteSuggestionsEnabled] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[omnibox::kHistorySuggestionsEnabled] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[omnibox::kBookmarkSuggestionsEnabled] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; - (*s_brave_allowlist)[kAskEnableWidvine] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; + (*s_brave_allowlist)[kAskEnableWidvine] = settings_api::PrefType::kBoolean; (*s_brave_allowlist)[kNewTabPageSuperReferralThemesOption] = - settings_api::PrefType::PREF_TYPE_NUMBER; - (*s_brave_allowlist)[kTabsSearchShow] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kNumber; + (*s_brave_allowlist)[kTabsSearchShow] = settings_api::PrefType::kBoolean; (*s_brave_allowlist)[brave_tabs::kTabHoverMode] = - settings_api::PREF_TYPE_NUMBER; + settings_api::PrefType::kNumber; (*s_brave_allowlist)[kTabMuteIndicatorNotClickable] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; #if BUILDFLAG(IS_MAC) (*s_brave_allowlist)[prefs::kShowFullscreenToolbar] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; #endif #if BUILDFLAG(ENABLE_BRAVE_VPN) (*s_brave_allowlist)[brave_vpn::prefs::kBraveVPNShowButton] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; #if BUILDFLAG(ENABLE_BRAVE_VPN_WIREGUARD) (*s_brave_allowlist)[brave_vpn::prefs::kBraveVPNWireguardEnabled] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; #endif #endif #if defined(TOOLKIT_VIEWS) (*s_brave_allowlist)[sidebar::kSidebarShowOption] = - settings_api::PrefType::PREF_TYPE_NUMBER; + settings_api::PrefType::kNumber; #endif #if BUILDFLAG(ENABLE_SPEEDREADER) (*s_brave_allowlist)[speedreader::kSpeedreaderPrefEnabled] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; #endif // De-AMP feature (*s_brave_allowlist)[de_amp::kDeAmpPrefEnabled] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; // Debounce feature (*s_brave_allowlist)[debounce::prefs::kDebounceEnabled] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; // new tab prefs (*s_brave_allowlist)[kNewTabPageShowSponsoredImagesBackgroundImage] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[kNewTabPageShowBackgroundImage] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; - (*s_brave_allowlist)[kNewTabPageShowClock] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; - (*s_brave_allowlist)[kNewTabPageShowStats] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; + (*s_brave_allowlist)[kNewTabPageShowClock] = settings_api::PrefType::kBoolean; + (*s_brave_allowlist)[kNewTabPageShowStats] = settings_api::PrefType::kBoolean; (*s_brave_allowlist)[kNewTabPageShowRewards] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[kNewTabPageShowBraveTalk] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[kNewTabPageShowsOptions] = - settings_api::PrefType::PREF_TYPE_NUMBER; + settings_api::PrefType::kNumber; #if BUILDFLAG(ENABLE_EXTENSIONS) // Web discovery prefs - (*s_brave_allowlist)[kWebDiscoveryEnabled] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + (*s_brave_allowlist)[kWebDiscoveryEnabled] = settings_api::PrefType::kBoolean; #endif // Clear browsing data on exit prefs. (*s_brave_allowlist)[browsing_data::prefs::kDeleteBrowsingHistoryOnExit] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[browsing_data::prefs::kDeleteDownloadHistoryOnExit] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[browsing_data::prefs::kDeleteCacheOnExit] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[browsing_data::prefs::kDeleteCookiesOnExit] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[browsing_data::prefs::kDeletePasswordsOnExit] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[browsing_data::prefs::kDeleteFormDataOnExit] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[browsing_data::prefs::kDeleteSiteSettingsOnExit] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[browsing_data::prefs::kDeleteHostedAppsDataOnExit] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[browsing_data::prefs::kDeleteBraveLeoHistory] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[browsing_data::prefs::kDeleteBraveLeoHistoryOnExit] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[kAlwaysShowBookmarkBarOnNTP] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; - (*s_brave_allowlist)[kMRUCyclingEnabled] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; + (*s_brave_allowlist)[kMRUCyclingEnabled] = settings_api::PrefType::kBoolean; // WebTorrent pref - (*s_brave_allowlist)[kWebTorrentEnabled] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + (*s_brave_allowlist)[kWebTorrentEnabled] = settings_api::PrefType::kBoolean; #if BUILDFLAG(ENABLE_BRAVE_WAYBACK_MACHINE) (*s_brave_allowlist)[kBraveWaybackMachineEnabled] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; #endif (*s_brave_allowlist)[kEnableWindowClosingConfirm] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[kEnableClosingLastTab] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; // Hangouts pref - (*s_brave_allowlist)[kHangoutsEnabled] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + (*s_brave_allowlist)[kHangoutsEnabled] = settings_api::PrefType::kBoolean; // IPFS Companion pref (*s_brave_allowlist)[kIPFSCompanionEnabled] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; // Brave Wallet pref (*s_brave_allowlist)[kBraveWalletSelectedNetworks] = - settings_api::PrefType::PREF_TYPE_DICTIONARY; + settings_api::PrefType::kDictionary; (*s_brave_allowlist)[kDefaultEthereumWallet] = - settings_api::PrefType::PREF_TYPE_NUMBER; - (*s_brave_allowlist)[kDefaultSolanaWallet] = - settings_api::PrefType::PREF_TYPE_NUMBER; - (*s_brave_allowlist)[kDefaultBaseCurrency] = - settings_api::PrefType::PREF_TYPE_STRING; + settings_api::PrefType::kNumber; + (*s_brave_allowlist)[kDefaultSolanaWallet] = settings_api::PrefType::kNumber; + (*s_brave_allowlist)[kDefaultBaseCurrency] = settings_api::PrefType::kString; (*s_brave_allowlist)[kDefaultBaseCryptocurrency] = - settings_api::PrefType::PREF_TYPE_STRING; + settings_api::PrefType::kString; (*s_brave_allowlist)[kShowWalletIconOnToolbar] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[kBraveWalletAutoLockMinutes] = - settings_api::PrefType::PREF_TYPE_NUMBER; + settings_api::PrefType::kNumber; (*s_brave_allowlist)[kBraveWalletNftDiscoveryEnabled] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; // IPFS pref #if BUILDFLAG(ENABLE_IPFS) - (*s_brave_allowlist)[kIPFSResolveMethod] = - settings_api::PrefType::PREF_TYPE_NUMBER; + (*s_brave_allowlist)[kIPFSResolveMethod] = settings_api::PrefType::kNumber; (*s_brave_allowlist)[kIPFSAutoFallbackToGateway] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[kIPFSPublicGatewayAddress] = - settings_api::PrefType::PREF_TYPE_STRING; + settings_api::PrefType::kString; (*s_brave_allowlist)[kIPFSPublicNFTGatewayAddress] = - settings_api::PrefType::PREF_TYPE_STRING; + settings_api::PrefType::kString; (*s_brave_allowlist)[kIPFSAutoRedirectToConfiguredGateway] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; - (*s_brave_allowlist)[kIPFSAlwaysStartMode] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; - (*s_brave_allowlist)[kIpfsStorageMax] = - settings_api::PrefType::PREF_TYPE_NUMBER; + settings_api::PrefType::kBoolean; + (*s_brave_allowlist)[kIPFSAlwaysStartMode] = settings_api::PrefType::kBoolean; + (*s_brave_allowlist)[kIpfsStorageMax] = settings_api::PrefType::kNumber; #endif // Leo Assistant pref #if BUILDFLAG(ENABLE_AI_CHAT) (*s_brave_allowlist)[ai_chat::prefs::kBraveChatAutocompleteProviderEnabled] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[ai_chat::prefs::kDefaultModelKey] = - settings_api::PrefType::PREF_TYPE_STRING; + settings_api::PrefType::kString; #endif #if !BUILDFLAG(USE_GCM_FROM_PLATFORM) // Push Messaging Pref (*s_brave_allowlist)[kBraveGCMChannelStatus] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; #endif // Omnibox pref (*s_brave_allowlist)[omnibox::kPreventUrlElisionsInOmnibox] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; #if BUILDFLAG(ENABLE_TOR) (*s_brave_allowlist)[tor::prefs::kAutoOnionRedirect] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[tor::prefs::kOnionOnlyInTorWindows] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[tor::prefs::kBridgesConfig] = - settings_api::PrefType::PREF_TYPE_DICTIONARY; + settings_api::PrefType::kDictionary; #endif (*s_brave_allowlist)[prefs::kWebRTCIPHandlingPolicy] = - settings_api::PrefType::PREF_TYPE_STRING; + settings_api::PrefType::kString; // Request OTR feature (*s_brave_allowlist)[request_otr::kRequestOTRActionOption] = - settings_api::PrefType::PREF_TYPE_NUMBER; + settings_api::PrefType::kNumber; (*s_brave_allowlist)[decentralized_dns::kUnstoppableDomainsResolveMethod] = - settings_api::PrefType::PREF_TYPE_NUMBER; + settings_api::PrefType::kNumber; (*s_brave_allowlist)[decentralized_dns::kENSResolveMethod] = - settings_api::PrefType::PREF_TYPE_NUMBER; + settings_api::PrefType::kNumber; (*s_brave_allowlist)[decentralized_dns::kEnsOffchainResolveMethod] = - settings_api::PrefType::PREF_TYPE_NUMBER; + settings_api::PrefType::kNumber; (*s_brave_allowlist)[decentralized_dns::kSnsResolveMethod] = - settings_api::PrefType::PREF_TYPE_NUMBER; + settings_api::PrefType::kNumber; // Media router pref (*s_brave_allowlist)[kEnableMediaRouterOnRestart] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; // NFT pinning pref - (*s_brave_allowlist)[kAutoPinEnabled] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + (*s_brave_allowlist)[kAutoPinEnabled] = settings_api::PrefType::kBoolean; #if defined(TOOLKIT_VIEWS) // Vertical tab strip prefs (*s_brave_allowlist)[brave_tabs::kVerticalTabsEnabled] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[brave_tabs::kVerticalTabsFloatingEnabled] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[brave_tabs::kVerticalTabsShowTitleOnWindow] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; #endif #if BUILDFLAG(ENABLE_PLAYLIST) (*s_brave_allowlist)[playlist::kPlaylistEnabledPref] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; (*s_brave_allowlist)[playlist::kPlaylistCacheByDefault] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; + settings_api::PrefType::kBoolean; #endif return *s_brave_allowlist; diff --git a/browser/farbling/brave_dark_mode_fingerprint_protection_browsertest.cc b/browser/farbling/brave_dark_mode_fingerprint_protection_browsertest.cc index 153e82a965a6..8bca8eab7c0d 100644 --- a/browser/farbling/brave_dark_mode_fingerprint_protection_browsertest.cc +++ b/browser/farbling/brave_dark_mode_fingerprint_protection_browsertest.cc @@ -74,6 +74,18 @@ class BraveDarkModeFingerprintProtectionTest : public InProcessBrowserTest { } ui::ColorProviderKey GetColorProviderKey() const override { return key_; } + const ui::RendererColorMap GetRendererColorMap( + ui::ColorProviderKey::ColorMode color_mode, + ui::ColorProviderKey::ForcedColors forced_colors) const override { + auto key = GetColorProviderKey(); + key.color_mode = color_mode; + key.forced_colors = forced_colors; + ui::ColorProvider* color_provider = + ui::ColorProviderManager::Get().GetColorProviderFor(key); + CHECK(color_provider); + return ui::CreateRendererColorMap(*color_provider); + } + private: ui::ColorProvider provider_; ui::ColorProviderKey key_; diff --git a/browser/flags/android/java/src/org/chromium/chrome/browser/flags/BraveCachedFlag.java b/browser/flags/android/java/src/org/chromium/chrome/browser/flags/BraveCachedFlag.java index ef11b82e82aa..a03edca5748f 100644 --- a/browser/flags/android/java/src/org/chromium/chrome/browser/flags/BraveCachedFlag.java +++ b/browser/flags/android/java/src/org/chromium/chrome/browser/flags/BraveCachedFlag.java @@ -29,12 +29,6 @@ public BraveCachedFlag(String featureName, boolean defaultValue) { maybeOverrideDefaultValue(featureName, defaultValue); } - public BraveCachedFlag(String featureName, String sharedPreferenceKey, boolean defaultValue) { - super(featureName, sharedPreferenceKey, defaultValue); - - maybeOverrideDefaultValue(featureName, defaultValue); - } - private void maybeOverrideDefaultValue(String featureName, boolean defaultValue) { // Override value if necessary. if (sFlags.containsKey(featureName)) { diff --git a/browser/incognito/android/java/res/layout/incognito_reauth_view.xml b/browser/incognito/android/java/res/layout/incognito_reauth_view.xml index 40b4563b0bc2..4a362c2b6616 100644 --- a/browser/incognito/android/java/res/layout/incognito_reauth_view.xml +++ b/browser/incognito/android/java/res/layout/incognito_reauth_view.xml @@ -15,7 +15,7 @@ You can obtain one at https://mozilla.org/MPL/2.0/. android:layout_height="match_parent" android:background="@color/brave_private_tabs_bg_color"> - (source).ptr(); - content::NavigationEntry* entry = controller->GetLastCommittedEntry(); - if (!entry || entry->GetURL().spec().find(url_part_) == std::string::npos) { - return; - } - - WindowedNotificationObserver::Observe(type, source, details); - } - - private: - std::string url_part_; -}; - IN_PROC_BROWSER_TEST_F(IpfsTabHelperBrowserTest, ResolvedIPFSLinkLocal) { ASSERT_TRUE( ipfs::IPFSTabHelper::MaybeCreateForWebContents(active_contents())); @@ -920,9 +893,15 @@ IN_PROC_BROWSER_TEST_F(IpfsTabHelperBrowserTest, IPFSFallbackInfobar) { const GURL test_url = embedded_test_server()->GetURL( "drweb.link", "/ipns/k2k4r8ni09jro03sto91pyi070ww4x63iwub4x3sc13qn5pwkjxhfdt4"); + const GURL test_non_ipfs_url = embedded_test_server()->GetURL("navigate_to.com", "/"); + GURL::Replacements replace_with_gateway_url; + replace_with_gateway_url.SetHostStr(gateway_url.host_piece()); + const GURL expected_gateway_url = + test_url.ReplaceComponents(replace_with_gateway_url); + auto find_infobar = [](infobars::ContentInfoBarManager* content_infobar_manager) -> infobars::InfoBar* { @@ -952,10 +931,9 @@ IN_PROC_BROWSER_TEST_F(IpfsTabHelperBrowserTest, IPFSFallbackInfobar) { SetHttpStatusCode(net::HTTP_INTERNAL_SERVER_ERROR); { - UrlPartLoadObserver observer(gateway_url.host(), - content::NotificationService::AllSources()); + ui_test_utils::UrlLoadObserver url_observer(expected_gateway_url); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), test_url)); - observer.Wait(); + url_observer.Wait(); // Get last shown infobar auto* infobar = find_infobar( infobars::ContentInfoBarManager::FromWebContents(active_contents())); @@ -968,10 +946,9 @@ IN_PROC_BROWSER_TEST_F(IpfsTabHelperBrowserTest, IPFSFallbackInfobar) { } { - UrlPartLoadObserver observer(gateway_url.host(), - content::NotificationService::AllSources()); + ui_test_utils::UrlLoadObserver url_observer(expected_gateway_url); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), test_url)); - observer.Wait(); + url_observer.Wait(); WaitForLoadStopWithoutSuccessCheck(active_contents()); auto ipfs_address = active_contents()->GetVisibleURL(); // Get last shown infobar @@ -986,10 +963,9 @@ IN_PROC_BROWSER_TEST_F(IpfsTabHelperBrowserTest, IPFSFallbackInfobar) { } { - UrlPartLoadObserver observer(test_non_ipfs_url.host(), - content::NotificationService::AllSources()); + ui_test_utils::UrlLoadObserver url_observer(test_non_ipfs_url); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), test_non_ipfs_url)); - observer.Wait(); + url_observer.Wait(); // Get last shown infobar auto* infobar = find_infobar( infobars::ContentInfoBarManager::FromWebContents(active_contents())); @@ -1001,10 +977,9 @@ IN_PROC_BROWSER_TEST_F(IpfsTabHelperBrowserTest, IPFSFallbackInfobar) { // Enable the IPFS companion prefs->SetBoolean(kIPFSCompanionEnabled, true); { - UrlPartLoadObserver observer(gateway_url.host(), - content::NotificationService::AllSources()); + ui_test_utils::UrlLoadObserver url_observer(expected_gateway_url); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), test_url)); - observer.Wait(); + url_observer.Wait(); // Get last shown infobar auto* infobar = find_infobar( infobars::ContentInfoBarManager::FromWebContents(active_contents())); diff --git a/browser/misc_metrics/extension_metrics_service.cc b/browser/misc_metrics/extension_metrics_service.cc index 9e8818db56d0..ace3caff6067 100644 --- a/browser/misc_metrics/extension_metrics_service.cc +++ b/browser/misc_metrics/extension_metrics_service.cc @@ -14,16 +14,18 @@ namespace misc_metrics { namespace { constexpr auto kPopularAdBlockExtensions = - base::MakeFixedFlatSetSorted({ - // AdGuard - "bgnkhhnnamicmpeenaelnjfhikgbkllg", - // uBO - "cjpalhdlnbpafiamejdnhcphjbkeiagm", - // Ghostery - "mlomiejdfkolichcflejclcbmpeaniij", - // AdBlocker Ultimate - "ohahllgiabjaoigichmmfljhkcfikeof", - }); + base::MakeFixedFlatSet( + base::sorted_unique, + { + // AdGuard + "bgnkhhnnamicmpeenaelnjfhikgbkllg", + // uBO + "cjpalhdlnbpafiamejdnhcphjbkeiagm", + // Ghostery + "mlomiejdfkolichcflejclcbmpeaniij", + // AdBlocker Ultimate + "ohahllgiabjaoigichmmfljhkcfikeof", + }); constexpr base::TimeDelta kReportDebounceTime = base::Seconds(10); } // namespace diff --git a/browser/net/brave_reduce_language_network_delegate_helper.cc b/browser/net/brave_reduce_language_network_delegate_helper.cc index 093f2d7b5543..fa01c1f5aee4 100644 --- a/browser/net/brave_reduce_language_network_delegate_helper.cc +++ b/browser/net/brave_reduce_language_network_delegate_helper.cc @@ -33,15 +33,17 @@ constexpr char kAcceptLanguageMax[] = "en-US,en;q=0.9"; const std::array kFakeQValues = {";q=0.5", ";q=0.6", ";q=0.7", ";q=0.8", ";q=0.9"}; static constexpr auto kFarbleAcceptLanguageExceptions = - base::MakeFixedFlatSetSorted({ - // https://github.com/brave/brave-browser/issues/26325 - "aeroplan.rewardops.com", - // https://github.com/brave/brave-browser/issues/31196 - "login.live.com", - // https://github.com/brave/brave-browser/issues/25309 - "ulta.com", - "www.ulta.com", - }); + base::MakeFixedFlatSet( + base::sorted_unique, + { + // https://github.com/brave/brave-browser/issues/26325 + "aeroplan.rewardops.com", + // https://github.com/brave/brave-browser/issues/31196 + "login.live.com", + // https://github.com/brave/brave-browser/issues/25309 + "ulta.com", + "www.ulta.com", + }); } // namespace std::string FarbleAcceptLanguageHeader( diff --git a/browser/resources/settings/brave_overrides/cookies_page.ts b/browser/resources/settings/brave_overrides/cookies_page.ts index 7ed7832a4f70..72ea5ca0d1b2 100644 --- a/browser/resources/settings/brave_overrides/cookies_page.ts +++ b/browser/resources/settings/brave_overrides/cookies_page.ts @@ -7,26 +7,17 @@ import {RegisterPolymerTemplateModifications} from 'chrome://resources/brave/pol RegisterPolymerTemplateModifications({ 'settings-cookies-page': (templateContent) => { - const privacySandboxSettings4Template = templateContent. + const is3pcdRedesignEnabledTemplate = templateContent. querySelector( - 'template[if*="isPrivacySandboxSettings3CookieSettingsEnabled_"]' + 'template[if*="!is3pcdRedesignEnabled_"]' ) - if (!privacySandboxSettings4Template) { + if (!is3pcdRedesignEnabledTemplate) { console.error( '[Brave Settings Overrides] Could not find template with ' + - 'if*=isPrivacySandboxSettings3CookieSettingsEnabled_ on cookies page.') + 'if*=!is3pcdRedesignEnabledTemplate on cookies page.') } else { - const clearOnExitToggle = - privacySandboxSettings4Template.content.getElementById('clearOnExit') - if (!clearOnExitToggle) { - console.error( - '[Brave Settings Overrides] Could not find clearOnExit id ' + - 'on cookies page.') - } else { - clearOnExitToggle.setAttribute('sub-label', '') - } const blockThirdPartyIncognitoRadioButton = - privacySandboxSettings4Template.content. + is3pcdRedesignEnabledTemplate.content. getElementById('blockThirdPartyIncognito') if (!blockThirdPartyIncognitoRadioButton) { console.error( diff --git a/browser/resources/settings/brave_overrides/security_page.ts b/browser/resources/settings/brave_overrides/security_page.ts index 17eb9e275f2a..a264e612f573 100644 --- a/browser/resources/settings/brave_overrides/security_page.ts +++ b/browser/resources/settings/brave_overrides/security_page.ts @@ -27,13 +27,23 @@ RegisterPolymerTemplateModifications({ passwordsLeakToggle.setAttribute('hidden', 'true') } if (loadTimeData.getBoolean("isHttpsByDefaultEnabled")) { - const httpsOnlyModeToggle = templateContent. - getElementById('httpsOnlyModeToggle') - if (!httpsOnlyModeToggle) { - console.error('[Brave Settings Overrides] Could not find' + - 'httpsOnlyModeToggle on security page.') + const enableHttpsFirstModeNewSettings = templateContent. + querySelector( + 'template[is=dom-if][if="[[!enableHttpsFirstModeNewSettings_]]"]' + ) + if (!enableHttpsFirstModeNewSettings) { + console.error( + '[Brave Settings Overrides] Could not find template with ' + + 'if=[[!enableHttpsFirstModeNewSettings on security page.]]') } else { - httpsOnlyModeToggle.setAttribute('hidden', 'true') + const httpsOnlyModeToggle = enableHttpsFirstModeNewSettings.content. + getElementById('httpsOnlyModeToggle') + if (!httpsOnlyModeToggle) { + console.error('[Brave Settings Overrides] Could not find' + + 'httpsOnlyModeToggle on security page.') + } else { + httpsOnlyModeToggle.setAttribute('hidden', 'true') + } } } const link = templateContent.getElementById('advanced-protection-program-link') diff --git a/browser/ui/BUILD.gn b/browser/ui/BUILD.gn index fc64b4e195c0..50d2b04c49ef 100644 --- a/browser/ui/BUILD.gn +++ b/browser/ui/BUILD.gn @@ -252,6 +252,8 @@ source_set("ui") { "webui/settings/brave_tor_handler.cc", "webui/settings/brave_tor_handler.h", ] + + deps += [ "//chrome/browser/image_fetcher" ] } if (enable_extensions) { sources += [ 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 ece4c99f9f85..495de246691e 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 @@ -14,7 +14,6 @@ import org.chromium.base.supplier.Supplier; import org.chromium.chrome.browser.merchant_viewer.MerchantTrustSignalsCoordinator; import org.chromium.chrome.browser.omnibox.LocationBarDataProvider; -import org.chromium.chrome.browser.omnibox.SearchEngineLogoUtils; import org.chromium.chrome.browser.omnibox.UrlBarEditingTextStateProvider; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.components.permissions.PermissionDialogController; @@ -26,20 +25,33 @@ public class BraveStatusMediator extends StatusMediator { // To delete in bytecode, members from parent class will be used instead. private boolean mUrlHasFocus; - public BraveStatusMediator(PropertyModel model, Resources resources, Context context, - UrlBarEditingTextStateProvider urlBarEditingTextStateProvider, boolean isTablet, + public BraveStatusMediator( + PropertyModel model, + Resources resources, + Context context, + UrlBarEditingTextStateProvider urlBarEditingTextStateProvider, + boolean isTablet, LocationBarDataProvider locationBarDataProvider, PermissionDialogController permissionDialogController, - SearchEngineLogoUtils searchEngineLogoUtils, OneshotSupplier templateUrlServiceSupplier, - Supplier profileSupplier, PageInfoIPHController pageInfoIPHController, + Supplier profileSupplier, + PageInfoIPHController pageInfoIPHController, WindowAndroid windowAndroid, - @Nullable Supplier - merchantTrustSignalsCoordinatorSupplier) { - super(model, resources, context, urlBarEditingTextStateProvider, isTablet, - locationBarDataProvider, permissionDialogController, searchEngineLogoUtils, - templateUrlServiceSupplier, profileSupplier, pageInfoIPHController, windowAndroid, - + @Nullable + Supplier + merchantTrustSignalsCoordinatorSupplier) { + super( + model, + resources, + context, + urlBarEditingTextStateProvider, + isTablet, + locationBarDataProvider, + permissionDialogController, + templateUrlServiceSupplier, + profileSupplier, + pageInfoIPHController, + windowAndroid, merchantTrustSignalsCoordinatorSupplier); } diff --git a/browser/ui/android/strings/android_brave_strings.grd b/browser/ui/android/strings/android_brave_strings.grd index 86bfd9809d67..377592ba92d9 100644 --- a/browser/ui/android/strings/android_brave_strings.grd +++ b/browser/ui/android/strings/android_brave_strings.grd @@ -2672,9 +2672,6 @@ If you don't accept this request, VPN will not reconnect and your internet conne Choose a file - - Block third-party cookies in Private - Private Key diff --git a/browser/ui/android/strings/android_chrome_strings.grd b/browser/ui/android/strings/android_chrome_strings.grd index b61218994d02..f6d992a464d7 100644 --- a/browser/ui/android/strings/android_chrome_strings.grd +++ b/browser/ui/android/strings/android_chrome_strings.grd @@ -437,35 +437,6 @@ CHAR_LIMIT guidelines: Automatically sends usage statistics and crash reports to Brave - - - Usage data - - - Manage usage data sharing - - - Choose what you’re comfortable to share with Brave. The metrics you share will be used to help improve Brave’s features, performance, and stability. - - - Extended usage data - - - Basic data plus information about the websites you visit and apps you use - - - Basic usage data - - - How you interact with Brave, settings you’ve selected, details of Brave crashes - - - No usage data - - - No statistics or crash reports are sent to Brave - - Search engine @@ -594,6 +565,15 @@ CHAR_LIMIT guidelines: Autofill Options + + Delete saved security codes? + + + All security codes saved on your device and in your Brave sync chain will be deleted + + + Delete + @@ -959,24 +939,6 @@ For example, some websites may respond to this request by showing you ads that a Manage info used by sites to measure ad performance - - <b>What data is used:</b> Your browsing history, a record of sites you’ve visited using Brave on this device. - - - <b>How we use this data:</b> Brave can estimate your interests. Later, a site you visit can ask Brave to see your interests in order to personalize the ads you see. - - - <b>How you can manage your data:</b> To protect your privacy, we auto-delete your interests that are older than 4 weeks. As you keep browsing, an interest might appear on the list again. Or you can remove interests you don’t want Brave to consider. - - - <b>What data is used:</b> Your browsing history, a record of sites you’ve visited using Brave on this device. - - - <b>How we use this data:</b> Sites can store information with Brave about your interests. For example, if you visit a site to buy shoes for a marathon, the site might define your interest as running marathons. Later, if you visit a different site to register for a race, that site can show you an ad for running shoes based on your interests. - - - <b>How you can manage your data:</b> To protect your privacy, we auto-delete sites from the list that are older than 4 weeks. A site you visit again might appear on the list again. Or you can remove a site if you don’t want that site to ever define interests for you. - Add %1$sActing and Theater @@ -984,65 +946,6 @@ For example, some websites may respond to this request by showing you ads that a Remove %1$sActing and Theater - - - No thanks - - - Yes, I’m in - - - Got it - - - Settings - - - Help us build a more private web - - - Brave is exploring new features that allow sites to deliver the same browsing experience using less of your info - - - Limited sharing between sites - - - We’re exploring ways to restrict tracking while enabling sites to stop ad spam and fraud. - - - More control over the ads you see - - - You can see and remove topics of interest sites use to show you ads. Brave estimates your interests based on your recent browsing history. - - - Learn more about ad personalization in Brave - - - Your interests as estimated by Brave - - - Sites you visit that define your interests - - - You can change your mind at any time in Brave settings. The trials run alongside the current way ads get served, so you won’t see changes right away. - - - You can learn more about these features in Brave settings. - - - Privacy Sandbox prompt opened at half height - - - Privacy Sandbox prompt opened at full height - - - Privacy Sandbox prompt closed - - - Help us build a better web - - With ad measurement, limited types of data can be shared among sites and apps to measure the performance of their ads, such as the time of day an ad was shown to you. @@ -1555,7 +1458,7 @@ Your Brave account may have other forms of browsing history like searches and ac - Tracking protection + Tracking Protection Manage third-party cookies and tracking protections @@ -2879,27 +2782,27 @@ To change this setting, <resetlink>reset sync

Other - - {FILE_COUNT, plural, =1 {# File} other {# Files}} + + {FILE_COUNT, plural, =1 {All files, 1 file in list} other {All files, # files in list}} + + + {FILE_COUNT, plural, =1 {Other 1 file in list} other {Other # files in list}} - {FILE_COUNT, plural, =1 {# Image} other {# Images}} + {FILE_COUNT, plural, =1 {Images, 1 image in list} other {Images, # images in list}} - {FILE_COUNT, plural, =1 {# Video} other {# Videos}} + {FILE_COUNT, plural, =1 {Videos, 1 video in list} other {Videos, # videos in list}} - {FILE_COUNT, plural, =1 {# Audio file} other {# Audio files}} + {FILE_COUNT, plural, =1 {Audio files, 1 audio file in list} other {Audio files, # audio files in list}} - {FILE_COUNT, plural, =1 {# Page} other {# Pages}} + {FILE_COUNT, plural, =1 {Pages, 1 page in list} other {Pages, # pages in list}} Download this page - - Files that you download appear here - You’ll find your downloads here @@ -3073,21 +2976,9 @@ To change this setting, <resetlink>reset sync

Info is sent to Brave about your Brave usage, but it isn\u2019t tied to you\n\nIf Brave crashes, details about the crash may include some personal info\n\nIf you turn on sync, metrics may also include info about URLs you visit - - Sign in to get the most out of Brave - - - Sign in for additional features - - + Sign in to browse easier across devices - - Sign in to get the most out of Brave - - - Sign in to make Brave your own - Signing in\u2026 @@ -3186,6 +3077,9 @@ To change this setting, <resetlink>reset sync

Yes, I'm in + + No thanks + Choose an account @@ -3781,9 +3675,6 @@ To change this setting, <resetlink>reset sync

Bookmarks - - Pages that you bookmark appear here - No bookmarks @@ -4044,9 +3935,6 @@ To change this setting, <resetlink>reset sync

Find your reading list in Bookmarks - - You’ll find your reading list here - @@ -4277,6 +4165,12 @@ To change this setting, <resetlink>reset sync

Navigate: %1$sCrater Lake National Park (U.S. National Park Service): %2$shttps://www.nps.gov/crla + + Most visited sites + + + Query tiles + {NUM_SELECTED, plural, @@ -4464,7 +4358,7 @@ To change this setting, <resetlink>reset sync

- Your activity is saved in your <link>Brave sync chain</link>. + Your activity in Page Insights is saved in your <link>Brave sync chain</link>. Logo of privacy notice for page insights hub which redirects to my activity page. @@ -4627,9 +4521,6 @@ To change this setting, <resetlink>reset sync

Tap to copy the URL for this app - - To use %1$sPWA List for the first time, please connect to the internet. - General @@ -5982,6 +5873,10 @@ To change this setting, <resetlink>reset sync

Lorem Ipsum + + + Here are the voices you can pick for reading out your web pages. If you like this voice and want me to keep using it just tap the voice name. + diff --git a/browser/ui/android/toolbar/java/res/layout/tab_switcher_toolbar.xml b/browser/ui/android/toolbar/java/res/layout/tab_switcher_toolbar.xml index f6e4da2a9292..8035a8c2b21b 100644 --- a/browser/ui/android/toolbar/java/res/layout/tab_switcher_toolbar.xml +++ b/browser/ui/android/toolbar/java/res/layout/tab_switcher_toolbar.xml @@ -71,27 +71,13 @@ android:layout_gravity="center" android:layout_marginBottom="4dp"/> - - - - + diff --git a/browser/ui/bookmark/BUILD.gn b/browser/ui/bookmark/BUILD.gn index 2530365a92aa..416500d36729 100644 --- a/browser/ui/bookmark/BUILD.gn +++ b/browser/ui/bookmark/BUILD.gn @@ -18,6 +18,8 @@ source_set("bookmark") { "brave_bookmark_tab_helper.h", ] + public_deps = [ "//base" ] + deps = [ "//base", "//brave/common", diff --git a/browser/ui/toolbar/brave_app_menu_model_browsertest.cc b/browser/ui/toolbar/brave_app_menu_model_browsertest.cc index d0d761e2297f..9879b9e86ee2 100644 --- a/browser/ui/toolbar/brave_app_menu_model_browsertest.cc +++ b/browser/ui/toolbar/brave_app_menu_model_browsertest.cc @@ -208,27 +208,27 @@ IN_PROC_BROWSER_TEST_F(BraveAppMenuModelBrowserTest, CommandsExecutionTest) { // Instead, BraveBrowserCommandControllerTest will do that. IN_PROC_BROWSER_TEST_F(BraveAppMenuModelBrowserTest, MenuOrderTest) { std::vector commands_in_order_for_normal_profile = { - IDC_NEW_TAB, - IDC_NEW_WINDOW, - IDC_NEW_INCOGNITO_WINDOW, + IDC_NEW_TAB, + IDC_NEW_WINDOW, + IDC_NEW_INCOGNITO_WINDOW, #if BUILDFLAG(ENABLE_TOR) - IDC_NEW_OFFTHERECORD_WINDOW_TOR, + IDC_NEW_OFFTHERECORD_WINDOW_TOR, #endif - IDC_SHOW_BRAVE_WALLET, + IDC_SHOW_BRAVE_WALLET, #if BUILDFLAG(ENABLE_BRAVE_VPN) - IDC_SHOW_BRAVE_VPN_PANEL, + IDC_SHOW_BRAVE_VPN_PANEL, #endif - IDC_RECENT_TABS_MENU, - IDC_BOOKMARKS_MENU, - IDC_SHOW_DOWNLOADS, - IDC_EXTENSIONS_SUBMENU_MANAGE_EXTENSIONS, - IDC_ZOOM_MENU, - IDC_PRINT, - IDC_FIND, - IDC_MORE_TOOLS_MENU, - IDC_EDIT_MENU, - IDC_HELP_MENU, - IDC_OPTIONS, + IDC_RECENT_TABS_MENU, + IDC_BOOKMARKS_MENU, + IDC_SHOW_DOWNLOADS, + IDC_EXTENSIONS_SUBMENU_MANAGE_EXTENSIONS, + IDC_ZOOM_MENU, + IDC_PRINT, + IDC_FIND, + IDC_MORE_TOOLS_MENU, + IDC_EDIT_MENU, + IDC_HELP_MENU, + IDC_OPTIONS, }; std::vector commands_disabled_for_normal_profile = { @@ -266,23 +266,23 @@ IN_PROC_BROWSER_TEST_F(BraveAppMenuModelBrowserTest, MenuOrderTest) { auto* private_browser = CreateIncognitoBrowser(); std::vector commands_in_order_for_private_profile = { - IDC_NEW_TAB, - IDC_NEW_WINDOW, - IDC_NEW_INCOGNITO_WINDOW, + IDC_NEW_TAB, + IDC_NEW_WINDOW, + IDC_NEW_INCOGNITO_WINDOW, #if BUILDFLAG(ENABLE_TOR) - IDC_NEW_OFFTHERECORD_WINDOW_TOR, + IDC_NEW_OFFTHERECORD_WINDOW_TOR, #endif - IDC_SHOW_BRAVE_WALLET, - IDC_BOOKMARKS_MENU, - IDC_SHOW_DOWNLOADS, - IDC_EXTENSIONS_SUBMENU_MANAGE_EXTENSIONS, - IDC_ZOOM_MENU, - IDC_PRINT, - IDC_FIND, - IDC_MORE_TOOLS_MENU, - IDC_EDIT_MENU, - IDC_HELP_MENU, - IDC_OPTIONS, + IDC_SHOW_BRAVE_WALLET, + IDC_BOOKMARKS_MENU, + IDC_SHOW_DOWNLOADS, + IDC_EXTENSIONS_SUBMENU_MANAGE_EXTENSIONS, + IDC_ZOOM_MENU, + IDC_PRINT, + IDC_FIND, + IDC_MORE_TOOLS_MENU, + IDC_EDIT_MENU, + IDC_HELP_MENU, + IDC_OPTIONS, }; std::vector commands_disabled_for_private_profile = { @@ -318,17 +318,17 @@ IN_PROC_BROWSER_TEST_F(BraveAppMenuModelBrowserTest, MenuOrderTest) { CheckCommandsAreInOrderInMenuModel(guest_browser, commands_in_order_for_guest_profile); std::vector commands_disabled_for_guest_profile = { - IDC_NEW_INCOGNITO_WINDOW, + IDC_NEW_INCOGNITO_WINDOW, #if BUILDFLAG(ENABLE_TOR) - IDC_NEW_OFFTHERECORD_WINDOW_TOR, + IDC_NEW_OFFTHERECORD_WINDOW_TOR, #endif - IDC_SHOW_BRAVE_WALLET, + IDC_SHOW_BRAVE_WALLET, #if BUILDFLAG(ENABLE_BRAVE_VPN) - IDC_SHOW_BRAVE_VPN_PANEL, + IDC_SHOW_BRAVE_VPN_PANEL, #endif - IDC_RECENT_TABS_MENU, - IDC_BOOKMARKS_MENU, - IDC_EXTENSIONS_SUBMENU_MANAGE_EXTENSIONS, + IDC_RECENT_TABS_MENU, + IDC_BOOKMARKS_MENU, + IDC_EXTENSIONS_SUBMENU_MANAGE_EXTENSIONS, }; CheckCommandsAreDisabledInMenuModel(guest_browser, diff --git a/browser/ui/views/bookmarks/bookmark_bar_instructions_view.cc b/browser/ui/views/bookmarks/bookmark_bar_instructions_view.cc index 86a82d99e113..9550f53d6427 100644 --- a/browser/ui/views/bookmarks/bookmark_bar_instructions_view.cc +++ b/browser/ui/views/bookmarks/bookmark_bar_instructions_view.cc @@ -1,7 +1,7 @@ -/* Copyright 2020 The Brave Authors. All rights reserved. +/* 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/. */ + * You can obtain one at https://mozilla.org/MPL/2.0/. */ #include "brave/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h" @@ -20,6 +20,7 @@ #include "chrome/browser/ui/chrome_pages.h" #include "chrome/browser/ui/color/chrome_color_id.h" #include "ui/accessibility/ax_node_data.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/color/color_id.h" #include "ui/color/color_provider.h" #include "ui/events/event.h" @@ -133,3 +134,6 @@ void BookmarkBarInstructionsView::UpdateColors() { import_link_->SetEnabledColor(cp->GetColor(ui::kColorLinkForeground)); } } + +BEGIN_METADATA(BookmarkBarInstructionsView) +END_METADATA diff --git a/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h b/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h index bb257c4be6ef..97ed5b2057b9 100644 --- a/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h +++ b/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h @@ -1,13 +1,14 @@ -/* Copyright 2020 The Brave Authors. All rights reserved. +/* 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/. */ + * You can obtain one at https://mozilla.org/MPL/2.0/. */ #ifndef BRAVE_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_INSTRUCTIONS_VIEW_H_ #define BRAVE_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_INSTRUCTIONS_VIEW_H_ #include "base/compiler_specific.h" #include "base/memory/raw_ptr.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/context_menu_controller.h" #include "ui/views/view.h" @@ -25,6 +26,7 @@ class Browser; // NOTE: Most of code is copied from chromium's deleted file. class BookmarkBarInstructionsView : public views::View, public views::ContextMenuController { + METADATA_HEADER(BookmarkBarInstructionsView, views::View) public: explicit BookmarkBarInstructionsView(Browser* browser); BookmarkBarInstructionsView(const BookmarkBarInstructionsView&) = delete; diff --git a/browser/ui/views/brave_actions/brave_actions_container.cc b/browser/ui/views/brave_actions/brave_actions_container.cc index 7189ef6c47e1..66f501b24764 100644 --- a/browser/ui/views/brave_actions/brave_actions_container.cc +++ b/browser/ui/views/brave_actions/brave_actions_container.cc @@ -19,6 +19,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/layout_constants.h" #include "components/prefs/pref_service.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/views/layout/box_layout.h" #include "ui/views/view.h" @@ -139,3 +140,6 @@ void BraveActionsContainer::OnBraveRewardsPreferencesChanged() { rewards_action_btn_->SetVisible(ShouldShowBraveRewardsAction()); } } + +BEGIN_METADATA(BraveActionsContainer) +END_METADATA diff --git a/browser/ui/views/brave_actions/brave_actions_container.h b/browser/ui/views/brave_actions/brave_actions_container.h index 97ebd1b19161..49b626658005 100644 --- a/browser/ui/views/brave_actions/brave_actions_container.h +++ b/browser/ui/views/brave_actions/brave_actions_container.h @@ -6,12 +6,11 @@ #ifndef BRAVE_BROWSER_UI_VIEWS_BRAVE_ACTIONS_BRAVE_ACTIONS_CONTAINER_H_ #define BRAVE_BROWSER_UI_VIEWS_BRAVE_ACTIONS_BRAVE_ACTIONS_CONTAINER_H_ -#include - #include "base/gtest_prod_util.h" #include "base/memory/raw_ptr.h" #include "chrome/browser/ui/browser.h" #include "components/prefs/pref_member.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/gfx/skia_util.h" #include "ui/views/view.h" @@ -33,6 +32,8 @@ class Button; // TODO(petemill): consider splitting to separate model, like // ToolbarActionsModel and ToolbarActionsBar class BraveActionsContainer : public views::View { + METADATA_HEADER(BraveActionsContainer, views::View) + public: BraveActionsContainer(Browser* browser, Profile* profile); BraveActionsContainer(const BraveActionsContainer&) = delete; diff --git a/browser/ui/views/brave_actions/brave_rewards_action_view.cc b/browser/ui/views/brave_actions/brave_rewards_action_view.cc index 911d9d8cef72..ff3982b37bb3 100644 --- a/browser/ui/views/brave_actions/brave_rewards_action_view.cc +++ b/browser/ui/views/brave_actions/brave_rewards_action_view.cc @@ -31,6 +31,7 @@ #include "chrome/browser/ui/views/location_bar/location_bar_view.h" #include "components/grit/brave_components_strings.h" #include "components/prefs/pref_service.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/base/models/simple_menu_model.h" #include "ui/color/color_provider_manager.h" #include "ui/gfx/canvas.h" @@ -247,8 +248,9 @@ void BraveRewardsActionView::Update() { text, brave::kBadgeTextColor, background_color)); image_source->UseVerifiedIcon(background_color == kBadgeVerifiedBG); - SetImage(views::Button::STATE_NORMAL, - gfx::ImageSkia(std::move(image_source), preferred_size)); + SetImageModel(views::Button::STATE_NORMAL, + ui::ImageModel::FromImageSkia( + gfx::ImageSkia(std::move(image_source), preferred_size))); } void BraveRewardsActionView::ClosePanelForTesting() { @@ -503,3 +505,6 @@ void BraveRewardsActionView::UpdateTabHelper( OnPublisherForTabUpdated(tab_helper_ ? tab_helper_->GetPublisherIdForTab() : ""); } + +BEGIN_METADATA(BraveRewardsActionView) +END_METADATA diff --git a/browser/ui/views/brave_actions/brave_rewards_action_view.h b/browser/ui/views/brave_actions/brave_rewards_action_view.h index 06d890ab0488..27de19989359 100644 --- a/browser/ui/views/brave_actions/brave_rewards_action_view.h +++ b/browser/ui/views/brave_actions/brave_rewards_action_view.h @@ -21,6 +21,7 @@ #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" #include "chrome/browser/ui/views/toolbar/toolbar_button.h" #include "components/prefs/pref_change_registrar.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/gfx/geometry/skia_conversions.h" #include "ui/views/widget/widget_observer.h" @@ -38,6 +39,7 @@ class BraveRewardsActionView public brave_rewards::RewardsPanelCoordinator::Observer, public brave_rewards::RewardsServiceObserver, public brave_rewards::RewardsNotificationServiceObserver { + METADATA_HEADER(BraveRewardsActionView, ToolbarButton) public: explicit BraveRewardsActionView(Browser* browser); diff --git a/browser/ui/views/brave_actions/brave_shields_action_view.cc b/browser/ui/views/brave_actions/brave_shields_action_view.cc index 471e54405520..623382c5614d 100644 --- a/browser/ui/views/brave_actions/brave_shields_action_view.cc +++ b/browser/ui/views/brave_actions/brave_shields_action_view.cc @@ -28,6 +28,7 @@ #include "content/public/common/url_constants.h" #include "extensions/common/constants.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/base/models/image_model.h" #include "ui/base/resource/resource_bundle.h" #include "ui/color/color_provider_manager.h" @@ -291,3 +292,6 @@ void BraveShieldsActionView::OnTabStripModelChanged( UpdateIconState(); } } + +BEGIN_METADATA(BraveShieldsActionView) +END_METADATA diff --git a/browser/ui/views/brave_actions/brave_shields_action_view.h b/browser/ui/views/brave_actions/brave_shields_action_view.h index d06d80f6487c..d656f9bcd9ff 100644 --- a/browser/ui/views/brave_actions/brave_shields_action_view.h +++ b/browser/ui/views/brave_actions/brave_shields_action_view.h @@ -14,6 +14,7 @@ #include "brave/browser/ui/webui/brave_shields/shields_panel_ui.h" #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" #include "chrome/browser/ui/views/bubble/webui_bubble_manager.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/controls/button/label_button.h" #include "ui/views/controls/button/menu_button_controller.h" #include "ui/views/widget/widget.h" @@ -25,6 +26,7 @@ class BraveShieldsActionView : public views::LabelButton, public brave_shields::BraveShieldsDataController::Observer, public TabStripModelObserver { + METADATA_HEADER(BraveShieldsActionView, views::LabelButton) public: explicit BraveShieldsActionView(Profile& profile, TabStripModel& tab_strip_model); diff --git a/browser/ui/views/brave_ads/notification_ad_control_buttons_view.cc b/browser/ui/views/brave_ads/notification_ad_control_buttons_view.cc index 476e9ee894ab..dee3d4a1aacd 100644 --- a/browser/ui/views/brave_ads/notification_ad_control_buttons_view.cc +++ b/browser/ui/views/brave_ads/notification_ad_control_buttons_view.cc @@ -107,11 +107,13 @@ void NotificationAdControlButtonsView::UpdateCloseButton() { const bool should_use_dark_colors = GetNativeTheme()->ShouldUseDarkColors(); - const gfx::ImageSkia image_skia = gfx::CreateVectorIcon( - kBraveAdsCloseButtonIcon, kCloseButtonIconDipSize, - should_use_dark_colors ? kDarkModeCloseButtonIconColor - : kLightModeCloseButtonIconColor); - close_button_->SetImage(views::Button::STATE_NORMAL, image_skia); + close_button_->SetImageModel( + views::Button::STATE_NORMAL, + ui::ImageModel::FromVectorIcon(kBraveAdsCloseButtonIcon, + should_use_dark_colors + ? kDarkModeCloseButtonIconColor + : kLightModeCloseButtonIconColor, + kCloseButtonIconDipSize)); close_button_->AdjustBorderInsetToFitHeight(kMinimumButtonHeight); } diff --git a/browser/ui/views/brave_ads/padded_image_button.cc b/browser/ui/views/brave_ads/padded_image_button.cc index 6ebf9cef29da..f9dde5af7e5e 100644 --- a/browser/ui/views/brave_ads/padded_image_button.cc +++ b/browser/ui/views/brave_ads/padded_image_button.cc @@ -6,6 +6,7 @@ #include "brave/browser/ui/views/brave_ads/padded_image_button.h" #include +#include #include "ui/base/metadata/metadata_impl_macros.h" #include "ui/color/color_provider.h" @@ -30,7 +31,7 @@ constexpr float kVisibleOpacity = 0.12f; } // namespace PaddedImageButton::PaddedImageButton(PressedCallback callback) - : views::ImageButton(callback) { + : views::ImageButton(std::move(callback)) { auto* ink_drop = views::InkDrop::Get(this); views::InkDrop::UseInkDropForSquareRipple(ink_drop, /*highlight_on_hover=*/false, diff --git a/browser/ui/views/brave_tab_search_bubble_host.cc b/browser/ui/views/brave_tab_search_bubble_host.cc index e0f9d999aee3..8ce1f2aecc34 100644 --- a/browser/ui/views/brave_tab_search_bubble_host.cc +++ b/browser/ui/views/brave_tab_search_bubble_host.cc @@ -16,9 +16,10 @@ void BraveTabSearchBubbleHost::SetBubbleArrow( } bool BraveTabSearchBubbleHost::ShowTabSearchBubble( - bool triggered_by_keyboard_shortcut) { - bool result = - TabSearchBubbleHost::ShowTabSearchBubble(triggered_by_keyboard_shortcut); + bool triggered_by_keyboard_shortcut, + int tab_index) { + bool result = TabSearchBubbleHost::ShowTabSearchBubble( + triggered_by_keyboard_shortcut, tab_index); 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 a6679e52bdfe..8cd0ead68e8f 100644 --- a/browser/ui/views/brave_tab_search_bubble_host.h +++ b/browser/ui/views/brave_tab_search_bubble_host.h @@ -16,8 +16,8 @@ class BraveTabSearchBubbleHost : public TabSearchBubbleHost { void SetBubbleArrow(views::BubbleBorder::Arrow arrow); // TabSearchBubbleHost: - bool ShowTabSearchBubble( - bool triggered_by_keyboard_shortcut = false) override; + bool ShowTabSearchBubble(bool triggered_by_keyboard_shortcut = false, + int tab_index = -1) override; private: absl::optional arrow_; diff --git a/browser/ui/views/brave_tooltips/brave_tooltip_label_button.cc b/browser/ui/views/brave_tooltips/brave_tooltip_label_button.cc index 473c0e90d73f..8ab969ec256e 100644 --- a/browser/ui/views/brave_tooltips/brave_tooltip_label_button.cc +++ b/browser/ui/views/brave_tooltips/brave_tooltip_label_button.cc @@ -5,6 +5,8 @@ #include "brave/browser/ui/views/brave_tooltips/brave_tooltip_label_button.h" +#include + #include "ui/base/cursor/cursor.h" namespace brave_tooltips { @@ -12,7 +14,7 @@ namespace brave_tooltips { BraveTooltipLabelButton::BraveTooltipLabelButton(PressedCallback callback, const std::u16string& text, int button_context) - : LabelButton(callback, text, button_context) {} + : LabelButton(std::move(callback), text, button_context) {} BraveTooltipLabelButton::~BraveTooltipLabelButton() = default; diff --git a/browser/ui/views/download/brave_download_item_view.cc b/browser/ui/views/download/brave_download_item_view.cc index 3ada48c46743..9d219897d045 100644 --- a/browser/ui/views/download/brave_download_item_view.cc +++ b/browser/ui/views/download/brave_download_item_view.cc @@ -18,6 +18,7 @@ #include "components/vector_icons/vector_icons.h" #include "content/public/common/origin_util.h" #include "third_party/skia/include/core/SkColor.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/base/resource/resource_bundle.h" #include "ui/color/color_provider.h" #include "ui/gfx/canvas.h" @@ -262,3 +263,6 @@ void BraveDownloadItemView::OnViewFocused(View* observed_view) { void BraveDownloadItemView::OnViewBlurred(View* observed_view) { SetOriginUrlVisible(false); } + +BEGIN_METADATA(BraveDownloadItemView) +END_METADATA diff --git a/browser/ui/views/download/brave_download_item_view.h b/browser/ui/views/download/brave_download_item_view.h index 77fae3e46238..895279abc9c4 100644 --- a/browser/ui/views/download/brave_download_item_view.h +++ b/browser/ui/views/download/brave_download_item_view.h @@ -9,10 +9,13 @@ #include "brave/browser/download/brave_download_item_model.h" #include "chrome/browser/ui/download/download_item_mode.h" #include "chrome/browser/ui/views/download/download_item_view.h" +#include "ui/base/metadata/metadata_header_macros.h" // The purpose of this subclass is to add URL origin and lock icon to the // download item view (shown in the download shelf). class BraveDownloadItemView : public DownloadItemView { + METADATA_HEADER(BraveDownloadItemView, DownloadItemView) + public: BraveDownloadItemView(DownloadUIModel::DownloadUIModelPtr download, DownloadShelfView* parent, views::View* accessible_alert); diff --git a/browser/ui/views/download/bubble/download_bubble_unittest.cc b/browser/ui/views/download/bubble/download_bubble_unittest.cc index 9c052f1044c7..085f93eab24b 100644 --- a/browser/ui/views/download/bubble/download_bubble_unittest.cc +++ b/browser/ui/views/download/bubble/download_bubble_unittest.cc @@ -129,24 +129,3 @@ TEST_F(DownloadBubbleTest, ContextMenuCancelledItemTest) { EXPECT_TRUE(menu_model->GetIndexOfCommandId( static_cast(BraveDownloadCommands::REMOVE_FROM_LIST))); } - -class DownloadBubbleFeatureDisabledTest : public DownloadBubbleTest { - public: - DownloadBubbleFeatureDisabledTest() { - feature_list_.InitAndDisableFeature(safe_browsing::kDownloadBubble); - } - - base::test::ScopedFeatureList feature_list_; -}; - -TEST_F(DownloadBubbleFeatureDisabledTest, ContextMenuCompletedTest) { - SetupDownloadItemDefaults(); - SetupCompletedDownloadItem(); - - // Check completed item doesn't have remove from list menu entry when feature - // is disabled. - DownloadShelfContextMenuView ctx_menu(model_.GetWeakPtr()); - auto* menu_model = ctx_menu.GetMenuModel(); - EXPECT_FALSE(menu_model->GetIndexOfCommandId( - static_cast(BraveDownloadCommands::REMOVE_FROM_LIST))); -} diff --git a/browser/ui/views/frame/brave_browser_frame_view_linux_native.cc b/browser/ui/views/frame/brave_browser_frame_view_linux_native.cc index 35bd345eb6ec..3e62f9a3bca4 100644 --- a/browser/ui/views/frame/brave_browser_frame_view_linux_native.cc +++ b/browser/ui/views/frame/brave_browser_frame_view_linux_native.cc @@ -97,10 +97,10 @@ void BraveBrowserFrameViewLinuxNative::MaybeUpdateCachedFrameButtonImages() { views::Button* button = GetButtonFromDisplayType(type); DCHECK_EQ(std::string(views::ImageButton::kViewClassName), button->GetClassName()); - static_cast(button)->SetImage( + static_cast(button)->SetImageModel( button_state, - nav_button_provider_->GetImage( - type, ButtonStateToNavButtonProviderState(button_state))); + ui::ImageModel::FromImageSkia(nav_button_provider_->GetImage( + type, ButtonStateToNavButtonProviderState(button_state)))); } } diff --git a/browser/ui/views/frame/brave_browser_root_view.cc b/browser/ui/views/frame/brave_browser_root_view.cc index a93736e5c658..8ed854a90162 100644 --- a/browser/ui/views/frame/brave_browser_root_view.cc +++ b/browser/ui/views/frame/brave_browser_root_view.cc @@ -9,6 +9,7 @@ #include "brave/browser/ui/tabs/features.h" #include "brave/browser/ui/views/tabs/vertical_tab_utils.h" #include "chrome/browser/ui/browser.h" +#include "ui/base/metadata/metadata_impl_macros.h" BraveBrowserRootView::BraveBrowserRootView(BrowserView* browser_view, views::Widget* widget) @@ -42,3 +43,6 @@ void BraveBrowserRootView::OnNativeThemeUpdated( ui::NativeTheme* observed_theme) { ThemeChanged(); } + +BEGIN_METADATA(BraveBrowserRootView) +END_METADATA diff --git a/browser/ui/views/frame/brave_browser_root_view.h b/browser/ui/views/frame/brave_browser_root_view.h index 6c7c7eb34e15..eb207ac65233 100644 --- a/browser/ui/views/frame/brave_browser_root_view.h +++ b/browser/ui/views/frame/brave_browser_root_view.h @@ -8,6 +8,7 @@ #include "base/scoped_observation.h" #include "chrome/browser/ui/views/frame/browser_root_view.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/native_theme/native_theme.h" class Browser; @@ -19,6 +20,7 @@ class Browser; // provider always. class BraveBrowserRootView : public BrowserRootView, public ui::NativeThemeObserver { + METADATA_HEADER(BraveBrowserRootView, BrowserRootView) public: BraveBrowserRootView(BrowserView* browser_view, views::Widget* widget); ~BraveBrowserRootView() override; diff --git a/browser/ui/views/frame/brave_browser_view.cc b/browser/ui/views/frame/brave_browser_view.cc index 4460bcf95943..237a9feef0f3 100644 --- a/browser/ui/views/frame/brave_browser_view.cc +++ b/browser/ui/views/frame/brave_browser_view.cc @@ -813,3 +813,6 @@ void BraveBrowserView::SetSidePanelOperationByActiveTabChange(bool tab_change) { sidebar_container_view_->set_operation_from_active_tab_change(tab_change); } + +BEGIN_METADATA(BraveBrowserView) +END_METADATA diff --git a/browser/ui/views/frame/brave_browser_view.h b/browser/ui/views/frame/brave_browser_view.h index 852a08c32172..5c247c0cad55 100644 --- a/browser/ui/views/frame/brave_browser_view.h +++ b/browser/ui/views/frame/brave_browser_view.h @@ -22,6 +22,7 @@ #include "build/build_config.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "ui/base/accelerators/accelerator.h" +#include "ui/base/metadata/metadata_header_macros.h" #if BUILDFLAG(ENABLE_BRAVE_VPN) #include "brave/browser/ui/views/toolbar/brave_vpn_panel_controller.h" @@ -56,6 +57,7 @@ class VerticalTabStripWidgetDelegateView; class BraveBrowserView : public BrowserView, public commands::AcceleratorService::Observer { + METADATA_HEADER(BraveBrowserView, BrowserView) public: explicit BraveBrowserView(std::unique_ptr browser); BraveBrowserView(const BraveBrowserView&) = delete; diff --git a/browser/ui/views/frame/brave_opaque_browser_frame_view.cc b/browser/ui/views/frame/brave_opaque_browser_frame_view.cc index 7021dd68ae8f..bde26237cee7 100644 --- a/browser/ui/views/frame/brave_opaque_browser_frame_view.cc +++ b/browser/ui/views/frame/brave_opaque_browser_frame_view.cc @@ -17,6 +17,7 @@ #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h" #include "ui/base/hit_test.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/compositor/layer.h" #include "ui/gfx/geometry/insets.h" #include "ui/gfx/geometry/rect.h" @@ -149,3 +150,6 @@ bool BraveOpaqueBrowserFrameView::ShouldShowVerticalTabs() const { DCHECK(browser); return tabs::utils::ShouldShowVerticalTabs(browser); } + +BEGIN_METADATA(BraveOpaqueBrowserFrameView) +END_METADATA diff --git a/browser/ui/views/frame/brave_opaque_browser_frame_view.h b/browser/ui/views/frame/brave_opaque_browser_frame_view.h index 3df9dcf73245..81268b787441 100644 --- a/browser/ui/views/frame/brave_opaque_browser_frame_view.h +++ b/browser/ui/views/frame/brave_opaque_browser_frame_view.h @@ -9,10 +9,12 @@ #include #include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h" +#include "ui/base/metadata/metadata_header_macros.h" class BraveWindowFrameGraphic; class BraveOpaqueBrowserFrameView : public OpaqueBrowserFrameView { + METADATA_HEADER(BraveOpaqueBrowserFrameView, OpaqueBrowserFrameView) public: BraveOpaqueBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view, 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 26af10e5f9fa..307a70ffbb02 100644 --- a/browser/ui/views/frame/vertical_tab_strip_region_view.cc +++ b/browser/ui/views/frame/vertical_tab_strip_region_view.cc @@ -291,16 +291,17 @@ class VerticalTabNewTabButton : public BraveNewTabButton { // BraveNewTabButton: SkPath GetBorderPath(const gfx::Point& origin, - float scale, bool extend_to_top) const override { auto contents_bounds = GetContentsBounds(); - const float radius = GetCornerRadius() * scale; SkPath path; - const gfx::Rect path_rect(origin.x(), origin.y(), - contents_bounds.width() * scale, - contents_bounds.height() * scale); - path.addRoundRect(RectToSkRect(path_rect), radius, radius); - path.close(); + const auto* widget = GetWidget(); + if (widget) { + const float radius = GetCornerRadius(); + const gfx::Rect path_rect(origin.x(), origin.y(), contents_bounds.width(), + contents_bounds.height()); + path.addRoundRect(RectToSkRect(path_rect), radius, radius); + path.close(); + } return path; } @@ -329,8 +330,7 @@ class VerticalTabNewTabButton : public BraveNewTabButton { cc::PaintFlags flags; flags.setAntiAlias(true); flags.setColor(cp->GetColor(kColorToolbar)); - canvas->DrawPath( - GetBorderPath(gfx::Point(), canvas->image_scale(), false), flags); + canvas->DrawPath(GetBorderPath(gfx::Point(), false), flags); } // Draw split line on the top. @@ -414,7 +414,7 @@ class ResettableResizeArea : public views::ResizeArea { raw_ptr region_view_; }; -BEGIN_METADATA(ResettableResizeArea, ResizeArea) +BEGIN_METADATA(ResettableResizeArea, views::ResizeArea) END_METADATA } // namespace diff --git a/browser/ui/views/frame/vertical_tab_strip_region_view.h b/browser/ui/views/frame/vertical_tab_strip_region_view.h index cf17e3800e08..e6f5ffe90d4c 100644 --- a/browser/ui/views/frame/vertical_tab_strip_region_view.h +++ b/browser/ui/views/frame/vertical_tab_strip_region_view.h @@ -17,6 +17,7 @@ #include "chrome/browser/ui/exclusive_access/fullscreen_observer.h" #include "chrome/browser/ui/views/frame/tab_strip_region_view.h" #include "components/prefs/pref_member.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/controls/resize_area_delegate.h" namespace views { diff --git a/browser/ui/views/infobars/brave_infobar_container_view.cc b/browser/ui/views/infobars/brave_infobar_container_view.cc index 10c7606373dd..987e62ad1fd0 100644 --- a/browser/ui/views/infobars/brave_infobar_container_view.cc +++ b/browser/ui/views/infobars/brave_infobar_container_view.cc @@ -7,6 +7,8 @@ #include +#include "ui/base/metadata/metadata_impl_macros.h" + BraveInfoBarContainerView::BraveInfoBarContainerView( infobars::InfoBarContainer::Delegate* delegate) : InfoBarContainerView(delegate) { @@ -17,3 +19,6 @@ BraveInfoBarContainerView::BraveInfoBarContainerView( } BraveInfoBarContainerView::~BraveInfoBarContainerView() = default; + +BEGIN_METADATA(BraveInfoBarContainerView) +END_METADATA diff --git a/browser/ui/views/infobars/brave_infobar_container_view.h b/browser/ui/views/infobars/brave_infobar_container_view.h index 45a53299c631..f49a2009aaf1 100644 --- a/browser/ui/views/infobars/brave_infobar_container_view.h +++ b/browser/ui/views/infobars/brave_infobar_container_view.h @@ -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 http://mozilla.org/MPL/2.0/. */ -#include "chrome/browser/ui/views/infobars/infobar_container_view.h" - #ifndef BRAVE_BROWSER_UI_VIEWS_INFOBARS_BRAVE_INFOBAR_CONTAINER_VIEW_H_ #define BRAVE_BROWSER_UI_VIEWS_INFOBARS_BRAVE_INFOBAR_CONTAINER_VIEW_H_ +#include "chrome/browser/ui/views/infobars/infobar_container_view.h" +#include "ui/base/metadata/metadata_header_macros.h" + class BraveInfoBarContainerView : public InfoBarContainerView { + METADATA_HEADER(BraveInfoBarContainerView, InfoBarContainerView) public: explicit BraveInfoBarContainerView( infobars::InfoBarContainer::Delegate* delegate); diff --git a/browser/ui/views/infobars/brave_wayback_machine_infobar_button_container.cc b/browser/ui/views/infobars/brave_wayback_machine_infobar_button_container.cc index ba07b3c2576f..29b8bb9fb2df 100644 --- a/browser/ui/views/infobars/brave_wayback_machine_infobar_button_container.cc +++ b/browser/ui/views/infobars/brave_wayback_machine_infobar_button_container.cc @@ -12,6 +12,7 @@ #include "brave/components/l10n/common/localization_util.h" #include "brave/grit/brave_generated_resources.h" #include "chrome/browser/ui/views/chrome_layout_provider.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/views/controls/button/md_text_button.h" #include "ui/views/view_class_properties.h" @@ -79,3 +80,6 @@ void BraveWaybackMachineInfoBarButtonContainer::AdjustButtonInsets( button_->SetBorder(views::CreateEmptyBorder(button_insets)); button_->SizeToPreferredSize(); } + +BEGIN_METADATA(BraveWaybackMachineInfoBarButtonContainer) +END_METADATA diff --git a/browser/ui/views/infobars/brave_wayback_machine_infobar_button_container.h b/browser/ui/views/infobars/brave_wayback_machine_infobar_button_container.h index 1e173ea288de..b0006c92b821 100644 --- a/browser/ui/views/infobars/brave_wayback_machine_infobar_button_container.h +++ b/browser/ui/views/infobars/brave_wayback_machine_infobar_button_container.h @@ -7,6 +7,7 @@ #define BRAVE_BROWSER_UI_VIEWS_INFOBARS_BRAVE_WAYBACK_MACHINE_INFOBAR_BUTTON_CONTAINER_H_ #include "base/memory/raw_ptr.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/controls/button/button.h" #include "ui/views/view.h" @@ -17,6 +18,7 @@ class BraveWaybackMachineInfoBarThrobber; // When throbbing is requested, button extends its right inset and throbber runs // on that area. class BraveWaybackMachineInfoBarButtonContainer : public views::View { + METADATA_HEADER(BraveWaybackMachineInfoBarButtonContainer, views::View) public: explicit BraveWaybackMachineInfoBarButtonContainer( views::Button::PressedCallback callback); diff --git a/browser/ui/views/infobars/brave_wayback_machine_infobar_throbber.cc b/browser/ui/views/infobars/brave_wayback_machine_infobar_throbber.cc index 0d6512c974b6..c28f0b78a97a 100644 --- a/browser/ui/views/infobars/brave_wayback_machine_infobar_throbber.cc +++ b/browser/ui/views/infobars/brave_wayback_machine_infobar_throbber.cc @@ -7,6 +7,7 @@ #include "base/functional/bind.h" #include "base/location.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/gfx/canvas.h" #include "ui/gfx/paint_throbber.h" @@ -49,3 +50,6 @@ void BraveWaybackMachineInfoBarThrobber::OnPaint(gfx::Canvas* canvas) { bool BraveWaybackMachineInfoBarThrobber::IsRunning() const { return timer_.IsRunning(); } + +BEGIN_METADATA(BraveWaybackMachineInfoBarThrobber) +END_METADATA diff --git a/browser/ui/views/infobars/brave_wayback_machine_infobar_throbber.h b/browser/ui/views/infobars/brave_wayback_machine_infobar_throbber.h index cfd60213a223..01ffa24934b8 100644 --- a/browser/ui/views/infobars/brave_wayback_machine_infobar_throbber.h +++ b/browser/ui/views/infobars/brave_wayback_machine_infobar_throbber.h @@ -8,10 +8,12 @@ #include "base/time/time.h" #include "base/timer/timer.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/view.h" // White throbber. Most of codes are copied from views::Throbber. class BraveWaybackMachineInfoBarThrobber : public views::View { + METADATA_HEADER(BraveWaybackMachineInfoBarThrobber, views::View) public: BraveWaybackMachineInfoBarThrobber(); ~BraveWaybackMachineInfoBarThrobber() override; diff --git a/browser/ui/views/infobars/brave_wayback_machine_infobar_view.cc b/browser/ui/views/infobars/brave_wayback_machine_infobar_view.cc index 4d63bef65076..e93bae5f6718 100644 --- a/browser/ui/views/infobars/brave_wayback_machine_infobar_view.cc +++ b/browser/ui/views/infobars/brave_wayback_machine_infobar_view.cc @@ -11,6 +11,7 @@ #include "brave/browser/infobars/brave_wayback_machine_delegate_impl.h" #include "brave/browser/ui/views/infobars/brave_wayback_machine_infobar_contents_view.h" #include "brave/components/brave_wayback_machine/brave_wayback_machine_infobar_delegate.h" +#include "ui/base/metadata/metadata_impl_macros.h" // static std::unique_ptr @@ -41,3 +42,6 @@ void BraveWaybackMachineInfoBarView::Layout() { sub_views_->SetBounds(0, OffsetY(&*sub_views_), GetEndX(), sub_views_->height()); } + +BEGIN_METADATA(BraveWaybackMachineInfoBarView) +END_METADATA diff --git a/browser/ui/views/infobars/brave_wayback_machine_infobar_view.h b/browser/ui/views/infobars/brave_wayback_machine_infobar_view.h index b570f36b3251..34ba205278da 100644 --- a/browser/ui/views/infobars/brave_wayback_machine_infobar_view.h +++ b/browser/ui/views/infobars/brave_wayback_machine_infobar_view.h @@ -10,6 +10,7 @@ #include "base/memory/raw_ref.h" #include "chrome/browser/ui/views/infobars/infobar_view.h" +#include "ui/base/metadata/metadata_header_macros.h" namespace content { class WebContents; @@ -18,6 +19,7 @@ class WebContents; class BraveWaybackMachineInfoBarDelegate; class BraveWaybackMachineInfoBarView : public InfoBarView { + METADATA_HEADER(BraveWaybackMachineInfoBarView, InfoBarView) public: BraveWaybackMachineInfoBarView( std::unique_ptr delegate, diff --git a/browser/ui/views/infobars/web_discovery_infobar_content_view.cc b/browser/ui/views/infobars/web_discovery_infobar_content_view.cc index 47b2c644bae6..a0ce9649ade0 100644 --- a/browser/ui/views/infobars/web_discovery_infobar_content_view.cc +++ b/browser/ui/views/infobars/web_discovery_infobar_content_view.cc @@ -57,8 +57,9 @@ void OpenMoreInfoPage() { // Re-calculated preferred size as it doesn't give proper // size when enlarged. class InfoBarStyledLabel : public CustomStyledLabel { + METADATA_HEADER(InfoBarStyledLabel, CustomStyledLabel) + public: - METADATA_HEADER(InfoBarStyledLabel); using CustomStyledLabel::CustomStyledLabel; InfoBarStyledLabel(const InfoBarStyledLabel&) = delete; InfoBarStyledLabel& operator=(const InfoBarStyledLabel&) = delete; @@ -87,7 +88,7 @@ class InfoBarStyledLabel : public CustomStyledLabel { } }; -BEGIN_METADATA(InfoBarStyledLabel, CustomStyledLabel) +BEGIN_METADATA(InfoBarStyledLabel) END_METADATA // TODO(simonhong): Use leo MdTextButton when it's stabilized. @@ -461,9 +462,9 @@ std::unique_ptr WebDiscoveryInfoBarContentView::GetOkButton( std::unique_ptr WebDiscoveryInfoBarContentView::GetCloseButton() { auto close_button = std::make_unique(base::BindRepeating( &WebDiscoveryInfoBarContentView::CloseInfoBar, base::Unretained(this))); - close_button->SetImage( + close_button->SetImageModel( views::Button::STATE_NORMAL, - gfx::CreateVectorIcon( + ui::ImageModel::FromVectorIcon( kWebDiscoveryInfobarCloseButtonIcon, GetColorProvider()->GetColor(kColorWebDiscoveryInfoBarClose))); close_button->SetProperty( diff --git a/browser/ui/views/location_bar/brave_news_location_view.cc b/browser/ui/views/location_bar/brave_news_location_view.cc index fdeb1e959598..0e8b390177e3 100644 --- a/browser/ui/views/location_bar/brave_news_location_view.cc +++ b/browser/ui/views/location_bar/brave_news_location_view.cc @@ -20,6 +20,7 @@ #include "components/grit/brave_components_strings.h" #include "content/public/browser/web_contents.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/gfx/color_utils.h" #include "ui/gfx/geometry/skia_conversions.h" #include "ui/native_theme/native_theme.h" @@ -180,3 +181,6 @@ void BraveNewsLocationView::UpdateIconColor(bool subscribed) { void BraveNewsLocationView::OnBubbleClosed() { bubble_view_ = nullptr; } + +BEGIN_METADATA(BraveNewsLocationView) +END_METADATA diff --git a/browser/ui/views/location_bar/brave_news_location_view.h b/browser/ui/views/location_bar/brave_news_location_view.h index e8620079d73c..23214e4d1463 100644 --- a/browser/ui/views/location_bar/brave_news_location_view.h +++ b/browser/ui/views/location_bar/brave_news_location_view.h @@ -13,6 +13,7 @@ #include "brave/browser/brave_news/brave_news_tab_helper.h" #include "chrome/browser/ui/views/page_action/page_action_icon_view.h" #include "components/prefs/pref_member.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/gfx/vector_icon_types.h" #include "ui/views/view.h" @@ -24,6 +25,7 @@ class BraveNewsBubbleView; class BraveNewsLocationView : public PageActionIconView, public BraveNewsTabHelper::PageFeedsObserver, public content::WebContentsObserver { + METADATA_HEADER(BraveNewsLocationView, PageActionIconView) public: BraveNewsLocationView( Profile* profile, diff --git a/browser/ui/views/location_bar/brave_star_view.cc b/browser/ui/views/location_bar/brave_star_view.cc index 23a6c4ec3e28..cadeb0079768 100644 --- a/browser/ui/views/location_bar/brave_star_view.cc +++ b/browser/ui/views/location_bar/brave_star_view.cc @@ -5,6 +5,11 @@ #include "brave/browser/ui/views/location_bar/brave_star_view.h" +#include "ui/base/metadata/metadata_impl_macros.h" + void BraveStarView::UpdateImpl() { SetVisible(false); } + +BEGIN_METADATA(BraveStarView) +END_METADATA diff --git a/browser/ui/views/location_bar/brave_star_view.h b/browser/ui/views/location_bar/brave_star_view.h index 2b48a494348b..22acde595cc8 100644 --- a/browser/ui/views/location_bar/brave_star_view.h +++ b/browser/ui/views/location_bar/brave_star_view.h @@ -7,8 +7,10 @@ #define BRAVE_BROWSER_UI_VIEWS_LOCATION_BAR_BRAVE_STAR_VIEW_H_ #include "chrome/browser/ui/views/location_bar/star_view.h" +#include "ui/base/metadata/metadata_header_macros.h" class BraveStarView : public StarView { + METADATA_HEADER(BraveStarView, StarView) public: using StarView::StarView; diff --git a/browser/ui/views/location_bar/ipfs_location_view.cc b/browser/ui/views/location_bar/ipfs_location_view.cc index 51122310d09c..f373e13c01bd 100644 --- a/browser/ui/views/location_bar/ipfs_location_view.cc +++ b/browser/ui/views/location_bar/ipfs_location_view.cc @@ -20,6 +20,7 @@ #include "chrome/browser/ui/layout_constants.h" #include "chrome/browser/ui/views/toolbar/toolbar_ink_drop_util.h" #include "components/grit/brave_components_resources.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/base/models/image_model.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/color_palette.h" @@ -156,3 +157,6 @@ void IPFSLocationView::Update(content::WebContents* web_contents, reinterpret_cast(button_.get()) ->SetIPFSLocation(ipfs_resolved_url); } + +BEGIN_METADATA(IPFSLocationView) +END_METADATA diff --git a/browser/ui/views/location_bar/ipfs_location_view.h b/browser/ui/views/location_bar/ipfs_location_view.h index 0f99ecc4023d..4b23d5edb791 100644 --- a/browser/ui/views/location_bar/ipfs_location_view.h +++ b/browser/ui/views/location_bar/ipfs_location_view.h @@ -7,6 +7,7 @@ #define BRAVE_BROWSER_UI_VIEWS_LOCATION_BAR_IPFS_LOCATION_VIEW_H_ #include "base/memory/raw_ptr.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/gfx/geometry/size.h" #include "ui/views/controls/button/label_button.h" #include "ui/views/controls/button/label_button_border.h" @@ -18,6 +19,7 @@ class WebContents; } // namespace content class IPFSLocationView : public views::View { + METADATA_HEADER(IPFSLocationView, views::View) public: explicit IPFSLocationView(Profile* profile); ~IPFSLocationView() override; diff --git a/browser/ui/views/location_bar/onion_location_view.cc b/browser/ui/views/location_bar/onion_location_view.cc index d93960f5add1..f99b7d2c02ba 100644 --- a/browser/ui/views/location_bar/onion_location_view.cc +++ b/browser/ui/views/location_bar/onion_location_view.cc @@ -23,6 +23,7 @@ #include "chrome/browser/ui/views/toolbar/toolbar_ink_drop_util.h" #include "components/grit/brave_components_resources.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/base/models/image_model.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/color_palette.h" @@ -172,3 +173,6 @@ void OnionLocationView::Update(content::WebContents* web_contents, ->SetOnionLocation(helper->onion_location()); } } + +BEGIN_METADATA(OnionLocationView) +END_METADATA diff --git a/browser/ui/views/location_bar/onion_location_view.h b/browser/ui/views/location_bar/onion_location_view.h index f5b77f6c73a7..ed56abc8131b 100644 --- a/browser/ui/views/location_bar/onion_location_view.h +++ b/browser/ui/views/location_bar/onion_location_view.h @@ -7,6 +7,7 @@ #define BRAVE_BROWSER_UI_VIEWS_LOCATION_BAR_ONION_LOCATION_VIEW_H_ #include "base/memory/raw_ptr.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/gfx/geometry/size.h" #include "ui/views/controls/button/label_button.h" #include "ui/views/controls/button/label_button_border.h" @@ -18,6 +19,7 @@ class WebContents; } // namespace content class OnionLocationView : public views::View { + METADATA_HEADER(OnionLocationView, views::View) public: explicit OnionLocationView(Profile* profile); ~OnionLocationView() override; diff --git a/browser/ui/views/omnibox/brave_omnibox_view_views.cc b/browser/ui/views/omnibox/brave_omnibox_view_views.cc index fbad9699ae36..ceb5828153a5 100644 --- a/browser/ui/views/omnibox/brave_omnibox_view_views.cc +++ b/browser/ui/views/omnibox/brave_omnibox_view_views.cc @@ -15,6 +15,7 @@ #include "chrome/browser/ui/views/location_bar/location_bar_view.h" #include "chrome/grit/generated_resources.h" #include "components/omnibox/browser/omnibox_edit_model.h" +#include "ui/base/metadata/metadata_impl_macros.h" namespace { void BraveUpdateContextMenu(ui::SimpleMenuModel* menu_contents, GURL url) { @@ -127,3 +128,6 @@ void BraveOmniboxViewViews::UpdateContextMenu( BraveUpdateContextMenu(menu_contents, url_to_copy.value()); } } + +BEGIN_METADATA(BraveOmniboxViewViews) +END_METADATA diff --git a/browser/ui/views/omnibox/brave_omnibox_view_views.h b/browser/ui/views/omnibox/brave_omnibox_view_views.h index 5dca77b58e7d..9b05e16fa884 100644 --- a/browser/ui/views/omnibox/brave_omnibox_view_views.h +++ b/browser/ui/views/omnibox/brave_omnibox_view_views.h @@ -6,12 +6,16 @@ #ifndef BRAVE_BROWSER_UI_VIEWS_OMNIBOX_BRAVE_OMNIBOX_VIEW_VIEWS_H_ #define BRAVE_BROWSER_UI_VIEWS_OMNIBOX_BRAVE_OMNIBOX_VIEW_VIEWS_H_ +#include + #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" -#include "third_party/abseil-cpp/absl/types/optional.h" +#include "ui/base/metadata/metadata_header_macros.h" class GURL; class BraveOmniboxViewViews : public OmniboxViewViews { + METADATA_HEADER(BraveOmniboxViewViews, OmniboxViewViews) + public: using OmniboxViewViews::OmniboxViewViews; @@ -23,7 +27,7 @@ class BraveOmniboxViewViews : public OmniboxViewViews { void CleanAndCopySelectedURL(); protected: - absl::optional GetURLToCopy(); + std::optional GetURLToCopy(); void CopySanitizedURL(const GURL& url); #if BUILDFLAG(IS_WIN) // View overrides: diff --git a/browser/ui/views/playlist/playlist_action_bubble_view.cc b/browser/ui/views/playlist/playlist_action_bubble_view.cc index 963ed510eda3..f041f4e8ab45 100644 --- a/browser/ui/views/playlist/playlist_action_bubble_view.cc +++ b/browser/ui/views/playlist/playlist_action_bubble_view.cc @@ -21,6 +21,7 @@ #include "brave/grit/brave_theme_resources.h" #include "chrome/grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/base/metadata/metadata_impl_macros.h" #include "ui/gfx/canvas.h" #include "ui/gfx/skia_paint_util.h" @@ -73,17 +74,6 @@ class ConfirmBubble : public PlaylistActionBubbleView, const std::vector& items) override {} private: - class Row : public views::LabelButton { - public: - Row(const std::u16string& text, - const ui::ImageModel& icon, - views::Button::PressedCallback callback = {}); - ~Row() override = default; - - // views::LabelButton: - void Layout() override; - }; - void ResetChildViews(); void OpenInPlaylist(); @@ -96,6 +86,21 @@ class ConfirmBubble : public PlaylistActionBubbleView, playlist_tab_helper_observation_{this}; }; +class Row : public views::LabelButton { + METADATA_HEADER(Row, views::LabelButton) + public: + Row(const std::u16string& text, + const ui::ImageModel& icon, + views::Button::PressedCallback callback = {}); + ~Row() override = default; + + // views::LabelButton: + void Layout() override; +}; + +BEGIN_METADATA(Row) +END_METADATA + //////////////////////////////////////////////////////////////////////////////// // AddBubble // * Shows when users try adding items found from the current contents. @@ -123,16 +128,16 @@ class AddBubble : public PlaylistActionBubbleView { //////////////////////////////////////////////////////////////////////////////// // ConfirmBubble Impl -ConfirmBubble::Row::Row(const std::u16string& text, - const ui::ImageModel& icon, - views::Button::PressedCallback callback) - : LabelButton(callback, text) { +Row::Row(const std::u16string& text, + const ui::ImageModel& icon, + views::Button::PressedCallback callback) + : LabelButton(std::move(callback), text) { SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_RIGHT); SetImageModel(views::Button::STATE_NORMAL, icon); label()->SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_LEFT); } -void ConfirmBubble::Row::Layout() { +void Row::Layout() { LabelButton::Layout(); // Extend |label|'s width so the this button's sub controls are justified. const auto contents_x = GetContentsBounds().x(); diff --git a/browser/ui/views/playlist/playlist_action_dialogs.cc b/browser/ui/views/playlist/playlist_action_dialogs.cc index 34ef57d4575a..5de9f5953adb 100644 --- a/browser/ui/views/playlist/playlist_action_dialogs.cc +++ b/browser/ui/views/playlist/playlist_action_dialogs.cc @@ -121,6 +121,8 @@ END_METADATA // A textfield that limits the maximum length of the input text. class BoundedTextfield : public views::Textfield { + METADATA_HEADER(BoundedTextfield, views::Textfield) + public: explicit BoundedTextfield(size_t max_length) : max_length_(max_length) { length_label_ = AddChildView(std::make_unique()); @@ -176,6 +178,10 @@ class BoundedTextfield : public views::Textfield { base::WeakPtrFactory weak_ptr_factory_{this}; }; + +BEGIN_METADATA(BoundedTextfield) +END_METADATA + } // namespace namespace playlist { diff --git a/browser/ui/views/profiles/brave_avatar_toolbar_button.cc b/browser/ui/views/profiles/brave_avatar_toolbar_button.cc index 8e7db8179b1d..03e330e3f371 100644 --- a/browser/ui/views/profiles/brave_avatar_toolbar_button.cc +++ b/browser/ui/views/profiles/brave_avatar_toolbar_button.cc @@ -27,6 +27,7 @@ #include "chrome/browser/ui/views/toolbar/toolbar_ink_drop_util.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/base/pointer/touch_ui_controller.h" #include "ui/base/theme_provider.h" #include "ui/gfx/geometry/rrect_f.h" @@ -203,3 +204,6 @@ std::u16string BraveAvatarToolbarButton::GetAvatarTooltipText() const { return AvatarToolbarButton::GetAvatarTooltipText(); } + +BEGIN_METADATA(BraveAvatarToolbarButton) +END_METADATA diff --git a/browser/ui/views/profiles/brave_avatar_toolbar_button.h b/browser/ui/views/profiles/brave_avatar_toolbar_button.h index ad82c23aa1c0..a9954f0bffb8 100644 --- a/browser/ui/views/profiles/brave_avatar_toolbar_button.h +++ b/browser/ui/views/profiles/brave_avatar_toolbar_button.h @@ -7,10 +7,13 @@ #define BRAVE_BROWSER_UI_VIEWS_PROFILES_BRAVE_AVATAR_TOOLBAR_BUTTON_H_ #include "chrome/browser/ui/views/profiles/avatar_toolbar_button.h" +#include "ui/base/metadata/metadata_header_macros.h" class BrowserView; class BraveAvatarToolbarButton : public AvatarToolbarButton { + METADATA_HEADER(BraveAvatarToolbarButton, AvatarToolbarButton) + public: explicit BraveAvatarToolbarButton(BrowserView* browser_view); BraveAvatarToolbarButton(const BraveAvatarToolbarButton&) = delete; diff --git a/browser/ui/views/rounded_separator.cc b/browser/ui/views/rounded_separator.cc index 59792a842b44..42e18764175f 100644 --- a/browser/ui/views/rounded_separator.cc +++ b/browser/ui/views/rounded_separator.cc @@ -12,14 +12,12 @@ #include "ui/accessibility/ax_enums.mojom.h" #include "ui/accessibility/ax_node_data.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/color/color_id.h" #include "ui/color/color_provider.h" #include "ui/gfx/canvas.h" #include "ui/native_theme/native_theme.h" -// static -const char RoundedSeparator::kViewClassName[] = "RoundedSeparator"; - // static const int RoundedSeparator::kThickness = 1; @@ -79,6 +77,5 @@ void RoundedSeparator::OnPaint(gfx::Canvas* canvas) { View::OnPaint(canvas); } -const char* RoundedSeparator::GetClassName() const { - return kViewClassName; -} +BEGIN_METADATA(RoundedSeparator) +END_METADATA diff --git a/browser/ui/views/rounded_separator.h b/browser/ui/views/rounded_separator.h index ff29817c2110..ba31710db091 100644 --- a/browser/ui/views/rounded_separator.h +++ b/browser/ui/views/rounded_separator.h @@ -6,18 +6,18 @@ #ifndef BRAVE_BROWSER_UI_VIEWS_ROUNDED_SEPARATOR_H_ #define BRAVE_BROWSER_UI_VIEWS_ROUNDED_SEPARATOR_H_ +#include #include -#include "third_party/abseil-cpp/absl/types/optional.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/view.h" // The RoundedSeparator class is a view that shows a line used to visually // separate other views. class RoundedSeparator : public views::View { - public: - // The separator's class name. - static const char kViewClassName[]; + METADATA_HEADER(RoundedSeparator, views::View) + public: // The separator's thickness in dip. static const int kThickness; @@ -34,11 +34,10 @@ class RoundedSeparator : public views::View { gfx::Size CalculatePreferredSize() const override; void GetAccessibleNodeData(ui::AXNodeData* node_data) override; void OnPaint(gfx::Canvas* canvas) override; - const char* GetClassName() const override; private: int preferred_height_ = kThickness; - absl::optional overridden_color_; + std::optional overridden_color_; }; #endif // BRAVE_BROWSER_UI_VIEWS_ROUNDED_SEPARATOR_H_ diff --git a/browser/ui/views/side_panel/brave_bookmarks_side_panel_view.cc b/browser/ui/views/side_panel/brave_bookmarks_side_panel_view.cc index d2d31f2df320..68fa4e2e7fef 100644 --- a/browser/ui/views/side_panel/brave_bookmarks_side_panel_view.cc +++ b/browser/ui/views/side_panel/brave_bookmarks_side_panel_view.cc @@ -18,6 +18,8 @@ #include "chrome/common/webui_url_constants.h" #include "chrome/grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/metadata/metadata_header_macros.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/base/models/image_model.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/font_list.h" @@ -34,6 +36,8 @@ namespace { // Renders icon, title and launch button. class BookmarksSidePanelHeaderView : public views::View { + METADATA_HEADER(BookmarksSidePanelHeaderView, views::View) + public: explicit BookmarksSidePanelHeaderView(Browser* browser) { constexpr int kHeaderInteriorMargin = 16; @@ -102,6 +106,9 @@ class BookmarksSidePanelHeaderView : public views::View { } }; +BEGIN_METADATA(BookmarksSidePanelHeaderView) +END_METADATA + } // namespace BraveBookmarksSidePanelView::BraveBookmarksSidePanelView(Browser* browser) { diff --git a/browser/ui/views/side_panel/brave_read_later_side_panel_view.cc b/browser/ui/views/side_panel/brave_read_later_side_panel_view.cc index 59291a4b71fc..39bbbe496785 100644 --- a/browser/ui/views/side_panel/brave_read_later_side_panel_view.cc +++ b/browser/ui/views/side_panel/brave_read_later_side_panel_view.cc @@ -12,6 +12,8 @@ #include "brave/grit/brave_theme_resources.h" #include "chrome/browser/ui/views/side_panel/read_later_side_panel_web_view.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/metadata/metadata_header_macros.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/font_list.h" #include "ui/gfx/geometry/insets.h" @@ -26,6 +28,8 @@ namespace { // Renders icon and title. class ReadLaterSidePanelHeaderView : public views::View { + METADATA_HEADER(ReadLaterSidePanelHeaderView, views::View) + public: ReadLaterSidePanelHeaderView() { constexpr int kHeaderInteriorMargin = 16; @@ -66,6 +70,9 @@ class ReadLaterSidePanelHeaderView : public views::View { delete; }; +BEGIN_METADATA(ReadLaterSidePanelHeaderView) +END_METADATA + } // namespace BraveReadLaterSidePanelView::BraveReadLaterSidePanelView( @@ -87,3 +94,6 @@ BraveReadLaterSidePanelView::BraveReadLaterSidePanelView( } BraveReadLaterSidePanelView::~BraveReadLaterSidePanelView() = default; + +BEGIN_METADATA(BraveReadLaterSidePanelView) +END_METADATA diff --git a/browser/ui/views/side_panel/brave_read_later_side_panel_view.h b/browser/ui/views/side_panel/brave_read_later_side_panel_view.h index 0bbb48257c8f..dce803c88371 100644 --- a/browser/ui/views/side_panel/brave_read_later_side_panel_view.h +++ b/browser/ui/views/side_panel/brave_read_later_side_panel_view.h @@ -8,12 +8,14 @@ #include "base/functional/callback_forward.h" #include "brave/browser/ui/views/side_panel/brave_side_panel_view_base.h" +#include "ui/base/metadata/metadata_header_macros.h" class Browser; // Gives reading list specific header view with web view. class BraveReadLaterSidePanelView : public BraveSidePanelViewBase { public: + METADATA_HEADER(BraveReadLaterSidePanelView); BraveReadLaterSidePanelView(Browser* browser, base::RepeatingClosure close_cb); ~BraveReadLaterSidePanelView() override; diff --git a/browser/ui/views/side_panel/brave_side_panel_utils.cc b/browser/ui/views/side_panel/brave_side_panel_utils.cc index 2136f9fe4a80..36a913f3800c 100644 --- a/browser/ui/views/side_panel/brave_side_panel_utils.cc +++ b/browser/ui/views/side_panel/brave_side_panel_utils.cc @@ -10,12 +10,17 @@ #include "chrome/browser/ui/views/side_panel/side_panel_web_ui_view.h" #include "components/grit/brave_components_strings.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/metadata/metadata_impl_macros.h" #if BUILDFLAG(ENABLE_AI_CHAT) #include "brave/browser/ui/webui/ai_chat/ai_chat_ui.h" #include "brave/components/ai_chat/core/common/features.h" #endif +using SidePanelWebUIViewT_AIChatUI = SidePanelWebUIViewT; +BEGIN_TEMPLATE_METADATA(SidePanelWebUIViewT_AIChatUI, SidePanelWebUIViewT) +END_METADATA + namespace { #if BUILDFLAG(ENABLE_AI_CHAT) diff --git a/browser/ui/views/side_panel/brave_side_panel_view_base.cc b/browser/ui/views/side_panel/brave_side_panel_view_base.cc index b4020be3690f..d82938b5baec 100644 --- a/browser/ui/views/side_panel/brave_side_panel_view_base.cc +++ b/browser/ui/views/side_panel/brave_side_panel_view_base.cc @@ -8,6 +8,7 @@ #include "brave/browser/ui/color/brave_color_id.h" #include "chrome/browser/ui/views/side_panel/side_panel_content_proxy.h" #include "chrome/browser/ui/views/side_panel/side_panel_util.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/views/background.h" BraveSidePanelViewBase::BraveSidePanelViewBase() { @@ -43,3 +44,6 @@ void BraveSidePanelViewBase::OnViewVisibilityChanged( view_observation_.Reset(); } } + +BEGIN_METADATA(BraveSidePanelViewBase) +END_METADATA diff --git a/browser/ui/views/side_panel/brave_side_panel_view_base.h b/browser/ui/views/side_panel/brave_side_panel_view_base.h index 7a73b9df9cf4..48b9f7599502 100644 --- a/browser/ui/views/side_panel/brave_side_panel_view_base.h +++ b/browser/ui/views/side_panel/brave_side_panel_view_base.h @@ -7,10 +7,12 @@ #define BRAVE_BROWSER_UI_VIEWS_SIDE_PANEL_BRAVE_SIDE_PANEL_VIEW_BASE_H_ #include "base/scoped_observation.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/view.h" #include "ui/views/view_observer.h" class BraveSidePanelViewBase : public views::View, public views::ViewObserver { + METADATA_HEADER(BraveSidePanelViewBase, views::View) public: BraveSidePanelViewBase(); ~BraveSidePanelViewBase() override; diff --git a/browser/ui/views/sidebar/sidebar_items_contents_view.cc b/browser/ui/views/sidebar/sidebar_items_contents_view.cc index 7b6523eb9ccc..162137d3dcce 100644 --- a/browser/ui/views/sidebar/sidebar_items_contents_view.cc +++ b/browser/ui/views/sidebar/sidebar_items_contents_view.cc @@ -395,10 +395,11 @@ void SidebarItemsContentsView::SetImageForItem(const sidebar::SidebarItem& item, CHECK_LT(*index, children().size()); SidebarItemView* item_view = GetItemViewAt(*index); - item_view->SetImage( + item_view->SetImageModel( views::Button::STATE_NORMAL, - gfx::ImageSkiaOperations::CreateResizedImage( - image, skia::ImageOperations::RESIZE_BEST, kIconSize)); + ui::ImageModel::FromImageSkia( + gfx::ImageSkiaOperations::CreateResizedImage( + image, skia::ImageOperations::RESIZE_BEST, kIconSize))); } void SidebarItemsContentsView::ClearDragIndicator() { diff --git a/browser/ui/views/sidebar/sidebar_items_scroll_view.cc b/browser/ui/views/sidebar/sidebar_items_scroll_view.cc index e43defddb033..9a23337b1fe0 100644 --- a/browser/ui/views/sidebar/sidebar_items_scroll_view.cc +++ b/browser/ui/views/sidebar/sidebar_items_scroll_view.cc @@ -263,18 +263,18 @@ void SidebarItemsScrollView::UpdateArrowViewsTheme() { const SkColor arrow_disabled = color_provider->GetColor(kColorSidebarArrowDisabled); - up_arrow_->SetImage( + up_arrow_->SetImageModel( views::Button::STATE_NORMAL, - gfx::CreateVectorIcon(kSidebarItemsUpArrowIcon, arrow_normal)); - up_arrow_->SetImage( - views::Button::STATE_DISABLED, - gfx::CreateVectorIcon(kSidebarItemsUpArrowIcon, arrow_disabled)); - down_arrow_->SetImage( - views::Button::STATE_NORMAL, - gfx::CreateVectorIcon(kSidebarItemsDownArrowIcon, arrow_normal)); - down_arrow_->SetImage( - views::Button::STATE_DISABLED, - gfx::CreateVectorIcon(kSidebarItemsDownArrowIcon, arrow_disabled)); + ui::ImageModel::FromVectorIcon(kSidebarItemsUpArrowIcon, arrow_normal)); + up_arrow_->SetImageModel(views::Button::STATE_DISABLED, + ui::ImageModel::FromVectorIcon( + kSidebarItemsUpArrowIcon, arrow_disabled)); + down_arrow_->SetImageModel(views::Button::STATE_NORMAL, + ui::ImageModel::FromVectorIcon( + kSidebarItemsDownArrowIcon, arrow_normal)); + down_arrow_->SetImageModel(views::Button::STATE_DISABLED, + ui::ImageModel::FromVectorIcon( + kSidebarItemsDownArrowIcon, arrow_disabled)); } } diff --git a/browser/ui/views/speedreader/reader_mode_toolbar_view.cc b/browser/ui/views/speedreader/reader_mode_toolbar_view.cc index 45f1b1773398..7575353261f2 100644 --- a/browser/ui/views/speedreader/reader_mode_toolbar_view.cc +++ b/browser/ui/views/speedreader/reader_mode_toolbar_view.cc @@ -10,6 +10,7 @@ #include "brave/components/constants/webui_url_constants.h" #include "chrome/browser/ui/color/chrome_color_id.h" #include "content/public/browser/browser_context.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/views/background.h" #include "ui/views/border.h" #include "url/gurl.h" @@ -69,3 +70,6 @@ void ReaderModeToolbarView::OnBoundsChanged(const gfx::Rect& previous_bounds) { #endif toolbar_->SetBoundsRect(toolbar_bounds); } + +BEGIN_METADATA(ReaderModeToolbarView) +END_METADATA diff --git a/browser/ui/views/speedreader/reader_mode_toolbar_view.h b/browser/ui/views/speedreader/reader_mode_toolbar_view.h index 93d3a6c3018c..6f511e1ea03f 100644 --- a/browser/ui/views/speedreader/reader_mode_toolbar_view.h +++ b/browser/ui/views/speedreader/reader_mode_toolbar_view.h @@ -8,6 +8,7 @@ #include +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/controls/webview/webview.h" namespace content { @@ -15,6 +16,7 @@ class BrowserContext; } class ReaderModeToolbarView : public views::View { + METADATA_HEADER(ReaderModeToolbarView, views::View) public: explicit ReaderModeToolbarView(content::BrowserContext* browser_context); ~ReaderModeToolbarView() override; diff --git a/browser/ui/views/tabs/brave_new_tab_button.cc b/browser/ui/views/tabs/brave_new_tab_button.cc index adc9144f3202..c671fc3643cf 100644 --- a/browser/ui/views/tabs/brave_new_tab_button.cc +++ b/browser/ui/views/tabs/brave_new_tab_button.cc @@ -1,7 +1,7 @@ /* 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 "brave/browser/ui/views/tabs/brave_new_tab_button.h" @@ -12,6 +12,8 @@ #include "brave/components/vector_icons/vector_icons.h" #include "chrome/browser/ui/views/tabs/new_tab_button.h" #include "chrome/browser/ui/views/tabs/tab_strip.h" +#include "ui/base/metadata/metadata_impl_macros.h" +#include "ui/compositor/compositor.h" #include "ui/gfx/geometry/skia_conversions.h" #include "ui/gfx/paint_vector_icon.h" #include "ui/gfx/scoped_canvas.h" @@ -19,6 +21,25 @@ using tabs::features::HorizontalTabsUpdateEnabled; +namespace { + +SkPath GetBorderPath(const gfx::Point& origin, + bool extend_to_top, + int corner_radius, + const gfx::Size& contents_bounds) { + // Overridden to use Brave's non-circular shape + SkPath path; + const gfx::Rect path_rect( + origin.x(), extend_to_top ? 0 : origin.y(), contents_bounds.width(), + (extend_to_top ? origin.y() : 0) + + std::min(contents_bounds.width(), contents_bounds.height())); + path.addRoundRect(RectToSkRect(path_rect), corner_radius, corner_radius); + path.close(); + return path; +} + +} // namespace + // static gfx::Size BraveNewTabButton::GetButtonSize() { if (!HorizontalTabsUpdateEnabled()) { @@ -27,30 +48,8 @@ gfx::Size BraveNewTabButton::GetButtonSize() { return {28, 28}; } -// static -SkPath BraveNewTabButton::GetBorderPath(const gfx::Point& origin, - float scale, - bool extend_to_top, - int corner_radius, - const gfx::Size& contents_bounds) { - // Overriden to use Brave's non-circular shape - gfx::PointF scaled_origin(origin); - scaled_origin.Scale(scale); - const float radius = corner_radius * scale; - - SkPath path; - const gfx::Rect path_rect( - scaled_origin.x(), extend_to_top ? 0 : scaled_origin.y(), - contents_bounds.width() * scale, - (extend_to_top ? scaled_origin.y() : 0) + - std::min(contents_bounds.width(), contents_bounds.height()) * scale); - path.addRoundRect(RectToSkRect(path_rect), radius, radius); - path.close(); - return path; -} - gfx::Size BraveNewTabButton::CalculatePreferredSize() const { - // Overriden so that we use Brave's custom button size + // Overridden so that we use Brave's custom button size gfx::Size size = GetButtonSize(); const auto insets = GetInsets(); size.Enlarge(insets.width(), insets.height()); @@ -58,10 +57,12 @@ gfx::Size BraveNewTabButton::CalculatePreferredSize() const { } SkPath BraveNewTabButton::GetBorderPath(const gfx::Point& origin, - float scale, bool extend_to_top) const { - return GetBorderPath(origin, scale, extend_to_top, GetCornerRadius(), - GetContentsBounds().size()); + if (GetWidget()) { + return ::GetBorderPath(origin, extend_to_top, GetCornerRadius(), + GetContentsBounds().size()); + } + return SkPath(); } BraveNewTabButton::BraveNewTabButton(TabStrip* tab_strip, @@ -84,15 +85,16 @@ void BraveNewTabButton::PaintIcon(gfx::Canvas* canvas) { // the canvas in the center of the view. constexpr int kIconSize = 16; gfx::Rect bounds = GetContentsBounds(); - canvas->Translate(gfx::Vector2d((bounds.width() - kIconSize) / 2, - (bounds.height() - kIconSize) / 2)); + canvas->Translate( + gfx::Vector2d((bounds.width() - kIconSize) / 2 + bounds.x(), + (bounds.height() - kIconSize) / 2 + bounds.y())); gfx::PaintVectorIcon(canvas, kLeoPlusAddIcon, kIconSize, GetForegroundColor()); return; } // Shim base implementation's painting - // Overriden to fix chromium assumption that border radius + // Overridden to fix chromium assumption that border radius // will be 50% of width. // Incorrect offset that base class will use @@ -122,3 +124,6 @@ gfx::Insets BraveNewTabButton::GetInsets() const { // So, adding more insets here is easy solution. return NewTabButton::GetInsets() + gfx::Insets::TLBR(0, 6, 0, 0); } + +BEGIN_METADATA(BraveNewTabButton) +END_METADATA diff --git a/browser/ui/views/tabs/brave_new_tab_button.h b/browser/ui/views/tabs/brave_new_tab_button.h index 6c1bebb0a584..2eb0209017ca 100644 --- a/browser/ui/views/tabs/brave_new_tab_button.h +++ b/browser/ui/views/tabs/brave_new_tab_button.h @@ -1,7 +1,7 @@ /* 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/. */ #ifndef BRAVE_BROWSER_UI_VIEWS_TABS_BRAVE_NEW_TAB_BUTTON_H_ #define BRAVE_BROWSER_UI_VIEWS_TABS_BRAVE_NEW_TAB_BUTTON_H_ @@ -10,6 +10,7 @@ #include "chrome/browser/ui/views/tabs/new_tab_button.h" #include "third_party/skia/include/core/SkPath.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/size.h" @@ -19,16 +20,13 @@ class ButtonListener; } class BraveNewTabButton : public NewTabButton { + METADATA_HEADER(BraveNewTabButton, NewTabButton) + public: - // These static members are shared with BraveTabSearchButton + // This static members are shared with BraveTabSearchButton // TODO(sko) If we could make TabSearchButton inherit BraveNewTabButton, - // we might not need these any more. + // we might not need to do this any more. static gfx::Size GetButtonSize(); - static SkPath GetBorderPath(const gfx::Point& origin, - float scale, - bool extend_to_top, - int border_radius, - const gfx::Size& contents_bounds); BraveNewTabButton(TabStrip* tab_strip, PressedCallback callback); ~BraveNewTabButton() override; @@ -49,7 +47,6 @@ class BraveNewTabButton : public NewTabButton { void PaintFill(gfx::Canvas* canvas) const override; gfx::Size CalculatePreferredSize() const override; SkPath GetBorderPath(const gfx::Point& origin, - float scale, bool extend_to_top) const override; gfx::Insets GetInsets() const override; }; diff --git a/browser/ui/views/tabs/brave_tab_group_highlight.cc b/browser/ui/views/tabs/brave_tab_group_highlight.cc index 4baa2fc1edbe..fdbf8865fff4 100644 --- a/browser/ui/views/tabs/brave_tab_group_highlight.cc +++ b/browser/ui/views/tabs/brave_tab_group_highlight.cc @@ -9,6 +9,7 @@ #include "brave/browser/ui/tabs/features.h" #include "brave/browser/ui/views/tabs/vertical_tab_utils.h" #include "chrome/browser/ui/views/tabs/tab_group_views.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/gfx/geometry/skia_conversions.h" BraveTabGroupHighlight::~BraveTabGroupHighlight() = default; @@ -21,3 +22,6 @@ SkPath BraveTabGroupHighlight::GetPath() const { return {}; } + +BEGIN_METADATA(BraveTabGroupHighlight) +END_METADATA diff --git a/browser/ui/views/tabs/brave_tab_group_highlight.h b/browser/ui/views/tabs/brave_tab_group_highlight.h index 38ba9e49af38..83456e4728ff 100644 --- a/browser/ui/views/tabs/brave_tab_group_highlight.h +++ b/browser/ui/views/tabs/brave_tab_group_highlight.h @@ -7,8 +7,10 @@ #define BRAVE_BROWSER_UI_VIEWS_TABS_BRAVE_TAB_GROUP_HIGHLIGHT_H_ #include "chrome/browser/ui/views/tabs/tab_group_highlight.h" +#include "ui/base/metadata/metadata_header_macros.h" class BraveTabGroupHighlight : public TabGroupHighlight { + METADATA_HEADER(BraveTabGroupHighlight, TabGroupHighlight) public: using TabGroupHighlight::TabGroupHighlight; ~BraveTabGroupHighlight() override; diff --git a/browser/ui/views/tabs/brave_tab_group_underline.cc b/browser/ui/views/tabs/brave_tab_group_underline.cc index dd9512143d75..8953e1ac595a 100644 --- a/browser/ui/views/tabs/brave_tab_group_underline.cc +++ b/browser/ui/views/tabs/brave_tab_group_underline.cc @@ -14,6 +14,7 @@ #include "cc/paint/paint_flags.h" #include "chrome/browser/ui/views/tabs/tab_group_style.h" #include "chrome/browser/ui/views/tabs/tab_group_views.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/gfx/canvas.h" #include "ui/gfx/geometry/skia_conversions.h" #include "ui/views/view_utils.h" @@ -121,3 +122,6 @@ int BraveTabGroupUnderline::GetStrokeInset() { } return brave_tabs::kHorizontalTabInset; } + +BEGIN_METADATA(BraveTabGroupUnderline) +END_METADATA diff --git a/browser/ui/views/tabs/brave_tab_group_underline.h b/browser/ui/views/tabs/brave_tab_group_underline.h index 50933047c29b..a4c205429ecd 100644 --- a/browser/ui/views/tabs/brave_tab_group_underline.h +++ b/browser/ui/views/tabs/brave_tab_group_underline.h @@ -7,10 +7,12 @@ #define BRAVE_BROWSER_UI_VIEWS_TABS_BRAVE_TAB_GROUP_UNDERLINE_H_ #include "chrome/browser/ui/views/tabs/tab_group_underline.h" +#include "ui/base/metadata/metadata_header_macros.h" // In vertical tabs, TabGroupUnderline is not actually "underline'. It's an // enclosing rounded rect for views in the group. class BraveTabGroupUnderline : public TabGroupUnderline { + METADATA_HEADER(BraveTabGroupUnderline, TabGroupUnderline) public: BraveTabGroupUnderline(TabGroupViews* tab_group_views, const tab_groups::TabGroupId& group, diff --git a/browser/ui/views/tabs/brave_tab_strip.cc b/browser/ui/views/tabs/brave_tab_strip.cc index 7bc6d8452096..6050763fdc23 100644 --- a/browser/ui/views/tabs/brave_tab_strip.cc +++ b/browser/ui/views/tabs/brave_tab_strip.cc @@ -231,7 +231,7 @@ void BraveTabStrip::UpdateTabContainer() { base::FeatureList::IsEnabled(features::kSplitTabStrip); const bool is_using_compound_tab_container = views::IsViewClass( - base::to_address(tab_container_)); + std::to_address(tab_container_)); base::ScopedClosureRunner layout_lock; if (should_use_compound_tab_container != is_using_compound_tab_container) { diff --git a/browser/ui/views/toolbar/bookmark_button.cc b/browser/ui/views/toolbar/bookmark_button.cc index 7bce57e2debb..db62a5d9d8e9 100644 --- a/browser/ui/views/toolbar/bookmark_button.cc +++ b/browser/ui/views/toolbar/bookmark_button.cc @@ -1,7 +1,7 @@ -/* Copyright 2019 The Brave Authors. All rights reserved. +/* 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 "brave/browser/ui/views/toolbar/bookmark_button.h" @@ -16,6 +16,7 @@ #include "chrome/grit/generated_resources.h" #include "components/omnibox/browser/vector_icons.h" #include "components/strings/grit/components_strings.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/gfx/paint_vector_icon.h" BookmarkButton::BookmarkButton(PressedCallback callback) @@ -40,9 +41,12 @@ void BookmarkButton::UpdateImageAndText() { SkColor icon_color = color_provider->GetColor(kColorToolbarButtonIcon); const gfx::VectorIcon& icon = active_ ? omnibox::kStarActiveIcon : omnibox::kStarIcon; - SetImage(views::Button::STATE_NORMAL, - gfx::CreateVectorIcon(icon, 16, icon_color)); + SetImageModel(views::Button::STATE_NORMAL, + ui::ImageModel::FromVectorIcon(icon, icon_color, 16)); int tooltip_id = active_ ? IDS_TOOLTIP_STARRED : IDS_TOOLTIP_STAR; SetTooltipText(brave_l10n::GetLocalizedResourceUTF16String(tooltip_id)); } + +BEGIN_METADATA(BookmarkButton) +END_METADATA diff --git a/browser/ui/views/toolbar/bookmark_button.h b/browser/ui/views/toolbar/bookmark_button.h index 6b4bc1929a37..a4e74a18bfd2 100644 --- a/browser/ui/views/toolbar/bookmark_button.h +++ b/browser/ui/views/toolbar/bookmark_button.h @@ -1,14 +1,16 @@ -/* Copyright 2019 The Brave Authors. All rights reserved. +/* 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/. */ #ifndef BRAVE_BROWSER_UI_VIEWS_TOOLBAR_BOOKMARK_BUTTON_H_ #define BRAVE_BROWSER_UI_VIEWS_TOOLBAR_BOOKMARK_BUTTON_H_ #include "chrome/browser/ui/views/toolbar/toolbar_button.h" +#include "ui/base/metadata/metadata_header_macros.h" class BookmarkButton : public ToolbarButton { + METADATA_HEADER(BookmarkButton, ToolbarButton) public: explicit BookmarkButton(PressedCallback callback); BookmarkButton(const BookmarkButton&) = delete; diff --git a/browser/ui/views/toolbar/brave_toolbar_view.cc b/browser/ui/views/toolbar/brave_toolbar_view.cc index 0dba126c8b1e..5a31304e682b 100644 --- a/browser/ui/views/toolbar/brave_toolbar_view.cc +++ b/browser/ui/views/toolbar/brave_toolbar_view.cc @@ -31,6 +31,7 @@ #include "components/bookmarks/common/bookmark_pref_names.h" #include "components/prefs/pref_service.h" #include "ui/base/hit_test.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/base/window_open_disposition_utils.h" #include "ui/events/event.h" #include "ui/views/window/hit_test_utils.h" @@ -406,3 +407,6 @@ void BraveToolbarView::ResetButtonBounds() { bookmark_->SetX(bookmark_x); } } + +BEGIN_METADATA(BraveToolbarView) +END_METADATA diff --git a/browser/ui/views/toolbar/brave_toolbar_view.h b/browser/ui/views/toolbar/brave_toolbar_view.h index 5c1fa157e8ba..ac32cc02578e 100644 --- a/browser/ui/views/toolbar/brave_toolbar_view.h +++ b/browser/ui/views/toolbar/brave_toolbar_view.h @@ -12,6 +12,7 @@ #include "chrome/browser/profiles/profile_attributes_storage.h" #include "chrome/browser/ui/views/toolbar/toolbar_view.h" #include "components/prefs/pref_member.h" +#include "ui/base/metadata/metadata_header_macros.h" #if BUILDFLAG(ENABLE_BRAVE_VPN) class BraveVPNButton; @@ -22,6 +23,7 @@ class WalletButton; class BraveToolbarView : public ToolbarView, public ProfileAttributesStorage::Observer { + METADATA_HEADER(BraveToolbarView, ToolbarView) public: explicit BraveToolbarView(Browser* browser, BrowserView* browser_view); ~BraveToolbarView() override; diff --git a/browser/ui/views/toolbar/brave_vpn_button.cc b/browser/ui/views/toolbar/brave_vpn_button.cc index 995c44e1f9bd..6f6ed255279b 100644 --- a/browser/ui/views/toolbar/brave_vpn_button.cc +++ b/browser/ui/views/toolbar/brave_vpn_button.cc @@ -222,21 +222,22 @@ void BraveVPNButton::UpdateColorsAndInsets() { ? kColorBraveVpnButtonTextError : kColorBraveVpnButtonText)); if (is_error_state_) { - SetImage( - views::Button::STATE_NORMAL, - gfx::CreateVectorIcon(kVpnIndicatorErrorIcon, - cp->GetColor(kColorBraveVpnButtonIconError))); + SetImageModel(views::Button::STATE_NORMAL, + ui::ImageModel::FromVectorIcon( + kVpnIndicatorErrorIcon, + cp->GetColor(kColorBraveVpnButtonIconError))); // Use background for inner color of error button image. image()->SetBackground(std::make_unique( cp->GetColor(kColorBraveVpnButtonIconErrorInner))); } else { - SetImage(views::Button::STATE_NORMAL, - gfx::CreateVectorIcon( - is_connected_ ? kVpnIndicatorOnIcon : kVpnIndicatorOffIcon, - cp->GetColor(is_connected_ - ? kColorBraveVpnButtonIconConnected - : kColorBraveVpnButtonIconDisconnected))); + SetImageModel( + views::Button::STATE_NORMAL, + ui::ImageModel::FromVectorIcon( + is_connected_ ? kVpnIndicatorOnIcon : kVpnIndicatorOffIcon, + cp->GetColor(is_connected_ + ? kColorBraveVpnButtonIconConnected + : kColorBraveVpnButtonIconDisconnected))); // Use background for inner color of button image. // Adjusted border thickness to make invisible to the outside of the icon. @@ -332,5 +333,5 @@ void BraveVPNButton::OnButtonPressed(const ui::Event& event) { chrome::ExecuteCommand(browser_, IDC_SHOW_BRAVE_VPN_PANEL); } -BEGIN_METADATA(BraveVPNButton, LabelButton) +BEGIN_METADATA(BraveVPNButton, views::LabelButton) END_METADATA diff --git a/browser/ui/views/toolbar/brave_vpn_status_label.cc b/browser/ui/views/toolbar/brave_vpn_status_label.cc index 9f7f557e2a0b..1ee6aba4bd94 100644 --- a/browser/ui/views/toolbar/brave_vpn_status_label.cc +++ b/browser/ui/views/toolbar/brave_vpn_status_label.cc @@ -14,6 +14,7 @@ #include "brave/grit/brave_generated_resources.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/views/frame/browser_view.h" +#include "ui/base/metadata/metadata_impl_macros.h" using ConnectionState = brave_vpn::mojom::ConnectionState; using PurchasedState = brave_vpn::mojom::PurchasedState; @@ -96,3 +97,6 @@ void BraveVPNStatusLabel::UpdateState() { SetText(brave_l10n::GetLocalizedResourceUTF16String( GetStringIdForConnectionState(state))); } + +BEGIN_METADATA(BraveVPNStatusLabel) +END_METADATA diff --git a/browser/ui/views/toolbar/brave_vpn_status_label.h b/browser/ui/views/toolbar/brave_vpn_status_label.h index 8522a7b3acc7..f2d6f5ff331a 100644 --- a/browser/ui/views/toolbar/brave_vpn_status_label.h +++ b/browser/ui/views/toolbar/brave_vpn_status_label.h @@ -8,6 +8,7 @@ #include "base/memory/raw_ptr.h" #include "brave/components/brave_vpn/browser/brave_vpn_service_observer.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/controls/label.h" namespace brave_vpn { @@ -18,6 +19,7 @@ class Browser; class BraveVPNStatusLabel : public views::Label, public brave_vpn::BraveVPNServiceObserver { + METADATA_HEADER(BraveVPNStatusLabel, views::Label) public: explicit BraveVPNStatusLabel(Browser* browser); ~BraveVPNStatusLabel() override; diff --git a/browser/ui/views/toolbar/brave_vpn_toggle_button.cc b/browser/ui/views/toolbar/brave_vpn_toggle_button.cc index f83765fa4448..26d8b8c17b5b 100644 --- a/browser/ui/views/toolbar/brave_vpn_toggle_button.cc +++ b/browser/ui/views/toolbar/brave_vpn_toggle_button.cc @@ -14,6 +14,7 @@ #include "brave/grit/brave_generated_resources.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/views/frame/browser_view.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/color/color_id.h" using ConnectionState = brave_vpn::mojom::ConnectionState; @@ -60,3 +61,6 @@ void BraveVPNToggleButton::UpdateState() { state == ConnectionState::CONNECTED); SetIsOn(is_on); } + +BEGIN_METADATA(BraveVPNToggleButton) +END_METADATA diff --git a/browser/ui/views/toolbar/brave_vpn_toggle_button.h b/browser/ui/views/toolbar/brave_vpn_toggle_button.h index 4e48ce00ec64..385e658eb679 100644 --- a/browser/ui/views/toolbar/brave_vpn_toggle_button.h +++ b/browser/ui/views/toolbar/brave_vpn_toggle_button.h @@ -8,6 +8,7 @@ #include "base/memory/raw_ptr.h" #include "brave/components/brave_vpn/browser/brave_vpn_service_observer.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/controls/button/toggle_button.h" namespace brave_vpn { @@ -18,6 +19,7 @@ class Browser; class BraveVPNToggleButton : public views::ToggleButton, public brave_vpn::BraveVPNServiceObserver { + METADATA_HEADER(BraveVPNToggleButton, views::ToggleButton) public: explicit BraveVPNToggleButton(Browser* browser); ~BraveVPNToggleButton() override; diff --git a/browser/ui/views/toolbar/wallet_button.cc b/browser/ui/views/toolbar/wallet_button.cc index 3f4b228e18ee..09ce9e40bb54 100644 --- a/browser/ui/views/toolbar/wallet_button.cc +++ b/browser/ui/views/toolbar/wallet_button.cc @@ -213,15 +213,17 @@ void WalletButton::UpdateImageAndText(bool activated) { color_id = kColorToolbarButtonActivated; } - constexpr int kIconSize = 16; - auto icon = gfx::CreateVectorIcon(kLeoProductBraveWalletIcon, kIconSize, - color_provider->GetColor(color_id)); - if (counter_ == 0) { - SetImage(views::Button::STATE_NORMAL, icon); + SetImageModel( + views::Button::STATE_NORMAL, + ui::ImageModel::FromVectorIcon(kLeoProductBraveWalletIcon, + color_provider->GetColor(color_id), 16)); return; } + auto icon = gfx::CreateVectorIcon(kLeoProductBraveWalletIcon, GetIconSize(), + color_provider->GetColor(color_id)); + size_t icon_size = std::max(icon.width(), icon.height()); auto badge_size = brave::BraveIconWithBadgeImageSource::GetMaxBadgeSize(); gfx::Size preferred_size(icon_size + badge_size.width(), @@ -238,8 +240,9 @@ void WalletButton::UpdateImageAndText(bool activated) { auto text = GetBadgeText(); image_source->SetBadge(std::make_unique( text, brave::kBadgeTextColor, brave::kBadgeNotificationBG)); - SetImage(views::Button::STATE_NORMAL, - gfx::ImageSkia(std::move(image_source), preferred_size)); + SetImageModel(views::Button::STATE_NORMAL, + ui::ImageModel::FromImageSkia( + gfx::ImageSkia(std::move(image_source), preferred_size))); } void WalletButton::UpdateVisibility() { @@ -285,5 +288,5 @@ views::View* WalletButton::GetAsAnchorView() { return anchor_view; } -BEGIN_METADATA(WalletButton, ToolbarButton) +BEGIN_METADATA(WalletButton) END_METADATA diff --git a/browser/ui/views/toolbar/wallet_button.h b/browser/ui/views/toolbar/wallet_button.h index 1a6ca3f1a14f..98156f0eb0f1 100644 --- a/browser/ui/views/toolbar/wallet_button.h +++ b/browser/ui/views/toolbar/wallet_button.h @@ -23,7 +23,7 @@ class PrefService; class WalletButton : public ToolbarButton { - METADATA_HEADER(WalletButton); + METADATA_HEADER(WalletButton, ToolbarButton) public: WalletButton(View* backup_anchor_view, Profile* profile); diff --git a/browser/ui/webui/ai_chat/ai_chat_ui.cc b/browser/ui/webui/ai_chat/ai_chat_ui.cc index dcc5d05c85d3..658241b6f6db 100644 --- a/browser/ui/webui/ai_chat/ai_chat_ui.cc +++ b/browser/ui/webui/ai_chat/ai_chat_ui.cc @@ -99,6 +99,9 @@ AIChatUI::AIChatUI(content::WebUI* web_ui) untrusted_source->OverrideContentSecurityPolicy( network::mojom::CSPDirectiveName::FontSrc, "font-src 'self' data: chrome-untrusted://resources;"); + + untrusted_source->OverrideContentSecurityPolicy( + network::mojom::CSPDirectiveName::TrustedTypes, "trusted-types default;"); } AIChatUI::~AIChatUI() = default; diff --git a/browser/ui/webui/new_tab_page/brave_new_tab_ui_browsertest.cc b/browser/ui/webui/new_tab_page/brave_new_tab_ui_browsertest.cc index 5ae5d65dc8be..49b86fec7faf 100644 --- a/browser/ui/webui/new_tab_page/brave_new_tab_ui_browsertest.cc +++ b/browser/ui/webui/new_tab_page/brave_new_tab_ui_browsertest.cc @@ -1,7 +1,7 @@ -/* Copyright 2020 The Brave Authors. All rights reserved. +/* 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/. */ + * You can obtain one at https://mozilla.org/MPL/2.0/. */ #include "base/memory/raw_ptr.h" #include "base/path_service.h" @@ -13,8 +13,6 @@ #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/child_process_termination_info.h" -#include "content/public/browser/notification_service.h" -#include "content/public/browser/notification_types.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_process_host_observer.h" #include "content/public/test/browser_test.h" @@ -44,12 +42,10 @@ class ObserverLogger : public RenderProcessHostObserver { class BraveNewTabUIBrowserTest : public extensions::ExtensionFunctionalTest { public: - void GoBack(WebContents* web_contents) { - WindowedNotificationObserver load_stop_observer( - content::NOTIFICATION_LOAD_STOP, - NotificationService::AllSources()); + void GoBack(WebContents* web_contents, const GURL& expected_url) { + ui_test_utils::UrlLoadObserver url_observer(expected_url); web_contents->GetController().GoBack(); - load_stop_observer.Wait(); + url_observer.Wait(); } }; @@ -59,7 +55,7 @@ IN_PROC_BROWSER_TEST_F(BraveNewTabUIBrowserTest, StartupURLTest) { RenderProcessHost* host = contents->GetPrimaryMainFrame()->GetProcess(); ObserverLogger observer_logger(host); - GURL new_tab_url(chrome::kChromeUINewTabURL); + const GURL new_tab_url(chrome::kChromeUINewTabURL); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), new_tab_url)); WaitForLoadStop(contents); @@ -67,7 +63,7 @@ IN_PROC_BROWSER_TEST_F(BraveNewTabUIBrowserTest, StartupURLTest) { ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), simple_url)); WaitForLoadStop(contents); - GoBack(contents); + GoBack(contents, new_tab_url); WaitForLoadStop(contents); } diff --git a/browser/ui/webui/settings/brave_tor_handler.cc b/browser/ui/webui/settings/brave_tor_handler.cc index 767c39f0b80e..4905cf9dba2e 100644 --- a/browser/ui/webui/settings/brave_tor_handler.cc +++ b/browser/ui/webui/settings/brave_tor_handler.cc @@ -244,7 +244,8 @@ class BridgeRequest { std::unique_ptr MakeMoatRequest( const GURL& url, const base::Value& data, - network::SimpleURLLoader::BodyAsStringCallback response_callback) { + network::SimpleURLLoader::BodyAsStringCallbackDeprecated + response_callback) { auto request = std::make_unique(); request->url = url; request->method = net::HttpRequestHeaders::kPostMethod; diff --git a/browser/web_discovery/web_discovery_unittest.cc b/browser/web_discovery/web_discovery_unittest.cc index 1c5dee3c5a97..8591bee29ff4 100644 --- a/browser/web_discovery/web_discovery_unittest.cc +++ b/browser/web_discovery/web_discovery_unittest.cc @@ -58,7 +58,8 @@ class WebDiscoveryCTATest : public testing::Test { // Set brave search as a default provider. std::unique_ptr brave = CreateTestTemplateURL( u"brave", "https://search.brave.com/", std::string(), - base::Time::FromTimeT(100), false, false, + base::Time::FromTimeT(100), false, + TemplateURLData::CreatedByPolicy::kNoPolicy, TemplateURLPrepopulateData::PREPOPULATED_ENGINE_ID_BRAVE); service()->SetUserSelectedDefaultSearchProvider(brave.get()); ASSERT_TRUE(IsBraveSearchDefault()); @@ -68,7 +69,8 @@ class WebDiscoveryCTATest : public testing::Test { // Set brave search as a default provider. std::unique_ptr google = CreateTestTemplateURL( u"google", "https://www.google.com/", std::string(), - base::Time::FromTimeT(100), false, false, + base::Time::FromTimeT(100), false, + TemplateURLData::CreatedByPolicy::kNoPolicy, TemplateURLPrepopulateData::PREPOPULATED_ENGINE_ID_GOOGLE); service()->SetUserSelectedDefaultSearchProvider(google.get()); ASSERT_FALSE(IsBraveSearchDefault()); diff --git a/build/android/bytecode/BUILD.gn b/build/android/bytecode/BUILD.gn index adb32d6a1c8b..ff77bcc3bbd8 100644 --- a/build/android/bytecode/BUILD.gn +++ b/build/android/bytecode/BUILD.gn @@ -25,6 +25,7 @@ java_binary("java_bytecode_rewriter") { "//brave/build/android/bytecode/java/org/brave/bytecode/BraveBookmarkPageClassAdapter.java", "//brave/build/android/bytecode/java/org/brave/bytecode/BraveBookmarkToolbarClassAdapter.java", "//brave/build/android/bytecode/java/org/brave/bytecode/BraveBookmarkToolbarCoordinatorClassAdapter.java", + "//brave/build/android/bytecode/java/org/brave/bytecode/BraveBookmarkUiPrefsClassAdapter.java", "//brave/build/android/bytecode/java/org/brave/bytecode/BraveBookmarkUtilsClassAdapter.java", "//brave/build/android/bytecode/java/org/brave/bytecode/BraveBottomControlsCoordinatorClassAdapter.java", "//brave/build/android/bytecode/java/org/brave/bytecode/BraveBottomControlsMediatorClassAdapter.java", @@ -43,7 +44,6 @@ java_binary("java_bytecode_rewriter") { "//brave/build/android/bytecode/java/org/brave/bytecode/BraveExternalNavigationHandlerClassAdapter.java", "//brave/build/android/bytecode/java/org/brave/bytecode/BraveFeedSurfaceCoordinatorClassAdapter.java", "//brave/build/android/bytecode/java/org/brave/bytecode/BraveFeedSurfaceMediatorClassAdapter.java", - "//brave/build/android/bytecode/java/org/brave/bytecode/BraveFourStateCookieSettingsPreferenceBaseClassAdapter.java", "//brave/build/android/bytecode/java/org/brave/bytecode/BraveFreIntentCreatorClassAdapter.java", "//brave/build/android/bytecode/java/org/brave/bytecode/BraveHelpAndFeedbackLauncherImplClassAdapter.java", "//brave/build/android/bytecode/java/org/brave/bytecode/BraveHomepageManagerClassAdapter.java", diff --git a/build/android/bytecode/java/org/brave/bytecode/BraveBookmarkUiPrefsClassAdapter.java b/build/android/bytecode/java/org/brave/bytecode/BraveBookmarkUiPrefsClassAdapter.java new file mode 100644 index 000000000000..3419b0d92c05 --- /dev/null +++ b/build/android/bytecode/java/org/brave/bytecode/BraveBookmarkUiPrefsClassAdapter.java @@ -0,0 +1,21 @@ +/* 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/. */ + +package org.brave.bytecode; + +import org.objectweb.asm.ClassVisitor; + +public class BraveBookmarkUiPrefsClassAdapter extends BraveClassVisitor { + static String sBookmarkUiPrefsClassName = + "org/chromium/chrome/browser/bookmarks/BookmarkUiPrefs"; + static String sBraveBookmarkUiPrefsClassName = + "org/chromium/chrome/browser/bookmarks/BraveBookmarkUiPrefs"; + + public BraveBookmarkUiPrefsClassAdapter(ClassVisitor visitor) { + super(visitor); + + redirectConstructor(sBookmarkUiPrefsClassName, sBraveBookmarkUiPrefsClassName); + } +} diff --git a/build/android/bytecode/java/org/brave/bytecode/BraveBookmarkUtilsClassAdapter.java b/build/android/bytecode/java/org/brave/bytecode/BraveBookmarkUtilsClassAdapter.java index a809dc4d4526..f7fd93ad04bf 100644 --- a/build/android/bytecode/java/org/brave/bytecode/BraveBookmarkUtilsClassAdapter.java +++ b/build/android/bytecode/java/org/brave/bytecode/BraveBookmarkUtilsClassAdapter.java @@ -17,7 +17,12 @@ public BraveBookmarkUtilsClassAdapter(ClassVisitor visitor) { changeMethodOwner( sBookmarkUtilsClassName, "addOrEditBookmark", sBraveBookmarkUtilsClassName); - changeMethodOwner(sBookmarkUtilsClassName, "showBookmarkManagerOnPhone", + + changeMethodOwner( + sBookmarkUtilsClassName, + "showBookmarkManagerOnPhone", sBraveBookmarkUtilsClassName); + + changeMethodOwner(sBookmarkUtilsClassName, "isSpecialFolder", sBraveBookmarkUtilsClassName); } } diff --git a/build/android/bytecode/java/org/brave/bytecode/BraveClassAdapter.java b/build/android/bytecode/java/org/brave/bytecode/BraveClassAdapter.java index 8a42dde398ce..a1c6a429236f 100644 --- a/build/android/bytecode/java/org/brave/bytecode/BraveClassAdapter.java +++ b/build/android/bytecode/java/org/brave/bytecode/BraveClassAdapter.java @@ -26,6 +26,7 @@ public static ClassVisitor createAdapter(ClassVisitor chain) { chain = new BraveBookmarkPageClassAdapter(chain); chain = new BraveBookmarkToolbarClassAdapter(chain); chain = new BraveBookmarkToolbarCoordinatorClassAdapter(chain); + chain = new BraveBookmarkUiPrefsClassAdapter(chain); chain = new BraveBookmarkUtilsClassAdapter(chain); chain = new BraveBottomControlsCoordinatorClassAdapter(chain); chain = new BraveBottomControlsMediatorClassAdapter(chain); @@ -42,7 +43,6 @@ public static ClassVisitor createAdapter(ClassVisitor chain) { chain = new BraveExternalNavigationHandlerClassAdapter(chain); chain = new BraveFeedSurfaceCoordinatorClassAdapter(chain); chain = new BraveFeedSurfaceMediatorClassAdapter(chain); - chain = new BraveFourStateCookieSettingsPreferenceBaseClassAdapter(chain); chain = new BraveFreIntentCreatorClassAdapter(chain); chain = new BraveHelpAndFeedbackLauncherImplClassAdapter(chain); chain = new BraveHomepageManagerClassAdapter(chain); diff --git a/build/android/bytecode/java/org/brave/bytecode/BraveFourStateCookieSettingsPreferenceBaseClassAdapter.java b/build/android/bytecode/java/org/brave/bytecode/BraveFourStateCookieSettingsPreferenceBaseClassAdapter.java deleted file mode 100644 index 819cef7de2a0..000000000000 --- a/build/android/bytecode/java/org/brave/bytecode/BraveFourStateCookieSettingsPreferenceBaseClassAdapter.java +++ /dev/null @@ -1,22 +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 https://mozilla.org/MPL/2.0/. */ - -package org.brave.bytecode; - -import org.objectweb.asm.ClassVisitor; - -public class BraveFourStateCookieSettingsPreferenceBaseClassAdapter extends BraveClassVisitor { - static String sFourStateCookieSettingsPreferenceClassName = - "org/chromium/components/browser_ui/site_settings/FourStateCookieSettingsPreference"; - static String sBraveFourStateCookieSettingsPreferenceBaseClassName = - "org/chromium/components/browser_ui/site_settings/BraveFourStateCookieSettingsPreferenceBase"; - - public BraveFourStateCookieSettingsPreferenceBaseClassAdapter(ClassVisitor visitor) { - super(visitor); - - changeSuperName(sFourStateCookieSettingsPreferenceClassName, - sBraveFourStateCookieSettingsPreferenceBaseClassName); - } -} diff --git a/build/android/bytecode/java/org/brave/bytecode/BraveToolbarManagerClassAdapter.java b/build/android/bytecode/java/org/brave/bytecode/BraveToolbarManagerClassAdapter.java index 8ce6dfb7c54f..6ddd59a284ff 100644 --- a/build/android/bytecode/java/org/brave/bytecode/BraveToolbarManagerClassAdapter.java +++ b/build/android/bytecode/java/org/brave/bytecode/BraveToolbarManagerClassAdapter.java @@ -74,9 +74,6 @@ public BraveToolbarManagerClassAdapter(ClassVisitor visitor) { deleteField(sBraveToolbarManagerClassName, "mIncognitoStateProvider"); makeProtectedField(sToolbarManagerClassName, "mIncognitoStateProvider"); - deleteField(sBraveToolbarManagerClassName, "mTabCountProvider"); - makeProtectedField(sToolbarManagerClassName, "mTabCountProvider"); - deleteField(sBraveToolbarManagerClassName, "mTabGroupUi"); makeProtectedField(sToolbarManagerClassName, "mTabGroupUi"); diff --git a/build/commands/lib/util.js b/build/commands/lib/util.js index b8ea4ff68f35..d4adbce98d0c 100644 --- a/build/commands/lib/util.js +++ b/build/commands/lib/util.js @@ -27,21 +27,25 @@ async function applyPatches() { const v8PatchesPath = path.join(patchesPath, 'v8') const catapultPatchesPath = path.join(patchesPath, 'third_party', 'catapult') const devtoolsFrontendPatchesPath = path.join(patchesPath, 'third_party', 'devtools-frontend', 'src') + const ffmpegPatchesPath = path.join(patchesPath, 'third_party', 'ffmpeg') const chromiumRepoPath = config.srcDir const v8RepoPath = path.join(chromiumRepoPath, 'v8') const catapultRepoPath = path.join(chromiumRepoPath, 'third_party', 'catapult') const devtoolsFrontendRepoPath = path.join(chromiumRepoPath, 'third_party', 'devtools-frontend', 'src') + const ffmpegRepoPath = path.join(chromiumRepoPath, 'third_party', 'ffmpeg') const chromiumPatcher = new GitPatcher(patchesPath, chromiumRepoPath) const v8Patcher = new GitPatcher(v8PatchesPath, v8RepoPath) const catapultPatcher = new GitPatcher(catapultPatchesPath, catapultRepoPath) const devtoolsFrontendPatcher = new GitPatcher(devtoolsFrontendPatchesPath, devtoolsFrontendRepoPath) + const ffmpegPatcher = new GitPatcher(ffmpegPatchesPath, ffmpegRepoPath) const chromiumPatchStatus = await chromiumPatcher.applyPatches() const v8PatchStatus = await v8Patcher.applyPatches() const catapultPatchStatus = await catapultPatcher.applyPatches() const devtoolsFrontendPatchStatus = await devtoolsFrontendPatcher.applyPatches() + const ffmpegPatchStatus = await ffmpegPatcher.applyPatches() // Log status for all patches // Differentiate entries for logging @@ -50,7 +54,7 @@ async function applyPatches() { s => s.path = path.join('third_party', 'catapult', s.path)) devtoolsFrontendPatchStatus.forEach( s => s.path = path.join('third_party', 'devtools-frontend', 'src', s.path)) - const allPatchStatus = [...chromiumPatchStatus, ...v8PatchStatus, ...catapultPatchStatus, ...devtoolsFrontendPatchStatus] + const allPatchStatus = [...chromiumPatchStatus, ...v8PatchStatus, ...catapultPatchStatus, ...devtoolsFrontendPatchStatus, ...ffmpegPatchStatus] Log.allPatchStatus(allPatchStatus, 'Chromium') const hasPatchError = allPatchStatus.some(p => p.error) diff --git a/build/commands/scripts/updatePatches.js b/build/commands/scripts/updatePatches.js index 1d700bec5bf7..8898a1204676 100644 --- a/build/commands/scripts/updatePatches.js +++ b/build/commands/scripts/updatePatches.js @@ -22,10 +22,12 @@ module.exports = function RunCommand (options) { const v8Dir = path.join(config.srcDir, 'v8') const catapultDir = path.join(config.srcDir, 'third_party', 'catapult') const devtoolsFrontendDir = path.join(config.srcDir, 'third_party', 'devtools-frontend', 'src') + const ffmpegDir = path.join(config.srcDir, 'third_party', 'ffmpeg') const patchDir = path.join(config.braveCoreDir, 'patches') const v8PatchDir = path.join(patchDir, 'v8') const catapultPatchDir = path.join(patchDir, 'third_party', 'catapult') const devtoolsFrontendPatchDir = path.join(patchDir, 'third_party', 'devtools-frontend', 'src') + const ffmpegPatchDir = path.join(patchDir, 'third_party', 'ffmpeg') Promise.all([ // chromium @@ -36,6 +38,8 @@ module.exports = function RunCommand (options) { updatePatches(catapultDir, catapultPatchDir), // third_party/devtools-frontend/src updatePatches(devtoolsFrontendDir, devtoolsFrontendPatchDir), + // third_party/ffmpeg + updatePatches(ffmpegDir, ffmpegPatchDir), ]) .then(() => { console.log('Done.') diff --git a/chromium_src/base/feature_list.cc b/chromium_src/base/feature_list.cc index c89a6453483b..a7145096b8a9 100644 --- a/chromium_src/base/feature_list.cc +++ b/chromium_src/base/feature_list.cc @@ -5,6 +5,7 @@ #include "base/feature_list.h" +#include "base/check_op.h" #include "base/containers/flat_map.h" #include "base/containers/flat_set.h" #include "base/feature_override.h" diff --git a/chromium_src/build/buildflag.h b/chromium_src/build/buildflag.h index 8eeaf30ab576..2532c81f2b37 100644 --- a/chromium_src/build/buildflag.h +++ b/chromium_src/build/buildflag.h @@ -9,7 +9,10 @@ // This file is used in rc.exe which doesn't receive low priority additional // global include to support #include "src/...". // #include_next is used instead to include original upstream file. +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgnu-include-next" #include_next "build/buildflag.h" +#pragma clang diagnostic pop // Use IF_BUILDFLAG(FLAG_NAME, { some_code_here(); }) to generate a single // conditional define. diff --git a/chromium_src/chrome/browser/apps/link_capturing/link_capturing_features.cc b/chromium_src/chrome/browser/apps/link_capturing/link_capturing_features.cc deleted file mode 100644 index cd6902c55f21..000000000000 --- a/chromium_src/chrome/browser/apps/link_capturing/link_capturing_features.cc +++ /dev/null @@ -1,18 +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/browser/apps/link_capturing/link_capturing_features.cc" - -#include "base/feature_override.h" - -namespace apps::features { - -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) -OVERRIDE_FEATURE_DEFAULT_STATES({{ - {kDesktopPWAsLinkCapturing, base::FEATURE_DISABLED_BY_DEFAULT}, -}}); -#endif - -} // namespace apps::features diff --git a/chromium_src/chrome/browser/browser_features.cc b/chromium_src/chrome/browser/browser_features.cc index 531e3dee5581..196fa714e8e5 100644 --- a/chromium_src/chrome/browser/browser_features.cc +++ b/chromium_src/chrome/browser/browser_features.cc @@ -17,9 +17,6 @@ OVERRIDE_FEATURE_DEFAULT_STATES({{ {kAppBoundEncryptionMetrics, base::FEATURE_DISABLED_BY_DEFAULT}, #endif {kBookmarkTriggerForPrerender2, base::FEATURE_DISABLED_BY_DEFAULT}, -#if !BUILDFLAG(IS_ANDROID) - {kCopyLinkToText, base::FEATURE_DISABLED_BY_DEFAULT}, -#endif {kDestroyProfileOnBrowserClose, base::FEATURE_DISABLED_BY_DEFAULT}, {kFedCmWithoutThirdPartyCookies, base::FEATURE_DISABLED_BY_DEFAULT}, // Google has asked embedders not to enforce these pins: diff --git a/chromium_src/chrome/browser/download/download_ui_controller.cc b/chromium_src/chrome/browser/download/download_ui_controller.cc index c0b99e48807e..d41588d1c0a4 100644 --- a/chromium_src/chrome/browser/download/download_ui_controller.cc +++ b/chromium_src/chrome/browser/download/download_ui_controller.cc @@ -6,10 +6,7 @@ #include "brave/browser/ipfs/ipfs_tab_helper.h" #include "chrome/browser/download/bubble/download_bubble_prefs.h" #include "chrome/browser/download/download_stats.h" - -namespace download { -bool BraveIsDownloadBubbleV2Enabled(Profile* profile); -} // namespace download +#include "chrome/common/pref_names.h" bool IsIpfsImportDownloadCreated(content::WebContents* web_contents, download::DownloadItem* item); @@ -22,10 +19,12 @@ bool IsIpfsImportDownloadCreated(content::WebContents* web_contents, // Prevent DownloadBubbleUIControllerDelegate from overriding // prefs::kPromptForDownload value for OffTheRecord profiles -#define IsDownloadBubbleV2Enabled BraveIsDownloadBubbleV2Enabled +#define kPromptForDownload kPromptForDownload, \ + profile_->GetPrefs()->GetBoolean(prefs::kPromptForDownload)); \ + DCHECK_EQ(true #include "src/chrome/browser/download/download_ui_controller.cc" -#undef IsDownloadBubbleV2Enabled +#undef kPromptForDownload #undef RecordDownloadStartPerProfileType bool IsIpfsImportDownloadCreated(content::WebContents* web_contents, @@ -34,11 +33,3 @@ bool IsIpfsImportDownloadCreated(content::WebContents* web_contents, ipfs::IPFSTabHelper::FromWebContents(web_contents); return (helper && helper->GetImportController()->HasInProgressDownload(item)); } - -namespace download { - -bool BraveIsDownloadBubbleV2Enabled(Profile* profile) { - return false; -} - -} // namespace download diff --git a/chromium_src/chrome/browser/push_messaging/push_messaging_service_unittest.cc b/chromium_src/chrome/browser/push_messaging/push_messaging_service_unittest.cc index ddbc75eb7abd..fa51812de6fa 100644 --- a/chromium_src/chrome/browser/push_messaging/push_messaging_service_unittest.cc +++ b/chromium_src/chrome/browser/push_messaging/push_messaging_service_unittest.cc @@ -1,10 +1,20 @@ /* 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 "brave/test/base/brave_testing_profile.h" +// These tests fail because we do not record permissions UKM, see +// brave/chromium_src/components/permissions/permission_uma_util.cc +// GetUkmSourceId override. +#define RecordsRevocationAndSourceUiNoReporterTest \ + DISABLED_RecordsRevocationAndSourceUiNoReporterTest +#define RecordsRevocationAndSourceUiWithReporterTest \ + DISABLED_RecordsRevocationAndSourceUiWithReporterTest + #define TestingProfile BraveTestingProfile #include "src/chrome/browser/push_messaging/push_messaging_service_unittest.cc" #undef TestingProfile +#undef RecordsRevocationAndSourceUiWithReporterTest +#undef RecordsRevocationAndSourceUiNoReporterTest 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 f8d951ab7b3f..c36cabae3085 100644 --- a/chromium_src/chrome/browser/signin/account_consistency_disabled_unittest.cc +++ b/chromium_src/chrome/browser/signin/account_consistency_disabled_unittest.cc @@ -34,19 +34,21 @@ TEST(AccountConsistencyDisabledTest, NewProfile) { TestingProfile::Builder profile_builder; profile_builder.SetIsNewProfile(true); { - TestingPrefStore* user_prefs = new TestingPrefStore(); + auto user_prefs = base::MakeRefCounted(); // Set the read error so that Profile::IsNewProfile() returns true. user_prefs->set_read_error(PersistentPrefStore::PREF_READ_ERROR_NO_FILE); std::unique_ptr pref_service = std::make_unique( - /*managed_prefs=*/new TestingPrefStore(), - /*supervised_user_prefs=*/new TestingPrefStore(), - /*extension_prefs=*/new TestingPrefStore(), - /*standalone_browser_prefs=*/new TestingPrefStore(), user_prefs, - /*recommended_prefs=*/new TestingPrefStore(), - new user_prefs::PrefRegistrySyncable(), new PrefNotifierImpl()); + /*managed_prefs=*/base::MakeRefCounted(), + /*supervised_user_prefs=*/base::MakeRefCounted(), + /*extension_prefs=*/base::MakeRefCounted(), + /*standalone_browser_prefs=*/ + base::MakeRefCounted(), std::move(user_prefs), + /*recommended_prefs=*/base::MakeRefCounted(), + base::MakeRefCounted(), + std::make_unique()); RegisterUserProfilePrefs(pref_service->registry()); profile_builder.SetPrefService(std::move(pref_service)); } diff --git a/chromium_src/chrome/browser/ssl/https_upgrades_interceptor.cc b/chromium_src/chrome/browser/ssl/https_upgrades_interceptor.cc index 78899bd0f1b2..3d266f6f137d 100644 --- a/chromium_src/chrome/browser/ssl/https_upgrades_interceptor.cc +++ b/chromium_src/chrome/browser/ssl/https_upgrades_interceptor.cc @@ -47,8 +47,7 @@ } \ return MaybeCreateLoaderForResponse_ChromiumImpl( \ modified_status, request, response_head, response_body, loader, \ - client_receiver, url_loader, skip_other_interceptors, \ - will_return_unsafe_redirect); \ + client_receiver, url_loader); \ } \ bool HttpsUpgradesInterceptor::MaybeCreateLoaderForResponse_ChromiumImpl( \ __VA_ARGS__) diff --git a/chromium_src/chrome/browser/ssl/https_upgrades_navigation_throttle.cc b/chromium_src/chrome/browser/ssl/https_upgrades_navigation_throttle.cc index 9b80934eabc1..1d47d73c0892 100644 --- a/chromium_src/chrome/browser/ssl/https_upgrades_navigation_throttle.cc +++ b/chromium_src/chrome/browser/ssl/https_upgrades_navigation_throttle.cc @@ -80,11 +80,12 @@ HttpsUpgradesNavigationThrottle::MaybeCreateThrottleFor( HttpsFirstModeServiceFactory::GetForProfile(profile); if (hfm_service) { // Can be null in some cases, e.g. when using Ash sign-in profile. - hfm_service->MaybeEnableHttpsFirstModeForUrl(handle->GetURL()); + interstitial_state.enabled_by_typically_secure_browsing = + hfm_service->IsInterstitialEnabledByTypicallySecureUserHeuristic(); } // StatefulSSLHostStateDelegate can be null during tests. - if (state && state->IsHttpsEnforcedForHost(handle->GetURL().host(), - storage_partition)) { + if (state && + state->IsHttpsEnforcedForUrl(handle->GetURL(), storage_partition)) { interstitial_state.enabled_by_engagement_heuristic = true; } diff --git a/chromium_src/chrome/browser/sync/prefs/chrome_syncable_prefs_database.cc b/chromium_src/chrome/browser/sync/prefs/chrome_syncable_prefs_database.cc index 9eba536054b6..229f6ebc2b83 100644 --- a/chromium_src/chrome/browser/sync/prefs/chrome_syncable_prefs_database.cc +++ b/chromium_src/chrome/browser/sync/prefs/chrome_syncable_prefs_database.cc @@ -40,102 +40,110 @@ enum { } // namespace brave_syncable_prefs_ids const auto& BraveSyncablePreferences() { - static const auto kBraveSyncablePrefsAllowList = base::MakeFixedFlatMapSorted< - std::string_view, sync_preferences::SyncablePrefMetadata>({ - {"profile.content_settings.exceptions.braveShields", - {brave_syncable_prefs_ids::kProfileContentSettingsExceptionsBraveShields, - syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, - sync_preferences::MergeBehavior::kMergeableDict}}, - {"profile.content_settings.exceptions.braveSpeedreader", - {brave_syncable_prefs_ids:: - kProfileContentSettingsExceptionsBraveSpeedreader, - syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, - sync_preferences::MergeBehavior::kMergeableDict}}, - {"profile.content_settings.exceptions.cosmeticFiltering", - {brave_syncable_prefs_ids:: - kProfileContentSettingsExceptionsCosmeticFiltering, - syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, - sync_preferences::MergeBehavior::kMergeableDict}}, - {"profile.content_settings.exceptions.fingerprintingV2", - {brave_syncable_prefs_ids:: - kProfileContentSettingsExceptionsFingerprintingV2, - syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, - sync_preferences::MergeBehavior::kMergeableDict}}, - {"profile.content_settings.exceptions.httpUpgradableResources", - {brave_syncable_prefs_ids:: - kProfileContentSettingsExceptionsHttpUpgradableResources, - syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, - sync_preferences::MergeBehavior::kMergeableDict}}, - {"profile.content_settings.exceptions.httpsUpgrades", - {brave_syncable_prefs_ids:: - kProfileContentSettingsExceptionsHttpsUpgrades, - syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, - sync_preferences::MergeBehavior::kMergeableDict}}, - {"profile.content_settings.exceptions.referrers", - {brave_syncable_prefs_ids::kProfileContentSettingsExceptionsReferrers, - syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, - sync_preferences::MergeBehavior::kMergeableDict}}, - {"profile.content_settings.exceptions.shieldsAds", - {brave_syncable_prefs_ids::kProfileContentSettingsExceptionsShieldsAds, - syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, - sync_preferences::MergeBehavior::kMergeableDict}}, - {"profile.content_settings.exceptions.shieldsCookiesV3", - {brave_syncable_prefs_ids:: - kProfileContentSettingsExceptionsShieldsCookiesV3, - syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, - sync_preferences::MergeBehavior::kMergeableDict}}, - {"profile.content_settings.exceptions.trackers", - {brave_syncable_prefs_ids::kProfileContentSettingsExceptionsTrackers, - syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, - sync_preferences::MergeBehavior::kMergeableDict}}, - {"profile.default_content_setting_values.braveShields", - {brave_syncable_prefs_ids:: - kProfileDefaultContentSettingValuesBraveShields, - syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, - sync_preferences::MergeBehavior::kNone}}, - {"profile.default_content_setting_values.braveSpeedreader", - {brave_syncable_prefs_ids:: - kProfileDefaultContentSettingValuesBraveSpeedreader, - syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, - sync_preferences::MergeBehavior::kNone}}, - {"profile.default_content_setting_values.cosmeticFiltering", - {brave_syncable_prefs_ids:: - kProfileDefaultContentSettingValuesCosmeticFiltering, - syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, - sync_preferences::MergeBehavior::kNone}}, - {"profile.default_content_setting_values.fingerprintingV2", - {brave_syncable_prefs_ids:: - kProfileDefaultContentSettingValuesFingerprintingV2, - syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, - sync_preferences::MergeBehavior::kNone}}, - {"profile.default_content_setting_values.httpUpgradableResources", - {brave_syncable_prefs_ids:: - kProfileDefaultContentSettingValuesHttpUpgradableResources, - syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, - sync_preferences::MergeBehavior::kNone}}, - {"profile.default_content_setting_values.httpsUpgrades", - {brave_syncable_prefs_ids:: - kProfileDefaultContentSettingValuesHttpsUpgrades, - syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, - sync_preferences::MergeBehavior::kNone}}, - {"profile.default_content_setting_values.referrers", - {brave_syncable_prefs_ids::kProfileDefaultContentSettingValuesReferrers, - syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, - sync_preferences::MergeBehavior::kNone}}, - {"profile.default_content_setting_values.shieldsAds", - {brave_syncable_prefs_ids::kProfileDefaultContentSettingValuesShieldsAds, - syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, - sync_preferences::MergeBehavior::kNone}}, - {"profile.default_content_setting_values.shieldsCookiesV3", - {brave_syncable_prefs_ids:: - kProfileDefaultContentSettingValuesShieldsCookiesV3, - syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, - sync_preferences::MergeBehavior::kNone}}, - {"profile.default_content_setting_values.trackers", - {brave_syncable_prefs_ids::kProfileDefaultContentSettingValuesTrackers, - syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, - sync_preferences::MergeBehavior::kNone}}, - }); + static const auto kBraveSyncablePrefsAllowList = base::MakeFixedFlatMap< + std::string_view, sync_preferences::SyncablePrefMetadata>( + base::sorted_unique, + { + {"profile.content_settings.exceptions.braveShields", + {brave_syncable_prefs_ids:: + kProfileContentSettingsExceptionsBraveShields, + syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, + sync_preferences::MergeBehavior::kMergeableDict}}, + {"profile.content_settings.exceptions.braveSpeedreader", + {brave_syncable_prefs_ids:: + kProfileContentSettingsExceptionsBraveSpeedreader, + syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, + sync_preferences::MergeBehavior::kMergeableDict}}, + {"profile.content_settings.exceptions.cosmeticFiltering", + {brave_syncable_prefs_ids:: + kProfileContentSettingsExceptionsCosmeticFiltering, + syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, + sync_preferences::MergeBehavior::kMergeableDict}}, + {"profile.content_settings.exceptions.fingerprintingV2", + {brave_syncable_prefs_ids:: + kProfileContentSettingsExceptionsFingerprintingV2, + syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, + sync_preferences::MergeBehavior::kMergeableDict}}, + {"profile.content_settings.exceptions.httpUpgradableResources", + {brave_syncable_prefs_ids:: + kProfileContentSettingsExceptionsHttpUpgradableResources, + syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, + sync_preferences::MergeBehavior::kMergeableDict}}, + {"profile.content_settings.exceptions.httpsUpgrades", + {brave_syncable_prefs_ids:: + kProfileContentSettingsExceptionsHttpsUpgrades, + syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, + sync_preferences::MergeBehavior::kMergeableDict}}, + {"profile.content_settings.exceptions.referrers", + {brave_syncable_prefs_ids:: + kProfileContentSettingsExceptionsReferrers, + syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, + sync_preferences::MergeBehavior::kMergeableDict}}, + {"profile.content_settings.exceptions.shieldsAds", + {brave_syncable_prefs_ids:: + kProfileContentSettingsExceptionsShieldsAds, + syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, + sync_preferences::MergeBehavior::kMergeableDict}}, + {"profile.content_settings.exceptions.shieldsCookiesV3", + {brave_syncable_prefs_ids:: + kProfileContentSettingsExceptionsShieldsCookiesV3, + syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, + sync_preferences::MergeBehavior::kMergeableDict}}, + {"profile.content_settings.exceptions.trackers", + {brave_syncable_prefs_ids::kProfileContentSettingsExceptionsTrackers, + syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, + sync_preferences::MergeBehavior::kMergeableDict}}, + {"profile.default_content_setting_values.braveShields", + {brave_syncable_prefs_ids:: + kProfileDefaultContentSettingValuesBraveShields, + syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, + sync_preferences::MergeBehavior::kNone}}, + {"profile.default_content_setting_values.braveSpeedreader", + {brave_syncable_prefs_ids:: + kProfileDefaultContentSettingValuesBraveSpeedreader, + syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, + sync_preferences::MergeBehavior::kNone}}, + {"profile.default_content_setting_values.cosmeticFiltering", + {brave_syncable_prefs_ids:: + kProfileDefaultContentSettingValuesCosmeticFiltering, + syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, + sync_preferences::MergeBehavior::kNone}}, + {"profile.default_content_setting_values.fingerprintingV2", + {brave_syncable_prefs_ids:: + kProfileDefaultContentSettingValuesFingerprintingV2, + syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, + sync_preferences::MergeBehavior::kNone}}, + {"profile.default_content_setting_values.httpUpgradableResources", + {brave_syncable_prefs_ids:: + kProfileDefaultContentSettingValuesHttpUpgradableResources, + syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, + sync_preferences::MergeBehavior::kNone}}, + {"profile.default_content_setting_values.httpsUpgrades", + {brave_syncable_prefs_ids:: + kProfileDefaultContentSettingValuesHttpsUpgrades, + syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, + sync_preferences::MergeBehavior::kNone}}, + {"profile.default_content_setting_values.referrers", + {brave_syncable_prefs_ids:: + kProfileDefaultContentSettingValuesReferrers, + syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, + sync_preferences::MergeBehavior::kNone}}, + {"profile.default_content_setting_values.shieldsAds", + {brave_syncable_prefs_ids:: + kProfileDefaultContentSettingValuesShieldsAds, + syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, + sync_preferences::MergeBehavior::kNone}}, + {"profile.default_content_setting_values.shieldsCookiesV3", + {brave_syncable_prefs_ids:: + kProfileDefaultContentSettingValuesShieldsCookiesV3, + syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, + sync_preferences::MergeBehavior::kNone}}, + {"profile.default_content_setting_values.trackers", + {brave_syncable_prefs_ids:: + kProfileDefaultContentSettingValuesTrackers, + syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone, + sync_preferences::MergeBehavior::kNone}}, + }); return kBraveSyncablePrefsAllowList; } } // namespace diff --git a/chromium_src/chrome/browser/ui/android/hats/hats_service_android.cc b/chromium_src/chrome/browser/ui/android/hats/hats_service_android.cc new file mode 100644 index 000000000000..9d341a7a66d0 --- /dev/null +++ b/chromium_src/chrome/browser/ui/android/hats/hats_service_android.cc @@ -0,0 +1,19 @@ +/* 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 https://mozilla.org/MPL/2.0/. */ + +#include "chrome/browser/ui/android/hats/hats_service_android.h" + +#define HatsServiceAndroid HatsServiceAndroid_ChromiumImpl +#include "src/chrome/browser/ui/android/hats/hats_service_android.cc" +#undef HatsServiceAndroid + +HatsServiceAndroid::HatsServiceAndroid(Profile* profile) + : HatsServiceAndroid_ChromiumImpl(profile) {} + +HatsServiceAndroid::~HatsServiceAndroid() = default; + +bool HatsServiceAndroid::CanShowSurvey(const std::string& trigger) const { + return false; +} diff --git a/chromium_src/chrome/browser/ui/android/hats/hats_service_android.h b/chromium_src/chrome/browser/ui/android/hats/hats_service_android.h new file mode 100644 index 000000000000..61ea298b648a --- /dev/null +++ b/chromium_src/chrome/browser/ui/android/hats/hats_service_android.h @@ -0,0 +1,24 @@ +/* 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 https://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_ANDROID_HATS_HATS_SERVICE_ANDROID_H_ +#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_ANDROID_HATS_HATS_SERVICE_ANDROID_H_ + +#define HatsServiceAndroid HatsServiceAndroid_ChromiumImpl +#include "src/chrome/browser/ui/android/hats/hats_service_android.h" // IWYU pragma: export +#undef HatsServiceAndroid + +class HatsServiceAndroid : public HatsServiceAndroid_ChromiumImpl { + public: + explicit HatsServiceAndroid(Profile* profile); + HatsServiceAndroid(const HatsServiceAndroid&) = delete; + HatsServiceAndroid& operator=(const HatsServiceAndroid&) = delete; + + ~HatsServiceAndroid() override; + + bool CanShowSurvey(const std::string& trigger) const override; +}; + +#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_ANDROID_HATS_HATS_SERVICE_ANDROID_H_ diff --git a/chromium_src/chrome/browser/ui/autofill/autofill_context_menu_manager.cc b/chromium_src/chrome/browser/ui/autofill/autofill_context_menu_manager.cc new file mode 100644 index 000000000000..4b4798d9c8fe --- /dev/null +++ b/chromium_src/chrome/browser/ui/autofill/autofill_context_menu_manager.cc @@ -0,0 +1,29 @@ +// 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 "chrome/browser/ui/autofill/autofill_context_menu_manager.h" + +#define AppendItems AppendItems_ChromiumImpl +#include "src/chrome/browser/ui/autofill/autofill_context_menu_manager.cc" +#undef AppendItems + +namespace autofill { + +void AutofillContextMenuManager::AppendItems() { + AppendItems_ChromiumImpl(); + + // Remove feedback menu item if present (and the separator that comes after + // it). + const std::optional feedback_item_index = + menu_model_->GetIndexOfCommandId(IDC_CONTENT_CONTEXT_AUTOFILL_FEEDBACK); + if (feedback_item_index.has_value()) { + menu_model_->RemoveItemAt(feedback_item_index.value()); + DCHECK_EQ(ui::MenuModel::TYPE_SEPARATOR, + menu_model_->GetTypeAt(feedback_item_index.value())); + menu_model_->RemoveItemAt(feedback_item_index.value()); + } +} + +} // namespace autofill diff --git a/chromium_src/chrome/browser/ui/autofill/autofill_context_menu_manager.h b/chromium_src/chrome/browser/ui/autofill/autofill_context_menu_manager.h new file mode 100644 index 000000000000..80dc21a71365 --- /dev/null +++ b/chromium_src/chrome/browser/ui/autofill/autofill_context_menu_manager.h @@ -0,0 +1,16 @@ +// 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/. + +#ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_CONTEXT_MENU_MANAGER_H_ +#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_CONTEXT_MENU_MANAGER_H_ + +#define AppendItems \ + AppendItems_ChromiumImpl(); \ + void AppendItems + +#include "src/chrome/browser/ui/autofill/autofill_context_menu_manager.h" // IWYU pragma: export +#undef AppendItems + +#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_CONTEXT_MENU_MANAGER_H_ diff --git a/chromium_src/chrome/browser/ui/hats/hats_service.cc b/chromium_src/chrome/browser/ui/hats/hats_service.cc deleted file mode 100644 index 4ea0c61c6ae4..000000000000 --- a/chromium_src/chrome/browser/ui/hats/hats_service.cc +++ /dev/null @@ -1,19 +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 "chrome/browser/ui/hats/hats_service.h" - -#define HatsService HatsService_ChromiumImpl -#include "src/chrome/browser/ui/hats/hats_service.cc" -#undef HatsService - -HatsService::HatsService(Profile* profile) - : HatsService_ChromiumImpl(profile) {} - -HatsService::~HatsService() = default; - -bool HatsService::CanShowSurvey(const std::string& trigger) const { - return false; -} diff --git a/chromium_src/chrome/browser/ui/hats/hats_service.h b/chromium_src/chrome/browser/ui/hats/hats_service.h deleted file mode 100644 index 06e7fbd55152..000000000000 --- a/chromium_src/chrome/browser/ui/hats/hats_service.h +++ /dev/null @@ -1,26 +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_CHROME_BROWSER_UI_HATS_HATS_SERVICE_H_ -#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_HATS_HATS_SERVICE_H_ - -#define HatsService HatsService_ChromiumImpl -#define CanShowSurvey virtual CanShowSurvey -#include "src/chrome/browser/ui/hats/hats_service.h" // IWYU pragma: export -#undef CanShowSurvey -#undef HatsService - -class HatsService : public HatsService_ChromiumImpl { - public: - explicit HatsService(Profile* profile); - HatsService(const HatsService&) = delete; - HatsService& operator=(const HatsService&) = delete; - - ~HatsService() override; - - bool CanShowSurvey(const std::string& trigger) const override; -}; - -#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_HATS_HATS_SERVICE_H_ diff --git a/chromium_src/chrome/browser/ui/hats/hats_service_browsertest.cc b/chromium_src/chrome/browser/ui/hats/hats_service_browsertest.cc index 0699205b87a0..50967ae020a6 100644 --- a/chromium_src/chrome/browser/ui/hats/hats_service_browsertest.cc +++ b/chromium_src/chrome/browser/ui/hats/hats_service_browsertest.cc @@ -3,6 +3,10 @@ * 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/hats/hats_service.h" + +#include + #include "base/metrics/field_trial_params.h" #include "base/test/scoped_feature_list.h" #include "base/time/time.h" @@ -10,7 +14,7 @@ #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" #include "chrome/browser/profiles/profile_impl.h" #include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/hats/hats_service.h" +#include "chrome/browser/ui/hats/hats_service_desktop.h" #include "chrome/browser/ui/hats/hats_service_factory.h" #include "chrome/common/chrome_features.h" #include "chrome/test/base/in_process_browser_test.h" @@ -18,7 +22,6 @@ #include "components/metrics_services_manager/metrics_services_manager.h" #include "content/public/test/browser_test.h" #include "net/dns/mock_host_resolver.h" -#include "third_party/abseil-cpp/absl/types/optional.h" // Simplified version of the upstream tests modified to reflect the change in // the HatsService chromium_src override. @@ -63,10 +66,9 @@ class HatsServiceBrowserTestBase : public InProcessBrowserTest { ~HatsServiceBrowserTestBase() override = default; - HatsService* GetHatsService() { - HatsService* service = - HatsServiceFactory::GetForProfile(browser()->profile(), true); - return service; + HatsServiceDesktop* GetHatsService() { + return static_cast( + HatsServiceFactory::GetForProfile(browser()->profile(), true)); } void SetMetricsConsent(bool consent) { @@ -78,7 +80,7 @@ class HatsServiceBrowserTestBase : public InProcessBrowserTest { } private: - absl::optional scoped_metrics_consent_; + std::optional scoped_metrics_consent_; base::test::ScopedFeatureList scoped_feature_list_; }; diff --git a/chromium_src/chrome/browser/ui/hats/hats_service_desktop.cc b/chromium_src/chrome/browser/ui/hats/hats_service_desktop.cc new file mode 100644 index 000000000000..62f1089358aa --- /dev/null +++ b/chromium_src/chrome/browser/ui/hats/hats_service_desktop.cc @@ -0,0 +1,19 @@ +/* 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 https://mozilla.org/MPL/2.0/. */ + +#include "chrome/browser/ui/hats/hats_service_desktop.h" + +#define HatsServiceDesktop HatsServiceDesktop_ChromiumImpl +#include "src/chrome/browser/ui/hats/hats_service_desktop.cc" +#undef HatsServiceDesktop + +HatsServiceDesktop::HatsServiceDesktop(Profile* profile) + : HatsServiceDesktop_ChromiumImpl(profile) {} + +HatsServiceDesktop::~HatsServiceDesktop() = default; + +bool HatsServiceDesktop::CanShowSurvey(const std::string& trigger) const { + return false; +} diff --git a/chromium_src/chrome/browser/ui/hats/hats_service_desktop.h b/chromium_src/chrome/browser/ui/hats/hats_service_desktop.h new file mode 100644 index 000000000000..dfa14bf8e444 --- /dev/null +++ b/chromium_src/chrome/browser/ui/hats/hats_service_desktop.h @@ -0,0 +1,24 @@ +/* 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 https://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_HATS_HATS_SERVICE_DESKTOP_H_ +#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_HATS_HATS_SERVICE_DESKTOP_H_ + +#define HatsServiceDesktop HatsServiceDesktop_ChromiumImpl +#include "src/chrome/browser/ui/hats/hats_service_desktop.h" // IWYU pragma: export +#undef HatsServiceDesktop + +class HatsServiceDesktop : public HatsServiceDesktop_ChromiumImpl { + public: + explicit HatsServiceDesktop(Profile* profile); + HatsServiceDesktop(const HatsServiceDesktop&) = delete; + HatsServiceDesktop& operator=(const HatsServiceDesktop&) = delete; + + ~HatsServiceDesktop() override; + + bool CanShowSurvey(const std::string& trigger) const override; +}; + +#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_HATS_HATS_SERVICE_DESKTOP_H_ diff --git a/chromium_src/chrome/browser/ui/tabs/tab_renderer_data.cc b/chromium_src/chrome/browser/ui/tabs/tab_renderer_data.cc index 6f5def81e3a9..100c5f2a7b00 100644 --- a/chromium_src/chrome/browser/ui/tabs/tab_renderer_data.cc +++ b/chromium_src/chrome/browser/ui/tabs/tab_renderer_data.cc @@ -15,12 +15,12 @@ #include "brave/components/constants/webui_url_constants.h" #include "url/gurl.h" -TabRendererData TabRendererData::FromTabInModel(TabStripModel* model, +TabRendererData TabRendererData::FromTabInModel(const TabStripModel* model, int index) { if (base::FeatureList::IsEnabled(tabs::features::kBraveSharedPinnedTabs)) { if (index < model->IndexOfFirstNonPinnedTab()) { auto* shared_pinned_tab_service = - SharedPinnedTabServiceFactory::GetForProfile(model->GetProfile()); + SharedPinnedTabServiceFactory::GetForProfile(model->profile()); DCHECK(shared_pinned_tab_service); auto* contents = model->GetWebContentsAt(index); diff --git a/chromium_src/chrome/browser/ui/tabs/tab_renderer_data.h b/chromium_src/chrome/browser/ui/tabs/tab_renderer_data.h index 2a217b1d8559..2ef9e22bbbf1 100644 --- a/chromium_src/chrome/browser/ui/tabs/tab_renderer_data.h +++ b/chromium_src/chrome/browser/ui/tabs/tab_renderer_data.h @@ -6,8 +6,8 @@ #ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_TABS_TAB_RENDERER_DATA_H_ #define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_TABS_TAB_RENDERER_DATA_H_ -#define FromTabInModel \ - FromTabInModel_ChromiumImpl(TabStripModel* model, int index); \ +#define FromTabInModel \ + FromTabInModel_ChromiumImpl(const TabStripModel* model, int index); \ static TabRendererData FromTabInModel #include "src/chrome/browser/ui/tabs/tab_renderer_data.h" // IWYU pragma: export diff --git a/chromium_src/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model_unittest.cc b/chromium_src/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model_unittest.cc index cee069856913..f1dc32b31aa4 100644 --- a/chromium_src/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model_unittest.cc +++ b/chromium_src/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model_unittest.cc @@ -20,6 +20,21 @@ #define RecentlyClosedGroupsFromCurrentSession \ DISABLED_RecentlyClosedGroupsFromCurrentSession +// Disabling these tests because they reference items in menu explicitly by +// index which doesn't match our menu since we insert an additional "Clear +// browsing data" item ahead of the entries of interest to the test. +#define MaxSessionsAndRecency DISABLED_MaxSessionsAndRecency + +// Disabling these tests because our "More..." item doesn't match the test's +// expectation of the tab name. +#define MaxTabsPerSessionAndRecency DISABLED_MaxTabsPerSessionAndRecency + +// Disabling this because we have refresh disabled, but it fails because +// ExtensionWebContentsObserver::GetForWebContents returns nullptr and makes +// the test crash. +#define RecentlyClosedTabsAndWindowsFromLastSessionWithRefresh \ + DISABLED_RecentlyClosedTabsAndWindowsFromLastSessionWithRefresh + #define BRAVE_RECENT_TABS_SUB_MENU_MODEL_TEST \ void VerifyModel(const RecentTabsSubMenuModel& model, \ base::span data); \ @@ -33,6 +48,9 @@ #undef BRAVE_RECENT_TABS_SUB_MENU_MODEL_TEST +#undef RecentlyClosedTabsAndWindowsFromLastSessionWithRefresh +#undef MaxTabsPerSessionAndRecency +#undef MaxSessionsAndRecency #undef RecentlyClosedTabsAndWindowsFromLastSession #undef RecentlyClosedTabsFromCurrentSession #undef RecentlyClosedGroupsFromCurrentSession @@ -45,11 +63,6 @@ void RecentTabsSubMenuModelTest::VerifyModel( base::span data) { std::vector v_data{data.begin(), data.end()}; v_data.insert(v_data.begin() + 1, {ui::MenuModel::TYPE_COMMAND, true}); - const std::string_view test_name = - testing::UnitTest::GetInstance()->current_test_info()->name(); - if (base::StartsWith(test_name, "MaxTabsPerSessionAndRecency/")) { - v_data.push_back({ui::MenuModel::TYPE_COMMAND, true}); - } ::VerifyModel(model, base::make_span(v_data.begin(), v_data.size())); } diff --git a/chromium_src/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.cc b/chromium_src/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.cc index 2c57c4cbba77..773b79d4dfd4 100644 --- a/chromium_src/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.cc +++ b/chromium_src/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.cc @@ -8,6 +8,7 @@ #include "base/ranges/algorithm.h" #include "brave/browser/ui/color/brave_color_id.h" #include "components/vector_icons/vector_icons.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/gfx/geometry/skia_conversions.h" namespace gfx { @@ -110,3 +111,6 @@ bool DownloadToolbarButtonView::HasInsecureDownloads() { download::DownloadItem::InsecureDownloadStatus::WARN); }); } + +BEGIN_METADATA(DownloadToolbarButtonView) +END_METADATA diff --git a/chromium_src/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.h b/chromium_src/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.h index ffb5a0c8f6c0..09387fa98733 100644 --- a/chromium_src/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.h +++ b/chromium_src/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.h @@ -10,6 +10,7 @@ #include "chrome/browser/download/bubble/download_display_controller.h" #include "chrome/browser/download/download_ui_model.h" #include "chrome/browser/ui/views/toolbar/toolbar_button.h" +#include "ui/base/metadata/metadata_header_macros.h" #define DownloadToolbarButtonView DownloadToolbarButtonViewChromium #define PaintButtonContents \ @@ -27,6 +28,7 @@ #undef DownloadToolbarButtonView class DownloadToolbarButtonView : public DownloadToolbarButtonViewChromium { + METADATA_HEADER(DownloadToolbarButtonView, DownloadToolbarButtonViewChromium) public: using DownloadToolbarButtonViewChromium::DownloadToolbarButtonViewChromium; diff --git a/chromium_src/chrome/browser/ui/views/download/download_shelf_context_menu_view.cc b/chromium_src/chrome/browser/ui/views/download/download_shelf_context_menu_view.cc index 37ff2a80f974..70c08343002c 100644 --- a/chromium_src/chrome/browser/ui/views/download/download_shelf_context_menu_view.cc +++ b/chromium_src/chrome/browser/ui/views/download/download_shelf_context_menu_view.cc @@ -26,8 +26,7 @@ ui::SimpleMenuModel* DownloadShelfContextMenuView::GetMenuModel() { } // Only add "Remove item from list" entry to download bubble. - if (!download::IsDownloadBubbleEnabled( - ProfileManager::GetLastUsedProfile())) { + if (!download::IsDownloadBubbleEnabled()) { return model; } diff --git a/chromium_src/chrome/browser/ui/views/frame/browser_caption_button_container_win.cc b/chromium_src/chrome/browser/ui/views/frame/browser_caption_button_container_win.cc index 6b90c21e2665..d122a419cce5 100644 --- a/chromium_src/chrome/browser/ui/views/frame/browser_caption_button_container_win.cc +++ b/chromium_src/chrome/browser/ui/views/frame/browser_caption_button_container_win.cc @@ -8,6 +8,7 @@ #include "brave/components/constants/pref_names.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/views/tab_search_bubble_host.h" +#include "ui/base/metadata/metadata_impl_macros.h" #define BrowserCaptionButtonContainer BrowserCaptionButtonContainer_ChromiumImpl @@ -51,3 +52,6 @@ void BrowserCaptionButtonContainer::UpdateSearchTabsButtonState() { button->SetVisible(is_tab_search_visible); } } + +BEGIN_METADATA(BrowserCaptionButtonContainer) +END_METADATA diff --git a/chromium_src/chrome/browser/ui/views/frame/browser_caption_button_container_win.h b/chromium_src/chrome/browser/ui/views/frame/browser_caption_button_container_win.h index 11098b37ef1f..6c1da346b4b1 100644 --- a/chromium_src/chrome/browser/ui/views/frame/browser_caption_button_container_win.h +++ b/chromium_src/chrome/browser/ui/views/frame/browser_caption_button_container_win.h @@ -9,6 +9,7 @@ #include #include "components/prefs/pref_change_registrar.h" +#include "ui/base/metadata/metadata_header_macros.h" #define BrowserCaptionButtonContainer BrowserCaptionButtonContainer_ChromiumImpl @@ -17,6 +18,8 @@ class BrowserCaptionButtonContainer : public BrowserCaptionButtonContainer_ChromiumImpl { + METADATA_HEADER(BrowserCaptionButtonContainer, + BrowserCaptionButtonContainer_ChromiumImpl) public: explicit BrowserCaptionButtonContainer(BrowserFrameViewWin* frame_view); ~BrowserCaptionButtonContainer() override; diff --git a/chromium_src/chrome/browser/ui/views/permissions/permission_prompt_bubble_base_view.cc b/chromium_src/chrome/browser/ui/views/permissions/permission_prompt_bubble_base_view.cc index 6c6b3ee78f62..1516af775471 100644 --- a/chromium_src/chrome/browser/ui/views/permissions/permission_prompt_bubble_base_view.cc +++ b/chromium_src/chrome/browser/ui/views/permissions/permission_prompt_bubble_base_view.cc @@ -17,6 +17,7 @@ #include "brave/grit/brave_generated_resources.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_tabstrip.h" +#include "chrome/browser/ui/chrome_pages.h" #include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/common/webui_url_constants.h" #include "chrome/grit/generated_resources.h" @@ -27,6 +28,8 @@ #include "components/permissions/request_type.h" #include "components/strings/grit/components_strings.h" #include "third_party/widevine/cdm/buildflags.h" +#include "ui/base/metadata/metadata_header_macros.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/base/models/combobox_model.h" #include "ui/gfx/text_constants.h" #include "ui/views/bubble/bubble_dialog_delegate_view.h" @@ -47,6 +50,7 @@ namespace { #if BUILDFLAG(ENABLE_WIDEVINE) class DontAskAgainCheckbox : public views::Checkbox { + METADATA_HEADER(DontAskAgainCheckbox, views::Checkbox) public: explicit DontAskAgainCheckbox(WidevinePermissionRequest* request); DontAskAgainCheckbox(const DontAskAgainCheckbox&) = delete; @@ -58,6 +62,9 @@ class DontAskAgainCheckbox : public views::Checkbox { raw_ptr request_ = nullptr; }; +BEGIN_METADATA(DontAskAgainCheckbox) +END_METADATA + DontAskAgainCheckbox::DontAskAgainCheckbox(WidevinePermissionRequest* request) : views::Checkbox(brave_l10n::GetLocalizedResourceUTF16String( IDS_WIDEVINE_DONT_ASK_AGAIN_CHECKBOX), @@ -121,6 +128,7 @@ void AddAdditionalWidevineViewControlsIfNeeded( // to all permissions currently visible in the bubble. class PermissionLifetimeCombobox : public views::Combobox, public ui::ComboboxModel { + METADATA_HEADER(PermissionLifetimeCombobox, views::Combobox) public: explicit PermissionLifetimeCombobox( views::BubbleDialogDelegateView& dialog_delegate_view, @@ -163,6 +171,9 @@ class PermissionLifetimeCombobox : public views::Combobox, std::vector lifetime_options_; }; +BEGIN_METADATA(PermissionLifetimeCombobox) +END_METADATA + views::View* AddPermissionLifetimeComboboxIfNeeded( views::BubbleDialogDelegateView* dialog_delegate_view, permissions::PermissionPrompt::Delegate* delegate) { @@ -221,8 +232,9 @@ void AddFootnoteViewIfNeeded( brave_l10n::GetLocalizedResourceUTF16String( IDS_PERMISSIONS_BUBBLE_SITE_PERMISSION_LINK), brave_l10n::GetLocalizedResourceUTF16String(IDS_LEARN_MORE)}; - const std::vector urls{GURL(chrome::kChromeUIContentSettingsURL), - GURL(kPermissionPromptLearnMoreUrl)}; + const std::vector urls{ + chrome::GetSettingsUrl(chrome::kContentSettingsSubPage), + GURL(kPermissionPromptLearnMoreUrl)}; dialog_delegate_view->SetFootnoteView( views::CreateStyledLabelForDialogFootnote(browser, footnote, replacements, diff --git a/chromium_src/chrome/browser/ui/views/tabs/alert_indicator_button.cc b/chromium_src/chrome/browser/ui/views/tabs/alert_indicator_button.cc index dd13a529f940..9b59438d8ef0 100644 --- a/chromium_src/chrome/browser/ui/views/tabs/alert_indicator_button.cc +++ b/chromium_src/chrome/browser/ui/views/tabs/alert_indicator_button.cc @@ -11,6 +11,7 @@ #include "chrome/browser/ui/views/tabs/tab.h" #include "chrome/browser/ui/views/tabs/tab_slot_controller.h" #include "components/prefs/pref_service.h" +#include "ui/base/metadata/metadata_impl_macros.h" #define AlertIndicatorButton AlertIndicatorButtonBase @@ -35,3 +36,6 @@ void AlertIndicatorButton::UpdateEnabledForMuteToggle() { } AlertIndicatorButtonBase::UpdateEnabledForMuteToggle(); } + +BEGIN_METADATA(AlertIndicatorButton) +END_METADATA diff --git a/chromium_src/chrome/browser/ui/views/tabs/alert_indicator_button.h b/chromium_src/chrome/browser/ui/views/tabs/alert_indicator_button.h index c5749b958f8d..375f623c56fd 100644 --- a/chromium_src/chrome/browser/ui/views/tabs/alert_indicator_button.h +++ b/chromium_src/chrome/browser/ui/views/tabs/alert_indicator_button.h @@ -6,6 +6,8 @@ #ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_VIEWS_TABS_ALERT_INDICATOR_BUTTON_H_ #define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_VIEWS_TABS_ALERT_INDICATOR_BUTTON_H_ +#include "ui/base/metadata/metadata_header_macros.h" + class AlertIndicatorButton; #define AlertIndicatorButton AlertIndicatorButtonBase #define GetTab \ @@ -21,6 +23,7 @@ class AlertIndicatorButton; #undef AlertIndicatorButton class AlertIndicatorButton : public AlertIndicatorButtonBase { + METADATA_HEADER(AlertIndicatorButton, AlertIndicatorButtonBase) public: using AlertIndicatorButtonBase::AlertIndicatorButtonBase; void UpdateEnabledForMuteToggle() override; diff --git a/chromium_src/chrome/browser/ui/views/toolbar/side_panel_toolbar_button.cc b/chromium_src/chrome/browser/ui/views/toolbar/side_panel_toolbar_button.cc index 2e15433d2d35..ffbed8678a08 100644 --- a/chromium_src/chrome/browser/ui/views/toolbar/side_panel_toolbar_button.cc +++ b/chromium_src/chrome/browser/ui/views/toolbar/side_panel_toolbar_button.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/views/toolbar/side_panel_toolbar_button.h" + #include #include "base/memory/raw_ptr.h" @@ -11,10 +13,10 @@ #include "brave/grit/brave_generated_resources.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/views/toolbar/side_panel_toolbar_button.h" #include "chrome/browser/ui/views/toolbar/toolbar_button.h" #include "chrome/common/pref_names.h" #include "components/prefs/pref_service.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/base/models/simple_menu_model.h" #include "ui/views/context_menu_controller.h" @@ -76,3 +78,6 @@ void SidePanelToolbarButton::UpdateButtonImage() { SetVectorIcon(sidebar_alignment_.GetValue() ? kSidebarToolbarButtonRightIcon : kSidebarToolbarButtonIcon); } + +BEGIN_METADATA(SidePanelToolbarButton) +END_METADATA diff --git a/chromium_src/chrome/browser/ui/views/toolbar/side_panel_toolbar_button.h b/chromium_src/chrome/browser/ui/views/toolbar/side_panel_toolbar_button.h index 7014057f077e..8ffc9da8bfeb 100644 --- a/chromium_src/chrome/browser/ui/views/toolbar/side_panel_toolbar_button.h +++ b/chromium_src/chrome/browser/ui/views/toolbar/side_panel_toolbar_button.h @@ -7,6 +7,7 @@ #define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_VIEWS_TOOLBAR_SIDE_PANEL_TOOLBAR_BUTTON_H_ #include "components/prefs/pref_member.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/base/models/simple_menu_model.h" #define SidePanelToolbarButton SidePanelToolbarButton_ChromiumImpl @@ -16,6 +17,7 @@ #undef SidePanelToolbarButton class SidePanelToolbarButton : public SidePanelToolbarButton_ChromiumImpl { + METADATA_HEADER(SidePanelToolbarButton, SidePanelToolbarButton_ChromiumImpl) public: explicit SidePanelToolbarButton(Browser* browser); diff --git a/chromium_src/chrome/browser/ui/views/toolbar/toolbar_button.cc b/chromium_src/chrome/browser/ui/views/toolbar/toolbar_button.cc index a76da12b14e1..93bc6f1c826e 100644 --- a/chromium_src/chrome/browser/ui/views/toolbar/toolbar_button.cc +++ b/chromium_src/chrome/browser/ui/views/toolbar/toolbar_button.cc @@ -32,7 +32,9 @@ const gfx::VectorIcon& ToolbarButton_ChromiumImpl::GetVectorTouchIcon() const { return vector_icons_->touch_icon; } -ToolbarButton::~ToolbarButton() = default; +ToolbarButton::~ToolbarButton() { + views::InkDrop::Get(this)->GetInkDrop()->RemoveObserver(this); +} void ToolbarButton::OnThemeChanged() { ToolbarButton_ChromiumImpl::OnThemeChanged(); @@ -75,5 +77,5 @@ void ToolbarButton::OnInkDropStateChanged(views::InkDropState state) { } } -BEGIN_METADATA(ToolbarButton, ToolbarButton_ChromiumImpl) +BEGIN_METADATA(ToolbarButton) END_METADATA diff --git a/chromium_src/chrome/browser/ui/views/toolbar/toolbar_button.h b/chromium_src/chrome/browser/ui/views/toolbar/toolbar_button.h index 042e48fca221..56afdc5be390 100644 --- a/chromium_src/chrome/browser/ui/views/toolbar/toolbar_button.h +++ b/chromium_src/chrome/browser/ui/views/toolbar/toolbar_button.h @@ -24,9 +24,9 @@ class ToolbarButton : public ToolbarButton_ChromiumImpl, public views::InkDropObserver { - public: - METADATA_HEADER(ToolbarButton); + METADATA_HEADER(ToolbarButton, ToolbarButton_ChromiumImpl) + public: using ToolbarButton_ChromiumImpl::ToolbarButton_ChromiumImpl; ~ToolbarButton() override; diff --git a/chromium_src/chrome/browser/ui/webui/about_ui.cc b/chromium_src/chrome/browser/ui/webui/about/about_ui.cc similarity index 87% rename from chromium_src/chrome/browser/ui/webui/about_ui.cc rename to chromium_src/chrome/browser/ui/webui/about/about_ui.cc index f8f437a00d37..d3ee5278ee2c 100644 --- a/chromium_src/chrome/browser/ui/webui/about_ui.cc +++ b/chromium_src/chrome/browser/ui/webui/about/about_ui.cc @@ -1,7 +1,7 @@ /* 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/. */ + * You can obtain one at https://mozilla.org/MPL/2.0/. */ #include @@ -9,10 +9,11 @@ #include "base/strings/string_split.h" #include "third_party/re2/src/re2/re2.h" -#include "src/chrome/browser/ui/webui/about_ui.cc" +#include "src/chrome/browser/ui/webui/about/about_ui.cc" -std::string AboutUIHTMLSource::ChromeURLs() const { - std::string chrome_urls = ::ChromeURLs(); +std::string AboutUIHTMLSource::ChromeURLs( + content::BrowserContext* browser_context) const { + std::string chrome_urls = ::ChromeURLs(browser_context); // Replace Chrome -> Brave. const std::string chrome_header = "Chrome URLs"; diff --git a/chromium_src/chrome/browser/ui/webui/about/about_ui.h b/chromium_src/chrome/browser/ui/webui/about/about_ui.h new file mode 100644 index 000000000000..c2162da8f660 --- /dev/null +++ b/chromium_src/chrome/browser/ui/webui/about/about_ui.h @@ -0,0 +1,22 @@ +/* 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 https://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_WEBUI_ABOUT_ABOUT_UI_H_ +#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_WEBUI_ABOUT_ABOUT_UI_H_ + +namespace content { +class BrowserContext; +} // namespace content + +#define FinishDataRequest \ + NotUsed() {} \ + std::string ChromeURLs(content::BrowserContext* browser_context) const; \ + void FinishDataRequest + +#include "src/chrome/browser/ui/webui/about/about_ui.h" // IWYU pragma: export + +#undef FinishDataRequest + +#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_WEBUI_ABOUT_ABOUT_UI_H_ diff --git a/chromium_src/chrome/browser/ui/webui/about_ui.h b/chromium_src/chrome/browser/ui/webui/about_ui.h deleted file mode 100644 index 6759e3b85457..000000000000 --- a/chromium_src/chrome/browser/ui/webui/about_ui.h +++ /dev/null @@ -1,18 +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_CHROME_BROWSER_UI_WEBUI_ABOUT_UI_H_ -#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_WEBUI_ABOUT_UI_H_ - -#define FinishDataRequest \ - NotUsed() {} \ - std::string ChromeURLs() const; \ - void FinishDataRequest - -#include "src/chrome/browser/ui/webui/about_ui.h" // IWYU pragma: export - -#undef FinishDataRequest - -#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_WEBUI_ABOUT_UI_H_ diff --git a/chromium_src/chrome/common/chrome_features.cc b/chromium_src/chrome/common/chrome_features.cc index 92734cf85b10..20d5d33fb072 100644 --- a/chromium_src/chrome/common/chrome_features.cc +++ b/chromium_src/chrome/common/chrome_features.cc @@ -17,6 +17,9 @@ OVERRIDE_FEATURE_DEFAULT_STATES({{ {kKAnonymityService, base::FEATURE_DISABLED_BY_DEFAULT}, {kKAnonymityServiceOHTTPRequests, base::FEATURE_DISABLED_BY_DEFAULT}, {kPrivacyGuide3, base::FEATURE_DISABLED_BY_DEFAULT}, +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) + {kDesktopPWAsLinkCapturing, base::FEATURE_DISABLED_BY_DEFAULT}, +#endif #if BUILDFLAG(IS_ANDROID) {kPrivacyGuideAndroid, base::FEATURE_DISABLED_BY_DEFAULT}, {kPrivacyGuideAndroidPostMVP, base::FEATURE_DISABLED_BY_DEFAULT}, diff --git a/chromium_src/chrome/common/companion/visual_search/features.cc b/chromium_src/chrome/common/companion/visual_query/features.cc similarity index 57% rename from chromium_src/chrome/common/companion/visual_search/features.cc rename to chromium_src/chrome/common/companion/visual_query/features.cc index 11d763a14047..15aca1776ecb 100644 --- a/chromium_src/chrome/common/companion/visual_search/features.cc +++ b/chromium_src/chrome/common/companion/visual_query/features.cc @@ -3,16 +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 "src/chrome/common/companion/visual_search/features.cc" +#include "src/chrome/common/companion/visual_query/features.cc" #include "base/feature_override.h" -namespace companion::visual_search { -namespace features { +namespace companion::visual_query::features { OVERRIDE_FEATURE_DEFAULT_STATES({{ - {kVisualSearchSuggestions, base::FEATURE_DISABLED_BY_DEFAULT}, + {kVisualQuerySuggestions, base::FEATURE_DISABLED_BY_DEFAULT}, }}); -} // namespace features -} // namespace companion::visual_search +} // namespace companion::visual_query::features diff --git a/chromium_src/chrome/renderer/worker_content_settings_client.cc b/chromium_src/chrome/renderer/worker_content_settings_client.cc index d54d47fb47da..3e81ccf285e1 100644 --- a/chromium_src/chrome/renderer/worker_content_settings_client.cc +++ b/chromium_src/chrome/renderer/worker_content_settings_client.cc @@ -60,7 +60,7 @@ WorkerContentSettingsClient::GetEphemeralStorageOriginSync() { absl::optional optional_ephemeral_storage_origin; content_settings_manager_->AllowEphemeralStorageAccess( - render_frame_id_, document_origin_, site_for_cookies_, top_frame_origin_, + frame_token_, document_origin_, site_for_cookies_, top_frame_origin_, &optional_ephemeral_storage_origin); // Don't cache the value intentionally as other WorkerContentSettingsClient // methods do. diff --git a/chromium_src/components/attribution_reporting/features.cc b/chromium_src/components/attribution_reporting/features.cc index b00db9d11c17..97af50f467c9 100644 --- a/chromium_src/components/attribution_reporting/features.cc +++ b/chromium_src/components/attribution_reporting/features.cc @@ -11,6 +11,7 @@ namespace attribution_reporting::features { OVERRIDE_FEATURE_DEFAULT_STATES({{ {kAttributionReportingTriggerConfig, base::FEATURE_DISABLED_BY_DEFAULT}, + {kAttributionReportingTriggerContextId, base::FEATURE_DISABLED_BY_DEFAULT}, {kConversionMeasurement, base::FEATURE_DISABLED_BY_DEFAULT}, }}); diff --git a/chromium_src/components/autofill/core/browser/autofill_experiments_unittest.cc b/chromium_src/components/autofill/core/browser/autofill_experiments_unittest.cc index f4ac212ca618..4c40826aa02e 100644 --- a/chromium_src/components/autofill/core/browser/autofill_experiments_unittest.cc +++ b/chromium_src/components/autofill/core/browser/autofill_experiments_unittest.cc @@ -109,10 +109,7 @@ TEST_F(AutofillExperimentsTest, IsCardUploadEnabled_UserEmailWithGoogleDomain) { TEST_F(AutofillExperimentsTest, IsCardUploadEnabled_UserEmailWithNonGoogleDomainIfExperimentEnabled) { - scoped_feature_list_.InitWithFeatures( - {features::kAutofillUpstream, - features::kAutofillUpstreamAllowAllEmailDomains}, - {}); + scoped_feature_list_.InitWithFeatures({features::kAutofillUpstream}, {}); EXPECT_FALSE(IsCreditCardUploadEnabled( "cool.user@hotmail.com", AutofillMetrics::PaymentsSigninState::kSignedInAndSyncFeatureEnabled)); diff --git a/chromium_src/components/autofill/core/browser/autofill_field.cc b/chromium_src/components/autofill/core/browser/autofill_field.cc new file mode 100644 index 000000000000..43ae56fb56a1 --- /dev/null +++ b/chromium_src/components/autofill/core/browser/autofill_field.cc @@ -0,0 +1,17 @@ +// 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 "components/autofill/core/browser/autofill_field.h" + +#define AppendLogEventIfNotRepeated AppendLogEventIfNotRepeated_ChromiumImpl +#include "src/components/autofill/core/browser/autofill_field.cc" +#undef AppendLogEventIfNotRepeated + +namespace autofill { + +void AutofillField::AppendLogEventIfNotRepeated( + const FieldLogEventType& log_event) {} + +} // namespace autofill diff --git a/chromium_src/components/autofill/core/browser/autofill_field.h b/chromium_src/components/autofill/core/browser/autofill_field.h new file mode 100644 index 000000000000..07fcc79dad4f --- /dev/null +++ b/chromium_src/components/autofill/core/browser/autofill_field.h @@ -0,0 +1,17 @@ +// 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/. + +#ifndef BRAVE_CHROMIUM_SRC_COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_FIELD_H_ +#define BRAVE_CHROMIUM_SRC_COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_FIELD_H_ + +#define AppendLogEventIfNotRepeated \ + AppendLogEventIfNotRepeated_ChromiumImpl( \ + const FieldLogEventType& log_event); \ + void AppendLogEventIfNotRepeated + +#include "src/components/autofill/core/browser/autofill_field.h" // IWYU pragma: export +#undef AppendLogEventIfNotRepeated + +#endif // BRAVE_CHROMIUM_SRC_COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_FIELD_H_ diff --git a/chromium_src/components/autofill/core/common/autofill_payments_features.cc b/chromium_src/components/autofill/core/common/autofill_payments_features.cc index e9400d190e5f..64457d63a947 100644 --- a/chromium_src/components/autofill/core/common/autofill_payments_features.cc +++ b/chromium_src/components/autofill/core/common/autofill_payments_features.cc @@ -12,8 +12,6 @@ namespace features { OVERRIDE_FEATURE_DEFAULT_STATES({{ {kAutofillEnableRemadeDownstreamMetrics, base::FEATURE_DISABLED_BY_DEFAULT}, - {kAutofillUpstreamAllowAdditionalEmailDomains, - base::FEATURE_DISABLED_BY_DEFAULT}, }}); } // namespace features diff --git a/chromium_src/components/content_settings/browser/content_settings_manager_impl.cc b/chromium_src/components/content_settings/browser/content_settings_manager_impl.cc index e6eff5a95b9f..474177046be3 100644 --- a/chromium_src/components/content_settings/browser/content_settings_manager_impl.cc +++ b/chromium_src/components/content_settings/browser/content_settings_manager_impl.cc @@ -10,7 +10,7 @@ namespace content_settings { void ContentSettingsManagerImpl::AllowEphemeralStorageAccess( - int32_t render_frame_id, + const blink::LocalFrameToken& frame_token, const url::Origin& origin, const net::SiteForCookies& site_for_cookies, const url::Origin& top_frame_origin, diff --git a/chromium_src/components/content_settings/browser/content_settings_manager_impl.h b/chromium_src/components/content_settings/browser/content_settings_manager_impl.h index ac8e31bf4709..ec72299a7de4 100644 --- a/chromium_src/components/content_settings/browser/content_settings_manager_impl.h +++ b/chromium_src/components/content_settings/browser/content_settings_manager_impl.h @@ -9,13 +9,13 @@ #include "base/containers/flat_map.h" #include "components/content_settings/common/content_settings_manager.mojom.h" -#define OnContentBlocked \ - NotUsed() {} \ - void AllowEphemeralStorageAccess( \ - int32_t render_frame_id, const url::Origin& origin, \ - const net::SiteForCookies& site_for_cookies, \ - const url::Origin& top_frame_origin, \ - AllowEphemeralStorageAccessCallback callback) override; \ +#define OnContentBlocked \ + NotUsed() {} \ + void AllowEphemeralStorageAccess( \ + const blink::LocalFrameToken& frame_token, const url::Origin& origin, \ + const net::SiteForCookies& site_for_cookies, \ + const url::Origin& top_frame_origin, \ + AllowEphemeralStorageAccessCallback callback) override; \ void OnContentBlocked #include "src/components/content_settings/browser/content_settings_manager_impl.h" // IWYU pragma: export diff --git a/chromium_src/components/content_settings/common/content_settings_manager.mojom b/chromium_src/components/content_settings/common/content_settings_manager.mojom index 6fd763d736f6..fc42641f1cc1 100644 --- a/chromium_src/components/content_settings/common/content_settings_manager.mojom +++ b/chromium_src/components/content_settings/common/content_settings_manager.mojom @@ -7,12 +7,13 @@ module content_settings.mojom; import "services/network/public/mojom/site_for_cookies.mojom"; import "url/mojom/origin.mojom"; +import "third_party/blink/public/mojom/tokens/tokens.mojom"; [BraveExtend] interface ContentSettingsManager { [Sync] AllowEphemeralStorageAccess( - int32 render_frame_id, + blink.mojom.LocalFrameToken frame_token, url.mojom.Origin origin, network.mojom.SiteForCookies site_for_cookies, url.mojom.Origin top_frame_origin) => (url.mojom.Origin? storage_origin); diff --git a/chromium_src/components/content_settings/core/browser/content_settings_registry.cc b/chromium_src/components/content_settings/core/browser/content_settings_registry.cc index 48360779ddfd..f0c44cd13dc0 100644 --- a/chromium_src/components/content_settings/core/browser/content_settings_registry.cc +++ b/chromium_src/components/content_settings/core/browser/content_settings_registry.cc @@ -223,6 +223,20 @@ void ContentSettingsRegistry::BraveInit() { ContentSettingsInfo::INHERIT_IN_INCOGNITO, ContentSettingsInfo::EXCEPTIONS_ON_SECURE_AND_INSECURE_ORIGINS); + // Disable idle detection by default (we used to disable feature flag + // kIdleDetection, but it went away in cr121). + content_settings_info_.erase(ContentSettingsType::IDLE_DETECTION); + website_settings_registry_->UnRegister(ContentSettingsType::IDLE_DETECTION); + Register(ContentSettingsType::IDLE_DETECTION, "idle-detection", + CONTENT_SETTING_BLOCK, WebsiteSettingsInfo::UNSYNCABLE, + /*allowlisted_primary_schemes=*/{}, + /*valid_settings=*/ + {CONTENT_SETTING_ALLOW, CONTENT_SETTING_ASK, CONTENT_SETTING_BLOCK}, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, + WebsiteSettingsRegistry::ALL_PLATFORMS, + ContentSettingsInfo::INHERIT_IF_LESS_PERMISSIVE, + ContentSettingsInfo::EXCEPTIONS_ON_SECURE_ORIGINS_ONLY); + website_settings_registry_->UnRegister(ContentSettingsType::HTTP_ALLOWED); website_settings_registry_->Register( ContentSettingsType::HTTP_ALLOWED, "http-allowed", base::Value(), diff --git a/chromium_src/components/metrics/structured/structured_metrics_features.cc b/chromium_src/components/metrics/structured/structured_metrics_features.cc index 3e952076ae8f..64b434bdb9b9 100644 --- a/chromium_src/components/metrics/structured/structured_metrics_features.cc +++ b/chromium_src/components/metrics/structured/structured_metrics_features.cc @@ -11,6 +11,8 @@ namespace metrics::structured { OVERRIDE_FEATURE_DEFAULT_STATES({{ {kEnabledStructuredMetricsService, base::FEATURE_DISABLED_BY_DEFAULT}, + {kNearbyShareMetrics, base::FEATURE_DISABLED_BY_DEFAULT}, + {kPhoneHubStructuredMetrics, base::FEATURE_DISABLED_BY_DEFAULT}, }}); } // namespace metrics::structured diff --git a/chromium_src/components/password_manager/core/browser/login_database.cc b/chromium_src/components/password_manager/core/browser/login_database.cc deleted file mode 100644 index 15d98f38ffcf..000000000000 --- a/chromium_src/components/password_manager/core/browser/login_database.cc +++ /dev/null @@ -1,12 +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/. */ - -#define BRAVE_STATEMENT_TO_FORMS \ - if (result == ENCRYPTION_RESULT_SERVICE_FAILURE) \ - result = ENCRYPTION_RESULT_ITEM_FAILURE; - -#include "src/components/password_manager/core/browser/login_database.cc" - -#undef BRAVE_STATEMENT_TO_FORMS diff --git a/chromium_src/components/password_manager/core/browser/password_store/login_database.cc b/chromium_src/components/password_manager/core/browser/password_store/login_database.cc new file mode 100644 index 000000000000..d36659af7efd --- /dev/null +++ b/chromium_src/components/password_manager/core/browser/password_store/login_database.cc @@ -0,0 +1,12 @@ +/* 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 https://mozilla.org/MPL/2.0/. */ + +#define BRAVE_STATEMENT_TO_FORMS \ + if (result == ENCRYPTION_RESULT_SERVICE_FAILURE) \ + result = ENCRYPTION_RESULT_ITEM_FAILURE; + +#include "src/components/password_manager/core/browser/password_store/login_database.cc" + +#undef BRAVE_STATEMENT_TO_FORMS diff --git a/chromium_src/components/permissions/features.cc b/chromium_src/components/permissions/features.cc index a0840e948cc4..6e901f916c2b 100644 --- a/chromium_src/components/permissions/features.cc +++ b/chromium_src/components/permissions/features.cc @@ -20,7 +20,6 @@ OVERRIDE_FEATURE_DEFAULT_STATES({{ base::FEATURE_DISABLED_BY_DEFAULT}, #if !BUILDFLAG(IS_ANDROID) {kPermissionsPromptSurvey, base::FEATURE_DISABLED_BY_DEFAULT}, - {kRecordPermissionExpirationTimestamps, base::FEATURE_DISABLED_BY_DEFAULT}, #endif {kPermissionStorageAccessAPI, base::FEATURE_DISABLED_BY_DEFAULT}, {kShowRelatedWebsiteSetsPermissionGrants, diff --git a/chromium_src/components/privacy_sandbox/privacy_sandbox_features.cc b/chromium_src/components/privacy_sandbox/privacy_sandbox_features.cc index 1e0ebfb79d9e..744df4e566ab 100644 --- a/chromium_src/components/privacy_sandbox/privacy_sandbox_features.cc +++ b/chromium_src/components/privacy_sandbox/privacy_sandbox_features.cc @@ -15,7 +15,6 @@ OVERRIDE_FEATURE_DEFAULT_STATES({{ base::FEATURE_DISABLED_BY_DEFAULT}, {kPrivacySandboxFirstPartySetsUI, base::FEATURE_DISABLED_BY_DEFAULT}, {kPrivacySandboxProactiveTopicsBlocking, base::FEATURE_DISABLED_BY_DEFAULT}, - {kPrivacySandboxSettings3, base::FEATURE_DISABLED_BY_DEFAULT}, {kPrivacySandboxSettings4, base::FEATURE_DISABLED_BY_DEFAULT}, }}); diff --git a/chromium_src/components/privacy_sandbox/privacy_sandbox_settings_unittest.cc b/chromium_src/components/privacy_sandbox/privacy_sandbox_settings_unittest.cc index bac70f2a72f7..29a57ef9dc1e 100644 --- a/chromium_src/components/privacy_sandbox/privacy_sandbox_settings_unittest.cc +++ b/chromium_src/components/privacy_sandbox/privacy_sandbox_settings_unittest.cc @@ -556,6 +556,7 @@ TEST_F(PrivacySandboxSettingsTest, IsTopicsAllowed) { prefs::kPrivacySandboxApisEnabledV2, true); EXPECT_FALSE(privacy_sandbox_settings()->IsTopicsAllowed()); } + class PrivacySandboxSettingsTestCookiesClearOnExitTurnedOff : public PrivacySandboxSettingsTest { public: @@ -567,7 +568,8 @@ class PrivacySandboxSettingsTestCookiesClearOnExitTurnedOff TEST_F(PrivacySandboxSettingsTestCookiesClearOnExitTurnedOff, UseLastTopicsDataAccessibleSince) { - EXPECT_EQ(base::Time::FromTimeT(12345), + // The preference value is ignored + EXPECT_EQ(base::Time::Max(), privacy_sandbox_settings()->TopicsDataAccessibleSince()); } @@ -585,7 +587,11 @@ class PrivacySandboxSettingsTestCookiesClearOnExitTurnedOn TEST_F(PrivacySandboxSettingsTestCookiesClearOnExitTurnedOn, UpdateTopicsDataAccessibleSince) { - EXPECT_EQ(base::Time::Now(), + // Clear cookies on exit doesn't affect TopicsDataAccessibleSince() return + // value. The preference value is not updated and ignored. + EXPECT_EQ(base::Time::FromTimeT(12345), + prefs()->GetTime(prefs::kPrivacySandboxTopicsDataAccessibleSince)); + EXPECT_EQ(base::Time::Max(), privacy_sandbox_settings()->TopicsDataAccessibleSince()); } diff --git a/chromium_src/components/safe_browsing/core/common/features.cc b/chromium_src/components/safe_browsing/core/common/features.cc index 1d6f1ada6401..b7e811d8f99d 100644 --- a/chromium_src/components/safe_browsing/core/common/features.cc +++ b/chromium_src/components/safe_browsing/core/common/features.cc @@ -11,11 +11,6 @@ namespace safe_browsing { OVERRIDE_FEATURE_DEFAULT_STATES({{ -// Download bubble is desktop only feature. -#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS) - {kDownloadBubble, base::FEATURE_ENABLED_BY_DEFAULT}, - {kDownloadBubbleV2, base::FEATURE_ENABLED_BY_DEFAULT}, -#endif {kExtensionTelemetryDisableOffstoreExtensions, base::FEATURE_DISABLED_BY_DEFAULT}, {kExtensionTelemetryTabsApiSignal, base::FEATURE_DISABLED_BY_DEFAULT}, diff --git a/chromium_src/components/search_engines/generated_marketing_snippets.cc b/chromium_src/components/search_engines/generated_marketing_snippets.cc new file mode 100644 index 000000000000..72f1b233a700 --- /dev/null +++ b/chromium_src/components/search_engines/generated_marketing_snippets.cc @@ -0,0 +1,9 @@ +/* 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/. */ + +// We redefine our own versions of PrepopulatedEngine for DDG and Qwant. +#include "brave/components/search_engines/brave_prepopulated_engines.h" + +#include "src/components/search_engines/generated_marketing_snippets.cc" diff --git a/chromium_src/components/search_engines/template_url_prepopulate_data.cc b/chromium_src/components/search_engines/template_url_prepopulate_data.cc index 21e421797b35..cb76d6dcae45 100644 --- a/chromium_src/components/search_engines/template_url_prepopulate_data.cc +++ b/chromium_src/components/search_engines/template_url_prepopulate_data.cc @@ -111,8 +111,8 @@ constexpr BravePrepopulatedEngineID kBraveEnginesNZ[] = { // A map to keep track of a full list of default engines for countries // that don't use the default list. constexpr auto kDefaultEnginesByCountryIdMap = - base::MakeFixedFlatMapSorted>( + base::MakeFixedFlatMap>( + base::sorted_unique, {{country_codes::CountryCharsToCountryID('A', 'M'), kBraveEnginesWithYandex}, {country_codes::CountryCharsToCountryID('A', 'T'), @@ -178,285 +178,301 @@ constexpr auto kDefaultEnginesByCountryIdMap = BravePrepopulatedEngineID GetDefaultSearchEngine(int country_id, int version) { const BravePrepopulatedEngineID default_v6 = PREPOPULATED_ENGINE_ID_GOOGLE; static constexpr auto kContentV6 = - base::MakeFixedFlatMapSorted({ - {country_codes::CountryCharsToCountryID('A', 'U'), - PREPOPULATED_ENGINE_ID_DUCKDUCKGO_AU_NZ_IE}, - {country_codes::CountryCharsToCountryID('D', 'E'), - PREPOPULATED_ENGINE_ID_DUCKDUCKGO_DE}, - {country_codes::CountryCharsToCountryID('F', 'R'), - PREPOPULATED_ENGINE_ID_QWANT}, - {country_codes::CountryCharsToCountryID('I', 'E'), - PREPOPULATED_ENGINE_ID_DUCKDUCKGO_AU_NZ_IE}, - {country_codes::CountryCharsToCountryID('N', 'Z'), - PREPOPULATED_ENGINE_ID_DUCKDUCKGO_AU_NZ_IE}, - }); + base::MakeFixedFlatMap( + base::sorted_unique, + { + {country_codes::CountryCharsToCountryID('A', 'U'), + PREPOPULATED_ENGINE_ID_DUCKDUCKGO_AU_NZ_IE}, + {country_codes::CountryCharsToCountryID('D', 'E'), + PREPOPULATED_ENGINE_ID_DUCKDUCKGO_DE}, + {country_codes::CountryCharsToCountryID('F', 'R'), + PREPOPULATED_ENGINE_ID_QWANT}, + {country_codes::CountryCharsToCountryID('I', 'E'), + PREPOPULATED_ENGINE_ID_DUCKDUCKGO_AU_NZ_IE}, + {country_codes::CountryCharsToCountryID('N', 'Z'), + PREPOPULATED_ENGINE_ID_DUCKDUCKGO_AU_NZ_IE}, + }); static constexpr auto kContentV8 = - base::MakeFixedFlatMapSorted({ - {country_codes::CountryCharsToCountryID('A', 'M'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('A', 'U'), - PREPOPULATED_ENGINE_ID_DUCKDUCKGO_AU_NZ_IE}, - {country_codes::CountryCharsToCountryID('A', 'Z'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('B', 'Y'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('D', 'E'), - PREPOPULATED_ENGINE_ID_DUCKDUCKGO_DE}, - {country_codes::CountryCharsToCountryID('F', 'R'), - PREPOPULATED_ENGINE_ID_QWANT}, - {country_codes::CountryCharsToCountryID('I', 'E'), - PREPOPULATED_ENGINE_ID_DUCKDUCKGO_AU_NZ_IE}, - {country_codes::CountryCharsToCountryID('K', 'G'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('K', 'Z'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('M', 'D'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('N', 'Z'), - PREPOPULATED_ENGINE_ID_DUCKDUCKGO_AU_NZ_IE}, - {country_codes::CountryCharsToCountryID('R', 'U'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('T', 'J'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('T', 'M'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('U', 'Z'), - PREPOPULATED_ENGINE_ID_YANDEX}, - }); + base::MakeFixedFlatMap( + base::sorted_unique, + { + {country_codes::CountryCharsToCountryID('A', 'M'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('A', 'U'), + PREPOPULATED_ENGINE_ID_DUCKDUCKGO_AU_NZ_IE}, + {country_codes::CountryCharsToCountryID('A', 'Z'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('B', 'Y'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('D', 'E'), + PREPOPULATED_ENGINE_ID_DUCKDUCKGO_DE}, + {country_codes::CountryCharsToCountryID('F', 'R'), + PREPOPULATED_ENGINE_ID_QWANT}, + {country_codes::CountryCharsToCountryID('I', 'E'), + PREPOPULATED_ENGINE_ID_DUCKDUCKGO_AU_NZ_IE}, + {country_codes::CountryCharsToCountryID('K', 'G'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('K', 'Z'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('M', 'D'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('N', 'Z'), + PREPOPULATED_ENGINE_ID_DUCKDUCKGO_AU_NZ_IE}, + {country_codes::CountryCharsToCountryID('R', 'U'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('T', 'J'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('T', 'M'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('U', 'Z'), + PREPOPULATED_ENGINE_ID_YANDEX}, + }); static constexpr auto kContentV16 = - base::MakeFixedFlatMapSorted({ - {country_codes::CountryCharsToCountryID('A', 'M'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('A', 'Z'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('B', 'Y'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('F', 'R'), - PREPOPULATED_ENGINE_ID_QWANT}, - {country_codes::CountryCharsToCountryID('K', 'G'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('K', 'Z'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('M', 'D'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('R', 'U'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('T', 'J'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('T', 'M'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('U', 'Z'), - PREPOPULATED_ENGINE_ID_YANDEX}, - }); + base::MakeFixedFlatMap( + base::sorted_unique, + { + {country_codes::CountryCharsToCountryID('A', 'M'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('A', 'Z'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('B', 'Y'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('F', 'R'), + PREPOPULATED_ENGINE_ID_QWANT}, + {country_codes::CountryCharsToCountryID('K', 'G'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('K', 'Z'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('M', 'D'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('R', 'U'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('T', 'J'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('T', 'M'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('U', 'Z'), + PREPOPULATED_ENGINE_ID_YANDEX}, + }); static constexpr auto kContentV17 = - base::MakeFixedFlatMapSorted({ - {country_codes::CountryCharsToCountryID('A', 'M'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('A', 'Z'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('B', 'Y'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('C', 'A'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('D', 'E'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('F', 'R'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('G', 'B'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('K', 'G'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('K', 'Z'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('M', 'D'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('R', 'U'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('T', 'J'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('T', 'M'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('U', 'S'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('U', 'Z'), - PREPOPULATED_ENGINE_ID_YANDEX}, - }); + base::MakeFixedFlatMap( + base::sorted_unique, + { + {country_codes::CountryCharsToCountryID('A', 'M'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('A', 'Z'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('B', 'Y'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('C', 'A'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('D', 'E'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('F', 'R'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('G', 'B'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('K', 'G'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('K', 'Z'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('M', 'D'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('R', 'U'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('T', 'J'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('T', 'M'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('U', 'S'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('U', 'Z'), + PREPOPULATED_ENGINE_ID_YANDEX}, + }); static constexpr auto kContentV20 = - base::MakeFixedFlatMapSorted({ - {country_codes::CountryCharsToCountryID('A', 'M'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('A', 'T'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('A', 'Z'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('B', 'Y'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('C', 'A'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('D', 'E'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('E', 'S'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('F', 'R'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('G', 'B'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('K', 'G'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('K', 'Z'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('M', 'D'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('M', 'X'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('R', 'U'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('T', 'J'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('T', 'M'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('U', 'S'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('U', 'Z'), - PREPOPULATED_ENGINE_ID_YANDEX}, - }); + base::MakeFixedFlatMap( + base::sorted_unique, + { + {country_codes::CountryCharsToCountryID('A', 'M'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('A', 'T'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('A', 'Z'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('B', 'Y'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('C', 'A'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('D', 'E'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('E', 'S'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('F', 'R'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('G', 'B'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('K', 'G'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('K', 'Z'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('M', 'D'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('M', 'X'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('R', 'U'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('T', 'J'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('T', 'M'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('U', 'S'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('U', 'Z'), + PREPOPULATED_ENGINE_ID_YANDEX}, + }); static constexpr auto kContentV21 = - base::MakeFixedFlatMapSorted({ - {country_codes::CountryCharsToCountryID('A', 'M'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('A', 'R'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('A', 'T'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('A', 'Z'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('B', 'R'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('B', 'Y'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('C', 'A'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('D', 'E'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('E', 'S'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('F', 'R'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('G', 'B'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('K', 'G'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('K', 'Z'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('M', 'D'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('M', 'X'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('R', 'U'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('T', 'J'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('T', 'M'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('U', 'S'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('U', 'Z'), - PREPOPULATED_ENGINE_ID_YANDEX}, - }); + base::MakeFixedFlatMap( + base::sorted_unique, + { + {country_codes::CountryCharsToCountryID('A', 'M'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('A', 'R'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('A', 'T'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('A', 'Z'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('B', 'R'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('B', 'Y'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('C', 'A'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('D', 'E'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('E', 'S'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('F', 'R'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('G', 'B'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('K', 'G'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('K', 'Z'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('M', 'D'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('M', 'X'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('R', 'U'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('T', 'J'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('T', 'M'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('U', 'S'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('U', 'Z'), + PREPOPULATED_ENGINE_ID_YANDEX}, + }); static constexpr auto kContentV22 = - base::MakeFixedFlatMapSorted({ - {country_codes::CountryCharsToCountryID('A', 'M'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('A', 'R'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('A', 'T'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('A', 'Z'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('B', 'R'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('B', 'Y'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('C', 'A'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('D', 'E'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('E', 'S'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('F', 'R'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('G', 'B'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('I', 'N'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('K', 'G'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('K', 'Z'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('M', 'D'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('M', 'X'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('R', 'U'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('T', 'J'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('T', 'M'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('U', 'S'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('U', 'Z'), - PREPOPULATED_ENGINE_ID_YANDEX}, - }); + base::MakeFixedFlatMap( + base::sorted_unique, + { + {country_codes::CountryCharsToCountryID('A', 'M'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('A', 'R'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('A', 'T'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('A', 'Z'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('B', 'R'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('B', 'Y'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('C', 'A'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('D', 'E'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('E', 'S'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('F', 'R'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('G', 'B'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('I', 'N'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('K', 'G'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('K', 'Z'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('M', 'D'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('M', 'X'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('R', 'U'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('T', 'J'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('T', 'M'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('U', 'S'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('U', 'Z'), + PREPOPULATED_ENGINE_ID_YANDEX}, + }); static constexpr auto kContentV25 = - base::MakeFixedFlatMapSorted({ - {country_codes::CountryCharsToCountryID('A', 'M'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('A', 'R'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('A', 'T'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('A', 'Z'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('B', 'R'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('B', 'Y'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('C', 'A'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('D', 'E'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('E', 'S'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('F', 'R'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('G', 'B'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('I', 'N'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('K', 'G'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('K', 'R'), - PREPOPULATED_ENGINE_ID_NAVER}, - {country_codes::CountryCharsToCountryID('K', 'Z'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('M', 'D'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('M', 'X'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('R', 'U'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('T', 'J'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('T', 'M'), - PREPOPULATED_ENGINE_ID_YANDEX}, - {country_codes::CountryCharsToCountryID('U', 'S'), - PREPOPULATED_ENGINE_ID_BRAVE}, - {country_codes::CountryCharsToCountryID('U', 'Z'), - PREPOPULATED_ENGINE_ID_YANDEX}, - }); + base::MakeFixedFlatMap( + base::sorted_unique, + { + {country_codes::CountryCharsToCountryID('A', 'M'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('A', 'R'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('A', 'T'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('A', 'Z'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('B', 'R'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('B', 'Y'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('C', 'A'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('D', 'E'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('E', 'S'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('F', 'R'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('G', 'B'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('I', 'N'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('K', 'G'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('K', 'R'), + PREPOPULATED_ENGINE_ID_NAVER}, + {country_codes::CountryCharsToCountryID('K', 'Z'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('M', 'D'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('M', 'X'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('R', 'U'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('T', 'J'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('T', 'M'), + PREPOPULATED_ENGINE_ID_YANDEX}, + {country_codes::CountryCharsToCountryID('U', 'S'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('U', 'Z'), + PREPOPULATED_ENGINE_ID_YANDEX}, + }); if (version > 24) { auto* it = kContentV25.find(country_id); diff --git a/chromium_src/components/version_info/channel.h b/chromium_src/components/version_info/channel.h new file mode 100644 index 000000000000..77b7b56182cd --- /dev/null +++ b/chromium_src/components/version_info/channel.h @@ -0,0 +1,29 @@ +/* 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/. */ + +#ifndef BRAVE_CHROMIUM_SRC_COMPONENTS_VERSION_INFO_CHANNEL_H_ +#define BRAVE_CHROMIUM_SRC_COMPONENTS_VERSION_INFO_CHANNEL_H_ + +#include + +#define GetChannelString GetChannelString_ChromiumImpl + +#include "src/components/version_info/channel.h" // IWYU pragma: export +#undef GetChannelString + +namespace version_info { + +// We use |nightly| instead of |canary|. +constexpr std::string_view GetChannelString(Channel channel) { + if (channel == Channel::CANARY) { + return "nightly"; + } + + return GetChannelString_ChromiumImpl(channel); +} + +} // namespace version_info + +#endif // BRAVE_CHROMIUM_SRC_COMPONENTS_VERSION_INFO_CHANNEL_H_ diff --git a/chromium_src/components/version_info/version_info.h b/chromium_src/components/version_info/version_info.h index a48215c0bde9..28f45a22ee75 100644 --- a/chromium_src/components/version_info/version_info.h +++ b/chromium_src/components/version_info/version_info.h @@ -10,12 +10,10 @@ #include "brave/components/version_info/version_info_values.h" -#define GetChannelString GetChannelString_ChromiumImpl #define GetProductNameAndVersionForUserAgent \ GetProductNameAndVersionForUserAgent_Unused #include "src/components/version_info/version_info.h" // IWYU pragma: export -#undef GetChannelString #undef GetProductNameAndVersionForUserAgent namespace version_info { @@ -24,15 +22,6 @@ constexpr std::string GetProductNameAndVersionForUserAgent() { return "Chrome/" + std::string(constants::kBraveChromiumVersion); } -// We use |nightly| instead of |canary|. -constexpr std::string_view GetChannelString(Channel channel) { - if (channel == Channel::CANARY) { - return "nightly"; - } - - return GetChannelString_ChromiumImpl(channel); -} - } // namespace version_info #endif // BRAVE_CHROMIUM_SRC_COMPONENTS_VERSION_INFO_VERSION_INFO_H_ diff --git a/chromium_src/content/browser/file_system_access/features.cc b/chromium_src/content/browser/file_system_access/features.cc index 90adb2fc8916..5f3f5ec2c47d 100644 --- a/chromium_src/content/browser/file_system_access/features.cc +++ b/chromium_src/content/browser/file_system_access/features.cc @@ -10,7 +10,6 @@ namespace content::features { OVERRIDE_FEATURE_DEFAULT_STATES({{ - {kFileSystemAccessMoveLocalFiles, base::FEATURE_DISABLED_BY_DEFAULT}, {kFileSystemAccessDirectoryIterationSymbolicLinkCheck, base::FEATURE_DISABLED_BY_DEFAULT}, }}); diff --git a/chromium_src/content/browser/file_system_access/file_system_access_handle_base.cc b/chromium_src/content/browser/file_system_access/file_system_access_handle_base.cc new file mode 100644 index 000000000000..aa7b728ee150 --- /dev/null +++ b/chromium_src/content/browser/file_system_access/file_system_access_handle_base.cc @@ -0,0 +1,57 @@ +/* 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 "content/browser/file_system_access/file_system_access_handle_base.h" + +#include "content/browser/file_system_access/file_system_access_directory_handle_impl.h" + +#define DoRename DoRename_ChromiumImpl +#define DoMove DoMove_ChromiumImpl +#define GetChildURL(NEW_ENTRY_NAME, DEST_URL) \ + GetChildURL(NEW_ENTRY_NAME, DEST_URL); \ + if (dest_url.type() != storage::FileSystemType::kFileSystemTypeTemporary) { \ + std::move(callback).Run(file_system_access_error::FromStatus( \ + blink::mojom::FileSystemAccessStatus::kNotSupportedError)); \ + return; \ + } + +#include "src/content/browser/file_system_access/file_system_access_handle_base.cc" +#undef GetChildURL +#undef DoMove +#undef DoRename + +namespace content { + +void FileSystemAccessHandleBase::DoMove( + mojo::PendingRemote + destination_directory, + const std::string& new_entry_name, + bool has_transient_user_activation, + base::OnceCallback callback) { + if (url().type() != storage::FileSystemType::kFileSystemTypeTemporary) { + std::move(callback).Run(file_system_access_error::FromStatus( + blink::mojom::FileSystemAccessStatus::kNotSupportedError)); + return; + } + + DoMove_ChromiumImpl(std::move(destination_directory), new_entry_name, + has_transient_user_activation, std::move(callback)); +} + +void FileSystemAccessHandleBase::DoRename( + const std::string& new_entry_name, + bool has_transient_user_activation, + base::OnceCallback callback) { + if (url().type() != storage::FileSystemType::kFileSystemTypeTemporary) { + std::move(callback).Run(file_system_access_error::FromStatus( + blink::mojom::FileSystemAccessStatus::kNotSupportedError)); + return; + } + + DoRename_ChromiumImpl(new_entry_name, has_transient_user_activation, + std::move(callback)); +} + +} // namespace content diff --git a/chromium_src/content/browser/file_system_access/file_system_access_handle_base.h b/chromium_src/content/browser/file_system_access/file_system_access_handle_base.h new file mode 100644 index 000000000000..278be3af2e82 --- /dev/null +++ b/chromium_src/content/browser/file_system_access/file_system_access_handle_base.h @@ -0,0 +1,21 @@ +/* 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/. */ + +#ifndef BRAVE_CHROMIUM_SRC_CONTENT_BROWSER_FILE_SYSTEM_ACCESS_FILE_SYSTEM_ACCESS_HANDLE_BASE_H_ +#define BRAVE_CHROMIUM_SRC_CONTENT_BROWSER_FILE_SYSTEM_ACCESS_FILE_SYSTEM_ACCESS_HANDLE_BASE_H_ + +#define DoMove(...) \ + DoMove_ChromiumImpl(__VA_ARGS__); \ + void DoMove(__VA_ARGS__) + +#define DoRename(...) \ + DoRename_ChromiumImpl(__VA_ARGS__); \ + void DoRename(__VA_ARGS__) + +#include "src/content/browser/file_system_access/file_system_access_handle_base.h" // IWYU pragma: export +#undef DoRename +#undef DoMove + +#endif // BRAVE_CHROMIUM_SRC_CONTENT_BROWSER_FILE_SYSTEM_ACCESS_FILE_SYSTEM_ACCESS_HANDLE_BASE_H_ diff --git a/chromium_src/content/browser/renderer_host/mixed_content_checker.h b/chromium_src/content/browser/renderer_host/mixed_content_checker.h index 671b5d64caaf..8244655e7ac0 100644 --- a/chromium_src/content/browser/renderer_host/mixed_content_checker.h +++ b/chromium_src/content/browser/renderer_host/mixed_content_checker.h @@ -6,15 +6,15 @@ #ifndef BRAVE_CHROMIUM_SRC_CONTENT_BROWSER_RENDERER_HOST_MIXED_CONTENT_CHECKER_H_ #define BRAVE_CHROMIUM_SRC_CONTENT_BROWSER_RENDERER_HOST_MIXED_CONTENT_CHECKER_H_ -#define MaybeSendBlinkFeatureUsageReport \ +#define InWhichFrameIsContentMixed \ NotUsed(); \ \ static bool DoesOriginSchemeRestrictMixedContent(const url::Origin& origin); \ \ - void MaybeSendBlinkFeatureUsageReport + RenderFrameHostImpl* InWhichFrameIsContentMixed #include "src/content/browser/renderer_host/mixed_content_checker.h" // IWYU pragma: export -#undef MaybeSendBlinkFeatureUsageReport +#undef InWhichFrameIsContentMixed #endif // BRAVE_CHROMIUM_SRC_CONTENT_BROWSER_RENDERER_HOST_MIXED_CONTENT_CHECKER_H_ diff --git a/chromium_src/content/public/common/content_features.cc b/chromium_src/content/public/common/content_features.cc index 0683b1e40171..24e35641f776 100644 --- a/chromium_src/content/public/common/content_features.cc +++ b/chromium_src/content/public/common/content_features.cc @@ -10,6 +10,13 @@ namespace features { +// This is intended as a kill switch for the Idle Detection feature. To enable +// this feature, the experimental web platform features flag should be set, +// or the site should obtain an Origin Trial token. +BASE_FEATURE(kIdleDetection, + "IdleDetection", + base::FEATURE_DISABLED_BY_DEFAULT); + OVERRIDE_FEATURE_DEFAULT_STATES({{ {kAttributionFencedFrameReportingBeacon, base::FEATURE_DISABLED_BY_DEFAULT}, {kCookieDeprecationFacilitatedTesting, base::FEATURE_DISABLED_BY_DEFAULT}, @@ -17,7 +24,6 @@ OVERRIDE_FEATURE_DEFAULT_STATES({{ {kDIPS, base::FEATURE_DISABLED_BY_DEFAULT}, {kFedCm, base::FEATURE_DISABLED_BY_DEFAULT}, {kFirstPartySets, base::FEATURE_DISABLED_BY_DEFAULT}, - {kIdleDetection, base::FEATURE_DISABLED_BY_DEFAULT}, {kLegacyTechReportEnableCookieIssueReports, base::FEATURE_DISABLED_BY_DEFAULT}, {kLegacyTechReportTopLevelUrl, base::FEATURE_DISABLED_BY_DEFAULT}, diff --git a/chromium_src/content/public/common/content_features.h b/chromium_src/content/public/common/content_features.h new file mode 100644 index 000000000000..65db99a70ad9 --- /dev/null +++ b/chromium_src/content/public/common/content_features.h @@ -0,0 +1,17 @@ +/* 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 https://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_CHROMIUM_SRC_CONTENT_PUBLIC_COMMON_CONTENT_FEATURES_H_ +#define BRAVE_CHROMIUM_SRC_CONTENT_PUBLIC_COMMON_CONTENT_FEATURES_H_ + +#include "src/content/public/common/content_features.h" // IWYU pragma: export + +namespace features { + +CONTENT_EXPORT BASE_DECLARE_FEATURE(kIdleDetection); + +} // namespace features + +#endif // BRAVE_CHROMIUM_SRC_CONTENT_PUBLIC_COMMON_CONTENT_FEATURES_H_ diff --git a/chromium_src/ios/chrome/browser/browser_state/model/browser_state_keyed_service_factories.mm b/chromium_src/ios/chrome/browser/browser_state/model/browser_state_keyed_service_factories.mm index 14da331f704e..f63a7aceb28d 100644 --- a/chromium_src/ios/chrome/browser/browser_state/model/browser_state_keyed_service_factories.mm +++ b/chromium_src/ios/chrome/browser/browser_state/model/browser_state_keyed_service_factories.mm @@ -6,7 +6,7 @@ #include "ios/chrome/browser/browser_state/model/browser_state_keyed_service_factories.h" #include "brave/ios/browser/browser_state/brave_browser_state_keyed_service_factories.h" -#include "ios/chrome/browser/autofill/personal_data_manager_factory.h" +#include "ios/chrome/browser/autofill/model/personal_data_manager_factory.h" #include "ios/chrome/browser/bookmarks/model/bookmark_undo_service_factory.h" #include "ios/chrome/browser/bookmarks/model/local_or_syncable_bookmark_model_factory.h" #include "ios/chrome/browser/consent_auditor/model/consent_auditor_factory.h" @@ -15,14 +15,14 @@ #include "ios/chrome/browser/favicon/ios_chrome_favicon_loader_factory.h" #include "ios/chrome/browser/favicon/ios_chrome_large_icon_cache_factory.h" #include "ios/chrome/browser/favicon/ios_chrome_large_icon_service_factory.h" -#include "ios/chrome/browser/history/history_service_factory.h" -#include "ios/chrome/browser/history/web_history_service_factory.h" +#include "ios/chrome/browser/history/model/history_service_factory.h" +#include "ios/chrome/browser/history/model/web_history_service_factory.h" #include "ios/chrome/browser/invalidation/model/ios_chrome_profile_invalidation_provider_factory.h" #include "ios/chrome/browser/passwords/model/ios_chrome_profile_password_store_factory.h" #include "ios/chrome/browser/reading_list/model/reading_list_model_factory.h" #include "ios/chrome/browser/search_engines/model/template_url_service_factory.h" -#include "ios/chrome/browser/signin/account_consistency_service_factory.h" -#include "ios/chrome/browser/signin/identity_manager_factory.h" +#include "ios/chrome/browser/signin/model/account_consistency_service_factory.h" +#include "ios/chrome/browser/signin/model/identity_manager_factory.h" #include "ios/chrome/browser/sync/model/ios_user_event_service_factory.h" #include "ios/chrome/browser/sync/model/model_type_store_service_factory.h" #include "ios/chrome/browser/sync/model/session_sync_service_factory.h" diff --git a/chromium_src/ios/chrome/browser/main/browser_agent_util.mm b/chromium_src/ios/chrome/browser/main/model/browser_agent_util.mm similarity index 92% rename from chromium_src/ios/chrome/browser/main/browser_agent_util.mm rename to chromium_src/ios/chrome/browser/main/model/browser_agent_util.mm index e36facc97287..bf9b0e9d74d6 100644 --- a/chromium_src/ios/chrome/browser/main/browser_agent_util.mm +++ b/chromium_src/ios/chrome/browser/main/model/browser_agent_util.mm @@ -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/. */ -#import "ios/chrome/browser/main/browser_agent_util.h" +#import "ios/chrome/browser/main/model/browser_agent_util.h" #include "ios/chrome/browser/send_tab_to_self/model/send_tab_to_self_browser_agent.h" #include "ios/chrome/browser/shared/model/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/tabs/model/synced_window_delegate_browser_agent.h" 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 0ff8fe912d22..bd711f9e1e45 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 @@ -69,8 +69,9 @@ void BraveRegisterLocalStatePrefs(PrefRegistrySimple* registry) { #undef BRAVE_REGISTER_LOCAL_STATE_PREFS #undef BRAVE_REGISTER_BROWSER_STATE_PREFS -void MigrateObsoleteBrowserStatePrefs(PrefService* prefs) { - MigrateObsoleteBrowserStatePrefs_ChromiumImpl(prefs); +void MigrateObsoleteBrowserStatePrefs(const base::FilePath& state_path, + PrefService* prefs) { + MigrateObsoleteBrowserStatePrefs_ChromiumImpl(state_path, prefs); brave_wallet::KeyringService::MigrateObsoleteProfilePrefs(prefs); brave_wallet::MigrateObsoleteProfilePrefs(prefs); diff --git a/chromium_src/ios/chrome/browser/signin/about_signin_internals_factory.cc b/chromium_src/ios/chrome/browser/signin/model/about_signin_internals_factory.cc similarity index 95% rename from chromium_src/ios/chrome/browser/signin/about_signin_internals_factory.cc rename to chromium_src/ios/chrome/browser/signin/model/about_signin_internals_factory.cc index df5f5cefc360..c7523f711653 100644 --- a/chromium_src/ios/chrome/browser/signin/about_signin_internals_factory.cc +++ b/chromium_src/ios/chrome/browser/signin/model/about_signin_internals_factory.cc @@ -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/. */ -#include "ios/chrome/browser/signin/about_signin_internals_factory.h" +#include "ios/chrome/browser/signin/model/about_signin_internals_factory.h" #include "base/no_destructor.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" diff --git a/chromium_src/net/socket/socks5_client_socket.cc b/chromium_src/net/socket/socks5_client_socket.cc index 58cb390ca8f2..b2a8b34d843c 100644 --- a/chromium_src/net/socket/socks5_client_socket.cc +++ b/chromium_src/net/socket/socks5_client_socket.cc @@ -111,7 +111,7 @@ int SOCKS5ClientSocketAuth::Authenticate( case STATE_WRITE: DCHECK_EQ(OK, rv); DCHECK_LT(0u, buffer_left_); - iobuf_ = new IOBuffer(buffer_left_); + iobuf_ = base::MakeRefCounted(buffer_left_); memcpy(iobuf_->data(), &buffer_.data()[buffer_.size() - buffer_left_], buffer_left_); @@ -139,14 +139,14 @@ int SOCKS5ClientSocketAuth::Authenticate( DCHECK_EQ(OK, rv); buffer_.clear(); buffer_left_ = kSOCKSAuthUsernamePasswordResponseLen; - iobuf_ = new IOBuffer(buffer_left_); + iobuf_ = base::MakeRefCounted(buffer_left_); next_state_ = STATE_READ; rv = OK; break; case STATE_READ: DCHECK_EQ(OK, rv); - iobuf_ = new IOBuffer(buffer_left_); + iobuf_ = base::MakeRefCounted(buffer_left_); next_state_ = STATE_READ_COMPLETE; net_log.BeginEvent(NetLogEventType::SOCKS5_AUTH_READ); rv = transport_socket_->Read(iobuf_.get(), buffer_left_, callback); diff --git a/chromium_src/net/tools/transport_security_state_generator/input_file_parsers.cc b/chromium_src/net/tools/transport_security_state_generator/input_file_parsers.cc index 883eb0ef3b3d..44fbdd8e1b1b 100644 --- a/chromium_src/net/tools/transport_security_state_generator/input_file_parsers.cc +++ b/chromium_src/net/tools/transport_security_state_generator/input_file_parsers.cc @@ -549,9 +549,9 @@ bool ParseCertificatesFile(std::string_view certs_input, Pinsets* pinsets, base::Time* timestamp) { constexpr std::string_view brave_certs = R"brave_certs( -# Last updated: Tue Jan 16 19:43:34 UTC 2024 +# Last updated: Wed Jan 17 19:42:33 UTC 2024 PinsListTimestamp -1705434214 +1705520553 # =====BEGIN BRAVE ROOTS ASC===== #From https://www.amazontrust.com/repository/ diff --git a/chromium_src/services/network/cookie_settings.cc b/chromium_src/services/network/cookie_settings.cc index fc8b8a10809a..6f61e20c4818 100644 --- a/chromium_src/services/network/cookie_settings.cc +++ b/chromium_src/services/network/cookie_settings.cc @@ -5,6 +5,8 @@ #include "services/network/cookie_settings.h" +#include + #include "net/base/features.h" #include "url/origin.h" @@ -16,7 +18,8 @@ bool CookieSettings::IsEphemeralCookieAccessible( const net::CanonicalCookie& cookie, const GURL& url, const net::SiteForCookies& site_for_cookies, - const absl::optional& top_frame_origin, + const std::optional& top_frame_origin, + const net::FirstPartySetMetadata& first_party_set_metadata, net::CookieSettingOverrides overrides, net::CookieInclusionStatus* cookie_inclusion_status) const { // Upstream now do single cookie-specific checks in some places to determine @@ -30,14 +33,15 @@ bool CookieSettings::IsEphemeralCookieAccessible( } return IsCookieAccessible(cookie, url, site_for_cookies, top_frame_origin, - overrides, cookie_inclusion_status); + first_party_set_metadata, overrides, + cookie_inclusion_status); } net::NetworkDelegate::PrivacySetting CookieSettings::IsEphemeralPrivacyModeEnabled( const GURL& url, const net::SiteForCookies& site_for_cookies, - const absl::optional& top_frame_origin, + const std::optional& top_frame_origin, net::CookieSettingOverrides overrides) const { if (IsEphemeralCookieAccessAllowed(url, site_for_cookies, top_frame_origin, overrides)) { @@ -56,7 +60,7 @@ bool CookieSettings::AnnotateAndMoveUserBlockedEphemeralCookies( net::CookieSettingOverrides overrides, net::CookieAccessResultList& maybe_included_cookies, net::CookieAccessResultList& excluded_cookies) const { - absl::optional top_frame_origin_opt; + std::optional top_frame_origin_opt; if (top_frame_origin) top_frame_origin_opt = *top_frame_origin; diff --git a/chromium_src/services/network/cookie_settings.h b/chromium_src/services/network/cookie_settings.h index 1f1032a665a1..26bb5e14f65a 100644 --- a/chromium_src/services/network/cookie_settings.h +++ b/chromium_src/services/network/cookie_settings.h @@ -11,12 +11,13 @@ bool IsEphemeralCookieAccessible( \ const net::CanonicalCookie& cookie, const GURL& url, \ const net::SiteForCookies& site_for_cookies, \ - const absl::optional& top_frame_origin, \ + const std::optional& top_frame_origin, \ + const net::FirstPartySetMetadata& first_party_set_metadata, \ net::CookieSettingOverrides overrides, \ net::CookieInclusionStatus* cookie_inclusion_status) const; \ net::NetworkDelegate::PrivacySetting IsEphemeralPrivacyModeEnabled( \ const GURL& url, const net::SiteForCookies& site_for_cookies, \ - const absl::optional& top_frame_origin, \ + const std::optional& top_frame_origin, \ net::CookieSettingOverrides overrides) const; \ bool AnnotateAndMoveUserBlockedEphemeralCookies( \ const GURL& url, const net::SiteForCookies& site_for_cookies, \ @@ -27,6 +28,8 @@ net::CookieAccessResultList& excluded_cookies) const; \ DeleteCookiePredicate CreateDeleteCookieOnExitPredicate +#include + #include "src/services/network/cookie_settings.h" // IWYU pragma: export #undef CreateDeleteCookieOnExitPredicate diff --git a/chromium_src/services/network/restricted_cookie_manager.cc b/chromium_src/services/network/restricted_cookie_manager.cc index 52a61c38f90b..7606c8d1ea10 100644 --- a/chromium_src/services/network/restricted_cookie_manager.cc +++ b/chromium_src/services/network/restricted_cookie_manager.cc @@ -26,10 +26,10 @@ #define FromStorage(NAME, VALUE, DOMAIN, PATH, CREATION, EXPIRY, LAST_ACCESS, \ LAST_UPDATE, SECURE, HTTP_ONLY, SAME_SITE, PRIORITY, \ - SAME_PARTY, PARTITION, SOURCE_SCHEME, PORT) \ + PARTITION, SOURCE_SCHEME, PORT) \ FromStorage(NAME, VALUE, DOMAIN, PATH, CREATION, \ ModifyExpiration(EXPIRY, CREATION), LAST_ACCESS, LAST_UPDATE, \ - SECURE, HTTP_ONLY, SAME_SITE, PRIORITY, SAME_PARTY, PARTITION, \ + SECURE, HTTP_ONLY, SAME_SITE, PRIORITY, PARTITION, \ SOURCE_SCHEME, PORT) #include "src/services/network/restricted_cookie_manager.cc" diff --git a/chromium_src/third_party/blink/common/features.cc b/chromium_src/third_party/blink/common/features.cc index e6457204e474..82b998f1fff6 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}, - {kBrowsingTopicsXHR, base::FEATURE_DISABLED_BY_DEFAULT}, {kClientHintsFormFactor, base::FEATURE_DISABLED_BY_DEFAULT}, {kClientHintsMetaEquivDelegateCH, base::FEATURE_DISABLED_BY_DEFAULT}, {kComputePressure, base::FEATURE_DISABLED_BY_DEFAULT}, @@ -51,9 +50,7 @@ OVERRIDE_FEATURE_DEFAULT_STATES({{ {kSpeculationRulesHeaderEnableThirdPartyOriginTrial, base::FEATURE_DISABLED_BY_DEFAULT}, {kSpeculationRulesPrefetchFuture, base::FEATURE_DISABLED_BY_DEFAULT}, - {kSpeculationRulesPrefetchProxy, base::FEATURE_DISABLED_BY_DEFAULT}, {kTextFragmentAnchor, base::FEATURE_DISABLED_BY_DEFAULT}, - {kWebEnvironmentIntegrity, base::FEATURE_DISABLED_BY_DEFAULT}, }}); // Allow certain client hints in request header. diff --git a/chromium_src/third_party/blink/common/origin_trials/origin_trials.cc b/chromium_src/third_party/blink/common/origin_trials/origin_trials.cc index 35386a1de203..8cbf2acceb0d 100644 --- a/chromium_src/third_party/blink/common/origin_trials/origin_trials.cc +++ b/chromium_src/third_party/blink/common/origin_trials/origin_trials.cc @@ -36,7 +36,6 @@ bool IsTrialDisabledInBrave(std::string_view trial_name) { "SignedExchangeSubresourcePrefetch", "SubresourceWebBundles", "TrustTokens", - "WebEnvironmentIntegrity", }; if (base::Contains(kBraveDisabledTrialNames, trial_name)) { @@ -60,7 +59,6 @@ bool IsTrialDisabledInBrave(blink::mojom::OriginTrialFeature feature) { blink::mojom::OriginTrialFeature::kParakeet, blink::mojom::OriginTrialFeature::kPrivacySandboxAdsAPIs, blink::mojom::OriginTrialFeature::kPrivateStateTokens, - blink::mojom::OriginTrialFeature::kWebEnvironmentIntegrity, }; return base::Contains(kBraveDisabledTrialFeatures, feature); diff --git a/chromium_src/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py b/chromium_src/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py index c9d916dec62e..241308dcc0c1 100644 --- a/chromium_src/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py +++ b/chromium_src/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py @@ -216,11 +216,13 @@ def _append_report_page_graph_api_call_event(cg_context, expr): exception_state = "nullptr" # Extract return value. See `bind_return_value` in upstream interface.py. - is_return_type_void = ((not cg_context.return_type - or cg_context.return_type.unwrap().is_void) - and not cg_context.does_override_idl_return_type) - if is_return_type_void or hasattr(cg_context, _IS_OBSERVABLE_ARRAY_SETTER): - return_value = "absl::nullopt" + is_return_type_undefined = ( + (not cg_context.return_type + or cg_context.return_type.unwrap().is_undefined) + and not cg_context.does_override_idl_return_type) + if is_return_type_undefined or hasattr(cg_context, + _IS_OBSERVABLE_ARRAY_SETTER): + return_value = "std::nullopt" else: return_value = _to_page_graph_blink_arg("return_value") diff --git a/chromium_src/third_party/blink/renderer/core/frame/local_dom_window.cc b/chromium_src/third_party/blink/renderer/core/frame/local_dom_window.cc index 42541126c939..16cc39f0a000 100644 --- a/chromium_src/third_party/blink/renderer/core/frame/local_dom_window.cc +++ b/chromium_src/third_party/blink/renderer/core/frame/local_dom_window.cc @@ -17,8 +17,14 @@ #define resizeTo resizeTo_ChromiumImpl #define moveTo moveTo_ChromiumImpl -#include "src/third_party/blink/renderer/core/frame/local_dom_window.cc" +#define BRAVE_LOCAL_DOM_WINDOW_CAN_EXECUTE_SCRIPTS \ + if (WebContentSettingsClient* settings_client = \ + GetFrame()->GetContentSettingsClient()) { \ + script_enabled = settings_client->AllowScript(allow_script_renderer); \ + } +#include "src/third_party/blink/renderer/core/frame/local_dom_window.cc" +#undef BRAVE_LOCAL_DOM_WINDOW_CAN_EXECUTE_SCRIPTS #undef outerHeight #undef outerWidth #undef screenX @@ -95,13 +101,16 @@ int LocalDOMWindow::screenY() const { : screenY_ChromiumImpl(); } -void LocalDOMWindow::resizeTo(int width, int height) const { +void LocalDOMWindow::resizeTo(int width, + int height, + ExceptionState& exception_state) const { ExecutionContext* context = GetExecutionContext(); if (BlockScreenFingerprinting(context)) { resizeTo_ChromiumImpl(width + outerWidth_ChromiumImpl() - outerWidth(), - height + outerHeight_ChromiumImpl() - outerHeight()); + height + outerHeight_ChromiumImpl() - outerHeight(), + exception_state); } else { - resizeTo_ChromiumImpl(width, height); + resizeTo_ChromiumImpl(width, height, exception_state); } } diff --git a/chromium_src/third_party/blink/renderer/core/frame/local_dom_window.h b/chromium_src/third_party/blink/renderer/core/frame/local_dom_window.h index 1b213ddb9276..eaf8b49f2085 100644 --- a/chromium_src/third_party/blink/renderer/core/frame/local_dom_window.h +++ b/chromium_src/third_party/blink/renderer/core/frame/local_dom_window.h @@ -36,8 +36,9 @@ screenY_ChromiumImpl() const; \ int screenTop -#define resizeTo \ - resizeTo_ChromiumImpl(int width, int height) const; \ +#define resizeTo \ + resizeTo_ChromiumImpl(int width, int height, \ + ExceptionState& exception_state) const; \ void resizeTo #define moveTo \ diff --git a/chromium_src/third_party/blink/renderer/core/html/html_permission_element.cc b/chromium_src/third_party/blink/renderer/core/html/html_permission_element.cc new file mode 100644 index 000000000000..63a73555dd38 --- /dev/null +++ b/chromium_src/third_party/blink/renderer/core/html/html_permission_element.cc @@ -0,0 +1,14 @@ +/* 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 "third_party/blink/renderer/core/html/html_permission_element.h" + +#include "third_party/blink/public/mojom/permissions/permission.mojom-blink.h" +#include "third_party/blink/renderer/core/dom/document.h" +#include "third_party/blink/renderer/core/dom/element.h" + +#define PermissionStatus mojom::blink::PermissionStatus +#include "src/third_party/blink/renderer/core/html/html_permission_element.cc" +#undef PermissionStatus diff --git a/chromium_src/third_party/blink/renderer/core/html/html_script_element.cc b/chromium_src/third_party/blink/renderer/core/html/html_script_element.cc index 129423238a10..d14444954dda 100644 --- a/chromium_src/third_party/blink/renderer/core/html/html_script_element.cc +++ b/chromium_src/third_party/blink/renderer/core/html/html_script_element.cc @@ -12,12 +12,18 @@ namespace blink { // static -bool HTMLScriptElement::supports(ScriptState* script_state, - const AtomicString& type) { +bool HTMLScriptElement::supports(const AtomicString& type) { if (type == script_type_names::kWebbundle) return false; - return supports_ChromiumImpl(script_state, type); + // There used to be a kSpeculationRulesPrefetchProxy feature flag to disable + // speculative prefetching in the upstream function, but with its removal, it + // was necessary to move the check here. + if (type == script_type_names::kSpeculationrules) { + return false; + } + + return supports_ChromiumImpl(type); } } // namespace blink diff --git a/chromium_src/third_party/blink/renderer/core/html/html_script_element.h b/chromium_src/third_party/blink/renderer/core/html/html_script_element.h index f7ee367cba73..d518e7d1133a 100644 --- a/chromium_src/third_party/blink/renderer/core/html/html_script_element.h +++ b/chromium_src/third_party/blink/renderer/core/html/html_script_element.h @@ -6,8 +6,8 @@ #ifndef BRAVE_CHROMIUM_SRC_THIRD_PARTY_BLINK_RENDERER_CORE_HTML_HTML_SCRIPT_ELEMENT_H_ #define BRAVE_CHROMIUM_SRC_THIRD_PARTY_BLINK_RENDERER_CORE_HTML_HTML_SCRIPT_ELEMENT_H_ -#define supports \ - supports_ChromiumImpl(ScriptState*, const AtomicString&); \ +#define supports \ + supports_ChromiumImpl(const AtomicString&); \ static bool supports #include "src/third_party/blink/renderer/core/html/html_script_element.h" // IWYU pragma: export diff --git a/chromium_src/ui/accessibility/accessibility_features.cc b/chromium_src/ui/accessibility/accessibility_features.cc new file mode 100644 index 000000000000..5c875f2028fb --- /dev/null +++ b/chromium_src/ui/accessibility/accessibility_features.cc @@ -0,0 +1,18 @@ +/* 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/ui/accessibility/accessibility_features.cc" + +#include "base/feature_override.h" + +namespace features { + +OVERRIDE_FEATURE_DEFAULT_STATES({{ +#if !BUILDFLAG(IS_ANDROID) + {kReadAnything, base::FEATURE_DISABLED_BY_DEFAULT}, +#endif +}}); + +} // namespace features diff --git a/chromium_src/ui/views/controls/button/md_text_button.cc b/chromium_src/ui/views/controls/button/md_text_button.cc index 4de429838374..113538f70273 100644 --- a/chromium_src/ui/views/controls/button/md_text_button.cc +++ b/chromium_src/ui/views/controls/button/md_text_button.cc @@ -157,8 +157,12 @@ namespace views { MdTextButton::MdTextButton(PressedCallback callback, const std::u16string& text, - int button_context) - : MdTextButtonBase(std::move(callback), text, button_context) { + int button_context, + bool use_text_color_for_icon) + : MdTextButtonBase(std::move(callback), + text, + button_context, + use_text_color_for_icon) { SetCornerRadius(100); views::HighlightPathGenerator::Install( this, std::make_unique()); @@ -367,6 +371,9 @@ MdTextButton::ButtonColors MdTextButton::GetButtonColors() { .text_color = AddOpacity(style.text_color, opacity)}; } +BEGIN_METADATA(MdTextButton) +END_METADATA + } // namespace views namespace { diff --git a/chromium_src/ui/views/controls/button/md_text_button.h b/chromium_src/ui/views/controls/button/md_text_button.h index b727af5c0b19..3e8b0afb3fbe 100644 --- a/chromium_src/ui/views/controls/button/md_text_button.h +++ b/chromium_src/ui/views/controls/button/md_text_button.h @@ -36,6 +36,8 @@ namespace views { // - Differenet hover bg color for prominent background // - No shadow for prominent background class VIEWS_EXPORT MdTextButton : public MdTextButtonBase { + METADATA_HEADER(MdTextButton, views::MdTextButtonBase) + public: struct ButtonColors { SkColor background_color; @@ -47,7 +49,8 @@ class VIEWS_EXPORT MdTextButton : public MdTextButtonBase { explicit MdTextButton(PressedCallback callback = PressedCallback(), const std::u16string& text = std::u16string(), - int button_context = style::CONTEXT_BUTTON_MD); + int button_context = style::CONTEXT_BUTTON_MD, + bool use_text_color_for_icon = true); MdTextButton(const MdTextButton&) = delete; MdTextButton& operator=(const MdTextButton&) = delete; ~MdTextButton() override; diff --git a/chromium_src/v8/src/execution/isolate.cc b/chromium_src/v8/src/execution/isolate.cc index f6d337b643c2..b07ce2022361 100644 --- a/chromium_src/v8/src/execution/isolate.cc +++ b/chromium_src/v8/src/execution/isolate.cc @@ -31,7 +31,7 @@ GetExecutingScriptsImpl(Isolate* isolate, bool all, bool include_position) { } int script_position = 0; - if (include_position && !isolate->has_pending_exception()) { + if (include_position && !isolate->has_exception()) { Handle shared_handle(shared, isolate); SharedFunctionInfo::EnsureSourcePositionsAvailable(isolate, shared_handle); diff --git a/components/ai_chat/renderer/page_content_extractor.cc b/components/ai_chat/renderer/page_content_extractor.cc index 3d547014efc9..56bbfc47403d 100644 --- a/components/ai_chat/renderer/page_content_extractor.cc +++ b/components/ai_chat/renderer/page_content_extractor.cc @@ -72,17 +72,20 @@ const char16_t kVideoTrackTranscriptUrlExtractionScript[] = })() )JS"; -constexpr auto kYouTubeHosts = base::MakeFixedFlatSetSorted({ - "m.youtube.com", - "www.youtube.com", -}); +constexpr auto kYouTubeHosts = + base::MakeFixedFlatSet(base::sorted_unique, + { + "m.youtube.com", + "www.youtube.com", + }); // TODO(petemill): Use heuristics to determine if page's main focus is // a video, and not a hard-coded list of Url hosts. constexpr auto kVideoTrackHosts = - base::MakeFixedFlatSetSorted({ - "www.ted.com", - }); + base::MakeFixedFlatSet(base::sorted_unique, + { + "www.ted.com", + }); } // namespace diff --git a/components/ai_chat/resources/page/chat_ui.tsx b/components/ai_chat/resources/page/chat_ui.tsx index b37dff1540b7..c5c05f86ca20 100644 --- a/components/ai_chat/resources/page/chat_ui.tsx +++ b/components/ai_chat/resources/page/chat_ui.tsx @@ -11,6 +11,7 @@ import { setIconBasePath } from '@brave/leo/react/icon' import '$web-components/app.global.scss' import '@brave/leo/tokens/css/variables.css' +import '$web-common/defaultTrustedTypesPolicy' import { loadTimeData } from '$web-common/loadTimeData' import BraveCoreThemeProvider from '$web-common/BraveCoreThemeProvider' import Main from './components/main' diff --git a/components/ai_chat/resources/page/components/code_block/index.tsx b/components/ai_chat/resources/page/components/code_block/index.tsx new file mode 100644 index 000000000000..6e62013324d1 --- /dev/null +++ b/components/ai_chat/resources/page/components/code_block/index.tsx @@ -0,0 +1,81 @@ +/* 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/. */ + +import * as React from 'react' + +import styles from './style.module.scss' +import Button from '@brave/leo/react/button' +import Icon from '@brave/leo/react/icon' +import { Light as SyntaxHighlighter } from 'react-syntax-highlighter' +import hljsStyle from 'react-syntax-highlighter/dist/esm/styles/hljs/ir-black' +import cpp from 'react-syntax-highlighter/dist/esm/languages/hljs/cpp' +import javascript from 'react-syntax-highlighter/dist/esm/languages/hljs/javascript' +import python from 'react-syntax-highlighter/dist/esm/languages/hljs/python' +import json from 'react-syntax-highlighter/dist/esm/languages/hljs/json' + +SyntaxHighlighter.registerLanguage('cpp', cpp) +SyntaxHighlighter.registerLanguage('javascript', javascript) +SyntaxHighlighter.registerLanguage('python', python) +SyntaxHighlighter.registerLanguage('json', json) + +interface CodeInlineProps { + code: string +} +interface CodeBlockProps { + code: string + lang: string +} + +function Inline(props: CodeInlineProps) { + return ( + + + {props.code} + + + ) +} + +function Block(props: CodeBlockProps) { + const [hasCopied, setHasCopied] = React.useState(false) + + const handleCopy = () => { + navigator.clipboard.writeText(props.code).then(() => { + setHasCopied(true) + setTimeout(() => setHasCopied(false), 1000) + }) + } + + return ( +

+
+
{props.lang}
+ +
+ + {props.code} + +
+ ) +} + +export default { + Inline, + Block +} diff --git a/components/ai_chat/resources/page/components/code_block/style.module.scss b/components/ai_chat/resources/page/components/code_block/style.module.scss new file mode 100644 index 000000000000..7343b7e92b88 --- /dev/null +++ b/components/ai_chat/resources/page/components/code_block/style.module.scss @@ -0,0 +1,37 @@ +// 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/. + +.container { + overflow: auto; + background: var(--leo-color-page-background); + border: 1px solid var(--leo-color-divider-subtle); + border-radius: 8px; + + pre, + code { + white-space: pre-wrap; + margin: 0; + } + + pre { + padding: var(--leo-spacing-xl); + } + + code { + padding: var(--leo-spacing-s); + } +} + +.toolbar { + background: var(--leo-color-container-background); + padding: var(--leo-spacing-m) 16px var(--leo-spacing-m) var(--leo-spacing-2xl); + display: flex; + align-items: center; + justify-content: space-between; + + leo-button { + max-width: max-content; + } +} diff --git a/components/ai_chat/resources/page/components/conversation_list/index.tsx b/components/ai_chat/resources/page/components/conversation_list/index.tsx index ef4adaa362e8..4386e5fb9edc 100644 --- a/components/ai_chat/resources/page/components/conversation_list/index.tsx +++ b/components/ai_chat/resources/page/components/conversation_list/index.tsx @@ -15,15 +15,54 @@ import ContextMenuAssistant from '../context_menu_assistant' import { getLocale } from '$web-common/locale' import SiteTitle from '../site_title' +const CodeBlock = React.lazy(async () => ({ default: (await import('../code_block')).default.Block })) +const CodeInline = React.lazy(async () => ({ default: (await import('../code_block')).default.Inline })) + +// Capture markdown-style code blocks and inline code. +// It captures: +// 1. Multiline code blocks with optional language specifiers (```lang\n...code...```). +// 2. Inline code segments (`code`). +// 3. Regular text outside of code segments. +const codeFormatRegexp = /```([^\n`]+)?\n?([\s\S]*?)```|`(.*?)`|([^`]+)/gs + const SUGGESTION_STATUS_SHOW_BUTTON: mojom.SuggestionGenerationStatus[] = [ mojom.SuggestionGenerationStatus.CanGenerate, mojom.SuggestionGenerationStatus.IsGenerating ] -function ConversationList() { - // Scroll the last conversation item in to view when entries are added. - const lastConversationEntryElementRef = React.useRef(null) +interface ConversationListProps { + onLastElementHeightChange: () => void +} + +interface FormattedTextProps { + text: string +} + +function FormattedTextRenderer(props: FormattedTextProps): JSX.Element { + const nodes = React.useMemo(() => { + const formattedNodes = Array.from(props.text.matchAll(codeFormatRegexp)).map((match: any) => { + if (match[0].substring(0,3).includes('```')) { + return ( + + ) + } else if (match[0].substring(0,1).includes('`')) { + return ( + + + + ) + } else { + return match[0] + } + }) + + return <>{formattedNodes} + }, [props.text]) + + return nodes +} +function ConversationList(props: ConversationListProps) { const context = React.useContext(DataContext) const { isGenerating, @@ -41,26 +80,17 @@ function ConversationList() { suggestedQuestions.length > 0 || SUGGESTION_STATUS_SHOW_BUTTON.includes(context.suggestionStatus)) - React.useEffect(() => { - if (!conversationHistory.length && !isGenerating) { - return - } - - if (!lastConversationEntryElementRef.current) { - console.error('Conversation entry element did not exist when expected') - } else { - lastConversationEntryElementRef.current.scrollIntoView(false) - } - }, [ - conversationHistory.length, - isGenerating, - lastConversationEntryElementRef.current?.clientHeight - ]) - const handleQuestionSubmit = (question: string) => { getPageHandlerInstance().pageHandler.submitHumanConversationEntry(question) } + const lastEntryElementRef = React.useRef(null) + + React.useEffect(() => { + if (!lastEntryElementRef.current) return + props.onLastElementHeightChange() + }, [conversationHistory.length, lastEntryElementRef.current?.clientHeight]) + return ( <>
@@ -84,7 +114,7 @@ function ConversationList() { return (
{isAIAssistant && ( @@ -100,8 +130,10 @@ function ConversationList() {
-
- {turn.text} +
+ {} {isLoading && } {showSiteTitle &&
}
diff --git a/components/ai_chat/resources/page/components/input_box/index.tsx b/components/ai_chat/resources/page/components/input_box/index.tsx index 65a4e49f61e1..59f736e67cf5 100644 --- a/components/ai_chat/resources/page/components/input_box/index.tsx +++ b/components/ai_chat/resources/page/components/input_box/index.tsx @@ -8,6 +8,7 @@ import * as React from 'react' import classnames from 'classnames' import { getLocale } from '$web-common/locale' import Icon from '@brave/leo/react/icon' +import Button from '@brave/leo/react/button' import styles from './style.module.scss' import DataContext from '../../state/context' @@ -36,7 +37,7 @@ function InputBox () { setInputText('') } - const handleSubmit = (e: React.MouseEvent) => { + const handleSubmit = (e: CustomEvent) => { e.preventDefault() submitInputTextToAPI() } @@ -52,37 +53,40 @@ function InputBox () { } return ( -
-
-
-