diff --git a/BUILD.gn b/BUILD.gn index 38bd219000a5..1642ad9b7fa2 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -610,7 +610,7 @@ if (is_mac) { cargo_audit_target_dir = "$root_build_dir/cargo_audit" cargo_audit_exe = "$cargo_audit_target_dir/release/cargo-audit" -cargo_audit_src = "//brave/tools/crates/cargo_audit/v0_20/crate" +cargo_audit_src = "//brave/tools/crates/cargo_audit/v0_21/crate" if (host_os == "win") { cargo_audit_exe += ".exe" } diff --git a/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/BraveTabGroupUiCoordinator.java b/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/BraveTabGroupUiCoordinator.java index eacbbec5cc31..7e17df14eb0e 100644 --- a/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/BraveTabGroupUiCoordinator.java +++ b/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/BraveTabGroupUiCoordinator.java @@ -8,7 +8,6 @@ import android.app.Activity; import android.view.View; import android.view.ViewGroup; -import android.widget.LinearLayout; import androidx.annotation.NonNull; @@ -19,11 +18,10 @@ import org.chromium.chrome.browser.data_sharing.DataSharingTabManager; import org.chromium.chrome.browser.layouts.LayoutStateProvider; import org.chromium.chrome.browser.tab_ui.TabContentManager; -import org.chromium.chrome.browser.tabmodel.IncognitoStateProvider; -import org.chromium.chrome.browser.tabmodel.IncognitoStateProvider.IncognitoStateObserver; import org.chromium.chrome.browser.tabmodel.TabCreatorManager; import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.tabmodel.TabModelSelectorObserver; +import org.chromium.chrome.browser.theme.ThemeColorProvider; import org.chromium.chrome.browser.toolbar.bottom.BottomControlsCoordinator; import org.chromium.chrome.tab_ui.R; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; @@ -36,15 +34,12 @@ public class BraveTabGroupUiCoordinator extends TabGroupUiCoordinator { private TabGroupUiToolbarView mToolbarView; // Own members. - private IncognitoStateProvider mIncognitoStateProvider; - private IncognitoStateObserver mIncognitoStateObserver; private TabModelSelector mTabModelSelector; public BraveTabGroupUiCoordinator( @NonNull Activity activity, @NonNull ViewGroup parentView, @NonNull BrowserControlsStateProvider browserControlsStateProvider, - @NonNull IncognitoStateProvider incognitoStateProvider, @NonNull ScrimCoordinator scrimCoordinator, @NonNull ObservableSupplier omniboxFocusStateSupplier, @NonNull BottomSheetController bottomSheetController, @@ -53,12 +48,12 @@ public BraveTabGroupUiCoordinator( @NonNull TabContentManager tabContentManager, @NonNull TabCreatorManager tabCreatorManager, @NonNull OneshotSupplier layoutStateProviderSupplier, - @NonNull ModalDialogManager modalDialogManager) { + @NonNull ModalDialogManager modalDialogManager, + @NonNull ThemeColorProvider themeColorProvider) { super( activity, parentView, browserControlsStateProvider, - incognitoStateProvider, scrimCoordinator, omniboxFocusStateSupplier, bottomSheetController, @@ -67,9 +62,9 @@ public BraveTabGroupUiCoordinator( tabContentManager, tabCreatorManager, layoutStateProviderSupplier, - modalDialogManager); + modalDialogManager, + themeColorProvider); - mIncognitoStateProvider = incognitoStateProvider; mTabModelSelector = tabModelSelector; assert mToolbarView != null : "Make sure mToolbarView is properly patched in bytecode."; @@ -133,20 +128,6 @@ private void callSuperInitializeWithNative( BottomControlsCoordinator.BottomControlsVisibilityController visibilityController, Callback onModelTokenChange) { super.initializeWithNative(activity, visibilityController, onModelTokenChange); - - mIncognitoStateObserver = - (isIncognito) -> { - if (!isIncognito) { - // Make sure that background color match bottom toolbar color. - LinearLayout mainContent = mToolbarView.findViewById(R.id.main_content); - assert mainContent != null : "Something has changed in upstream!"; - if (mainContent != null) { - mainContent.setBackgroundColor( - activity.getColor(R.color.dialog_bg_color_baseline)); - } - } - }; - mIncognitoStateProvider.addIncognitoStateObserverAndTrigger(mIncognitoStateObserver); } @Override @@ -157,6 +138,5 @@ public void destroy() { // mTabStripCoordinator could be null in a base class. // https://github.com/brave/brave-browser/issues/40673 } - mIncognitoStateProvider.removeObserver(mIncognitoStateObserver); } } 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 f9a98dff2d6c..dfe5c3e3a33b 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 @@ -174,15 +174,6 @@ - - Quickly compare pages by making a group. To start, touch & hold a link. - - - Tap to see another tab - - - Switch between tabs in your tab group near bottom of screen - You can now open a new tab here @@ -212,6 +203,9 @@ Share + + Manage + @@ -222,18 +216,6 @@ Tab Switcher - - {NUMBER_OF_TABS, plural, - =1 {Close tab group with %1$d1 tab.} - other {Close tab group with %1$d2 tabs.} - } - - - {NUMBER_OF_TABS, plural, - =1 {Close %1$sshopping group with %2$d1 tab.} - other {Close %1$sshopping group with %2$d2 tabs.} - } - @@ -406,18 +388,6 @@ - - {NUMBER_OF_TABS, plural, - =1 {Expand tab group with %1$d1 tab.} - other {Expand tab group with %1$d2 tabs.} - } - - - {NUMBER_OF_TABS, plural, - =1 {Expand %1$sShopping cart tab group with %2$d1 tab.} - other {Expand %1$sShopping cart tab group with %2$d2 tabs.} - } - {TABS_COUNT, plural, =1 {Collapse %1$d1 tab.} @@ -750,9 +720,6 @@ This will permanently delete the group from your device - - Don't ask again - Delete group diff --git a/android/java/apk_for_test.flags b/android/java/apk_for_test.flags index 4407c42ed412..fbe1715ea9e2 100644 --- a/android/java/apk_for_test.flags +++ b/android/java/apk_for_test.flags @@ -145,6 +145,7 @@ *** mModalDialogManagerSupplier; *** mTabObscuringHandler; *** mReadAloudControllerSupplier; + *** mTopUiThemeColorProvider; *** onOrientationChange(...); *** updateBookmarkButtonStatus(...); *** updateReloadState(...); diff --git a/android/java/org/chromium/chrome/browser/BraveIntentHandler.java b/android/java/org/chromium/chrome/browser/BraveIntentHandler.java index 54608d182fda..9392decd57b6 100644 --- a/android/java/org/chromium/chrome/browser/BraveIntentHandler.java +++ b/android/java/org/chromium/chrome/browser/BraveIntentHandler.java @@ -80,17 +80,17 @@ public String call() { return null; } - private static String getUrlForCustomTab(Intent intent) { + private static String getUrlForCustomTab(Intent unused_intent) { assert false; return null; } - private static String getUrlForWebapp(Intent intent) { + private static String getUrlForWebapp(Intent unused_intent) { assert false; return null; } - private static boolean isJavascriptSchemeOrInvalidUrl(String url) { + private static boolean isJavascriptSchemeOrInvalidUrl(String unused_url) { assert false; return false; } diff --git a/android/java/org/chromium/chrome/browser/BraveRewardsNativeWorker.java b/android/java/org/chromium/chrome/browser/BraveRewardsNativeWorker.java index 99fd7e976273..67d4c4813379 100644 --- a/android/java/org/chromium/chrome/browser/BraveRewardsNativeWorker.java +++ b/android/java/org/chromium/chrome/browser/BraveRewardsNativeWorker.java @@ -47,9 +47,6 @@ public interface PublisherObserver { void onFrontTabPublisherChanged(boolean ver public static final int BAT_NOT_ALLOWED = 25; public static final int SAFETYNET_ATTESTATION_FAILED = 27; - private static final int REWARDS_UNKNOWN = 0; - private static final int REWARDS_DISABLED = 1; - private static final int REWARDS_ENABLED = 2; private String mFrontTabUrl; private static final Handler sHandler = new Handler(); diff --git a/android/java/org/chromium/chrome/browser/BraveSyncWorker.java b/android/java/org/chromium/chrome/browser/BraveSyncWorker.java index 8ef588ccffc3..59ef671ad963 100644 --- a/android/java/org/chromium/chrome/browser/BraveSyncWorker.java +++ b/android/java/org/chromium/chrome/browser/BraveSyncWorker.java @@ -5,14 +5,11 @@ package org.chromium.chrome.browser; -import android.content.Context; - import org.jni_zero.CalledByNative; import org.jni_zero.JNINamespace; import org.jni_zero.NativeMethods; import org.chromium.base.Callback; -import org.chromium.base.ContextUtils; import java.time.LocalDateTime; import java.time.ZoneOffset; @@ -21,9 +18,6 @@ public class BraveSyncWorker { private static final String TAG = "SYNC"; - private Context mContext; - private String mDebug = "true"; - private long mNativeBraveSyncWorker; private static BraveSyncWorker sBraveSyncWorker; @@ -67,7 +61,6 @@ private void destroy() { } public BraveSyncWorker() { - mContext = ContextUtils.getApplicationContext(); init(); } diff --git a/android/java/org/chromium/chrome/browser/QRCodeShareDialogFragment.java b/android/java/org/chromium/chrome/browser/QRCodeShareDialogFragment.java index 11307df42a97..7e4d8ffc6c4f 100644 --- a/android/java/org/chromium/chrome/browser/QRCodeShareDialogFragment.java +++ b/android/java/org/chromium/chrome/browser/QRCodeShareDialogFragment.java @@ -28,8 +28,7 @@ public class QRCodeShareDialogFragment extends DialogFragment implements View.On private static final String TAG = "SUPER-REFERRAL"; // For QR code generation - private static final int WHITE = 0xFFFFFFFF; - private static final int BLACK = 0xFF000000; + // WHITE/BLACK depend on the normal/Night mode private static final int WIDTH = 300; private ImageView mQRImage; diff --git a/android/java/org/chromium/chrome/browser/app/BraveActivity.java b/android/java/org/chromium/chrome/browser/app/BraveActivity.java index 60237252b100..4dd98f5d66f3 100644 --- a/android/java/org/chromium/chrome/browser/app/BraveActivity.java +++ b/android/java/org/chromium/chrome/browser/app/BraveActivity.java @@ -142,7 +142,6 @@ import org.chromium.chrome.browser.multiwindow.BraveMultiWindowUtils; import org.chromium.chrome.browser.multiwindow.MultiInstanceManager; import org.chromium.chrome.browser.multiwindow.MultiWindowUtils; -import org.chromium.chrome.browser.notifications.BraveNotificationWarningDialog; import org.chromium.chrome.browser.notifications.permissions.NotificationPermissionController; import org.chromium.chrome.browser.notifications.retention.RetentionNotificationUtil; import org.chromium.chrome.browser.ntp.NewTabPageManager; @@ -278,9 +277,7 @@ public abstract class BraveActivity extends ChromeActivity public static final String BRAVE_WEBCOMPAT_INFO_WIKI_URL = "https://github.com/brave/brave-browser/wiki/Web-compatibility-reports"; - private static final int DAYS_1 = 1; private static final int DAYS_4 = 4; - private static final int DAYS_5 = 5; private static final int DAYS_7 = 7; private static final int DAYS_12 = 12; @@ -1186,7 +1183,7 @@ public void finishNativeInitialization() { } checkFingerPrintingOnUpgrade(isFirstInstall); - checkForVpnCallout(isFirstInstall); + checkForVpnCallout(); if (ChromeFeatureList.isEnabled(BraveFeatureList.BRAVE_VPN_LINK_SUBSCRIPTION_ANDROID_UI) && BraveVpnPrefUtils.isSubscriptionPurchase() @@ -1407,7 +1404,7 @@ private void handleDeepLinkVpn() { BraveVpnUtils.openBraveVpnPlansActivity(this); } - private void checkForVpnCallout(boolean isFirstInstall) { + private void checkForVpnCallout() { String countryCode = Locale.getDefault().getCountry(); if (!countryCode.equals(BraveConstants.INDIA_COUNTRY_CODE) @@ -1671,19 +1668,11 @@ private void checkForYandexSE() { BraveSearchEngineUtils.setDSEPrefs(yandexTemplateUrl, lastUsedRegularProfile); BraveSearchEngineUtils.setDSEPrefs( yandexTemplateUrl, - lastUsedRegularProfile.getPrimaryOTRProfile(/* createIfNeeded= */ true)); + lastUsedRegularProfile.getPrimaryOtrProfile(/* createIfNeeded= */ true)); } } } - private BraveNotificationWarningDialog.DismissListener mCloseDialogListener = - new BraveNotificationWarningDialog.DismissListener() { - @Override - public void onDismiss() { - checkForNotificationData(); - } - }; - private void checkForNotificationData() { Intent notifIntent = getIntent(); if (notifIntent != null && notifIntent.getStringExtra(RetentionNotificationUtil.NOTIFICATION_TYPE) != null) { diff --git a/android/java/org/chromium/chrome/browser/app/bookmarks/BraveBookmarkActivity.java b/android/java/org/chromium/chrome/browser/app/bookmarks/BraveBookmarkActivity.java index 1e384af2ed20..184f704781a0 100644 --- a/android/java/org/chromium/chrome/browser/app/bookmarks/BraveBookmarkActivity.java +++ b/android/java/org/chromium/chrome/browser/app/bookmarks/BraveBookmarkActivity.java @@ -23,7 +23,7 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); IntentRequestTracker intentRequestTracker = IntentRequestTracker.createFromActivity(this); - mWindowAndroid = new ActivityWindowAndroid(this, true, intentRequestTracker); + mWindowAndroid = new ActivityWindowAndroid(this, true, intentRequestTracker, null); mWindowAndroid.getIntentRequestTracker().restoreInstanceState(savedInstanceState); if (mBookmarkManagerCoordinator instanceof BraveBookmarkManagerCoordinator) { ((BraveBookmarkManagerCoordinator) mBookmarkManagerCoordinator) diff --git a/android/java/org/chromium/chrome/browser/app/domain/CryptoModel.java b/android/java/org/chromium/chrome/browser/app/domain/CryptoModel.java index 0806733aa7a2..246285c1ad71 100644 --- a/android/java/org/chromium/chrome/browser/app/domain/CryptoModel.java +++ b/android/java/org/chromium/chrome/browser/app/domain/CryptoModel.java @@ -35,6 +35,13 @@ import java.util.Arrays; import java.util.List; +// Unused members, never read: +// - mSolanaTxManagerProxy +// - mSwapService +// - mBlockchainRegistry +// - mEthTxManagerProxy +// - mAssetRatioService +@SuppressWarnings("UnusedVariable") public class CryptoModel { private TxService mTxService; private final PendingTxHelper mPendingTxHelper; diff --git a/android/java/org/chromium/chrome/browser/app/helpers/ImageLoader.java b/android/java/org/chromium/chrome/browser/app/helpers/ImageLoader.java index 87499813a6ab..4109725d0b2f 100644 --- a/android/java/org/chromium/chrome/browser/app/helpers/ImageLoader.java +++ b/android/java/org/chromium/chrome/browser/app/helpers/ImageLoader.java @@ -61,16 +61,13 @@ import java.lang.ref.WeakReference; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; -import java.util.Arrays; import java.util.Iterator; -import java.util.List; import java.util.Locale; import java.util.regex.Matcher; import java.util.regex.Pattern; public class ImageLoader { private static final String TAG = "ImageLoader"; - private static final List ANIMATED_LIST = Arrays.asList(".gif"); private static final String UNUSED_CLIENT_NAME = "unused"; private static final String BASE64_ENCODING_PATTERN = "^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$"; @@ -113,9 +110,8 @@ private static void downloadImage(String url, final RequestManager requestManage validUrl = url; } - WebContentsFactory webContentsFactory = new WebContentsFactory(); WebContents webContents = - webContentsFactory.createWebContentsWithWarmRenderer( + WebContentsFactory.createWebContentsWithWarmRenderer( profile, true, NetId.INVALID); webContents.downloadImage( new GURL(validUrl), // Url @@ -333,36 +329,50 @@ public static String sanitizeSvg(String input) { } } - private static void loadImage(ImageFetcherFacade imageFetcherFacade, - RequestManager requestManager, boolean isCircular, final int roundedCorners, - ImageView imageView, CustomTarget customTarget, Callback callback) { + private static void loadImage( + ImageFetcherFacade imageFetcherFacade, + RequestManager requestManager, + boolean isCircular, + final int roundedCorners, + ImageView imageView, + CustomTarget customTarget, + Callback callback) { if (imageFetcherFacade == null - || (imageFetcherFacade.data == null && imageFetcherFacade.drawable == null)) { + || (imageFetcherFacade.mData == null && imageFetcherFacade.mDrawable == null)) { if (callback != null) callback.onLoadFailed(); return; } RequestBuilder request = requestManager - .load(imageFetcherFacade.data != null ? imageFetcherFacade.data - : imageFetcherFacade.drawable) + .load( + imageFetcherFacade.mData != null + ? imageFetcherFacade.mData + : imageFetcherFacade.mDrawable) .transform(getTransformations(isCircular, roundedCorners)) .diskCacheStrategy(DiskCacheStrategy.NONE) .priority(Priority.IMMEDIATE) - .listener(new RequestListener() { - @Override - public boolean onLoadFailed(GlideException glideException, Object model, - Target target, boolean isFirstResource) { - return callback != null && callback.onLoadFailed(); - } - - @Override - public boolean onResourceReady(Drawable resource, Object model, - Target target, DataSource dataSource, - boolean isFirstResource) { - return callback != null - && callback.onResourceReady(resource, target); - } - }); + .listener( + new RequestListener() { + @Override + public boolean onLoadFailed( + GlideException glideException, + Object model, + Target target, + boolean isFirstResource) { + return callback != null && callback.onLoadFailed(); + } + + @Override + public boolean onResourceReady( + Drawable resource, + Object model, + Target target, + DataSource dataSource, + boolean isFirstResource) { + return callback != null + && callback.onResourceReady(resource, target); + } + }); if (imageView != null) { request.into(imageView); @@ -516,16 +526,17 @@ public interface Callback { } private static class ImageFetcherFacade { - final byte[] data; - final Drawable drawable; + final byte[] mData; + final Drawable mDrawable; + public ImageFetcherFacade(byte[] data) { - this.data = data; - this.drawable = null; + mData = data; + mDrawable = null; } ImageFetcherFacade(Drawable drawable) { - this.drawable = drawable; - this.data = null; + mDrawable = drawable; + mData = null; } } } diff --git a/android/java/org/chromium/chrome/browser/appmenu/BraveTabbedAppMenuPropertiesDelegate.java b/android/java/org/chromium/chrome/browser/appmenu/BraveTabbedAppMenuPropertiesDelegate.java index b5ab465dc1dc..ec83f9179c68 100644 --- a/android/java/org/chromium/chrome/browser/appmenu/BraveTabbedAppMenuPropertiesDelegate.java +++ b/android/java/org/chromium/chrome/browser/appmenu/BraveTabbedAppMenuPropertiesDelegate.java @@ -130,7 +130,6 @@ public void prepareMenu(Menu menu, AppMenuHandler handler) { menu.findItem(R.id.request_vpn_location_row_menu_id).getSubMenu(); MenuItem vpnLocationSubMenuItem = vpnLocationSubMenu.findItem(R.id.request_vpn_location_id); - String isoCode = BraveVpnPrefUtils.getRegionIsoCode(); String regionName = BraveVpnPrefUtils.getRegionPrecision() .equals(BraveVpnConstants.REGION_PRECISION_COUNTRY) @@ -302,7 +301,7 @@ public void prepareMenu(Menu menu, AppMenuHandler handler) { // By this we forcibly initialize BookmarkBridge MenuItem bookmarkItem = menu.findItem(R.id.bookmark_this_page_id); if (bookmarkItem != null && currentTab != null) { - updateBookmarkMenuItemShortcut(bookmarkItem, currentTab, /* fromCCT= */ false); + updateBookmarkMenuItemShortcut(bookmarkItem, currentTab, /* fromCct= */ false); } // Remove unused dividers. This needs to be done after the visibility of all the items is diff --git a/android/java/org/chromium/chrome/browser/autofill/BraveAutofillBackgroundServiceImpl.java b/android/java/org/chromium/chrome/browser/autofill/BraveAutofillBackgroundServiceImpl.java index af43c7dcdade..bffa4fb44db9 100644 --- a/android/java/org/chromium/chrome/browser/autofill/BraveAutofillBackgroundServiceImpl.java +++ b/android/java/org/chromium/chrome/browser/autofill/BraveAutofillBackgroundServiceImpl.java @@ -397,7 +397,7 @@ private String inferHint(Context context, ViewNode node, @Nullable String actual return null; } - if (isOmnibox(node, hint)) { + if (isOmnibox(node)) { return null; } @@ -457,7 +457,7 @@ private String inferHint(Context context, ViewNode node, @Nullable String actual return null; } - private boolean isOmnibox(ViewNode node, String hint) { + private boolean isOmnibox(ViewNode node) { int inputType = node.getInputType(); if ((inputType & EditorInfo.TYPE_TEXT_VARIATION_URI) diff --git a/android/java/org/chromium/chrome/browser/billing/InAppPurchaseWrapper.java b/android/java/org/chromium/chrome/browser/billing/InAppPurchaseWrapper.java index 7c07055b4b0d..423c2ba9220b 100644 --- a/android/java/org/chromium/chrome/browser/billing/InAppPurchaseWrapper.java +++ b/android/java/org/chromium/chrome/browser/billing/InAppPurchaseWrapper.java @@ -352,12 +352,14 @@ public void initiatePurchase(Activity activity, ProductDetails productDetails) { MutableLiveData _billingConnectionState = new MutableLiveData(); LiveData billingConnectionState = _billingConnectionState; startBillingServiceConnection(_billingConnectionState); - LiveDataUtil.observeOnce(billingConnectionState, isConnected -> { - if (isConnected) { - BillingResult billingResult = - mBillingClient.launchBillingFlow(activity, billingFlowParams); - } - }); + LiveDataUtil.observeOnce( + billingConnectionState, + isConnected -> { + if (isConnected) { + BillingResult unused_billingResult = + mBillingClient.launchBillingFlow(activity, billingFlowParams); + } + }); } public void processPurchases(Context context, Purchase activePurchase) { diff --git a/android/java/org/chromium/chrome/browser/brave_leo/BraveLeoActivity.java b/android/java/org/chromium/chrome/browser/brave_leo/BraveLeoActivity.java index e503be208a03..acc798e26fc9 100644 --- a/android/java/org/chromium/chrome/browser/brave_leo/BraveLeoActivity.java +++ b/android/java/org/chromium/chrome/browser/brave_leo/BraveLeoActivity.java @@ -97,7 +97,6 @@ protected RootUiCoordinator createRootUiCoordinator() { /* statusBarColorProvider= */ this, getIntentRequestTracker(), () -> mToolbarCoordinator, - () -> mNavigationController, () -> mIntentDataProvider, mBackPressManager, () -> mTabController, diff --git a/android/java/org/chromium/chrome/browser/brave_leo/BraveLeoCustomTabRootUiCoordinator.java b/android/java/org/chromium/chrome/browser/brave_leo/BraveLeoCustomTabRootUiCoordinator.java index 3df247f93914..04e7c846199d 100644 --- a/android/java/org/chromium/chrome/browser/brave_leo/BraveLeoCustomTabRootUiCoordinator.java +++ b/android/java/org/chromium/chrome/browser/brave_leo/BraveLeoCustomTabRootUiCoordinator.java @@ -24,7 +24,6 @@ import org.chromium.chrome.browser.compositor.layouts.LayoutManagerImpl; import org.chromium.chrome.browser.customtabs.BaseCustomTabRootUiCoordinator; import org.chromium.chrome.browser.customtabs.CustomTabFeatureOverridesManager; -import org.chromium.chrome.browser.customtabs.content.CustomTabActivityNavigationController; import org.chromium.chrome.browser.customtabs.content.CustomTabActivityTabController; import org.chromium.chrome.browser.customtabs.features.minimizedcustomtab.CustomTabMinimizeDelegate; import org.chromium.chrome.browser.customtabs.features.toolbar.CustomTabToolbarCoordinator; @@ -83,7 +82,6 @@ public BraveLeoCustomTabRootUiCoordinator( @NonNull StatusBarColorProvider statusBarColorProvider, @NonNull IntentRequestTracker intentRequestTracker, @NonNull Supplier customTabToolbarCoordinator, - @NonNull Supplier customTabNavigationController, @NonNull Supplier intentDataProvider, @NonNull BackPressManager backPressManager, @NonNull Supplier tabController, @@ -122,7 +120,6 @@ public BraveLeoCustomTabRootUiCoordinator( statusBarColorProvider, intentRequestTracker, customTabToolbarCoordinator, - customTabNavigationController, intentDataProvider, backPressManager, tabController, diff --git a/android/java/org/chromium/chrome/browser/brave_news/BraveNewsUtils.java b/android/java/org/chromium/chrome/browser/brave_news/BraveNewsUtils.java index b08374e43867..f5905e350082 100644 --- a/android/java/org/chromium/chrome/browser/brave_news/BraveNewsUtils.java +++ b/android/java/org/chromium/chrome/browser/brave_news/BraveNewsUtils.java @@ -55,7 +55,6 @@ public static String getPromotionIdItem(FeedItemsCard items) { if (items.getFeedItems() != null) { for (FeedItemCard itemCard : items.getFeedItems()) { FeedItem item = itemCard.getFeedItem(); - FeedItemMetadata itemMetaData = new FeedItemMetadata(); if (item.which() == FeedItem.Tag.PromotedArticle) { PromotedArticle promotedArticle = item.getPromotedArticle(); creativeInstanceId = promotedArticle.creativeInstanceId; @@ -89,6 +88,7 @@ public static DisplayAd getFromDisplayAdsMap(Integer index) { // method for logging news object. works by putting Log.d in the desired places of the parsing // of the object + @SuppressWarnings("UnusedVariable") public static void logFeedItem(FeedItemsCard items, String id) { if (items != null) { if (items.getCardType() == CardType.DISPLAY_AD) { diff --git a/android/java/org/chromium/chrome/browser/brave_news/CardBuilderFeedCard.java b/android/java/org/chromium/chrome/browser/brave_news/CardBuilderFeedCard.java index 4b0415137a9d..0e9e0d4e6672 100644 --- a/android/java/org/chromium/chrome/browser/brave_news/CardBuilderFeedCard.java +++ b/android/java/org/chromium/chrome/browser/brave_news/CardBuilderFeedCard.java @@ -107,7 +107,6 @@ public class CardBuilderFeedCard { private String mCreativeInstanceId; private String mOffersCategory; private RequestManager mGlide; - private DisplayAdsTable mPosTabAd; private static final String TAG = "BN"; private static final int MARGIN_VERTICAL = 10; @@ -124,7 +123,6 @@ public CardBuilderFeedCard(BraveNewsController braveNewsController, RequestManag mBraveNewsController = braveNewsController; mDeviceWidth = ConfigurationUtils.getDisplayMetrics(activity).get("width"); mGlide = glide; - mPosTabAd = new DisplayAdsTable(); mIsPromo = false; mCreativeInstanceId = ""; @@ -196,18 +194,14 @@ private void createdDisplayAdCard(DisplayAd adData) { RecyclerView.LayoutParams linearLayoutParams = (RecyclerView.LayoutParams) mLinearLayout.getLayoutParams(); - TableLayout.LayoutParams tableParamsTopNews = new TableLayout.LayoutParams( - TableLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); - TableLayout.LayoutParams tableParamsRow1 = new TableLayout.LayoutParams( - TableLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); - TableLayout.LayoutParams rowTableParams = new TableLayout.LayoutParams( - TableLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); + TableLayout.LayoutParams rowTableParams = + new TableLayout.LayoutParams( + TableLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); FrameLayout adLayoutUp = new FrameLayout(mActivity); ImageView adImage = new ImageView(mActivity); TextView adLogo = new TextView(mActivity); - LinearLayout adLayoutDown = new LinearLayout(mActivity); TextView adTitle = new TextView(mActivity); TextView adDesc = new TextView(mActivity); Button adButton = new Button(mActivity); @@ -218,19 +212,23 @@ private void createdDisplayAdCard(DisplayAd adData) { TableRow row1 = new TableRow(mActivity); TableRow row2 = new TableRow(mActivity); - TableRow.LayoutParams adLayoutParams = new TableRow.LayoutParams( - TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT); - TableRow.LayoutParams adLayoutDownParams = new TableRow.LayoutParams( - TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT); + TableRow.LayoutParams adLayoutParams = + new TableRow.LayoutParams( + TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT); - FrameLayout.LayoutParams adImageParams = new FrameLayout.LayoutParams( - FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT); + FrameLayout.LayoutParams adImageParams = + new FrameLayout.LayoutParams( + FrameLayout.LayoutParams.WRAP_CONTENT, + FrameLayout.LayoutParams.WRAP_CONTENT); - TableRow.LayoutParams adButtonParams = new TableRow.LayoutParams( - TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT); + TableRow.LayoutParams adButtonParams = + new TableRow.LayoutParams( + TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT); - tableLayoutTopNews.setLayoutParams(new LinearLayout.LayoutParams( - LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); + tableLayoutTopNews.setLayoutParams( + new LinearLayout.LayoutParams( + LinearLayout.LayoutParams.MATCH_PARENT, + LinearLayout.LayoutParams.WRAP_CONTENT)); mLinearLayout.addView(tableLayoutTopNews); linearLayoutParams.height = 0; @@ -242,10 +240,10 @@ private void createdDisplayAdCard(DisplayAd adData) { if (adData != null) { linearLayoutParams.height = RecyclerView.LayoutParams.WRAP_CONTENT; mLinearLayout.setLayoutParams(linearLayoutParams); - FrameLayout.LayoutParams adLogoParams = new FrameLayout.LayoutParams( - FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT); - TableRow.LayoutParams adItemsParams = new TableRow.LayoutParams( - TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT); + FrameLayout.LayoutParams adLogoParams = + new FrameLayout.LayoutParams( + FrameLayout.LayoutParams.MATCH_PARENT, + FrameLayout.LayoutParams.WRAP_CONTENT); rowTableParams.setMargins(50, 0, 50, 0); rowTableParams.width = TableLayout.LayoutParams.MATCH_PARENT; @@ -272,7 +270,7 @@ private void createdDisplayAdCard(DisplayAd adData) { adImage.setLayoutParams(adImageLinearParams); adImage.setContentDescription(mActivity.getResources().getText(R.string.brave_news_ad)); - setDisplayAdImage(adImage, adData.image, 1); + setDisplayAdImage(adImage, adData.image); adLayoutUp.addView(adImage); adLayoutUp.addView(adLogo); @@ -312,8 +310,11 @@ public void onClick(View v) { row2.addView(adDesc); row2.addView(adButton); - adItemsParams = new TableRow.LayoutParams( - TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT, 1.0f); + TableRow.LayoutParams adItemsParams = + new TableRow.LayoutParams( + TableRow.LayoutParams.MATCH_PARENT, + TableRow.LayoutParams.WRAP_CONTENT, + 1.0f); adTitle.setTextSize(17); adItemsParams.bottomMargin = 2 * MARGIN_VERTICAL; adTitle.setTypeface(null, Typeface.BOLD); @@ -363,13 +364,12 @@ public void onClick(View v) { public LinearLayout createCard(int type, int position) { TableLayout tableLayoutTopNews = new TableLayout(mActivity); - TableLayout.LayoutParams tableParamsTopNews = new TableLayout.LayoutParams( - TableLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); - TableLayout.LayoutParams tableParamsRow1 = new TableLayout.LayoutParams( - TableLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); - TableLayout.LayoutParams rowTableParams = new TableLayout.LayoutParams( - TableLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); - int displayHeight = mActivity.getResources().getDisplayMetrics().heightPixels; + TableLayout.LayoutParams tableParamsTopNews = + new TableLayout.LayoutParams( + TableLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + TableLayout.LayoutParams rowTableParams = + new TableLayout.LayoutParams( + TableLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); TableRow rowTop = new TableRow(mActivity); TextView topText = new TextView(mActivity); BraveTouchUtils.ensureMinTouchTarget(topText); @@ -595,7 +595,6 @@ public void onClick(View v) { linearLayoutParams.setMargins( mHorizontalMargin, 0, mHorizontalMargin, 5 * MARGIN_VERTICAL); - int height = mActivity.getResources().getDisplayMetrics().heightPixels; mLinearLayout.setLayoutParams(linearLayoutParams); mLinearLayout.addView(tableLayoutTopNews); @@ -739,43 +738,54 @@ private void openUrlAndSaveEvent(DisplayAd adData) { private void addElementsToSingleLayout(ViewGroup view, int index, int itemType, int position) { ImageView image = new ImageView(mActivity); - ImageView logo = new ImageView(mActivity); TextView title = new TextView(mActivity); TextView publisher = new TextView(mActivity); TextView source = new TextView(mActivity); TextView desc = new TextView(mActivity); - LinearLayout.LayoutParams linearLayoutParams = new LinearLayout.LayoutParams( - LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); - - LinearLayout.LayoutParams publisherParams = new LinearLayout.LayoutParams( - LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, 1f); - LinearLayout.LayoutParams imageParams = new LinearLayout.LayoutParams( - LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT, 1f); - LinearLayout.LayoutParams titleParams = new LinearLayout.LayoutParams( - LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT, 1f); - LinearLayout.LayoutParams sourceParams = new LinearLayout.LayoutParams( - LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT, 1f); - LinearLayout.LayoutParams descParams = new LinearLayout.LayoutParams( - LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT, 1f); - LinearLayout.LayoutParams logoParams = new LinearLayout.LayoutParams( - LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT, 1f); - - TableLayout.LayoutParams tableParamsTopNews = new TableLayout.LayoutParams( - TableLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); - - TableRow.LayoutParams linearLayoutRowParams = new TableRow.LayoutParams( - TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT); - TableRow.LayoutParams linearLayoutRowParams1 = new TableRow.LayoutParams( - TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT); - TableRow.LayoutParams sourceRowParams = new TableRow.LayoutParams( - TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT); - TableRow.LayoutParams titleRowParams = new TableRow.LayoutParams( - TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT); - TableRow.LayoutParams descRowParams = new TableRow.LayoutParams( - TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT); - TableRow.LayoutParams imageRowParams = new TableRow.LayoutParams( - TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT); + LinearLayout.LayoutParams publisherParams = + new LinearLayout.LayoutParams( + LinearLayout.LayoutParams.MATCH_PARENT, + LinearLayout.LayoutParams.WRAP_CONTENT, + 1f); + LinearLayout.LayoutParams imageParams = + new LinearLayout.LayoutParams( + LinearLayout.LayoutParams.MATCH_PARENT, + LinearLayout.LayoutParams.MATCH_PARENT, + 1f); + LinearLayout.LayoutParams titleParams = + new LinearLayout.LayoutParams( + LinearLayout.LayoutParams.MATCH_PARENT, + LinearLayout.LayoutParams.MATCH_PARENT, + 1f); + LinearLayout.LayoutParams descParams = + new LinearLayout.LayoutParams( + LinearLayout.LayoutParams.MATCH_PARENT, + LinearLayout.LayoutParams.MATCH_PARENT, + 1f); + + TableLayout.LayoutParams tableParamsTopNews = + new TableLayout.LayoutParams( + TableLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); + + TableRow.LayoutParams linearLayoutRowParams = + new TableRow.LayoutParams( + TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT); + TableRow.LayoutParams linearLayoutRowParams1 = + new TableRow.LayoutParams( + TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT); + TableRow.LayoutParams sourceRowParams = + new TableRow.LayoutParams( + TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT); + TableRow.LayoutParams titleRowParams = + new TableRow.LayoutParams( + TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT); + TableRow.LayoutParams descRowParams = + new TableRow.LayoutParams( + TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT); + TableRow.LayoutParams imageRowParams = + new TableRow.LayoutParams( + TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT); LinearLayout layoutSingleCard = new LinearLayout(mActivity); publisher.setLetterSpacing(0.03f); @@ -1247,7 +1257,7 @@ private void setTextFromFeed(TextView textView, int type, int index) { FeedItemMetadata itemData = getItemData(index); if (itemData != null) { setText(itemData, textView, type); - setListeners(textView, itemData.url.url, mCreativeInstanceId, mIsPromo); + setListeners(textView, mCreativeInstanceId, mIsPromo); } } catch (Exception e) { @@ -1267,26 +1277,19 @@ private FeedItemMetadata getItemData(int index) { switch (feedItem.which()) { case FeedItem.Tag.Article: - Article article = feedItem.getArticle(); - FeedItemMetadata articleData = article.data; itemData = article.data; - break; case FeedItem.Tag.PromotedArticle: PromotedArticle promotedArticle = feedItem.getPromotedArticle(); - FeedItemMetadata promotedArticleData = promotedArticle.data; mCreativeInstanceId = promotedArticle.creativeInstanceId; itemData = promotedArticle.data; - mIsPromo = true; break; case FeedItem.Tag.Deal: Deal deal = feedItem.getDeal(); - FeedItemMetadata dealData = deal.data; mOffersCategory = deal.offersCategory; itemData = deal.data; - break; } } catch (Exception e) { @@ -1298,8 +1301,7 @@ private FeedItemMetadata getItemData(int index) { return itemDataFinal; } - private void setListeners( - View view, String urlString, String creativeInstanceId, boolean isPromo) { + private void setListeners(View view, String creativeInstanceId, boolean isPromo) { DisplayAd displayAd = mNewsItem.getDisplayAd(); view.setOnClickListener( new View.OnClickListener() { @@ -1343,7 +1345,7 @@ private void setText(FeedItemMetadata itemData, TextView textView, int type) { } } - private void setDisplayAdImage(ImageView imageView, Image adDataImage, int index) { + private void setDisplayAdImage(ImageView imageView, Image adDataImage) { Url imageUrlTemp = null; switch (adDataImage.which()) { @@ -1424,21 +1426,29 @@ private void setImage(ImageView imageView, String type, int index) { } // used for logging the Glide implementation - private RequestListener createLoggerListener(final String name) { + private RequestListener createLoggerListener(final String unused_name) { return new RequestListener() { @Override - public boolean onLoadFailed(@Nullable GlideException e, Object model, Target target, + public boolean onLoadFailed( + @Nullable GlideException e, + Object model, + Target target, boolean isFirstResource) { return false; } + @Override - public boolean onResourceReady(Drawable resource, Object model, Target target, - DataSource dataSource, boolean isFirstResource) { + public boolean onResourceReady( + Drawable resource, + Object model, + Target target, + DataSource dataSource, + boolean isFirstResource) { if (resource instanceof BitmapDrawable) { - Bitmap bitmap = ((BitmapDrawable) resource).getBitmap(); + // Bitmap bitmap = ((BitmapDrawable) resource).getBitmap(); // Log.d(TAG,String.format(Locale.getDefault(), "Ready %s bitmap %,d bytes, // size: %d x %d", - // name, + // unused_name, // bitmap.getByteCount(), // bitmap.getWidth(), // bitmap.getHeight())); diff --git a/android/java/org/chromium/chrome/browser/brave_stats/BraveStatsBottomSheetDialogFragment.java b/android/java/org/chromium/chrome/browser/brave_stats/BraveStatsBottomSheetDialogFragment.java index bde8b8d21e63..e878f312ee43 100644 --- a/android/java/org/chromium/chrome/browser/brave_stats/BraveStatsBottomSheetDialogFragment.java +++ b/android/java/org/chromium/chrome/browser/brave_stats/BraveStatsBottomSheetDialogFragment.java @@ -46,9 +46,7 @@ import java.util.List; public class BraveStatsBottomSheetDialogFragment extends BottomSheetDialogFragment { - final public static String TAG_FRAGMENT = "BRAVESTATS_FRAG"; - private static final String APP_PACKAGE = "app_package"; - private static final String APP_UID = "app_uid"; + public static final String TAG_FRAGMENT = "BRAVESTATS_FRAG"; private DatabaseHelper mDatabaseHelper = DatabaseHelper.getInstance(); private static final int WEBSITES = 0; diff --git a/android/java/org/chromium/chrome/browser/compositor/layouts/BraveToolbarSwipeLayout.java b/android/java/org/chromium/chrome/browser/compositor/layouts/BraveToolbarSwipeLayout.java index e819531cce6c..b56dff088bd0 100644 --- a/android/java/org/chromium/chrome/browser/compositor/layouts/BraveToolbarSwipeLayout.java +++ b/android/java/org/chromium/chrome/browser/compositor/layouts/BraveToolbarSwipeLayout.java @@ -6,7 +6,9 @@ package org.chromium.chrome.browser.compositor.layouts; import android.content.Context; +import android.view.ViewGroup; +import org.chromium.base.supplier.Supplier; import org.chromium.chrome.browser.browser_controls.BrowserControlsStateProvider; import org.chromium.chrome.browser.layouts.LayoutManager; import org.chromium.chrome.browser.theme.TopUiThemeColorProvider; @@ -17,6 +19,7 @@ public class BraveToolbarSwipeLayout extends ToolbarSwipeLayout { * Whether or not to move toolbar with tab contents. Will be deleted in bytecode, value from the * parent class will be used instead. */ + @SuppressWarnings("UnusedVariable") private boolean mMoveToolbar; public BraveToolbarSwipeLayout( @@ -25,14 +28,18 @@ public BraveToolbarSwipeLayout( LayoutRenderHost renderHost, BrowserControlsStateProvider browserControlsStateProvider, LayoutManager layoutManager, - TopUiThemeColorProvider topUiColorProvider) { + TopUiThemeColorProvider topUiColorProvider, + Supplier bottomControlsOffsetSupplier, + ViewGroup contentContainer) { super( context, updateHost, renderHost, browserControlsStateProvider, layoutManager, - topUiColorProvider); + topUiColorProvider, + bottomControlsOffsetSupplier, + contentContainer); // To postpone toolbar transition animation to the end of the swipe. mMoveToolbar = false; diff --git a/android/java/org/chromium/chrome/browser/contextmenu/BraveChromeContextMenuPopulator.java b/android/java/org/chromium/chrome/browser/contextmenu/BraveChromeContextMenuPopulator.java index 6e5c4e609c29..7b3c44e1df1f 100644 --- a/android/java/org/chromium/chrome/browser/contextmenu/BraveChromeContextMenuPopulator.java +++ b/android/java/org/chromium/chrome/browser/contextmenu/BraveChromeContextMenuPopulator.java @@ -15,7 +15,6 @@ import org.chromium.components.embedder_support.contextmenu.ContextMenuItemDelegate; import org.chromium.components.embedder_support.contextmenu.ContextMenuNativeDelegate; import org.chromium.components.embedder_support.contextmenu.ContextMenuParams; -import org.chromium.components.externalauth.ExternalAuthUtils; import org.chromium.mojo.bindings.ConnectionErrorHandler; import org.chromium.mojo.system.MojoException; import org.chromium.url_sanitizer.mojom.UrlSanitizerService; @@ -29,18 +28,10 @@ public BraveChromeContextMenuPopulator( TabContextMenuItemDelegate itemDelegate, Supplier shareDelegate, @ContextMenuMode int mode, - ExternalAuthUtils externalAuthUtils, Context context, ContextMenuParams params, ContextMenuNativeDelegate nativeDelegate) { - super( - itemDelegate, - shareDelegate, - mode, - externalAuthUtils, - context, - params, - nativeDelegate); + super(itemDelegate, shareDelegate, mode, context, params, nativeDelegate); mItemDelegate = itemDelegate; mParams = params; diff --git a/android/java/org/chromium/chrome/browser/crypto_wallet/activities/AddAccountActivity.java b/android/java/org/chromium/chrome/browser/crypto_wallet/activities/AddAccountActivity.java index e68602db7703..0203c16a85c4 100644 --- a/android/java/org/chromium/chrome/browser/crypto_wallet/activities/AddAccountActivity.java +++ b/android/java/org/chromium/chrome/browser/crypto_wallet/activities/AddAccountActivity.java @@ -93,7 +93,7 @@ protected void triggerLayoutInflation() { final Button btnAdd = findViewById(R.id.btn_add); TextView importBtn = findViewById(R.id.import_btn); - EditText mImportAccountPasswordText = findViewById(R.id.import_account_password_text); + mImportAccountPasswordText = findViewById(R.id.import_account_password_text); btnAdd.setEnabled(false); try { diff --git a/android/java/org/chromium/chrome/browser/crypto_wallet/activities/BraveWalletActivity.java b/android/java/org/chromium/chrome/browser/crypto_wallet/activities/BraveWalletActivity.java index c92fc40cca8f..5a822b5d49b3 100644 --- a/android/java/org/chromium/chrome/browser/crypto_wallet/activities/BraveWalletActivity.java +++ b/android/java/org/chromium/chrome/browser/crypto_wallet/activities/BraveWalletActivity.java @@ -16,8 +16,6 @@ import androidx.appcompat.view.menu.MenuBuilder; import androidx.viewpager2.widget.ViewPager2; -import com.google.android.material.appbar.MaterialToolbar; - import org.chromium.base.Log; import org.chromium.chrome.R; import org.chromium.chrome.browser.app.BraveActivity; @@ -47,8 +45,6 @@ public class BraveWalletActivity extends BraveWalletBaseActivity implements OnNe private static final String TAG = "BWalletBaseActivity"; - private MaterialToolbar mToolbar; - private View mCryptoOnboardingLayout; private ImageView mOnboardingCloseButton; private ImageView mOnboardingBackButton; @@ -180,7 +176,7 @@ public void onDestroy() { @Override protected ActivityWindowAndroid createWindowAndroid() { - return new ActivityWindowAndroid(this, true, getIntentRequestTracker()) { + return new ActivityWindowAndroid(this, true, getIntentRequestTracker(), null) { @Override public ModalDialogManager getModalDialogManager() { return mModalDialogManager; diff --git a/android/java/org/chromium/chrome/browser/crypto_wallet/adapters/CreateAccountAdapter.java b/android/java/org/chromium/chrome/browser/crypto_wallet/adapters/CreateAccountAdapter.java index 469dff884dab..625bf240c991 100644 --- a/android/java/org/chromium/chrome/browser/crypto_wallet/adapters/CreateAccountAdapter.java +++ b/android/java/org/chromium/chrome/browser/crypto_wallet/adapters/CreateAccountAdapter.java @@ -6,8 +6,6 @@ package org.chromium.chrome.browser.crypto_wallet.adapters; import android.content.Context; -import android.os.Handler; -import android.os.Looper; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -21,13 +19,8 @@ import org.chromium.chrome.browser.crypto_wallet.model.CryptoAccountTypeInfo; import java.util.List; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; public class CreateAccountAdapter extends RecyclerView.Adapter { - private Context mContext; - private final ExecutorService mExecutor; - private final Handler mHandler; private final LayoutInflater inflater; private OnCreateAccountClickListener mCreateAccountClickListener; private List mCryptoAccountTypeInfos; @@ -35,15 +28,11 @@ public class CreateAccountAdapter extends RecyclerView.Adapter cryptoAccountTypeInfos) { mCryptoAccountTypeInfos = cryptoAccountTypeInfos; - this.mContext = context; inflater = LayoutInflater.from(context); - mExecutor = Executors.newSingleThreadExecutor(); - mHandler = new Handler(Looper.getMainLooper()); } @Override public @NonNull ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { - mContext = parent.getContext(); View view = inflater.inflate(R.layout.item_create_account, parent, false); return new ViewHolder(view); } diff --git a/android/java/org/chromium/chrome/browser/crypto_wallet/presenters/SolanaInstructionPresenter.java b/android/java/org/chromium/chrome/browser/crypto_wallet/presenters/SolanaInstructionPresenter.java index 6c68f7217f29..b4cafcf030b5 100644 --- a/android/java/org/chromium/chrome/browser/crypto_wallet/presenters/SolanaInstructionPresenter.java +++ b/android/java/org/chromium/chrome/browser/crypto_wallet/presenters/SolanaInstructionPresenter.java @@ -295,6 +295,8 @@ private static class SolanaInstructionAccountPresenter { private String mPubKey; private SolanaAccountMeta mSolanaAccountMeta; private String mLocalizeAccountHeader; + + @SuppressWarnings("UnusedVariable") private String mAccountHeader; private SolanaInstructionAccountPresenter( diff --git a/android/java/org/chromium/chrome/browser/crypto_wallet/util/AsyncUtils.java b/android/java/org/chromium/chrome/browser/crypto_wallet/util/AsyncUtils.java index 687eee563ca7..0345a63fbaa4 100644 --- a/android/java/org/chromium/chrome/browser/crypto_wallet/util/AsyncUtils.java +++ b/android/java/org/chromium/chrome/browser/crypto_wallet/util/AsyncUtils.java @@ -32,7 +32,7 @@ public static class MultiResponseHandler { private Runnable mWhenAllCompletedRunnable; private int mTotalElements; private int mCurrentElements; - private Object mLock = new Object(); + private final Object mLock = new Object(); public MultiResponseHandler(int totalElements) { synchronized (mLock) { diff --git a/android/java/org/chromium/chrome/browser/crypto_wallet/util/ParsedTransaction.java b/android/java/org/chromium/chrome/browser/crypto_wallet/util/ParsedTransaction.java index c5bced96e850..2b69b2a95924 100644 --- a/android/java/org/chromium/chrome/browser/crypto_wallet/util/ParsedTransaction.java +++ b/android/java/org/chromium/chrome/browser/crypto_wallet/util/ParsedTransaction.java @@ -517,9 +517,6 @@ public static ParsedTransaction parseTransaction( final double price = Utils.getOrDefault( assetPrices, txNetwork.symbol.toLowerCase(Locale.ENGLISH), 0.0d); - for (String k : assetPrices.keySet()) { - String v = String.valueOf(assetPrices.get(k)); - } double sendAmount = 0; if (txInfo.txType == TransactionType.SOLANA_SYSTEM_TRANSFER) { sendAmount = Utils.fromWei(value, txNetwork.decimals); diff --git a/android/java/org/chromium/chrome/browser/crypto_wallet/util/Utils.java b/android/java/org/chromium/chrome/browser/crypto_wallet/util/Utils.java index ca0cd6701662..039c7494ef73 100644 --- a/android/java/org/chromium/chrome/browser/crypto_wallet/util/Utils.java +++ b/android/java/org/chromium/chrome/browser/crypto_wallet/util/Utils.java @@ -173,7 +173,6 @@ public static String getTextFromClipboard(Context context) { ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); ClipData clipData = clipboard.getPrimaryClip(); - String pasteData = ""; if (clipData != null && clipData.getDescription().hasMimeType(MIMETYPE_TEXT_PLAIN) && clipData.getItemCount() > 0) { diff --git a/android/java/org/chromium/chrome/browser/custom_layout/popup_window_tooltip/PopupWindowTooltip.java b/android/java/org/chromium/chrome/browser/custom_layout/popup_window_tooltip/PopupWindowTooltip.java index cfff4f5604e5..158e66bc99bf 100644 --- a/android/java/org/chromium/chrome/browser/custom_layout/popup_window_tooltip/PopupWindowTooltip.java +++ b/android/java/org/chromium/chrome/browser/custom_layout/popup_window_tooltip/PopupWindowTooltip.java @@ -33,6 +33,10 @@ import org.chromium.base.Log; import org.chromium.chrome.R; +// This class has many fields reported as unused: +// - mModal +// This class uses a builder, so all they seems introduced by intent. +@SuppressWarnings("UnusedVariable") public class PopupWindowTooltip implements PopupWindow.OnDismissListener { private static final String TAG = PopupWindowTooltip.class.getSimpleName(); diff --git a/android/java/org/chromium/chrome/browser/firstrun/WelcomeOnboardingActivity.java b/android/java/org/chromium/chrome/browser/firstrun/WelcomeOnboardingActivity.java index 71142b3f3884..70aa9d572b58 100644 --- a/android/java/org/chromium/chrome/browser/firstrun/WelcomeOnboardingActivity.java +++ b/android/java/org/chromium/chrome/browser/firstrun/WelcomeOnboardingActivity.java @@ -71,14 +71,12 @@ public class WelcomeOnboardingActivity extends FirstRunActivityBase { private boolean mInitializeViewsDone; private boolean mInvokePostWorkAtInitializeViews; - private boolean mIsP3aEnabled; private boolean mIsTablet; private BraveFirstRunFlowSequencer mFirstRunFlowSequencer; private int mCurrentStep = -1; private View mVLeafAlignTop; private View mVLeafAlignBottom; - private ImageView mIvBackground; private ImageView mIvLeafTop; private ImageView mIvLeafBottom; private ImageView mIvBrave; @@ -159,7 +157,6 @@ public void onInstallReferrerServiceDisconnected() {} } private void initViews() { - mIvBackground = findViewById(R.id.iv_background); mIvLeafTop = findViewById(R.id.iv_leaf_top); mIvLeafBottom = findViewById(R.id.iv_leaf_bottom); mVLeafAlignTop = findViewById(R.id.view_leaf_top_align); diff --git a/android/java/org/chromium/chrome/browser/local_database/DatabaseHelper.java b/android/java/org/chromium/chrome/browser/local_database/DatabaseHelper.java index b750f3269f6d..07dbf8181f7b 100644 --- a/android/java/org/chromium/chrome/browser/local_database/DatabaseHelper.java +++ b/android/java/org/chromium/chrome/browser/local_database/DatabaseHelper.java @@ -94,7 +94,7 @@ public void insertAd(DisplayAd ad, int position, int tabId) { values.put(DisplayAdsTable.COLUMN_AD_IMAGE, imageUrlTemp.url); // insert row - long newRowId = db.insert(DisplayAdsTable.TABLE_NAME, null, values); + long unused_newRowId = db.insert(DisplayAdsTable.TABLE_NAME, null, values); } } diff --git a/android/java/org/chromium/chrome/browser/multiwindow/BraveMultiInstanceManagerApi31.java b/android/java/org/chromium/chrome/browser/multiwindow/BraveMultiInstanceManagerApi31.java index 80af3a449458..86ba40d3a1c7 100644 --- a/android/java/org/chromium/chrome/browser/multiwindow/BraveMultiInstanceManagerApi31.java +++ b/android/java/org/chromium/chrome/browser/multiwindow/BraveMultiInstanceManagerApi31.java @@ -19,7 +19,7 @@ import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager; import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager.SnackbarController; import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManagerProvider; -import org.chromium.components.browser_ui.desktop_windowing.DesktopWindowStateProvider; +import org.chromium.components.browser_ui.desktop_windowing.DesktopWindowStateManager; import org.chromium.components.browser_ui.widget.MenuOrKeyboardActionController; import org.chromium.ui.modaldialog.ModalDialogManager; @@ -36,7 +36,7 @@ class BraveMultiInstanceManagerApi31 extends MultiInstanceManagerApi31 { ActivityLifecycleDispatcher activityLifecycleDispatcher, ObservableSupplier modalDialogManagerSupplier, MenuOrKeyboardActionController menuOrKeyboardActionController, - Supplier desktopWindowStateProviderSupplier) { + Supplier desktopWindowStateManagerSupplier) { super( activity, tabModelOrchestratorSupplier, @@ -44,7 +44,7 @@ class BraveMultiInstanceManagerApi31 extends MultiInstanceManagerApi31 { activityLifecycleDispatcher, modalDialogManagerSupplier, menuOrKeyboardActionController, - desktopWindowStateProviderSupplier); + desktopWindowStateManagerSupplier); } @Override diff --git a/android/java/org/chromium/chrome/browser/notifications/BraveNotificationWarningDialog.java b/android/java/org/chromium/chrome/browser/notifications/BraveNotificationWarningDialog.java index b64d883f0fc6..202e44aa605b 100644 --- a/android/java/org/chromium/chrome/browser/notifications/BraveNotificationWarningDialog.java +++ b/android/java/org/chromium/chrome/browser/notifications/BraveNotificationWarningDialog.java @@ -143,9 +143,9 @@ private void updateTitleDescriptionText(View view) { if (getArguments() != null) { mLaunchedFrom = getArguments().getInt(LAUNCHED_FROM); if (mLaunchedFrom == FROM_LAUNCHED_BRAVE_ACTIVITY) { - launchedFromBraveActivity(view); + launchedFromBraveActivity(); } else if (mLaunchedFrom == FROM_LAUNCHED_BRAVE_SETTINGS) { - launchedFromBraveSettings(view); + launchedFromBraveSettings(); view.findViewById(R.id.btn_not_now).setVisibility(View.GONE); } else if (mLaunchedFrom == FROM_LAUNCHED_BRAVE_PANEL) { launchedFromBravePanel(view); @@ -166,7 +166,7 @@ private void launchedFromBravePanel(View view) { view.getResources(), R.drawable.blue_48_rounded_bg, null)); } - private void launchedFromBraveActivity(View view) { + private void launchedFromBraveActivity() { mPrimaryButton.setText(R.string.turn_on_brave_notifications); if (shouldShowBothWarningDialog(getContext())) { @@ -182,7 +182,7 @@ private void launchedFromBraveActivity(View view) { } } - private void launchedFromBraveSettings(View view) { + private void launchedFromBraveSettings() { mPrimaryButton.setText(R.string.got_it); if (shouldShowBothWarningDialog(getContext())) { diff --git a/android/java/org/chromium/chrome/browser/notifications/BraveOnboardingNotification.java b/android/java/org/chromium/chrome/browser/notifications/BraveOnboardingNotification.java index 4b1f06008ec7..3de09bd891b2 100644 --- a/android/java/org/chromium/chrome/browser/notifications/BraveOnboardingNotification.java +++ b/android/java/org/chromium/chrome/browser/notifications/BraveOnboardingNotification.java @@ -30,7 +30,6 @@ public class BraveOnboardingNotification extends BroadcastReceiver { public Context mContext; - private Intent mIntent; private static final String TAG = "OnboardingNoti"; private static final int BRAVE_ONBOARDING_NOTIFICATION_ID = -2; diff --git a/android/java/org/chromium/chrome/browser/notifications/permissions/BraveNotificationPermissionRationaleDialogController.java b/android/java/org/chromium/chrome/browser/notifications/permissions/BraveNotificationPermissionRationaleDialogController.java index 4e886dc4b90c..e23628f9018b 100644 --- a/android/java/org/chromium/chrome/browser/notifications/permissions/BraveNotificationPermissionRationaleDialogController.java +++ b/android/java/org/chromium/chrome/browser/notifications/permissions/BraveNotificationPermissionRationaleDialogController.java @@ -21,12 +21,11 @@ public BraveNotificationPermissionRationaleDialogController( super(context, modalDialogManager); } - /** - * This is empty override method, to block default android 13 chromium dialog - * */ + /** This is empty override method, to block default android 13 chromium dialog */ @Override public void showRationaleUi(Callback rationaleCallback) {} + @SuppressWarnings("UnusedVariable") private Callback wrapDialogDismissalCallback(Callback rationaleCallback) { assert false : "wrapDialogDismissalCallback should be redirected to parent in bytecode!"; return null; diff --git a/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPage.java b/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPage.java index 1936a4a8e388..80dc8feb20c3 100644 --- a/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPage.java +++ b/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPage.java @@ -45,7 +45,10 @@ public class BraveNewTabPage extends NewTabPage { // To delete in bytecode, members from parent class will be used instead. private BrowserControlsStateProvider mBrowserControlsStateProvider; private NewTabPageLayout mNewTabPageLayout; + + @SuppressWarnings("UnusedVariable") private FeedSurfaceProvider mFeedSurfaceProvider; + private Supplier mToolbarSupplier; private BottomSheetController mBottomSheetController; private ObservableSupplier mTabStripHeightSupplier; diff --git a/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPageLayout.java b/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPageLayout.java index 8f885c0ab907..f814993f8a08 100644 --- a/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPageLayout.java +++ b/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPageLayout.java @@ -53,13 +53,11 @@ import org.chromium.base.task.AsyncTask; import org.chromium.base.task.PostTask; import org.chromium.base.task.TaskTraits; -import org.chromium.brave_news.mojom.Article; import org.chromium.brave_news.mojom.BraveNewsController; import org.chromium.brave_news.mojom.CardType; import org.chromium.brave_news.mojom.DisplayAd; import org.chromium.brave_news.mojom.Feed; import org.chromium.brave_news.mojom.FeedItem; -import org.chromium.brave_news.mojom.FeedItemMetadata; import org.chromium.brave_news.mojom.FeedPage; import org.chromium.brave_news.mojom.FeedPageItem; import org.chromium.chrome.R; @@ -126,11 +124,13 @@ public class BraveNewTabPageLayout // To delete in bytecode, parent variable will be used instead. private ViewGroup mMvTilesContainerLayout; + + @SuppressWarnings("UnusedVariable") private LogoCoordinator mLogoCoordinator; + private Integer mInitialTileNum; // Own members. - private final Context mContext; private ImageView mBgImageView; private Profile mProfile; private SponsoredTab mSponsoredTab; @@ -177,21 +177,17 @@ public class BraveNewTabPageLayout private FeedItemsCard mVisibleCard; private String mFeedHash; private SharedPreferences.OnSharedPreferenceChangeListener mPreferenceListener; - private boolean mComesFromNewTab; private boolean mIsTopSitesEnabled; private boolean mIsBraveStatsEnabled; private boolean mIsDisplayNewsFeed; private boolean mIsDisplayNewsOptin; private long mNewsFeedLastViewTime; - private Supplier mTabProvider; - private static final int SHOW_BRAVE_RATE_ENTRY_AT = 10; // 10th row public BraveNewTabPageLayout(Context context, AttributeSet attrs) { super(context, attrs); - mContext = context; mProfile = ProfileManager.getLastUsedRegularProfile(); mNTPBackgroundImagesBridge = NTPBackgroundImagesBridge.getInstance(mProfile); mNTPBackgroundImagesBridge.setNewTabPageListener(mNewTabPageListener); @@ -202,7 +198,6 @@ public BraveNewTabPageLayout(Context context, AttributeSet attrs) { protected void onFinishInflate() { super.onFinishInflate(); - mComesFromNewTab = false; mFeedHash = ""; initBraveNewsController(); try { @@ -1006,10 +1001,6 @@ private void runFeed(boolean isNewContent, Feed feed) { FeedItem featuredItem = feed.featuredItem; FeedItemsCard featuredItemsCard = new FeedItemsCard(); - FeedItemMetadata featuredItemMetaData = new FeedItemMetadata(); - Article featuredArticle = featuredItem.getArticle(); - FeedItemMetadata featuredArticleData = featuredArticle.data; - FeedItemCard featuredItemCard = new FeedItemCard(); List featuredCardItems = new ArrayList<>(); @@ -1035,8 +1026,6 @@ private void runFeed(boolean isNewContent, Feed feed) { } // start page loop - int noPages = 0; - int itemIndex = 0; for (FeedPage page : feed.pages) { for (FeedPageItem cardData : page.items) { // if for any reason we get an empty object, unless it's a @@ -1052,7 +1041,6 @@ private void runFeed(boolean isNewContent, Feed feed) { feedItemsCard.setUuid(UUID.randomUUID().toString()); List cardItems = new ArrayList<>(); for (FeedItem item : cardData.items) { - FeedItemMetadata itemMetaData = new FeedItemMetadata(); FeedItemCard feedItemCard = new FeedItemCard(); feedItemCard.setFeedItem(item); @@ -1223,9 +1211,7 @@ protected boolean useFixedMVTLayout() { .getBoolean(BravePref.NEW_TAB_PAGE_SHOW_BACKGROUND_IMAGE); } - public void setTabProvider(Supplier tabProvider) { - mTabProvider = tabProvider; - } + public void setTabProvider(Supplier unused_tabProvider) {} private void showNTPImage(NTPImage ntpImage) { Display display = mActivity.getWindowManager().getDefaultDisplay(); diff --git a/android/java/org/chromium/chrome/browser/ntp_background_images/model/Wallpaper.java b/android/java/org/chromium/chrome/browser/ntp_background_images/model/Wallpaper.java index 8e41eac7d2a6..bdc315b67c40 100644 --- a/android/java/org/chromium/chrome/browser/ntp_background_images/model/Wallpaper.java +++ b/android/java/org/chromium/chrome/browser/ntp_background_images/model/Wallpaper.java @@ -14,9 +14,6 @@ public class Wallpaper extends NTPImage { private String mThemeName; private boolean mIsSponsored; private String mCreativeInstanceId; - private String mCreativeSetId; - private String mCampaignId; - private String mAdvertiserId; private String mWallpaperId; public Wallpaper(String imagePath, int focalPointX, int focalPointY, String logoPath, diff --git a/android/java/org/chromium/chrome/browser/ntp_background_images/util/NTPImageUtil.java b/android/java/org/chromium/chrome/browser/ntp_background_images/util/NTPImageUtil.java index c2425687dca0..cc88b8c6c4d5 100644 --- a/android/java/org/chromium/chrome/browser/ntp_background_images/util/NTPImageUtil.java +++ b/android/java/org/chromium/chrome/browser/ntp_background_images/util/NTPImageUtil.java @@ -42,23 +42,37 @@ public class NTPImageUtil { private static final String TAG = "NTPUtil"; - private static final int BOTTOM_TOOLBAR_HEIGHT = 56; private static final String REMOVED_SITES = "removed_sites"; public static HashMap> imageCache = new HashMap>(); - private static SpannableString getBannerText(ChromeActivity chromeActivity, int ntpType, - View bannerLayout, SponsoredTab sponsoredTab, NewTabPageListener newTabPageListener) { + // This function is not used, but removing it completely causes errors for unused resources: + // The resource R.string.earn_tokens_for_viewing appears to be unused [UnusedResources] + // The resource R.string.you_are_earning_tokens appears to be unused [UnusedResources] + // This is related to rewards, so I keep it till review + @SuppressWarnings("UnusedVariable") + private static SpannableString getBannerText( + ChromeActivity chromeActivity, + int ntpType, + View bannerLayout, + SponsoredTab sponsoredTab, + NewTabPageListener newTabPageListener) { String bannerText = ""; if (ntpType == SponsoredImageUtil.BR_ON_ADS_ON) { - bannerText = String.format( - chromeActivity.getResources().getString(R.string.you_are_earning_tokens), - chromeActivity.getResources().getString(R.string.learn_more)); + bannerText = + String.format( + chromeActivity + .getResources() + .getString(R.string.you_are_earning_tokens), + chromeActivity.getResources().getString(R.string.learn_more)); } else if (ntpType == SponsoredImageUtil.BR_ON_ADS_OFF) { - bannerText = String.format( - chromeActivity.getResources().getString(R.string.earn_tokens_for_viewing), - chromeActivity.getResources().getString(R.string.learn_more)); + bannerText = + String.format( + chromeActivity + .getResources() + .getString(R.string.earn_tokens_for_viewing), + chromeActivity.getResources().getString(R.string.learn_more)); } int learnMoreIndex = bannerText.indexOf(chromeActivity.getResources().getString(R.string.learn_more)); @@ -139,28 +153,16 @@ public static Bitmap getWallpaperBitmap(NTPImage ntpImage, int layoutWidth, int private static Bitmap getBitmapFromImagePath(String imagePath, BitmapFactory.Options options) { Context mContext = ContextUtils.getApplicationContext(); Bitmap imageBitmap = null; - InputStream inputStream = null; - try { - Uri imageFileUri = Uri.parse("file://" + imagePath); - inputStream = mContext.getContentResolver().openInputStream(imageFileUri); + Uri imageFileUri = Uri.parse("file://" + imagePath); + try (InputStream inputStream = + mContext.getContentResolver().openInputStream(imageFileUri)) { imageBitmap = BitmapFactory.decodeStream(inputStream, null, options); - inputStream.close(); } catch (IOException exc) { Log.e(TAG, "getBitmapFromImagePath: IOException: " + exc.getMessage()); } catch (IllegalArgumentException exc) { Log.e(TAG, "getBitmapFromImagePath: IllegalArgumentException: " + exc.getMessage()); } catch (OutOfMemoryError exc) { Log.e(TAG, "getBitmapFromImagePath: OutOfMemoryError: " + exc.getMessage()); - } finally { - try { - if (inputStream != null) { - inputStream.close(); - } - } catch (IOException exception) { - Log.e(TAG, - "getBitmapFromImagePath IOException in finally: " + exception.getMessage()); - return null; - } } return imageBitmap; } diff --git a/android/java/org/chromium/chrome/browser/omnibox/BraveLocationBarCoordinator.java b/android/java/org/chromium/chrome/browser/omnibox/BraveLocationBarCoordinator.java index 91298b965f9a..4e1486c4f554 100644 --- a/android/java/org/chromium/chrome/browser/omnibox/BraveLocationBarCoordinator.java +++ b/android/java/org/chromium/chrome/browser/omnibox/BraveLocationBarCoordinator.java @@ -32,7 +32,6 @@ import org.chromium.chrome.browser.tabmodel.TabWindowManager; import org.chromium.components.omnibox.action.OmniboxActionDelegate; import org.chromium.ui.base.WindowAndroid; -import org.chromium.ui.base.WindowDelegate; import org.chromium.ui.modaldialog.ModalDialogManager; import java.util.function.BooleanSupplier; @@ -60,7 +59,6 @@ public BraveLocationBarCoordinator( ObservableSupplier profileObservableSupplier, LocationBarDataProvider locationBarDataProvider, ActionMode.Callback actionModeCallback, - WindowDelegate windowDelegate, WindowAndroid windowAndroid, @NonNull Supplier activityTabSupplier, Supplier modalDialogManagerSupplier, @@ -96,7 +94,6 @@ public BraveLocationBarCoordinator( profileObservableSupplier, locationBarDataProvider, actionModeCallback, - windowDelegate, windowAndroid, activityTabSupplier, modalDialogManagerSupplier, diff --git a/android/java/org/chromium/chrome/browser/omnibox/suggestions/BraveAutocompleteMediator.java b/android/java/org/chromium/chrome/browser/omnibox/suggestions/BraveAutocompleteMediator.java index 9741d6003ae0..a76b1dc40072 100644 --- a/android/java/org/chromium/chrome/browser/omnibox/suggestions/BraveAutocompleteMediator.java +++ b/android/java/org/chromium/chrome/browser/omnibox/suggestions/BraveAutocompleteMediator.java @@ -42,7 +42,6 @@ class BraveAutocompleteMediator extends AutocompleteMediator private static final String AUTOCOMPLETE_ENABLED = "brave.autocomplete_enabled"; private static final String LEO_START_WORD_UPPER_CASE = "LEO"; - private Context mContext; private AutocompleteDelegate mDelegate; private Supplier mActivityTabSupplier; @@ -94,7 +93,6 @@ public BraveAutocompleteMediator( windowAndroid, deferredIMEWindowInsetApplicationCallback); - mContext = context; mDelegate = delegate; mActivityTabSupplier = activityTabSupplier; } diff --git a/android/java/org/chromium/chrome/browser/onboarding/BraveRewardsOnboardingFragment.java b/android/java/org/chromium/chrome/browser/onboarding/BraveRewardsOnboardingFragment.java index 003d55d8f6db..e78c9971d2ff 100644 --- a/android/java/org/chromium/chrome/browser/onboarding/BraveRewardsOnboardingFragment.java +++ b/android/java/org/chromium/chrome/browser/onboarding/BraveRewardsOnboardingFragment.java @@ -33,23 +33,19 @@ public class BraveRewardsOnboardingFragment extends Fragment { private OnViewPagerAction onViewPagerAction; - private TextView tvTitle; private TextView tvText; private TextView tvAgree; private Button btnSkip; private Button btnNext; - private boolean isAdsAvailable; - public BraveRewardsOnboardingFragment() { // Required empty public constructor } @Override public View onCreateView( - LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - isAdsAvailable = OnboardingPrefManager.getInstance().isAdsAvailable(); + LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View root = inflater.inflate(R.layout.fragment_brave_rewards_onboarding, container, false); @@ -62,7 +58,6 @@ public View onCreateView( } private void initializeViews(View root) { - tvTitle = root.findViewById(R.id.section_title); tvText = root.findViewById(R.id.section_text); tvAgree = root.findViewById(R.id.agree_text); diff --git a/android/java/org/chromium/chrome/browser/onboarding/OnboardingPrefManager.java b/android/java/org/chromium/chrome/browser/onboarding/OnboardingPrefManager.java index f5108d2a0d6b..8486915e1a1d 100644 --- a/android/java/org/chromium/chrome/browser/onboarding/OnboardingPrefManager.java +++ b/android/java/org/chromium/chrome/browser/onboarding/OnboardingPrefManager.java @@ -35,11 +35,8 @@ public class OnboardingPrefManager { private static final String PREF_P3A_ONBOARDING = "p3a_onboarding"; private static final String PREF_CROSS_PROMO_MODAL = "cross_promo_modal"; private static final String PREF_ONBOARDING_V2 = "onboarding_v2"; - private static final String PREF_NEXT_ONBOARDING_DATE = "next_onboarding_date"; private static final String PREF_NEXT_CROSS_PROMO_MODAL_DATE = "next_cross_promo_modal_date"; private static final String PREF_SEARCH_ENGINE_ONBOARDING = "search_engine_onboarding"; - private static final String PREF_SHOW_DEFAULT_BROWSER_MODAL_AFTER_P3A = - "show_default_browser_modal_after_p3a"; public static final String PREF_BRAVE_STATS = "brave_stats"; public static final String PREF_BRAVE_STATS_NOTIFICATION = "brave_stats_notification"; public static final String FROM_NOTIFICATION = "from_notification"; diff --git a/android/java/org/chromium/chrome/browser/onboarding/OnboardingViewPagerAdapter.java b/android/java/org/chromium/chrome/browser/onboarding/OnboardingViewPagerAdapter.java index 8fc982bf503d..4a379bd9caf1 100644 --- a/android/java/org/chromium/chrome/browser/onboarding/OnboardingViewPagerAdapter.java +++ b/android/java/org/chromium/chrome/browser/onboarding/OnboardingViewPagerAdapter.java @@ -1,26 +1,23 @@ /** - * 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 https://mozilla.org/MPL/2.0/. + * 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 https://mozilla.org/MPL/2.0/. */ - package org.chromium.chrome.browser.onboarding; +import android.content.Context; + import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; -import android.content.Context; import androidx.fragment.app.FragmentPagerAdapter; public class OnboardingViewPagerAdapter extends FragmentPagerAdapter { private final OnViewPagerAction onViewPagerAction; - private final Context context; private static final int ONBOARDING_WITH_3_PAGES = 3; - public OnboardingViewPagerAdapter(Context context, FragmentManager fm, - OnViewPagerAction onViewPagerAction) { + public OnboardingViewPagerAdapter( + Context unused_context, FragmentManager fm, OnViewPagerAction onViewPagerAction) { super(fm); - this.context = context; this.onViewPagerAction = onViewPagerAction; } diff --git a/android/java/org/chromium/chrome/browser/onboarding/SearchEngineOnboardingFragment.java b/android/java/org/chromium/chrome/browser/onboarding/SearchEngineOnboardingFragment.java index 4d579ebde82d..5e2201de8206 100644 --- a/android/java/org/chromium/chrome/browser/onboarding/SearchEngineOnboardingFragment.java +++ b/android/java/org/chromium/chrome/browser/onboarding/SearchEngineOnboardingFragment.java @@ -157,21 +157,26 @@ private void initializeViews(View root) { } private void setActions() { - btnSave.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - if (mSelectedSearchEngine == null) { - mSelectedSearchEngine = BraveSearchEngineUtils.getTemplateUrlByShortName( - mProfile, BraveSearchEngineUtils.getDSEShortName(mProfile, false)); - } - if (mSelectedSearchEngine != null) { - BraveSearchEngineUtils.setDSEPrefs(mSelectedSearchEngine, mProfile); - BraveSearchEngineUtils.setDSEPrefs(mSelectedSearchEngine, - mProfile.getPrimaryOTRProfile(/* createIfNeeded= */ true)); - } - getActivity().finish(); - } - }); + btnSave.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View view) { + if (mSelectedSearchEngine == null) { + mSelectedSearchEngine = + BraveSearchEngineUtils.getTemplateUrlByShortName( + mProfile, + BraveSearchEngineUtils.getDSEShortName( + mProfile, false)); + } + if (mSelectedSearchEngine != null) { + BraveSearchEngineUtils.setDSEPrefs(mSelectedSearchEngine, mProfile); + BraveSearchEngineUtils.setDSEPrefs( + mSelectedSearchEngine, + mProfile.getPrimaryOtrProfile(/* createIfNeeded= */ true)); + } + getActivity().finish(); + } + }); } private void searchEngineSelected(int position, List templateUrls) { diff --git a/android/java/org/chromium/chrome/browser/onboarding/v2/HighlightDialogFragment.java b/android/java/org/chromium/chrome/browser/onboarding/v2/HighlightDialogFragment.java index 1943d29a3f93..fe7b8f50f83e 100644 --- a/android/java/org/chromium/chrome/browser/onboarding/v2/HighlightDialogFragment.java +++ b/android/java/org/chromium/chrome/browser/onboarding/v2/HighlightDialogFragment.java @@ -42,10 +42,13 @@ public interface HighlightDialogListener { void onLearnMore(); } - private static final List highlightViews = Arrays.asList(R.id.brave_stats_ads, - R.id.brave_stats_data_saved, R.id.brave_stats_time, R.id.ntp_stats_layout); + private static final List highlightViews = + Arrays.asList( + R.id.brave_stats_ads, + R.id.brave_stats_data_saved, + R.id.brave_stats_time, + R.id.ntp_stats_layout); - private HighlightItem item; private HighlightView highlightView; private ViewPager viewpager; private boolean isFromStats; diff --git a/android/java/org/chromium/chrome/browser/onboarding/v2/HighlightView.java b/android/java/org/chromium/chrome/browser/onboarding/v2/HighlightView.java index 49f4e1b093d0..b8e0d066ff6b 100644 --- a/android/java/org/chromium/chrome/browser/onboarding/v2/HighlightView.java +++ b/android/java/org/chromium/chrome/browser/onboarding/v2/HighlightView.java @@ -41,15 +41,12 @@ public class HighlightView extends FrameLayout { private boolean mIsHighlightTransparent; private AnimatorSet mAnimatorSet; - private Context mContext; - private float mInnerRadius; private float mOuterRadius; private int mColor = -1; public HighlightView(Context context, AttributeSet attrs) { super(context, attrs); - mContext = context; PorterDuffXfermode xfermode = new PorterDuffXfermode(PorterDuff.Mode.MULTIPLY); mBasicPaint = new Paint(); mEraserPaint = new Paint(); diff --git a/android/java/org/chromium/chrome/browser/playlist/hls_content/HlsUtils.java b/android/java/org/chromium/chrome/browser/playlist/hls_content/HlsUtils.java index 29f4f62ea624..0d2959c13fd1 100644 --- a/android/java/org/chromium/chrome/browser/playlist/hls_content/HlsUtils.java +++ b/android/java/org/chromium/chrome/browser/playlist/hls_content/HlsUtils.java @@ -49,7 +49,6 @@ public static void getManifestFile( if (playlistService == null) { return; } - String mediaPath = getHlsMediaFilePath(playlistItem); String hlsManifestFilePath = getHlsManifestFilePath(playlistItem); final String manifestUrl = getHlsResolutionManifestUrl(context, playlistItem); if (TextUtils.isEmpty(manifestUrl)) { @@ -178,7 +177,6 @@ public void onDataCompleted() { private static String getPlaylistIdFromFile(PlaylistItem playlistItem) { String playlistId = "Default"; if (playlistItem != null && playlistItem.cached) { - String playlistItemMediaPath = playlistItem.mediaPath.url; // For i.e. // "file:///data/user/0/com.brave.browser_nightly/app_chrome/Default/playlist/399C40F34AF31E593D0C48B9ECEEB4CA/media_file.m3u8" String[] paths = playlistItem.mediaPath.url.split(File.separator); diff --git a/android/java/org/chromium/chrome/browser/playlist/settings/BravePlaylistResetPreference.java b/android/java/org/chromium/chrome/browser/playlist/settings/BravePlaylistResetPreference.java index 1745c83298c5..368c7e594b07 100644 --- a/android/java/org/chromium/chrome/browser/playlist/settings/BravePlaylistResetPreference.java +++ b/android/java/org/chromium/chrome/browser/playlist/settings/BravePlaylistResetPreference.java @@ -6,7 +6,6 @@ package org.chromium.chrome.browser.playlist.settings; import android.content.Context; -import android.content.res.Resources; import android.util.AttributeSet; import android.widget.TextView; @@ -23,18 +22,12 @@ public class BravePlaylistResetPreference private String TAG = "BravePlaylistResetPreference"; private int mPrefAccentColor; - private final String mConfirmationPhrase; - /** - * Constructor for BravePlaylistResetPreference. - */ + /** Constructor for BravePlaylistResetPreference. */ public BravePlaylistResetPreference(Context context, AttributeSet attrs) { super(context, attrs); - Resources resources = getContext().getResources(); mPrefAccentColor = getContext().getColor(R.color.wallet_error_text_color); - mConfirmationPhrase = - resources.getString(R.string.brave_wallet_reset_settings_confirmation_phrase); setOnPreferenceClickListener(this); } diff --git a/android/java/org/chromium/chrome/browser/preferences/BravePrefServiceBridge.java b/android/java/org/chromium/chrome/browser/preferences/BravePrefServiceBridge.java index 2b696e797d74..4bccb53ba69b 100644 --- a/android/java/org/chromium/chrome/browser/preferences/BravePrefServiceBridge.java +++ b/android/java/org/chromium/chrome/browser/preferences/BravePrefServiceBridge.java @@ -124,9 +124,9 @@ public void setNewsOptIn(boolean value) { } public boolean getNewsOptIn() { - boolean getNewsOptIn = BravePrefServiceBridgeJni.get().getNewsOptIn(); return BravePrefServiceBridgeJni.get().getNewsOptIn(); } + public void setShowNews(boolean value) { BravePrefServiceBridgeJni.get().setShowNews(value); } diff --git a/android/java/org/chromium/chrome/browser/privacy/settings/BravePrivacySettings.java b/android/java/org/chromium/chrome/browser/privacy/settings/BravePrivacySettings.java index 322a5e7c0007..be1c990a9112 100644 --- a/android/java/org/chromium/chrome/browser/privacy/settings/BravePrivacySettings.java +++ b/android/java/org/chromium/chrome/browser/privacy/settings/BravePrivacySettings.java @@ -36,7 +36,6 @@ import org.chromium.components.browser_ui.settings.ChromeBasePreference; import org.chromium.components.browser_ui.settings.ChromeSwitchPreference; import org.chromium.components.browser_ui.settings.SettingsUtils; -import org.chromium.components.prefs.PrefService; import org.chromium.components.user_prefs.UserPrefs; import org.chromium.gms.ChromiumPlayServicesAvailability; import org.chromium.mojo.bindings.ConnectionErrorHandler; @@ -99,8 +98,6 @@ public class BravePrivacySettings extends PrivacySettings implements ConnectionE private static final String PREF_ENS = "ens"; private static final String PREF_SNS = "sns"; private static final String PREF_REQUEST_OTR = "request_otr"; - private static final String PREF_HTTPS_ONLY_MODE_ENABLED_SAVED_STATE = - "https_only_mode_enabled_saved_state"; public static final String PREF_BLOCK_TRACKERS_ADS = "block_trackers_ads"; private static final String PREF_BLOCK_CROSS_SITE_COOKIES = "block_cross_site_cookies"; @@ -159,8 +156,6 @@ public class BravePrivacySettings extends PrivacySettings implements ConnectionE private static final int STANDARD = 1; private static final int ALLOW = 2; - private final PrefService mPrefServiceBridge = - UserPrefs.get(ProfileManager.getLastUsedRegularProfile()); private final PrivacyPreferencesManagerImpl mPrivacyPrefManager = PrivacyPreferencesManagerImpl.getInstance(); private ChromeSwitchPreference mCanMakePayment; diff --git a/android/java/org/chromium/chrome/browser/qrreader/CameraSource.java b/android/java/org/chromium/chrome/browser/qrreader/CameraSource.java index bfdd9fd642c8..f4374efffb31 100644 --- a/android/java/org/chromium/chrome/browser/qrreader/CameraSource.java +++ b/android/java/org/chromium/chrome/browser/qrreader/CameraSource.java @@ -143,7 +143,9 @@ public class CameraSource { // These instances need to be held onto to avoid GC of their underlying resources. Even though // these aren't used outside of the method that creates them, they still must have hard // references maintained to them. + @SuppressWarnings("UnusedVariable") private SurfaceView mDummySurfaceView; + private SurfaceTexture mDummySurfaceTexture; /** @@ -151,11 +153,12 @@ public class CameraSource { * frames become available from the camera. */ private Thread mProcessingThread; + private FrameProcessingRunnable mFrameProcessor; /** * Map to convert between a byte array, received from the camera, and its associated byte - * buffer. We use byte buffers internally because this is a more efficient way to call into + * buffer. We use byte buffers internally because this is a more efficient way to call into * native code later (avoids a potential copy). */ @SuppressWarnings("ArrayAsKeyOfSetOrMap") diff --git a/android/java/org/chromium/chrome/browser/quick_search_engines/settings/QuickSearchEnginesAdapter.java b/android/java/org/chromium/chrome/browser/quick_search_engines/settings/QuickSearchEnginesAdapter.java index bddbd0ddaa11..ff2905a67efc 100644 --- a/android/java/org/chromium/chrome/browser/quick_search_engines/settings/QuickSearchEnginesAdapter.java +++ b/android/java/org/chromium/chrome/browser/quick_search_engines/settings/QuickSearchEnginesAdapter.java @@ -25,7 +25,6 @@ public class QuickSearchEnginesAdapter extends RecyclerView.Adapter { - private Context mContext; private List mSearchEngines; private QuickSearchEnginesCallback mQuickSearchEnginesCallback; private ItemTouchHelperCallback.OnStartDragListener mDragStartListener; @@ -36,7 +35,6 @@ public QuickSearchEnginesAdapter( List searchEngines, QuickSearchEnginesCallback quickSearchEnginesCallback, ItemTouchHelperCallback.OnStartDragListener dragStartListener) { - mContext = context; mSearchEngines = searchEngines; mQuickSearchEnginesCallback = quickSearchEnginesCallback; mDragStartListener = dragStartListener; diff --git a/android/java/org/chromium/chrome/browser/quick_search_engines/views/QuickSearchEnginesViewAdapter.java b/android/java/org/chromium/chrome/browser/quick_search_engines/views/QuickSearchEnginesViewAdapter.java index b1f0a6ae90bb..a21026d41912 100644 --- a/android/java/org/chromium/chrome/browser/quick_search_engines/views/QuickSearchEnginesViewAdapter.java +++ b/android/java/org/chromium/chrome/browser/quick_search_engines/views/QuickSearchEnginesViewAdapter.java @@ -22,7 +22,6 @@ public class QuickSearchEnginesViewAdapter extends RecyclerView.Adapter { - private Context mContext; private List mSearchEngines; private QuickSearchEnginesCallback mQuickSearchEnginesCallback; @@ -30,7 +29,6 @@ public QuickSearchEnginesViewAdapter( Context context, List searchEngines, QuickSearchEnginesCallback quickSearchEnginesCallback) { - mContext = context; mSearchEngines = searchEngines; mQuickSearchEnginesCallback = quickSearchEnginesCallback; } diff --git a/android/java/org/chromium/chrome/browser/rate/RateUtils.java b/android/java/org/chromium/chrome/browser/rate/RateUtils.java index 28735d7ef4e4..d1859febfcc4 100644 --- a/android/java/org/chromium/chrome/browser/rate/RateUtils.java +++ b/android/java/org/chromium/chrome/browser/rate/RateUtils.java @@ -36,7 +36,6 @@ public class RateUtils { private static final String PREF_RATE = "rate"; private static final String PREF_NEXT_RATE_DATE = "next_rate_date"; - private static final String PREF_NEXT_APP_OPEN_COUNT = "next_app_open_count"; private static final String PREF_ADDED_BOOKMARK_COUNT = "added_bookmark_count"; private static final String PREF_LAST_SESSION_SHOWN = "last_session_shown"; diff --git a/android/java/org/chromium/chrome/browser/rewards/BraveRewardsPanel.java b/android/java/org/chromium/chrome/browser/rewards/BraveRewardsPanel.java index 9a685e21c161..15a94b7c5bd3 100644 --- a/android/java/org/chromium/chrome/browser/rewards/BraveRewardsPanel.java +++ b/android/java/org/chromium/chrome/browser/rewards/BraveRewardsPanel.java @@ -111,15 +111,12 @@ public class BraveRewardsPanel private static final String BRAVE_REWARDS_CHANGES_PAGE = "https://brave.com/rewards-changes"; private static final String TAG = "BraveRewards"; - private static final int UPDATE_BALANCE_INTERVAL = 60000; // In milliseconds private static final int PUBLISHER_INFO_FETCH_RETRY = 3 * 1000; // In milliseconds private static final int PUBLISHER_FETCHES_COUNT = 3; private static final String YOUTUBE_TYPE = "youtube#"; private static final String TWITCH_TYPE = "twitch#"; - private static final String SUCCESS = "success"; - // Balance report codes private static final int BALANCE_REPORT_EARNING_FROM_ADS = 0; private static final int BALANCE_REPORT_AUTO_CONTRIBUTE = 1; @@ -127,10 +124,7 @@ public class BraveRewardsPanel private static final int BALANCE_REPORT_ONE_TIME_DONATION = 3; // Custom Android notification - private static final char NOTIFICATION_PROMID_SEPARATOR = '_'; private static final int REWARDS_NOTIFICATION_NO_INTERNET = 1000; - private static final String REWARDS_NOTIFICATION_NO_INTERNET_ID = - "29d835c2-5752-4152-93c3-8a1ded9dd4ec"; private static final int REWARDS_PROMOTION_CLAIM_ERROR = REWARDS_NOTIFICATION_NO_INTERNET + 1; private static final String REWARDS_PROMOTION_CLAIM_ERROR_ID = "rewards_promotion_claim_error_id"; @@ -138,7 +132,6 @@ public class BraveRewardsPanel // Auto contribute results private static final String AUTO_CONTRIBUTE_SUCCESS = "0"; private static final String AUTO_CONTRIBUTE_GENERAL_ERROR = "1"; - private static final String AUTO_CONTRIBUTE_NOT_ENOUGH_FUNDS = "15"; private static final String ERROR_CONVERT_PROBI = "ERROR"; public static final String WALLET_GENERATION_DISABLED_ERROR = "wallet-generation-disabled"; @@ -147,8 +140,6 @@ public class BraveRewardsPanel private static final String PAYOUT_STATUS_PROCESSING = "processing"; private static final String PAYOUT_STATUS_COMPLETE = "complete"; - private static final int CLICK_DISABLE_INTERVAL = 1000; // In milliseconds - private static final String SELF_CUSTODY_AVAILABLE = "self_custody_available"; private static final String WALLET_DISCONNECTED = "wallet_disconnected"; private static final String UPHOLD_BAT_NOT_ALLOWED = "uphold_bat_not_allowed"; @@ -201,7 +192,6 @@ public enum NotificationClickAction { private View mNotificationPermissionLayout; private boolean mNotificationShown; - private View mBraveRewardsOnboardingModalView; private View mRewardsResponseModal; private View mConnectAccountModal; private View mRewardsVbatExpireNoticeModal; @@ -306,8 +296,6 @@ private void setUpViews() { mBravePanelShadow = mPopupView.findViewById(R.id.panel_shadow); mBraveRewardsOnboardingView = mPopupView.findViewById(R.id.brave_rewards_onboarding_layout_id); - mBraveRewardsOnboardingModalView = - mPopupView.findViewById(R.id.brave_rewards_onboarding_modal_id); mNotificationLayout = mPopupView.findViewById(R.id.brave_rewards_panel_notification_layout_id); mNotificationPermissionLayout = @@ -525,7 +513,7 @@ private boolean isValidNotificationType(int type, int argsNum) { return valid; } - private void showNotification(String id, int type, long timestamp, String[] args) { + private void showNotification(String id, int type, String[] args) { if (mBraveRewardsNativeWorker == null) { return; } @@ -809,15 +797,14 @@ public void onGetCurrentBalanceReport(double[] report) { } String batText = BraveRewardsHelper.BAT_TEXT; for (int i = 0; i < report.length; i++) { - TextView tvTitle = null; TextView tv = null; String text = ""; double probiDouble = report[i]; - boolean hideControls = (probiDouble == 0); - String value = Double.isNaN(probiDouble) - ? "0.000" + batText - : String.format(Locale.getDefault(), "%.3f", probiDouble); + String value = + Double.isNaN(probiDouble) + ? "0.000" + batText + : String.format(Locale.getDefault(), "%.3f", probiDouble); switch (i) { case BALANCE_REPORT_EARNING_FROM_ADS: @@ -1122,9 +1109,9 @@ public void onClick(View v) { } @Override - public void onGetLatestNotification(String id, int type, long timestamp, String[] args) { + public void onGetLatestNotification(String id, int type, long unused_timestamp, String[] args) { if (!mCurrentNotificationId.equals(REWARDS_PROMOTION_CLAIM_ERROR_ID)) { - showNotification(id, type, timestamp, args); + showNotification(id, type, args); } } @@ -1377,11 +1364,6 @@ public void onClick(View v) { }); View rewardsPanelUnverifiedCreatorSection = unverifiedStateLayout.findViewById(R.id.rewards_panel_unverified_creator_section); - TextView rewardsPanelUnverifiedCreatorCountText = - unverifiedStateLayout.findViewById( - R.id.rewards_panel_unverified_creator_count_text); - TextView rewardsPanelUnverifiedCreatorText = - unverifiedStateLayout.findViewById(R.id.rewards_panel_unverified_creator_text); View rewardsPanelUnverifiedOffSection = unverifiedStateLayout.findViewById(R.id.rewards_panel_unverified_off_section); LinearLayout rewardsSettingsButton = diff --git a/android/java/org/chromium/chrome/browser/rewards/adaptive_captcha/AdaptiveCaptchaHelper.java b/android/java/org/chromium/chrome/browser/rewards/adaptive_captcha/AdaptiveCaptchaHelper.java index 2487147eaeb7..6dfbda017691 100644 --- a/android/java/org/chromium/chrome/browser/rewards/adaptive_captcha/AdaptiveCaptchaHelper.java +++ b/android/java/org/chromium/chrome/browser/rewards/adaptive_captcha/AdaptiveCaptchaHelper.java @@ -262,10 +262,10 @@ private static void writeRequestOutput(String body, HttpURLConnection urlConnect private static String readResponse(HttpURLConnection urlConnection) throws IOException { String responseString = ""; - BufferedReader br = null; - try { - br = new BufferedReader(new InputStreamReader( - urlConnection.getInputStream(), StandardCharsets.UTF_8.name())); + try (BufferedReader br = + new BufferedReader( + new InputStreamReader( + urlConnection.getInputStream(), StandardCharsets.UTF_8.name()))) { StringBuilder sb = new StringBuilder(); String line = null; while ((line = br.readLine()) != null) { @@ -274,12 +274,8 @@ private static String readResponse(HttpURLConnection urlConnection) throws IOExc responseString = sb.toString(); } catch (Exception e) { Log.e(TAG, e.getMessage()); - } finally { - if (br != null) { - br.close(); - } - return responseString; } + return responseString; } private static String getStartAttestationBody(String paymentId) throws JSONException { diff --git a/android/java/org/chromium/chrome/browser/rewards/onboarding/RewardsOnboarding.java b/android/java/org/chromium/chrome/browser/rewards/onboarding/RewardsOnboarding.java index 52954046463f..151a83c3695a 100644 --- a/android/java/org/chromium/chrome/browser/rewards/onboarding/RewardsOnboarding.java +++ b/android/java/org/chromium/chrome/browser/rewards/onboarding/RewardsOnboarding.java @@ -65,12 +65,10 @@ public class RewardsOnboarding implements BraveRewardsObserver { private BraveRewardsNativeWorker mBraveRewardsNativeWorker; private ChromeTabbedActivity mActivity; - private int mDeviceWidth; private static final String SUCCESS = "success"; public RewardsOnboarding(View anchorView, int deviceWidth) { - mDeviceWidth = deviceWidth; mAnchorView = anchorView; mPopupWindow = new PopupWindow(anchorView.getContext()); mPopupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT); 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 777748e1ab8a..8c5d961d5c3e 100644 --- a/android/java/org/chromium/chrome/browser/rewards/tipping/RewardsTippingBannerActivity.java +++ b/android/java/org/chromium/chrome/browser/rewards/tipping/RewardsTippingBannerActivity.java @@ -12,24 +12,17 @@ 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.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 class RewardsTippingBannerActivity extends AsyncInitializationActivity + implements BraveRewardsObserver { public static final String TAB_ID_EXTRA = "currentTabId"; public static final String TIP_MONTHLY_EXTRA = "tipMonthly"; public static final String TIP_AMOUNT_EXTRA = "tipAmount"; private int mCurrentTabId = -1; - private BraveRewardsBannerInfo mBannerInfo; - - private BraveRewardsHelper mIconFetcher; - - private static final String IMAGE_URL_PREFIX = "chrome://rewards-image/"; @Override protected void triggerLayoutInflation() { diff --git a/android/java/org/chromium/chrome/browser/rewards/tipping/RewardsTippingBannerFragment.java b/android/java/org/chromium/chrome/browser/rewards/tipping/RewardsTippingBannerFragment.java index fa03d17eadb3..157217db1925 100644 --- a/android/java/org/chromium/chrome/browser/rewards/tipping/RewardsTippingBannerFragment.java +++ b/android/java/org/chromium/chrome/browser/rewards/tipping/RewardsTippingBannerFragment.java @@ -32,7 +32,6 @@ import org.chromium.base.Log; import org.chromium.chrome.R; import org.chromium.chrome.browser.BraveRewardsExternalWallet; -import org.chromium.chrome.browser.BraveRewardsHelper; import org.chromium.chrome.browser.BraveRewardsNativeWorker; import org.chromium.chrome.browser.BraveRewardsObserver; import org.chromium.chrome.browser.BraveWalletProvider; @@ -55,8 +54,6 @@ public class RewardsTippingBannerFragment extends Fragment implements BraveRewar private int mCurrentTabId = -1; private BraveRewardsBannerInfo mBannerInfo; - private BraveRewardsHelper mIconFetcher; - private static final String TWITTER = "twitter"; private static final String YOUTUBE = "youtube"; private static final String TWITCH = "twitch"; diff --git a/android/java/org/chromium/chrome/browser/rewards/tipping/RewardsTippingPanelFragment.java b/android/java/org/chromium/chrome/browser/rewards/tipping/RewardsTippingPanelFragment.java index 17dd54ae9fca..771e93cafc7f 100644 --- a/android/java/org/chromium/chrome/browser/rewards/tipping/RewardsTippingPanelFragment.java +++ b/android/java/org/chromium/chrome/browser/rewards/tipping/RewardsTippingPanelFragment.java @@ -144,9 +144,9 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c initTipChoice(mToggle); setAlreadyMonthlyContributionSetMessage(); sendTipButtonClick(view); - web3ButtonClick(view); + web3ButtonClick(); exchangeButtonClick(view); - setCustodianIconAndName(view); + setCustodianIconAndName(); updateTermsOfServicePlaceHolder(view); checkEnoughFund(); setMonthlyInformationClick(view); @@ -220,7 +220,7 @@ public void onGetExternalWallet(String externalWallet) { setLogoutStateMessage(); } else { int pubStatus = mBraveRewardsNativeWorker.getPublisherStatus(mCurrentTabId); - setPublisherNoteText(pubStatus, walletStatus); + setPublisherNoteText(pubStatus); } } else { mCustodianText.setVisibility(View.GONE); @@ -231,9 +231,9 @@ public void onGetExternalWallet(String externalWallet) { } } - private void setPublisherNoteText(int pubStatus, int walletStatus) { + private void setPublisherNoteText(int pubStatus) { if ((pubStatus == PublisherStatus.UPHOLD_VERIFIED - && !mWalletType.equals(BraveWalletProvider.UPHOLD)) + && !mWalletType.equals(BraveWalletProvider.UPHOLD)) || (pubStatus == PublisherStatus.BITFLYER_VERIFIED && !mWalletType.equals(BraveWalletProvider.BITFLYER)) || (pubStatus == PublisherStatus.GEMINI_VERIFIED @@ -411,11 +411,12 @@ private void showWarningMessage(View view, int background, String title, String } } - private void web3ButtonClick(View view) { - mWeb3WalletButton.setOnClickListener(v -> { - TabUtils.openUrlInNewTab(false, mWeb3Url); - dismissRewardsPanel(); - }); + private void web3ButtonClick() { + mWeb3WalletButton.setOnClickListener( + v -> { + TabUtils.openUrlInNewTab(false, mWeb3Url); + dismissRewardsPanel(); + }); } private void sendTipButtonClick(View view) { @@ -541,7 +542,7 @@ private void checkEnoughFund() { } } - private void setCustodianIconAndName(View view) { + private void setCustodianIconAndName() { int custodianIcon = R.drawable.ic_logo_solana; int custodianName = R.string.wallet_sol_name; diff --git a/android/java/org/chromium/chrome/browser/rewards/tipping/RewardsTippingSuccessContribution.java b/android/java/org/chromium/chrome/browser/rewards/tipping/RewardsTippingSuccessContribution.java index d54c24c8f512..21babcfb327d 100644 --- a/android/java/org/chromium/chrome/browser/rewards/tipping/RewardsTippingSuccessContribution.java +++ b/android/java/org/chromium/chrome/browser/rewards/tipping/RewardsTippingSuccessContribution.java @@ -20,7 +20,6 @@ import org.chromium.ui.base.DeviceFormFactor; public class RewardsTippingSuccessContribution { - private static final String AMOUNT_SELECTED = "amount_selected"; private static final String TAG = "TippingSuccess"; private View mContentView; private double mAmountSelected; diff --git a/android/java/org/chromium/chrome/browser/search_engines/settings/BraveSearchEnginePreference.java b/android/java/org/chromium/chrome/browser/search_engines/settings/BraveSearchEnginePreference.java index 37adfe1cbf33..a1219ee4302f 100644 --- a/android/java/org/chromium/chrome/browser/search_engines/settings/BraveSearchEnginePreference.java +++ b/android/java/org/chromium/chrome/browser/search_engines/settings/BraveSearchEnginePreference.java @@ -38,8 +38,7 @@ private Profile getProfile(boolean isPrivate) { if (!isPrivate) { return mProfile; } else { - return mProfile.getPrimaryOTRProfile( - /* createIfNeeded= */ true); + return mProfile.getPrimaryOtrProfile(/* createIfNeeded= */ true); } } } diff --git a/android/java/org/chromium/chrome/browser/settings/BraveMainPreferencesBase.java b/android/java/org/chromium/chrome/browser/settings/BraveMainPreferencesBase.java index 5d0781c93c59..a89479476248 100644 --- a/android/java/org/chromium/chrome/browser/settings/BraveMainPreferencesBase.java +++ b/android/java/org/chromium/chrome/browser/settings/BraveMainPreferencesBase.java @@ -58,15 +58,12 @@ public abstract class BraveMainPreferencesBase extends BravePreferenceFragment private static final String PREF_BASICS_SECTION = "basics_section"; private static final String PREF_ADVANCED_SECTION = "advanced_section"; private static final String PREF_ONLINE_CHECKOUT_SECTION = "online_checkout_section"; - private static final String PREF_SEARCH_ENGINE_SECTION = "search_engine_section"; private static final String PREF_SUPPORT_SECTION = "support_section"; private static final String PREF_ABOUT_SECTION = "about_section"; // prefs private static final String PREF_BRAVE_VPN_CALLOUT = "pref_vpn_callout"; - private static final String PREF_STANDARD_SEARCH_ENGINE = "standard_search_engine"; - private static final String PREF_PRIVATE_SEARCH_ENGINE = "private_search_engine"; private static final String PREF_CLOSING_ALL_TABS_CLOSES_BRAVE = "closing_all_tabs_closes_brave"; private static final String PREF_PRIVACY = "privacy"; @@ -362,8 +359,6 @@ private void rearrangePreferenceOrders() { } findPreference(PREF_ABOUT_CHROME).setOrder(++aboutSectionOrder); - int order = findPreference(PREF_CLOSING_ALL_TABS_CLOSES_BRAVE).getOrder(); - // We don't have home button on top toolbar at the moment if (!DeviceFormFactor.isTablet() && !BottomToolbarConfiguration.isBottomToolbarEnabled()) { removePreferenceIfPresent(MainSettings.PREF_HOMEPAGE); diff --git a/android/java/org/chromium/chrome/browser/settings/BraveNewsPreferencesDetails.java b/android/java/org/chromium/chrome/browser/settings/BraveNewsPreferencesDetails.java index fcc340ebbde3..fd86dc9826c5 100644 --- a/android/java/org/chromium/chrome/browser/settings/BraveNewsPreferencesDetails.java +++ b/android/java/org/chromium/chrome/browser/settings/BraveNewsPreferencesDetails.java @@ -55,7 +55,6 @@ public class BraveNewsPreferencesDetails extends BravePreferenceFragment private BraveNewsPreferencesTypeAdapter mAdapter; private BraveNewsController mBraveNewsController; - private List mPublisherList; private String mBraveNewsPreferencesType; private String mSearch = ""; private HashMap mFeedSearchResultItemFollowMap = new HashMap<>(); diff --git a/android/java/org/chromium/chrome/browser/settings/BraveNewsPreferencesTypeAdapter.java b/android/java/org/chromium/chrome/browser/settings/BraveNewsPreferencesTypeAdapter.java index 023ae487086c..00c10e371e96 100644 --- a/android/java/org/chromium/chrome/browser/settings/BraveNewsPreferencesTypeAdapter.java +++ b/android/java/org/chromium/chrome/browser/settings/BraveNewsPreferencesTypeAdapter.java @@ -54,13 +54,15 @@ public class BraveNewsPreferencesTypeAdapter extends RecyclerView.Adapter channelList, + BraveNewsController braveNewsController, + RequestManager glide, + String braveNewsPreferencesType, + List channelList, List publisherList) { mContext = context; mBraveNewsController = braveNewsController; diff --git a/android/java/org/chromium/chrome/browser/settings/BraveNewsSettingsDividerItemDecoration.java b/android/java/org/chromium/chrome/browser/settings/BraveNewsSettingsDividerItemDecoration.java index 29b439054428..0b1955747ba2 100644 --- a/android/java/org/chromium/chrome/browser/settings/BraveNewsSettingsDividerItemDecoration.java +++ b/android/java/org/chromium/chrome/browser/settings/BraveNewsSettingsDividerItemDecoration.java @@ -26,7 +26,6 @@ public void onDraw(@NonNull Canvas canvas, @NonNull RecyclerView parent, for (int i = 0; i < parent.getChildCount() - 1; i++) { View child = parent.getChildAt(i); - int position = parent.getChildAdapterPosition(child); int left = parent.getPaddingLeft(); int right = parent.getWidth() - parent.getPaddingRight(); diff --git a/android/java/org/chromium/chrome/browser/settings/BraveSearchEnginesPreferences.java b/android/java/org/chromium/chrome/browser/settings/BraveSearchEnginesPreferences.java index 11d9fa97937d..1d87b01c3a48 100644 --- a/android/java/org/chromium/chrome/browser/settings/BraveSearchEnginesPreferences.java +++ b/android/java/org/chromium/chrome/browser/settings/BraveSearchEnginesPreferences.java @@ -30,8 +30,6 @@ public class BraveSearchEnginesPreferences extends BravePreferenceFragment private static final String PREF_AUTOCOMPLETE_TOP_SITES = "autocomplete_top_sites"; private static final String PREF_ADD_OPEN_SEARCH_ENGINES = "brave.other_search_engines_enabled"; - private static final String PREF_QUICK_SEARCH_ENGINE = "quick_search_engine"; - private ChromeManagedPreferenceDelegate mManagedPreferenceDelegate; private ChromeSwitchPreference mShowAutocompleteInAddressBar; @@ -88,7 +86,7 @@ private void updateSearchEnginePreference() { searchEnginePreference.setEnabled(true); searchEnginePreference.setSummary( BraveSearchEngineUtils.getDSEShortName( - getProfile().getPrimaryOTRProfile(/* createIfNeeded= */ true), true)); + getProfile().getPrimaryOtrProfile(/* createIfNeeded= */ true), true)); mSearchSuggestions = (ChromeSwitchPreference) findPreference(PREF_SEARCH_SUGGESTIONS); mSearchSuggestions.setOnPreferenceChangeListener(this); diff --git a/android/java/org/chromium/chrome/browser/settings/BraveSyncCodeCountdownFragment.java b/android/java/org/chromium/chrome/browser/settings/BraveSyncCodeCountdownFragment.java index 5ac01100ab06..0663316ad630 100644 --- a/android/java/org/chromium/chrome/browser/settings/BraveSyncCodeCountdownFragment.java +++ b/android/java/org/chromium/chrome/browser/settings/BraveSyncCodeCountdownFragment.java @@ -75,6 +75,8 @@ public void run() { 1000); } + // duration.getSeconds should be toSeconds after api 31. + @SuppressWarnings("JavaDurationGetSecondsToToSeconds") void updateText() { if (mDestroyed) { cleanupTextUpdater(); diff --git a/android/java/org/chromium/chrome/browser/settings/BraveSyncScreensPreference.java b/android/java/org/chromium/chrome/browser/settings/BraveSyncScreensPreference.java index 2582220f70c8..dfabd0f52cbd 100644 --- a/android/java/org/chromium/chrome/browser/settings/BraveSyncScreensPreference.java +++ b/android/java/org/chromium/chrome/browser/settings/BraveSyncScreensPreference.java @@ -30,14 +30,12 @@ import android.view.ViewGroup.LayoutParams; import android.view.WindowManager; import android.view.inputmethod.InputMethodManager; -import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.FrameLayout; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; -import android.widget.ListView; import android.widget.ScrollView; import android.widget.TextView; import android.widget.Toast; @@ -85,7 +83,6 @@ import java.time.LocalDateTime; import java.time.ZoneOffset; import java.util.ArrayList; -import java.util.List; /** Settings fragment that allows to control Sync functionality. */ public class BraveSyncScreensPreference extends BravePreferenceFragment @@ -100,13 +97,6 @@ public class BraveSyncScreensPreference extends BravePreferenceFragment private static final int RC_HANDLE_CAMERA_PERM = 2; // Intent request code to handle updating play services if needed. private static final int RC_HANDLE_GMS = 9001; - // For QR code generation - private static final int WHITE = 0xFFFFFFFF; - private static final int BLACK = 0xFF000000; - private static final int WIDTH = 300; - // For view sizes limit - private static final int MAX_WIDTH = 512; - private static final int MAX_HEIGHT = 1024; // The have a sync code button displayed in the Sync view. private Button mScanChainCodeButton; @@ -125,16 +115,11 @@ public class BraveSyncScreensPreference extends BravePreferenceFragment private Button mDeleteAccountButton; private Button mNewCodeWordsButton; private Button mNewQrCodeButton; - // Brave Sync message text view - private TextView mBraveSyncTextViewInitial; private TextView mBraveSyncTextDevicesTitle; private TextView mBraveSyncWordCountTitle; private TextView mBraveSyncAddDeviceCodeWords; private CameraSource mCameraSource; private CameraSourcePreview mCameraSourcePreview; - private ListView mDevicesListView; - private ArrayAdapter mDevicesAdapter; - private List mDevicesList; private ScrollView mScrollViewSyncInitial; private ScrollView mScrollViewSyncChainCode; private ScrollView mScrollViewSyncStartChain; @@ -436,7 +421,6 @@ public void onActivityCreated(Bundle savedInstanceState) { mCopyButton.setOnClickListener(this); } - mBraveSyncTextViewInitial = getView().findViewById(R.id.brave_sync_text_initial); mBraveSyncTextDevicesTitle = getView().findViewById(R.id.brave_sync_devices_title); mBraveSyncWordCountTitle = getView().findViewById(R.id.brave_sync_text_word_count); mBraveSyncWordCountTitle.setText(getString(R.string.brave_sync_word_count_text, 0)); diff --git a/android/java/org/chromium/chrome/browser/settings/BraveWalletPreferences.java b/android/java/org/chromium/chrome/browser/settings/BraveWalletPreferences.java index 8b775fb9abec..a4b1fb463943 100644 --- a/android/java/org/chromium/chrome/browser/settings/BraveWalletPreferences.java +++ b/android/java/org/chromium/chrome/browser/settings/BraveWalletPreferences.java @@ -39,11 +39,6 @@ public class BraveWalletPreferences extends BravePreferenceFragment private static final String TAG = "WalletPreferences"; private static final String PREF_BRAVE_WALLET_AUTOLOCK = "pref_brave_wallet_autolock"; - /** - * @noinspection unused - */ - private static final String PREF_BRAVE_WALLET_RESET = "pref_brave_wallet_reset"; - private static final String BRAVE_WALLET_WEB3_NOTIFICATION_SWITCH = "web3_notifications_switch"; private static final String BRAVE_WALLET_WEB3_NFT_DISCOVERY_SWITCH = "nft_auto_discovery_switch"; diff --git a/android/java/org/chromium/chrome/browser/settings/MediaPreferences.java b/android/java/org/chromium/chrome/browser/settings/MediaPreferences.java index 018fb7303ae7..5167b5a97861 100644 --- a/android/java/org/chromium/chrome/browser/settings/MediaPreferences.java +++ b/android/java/org/chromium/chrome/browser/settings/MediaPreferences.java @@ -137,14 +137,15 @@ public boolean onPreferenceChange(Preference preference, Object newValue) { String key = preference.getKey(); boolean shouldRelaunch = false; if (PREF_WIDEVINE_ENABLED.equals(key)) { - ChromeSwitchPreference enableWidevinePref = - (ChromeSwitchPreference) findPreference(PREF_WIDEVINE_ENABLED); - BraveLocalState.get().setBoolean(BravePref.WIDEVINE_ENABLED, - !BraveLocalState.get().getBoolean(BravePref.WIDEVINE_ENABLED)); + BraveLocalState.get() + .setBoolean( + BravePref.WIDEVINE_ENABLED, + !BraveLocalState.get().getBoolean(BravePref.WIDEVINE_ENABLED)); shouldRelaunch = true; } else if (PREF_BACKGROUND_VIDEO_PLAYBACK.equals(key)) { BraveFeatureUtil.enableFeature( - BraveFeatureList.BRAVE_BACKGROUND_VIDEO_PLAYBACK_INTERNAL, (boolean) newValue, + BraveFeatureList.BRAVE_BACKGROUND_VIDEO_PLAYBACK_INTERNAL, + (boolean) newValue, false); shouldRelaunch = true; } else if (PLAY_YT_VIDEO_IN_BROWSER_KEY.equals(key)) { diff --git a/android/java/org/chromium/chrome/browser/settings/themes/BraveRadioButtonGroupCustomHomepageThemePreference.java b/android/java/org/chromium/chrome/browser/settings/themes/BraveRadioButtonGroupCustomHomepageThemePreference.java index 0b53978c12e2..05e7a0c75b23 100644 --- a/android/java/org/chromium/chrome/browser/settings/themes/BraveRadioButtonGroupCustomHomepageThemePreference.java +++ b/android/java/org/chromium/chrome/browser/settings/themes/BraveRadioButtonGroupCustomHomepageThemePreference.java @@ -22,10 +22,9 @@ import org.chromium.components.browser_ui.widget.RadioButtonWithDescription; import org.chromium.components.user_prefs.UserPrefs; -public class BraveRadioButtonGroupCustomHomepageThemePreference extends RadioButtonGroupThemePreference { +public class BraveRadioButtonGroupCustomHomepageThemePreference + extends RadioButtonGroupThemePreference { - private RadioButtonWithDescription braveDefaultView; - private RadioButtonWithDescription refView; private NTPBackgroundImagesBridge mNTPBackgroundImagesBridge; public BraveRadioButtonGroupCustomHomepageThemePreference(Context context, AttributeSet attrs) { diff --git a/android/java/org/chromium/chrome/browser/shields/BraveShieldsHandler.java b/android/java/org/chromium/chrome/browser/shields/BraveShieldsHandler.java index 7bee04752bf9..e442e46963c2 100644 --- a/android/java/org/chromium/chrome/browser/shields/BraveShieldsHandler.java +++ b/android/java/org/chromium/chrome/browser/shields/BraveShieldsHandler.java @@ -5,7 +5,6 @@ package org.chromium.chrome.browser.shields; -import android.animation.AnimatorSet; import android.app.Activity; import android.app.Dialog; import android.content.Context; @@ -50,7 +49,6 @@ import org.chromium.chrome.browser.brave_stats.BraveStatsUtil; import org.chromium.chrome.browser.customtabs.CustomTabActivity; import org.chromium.chrome.browser.flags.ChromeFeatureList; -import org.chromium.chrome.browser.night_mode.GlobalNightModeStateProviderHolder; import org.chromium.chrome.browser.onboarding.OnboardingPrefManager; import org.chromium.chrome.browser.preferences.website.BraveShieldsContentSettings; import org.chromium.chrome.browser.profiles.Profile; @@ -74,7 +72,6 @@ public class BraveShieldsHandler implements BraveRewardsHelper.LargeIconReadyCallback, ConnectionErrorHandler { private static final String TAG = "BraveShieldsHandler"; - private static final int URL_SPEC_MAX_LINES = 3; private static final String CHROME_ERROR = "chrome-error://"; private static class BlockersInfo { @@ -95,12 +92,10 @@ public BlockersInfo() { private Context mContext; private PopupWindow mPopupWindow; - private AnimatorSet mMenuItemEnterAnimator; private BraveShieldsMenuObserver mMenuObserver; private View mHardwareButtonMenuAnchor; private final Map mTabsStat = Collections.synchronizedMap(new HashMap()); - private OnCheckedChangeListener mBraveShieldsAdsTrackingChangeListener; private SwitchCompat mBraveShieldsBlockingScriptsSwitch; private OnCheckedChangeListener mBraveShieldsBlockingScriptsChangeListener; private SwitchCompat mBraveShieldsForgetFirstPartyStorageSwitch; @@ -118,8 +113,6 @@ public BlockersInfo() { private LinearLayout mReportBrokenSiteLayout; private LinearLayout mReportErrorPageLayout; private TextView mSiteBlockCounterText; - private TextView mShieldsDownText; - private TextView mSiteBrokenWarningText; private View mBottomDivider; private ImageView mToggleIcon; @@ -239,16 +232,13 @@ private PopupWindow showPopupMenu(View anchorView) { // the keyboard, instead of overlapping the keyboard as it should. int displayHeight = mContext.getResources().getDisplayMetrics().heightPixels; int widthHeight = mContext.getResources().getDisplayMetrics().widthPixels; - int currentDisplayWidth = widthHeight; // In appcompat 23.2.1, DisplayMetrics are not updated after rotation change. This is a // workaround for it. See crbug.com/599048. // TODO(ianwen): Remove the rotation check after we roll to 23.3.0. if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_180) { - currentDisplayWidth = Math.min(displayHeight, widthHeight); displayHeight = Math.max(displayHeight, widthHeight); } else if (rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270) { - currentDisplayWidth = Math.max(displayHeight, widthHeight); displayHeight = Math.min(displayHeight, widthHeight); } else { assert false : "Rotation unexpected"; @@ -424,8 +414,6 @@ private void initViews() { mAboutLayout = mPopupView.findViewById(R.id.brave_shields_about_layout_id); mToggleLayout = mPopupView.findViewById(R.id.brave_shields_toggle_layout_id); mSiteBlockCounterText = mPopupView.findViewById(R.id.site_block_count_text); - mShieldsDownText = mPopupView.findViewById(R.id.shield_down_text); - mSiteBrokenWarningText = mPopupView.findViewById(R.id.site_broken_warning_text); mReportBrokenSiteLayout = mPopupView.findViewById(R.id.brave_shields_report_site_layout_id); mReportErrorPageLayout = @@ -949,17 +937,18 @@ public void onClick(View view) { }); LinearLayout mSiteBlockLayout = mMainLayout.findViewById(R.id.site_block_layout); - TextView mSiteBrokenWarningText = mMainLayout.findViewById(R.id.site_broken_warning_text); + TextView siteBrokenWarningText = mMainLayout.findViewById(R.id.site_broken_warning_text); TextView mShieldsUpText = mMainLayout.findViewById(R.id.shield_up_text); - String mBraveShieldsText = mContext.getResources().getString(R.string.brave_shields_onboarding_title); + String mBraveShieldsText = + mContext.getResources().getString(R.string.brave_shields_onboarding_title); if (isChecked) { mShieldDownText.setVisibility(View.GONE); mReportBrokenSiteButton.setVisibility(View.GONE); mSiteBlockLayout.setVisibility(View.VISIBLE); - mSiteBrokenWarningText.setVisibility(View.VISIBLE); + siteBrokenWarningText.setVisibility(View.VISIBLE); mToggleLayout.setVisibility(View.VISIBLE); String mUpText = mContext.getResources().getString(R.string.up); @@ -971,7 +960,7 @@ public void onClick(View view) { mReportBrokenSiteButton.setVisibility(View.VISIBLE); mSiteBlockLayout.setVisibility(View.GONE); - mSiteBrokenWarningText.setVisibility(View.GONE); + siteBrokenWarningText.setVisibility(View.GONE); mToggleLayout.setVisibility(View.GONE); setToggleView(false); @@ -983,8 +972,6 @@ public void onClick(View view) { } private void setUpViews() { - boolean isNightMode = GlobalNightModeStateProviderHolder.getInstance().isInNightMode(); - initViews(); setUpMainLayout(); diff --git a/android/java/org/chromium/chrome/browser/shields/BraveShieldsUtils.java b/android/java/org/chromium/chrome/browser/shields/BraveShieldsUtils.java index e52c90e29fc8..3561684b112e 100644 --- a/android/java/org/chromium/chrome/browser/shields/BraveShieldsUtils.java +++ b/android/java/org/chromium/chrome/browser/shields/BraveShieldsUtils.java @@ -38,7 +38,6 @@ public class BraveShieldsUtils { public static final String WEBCOMPAT_UI_SOURCE_HISTOGRAM_NAME = "Brave.Webcompat.UISource"; public static final String WEBCOMPAT_REPORT_BRAVE_VERSION = "version"; public static final String WEBCOMPAT_REPORT_BRAVE_CHANNEL = "channel"; - private static final String MULTIPART_CONTENT_TYPE_PREFIX = "multipart/form-data; boundary=%s"; private static final String MULTIPART_BOUNDARY = "MultipartBoundary"; private static final int MULTIPART_BOUNDARY_SIZE = 69; private static final char[] MULTIPART_CHARS = @@ -185,7 +184,7 @@ private static void generateMultipartData( throws UnsupportedEncodingException, IOException { final String mb = generateBoundary(); urlConnection.setRequestProperty( - "Content-Type", String.format(MULTIPART_CONTENT_TYPE_PREFIX, mb)); + "Content-Type", String.format("multipart/form-data; boundary=%s", mb)); urlConnection.connect(); try (OutputStream os = urlConnection.getOutputStream()) { diff --git a/android/java/org/chromium/chrome/browser/speedreader/BraveSpeedReaderManager.java b/android/java/org/chromium/chrome/browser/speedreader/BraveSpeedReaderManager.java index 363f703b3457..4bc990b47b65 100644 --- a/android/java/org/chromium/chrome/browser/speedreader/BraveSpeedReaderManager.java +++ b/android/java/org/chromium/chrome/browser/speedreader/BraveSpeedReaderManager.java @@ -45,9 +45,6 @@ public class BraveSpeedReaderManager extends EmptyTabObserver implements UserDat /** If the infobar was closed due to the close button. */ private boolean mIsDismissed; - /** Whether this manager and tab have been destroyed. */ - private boolean mIsDestroyed; - /** The tab this manager is attached to. */ private final Tab mTab; @@ -77,13 +74,9 @@ public static void createForTab(Tab tab) { tab, () -> MessageDispatcherProvider.from(tab.getWindowAndroid()))); } - /** - * Clear the status map and references to other objects. - */ + /** Clear the status map and references to other objects. */ @Override - public void destroy() { - mIsDestroyed = true; - } + public void destroy() {} @Override public void onShown(Tab shownTab, @TabSelectionType int type) { @@ -158,7 +151,7 @@ private void showReaderModeMessage(MessageDispatcher messageDispatcher) { mMessageModel, mTab.getWebContents(), MessageScopeType.NAVIGATION, false); } - private void onMessageDismissed(GURL url, @DismissReason int dismissReason) { + private void onMessageDismissed(GURL unused_url, @DismissReason int dismissReason) { mMessageModel = null; if (dismissReason == DismissReason.GESTURE) { mIsDismissed = true; 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 84936cd56ac3..66b53eafde64 100644 --- a/android/java/org/chromium/chrome/browser/tabbed_mode/BraveTabbedRootUiCoordinator.java +++ b/android/java/org/chromium/chrome/browser/tabbed_mode/BraveTabbedRootUiCoordinator.java @@ -101,6 +101,7 @@ public BraveTabbedRootUiCoordinator( @NonNull IntentRequestTracker intentRequestTracker, @NonNull InsetObserver insetObserver, @NonNull Function backButtonShouldCloseTabFn, + @NonNull Callback sendToBackground, boolean initializeUiWithIncognitoColors, @NonNull BackPressManager backPressManager, @Nullable Bundle savedInstanceState, @@ -148,6 +149,7 @@ public BraveTabbedRootUiCoordinator( intentRequestTracker, insetObserver, backButtonShouldCloseTabFn, + sendToBackground, initializeUiWithIncognitoColors, backPressManager, savedInstanceState, diff --git a/android/java/org/chromium/chrome/browser/toolbar/BraveToolbarManager.java b/android/java/org/chromium/chrome/browser/toolbar/BraveToolbarManager.java index a650311a422e..a798e101481f 100644 --- a/android/java/org/chromium/chrome/browser/toolbar/BraveToolbarManager.java +++ b/android/java/org/chromium/chrome/browser/toolbar/BraveToolbarManager.java @@ -55,6 +55,8 @@ import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.tasks.tab_management.TabGroupUi; import org.chromium.chrome.browser.tasks.tab_management.TabManagementDelegateProvider; +import org.chromium.chrome.browser.theme.BottomUiThemeColorProvider; +import org.chromium.chrome.browser.theme.ThemeColorProvider; import org.chromium.chrome.browser.theme.TopUiThemeColorProvider; import org.chromium.chrome.browser.toolbar.bottom.BottomControlsContentDelegate; import org.chromium.chrome.browser.toolbar.bottom.BottomControlsCoordinator; @@ -74,7 +76,7 @@ import org.chromium.chrome.browser.ui.edge_to_edge.EdgeToEdgeController; import org.chromium.chrome.browser.ui.system.StatusBarColorController; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; -import org.chromium.components.browser_ui.desktop_windowing.DesktopWindowStateProvider; +import org.chromium.components.browser_ui.desktop_windowing.DesktopWindowStateManager; import org.chromium.components.browser_ui.widget.scrim.ScrimCoordinator; import org.chromium.components.omnibox.action.OmniboxActionDelegate; import org.chromium.misc_metrics.mojom.MiscAndroidMetrics; @@ -113,6 +115,7 @@ public class BraveToolbarManager extends ToolbarManager { private LayoutStateProvider.LayoutStateObserver mLayoutStateObserver; private LayoutStateProvider mLayoutStateProvider; private ObservableSupplier mReadAloudControllerSupplier; + private TopUiThemeColorProvider mTopUiThemeColorProvider; // Own members. private TabGroupUi mTabGroupUi; @@ -153,7 +156,6 @@ public BraveToolbarManager( FindToolbarManager findToolbarManager, ObservableSupplier profileSupplier, ObservableSupplier bookmarkModelSupplier, - @Nullable Supplier canAnimateNativeBrowserControls, OneshotSupplier layoutStateProviderSupplier, OneshotSupplier appMenuCoordinatorSupplier, boolean canShowUpdateBadge, @@ -180,7 +182,7 @@ public BraveToolbarManager( @Nullable ObservableSupplier overviewColorSupplier, @Nullable View baseChromeLayout, ObservableSupplier readAloudControllerSupplier, - @Nullable DesktopWindowStateProvider desktopWindowStateProvider) { + @Nullable DesktopWindowStateManager desktopWindowStateManager) { super( activity, bottomControlsStacker, @@ -200,7 +202,6 @@ public BraveToolbarManager( findToolbarManager, profileSupplier, bookmarkModelSupplier, - canAnimateNativeBrowserControls, layoutStateProviderSupplier, appMenuCoordinatorSupplier, canShowUpdateBadge, @@ -225,7 +226,7 @@ public BraveToolbarManager( overviewColorSupplier, baseChromeLayout, readAloudControllerSupplier, - desktopWindowStateProvider); + desktopWindowStateManager); mOmniboxFocusStateSupplier = omniboxFocusStateSupplier; mLayoutStateProviderSupplier = layoutStateProviderSupplier; @@ -270,13 +271,20 @@ public void enableBottomControls() { (ViewStub) mActivity.findViewById(R.id.bottom_controls_stub); mBottomControls = (BraveScrollingBottomViewResourceFrameLayout) bottomControlsStub.inflate(); + + ThemeColorProvider bottomUiThemeColorProvider = + new BottomUiThemeColorProvider( + mTopUiThemeColorProvider, + mBrowserControlsSizer, + mIncognitoStateProvider, + mActivity); + mTabGroupUi = TabManagementDelegateProvider.getDelegate() .createTabGroupUi( mActivity, mBottomControls.findViewById(R.id.bottom_container_slot), mBrowserControlsSizer, - mIncognitoStateProvider, mScrimCoordinator, mOmniboxFocusStateSupplier, mBottomSheetController, @@ -285,8 +293,8 @@ public void enableBottomControls() { mTabContentManager, mTabCreatorManager, mLayoutStateProviderSupplier, - mModalDialogManagerSupplier.get()); - + mModalDialogManagerSupplier.get(), + bottomUiThemeColorProvider); mContentDelegateSupplier.set(mTabGroupUi); BrowserStateBrowserControlsVisibilityDelegate controlsVisibilityDelegate = 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 9ee654db2c80..b9a764a790a2 100644 --- a/android/java/org/chromium/chrome/browser/toolbar/bottom/BottomToolbarCoordinator.java +++ b/android/java/org/chromium/chrome/browser/toolbar/bottom/BottomToolbarCoordinator.java @@ -58,26 +58,20 @@ class BottomToolbarCoordinator implements View.OnLongClickListener { /** The tab switcher mode bottom toolbar stub that will be inflated when native is ready. */ private final ViewStub mTabSwitcherModeStub; - /** A provider that notifies components when the theme color changes.*/ + /** A provider that notifies components when the theme color changes. */ private final ThemeColorProvider mThemeColorProvider; private LayoutStateProvider.LayoutStateObserver mLayoutStateObserver; - private OneshotSupplier mLayoutStateProviderSupplier; private LayoutStateProvider mLayoutStateProvider; - /** The activity tab provider. */ - private ActivityTabProvider mTabProvider; - private ObservableSupplierImpl mShareButtonListenerSupplier = new ObservableSupplierImpl<>(); private CallbackController mCallbackController = new CallbackController(); ObservableSupplier mMenuButtonHelperSupplier; - private BottomControlsMediator mBottomControlsMediator; private Runnable mOriginalHomeButtonRunnable; private final BraveScrollingBottomViewResourceFrameLayout mScrollingBottomView; private HomeButton mHomeButton; private BookmarksButton mBookmarksButton; - private SearchAccelerator mSearchAccelerator; private BottomToolbarNewTabButton mNewTabButton; private View mBottomContainerTopShadow; private boolean mBookmarkButtonFilled; @@ -123,10 +117,8 @@ class BottomToolbarCoordinator implements View.OnLongClickListener { mTabSwitcherModeStub = root.findViewById(R.id.bottom_toolbar_tab_switcher_mode_stub); mThemeColorProvider = themeColorProvider; - mTabProvider = tabProvider; mMenuButtonHelperSupplier = menuButtonHelperSupplier; - mBottomControlsMediator = bottomControlsMediator; mOriginalHomeButtonRunnable = openHomepageAction; mScrollingBottomView = (BraveScrollingBottomViewResourceFrameLayout) scrollingBottomView; 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 303c984c4417..1c49fc322739 100644 --- a/android/java/org/chromium/chrome/browser/toolbar/bottom/BrowsingModeBottomToolbarCoordinator.java +++ b/android/java/org/chromium/chrome/browser/toolbar/bottom/BrowsingModeBottomToolbarCoordinator.java @@ -10,7 +10,6 @@ import android.view.View.OnLongClickListener; import org.chromium.base.Callback; -import org.chromium.base.CallbackController; import org.chromium.base.ContextUtils; import org.chromium.base.Log; import org.chromium.base.supplier.ObservableSupplier; @@ -76,7 +75,6 @@ public class BrowsingModeBottomToolbarCoordinator { /** The activity tab provider that used for making the IPH. */ private final ActivityTabProvider mTabProvider; - private CallbackController mCallbackController = new CallbackController(); private final BookmarksButton mBookmarkButton; private final MenuButton mMenuButton; private ThemeColorProvider mThemeColorProvider; diff --git a/android/java/org/chromium/chrome/browser/toolbar/bottom/BrowsingModeBottomToolbarMediator.java b/android/java/org/chromium/chrome/browser/toolbar/bottom/BrowsingModeBottomToolbarMediator.java index 706dccc1fce8..3ce540050799 100644 --- a/android/java/org/chromium/chrome/browser/toolbar/bottom/BrowsingModeBottomToolbarMediator.java +++ b/android/java/org/chromium/chrome/browser/toolbar/bottom/BrowsingModeBottomToolbarMediator.java @@ -16,12 +16,6 @@ * toolbar, and updating the model accordingly. */ class BrowsingModeBottomToolbarMediator implements ThemeColorObserver { - /** The transparency fraction of the IPH bubble. */ - private static final float DUET_IPH_BUBBLE_ALPHA_FRACTION = 0.9f; - - /** The transparency fraction of the IPH background. */ - private static final float DUET_IPH_BACKGROUND_ALPHA_FRACTION = 0.3f; - /** The dismissable parameter name of the IPH. */ static final String DUET_IPH_TAP_TO_DISMISS_PARAM_NAME = "duet_iph_tap_to_dismiss_enabled"; 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 34e43ea8f872..9b8fda5d1da6 100644 --- a/android/java/org/chromium/chrome/browser/toolbar/top/BraveToolbarLayoutImpl.java +++ b/android/java/org/chromium/chrome/browser/toolbar/top/BraveToolbarLayoutImpl.java @@ -102,6 +102,7 @@ import org.chromium.chrome.browser.tabmodel.TabModelSelectorTabObserver; import org.chromium.chrome.browser.theme.ThemeUtils; import org.chromium.chrome.browser.toolbar.ToolbarDataProvider; +import org.chromium.chrome.browser.toolbar.ToolbarProgressBar; import org.chromium.chrome.browser.toolbar.ToolbarTabController; import org.chromium.chrome.browser.toolbar.bottom.BottomToolbarConfiguration; import org.chromium.chrome.browser.toolbar.bottom.BottomToolbarVariationManager; @@ -115,7 +116,6 @@ import org.chromium.chrome.browser.util.BraveTouchUtils; import org.chromium.chrome.browser.util.ConfigurationUtils; import org.chromium.chrome.browser.util.PackageUtils; -import org.chromium.chrome.browser.widget.quickactionsearchandbookmark.promo.SearchWidgetPromoPanel; import org.chromium.components.embedder_support.util.UrlUtilities; import org.chromium.components.feature_engagement.Tracker; import org.chromium.content_public.browser.NavigationHandle; @@ -156,12 +156,8 @@ public abstract class BraveToolbarLayoutImpl extends ToolbarLayout private static final List BRAVE_SEARCH_ENGINE_DEFAULT_REGIONS = Arrays.asList("CA", "DE", "FR", "GB", "US", "AT", "ES", "MX", "BR", "AR", "IN"); - private static final long MB_10 = 10000000; - private static final long MINUTES_10 = 10 * 60 * 1000; private static final int URL_FOCUS_TOOLBAR_BUTTONS_TRANSLATION_X_DP = 10; - private static final int PLAYLIST_MEDIA_COUNT_LIMIT = 3; - private static final int DAYS_7 = 7; public static boolean mShouldShowPlaylistMenu; @@ -177,8 +173,15 @@ public abstract class BraveToolbarLayoutImpl extends ToolbarLayout private FrameLayout mShieldsLayout; private FrameLayout mRewardsLayout; private BraveShieldsHandler mBraveShieldsHandler; + + // TabModelSelectorTabObserver setups observer at the ctor + @SuppressWarnings("UnusedVariable") private TabModelSelectorTabObserver mTabModelSelectorTabObserver; + + // TabModelSelectorTabModelObserver setups observer at the ctor + @SuppressWarnings("UnusedVariable") private TabModelSelectorTabModelObserver mTabModelSelectorTabModelObserver; + private BraveRewardsNativeWorker mBraveRewardsNativeWorker; private BraveRewardsPanel mRewardsPopup; private DAppsWalletController mDAppsWalletController; @@ -201,7 +204,8 @@ public abstract class BraveToolbarLayoutImpl extends ToolbarLayout private ColorStateList mDarkModeTint; private ColorStateList mLightModeTint; - private SearchWidgetPromoPanel mSearchWidgetPromoPanel; + // See comment at onUrlFocusChange + // private SearchWidgetPromoPanel mSearchWidgetPromoPanel; private final Set mTabsWithWalletIcon = Collections.synchronizedSet(new HashSet()); @@ -274,7 +278,10 @@ protected void onFinishInflate() { mDarkModeTint = ThemeUtils.getThemedToolbarIconTint(getContext(), false); mLightModeTint = ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.brave_white)); - mSearchWidgetPromoPanel = new SearchWidgetPromoPanel(getContext()); + + // See comment at onUrlFocusChange + // mSearchWidgetPromoPanel = new SearchWidgetPromoPanel(getContext()); + if (mHomeButton != null) { mHomeButton.setOnLongClickListener(this); } @@ -491,7 +498,7 @@ public void onShown(Tab tab, @TabSelectionType int type) { if (type != TabSelectionType.FROM_USER) { dismissWalletPanelOrDialog(); } - findMediaFiles(tab); + findMediaFiles(); } @Override @@ -647,7 +654,7 @@ private boolean isPlaylistButtonVisible() { } } - private void findMediaFiles(Tab tab) { + private void findMediaFiles() { if (mPlaylistService != null && isPlaylistEnabledByPrefsAndFlags()) { hidePlaylistButton(); mPlaylistService.findMediaFilesFromActiveTab(); @@ -1058,9 +1065,10 @@ private void addSavedBandwidthToDb(long savings) { @Override protected Void doInBackground() { try { - SavedBandwidthTable savedBandwidthTable = new SavedBandwidthTable( - savings, BraveStatsUtil.getCalculatedDate("yyyy-MM-dd", 0)); - long rowId = mDatabaseHelper.insertSavedBandwidth(savedBandwidthTable); + SavedBandwidthTable savedBandwidthTable = + new SavedBandwidthTable( + savings, BraveStatsUtil.getCalculatedDate("yyyy-MM-dd", 0)); + long unused_rowId = mDatabaseHelper.insertSavedBandwidth(savedBandwidthTable); } catch (Exception e) { // Do nothing if url is invalid. // Just return w/o showing shields popup. @@ -1068,6 +1076,7 @@ protected Void doInBackground() { } return null; } + @Override protected void onPostExecute(Void result) { assert ThreadUtils.runningOnUiThread(); @@ -1083,10 +1092,15 @@ protected Void doInBackground() { try { URL urlObject = new URL(url); URL siteObject = new URL(statSite); - BraveStatsTable braveStatsTable = new BraveStatsTable(url, urlObject.getHost(), - statType, statSite, siteObject.getHost(), - BraveStatsUtil.getCalculatedDate("yyyy-MM-dd", 0)); - long rowId = mDatabaseHelper.insertStats(braveStatsTable); + BraveStatsTable braveStatsTable = + new BraveStatsTable( + url, + urlObject.getHost(), + statType, + statSite, + siteObject.getHost(), + BraveStatsUtil.getCalculatedDate("yyyy-MM-dd", 0)); + long unused_rowId = mDatabaseHelper.insertStats(braveStatsTable); } catch (Exception e) { // Do nothing if url is invalid. // Just return w/o showing shields popup. @@ -1094,6 +1108,7 @@ protected Void doInBackground() { } return null; } + @Override protected void onPostExecute(Void result) { assert ThreadUtils.runningOnUiThread(); @@ -1176,11 +1191,11 @@ public void onClickImpl(View v) { Log.e(TAG, "HomeButton click " + e); } } else if (mBraveWalletButton == v && mBraveWalletButton != null) { - maybeShowWalletPanel(v); + maybeShowWalletPanel(); } } - private void maybeShowWalletPanel(View v) { + private void maybeShowWalletPanel() { try { BraveActivity activity = BraveActivity.getBraveActivity(); activity.showWalletPanel(true); @@ -1613,7 +1628,8 @@ public void initialize( BooleanSupplier partnerHomepageEnabledSupplier, OfflineDownloader offlineDownloader, UserEducationHelper userEducationHelper, - ObservableSupplier trackerSupplier) { + ObservableSupplier trackerSupplier, + ToolbarProgressBar progressBar) { super.initialize( toolbarDataProvider, tabController, @@ -1623,7 +1639,8 @@ public void initialize( partnerHomepageEnabledSupplier, offlineDownloader, userEducationHelper, - trackerSupplier); + trackerSupplier, + progressBar); BraveMenuButtonCoordinator.setMenuFromBottom(isMenuButtonOnBottom()); } 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 f7e78ec9a0c6..d985ca7b5ea3 100644 --- a/android/java/org/chromium/chrome/browser/toolbar/top/BraveTopToolbarCoordinator.java +++ b/android/java/org/chromium/chrome/browser/toolbar/top/BraveTopToolbarCoordinator.java @@ -31,6 +31,7 @@ import org.chromium.chrome.browser.theme.TopUiThemeColorProvider; import org.chromium.chrome.browser.toolbar.ButtonDataProvider; import org.chromium.chrome.browser.toolbar.ToolbarDataProvider; +import org.chromium.chrome.browser.toolbar.ToolbarProgressBar; import org.chromium.chrome.browser.toolbar.ToolbarTabController; import org.chromium.chrome.browser.toolbar.menu_button.MenuButton; import org.chromium.chrome.browser.toolbar.menu_button.MenuButtonCoordinator; @@ -39,7 +40,7 @@ import org.chromium.chrome.browser.toolbar.top.tab_strip.TabStripTransitionCoordinator.TabStripTransitionDelegate; import org.chromium.chrome.browser.ui.appmenu.AppMenuButtonHelper; import org.chromium.chrome.browser.user_education.UserEducationHelper; -import org.chromium.components.browser_ui.desktop_windowing.DesktopWindowStateProvider; +import org.chromium.components.browser_ui.desktop_windowing.DesktopWindowStateManager; import org.chromium.ui.resources.ResourceManager; import org.chromium.ui.util.ColorUtils; @@ -49,7 +50,6 @@ public class BraveTopToolbarCoordinator extends TopToolbarCoordinator { // To delete in bytecode. Variables from the parent class will be used instead. private OptionalBrowsingModeButtonController mOptionalButtonController; - private ToolbarColorObserverManager mToolbarColorObserverManager; // Own members. private ToolbarLayout mBraveToolbarLayout; @@ -85,9 +85,10 @@ public BraveTopToolbarCoordinator( browserStateBrowserControlsVisibilityDelegate, FullscreenManager fullscreenManager, TabObscuringHandler tabObscuringHandler, - @Nullable DesktopWindowStateProvider desktopWindowStateProvider, + @Nullable DesktopWindowStateManager desktopWindowStateManager, OneshotSupplier tabStripTransitionDelegateSupplier, - @Nullable OnLongClickListener onLongClickListener) { + @Nullable OnLongClickListener onLongClickListener, + ToolbarProgressBar progressBar) { super( controlContainer, toolbarLayout, @@ -112,9 +113,10 @@ public BraveTopToolbarCoordinator( browserStateBrowserControlsVisibilityDelegate, fullscreenManager, tabObscuringHandler, - desktopWindowStateProvider, + desktopWindowStateManager, tabStripTransitionDelegateSupplier, - onLongClickListener); + onLongClickListener, + progressBar); mBraveToolbarLayout = toolbarLayout; mBraveMenuButtonCoordinator = browsingModeMenuButtonCoordinator; @@ -199,7 +201,8 @@ public void initializeWithNative( LayoutManager layoutManager, ObservableSupplier tabSupplier, BrowserControlsVisibilityManager browserControlsVisibilityManager, - TopUiThemeColorProvider topUiThemeColorProvider) { + TopUiThemeColorProvider topUiThemeColorProvider, + Supplier bottomToolbarControlsOffsetSupplier) { super.initializeWithNative( profile, layoutUpdater, @@ -208,7 +211,8 @@ public void initializeWithNative( layoutManager, tabSupplier, browserControlsVisibilityManager, - topUiThemeColorProvider); + topUiThemeColorProvider, + bottomToolbarControlsOffsetSupplier); assert mBraveToolbarLayout instanceof BraveToolbarLayoutImpl : "Something has changed in the upstream!"; diff --git a/android/java/org/chromium/chrome/browser/util/BraveDbUtil.java b/android/java/org/chromium/chrome/browser/util/BraveDbUtil.java index 1e2c12a1d767..ee740ceab40d 100644 --- a/android/java/org/chromium/chrome/browser/util/BraveDbUtil.java +++ b/android/java/org/chromium/chrome/browser/util/BraveDbUtil.java @@ -66,7 +66,6 @@ public void ExportRewardsDb(Dialog dlg) { } public void ImportRewardsDb(Dialog dlg, String fileToImport) { - Context context = ContextUtils.getApplicationContext(); mRewardsDst = importDestinationPath(); mRewardsSrc = fileToImport.isEmpty() @@ -85,9 +84,9 @@ private void copyRewardsDbThread(Dialog dlg, boolean isImport) { if (isImport) { File file = new File(mRewardsDst); - boolean file_deleted = file.delete(); + boolean unused_file_deleted = file.delete(); File file_journal = new File(mRewardsDst + "-journal"); - boolean file_journal_deleted = file_journal.delete(); + boolean unused_file_journal_deleted = file_journal.delete(); } String erroMsg = ""; diff --git a/android/java/org/chromium/chrome/browser/util/TouchDelegateComposite.java b/android/java/org/chromium/chrome/browser/util/TouchDelegateComposite.java index f227d1c44d00..ffc418040db0 100644 --- a/android/java/org/chromium/chrome/browser/util/TouchDelegateComposite.java +++ b/android/java/org/chromium/chrome/browser/util/TouchDelegateComposite.java @@ -37,14 +37,12 @@ public void addDelegate(TouchDelegate delegate) { mDelegates.add(new Pair<>(null, new Pair<>(new Rect(), delegate))); } - /** - * Add a delegate by bounds and view. - */ + /** Add a delegate by bounds and view. */ public void addDelegate(Rect bounds, View view) { - boolean dup = false; - mDelegates = mDelegates.stream() - .filter(e -> e.first == null || e.first.getId() != view.getId()) - .collect(Collectors.toList()); + mDelegates = + mDelegates.stream() + .filter(e -> e.first == null || e.first.getId() != view.getId()) + .collect(Collectors.toList()); mDelegates.add(new Pair<>(view, new Pair<>(bounds, new TouchDelegate(bounds, view)))); } 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 7bfe631a54e8..fbdf3c526058 100644 --- a/android/java/org/chromium/chrome/browser/vpn/activities/BraveVpnProfileActivity.java +++ b/android/java/org/chromium/chrome/browser/vpn/activities/BraveVpnProfileActivity.java @@ -10,8 +10,6 @@ import android.view.MenuItem; import android.view.View; import android.widget.Button; -import android.widget.LinearLayout; -import android.widget.ProgressBar; import android.widget.TextView; import androidx.appcompat.app.ActionBar; @@ -27,8 +25,6 @@ public class BraveVpnProfileActivity extends BraveVpnParentActivity { private TextView mProfileText; private Button mInstallVpnButton; private Button mContactSupportButton; - private ProgressBar mProfileProgress; - private LinearLayout mProfileLayout; private void initializeViews() { setContentView(R.layout.activity_brave_vpn_profile); @@ -41,9 +37,6 @@ private void initializeViews() { actionBar.setHomeAsUpIndicator(R.drawable.ic_baseline_close_24); actionBar.setTitle(getResources().getString(R.string.install_vpn)); - mProfileProgress = findViewById(R.id.profile_progress); - mProfileLayout = findViewById(R.id.profile_layout); - mProfileTitle = findViewById(R.id.brave_vpn_profile_title); mProfileText = findViewById(R.id.brave_vpn_profile_text); diff --git a/android/java/org/chromium/chrome/browser/vpn/activities/VpnPaywallActivity.java b/android/java/org/chromium/chrome/browser/vpn/activities/VpnPaywallActivity.java index bb82d1650455..d3194be5a3ea 100644 --- a/android/java/org/chromium/chrome/browser/vpn/activities/VpnPaywallActivity.java +++ b/android/java/org/chromium/chrome/browser/vpn/activities/VpnPaywallActivity.java @@ -35,7 +35,6 @@ import org.chromium.ui.text.SpanApplier.SpanInfo; public class VpnPaywallActivity extends BraveVpnParentActivity { - private LinearLayout mPlanLayout; private boolean mShouldShowRestoreMenu; private ProgressBar mMonthlyPlanProgress; @@ -73,8 +72,6 @@ private void initializeViews() { actionBar.setHomeAsUpIndicator(R.drawable.ic_baseline_close_24); actionBar.setTitle(getResources().getString(R.string.brave_vpn)); - mPlanLayout = findViewById(R.id.plan_layout); - mMonthlyPlanProgress = findViewById(R.id.monthly_plan_progress); mRemovedValueText = findViewById(R.id.removed_value_tv); diff --git a/android/java/org/chromium/chrome/browser/vpn/utils/BraveVpnPrefUtils.java b/android/java/org/chromium/chrome/browser/vpn/utils/BraveVpnPrefUtils.java index c8facdedb31a..381a6e3f89ba 100644 --- a/android/java/org/chromium/chrome/browser/vpn/utils/BraveVpnPrefUtils.java +++ b/android/java/org/chromium/chrome/browser/vpn/utils/BraveVpnPrefUtils.java @@ -26,7 +26,6 @@ public class BraveVpnPrefUtils { private static final String PREF_BRAVE_VPN_PURCHASE_TOKEN = "brave_vpn_purchase_token"; private static final String PREF_BRAVE_VPN_PRODUCT_ID = "brave_vpn_product_id"; private static final String PREF_BRAVE_VPN_PURCHASE_EXPIRY = "brave_vpn_purchase_expiry"; - private static final String PREF_BRAVE_VPN_SERVER_REGIONS = "brave_vpn_server_regions"; private static final String PREF_BRAVE_VPN_SERVER_CHANGE_LOCATION = "server_change_location"; private static final String PREF_BRAVE_VPN_SERVER_COUNTRY = "server_country"; private static final String PREF_BRAVE_VPN_SERVER_CONTINENT = "server_continent"; diff --git a/android/java/org/chromium/chrome/browser/vpn/wireguard/TunnelModel.java b/android/java/org/chromium/chrome/browser/vpn/wireguard/TunnelModel.java index 0471b2c213e3..f51c8c8a16a2 100644 --- a/android/java/org/chromium/chrome/browser/vpn/wireguard/TunnelModel.java +++ b/android/java/org/chromium/chrome/browser/vpn/wireguard/TunnelModel.java @@ -15,7 +15,10 @@ public class TunnelModel implements Tunnel { public static final String TUNNEL_NAME = "Brave"; private final String name; + + @SuppressWarnings("UnusedVariable") private Config config; + private final TunnelStateUpdateListener tunnelStateUpdateListener; public State getState() { diff --git a/android/java/org/chromium/chrome/browser/vpn/wireguard/WireguardServiceImpl.java b/android/java/org/chromium/chrome/browser/vpn/wireguard/WireguardServiceImpl.java index 3145f109bb17..491d02dba311 100644 --- a/android/java/org/chromium/chrome/browser/vpn/wireguard/WireguardServiceImpl.java +++ b/android/java/org/chromium/chrome/browser/vpn/wireguard/WireguardServiceImpl.java @@ -43,7 +43,6 @@ public class WireguardServiceImpl private final IBinder mBinder = new LocalBinder(); private Timer mVpnStatisticsTimer; private Timer mVpnRecordStatisticsTimer; - private Timer mRecordDaysUsedTimer; private static final int BRAVE_VPN_NOTIFICATION_ID = 801; private Context mContext = ContextUtils.getApplicationContext(); diff --git a/android/java/org/chromium/chrome/browser/widget/quickactionsearchandbookmark/QuickActionSearchAndBookmarkWidgetProvider.java b/android/java/org/chromium/chrome/browser/widget/quickactionsearchandbookmark/QuickActionSearchAndBookmarkWidgetProvider.java index d6ec7e014ecd..8008e0e1de2e 100644 --- a/android/java/org/chromium/chrome/browser/widget/quickactionsearchandbookmark/QuickActionSearchAndBookmarkWidgetProvider.java +++ b/android/java/org/chromium/chrome/browser/widget/quickactionsearchandbookmark/QuickActionSearchAndBookmarkWidgetProvider.java @@ -55,7 +55,8 @@ import org.chromium.chrome.browser.suggestions.tile.Tile; import org.chromium.chrome.browser.ui.favicon.FaviconUtils; import org.chromium.chrome.browser.ui.searchactivityutils.SearchActivityClient; -import org.chromium.chrome.browser.ui.searchactivityutils.SearchActivityExtras; +import org.chromium.chrome.browser.ui.searchactivityutils.SearchActivityExtras.IntentOrigin; +import org.chromium.chrome.browser.ui.searchactivityutils.SearchActivityExtras.SearchType; import org.chromium.chrome.browser.ui.searchactivityutils.SearchActivityPreferencesManager; import org.chromium.chrome.browser.ui.searchactivityutils.SearchActivityPreferencesManager.SearchActivityPreferences; import org.chromium.chrome.browser.widget.quickactionsearchandbookmark.utils.BraveSearchWidgetUtils; @@ -100,56 +101,60 @@ public void accept(SearchActivityPreferences prefs) { private static final int DESIRED_ICON_SIZE = 44; private static final int DESIRED_ICON_RADIUS = 16; - private final static int[][][] tileViewsIdArray = new int[][][] { - { + private static final int[][][] tileViewsIdArray = + new int[][][] { + { {R.id.ivRow1Bookmark1Icon, R.id.tvRow1Bookmark1Name, R.id.layoutRow1Bookmark1}, {R.id.ivRow1Bookmark2Icon, R.id.tvRow1Bookmark2Name, R.id.layoutRow1Bookmark2}, {R.id.ivRow1Bookmark3Icon, R.id.tvRow1Bookmark3Name, R.id.layoutRow1Bookmark3}, {R.id.ivRow1Bookmark4Icon, R.id.tvRow1Bookmark4Name, R.id.layoutRow1Bookmark4}, - }, - { + }, + { {R.id.ivRow2Bookmark1Icon, R.id.tvRow2Bookmark1Name, R.id.layoutRow2Bookmark1}, {R.id.ivRow2Bookmark2Icon, R.id.tvRow2Bookmark2Name, R.id.layoutRow2Bookmark2}, {R.id.ivRow2Bookmark3Icon, R.id.tvRow2Bookmark3Name, R.id.layoutRow2Bookmark3}, {R.id.ivRow2Bookmark4Icon, R.id.tvRow2Bookmark4Name, R.id.layoutRow2Bookmark4}, - }, - { + }, + { {R.id.ivRow3Bookmark1Icon, R.id.tvRow3Bookmark1Name, R.id.layoutRow3Bookmark1}, {R.id.ivRow3Bookmark2Icon, R.id.tvRow3Bookmark2Name, R.id.layoutRow3Bookmark2}, {R.id.ivRow3Bookmark3Icon, R.id.tvRow3Bookmark3Name, R.id.layoutRow3Bookmark3}, {R.id.ivRow3Bookmark4Icon, R.id.tvRow3Bookmark4Name, R.id.layoutRow3Bookmark4}, - }, - { + }, + { {R.id.ivRow4Bookmark1Icon, R.id.tvRow4Bookmark1Name, R.id.layoutRow4Bookmark1}, {R.id.ivRow4Bookmark2Icon, R.id.tvRow4Bookmark2Name, R.id.layoutRow4Bookmark2}, {R.id.ivRow4Bookmark3Icon, R.id.tvRow4Bookmark3Name, R.id.layoutRow4Bookmark3}, {R.id.ivRow4Bookmark4Icon, R.id.tvRow4Bookmark4Name, R.id.layoutRow4Bookmark4}, - }, - }; + }, + }; - private static QuickActionSearchAndBookmarkWidgetProviderDelegate mDelegate; - private static final Object mLock = new Object(); - private static Set mUpdateAppWidgetsRunnables; + private static QuickActionSearchAndBookmarkWidgetProviderDelegate sDelegate; + private static final Object LOCK = new Object(); + private static Set sUpdateAppWidgetsRunnables; private boolean mNativeLoaded; public QuickActionSearchAndBookmarkWidgetProvider() { mNativeLoaded = false; - QuickActionSearchAndBookmarkWidgetProvider.mUpdateAppWidgetsRunnables = + QuickActionSearchAndBookmarkWidgetProvider.sUpdateAppWidgetsRunnables = new HashSet(); - final BrowserParts parts = new EmptyBrowserParts() { - @Override - public void finishNativeInitialization() { - synchronized (QuickActionSearchAndBookmarkWidgetProvider.mLock) { - mNativeLoaded = true; - for (Runnable runnable : - QuickActionSearchAndBookmarkWidgetProvider.mUpdateAppWidgetsRunnables) { - PostTask.postTask(TaskTraits.UI_DEFAULT, runnable); + final BrowserParts parts = + new EmptyBrowserParts() { + @Override + public void finishNativeInitialization() { + synchronized (QuickActionSearchAndBookmarkWidgetProvider.LOCK) { + mNativeLoaded = true; + for (Runnable runnable : + QuickActionSearchAndBookmarkWidgetProvider + .sUpdateAppWidgetsRunnables) { + PostTask.postTask(TaskTraits.UI_DEFAULT, runnable); + } + QuickActionSearchAndBookmarkWidgetProvider.sUpdateAppWidgetsRunnables + .clear(); + } } - QuickActionSearchAndBookmarkWidgetProvider.mUpdateAppWidgetsRunnables.clear(); - } - } - }; + }; try { ChromeBrowserInitializer.getInstance().handlePreNativeStartupAndLoadLibraries(parts); @@ -166,10 +171,10 @@ public static void initializeDelegate() { } private static QuickActionSearchAndBookmarkWidgetProviderDelegate getDelegate() { - if (mDelegate == null) { - mDelegate = new QuickActionSearchAndBookmarkWidgetProviderDelegate(); + if (sDelegate == null) { + sDelegate = new QuickActionSearchAndBookmarkWidgetProviderDelegate(); } - return mDelegate; + return sDelegate; } @Override @@ -197,9 +202,9 @@ public void onAppWidgetOptionsChanged(Context context, AppWidgetManager appWidge } private void runUpdateAppWidgetsWithNative(int[] appWidgetIds) { - synchronized (QuickActionSearchAndBookmarkWidgetProvider.mLock) { + synchronized (QuickActionSearchAndBookmarkWidgetProvider.LOCK) { if (!mNativeLoaded) { - QuickActionSearchAndBookmarkWidgetProvider.mUpdateAppWidgetsRunnables.add( + QuickActionSearchAndBookmarkWidgetProvider.sUpdateAppWidgetsRunnables.add( buildStartWithNativeRunnable(appWidgetIds)); return; @@ -222,9 +227,11 @@ public void run() { public static void updateTileIcon(Tile tile) { int index = indexOf(tile); - if (index != -1) - updateTileIcon(tileViewsIdArray[index / TILES_PER_ROW][index % TILES_PER_ROW][0], + if (index != -1) { + updateTileIcon( + tileViewsIdArray[index / TILES_PER_ROW][index % TILES_PER_ROW][0], getBitmap(tile.getIcon())); + } } public static void updateSearchEngine(String searchEngine) { @@ -359,10 +366,7 @@ public void onLargeIconAvailable( boolean isFallbackColorDefault, @IconType int iconType) { if (icon == null) - updateTileIcon( - imageViewId, - getTileIconFromColor( - gurl, fallbackColor, isFallbackColorDefault)); + updateTileIcon(imageViewId, getTileIconFromColor(gurl, fallbackColor)); else updateTileIcon(imageViewId, getRoundedTileIconFromBitmap(icon)); } }; @@ -377,10 +381,10 @@ private static Bitmap getRoundedTileIconFromBitmap(Bitmap icon) { return getBitmap(roundedIcon); } - private static Bitmap getTileIconFromColor( - GURL gurl, int fallbackColor, boolean isFallbackColorDefault) { - RoundedIconGenerator mIconGenerator = FaviconUtils.createRoundedRectangleIconGenerator( - ContextUtils.getApplicationContext()); + private static Bitmap getTileIconFromColor(GURL gurl, int fallbackColor) { + RoundedIconGenerator mIconGenerator = + FaviconUtils.createRoundedRectangleIconGenerator( + ContextUtils.getApplicationContext()); mIconGenerator.setBackgroundColor(fallbackColor); return mIconGenerator.generateIconForUrl(gurl); } @@ -399,8 +403,9 @@ private static Bitmap getBitmap(@Nullable Drawable drawable) { drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); drawable.draw(canvas); return bitmap; - } else + } else { return null; + } } private static void setRowsVisibility(RemoteViews views, int tilesSize, int minHeight) { @@ -433,15 +438,13 @@ private static PendingIntent createIntent(@NonNull Context context, @NonNull Str } private static PendingIntent createIntent(@NonNull Context context, boolean startVoiceSearch) { - SearchActivityClient client = new SearchActivityClientImpl(); + SearchActivityClient client = + new SearchActivityClientImpl(context, IntentOrigin.SEARCH_WIDGET); + Intent searchIntent = - client.createIntent( - context, - SearchActivityExtras.IntentOrigin.SEARCH_WIDGET, - null, - startVoiceSearch - ? SearchActivityExtras.SearchType.VOICE - : SearchActivityExtras.SearchType.TEXT); + client.newIntentBuilder() + .setSearchType(startVoiceSearch ? SearchType.VOICE : SearchType.TEXT) + .build(); searchIntent.putExtra(SearchWidgetProvider.EXTRA_FROM_SEARCH_WIDGET, true); searchIntent.setComponent(new ComponentName(context, SearchActivity.class)); @@ -519,17 +522,14 @@ public static List readWidgetTiles() { } } - /** - * A short class for tile. It keeps only information needed to this widget. - **/ - + /** A short class for tile. It keeps only information needed to this widget. */ public static class WidgetTile { - private String title; - private GURL gurl; + private String mTitle; + private GURL mGurl; public WidgetTile(String title, GURL gurl) { - this.title = title; - this.gurl = gurl; + mTitle = title; + mGurl = gurl; } public String getUrl() { @@ -537,16 +537,16 @@ public String getUrl() { } public GURL getGURL() { - return this.gurl; + return mGurl; } public String getTitle() { - return this.title; + return mTitle; } public void parseTile(Tile tile) { - this.gurl = tile.getUrl(); - this.title = tile.getTitle(); + mGurl = tile.getUrl(); + mTitle = tile.getTitle(); } public JSONObject toJSONObject() { diff --git a/android/java/proguard.flags b/android/java/proguard.flags index c4558310570d..571f66d368ae 100644 --- a/android/java/proguard.flags +++ b/android/java/proguard.flags @@ -30,7 +30,7 @@ -keep class org.chromium.components.browser_ui.site_settings.SingleCategorySettings { *** mCategory; - *** getAddExceptionDialogMessage(...); + *** getAddExceptionDialogMessageResourceId(...); *** resetList(...); } diff --git a/android/javatests/org/chromium/chrome/browser/BytecodeTest.java b/android/javatests/org/chromium/chrome/browser/BytecodeTest.java index 56daeabc23af..608f9b5328ea 100644 --- a/android/javatests/org/chromium/chrome/browser/BytecodeTest.java +++ b/android/javatests/org/chromium/chrome/browser/BytecodeTest.java @@ -92,7 +92,7 @@ import org.chromium.chrome.browser.omnibox.LocationBarLayout; import org.chromium.chrome.browser.omnibox.OverrideUrlLoadingDelegate; import org.chromium.chrome.browser.omnibox.UrlBarEditingTextStateProvider; -import org.chromium.chrome.browser.omnibox.status.PageInfoIPHController; +import org.chromium.chrome.browser.omnibox.status.PageInfoIphController; import org.chromium.chrome.browser.omnibox.status.StatusCoordinator.PageInfoAction; import org.chromium.chrome.browser.omnibox.suggestions.AutocompleteDelegate; import org.chromium.chrome.browser.omnibox.suggestions.OmniboxSuggestionsDropdownEmbedder; @@ -117,6 +117,7 @@ import org.chromium.chrome.browser.theme.TopUiThemeColorProvider; import org.chromium.chrome.browser.toolbar.ToolbarDataProvider; import org.chromium.chrome.browser.toolbar.ToolbarManager; +import org.chromium.chrome.browser.toolbar.ToolbarProgressBar; import org.chromium.chrome.browser.toolbar.ToolbarTabController; import org.chromium.chrome.browser.toolbar.menu_button.MenuButtonCoordinator; import org.chromium.chrome.browser.toolbar.top.NavigationPopup.HistoryDelegate; @@ -133,7 +134,7 @@ import org.chromium.chrome.browser.ui.system.StatusBarColorController.StatusBarColorProvider; import org.chromium.chrome.browser.user_education.UserEducationHelper; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; -import org.chromium.components.browser_ui.desktop_windowing.DesktopWindowStateProvider; +import org.chromium.components.browser_ui.desktop_windowing.DesktopWindowStateManager; import org.chromium.components.browser_ui.edge_to_edge.EdgeToEdgeStateProvider; import org.chromium.components.browser_ui.site_settings.ContentSettingException; import org.chromium.components.browser_ui.site_settings.PermissionInfo; @@ -151,7 +152,6 @@ import org.chromium.components.embedder_support.contextmenu.ContextMenuNativeDelegate; import org.chromium.components.embedder_support.contextmenu.ContextMenuParams; import org.chromium.components.external_intents.ExternalNavigationDelegate; -import org.chromium.components.externalauth.ExternalAuthUtils; import org.chromium.components.feature_engagement.Tracker; import org.chromium.components.omnibox.AutocompleteMatch; import org.chromium.components.omnibox.action.OmniboxActionDelegate; @@ -164,7 +164,6 @@ import org.chromium.ui.base.ActivityWindowAndroid; import org.chromium.ui.base.IntentRequestTracker; import org.chromium.ui.base.WindowAndroid; -import org.chromium.ui.base.WindowDelegate; import org.chromium.ui.modaldialog.ModalDialogManager; import org.chromium.ui.modelutil.MVCListAdapter.ModelList; import org.chromium.ui.modelutil.PropertyModel; @@ -557,10 +556,10 @@ public void testMethodsExist() throws Exception { Assert.assertTrue( methodExists( "org/chromium/components/browser_ui/site_settings/SingleCategorySettings", - "getAddExceptionDialogMessage", + "getAddExceptionDialogMessageResourceId", MethodModifier.REGULAR, - false, - null)); + true, + int.class)); Assert.assertTrue( methodExists( "org/chromium/components/browser_ui/site_settings/SingleCategorySettings", @@ -900,7 +899,6 @@ public void testMethodsForInvocationExist() throws Exception { MethodModifier.REGULAR, true, ViewProvider.class, - Context.class, boolean.class)); Assert.assertTrue( methodExists( @@ -926,13 +924,6 @@ public void testMethodsForInvocationExist() throws Exception { getClassForPath( "org/chromium/components/browser_ui/site_settings/ContentSettingsResources$ResourceItem"), int.class)); - Assert.assertTrue( - methodExists( - "org/chromium/components/browser_ui/site_settings/SingleCategorySettings", - "getAddExceptionDialogMessage", - MethodModifier.REGULAR, - true, - String.class)); Assert.assertTrue( methodExists( "org/chromium/components/browser_ui/site_settings/SingleCategorySettings", @@ -1133,7 +1124,6 @@ public void testConstructorsExistAndMatch() throws Exception { FindToolbarManager.class, ObservableSupplier.class, ObservableSupplier.class, - Supplier.class, OneshotSupplier.class, OneshotSupplier.class, boolean.class, @@ -1158,7 +1148,7 @@ public void testConstructorsExistAndMatch() throws Exception { ObservableSupplier.class, View.class, ObservableSupplier.class, - DesktopWindowStateProvider.class)); + DesktopWindowStateManager.class)); Assert.assertTrue( constructorsMatch( "org/chromium/chrome/browser/toolbar/bottom/BottomControlsMediator", @@ -1198,7 +1188,6 @@ public void testConstructorsExistAndMatch() throws Exception { Activity.class, ViewGroup.class, BrowserControlsStateProvider.class, - IncognitoStateProvider.class, ScrimCoordinator.class, ObservableSupplier.class, BottomSheetController.class, @@ -1207,7 +1196,8 @@ public void testConstructorsExistAndMatch() throws Exception { TabContentManager.class, TabCreatorManager.class, OneshotSupplier.class, - ModalDialogManager.class)); + ModalDialogManager.class, + ThemeColorProvider.class)); Assert.assertTrue( constructorsMatch( "org/chromium/chrome/browser/site_settings/ChromeSiteSettingsDelegate", @@ -1231,7 +1221,7 @@ public void testConstructorsExistAndMatch() throws Exception { PermissionDialogController.class, OneshotSupplier.class, Supplier.class, - PageInfoIPHController.class, + PageInfoIphController.class, WindowAndroid.class, Supplier.class)); Assert.assertTrue( @@ -1288,9 +1278,10 @@ public void testConstructorsExistAndMatch() throws Exception { BrowserStateBrowserControlsVisibilityDelegate.class, FullscreenManager.class, TabObscuringHandler.class, - DesktopWindowStateProvider.class, + DesktopWindowStateManager.class, OneshotSupplier.class, - OnLongClickListener.class)); + OnLongClickListener.class, + ToolbarProgressBar.class)); Assert.assertTrue( constructorsMatch( "org/chromium/chrome/browser/toolbar/menu_button/MenuButtonCoordinator", @@ -1420,7 +1411,6 @@ public void testConstructorsExistAndMatch() throws Exception { ObservableSupplier.class, LocationBarDataProvider.class, ActionMode.Callback.class, - WindowDelegate.class, WindowAndroid.class, Supplier.class, Supplier.class, @@ -1500,7 +1490,6 @@ public void testConstructorsExistAndMatch() throws Exception { Context.class, Callback.class, PropertyModel.class, - boolean.class, Callback.class, LogoCoordinator.VisibilityObserver.class, CachedTintedBitmap.class)); @@ -1557,6 +1546,7 @@ public void testConstructorsExistAndMatch() throws Exception { IntentRequestTracker.class, InsetObserver.class, Function.class, + Callback.class, boolean.class, BackPressManager.class, Bundle.class, @@ -1658,7 +1648,6 @@ public void testConstructorsExistAndMatch() throws Exception { TabContextMenuItemDelegate.class, Supplier.class, int.class, - ExternalAuthUtils.class, Context.class, ContextMenuParams.class, ContextMenuNativeDelegate.class)); @@ -1703,7 +1692,9 @@ public void testConstructorsExistAndMatch() throws Exception { LayoutRenderHost.class, BrowserControlsStateProvider.class, LayoutManager.class, - TopUiThemeColorProvider.class)); + TopUiThemeColorProvider.class, + Supplier.class, + ViewGroup.class)); Assert.assertTrue( constructorsMatch( "org/chromium/components/embedder_support/view/ContentView", @@ -1904,6 +1895,10 @@ public void testFieldsExist() throws Exception { fieldExists( "org/chromium/chrome/browser/toolbar/ToolbarManager", "mTabObscuringHandler")); + Assert.assertTrue( + fieldExists( + "org/chromium/chrome/browser/toolbar/ToolbarManager", + "mTopUiThemeColorProvider")); Assert.assertTrue( fieldExists( "org/chromium/chrome/browser/toolbar/top/TopToolbarCoordinator", diff --git a/app/BUILD.gn b/app/BUILD.gn index 4ff00e9dd1d7..c16c6d2b40ba 100644 --- a/app/BUILD.gn +++ b/app/BUILD.gn @@ -174,7 +174,6 @@ source_set("unit_tests") { "//brave/components/commands/common", "//chrome/app:command_ids", "//chrome/browser/apps/link_capturing:features", - "//chrome/browser/companion/core", "//chrome/common:chrome_features", "//components/translate/core/common", "//extensions/common", diff --git a/app/brave_main_delegate.cc b/app/brave_main_delegate.cc index a4b26b5b6e65..211b53a92ad9 100644 --- a/app/brave_main_delegate.cc +++ b/app/brave_main_delegate.cc @@ -73,7 +73,7 @@ constexpr char kBraveSyncServiceStagingURL[] = void AdjustSyncServiceUrlForAndroid(std::string* brave_sync_service_url) { DCHECK_NE(brave_sync_service_url, nullptr); - const char kProcessTypeSwitchName[] = "type"; + static constexpr char kProcessTypeSwitchName[] = "type"; // On Android we can detect data dir only on host process, and we cannot // for example on renderer or gpu-process, because JNI is not initialized diff --git a/app/brave_main_delegate_unittest.cc b/app/brave_main_delegate_unittest.cc index 956438e84e39..ebd17415e15d 100644 --- a/app/brave_main_delegate_unittest.cc +++ b/app/brave_main_delegate_unittest.cc @@ -15,7 +15,7 @@ #include "components/variations/variations_switches.h" #include "testing/gtest/include/gtest/gtest.h" -const char kBraveOriginTrialsPublicKey[] = +constexpr char kBraveOriginTrialsPublicKey[] = "bYUKPJoPnCxeNvu72j4EmPuK7tr1PAC7SHh8ld9Mw3E=," "fMS4mpO6buLQ/QMd+zJmxzty/VQ6B1EUZqoCU04zoRU="; diff --git a/app/brave_settings_strings.grdp b/app/brave_settings_strings.grdp index 4ae6b4c4106b..0f203fc81152 100644 --- a/app/brave_settings_strings.grdp +++ b/app/brave_settings_strings.grdp @@ -929,6 +929,9 @@ Web apps (PWAs) + + Passwords + diff --git a/app/brave_strings.grd b/app/brave_strings.grd index 1d87329a1c6c..66a9b915c09a 100644 --- a/app/brave_strings.grd +++ b/app/brave_strings.grd @@ -345,6 +345,24 @@ If you update this file, be sure also to update google_chrome_strings.grd. --> Task Manager - Brave + + Search + + + Look up the name of any tab title or extension to highlight it in the process table. + + + Ends the highlighted process. + + + Tabs + + + Extensions + + + System + Help make Brave better by sending crash reports and $1usage statistics to Brave @@ -988,12 +1006,15 @@ Permissions you've already given to websites and apps may apply to this account. Any Brave data that is generated during the use of this profile (such as the creation of bookmarks, history, passwords, and other settings) can be removed by the work profile administrator. $1Learn more - + Your organization requires you to sign into Brave - + Your organization, $1manager.com, requires you to sign into Brave + + Sign in to Brave? + You're signed in to Brave! @@ -1014,6 +1035,11 @@ Permissions you've already given to websites and apps may apply to this account. Multiple organizations manage Brave + + + You can sign in to get your stuff, or use Brave without an account + + @@ -1616,6 +1642,9 @@ Permissions you've already given to websites and apps may apply to this account. Copy + + Copy text + Text copied @@ -1718,6 +1747,9 @@ Permissions you've already given to websites and apps may apply to this account. Translated language: English$1 + + Search language list + @@ -1938,10 +1970,9 @@ Permissions you've already given to websites and apps may apply to this account. - - While we're setting up account access, you can still use Brave. You may not be able to access some resources until setup is complete. + + Your organization can see and manage browsing data, such as your bookmarks, history, and passwords. It can't see browsing data in personal Brave profiles. - @@ -2055,6 +2086,14 @@ Permissions you've already given to websites and apps may apply to this account. + + + You usually block notifications. To let this site notify you, click here. + + + You usually block notifications. To let this site notify you, click the notification icon on the right corner of your location bar. + + Your changes will take effect the next time you relaunch Brave. @@ -2419,6 +2458,16 @@ Permissions you've already given to websites and apps may apply to this account. Cleared Brave data + + + + Sign in to Brave + + + + To get your extensions on all your computers, sign in to Brave + + Google Chrome Beta diff --git a/app/brave_strings_override.grd b/app/brave_strings_override.grd index ca1adf49467b..d36194059fe6 100644 --- a/app/brave_strings_override.grd +++ b/app/brave_strings_override.grd @@ -437,6 +437,9 @@ Permissions you've already given to websites and apps may apply to this account. + + + diff --git a/app/certificate_manager.grdp b/app/certificate_manager.grdp index a451badf218e..08ecaee7c036 100644 --- a/app/certificate_manager.grdp +++ b/app/certificate_manager.grdp @@ -82,6 +82,9 @@ Installed by your Administrator + + Installed by you + Trusted Certificates @@ -152,14 +155,20 @@ Delete "$1VeriSign Browser Certificate"? - + If you delete one of your own certificates, you can no longer use it to identify yourself. + + If you delete a server certificate, Brave will no longer use it to identify servers. + Error reading file + + Import is only supported for a single certificate + Error deleting certificate @@ -172,7 +181,7 @@ Error importing certificate - + Unable to import certificate diff --git a/app/feature_defaults_unittest.cc b/app/feature_defaults_unittest.cc index c5bf07b04ab9..50e92e10264a 100644 --- a/app/feature_defaults_unittest.cc +++ b/app/feature_defaults_unittest.cc @@ -9,7 +9,6 @@ #include "base/features.h" #include "base/logging.h" #include "chrome/browser/browser_features.h" -#include "chrome/browser/companion/core/features.h" #include "chrome/browser/devtools/features.h" #include "chrome/browser/preloading/preloading_features.h" #include "chrome/browser/ui/ui_features.h" @@ -80,7 +79,6 @@ TEST(FeatureDefaultsTest, DisabledFeatures) { const base::Feature* disabled_features[] = { &aggregation_service::kAggregationServiceMultipleCloudProviders, #if BUILDFLAG(IS_ANDROID) - &android_webview::features::kWebViewEnumerateDevicesCache, &android_webview::features::kWebViewMediaIntegrityApiBlinkExtension, #endif &attribution_reporting::features::kConversionMeasurement, @@ -110,7 +108,6 @@ TEST(FeatureDefaultsTest, DisabledFeatures) { &blink::features::kSharedStorageAPI, &blink::features::kSharedStorageAPIM118, &blink::features::kSharedStorageAPIM125, - &blink::features::kSharedStorageSelectURLLimit, &blink::features::kSpeculationRulesPrefetchFuture, &blink::features::kTextFragmentAnchor, #if BUILDFLAG(IS_ANDROID) @@ -127,10 +124,6 @@ TEST(FeatureDefaultsTest, DisabledFeatures) { &content_settings::features::kTrackingProtection3pcd, &content_settings::features::kUserBypassUI, #if !BUILDFLAG(IS_ANDROID) - &companion::features::internal:: - kCompanionEnabledByObservingExpsNavigations, - &companion::features::internal::kSidePanelCompanion, - &companion::features::internal::kSidePanelCompanion2, &enterprise_signals::features::kDeviceSignalsConsentDialog, &extensions_features::kExtensionManifestV2DeprecationWarning, &extensions_features::kExtensionManifestV2Unsupported, @@ -138,7 +131,6 @@ TEST(FeatureDefaultsTest, DisabledFeatures) { &features::kToolbarPinning, #endif &features::kBookmarkTriggerForPrerender2, - &features::kChromeLabs, &features::kChromeStructuredMetrics, &features::kCookieDeprecationFacilitatedTesting, #if !BUILDFLAG(IS_ANDROID) @@ -161,9 +153,6 @@ TEST(FeatureDefaultsTest, DisabledFeatures) { &features::kKAnonymityServiceOHTTPRequests, &features::kNewTabPageTriggerForPrerender2, &features::kNotificationTriggers, -#if BUILDFLAG(IS_ANDROID) - &features::kPrivacyGuidePreloadAndroid, -#endif &features::kPrivacySandboxAdsAPIsOverride, &features::kPrivacySandboxAdsAPIsM1Override, #if !BUILDFLAG(IS_ANDROID) @@ -187,7 +176,6 @@ TEST(FeatureDefaultsTest, DisabledFeatures) { &features::kWebOTP, &heap_profiling::kHeapProfilerReporting, &history::kOrganicRepeatableQueries, - &history_clusters::kSidePanelJourneys, &history_clusters::features::kOnDeviceClustering, &history_clusters::features::kOnDeviceClusteringKeywordFiltering, &history_clusters::internal::kHistoryClustersInternalsPage, @@ -222,7 +210,6 @@ TEST(FeatureDefaultsTest, DisabledFeatures) { &ntp_features::kNtpAlphaBackgroundCollections, &ntp_features::kNtpBackgroundImageErrorDetection, &ntp_features::kNtpChromeCartModule, - &omnibox::kDocumentProviderNoSetting, &omnibox::kDocumentProviderNoSyncRequirement, &omnibox::kMlUrlScoring, &omnibox::kRichAutocompletion, @@ -249,7 +236,6 @@ TEST(FeatureDefaultsTest, DisabledFeatures) { &privacy_sandbox::kEnforcePrivacySandboxAttestations, &privacy_sandbox::kOverridePrivacySandboxSettingsLocalTesting, &privacy_sandbox::kPrivacySandboxFirstPartySetsUI, - &privacy_sandbox::kPrivacySandboxProactiveTopicsBlocking, &privacy_sandbox::kPrivacySandboxSettings4, &privacy_sandbox::kTrackingProtectionContentSettingUbControl, &safe_browsing::kExtensionTelemetryDisableOffstoreExtensions, diff --git a/app/generated_resources.grd b/app/generated_resources.grd index a00d1aa47adb..15c55b0177b2 100644 --- a/app/generated_resources.grd +++ b/app/generated_resources.grd @@ -3726,9 +3726,6 @@ are declared in tools/grit/grit_rule.gni. Got it. By default, new sites that you visit won't send you notifications. - - You usually block notifications. To let this site notify you, click here. - Most people block notifications from this site @@ -3901,6 +3898,27 @@ are declared in tools/grit/grit_rule.gni. &Details + + &Modifications + + + Trust + + + Trust State + + + Distrusted + + + Hint + + + Trusted + + + Constraints + SSL Client Certificate @@ -6250,21 +6268,9 @@ Keep your key file in a safe place. You will need it to create new versions of y Allow extensions - - No extensions need access to this site - - - Extensions are not allowed on this site - - - Extensions are not allowed on this site - Extensions installed by your administrator can still read and change this site - - Extensions can request access to this site - To apply your updated settings to this site, reload this page @@ -7271,21 +7277,6 @@ Keep your key file in a safe place. You will need it to create new versions of y Pa&ste and Go - - Press $1Tab to search $2google.com - - - Press $1Tab to send commands to $2Brave Talk - - - Tab - - - Search $1google.com - - - Send commands to $1ACME Music App - Search $1google.com: @@ -7338,7 +7329,19 @@ Keep your key file in a safe place. You will need it to create new versions of y Add to your search - Ask using this page + Ask about this page + + + Generating suggestions for this page… + + + You can also ask things like “summarize” + + + No suggestions available. Try asking things like “summarize this page” or your own question. + + + Try asking things like “summarize this page” or your own question. Your Google Lens selection. Press enter or backspace to delete your Google Lens selection @@ -8261,15 +8264,12 @@ Keep your key file in a safe place. You will need it to create new versions of y Hide these files - - Google Drive files + + Google Drive - - Drive files - - - - SharePoint files + + + SharePoint Files @@ -8280,16 +8280,6 @@ Keep your key file in a safe place. You will need it to create new versions of y Super Duper Module - - From your Google Drive - - - - From your Microsoft Sharepoint - - - From your Drive - You’re seeing suggested files to help you easily get back to your most recent activity in Google Drive. <br> @@ -9346,33 +9336,33 @@ Keep your key file in a safe place. You will need it to create new versions of y {NUM_TABS, plural, - =0 {No unused tabs} - =1 {Close 1 unused tab} - other {Close # unused tabs}} + =0 {No inactive tabs} + =1 {Review 1 inactive tab} + other {Review # inactive tabs}} - Review and decide + Keep your tabs clutter-free - Close unused tabs + Review inactive tabs - These tabs have been unused for $17 or more days. + Tabs you haven't used in $17 or more days - Your tabs are tidy! + Things look neat! No inactive tabs right now - Close unused tabs? + Review inactive tabs? - Close unused tabs? + Review inactive tabs? - Close unused tabs + Review inactive tabs {NUM_DAYS, plural, @@ -9383,15 +9373,24 @@ Keep your key file in a safe place. You will need it to create new versions of y - Close Unused Tabs + Review Inactive Tabs - Close unused tabs + Review inactive tabs + + Close all + + + Remove $1New Tab from list + + + Remove tab from list + Organize tabs? @@ -11110,10 +11109,10 @@ Check your passwords anytime in $1Brave P Collapse recently closed - All tabs + Search - Organize tabs + Organize Create group @@ -11248,10 +11247,13 @@ Check your passwords anytime in $1Brave P Thumbs up submits feedback that you like this tab group suggestion - Group tabs + Group tabs with AI - Check for suggestions + Get your tabs sorted + + + Click to navigate away from $1Auto Tab Groups @@ -11478,6 +11480,7 @@ Check your passwords anytime in $1Brave P Name this group + Save Group @@ -11526,6 +11529,502 @@ Check your passwords anytime in $1Brave P + + + + + + Share “$1Vacation” Tab Group + + + + + + Manage “$1Vacation” Tab Group + + + Stop Sharing + + + + + + Stop Sharing? + + + + + + Remove $1John Doe? + + + Remove + + + + + + Delete Tab Group? + + + Delete + + + + + + Join Tab Group with $1Ali + {NUM_OTHER_MEMBERS, plural, + =0 {Join Tab Group with $1Ali} + =1 {Join Tab Group with $1Ali and # Other} + other {Join Tab Group with $1Ali and # Others} + } + + + Join and Open + + + Tab Group Details + + + This Link Doesn’t Work + + + + + + Leave Tab Group? + + + + + + Block and Leave Group? + + + Block and Leave + + + + + + Sign in and Sync Needed + + + Sync Is Needed + + + Sync Your Tab Groups + + + Verify Your Account + + + Verify It's You + + + + + Got It + + + Something Went Wrong + + + Your Organization Doesn't Allow You to Sign in + + + Your Organization Limits What You Can Save + + + You’re Signed out + + + This Tab Group Is Full + + + + + Keep Tab Group? + + + Keep Group + + + Delete Group + + + Leave Group + + + + + + + Recent Activity + + + Last Update to this Tab + + + Latest Updates to this Group + + + + + + + Share “$1Vacation” tab group + + + + + + Manage “$1Vacation” tab group + + + Stop sharing + + + + + + Stop sharing? + + + + + + Remove $1John Doe? + + + Remove + + + + + + Delete tab group? + + + Delete + + + + + + + {NUM_OTHER_MEMBERS, plural, + =0 {Join tab group with $1Ali} + =1 {Join tab group with $1Ali and # other} + other {Join tab group with $1Ali and # others} + } + + + Join and open + + + Tab group details + + + This link doesn’t work + + + + + + Leave tab group? + + + + + + Block and leave group? + + + Block and leave + + + + + + Sign in and sync needed + + + Sync is needed + + + Sync your tab groups + + + Verify your account + + + Verify it's you + + + + + Got it + + + Something went wrong + + + Your organization doesn't allow you to sign in + + + Your organization limits what you can save + + + You’re signed out + + + This tab group is full + + + + + Keep tab group? + + + Keep group + + + Delete group + + + Leave group + + + + + + Recent activity + + + Last update to this tab + + + Latest updates to this group + + + + + + + + Anyone with the link can edit all tabs, so share wisely. Link expires in 48 hours. + + + Share as $1John Doe + + + + + + Always share wisely. Links expire in 48 hours. + + + + + + Everyone will immediately lose access to the “$1Vacation” tab group, and all invitation links will be turned off + + + + + + $1John Doe ($2johndoe@gmail.com) will immediately lose access to the “$3Vacation” tab group + + + + + + Everyone will immediately lose access to the “$1Vacation” tab group, and it will be deleted from all devices + + + + + + $1Ali Connors ($2ali.connors@gmail.com) wants you to join a tab group. Anyone with the link can edit all tabs, so join with care. Link expires in 48 hr. + + + Tabs in group + + + Contact the sender to ask for a new link + + + + + + You’ll immediately lose access to the “$1Vacation” tab group, and it will be deleted from all your devices + + + Leave + + + + + + You’ll immediately lose access to the “$1Vacation” tab group, and $1Ali Connors ($2ali.connors@gmail.com) will no longer be able to interact with you across Brave services. + + + Learn about blocked accounts + + + + + + To share or join tab groups, you need to sign in and turn on sync + + + Continue + + + To share or join tab groups, you need to turn on sync + + + To share, join, and collaborate in tab groups, sync your tab groups in Settings + + + To share, join, and collaborate in tab groups, verify it’s you + + + + + + There was an error. Try again. + + + Something went wrong. Try again. + + + Make sure you trust the profile that sent this invitation + + + To share or join tab groups, you must be able to sign in to Brave + + + When your organization limits saving to your Brave sync chain, you can’t share or join tab groups + + + To share, join, and collaborate in tab groups, open settings and turn on Allow Brave sign-in + + + Settings + + + Contact the profile who sent this link + + + Your tab group is full, new members can’t join with the link + + + + + + Keep this group to add tabs later, or delete it if you no longer need it. + + + If you delete it, everyone will immediately lose access to the "$1Vacation" tab group, and it will be deleted from all devices. + + + Keep this group to add tabs later, or leave it if you no longer want access to it + + + + + + {TIME_DIMENSION, plural, + =0 {$12m ago} + =1 {$12h ago} + other {$12d ago} + } + + + $1Ali changed a tab + + + $1Ali removed a tab + + + $1Ali added a tab + + + $1Ali joined the group + + + $1Ali left the group + + + $1Ali changed the group name + + + $1Ali changed the group color + + + $1Ali added this tab + + + $1Ali changed this tab + + + + + + Added this tab + + + Changed this tab + + + + + + $1Ali removed tab “$2chromium.org” + + + Reopen + + + $1Ali joined "$2Vacation" tab group + + + Manage + + + The "$1Vacation" tab group is no longer available + + + + + + Changes made are seen by everyone in the group + + + + + + Learn about shared tab groups + + + Profiles with access + + + Anyone with the link can edit all tabs + + + Let anyone with the link join + + + Cancel + + + + + @@ -11607,14 +12106,6 @@ Check your passwords anytime in $1Brave P Stop sharing - - - Stop - - - You're sharing your screen - - @@ -12346,11 +12837,11 @@ Check your passwords anytime in $1Brave P - Related installed applications + Related applications - A site can find out if related web applications are installed on your machine. This info is available to the site and its subdomains. + A site and its subdomains can see what related web applications are installed on your device. @@ -13080,21 +13571,12 @@ This can include information about installed software, files, your browser, and - - Use your Brave sync chain to save and fill passwords? - Use your Brave sync chain to save and fill passwords and passkeys? - - Passwords from your Brave sync chain will also be available on this device while you're signed in - Passwords and passkeys in your Brave sync chain will also be available on this device while you're signed in - - Brave saved your password to this device, but you can save it to your Brave sync chain instead. Then, all passwords in your Brave sync chain will also be available while you're signed in. - Brave saved your password to this device, but you can save it to your Brave sync chain instead. Then, all passwords and passkeys in your Brave sync chain will also be available while you're signed in. @@ -13778,26 +14260,26 @@ Please help our engineers fix this problem. Tell us what happened right before y - - + + File - + Edit - + View - + History - + Window - + Tab - + Help @@ -16113,12 +16595,6 @@ Please help our engineers fix this problem. Tell us what happened right before y This passkey will only be saved on this device. It will remain on this device after you close all Private windows. - - This passkey will only be saved in Windows Hello - - - This passkey will be saved only in Windows Hello. It will remain on this device after you close all Private windows. - Choose where to save your passkey for $1example.com @@ -16202,6 +16678,30 @@ Please help our engineers fix this problem. Tell us what happened right before y From "$1Pixel 7" + + Passkeys & Security Keys + + + Passkeys + + + Use your phone or tablet + + + Scan this QR code with the camera on the device where you want to create and save your passkey for $1example.com + + + Scan this QR code with the camera on the device that has your passkey for $1example.com + + + Use your security key + + + Insert and touch your security key to set it up for $1example.com + + + Insert and touch your security key to use it for $1example.com + @@ -16350,32 +16850,26 @@ Please help our engineers fix this problem. Tell us what happened right before y Brave Password Manager - - Passkey update needed - - - Sign in to this site to create a new passkey. The old one was deleted from Brave Password Manager. + + This passkey was deleted from this site - - Manage passkeys - - - Got it + + Sign in using a password or other recovery method - Passkey updated + Updated passkey - You can view and manage your passkeys saved in $1Brave Password Manager + Manage your passwords & passkeys in $1Brave Password Manager Brave Password Manager - Passkey deleted + Deleted passkey - You can view and manage your passkeys saved in $1Brave Password Manager + Manage your passwords & passkeys in $1Brave Password Manager Brave Password Manager @@ -16435,47 +16929,8 @@ Please help our engineers fix this problem. Tell us what happened right before y $1www.cheapalcohol.com has canceled the request for identity information. - - - - Side Search - - - Close search in side panel. Search is open in the side panel. - - - Open search in side panel. Search is not open in the side panel. - - - Close search in side panel - - - Submit Feedback - - - See more search results - - - Close search in side panel - - - Open search in side panel - - - Close search in side panel - - - Submit Feedback - - - Verify with this phone - - - Verify your identity - - Private @@ -17041,6 +17496,9 @@ Please help our engineers fix this problem. Tell us what happened right before y Use a different account + + Use a different $1idp.com account + Back @@ -17131,6 +17589,9 @@ Please help our engineers fix this problem. Tell us what happened right before y Automatically sign me in to this website + + You can't sign in using this account + @@ -17475,6 +17936,9 @@ Please help our engineers fix this problem. Tell us what happened right before y + + More actions + Link copied @@ -17490,6 +17954,9 @@ Please help our engineers fix this problem. Tell us what happened right before y Open + + Close + @@ -17708,6 +18175,25 @@ Please help our engineers fix this problem. Tell us what happened right before y You just deleted data in Brave. We’d love to hear about your experience to improve Brave. + + + + Brave makes PDFs better + + + PDFs automatically get converted so you can search and select text + + + PDFs automatically get converted so you can search and select text + + + + + Select Audio Output + + + Choose an audio output device + diff --git a/app/generated_resources_override.grd b/app/generated_resources_override.grd index 262d9de96879..aae4d15821b3 100644 --- a/app/generated_resources_override.grd +++ b/app/generated_resources_override.grd @@ -865,6 +865,7 @@ are declared in tools/grit/grit_rule.gni. Unpin group from bookmarks + Pin Group to Bookmarks @@ -874,15 +875,25 @@ are declared in tools/grit/grit_rule.gni. - + + + + + + Make sure you trust the profile that sent this invitation + + + Contact the profile who sent this link + + + Profiles with access + + - - - @@ -1243,9 +1254,6 @@ are declared in tools/grit/grit_rule.gni. This passkey will only be saved on this device. It will remain on this device after you close all Private windows. - - This passkey will be saved only in Windows Hello. It will remain on this device after you close all Private windows. - Save this passkey outside Private? @@ -1349,6 +1357,7 @@ are declared in tools/grit/grit_rule.gni. - + + diff --git a/app/media_router_strings.grdp b/app/media_router_strings.grdp index a025e7744a61..9c35fe0414f8 100644 --- a/app/media_router_strings.grdp +++ b/app/media_router_strings.grdp @@ -103,10 +103,10 @@ Permission to cast is rejected. Open a help center article in a new tab to learn more. - To cast, give Brave access in $1system settings + To cast, give Brave access in: $1System Settings > Local Network > Brave - - system settings + + System Settings Available diff --git a/app/os_settings_search_tag_strings.grdp b/app/os_settings_search_tag_strings.grdp index a7e5c2240ffd..d220cd8dd766 100644 --- a/app/os_settings_search_tag_strings.grdp +++ b/app/os_settings_search_tag_strings.grdp @@ -526,6 +526,9 @@ Local Data Recovery + + Content Transfer + @@ -1473,6 +1476,21 @@ Auto clicks + + Face control + + + Facial control + + + Facial gestures + + + Head pointer + + + Head tracking + Large cursor diff --git a/app/os_settings_strings.grdp b/app/os_settings_strings.grdp index 6ca147bd95a8..86e070c125a5 100644 --- a/app/os_settings_strings.grdp +++ b/app/os_settings_strings.grdp @@ -1316,12 +1316,11 @@ Show large mouse cursor - Face control - Use face and gaze movement to control cursor and keyboard + Use head movements and facial expressions to control your Chromebook. <a>Learn more</a> Previous @@ -1332,27 +1331,39 @@ Add action + + Remove action $1Click a mouse button + Assign a gesture + + Assigned gesture $1Blink both eyes to $2Click a mouse button + + + Removed action $1Click a mouse button + Add an action - $1Pause or resume face control selected. Press Search plus Space to unselect. + $1Pause or resume face control selected. $21 of $313. Press Search plus Space to unselect. - $1Pause or resume face control not selected. Press Search plus Space to select. + $1Pause or resume face control not selected. $21 of $313. Press Search plus Space to select. Create key combination + + Change + + + Change key combination $1ctrl + c + Select a gesture for $1Click a mouse button - - Selecting an already assigned gesture will remove it from its original action - Gesture setting: $1Eyes blink @@ -1389,6 +1400,9 @@ Double-click the mouse + + Triple-click the mouse + Right-click the mouse @@ -1416,8 +1430,14 @@ Create custom key combination + + Custom key combination: $1ctrl + c + - Once you start scroll mode, move your head in the direction you'd like to scroll + Use the gesture to enter scroll mode, then move your head in the direction you'd like to scroll. Use the gesture again to exit scroll mode. + + + Use the gesture, then move your head to show where you'd like to drop the item. Use the gesture again to drop it. Take a screenshot @@ -1476,20 +1496,20 @@ Make a circle with your lips - - Stretch left corner of your mouth + + Move your mouth left Pucker by squeezing lips together - - Stretch right corner of your mouth + + Move your mouth right Smile - - Wrinkle your nose + + Show all of your teeth Cursor @@ -1530,13 +1550,13 @@ Use facial gestures to perform actions - - Use head movements to control mouse cursor + + Use head movements to control the mouse cursor - + Adjust speed separately for each direction - + Cursor speed @@ -1548,6 +1568,36 @@ Reset + + Cursor settings reset + + + Cursor stability + + + You can keep the cursor stable even if you have slight head movements. This requires more effort to move the cursor. + + + Responsive + + + Stable + + + Selecting an already assigned gesture will remove it from its original action. + + + "$1Smile" may overlap with "$2Squint left eye". If possible, try picking a different gesture. + + + "$1Smile" may overlap with "$2Squint left eye" and "$3Squint right eye". If possible, try picking a different gesture. + + + "$1Smile" may overlap with "$2Squint left eye", "$3Squint right eye", and "$4Blink eyes". If possible, try picking a different gesture. + + + $1Selecting an already assigned gesture will remove it from its original action. $2Smile may overlap with squint left eye. If possible, try picking a different gesture. + Flash notifications @@ -1882,22 +1932,22 @@ Side-by-side - + Disable built-in touchpad - + Always Built-in touchpad is disabled - + When a mouse is connected - - Press esc 5 times to re-enable it + + Press shift 5 times to re-enable it - + Never @@ -3679,7 +3729,25 @@ Press an assigned switch or key to remove assignment. Studio-style mic - Apply noise cancellation and audio improvements. <a target="_blank" href="$1https://google.com/">Learn more</a> + Apply noise cancellation and audio improvements. + + + The connected mic can only support noise cancellation + + + Effect mode + + + Area voice + + + Improve audio quality so voices sound natural and clear. + + + Focused voice + + + Beamforming mic so the profile using the Chromebook sounds clear. Front microphone @@ -6284,16 +6352,13 @@ Press an assigned switch or key to remove assignment. Automatic time zone detection is disabled - - Use your IP address to determine location (default) - Time zone is currently set to $1(UTC+4:00) Georgia Standard Time (Tbilisi). To automatically update the time zone, <a href="#">turn on system location access</a>. Time zone is currently set to $1(UTC+4:00) Georgia Standard Time (Tbilisi). This setting is managed by your administrator. - + Use your IP address to determine location @@ -6407,10 +6472,6 @@ Press an assigned switch or key to remove assignment. Disabled - - - - right alt fn diff --git a/app/os_settings_strings_override.grdp b/app/os_settings_strings_override.grdp index a52d6d203981..5e73f5a32895 100644 --- a/app/os_settings_strings_override.grdp +++ b/app/os_settings_strings_override.grdp @@ -13,6 +13,9 @@ Find more accessibility tools in the Web Store + + Beamforming mic so the profile using the Chromebook sounds clear. + You can limit sign-in to certain users. This removes the "Add profile" option on the sign-in screen. You can also remove current users. diff --git a/app/password_manager_ui_strings.grdp b/app/password_manager_ui_strings.grdp index 11599913e652..3d900093d861 100644 --- a/app/password_manager_ui_strings.grdp +++ b/app/password_manager_ui_strings.grdp @@ -629,9 +629,6 @@ Learn how to get started on <a target='_blank' href='$1'>Android</a> and <a target='_blank' href='$2'>iOS</a> - - Use and save passwords in your Brave sync chain - When on, passwords are saved in $1your account. When off, passwords are saved only to this device. @@ -949,31 +946,4 @@ To sign in with a passkey on this device again, you’ll need to verify it’s you. If you have another sign-in option, like a password, you can use it to sign in instead. - - - Continue - - - - - Protect passwords with your screen lock - - - If you share this device with others, you can use your screen lock to verify it's you whenever you use a saved password - - - You're using your screen lock for filling passwords - - - - - Add more protection to your passwords - - - You can use your fingerprint to verify it's you whenever you use a saved password - - - You're using your fingerprint for filling passwords - - diff --git a/app/profiles_strings.grdp b/app/profiles_strings.grdp index 97cb46424bce..0150cecdb5e3 100644 --- a/app/profiles_strings.grdp +++ b/app/profiles_strings.grdp @@ -90,6 +90,10 @@ Turn on sync... + + Continue as $1Bob + + Continue as $1John @@ -631,26 +635,26 @@ About this profile + + Set up a new profile + - This profile is managed by your organization, which can view certain kinds of information, including + This profile is managed by your organization, which can view some information, including - This profile is managed by $1example.com, which can view certain kinds of information, including + This profile is managed by $1example.com, which can view some information, including Profile information - - Your organization can see and manage browsing data in your work profile, such as your bookmarks, history, and passwords. - Device information - To make sure this device can be used safely, your organization may need to see information about its operating system, browser, and settings, and what software is installed on the device. + To make sure this device can be used safely, your organization can see information about its operating system, browser, and settings, and what software is installed on the device. - Setting up your work profile ... + Setting up your profile ... Setup may take a little longer ... @@ -662,7 +666,13 @@ Now you can start browsing - Your work profile is almost ready + Your profile hasn't been set up + + + You can try again or contact your administrator for help + + + Try again Something went wrong @@ -673,17 +683,26 @@ Sign in to get your bookmarks, passwords, and more on all your devices - + Keep existing browsing data separate from your work profile? + + Keep existing browsing data separate from your school profile? + + + Keep existing browsing data separate from this new profile? + Yes, keep it separate (recommended) - - Your existing browsing data will remain in the old profile. Your work profile will not contain any previous browsing data. + + Yes, keep it separate + + + Your existing browsing data will remain in the existing profile. This new profile will not contain any previous browsing data. - No, move it into your work profile + No, move it into this new profile This includes bookmarks, extensions and your browsing history of sites. @@ -813,115 +832,74 @@ Switch - - - - Your device is managed by $1example.com. Administrators can access the data in any profile on this device. - - - Your device is managed by your organization. Administrators can access the data in any profile on this device. - - - This will permanently delete your browsing data from this device. - - - Delete this profile? - - - This will permanently delete your browsing data from this device. To recover the data, turn on sync as - - Sign in to get your passwords and more on all your devices - - - - - - Your session is managed by $1example.com. Administrators can delete your profile and also monitor your network traffic. - - - Your session is managed by your organization. Administrators can delete your profile and also monitor your network traffic. - - - Choose an account - - - Use another account - - - Choose a profile - - - Can't delete this profile - - - $1Jane.Doe@gmail.com is the default account on your $2Chromebook - - - Got it - - - Delete this profile and browsing data? - - - This will permanently delete browsing data and saved desks associated with this profile from this device. The Brave sync chains in this profile may be used by other apps on your $1Chromebook. You can remove these accounts in <a is="action-link" target="_blank">$2Settings > $3Accounts</a>. - - - Let's go - - + + Your device is managed by $1example.com. Administrators can access the data in any profile on this device. + + + Your device is managed by your organization. Administrators can access the data in any profile on this device. + + + This will permanently delete your browsing data from this device. + + + Delete this profile? + + + This will permanently delete your browsing data from this device. To recover the data, turn on sync as + + Sign in to get your passwords and more on all your devices + - - - Get additional features - - - Sign in for additional features - - - All your devices - - - Easily pick up where you left off - - - Stronger security - - - Protect your passwords against phishing - - - Back up data - - - Save your bookmarks, passwords and more with sync + + Get additional features + + + Sign in for additional features + + + All your devices + + + Easily pick up where you left off + + + Stronger security + + + Protect your passwords against phishing + + + Back up data + + + Save your bookmarks, passwords and more with sync + + + Save your bookmarks and more with sync + + + + Don't sign in - - Save your bookmarks and more with sync + + Sign in - - - Don't sign in - - - Sign in - - - - - Don't Sign In - - - Sign In - - - - Your device is managed by your organization. Administrators can access the data in any profile on this device. + + + + Don't Sign In - - Your device is managed by $1example.com. Administrators can access the data in any profile on this device. + + Sign In + + Your device is managed by your organization. Administrators can access the data in any profile on this device. + + + Your device is managed by $1example.com. Administrators can access the data in any profile on this device. + diff --git a/app/profiles_strings_override.grdp b/app/profiles_strings_override.grdp index 3f76164abe24..35d2e49a647b 100644 --- a/app/profiles_strings_override.grdp +++ b/app/profiles_strings_override.grdp @@ -61,18 +61,9 @@ Private - - - - + - - - - - - + - diff --git a/app/settings_brave_strings.grdp b/app/settings_brave_strings.grdp index 97e36d7fbe3e..5cad9331afed 100644 --- a/app/settings_brave_strings.grdp +++ b/app/settings_brave_strings.grdp @@ -345,9 +345,6 @@ When you type in the address bar or search box, Brave sends what you type to your default search engine to get better suggestions. This is off in Private. - - When you type in the address bar or search box, Brave sends what you type to Google Drive to get item suggestions. This is off in Private. - Sign in to sync and personalize Brave across your devices diff --git a/app/settings_brave_strings_override.grdp b/app/settings_brave_strings_override.grdp index 6d476d9f08f5..167cbc2c500c 100644 --- a/app/settings_brave_strings_override.grdp +++ b/app/settings_brave_strings_override.grdp @@ -36,9 +36,6 @@ When you type in the address bar or search box, Brave sends what you type to your default search engine to get better suggestions. This is off in Private. - - When you type in the address bar or search box, Brave sends what you type to Google Drive to get item suggestions. This is off in Private. - diff --git a/app/settings_strings.grdp b/app/settings_strings.grdp index bcbccd07fa9d..4dec57cd193b 100644 --- a/app/settings_strings.grdp +++ b/app/settings_strings.grdp @@ -170,11 +170,6 @@ Show a quick highlight on the focused object - - - Manage accessibility features - - Swipe between pages @@ -998,9 +993,6 @@ Signs you out of most sites. You'll stay signed in to your Brave sync chain so your synced data can be deleted. - - Signs you out of most sites. You won't be signed out of your Brave sync chain. - Signs you out of most sites. You'll stay signed in to your Brave sync chain so your Family Link settings for Brave apply. @@ -4214,14 +4206,6 @@ $1Brave is using proxy settings from your administrator - - - Use ChromeOS proxy settings for this profile. - - - This profile uses ChromeOS proxy settings. - - @@ -4703,12 +4687,18 @@ Data sent to Brave may be seen by human reviewers to improve Brave AI’s technology + + Your organization controls how data collected by these features may be used. <a target="_blank" href="$1">Learn more</a> + This feature uses AI, is in early development, and won’t always get it right Data sent to Brave may be seen by human reviewers to improve this feature + + Your content will not be used by human reviewers to improve AI. Your organization may change these settings at any time + @@ -4757,4 +4747,15 @@ Comparison tables are saved in your Brave sync chain + + + + Turn on + + + Enhanced protection is on + + + Enhanced protection is off + diff --git a/app/settings_strings_override.grdp b/app/settings_strings_override.grdp index 9be6c376e460..d455671e32d4 100644 --- a/app/settings_strings_override.grdp +++ b/app/settings_strings_override.grdp @@ -27,8 +27,6 @@ - - @@ -171,8 +169,6 @@ - - diff --git a/app/shared_settings_strings.grdp b/app/shared_settings_strings.grdp index c5ed45242b21..9c5a44b5ed7d 100644 --- a/app/shared_settings_strings.grdp +++ b/app/shared_settings_strings.grdp @@ -261,9 +261,6 @@ Improve search suggestions - - Show Google Drive suggestions - @@ -349,9 +346,6 @@ - - Passwords - Passwords and passkeys diff --git a/base/android/java/src/org/chromium/base/shared_preferences/BraveStrictPreferenceKeyChecker.java b/base/android/java/src/org/chromium/base/shared_preferences/BraveStrictPreferenceKeyChecker.java index 1d39a04f9332..77686d0647e2 100644 --- a/base/android/java/src/org/chromium/base/shared_preferences/BraveStrictPreferenceKeyChecker.java +++ b/base/android/java/src/org/chromium/base/shared_preferences/BraveStrictPreferenceKeyChecker.java @@ -27,7 +27,7 @@ public void checkIsKeyInUse(String key) { * Dummy method that will be deleted form the bytecode. {@link * StrictPreferenceKeyChecker#isKeyInUse} will be used instead. */ - private boolean isKeyInUse(String key) { + private boolean isKeyInUse(String unused_key) { assert false : "This method should be deleted in bytecode!"; return false; } diff --git a/brave_domains/service_domains.cc b/brave_domains/service_domains.cc index 982a4cff15ef..7e46e7666f6f 100644 --- a/brave_domains/service_domains.cc +++ b/brave_domains/service_domains.cc @@ -37,11 +37,11 @@ std::string GetServicesDomainForSwitchValue(std::string env_from_switch) { } bool IsValidSwitchValue(std::string value) { - static const auto kAllowedSwitchValues = + static constexpr auto kAllowedSwitchValues = base::MakeFixedFlatSet( {kBraveServicesSwitchValueDev, kBraveServicesSwitchValueStaging, kBraveServicesSwitchValueProduction}); - return base::Contains(kAllowedSwitchValues, value); + return kAllowedSwitchValues.contains(value); } void MaybeWarnSwitchValue(std::string key, std::string value) { diff --git a/browser/ai_chat/ai_chat_browsertests.cc b/browser/ai_chat/ai_chat_browsertests.cc index f9cd29f67494..83df01665bdf 100644 --- a/browser/ai_chat/ai_chat_browsertests.cc +++ b/browser/ai_chat/ai_chat_browsertests.cc @@ -91,7 +91,7 @@ IN_PROC_BROWSER_TEST_F(AiChatBrowserTest, YoutubeNavigations) { const std::string initial_content = FetchPageContent(); EXPECT_EQ("Initial content", initial_content); - constexpr const char kClick[] = + static constexpr char kClick[] = R"js( document.getElementById('config').click() )js"; diff --git a/browser/ai_chat/ai_chat_profile_browsertest.cc b/browser/ai_chat/ai_chat_profile_browsertest.cc index b7bdca978c53..b1004661b4c7 100644 --- a/browser/ai_chat/ai_chat_profile_browsertest.cc +++ b/browser/ai_chat/ai_chat_profile_browsertest.cc @@ -11,6 +11,7 @@ #include "brave/components/sidebar/browser/sidebar_item.h" #include "chrome/browser/profiles/profile_window.h" #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_util.h" +#include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/location_bar/location_bar.h" #include "chrome/browser/ui/tabs/public/tab_features.h" #include "chrome/browser/ui/views/side_panel/side_panel_registry.h" @@ -40,9 +41,8 @@ const char* GetProfileTypeString(ProfileType type) { return "Private"; case ProfileType::kTor: return "Tor"; - default: - NOTREACHED_NORETURN(); } + NOTREACHED(); } } // namespace @@ -74,9 +74,8 @@ class AIChatProfileTest : public InProcessBrowserTest, brave::NewOffTheRecordWindowTor(browser()); return observer.Wait(); } - default: - NOTREACHED_NORETURN(); } + NOTREACHED(); } bool IsAIChatEnabled() { return GetParam() == ProfileType::kRegular; } diff --git a/browser/ai_chat/ai_chat_render_view_context_menu_browsertest.cc b/browser/ai_chat/ai_chat_render_view_context_menu_browsertest.cc index 0391f6d1e4c9..660307c90940 100644 --- a/browser/ai_chat/ai_chat_render_view_context_menu_browsertest.cc +++ b/browser/ai_chat/ai_chat_render_view_context_menu_browsertest.cc @@ -41,6 +41,7 @@ #include "net/test/embedded_test_server/embedded_test_server.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/base/mojom/menu_source_type.mojom.h" #include "url/gurl.h" using ::testing::_; @@ -156,7 +157,8 @@ class AIChatRenderViewContextMenuBrowserTest : public InProcessBrowserTest { web_contents->GetPrimaryMainFrame() ->GetRenderViewHost() ->GetWidget() - ->ShowContextMenuAtPoint(gfx::Point(x, y), ui::MENU_SOURCE_MOUSE); + ->ShowContextMenuAtPoint(gfx::Point(x, y), + ui::mojom::MenuSourceType::kMouse); run_loop.Run(); EXPECT_NE(ai_engine, nullptr); testing::Mock::VerifyAndClearExpectations(ai_engine); diff --git a/browser/ai_chat/ai_chat_ui_browsertest.cc b/browser/ai_chat/ai_chat_ui_browsertest.cc index 5bf3da579571..b29ecfe2499c 100644 --- a/browser/ai_chat/ai_chat_ui_browsertest.cc +++ b/browser/ai_chat/ai_chat_ui_browsertest.cc @@ -42,7 +42,6 @@ #include "net/test/embedded_test_server/http_response.h" #include "printing/buildflags/buildflags.h" #include "services/network/public/cpp/network_switches.h" -#include "services/screen_ai/buildflags/buildflags.h" #include "ui/compositor/compositor_switches.h" #include "url/gurl.h" @@ -50,18 +49,6 @@ #include "chrome/browser/printing/test_print_preview_observer.h" #endif -#if BUILDFLAG(ENABLE_SCREEN_AI_BROWSERTESTS) && !BUILDFLAG(USE_FAKE_SCREEN_AI) -#define PDF_OCR_INTEGRATION_TEST_ENABLED -#endif - -#if defined(PDF_OCR_INTEGRATION_TEST_ENABLED) -#include "chrome/browser/screen_ai/screen_ai_install_state.h" -#include "components/strings/grit/components_strings.h" -#include "services/screen_ai/public/cpp/utilities.h" -#include "ui/accessibility/accessibility_features.h" -#include "ui/accessibility/ax_features.mojom-features.h" -#endif // defined(PDF_OCR_INTEGRATION_TEST_ENABLED) - namespace { constexpr char kEmbeddedTestServerDirectory[] = "leo"; @@ -311,9 +298,10 @@ IN_PROC_BROWSER_TEST_F(AIChatUIBrowserTest, ExtractionPrintDialog) { #endif // BUILDFLAG(IS_WIN) && defined(ADDRESS_SANITIZER) && // defined(ARCH_CPU_64_BITS) IN_PROC_BROWSER_TEST_F(AIChatUIBrowserTest, MAYBE_PrintPreviewFallback) { - // Falls back when there is no regular DOM content - // pdf test will be in UpstreamPDFIntegratoinTest since we enable upstream pdf - // ocr for all pdf files + NavigateURL(https_server_.GetURL("a.com", "/text_in_image.pdf"), false); + FetchPageContent( + FROM_HERE, "This is the way.\n\nI have spoken.\nWherever I Go, He Goes."); + NavigateURL(https_server_.GetURL("a.com", "/canvas.html"), false); FetchPageContent(FROM_HERE, "this is the way"); @@ -396,110 +384,3 @@ IN_PROC_BROWSER_TEST_F(AIChatUIBrowserTest, {{"test query", "test summary"}, {"test query 2", "test summary 2"}})); } - -#if defined(PDF_OCR_INTEGRATION_TEST_ENABLED) -// Test ai chat integration with upstream kPdfOcr -class UpstreamPDFIntegratoinTest : public AIChatUIBrowserTest { - public: - UpstreamPDFIntegratoinTest() - : embedded_test_server_(net::EmbeddedTestServer::TYPE_HTTPS) { - feature_list_.InitWithFeatures( - {::features::kPdfOcr, ::features::kScreenAITestMode, - ax::mojom::features::kScreenAIOCREnabled}, - {}); - } - - void SetUpOnMainThread() override { - AIChatUIBrowserTest::SetUpOnMainThread(); - - content::SetupCrossSiteRedirector(&embedded_test_server_); - - base::FilePath test_data_dir; - test_data_dir = base::PathService::CheckedGet(chrome::DIR_TEST_DATA); - test_data_dir = - test_data_dir.AppendASCII("pdf").AppendASCII("accessibility"); - embedded_test_server_.ServeFilesFromDirectory(test_data_dir); - ASSERT_TRUE(embedded_test_server_.Start()); - - screen_ai::ScreenAIInstallState::GetInstance()->SetComponentFolder( - screen_ai::GetComponentBinaryPathForTests().DirName()); - } - - void SetUpCommandLine(base::CommandLine* command_line) override { - AIChatUIBrowserTest::SetUpCommandLine(command_line); - command_line->RemoveSwitch(network::switches::kHostResolverRules); - } - - void FetchPageContentAndWaitForOCR( - const base::Location& location, - std::string_view expected_text, - int ocr_status_message_id = IDS_PDF_OCR_COMPLETED) { - SCOPED_TRACE(testing::Message() << location.ToString()); - base::RunLoop run_loop; - chat_tab_helper_->GetPageContent( - base::BindLambdaForTesting( - [&run_loop, expected_text](std::string text, bool is_video, - std::string invalidation_token) { - EXPECT_FALSE(is_video); - EXPECT_EQ(text, expected_text); - run_loop.Quit(); - }), - ""); - auto inner_web_contents = GetActiveWebContents()->GetInnerWebContents(); - ASSERT_TRUE(inner_web_contents.size() == 1); - WaitForAccessibilityTreeToContainNodeWithName( - inner_web_contents[0], l10n_util::GetStringUTF8(ocr_status_message_id)); - run_loop.Run(); - } - - protected: - net::test_server::EmbeddedTestServer embedded_test_server_; - base::test::ScopedFeatureList feature_list_; -}; - -IN_PROC_BROWSER_TEST_F(UpstreamPDFIntegratoinTest, PDFOcr) { - // Single paragraph - NavigateURL( - embedded_test_server_.GetURL("a.com", "/hello-world-in-image.pdf")); - FetchPageContentAndWaitForOCR(FROM_HERE, "Hello, world!"); - - // Multiple paragraphs - NavigateURL(embedded_test_server_.GetURL( - "a.com", "/inaccessible-text-in-three-page.pdf")); - FetchPageContentAndWaitForOCR(FROM_HERE, - "Hello, world!\n" - "Paragraph 1 on Page 2\n" - "Paragraph 2 on Page 2\n" - "Paragraph 1 on Page 3\n" - "Paragraph 2 on Page 3"); -} - -#if BUILDFLAG(ENABLE_TEXT_RECOGNITION) && BUILDFLAG(ENABLE_PRINT_PREVIEW) -IN_PROC_BROWSER_TEST_F(UpstreamPDFIntegratoinTest, - PDFOcrFailed_PrintPreviewFallback) { - // Fallback to print preview extraction when upstream pdf ocr has empty - // results. - NavigateURL(https_server_.GetURL("b.com", "/text_in_image.pdf"), false); - FetchPageContentAndWaitForOCR( - FROM_HERE, "This is the way.\n\nI have spoken.\nWherever I Go, He Goes.", - IDS_PDF_OCR_NO_RESULT); -} -#endif // BUILDFLAG(ENABLE_TEXT_RECOGNITION) && BUILDFLAG(ENABLE_PRINT_PREVIEW) - -IN_PROC_BROWSER_TEST_F(UpstreamPDFIntegratoinTest, PDFOcrWithBlankPage) { - // Single paragraph - NavigateURL( - https_server_.GetURL("a.com", "/hello-world-in-image-has-blank.pdf")); - FetchPageContentAndWaitForOCR(FROM_HERE, "Hello, world!"); - - // Multiple paragraphs - NavigateURL(https_server_.GetURL( - "a.com", "/inaccessible-text-in-three-page-has-blank.pdf")); - FetchPageContentAndWaitForOCR(FROM_HERE, - "Hello, world!\n\n" - "Paragraph 1 on Page 2\n" - "Paragraph 2 on Page 2\n\n" - "Paragraph 1 on Page 3\n" - "Paragraph 2 on Page 3"); -} -#endif // defined(PDF_OCR_INTEGRATION_TEST_ENABLED) diff --git a/browser/brave_ads/device_id/device_id_impl_mac.cc b/browser/brave_ads/device_id/device_id_impl_mac.cc index 58d859bd9be7..d88ba5e68ac8 100644 --- a/browser/brave_ads/device_id/device_id_impl_mac.cc +++ b/browser/brave_ads/device_id/device_id_impl_mac.cc @@ -205,9 +205,7 @@ std::string GetMacAddress( result = IORegistryEntryGetParentEntry(service, kIOServicePlane, &parent); if (result == KERN_SUCCESS) { const base::mac::ScopedIOObject scoped_parent(parent); - const bool keep_going = - processor.ProcessNetworkController(scoped_parent.get()); - if (!keep_going) { + if (!processor.ProcessNetworkController(scoped_parent.get())) { break; } } diff --git a/browser/brave_ads/tabs/ads_tab_helper_browsertest.cc b/browser/brave_ads/tabs/ads_tab_helper_browsertest.cc index b79dbce75262..7aad3254c22e 100644 --- a/browser/brave_ads/tabs/ads_tab_helper_browsertest.cc +++ b/browser/brave_ads/tabs/ads_tab_helper_browsertest.cc @@ -435,8 +435,7 @@ class BraveAdsTabHelperTest : public PlatformBrowserTest { } } - NOTREACHED_NORETURN() - << "Query key not found. Unable to handle the request."; + NOTREACHED() << "Query key not found. Unable to handle the request."; } std::vector RedirectChainExpectation( diff --git a/browser/brave_shields/ad_block_service_browsertest.cc b/browser/brave_shields/ad_block_service_browsertest.cc index c16b1b10c5a2..5791acce0527 100644 --- a/browser/brave_shields/ad_block_service_browsertest.cc +++ b/browser/brave_shields/ad_block_service_browsertest.cc @@ -109,7 +109,8 @@ using brave_shields::features::kCosmeticFilteringJsPerformance; namespace { void WaitForSelectorBlocked(const content::ToRenderFrameHost& target, const std::string& selector) { - const char kTemplate[] = R"(waitCSSSelector($1, 'display', 'none'))"; + static constexpr char kTemplate[] = + R"(waitCSSSelector($1, 'display', 'none'))"; ASSERT_TRUE( EvalJs(target, content::JsReplace(kTemplate, selector)).ExtractBool()); @@ -3005,7 +3006,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, ContentPicker) { const GURL tab_url = embedded_test_server()->GetURL("a.com", "/cosmetic_filtering.html"); NavigateToURL(tab_url); - const char kPickerIsInjected[] = + static constexpr char kPickerIsInjected[] = "document.getElementById('brave-element-picker') != null"; ASSERT_FALSE( content::EvalJs(web_contents(), kPickerIsInjected).ExtractBool()); @@ -3079,7 +3080,7 @@ class AdBlockServiceTestJsPerformance : public AdBlockServiceTest { void AddDivsWithDynamicClasses(const content::ToRenderFrameHost& target, int start_number, int end_number) const { - const char kTemplate[] = R"( + static constexpr char kTemplate[] = R"( for (let i = $1; i <= $2; i++) { const e = document.createElement('div'); e.className = 'div-class-' + i; diff --git a/browser/brave_vpn/dns/BUILD.gn b/browser/brave_vpn/dns/BUILD.gn index 19a3b6b68801..d85fcdaad35b 100644 --- a/browser/brave_vpn/dns/BUILD.gn +++ b/browser/brave_vpn/dns/BUILD.gn @@ -13,6 +13,7 @@ source_set("unit_tests") { sources = [ "brave_vpn_dns_observer_service_win_unittest.cc" ] deps = [ "//brave/components/brave_vpn/common", + "//chrome/browser/prefs", "//chrome/common:constants", "//chrome/test:test_support", "//net", diff --git a/browser/brave_vpn/vpn_utils.cc b/browser/brave_vpn/vpn_utils.cc index 7c999517b192..18d901343405 100644 --- a/browser/brave_vpn/vpn_utils.cc +++ b/browser/brave_vpn/vpn_utils.cc @@ -48,7 +48,7 @@ std::unique_ptr CreateConnectionAPIImpl( #endif // VPN is not supported on other platforms. - NOTREACHED_NORETURN(); + NOTREACHED(); } #endif diff --git a/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_crash_reporter_client.cc b/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_crash_reporter_client.cc index b2dbf883d638..69b0ab786b45 100644 --- a/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_crash_reporter_client.cc +++ b/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_crash_reporter_client.cc @@ -61,11 +61,6 @@ void BraveVPNHelperCrashReporterClient::InitializeCrashReportingForProcess( base::FilePath()); } -bool BraveVPNHelperCrashReporterClient::ShouldCreatePipeName( - const std::wstring& process_type) { - return false; -} - bool BraveVPNHelperCrashReporterClient::GetAlternativeCrashDumpLocation( std::wstring* crash_dir) { return false; @@ -92,35 +87,11 @@ void BraveVPNHelperCrashReporterClient::GetProductNameAndVersion( install_static::GetChromeChannelName(/*with_extended_stable=*/true); } -bool BraveVPNHelperCrashReporterClient::ShouldShowRestartDialog( - std::wstring* title, - std::wstring* message, - bool* is_rtl_locale) { - // There is no UX associated with brave_vpn_helper, so no dialog should be - // shown. - return false; -} - -bool BraveVPNHelperCrashReporterClient::AboutToRestart() { - // The brave_vpn_helper should never be restarted after a crash. - return false; -} - -bool BraveVPNHelperCrashReporterClient::GetIsPerUserInstall() { - return !install_static::IsSystemInstall(); -} - bool BraveVPNHelperCrashReporterClient::GetShouldDumpLargerDumps() { // Use large dumps for all but the stable channel. return install_static::GetChromeChannel() != version_info::Channel::STABLE; } -int BraveVPNHelperCrashReporterClient::GetResultCodeRespawnFailed() { - // The restart dialog is never shown. - NOTREACHED_IN_MIGRATION(); - return 0; -} - bool BraveVPNHelperCrashReporterClient::GetCrashDumpLocation( std::wstring* crash_dir) { auto profile_dir = brave_vpn::GetVpnHelperServiceProfileDir(); diff --git a/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_crash_reporter_client.h b/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_crash_reporter_client.h index cb925635b272..e57b8bb67278 100644 --- a/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_crash_reporter_client.h +++ b/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_crash_reporter_client.h @@ -27,20 +27,13 @@ class BraveVPNHelperCrashReporterClient ~BraveVPNHelperCrashReporterClient() override; // crash_reporter::CrashReporterClient: - bool ShouldCreatePipeName(const std::wstring& process_type) override; bool GetAlternativeCrashDumpLocation(std::wstring* crash_dir) override; void GetProductNameAndVersion(const std::wstring& exe_path, std::wstring* product_name, std::wstring* version, std::wstring* special_build, std::wstring* channel_name) override; - bool ShouldShowRestartDialog(std::wstring* title, - std::wstring* message, - bool* is_rtl_locale) override; - bool AboutToRestart() override; - bool GetIsPerUserInstall() override; bool GetShouldDumpLargerDumps() override; - int GetResultCodeRespawnFailed() override; bool GetCrashDumpLocation(std::wstring* crash_dir) override; bool GetCrashMetricsLocation(std::wstring* metrics_dir) override; bool IsRunningUnattended() override; diff --git a/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_utils.cc b/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_utils.cc index a9c0cc94757c..1ae28e025415 100644 --- a/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_utils.cc +++ b/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_utils.cc @@ -113,7 +113,7 @@ std::wstring GetBraveVpnHelperRegistryStoragePath() { return L"Software\\BraveSoftware\\Brave\\Vpn\\HelperServiceDevelopment"; } - NOTREACHED_NORETURN(); + NOTREACHED(); } std::wstring GetBraveVpnOneTimeServiceCleanupStoragePath() { @@ -132,7 +132,7 @@ std::wstring GetBraveVpnOneTimeServiceCleanupStoragePath() { L"pment"; } - NOTREACHED_NORETURN(); + NOTREACHED(); } } // namespace brave_vpn diff --git a/browser/brave_vpn/win/brave_vpn_helper/vpn_utils.cc b/browser/brave_vpn/win/brave_vpn_helper/vpn_utils.cc index 36d872e27a01..e005aa999547 100644 --- a/browser/brave_vpn/win/brave_vpn_helper/vpn_utils.cc +++ b/browser/brave_vpn/win/brave_vpn_helper/vpn_utils.cc @@ -44,7 +44,7 @@ std::wstring GetBraveVpnServiceFilterName() { return L"Brave VPN Development Service DNS Filter"; } - NOTREACHED_NORETURN(); + NOTREACHED(); } GUID GetVpnDnsSublayerGUID() { @@ -81,7 +81,7 @@ GUID GetVpnDnsSublayerGUID() { {0x95, 0xe8, 0x00, 0x81, 0x13, 0xd3, 0xc0, 0xd6}}; } - NOTREACHED_NORETURN(); + NOTREACHED(); } DWORD AddSublayer(GUID uuid) { diff --git a/browser/brave_vpn/win/brave_vpn_wireguard_service/brave_wireguard_service_crash_reporter_client.cc b/browser/brave_vpn/win/brave_vpn_wireguard_service/brave_wireguard_service_crash_reporter_client.cc index 33f27b0edade..3d8ffe42c69b 100644 --- a/browser/brave_vpn/win/brave_vpn_wireguard_service/brave_wireguard_service_crash_reporter_client.cc +++ b/browser/brave_vpn/win/brave_vpn_wireguard_service/brave_wireguard_service_crash_reporter_client.cc @@ -73,11 +73,6 @@ void BraveWireguardCrashReporterClient::InitializeCrashReportingForProcess( base::FilePath()); } -bool BraveWireguardCrashReporterClient::ShouldCreatePipeName( - const std::wstring& process_type) { - return false; -} - bool BraveWireguardCrashReporterClient::GetAlternativeCrashDumpLocation( std::wstring* crash_dir) { return false; @@ -104,35 +99,11 @@ void BraveWireguardCrashReporterClient::GetProductNameAndVersion( install_static::GetChromeChannelName(/*with_extended_stable=*/true); } -bool BraveWireguardCrashReporterClient::ShouldShowRestartDialog( - std::wstring* title, - std::wstring* message, - bool* is_rtl_locale) { - // There is no UX associated with brave_vpn_wireguard_service, so no dialog - // should be shown. - return false; -} - -bool BraveWireguardCrashReporterClient::AboutToRestart() { - // The brave_vpn_wireguard_service should never be restarted after a crash. - return false; -} - -bool BraveWireguardCrashReporterClient::GetIsPerUserInstall() { - return !install_static::IsSystemInstall(); -} - bool BraveWireguardCrashReporterClient::GetShouldDumpLargerDumps() { // Use large dumps for all but the stable channel. return install_static::GetChromeChannel() != version_info::Channel::STABLE; } -int BraveWireguardCrashReporterClient::GetResultCodeRespawnFailed() { - // The restart dialog is never shown. - NOTREACHED_IN_MIGRATION(); - return 0; -} - bool BraveWireguardCrashReporterClient::GetCrashDumpLocation( std::wstring* crash_dir) { auto profile_dir = GetBraveWireguardServiceProfileDir(); diff --git a/browser/brave_vpn/win/brave_vpn_wireguard_service/brave_wireguard_service_crash_reporter_client.h b/browser/brave_vpn/win/brave_vpn_wireguard_service/brave_wireguard_service_crash_reporter_client.h index f5af5b31cfc2..2d683520f22d 100644 --- a/browser/brave_vpn/win/brave_vpn_wireguard_service/brave_wireguard_service_crash_reporter_client.h +++ b/browser/brave_vpn/win/brave_vpn_wireguard_service/brave_wireguard_service_crash_reporter_client.h @@ -27,20 +27,13 @@ class BraveWireguardCrashReporterClient ~BraveWireguardCrashReporterClient() override; // crash_reporter::CrashReporterClient: - bool ShouldCreatePipeName(const std::wstring& process_type) override; bool GetAlternativeCrashDumpLocation(std::wstring* crash_dir) override; void GetProductNameAndVersion(const std::wstring& exe_path, std::wstring* product_name, std::wstring* version, std::wstring* special_build, std::wstring* channel_name) override; - bool ShouldShowRestartDialog(std::wstring* title, - std::wstring* message, - bool* is_rtl_locale) override; - bool AboutToRestart() override; - bool GetIsPerUserInstall() override; bool GetShouldDumpLargerDumps() override; - int GetResultCodeRespawnFailed() override; bool GetCrashDumpLocation(std::wstring* crash_dir) override; bool GetCrashMetricsLocation(std::wstring* metrics_dir) override; bool IsRunningUnattended() override; diff --git a/browser/brave_vpn/win/brave_vpn_wireguard_service/resources/resource_loader.cc b/browser/brave_vpn/win/brave_vpn_wireguard_service/resources/resource_loader.cc index e7387b32db91..01b5b77a8c44 100644 --- a/browser/brave_vpn/win/brave_vpn_wireguard_service/resources/resource_loader.cc +++ b/browser/brave_vpn/win/brave_vpn_wireguard_service/resources/resource_loader.cc @@ -34,10 +34,8 @@ base::FilePath FindPakFilePath(const base::FilePath& assets_path, if (base::PathExists(pak_path)) { return pak_path; } - if (locale != "en-US") { - return FindPakFilePath(assets_path, "en-US"); - } - NOTREACHED_NORETURN(); + CHECK_NE(locale, "en-US"); + return FindPakFilePath(assets_path, "en-US"); } void LoadLocaleResources() { diff --git a/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/BUILD.gn b/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/BUILD.gn index c56eb6fa1466..aad674fab8db 100644 --- a/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/BUILD.gn +++ b/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/BUILD.gn @@ -27,6 +27,7 @@ source_set("status_tray") { "//chrome/common:channel_info", "//components/version_info:channel", "//ui/base", + "//ui/menus", "//ui/native_theme", "//ui/native_theme:native_theme_browser", ] @@ -46,6 +47,7 @@ source_set("unit_tests") { "//brave/components/constants", "//brave/components/resources:strings_grit", "//testing/gtest", + "//ui/menus", "//ui/native_theme", ] } diff --git a/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_icon/BUILD.gn b/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_icon/BUILD.gn index 2165155eab8c..039a7e9ba723 100644 --- a/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_icon/BUILD.gn +++ b/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_icon/BUILD.gn @@ -33,5 +33,6 @@ source_set("status_icon") { ":utils", "//base", "//ui/gfx", + "//ui/menus", ] } diff --git a/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_icon/status_tray.cc b/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_icon/status_tray.cc index d9be697ebf3e..d56461b22eb5 100644 --- a/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_icon/status_tray.cc +++ b/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_icon/status_tray.cc @@ -20,9 +20,10 @@ namespace brave_vpn { -static const UINT kStatusIconMessage = WM_APP + 1; - namespace { + +constexpr UINT kStatusIconMessage = WM_APP + 1; + const base::FilePath::CharType kBraveVpnTaskbarMessageName[] = FILE_PATH_LITERAL("TaskbarCreated"); diff --git a/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_icon/tray_menu_model.h b/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_icon/tray_menu_model.h index f4fe39a8c2a8..4f1461566838 100644 --- a/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_icon/tray_menu_model.h +++ b/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_icon/tray_menu_model.h @@ -7,7 +7,7 @@ #define BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_WIREGUARD_SERVICE_STATUS_TRAY_STATUS_ICON_TRAY_MENU_MODEL_H_ #include "base/memory/raw_ptr.h" -#include "ui/base/models/simple_menu_model.h" +#include "ui/menus/simple_menu_model.h" namespace brave_vpn { diff --git a/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_tray_runner.cc b/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_tray_runner.cc index b00a3214e567..2cc0edcc37db 100644 --- a/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_tray_runner.cc +++ b/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_tray_runner.cc @@ -6,9 +6,9 @@ #include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_tray_runner.h" #include // Should be before shellapi.h -#include #include +#include #include #include @@ -31,7 +31,7 @@ #include "brave/components/brave_vpn/common/win/utils.h" #include "components/grit/brave_components_strings.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/base/models/simple_menu_model.h" +#include "ui/menus/simple_menu_model.h" #include "ui/native_theme/native_theme.h" namespace brave_vpn { @@ -67,7 +67,7 @@ int GetStatusIconTooltip(brave_vpn::mojom::ConnectionState state) { return IDS_BRAVE_VPN_WIREGUARD_TRAY_ICON_TOOLTIP_ERROR; } - NOTREACHED_NORETURN(); + NOTREACHED(); } int GetStatusTrayIcon(brave_vpn::mojom::ConnectionState state) { @@ -89,7 +89,7 @@ int GetStatusTrayIcon(brave_vpn::mojom::ConnectionState state) { : IDR_BRAVE_VPN_TRAY_DARK_ERROR; } - NOTREACHED_NORETURN(); + NOTREACHED(); } } // namespace diff --git a/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_tray_runner_unittest.cc b/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_tray_runner_unittest.cc index ce1a5ffcc712..744c09c18d3e 100644 --- a/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_tray_runner_unittest.cc +++ b/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_tray_runner_unittest.cc @@ -15,7 +15,7 @@ #include "brave/browser/brave_vpn/win/storage_utils.h" #include "components/grit/brave_components_strings.h" #include "testing/gtest/include/gtest/gtest.h" -#include "ui/base/models/simple_menu_model.h" +#include "ui/menus/simple_menu_model.h" #include "ui/native_theme/native_theme.h" namespace brave_vpn { diff --git a/browser/brave_vpn/win/service_details.cc b/browser/brave_vpn/win/service_details.cc index 3ec919a11454..864326717bbb 100644 --- a/browser/brave_vpn/win/service_details.cc +++ b/browser/brave_vpn/win/service_details.cc @@ -96,7 +96,7 @@ const CLSID& GetBraveVpnWireguardServiceClsid() { return kBraveDevelopmentWireguardServiceCLSID; } - NOTREACHED_NORETURN(); + NOTREACHED(); } const IID& GetBraveVpnWireguardServiceIid() { @@ -117,7 +117,7 @@ std::wstring GetBraveVpnWireguardServiceDisplayName() { return L"Brave Development Vpn Wireguard Service"; } - NOTREACHED_NORETURN(); + NOTREACHED(); } std::wstring GetBraveVpnWireguardServiceDescription() { @@ -144,7 +144,7 @@ std::wstring GetBraveVpnWireguardTunnelServiceName() { return kBraveDevelopmentWireguardTunnelServiceName; } - NOTREACHED_NORETURN(); + NOTREACHED(); } base::FilePath GetBraveVPNWireguardServiceExecutablePath( diff --git a/browser/brave_wallet/BUILD.gn b/browser/brave_wallet/BUILD.gn index 720e3a81c136..281a748aa12a 100644 --- a/browser/brave_wallet/BUILD.gn +++ b/browser/brave_wallet/BUILD.gn @@ -186,6 +186,7 @@ source_set("unit_tests") { "//brave/components/version_info", "//chrome/browser", "//chrome/browser/permissions", + "//chrome/browser/prefs", "//chrome/test:test_support", "//components/country_codes", "//testing/gtest", diff --git a/browser/component_updater/brave_component_updater_configurator.cc b/browser/component_updater/brave_component_updater_configurator.cc index bf8c878f323b..b72f42df9117 100644 --- a/browser/component_updater/brave_component_updater_configurator.cc +++ b/browser/component_updater/brave_component_updater_configurator.cc @@ -57,8 +57,11 @@ BraveConfigurator::BraveConfigurator( : configurator_impl_(ComponentUpdaterCommandLineConfigPolicy(cmdline), false), pref_service_(raw_ref::from_ptr(pref_service)), - persisted_data_( - update_client::CreatePersistedData(pref_service, nullptr)), + persisted_data_(update_client::CreatePersistedData( + base::BindRepeating( + [](PrefService* pref_service) { return pref_service; }, + pref_service), + nullptr)), url_loader_factory_(std::move(url_loader_factory)) {} BraveConfigurator::~BraveConfigurator() = default; @@ -167,10 +170,6 @@ BraveConfigurator::GetPatcherFactory() { return patch_factory_; } -bool BraveConfigurator::EnabledDeltas() const { - return configurator_impl_.EnabledDeltas(); -} - bool BraveConfigurator::EnabledBackgroundDownloader() const { return configurator_impl_.EnabledBackgroundDownloader(); } diff --git a/browser/component_updater/brave_component_updater_configurator.h b/browser/component_updater/brave_component_updater_configurator.h index 00f09708fcac..b934ffe1aadf 100644 --- a/browser/component_updater/brave_component_updater_configurator.h +++ b/browser/component_updater/brave_component_updater_configurator.h @@ -61,7 +61,6 @@ class BraveConfigurator : public update_client::Configurator { override; scoped_refptr GetUnzipperFactory() override; scoped_refptr GetPatcherFactory() override; - bool EnabledDeltas() const override; bool EnabledBackgroundDownloader() const override; bool EnabledCupSigning() const override; PrefService* GetPrefService() const override; diff --git a/browser/content_settings/brave_content_settings_browsertest.cc b/browser/content_settings/brave_content_settings_browsertest.cc index e2c9b3b0bf84..d550b2ae513c 100644 --- a/browser/content_settings/brave_content_settings_browsertest.cc +++ b/browser/content_settings/brave_content_settings_browsertest.cc @@ -4,6 +4,7 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "base/containers/contains.h" +#include "base/containers/fixed_flat_set.h" #include "base/strings/stringprintf.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/profiles/profile.h" @@ -47,13 +48,14 @@ class BraveContentSettingsBrowserTest : public InProcessBrowserTest { ContentSettingsType content_type, ContentSetting current_setting, ContentSetting incognito_default_setting) { - const ContentSettingsType kOffTheRecordAwareTypes[] = { - ContentSettingsType::NOTIFICATIONS, - ContentSettingsType::PROTECTED_MEDIA_IDENTIFIER, - ContentSettingsType::IDLE_DETECTION, - ContentSettingsType::BRAVE_HTTPS_UPGRADE, - }; - if (base::Contains(kOffTheRecordAwareTypes, content_type)) { + static constexpr auto kOffTheRecordAwareTypes = + base::MakeFixedFlatSet({ + ContentSettingsType::NOTIFICATIONS, + ContentSettingsType::PROTECTED_MEDIA_IDENTIFIER, + ContentSettingsType::IDLE_DETECTION, + ContentSettingsType::BRAVE_HTTPS_UPGRADE, + }); + if (kOffTheRecordAwareTypes.contains(content_type)) { return current_setting; } return incognito_default_setting; diff --git a/browser/ephemeral_storage/ephemeral_storage_browsertest.cc b/browser/ephemeral_storage/ephemeral_storage_browsertest.cc index e8100b24191f..113a9aa3433c 100644 --- a/browser/ephemeral_storage/ephemeral_storage_browsertest.cc +++ b/browser/ephemeral_storage/ephemeral_storage_browsertest.cc @@ -418,7 +418,7 @@ void EphemeralStorageBrowserTest::SetCookieSetting( // Helper to load easy-to-use Indexed DB API. void EphemeralStorageBrowserTest::LoadIndexedDbHelper(RenderFrameHost* host) { - const char kLoadIndexMinScript[] = + static constexpr char kLoadIndexMinScript[] = "new Promise((resolve) => {" " const script = document.createElement('script');" " script.onload = () => {" @@ -1028,7 +1028,7 @@ IN_PROC_BROWSER_TEST_F(EphemeralStorageBrowserTest, frames[site_b_tab2][4]}}, }; - const char kTestMessage[] = "msg"; + static constexpr char kTestMessage[] = "msg"; for (const auto& test_case : kTestCases) { // RenderFrameHosts that were expected to sent something or receive // something. The set is used to skip RFHs in "expect received nothing" diff --git a/browser/ethereum_remote_client/ethereum_remote_client_service.cc b/browser/ethereum_remote_client/ethereum_remote_client_service.cc index c1e3d896d12a..12964aa9ec8c 100644 --- a/browser/ethereum_remote_client/ethereum_remote_client_service.cc +++ b/browser/ethereum_remote_client/ethereum_remote_client_service.cc @@ -48,9 +48,6 @@ EthereumRemoteClientService::EthereumRemoteClientService( EthereumRemoteClientService::~EthereumRemoteClientService() = default; -const size_t EthereumRemoteClientService::kNonceByteLength = 12; -const size_t EthereumRemoteClientService::kSeedByteLength = 32; - // Returns 32 bytes of output from HKDF-SHA256. // This is done so that ethereum-remote-client never actually directly has // access to the master seed, but it does have a deterministic seed. diff --git a/browser/ethereum_remote_client/ethereum_remote_client_service.h b/browser/ethereum_remote_client/ethereum_remote_client_service.h index 4869b877a4fe..40bb977addec 100644 --- a/browser/ethereum_remote_client/ethereum_remote_client_service.h +++ b/browser/ethereum_remote_client/ethereum_remote_client_service.h @@ -67,8 +67,8 @@ class EthereumRemoteClientService final : public KeyedService { std::string* nonce); static std::string GetRandomNonce(); static std::string GetRandomSeed(); - static const size_t kNonceByteLength; - static const size_t kSeedByteLength; + static constexpr size_t kNonceByteLength = 12; + static constexpr size_t kSeedByteLength = 32; private: bool LoadRootSeedInfo(std::vector key, std::string* seed); diff --git a/browser/extensions/api/brave_rewards_api.cc b/browser/extensions/api/brave_rewards_api.cc index b95a4f467674..d467576db1c0 100644 --- a/browser/extensions/api/brave_rewards_api.cc +++ b/browser/extensions/api/brave_rewards_api.cc @@ -27,6 +27,7 @@ #include "chrome/browser/extensions/api/tabs/tabs_constants.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_tab_util.h" +#include "chrome/browser/extensions/window_controller.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser_finder.h" #include "components/prefs/pref_service.h" @@ -48,9 +49,11 @@ RewardsTabHelper* GetRewardsTabHelperForTabId( content::BrowserContext* browser_context) { DCHECK(browser_context); content::WebContents* web_contents = nullptr; + extensions::WindowController* window = nullptr; bool found = extensions::ExtensionTabUtil::GetTabById( - tab_id, browser_context, false, nullptr, nullptr, &web_contents, nullptr); - if (!found || !web_contents) { + tab_id, browser_context, /*incognito_enabled=*/false, &window, + &web_contents, /*tab_index=*/nullptr); + if (!found || !window || !web_contents) { return nullptr; } return RewardsTabHelper::FromWebContents(web_contents); @@ -60,9 +63,10 @@ content::WebContents* WebContentsFromBrowserContext( int tab_id, content::BrowserContext* browser_context) { content::WebContents* contents = nullptr; + extensions::WindowController* window = nullptr; extensions::ExtensionTabUtil::GetTabById( - tab_id, Profile::FromBrowserContext(browser_context), false, nullptr, - nullptr, &contents, nullptr); + tab_id, Profile::FromBrowserContext(browser_context), + /*incognito_enabled=*/false, &window, &contents, /*tab_index=*/nullptr); return contents; } diff --git a/browser/hub/internal/android/java/src/org/chromium/chrome/browser/hub/BraveHubManagerImpl.java b/browser/hub/internal/android/java/src/org/chromium/chrome/browser/hub/BraveHubManagerImpl.java index 7201c1c1b0f7..45aafc439d35 100644 --- a/browser/hub/internal/android/java/src/org/chromium/chrome/browser/hub/BraveHubManagerImpl.java +++ b/browser/hub/internal/android/java/src/org/chromium/chrome/browser/hub/BraveHubManagerImpl.java @@ -34,7 +34,6 @@ public class BraveHubManagerImpl extends HubManagerImpl { private Activity mActivity; private int mBottomToolbarHeight; - private boolean mBottomToolbarVisible; private boolean mIsTablet; private ComponentCallbacks mComponentCallbacks; diff --git a/browser/hub/internal/android/res/layout/hub_toolbar_layout.xml b/browser/hub/internal/android/res/layout/hub_toolbar_layout.xml index 01457cbb35a7..6b1817728f13 100644 --- a/browser/hub/internal/android/res/layout/hub_toolbar_layout.xml +++ b/browser/hub/internal/android/res/layout/hub_toolbar_layout.xml @@ -5,81 +5,109 @@ 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/. --> - + android:orientation="vertical" + tools:ignore="MergeRootFrame"> + + - - + android:layout_height="wrap_content" + android:orientation="vertical"> - - + android:layout_height="@dimen/toolbar_height_no_shadow"> - + - + - + + + + + - - - - + + + + + + + diff --git a/browser/net/BUILD.gn b/browser/net/BUILD.gn index de7a3dde0387..8352c709ab50 100644 --- a/browser/net/BUILD.gn +++ b/browser/net/BUILD.gn @@ -93,6 +93,7 @@ source_set("unit_tests") { "//brave/components/brave_shields/content/browser", "//brave/components/brave_shields/content/test:test_support", "//brave/components/l10n/common:test_support", + "//chrome/browser/prefs", "//chrome/test:test_support", "//content/test:test_support", "//net", diff --git a/browser/net/brave_ad_block_csp_network_delegate_helper.cc b/browser/net/brave_ad_block_csp_network_delegate_helper.cc index 93ebb078e5c3..395fa0f491c9 100644 --- a/browser/net/brave_ad_block_csp_network_delegate_helper.cc +++ b/browser/net/brave_ad_block_csp_network_delegate_helper.cc @@ -79,13 +79,9 @@ int OnHeadersReceived_AdBlockCspWork( new net::HttpResponseHeaders(response_headers->raw_headers()); } - std::string original_csp_string; - std::optional original_csp = std::nullopt; - if ((*override_response_headers) - ->GetNormalizedHeader("Content-Security-Policy", - &original_csp_string)) { - original_csp = std::optional(original_csp_string); - } + std::optional original_csp = + (*override_response_headers) + ->GetNormalizedHeader("Content-Security-Policy"); (*override_response_headers)->RemoveHeader("Content-Security-Policy"); diff --git a/browser/net/brave_network_audit_search_ad_browsertest.cc b/browser/net/brave_network_audit_search_ad_browsertest.cc index 31af715daf68..baa9fbc71b1a 100644 --- a/browser/net/brave_network_audit_search_ad_browsertest.cc +++ b/browser/net/brave_network_audit_search_ad_browsertest.cc @@ -123,7 +123,8 @@ class BraveNetworkAuditSearchAdTest : public InProcessBrowserTest { // Brave search // The test simulation has a pattern https://search.brave.com: // port is changed dynamically - const char kAllowedBraveSearchTemplate[] = "https://search.brave.com:%s/"; + static constexpr char kAllowedBraveSearchTemplate[] = + "https://search.brave.com:%s/"; allowed_prefixes.push_back( base::StringPrintf(kAllowedBraveSearchTemplate, port.c_str())); VerifyNetworkAuditLog(net_log_path_, audit_results_path_, allowed_prefixes); diff --git a/browser/net/brave_speech_to_text_network_delegate_helper.cc b/browser/net/brave_speech_to_text_network_delegate_helper.cc index 7d6534ed78f1..1d06d3e41962 100644 --- a/browser/net/brave_speech_to_text_network_delegate_helper.cc +++ b/browser/net/brave_speech_to_text_network_delegate_helper.cc @@ -28,9 +28,9 @@ void AddSpeechToTextBraveHeaders(network::ResourceRequest* request) { request->credentials_mode = network::mojom::CredentialsMode::kInclude; request->site_for_cookies = net::SiteForCookies::FromUrl(request->url); - constexpr const char kRequestKey[] = "request-key"; + static constexpr char kRequestKey[] = "request-key"; request->headers.SetHeader(kRequestKey, request_key); - constexpr const char kRequestDate[] = "request-date"; + static constexpr char kRequestDate[] = "request-date"; const auto request_date = base::TimeFormatHTTP(base::Time::Now()); request->headers.SetHeader(kRequestDate, request_date); @@ -52,7 +52,7 @@ void OnBeforeURLRequest_SpoofSpeechToText(network::ResourceRequest* request) { if (!base::FeatureList::IsEnabled(stt::kSttFeature)) { return; } - constexpr const char kSttPrefix[] = + static constexpr char kSttPrefix[] = "https://www.google.com/speech-api/full-duplex/v1/*"; static base::NoDestructor stt_pattern(URLPattern::SCHEME_HTTPS, kSttPrefix); diff --git a/browser/net/brave_torrent_redirect_network_delegate_helper_unittest.cc b/browser/net/brave_torrent_redirect_network_delegate_helper_unittest.cc index 46fa5c723722..2b45192386b7 100644 --- a/browser/net/brave_torrent_redirect_network_delegate_helper_unittest.cc +++ b/browser/net/brave_torrent_redirect_network_delegate_helper_unittest.cc @@ -133,9 +133,8 @@ TEST_F(BraveTorrentRedirectNetworkDelegateHelperTest, ASSERT_EQ(mimeType, kOctetStreamMimeType); orig_response_headers->AddHeader("Content-Disposition", "filename=\"sintel.torrent\""); - std::string disposition; - ASSERT_TRUE(orig_response_headers->GetNormalizedHeader("Content-Disposition", - &disposition)); + ASSERT_TRUE(orig_response_headers->GetNormalizedHeader("Content-Disposition") + .has_value()); scoped_refptr overwrite_response_headers = new net::HttpResponseHeaders(std::string()); diff --git a/browser/ntp_background/custom_background_file_manager.cc b/browser/ntp_background/custom_background_file_manager.cc index 485d172279bf..a985550909e9 100644 --- a/browser/ntp_background/custom_background_file_manager.cc +++ b/browser/ntp_background/custom_background_file_manager.cc @@ -6,6 +6,7 @@ #include "brave/browser/ntp_background/custom_background_file_manager.h" #include +#include #include "base/files/file.h" #include "base/files/file_util.h" @@ -189,9 +190,10 @@ void CustomBackgroundFileManager::SaveImageAsPNG( } auto encode_and_save = base::BindOnce( [](const SkBitmap& bitmap, const base::FilePath& target_path) { - std::vector encoded; - if (!gfx::PNGCodec::EncodeBGRASkBitmap( - bitmap, /*discard_transparency=*/false, &encoded)) { + std::optional> encoded = + gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, + /*discard_transparency=*/false); + if (!encoded) { DVLOG(2) << "Failed to encode image as PNG"; return base::FilePath(); } @@ -202,7 +204,7 @@ void CustomBackgroundFileManager::SaveImageAsPNG( base::StringPrintf("-%d", i)); } - if (!base::WriteFile(modified_path, base::make_span(encoded))) { + if (!base::WriteFile(modified_path, *encoded)) { DVLOG(2) << "Failed to write image to file " << modified_path; return base::FilePath(); } diff --git a/browser/ntp_background/ntp_background_prefs.cc b/browser/ntp_background/ntp_background_prefs.cc index be283b367931..92410fb738b7 100644 --- a/browser/ntp_background/ntp_background_prefs.cc +++ b/browser/ntp_background/ntp_background_prefs.cc @@ -35,14 +35,17 @@ const char* TypeToString(NTPBackgroundPrefs::Type type) { NTPBackgroundPrefs::Type StringToType(const std::string& type_string) { // See class description for details. - if (type_string == "brave") + if (type_string == "brave") { return NTPBackgroundPrefs::Type::kBrave; - if (type_string == "custom_image") + } + if (type_string == "custom_image") { return NTPBackgroundPrefs::Type::kCustomImage; - if (type_string == "solid_color" || type_string == "color") + } + if (type_string == "solid_color" || type_string == "color") { return NTPBackgroundPrefs::Type::kColor; + } - NOTREACHED_IN_MIGRATION(); + // This shouldn't occur normally, but is possible if prefs are corrupted. return NTPBackgroundPrefs::Type::kBrave; } @@ -66,11 +69,13 @@ void NTPBackgroundPrefs::RegisterPref( } void NTPBackgroundPrefs::MigrateOldPref() { - if (!service_->HasPrefPath(kDeprecatedPrefName)) + if (!service_->HasPrefPath(kDeprecatedPrefName)) { return; + } - if (service_->GetBoolean(kDeprecatedPrefName)) + if (service_->GetBoolean(kDeprecatedPrefName)) { SetType(Type::kCustomImage); + } service_->ClearPref(kDeprecatedPrefName); } @@ -82,8 +87,9 @@ NTPBackgroundPrefs::Type NTPBackgroundPrefs::GetType() const { } void NTPBackgroundPrefs::SetType(Type type) { - if (type == GetType()) + if (type == GetType()) { return; + } ScopedDictPrefUpdate update(service_, kPrefName); update->Set(kTypeKey, TypeToString(type)); @@ -142,8 +148,9 @@ void NTPBackgroundPrefs::RemoveCustomImageFromList( std::vector NTPBackgroundPrefs::GetCustomImageList() const { const auto& list = service_->GetList(kCustomImageListPrefName); std::vector result; - for (const auto& item : list) + for (const auto& item : list) { result.push_back(item.GetString()); + } return result; } diff --git a/browser/permissions/brave_wallet_permission_context_unittest.cc b/browser/permissions/brave_wallet_permission_context_unittest.cc index 79eeec81b732..bbbbb6e389c2 100644 --- a/browser/permissions/brave_wallet_permission_context_unittest.cc +++ b/browser/permissions/brave_wallet_permission_context_unittest.cc @@ -84,7 +84,7 @@ TEST_F(BraveWalletPermissionContextUnitTest, AddPermission) { // Set blocked content setting for the url. map()->SetContentSettingDefaultScope( origin.GetURL(), origin.GetURL(), - PermissionUtil::PermissionTypeToContentSettingTypeSafe(entry.type), + PermissionUtil::PermissionTypeToContentSettingsTypeSafe(entry.type), CONTENT_SETTING_BLOCK); success = permissions::BraveWalletPermissionContext::HasPermission( entry.type, browser_context(), origin, entry.address, &has_permission); @@ -94,7 +94,7 @@ TEST_F(BraveWalletPermissionContextUnitTest, AddPermission) { // Set content setting to default map()->SetContentSettingDefaultScope( origin.GetURL(), origin.GetURL(), - PermissionUtil::PermissionTypeToContentSettingTypeSafe(entry.type), + PermissionUtil::PermissionTypeToContentSettingsTypeSafe(entry.type), CONTENT_SETTING_DEFAULT); success = permissions::BraveWalletPermissionContext::HasPermission( entry.type, browser_context(), origin, entry.address, &has_permission); @@ -133,14 +133,14 @@ TEST_F(BraveWalletPermissionContextUnitTest, ResetPermission) { // CONTENT_SETTING_BLOCK shouldn't affect reset. map()->SetContentSettingDefaultScope( origin.GetURL(), origin.GetURL(), - PermissionUtil::PermissionTypeToContentSettingTypeSafe(entry.type), + PermissionUtil::PermissionTypeToContentSettingsTypeSafe(entry.type), CONTENT_SETTING_BLOCK); // Reset the permission ASSERT_TRUE(permissions::BraveWalletPermissionContext::ResetPermission( entry.type, browser_context(), origin, entry.address)); map()->SetContentSettingDefaultScope( origin.GetURL(), origin.GetURL(), - PermissionUtil::PermissionTypeToContentSettingTypeSafe(entry.type), + PermissionUtil::PermissionTypeToContentSettingsTypeSafe(entry.type), CONTENT_SETTING_DEFAULT); // Verify the permission is reset diff --git a/browser/playlist/playlist_data_source.cc b/browser/playlist/playlist_data_source.cc index e5657b1be19d..b675946b7df4 100644 --- a/browser/playlist/playlist_data_source.cc +++ b/browser/playlist/playlist_data_source.cc @@ -157,8 +157,7 @@ PlaylistDataSource::DataRequest::DataRequest(const GURL& url) { } else if (type_string == "favicon") { type = DataRequest::Type::kFavicon; } else { - NOTREACHED_IN_MIGRATION() - << "type is not in {thumbnail,media,favicon}: " << type_string; + NOTREACHED() << "type is not in {thumbnail,media,favicon}: " << type_string; } } @@ -192,10 +191,7 @@ void PlaylistDataSource::StartDataRequest( GetFavicon(data_request, wc_getter, std::move(got_data_callback)); break; case DataRequest::Type::kMedia: - NOTREACHED_IN_MIGRATION() - << "This request should call StartRangeDataRequest()"; - std::move(got_data_callback).Run(nullptr); - break; + NOTREACHED() << "This request should call StartRangeDataRequest()"; } } @@ -283,8 +279,6 @@ std::string PlaylistDataSource::GetMimeType(const GURL& url) { case DataRequest::Type::kFavicon: return FaviconSource::GetMimeType(url); } - - NOTREACHED_NORETURN(); } bool PlaylistDataSource::AllowCaching() { diff --git a/browser/playlist/playlist_service_factory.cc b/browser/playlist/playlist_service_factory.cc index 16a89ad1525f..47a2318d16c2 100644 --- a/browser/playlist/playlist_service_factory.cc +++ b/browser/playlist/playlist_service_factory.cc @@ -172,9 +172,11 @@ class PlaylistServiceDelegateImpl : public PlaylistService::Delegate { auto encode = base::BindOnce( [](const SkBitmap& bitmap) { auto encoded = base::MakeRefCounted(); - if (!gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, - /*discard_transparency=*/false, - &encoded->as_vector())) { + if (auto result = gfx::PNGCodec::EncodeBGRASkBitmap( + bitmap, + /*discard_transparency=*/false)) { + encoded->as_vector() = std::move(result).value(); + } else { DVLOG(2) << "Failed to encode image as PNG"; } diff --git a/browser/playlist/test/BUILD.gn b/browser/playlist/test/BUILD.gn index c7fc738309e7..a3ff273179dc 100644 --- a/browser/playlist/test/BUILD.gn +++ b/browser/playlist/test/BUILD.gn @@ -67,6 +67,7 @@ source_set("unit_tests") { deps = [ "//base", "//brave/components/playlist/browser", + "//chrome/browser/prefs", "//chrome/test:test_support", "//components/pref_registry", "//content/test:test_support", diff --git a/browser/renderer_context_menu/brave_mock_render_view_context_menu.h b/browser/renderer_context_menu/brave_mock_render_view_context_menu.h index 0788504e786d..bee93e5051d9 100644 --- a/browser/renderer_context_menu/brave_mock_render_view_context_menu.h +++ b/browser/renderer_context_menu/brave_mock_render_view_context_menu.h @@ -14,7 +14,7 @@ #include "base/memory/raw_ptr.h" #include "components/renderer_context_menu/render_view_context_menu_proxy.h" #include "ui/base/models/image_model.h" -#include "ui/base/models/simple_menu_model.h" +#include "ui/menus/simple_menu_model.h" class BraveMockRenderViewContextMenu; class PrefService; diff --git a/browser/renderer_context_menu/test/render_view_context_menu_browsertest.cc b/browser/renderer_context_menu/test/render_view_context_menu_browsertest.cc index 95f8273bcbc4..5baa76ce8788 100644 --- a/browser/renderer_context_menu/test/render_view_context_menu_browsertest.cc +++ b/browser/renderer_context_menu/test/render_view_context_menu_browsertest.cc @@ -29,7 +29,7 @@ class BraveContextMenuBrowserTest : public InProcessBrowserTest { const GURL& url, const std::u16string& link_text, blink::mojom::ContextMenuDataMediaType media_type, - ui::MenuSourceType source_type) { + ui::mojom::MenuSourceType source_type) { content::ContextMenuParams params; params.media_type = media_type; params.unfiltered_link_url = unfiltered_url; @@ -54,7 +54,7 @@ class BraveContextMenuBrowserTest : public InProcessBrowserTest { const GURL& url, const std::u16string& link_text, blink::mojom::ContextMenuDataMediaType media_type, - ui::MenuSourceType source_type) { + ui::mojom::MenuSourceType source_type) { return CreateContextMenuInWebContents( browser()->tab_strip_model()->GetActiveWebContents(), unfiltered_url, url, link_text, media_type, source_type); @@ -65,7 +65,7 @@ class BraveContextMenuBrowserTest : public InProcessBrowserTest { const GURL& url) { return CreateContextMenu(unfiltered_url, url, std::u16string(), blink::mojom::ContextMenuDataMediaType::kNone, - ui::MENU_SOURCE_NONE); + ui::mojom::MenuSourceType::kNone); } private: diff --git a/browser/resources/extensions/BUILD.gn b/browser/resources/extensions/BUILD.gn index 923f44162b2e..7c2802b94934 100644 --- a/browser/resources/extensions/BUILD.gn +++ b/browser/resources/extensions/BUILD.gn @@ -13,5 +13,6 @@ import("sources.gni") # compile (etc.) from that directory. preprocess_if_expr("preprocess") { out_folder = "$root_gen_dir/chrome/browser/resources/extensions/preprocessed" - in_files = brave_extensions_local_ts_files + brave_extensions_local_html_files + in_files = + brave_extensions_local_ts_files + brave_extensions_local_html_css_files } diff --git a/browser/resources/extensions/brave_item_list_more_items.css b/browser/resources/extensions/brave_item_list_more_items.css new file mode 100644 index 000000000000..a928fd0bb403 --- /dev/null +++ b/browser/resources/extensions/brave_item_list_more_items.css @@ -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/. */ + +/* #css_wrapper_metadata_start + * #type=style-lit + * #scheme=relative + * #css_wrapper_metadata_end */ + +.more-items-message { + color: #6e6e6e; + font-size: 123%; + /* Should be 16px when 100% is 13px. */ + font-weight: 500; + margin-top: 32px; + text-align: center; +} diff --git a/browser/resources/extensions/brave_item_list_more_items.html b/browser/resources/extensions/brave_item_list_more_items.html deleted file mode 100644 index 89877982a484..000000000000 --- a/browser/resources/extensions/brave_item_list_more_items.html +++ /dev/null @@ -1,16 +0,0 @@ - -
- - $i18nRaw{noExtensionsOrApps} - -
diff --git a/browser/resources/extensions/brave_item_list_more_items.html.ts b/browser/resources/extensions/brave_item_list_more_items.html.ts new file mode 100644 index 000000000000..f55fa699a22d --- /dev/null +++ b/browser/resources/extensions/brave_item_list_more_items.html.ts @@ -0,0 +1,15 @@ +// Copyright (c) 2024 The Brave Authors. All rights reserved. +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this file, +// You can obtain one at https://mozilla.org/MPL/2.0/. +import { html } from '//resources/lit/v3_0/lit.rollup.js'; +import type { ExtensionsBraveItemListMoreItemsElement } from './brave_item_list_more_items.js' + +export function getHtml(this: ExtensionsBraveItemListMoreItemsElement) { + return html`
+ + $i18nRaw{noExtensionsOrApps} + +
` +} diff --git a/browser/resources/extensions/brave_item_list_more_items.ts b/browser/resources/extensions/brave_item_list_more_items.ts index e1ee46eefb1f..93fea30f06e8 100644 --- a/browser/resources/extensions/brave_item_list_more_items.ts +++ b/browser/resources/extensions/brave_item_list_more_items.ts @@ -3,15 +3,16 @@ * 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 {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js' -import {I18nMixin, I18nMixinInterface} from 'chrome://resources/cr_elements/i18n_mixin.js' -import 'chrome://resources/cr_elements/cr_shared_style.css.js' -import 'chrome://resources/js/cr.js' -import {getTemplate} from './brave_item_list_more_items.html.js' +import { CrLitElement } from '//resources/lit/v3_0/lit.rollup.js' +import { I18nMixinLit, I18nMixinLitInterface } from '//resources/cr_elements/i18n_mixin_lit.js' +import '//resources/js/cr.js' + +import {getCss} from './brave_item_list_more_items.css.js' +import { getHtml } from './brave_item_list_more_items.html.js' const ExtensionsBraveItemListMoreItemsElementBase = - I18nMixin(PolymerElement) as { - new(): PolymerElement & I18nMixinInterface + I18nMixinLit(CrLitElement) as { + new(): CrLitElement & I18nMixinLitInterface } export class ExtensionsBraveItemListMoreItemsElement extends ExtensionsBraveItemListMoreItemsElementBase { @@ -19,22 +20,26 @@ export class ExtensionsBraveItemListMoreItemsElement extends ExtensionsBraveItem return 'extensions-brave-item-list-more-items' } - static get template() { - return getTemplate() + // @ts-ignore + static override get styles() { + return getCss() } - static get properties() { - return { - /** @type {!Array} */ - apps: Array, + // @ts-ignore + override render() { + return getHtml.bind(this)() + } - /** @type {!Array} */ - extensions: Array, + // @ts-ignore + static override get properties() { + return { + apps: { type: Array }, + extensions: { type: Array }, }; } - private apps: chrome.developerPrivate.ExtensionInfo[]; - private extensions: chrome.developerPrivate.ExtensionInfo[]; + private apps: chrome.developerPrivate.ExtensionInfo[] = []; + private extensions: chrome.developerPrivate.ExtensionInfo[] = []; shouldShowMoreItemsMessage_() { if (!this.apps || !this.extensions) diff --git a/browser/resources/extensions/brave_overrides/extensions_toolbar.ts b/browser/resources/extensions/brave_overrides/extensions_toolbar.ts index 297434bb29e7..ad6e2bf72c94 100644 --- a/browser/resources/extensions/brave_overrides/extensions_toolbar.ts +++ b/browser/resources/extensions/brave_overrides/extensions_toolbar.ts @@ -3,11 +3,11 @@ // 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 { RegisterStyleOverride } from '//resources/brave/polymer_overriding.js' -import { html } from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js' +import { injectStyle } from '//resources/brave/lit_overriding.js' +import { css } from '//resources/lit/v3_0/lit.rollup.js' +import { ExtensionsToolbarElement } from '../toolbar.js' -RegisterStyleOverride('extensions-toolbar', html``) + overflow: hidden + }`) diff --git a/browser/resources/extensions/brave_overrides/side_bar.ts b/browser/resources/extensions/brave_overrides/side_bar.ts index dfb057004dff..f1061d21ee09 100644 --- a/browser/resources/extensions/brave_overrides/side_bar.ts +++ b/browser/resources/extensions/brave_overrides/side_bar.ts @@ -32,5 +32,13 @@ injectStyle(ExtensionsSidebarElement, css` .cr-nav-menu-item cr-ripple { display: none !important; } - ` + + .separator { + display: none !important; + } + + #moreExtensions { + display: none !important; + } +` ) diff --git a/browser/resources/extensions/sources.gni b/browser/resources/extensions/sources.gni index 523c3022a962..159332a68218 100644 --- a/browser/resources/extensions/sources.gni +++ b/browser/resources/extensions/sources.gni @@ -3,23 +3,19 @@ # 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/. -brave_extensions_web_component_files = [ "brave_item_list_more_items.ts" ] - brave_extensions_non_web_component_files = [ "brave_overrides/extensions_detail_view.ts", "brave_overrides/extensions_toolbar.ts", "brave_overrides/index.ts", "brave_overrides/side_bar.ts", + "brave_item_list_more_items.ts", + "brave_item_list_more_items.html.ts", ] +brave_extensions_css_files = [ "brave_item_list_more_items.css" ] + brave_extensions_preprocess_extra_deps = [ "//brave/browser/resources/extensions:preprocess" ] -brave_extensions_local_ts_files = brave_extensions_web_component_files + - brave_extensions_non_web_component_files - -brave_extensions_local_html_files = [] -foreach(component_file, brave_extensions_web_component_files) { - brave_extensions_local_html_files += - [ string_replace(component_file, ".ts", ".html") ] -} +brave_extensions_local_ts_files = brave_extensions_non_web_component_files +brave_extensions_local_html_css_files = brave_extensions_css_files diff --git a/browser/resources/settings/brave_overrides/security_page.ts b/browser/resources/settings/brave_overrides/security_page.ts index 9ad4935f9702..dd1a96f79746 100644 --- a/browser/resources/settings/brave_overrides/security_page.ts +++ b/browser/resources/settings/brave_overrides/security_page.ts @@ -32,11 +32,24 @@ RegisterPolymerTemplateModifications({ } else { safeBrowsingEnhanced.setAttribute('hidden', 'true') } - const passwordsLeakToggle = templateContent.getElementById('passwordsLeakToggle') - if (!passwordsLeakToggle) { - console.error('[Brave Settings Overrides] Could not find passwordsLeakToggle id on security page.') + const passwordsLeakSettings = templateContent. + querySelector( + 'template[is=dom-if][if="[[!enablePasswordLeakToggleMove_]]"]' + ) + if (!passwordsLeakSettings) { + console.error( + '[Brave Settings Overrides] Could not find template with ' + + 'if=[[!enablePasswordLeakToggleMove_]] on security page.') } else { - passwordsLeakToggle.setAttribute('hidden', 'true') + const passwordsLeakToggleOld = passwordsLeakSettings.content. + getElementById('passwordsLeakToggleOld') + if (!passwordsLeakToggleOld) { + console.error('[Brave Settings Overrides] Could not find' + + 'passwordsLeakToggleOld on security page.') + } else { + passwordsLeakToggleOld.setAttribute('hidden', 'true') + } + passwordsLeakToggleOld.setAttribute('hidden', 'true') } if (loadTimeData.getBoolean("isHttpsByDefaultEnabled")) { const enableHttpsFirstModeNewSettings = templateContent. diff --git a/browser/sandbox/win/module_file_name_patch_browsertest.cc b/browser/sandbox/win/module_file_name_patch_browsertest.cc index 9ae3402718c4..07adec7807d4 100644 --- a/browser/sandbox/win/module_file_name_patch_browsertest.cc +++ b/browser/sandbox/win/module_file_name_patch_browsertest.cc @@ -70,11 +70,11 @@ IN_PROC_BROWSER_TEST_P(ModuleFileNameBrowserTest, CheckPath) { std::wstring_view(main_path).ends_with(L"brave_browser_tests.exe")) << main_path; - constexpr const size_t kInterceptedFunctions = 4u; + static constexpr size_t kInterceptedFunctions = 4u; #if !defined(ADDRESS_SANITIZER) - constexpr const size_t kExpectedReplacements = 4u; + static constexpr size_t kExpectedReplacements = 4u; #else - constexpr const size_t kExpectedReplacements = 3u; + static constexpr size_t kExpectedReplacements = 3u; #endif if (GetParam()) { diff --git a/browser/share/android/java/src/org/chromium/chrome/browser/share/send_tab_to_self/BraveManageAccountDevicesLinkView.java b/browser/share/android/java/src/org/chromium/chrome/browser/share/send_tab_to_self/BraveManageAccountDevicesLinkView.java index 2a1d35f46072..fb7cfeca12e2 100644 --- a/browser/share/android/java/src/org/chromium/chrome/browser/share/send_tab_to_self/BraveManageAccountDevicesLinkView.java +++ b/browser/share/android/java/src/org/chromium/chrome/browser/share/send_tab_to_self/BraveManageAccountDevicesLinkView.java @@ -11,9 +11,7 @@ import android.widget.LinearLayout; import org.chromium.chrome.browser.profiles.Profile; -import org.chromium.components.signin.base.AccountCapabilities; import org.chromium.components.signin.base.AccountInfo; -import org.chromium.components.signin.base.CoreAccountId; public class BraveManageAccountDevicesLinkView extends LinearLayout { public BraveManageAccountDevicesLinkView(Context context, AttributeSet attrs) { @@ -23,13 +21,6 @@ public BraveManageAccountDevicesLinkView(Context context, AttributeSet attrs) { } public static AccountInfo getSharingAccountInfo(Profile profile) { - return new AccountInfo( - new CoreAccountId(""), - "", - "", - null, - null, - null, - new AccountCapabilities(new String[0], new boolean[0])); + return new AccountInfo.Builder("", "").build(); } } diff --git a/browser/sources.gni b/browser/sources.gni index 7f575feedbd3..6e3dc0a95667 100644 --- a/browser/sources.gni +++ b/browser/sources.gni @@ -489,8 +489,6 @@ if (is_win && is_official_build) { "//chrome/browser/google/switches.cc", "//chrome/browser/google/switches.h", ] - - brave_chrome_browser_deps += [ "//google_update" ] } brave_chrome_browser_public_deps = [ diff --git a/browser/speedreader/page_distiller.cc b/browser/speedreader/page_distiller.cc index 50c968be7b92..1ec6df4cddc2 100644 --- a/browser/speedreader/page_distiller.cc +++ b/browser/speedreader/page_distiller.cc @@ -51,7 +51,7 @@ void PageDistiller::GetTextToSpeak(TextToSpeechContentCallback callback) { return std::move(callback).Run(base::Value()); } - constexpr const char16_t kGetTextToSpeak[] = + static constexpr char16_t kGetTextToSpeak[] = uR"js( speedreaderUtils.extractTextToSpeak() )js"; web_contents_->GetPrimaryMainFrame()->ExecuteJavaScriptInIsolatedWorld( @@ -77,10 +77,10 @@ void PageDistiller::StartDistill(DistillContentCallback callback) { return std::move(callback).Run(false, {}); } - constexpr const char16_t kGetDocumentSource[] = + static constexpr char16_t kGetDocumentSource[] = uR"js( document.documentElement.outerHTML )js"; - constexpr const char16_t kGetBodySource[] = + static constexpr char16_t kGetBodySource[] = uR"js( document.body.outerHTML )js"; web_contents_->GetPrimaryMainFrame()->ExecuteJavaScriptInIsolatedWorld( diff --git a/browser/speedreader/speedreader_browsertest.cc b/browser/speedreader/speedreader_browsertest.cc index 2e4fc2f5d228..b09f1b2788a1 100644 --- a/browser/speedreader/speedreader_browsertest.cc +++ b/browser/speedreader/speedreader_browsertest.cc @@ -432,7 +432,7 @@ IN_PROC_BROWSER_TEST_F(SpeedReaderBrowserTest, OnDemandReader) { EXPECT_TRUE(speedreader::DistillStates::IsDistillable( tab_helper()->PageDistillState())); // Change content on the page. - constexpr const char kChangeContent[] = + static constexpr char kChangeContent[] = R"js( document.querySelector('meta[property="og:title"]').content = 'Title was changed by javascript' @@ -445,7 +445,7 @@ IN_PROC_BROWSER_TEST_F(SpeedReaderBrowserTest, OnDemandReader) { tab_helper()->PageDistillState())); // Check title on the distilled page. - constexpr const char kCheckContent[] = + static constexpr char kCheckContent[] = R"js( !!document.getElementById('brave_speedreader_style') && (document.title === 'Title was changed by javascript') @@ -462,7 +462,7 @@ IN_PROC_BROWSER_TEST_F(SpeedReaderBrowserTest, OnDemandReaderEncoding) { EXPECT_TRUE(GetReaderButton()->GetVisible()); ClickReaderButton(); - constexpr const char kCheckText[] = + static constexpr char kCheckText[] = R"js( document.querySelector('#par-to-check').innerText.length )js"; EXPECT_EQ(92, content::EvalJs(ActiveWebContents(), kCheckText, content::EXECUTE_SCRIPT_DEFAULT_OPTIONS, @@ -571,7 +571,7 @@ IN_PROC_BROWSER_TEST_F(SpeedReaderBrowserTest, ShowOriginalPage) { NavigateToPageSynchronously(kTestPageReadable); auto* web_contents = ActiveWebContents(); - constexpr const char kCheckNoApiInMainWorld[] = + static constexpr char kCheckNoApiInMainWorld[] = R"js( document.speedreader === undefined )js"; @@ -579,7 +579,7 @@ IN_PROC_BROWSER_TEST_F(SpeedReaderBrowserTest, ShowOriginalPage) { content::EXECUTE_SCRIPT_DEFAULT_OPTIONS) .ExtractBool()); - constexpr const char kClickLinkAndGetTitle[] = + static constexpr char kClickLinkAndGetTitle[] = R"js( (function() { // element id is hardcoded in extractor.rs @@ -614,7 +614,7 @@ IN_PROC_BROWSER_TEST_F(SpeedReaderBrowserTest, ShowOriginalPageOnUnreadable) { NavigateToPageSynchronously(kTestPageSimple); auto* web_contents = ActiveWebContents(); - constexpr const char kCheckNoElement[] = + static constexpr char kCheckNoElement[] = R"js( document.getElementById('c93e2206-2f31-4ddc-9828-2bb8e8ed940e') == null )js"; @@ -624,7 +624,7 @@ IN_PROC_BROWSER_TEST_F(SpeedReaderBrowserTest, ShowOriginalPageOnUnreadable) { ISOLATED_WORLD_ID_BRAVE_INTERNAL) .ExtractBool()); - constexpr const char kCheckNoApi[] = + static constexpr char kCheckNoApi[] = R"js( document.speedreader === undefined )js"; @@ -644,7 +644,7 @@ IN_PROC_BROWSER_TEST_F(SpeedReaderBrowserTest, SetDataAttributes) { NavigateToPageSynchronously(kTestPageReadable); auto GetDataAttribute = [](const std::string& attr) { - constexpr const char kGetDataAttribute[] = + static constexpr char kGetDataAttribute[] = R"js( document.documentElement.getAttribute('$1') )js"; @@ -706,7 +706,7 @@ IN_PROC_BROWSER_TEST_F(SpeedReaderBrowserTest, SetDataAttributes) { IN_PROC_BROWSER_TEST_F(SpeedReaderBrowserTest, Toolbar) { auto GetDataAttribute = [](const std::string& attr) { - constexpr const char kGetDataAttribute[] = + static constexpr char kGetDataAttribute[] = R"js( document.documentElement.getAttribute('$1') )js"; @@ -731,7 +731,7 @@ IN_PROC_BROWSER_TEST_F(SpeedReaderBrowserTest, Toolbar) { auto WaitElement = [&](content::WebContents* contents, const std::string& elem) { - constexpr const char kWaitElement[] = + static constexpr char kWaitElement[] = R"js( (!!document.getElementById('$1')) )js"; @@ -749,7 +749,7 @@ IN_PROC_BROWSER_TEST_F(SpeedReaderBrowserTest, Toolbar) { }; auto Click = [&](content::WebContents* contents, const std::string& id) { - constexpr const char kClick[] = + static constexpr char kClick[] = R"js( document.getElementById('$1').click() )js"; @@ -837,7 +837,7 @@ IN_PROC_BROWSER_TEST_F(SpeedReaderBrowserTest, ToolbarLangs) { ->reader_mode_toolbar_view_.get(); auto* toolbar = toolbar_view->GetWebContentsForTesting(); - constexpr const char kGetLang[] = R"js( navigator.languages.toString() )js"; + static constexpr char kGetLang[] = R"js( navigator.languages.toString() )js"; EXPECT_EQ("en-US,ja,en-CA,fr-CA", content::EvalJs(toolbar, kGetLang).ExtractString()); } @@ -913,7 +913,7 @@ IN_PROC_BROWSER_TEST_F(SpeedReaderBrowserTest, Csp) { NavigateToPageSynchronously(page, WindowOpenDisposition::CURRENT_TAB); - constexpr const char kCheckNoMaliciousContent[] = R"js( + static constexpr char kCheckNoMaliciousContent[] = R"js( !document.getElementById('malicious1') && !document.querySelector('meta[http-equiv="undefinedHttpEquiv"]') )js"; @@ -955,7 +955,7 @@ IN_PROC_BROWSER_TEST_F(SpeedReaderBrowserTest, CspInBody) { NavigateToPageSynchronously(kTestCSPInBodyPage, WindowOpenDisposition::CURRENT_TAB); - constexpr const char kCheckCsp[] = R"js( + static constexpr char kCheckCsp[] = R"js( document.querySelectorAll('meta[content="CSP in body"]').length === 0 )js"; diff --git a/browser/speedreader/speedreader_tab_helper.cc b/browser/speedreader/speedreader_tab_helper.cc index daa545c593cc..e087aee547e1 100644 --- a/browser/speedreader/speedreader_tab_helper.cc +++ b/browser/speedreader/speedreader_tab_helper.cc @@ -458,7 +458,7 @@ void SpeedreaderTabHelper::OnReadingStart(content::WebContents* web_contents) { return; } - constexpr const char16_t kReading[] = + static constexpr char16_t kReading[] = uR"js( speedreaderUtils.setTtsReadingState($1) )js"; const auto script = base::ReplaceStringPlaceholders( @@ -481,7 +481,7 @@ void SpeedreaderTabHelper::OnReadingProgress(content::WebContents* web_contents, web_contents != this->web_contents()) { return; } - constexpr const char16_t kHighlight[] = + static constexpr char16_t kHighlight[] = uR"js( speedreaderUtils.highlightText($1, $2, $3) )js"; const auto script = base::ReplaceStringPlaceholders( @@ -551,7 +551,7 @@ void SpeedreaderTabHelper::OnResult( void SpeedreaderTabHelper::SetDocumentAttribute(const std::string& attribute, const std::string& value) { - constexpr const char16_t kSetAttribute[] = + static constexpr char16_t kSetAttribute[] = uR"js( (function() { const attribute = '$1' diff --git a/browser/test/os_crypt/keychain_password_mac_browsertest.mm b/browser/test/os_crypt/keychain_password_mac_browsertest.mm index 991831e5adff..06cba7b052b7 100644 --- a/browser/test/os_crypt/keychain_password_mac_browsertest.mm +++ b/browser/test/os_crypt/keychain_password_mac_browsertest.mm @@ -15,7 +15,7 @@ const char* account_name; }; -static const TestParams kTestVectors[] = { +constexpr TestParams kTestVectors[] = { { nullptr, "Brave Safe Storage", diff --git a/browser/themes/brave_dark_mode_utils.cc b/browser/themes/brave_dark_mode_utils.cc index db4b939e708e..827d782c94ec 100644 --- a/browser/themes/brave_dark_mode_utils.cc +++ b/browser/themes/brave_dark_mode_utils.cc @@ -9,6 +9,8 @@ #include "base/check_is_test.h" #include "base/command_line.h" +#include "base/logging.h" +#include "base/notreached.h" #include "base/strings/string_util.h" #include "brave/browser/themes/brave_dark_mode_utils_internal.h" #include "brave/components/constants/brave_switches.h" @@ -49,12 +51,16 @@ dark_mode::BraveDarkModeType GetDarkModeSwitchValue( command_line.GetSwitchValueASCII(switches::kDarkMode); std::string requested_dark_mode_value_lower = base::ToLowerASCII(requested_dark_mode_value); - if (requested_dark_mode_value_lower == "light") + DCHECK(requested_dark_mode_value_lower == "dark" || + requested_dark_mode_value == "light"); + + if (requested_dark_mode_value_lower == "light") { return dark_mode::BraveDarkModeType::BRAVE_DARK_MODE_TYPE_LIGHT; - if (requested_dark_mode_value_lower == "dark") + } + if (requested_dark_mode_value_lower == "dark") { return dark_mode::BraveDarkModeType::BRAVE_DARK_MODE_TYPE_DARK; + } - NOTREACHED_IN_MIGRATION(); return dark_mode::BraveDarkModeType::BRAVE_DARK_MODE_TYPE_LIGHT; } @@ -69,8 +75,9 @@ void RegisterBraveDarkModeLocalStatePrefs(PrefRegistrySimple* registry) { } bool SystemDarkModeEnabled() { - if (g_is_test_) + if (g_is_test_) { return g_system_dark_mode_enabled_in_test_; + } #if BUILDFLAG(IS_LINUX) return HasCachedSystemDarkModeType(); @@ -85,13 +92,15 @@ void SetUseSystemDarkModeEnabledForTest(bool enabled) { } std::string GetStringFromBraveDarkModeType(BraveDarkModeType type) { + DCHECK_NE(type, BraveDarkModeType::BRAVE_DARK_MODE_TYPE_DEFAULT) + << "Didn't expect to encounter the default theme mode here - this was " + "previously a NOTREACHED"; switch (type) { case BraveDarkModeType::BRAVE_DARK_MODE_TYPE_LIGHT: return "Light"; case BraveDarkModeType::BRAVE_DARK_MODE_TYPE_DARK: return "Dark"; default: - NOTREACHED_IN_MIGRATION(); return "Default"; } } @@ -117,8 +126,9 @@ BraveDarkModeType GetActiveBraveDarkModeType() { // allow override via cli flag const base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); - if (command_line.HasSwitch(switches::kDarkMode)) + if (command_line.HasSwitch(switches::kDarkMode)) { return GetDarkModeSwitchValue(command_line); + } if (!g_browser_process || !g_browser_process->local_state()) { // In unittest, local_state() could not be initialzed. @@ -129,8 +139,9 @@ BraveDarkModeType GetActiveBraveDarkModeType() { BraveDarkModeType type = static_cast( g_browser_process->local_state()->GetInteger(kBraveDarkMode)); if (type == BraveDarkModeType::BRAVE_DARK_MODE_TYPE_DEFAULT) { - if (!SystemDarkModeEnabled()) + if (!SystemDarkModeEnabled()) { return GetDarkModeTypeBasedOnChannel(); + } return ui::NativeTheme::GetInstanceForNativeUi()->ShouldUseDarkColors() ? BraveDarkModeType::BRAVE_DARK_MODE_TYPE_DARK @@ -143,8 +154,9 @@ BraveDarkModeType GetBraveDarkModeType() { // allow override via cli flag const base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); - if (command_line.HasSwitch(switches::kDarkMode)) + if (command_line.HasSwitch(switches::kDarkMode)) { return GetDarkModeSwitchValue(command_line); + } if (!g_browser_process || !g_browser_process->local_state()) { // In unittest, local_state() could not be initialzed. @@ -155,8 +167,9 @@ BraveDarkModeType GetBraveDarkModeType() { BraveDarkModeType type = static_cast( g_browser_process->local_state()->GetInteger(kBraveDarkMode)); if (type == BraveDarkModeType::BRAVE_DARK_MODE_TYPE_DEFAULT) { - if (!SystemDarkModeEnabled()) + if (!SystemDarkModeEnabled()) { return GetDarkModeTypeBasedOnChannel(); + } return type; } return type; diff --git a/browser/tor/BUILD.gn b/browser/tor/BUILD.gn index b9c75fe3f239..fe26d95042de 100644 --- a/browser/tor/BUILD.gn +++ b/browser/tor/BUILD.gn @@ -62,6 +62,7 @@ source_set("util") { deps = [ "//chrome/browser:browser_public_dependencies", + "//chrome/browser/prefs", "//components/policy/core/common", "//components/user_prefs", "//content/public/browser", diff --git a/browser/tor/test/BUILD.gn b/browser/tor/test/BUILD.gn index 55fdb3abd133..ecd776f81783 100644 --- a/browser/tor/test/BUILD.gn +++ b/browser/tor/test/BUILD.gn @@ -69,6 +69,7 @@ source_set("browser_tests") { "//chrome/browser", "//chrome/browser:browser_process", "//chrome/browser/content_settings:content_settings_factory", + "//chrome/browser/prefs", "//chrome/browser/search_engines", "//chrome/browser/ui", "//chrome/test:test_support", diff --git a/browser/translate/brave_translate_browsertest.cc b/browser/translate/brave_translate_browsertest.cc index a31f4ff5dff7..336a4c5f69bf 100644 --- a/browser/translate/brave_translate_browsertest.cc +++ b/browser/translate/brave_translate_browsertest.cc @@ -361,8 +361,9 @@ IN_PROC_BROWSER_TEST_F(BraveTranslateBrowserGoogleRedirectTest, GetTranslateManager()->TranslatePage("es", "en", true); WaitUntilPageTranslated(); - const char kTestURL[] = "https://translate.google.com/something.svg"; - const char kTestSvg[] = R"( + static constexpr char kTestURL[] = + "https://translate.google.com/something.svg"; + static constexpr char kTestSvg[] = R"( )"; @@ -382,7 +383,7 @@ IN_PROC_BROWSER_TEST_F(BraveTranslateBrowserGoogleRedirectTest, EXPECT_EQ("https://translate.brave.com/something.svg", EvalTranslateJs(do_xhr_and_get_final_url)); - const char kLoadImageTemplate[] = R"( + static constexpr char kLoadImageTemplate[] = R"( new Promise((resolve) => { let p = new Image(); p.onload = () => resolve(true); diff --git a/browser/ui/BUILD.gn b/browser/ui/BUILD.gn index 4f2e3c2b89f3..89cec2e2ac15 100644 --- a/browser/ui/BUILD.gn +++ b/browser/ui/BUILD.gn @@ -610,6 +610,7 @@ source_set("ui") { "//chrome/browser/devtools", "//chrome/browser/ui/download", "//chrome/browser/ui/exclusive_access", + "//chrome/browser/ui/javascript_dialogs", "//chrome/browser/ui/views/bubble", "//chrome/browser/ui/views/toolbar", "//components/bookmarks/browser", @@ -1209,10 +1210,7 @@ source_set("ui") { if (is_win && is_official_build) { sources += [ "//chrome/browser/ui/webui/help/version_updater_win.cc" ] - deps += [ - "//chrome/updater/app/server/win:updater_legacy_idl", - "//google_update", - ] + deps += [ "//chrome/updater/app/server/win:updater_legacy_idl" ] } if (enable_tor) { @@ -1445,6 +1443,7 @@ source_set("unit_tests") { "//brave/components/brave_vpn/browser/connection:api", "//brave/components/brave_vpn/browser/connection/ikev2:sim", "//brave/components/skus/browser", + "//chrome/browser/prefs", "//chrome/browser/themes", "//chrome/test:test_support", "//skia", diff --git a/browser/ui/android/logo/java/src/org/chromium/chrome/browser/logo/BraveLogoMediator.java b/browser/ui/android/logo/java/src/org/chromium/chrome/browser/logo/BraveLogoMediator.java index 82195963b37a..3391d7383120 100644 --- a/browser/ui/android/logo/java/src/org/chromium/chrome/browser/logo/BraveLogoMediator.java +++ b/browser/ui/android/logo/java/src/org/chromium/chrome/browser/logo/BraveLogoMediator.java @@ -20,7 +20,6 @@ public BraveLogoMediator( Context context, Callback logoClickedCallback, PropertyModel logoModel, - boolean shouldFetchDoodle, Callback onLogoAvailableCallback, LogoCoordinator.VisibilityObserver visibilityObserver, CachedTintedBitmap defaultGoogleLogo) { @@ -28,7 +27,6 @@ public BraveLogoMediator( context, logoClickedCallback, logoModel, - shouldFetchDoodle, onLogoAvailableCallback, visibilityObserver, defaultGoogleLogo); 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 3d2b10c37179..fc1feed55c5b 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 @@ -33,7 +33,7 @@ public BraveStatusMediator( PermissionDialogController permissionDialogController, OneshotSupplier templateUrlServiceSupplier, Supplier profileSupplier, - PageInfoIPHController pageInfoIPHController, + PageInfoIphController pageInfoIphController, WindowAndroid windowAndroid, @Nullable Supplier @@ -47,7 +47,7 @@ public BraveStatusMediator( permissionDialogController, templateUrlServiceSupplier, profileSupplier, - pageInfoIPHController, + pageInfoIphController, windowAndroid, merchantTrustSignalsCoordinatorSupplier); } diff --git a/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/BraveAutocompleteCoordinator.java b/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/BraveAutocompleteCoordinator.java index 05023bfd22a7..f458ca9f9564 100644 --- a/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/BraveAutocompleteCoordinator.java +++ b/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/BraveAutocompleteCoordinator.java @@ -1,13 +1,10 @@ -/** - * Copyright (c) 2022 The Brave Authors. All rights reserved. +/* Copyright (c) 2022 The Brave Authors. All rights reserved. * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at https://mozilla.org/MPL/2.0/. - */ + * You can obtain one at https://mozilla.org/MPL/2.0/. */ package org.chromium.chrome.browser.omnibox.suggestions; -import android.content.Context; import android.view.LayoutInflater; import android.view.View; @@ -26,15 +23,13 @@ public class BraveAutocompleteCoordinator { public ViewProvider createViewProvider( - Context context, boolean forcePhoneStyleOmnibox) { + boolean forcePhoneStyleOmnibox) { ViewProvider provider = (ViewProvider) BraveReflectionUtil.invokeMethod( AutocompleteCoordinator.class, this, "createViewProvider", - Context.class, - context, boolean.class, forcePhoneStyleOmnibox); diff --git a/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/BraveDropdownItemViewInfoListBuilder.java b/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/BraveDropdownItemViewInfoListBuilder.java index 339af0141214..7a5889ff0b65 100644 --- a/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/BraveDropdownItemViewInfoListBuilder.java +++ b/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/BraveDropdownItemViewInfoListBuilder.java @@ -11,7 +11,6 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.annotation.Px; import org.chromium.base.BraveFeatureList; import org.chromium.base.BravePreferenceKeys; @@ -27,6 +26,7 @@ import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.search_engines.settings.BraveSearchEngineAdapter; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.components.omnibox.AutocompleteInput; import org.chromium.components.omnibox.AutocompleteResult; import org.chromium.components.omnibox.GroupsProto.GroupConfig; import org.chromium.components.omnibox.OmniboxFeatures; @@ -45,10 +45,6 @@ class BraveDropdownItemViewInfoListBuilder extends DropdownItemViewInfoListBuild private @NonNull Supplier mActivityTabSupplier; private static final List sBraveSearchEngineDefaultRegions = Arrays.asList("CA", "DE", "FR", "GB", "US", "AT", "ES", "MX"); - @Px - private static final int DROPDOWN_HEIGHT_UNKNOWN = -1; - private static final int DEFAULT_SIZE_OF_VISIBLE_GROUP = 5; - private Context mContext; private AutocompleteDelegate mAutocompleteDelegate; private BraveLeoAutocompleteDelegate mLeoAutocompleteDelegate; private @NonNull Optional mImageSupplier; @@ -71,7 +67,6 @@ public void setLeoAutocompleteDelegate(BraveLeoAutocompleteDelegate leoAutocompl @Override void initDefaultProcessors( Context context, SuggestionHost host, UrlBarEditingTextStateProvider textProvider) { - mContext = context; mUrlBarEditingTextProvider = textProvider; super.initDefaultProcessors(context, host, textProvider); if (host instanceof BraveSuggestionHost) { @@ -121,11 +116,12 @@ private int getTileNavSuggestPosition(List viewInfoList) { @Override @NonNull - List buildDropdownViewInfoList(AutocompleteResult autocompleteResult) { + List buildDropdownViewInfoList( + AutocompleteInput input, AutocompleteResult autocompleteResult) { mBraveSearchBannerProcessor.onSuggestionsReceived(); mBraveLeoSuggestionProcessor.onSuggestionsReceived(); List viewInfoList = - super.buildDropdownViewInfoList(autocompleteResult); + super.buildDropdownViewInfoList(input, autocompleteResult); // We want to show Leo auto suggestion even if the whole auto complete feature // is disabled @@ -150,7 +146,6 @@ List buildDropdownViewInfoList(AutocompleteResult autocomp && !mUrlBarEditingTextProvider.getTextWithoutAutocomplete().isEmpty()) { final PropertyModel leoModel = mBraveLeoSuggestionProcessor.createModel(); mBraveLeoSuggestionProcessor.populateModel(leoModel); - var newMatches = autocompleteResult.getSuggestionsList(); GroupConfig config; int tileNavSuggestPosition = getTileNavSuggestPosition(viewInfoList); diff --git a/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/editurl/BraveEditUrlSuggestionProcessor.java b/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/editurl/BraveEditUrlSuggestionProcessor.java index 320615ec7aee..d374c49b2e15 100644 --- a/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/editurl/BraveEditUrlSuggestionProcessor.java +++ b/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/editurl/BraveEditUrlSuggestionProcessor.java @@ -70,13 +70,11 @@ && tabMatchesSuggestion(activeTab, suggestion)) { OmniboxSuggestionType.URL_WHAT_YOU_TYPED, suggestion.getSubtypes(), suggestion.isSearchSuggestion(), - suggestion.getRelevance(), suggestion.getTransition(), suggestion.getDisplayText(), suggestion.getDisplayTextClassifications(), suggestion.getDescription(), suggestion.getDescriptionClassifications(), - suggestion.getAnswer(), /* serializedAnswerTemplate */ null, suggestion.getAnswerType().getNumber(), suggestion.getFillIntoEdit(), diff --git a/browser/ui/android/strings/android_chrome_strings.grd b/browser/ui/android/strings/android_chrome_strings.grd index 20175bc2d425..6e10ee5833be 100644 --- a/browser/ui/android/strings/android_chrome_strings.grd +++ b/browser/ui/android/strings/android_chrome_strings.grd @@ -353,18 +353,6 @@ CHAR_LIMIT guidelines: Preload Pages - - Choose whether to preload pages - - - Browsing and searching is faster - - - Brave preloads pages you're likely to visit, so that they load more quickly when you visit them - - - If you allow cookies, Brave may use them when preloading - Preload pages @@ -384,7 +372,7 @@ CHAR_LIMIT guidelines: Standard preloading:
- Some of the pages you visit are preloaded. Pages may be preloaded through Brave servers when linked from a Brave site. + Some of the pages you visit are preloaded. Pages may be preloaded through Brave servers when linked from a Brave site or app. Preloads pages that Brave thinks you are likely to visit. @@ -393,10 +381,10 @@ CHAR_LIMIT guidelines: If you allow cookies, Brave may use them for preloading. - When a Brave site asks to privately preload links on their page, Brave encrypts and preloads pages through Brave servers without cookies. This hides your identity from the preloaded site. + When a Brave site or app asks to privately preload links on their page, Brave encrypts and preloads pages through Brave servers without cookies. This hides your identity from the preloaded site. - Because the preloaded pages are encrypted, and the site linking to the pages is a Brave site, Brave servers don’t receive new information when privately preloading these pages. + Because the preloaded pages are encrypted, and the site or app linking to the pages is a Brave site or app, Brave servers don’t receive new information when privately preloading these pages. Extended preloading @@ -405,7 +393,7 @@ CHAR_LIMIT guidelines: Extended preloading: - More pages are preloaded. Pages may be preloaded through Brave servers when requested by other sites. + More pages are preloaded. Pages may be preloaded through Brave servers when requested by other sites or apps. More frequently preloads pages that Brave thinks you are likely to visit. This setting may result in increased data use. @@ -414,7 +402,7 @@ CHAR_LIMIT guidelines: If you allow cookies, Brave may use them for preloading. - When a site asks to privately preload links on their page, Brave encrypts and preloads pages through Brave servers without cookies. This hides your identity from the preloaded site. + When a site or app asks to privately preload links on their page, Brave encrypts and preloads pages through Brave servers without cookies. This hides your identity from the preloaded site. Because the preloaded pages are encrypted, Brave will not learn anything about the preloaded page content. Brave servers will learn which sites are privately preloaded. This information is only used to preload the pages, and is not linked to other information from your Brave sync chain. @@ -500,6 +488,9 @@ For more settings that use data to improve your Brave experience, go to The apps you chose will be used by default. If an app isn’t already on this device, it’ll be downloaded shortly. + + %1$sEngine is your default search engine + @@ -677,15 +668,6 @@ For more settings that use data to improve your Brave experience, go to Save passwords - - Use and save passwords in your Brave sync chain - - - When on, passwords are saved in %1$sfoo@gmail.com. When off, passwords are saved only to this device. - - - When on, passwords are saved in your account. When off, passwords are saved only to this device. - Auto Sign-in @@ -1034,6 +1016,16 @@ For more settings that use data to improve your Brave experience, go to Passwords will stop working soon because Google Play services isn’t available. To use passwords saved in your Brave sync chain, sign in using another device, or go to passwords.google.com.
+ + + Use your %1$sexample.com password? + + + <b1>%1$sexample.com</b1> and <b2>%2$sexample.com</b2> seem to be related. Make sure you trust <b3>%2$sexample.com</b3> before using your password. + + + Password used. + @@ -1534,18 +1526,6 @@ Your Brave account may have other forms of browsing history like searches and ac If you also share Brave usage reports, those reports include the URLs you visit - - From the address bar, you can open page info to see additional info about the page you're visiting - - - If you also save your bookmarks in your Brave sync chain, you can track product prices in Brave and get notified when the price drops - - - URLs you visit are sent to Brave to predict what sites you might visit next and to show you additional info about the page you're visiting - - - If you also share Brave usage reports, those reports include the URLs you visit - History sync @@ -1624,18 +1604,6 @@ Your Brave account may have other forms of browsing history like searches and ac Privacy guide explanation closed - - When you tap or type in the address bar or search box, you'll see suggestions from your default search engine. This is off in Private. - - - As you type, Brave sends the content of the address bar or search box to your default search engine - - - Depending on your settings, Brave may also send cookies, your current URL, and your location - - - When off, you’ll still see suggestions that Brave provides locally - @@ -1946,12 +1914,31 @@ Your Brave account may have other forms of browsing history like searches and ac Try again later + + To check for compromised passwords, go to Brave Password Manager + + + No weak or reused passwords + To check for compromised passwords, sign in to your Brave sync chain Recently checked passwords saved to %1$selisa.becket@gmail.com + + Strengthen your passwords + + + {NUM_PASSWORDS, plural, + =1 {Brave found a weak password that you could improve} + other {Brave found # weak passwords that you could improve}} + + + {NUM_PASSWORDS, plural, + =1 {Brave found a reused password that you could improve} + other {Brave found # reused passwords that you could improve}} + @@ -1972,6 +1959,9 @@ Your Brave account may have other forms of browsing history like searches and ac Real-time, proactive protection against dangerous sites, downloads, and extensions that’s based on your browsing data getting sent to Brave + + Real-time, AI-powered protection against dangerous sites, downloads, and extensions that's based on your browsing data getting sent to Brave + Standard protection @@ -2275,6 +2265,19 @@ Your Brave account may have other forms of browsing history like searches and ac Download page again? + + + + Choose what to share with %1$s + + + The site will be able to see the contents of your screen + + + Share + + + Open PDF? @@ -2637,6 +2640,24 @@ Your Brave account may have other forms of browsing history like searches and ac =1 {1 item is saved only to this device. To use it on your other devices, save it in your Brave sync chain, %2$selisa.g.beckett@gmail.com.} other {# items are saved only to this device. To use them on your other devices, save them in your Brave sync chain, %2$selisa.g.beckett@gmail.com.}} + + Save in account + + + {BOOKMARKS_COUNT, plural, + =1 {1 bookmark is saved only to this device. To use it on your other devices, save it in your Brave sync chain, %2$selisa.g.beckett@gmail.com.} + other {# bookmarks are saved only to this device. To use them on your other devices, save them in your Brave sync chain, %2$selisa.g.beckett@gmail.com.}} + + + {BOOKMARKS_COUNT, plural, + =1 {1 bookmark and other items are saved only to this device. To use them on your other devices, save them in your Brave sync chain, %2$selisa.g.beckett@gmail.com.} + other {# bookmarks and other items are saved only to this device. To use them on your other devices, save them in your Brave sync chain, %2$selisa.g.beckett@gmail.com.}} + + + {ITEMS_COUNT, plural, + =1 {1 item is saved only to this device. To use it on your other devices, save it in your Brave sync chain, %2$selisa.g.beckett@gmail.com.} + other {# items are saved only to this device. To use them on your other devices, save them in your Brave sync chain, %2$selisa.g.beckett@gmail.com.}} + Save data in your Brave sync chain @@ -3646,9 +3667,6 @@ To change this setting, BEGIN_LINKdelete the Brave da Make Brave your own - - Sign in to browse easier across devices - Sign in to get your bookmarks, passwords, and more on all your devices @@ -3720,9 +3738,6 @@ To change this setting, BEGIN_LINKdelete the Brave da To quickly get back to sites you’ve visited, sync your tabs and history - - Sync your passwords, history & more on all devices - Sync your bookmarks, history & more on all devices @@ -3878,9 +3893,6 @@ To change this setting, BEGIN_LINKdelete the Brave da Use Brave your way - - Sync to get your passwords, bookmarks and more on your other devices - Sync to get your bookmarks, history and more on your other devices @@ -4139,18 +4151,9 @@ To change this setting, BEGIN_LINKdelete the Brave da Restore %1$s6 tabs as new background tabs. - - Restore tab group %1$sshopping as a new background tab group. - Restore tab group %1$sshopping, color %2$sBlue, as a new background tab group. - - {TAB_COUNT, plural, - =1 {Restore tab group of %1$s1 tab as a new background tab group.} - other {Restore tab group of %1$s5 tabs as a new background tab group.} - } - {TAB_COUNT, plural, =1 {Restore tab group of %1$s1 tab, color %2$sBlue, as a new background tab group.} @@ -4225,6 +4228,9 @@ To change this setting, BEGIN_LINKdelete the Brave da Current recommendation: %1$sNew tab + + Only available for small windows + Toolbar shortcut @@ -4493,7 +4499,7 @@ To change this setting, BEGIN_LINKdelete the Brave da URL required - Bookmark save flow + Bookmark saved to %1$sMobile bookmarks Bookmark save flow opened at half height @@ -4926,7 +4932,7 @@ To change this setting, BEGIN_LINKdelete the Brave da Unnamed group - + Tab @@ -5827,98 +5833,6 @@ To change this setting, BEGIN_LINKdelete the Brave da Stack Unwinder - - Phone as a Security Key Support - - - - Brave as a Security Key - - - - Registration succeeded - - - - Registration failed - - - - Sign-in succeeded - - - - Sign-in failed - - - - Connecting to your device… - - - - This may take a minute - - - - Place your phone close to the computer - - - - Connected to device - - - - Processing request - - - - Updating Brave to connect to other devices - - - - Something went wrong - - - - Can’t connect to your computer. Try another verification option. - - - - %1$sBrave needs Nearby devices permission in order to connect to your device - - - - To use this device as a security key, set a screen lock - - - - This verification method isn’t available for this device. Pick a different option on your other device. - - - - Try another verification option - - - - (Error %1$d104) - - - - Close - - - - Your computer wants to register this device for signing in to a site - - - - Your computer wants to use this device to sign in to a site - - - - Turning on Bluetooth… - - Phone as a security key @@ -5951,30 +5865,6 @@ To change this setting, BEGIN_LINKdelete the Brave da Removed - - Connect with QR Code? - - - - You can use this phone to sign in on the device that’s displaying this QR code. - - - - You can use this tablet to sign in on the device that’s displaying this QR code. - - - - Remember this computer - - - - Allow - - - - Don’t allow - - QR Code @@ -6065,10 +5955,6 @@ To change this setting, BEGIN_LINKdelete the Brave da Including link: %1$shttps://www.example.com - - Open Settings - - chrome_qrcode_%1$s1582667748515 @@ -6220,6 +6106,11 @@ To change this setting, BEGIN_LINKdelete the Brave da Notification permission flow closed + + + Processing notification + + Get image descriptions? @@ -6314,6 +6205,16 @@ To change this setting, BEGIN_LINKdelete the Brave da To continue, %1$sidp.com will share your %2$sname and email address with this site. See this site's <link_privacy_policy>privacy policy</link_privacy_policy> and <link_terms_of_service>terms of service</link_terms_of_service>. + + Sign in + + + Sign in to get your passwords and more on all your devices + + + Sign in to Brave + + Continue as %1$sAlbus (or Albus Dumbledore) @@ -6338,6 +6239,15 @@ To change this setting, BEGIN_LINKdelete the Brave da Got it + + More details + + + Choose "More details" below to get more information from %1$sidp.example. + + + If this issue keeps happening, choose "More details" below to get more information from %1$sidp.example. + Can't continue with %1$sidp.example @@ -6774,6 +6684,15 @@ To change this setting, BEGIN_LINKdelete the Brave da Manage + + New activity + + + Added + + + Changed + @@ -6828,6 +6747,9 @@ To change this setting, BEGIN_LINKdelete the Brave da Search your Private tabs + + Back + diff --git a/browser/ui/android/strings/android_chrome_strings_override.grd b/browser/ui/android/strings/android_chrome_strings_override.grd index 99a041d19c6a..4aa05c52769c 100644 --- a/browser/ui/android/strings/android_chrome_strings_override.grd +++ b/browser/ui/android/strings/android_chrome_strings_override.grd @@ -132,15 +132,15 @@ CHAR_LIMIT guidelines: While in Private, sites can’t use your cookies to see your browsing activity across different sites, for example, to personalize ads. Features on some sites may break. - - When you tap or type in the address bar or search box, you'll see suggestions from your default search engine. This is off in Private. - Brave Private Private mode keeps your browsing private from others who use your device + + + Private tabs @@ -284,7 +284,6 @@ CHAR_LIMIT guidelines: Search your Private tabs - diff --git a/browser/ui/brave_browser_command_controller_browsertest.cc b/browser/ui/brave_browser_command_controller_browsertest.cc index 52db6a8750ea..72284fa2de5c 100644 --- a/browser/ui/brave_browser_command_controller_browsertest.cc +++ b/browser/ui/brave_browser_command_controller_browsertest.cc @@ -9,6 +9,7 @@ #include #include "base/functional/callback_helpers.h" +#include "base/test/run_until.h" #include "base/test/scoped_feature_list.h" #include "brave/app/brave_command_ids.h" #include "brave/browser/ui/browser_commands.h" @@ -56,7 +57,6 @@ #include "chrome/browser/ui/views/side_panel/side_panel_entry_id.h" #include "chrome/browser/ui/views/side_panel/side_panel_entry_key.h" #include "chrome/browser/ui/views/side_panel/side_panel_enums.h" -#include "chrome/browser/ui/views/side_panel/side_panel_test_utils.h" #include "chrome/browser/ui/views/side_panel/side_panel_ui.h" #endif @@ -175,6 +175,15 @@ class BraveBrowserCommandControllerTest : public InProcessBrowserTest { } #endif +#if defined(TOOLKIT_VIEWS) + void WaitForSidePanelClose() { + ASSERT_TRUE(base::test::RunUntil([&]() { + return browser()->GetBrowserView().unified_side_panel()->state() == + SidePanel::State::kClosed; + })); + } +#endif // #if defined(TOOLKIT_VIEWS) + private: policy::MockConfigurationPolicyProvider provider_; base::test::ScopedFeatureList scoped_feature_list_; @@ -439,7 +448,10 @@ IN_PROC_BROWSER_TEST_F(BraveBrowserCommandControllerTest, SidePanelEntry::Key(SidePanelEntryId::kChatUI); auto* side_panel_coordinator = browser()->GetFeatures().side_panel_coordinator(); - auto side_panel_waiter = SidePanelWaiter(side_panel_coordinator); + ASSERT_TRUE(base::test::RunUntil([&]() { + return browser()->GetBrowserView().unified_side_panel()->state() == + SidePanel::State::kClosed; + })); // initially no panel is showing EXPECT_FALSE(side_panel_coordinator->IsSidePanelEntryShowing(ai_chat_key)); @@ -450,7 +462,7 @@ IN_PROC_BROWSER_TEST_F(BraveBrowserCommandControllerTest, EXPECT_TRUE(side_panel_coordinator->IsSidePanelEntryShowing(ai_chat_key)); // after command again, no panel is showing browser()->command_controller()->ExecuteCommand(IDC_TOGGLE_AI_CHAT); - side_panel_waiter.WaitForSidePanelClose(); + WaitForSidePanelClose(); EXPECT_FALSE(side_panel_coordinator->IsSidePanelEntryShowing(ai_chat_key)); EXPECT_FALSE(side_panel_coordinator->IsSidePanelShowing()); @@ -465,7 +477,7 @@ IN_PROC_BROWSER_TEST_F(BraveBrowserCommandControllerTest, EXPECT_TRUE(side_panel_coordinator->IsSidePanelEntryShowing(ai_chat_key)); // after command again, no panel is showing browser()->command_controller()->ExecuteCommand(IDC_TOGGLE_AI_CHAT); - side_panel_waiter.WaitForSidePanelClose(); + WaitForSidePanelClose(); EXPECT_FALSE(side_panel_coordinator->IsSidePanelEntryShowing(ai_chat_key)); EXPECT_FALSE(side_panel_coordinator->IsSidePanelShowing()); } diff --git a/browser/ui/brave_icon_with_badge_image_source.cc b/browser/ui/brave_icon_with_badge_image_source.cc index c930c7c5b7ad..f7194c44d43c 100644 --- a/browser/ui/brave_icon_with_badge_image_source.cc +++ b/browser/ui/brave_icon_with_badge_image_source.cc @@ -34,9 +34,6 @@ constexpr int kMaxIncrementAttempts = 5; namespace brave { -const SkColor kBadgeNotificationBG = SkColorSetRGB(0xfb, 0x54, 0x2b); -const SkColor kBadgeTextColor = SK_ColorWHITE; - BraveIconWithBadgeImageSource::BraveIconWithBadgeImageSource( const gfx::Size& size, GetColorProviderCallback get_color_provider_callback, diff --git a/browser/ui/brave_icon_with_badge_image_source.h b/browser/ui/brave_icon_with_badge_image_source.h index 6f304c23fa7b..dca9a658cd0e 100644 --- a/browser/ui/brave_icon_with_badge_image_source.h +++ b/browser/ui/brave_icon_with_badge_image_source.h @@ -9,6 +9,7 @@ #include #include "chrome/browser/ui/extensions/icon_with_badge_image_source.h" +#include "third_party/skia/include/core/SkColor.h" namespace gfx { class Canvas; @@ -17,8 +18,8 @@ class Rect; namespace brave { -extern const SkColor kBadgeNotificationBG; -extern const SkColor kBadgeTextColor; +inline constexpr SkColor kBadgeNotificationBG = SkColorSetRGB(0xfb, 0x54, 0x2b); +inline constexpr SkColor kBadgeTextColor = SK_ColorWHITE; // The purpose of this subclass is to: // - Paint the BraveAction badge in a custom location and with a different size diff --git a/browser/ui/browser_commands.cc b/browser/ui/browser_commands.cc index a9b899fca658..13d756067dc0 100644 --- a/browser/ui/browser_commands.cc +++ b/browser/ui/browser_commands.cc @@ -222,7 +222,9 @@ void OpenBraveVPNUrls(Browser* browser, int command_id) { brave_vpn::GetManageUrl(vpn_service->GetCurrentEnvironment()); break; default: - NOTREACHED_IN_MIGRATION(); + NOTREACHED() << "This should only be called with one of the above VPN " + "commands. (was " + << command_id << ")"; } chrome::AddTabAt(browser, GURL(target_url), -1, true); diff --git a/browser/ui/commander/fuzzy_finder.cc b/browser/ui/commander/fuzzy_finder.cc index 9758a9ff653c..fd3a84c5519d 100644 --- a/browser/ui/commander/fuzzy_finder.cc +++ b/browser/ui/commander/fuzzy_finder.cc @@ -22,19 +22,19 @@ namespace { // Used only for exact matches. -static const double kMaxScore = 1.0; +constexpr double kMaxScore = 1.0; // When needle is a prefix of haystack. -static const double kPrefixScore = .99; +constexpr double kPrefixScore = .99; // When a heuristic determines that the match should score highly, // but it is *not* an exact match or prefix. -static const double kVeryHighScore = .95; +constexpr double kVeryHighScore = .95; // Max haystack size in UTF-16 units for the dynamic programming algorithm. // Haystacks longer than this are scored by ConsecutiveMatchWithGaps. -static constexpr size_t kMaxHaystack = 1024; +constexpr size_t kMaxHaystack = 1024; // Max needle size in UTF-16 units for the dynamic programming algorithm. // Needles longer than this are scored by ConsecutiveMatchWithGaps -static constexpr size_t kMaxNeedle = 16; +constexpr size_t kMaxNeedle = 16; struct MatchRecord { MatchRecord(int start, int end, int length, bool is_boundary, int gap_before) @@ -58,9 +58,9 @@ double ScoreForMatches(const std::vector& matches, // |base_score| is the maximum per match, so total should not exceed 1.0. const double base_score = 1.0 / needle_size; const double gap_penalty = 1.0 / haystack_size; - static const double kRegularMultiplier = .5; - static const double kWordBoundaryMultiplier = .8; - static const double kInitialMultiplier = 1.0; + static constexpr double kRegularMultiplier = .5; + static constexpr double kWordBoundaryMultiplier = .8; + static constexpr double kInitialMultiplier = 1.0; double score = 0; for (size_t i = 0; i < matches.size(); i++) { diff --git a/browser/ui/playlist/playlist_dialogs.cc b/browser/ui/playlist/playlist_dialogs.cc index 184300827df9..545ef3c12a05 100644 --- a/browser/ui/playlist/playlist_dialogs.cc +++ b/browser/ui/playlist/playlist_dialogs.cc @@ -12,30 +12,30 @@ namespace playlist { #if !defined(TOOLKIT_VIEWS) void ShowCreatePlaylistDialog(content::WebContents* web_contents) { - NOTREACHED_NORETURN(); + NOTREACHED(); } void ShowRemovePlaylistDialog(content::WebContents* web_contents, const std::string& playlist_id) { - NOTREACHED_NORETURN(); + NOTREACHED(); } void ShowMoveItemsDialog(content::WebContents* contents, const std::string& playlist_id, const std::vector& items) { - NOTREACHED_NORETURN(); + NOTREACHED(); } void ShowPlaylistSettings() { - NOTREACHED_NORETURN(); + NOTREACHED(); } void ClosePanel() { - NOTREACHED_NORETURN(); + NOTREACHED(); } void ShowPlaylistAddBubble(content::WebContents* contents) { - NOTREACHED_NORETURN(); + NOTREACHED(); } // #else functions are defined in playlist_action_dialogs.cc diff --git a/browser/ui/sidebar/sidebar_utils.cc b/browser/ui/sidebar/sidebar_utils.cc index 58af87379838..0a845db3b752 100644 --- a/browser/ui/sidebar/sidebar_utils.cc +++ b/browser/ui/sidebar/sidebar_utils.cc @@ -144,9 +144,8 @@ SidePanelEntryId SidePanelIdFromSideBarItemType(BuiltInItemType type) { break; } - NOTREACHED_NORETURN() - << "Asked for a panel Id from a sidebar item which could " - "not have a panel Id."; + NOTREACHED() << "Asked for a panel Id from a sidebar item which could " + "not have a panel Id."; } std::optional BuiltInItemTypeFromSidePanelId( diff --git a/browser/ui/tabs/shared_pinned_tab_service.cc b/browser/ui/tabs/shared_pinned_tab_service.cc index 9c6b75c94a52..aaf76b2171c9 100644 --- a/browser/ui/tabs/shared_pinned_tab_service.cc +++ b/browser/ui/tabs/shared_pinned_tab_service.cc @@ -22,6 +22,7 @@ #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/tabs/tab_enums.h" #include "chrome/browser/ui/tabs/tab_model.h" +#include "chrome/browser/ui/webui/webui_embedding_context.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/navigation_handle.h" #include "content/public/browser/web_contents_observer.h" @@ -236,39 +237,7 @@ SharedPinnedTabService::GetTabRendererDataForDummyContents( } } - NOTREACHED_NORETURN(); -} - -void SharedPinnedTabService::CacheWebContentsIfNeeded( - Browser* browser, - std::vector> pinned_tabs) { - DVLOG(2) << __FUNCTION__; - DCHECK(!profile_will_be_destroyed_); - - // Caches shared contents from closing browser so that we can extend the - // lifetime of the contents. - if (!base::Contains(closing_browsers_, browser)) { - return; - } - - // Check if there's any browser can host web contents. - if (browsers_.empty()) { - return; - } - - for (auto& pinned_tab : pinned_tabs) { - if (!pinned_tab->contents()) { - // Could be already cached by another component. - continue; - } - - if (!SharedContentsData::FromWebContents(pinned_tab->contents())) { - continue; - } - - cached_shared_contentses_from_closing_browser_.insert( - tabs::TabModel::DestroyAndTakeWebContents(std::move(pinned_tab))); - } + NOTREACHED(); } void SharedPinnedTabService::Shutdown() { @@ -357,13 +326,19 @@ void SharedPinnedTabService::OnBrowserClosing(Browser* browser) { } } } else { + CHECK(!profile_will_be_destroyed_); + // Try caching shared contents from the closing browser. auto* tab_strip_model = browser->tab_strip_model(); - std::vector> pinned_tabs; for (int i = tab_strip_model->IndexOfFirstNonPinnedTab() - 1; i >= 0; --i) { - pinned_tabs.push_back(tab_strip_model->DetachTabAtForInsertion(i)); + auto* web_contents = tab_strip_model->GetWebContentsAt(i); + if (!web_contents || !SharedContentsData::FromWebContents(web_contents)) { + continue; + } + + cached_shared_contentses_from_closing_browser_.insert( + tab_strip_model->DetachWebContentsAtForInsertion(i)); } - CacheWebContentsIfNeeded(browser, std::move(pinned_tabs)); for (auto& pinned_tab_data : pinned_tab_data_) { if (pinned_tab_data.contents_owner_model == browser->tab_strip_model()) { @@ -846,8 +821,12 @@ void SharedPinnedTabService::MoveSharedWebContentsToBrowser( DCHECK(dummy_contents_data); dummy_contents_data->stop_propagation(); - pinned_tab_data.contents_owner_model->DiscardWebContentsAt( - index, std::move(unique_shared_contents)); + auto discarded_content = + pinned_tab_data.contents_owner_model->DiscardWebContentsAt( + index, std::move(unique_shared_contents)); + // Need to clear tab interface before it's gone. Otherwise, + // EmbeddingTabTracker will have dangling pointer to TabInterface. + webui::SetTabInterface(discarded_content.get(), nullptr); } else { // Restore a shared pinned tab from a closed browser. auto iter = diff --git a/browser/ui/tabs/shared_pinned_tab_service.h b/browser/ui/tabs/shared_pinned_tab_service.h index a97a031d2c8d..07ae5d5d5b31 100644 --- a/browser/ui/tabs/shared_pinned_tab_service.h +++ b/browser/ui/tabs/shared_pinned_tab_service.h @@ -84,10 +84,6 @@ class SharedPinnedTabService : public KeyedService, void OnProfileWillBeDestroyed(Profile* profile) override; private: - void CacheWebContentsIfNeeded( - Browser* browser, - std::vector> pinned_tabs); - void OnTabAdded(TabStripModel* tab_strip_model, const TabStripModelChange::Insert* insert); void OnTabMoved(TabStripModel* tab_strip_model, diff --git a/browser/ui/tabs/split_view_browser_data.cc b/browser/ui/tabs/split_view_browser_data.cc index 6df51a3e1e05..d590c638ff0a 100644 --- a/browser/ui/tabs/split_view_browser_data.cc +++ b/browser/ui/tabs/split_view_browser_data.cc @@ -76,7 +76,7 @@ void SplitViewBrowserData::BreakTile(const tabs::TabHandle& tab) { observer.OnDidBreakTile(tile_to_break); } } else { - NOTREACHED_IN_MIGRATION() << "Tile doesn't exist"; + NOTREACHED() << "Tried to break tile which doesn't exist"; } } diff --git a/browser/ui/tabs/split_view_tab_strip_model_adapter.cc b/browser/ui/tabs/split_view_tab_strip_model_adapter.cc index 50e0ce039761..2f6671431248 100644 --- a/browser/ui/tabs/split_view_tab_strip_model_adapter.cc +++ b/browser/ui/tabs/split_view_tab_strip_model_adapter.cc @@ -278,7 +278,7 @@ void SplitViewTabStripModelAdapter::TabPinnedStateChanged( void SplitViewTabStripModelAdapter::TabGroupedStateChanged( std::optional group, - tabs::TabModel* tab, + tabs::TabInterface* tab, int index) { if (!model_->ContainsIndex(index)) { return; diff --git a/browser/ui/tabs/split_view_tab_strip_model_adapter.h b/browser/ui/tabs/split_view_tab_strip_model_adapter.h index 7a5bd783a764..982d5aeae84a 100644 --- a/browser/ui/tabs/split_view_tab_strip_model_adapter.h +++ b/browser/ui/tabs/split_view_tab_strip_model_adapter.h @@ -46,7 +46,7 @@ class SplitViewTabStripModelAdapter : public TabStripModelObserver { content::WebContents* contents, int index) override; void TabGroupedStateChanged(std::optional group, - tabs::TabModel* tab, + tabs::TabInterface* tab, int index) override; private: diff --git a/browser/ui/toolbar/BUILD.gn b/browser/ui/toolbar/BUILD.gn index b36ee0bbfc46..099a26446423 100644 --- a/browser/ui/toolbar/BUILD.gn +++ b/browser/ui/toolbar/BUILD.gn @@ -15,38 +15,57 @@ source_set("brave_app_menu_unit_test") { "//testing/gtest", ] - sources = [ - "//chrome/browser/ui/tabs/recent_tabs_builder_test_helper.cc", - "//chrome/browser/ui/tabs/recent_tabs_builder_test_helper.h", - "//chrome/browser/ui/tabs/recent_tabs_sub_menu_model_unittest.cc", - "//chrome/test/base/browser_with_test_window_test.cc", - "//chrome/test/base/browser_with_test_window_test.h", - "//chrome/test/base/menu_model_test.cc", - "//chrome/test/base/menu_model_test.h", - ] - deps = [ "//brave/app:brave_generated_resources_grit_grit", "//brave/app:generate_command_metadata", - "//build:chromeos_buildflags", "//chrome/app:command_ids", + "//chrome/browser:browser_process", "//chrome/browser/sync", - "//chrome/browser/ui:browser_navigator_params_headers", - "//chrome/browser/ui:ui", "//chrome/test:test_support", "//components/constrained_window:constrained_window", - "//components/sessions:test_support", "//components/sync_preferences:sync_preferences", "//components/sync_sessions:sync_sessions", - "//components/tab_groups:tab_groups", - "//content/test:test_support", "//ui/views:test_support", ] if (enable_brave_vpn) { - sources += [ "//brave/browser/ui/toolbar/brave_vpn_menu_model_unittest.cc" ] + sources = [ "//brave/browser/ui/toolbar/brave_vpn_menu_model_unittest.cc" ] deps += [ "//base", "//brave/components/brave_vpn/common", ] } } + +source_set("brave_app_menu_browser_tests") { + testonly = true + defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ] + + sources = [ + "//chrome/browser/ui/tabs/recent_tabs_builder_test_helper.cc", + "//chrome/browser/ui/tabs/recent_tabs_builder_test_helper.h", + "//chrome/browser/ui/tabs/recent_tabs_sub_menu_model_browsertest.cc", + "//chrome/test/base/browser_with_test_window_test.cc", + "//chrome/test/base/browser_with_test_window_test.h", + "//chrome/test/base/menu_model_test.cc", + "//chrome/test/base/menu_model_test.h", + ] + + deps = [ + "//chrome/browser", + "//chrome/browser:browser_process", + "//chrome/browser/sync", + "//chrome/browser/ui:browser_navigator_params_headers", + "//chrome/browser/ui/browser_window", + "//chrome/test:test_support", + "//chrome/test:test_support_ui", + "//components/constrained_window", + "//components/sessions:test_support", + "//components/sync:test_support", + "//components/variations:test_support", + "//content/test:test_support", + "//net:test_support", + "//testing/gmock", + "//testing/gtest", + "//ui/views:test_support", + ] +} diff --git a/browser/ui/toolbar/app_menu_icons.cc b/browser/ui/toolbar/app_menu_icons.cc index 77c0c30f035a..ee4dd4d383d6 100644 --- a/browser/ui/toolbar/app_menu_icons.cc +++ b/browser/ui/toolbar/app_menu_icons.cc @@ -12,9 +12,9 @@ #include "brave/components/vector_icons/vector_icons.h" #include "chrome/app/chrome_command_ids.h" #include "ui/base/models/image_model.h" -#include "ui/base/models/simple_menu_model.h" #include "ui/color/color_id.h" #include "ui/gfx/vector_icon_types.h" +#include "ui/menus/simple_menu_model.h" namespace { diff --git a/browser/ui/toolbar/bookmark_bar_sub_menu_model.cc b/browser/ui/toolbar/bookmark_bar_sub_menu_model.cc index d6cdacfe6ac2..f536f9d18eba 100644 --- a/browser/ui/toolbar/bookmark_bar_sub_menu_model.cc +++ b/browser/ui/toolbar/bookmark_bar_sub_menu_model.cc @@ -10,7 +10,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/grit/generated_resources.h" #include "components/prefs/pref_service.h" -#include "ui/base/models/simple_menu_model.h" +#include "ui/menus/simple_menu_model.h" BookmarkBarSubMenuModel::BookmarkBarSubMenuModel(Profile* profile) : SimpleMenuModel(this), profile_(profile) { diff --git a/browser/ui/toolbar/bookmark_bar_sub_menu_model.h b/browser/ui/toolbar/bookmark_bar_sub_menu_model.h index 6bdc66f5d773..cd13af8cb6b6 100644 --- a/browser/ui/toolbar/bookmark_bar_sub_menu_model.h +++ b/browser/ui/toolbar/bookmark_bar_sub_menu_model.h @@ -7,7 +7,7 @@ #define BRAVE_BROWSER_UI_TOOLBAR_BOOKMARK_BAR_SUB_MENU_MODEL_H_ #include "base/memory/raw_ptr.h" -#include "ui/base/models/simple_menu_model.h" +#include "ui/menus/simple_menu_model.h" class Profile; diff --git a/browser/ui/toolbar/brave_app_menu_model.cc b/browser/ui/toolbar/brave_app_menu_model.cc index 0c4dae8d717e..831bce3892f7 100644 --- a/browser/ui/toolbar/brave_app_menu_model.cc +++ b/browser/ui/toolbar/brave_app_menu_model.cc @@ -85,7 +85,7 @@ BraveAppMenuModel::ConvertIDCToSidebarShowOptions(int id) { default: break; } - NOTREACHED_NORETURN(); + NOTREACHED(); } #endif // defined(TOOLKIT_VIEWS) @@ -353,6 +353,12 @@ void BraveAppMenuModel::RemoveUpstreamMenus() { RemoveItemAt(*index); } + // Remove upstream's "Tab groups" menu item, as this functionality is already + // available in multiple other places + if (const auto index = GetIndexOfCommandId(IDC_SAVED_TAB_GROUPS_MENU)) { + RemoveItemAt(*index); + } + // Remove upstream's dev tools menu and associated separator. // It'll be changed its position in more tools. if (const auto index = more_tools_model->GetIndexOfCommandId(IDC_DEV_TOOLS)) { @@ -452,8 +458,6 @@ std::optional BraveAppMenuModel::GetProperItemIndex( } } - NOTREACHED_IN_MIGRATION() - << "At least, a menu item for this command should exist: " - << commands_to_check[commands_size - 1]; - return std::nullopt; + NOTREACHED() << "At least, a menu item for this command should exist: " + << commands_to_check[commands_size - 1]; } diff --git a/browser/ui/toolbar/brave_app_menu_model.h b/browser/ui/toolbar/brave_app_menu_model.h index 4ca756d530f4..d61862c7e519 100644 --- a/browser/ui/toolbar/brave_app_menu_model.h +++ b/browser/ui/toolbar/brave_app_menu_model.h @@ -15,7 +15,7 @@ #include "base/gtest_prod_util.h" #include "brave/components/brave_vpn/common/buildflags/buildflags.h" #include "chrome/browser/ui/toolbar/app_menu_model.h" -#include "ui/base/models/simple_menu_model.h" +#include "ui/menus/simple_menu_model.h" #if defined(TOOLKIT_VIEWS) #include "brave/components/sidebar/browser/sidebar_service.h" diff --git a/browser/ui/toolbar/brave_app_menu_model_browsertest.cc b/browser/ui/toolbar/brave_app_menu_model_browsertest.cc index 2361222f3a2f..58a154be3c57 100644 --- a/browser/ui/toolbar/brave_app_menu_model_browsertest.cc +++ b/browser/ui/toolbar/brave_app_menu_model_browsertest.cc @@ -192,6 +192,7 @@ IN_PROC_BROWSER_TEST_F(BraveAppMenuModelBrowserTest, MenuOrderTest) { std::vector commands_disabled_for_normal_profile = { IDC_NEW_TOR_CONNECTION_FOR_SITE, + IDC_SAVED_TAB_GROUPS_MENU, }; CheckCommandsAreInOrderInMenuModel(browser(), commands_in_order_for_normal_profile); diff --git a/browser/ui/toolbar/brave_vpn_menu_model.h b/browser/ui/toolbar/brave_vpn_menu_model.h index 078e85409a67..aa1fe4b42e20 100644 --- a/browser/ui/toolbar/brave_vpn_menu_model.h +++ b/browser/ui/toolbar/brave_vpn_menu_model.h @@ -9,7 +9,7 @@ #include #include "base/memory/raw_ptr.h" -#include "ui/base/models/simple_menu_model.h" +#include "ui/menus/simple_menu_model.h" class Browser; class PrefService; diff --git a/browser/ui/toolbar/brave_vpn_menu_model_unittest.cc b/browser/ui/toolbar/brave_vpn_menu_model_unittest.cc index ae500fa8c023..440c08a61599 100644 --- a/browser/ui/toolbar/brave_vpn_menu_model_unittest.cc +++ b/browser/ui/toolbar/brave_vpn_menu_model_unittest.cc @@ -20,7 +20,7 @@ #include "components/sync_preferences/testing_pref_service_syncable.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/base/models/simple_menu_model.h" +#include "ui/menus/simple_menu_model.h" class BraveVPNMenuModelUnitTest : public testing::Test { public: diff --git a/browser/ui/views/bookmarks/bookmark_bar_instructions_view.cc b/browser/ui/views/bookmarks/bookmark_bar_instructions_view.cc index e4dbf7439c3c..e5aa4196b64c 100644 --- a/browser/ui/views/bookmarks/bookmark_bar_instructions_view.cc +++ b/browser/ui/views/bookmarks/bookmark_bar_instructions_view.cc @@ -111,7 +111,7 @@ void BookmarkBarInstructionsView::LinkClicked() { void BookmarkBarInstructionsView::ShowContextMenuForViewImpl( views::View* source, const gfx::Point& point, - ui::MenuSourceType source_type) { + ui::mojom::MenuSourceType source_type) { // Do nothing here, we don't want to show the Bookmarks context menu when // the user right clicks on the "Import bookmarks now" link. } diff --git a/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h b/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h index 7e996385b53f..52a08a73fbcf 100644 --- a/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h +++ b/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h @@ -42,9 +42,10 @@ class BookmarkBarInstructionsView : public views::View, void GetAccessibleNodeData(ui::AXNodeData* node_data) override; // views::ContextMenuController: - void ShowContextMenuForViewImpl(views::View* source, - const gfx::Point& point, - ui::MenuSourceType source_type) override; + void ShowContextMenuForViewImpl( + views::View* source, + const gfx::Point& point, + ui::mojom::MenuSourceType source_type) override; void UpdateColors(); void LinkClicked(); diff --git a/browser/ui/views/brave_actions/brave_actions_container.cc b/browser/ui/views/brave_actions/brave_actions_container.cc index dfbdc4bb5a32..b8fe4836664f 100644 --- a/browser/ui/views/brave_actions/brave_actions_container.cc +++ b/browser/ui/views/brave_actions/brave_actions_container.cc @@ -23,8 +23,10 @@ #include "ui/views/layout/box_layout.h" #include "ui/views/view.h" -BraveActionsContainer::BraveActionsContainer(Browser* browser, Profile* profile) - : browser_(browser) {} +BraveActionsContainer::BraveActionsContainer( + BrowserWindowInterface* browser_window_interface, + Profile* profile) + : browser_window_interface_(browser_window_interface) {} BraveActionsContainer::~BraveActionsContainer() = default; @@ -59,31 +61,32 @@ void BraveActionsContainer::Init() { // React to Brave Rewards preferences changes. show_brave_rewards_button_.Init( brave_rewards::prefs::kShowLocationBarButton, - browser_->profile()->GetPrefs(), + browser_window_interface_->GetProfile()->GetPrefs(), base::BindRepeating( &BraveActionsContainer::OnBraveRewardsPreferencesChanged, base::Unretained(this))); } bool BraveActionsContainer::ShouldShowBraveRewardsAction() const { - if (!brave_rewards::IsSupportedForProfile(browser_->profile())) { + if (!brave_rewards::IsSupportedForProfile( + browser_window_interface_->GetProfile())) { return false; } - const PrefService* prefs = browser_->profile()->GetPrefs(); + const PrefService* prefs = + browser_window_interface_->GetProfile()->GetPrefs(); return prefs->GetBoolean(brave_rewards::prefs::kShowLocationBarButton); } void BraveActionsContainer::AddActionViewForShields() { - shields_action_btn_ = - AddChildViewAt(std::make_unique( - *browser_->profile(), *browser_->tab_strip_model()), - 1); + shields_action_btn_ = AddChildViewAt( + std::make_unique(browser_window_interface_), 1); shields_action_btn_->SetPreferredSize(GetActionSize()); shields_action_btn_->Init(); } void BraveActionsContainer::AddActionViewForRewards() { - auto button = std::make_unique(browser_); + auto button = + std::make_unique(browser_window_interface_); rewards_action_btn_ = AddChildViewAt(std::move(button), 2); rewards_action_btn_->SetPreferredSize(GetActionSize()); rewards_action_btn_->SetVisible(ShouldShowBraveRewardsAction()); diff --git a/browser/ui/views/brave_actions/brave_actions_container.h b/browser/ui/views/brave_actions/brave_actions_container.h index 3cdd10a3d084..59c1b21f49d7 100644 --- a/browser/ui/views/brave_actions/brave_actions_container.h +++ b/browser/ui/views/brave_actions/brave_actions_container.h @@ -35,7 +35,8 @@ class BraveActionsContainer : public views::View { METADATA_HEADER(BraveActionsContainer, views::View) public: - BraveActionsContainer(Browser* browser, Profile* profile); + BraveActionsContainer(BrowserWindowInterface* browser_window_interface, + Profile* profile); BraveActionsContainer(const BraveActionsContainer&) = delete; BraveActionsContainer& operator=(const BraveActionsContainer&) = delete; @@ -71,7 +72,7 @@ class BraveActionsContainer : public views::View { // The Browser this LocationBarView is in. Note that at least // chromeos::SimpleWebViewDialog uses a LocationBarView outside any browser // window, so this may be NULL. - raw_ptr browser_ = nullptr; + raw_ptr browser_window_interface_ = nullptr; raw_ptr shields_action_btn_ = nullptr; raw_ptr rewards_action_btn_ = nullptr; 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 04efbab06b54..cc1624809d53 100644 --- a/browser/ui/views/brave_actions/brave_rewards_action_view.cc +++ b/browser/ui/views/brave_actions/brave_rewards_action_view.cc @@ -35,7 +35,6 @@ #include "components/prefs/pref_service.h" #include "extensions/common/constants.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" #include "ui/gfx/geometry/rect.h" @@ -43,6 +42,7 @@ #include "ui/gfx/image/image_skia.h" #include "ui/gfx/paint_vector_icon.h" #include "ui/gfx/skia_util.h" +#include "ui/menus/simple_menu_model.h" #include "ui/views/animation/ink_drop_impl.h" #include "ui/views/controls/button/label_button_border.h" #include "ui/views/controls/button/menu_button_controller.h" @@ -176,31 +176,32 @@ class RewardsActionMenuModel : public ui::SimpleMenuModel, std::unique_ptr CreateBubbleManager( views::View* anchor_view, - Profile* profile) { + BrowserWindowInterface* browser_window_interface) { if (base::FeatureList::IsEnabled( brave_rewards::features::kNewRewardsUIFeature)) { return WebUIBubbleManager::Create( - anchor_view, profile, GURL(kRewardsPageTopURL), + anchor_view, browser_window_interface, GURL(kRewardsPageTopURL), IDS_BRAVE_UI_BRAVE_REWARDS); } return WebUIBubbleManager::Create( - anchor_view, profile, GURL(kBraveRewardsPanelURL), + anchor_view, browser_window_interface, GURL(kBraveRewardsPanelURL), IDS_BRAVE_UI_BRAVE_REWARDS); } } // namespace -BraveRewardsActionView::BraveRewardsActionView(Browser* browser) +BraveRewardsActionView::BraveRewardsActionView( + BrowserWindowInterface* browser_window_interface) : ToolbarButton( base::BindRepeating(&BraveRewardsActionView::OnButtonPressed, base::Unretained(this)), std::make_unique( - browser->profile()->GetPrefs()), + browser_window_interface->GetProfile()->GetPrefs()), nullptr, false), - browser_(browser), - bubble_manager_(CreateBubbleManager(this, browser->profile())) { - DCHECK(browser_); + browser_window_interface_(browser_window_interface), + bubble_manager_(CreateBubbleManager(this, browser_window_interface)) { + DCHECK(browser_window_interface_); SetButtonController(std::make_unique( this, @@ -213,7 +214,7 @@ BraveRewardsActionView::BraveRewardsActionView(Browser* browser) SetAccessibleName( brave_l10n::GetLocalizedResourceUTF16String(IDS_BRAVE_UI_BRAVE_REWARDS)); - auto* profile = browser_->profile(); + auto* profile = browser_window_interface_->GetProfile(); pref_change_registrar_.Init(profile->GetPrefs()); pref_change_registrar_.Add( @@ -229,7 +230,7 @@ BraveRewardsActionView::BraveRewardsActionView(Browser* browser) base::BindRepeating(&BraveRewardsActionView::OnPreferencesChanged, base::Unretained(this))); - browser_->tab_strip_model()->AddObserver(this); + browser_window_interface_->GetTabStripModel()->AddObserver(this); if (auto* rewards_service = GetRewardsService()) { rewards_service_observation_.Observe(rewards_service); @@ -239,7 +240,8 @@ BraveRewardsActionView::BraveRewardsActionView(Browser* browser) notification_service_observation_.Observe(notification_service); } - panel_coordinator_ = RewardsPanelCoordinator::FromBrowser(browser_); + panel_coordinator_ = RewardsPanelCoordinator::FromBrowser( + browser_window_interface_->GetBrowserForMigrationOnly()); if (panel_coordinator_) { panel_observation_.Observe(panel_coordinator_); } @@ -280,7 +282,8 @@ gfx::Rect BraveRewardsActionView::GetAnchorBoundsInScreen() const { if (!GetVisible()) { // If the button is currently hidden, then anchor the bubble to the // location bar instead. - auto* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); + auto* browser_view = BrowserView::GetBrowserViewForBrowser( + browser_window_interface_->GetBrowserForMigrationOnly()); DCHECK(browser_view); return browser_view->GetLocationBarView()->GetAnchorBoundsInScreen(); } @@ -393,11 +396,12 @@ void BraveRewardsActionView::OnPreferencesChanged(const std::string& key) { } content::WebContents* BraveRewardsActionView::GetActiveWebContents() { - return browser_->tab_strip_model()->GetActiveWebContents(); + return browser_window_interface_->GetTabStripModel()->GetActiveWebContents(); } brave_rewards::RewardsService* BraveRewardsActionView::GetRewardsService() { - return RewardsServiceFactory::GetForProfile(browser_->profile()); + return RewardsServiceFactory::GetForProfile( + browser_window_interface_->GetProfile()); } brave_rewards::RewardsNotificationService* @@ -420,7 +424,7 @@ void BraveRewardsActionView::ToggleRewardsPanel() { } // Clear the default-on-start badge text when the user opens the panel. - auto* prefs = browser_->profile()->GetPrefs(); + auto* prefs = browser_window_interface_->GetProfile()->GetPrefs(); prefs->SetString(brave_rewards::prefs::kBadgeText, ""); bubble_manager_->ShowBubble(); @@ -439,8 +443,9 @@ gfx::ImageSkia BraveRewardsActionView::GetRewardsIcon() { std::pair BraveRewardsActionView::GetBadgeTextAndBackground() { // 1. Display the default-on-start Rewards badge text, if specified. - std::string text_pref = browser_->profile()->GetPrefs()->GetString( - brave_rewards::prefs::kBadgeText); + std::string text_pref = + browser_window_interface_->GetProfile()->GetPrefs()->GetString( + brave_rewards::prefs::kBadgeText); if (!text_pref.empty()) { return {text_pref, brave::kBadgeNotificationBG}; } @@ -471,7 +476,7 @@ size_t BraveRewardsActionView::GetRewardsNotificationCount() { // Increment the notification count if the user has enabled Rewards but has // not declared a country. - auto* prefs = browser_->profile()->GetPrefs(); + auto* prefs = browser_window_interface_->GetProfile()->GetPrefs(); if (prefs->GetBoolean(brave_rewards::prefs::kEnabled) && prefs->GetString(brave_rewards::prefs::kDeclaredGeo).empty()) { ++count; 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 27de19989359..5a29a1ca80e8 100644 --- a/browser/ui/views/brave_actions/brave_rewards_action_view.h +++ b/browser/ui/views/brave_actions/brave_rewards_action_view.h @@ -41,7 +41,8 @@ class BraveRewardsActionView public brave_rewards::RewardsNotificationServiceObserver { METADATA_HEADER(BraveRewardsActionView, ToolbarButton) public: - explicit BraveRewardsActionView(Browser* browser); + explicit BraveRewardsActionView( + BrowserWindowInterface* browser_window_interface); ~BraveRewardsActionView() override; @@ -119,7 +120,7 @@ class BraveRewardsActionView brave_rewards::RewardsNotificationService, brave_rewards::RewardsNotificationServiceObserver>; - raw_ptr browser_ = nullptr; + raw_ptr browser_window_interface_ = nullptr; raw_ptr panel_coordinator_ = nullptr; raw_ptr tab_helper_ = nullptr; std::unique_ptr bubble_manager_; 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 4e8dacb47da1..43f6703b7375 100644 --- a/browser/ui/views/brave_actions/brave_shields_action_view.cc +++ b/browser/ui/views/brave_actions/brave_shields_action_view.cc @@ -9,6 +9,7 @@ #include #include +#include "base/check_deref.h" #include "base/memory/weak_ptr.h" #include "brave/browser/ui/brave_icon_with_badge_image_source.h" #include "brave/browser/ui/webui/brave_shields/shields_panel_ui.h" @@ -65,13 +66,15 @@ class BraveShieldsActionViewHighlightPathGenerator DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(BraveShieldsActionView, kShieldsActionIcon); -BraveShieldsActionView::BraveShieldsActionView(Profile& profile, - TabStripModel& tab_strip_model) +BraveShieldsActionView::BraveShieldsActionView( + BrowserWindowInterface* browser_window_interface) : LabelButton(base::BindRepeating(&BraveShieldsActionView::ButtonPressed, - base::Unretained(this)), + base::Unretained(this), + browser_window_interface), std::u16string()), - profile_(profile), - tab_strip_model_(tab_strip_model) { + profile_(CHECK_DEREF(browser_window_interface->GetProfile())), + tab_strip_model_( + CHECK_DEREF(browser_window_interface->GetTabStripModel())) { auto* web_contents = tab_strip_model_->GetActiveWebContents(); if (web_contents) { brave_shields::BraveShieldsTabHelper::FromWebContents(web_contents) @@ -89,7 +92,7 @@ BraveShieldsActionView::BraveShieldsActionView(Profile& profile, auto menu_button_controller = std::make_unique( this, base::BindRepeating(&BraveShieldsActionView::ButtonPressed, - base::Unretained(this)), + base::Unretained(this), browser_window_interface), std::make_unique(this)); menu_button_controller_ = menu_button_controller.get(); SetButtonController(std::move(menu_button_controller)); @@ -198,7 +201,8 @@ void BraveShieldsActionView::UpdateIconState() { ui::ImageModel::FromImageSkia(icon)); } -void BraveShieldsActionView::ButtonPressed() { +void BraveShieldsActionView::ButtonPressed( + BrowserWindowInterface* browser_window_interface) { auto* web_content = tab_strip_model_->GetActiveWebContents(); if (web_content && SchemeIsLocal(web_content->GetLastCommittedURL())) { return; // Do not show bubble if it's a local scheme @@ -206,7 +210,8 @@ void BraveShieldsActionView::ButtonPressed() { if (!webui_bubble_manager_) { webui_bubble_manager_ = WebUIBubbleManager::Create( - this, &*profile_, GURL(kShieldsPanelURL), IDS_BRAVE_SHIELDS); + this, browser_window_interface, GURL(kShieldsPanelURL), + IDS_BRAVE_SHIELDS); } if (webui_bubble_manager_->GetBubbleWidget()) { 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 48adb6b67847..2b472529e4c4 100644 --- a/browser/ui/views/brave_actions/brave_shields_action_view.h +++ b/browser/ui/views/brave_actions/brave_shields_action_view.h @@ -28,8 +28,8 @@ class BraveShieldsActionView METADATA_HEADER(BraveShieldsActionView, views::LabelButton) public: DECLARE_CLASS_ELEMENT_IDENTIFIER_VALUE(kShieldsActionIcon); - explicit BraveShieldsActionView(Profile& profile, - TabStripModel& tab_strip_model); + explicit BraveShieldsActionView( + BrowserWindowInterface* browser_window_interface); BraveShieldsActionView(const BraveShieldsActionView&) = delete; BraveShieldsActionView& operator=(const BraveShieldsActionView&) = delete; ~BraveShieldsActionView() override; @@ -49,7 +49,7 @@ class BraveShieldsActionView } private: - void ButtonPressed(); + void ButtonPressed(BrowserWindowInterface* browser_window_interface); bool SchemeIsLocal(GURL url); void UpdateIconState(); gfx::ImageSkia GetIconImage(bool is_enabled); diff --git a/browser/ui/views/brave_player/brave_player_action_icon_view.cc b/browser/ui/views/brave_player/brave_player_action_icon_view.cc index e529d9cfc63b..709656415437 100644 --- a/browser/ui/views/brave_player/brave_player_action_icon_view.cc +++ b/browser/ui/views/brave_player/brave_player_action_icon_view.cc @@ -84,7 +84,7 @@ const gfx::VectorIcon& BravePlayerActionIconView::GetVectorIcon() const { // We don't use vector icon because we need gradation effect. // TODO(sko) When Nala icon updates, try use vector icon and blending effect // to generate gradation effect. - NOTREACHED_NORETURN(); + NOTREACHED(); } void BravePlayerActionIconView::UpdateImpl() { diff --git a/browser/ui/views/brave_rewards/tip_panel_bubble_host.cc b/browser/ui/views/brave_rewards/tip_panel_bubble_host.cc index ce7a129f3a4f..f0ea90e3714f 100644 --- a/browser/ui/views/brave_rewards/tip_panel_bubble_host.cc +++ b/browser/ui/views/brave_rewards/tip_panel_bubble_host.cc @@ -28,9 +28,10 @@ namespace { // `TipPanelBubbleManager` disables web contents caching for the tip panel. class TipPanelBubbleManager : public WebUIBubbleManagerImpl { public: - TipPanelBubbleManager(views::View* anchor_view, Profile* profile) + TipPanelBubbleManager(views::View* anchor_view, + BrowserWindowInterface* browser_window_interface) : WebUIBubbleManagerImpl(anchor_view, - profile, + browser_window_interface, GURL(kBraveTipPanelURL), IDS_BRAVE_UI_BRAVE_REWARDS, /*force_load_on_create=*/false) {} @@ -88,7 +89,7 @@ void TipPanelBubbleHost::OnTipPanelRequested(const std::string& publisher_id) { // Create the bubble manager if necessary. if (!bubble_manager_) { bubble_manager_ = std::make_unique( - GetAnchorView(&GetBrowser()), GetBrowser().profile()); + GetAnchorView(&GetBrowser()), &GetBrowser()); } // Notify the panel coordinator of the browser size, so that it can size diff --git a/browser/ui/views/brave_shields/cookie_list_opt_in_bubble_host.cc b/browser/ui/views/brave_shields/cookie_list_opt_in_bubble_host.cc index 0e3b15c392f3..f3a7fc05a498 100644 --- a/browser/ui/views/brave_shields/cookie_list_opt_in_bubble_host.cc +++ b/browser/ui/views/brave_shields/cookie_list_opt_in_bubble_host.cc @@ -87,10 +87,11 @@ void ShowBubbleOnSessionRestore(base::WeakPtr browser, Profile*, int) { class BubbleManager : public WebUIBubbleManagerImpl { public: - BubbleManager(views::View* anchor_view, Profile* profile) + BubbleManager(views::View* anchor_view, + BrowserWindowInterface* browser_window_interface) : WebUIBubbleManagerImpl( anchor_view, - profile, + browser_window_interface, GURL(kCookieListOptInURL), IDS_BRAVE_SHIELDS, /*force_load_on_create=*/false) {} @@ -163,7 +164,7 @@ void CookieListOptInBubbleHost::ShowBubble() { if (!bubble_manager_) { bubble_manager_ = std::make_unique( - GetAnchorView(&GetBrowser()), GetBrowser().profile()); + GetAnchorView(&GetBrowser()), &GetBrowser()); } if (!bubble_manager_->GetBubbleWidget()) { diff --git a/browser/ui/views/download/bubble/download_bubble_unittest.cc b/browser/ui/views/download/bubble/download_bubble_unittest.cc index ee769e53487f..084f95afd240 100644 --- a/browser/ui/views/download/bubble/download_bubble_unittest.cc +++ b/browser/ui/views/download/bubble/download_bubble_unittest.cc @@ -15,7 +15,7 @@ #include "content/public/test/browser_task_environment.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "ui/base/models/simple_menu_model.h" +#include "ui/menus/simple_menu_model.h" #include "url/gurl.h" using download::DownloadItem; 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 c9af9c4bade6..5f36e7c03a6c 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 @@ -8,6 +8,7 @@ #include #include +#include "base/notreached.h" #include "brave/browser/ui/views/tabs/vertical_tab_utils.h" #include "brave/browser/ui/views/toolbar/brave_toolbar_view.h" #include "chrome/browser/ui/layout_constants.h" @@ -31,12 +32,10 @@ ui::NavButtonProvider::ButtonState ButtonStateToNavButtonProviderState( return ui::NavButtonProvider::ButtonState::kPressed; case views::Button::STATE_DISABLED: return ui::NavButtonProvider::ButtonState::kDisabled; - case views::Button::STATE_COUNT: - default: - NOTREACHED_IN_MIGRATION(); return ui::NavButtonProvider::ButtonState::kNormal; } + NOTREACHED(); } } // namespace @@ -121,8 +120,7 @@ views::Button* BraveBrowserFrameViewLinuxNative::FrameButtonToButton( case views::FrameButton::kClose: return close_button(); } - NOTREACHED_IN_MIGRATION(); - return nullptr; + NOTREACHED(); } void BraveBrowserFrameViewLinuxNative:: diff --git a/browser/ui/views/frame/brave_browser_view.cc b/browser/ui/views/frame/brave_browser_view.cc index 410cbf7a78cc..4b33bf79e78d 100644 --- a/browser/ui/views/frame/brave_browser_view.cc +++ b/browser/ui/views/frame/brave_browser_view.cc @@ -587,6 +587,18 @@ void BraveBrowserView::UpdateSearchTabsButtonState() { BraveBrowserView::~BraveBrowserView() { tab_cycling_event_handler_.reset(); + // Removes the bubble from the browser, as it uses the `ToolbarView` as an + // archor, and that leaves a dangling reference once the `TopContainerView` is + // destroyed before all `SupportsUserData` is cleared. + if (brave_shields::CookieListOptInBubbleHost::FromBrowser(browser_.get())) { + brave_shields::CookieListOptInBubbleHost::RemoveFromBrowser(browser_.get()); + } + + // Same as above. + if (brave_rewards::TipPanelBubbleHost::FromBrowser(browser_.get())) { + brave_rewards::TipPanelBubbleHost::RemoveFromBrowser(browser_.get()); + } + DCHECK(!tab_cycling_event_handler_); } 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 7a89b231ff6a..3a75cd6f5c5c 100644 --- a/browser/ui/views/frame/vertical_tab_strip_region_view.cc +++ b/browser/ui/views/frame/vertical_tab_strip_region_view.cc @@ -122,14 +122,15 @@ END_METADATA class VerticalTabSearchButton : public BraveTabSearchButton { METADATA_HEADER(VerticalTabSearchButton, BraveTabSearchButton) public: - VerticalTabSearchButton( - VerticalTabStripRegionView* region_view, - TabStripController* tab_strip_controller, - tabs::TabDeclutterController* tab_declutter_controller, - Edge flat_edge) + VerticalTabSearchButton(VerticalTabStripRegionView* region_view, + TabStripController* tab_strip_controller, + BrowserWindowInterface* browser_window_interface, + Edge fixed_flat_edge, + Edge animated_flat_edge) : BraveTabSearchButton(tab_strip_controller, - tab_declutter_controller, - flat_edge) { + browser_window_interface, + fixed_flat_edge, + animated_flat_edge) { SetPreferredSize( gfx::Size{ToggleButton::GetIconWidth(), ToggleButton::GetIconWidth()}); SetTooltipText(l10n_util::GetStringUTF16(IDS_TOOLTIP_TAB_SEARCH)); @@ -455,7 +456,8 @@ class VerticalTabStripRegionView::HeaderView : public views::View { METADATA_HEADER(HeaderView, views::View) public: HeaderView(views::Button::PressedCallback toggle_callback, - VerticalTabStripRegionView* region_view) + VerticalTabStripRegionView* region_view, + BrowserWindowInterface* browser_window_interface) : region_view_(region_view), tab_strip_(region_view->tab_strip()) { SetBorder(views::CreateEmptyBorder(gfx::Insets(kHeaderInset))); @@ -473,10 +475,7 @@ class VerticalTabStripRegionView::HeaderView : public views::View { // way to change its bubble arrow from TOP_RIGHT at the moment. tab_search_button_ = AddChildView(std::make_unique( region_view, region_view->tab_strip()->controller(), - region_view_->browser() - ->browser_window_features() - ->tab_declutter_controller(), - Edge::kNone)); + browser_window_interface, Edge::kNone, Edge::kNone)); UpdateTabSearchButtonVisibility(); vertical_tab_on_right_.Init( @@ -619,7 +618,7 @@ VerticalTabStripRegionView::VerticalTabStripRegionView( } }, this), - this)); + this, browser_)); contents_view_ = AddChildView(std::make_unique( this, original_region_view_->tab_strip_)); diff --git a/browser/ui/views/frame/vertical_tab_strip_root_view_browsertest.cc b/browser/ui/views/frame/vertical_tab_strip_root_view_browsertest.cc index 1682142a0831..d70897877232 100644 --- a/browser/ui/views/frame/vertical_tab_strip_root_view_browsertest.cc +++ b/browser/ui/views/frame/vertical_tab_strip_root_view_browsertest.cc @@ -3,10 +3,11 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at https://mozilla.org/MPL/2.0/. */ +#include "brave/browser/ui/views/frame/vertical_tab_strip_root_view.h" + #include "brave/browser/ui/browser_commands.h" #include "brave/browser/ui/views/frame/brave_browser_view.h" #include "brave/browser/ui/views/frame/vertical_tab_strip_region_view.h" -#include "brave/browser/ui/views/frame/vertical_tab_strip_root_view.h" #include "brave/browser/ui/views/frame/vertical_tab_strip_widget_delegate_view.h" #include "brave/browser/ui/views/tabs/vertical_tab_utils.h" #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" @@ -18,6 +19,7 @@ #include "ui/base/dragdrop/drop_target_event.h" #include "ui/base/dragdrop/mojom/drag_drop_types.mojom.h" #include "ui/base/dragdrop/os_exchange_data.h" +#include "ui/base/mojom/menu_source_type.mojom.h" #include "ui/compositor/layer_tree_owner.h" class VerticalTabStripRootViewBrowserTest : public InProcessBrowserTest { diff --git a/browser/ui/views/infobars/brave_confirm_infobar.cc b/browser/ui/views/infobars/brave_confirm_infobar.cc index 81922e3eee4c..4373d07a7101 100644 --- a/browser/ui/views/infobars/brave_confirm_infobar.cc +++ b/browser/ui/views/infobars/brave_confirm_infobar.cc @@ -119,9 +119,8 @@ views::MdTextButton* BraveConfirmInfoBar::GetButtonById(int id) { return cancel_button_; case ConfirmInfoBarDelegate::BUTTON_EXTRA: return extra_button_; - default: - NOTREACHED_NORETURN(); } + NOTREACHED(); } void BraveConfirmInfoBar::Layout(PassKey) { 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 4edc4afeb249..fe3ba0a2beba 100644 --- a/browser/ui/views/infobars/web_discovery_infobar_content_view.cc +++ b/browser/ui/views/infobars/web_discovery_infobar_content_view.cc @@ -108,21 +108,22 @@ class OkButton : public views::LabelButton { OkButton& operator=(const OkButton&) = delete; void UpdateBackgroundColor() override { - constexpr SkColor kBgColor[][ButtonState::STATE_COUNT] = { - { - // Light theme. - SkColorSetRGB(0x4E, 0x32, 0xEE), // normal - SkColorSetRGB(0x32, 0x2F, 0xB4), // hover - SkColorSetRGB(0x4E, 0x32, 0xEE), // focused - SkColorSetRGB(0xAC, 0xAF, 0xBB) // disabled - }, - { - // Dark theme. - SkColorSetRGB(0x4E, 0x32, 0xEE), // normal - SkColorSetRGB(0x87, 0x84, 0xF4), // hover - SkColorSetRGB(0x4E, 0x32, 0xEE), // focused - SkColorSetRGB(0x58, 0x5C, 0x6D), // disabled - }}; + static constexpr auto kBgColor = + std::to_array>( + {{ + // Light theme. + SkColorSetRGB(0x4E, 0x32, 0xEE), // normal + SkColorSetRGB(0x32, 0x2F, 0xB4), // hover + SkColorSetRGB(0x4E, 0x32, 0xEE), // focused + SkColorSetRGB(0xAC, 0xAF, 0xBB) // disabled + }, + { + // Dark theme. + SkColorSetRGB(0x4E, 0x32, 0xEE), // normal + SkColorSetRGB(0x87, 0x84, 0xF4), // hover + SkColorSetRGB(0x4E, 0x32, 0xEE), // focused + SkColorSetRGB(0x58, 0x5C, 0x6D), // disabled + }}); const int theme = ui::NativeTheme::GetInstanceForNativeUi()->ShouldUseDarkColors(); diff --git a/browser/ui/views/omnibox/brave_search_conversion_promotion_view.cc b/browser/ui/views/omnibox/brave_search_conversion_promotion_view.cc index 607f7fbcd8e0..cc805ae89c96 100644 --- a/browser/ui/views/omnibox/brave_search_conversion_promotion_view.cc +++ b/browser/ui/views/omnibox/brave_search_conversion_promotion_view.cc @@ -609,7 +609,7 @@ void BraveSearchConversionPromotionView::UpdateHoverState() { int BraveSearchConversionPromotionView::GetBannerTypeTitleStringResourceId() { switch (type_) { case ConversionType::kBannerTypeA: - NOTREACHED_NORETURN(); + NOTREACHED(); case ConversionType::kBannerTypeB: return IDS_BRAVE_SEARCH_CONVERSION_PROMOTION_BANNER_TYPE_B_TITLE; case ConversionType::kBannerTypeC: @@ -620,17 +620,19 @@ int BraveSearchConversionPromotionView::GetBannerTypeTitleStringResourceId() { return IDS_BRAVE_SEARCH_CONVERSION_PROMOTION_BANNER_TYPE_C_DDG_TITLE; case ConversionType::kDDGBannerTypeD: return IDS_BRAVE_SEARCH_CONVERSION_PROMOTION_BANNER_TYPE_D_DDG_TITLE; - default: + case ConversionType::kNone: + case ConversionType::kButton: + case ConversionType::kNTP: break; } - NOTREACHED_NORETURN(); + NOTREACHED(); } int BraveSearchConversionPromotionView::GetBannerTypeDescStringResourceId() { switch (type_) { case ConversionType::kBannerTypeA: - NOTREACHED_NORETURN(); + NOTREACHED(); case ConversionType::kBannerTypeB: return IDS_BRAVE_SEARCH_CONVERSION_PROMOTION_BANNER_TYPE_B_DESC; case ConversionType::kBannerTypeC: @@ -641,11 +643,13 @@ int BraveSearchConversionPromotionView::GetBannerTypeDescStringResourceId() { return IDS_BRAVE_SEARCH_CONVERSION_PROMOTION_BANNER_TYPE_C_DDG_DESC; case ConversionType::kDDGBannerTypeD: return IDS_BRAVE_SEARCH_CONVERSION_PROMOTION_BANNER_TYPE_D_DDG_DESC; - default: + case ConversionType::kNone: + case ConversionType::kButton: + case ConversionType::kNTP: break; } - NOTREACHED_NORETURN(); + NOTREACHED(); } bool BraveSearchConversionPromotionView::UseDDG() const { diff --git a/browser/ui/views/overlay/brave_video_overlay_window_views.cc b/browser/ui/views/overlay/brave_video_overlay_window_views.cc index 2fb64f9f4681..063b4db96324 100644 --- a/browser/ui/views/overlay/brave_video_overlay_window_views.cc +++ b/browser/ui/views/overlay/brave_video_overlay_window_views.cc @@ -352,7 +352,7 @@ void BraveVideoOverlayWindowViews::UpdateControlIcons() { } void BraveVideoOverlayWindowViews::SetMediaPosition( - const std::optional& media_position) { + const media_session::MediaPosition& media_position) { CHECK(timestamp_); media_position_ = media_position; @@ -498,7 +498,8 @@ void BraveVideoOverlayWindowViews::UpdateTimestampPeriodically() { timestamp_->SizeToPreferredSize(); } - if (!is_seeking_) { + if (!is_seeking_ && seeker_->GetWidget() && + seeker_->GetWidget()->IsVisible() && seeker_->GetVisible()) { seeker_->SetValue(media_position_->GetPosition().InSecondsF() / media_position_->duration().InSecondsF()); } diff --git a/browser/ui/views/overlay/brave_video_overlay_window_views.h b/browser/ui/views/overlay/brave_video_overlay_window_views.h index b3958ed01631..ec0f5b3a97dd 100644 --- a/browser/ui/views/overlay/brave_video_overlay_window_views.h +++ b/browser/ui/views/overlay/brave_video_overlay_window_views.h @@ -29,8 +29,7 @@ class BraveVideoOverlayWindowViews : public VideoOverlayWindowViews, void SetUpViews() override; void OnUpdateControlsBounds() override; void SetPlaybackState(PlaybackState playback_state) override; - void SetMediaPosition(const std::optional& - media_position) override; + void SetMediaPosition(const media_session::MediaPosition& position) override; bool ControlsHitTestContainsPoint(const gfx::Point& point) override; void SetSeekerEnabled(bool enabled) override; void ShowInactive() override; diff --git a/browser/ui/views/playlist/playlist_action_dialogs.cc b/browser/ui/views/playlist/playlist_action_dialogs.cc index d1c0f640e7d1..f3e20317045a 100644 --- a/browser/ui/views/playlist/playlist_action_dialogs.cc +++ b/browser/ui/views/playlist/playlist_action_dialogs.cc @@ -304,7 +304,7 @@ PlaylistNewPlaylistDialog::PlaylistNewPlaylistDialog( playlist::PlaylistService* service) : service_(service) { thumbnail_provider_ = std::make_unique(*service_); - const auto kSpacing = 24; + static constexpr int kSpacing = 24; SetBorder(views::CreateEmptyBorder(gfx::Insets(kSpacing))); SetLayoutManager(std::make_unique( views::BoxLayout::Orientation::kVertical, gfx::Insets(), diff --git a/browser/ui/views/profiles/brave_profile_menu_view.cc b/browser/ui/views/profiles/brave_profile_menu_view.cc index 575a66c7bef6..9e2497536fe2 100644 --- a/browser/ui/views/profiles/brave_profile_menu_view.cc +++ b/browser/ui/views/profiles/brave_profile_menu_view.cc @@ -24,8 +24,23 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/models/image_model.h" -void BraveProfileMenuView::BuildIdentity() { - ProfileMenuView::BuildIdentity(); +void BraveProfileMenuView::SetProfileIdentityInfo( + const std::u16string& profile_name, + SkColor profile_background_color, + std::optional edit_button_params, + const ui::ImageModel& image_model, + const ui::ImageModel& management_badge, + const std::u16string& title, + const std::u16string& subtitle, + const std::u16string& management_label, + const gfx::VectorIcon* header_art_icon) { + // This method is overriden because otherwise we would have to call + // `SetProfileIdentityInfo` a second time, and this leaves + // `profile_background_container_`, and `heading_label_` dangling in + // `ProfileMenuViewBase` for a while in between + // `identity_info_container_->RemoveAllChildViews()` being called, and the new + // pointers being assigned to those members. + Profile* profile = browser()->profile(); ProfileAttributesEntry* profile_attributes = g_browser_process->profile_manager() @@ -33,7 +48,7 @@ void BraveProfileMenuView::BuildIdentity() { .GetProfileAttributesWithPath(profile->GetPath()); // Reset IdentityInfo to get rid of the subtitle string // IDS_PROFILES_LOCAL_PROFILE_STATE("Not signed in"). - SetProfileIdentityInfo( + ProfileMenuView::SetProfileIdentityInfo( /*profile_name=*/std::u16string(), profile_attributes->GetProfileThemeColors().profile_highlight_color, /*edit_button_params=*/std::nullopt, diff --git a/browser/ui/views/profiles/brave_profile_menu_view.h b/browser/ui/views/profiles/brave_profile_menu_view.h index ed85ac5518a9..bc05193db333 100644 --- a/browser/ui/views/profiles/brave_profile_menu_view.h +++ b/browser/ui/views/profiles/brave_profile_menu_view.h @@ -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/. */ #ifndef BRAVE_BROWSER_UI_VIEWS_PROFILES_BRAVE_PROFILE_MENU_VIEW_H_ #define BRAVE_BROWSER_UI_VIEWS_PROFILES_BRAVE_PROFILE_MENU_VIEW_H_ @@ -19,7 +19,16 @@ class BraveProfileMenuView : public ProfileMenuView { using ProfileMenuView::ProfileMenuView; // Helper methods for building the menu. - void BuildIdentity() override; + void SetProfileIdentityInfo( + const std::u16string& profile_name, + SkColor profile_background_color, + std::optional edit_button_params, + const ui::ImageModel& image_model, + const ui::ImageModel& management_badge, + const std::u16string& title, + const std::u16string& subtitle = std::u16string(), + const std::u16string& management_label = std::u16string(), + const gfx::VectorIcon* header_art_icon = nullptr) override; void BuildAutofillButtons() override; void BuildSyncInfo() override; void BuildFeatureButtons() override; diff --git a/browser/ui/views/side_panel/bookmarks/brave_bookmarks_side_panel_coordinator.cc b/browser/ui/views/side_panel/bookmarks/brave_bookmarks_side_panel_coordinator.cc index 10354846ea6d..15f699d9a5c9 100644 --- a/browser/ui/views/side_panel/bookmarks/brave_bookmarks_side_panel_coordinator.cc +++ b/browser/ui/views/side_panel/bookmarks/brave_bookmarks_side_panel_coordinator.cc @@ -32,8 +32,9 @@ void BraveBookmarksSidePanelCoordinator::CreateAndRegisterEntry( } std::unique_ptr -BraveBookmarksSidePanelCoordinator::CreateBookmarksPanelView() { - return std::make_unique(&GetBrowser()); +BraveBookmarksSidePanelCoordinator::CreateBookmarksPanelView( + SidePanelEntryScope& scope) { + return std::make_unique(&GetBrowser(), scope); } BROWSER_USER_DATA_KEY_IMPL(BraveBookmarksSidePanelCoordinator); diff --git a/browser/ui/views/side_panel/bookmarks/brave_bookmarks_side_panel_coordinator.h b/browser/ui/views/side_panel/bookmarks/brave_bookmarks_side_panel_coordinator.h index 8eefa7e524a4..0c0fdb9a350c 100644 --- a/browser/ui/views/side_panel/bookmarks/brave_bookmarks_side_panel_coordinator.h +++ b/browser/ui/views/side_panel/bookmarks/brave_bookmarks_side_panel_coordinator.h @@ -12,6 +12,7 @@ class Browser; class SidePanelRegistry; +class SidePanelEntryScope; namespace views { class View; @@ -42,7 +43,8 @@ class BraveBookmarksSidePanelCoordinator private: friend class BrowserUserData; - std::unique_ptr CreateBookmarksPanelView(); + std::unique_ptr CreateBookmarksPanelView( + SidePanelEntryScope& scope); BROWSER_USER_DATA_KEY_DECL(); }; 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 412653962c4f..9d7b80ffcde1 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 @@ -143,7 +143,9 @@ END_METADATA } // namespace -BraveBookmarksSidePanelView::BraveBookmarksSidePanelView(Browser* browser) { +BraveBookmarksSidePanelView::BraveBookmarksSidePanelView( + Browser* browser, + SidePanelEntryScope& scope) { SetLayoutManager(std::make_unique()) ->SetOrientation(views::LayoutOrientation::kVertical); AddChildView(std::make_unique(browser)); @@ -153,7 +155,7 @@ BraveBookmarksSidePanelView::BraveBookmarksSidePanelView(Browser* browser) { // Reuse upstream's bookmarks panl nwebui. auto* web_view = AddChildView(BookmarksSidePanelCoordinator::GetOrCreateForBrowser(browser) - ->CreateBookmarksWebView()); + ->CreateBookmarksWebView(scope)); web_view->SetProperty( views::kFlexBehaviorKey, views::FlexSpecification(views::MinimumFlexSizeRule::kPreferred, diff --git a/browser/ui/views/side_panel/brave_bookmarks_side_panel_view.h b/browser/ui/views/side_panel/brave_bookmarks_side_panel_view.h index 54a56eed4b9c..ca92401d5d04 100644 --- a/browser/ui/views/side_panel/brave_bookmarks_side_panel_view.h +++ b/browser/ui/views/side_panel/brave_bookmarks_side_panel_view.h @@ -9,11 +9,13 @@ #include "brave/browser/ui/views/side_panel/brave_side_panel_view_base.h" class Browser; +class SidePanelEntryScope; // Gives bookmarks panel specific header view with web view. class BraveBookmarksSidePanelView : public BraveSidePanelViewBase { public: - explicit BraveBookmarksSidePanelView(Browser* browser); + explicit BraveBookmarksSidePanelView(Browser* browser, + SidePanelEntryScope& scope); ~BraveBookmarksSidePanelView() override; BraveBookmarksSidePanelView(const BraveBookmarksSidePanelView&) = delete; BraveBookmarksSidePanelView& operator=(const BraveBookmarksSidePanelView&) = 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 afd4259b8716..0d572dd90fb9 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 @@ -6,6 +6,7 @@ #include "brave/browser/ui/views/side_panel/brave_read_later_side_panel_view.h" #include +#include #include "base/functional/bind.h" #include "brave/browser/ui/color/brave_color_id.h" @@ -117,14 +118,15 @@ END_METADATA BraveReadLaterSidePanelView::BraveReadLaterSidePanelView( Browser* browser, + SidePanelEntryScope& scope, base::RepeatingClosure close_cb) { SetLayoutManager(std::make_unique()) ->SetOrientation(views::LayoutOrientation::kVertical); AddChildView(std::make_unique(browser)); AddChildView(std::make_unique()) ->SetColorId(kColorSidebarPanelHeaderSeparator); - auto* web_view = AddChildView( - std::make_unique(browser, close_cb)); + auto* web_view = AddChildView(std::make_unique( + browser, scope, std::move(close_cb))); web_view->SetProperty( views::kFlexBehaviorKey, views::FlexSpecification(views::MinimumFlexSizeRule::kPreferred, 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 538578199b1b..917eb061c179 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 @@ -11,6 +11,7 @@ #include "ui/base/metadata/metadata_header_macros.h" class Browser; +class SidePanelEntryScope; // Gives reading list specific header view with web view. class BraveReadLaterSidePanelView : public BraveSidePanelViewBase { @@ -18,6 +19,7 @@ class BraveReadLaterSidePanelView : public BraveSidePanelViewBase { public: BraveReadLaterSidePanelView(Browser* browser, + SidePanelEntryScope& scope, base::RepeatingClosure close_cb); ~BraveReadLaterSidePanelView() override; BraveReadLaterSidePanelView(const BraveReadLaterSidePanelView&) = delete; 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 6f5ca41b4cfb..9057767d2250 100644 --- a/browser/ui/views/side_panel/brave_side_panel_utils.cc +++ b/browser/ui/views/side_panel/brave_side_panel_utils.cc @@ -21,13 +21,12 @@ END_METADATA namespace { std::unique_ptr CreateAIChatSidePanelWebView( - base::WeakPtr profile) { - if (!profile) { - NOTREACHED_NORETURN(); - } + base::WeakPtr profile, + SidePanelEntryScope& scope) { + CHECK(profile); auto web_view = std::make_unique>( - base::RepeatingClosure(), base::RepeatingClosure(), + scope, base::RepeatingClosure(), base::RepeatingClosure(), std::make_unique>( GURL(kChatUIURL), profile.get(), IDS_SIDEBAR_CHAT_SUMMARIZER_ITEM_TITLE, diff --git a/browser/ui/views/side_panel/playlist/playlist_side_panel_coordinator.cc b/browser/ui/views/side_panel/playlist/playlist_side_panel_coordinator.cc index 912df4681d82..41ae89f90cab 100644 --- a/browser/ui/views/side_panel/playlist/playlist_side_panel_coordinator.cc +++ b/browser/ui/views/side_panel/playlist/playlist_side_panel_coordinator.cc @@ -75,7 +75,8 @@ void PlaylistSidePanelCoordinator::LoadPlaylist(const std::string& playlist_id, {}, ui::PageTransition::PAGE_TRANSITION_AUTO_BOOKMARK, {})); } -std::unique_ptr PlaylistSidePanelCoordinator::CreateWebView() { +std::unique_ptr PlaylistSidePanelCoordinator::CreateWebView( + SidePanelEntryScope& scope) { const bool should_create_contents_wrapper = !contents_wrapper_; if (should_create_contents_wrapper) { contents_wrapper_ = std::make_unique( @@ -90,7 +91,7 @@ std::unique_ptr PlaylistSidePanelCoordinator::CreateWebView() { } auto web_view = std::make_unique( - &GetBrowser(), base::DoNothing(), contents_wrapper_.get()); + &GetBrowser(), scope, base::DoNothing(), contents_wrapper_.get()); side_panel_web_view_ = web_view->GetWeakPtr(); if (!should_create_contents_wrapper) { diff --git a/browser/ui/views/side_panel/playlist/playlist_side_panel_coordinator.h b/browser/ui/views/side_panel/playlist/playlist_side_panel_coordinator.h index e51e03739cd5..1b7bb3d43be3 100644 --- a/browser/ui/views/side_panel/playlist/playlist_side_panel_coordinator.h +++ b/browser/ui/views/side_panel/playlist/playlist_side_panel_coordinator.h @@ -22,6 +22,7 @@ class PlaylistUI; class Browser; class SidePanelRegistry; +class SidePanelEntryScope; class PlaylistSidePanelCoordinator : public BrowserUserData, @@ -73,7 +74,7 @@ class PlaylistSidePanelCoordinator void DestroyWebContentsIfNeeded(); - std::unique_ptr CreateWebView(); + std::unique_ptr CreateWebView(SidePanelEntryScope& scope); raw_ptr browser_ = nullptr; diff --git a/browser/ui/views/side_panel/playlist/playlist_side_panel_web_view.cc b/browser/ui/views/side_panel/playlist/playlist_side_panel_web_view.cc index cd21b9e9eaf8..c7ed3f95175f 100644 --- a/browser/ui/views/side_panel/playlist/playlist_side_panel_web_view.cc +++ b/browser/ui/views/side_panel/playlist/playlist_side_panel_web_view.cc @@ -7,12 +7,13 @@ PlaylistSidePanelWebView::PlaylistSidePanelWebView( Browser* browser, + SidePanelEntryScope& scope, base::RepeatingClosure close_cb, WebUIContentsWrapper* contents_wrapper) - : SidePanelWebUIView( - /* on_show_cb = */ base::RepeatingClosure(), - close_cb, - contents_wrapper) {} + : SidePanelWebUIView(scope, + /* on_show_cb = */ base::RepeatingClosure(), + close_cb, + contents_wrapper) {} PlaylistSidePanelWebView::~PlaylistSidePanelWebView() = default; diff --git a/browser/ui/views/side_panel/playlist/playlist_side_panel_web_view.h b/browser/ui/views/side_panel/playlist/playlist_side_panel_web_view.h index 0ed733485347..7becd69177f1 100644 --- a/browser/ui/views/side_panel/playlist/playlist_side_panel_web_view.h +++ b/browser/ui/views/side_panel/playlist/playlist_side_panel_web_view.h @@ -8,6 +8,7 @@ class Browser; class WebUIContentsWrapper; +class SidePanelEntryScope; #include "base/functional/callback_forward.h" #include "brave/browser/ui/webui/playlist_ui.h" @@ -16,6 +17,7 @@ class WebUIContentsWrapper; class PlaylistSidePanelWebView : public SidePanelWebUIView { public: PlaylistSidePanelWebView(Browser* browser, + SidePanelEntryScope& scope, base::RepeatingClosure close_cb, WebUIContentsWrapper* contents_wrapper); PlaylistSidePanelWebView(const PlaylistSidePanelWebView&) = delete; diff --git a/browser/ui/views/sidebar/sidebar_control_view.cc b/browser/ui/views/sidebar/sidebar_control_view.cc index 17247b198c35..046927edfe70 100644 --- a/browser/ui/views/sidebar/sidebar_control_view.cc +++ b/browser/ui/views/sidebar/sidebar_control_view.cc @@ -102,7 +102,7 @@ SidebarControlView::~SidebarControlView() = default; void SidebarControlView::ShowContextMenuForViewImpl( views::View* source, const gfx::Point& point, - ui::MenuSourceType source_type) { + ui::mojom::MenuSourceType source_type) { if (context_menu_runner_ && context_menu_runner_->IsRunning()) { return; } diff --git a/browser/ui/views/sidebar/sidebar_control_view.h b/browser/ui/views/sidebar/sidebar_control_view.h index 2658ac3450ed..c3bc45850b08 100644 --- a/browser/ui/views/sidebar/sidebar_control_view.h +++ b/browser/ui/views/sidebar/sidebar_control_view.h @@ -13,7 +13,7 @@ #include "base/scoped_observation.h" #include "brave/browser/ui/sidebar/sidebar_model.h" #include "brave/browser/ui/views/sidebar/sidebar_button_view.h" -#include "ui/base/models/simple_menu_model.h" +#include "ui/menus/simple_menu_model.h" #include "ui/views/context_menu_controller.h" #include "ui/views/view.h" @@ -55,9 +55,10 @@ class SidebarControlView : public views::View, void OnThemeChanged() override; // views::ContextMenuController overrides: - void ShowContextMenuForViewImpl(views::View* source, - const gfx::Point& point, - ui::MenuSourceType source_type) override; + void ShowContextMenuForViewImpl( + views::View* source, + const gfx::Point& point, + ui::mojom::MenuSourceType source_type) override; // ui::SimpleMenuModel::Delegate overrides: void ExecuteCommand(int command_id, int event_flags) override; diff --git a/browser/ui/views/sidebar/sidebar_items_contents_view.cc b/browser/ui/views/sidebar/sidebar_items_contents_view.cc index f17fdb1f1c10..d0e803739eac 100644 --- a/browser/ui/views/sidebar/sidebar_items_contents_view.cc +++ b/browser/ui/views/sidebar/sidebar_items_contents_view.cc @@ -169,7 +169,7 @@ void SidebarItemsContentsView::UpdateAllBuiltInItemsViewState() { void SidebarItemsContentsView::ShowContextMenuForViewImpl( views::View* source, const gfx::Point& point, - ui::MenuSourceType source_type) { + ui::mojom::MenuSourceType source_type) { if (context_menu_runner_ && context_menu_runner_->IsRunning()) { return; } @@ -226,8 +226,6 @@ void SidebarItemsContentsView::ExecuteCommand(int command_id, int event_flags) { LaunchEditItemDialog(); return; } - - NOTREACHED_IN_MIGRATION(); } bool SidebarItemsContentsView::IsCommandIdVisible(int command_id) const { @@ -245,8 +243,7 @@ bool SidebarItemsContentsView::IsCommandIdVisible(int command_id) const { return GetSidebarService(browser_)->IsEditableItemAt(*index); } - NOTREACHED_IN_MIGRATION(); - return false; + NOTREACHED() << "No more commands now."; } void SidebarItemsContentsView::OnContextMenuClosed() { @@ -439,8 +436,7 @@ SidebarItemsContentsView::CalculateTargetDragIndicatorIndex( } } - NOTREACHED_IN_MIGRATION(); - return std::nullopt; + NOTREACHED() << "screen_position must be included in child views"; } std::optional SidebarItemsContentsView::DrawDragIndicator( @@ -566,9 +562,10 @@ ui::ImageModel SidebarItemsContentsView::GetImageForBuiltInItems( return get_image_model(kLeoProductPlaylistIcon, state); case sidebar::SidebarItem::BuiltInItemType::kChatUI: return get_image_model(kLeoProductBraveLeoIcon, state); - case sidebar::SidebarItem::BuiltInItemType::kNone: - NOTREACHED_NORETURN(); + default: + break; } + NOTREACHED() << "we don't ask image for other types"; } void SidebarItemsContentsView::OnWidgetDestroying(views::Widget* widget) { diff --git a/browser/ui/views/sidebar/sidebar_items_contents_view.h b/browser/ui/views/sidebar/sidebar_items_contents_view.h index 63eb64992581..ba25b6fd0d5d 100644 --- a/browser/ui/views/sidebar/sidebar_items_contents_view.h +++ b/browser/ui/views/sidebar/sidebar_items_contents_view.h @@ -15,7 +15,7 @@ #include "brave/browser/ui/sidebar/sidebar_model.h" #include "brave/browser/ui/views/sidebar/sidebar_button_view.h" #include "brave/components/sidebar/browser/sidebar_item.h" -#include "ui/base/models/simple_menu_model.h" +#include "ui/menus/simple_menu_model.h" #include "ui/views/context_menu_controller.h" #include "ui/views/controls/button/button.h" #include "ui/views/view.h" @@ -52,9 +52,10 @@ class SidebarItemsContentsView : public views::View, void OnThemeChanged() override; // views::ContextMenuController overrides: - void ShowContextMenuForViewImpl(views::View* source, - const gfx::Point& point, - ui::MenuSourceType source_type) override; + void ShowContextMenuForViewImpl( + views::View* source, + const gfx::Point& point, + ui::mojom::MenuSourceType source_type) override; // views::WidgetObserver overrides: void OnWidgetDestroying(views::Widget* widget) override; diff --git a/browser/ui/views/tabs/brave_browser_tab_strip_controller.cc b/browser/ui/views/tabs/brave_browser_tab_strip_controller.cc index edbc008bfb83..5ad7788386f7 100644 --- a/browser/ui/views/tabs/brave_browser_tab_strip_controller.cc +++ b/browser/ui/views/tabs/brave_browser_tab_strip_controller.cc @@ -32,7 +32,7 @@ const std::optional BraveBrowserTabStripController::GetModelIndexOf( void BraveBrowserTabStripController::ShowContextMenuForTab( Tab* tab, const gfx::Point& p, - ui::MenuSourceType source_type) { + ui::mojom::MenuSourceType source_type) { BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser()); const auto tab_index = browser_view->tabstrip()->GetModelIndexOf(tab); diff --git a/browser/ui/views/tabs/brave_browser_tab_strip_controller.h b/browser/ui/views/tabs/brave_browser_tab_strip_controller.h index e6d57815640f..fa97772f3ea3 100644 --- a/browser/ui/views/tabs/brave_browser_tab_strip_controller.h +++ b/browser/ui/views/tabs/brave_browser_tab_strip_controller.h @@ -30,7 +30,7 @@ class BraveBrowserTabStripController : public BrowserTabStripController { // BrowserTabStripController overrides: void ShowContextMenuForTab(Tab* tab, const gfx::Point& p, - ui::MenuSourceType source_type) override; + ui::mojom::MenuSourceType source_type) override; private: // If non-NULL it means we're showing a menu for the tab. diff --git a/browser/ui/views/tabs/brave_tab.cc b/browser/ui/views/tabs/brave_tab.cc index 73aec7724d6f..309682b52b29 100644 --- a/browser/ui/views/tabs/brave_tab.cc +++ b/browser/ui/views/tabs/brave_tab.cc @@ -208,6 +208,6 @@ void BraveTab::SetData(TabRendererData data) { if (data_changed && tabs::utils::ShouldShowVerticalTabs(controller()->GetBrowser()) && data_.pinned) { - SetGroup(std::nullopt); + set_group(std::nullopt); } } diff --git a/browser/ui/views/tabs/brave_tab_container.cc b/browser/ui/views/tabs/brave_tab_container.cc index 1c8835648d99..702aab169635 100644 --- a/browser/ui/views/tabs/brave_tab_container.cc +++ b/browser/ui/views/tabs/brave_tab_container.cc @@ -402,8 +402,8 @@ void BraveTabContainer::SetTabSlotVisibility() { // https://github.com/brave/brave-browser/issues/39298 for (Tab* tab : layout_helper_->GetTabs()) { if (std::optional group = tab->group(); - group && !base::Contains(group_views_, *group)) { - tab->SetGroup(std::nullopt); + group && !group_views_.contains(*group)) { + tab->set_group(std::nullopt); } } diff --git a/browser/ui/views/tabs/brave_tab_context_menu_contents.cc b/browser/ui/views/tabs/brave_tab_context_menu_contents.cc index 19280e702e47..cb51804cf0c1 100644 --- a/browser/ui/views/tabs/brave_tab_context_menu_contents.cc +++ b/browser/ui/views/tabs/brave_tab_context_menu_contents.cc @@ -66,8 +66,9 @@ void BraveTabContextMenuContents::Cancel() { controller_ = nullptr; } -void BraveTabContextMenuContents::RunMenuAt(const gfx::Point& point, - ui::MenuSourceType source_type) { +void BraveTabContextMenuContents::RunMenuAt( + const gfx::Point& point, + ui::mojom::MenuSourceType source_type) { menu_runner_->RunMenuAt(tab_->GetWidget(), nullptr, gfx::Rect(point, gfx::Size()), views::MenuAnchorPosition::kTopLeft, source_type); diff --git a/browser/ui/views/tabs/brave_tab_context_menu_contents.h b/browser/ui/views/tabs/brave_tab_context_menu_contents.h index 392676f702cc..e9cf479f46af 100644 --- a/browser/ui/views/tabs/brave_tab_context_menu_contents.h +++ b/browser/ui/views/tabs/brave_tab_context_menu_contents.h @@ -12,8 +12,9 @@ #include "base/gtest_prod_util.h" #include "base/memory/raw_ptr.h" #include "base/memory/weak_ptr.h" -#include "ui/base/models/simple_menu_model.h" +#include "ui/base/mojom/menu_source_type.mojom.h" #include "ui/base/ui_base_types.h" +#include "ui/menus/simple_menu_model.h" class BraveBrowserTabStripController; class BraveTabMenuModel; @@ -44,7 +45,8 @@ class BraveTabContextMenuContents : public ui::SimpleMenuModel::Delegate { void Cancel(); - void RunMenuAt(const gfx::Point& point, ui::MenuSourceType source_type); + void RunMenuAt(const gfx::Point& point, + ui::mojom::MenuSourceType source_type); // ui::SimpleMenuModel::Delegate overrides: bool IsCommandIdChecked(int command_id) const override; diff --git a/browser/ui/views/tabs/brave_tab_group_header.cc b/browser/ui/views/tabs/brave_tab_group_header.cc index c434e670a781..70d00fb09017 100644 --- a/browser/ui/views/tabs/brave_tab_group_header.cc +++ b/browser/ui/views/tabs/brave_tab_group_header.cc @@ -78,11 +78,11 @@ void BraveTabGroupHeader::VisualsChanged() { // vertical layout to maintain the group header height. if (!title_->GetText().empty()) { const gfx::Insets title_chip_insets = - group_style_->GetInsetsForHeaderChip(ShouldShowSyncIcon()); + group_style_->GetInsetsForHeaderChip(ShouldShowHeaderIcon()); title_chip_->SetSize( {title_chip_->width(), title_->height() + 2 * title_chip_insets.top()}); title_->SetY(title_chip_insets.top()); - if (ShouldShowSyncIcon()) { + if (ShouldShowHeaderIcon()) { sync_icon_->SetY(title_chip_insets.top()); } } @@ -91,7 +91,7 @@ void BraveTabGroupHeader::VisualsChanged() { LayoutTitleChipForVerticalTabs(); } - if (ShouldShowSyncIcon()) { + if (ShouldShowHeaderIcon()) { sync_icon_->SetImage(ui::ImageModel::FromVectorIcon( kLeoProductSyncIcon, SkColorSetA(GetGroupColor(), 0.6 * 255), group_style_->GetSyncIconWidth())); diff --git a/browser/ui/views/tabs/brave_tab_search_button.cc b/browser/ui/views/tabs/brave_tab_search_button.cc index 803217b774ef..98aa9ab54e8e 100644 --- a/browser/ui/views/tabs/brave_tab_search_button.cc +++ b/browser/ui/views/tabs/brave_tab_search_button.cc @@ -17,11 +17,13 @@ BraveTabSearchButton::BraveTabSearchButton( TabStripController* tab_strip_controller, - tabs::TabDeclutterController* tab_declutter_controller, - Edge flat_edge) + BrowserWindowInterface* browser_window_interface, + Edge fixed_flat_edge, + Edge animated_flat_edge) : TabSearchButton(tab_strip_controller, - tab_declutter_controller, - flat_edge) { + browser_window_interface, + fixed_flat_edge, + animated_flat_edge) { // Resetting the tab search bubble host first, to avoid a dangling in // `BraveTabSearchButton`, triggered `TabSearchBubbleHost` calling // `SetButtonController` and in the process destroying the still alive @@ -30,7 +32,7 @@ BraveTabSearchButton::BraveTabSearchButton( tab_search_bubble_host_ = nullptr; tab_search_bubble_host_ = std::make_unique( - this, tab_declutter_controller, tab_strip_controller->GetProfile()); + this, browser_window_interface); // Apply toolbar's icon color to search button. SetForegroundFrameActiveColorId(kColorToolbarButtonIcon); diff --git a/browser/ui/views/tabs/brave_tab_search_button.h b/browser/ui/views/tabs/brave_tab_search_button.h index bd7c65d33375..d45a395bc391 100644 --- a/browser/ui/views/tabs/brave_tab_search_button.h +++ b/browser/ui/views/tabs/brave_tab_search_button.h @@ -15,8 +15,9 @@ class BraveTabSearchButton : public TabSearchButton { public: explicit BraveTabSearchButton( TabStripController* tab_strip_controller, - tabs::TabDeclutterController* tab_declutter_controller, - Edge flat_edge); + BrowserWindowInterface* browser_window_interface, + Edge fixed_flat_edge, + Edge animated_flat_edge); ~BraveTabSearchButton() override; BraveTabSearchButton(const BraveTabSearchButton&) = delete; BraveTabSearchButton& operator=(const BraveTabSearchButton&) = delete; diff --git a/browser/ui/views/tabs/brave_tab_strip.cc b/browser/ui/views/tabs/brave_tab_strip.cc index c5a98a354455..f5bcd00083d8 100644 --- a/browser/ui/views/tabs/brave_tab_strip.cc +++ b/browser/ui/views/tabs/brave_tab_strip.cc @@ -327,7 +327,7 @@ void BraveTabStrip::UpdateTabContainer() { auto* tab = original_container->GetTabAtModelIndex(i); // At this point, we don't have group views in the container. So before // restoring groups, clears group for tabs. - tab->SetGroup(std::nullopt); + tab->set_group(std::nullopt); tab_container_->AddTab( tab->parent()->RemoveChildViewT(tab), i, tab->data().pinned ? TabPinned::kPinned : TabPinned::kUnpinned); diff --git a/browser/ui/views/toolbar/ai_chat_button.cc b/browser/ui/views/toolbar/ai_chat_button.cc index 4605fb573518..ddb888eb48d3 100644 --- a/browser/ui/views/toolbar/ai_chat_button.cc +++ b/browser/ui/views/toolbar/ai_chat_button.cc @@ -20,7 +20,7 @@ #include "components/prefs/pref_service.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/metadata/metadata_impl_macros.h" -#include "ui/base/models/simple_menu_model.h" +#include "ui/menus/simple_menu_model.h" #include "ui/views/accessibility/view_accessibility.h" namespace { diff --git a/browser/ui/views/toolbar/brave_app_menu.cc b/browser/ui/views/toolbar/brave_app_menu.cc index 9b33bd3fd5eb..93251f4508c1 100644 --- a/browser/ui/views/toolbar/brave_app_menu.cc +++ b/browser/ui/views/toolbar/brave_app_menu.cc @@ -48,12 +48,25 @@ using views::MenuItemView; namespace { +constexpr int kBookmarksCommandIdOffset = + AppMenuModel::kMinBookmarksCommandId - IDC_FIRST_UNBOUNDED_MENU; +constexpr int kTabGroupsCommandIdOffset = + AppMenuModel::kMinTabGroupsCommandId - IDC_FIRST_UNBOUNDED_MENU; + // Copied from app_menu.cc to dump w/o crashing bool IsBookmarkCommand(int command_id) { return command_id >= IDC_FIRST_UNBOUNDED_MENU && ((command_id - IDC_FIRST_UNBOUNDED_MENU) % AppMenuModel::kNumUnboundedMenuTypes == - 0); + kBookmarksCommandIdOffset); +} + +// Copied from app_menu.cc to dump w/o crashing +bool IsTabGroupsCommand(int command_id) { + return command_id >= IDC_FIRST_UNBOUNDED_MENU && + ((command_id - IDC_FIRST_UNBOUNDED_MENU) % + AppMenuModel::kNumUnboundedMenuTypes == + kTabGroupsCommandIdOffset); } // A button that resides inside menu item. @@ -192,10 +205,11 @@ void BraveAppMenu::ExecuteCommand(int command_id, int mouse_event_flags) { // Suspect that the entry is null but can't imagine which command causes it. // See // https://github.com/brave/brave-browser/issues/37862#issuecomment-2078553575 - if (!IsBookmarkCommand(command_id) && command_id != IDC_EDIT_MENU && + if (!IsBookmarkCommand(command_id) && !IsTabGroupsCommand(command_id) && + command_id != IDC_CREATE_NEW_TAB_GROUP && command_id != IDC_EDIT_MENU && command_id != IDC_ZOOM_MENU && command_id_to_entry_.find(command_id) == command_id_to_entry_.end()) { - LOG(ERROR) << __func__ << " entry should be exsit for " << command_id; + LOG(ERROR) << __func__ << " entry should exist for " << command_id; SCOPED_CRASH_KEY_NUMBER("BraveAppMenu", "command_id", command_id); base::debug::DumpWithoutCrashing(); return; diff --git a/browser/ui/views/toolbar/brave_vpn_button.cc b/browser/ui/views/toolbar/brave_vpn_button.cc index 76e463d6a905..ffdae71ab56c 100644 --- a/browser/ui/views/toolbar/brave_vpn_button.cc +++ b/browser/ui/views/toolbar/brave_vpn_button.cc @@ -26,7 +26,6 @@ #include "components/grit/brave_components_strings.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/metadata/metadata_impl_macros.h" -#include "ui/base/models/simple_menu_model.h" #include "ui/compositor/layer.h" #include "ui/gfx/canvas.h" #include "ui/gfx/color_utils.h" @@ -34,6 +33,7 @@ #include "ui/gfx/geometry/rrect_f.h" #include "ui/gfx/paint_vector_icon.h" #include "ui/gfx/skia_util.h" +#include "ui/menus/simple_menu_model.h" #include "ui/views/animation/ink_drop.h" #include "ui/views/animation/ink_drop_host.h" #include "ui/views/background.h" diff --git a/browser/ui/views/toolbar/brave_vpn_panel_controller.cc b/browser/ui/views/toolbar/brave_vpn_panel_controller.cc index 6b5af8e7c5b8..7e2935574f4e 100644 --- a/browser/ui/views/toolbar/brave_vpn_panel_controller.cc +++ b/browser/ui/views/toolbar/brave_vpn_panel_controller.cc @@ -39,9 +39,9 @@ void BraveVPNPanelController::ShowBraveVPNPanel(bool show_select) { url += "select"; } if (!webui_bubble_manager_) { - auto* profile = browser_view_->browser()->profile(); webui_bubble_manager_ = WebUIBubbleManager::Create( - anchor_view, profile, GURL(url), IDS_BRAVE_VPN_PANEL_NAME); + anchor_view, browser_view_->browser(), GURL(url), + IDS_BRAVE_VPN_PANEL_NAME); } if (webui_bubble_manager_->GetBubbleWidget()) { diff --git a/browser/ui/views/toolbar/side_panel_button.cc b/browser/ui/views/toolbar/side_panel_button.cc index af987dfc54a7..04baf17e0f2f 100644 --- a/browser/ui/views/toolbar/side_panel_button.cc +++ b/browser/ui/views/toolbar/side_panel_button.cc @@ -18,7 +18,7 @@ #include "components/prefs/pref_service.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/metadata/metadata_impl_macros.h" -#include "ui/base/models/simple_menu_model.h" +#include "ui/menus/simple_menu_model.h" #include "ui/views/accessibility/view_accessibility.h" #include "ui/views/context_menu_controller.h" #include "ui/views/controls/button/button_controller.h" diff --git a/browser/ui/views/toolbar/wallet_button.cc b/browser/ui/views/toolbar/wallet_button.cc index f0940aa42e42..4f0480007553 100644 --- a/browser/ui/views/toolbar/wallet_button.cc +++ b/browser/ui/views/toolbar/wallet_button.cc @@ -27,11 +27,11 @@ #include "components/prefs/pref_service.h" #include "content/public/browser/web_contents.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/geometry/rect_f.h" #include "ui/gfx/geometry/rrect_f.h" #include "ui/gfx/paint_vector_icon.h" +#include "ui/menus/simple_menu_model.h" #include "ui/views/controls/highlight_path_generator.h" #include "ui/views/layout/fill_layout.h" diff --git a/browser/ui/wallet_bubble_manager_delegate_impl.cc b/browser/ui/wallet_bubble_manager_delegate_impl.cc index adbf490eebee..67751f983bc4 100644 --- a/browser/ui/wallet_bubble_manager_delegate_impl.cc +++ b/browser/ui/wallet_bubble_manager_delegate_impl.cc @@ -67,7 +67,7 @@ class WalletWebUIBubbleManager : public WebUIBubbleManagerImpl, int task_manager_string_id, bool force_load_on_create) : WebUIBubbleManagerImpl(anchor_view, - browser->profile(), + browser, webui_url, task_manager_string_id, force_load_on_create), diff --git a/browser/ui/webui/brave_rewards_source.cc b/browser/ui/webui/brave_rewards_source.cc index b9f8ca9208e0..a0ee8836aa24 100644 --- a/browser/ui/webui/brave_rewards_source.cc +++ b/browser/ui/webui/brave_rewards_source.cc @@ -19,7 +19,9 @@ namespace { scoped_refptr BitmapToMemory(const SkBitmap& image) { scoped_refptr image_bytes(new base::RefCountedBytes()); - gfx::PNGCodec::EncodeBGRASkBitmap(image, false, &image_bytes->as_vector()); + if (auto encoded = gfx::PNGCodec::EncodeBGRASkBitmap(image, false)) { + image_bytes->as_vector() = std::move(*encoded); + } return image_bytes; } diff --git a/browser/ui/webui/private_new_tab_page/brave_private_new_tab_page_handler.cc b/browser/ui/webui/private_new_tab_page/brave_private_new_tab_page_handler.cc index 244d9f567c33..d84524ec6321 100644 --- a/browser/ui/webui/private_new_tab_page/brave_private_new_tab_page_handler.cc +++ b/browser/ui/webui/private_new_tab_page/brave_private_new_tab_page_handler.cc @@ -27,7 +27,7 @@ #endif namespace { -constexpr const auto kStuckPeriod = base::Seconds(45); +constexpr auto kStuckPeriod = base::Seconds(45); } BravePrivateNewTabPageHandler::BravePrivateNewTabPageHandler( diff --git a/browser/ui/webui/settings/brave_extensions_manifest_v2_browsertest.cc b/browser/ui/webui/settings/brave_extensions_manifest_v2_browsertest.cc index a0a26a861810..8a1507f50a16 100644 --- a/browser/ui/webui/settings/brave_extensions_manifest_v2_browsertest.cc +++ b/browser/ui/webui/settings/brave_extensions_manifest_v2_browsertest.cc @@ -21,7 +21,7 @@ namespace { -constexpr const char kExtensionId[] = "doojmbjmlfjjnbmnoijecmcbfeoakpjm"; +constexpr char kExtensionId[] = "doojmbjmlfjjnbmnoijecmcbfeoakpjm"; bool ClickExtensionToggle(content::WebContents* web_contents) { return EvalJs(web_contents, diff --git a/browser/ui/webui/settings/brave_extensions_manifest_v2_handler.cc b/browser/ui/webui/settings/brave_extensions_manifest_v2_handler.cc index 4c55244f9552..30b3e09d7548 100644 --- a/browser/ui/webui/settings/brave_extensions_manifest_v2_handler.cc +++ b/browser/ui/webui/settings/brave_extensions_manifest_v2_handler.cc @@ -22,10 +22,10 @@ #include "extensions/browser/extension_system.h" namespace { -constexpr const char kNoScriptId[] = "doojmbjmlfjjnbmnoijecmcbfeoakpjm"; -constexpr const char kUBlockId[] = "cjpalhdlnbpafiamejdnhcphjbkeiagm"; -constexpr const char kUMatrixId[] = "ogfcmafjalglgifnmanfmnieipoejdcf"; -constexpr const char kAdGuardId[] = "gfggjaccafhcbfogfkogggoepomehbjl"; +constexpr char kNoScriptId[] = "doojmbjmlfjjnbmnoijecmcbfeoakpjm"; +constexpr char kUBlockId[] = "cjpalhdlnbpafiamejdnhcphjbkeiagm"; +constexpr char kUMatrixId[] = "ogfcmafjalglgifnmanfmnieipoejdcf"; +constexpr char kAdGuardId[] = "gfggjaccafhcbfogfkogggoepomehbjl"; } // namespace BASE_FEATURE(kExtensionsManifestV2, diff --git a/browser/ui/webui/settings/brave_sync_handler.cc b/browser/ui/webui/settings/brave_sync_handler.cc index f85763f0a408..5b48b9f9593b 100644 --- a/browser/ui/webui/settings/brave_sync_handler.cc +++ b/browser/ui/webui/settings/brave_sync_handler.cc @@ -38,7 +38,7 @@ using brave_sync::TimeLimitedWords; namespace { -std::string GetSyncCodeValidationString( +std::string GetSyncCodeValidationErrorString( TimeLimitedWords::ValidationStatus validation_result) { using ValidationStatus = TimeLimitedWords::ValidationStatus; switch (validation_result) { @@ -52,10 +52,12 @@ std::string GetSyncCodeValidationString( return l10n_util::GetStringUTF8(IDS_BRAVE_SYNC_CODE_EXPIRED); case ValidationStatus::kValidForTooLong: return l10n_util::GetStringUTF8(IDS_BRAVE_SYNC_CODE_VALID_FOR_TOO_LONG); - default: - NOTREACHED_IN_MIGRATION(); - return ""; + case ValidationStatus::kValid: + // kValid means no error and we don't display any error when all is ok + return "OK"; } + NOTREACHED() << "Unexpected value for TimeLimitedWords::ValidationStatus: " + << base::to_underlying(validation_result); } } // namespace @@ -222,9 +224,11 @@ void BraveSyncHandler::HandleSetSyncCode(const base::Value::List& args) { if (!pure_words_with_status.has_value()) { LOG(ERROR) << "Could not validate a sync code, validation_result=" << static_cast(pure_words_with_status.error()) << " " - << GetSyncCodeValidationString(pure_words_with_status.error()); - RejectJavascriptCallback(args[0], base::Value(GetSyncCodeValidationString( - pure_words_with_status.error()))); + << GetSyncCodeValidationErrorString( + pure_words_with_status.error()); + RejectJavascriptCallback(args[0], + base::Value(GetSyncCodeValidationErrorString( + pure_words_with_status.error()))); return; } diff --git a/browser/ui/webui/settings/brave_tor_handler.cc b/browser/ui/webui/settings/brave_tor_handler.cc index 89d7daecd470..1fceeafc4bc3 100644 --- a/browser/ui/webui/settings/brave_tor_handler.cc +++ b/browser/ui/webui/settings/brave_tor_handler.cc @@ -42,14 +42,14 @@ namespace { // https://gitlab.torproject.org/tpo/anti-censorship/rdsys/-/blob/main/doc/moat.md -constexpr const char kTorBridgesFetchUrl[] = +constexpr char kTorBridgesFetchUrl[] = "https://bridges.torproject.org/moat/fetch"; -constexpr const char kTorBridgesCheckUrl[] = +constexpr char kTorBridgesCheckUrl[] = "https://bridges.torproject.org/moat/check"; -constexpr const char kMoatVersion[] = "0.1.0"; +constexpr char kMoatVersion[] = "0.1.0"; -constexpr const char kMoatShimToken[] = "LVOippNS8UiKLH6kXf1D8pI1clLc"; +constexpr char kMoatShimToken[] = "LVOippNS8UiKLH6kXf1D8pI1clLc"; constexpr net::NetworkTrafficAnnotationTag kTorBridgesMoatAnnotation = net::DefineNetworkTrafficAnnotation("brave_tor_bridges", R"( @@ -66,7 +66,7 @@ constexpr net::NetworkTrafficAnnotationTag kTorBridgesMoatAnnotation = cookies_allowed: NO })"); -constexpr const size_t kMaxBodySize = 256 * 1024; +constexpr size_t kMaxBodySize = 256 * 1024; base::Value FetchCaptchaData() { base::Value::Dict data; @@ -203,16 +203,16 @@ class BridgeRequest { void OnCaptchaDecoded(const gfx::Image& image) { // Re-encode image as PNG and send. - std::vector encoded; - if (!gfx::PNGCodec::EncodeBGRASkBitmap(image.AsBitmap(), - /*discard_transparency=*/false, - &encoded)) { + std::optional> encoded = + gfx::PNGCodec::EncodeBGRASkBitmap(image.AsBitmap(), + /*discard_transparency=*/false); + if (!encoded) { return std::move(captcha_callback_).Run(base::Value()); } base::Value::Dict result; result.Set("captcha", - "data:image/png;base64," + base::Base64Encode(encoded)); + "data:image/png;base64," + base::Base64Encode(*encoded)); std::move(captcha_callback_).Run(base::Value(std::move(result))); state_ = State::kProvideCaptcha; } diff --git a/browser/ui/webui/settings/brave_tor_snowflake_extension_browsertest.cc b/browser/ui/webui/settings/brave_tor_snowflake_extension_browsertest.cc index e08dadea86c3..01486f2d1ef6 100644 --- a/browser/ui/webui/settings/brave_tor_snowflake_extension_browsertest.cc +++ b/browser/ui/webui/settings/brave_tor_snowflake_extension_browsertest.cc @@ -21,8 +21,7 @@ namespace { -constexpr const char kSnowflakeExtensionId[] = - "mafpmfcccpbjnhfhjnllmmalhifmlcie"; +constexpr char kSnowflakeExtensionId[] = "mafpmfcccpbjnhfhjnllmmalhifmlcie"; bool ClickSnowflakeToggle(content::WebContents* web_contents) { return EvalJs( diff --git a/browser/ui/webui/settings/brave_tor_snowflake_extension_handler.cc b/browser/ui/webui/settings/brave_tor_snowflake_extension_handler.cc index 695aafb536f4..a809d996221f 100644 --- a/browser/ui/webui/settings/brave_tor_snowflake_extension_handler.cc +++ b/browser/ui/webui/settings/brave_tor_snowflake_extension_handler.cc @@ -22,8 +22,7 @@ namespace { // https://chrome.google.com/webstore/detail/snowflake/mafpmfcccpbjnhfhjnllmmalhifmlcie -constexpr const char kSnowflakeExtensionId[] = - "mafpmfcccpbjnhfhjnllmmalhifmlcie"; +constexpr char kSnowflakeExtensionId[] = "mafpmfcccpbjnhfhjnllmmalhifmlcie"; } // namespace class SnowflakeWebstoreInstaller final diff --git a/browser/ui/webui/webcompat_reporter/webcompat_reporter_ui.cc b/browser/ui/webui/webcompat_reporter/webcompat_reporter_ui.cc index 6479ff428b74..e3c265c60914 100644 --- a/browser/ui/webui/webcompat_reporter/webcompat_reporter_ui.cc +++ b/browser/ui/webui/webcompat_reporter/webcompat_reporter_ui.cc @@ -159,14 +159,7 @@ void WebcompatReporterDOMHandler::HandleCapturedScreenshotBitmap( } base::ThreadPool::PostTaskAndReplyWithResult( FROM_HERE, - base::BindOnce( - [](SkBitmap bitmap) { - std::vector png_output; - return gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, true, &png_output) - ? std::optional(png_output) - : std::nullopt; - }, - bitmap), + base::BindOnce(&gfx::PNGCodec::EncodeBGRASkBitmap, bitmap, false), base::BindOnce(&WebcompatReporterDOMHandler::HandleEncodedScreenshotPNG, weak_ptr_factory_.GetWeakPtr(), std::move(callback_id))); } diff --git a/browser/ui/whats_new/whats_new_util.cc b/browser/ui/whats_new/whats_new_util.cc index e315962a8ee8..b752ba61d741 100644 --- a/browser/ui/whats_new/whats_new_util.cc +++ b/browser/ui/whats_new/whats_new_util.cc @@ -39,12 +39,10 @@ double g_testing_major_version = 0; std::optional GetBraveMajorVersionAsDouble( const base::Version& version) { double brave_major_version; - if (!base::StringToDouble(base::StringPrintf("%d.%d", version.components()[1], - version.components()[2]), - &brave_major_version)) { - return std::nullopt; - } - + CHECK( + base::StringToDouble(base::StringPrintf("%d.%d", version.components()[1], + version.components()[2]), + &brave_major_version)); return brave_major_version; } @@ -55,8 +53,8 @@ std::optional GetCurrentBrowserVersion() { } const auto& version = version_info::GetVersion(); - DCHECK(version.IsValid()); - DCHECK_EQ(version.components().size(), 4ul); + CHECK(version.IsValid()); + CHECK_EQ(version.components().size(), 4ul); return GetBraveMajorVersionAsDouble(version); } @@ -126,8 +124,10 @@ std::string GetTargetMajorVersionParamName() { return "target_major_version_nightly"; case Channel::UNKNOWN: return "target_major_version_unknown"; + default: + break; } - NOTREACHED_NORETURN(); + NOTREACHED() << "All channels are handled above"; } void SetCurrentVersionForTesting(double major_version) { @@ -161,10 +161,7 @@ bool ShouldShowBraveWhatsNewForState(PrefService* local_state) { } const auto current_version = GetCurrentBrowserVersion(); - if (!current_version) { - NOTREACHED_IN_MIGRATION() << __func__ << " Should get current version."; - return false; - } + CHECK(current_version); if (*current_version != *target_major_version) { VLOG(2) << __func__ << " Current version is different with target version"; diff --git a/browser/url_sanitizer/url_sanitizer_browsertest.cc b/browser/url_sanitizer/url_sanitizer_browsertest.cc index b6db78a6d27c..534efd17f5d1 100644 --- a/browser/url_sanitizer/url_sanitizer_browsertest.cc +++ b/browser/url_sanitizer/url_sanitizer_browsertest.cc @@ -27,7 +27,7 @@ namespace { -constexpr const char kYoutubeRules[] = R"json( +constexpr char kYoutubeRules[] = R"json( [{ "include": [ "*://youtu.be/*", @@ -47,7 +47,7 @@ constexpr const char kYoutubeRules[] = R"json( }] )json"; -constexpr const char kYoutubePermissions[] = R"json( +constexpr char kYoutubePermissions[] = R"json( { "js_api": [ "*://*.youtube.com/*" ] } @@ -160,7 +160,7 @@ class URLSanitizerTestBase : public InProcessBrowserTest { auto* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); - constexpr const char kClickButton[] = + static constexpr char kClickButton[] = R"js( (function() { const button = document.getElementById('$1'); diff --git a/browser/web_discovery/BUILD.gn b/browser/web_discovery/BUILD.gn index e14979f3939c..80df9a2ec2a6 100644 --- a/browser/web_discovery/BUILD.gn +++ b/browser/web_discovery/BUILD.gn @@ -14,6 +14,7 @@ source_set("unit_tests") { "//brave/components/constants", "//brave/components/search_engines", "//chrome/browser", + "//chrome/browser/prefs", "//chrome/test:test_support", "//components/prefs", "//components/search_engines", diff --git a/build/android/bytecode/java/org/brave/bytecode/BraveSingleCategorySettingsClassAdapter.java b/build/android/bytecode/java/org/brave/bytecode/BraveSingleCategorySettingsClassAdapter.java index 73f93517694f..6807506296a0 100644 --- a/build/android/bytecode/java/org/brave/bytecode/BraveSingleCategorySettingsClassAdapter.java +++ b/build/android/bytecode/java/org/brave/bytecode/BraveSingleCategorySettingsClassAdapter.java @@ -8,18 +8,26 @@ import org.objectweb.asm.ClassVisitor; public class BraveSingleCategorySettingsClassAdapter extends BraveClassVisitor { - static String sSingleCategorySettingsClassName = "org/chromium/components/browser_ui/site_settings/SingleCategorySettings"; - static String sBraveSingleCategorySettingsClassName = "org/chromium/components/browser_ui/site_settings/BraveSingleCategorySettings"; + static String sSingleCategorySettingsClassName = + "org/chromium/components/browser_ui/site_settings/SingleCategorySettings"; + static String sBraveSingleCategorySettingsClassName = + "org/chromium/components/browser_ui/site_settings/BraveSingleCategorySettings"; public BraveSingleCategorySettingsClassAdapter(ClassVisitor visitor) { super(visitor); changeSuperName(sSingleCategorySettingsClassName, sBraveSingleCategorySettingsClassName); - changeMethodOwner(sSingleCategorySettingsClassName, "onOptionsItemSelected", + changeMethodOwner( + sSingleCategorySettingsClassName, + "onOptionsItemSelected", sBraveSingleCategorySettingsClassName); - changeMethodOwner(sSingleCategorySettingsClassName, "getAddExceptionDialogMessage", + changeMethodOwner( + sSingleCategorySettingsClassName, + "getAddExceptionDialogMessageResourceId", sBraveSingleCategorySettingsClassName); - changeMethodOwner(sSingleCategorySettingsClassName, "resetList", + changeMethodOwner( + sSingleCategorySettingsClassName, + "resetList", sBraveSingleCategorySettingsClassName); } } diff --git a/build/android/bytecode/java/org/brave/bytecode/BraveToolbarManagerClassAdapter.java b/build/android/bytecode/java/org/brave/bytecode/BraveToolbarManagerClassAdapter.java index 8c522b314008..3091ac5d1ed8 100644 --- a/build/android/bytecode/java/org/brave/bytecode/BraveToolbarManagerClassAdapter.java +++ b/build/android/bytecode/java/org/brave/bytecode/BraveToolbarManagerClassAdapter.java @@ -89,6 +89,9 @@ public BraveToolbarManagerClassAdapter(ClassVisitor visitor) { deleteField(sBraveToolbarManagerClassName, "mReadAloudControllerSupplier"); makeProtectedField(sToolbarManagerClassName, "mReadAloudControllerSupplier"); + deleteField(sBraveToolbarManagerClassName, "mTopUiThemeColorProvider"); + makeProtectedField(sToolbarManagerClassName, "mTopUiThemeColorProvider"); + makePublicMethod(sToolbarManagerClassName, "onOrientationChange"); addMethodAnnotation( sBraveToolbarManagerClassName, "onOrientationChange", "Ljava/lang/Override;"); diff --git a/build/android/bytecode/java/org/brave/bytecode/BraveTopToolbarCoordinatorClassAdapter.java b/build/android/bytecode/java/org/brave/bytecode/BraveTopToolbarCoordinatorClassAdapter.java index b1aecaed0c8b..b0ec2d0bba10 100644 --- a/build/android/bytecode/java/org/brave/bytecode/BraveTopToolbarCoordinatorClassAdapter.java +++ b/build/android/bytecode/java/org/brave/bytecode/BraveTopToolbarCoordinatorClassAdapter.java @@ -20,8 +20,5 @@ public BraveTopToolbarCoordinatorClassAdapter(ClassVisitor visitor) { deleteField(sBraveTopToolbarCoordinatorClassName, "mOptionalButtonController"); makeProtectedField(sTopToolbarCoordinatorClassName, "mOptionalButtonController"); - - deleteField(sBraveTopToolbarCoordinatorClassName, "mToolbarColorObserverManager"); - makeProtectedField(sTopToolbarCoordinatorClassName, "mToolbarColorObserverManager"); } } diff --git a/build/mac/download_hermetic_xcode.py b/build/mac/download_hermetic_xcode.py index 839aec19c464..826b0b517efd 100755 --- a/build/mac/download_hermetic_xcode.py +++ b/build/mac/download_hermetic_xcode.py @@ -22,11 +22,11 @@ def LoadPList(path): return plistlib.load(f) # This contains binaries from Xcode 14.3, along with the macOS 13.3 SDK -XCODE_VERSION = '16.0' +XCODE_VERSION = '16.1' HERMETIC_XCODE_BINARY = ( DEPS_PACKAGES_INTERNAL_URL + '/xcode-hermetic-toolchain/xcode-hermetic-toolchain-xcode-' + - XCODE_VERSION + '-sdk-15.0-14.0.tar.gz') + XCODE_VERSION + '-sdk-15.1-14.0.tar.gz') # The toolchain will not be downloaded if the minimum OS version is not met. 19 # is the major version number for macOS 10.15. Xcode 13.2 13C90 only runs on diff --git a/chromium_src/android_webview/browser/aw_permission_manager.cc b/chromium_src/android_webview/browser/aw_permission_manager.cc index 661e47662003..0cf1a4893ae0 100644 --- a/chromium_src/android_webview/browser/aw_permission_manager.cc +++ b/chromium_src/android_webview/browser/aw_permission_manager.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 "android_webview/browser/aw_permission_manager.h" + #include "components/permissions/permission_util.h" #include "third_party/blink/public/common/permissions/permission_utils.h" @@ -23,5 +25,25 @@ case PermissionType::BRAVE_OPEN_AI_CHAT: \ case PermissionType::NUM +namespace android_webview { + +void AwPermissionManager::SetOriginCanReadEnumerateDevicesAudioLabels( + const url::Origin& origin, + bool audio) {} + +void AwPermissionManager::SetOriginCanReadEnumerateDevicesVideoLabels( + const url::Origin& origin, + bool video) {} + +} // namespace android_webview + +#define SetOriginCanReadEnumerateDevicesAudioLabels \ + SetOriginCanReadEnumerateDevicesAudioLabels_ChromiumImpl +#define SetOriginCanReadEnumerateDevicesVideoLabels \ + SetOriginCanReadEnumerateDevicesVideoLabels_ChromiumImpl + #include "src/android_webview/browser/aw_permission_manager.cc" + +#undef SetOriginCanReadEnumerateDevicesAudioLabels +#undef SetOriginCanReadEnumerateDevicesVideoLabels #undef NUM diff --git a/chromium_src/android_webview/browser/aw_permission_manager.h b/chromium_src/android_webview/browser/aw_permission_manager.h new file mode 100644 index 000000000000..fa206d291e90 --- /dev/null +++ b/chromium_src/android_webview/browser/aw_permission_manager.h @@ -0,0 +1,20 @@ +/* Copyright (c) 2024 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_CHROMIUM_SRC_ANDROID_WEBVIEW_BROWSER_AW_PERMISSION_MANAGER_H_ +#define BRAVE_CHROMIUM_SRC_ANDROID_WEBVIEW_BROWSER_AW_PERMISSION_MANAGER_H_ + +#define SetOriginCanReadEnumerateDevicesAudioLabels \ + SetOriginCanReadEnumerateDevicesAudioLabels_ChromiumImpl( \ + const url::Origin& origin, bool audio); \ + void SetOriginCanReadEnumerateDevicesVideoLabels_ChromiumImpl( \ + const url::Origin& origin, bool video); \ + void SetOriginCanReadEnumerateDevicesAudioLabels + +#include "src/android_webview/browser/aw_permission_manager.h" // IWYU pragma: export + +#undef SetOriginCanReadEnumerateDevicesAudioLabels + +#endif // BRAVE_CHROMIUM_SRC_ANDROID_WEBVIEW_BROWSER_AW_PERMISSION_MANAGER_H_ diff --git a/chromium_src/android_webview/browser/aw_web_contents_delegate.cc b/chromium_src/android_webview/browser/aw_web_contents_delegate.cc new file mode 100644 index 000000000000..dfe51d65894c --- /dev/null +++ b/chromium_src/android_webview/browser/aw_web_contents_delegate.cc @@ -0,0 +1,31 @@ +/* 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 "android_webview/browser/aw_web_contents_delegate.h" + +namespace content { +class RenderFrameHost; +} + +namespace url { +class Origin; +} + +namespace android_webview { + +bool AwWebContentsDelegate::CheckMediaAccessPermission( + content::RenderFrameHost* render_frame_host, + const url::Origin& security_origin, + blink::mojom::MediaStreamType type) { + return false; +} + +} // namespace android_webview + +#define CheckMediaAccessPermission CheckMediaAccessPermission_ChromiumImpl + +#include "src/android_webview/browser/aw_web_contents_delegate.cc" + +#undef CheckMediaAccessPermission diff --git a/chromium_src/android_webview/browser/aw_web_contents_delegate.h b/chromium_src/android_webview/browser/aw_web_contents_delegate.h new file mode 100644 index 000000000000..abb8f3db96fa --- /dev/null +++ b/chromium_src/android_webview/browser/aw_web_contents_delegate.h @@ -0,0 +1,21 @@ +/* Copyright (c) 2024 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_CHROMIUM_SRC_ANDROID_WEBVIEW_BROWSER_AW_WEB_CONTENTS_DELEGATE_H_ +#define BRAVE_CHROMIUM_SRC_ANDROID_WEBVIEW_BROWSER_AW_WEB_CONTENTS_DELEGATE_H_ + +#include "components/embedder_support/android/delegate/web_contents_delegate_android.h" + +#define CheckMediaAccessPermission \ + CheckMediaAccessPermission_ChromiumImpl( \ + content::RenderFrameHost* render_frame_host, \ + const url::Origin& security_origin, blink::mojom::MediaStreamType type); \ + bool CheckMediaAccessPermission + +#include "src/android_webview/browser/aw_web_contents_delegate.h" // IWYU pragma: export + +#undef CheckMediaAccessPermission + +#endif // BRAVE_CHROMIUM_SRC_ANDROID_WEBVIEW_BROWSER_AW_WEB_CONTENTS_DELEGATE_H_ diff --git a/chromium_src/android_webview/common/aw_features.cc b/chromium_src/android_webview/common/aw_features.cc index 54c47e4a13be..9d8e8eb6a939 100644 --- a/chromium_src/android_webview/common/aw_features.cc +++ b/chromium_src/android_webview/common/aw_features.cc @@ -13,7 +13,6 @@ namespace android_webview { namespace features { OVERRIDE_FEATURE_DEFAULT_STATES({{ - {kWebViewEnumerateDevicesCache, base::FEATURE_DISABLED_BY_DEFAULT}, {kWebViewMediaIntegrityApiBlinkExtension, base::FEATURE_DISABLED_BY_DEFAULT}, }}); diff --git a/chromium_src/base/json/json_reader.cc b/chromium_src/base/json/json_reader.cc deleted file mode 100644 index 6233acd85171..000000000000 --- a/chromium_src/base/json/json_reader.cc +++ /dev/null @@ -1,17 +0,0 @@ -/* Copyright (c) 2024 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at https://mozilla.org/MPL/2.0/. */ - -#include "src/base/json/json_reader.cc" - -namespace base { - -#if BUILDFLAG(BUILD_RUST_JSON_READER) -JSONReader::Result DecodeJSONInRust(std::string_view json, int options) { - SCOPED_UMA_HISTOGRAM_TIMER_MICROS(kSecurityJsonParsingTime); - return DecodeJSONInRust(json, options, internal::kAbsoluteMaxDepth); -} -#endif // BUILDFLAG(BUILD_RUST_JSON_READER) - -} // namespace base diff --git a/chromium_src/base/json/json_reader.h b/chromium_src/base/json/json_reader.h deleted file mode 100644 index 134b0226a325..000000000000 --- a/chromium_src/base/json/json_reader.h +++ /dev/null @@ -1,20 +0,0 @@ -/* Copyright (c) 2024 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at https://mozilla.org/MPL/2.0/. */ -#ifndef BRAVE_CHROMIUM_SRC_BASE_JSON_JSON_READER_H_ -#define BRAVE_CHROMIUM_SRC_BASE_JSON_JSON_READER_H_ - -#include "base/rust_buildflags.h" // IWYU pragma: private -#include "src/base/json/json_reader.h" // IWYU pragma: export - -namespace base { - -#if BUILDFLAG(BUILD_RUST_JSON_READER) -BASE_EXPORT JSONReader::Result DecodeJSONInRust(std::string_view json, - int options); -#endif // BUILDFLAG(BUILD_RUST_JSON_READER) - -} // namespace base - -#endif // BRAVE_CHROMIUM_SRC_BASE_JSON_JSON_READER_H_ diff --git a/chromium_src/base/logging/rust_log_integration.cc b/chromium_src/base/logging/rust_log_integration.cc new file mode 100644 index 000000000000..318b5852b2da --- /dev/null +++ b/chromium_src/base/logging/rust_log_integration.cc @@ -0,0 +1,41 @@ +/* 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 "base/logging/rust_log_integration.h" + +#define print_rust_log print_rust_log_chromium_impl +#include "src/base/logging/rust_log_integration.cc" +#undef print_rust_log + +namespace logging { +namespace internal { + +BASE_EXPORT void print_rust_log(const char* msg, + const char* file, + int line, + LogSeverity severity, + bool verbose) { + switch (severity) { + // Trace and debug logs are set as `LOGGING_INFO`. Trace is also set as + // versbose, so we make a higher level verbosity. + case LOGGING_INFO: + severity = LOGGING_VERBOSE - verbose; + break; + default: + // All other cases are handled by the upstream version. + print_rust_log_chromium_impl(msg, file, line, severity, verbose); + return; + } + + if (!VLOG_IS_ON(-severity)) { + return; + } + + logging::LogMessage log_message(file, line, severity); + log_message.stream() << msg; +} + +} // namespace internal +} // namespace logging diff --git a/chromium_src/chrome/browser/browser_features.cc b/chromium_src/chrome/browser/browser_features.cc index cea197d71be2..e6dfd7130f26 100644 --- a/chromium_src/chrome/browser/browser_features.cc +++ b/chromium_src/chrome/browser/browser_features.cc @@ -17,7 +17,6 @@ OVERRIDE_FEATURE_DEFAULT_STATES({{ {kDestroyProfileOnBrowserClose, base::FEATURE_DISABLED_BY_DEFAULT}, // Google has asked embedders not to enforce these pins: // https://groups.google.com/a/chromium.org/g/embedder-dev/c/XsNTwEiN1lI/m/TMXh-ZvOAAAJ - {kKeyPinningComponentUpdater, base::FEATURE_DISABLED_BY_DEFAULT}, {kNewTabPageTriggerForPrerender2, base::FEATURE_DISABLED_BY_DEFAULT}, #if !BUILDFLAG(IS_ANDROID) {kReportPakFileIntegrity, base::FEATURE_DISABLED_BY_DEFAULT}, diff --git a/chromium_src/chrome/browser/companion/core/features.cc b/chromium_src/chrome/browser/companion/core/features.cc deleted file mode 100644 index 52e692583926..000000000000 --- a/chromium_src/chrome/browser/companion/core/features.cc +++ /dev/null @@ -1,23 +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/companion/core/features.cc" - -#include "base/feature_override.h" - -namespace companion { -namespace features { -namespace internal { - -OVERRIDE_FEATURE_DEFAULT_STATES({{ - {kCompanionEnabledByObservingExpsNavigations, - base::FEATURE_DISABLED_BY_DEFAULT}, - {kSidePanelCompanion, base::FEATURE_DISABLED_BY_DEFAULT}, - {kSidePanelCompanion2, base::FEATURE_DISABLED_BY_DEFAULT}, -}}); - -} // namespace internal -} // namespace features -} // namespace companion diff --git a/chromium_src/chrome/browser/component_updater/pki_metadata_component_installer_unittest.cc b/chromium_src/chrome/browser/component_updater/pki_metadata_component_installer_unittest.cc new file mode 100644 index 000000000000..44e72f8ddd54 --- /dev/null +++ b/chromium_src/chrome/browser/component_updater/pki_metadata_component_installer_unittest.cc @@ -0,0 +1,33 @@ +/* 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 https://mozilla.org/MPL/2.0/. */ + +#include "src/chrome/browser/component_updater/pki_metadata_component_installer_unittest.cc" + +namespace component_updater { + +TEST_F(PKIMetadataComponentInstallerTest, + InstallComponentUpdatesPinningIsDisabled) { + // Initialize the network service. + content::GetNetworkService(); + task_environment_.RunUntilIdle(); + WriteKPConfigToFile(); + policy_->ComponentReady(base::Version("1.2.3.4"), + component_install_dir_.GetPath(), + base::Value::Dict()); + task_environment_.RunUntilIdle(); + + network::NetworkService* network_service = + network::NetworkService::GetNetworkServiceForTesting(); + ASSERT_TRUE(network_service); + EXPECT_FALSE(network_service->pins_list_updated()); + const std::vector& pinsets = + network_service->pinsets(); + const std::vector& host_pins = + network_service->host_pins(); + EXPECT_EQ(pinsets.size(), 0u); + EXPECT_EQ(host_pins.size(), 0u); +} + +} // namespace component_updater diff --git a/chromium_src/chrome/browser/devtools/aida_client_unittest.cc b/chromium_src/chrome/browser/devtools/aida_client_unittest.cc new file mode 100644 index 000000000000..33e4c92fe84f --- /dev/null +++ b/chromium_src/chrome/browser/devtools/aida_client_unittest.cc @@ -0,0 +1,17 @@ +/* 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/chrome/browser/devtools/aida_client_unittest.cc" + +TEST_F(AidaClientTest, NotAvailable) { + auto availability = AidaClient::CanUseAida(profile_.get()); + EXPECT_FALSE(availability.available); + EXPECT_TRUE(availability.blocked); + EXPECT_TRUE(availability.blocked_by_age); + EXPECT_TRUE(availability.blocked_by_enterprise_policy); + EXPECT_TRUE(availability.blocked_by_geo); + EXPECT_FALSE(availability.blocked_by_rollout); + EXPECT_TRUE(availability.disallow_logging); +} diff --git a/chromium_src/chrome/browser/flags/android/chrome_feature_list.cc b/chromium_src/chrome/browser/flags/android/chrome_feature_list.cc index 71d43207d275..2c3350bdc599 100644 --- a/chromium_src/chrome/browser/flags/android/chrome_feature_list.cc +++ b/chromium_src/chrome/browser/flags/android/chrome_feature_list.cc @@ -56,7 +56,6 @@ namespace chrome { namespace android { OVERRIDE_FEATURE_DEFAULT_STATES({{ - {kIncognitoReauthenticationForAndroid, base::FEATURE_ENABLED_BY_DEFAULT}, {kMagicStackAndroid, base::FEATURE_DISABLED_BY_DEFAULT}, {kAdaptiveButtonInTopToolbarCustomizationV2, base::FEATURE_DISABLED_BY_DEFAULT}, diff --git a/chromium_src/chrome/browser/notifications/notification_platform_bridge_android.h b/chromium_src/chrome/browser/notifications/notification_platform_bridge_android.h new file mode 100644 index 000000000000..81ff1f98c708 --- /dev/null +++ b/chromium_src/chrome/browser/notifications/notification_platform_bridge_android.h @@ -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/. */ + +#ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_PLATFORM_BRIDGE_ANDROID_H_ +#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_PLATFORM_BRIDGE_ANDROID_H_ + +#define OnNotificationProcessed \ + Unused() {} \ + friend class BraveNotificationPlatformBridgeHelperAndroid; \ + void OnNotificationProcessed + +#include "src/chrome/browser/notifications/notification_platform_bridge_android.h" // IWYU pragma: export + +#undef OnNotificationProcessed + +#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_PLATFORM_BRIDGE_ANDROID_H_ diff --git a/chromium_src/chrome/browser/page_load_metrics/page_load_metrics_initialize.cc b/chromium_src/chrome/browser/page_load_metrics/page_load_metrics_initialize.cc index eb1127cee6e0..bdb422487585 100644 --- a/chromium_src/chrome/browser/page_load_metrics/page_load_metrics_initialize.cc +++ b/chromium_src/chrome/browser/page_load_metrics/page_load_metrics_initialize.cc @@ -10,11 +10,9 @@ #include "brave/components/brave_perf_predictor/browser/perf_predictor_page_metrics_observer.h" -namespace chrome { - namespace { -class BravePageLoadMetricsEmbedder : public chrome::PageLoadMetricsEmbedder { +class BravePageLoadMetricsEmbedder : public PageLoadMetricsEmbedder { public: explicit BravePageLoadMetricsEmbedder(content::WebContents* web_contents); BravePageLoadMetricsEmbedder(const BravePageLoadMetricsEmbedder&) = delete; @@ -30,7 +28,7 @@ class BravePageLoadMetricsEmbedder : public chrome::PageLoadMetricsEmbedder { BravePageLoadMetricsEmbedder::BravePageLoadMetricsEmbedder( content::WebContents* web_contents) - : chrome::PageLoadMetricsEmbedder(web_contents) {} + : PageLoadMetricsEmbedder(web_contents) {} BravePageLoadMetricsEmbedder::~BravePageLoadMetricsEmbedder() = default; @@ -56,5 +54,3 @@ void InitializePageLoadMetricsForWebContents( web_contents, std::make_unique(web_contents)); } - -} // namespace chrome diff --git a/chromium_src/chrome/browser/profiles/profile_avatar_icon_util.cc b/chromium_src/chrome/browser/profiles/profile_avatar_icon_util.cc index f037417e7c0e..e9e4bff308b2 100644 --- a/chromium_src/chrome/browser/profiles/profile_avatar_icon_util.cc +++ b/chromium_src/chrome/browser/profiles/profile_avatar_icon_util.cc @@ -29,12 +29,6 @@ namespace profiles { struct IconResourceInfo; -#if !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_ANDROID) -constexpr size_t kBraveDefaultAvatarIconsCount = 34; -#else - constexpr size_t kBraveDefaultAvatarIconsCount = 0; -#endif - const IconResourceInfo* GetBraveDefaultAvatarIconResourceInfo( size_t chromium_index); diff --git a/chromium_src/chrome/browser/profiles/profile_avatar_icon_util.h b/chromium_src/chrome/browser/profiles/profile_avatar_icon_util.h index 6604bd254dc6..f8c0a78c84f7 100644 --- a/chromium_src/chrome/browser/profiles/profile_avatar_icon_util.h +++ b/chromium_src/chrome/browser/profiles/profile_avatar_icon_util.h @@ -6,16 +6,23 @@ #ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_PROFILES_PROFILE_AVATAR_ICON_UTIL_H_ #define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_PROFILES_PROFILE_AVATAR_ICON_UTIL_H_ +#include "build/build_config.h" + #include "src/chrome/browser/profiles/profile_avatar_icon_util.h" // IWYU pragma: export namespace profiles { - // Access original value for tests - extern const size_t kBraveDefaultAvatarIconsCount; - // Provide direct access to custom implementation - base::Value::Dict GetDefaultProfileAvatarIconAndLabel_Brave( - SkColor fill_color, - SkColor stroke_color, - bool selected); + +#if !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_ANDROID) +inline constexpr size_t kBraveDefaultAvatarIconsCount = 34; +#else +inline constexpr size_t kBraveDefaultAvatarIconsCount = 0; +#endif + +// Provide direct access to custom implementation +base::Value::Dict GetDefaultProfileAvatarIconAndLabel_Brave( + SkColor fill_color, + SkColor stroke_color, + bool selected); } // namespace profiles #endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_PROFILES_PROFILE_AVATAR_ICON_UTIL_H_ diff --git a/chromium_src/chrome/browser/screen_ai/screen_ai_install_state.cc b/chromium_src/chrome/browser/screen_ai/screen_ai_install_state.cc new file mode 100644 index 000000000000..5d1490e2d4dd --- /dev/null +++ b/chromium_src/chrome/browser/screen_ai/screen_ai_install_state.cc @@ -0,0 +1,16 @@ +/* Copyright (c) 2024 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#include "chrome/browser/screen_ai/screen_ai_install_state.h" + +#define ShouldInstall ShouldInstall_ChromiumImpl +#include "src/chrome/browser/screen_ai/screen_ai_install_state.cc" +#undef ShouldInstall + +namespace screen_ai { +bool ScreenAIInstallState::ShouldInstall(PrefService* local_state) { + return false; +} +} // namespace screen_ai diff --git a/chromium_src/chrome/browser/screen_ai/screen_ai_install_state.h b/chromium_src/chrome/browser/screen_ai/screen_ai_install_state.h new file mode 100644 index 000000000000..22d61067b929 --- /dev/null +++ b/chromium_src/chrome/browser/screen_ai/screen_ai_install_state.h @@ -0,0 +1,17 @@ +/* Copyright (c) 2024 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_SCREEN_AI_SCREEN_AI_INSTALL_STATE_H_ +#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_SCREEN_AI_SCREEN_AI_INSTALL_STATE_H_ + +#define ShouldInstall \ + ShouldInstall_ChromiumImpl(PrefService* local_state); \ + static bool ShouldInstall + +#include "src/chrome/browser/screen_ai/screen_ai_install_state.h" // IWYU pragma: export + +#undef ShouldInstall + +#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_SCREEN_AI_SCREEN_AI_INSTALL_STATE_H_ 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 341843b8cf8c..c7bb145a4bf6 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 @@ -50,7 +50,7 @@ enum { } // namespace brave_syncable_prefs_ids const auto& BraveSyncablePreferences() { - static const auto kBraveSyncablePrefsAllowList = base::MakeFixedFlatMap< + static constexpr auto kBraveSyncablePrefsAllowList = base::MakeFixedFlatMap< std::string_view, sync_preferences::SyncablePrefMetadata>({ {"profile.content_settings.exceptions.braveShields", {brave_syncable_prefs_ids::kProfileContentSettingsExceptionsBraveShields, diff --git a/chromium_src/chrome/browser/ui/autofill/chrome_autofill_client.cc b/chromium_src/chrome/browser/ui/autofill/chrome_autofill_client.cc index e486d70edcad..98bce8b8eb29 100644 --- a/chromium_src/chrome/browser/ui/autofill/chrome_autofill_client.cc +++ b/chromium_src/chrome/browser/ui/autofill/chrome_autofill_client.cc @@ -16,7 +16,7 @@ #include "mojo/public/cpp/bindings/associated_receiver.h" #if !BUILDFLAG(IS_ANDROID) -#include "chrome/browser/autofill_prediction_improvements/chrome_autofill_prediction_improvements_client.h" +#include "chrome/browser/autofill_ai/chrome_autofill_ai_client.h" #endif // !BUILDFLAG(IS_ANDROID) namespace autofill { diff --git a/chromium_src/chrome/browser/ui/browser_window/browser_window_features.cc b/chromium_src/chrome/browser/ui/browser_window/browser_window_features.cc index 9b127cdc7c7c..75249b64e6b4 100644 --- a/chromium_src/chrome/browser/ui/browser_window/browser_window_features.cc +++ b/chromium_src/chrome/browser/ui/browser_window/browser_window_features.cc @@ -40,6 +40,6 @@ BraveVPNController* BrowserWindowFeatures::GetBraveVPNController() { #if BUILDFLAG(ENABLE_BRAVE_VPN) return brave_vpn_controller_.get(); #else - NOTREACHED_NORETURN(); + NOTREACHED(); #endif } diff --git a/chromium_src/chrome/browser/ui/chrome_pages.cc b/chromium_src/chrome/browser/ui/chrome_pages.cc index e9e647b7b017..7d7a06c55d63 100644 --- a/chromium_src/chrome/browser/ui/chrome_pages.cc +++ b/chromium_src/chrome/browser/ui/chrome_pages.cc @@ -5,7 +5,7 @@ // It has caller in the same file #define BRAVE_GET_SETTINGS_URL \ -GURL GetSettingsUrl_ChromiumImpl(const std::string& sub_page) { + GURL GetSettingsUrl_ChromiumImpl(std::string_view sub_page) { // BRAVE_GET_SETTINGS_URL #include "src/chrome/browser/ui/chrome_pages.cc" @@ -16,7 +16,7 @@ GURL GetSettingsUrl_ChromiumImpl(const std::string& sub_page) { namespace chrome { -GURL GetSettingsUrl(const std::string& sub_page) { +GURL GetSettingsUrl(std::string_view sub_page) { if (sub_page == chrome::kSyncSetupSubPage) return chrome::GetSettingsUrl(kBraveSyncSetupPath); return GetSettingsUrl_ChromiumImpl(sub_page); diff --git a/chromium_src/chrome/browser/ui/tabs/recent_tabs_sub_menu_model_browsertest.cc b/chromium_src/chrome/browser/ui/tabs/recent_tabs_sub_menu_model_browsertest.cc new file mode 100644 index 000000000000..0b2a5cf5ca81 --- /dev/null +++ b/chromium_src/chrome/browser/ui/tabs/recent_tabs_sub_menu_model_browsertest.cc @@ -0,0 +1,89 @@ +/* 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 https://mozilla.org/MPL/2.0/. */ + +#include + +#include "base/containers/to_vector.h" +#include "base/strings/string_util.h" + +// Disabling these tests because they refer to g_brave_browser_process which is +// not initialized in unit tests, is null and so they are crashing. Not related +// to change in RecentTabsSubMenuModel for additional `More...` menu item +#define RecentlyClosedTabsFromCurrentSession \ + DISABLED_RecentlyClosedTabsFromCurrentSession + +#define RecentlyClosedTabsAndWindowsFromLastSession \ + DISABLED_RecentlyClosedTabsAndWindowsFromLastSession + +#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 + +// Disabling these tests because upstream code won't execute +// IDC_SHOW_HISTORY_CLUSTERS_SIDE_PANEL command when history clusters aren't +// enabled but the test doesn't check for it. +#define LogMenuMetricsForShowGroupedHistory \ + DISABLED_LogMenuMetricsForShowGroupedHistory + +#define BRAVE_RECENT_TABS_SUB_MENU_MODEL_TEST \ + void VerifyModel(const RecentTabsSubMenuModel& model, \ + base::span data); \ + void VerifyModel(const ui::MenuModel* model, \ + base::span data); + +// The case when number of tabs on other device is <=4 so we do not add +// `More...` item is tested by RecentTabsSubMenuModelTest.MaxSessionsAndRecency + +#include "src/chrome/browser/ui/tabs/recent_tabs_sub_menu_model_browsertest.cc" + +#undef BRAVE_RECENT_TABS_SUB_MENU_MODEL_TEST + +#undef LogMenuMetricsForShowGroupedHistory +#undef RecentlyClosedTabsAndWindowsFromLastSessionWithRefresh +#undef MaxTabsPerSessionAndRecency +#undef MaxSessionsAndRecency +#undef RecentlyClosedTabsAndWindowsFromLastSession +#undef RecentlyClosedTabsFromCurrentSession +#undef RecentlyClosedGroupsFromCurrentSession + +// This override is in place because we must adjust the menu model to match our +// expectations +void RecentTabsSubMenuModelTest::VerifyModel( + const RecentTabsSubMenuModel& model, + base::span input) { + // We have to copy it over as we can not modify the input. + auto data = base::ToVector(input); + + // We replace the "Sign in to see tabs from other devices" menu command with + // the non-command string "No tabs from other devices" and need to adjust the + // data + auto& item_data = data.back(); + if (item_data.type == ui::MenuModel::TYPE_COMMAND) { + item_data.enabled = false; + } + + // The first two commands are History and History Clusters, but we disable + // History Clusters and upstream won't show it, so we should skip one command. + ::VerifyModel(model, base::make_span(data).subspan(1)); +} + +void RecentTabsSubMenuModelTest::VerifyModel(const ui::MenuModel* model, + base::span data) { + ::VerifyModel(model, data); +} diff --git a/chromium_src/chrome/browser/ui/tabs/recent_tabs_sub_menu_model_unittest.cc b/chromium_src/chrome/browser/ui/tabs/recent_tabs_sub_menu_model_unittest.cc deleted file mode 100644 index d9b1264ff562..000000000000 --- a/chromium_src/chrome/browser/ui/tabs/recent_tabs_sub_menu_model_unittest.cc +++ /dev/null @@ -1,89 +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 https://mozilla.org/MPL/2.0/. */ - -#include - -#include "base/containers/to_vector.h" -#include "base/strings/string_util.h" - -// Disabling these tests because they refer to g_brave_browser_process which is -// not initialized in unit tests, is null and so they are crashing. Not related -// to change in RecentTabsSubMenuModel for additional `More...` menu item -#define RecentlyClosedTabsFromCurrentSession \ - DISABLED_RecentlyClosedTabsFromCurrentSession - -#define RecentlyClosedTabsAndWindowsFromLastSession \ - DISABLED_RecentlyClosedTabsAndWindowsFromLastSession - -#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 - -// Disabling these tests because upstream code won't execute -// IDC_SHOW_HISTORY_CLUSTERS_SIDE_PANEL command when history clusters aren't -// enabled but the test doesn't check for it. -#define LogMenuMetricsForShowGroupedHistory \ - DISABLED_LogMenuMetricsForShowGroupedHistory - -#define BRAVE_RECENT_TABS_SUB_MENU_MODEL_TEST \ - void VerifyModel(const RecentTabsSubMenuModel& model, \ - base::span data); \ - void VerifyModel(const ui::MenuModel* model, \ - base::span data); - -// The case when number of tabs on other device is <=4 so we do not add -// `More...` item is tested by RecentTabsSubMenuModelTest.MaxSessionsAndRecency - -#include "src/chrome/browser/ui/tabs/recent_tabs_sub_menu_model_unittest.cc" - -#undef BRAVE_RECENT_TABS_SUB_MENU_MODEL_TEST - -#undef LogMenuMetricsForShowGroupedHistory -#undef RecentlyClosedTabsAndWindowsFromLastSessionWithRefresh -#undef MaxTabsPerSessionAndRecency -#undef MaxSessionsAndRecency -#undef RecentlyClosedTabsAndWindowsFromLastSession -#undef RecentlyClosedTabsFromCurrentSession -#undef RecentlyClosedGroupsFromCurrentSession - -// This override is in place because we must adjust the menu model to match our -// expectations -void RecentTabsSubMenuModelTest::VerifyModel( - const RecentTabsSubMenuModel& model, - base::span input) { - // We have to copy it over as we can not modify the input. - auto data = base::ToVector(input); - - // We replace the "Sign in to see tabs from other devices" menu command with - // the non-command string "No tabs from other devices" and need to adjust the - // data - auto& item_data = data.back(); - if (item_data.type == ui::MenuModel::TYPE_COMMAND) { - item_data.enabled = false; - } - - // The first two commands are History and History Clusters, but we disable - // History Clusters and upstream won't show it, so we should skip one command. - ::VerifyModel(model, base::make_span(data).subspan(1)); -} - -void RecentTabsSubMenuModelTest::VerifyModel(const ui::MenuModel* model, - base::span data) { - ::VerifyModel(model, data); -} diff --git a/chromium_src/chrome/browser/ui/toolbar/chrome_labs/chrome_labs_utils.cc b/chromium_src/chrome/browser/ui/toolbar/chrome_labs/chrome_labs_utils.cc new file mode 100644 index 000000000000..1105275bacbe --- /dev/null +++ b/chromium_src/chrome/browser/ui/toolbar/chrome_labs/chrome_labs_utils.cc @@ -0,0 +1,12 @@ +/* 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/. */ + +#define IsChromeLabsEnabled IsChromeLabsEnabled_ChromiumImpl +#include "src/chrome/browser/ui/toolbar/chrome_labs/chrome_labs_utils.cc" +#undef IsChromeLabsEnabled + +bool IsChromeLabsEnabled() { + return false; +} diff --git a/chromium_src/chrome/browser/ui/ui_features.cc b/chromium_src/chrome/browser/ui/ui_features.cc index 607407f6f078..7ce9d15b8198 100644 --- a/chromium_src/chrome/browser/ui/ui_features.cc +++ b/chromium_src/chrome/browser/ui/ui_features.cc @@ -11,7 +11,6 @@ namespace features { OVERRIDE_FEATURE_DEFAULT_STATES({{ - {kChromeLabs, base::FEATURE_DISABLED_BY_DEFAULT}, #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) {kFewerUpdateConfirmations, base::FEATURE_DISABLED_BY_DEFAULT}, #endif diff --git a/chromium_src/chrome/browser/ui/views/accelerator_table.cc b/chromium_src/chrome/browser/ui/views/accelerator_table.cc index 8b6e086acd20..08f594d2860b 100644 --- a/chromium_src/chrome/browser/ui/views/accelerator_table.cc +++ b/chromium_src/chrome/browser/ui/views/accelerator_table.cc @@ -15,7 +15,7 @@ namespace { -const AcceleratorMapping kBraveAcceleratorMap[] = { +constexpr AcceleratorMapping kBraveAcceleratorMap[] = { {ui::VKEY_M, ui::EF_CONTROL_DOWN, IDC_TOGGLE_TAB_MUTE}, // Ctrl+B(or Cmd+B) {ui::VKEY_B, ui::EF_PLATFORM_ACCELERATOR, IDC_TOGGLE_SIDEBAR}, 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 70c08343002c..8e3705141a57 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 @@ -4,12 +4,13 @@ * You can obtain one at https://mozilla.org/MPL/2.0/. */ #include "chrome/browser/ui/views/download/download_shelf_context_menu_view.h" + #include "brave/grit/brave_generated_resources.h" #include "chrome/browser/download/bubble/download_bubble_prefs.h" #include "chrome/browser/download/download_ui_model.h" #include "chrome/browser/profiles/profile_manager.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/base/models/simple_menu_model.h" +#include "ui/menus/simple_menu_model.h" #define DownloadShelfContextMenuView DownloadShelfContextMenuViewChromium diff --git a/chromium_src/chrome/browser/ui/views/profiles/profile_menu_view_base.h b/chromium_src/chrome/browser/ui/views/profiles/profile_menu_view_base.h index 2289f201ead2..7d3d923f7173 100644 --- a/chromium_src/chrome/browser/ui/views/profiles/profile_menu_view_base.h +++ b/chromium_src/chrome/browser/ui/views/profiles/profile_menu_view_base.h @@ -11,7 +11,13 @@ friend class BraveProfileMenuViewTest; \ \ public: + +// Overriding this function to avoid a second call to it. +#define SetProfileIdentityInfo(...) virtual SetProfileIdentityInfo(__VA_ARGS__) + #include "src/chrome/browser/ui/views/profiles/profile_menu_view_base.h" // IWYU pragma: export + #undef BRAVE_PROFILE_MENU_VIEW_BASE_H_ +#undef SetProfileIdentityInfo #endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_VIEWS_PROFILES_PROFILE_MENU_VIEW_BASE_H_ diff --git a/chromium_src/chrome/browser/ui/views/side_panel/side_panel_coordinator.h b/chromium_src/chrome/browser/ui/views/side_panel/side_panel_coordinator.h index 09cb0bdb9730..42e53119ae24 100644 --- a/chromium_src/chrome/browser/ui/views/side_panel/side_panel_coordinator.h +++ b/chromium_src/chrome/browser/ui/views/side_panel/side_panel_coordinator.h @@ -20,7 +20,6 @@ #include "chrome/browser/ui/views/side_panel/side_panel_registry.h" #include "chrome/browser/ui/views/side_panel/side_panel_ui.h" #include "chrome/browser/ui/views/side_panel/side_panel_util.h" -#include "chrome/browser/ui/views/side_panel/side_panel_view_state_observer.h" #include "ui/views/view_observer.h" #define CreateHeader \ diff --git a/chromium_src/chrome/browser/ui/views/toolbar/chrome_labs/chrome_labs_browsertest.cc b/chromium_src/chrome/browser/ui/views/toolbar/chrome_labs/chrome_labs_browsertest.cc new file mode 100644 index 000000000000..fc3b151661a1 --- /dev/null +++ b/chromium_src/chrome/browser/ui/views/toolbar/chrome_labs/chrome_labs_browsertest.cc @@ -0,0 +1,14 @@ +/* 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/chrome/browser/ui/views/toolbar/chrome_labs/chrome_labs_browsertest.cc" + +using ChromeLabsModelBrowserTest = InProcessBrowserTest; + +IN_PROC_BROWSER_TEST_F(ChromeLabsModelBrowserTest, NoChromeLabsModel) { + EXPECT_FALSE(BrowserView::GetBrowserViewForBrowser(browser()) + ->toolbar() + ->chrome_labs_model()); +} diff --git a/chromium_src/chrome/browser/ui/webui/certificate_manager/certificate_manager_ui.cc b/chromium_src/chrome/browser/ui/webui/certificate_manager/certificate_manager_ui.cc index 1a1df13fc97c..a9873666d044 100644 --- a/chromium_src/chrome/browser/ui/webui/certificate_manager/certificate_manager_ui.cc +++ b/chromium_src/chrome/browser/ui/webui/certificate_manager/certificate_manager_ui.cc @@ -5,11 +5,12 @@ #include "chrome/browser/ui/webui/certificate_manager/certificate_manager_ui.h" +#include "chrome/browser/ui/webui/certificate_manager/client_cert_sources.h" #include "content/public/browser/web_ui_data_source.h" namespace { -const char kBraveCRSLearnMoreLink[] = +constexpr char kBraveCRSLearnMoreLink[] = "https://github.com/brave/brave-browser/wiki/TLS-Policy#root-store"; } // namespace diff --git a/chromium_src/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chromium_src/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc index da49f0fa81ea..85a031573d11 100644 --- a/chromium_src/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc +++ b/chromium_src/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc @@ -4,7 +4,10 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "brave/browser/ui/webui/brave_web_ui_controller_factory.h" -#include "build/chromeos_buildflags.h" + +// Needed since we define CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_PROVIDER_H_ +// below +#include "chrome/browser/web_applications/web_app_provider.h" // NOLINTNEXTLINE #define CHROME_BROWSER_WEB_APPLICATIONS_SYSTEM_WEB_APPS_SYSTEM_WEB_APP_MANAGER_H_ diff --git a/chromium_src/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc b/chromium_src/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc index 2f91166fac7b..2d8813759f5d 100644 --- a/chromium_src/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc +++ b/chromium_src/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc @@ -50,7 +50,7 @@ #undef IDS_SETTINGS_PASSWORDS_AND_PASSKEYS_CHECKBOX_LABEL #define IDS_SETTINGS_PASSWORDS_AND_PASSKEYS_CHECKBOX_LABEL \ - IDS_SETTINGS_PASSWORDS_CHECKBOX_LABEL + IDS_SETTINGS_BRAVE_PASSWORDS_CHECKBOX_LABEL #undef IDS_SETTINGS_UI_FEATURE_ALIGN_LEFT #define IDS_SETTINGS_UI_FEATURE_ALIGN_LEFT \ diff --git a/chromium_src/chrome/browser/ui/webui/top_chrome/webui_contents_wrapper.cc b/chromium_src/chrome/browser/ui/webui/top_chrome/webui_contents_wrapper.cc index cd8a2ac358fc..4b7acf466bd6 100644 --- a/chromium_src/chrome/browser/ui/webui/top_chrome/webui_contents_wrapper.cc +++ b/chromium_src/chrome/browser/ui/webui/top_chrome/webui_contents_wrapper.cc @@ -8,44 +8,62 @@ #include #include "components/sessions/content/session_tab_helper.h" -#include "components/site_engagement/content/site_engagement_helper.h" -#include "content/public/browser/web_contents.h" -#include "content/public/browser/web_contents_delegate.h" -#include "content/public/browser/web_contents_observer.h" -// The buble delegate doesnt allow to open popups and we use +// The bubble delegate doesn't allow to open popups and we use // the Browser window delegate to redirect opening new popup content // to the Browser delegate instead of default one. // In order to close all popups we also save tab ids of each opened popup window // and close all with the bubble together. -#define PrimaryPageChanged \ - SetWebContentsAddNewContentsDelegate( \ - base::WeakPtr browser_delegate) { \ - browser_delegate_ = std::move(browser_delegate); \ - } \ - content::WebContents* WebUIContentsWrapper::AddNewContents( \ - content::WebContents* source, \ - std::unique_ptr new_contents, \ - const GURL& target_url, WindowOpenDisposition disposition, \ - const blink::mojom::WindowFeatures& window_features, bool user_gesture, \ - bool* was_blocked) { \ - if (!browser_delegate_) { \ - return nullptr; \ - } \ - auto* raw_popup_contents = new_contents.get(); \ - auto* contents = browser_delegate_->AddNewContents( \ - source, std::move(new_contents), target_url, \ - WindowOpenDisposition::NEW_POPUP, window_features, user_gesture, \ - was_blocked); \ - auto tab_id = \ - sessions::SessionTabHelper::IdForTab(raw_popup_contents).id(); \ - popup_ids_.push_back(tab_id); \ - return contents; \ - } \ - void WebUIContentsWrapper::ClearPopupIds() { \ - popup_ids_.clear(); \ - } \ - void WebUIContentsWrapper::PrimaryPageChanged +#define AddNewContents AddNewContents_ChromiumImpl #include "src/chrome/browser/ui/webui/top_chrome/webui_contents_wrapper.cc" -#undef PrimaryPageChanged +#undef AddNewContents + +void WebUIContentsWrapper::SetWebContentsAddNewContentsDelegate( + base::WeakPtr browser_delegate) { + browser_delegate_ = std::move(browser_delegate); +} + +void WebUIContentsWrapper::ClearPopupIds() { + popup_ids_.clear(); +} + +content::WebContents* WebUIContentsWrapper::Host::AddNewContents( + content::WebContents* source, + std::unique_ptr new_contents, + const GURL& target_url, + WindowOpenDisposition disposition, + const blink::mojom::WindowFeatures& window_features, + bool user_gesture, + bool* was_blocked) { + return WebUIContentsWrapper::Host::AddNewContents_ChromiumImpl( + source, std::move(new_contents), target_url, disposition, window_features, + user_gesture, was_blocked); +} + +content::WebContents* WebUIContentsWrapper::AddNewContents( + content::WebContents* source, + std::unique_ptr new_contents, + const GURL& target_url, + WindowOpenDisposition disposition, + const blink::mojom::WindowFeatures& window_features, + bool user_gesture, + bool* was_blocked) { + if (!browser_delegate_) { + return host_ ? host_->AddNewContents( + source, std::move(new_contents), target_url, disposition, + window_features, user_gesture, was_blocked) + : nullptr; + } + auto* raw_popup_contents = new_contents.get(); + auto* contents = browser_delegate_->AddNewContents( + source, std::move(new_contents), target_url, + WindowOpenDisposition::NEW_POPUP, window_features, user_gesture, + was_blocked); + if (!contents) { + return nullptr; + } + auto tab_id = sessions::SessionTabHelper::IdForTab(raw_popup_contents).id(); + popup_ids_.push_back(tab_id); + return contents; +} diff --git a/chromium_src/chrome/browser/ui/webui/top_chrome/webui_contents_wrapper.h b/chromium_src/chrome/browser/ui/webui/top_chrome/webui_contents_wrapper.h index b2ee024f6588..53fb248594e9 100644 --- a/chromium_src/chrome/browser/ui/webui/top_chrome/webui_contents_wrapper.h +++ b/chromium_src/chrome/browser/ui/webui/top_chrome/webui_contents_wrapper.h @@ -8,26 +8,34 @@ #include -#include "chrome/browser/ui/webui/top_chrome/webui_contents_wrapper.h" +#include "chrome/browser/ui/browser.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_delegate.h" #include "content/public/browser/web_contents_observer.h" -#include "ui/base/window_open_disposition.h" -#include "url/gurl.h" -#define PrimaryPageChanged \ - SetWebContentsAddNewContentsDelegate( \ - base::WeakPtr browser_delegate); \ - content::WebContents* AddNewContents( \ +#define HideCustomContextMenu \ + HideCustomContextMenu() {} \ + virtual content::WebContents* AddNewContents_ChromiumImpl( \ content::WebContents* source, \ std::unique_ptr new_contents, \ const GURL& target_url, WindowOpenDisposition disposition, \ const blink::mojom::WindowFeatures& window_features, bool user_gesture, \ - bool* was_blocked) override; \ + bool* was_blocked); \ + virtual void HideCustomContextMenu_Unused + +#define PrimaryPageChanged \ + SetWebContentsAddNewContentsDelegate( \ + base::WeakPtr browser_delegate); \ const std::vector& popup_ids() const { \ return popup_ids_; \ } \ void ClearPopupIds(); \ + content::WebContents* AddNewContents_ChromiumImpl( \ + content::WebContents* source, \ + std::unique_ptr new_contents, \ + const GURL& target_url, WindowOpenDisposition disposition, \ + const blink::mojom::WindowFeatures& window_features, bool user_gesture, \ + bool* was_blocked) override; \ void PrimaryPageChanged #define webui_resizes_host_ \ @@ -37,5 +45,6 @@ #include "src/chrome/browser/ui/webui/top_chrome/webui_contents_wrapper.h" // IWYU pragma: export #undef webui_resizes_host_ #undef PrimaryPageChanged +#undef HideCustomContextMenu #endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_WEBUI_TOP_CHROME_WEBUI_CONTENTS_WRAPPER_H_ diff --git a/chromium_src/chrome/browser/web_applications/os_integration/mac/apps_folder_support.mm b/chromium_src/chrome/browser/web_applications/os_integration/mac/apps_folder_support.mm index 4d9df927ed13..0997ee972fd4 100644 --- a/chromium_src/chrome/browser/web_applications/os_integration/mac/apps_folder_support.mm +++ b/chromium_src/chrome/browser/web_applications/os_integration/mac/apps_folder_support.mm @@ -18,20 +18,17 @@ #undef BRAVE_GET_CHROME_APPS_FOLDER_IMPL namespace { -base::FilePath GetLocalizableBraveAppShortcutsSubdirName() { - // clang-format off - static const char kBraveBrowserDevelopmentAppDirName[] = - "Brave Browser Development Apps.localized"; - static const char kBraveBrowserAppDirName[] = - "Brave Browser Apps.localized"; - static const char kBraveBrowserBetaAppDirName[] = - "Brave Browser Beta Apps.localized"; - static const char kBraveBrowserDevAppDirName[] = - "Brave Browser Dev Apps.localized"; - static const char kBraveBrowserNightlyAppDirName[] = - "Brave Browser Nightly Apps.localized"; - // clang-format on +constexpr char kBraveBrowserDevelopmentAppDirName[] = + "Brave Browser Development Apps.localized"; +constexpr char kBraveBrowserAppDirName[] = "Brave Browser Apps.localized"; +constexpr char kBraveBrowserBetaAppDirName[] = + "Brave Browser Beta Apps.localized"; +constexpr char kBraveBrowserDevAppDirName[] = + "Brave Browser Dev Apps.localized"; +constexpr char kBraveBrowserNightlyAppDirName[] = + "Brave Browser Nightly Apps.localized"; +base::FilePath GetLocalizableBraveAppShortcutsSubdirName() { switch (chrome::GetChannel()) { case version_info::Channel::STABLE: return base::FilePath(kBraveBrowserAppDirName); diff --git a/chromium_src/chrome/common/chrome_constants.cc b/chromium_src/chrome/common/chrome_constants.cc index a3231dd5593b..85a9559dec09 100644 --- a/chromium_src/chrome/common/chrome_constants.cc +++ b/chromium_src/chrome/common/chrome_constants.cc @@ -104,6 +104,8 @@ const base::FilePath::CharType kCRLSetFilename[] = FPL("Certificate Revocation Lists"); const base::FilePath::CharType kCustomDictionaryFileName[] = FPL("Custom Dictionary.txt"); +const base::FilePath::CharType kDeviceBoundSessionsFilename[] = + FPL("Device Bound Sessions"); const base::FilePath::CharType kDownloadServiceStorageDirname[] = FPL("Download Service"); const base::FilePath::CharType kExtensionActivityLogFilename[] = diff --git a/chromium_src/chrome/common/chrome_features.cc b/chromium_src/chrome/common/chrome_features.cc index 64873cf7fcda..146609c457d2 100644 --- a/chromium_src/chrome/common/chrome_features.cc +++ b/chromium_src/chrome/common/chrome_features.cc @@ -16,9 +16,6 @@ OVERRIDE_FEATURE_DEFAULT_STATES({{ {kHttpsFirstBalancedMode, base::FEATURE_DISABLED_BY_DEFAULT}, {kKAnonymityService, base::FEATURE_DISABLED_BY_DEFAULT}, {kKAnonymityServiceOHTTPRequests, base::FEATURE_DISABLED_BY_DEFAULT}, -#if BUILDFLAG(IS_ANDROID) - {kPrivacyGuidePreloadAndroid, base::FEATURE_DISABLED_BY_DEFAULT}, -#endif {kSCTAuditing, base::FEATURE_DISABLED_BY_DEFAULT}, #if !BUILDFLAG(IS_ANDROID) {kTrustSafetySentimentSurvey, base::FEATURE_DISABLED_BY_DEFAULT}, diff --git a/chromium_src/chrome/common/url_constants.h b/chromium_src/chrome/common/url_constants.h index cc1516c0eed3..29a1664f7cef 100644 --- a/chromium_src/chrome/common/url_constants.h +++ b/chromium_src/chrome/common/url_constants.h @@ -410,14 +410,27 @@ inline constexpr char kSyncGoogleDashboardURL[] = "https://support.brave.com/"; // The URL for the "Learn more" page for sync setup on the personal stuff page. inline constexpr char16_t kSyncLearnMoreURL[] = u"https://support.brave.com/"; +// The URL for the "Learn more" page for AI settings for managed users. +inline constexpr char16_t kAiSettingsLearnMorePageManagedUrl[] = + u"https://support.brave.com/"; + // The URL for the "Learn more" page for Help me Write. inline constexpr char kComposeLearnMorePageURL[] = "https://support.brave.com/"; +// The URL for the "Learn more" page for Help me Write for managed users. +inline constexpr char kComposeLearnMorePageManagedURL[] = + "https://support.brave.com/"; + // The URL for the "Learn more" links for pages related to History search. // TODO(crbug.com/328300718): Update help article URL. inline constexpr char kHistorySearchLearnMorePageURL[] = "https://support.brave.com/"; +// The URL for the "Learn more" links for pages related to History search for +// managed users. +inline constexpr char kHistorySearchLearnMorePageManagedURL[] = + "https://support.brave.com/"; + // The URL for the Settings page to enable history search. inline constexpr char16_t kHistorySearchSettingURL[] = u"chrome://settings/historySearch"; @@ -431,10 +444,18 @@ inline constexpr char16_t kHistorySearchV2SettingURL[] = inline constexpr char kWallpaperSearchLearnMorePageURL[] = "https://support.brave.com/"; +// The URL for the "Learn more" page for Wallpaper Search for managed users. +inline constexpr char kWallpaperSearchLearnMorePageManagedURL[] = + "https://support.brave.com/"; + // The URL for the "Learn more" page for Tab Organization. inline constexpr char kTabOrganizationLearnMorePageURL[] = "https://support.brave.com/"; +// The URL for the "Learn more" page for Tab Organization for managed users. +inline constexpr char kTabOrganizationLearnMorePageManagedURL[] = + "https://support.brave.com/"; + // The URL for the "Learn more" link in the enterprise disclaimer for managed // profile in the Signin Intercept bubble. inline constexpr char kSigninInterceptManagedDisclaimerLearnMoreURL[] = diff --git a/chromium_src/chrome/installer/mini_installer/mini_installer.cc b/chromium_src/chrome/installer/mini_installer/mini_installer.cc index af9aaa02091e..e13422f87dc5 100644 --- a/chromium_src/chrome/installer/mini_installer/mini_installer.cc +++ b/chromium_src/chrome/installer/mini_installer/mini_installer.cc @@ -44,7 +44,7 @@ namespace mini_installer { namespace { -const size_t kStandardReferralCodeLen = 6; +constexpr size_t kStandardReferralCodeLen = 6; } // namespace // Coverts a string in place to uppercase diff --git a/chromium_src/chrome/utility/importer/bookmark_html_reader.cc b/chromium_src/chrome/utility/importer/bookmark_html_reader.cc index 9aa170803b34..bbc4c232bf98 100644 --- a/chromium_src/chrome/utility/importer/bookmark_html_reader.cc +++ b/chromium_src/chrome/utility/importer/bookmark_html_reader.cc @@ -3,15 +3,17 @@ * 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 #include + +#include "base/containers/span.h" #include "build/build_config.h" #if BUILDFLAG(IS_ANDROID) namespace importer { -bool ReencodeFavicon(const unsigned char* src_data, - size_t src_len, - std::vector* png_data) { - return false; +std::optional> ReencodeFavicon( + base::span src) { + return std::nullopt; } } // namespace importer #endif diff --git a/chromium_src/components/component_updater/component_updater_service.cc b/chromium_src/components/component_updater/component_updater_service.cc index 3afe77600a22..3523a9876ae8 100644 --- a/chromium_src/components/component_updater/component_updater_service.cc +++ b/chromium_src/components/component_updater/component_updater_service.cc @@ -79,13 +79,13 @@ void CrxUpdateService::OnDemandUpdate(const std::vector& ids, void OnDemandUpdater::EnsureInstalled(const std::string& id, Callback callback) { - NOTREACHED_NORETURN(); + NOTREACHED(); } void OnDemandUpdater::OnDemandUpdate(const std::vector& ids, Priority priority, Callback callback) { - NOTREACHED_NORETURN(); + NOTREACHED(); } } // namespace component_updater diff --git a/chromium_src/components/content_settings/core/browser/host_content_settings_map.cc b/chromium_src/components/content_settings/core/browser/host_content_settings_map.cc index 10d3379fff96..6a177adaa568 100644 --- a/chromium_src/components/content_settings/core/browser/host_content_settings_map.cc +++ b/chromium_src/components/content_settings/core/browser/host_content_settings_map.cc @@ -6,6 +6,7 @@ #include "components/content_settings/core/browser/host_content_settings_map.h" #include "base/containers/contains.h" +#include "base/containers/fixed_flat_set.h" #include "brave/components/content_settings/core/browser/remote_list_provider.h" #include "build/build_config.h" #include "components/content_settings/core/browser/content_settings_utils.h" @@ -29,16 +30,16 @@ bool IsMorePermissive_BraveImpl(ContentSettingsType content_type, // We must be careful to not break this, otherwise // ProcessIncognitoInheritanceBehavior() will return `initial_setting` which // is usually ASK and incorrect for OffTheRecord profiles. - const ContentSettingsType kOffTheRecordAwareTypes[] = { - ContentSettingsType::NOTIFICATIONS, - ContentSettingsType::PROTECTED_MEDIA_IDENTIFIER, - ContentSettingsType::IDLE_DETECTION, - ContentSettingsType::BRAVE_HTTPS_UPGRADE, - }; + static constexpr auto kOffTheRecordAwareTypes = + base::MakeFixedFlatSet({ + ContentSettingsType::NOTIFICATIONS, + ContentSettingsType::PROTECTED_MEDIA_IDENTIFIER, + ContentSettingsType::IDLE_DETECTION, + ContentSettingsType::BRAVE_HTTPS_UPGRADE, + }); const bool is_more_permissive = IsMorePermissive(setting, initial_setting); - if (is_more_permissive || - base::Contains(kOffTheRecordAwareTypes, content_type) || + if (is_more_permissive || kOffTheRecordAwareTypes.contains(content_type) || base::FeatureList::IsEnabled(kAllowIncognitoPermissionInheritance)) { return is_more_permissive; } diff --git a/chromium_src/components/history_clusters/core/features.cc b/chromium_src/components/history_clusters/core/features.cc index 8e91924a5bba..5daef70586a0 100644 --- a/chromium_src/components/history_clusters/core/features.cc +++ b/chromium_src/components/history_clusters/core/features.cc @@ -21,6 +21,5 @@ OVERRIDE_FEATURE_DEFAULT_STATES({{ {kOmniboxAction, base::FEATURE_DISABLED_BY_DEFAULT}, {kOmniboxHistoryClusterProvider, base::FEATURE_DISABLED_BY_DEFAULT}, {kPersistContextAnnotationsInHistoryDb, base::FEATURE_DISABLED_BY_DEFAULT}, - {kSidePanelJourneys, base::FEATURE_DISABLED_BY_DEFAULT}, }}); } // namespace history_clusters::internal diff --git a/chromium_src/components/omnibox/browser/location_bar_model_util.cc b/chromium_src/components/omnibox/browser/location_bar_model_util.cc index 715c86d2e059..db27361d3c28 100644 --- a/chromium_src/components/omnibox/browser/location_bar_model_util.cc +++ b/chromium_src/components/omnibox/browser/location_bar_model_util.cc @@ -15,15 +15,13 @@ namespace location_bar_model { const gfx::VectorIcon& GetSecurityVectorIcon( security_state::SecurityLevel security_level, - bool use_updated_connection_security_indicators, security_state::MaliciousContentStatus malicious_content_status) { if (security_level == security_state::SECURE) { return kLeoTuneSmallIcon; } - return GetSecurityVectorIcon_Chromium( - security_level, use_updated_connection_security_indicators, - malicious_content_status); + return GetSecurityVectorIcon_Chromium(security_level, + malicious_content_status); } } // namespace location_bar_model diff --git a/chromium_src/components/omnibox/common/omnibox_features.cc b/chromium_src/components/omnibox/common/omnibox_features.cc index 80e7762ebc00..1b91223a112d 100644 --- a/chromium_src/components/omnibox/common/omnibox_features.cc +++ b/chromium_src/components/omnibox/common/omnibox_features.cc @@ -10,7 +10,6 @@ namespace omnibox { OVERRIDE_FEATURE_DEFAULT_STATES({{ - {kDocumentProviderNoSetting, base::FEATURE_DISABLED_BY_DEFAULT}, {kDocumentProviderNoSyncRequirement, base::FEATURE_DISABLED_BY_DEFAULT}, {kMlUrlScoring, base::FEATURE_DISABLED_BY_DEFAULT}, #if BUILDFLAG(IS_ANDROID) diff --git a/chromium_src/components/permissions/permission_request.cc b/chromium_src/components/permissions/permission_request.cc index e661dce8a9d1..5a91da15e211 100644 --- a/chromium_src/components/permissions/permission_request.cc +++ b/chromium_src/components/permissions/permission_request.cc @@ -9,6 +9,7 @@ #include #include "base/containers/contains.h" +#include "base/containers/fixed_flat_set.h" #include "build/build_config.h" #include "components/grit/brave_components_strings.h" #include "components/strings/grit/components_strings.h" @@ -161,18 +162,18 @@ PermissionRequest::GetDialogAnnotatedMessageText( #endif bool PermissionRequest::SupportsLifetime() const { - const RequestType kExcludedTypes[] = {RequestType::kDiskQuota, - RequestType::kMultipleDownloads, + static constexpr auto kExcludedTypes = base::MakeFixedFlatSet( + {RequestType::kDiskQuota, RequestType::kMultipleDownloads, #if BUILDFLAG(IS_ANDROID) - RequestType::kProtectedMediaIdentifier, + RequestType::kProtectedMediaIdentifier, #else RequestType::kRegisterProtocolHandler, #endif // BUILDFLAG(IS_ANDROID) #if BUILDFLAG(ENABLE_WIDEVINE) - RequestType::kWidevine + RequestType::kWidevine #endif // BUILDFLAG(ENABLE_WIDEVINE) - }; - return !base::Contains(kExcludedTypes, request_type()); + }); + return !kExcludedTypes.contains(request_type()); } void PermissionRequest::SetLifetime(std::optional lifetime) { diff --git a/chromium_src/components/permissions/permission_util.cc b/chromium_src/components/permissions/permission_util.cc index 0aea75c5f39a..1a8b36d0b4ed 100644 --- a/chromium_src/components/permissions/permission_util.cc +++ b/chromium_src/components/permissions/permission_util.cc @@ -103,7 +103,7 @@ bool PermissionUtil::IsPermission(ContentSettingsType type) { } } -PermissionType PermissionUtil::ContentSettingTypeToPermissionType( +PermissionType PermissionUtil::ContentSettingsTypeToPermissionType( ContentSettingsType permission) { switch (permission) { case ContentSettingsType::BRAVE_ADS: @@ -135,7 +135,7 @@ PermissionType PermissionUtil::ContentSettingTypeToPermissionType( case ContentSettingsType::BRAVE_OPEN_AI_CHAT: return PermissionType::BRAVE_OPEN_AI_CHAT; default: - return PermissionUtil_ChromiumImpl::ContentSettingTypeToPermissionType( + return PermissionUtil_ChromiumImpl::ContentSettingsTypeToPermissionType( permission); } } diff --git a/chromium_src/components/permissions/permission_util.h b/chromium_src/components/permissions/permission_util.h index c17f06c1f878..05675fec02f7 100644 --- a/chromium_src/components/permissions/permission_util.h +++ b/chromium_src/components/permissions/permission_util.h @@ -19,7 +19,7 @@ class PermissionUtil : public PermissionUtil_ChromiumImpl { blink::PermissionType* out); static bool IsPermission(ContentSettingsType type); - static blink::PermissionType ContentSettingTypeToPermissionType( + static blink::PermissionType ContentSettingsTypeToPermissionType( ContentSettingsType permission); static GURL GetCanonicalOrigin(ContentSettingsType permission, diff --git a/chromium_src/components/privacy_sandbox/privacy_sandbox_features.cc b/chromium_src/components/privacy_sandbox/privacy_sandbox_features.cc index cbc3a4c1152d..944b89386df8 100644 --- a/chromium_src/components/privacy_sandbox/privacy_sandbox_features.cc +++ b/chromium_src/components/privacy_sandbox/privacy_sandbox_features.cc @@ -14,7 +14,6 @@ OVERRIDE_FEATURE_DEFAULT_STATES({{ {kOverridePrivacySandboxSettingsLocalTesting, base::FEATURE_DISABLED_BY_DEFAULT}, {kPrivacySandboxFirstPartySetsUI, base::FEATURE_DISABLED_BY_DEFAULT}, - {kPrivacySandboxProactiveTopicsBlocking, base::FEATURE_DISABLED_BY_DEFAULT}, {kPrivacySandboxSettings4, base::FEATURE_DISABLED_BY_DEFAULT}, {kTrackingProtectionContentSettingUbControl, base::FEATURE_DISABLED_BY_DEFAULT}, diff --git a/chromium_src/components/sync_preferences/common_syncable_prefs_database.cc b/chromium_src/components/sync_preferences/common_syncable_prefs_database.cc index e0a5a6f96a70..416f23039d27 100644 --- a/chromium_src/components/sync_preferences/common_syncable_prefs_database.cc +++ b/chromium_src/components/sync_preferences/common_syncable_prefs_database.cc @@ -22,7 +22,7 @@ enum { } // namespace brave_syncable_prefs_ids const auto& BraveSyncablePreferences() { - static const auto kBraveCommonSyncablePrefsAllowlist = + static constexpr auto kBraveCommonSyncablePrefsAllowlist = base::MakeFixedFlatMap( {{prefs::kSyncedDefaultPrivateSearchProviderGUID, {brave_syncable_prefs_ids::kSyncedDefaultPrivateSearchProviderGUID, diff --git a/chromium_src/components/update_client/update_checker.cc b/chromium_src/components/update_client/update_checker.cc index 2a882a747a45..4b4de82a950b 100644 --- a/chromium_src/components/update_client/update_checker.cc +++ b/chromium_src/components/update_client/update_checker.cc @@ -115,7 +115,7 @@ void SequentialUpdateChecker::CheckNext() { } void SequentialUpdateChecker::UpdateResultAvailable( - const std::optional& results, + std::optional results, ErrorCategory error_category, int error, int retry_after_sec) { diff --git a/chromium_src/components/update_client/update_checker.h b/chromium_src/components/update_client/update_checker.h index 9ebd3cf1d956..181a30009aba 100644 --- a/chromium_src/components/update_client/update_checker.h +++ b/chromium_src/components/update_client/update_checker.h @@ -53,11 +53,10 @@ class SequentialUpdateChecker : public UpdateChecker { private: void CheckNext(); - void UpdateResultAvailable( - const std::optional& results, - ErrorCategory error_category, - int error, - int retry_after_sec); + void UpdateResultAvailable(std::optional results, + ErrorCategory error_category, + int error, + int retry_after_sec); THREAD_CHECKER(thread_checker_); diff --git a/chromium_src/components/viz/service/gl/gpu_service_impl.cc b/chromium_src/components/viz/service/gl/gpu_service_impl.cc index 80da3758a8a2..d7c8b74715a3 100644 --- a/chromium_src/components/viz/service/gl/gpu_service_impl.cc +++ b/chromium_src/components/viz/service/gl/gpu_service_impl.cc @@ -24,14 +24,20 @@ void GpuServiceImpl::InitializeWithHost( mojo::PendingRemote pending_gpu_host, gpu::GpuProcessShmCount use_shader_cache_shm_count, scoped_refptr default_offscreen_surface, + mojom::GpuServiceCreationParamsPtr creation_params, +#if BUILDFLAG(IS_ANDROID) gpu::SyncPointManager* sync_point_manager, gpu::SharedImageManager* shared_image_manager, gpu::Scheduler* scheduler, +#endif base::WaitableEvent* shutdown_event) { InitializeWithHost_ChromiumImpl( std::move(pending_gpu_host), std::move(use_shader_cache_shm_count), - std::move(default_offscreen_surface), sync_point_manager, - shared_image_manager, scheduler, shutdown_event); + std::move(default_offscreen_surface), std::move(creation_params), +#if BUILDFLAG(IS_ANDROID) + sync_point_manager, shared_image_manager, scheduler, +#endif + shutdown_event); #if BUILDFLAG(IS_WIN) if (gpu_host_) { std::string result; diff --git a/chromium_src/components/viz/service/gl/gpu_service_impl.h b/chromium_src/components/viz/service/gl/gpu_service_impl.h index 6eeccca2b0ea..9b866210a4bd 100644 --- a/chromium_src/components/viz/service/gl/gpu_service_impl.h +++ b/chromium_src/components/viz/service/gl/gpu_service_impl.h @@ -6,19 +6,34 @@ #ifndef BRAVE_CHROMIUM_SRC_COMPONENTS_VIZ_SERVICE_GL_GPU_SERVICE_IMPL_H_ #define BRAVE_CHROMIUM_SRC_COMPONENTS_VIZ_SERVICE_GL_GPU_SERVICE_IMPL_H_ +#include "base/compiler_specific.h" + // https://github.com/brave/brave-core/pull/17671 // To check that 'ModuleFilenamePatch' feature works, we provide a result of // call to the interested WINAPI functions. -#define InitializeWithHost \ - InitializeWithHost_ChromiumImpl( \ - mojo::PendingRemote pending_gpu_host, \ - gpu::GpuProcessShmCount use_shader_cache_shm_count, \ - scoped_refptr default_offscreen_surface, \ - gpu::SyncPointManager* sync_point_manager, \ - gpu::SharedImageManager* shared_image_manager, \ - gpu::Scheduler* scheduler, base::WaitableEvent* shutdown_event); \ - \ +#if BUILDFLAG(IS_ANDROID) +#define InitializeWithHost \ + InitializeWithHost_ChromiumImpl( \ + mojo::PendingRemote gpu_host, \ + gpu::GpuProcessShmCount use_shader_cache_shm_count, \ + scoped_refptr default_offscreen_surface, \ + mojom::GpuServiceCreationParamsPtr creation_params, \ + gpu::SyncPointManager* sync_point_manager = nullptr, \ + gpu::SharedImageManager* shared_image_manager = nullptr, \ + gpu::Scheduler* scheduler = nullptr, \ + base::WaitableEvent* shutdown_event = nullptr); \ + void InitializeWithHost +#else +#define InitializeWithHost \ + InitializeWithHost_ChromiumImpl( \ + mojo::PendingRemote gpu_host, \ + gpu::GpuProcessShmCount use_shader_cache_shm_count, \ + scoped_refptr default_offscreen_surface, \ + mojom::GpuServiceCreationParamsPtr creation_params, \ + base::WaitableEvent* shutdown_event = nullptr); \ + \ void InitializeWithHost +#endif #include "src/components/viz/service/gl/gpu_service_impl.h" // IWYU pragma: export diff --git a/chromium_src/content/browser/picture_in_picture/video_picture_in_picture_window_controller_impl.cc b/chromium_src/content/browser/picture_in_picture/video_picture_in_picture_window_controller_impl.cc index 3aafcad841d8..1574bbd12839 100644 --- a/chromium_src/content/browser/picture_in_picture/video_picture_in_picture_window_controller_impl.cc +++ b/chromium_src/content/browser/picture_in_picture/video_picture_in_picture_window_controller_impl.cc @@ -40,13 +40,6 @@ namespace content { -void VideoPictureInPictureWindowControllerImpl::SeekTo( - base::TimeDelta seek_time) { - if (media_session_action_seek_to_handled_) { - MediaSession::Get(web_contents())->SeekTo(seek_time); - } -} - void VideoPictureInPictureWindowControllerImpl::RequestFullscreen() { DCHECK(active_session_); diff --git a/chromium_src/content/browser/picture_in_picture/video_picture_in_picture_window_controller_impl.h b/chromium_src/content/browser/picture_in_picture/video_picture_in_picture_window_controller_impl.h index 2a59471dd009..e703316f0b95 100644 --- a/chromium_src/content/browser/picture_in_picture/video_picture_in_picture_window_controller_impl.h +++ b/chromium_src/content/browser/picture_in_picture/video_picture_in_picture_window_controller_impl.h @@ -9,17 +9,12 @@ #include "content/public/browser/video_picture_in_picture_window_controller.h" #include "services/media_session/public/mojom/media_session.mojom.h" -#define NextSlide \ - SeekTo(base::TimeDelta seek_time) override; \ - void RequestFullscreen() override; \ +#define NextSlide \ + RequestFullscreen() override; \ void NextSlide -#define media_session_action_next_slide_handled_ \ - media_session_action_next_slide_handled_ = false; \ - bool media_session_action_seek_to_handled_ #include "src/content/browser/picture_in_picture/video_picture_in_picture_window_controller_impl.h" // IWYU pragma: export -#undef media_session_action_next_slide_handled_ #undef NextSlide #endif // BRAVE_CHROMIUM_SRC_CONTENT_BROWSER_PICTURE_IN_PICTURE_VIDEO_PICTURE_IN_PICTURE_WINDOW_CONTROLLER_IMPL_H_ diff --git a/chromium_src/content/browser/private_aggregation/private_aggregation_manager.cc b/chromium_src/content/browser/private_aggregation/private_aggregation_manager.cc index c3c5e6e19195..c3191d88e579 100644 --- a/chromium_src/content/browser/private_aggregation/private_aggregation_manager.cc +++ b/chromium_src/content/browser/private_aggregation/private_aggregation_manager.cc @@ -5,6 +5,10 @@ #include "content/browser/private_aggregation/private_aggregation_manager.h" +#define GetManager GetManager_ChromiumImpl +#include "src/content/browser/private_aggregation/private_aggregation_manager.cc" +#undef GetManager + namespace content { PrivateAggregationManager* PrivateAggregationManager::GetManager( diff --git a/chromium_src/content/browser/private_aggregation/private_aggregation_manager.h b/chromium_src/content/browser/private_aggregation/private_aggregation_manager.h new file mode 100644 index 000000000000..75e674a95830 --- /dev/null +++ b/chromium_src/content/browser/private_aggregation/private_aggregation_manager.h @@ -0,0 +1,20 @@ +/* Copyright (c) 2024 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_CHROMIUM_SRC_CONTENT_BROWSER_PRIVATE_AGGREGATION_PRIVATE_AGGREGATION_MANAGER_H_ +#define BRAVE_CHROMIUM_SRC_CONTENT_BROWSER_PRIVATE_AGGREGATION_PRIVATE_AGGREGATION_MANAGER_H_ + +// Adding a `GetManager_ChromiumImpl`, so we can replace the existing one as +// nullopt, while keeping the original one off the normal call paths in +// chromium. This way we can just rename the implementation too, and still build +// the TU as expected, rather than shadowing it, dropping the symbols of other +// static functions like `ShouldSendReportDeterministically`. +#define GetManager(...) \ + GetManager_ChromiumImpl(__VA_ARGS__); \ + static PrivateAggregationManager* GetManager(__VA_ARGS__) +#include "src/content/browser/private_aggregation/private_aggregation_manager.h" // IWYU pragma: export +#undef GetManager + +#endif // BRAVE_CHROMIUM_SRC_CONTENT_BROWSER_PRIVATE_AGGREGATION_PRIVATE_AGGREGATION_MANAGER_H_ diff --git a/chromium_src/content/browser/renderer_host/mixed_content_checker.cc b/chromium_src/content/browser/renderer_host/mixed_content_checker.cc index c365e509f66b..ad03d76ba971 100644 --- a/chromium_src/content/browser/renderer_host/mixed_content_checker.cc +++ b/chromium_src/content/browser/renderer_host/mixed_content_checker.cc @@ -14,8 +14,7 @@ namespace content { // static bool MixedContentChecker::DoesOriginSchemeRestrictMixedContent( const url::Origin& origin) { - constexpr const char kOnion[] = ".onion"; - if (origin.host().ends_with(kOnion) && + if (origin.host().ends_with(".onion") && (origin.scheme() == url::kHttpsScheme || origin.scheme() == url::kHttpScheme || origin.scheme() == url::kWsScheme || diff --git a/chromium_src/content/browser/shared_storage/shared_storage_features.cc b/chromium_src/content/browser/shared_storage/shared_storage_features.cc new file mode 100644 index 000000000000..98188694171d --- /dev/null +++ b/chromium_src/content/browser/shared_storage/shared_storage_features.cc @@ -0,0 +1,16 @@ +/* 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/content/browser/shared_storage/shared_storage_features.cc" + +#include "base/feature_override.h" + +namespace content::features { + +OVERRIDE_FEATURE_DEFAULT_STATES({{ + {kSharedStorageSelectURLLimit, base::FEATURE_DISABLED_BY_DEFAULT}, +}}); + +} // namespace content::features diff --git a/chromium_src/content/browser/speech/network_speech_recognition_engine_impl.cc b/chromium_src/content/browser/speech/network_speech_recognition_engine_impl.cc index 2176ad6f582f..dda9814f689c 100644 --- a/chromium_src/content/browser/speech/network_speech_recognition_engine_impl.cc +++ b/chromium_src/content/browser/speech/network_speech_recognition_engine_impl.cc @@ -28,10 +28,9 @@ std::string GetAPIKey() { namespace content { NetworkSpeechRecognitionEngineImpl::NetworkSpeechRecognitionEngineImpl( - scoped_refptr shared_url_loader_factory, - const std::string& accept_language) - : NetworkSpeechRecognitionEngineImpl_ChromiumImpl(shared_url_loader_factory, - accept_language), + scoped_refptr shared_url_loader_factory) + : NetworkSpeechRecognitionEngineImpl_ChromiumImpl( + shared_url_loader_factory), shared_url_loader_factory_(std::move(shared_url_loader_factory)) {} NetworkSpeechRecognitionEngineImpl::~NetworkSpeechRecognitionEngineImpl() = diff --git a/chromium_src/content/browser/speech/network_speech_recognition_engine_impl.h b/chromium_src/content/browser/speech/network_speech_recognition_engine_impl.h index 2f14c6f45c33..ecb297ec4cb3 100644 --- a/chromium_src/content/browser/speech/network_speech_recognition_engine_impl.h +++ b/chromium_src/content/browser/speech/network_speech_recognition_engine_impl.h @@ -24,8 +24,7 @@ class CONTENT_EXPORT NetworkSpeechRecognitionEngineImpl : public NetworkSpeechRecognitionEngineImpl_ChromiumImpl { public: NetworkSpeechRecognitionEngineImpl( - scoped_refptr shared_url_loader_factory, - const std::string& accept_language); + scoped_refptr shared_url_loader_factory); ~NetworkSpeechRecognitionEngineImpl() override; void StartRecognition() override; diff --git a/chromium_src/content/common/features.cc b/chromium_src/content/common/features.cc index 0acdf2f8404c..772da8131279 100644 --- a/chromium_src/content/common/features.cc +++ b/chromium_src/content/common/features.cc @@ -15,7 +15,6 @@ OVERRIDE_FEATURE_DEFAULT_STATES({{ {kPrivacySandboxAdsAPIsM1Override, base::FEATURE_DISABLED_BY_DEFAULT}, {kResourceTimingForCancelledNavigationInFrame, base::FEATURE_DISABLED_BY_DEFAULT}, - {kServiceWorkerAutoPreload, base::FEATURE_DISABLED_BY_DEFAULT}, }}); } // namespace features diff --git a/chromium_src/content/public/browser/video_picture_in_picture_window_controller.h b/chromium_src/content/public/browser/video_picture_in_picture_window_controller.h index d91dbea399ec..d15c27ebbe6a 100644 --- a/chromium_src/content/public/browser/video_picture_in_picture_window_controller.h +++ b/chromium_src/content/public/browser/video_picture_in_picture_window_controller.h @@ -8,9 +8,8 @@ #include "base/time/time.h" -#define NextSlide \ - SeekTo(base::TimeDelta seek_time) {} \ - virtual void RequestFullscreen() {} \ +#define NextSlide \ + RequestFullscreen() {} \ virtual void NextSlide #include "src/content/public/browser/video_picture_in_picture_window_controller.h" // IWYU pragma: export diff --git a/chromium_src/content/public/browser/web_contents_delegate.cc b/chromium_src/content/public/browser/web_contents_delegate.cc new file mode 100644 index 000000000000..55836e8b27c9 --- /dev/null +++ b/chromium_src/content/public/browser/web_contents_delegate.cc @@ -0,0 +1,19 @@ +/* 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/content/public/browser/web_contents_delegate.cc" + +namespace content { +WebContents* WebContentsDelegate::AddNewContents_ChromiumImpl( + WebContents* source, + std::unique_ptr new_contents, + const GURL& target_url, + WindowOpenDisposition disposition, + const blink::mojom::WindowFeatures& window_features, + bool user_gesture, + bool* was_blocked) { + return nullptr; +} +} // namespace content diff --git a/chromium_src/content/public/browser/web_contents_delegate.h b/chromium_src/content/public/browser/web_contents_delegate.h new file mode 100644 index 000000000000..b1f28a7b932d --- /dev/null +++ b/chromium_src/content/public/browser/web_contents_delegate.h @@ -0,0 +1,21 @@ +/* Copyright (c) 2024 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_CHROMIUM_SRC_CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ +#define BRAVE_CHROMIUM_SRC_CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ + +#define AddNewContents \ + AddNewContents_ChromiumImpl( \ + WebContents* source, std::unique_ptr new_contents, \ + const GURL& target_url, WindowOpenDisposition disposition, \ + const blink::mojom::WindowFeatures& window_features, bool user_gesture, \ + bool* was_blocked); \ + virtual WebContents* AddNewContents + +#include "src/content/public/browser/web_contents_delegate.h" // IWYU pragma: export + +#undef AddNewContents + +#endif // BRAVE_CHROMIUM_SRC_CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ diff --git a/chromium_src/content/public/common/content_features.cc b/chromium_src/content/public/common/content_features.cc index 7d25344675a2..922bcbb25384 100644 --- a/chromium_src/content/public/common/content_features.cc +++ b/chromium_src/content/public/common/content_features.cc @@ -24,6 +24,7 @@ OVERRIDE_FEATURE_DEFAULT_STATES({{ {kFedCm, base::FEATURE_DISABLED_BY_DEFAULT}, {kNotificationTriggers, base::FEATURE_DISABLED_BY_DEFAULT}, {kPrivacySandboxAdsAPIsOverride, base::FEATURE_DISABLED_BY_DEFAULT}, + {kServiceWorkerAutoPreload, base::FEATURE_DISABLED_BY_DEFAULT}, {kWebIdentityDigitalCredentials, base::FEATURE_DISABLED_BY_DEFAULT}, #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) {kPwaNavigationCapturing, base::FEATURE_DISABLED_BY_DEFAULT}, diff --git a/chromium_src/google_update/google_update_idl.idl b/chromium_src/google_update/google_update_idl.idl deleted file mode 100644 index adca92cbc65a..000000000000 --- a/chromium_src/google_update/google_update_idl.idl +++ /dev/null @@ -1,1346 +0,0 @@ -// *** AUTOGENERATED FILE. DO NOT HAND-EDIT *** - -// Copyright 2009-2010 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ======================================================================== - -import "oaidl.idl"; -import "ocidl.idl"; - -// When adding interfaces to this file: -// * Do not use "Google" or "GoogleUpdate" directly. Instead, use preprocessor -// defines. -// * Add a test for the Google-specific value to -// omaha_customization_goopdate_apis_unittest.cc. - -// -// Enums. -// These values can be passed to interface methods and/or compared to their -// output. -// - -// Must be kept in sync with the enum in base/browser_utils.h. -typedef enum BrowserType { - BROWSER_UNKNOWN = 0, - BROWSER_DEFAULT = 1, - BROWSER_INTERNET_EXPLORER = 2, - BROWSER_FIREFOX = 3, - BROWSER_CHROME = 4, -} BrowserType; - -// The normal install flow proceeds from STATE_INIT through -// STATE_INSTALL_COMPLETE in order, skipping states that are not relevant. -// All exceptions and terminal states are start with STATE_INSTALL_COMPLETE. -typedef enum CurrentState { - STATE_INIT = 1, - STATE_WAITING_TO_CHECK_FOR_UPDATE = 2, - STATE_CHECKING_FOR_UPDATE = 3, - STATE_UPDATE_AVAILABLE = 4, - STATE_WAITING_TO_DOWNLOAD = 5, - STATE_RETRYING_DOWNLOAD = 6, - STATE_DOWNLOADING = 7, - STATE_DOWNLOAD_COMPLETE = 8, - STATE_EXTRACTING = 9, - STATE_APPLYING_DIFFERENTIAL_PATCH = 10, - // TODO(omaha3): Should we move STATE_DOWNLOAD_COMPLETE here and eliminate - // STATE_READY_TO_INSTALL? - STATE_READY_TO_INSTALL = 11, - STATE_WAITING_TO_INSTALL = 12, - STATE_INSTALLING = 13, - STATE_INSTALL_COMPLETE = 14, - STATE_PAUSED = 15, - STATE_NO_UPDATE = 16, - STATE_ERROR = 17, -} CurrentState; - -typedef enum InstallPriority { - INSTALL_PRIORITY_LOW = 0, - INSTALL_PRIORITY_HIGH = 10, -} InstallPriority; - -// Specifies what the client should do after installation. -typedef enum PostInstallAction { - POST_INSTALL_ACTION_DEFAULT = 0, - - // Caller should exit silently. - POST_INSTALL_ACTION_EXIT_SILENTLY = 1, - - // Caller should launch the command. - POST_INSTALL_ACTION_LAUNCH_COMMAND = 2, - - // Caller should launch the command and exit silently. - POST_INSTALL_ACTION_EXIT_SILENTLY_ON_LAUNCH_COMMAND = 3, - - // The caller should ask the user to restart the browser. If the value of - // IApp's browser is supported and postInstallUrl is valid, the client should - // offer to restart the browser. If the user chooses to do so, the client - // should launch the ICurrentState::postInstallUrl after shutting down and - // restarting the browser. - POST_INSTALL_ACTION_RESTART_BROWSER = 4, - - // Similar to POST_INSTALL_ACTION_RESTART_BROWSER, but ask the user to shut - // down all browsers. - POST_INSTALL_ACTION_RESTART_ALL_BROWSERS = 5, - - // The caller should ask the user to reboot the machine. - POST_INSTALL_ACTION_REBOOT = 6, -} PostInstallAction; - -enum AppCommandStatus { - // The command has never been executed. - COMMAND_STATUS_INIT = 1, - // The command is running. - COMMAND_STATUS_RUNNING = 2, - // An error occurred while launching or monitoring the command. - COMMAND_STATUS_ERROR = 3, - // The command has completed execution. - COMMAND_STATUS_COMPLETE = 4, -}; - -[ - object, - dual, - uuid(7CB305B1-4D45-4668-AD91-677F87BED305), - helpstring("IGoogleUpdate3 Interface"), - pointer_default(unique) -] -interface IGoogleUpdate3 : IDispatch { - // TODO(Omaha): Perhaps this interface exposes helpers such as - // RestartBrowsers, etc. - - // Returns the count of the AppBundles in this IGoogleUpdate3 interface. - [id(1), propget] HRESULT Count([out, retval] long* count); - - // Returns an IDispatch of the AppBundle in this IGoogleUpdate3 interface at - // the specified 0-based index. This property has the dispid of DISPID_VALUE - // to make it the default property of IGoogleUpdate3. - [id(DISPID_VALUE), propget] HRESULT Item([in] long index, - [out, retval] IDispatch** bundle); - // Returns an IDispatch to a newly created empty AppBundle. - [id(2)] HRESULT createAppBundle([out, retval] IDispatch** app_bundle); -} - -[ - object, - dual, - uuid(1985533F-9B0F-490A-85C5-24F316E66FB2), - helpstring("IAppBundle Interface"), - pointer_default(unique) -] -interface IAppBundle : IDispatch { - // TODO(omaha3): AppBundle::display_name_ is never used. Should we remove? - [propget] HRESULT displayName([out, retval] BSTR*); - [propput] HRESULT displayName([in] BSTR); - - [propget] HRESULT displayLanguage([out, retval] BSTR*); - [propput] HRESULT displayLanguage([in] BSTR); - - [propget] HRESULT installSource([out, retval] BSTR*); - [propput] HRESULT installSource([in] BSTR); - - [propget] HRESULT originURL([out, retval] BSTR*); - [propput] HRESULT originURL([in] BSTR); - - [propget] HRESULT offlineDirectory([out, retval] BSTR* offline_dir); - [propput] HRESULT offlineDirectory([in] BSTR offline_dir); - - [propget] HRESULT sessionId([out, retval] BSTR* session_id); - [propput] HRESULT sessionId([in] BSTR session_id); - - // Controls whether or not event pings should be sent at the end of - // an operation. - [propget] HRESULT sendPings([out, retval] VARIANT_BOOL* send_pings); - [propput] HRESULT sendPings([in] VARIANT_BOOL send_pings); - - // The priority property determines download speed/priority and the number/ - // frequency of retries. Use values from the InstallPriority enum. - [propget] HRESULT priority([out, retval] long* priority); - [propput] HRESULT priority([in] long priority); - - // Returns the count of the Apps in the AppBundle. - [id(1), propget] HRESULT Count([out, retval] long* count); - - // Returns an IDispatch of the App in the AppBundle at the specified 0-based - // index. This property has the dispid of DISPID_VALUE to make it the default - // property of IAppBundle. - [id(DISPID_VALUE), propget] HRESULT Item([in] long index, - [out, retval] IDispatch** app); - - // Impersonation and primary tokens set by the client. Typically only - // set by the gupdatem service. The gupdatem service exposes a narrow - // interface to medium integrity clients. When a medium integrity client calls - // into the gupdatem service, the gupdatem service captures the token of the - // caller, and then calls put_altTokens() on the gupdate service, so that the - // gupdate service can use it for future download() and install() requests. - [propput] HRESULT altTokens([in] ULONG_PTR impersonation_token, - [in] ULONG_PTR primary_token, - [in] DWORD caller_proc_id); - - // Sets a HWND to associate with the client, if any. This will be used as - // the parent window for any dialogs that the server may need to display. - [propput] HRESULT parentHWND([in] ULONG_PTR hwnd); - - // Initializes the bundle with the properties that have been set. - [id(2)] HRESULT initialize(); - - // Returns an IDispatch to a new App for the specified app id. - // The App is added to the Bundle. - [id(3)] HRESULT createApp([in] BSTR app_id, - [out, retval] IDispatch** app); - - // Returns an IDispatch to a newly created App for the specified app ID. The - // App is populated with information from the existing installation and added - // to the Bundle. Fails if the specified app is not installed. - [id(4)] HRESULT createInstalledApp([in] BSTR app_id, - [out, retval] IDispatch** app); - - // Creates App instances for all installed apps managed by this Omaha - // instance. Each App is populated with information from the existing install. - [id(5)] HRESULT createAllInstalledApps(); - - // These methods are non-blocking. The operation is scheduled. - [id(6)] HRESULT checkForUpdate(); - [id(7)] HRESULT download(); - [id(8)] HRESULT install(); - - // All-in-one function for automatically updating all apps. Populates the - // bundle then schedules the update, which includes the update check and - // download and install, if necessary. - [id(9)] HRESULT updateAllApps(); - - // These three methods are non-blocking. The operation is requested. - [id(10)] HRESULT stop(); - [id(11)] HRESULT pause(); - [id(12)] HRESULT resume(); - - // Returns true if the bundle has an uncompleted non-blocking request. - [id(13)] HRESULT isBusy([out, retval] VARIANT_BOOL* is_busy); - - // Downloads a package of an installed application. - [id(14)] HRESULT downloadPackage([in] BSTR app_id, [in] BSTR package_name); - - // TODO(omaha): Define this aggregated bundle state. Is this really a property - // or should it be getCurrentState? - // The server and bundle are the only thing that can provide aggregated - // time estimates for downloads. Also, aggregate percentage is not currently - // available to the client because the total bytes to download is not - // available from App in all post-update check states. - // To do this, we will probably need to know the total expected download - // size for all packages to be installed - those that are required or in use - - // by the time the update check phase is complete. - [id(15), propget] HRESULT currentState([out, retval] VARIANT* current_state); -}; - -[ - object, - dual, - uuid(A4BCDF52-2179-4C77-8C5F-B8095712B563), - helpstring("IApp Interface"), - pointer_default(unique) -] -interface IApp : IDispatch { - // Returns a version IDispatch object. - [id(1), propget] HRESULT currentVersion([out, retval] IDispatch** current); - [id(2), propget] HRESULT nextVersion([out, retval] IDispatch** next); - - [propget] HRESULT appId([out, retval] BSTR*); - - [propget] HRESULT displayName([out, retval] BSTR*); - [propput] HRESULT displayName([in] BSTR); - - [propget] HRESULT language([out, retval] BSTR*); - [propput] HRESULT language([in] BSTR); - - [propget] HRESULT ap([out, retval] BSTR*); - [propput] HRESULT ap([in] BSTR); - - [propget] HRESULT ttToken([out, retval] BSTR*); - [propput] HRESULT ttToken([in] BSTR); - - [propget] HRESULT iid([out, retval] BSTR*); - [propput] HRESULT iid([in] BSTR); - - [propget] HRESULT brandCode([out, retval] BSTR*); - [propput] HRESULT brandCode([in] BSTR); - - [propget] HRESULT clientId([out, retval] BSTR*); - [propput] HRESULT clientId([in] BSTR); - - [propget] HRESULT labels([out, retval] BSTR*); - [propput] HRESULT labels([in] BSTR); - - [propget] HRESULT referralId([out, retval] BSTR*); - [propput] HRESULT referralId([in] BSTR); - - // Returns an IDispatch to a command defined by this installed app with the - // specified ID, or NULL if this app is not installed or the command ID is not - // recognized. - [propget] HRESULT command([in] BSTR command_id, - [out, retval] IDispatch** command); - - // Use values from the BrowserType enum. - [propget] HRESULT browserType([out, retval] UINT*); - [propput] HRESULT browserType([in] UINT); - - [propget] HRESULT clientInstallData([out, retval] BSTR*); - [propput] HRESULT clientInstallData([in] BSTR); - - [propget] HRESULT serverInstallDataIndex([out, retval] BSTR*); - [propput] HRESULT serverInstallDataIndex([in] BSTR); - - // Set as soon as possible. Error pings are disabled until set to true. - [propget] HRESULT isEulaAccepted([out, retval] VARIANT_BOOL*); - [propput] HRESULT isEulaAccepted([in] VARIANT_BOOL); - - [propget] HRESULT usageStatsEnable([out, retval] UINT*); - [propput] HRESULT usageStatsEnable([in] UINT); - - [propget] HRESULT installTimeDiffSec([out, retval] UINT*); - - // Returns an ICurrentState interface. The object underlying the interface has - // static data that does not get updated as the server state changes. To get - // the most "current" state, the currentState property needs to be queried - // again. - [propget] HRESULT currentState([out, retval] IDispatch**); -}; - -[ - object, - dual, - uuid(A147722A-5568-4B84-B401-86D744470CBF), - helpstring("IApp2 Interface"), - pointer_default(unique) -] -interface IApp2 : IApp { - [propget] HRESULT untrustedData([out, retval] BSTR*); - [propput] HRESULT untrustedData([in] BSTR); -}; - -[ - object, - dual, - uuid(4842EC21-0860-45B5-99F0-A1E6E7C11561), - helpstring("IAppCommand Interface"), - pointer_default(unique) -] -interface IAppCommand : IDispatch { - [propget] HRESULT isWebAccessible([out, retval] VARIANT_BOOL*); - // Use values from the AppCommandStatus enum. - [propget] HRESULT status([out, retval] UINT*); - [propget] HRESULT exitCode([out, retval] DWORD*); - HRESULT execute([in, optional] VARIANT arg1, - [in, optional] VARIANT arg2, - [in, optional] VARIANT arg3, - [in, optional] VARIANT arg4, - [in, optional] VARIANT arg5, - [in, optional] VARIANT arg6, - [in, optional] VARIANT arg7, - [in, optional] VARIANT arg8, - [in, optional] VARIANT arg9); -}; - -[ - object, - dual, - uuid(C11C073F-E6D0-4EF7-897B-AAF52498CD2F), - helpstring("IAppCommand2 Interface"), - pointer_default(unique) -] -interface IAppCommand2 : IAppCommand { - [propget] HRESULT output([out, retval] BSTR*); -}; - -[ - object, - dual, - uuid(F234546B-DACD-4374-97CF-7BADFAB76766), - helpstring("IAppVersion Interface"), - pointer_default(unique) -] -interface IAppVersion : IDispatch { - [propget] HRESULT version([out, retval] BSTR*); - - // [propget] HRESULT installManifest([out, retval] BSTR*); - - // Returns the count of the Packages in the AppVersion. - [propget] HRESULT packageCount([out, retval] long* count); - - // Returns an IDispatch of the Package in the AppVersion at the specified - // 0-based index. - [propget] HRESULT package([in] long index, - [out, retval] IDispatch** package); -}; - -[ - object, - dual, - uuid(C663DEBB-F082-4971-9F6E-35DE45C96F4E), - helpstring("IPackage Interface"), - pointer_default(unique) -] -interface IPackage : IDispatch { - // Retrieves the package from the package cache and copies it to the - // directory provided. Returns an error is the package is not available - // locally. - [id(1)] HRESULT get([in] BSTR dir); - - // Returns true if the package has been downloaded and is available - // locally. - [propget] HRESULT isAvailable([out, retval] VARIANT_BOOL*); - - // Returns the manifest name of the package. - [propget] HRESULT filename([out, retval] BSTR*); -}; - -// TODO(omaha3): We should figure out what else we are going to want in this -// interface before dogfood even if we do not implement it. -[ - object, - dual, - uuid(E6836CFF-5949-44BC-B6BE-9C8C48DD8D97), - helpstring("ICurrentState Interface"), - pointer_default(unique) -] -interface ICurrentState : IDispatch { - // This interface is exposed to web clients! - // TODO(omaha3): Update valid comments once we settle on an implementation. - - // A value from the CurrentState enum. This value determines which of the - // properties below are valid. - [propget] HRESULT stateValue([out, retval] LONG*); - - // The remaining properties are only valid in the specified states. For all - // other states, the values are not specified. - - // This property is valid only when stateValue is STATE_UPDATE_AVAILABLE. - [propget] HRESULT availableVersion([out, retval] BSTR*); - - // The following three properties are only valid when stateValue is - // STATE_WAITING_TO_DOWNLOAD, STATE_RETRYING_DOWNLOAD, STATE_DOWNLOADING, - // STATE_DOWNLOAD_COMPLETE, STATE_EXTRACTING, - // STATE_APPLYING_DIFFERENTIAL_PATCH, or STATE_READY_TO_INSTALL. - - // Bytes downloaded so far. - [propget] HRESULT bytesDownloaded([out, retval] ULONG*); - - // Total bytes to download. - [propget] HRESULT totalBytesToDownload([out, retval] ULONG*); - - // Estimated download time remaining in ms. -1 indicates unknown. - // Progress may not always be available, so clients should handle the -1 case. - [propget] HRESULT downloadTimeRemainingMs([out, retval] LONG*); - - [propget] HRESULT nextRetryTime([out, retval] ULONGLONG*); - - // TODO(omaha 3): Need some way to indicate reconnecting, retrying, etc. - - // The following two properties are only valid when stateValue is - // STATE_INSTALLING or STATE_INSTALL_COMPLETE. - - // Current install progress in percentage from 0 to 100. -1 indicates unknown. - // Progress may not always be available, so clients should handle the -1 case. - [propget] HRESULT installProgress([out, retval] LONG*); - - // Estimated download time remaining in ms. -1 indicates unknown. - // Progress may not always be available, so clients should handle the -1 case. - [propget] HRESULT installTimeRemainingMs([out, retval] LONG*); - - // The following four properties are only valid when stateValue is - // STATE_ERROR: - - // Returns true if the app has been canceled. - [propget] HRESULT isCanceled([out, retval] VARIANT_BOOL* is_canceled); - - // Error code. - [propget] HRESULT errorCode([out, retval] LONG*); - - // Error extra code. - [propget] HRESULT extraCode1([out, retval] LONG*); - - // The following three properties are only valid when stateValue is - // STATE_ERROR or STATE_INSTALL_COMPLETE. - // TODO(omaha3): If STATE_DOWNLOAD_COMPLETE or STATE_READY_TO_INSTALL becomes - // a terminal state, does it support completion messages? - - // Completion message, localized in the specified language. - // TODO(omaha3): If we're going to have bundle error messages too, should the - // language be at bundle level? Should bundle have its own language setter? - [propget] HRESULT completionMessage([out, retval] BSTR*); - - // Application installer result code. This is to be used as additional - // information only. Success/failure should be determined using errorCode. - // This is an error if errorCode is GOOPDATEINSTALL_E_INSTALLER_FAILED. - [propget] HRESULT installerResultCode([out, retval] LONG*); - - // Application installer extra code. - [propget] HRESULT installerResultExtraCode1([out, retval] LONG*); - - // A command that needs to be launched by the client after installation. - [propget] HRESULT postInstallLaunchCommandLine([out, retval] BSTR*); - - // URL to be launched after restarting the browser. - [propget] HRESULT postInstallUrl([out, retval] BSTR*); - - // Returns a PostInstallAction value indicating the action to be taken by the - // client after installation. - [propget] HRESULT postInstallAction([out, retval] LONG*); -} - -[ - object, - dual, - uuid(48B5E6B2-9383-4B1E-AAE7-720C4779ABA6), - helpstring("IRegistrationUpdateHook Interface"), - pointer_default(unique), -] -interface IRegistrationUpdateHook : IDispatch { - HRESULT UpdateRegistry([in] BSTR app_id, [in] VARIANT_BOOL is_machine); -}; - -[ - object, - uuid(660130E8-74E4-4821-A6FD-4E9A86E06470), - helpstring("ICredentialDialog Interface"), - pointer_default(unique), -] -interface ICredentialDialog : IUnknown { - HRESULT QueryUserForCredentials([in] ULONG_PTR owner_hwnd, - [in] BSTR server, - [in] BSTR message, - [out] BSTR* username, - [out] BSTR* password); -}; - -// This is a legacy interface that could be removed in future versions. Do not -// use. -[ - object, - dual, - uuid(10DB7BD5-BD0B-4886-9705-174203FE0ADA), - helpstring("IPolicyStatus Interface"), - pointer_default(unique) -] -interface IPolicyStatus : IDispatch { - // Global Update Policies - - // Returns the time interval between update checks in minutes. - // 0 indicates updates are disabled. - [propget] HRESULT lastCheckPeriodMinutes([out, retval] DWORD* minutes); - - // For domain-joined machines, returns the suppressed times if any, and also - // checks the current time against the times that updates are suppressed. - // Updates are suppressed if the current time falls between the start time and - // the duration. - // The duration does not account for daylight savings time. For instance, if - // the start time is 22:00 hours, and with a duration of 8 hours, the updates - // will be suppressed for 8 hours regardless of whether daylight savings time - // changes happen in between. - [propget] HRESULT updatesSuppressedTimes( - [out] DWORD* start_hour, - [out] DWORD* start_min, - [out] DWORD* duration_min, - [out] VARIANT_BOOL* are_updates_suppressed); - - // Returns the value of the "DownloadPreference" group policy or an - // empty string if the group policy does not exist, the policy is unknown, or - // an error happened. - [propget] HRESULT downloadPreferenceGroupPolicy([out, retval] BSTR* pref); - - // Gets the total disk size limit for cached packages. When this limit is hit, - // packages may be deleted from oldest until total size is below the limit. - [propget] HRESULT packageCacheSizeLimitMBytes([out, retval] DWORD* limit); - - // Gets the package cache life limit. If a cached package is older than this - // limit, it may be deleted. - [propget] HRESULT packageCacheExpirationTimeDays([out, retval] DWORD* days); - - // Application Update Policies - - // Returns 1 if installation of the specified app is allowed. - // Otherwise, returns 0. - [propget] HRESULT effectivePolicyForAppInstalls([in] BSTR app_id, - [out, retval] DWORD* policy); - - // Returns 1 if updates of the specified app is allowed. - // Otherwise, returns one of 0 (Disabled), 2 (ManualUpdatesOnly), or - // 3 (AutomaticUpdatesOnly). - [propget] HRESULT effectivePolicyForAppUpdates([in] BSTR app_id, - [out, retval] DWORD* policy); - - // Returns the target version prefix for the app, if the machine is joined to - // a domain and has the corresponding policy set. - // Examples: - // * "" (or not configured): update to latest version available. - // * "55.": update to any minor version of 55 (e.g. 55.24.34 or 55.60.2). - // * "55.2.": update to any minor version of 55.2 (e.g. 55.2.34 or 55.2.2). - // * "55.24.34": update to this specific version only. - [propget] HRESULT targetVersionPrefix([in] BSTR app_id, - [out, retval] BSTR* prefix); - - // Returns whether the RollbackToTargetVersion policy has been set for the - // app. Setting RollbackToTargetVersion will result in a version downgrade if - // the app version on the client is higher than the version on the server. - // This could happen under circumstances such as: - // - TargetVersionPrefix is used to pick an older version on the channel. - // - TargetChannel is used to move the client to a channel with a lower - // version (e.g., Dev/Beta to Beta/Stable). - // - A user somehow installed a newer version on the client. - // When not set, a client will not receive updates until the app version on - // the server passes the version on the client. - [propget] HRESULT isRollbackToTargetVersionAllowed( - [in] BSTR app_id, - [out, retval] VARIANT_BOOL* rollback_allowed); -}; - -// IPolicyStatusValue represents the managed state of a single Google Update -// policy. It contains the current source and value, as well as if any conflicts -// exist with that policy. -[ - object, - dual, - uuid(931E73FD-D487-4458-AA08-1FF41413377B), - helpstring("IPolicyStatusValue Interface"), - pointer_default(unique) -] -interface IPolicyStatusValue : IDispatch { - [propget] HRESULT source([out, retval] BSTR*); - [propget] HRESULT value([out, retval] BSTR*); - [propget] HRESULT hasConflict([out, retval] VARIANT_BOOL* has_conflict); - [propget] HRESULT conflictSource([out, retval] BSTR*); - [propget] HRESULT conflictValue([out, retval] BSTR*); -} - -// IPolicyStatus2 exposes the following: -// * properties for Google Update that includes Global Update state, such as the -// Version of the Updater, the Time that Updates were checked for last. -// * A way to refresh the latest policies from the DM Server. -// * the managed state of Omaha policies. Each policy returns an -// IPolicyStatusValue that can be queried for the current source and value, as -// well as if any conflicts exist with that policy. -// IPolicyStatusValue is implemented by an object that marshals itself by -// value. To get the "current" value, the policy needs to be queried fresh. -[ - object, - dual, - uuid(EFF9CA12-4CD3-474B-B881-CDE1D92F1996), - helpstring("IPolicyStatus2 Interface"), - pointer_default(unique) -] -interface IPolicyStatus2 : IDispatch { - // Global Update Status. - - // Returns the running version of the Updater. For instance, 1.3.35.454. - [propget] HRESULT updaterVersion([out, retval] BSTR* version); - - // Returns the last time that the Updater successfully checked for updates. - [propget] HRESULT lastCheckedTime([out, retval] DATE* last_checked); - - // DM policy cache refresh. - - // Gets the latest policies from the DM Server. - HRESULT refreshPolicies(); - - // Global Update Policies - - // Returns the time interval between update checks in minutes. - // 0 indicates updates are disabled. - [propget] HRESULT lastCheckPeriodMinutes( - [out, retval] IPolicyStatusValue** value); - - // For domain-joined machines, returns the suppressed times if any, and also - // checks the current time against the times that updates are suppressed. - // Updates are suppressed if the current time falls between the start time and - // the duration. - // The duration does not account for daylight savings time. For instance, if - // the start time is 22:00 hours, and with a duration of 8 hours, the updates - // will be suppressed for 8 hours regardless of whether daylight savings time - // changes happen in between. - [propget] HRESULT updatesSuppressedTimes( - [out] IPolicyStatusValue** value, - VARIANT_BOOL* are_updates_suppressed); - - // Returns the value of the "DownloadPreference" group policy or an - // empty string if the group policy does not exist, the policy is unknown, or - // an error happened. - [propget] HRESULT downloadPreferenceGroupPolicy( - [out, retval] IPolicyStatusValue** value); - - // Gets the total disk size limit for cached packages. When this limit is hit, - // packages may be deleted from oldest until total size is below the limit. - [propget] HRESULT packageCacheSizeLimitMBytes( - [out, retval] IPolicyStatusValue** value); - - // Gets the package cache life limit. If a cached package is older than this - // limit, it may be deleted. - [propget] HRESULT packageCacheExpirationTimeDays( - [out, retval] IPolicyStatusValue** value); - - // Gets the proxy policy values. - [propget] HRESULT proxyMode([out, retval] IPolicyStatusValue** value); - [propget] HRESULT proxyPacUrl([out, retval] IPolicyStatusValue** value); - [propget] HRESULT proxyServer([out, retval] IPolicyStatusValue** value); - - // Application Update Policies - - // Returns 1 if installation of the specified app is allowed. - // Otherwise, returns 0. - [propget] HRESULT effectivePolicyForAppInstalls( - [in] BSTR app_id, - [out, retval] IPolicyStatusValue** value); - - // Returns 1 if updates of the specified app is allowed. - // Otherwise, returns one of 0 (Disabled), 2 (ManualUpdatesOnly), or - // 3 (AutomaticUpdatesOnly). - [propget] HRESULT effectivePolicyForAppUpdates( - [in] BSTR app_id, - [out, retval] IPolicyStatusValue** value); - - // Returns the target version prefix for the app, if the machine is joined to - // a domain and has the corresponding policy set. - // Examples: - // * "" (or not configured): update to latest version available. - // * "55.": update to any minor version of 55 (e.g. 55.24.34 or 55.60.2). - // * "55.2.": update to any minor version of 55.2 (e.g. 55.2.34 or 55.2.2). - // * "55.24.34": update to this specific version only. - [propget] HRESULT targetVersionPrefix( - [in] BSTR app_id, - [out, retval] IPolicyStatusValue** value); - - // Returns whether the RollbackToTargetVersion policy has been set for the - // app. If RollbackToTargetVersion is set, the TargetVersionPrefix policy - // governs the version to rollback clients with higher versions to. - [propget] HRESULT isRollbackToTargetVersionAllowed( - [in] BSTR app_id, [out, retval] IPolicyStatusValue** value); - - // Returns the target channel for the app, if the machine is joined to a - // domain and has the corresponding policy set. - [propget] HRESULT targetChannel([in] BSTR app_id, - [out, retval] IPolicyStatusValue** value); -}; - -// IPolicyStatus3 exposes everything IPolicyStatus2 does, and in addition, -// exposes the forceInstallApps policy. -[ - object, - dual, - uuid(C974F2DD-CFB8-4466-8E6D-96ED901DAACA), - helpstring("IPolicyStatus3 Interface"), - pointer_default(unique) -] -interface IPolicyStatus3 : IPolicyStatus2 { - // Global Update Policies - - [propget] HRESULT forceInstallApps([in] VARIANT_BOOL is_machine, - [out, retval] IPolicyStatusValue** value); -}; - -// BEGIN gupdatem interfaces. - -// The following interfaces are exposed as a narrower version of the -// IGoogleUpdate3 interface from the gupdatem service. These interfaces are -// meant for use from medium and low integrity clients. - -[ - object, - dual, - uuid(C9190589-ECEC-43F8-8AEC-62496BB87B26), - helpstring("IGoogleUpdate3Web Interface"), - pointer_default(unique), -] -interface IGoogleUpdate3Web : IDispatch { - HRESULT createAppBundleWeb([out, retval] IDispatch** app_bundle_web); -}; - -[ - object, - uuid(24D704AD-AC42-49F2-BB4F-68BA77C98E91), - helpstring("IGoogleUpdate3WebSecurity Interface"), - pointer_default(unique), -] -interface IGoogleUpdate3WebSecurity : IUnknown { - HRESULT setOriginURL([in] BSTR origin_url); -}; - -[ - object, - dual, - uuid(852A0F87-D117-4B7C-ABA9-2F76D91BCB9D), - helpstring("IAppBundleWeb Interface"), - pointer_default(unique), -] -interface IAppBundleWeb : IDispatch { - [id(2)] HRESULT createApp([in] BSTR app_guid, - [in] BSTR brand_code, - [in] BSTR language, - [in] BSTR ap); - [id(3)] HRESULT createInstalledApp([in] BSTR app_id); - [id(4)] HRESULT createAllInstalledApps(); - - [propget] HRESULT displayLanguage([out, retval] BSTR*); - [propput] HRESULT displayLanguage([in] BSTR); - - [propput] HRESULT parentHWND([in] ULONG_PTR hwnd); - - [propget] HRESULT length([out, retval] int* index); - [id(DISPID_VALUE), propget] HRESULT appWeb( - [in] int index, [out, retval] IDispatch** app_web); - - HRESULT initialize(); - - HRESULT checkForUpdate(); - HRESULT download(); - HRESULT install(); - - HRESULT pause(); - HRESULT resume(); - HRESULT cancel(); - - HRESULT downloadPackage([in] BSTR app_id, [in] BSTR package_name); - - [propget] HRESULT currentState([out, retval] VARIANT* current_state); -}; - -[ - object, - dual, - uuid(FB43AAD0-DDBA-4D01-A3E0-FAB100E7926B), - helpstring("IAppWeb Interface"), - pointer_default(unique), -] -interface IAppWeb : IDispatch { - [propget] HRESULT appId([out, retval] BSTR*); - - // Returns an IAppVersionWeb IDispatch object. - [propget] HRESULT currentVersionWeb([out, retval] IDispatch** current); - [propget] HRESULT nextVersionWeb([out, retval] IDispatch** next); - - // Returns an IAppCommandWeb IDispatch object, or NULL. - [propget] HRESULT command([in] BSTR command_id, - [out, retval] IDispatch** command); - - HRESULT cancel(); - - [propget] HRESULT currentState([out, retval] IDispatch** current_state); - - HRESULT launch(); - HRESULT uninstall(); - - [propget] HRESULT serverInstallDataIndex([out, retval] BSTR*); - [propput] HRESULT serverInstallDataIndex([in] BSTR); -}; - -[ - object, - dual, - uuid(19F4616B-B7DD-4B3F-8084-C81C5C77AAA4), - helpstring("IAppCommandWeb Interface"), - pointer_default(unique) -] -interface IAppCommandWeb : IDispatch { - // Use values from the AppCommandStatus enum. - [propget] HRESULT status([out, retval] UINT*); - [propget] HRESULT exitCode([out, retval] DWORD*); - [propget] HRESULT output([out, retval] BSTR*); - HRESULT execute([in, optional] VARIANT arg1, - [in, optional] VARIANT arg2, - [in, optional] VARIANT arg3, - [in, optional] VARIANT arg4, - [in, optional] VARIANT arg5, - [in, optional] VARIANT arg6, - [in, optional] VARIANT arg7, - [in, optional] VARIANT arg8, - [in, optional] VARIANT arg9); -}; - -[ - object, - dual, - uuid(35A4470F-5EEC-4715-A2DC-6AA9F8E21183), - helpstring("IAppVersionWeb Interface"), - pointer_default(unique) -] -interface IAppVersionWeb : IDispatch { - [propget] HRESULT version([out, retval] BSTR*); - - // Returns the count of the Packages in the AppVersion. - [propget] HRESULT packageCount([out, retval] long* count); - - // TODO(omaha3): Implement this after a security review. - // Returns an IDispatch of the Package in the AppVersion at the specified - // 0-based index. - [propget] HRESULT packageWeb([in] long index, - [out, retval] IDispatch** package); -}; - -[ - object, - dual, - uuid(7A24060E-533F-4962-9E15-34BD82555FA7), - helpstring("ICoCreateAsyncStatus Interface"), - pointer_default(unique) -] -interface ICoCreateAsyncStatus : IDispatch { - [propget] HRESULT isDone([out, retval] VARIANT_BOOL* is_done); - [propget] HRESULT completionHResult([out, retval] LONG* hr); - [propget] HRESULT createdInstance([out, retval] IDispatch** instance); -}; - -[ - object, - uuid(DD84E356-3D21-44C8-83DD-6BEEC22FA427), - helpstring("ICoCreateAsync Interface"), - pointer_default(unique) -] -interface ICoCreateAsync : IUnknown { - HRESULT createOmahaMachineServerAsync( - [in] BSTR origin_url, - [in] BOOL create_elevated, - [out, retval] ICoCreateAsyncStatus** status); -}; - -// END gupdatem interfaces. - -// BEGIN Legacy google_update_idl interfaces. - -[ - object, - uuid(AAE4AD28-500D-43BA-9F54-730CA146C190), - oleautomation, - nonextensible, - pointer_default(unique) -] -interface IBrowserHttpRequest2 : IUnknown { - // This method will send request/data from the browser process. - // @param url URL where request will be send. - // @param post_data POST data, if any. Can be NULL. - // @param request_headers HTTP request headers, if any. Can be NULL. - // @param response_headers_needed HTTP response headers that are needed. - // Should be one of the values listed here: - // http://msdn.microsoft.com/aa385351.aspx - // The input is a SAFEARRAY of DWORD. Can be a - // VT_EMPTY. - // @param response_headers HTTP response headers, returned as SAFEARRAY - // of BSTR. The values corresponding one-to-one - // with the response_headers_needed values. Can - // be NULL if response_headers_needed==VT_EMPTY - // @param response_code HTTP response code. - // @param cache_filename Cache file that contains the response data. - HRESULT Send([in] BSTR url, - [in] BSTR post_data, - [in] BSTR request_headers, - [in] VARIANT response_headers_needed, - [out] VARIANT* response_headers, - [out] DWORD* response_code, - [out] BSTR* cache_filename); -}; - -[ - object, - oleautomation, - uuid(70E5ECF5-2CA7-4019-9B23-916789A13C2C), - helpstring("Google Update IProcessLauncher Interface"), - pointer_default(unique) -] -interface IProcessLauncher : IUnknown { - // @param cmd_line The full command line to execute. - HRESULT LaunchCmdLine([in, string] const WCHAR* cmd_line); - - // @param browser_type The browser to start. - // @param url The url to launch the browser with. - HRESULT LaunchBrowser([in] DWORD browser_type, - [in, string] const WCHAR* url); - - // @param app_id Unique id to identify the calling client application - // @param event_id Unique id for the command - // @param caller_proc_id The process id of the calling process - // @param proc_handle The process handle valid in the caller's context - HRESULT LaunchCmdElevated([in, string] const WCHAR* app_guid, - [in, string] const WCHAR* cmd_id, - [in] DWORD caller_proc_id, - [out] ULONG_PTR* proc_handle); -}; - -[ - object, - oleautomation, - uuid(D5627FC9-E2F0-484B-89A4-5DACFE7FAAD3), - helpstring("Google Update IProcessLauncher2 Interface"), - pointer_default(unique) -] -interface IProcessLauncher2 : IProcessLauncher { - // Launches the command line, returning the COM server's process ID and - // handles to the launched process and its stdout. The caller is responsible - // for closing the returned handles (by passing DUPLICATE_CLOSE_SOURCE to - // DuplicateHandle, for instance). - // @param cmd_line The full command line to execute. - // @param server_proc_id The process id of the IProcessLauncher2 COM server. - // @param proc_handle The process handle valid in the server's context - // @param stdout_handle The child process's stdout handle valid in the - // server's context. - HRESULT LaunchCmdLineEx([in, string] const WCHAR* cmd_line, - [out] DWORD* server_proc_id, - [out] ULONG_PTR* proc_handle, - [out] ULONG_PTR* stdout_handle); -}; - -typedef enum { - COMPLETION_CODE_SUCCESS = 1, - COMPLETION_CODE_SUCCESS_CLOSE_UI, - COMPLETION_CODE_ERROR, - COMPLETION_CODE_RESTART_ALL_BROWSERS, - COMPLETION_CODE_REBOOT, - COMPLETION_CODE_RESTART_BROWSER, - COMPLETION_CODE_RESTART_ALL_BROWSERS_NOTICE_ONLY, - COMPLETION_CODE_REBOOT_NOTICE_ONLY, - COMPLETION_CODE_RESTART_BROWSER_NOTICE_ONLY, - COMPLETION_CODE_RUN_COMMAND, -} LegacyCompletionCodes; - -[ - object, - oleautomation, - uuid(8504FB26-FC3E-4C1C-9C94-46EC93E6BA63), - helpstring("GoogleUpdate UI-specific events Interface"), - pointer_default(unique) -] -interface IProgressWndEvents : IUnknown { - // The UI is closing down. The user has clicked on either the "X" or the - // other buttons of the UI to close the window. - HRESULT DoClose(); - - // Pause has been clicked on. - HRESULT DoPause(); - - // Resume has been clicked on. - HRESULT DoResume(); - - // RestartBrowsers button has been clicked on. - HRESULT DoRestartBrowsers(); - - // Reboot button has been clicked on. - HRESULT DoReboot(); - - // Launch Browser. - HRESULT DoLaunchBrowser([in, string] const WCHAR* url); -}; - - -[ - object, - oleautomation, - uuid(7CFC4E00-1C9D-443D-B5BE-CEEEAC1443AF), - helpstring("IJobObserver Interface"), - pointer_default(unique) -] -interface IJobObserver : IUnknown { - HRESULT OnShow(); - HRESULT OnCheckingForUpdate(); - HRESULT OnUpdateAvailable([in, string] const WCHAR* version_string); - HRESULT OnWaitingToDownload(); - HRESULT OnDownloading([in] int time_remaining_ms, [in] int pos); - HRESULT OnWaitingToInstall(); - HRESULT OnInstalling(); - HRESULT OnPause(); - HRESULT OnComplete([in] LegacyCompletionCodes code, - [in, string] const WCHAR* completion_text); - HRESULT SetEventSink([in] IProgressWndEvents* ui_sink); -}; - -[ - object, - oleautomation, - uuid(91B050A9-5A49-4249-A8C8-B4390961A912), - helpstring("IJobObserver2 Interface"), - pointer_default(unique) -] -interface IJobObserver2 : IUnknown { - // @param time_remaining_ms Remaining install time. - // @param pos Current install progress in percentage from 0 to 100. -1 - // indicates unknown. - HRESULT OnInstalling2([in] int time_remaining_ms, [in] int pos); -}; - -[ - object, - oleautomation, - uuid(4C929BFE-4FA4-488D-B1E2-82ECD6F076C8), - helpstring("IGoogleUpdate Interface"), - pointer_default(unique) -] -interface IGoogleUpdate : IUnknown { - // @param guid The guid for the app to be updated. - // @param observer The eventing interface. - HRESULT CheckForUpdate([in, string] const WCHAR* guid, - [in] IJobObserver* observer); - - // @param guid The guid for the app to be updated. - // @param observer The eventing interface. - HRESULT Update([in, string] const WCHAR* guid, - [in] IJobObserver* observer); -}; - -// IGoogleUpdateCore is an internal Omaha interface. -[ - object, - oleautomation, - uuid(10479D64-2C5F-46CD-9BC8-FD04FF4D02D8), - helpstring("Google Update Core Interface"), - pointer_default(unique) -] -interface IGoogleUpdateCore : IUnknown -{ - // Runs a command elevated. - // - // @param app_id Unique id to identify the calling client application - // @param event_id Unique id for the command - // @param caller_proc_id The process id of the calling process - // @param proc_handle The process handle valid in the caller's context - HRESULT LaunchCmdElevated([in, string] const WCHAR* app_guid, - [in, string] const WCHAR* cmd_id, - [in] DWORD caller_proc_id, - [out] ULONG_PTR* proc_handle); -}; - -// END Legacy google_update_idl interfaces. - -[ - uuid(6FF4F468-0B5A-4878-ACEB-86263DAAD877), - version(1.0), - helpstring("Omaha 3.0 Type Library") -] -library GoogleUpdate3Lib { - importlib("stdole2.tlb"); - - // These Interfaces are forward declared to ensure that they are described in - // the generated TLB file. This is required for ATL to correctly implement the - // corresponding IDispatch interfaces. - interface IGoogleUpdate3; - interface IAppBundle; - interface IApp; - interface IApp2; - interface IAppCommand; - interface IAppCommand2; - interface IAppVersion; - interface IPackage; - interface ICurrentState; - - interface IPolicyStatus; - interface IPolicyStatus2; - interface IPolicyStatus3; - interface IPolicyStatusValue; - interface IGoogleUpdate3Web; - interface IAppBundleWeb; - interface IAppWeb; - interface IAppCommandWeb; - interface IAppVersionWeb; - interface ICoCreateAsyncStatus; - - [ - uuid(2CF4A521-EC1E-4075-A20B-5DE3E5B89B1B), - helpstring("GoogleUpdate3 Class for per-user applications") - ] - coclass GoogleUpdate3UserClass { - [default] interface IDispatch; - } - - [ - uuid(08F15E98-0442-45D3-82F1-F67495CC51EB), - helpstring("GoogleUpdate3 Service Class for machine applications") - ] - coclass GoogleUpdate3ServiceClass { - [default] interface IDispatch; - } - - [ - uuid(2F78AECB-0A7F-4474-89D5-C325293DE960), - helpstring("GoogleUpdate3Web for user applications") - ] - coclass GoogleUpdate3WebUserClass { - [default] interface IDispatch; - } - - [ - uuid(00B16F95-319A-4F01-AC81-CE69B8F4E387), - helpstring("Pass-through broker for the GoogleUpdate3WebServiceClass") - ] - coclass GoogleUpdate3WebMachineClass { - [default] interface IDispatch; - } - - [ - uuid(3A9D7221-2278-41DD-930B-C2356B7D3725), - helpstring("GoogleUpdate3Web") - ] - coclass GoogleUpdate3WebServiceClass { - [default] interface IDispatch; - } - - [ - uuid(66CE3D6C-0B35-4F78-AC77-39728A75CB75), - helpstring("Fallback mechanism if GoogleUpdate3WebServiceClass fails") - ] - coclass GoogleUpdate3WebMachineFallbackClass { - [default] interface IDispatch; - } - - [ - uuid(06B74C04-E813-4DD4-A972-172836EFA8D6), - helpstring("CurrentStateUserClass") - ] - coclass CurrentStateUserClass { - [default] interface ICurrentState; - } - - [ - uuid(BC03C0E4-1528-4299-89B2-419644FA48AC), - helpstring("CurrentStateMachineClass") - ] - coclass CurrentStateMachineClass { - [default] interface ICurrentState; - } - - [ - uuid(8F6D9FE5-6ED3-43A3-80D2-EA8766D65352), - helpstring("CoCreateAsyncClass") - ] - coclass CoCreateAsyncClass { - [default] interface IUnknown; - } - - [ - uuid(4C738ABE-2ED7-4BF6-B668-046DC1A72C00), - helpstring("CredentialDialogUserClass") - ] - coclass CredentialDialogUserClass { - [default] interface IUnknown; - } - - [ - uuid(B5D1924F-CB80-47AA-8DEC-5E0854A42A73), - helpstring("CredentialDialogMachineClass") - ] - coclass CredentialDialogMachineClass { - [default] interface IUnknown; - } - - [ - uuid(F6E536F5-F795-49CE-A85D-2DA66503C6F1), - helpstring("PolicyStatusValueUserClass") - ] - coclass PolicyStatusValueUserClass { - [default] interface IUnknown; - } - - [ - uuid(EBDA5D88-AA7D-4A8C-A20C-C01FADB43EDA), - helpstring("PolicyStatusValueMachineClass") - ] - coclass PolicyStatusValueMachineClass { - [default] interface IUnknown; - } - - [ - uuid(02FA9A9C-3856-48A8-A62B-F898C64E45C5), - helpstring("Policy Status for per-user applications.") - ] - coclass PolicyStatusUserClass { - [default] interface IUnknown; - } - - [ - uuid(598BBE98-5919-4392-B62A-50D7115F10A3), - helpstring("Policy Status pass-through broker for machine applications.") - ] - coclass PolicyStatusMachineClass { - [default] interface IUnknown; - } - - [ - uuid(13B35483-DF37-4603-97F8-9504E48B49BF), - helpstring("Policy Status for per-machine applications.") - ] - coclass PolicyStatusMachineServiceClass { - [default] interface IUnknown; - } - - [ - uuid(652886FF-517B-4F23-A14F-F99563A04BCC), - helpstring("Fallback for if PolicyStatusMachineServiceClass fails.") - ] - coclass PolicyStatusMachineFallbackClass { - [default] interface IUnknown; - } - - // BEGIN Legacy google_update_idl coclasses. - - [ - uuid(4C3BA8F3-1264-4BDB-BB2D-CA44734AD00D), - helpstring("ProcessLauncherClass Class") - ] - coclass ProcessLauncherClass { - [default] interface IUnknown; - } - - [ - uuid(6DA8171A-7CEC-4E45-BDED-9F287AD7C854), - helpstring("OnDemand updates for per-user applications.") - ] - coclass OnDemandUserAppsClass { - [default] interface IUnknown; - } - - [ - uuid(28C83F57-E4C0-4B54-B187-585C51EE8F9C), - helpstring("OnDemand pass-through broker for machine applications.") - ] - coclass OnDemandMachineAppsClass { - [default] interface IUnknown; - } - - [ - uuid(D7D7525F-5DF4-4C9D-8781-C02F39F973E6), - helpstring("OnDemand updates for per-machine applications.") - ] - coclass OnDemandMachineAppsServiceClass { - [default] interface IUnknown; - } - - [ - uuid(3282EB12-D954-4FD2-A2E1-C942C8745C65), - helpstring("Fallback for if OnDemandMachineAppsServiceClass fails.") - ] - coclass OnDemandMachineAppsFallbackClass { - [default] interface IUnknown; - } - - [ - uuid(3AD2D487-D166-4160-8E36-1AE505233A55), - helpstring("GoogleUpdateCore Class") - ] - coclass GoogleUpdateCoreClass - { - [default] interface IUnknown; - } - - [ - uuid(F7FF255A-A593-41BD-A69B-E05D72B72756), - helpstring("GoogleUpdateCore Machine Class") - ] - coclass GoogleUpdateCoreMachineClass - { - [default] interface IUnknown; - } - - // END Legacy google_update_idl coclasses. -}; diff --git a/chromium_src/ios/chrome/browser/metrics/model/google_groups_manager_factory.mm b/chromium_src/ios/chrome/browser/metrics/model/google_groups_manager_factory.mm index 79db093d26f4..ec0e85f4314b 100644 --- a/chromium_src/ios/chrome/browser/metrics/model/google_groups_manager_factory.mm +++ b/chromium_src/ios/chrome/browser/metrics/model/google_groups_manager_factory.mm @@ -10,12 +10,6 @@ #import "components/variations/service/google_groups_manager.h" #import "ios/chrome/browser/shared/model/profile/profile_ios.h" -// static -GoogleGroupsManager* GoogleGroupsManagerFactory::GetForBrowserState( - ProfileIOS* profile) { - return nullptr; -} - // static GoogleGroupsManager* GoogleGroupsManagerFactory::GetForProfile( ProfileIOS* profile) { diff --git a/chromium_src/net/socket/socks5_client_socket.cc b/chromium_src/net/socket/socks5_client_socket.cc index 3d56489e4aed..918941f1dd46 100644 --- a/chromium_src/net/socket/socks5_client_socket.cc +++ b/chromium_src/net/socket/socks5_client_socket.cc @@ -18,6 +18,8 @@ namespace net { namespace { +constexpr size_t kSOCKSAuthUsernamePasswordResponseLen = 2; + HostPortPair ToLegacyDestinationEndpoint( const TransportSocketParams::Endpoint& endpoint) { if (absl::holds_alternative(endpoint)) { @@ -79,8 +81,6 @@ uint8_t SOCKS5ClientSocketAuth::auth_method() { return 0x02; } -static const size_t kSOCKSAuthUsernamePasswordResponseLen = 2; - int SOCKS5ClientSocketAuth::Authenticate( int rv, NetLogWithSource& net_log, 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 d4301f59e892..6275cc6f29a7 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 @@ -554,9 +554,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 Dec 3 19:46:08 UTC 2024 +# Last updated: Thu Dec 5 14:43:43 UTC 2024 PinsListTimestamp -1733255168 +1733409823 # =====BEGIN BRAVE ROOTS ASC===== #From https://www.amazontrust.com/repository/ diff --git a/chromium_src/pdf/pdfium/DEPS b/chromium_src/pdf/pdfium/DEPS deleted file mode 100644 index e59caad0df40..000000000000 --- a/chromium_src/pdf/pdfium/DEPS +++ /dev/null @@ -1,3 +0,0 @@ -include_rules = [ - "+third_party/pdfium/public", -] diff --git a/chromium_src/pdf/pdfium/pdfium_page.cc b/chromium_src/pdf/pdfium/pdfium_page.cc deleted file mode 100644 index c7d5f5ed0bc2..000000000000 --- a/chromium_src/pdf/pdfium/pdfium_page.cc +++ /dev/null @@ -1,17 +0,0 @@ -/* Copyright (c) 2024 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at https://mozilla.org/MPL/2.0/. */ - -#include "third_party/pdfium/public/fpdf_catalog.h" - -#define FPDFCatalog_IsTagged \ - false; \ - if (!page_object_count) { \ - images_.push_back(Image()); \ - return; \ - } \ - is_tagged = FPDFCatalog_IsTagged - -#include "src/pdf/pdfium/pdfium_page.cc" -#undef FPDFCatalog_IsTagged diff --git a/chromium_src/services/network/network_service.cc b/chromium_src/services/network/network_service.cc index 5f8f6d275676..638790e3e78d 100644 --- a/chromium_src/services/network/network_service.cc +++ b/chromium_src/services/network/network_service.cc @@ -3,7 +3,12 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at https://mozilla.org/MPL/2.0/. */ +#include "services/network/network_service.h" + +#define UpdateKeyPinsList UpdateKeyPinsList_Unused #include "src/services/network/network_service.cc" +#undef UpdateKeyPinsList + #include "brave/net/dns/secure_dns_counter.h" #include "services/network/public/mojom/network_service.mojom.h" @@ -17,4 +22,7 @@ void NetworkService::GetDnsRequestCountsAndReset( mojom::DnsRequestCounts::New(counts.total_count, counts.upgraded_count)); } +void NetworkService::UpdateKeyPinsList(mojom::PinListPtr pin_list, + base::Time update_time) {} + } // namespace network diff --git a/chromium_src/services/network/network_service.h b/chromium_src/services/network/network_service.h index e96199fff575..f45615b0ae43 100644 --- a/chromium_src/services/network/network_service.h +++ b/chromium_src/services/network/network_service.h @@ -12,9 +12,14 @@ GetDnsRequestCountsAndReset(GetDnsRequestCountsAndResetCallback callback) \ override; \ void DisableQuic +#define UpdateKeyPinsList \ + UpdateKeyPinsList_Unused(mojom::PinListPtr pin_list, \ + base::Time update_time); \ + void UpdateKeyPinsList #include "src/services/network/network_service.h" // IWYU pragma: export +#undef UpdateKeyPinsList #undef DisableQuic #endif // BRAVE_CHROMIUM_SRC_SERVICES_NETWORK_NETWORK_SERVICE_H_ diff --git a/chromium_src/third_party/blink/common/features.cc b/chromium_src/third_party/blink/common/features.cc index 2c4bcf4f231d..121a5c490bf4 100644 --- a/chromium_src/third_party/blink/common/features.cc +++ b/chromium_src/third_party/blink/common/features.cc @@ -44,7 +44,6 @@ OVERRIDE_FEATURE_DEFAULT_STATES({{ {kSharedStorageAPI, base::FEATURE_DISABLED_BY_DEFAULT}, {kSharedStorageAPIM118, base::FEATURE_DISABLED_BY_DEFAULT}, {kSharedStorageAPIM125, base::FEATURE_DISABLED_BY_DEFAULT}, - {kSharedStorageSelectURLLimit, base::FEATURE_DISABLED_BY_DEFAULT}, {kSpeculationRulesPrefetchFuture, base::FEATURE_DISABLED_BY_DEFAULT}, {kTextFragmentAnchor, base::FEATURE_DISABLED_BY_DEFAULT}, }}); diff --git a/chromium_src/third_party/blink/renderer/core/execution_context/navigator_base.cc b/chromium_src/third_party/blink/renderer/core/execution_context/navigator_base.cc index fdc13c69730f..66b1368d6b02 100644 --- a/chromium_src/third_party/blink/renderer/core/execution_context/navigator_base.cc +++ b/chromium_src/third_party/blink/renderer/core/execution_context/navigator_base.cc @@ -19,8 +19,8 @@ namespace probe { void ApplyBraveHardwareConcurrencyOverride(blink::ExecutionContext* context, unsigned int* hardware_concurrency) { - const unsigned kFakeMinProcessors = 2; - const unsigned kFakeMaxProcessors = 8; + static constexpr unsigned kFakeMinProcessors = 2; + static constexpr unsigned kFakeMaxProcessors = 8; unsigned true_value = static_cast(base::SysInfo::NumberOfProcessors()); if (true_value <= 2) { diff --git a/chromium_src/third_party/blink/renderer/core/frame/cached_permission_status.cc b/chromium_src/third_party/blink/renderer/core/frame/cached_permission_status.cc new file mode 100644 index 000000000000..fb9f053d120b --- /dev/null +++ b/chromium_src/third_party/blink/renderer/core/frame/cached_permission_status.cc @@ -0,0 +1,14 @@ +/* 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 "third_party/blink/renderer/core/frame/cached_permission_status.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/frame/cached_permission_status.cc" +#undef PermissionStatus diff --git a/chromium_src/third_party/blink/renderer/core/loader/mixed_content_checker.cc b/chromium_src/third_party/blink/renderer/core/loader/mixed_content_checker.cc index 5492a0d94e70..0c3f3baa1ac8 100644 --- a/chromium_src/third_party/blink/renderer/core/loader/mixed_content_checker.cc +++ b/chromium_src/third_party/blink/renderer/core/loader/mixed_content_checker.cc @@ -27,8 +27,7 @@ String GetHost(const KURL& obj) { template bool IsOnion(const T& obj) { - constexpr const char kOnion[] = ".onion"; - return GetHost(obj).EndsWith(kOnion) && + return GetHost(obj).EndsWith(".onion") && (obj.Protocol() == url::kHttpsScheme || obj.Protocol() == url::kHttpScheme || obj.Protocol() == url::kWsScheme || diff --git a/chromium_src/ui/base/models/simple_menu_model.h b/chromium_src/ui/base/models/simple_menu_model.h deleted file mode 100644 index d6f79f03a519..000000000000 --- a/chromium_src/ui/base/models/simple_menu_model.h +++ /dev/null @@ -1,17 +0,0 @@ -/* Copyright (c) 2024 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at https://mozilla.org/MPL/2.0/. */ - -#ifndef BRAVE_CHROMIUM_SRC_UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_ -#define BRAVE_CHROMIUM_SRC_UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_ - -#define AddButtonItem \ - AddButtonItemAt(int command_id, ButtonMenuItemModel* model, size_t index); \ - void AddButtonItem - -#include "src/ui/base/models/simple_menu_model.h" // IWYU pragma: export - -#undef AddButtonItem - -#endif // BRAVE_CHROMIUM_SRC_UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_ diff --git a/chromium_src/ui/base/models/simple_menu_model.cc b/chromium_src/ui/menus/simple_menu_model.cc similarity index 92% rename from chromium_src/ui/base/models/simple_menu_model.cc rename to chromium_src/ui/menus/simple_menu_model.cc index 365a36c573b4..f50712b59d94 100644 --- a/chromium_src/ui/base/models/simple_menu_model.cc +++ b/chromium_src/ui/menus/simple_menu_model.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 "src/ui/base/models/simple_menu_model.cc" +#include "src/ui/menus/simple_menu_model.cc" namespace ui { diff --git a/chromium_src/ui/menus/simple_menu_model.h b/chromium_src/ui/menus/simple_menu_model.h new file mode 100644 index 000000000000..3325b1ed0ffc --- /dev/null +++ b/chromium_src/ui/menus/simple_menu_model.h @@ -0,0 +1,17 @@ +/* Copyright (c) 2024 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_CHROMIUM_SRC_UI_MENUS_SIMPLE_MENU_MODEL_H_ +#define BRAVE_CHROMIUM_SRC_UI_MENUS_SIMPLE_MENU_MODEL_H_ + +#define AddButtonItem \ + AddButtonItemAt(int command_id, ButtonMenuItemModel* model, size_t index); \ + void AddButtonItem + +#include "src/ui/menus/simple_menu_model.h" // IWYU pragma: export + +#undef AddButtonItem + +#endif // BRAVE_CHROMIUM_SRC_UI_MENUS_SIMPLE_MENU_MODEL_H_ 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 a607ba6c2d1f..9bda1437281d 100644 --- a/chromium_src/ui/views/controls/button/md_text_button.cc +++ b/chromium_src/ui/views/controls/button/md_text_button.cc @@ -352,11 +352,10 @@ MdTextButton::ButtonColors MdTextButton::GetButtonColors() { MdTextButtonStyleKey style_lookup{GetBraveStyle(), color_scheme, state}; auto it = GetButtonThemes().find(style_lookup); if (it == GetButtonThemes().end()) { - NOTREACHED_IN_MIGRATION() - << "No button theme found for : " << static_cast(GetBraveStyle()) - << ", ColorScheme: " - << (color_scheme == ColorScheme::kDark ? "dark" : "light") - << ", ButtonState: " << state; + NOTREACHED() << "No button theme found for : " + << static_cast(GetBraveStyle()) << ", ColorScheme: " + << (color_scheme == ColorScheme::kDark ? "dark" : "light") + << ", ButtonState: " << state; } const auto& style = it->second; return {.background_color = AddOpacity( diff --git a/chromium_src/v8/src/builtins/builtins.cc b/chromium_src/v8/src/builtins/builtins.cc index e5ce3b0d16e6..2e72091dee7a 100644 --- a/chromium_src/v8/src/builtins/builtins.cc +++ b/chromium_src/v8/src/builtins/builtins.cc @@ -24,14 +24,13 @@ static std::string ToPageGraphArg(Isolate* isolate, Handle object) { if (object.is_null()) { return {}; } - MaybeHandle maybe_string = + MaybeDirectHandle maybe_string = Object::NoSideEffectsToMaybeString(isolate, object); - Handle string_handle; + DirectHandle string_handle; if (!maybe_string.ToHandle(&string_handle)) { return {}; } - if (auto c_string = - string_handle->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL)) { + if (auto c_string = string_handle->ToCString()) { return std::string(c_string.get()); } return {}; diff --git a/common/BUILD.gn b/common/BUILD.gn index 198bd4a672b5..a6038e91c979 100644 --- a/common/BUILD.gn +++ b/common/BUILD.gn @@ -35,7 +35,6 @@ source_set("channel_info") { deps = [ "//base:base", - "//base:logging_buildflags", "//components/version_info:version_info", ] diff --git a/components/ai_chat/content/browser/ai_chat_tab_helper.cc b/components/ai_chat/content/browser/ai_chat_tab_helper.cc index bcead876887e..12a143243567 100644 --- a/components/ai_chat/content/browser/ai_chat_tab_helper.cc +++ b/components/ai_chat/content/browser/ai_chat_tab_helper.cc @@ -52,9 +52,7 @@ void AIChatTabHelper::PDFA11yInfoLoadObserver::AccessibilityEventReceived( for (const auto& node : update.nodes) { const auto& node_name = node.GetStringAttribute(ax::mojom::StringAttribute::kName); - if (node_name == l10n_util::GetStringUTF8(IDS_PDF_LOADED_TO_A11Y_TREE) || - node_name == l10n_util::GetStringUTF8(IDS_PDF_OCR_COMPLETED) || - node_name == l10n_util::GetStringUTF8(IDS_PDF_OCR_NO_RESULT)) { + if (node_name == l10n_util::GetStringUTF8(IDS_PDF_LOADED_TO_A11Y_TREE)) { // features::kUseMoveNotCopyInMergeTreeUpdate updates a11y tree after // `AccessibilityEventReceived` so we cannot assume changes are // reflected upon receiving updates. @@ -251,20 +249,6 @@ void AIChatTabHelper::GetPageContent(GetPageContentCallback callback, bool is_pdf = IsPdf(web_contents()); if (is_pdf && !is_pdf_a11y_info_loaded_) { SetPendingGetContentCallback(std::move(callback)); - // PdfAccessibilityTree::AccessibilityModeChanged handles kPDFOcr changes - // with |always_load_or_reload_accessibility| is true - if (inner_web_contents_) { - auto current_mode = inner_web_contents_->GetAccessibilityMode(); - if (!current_mode.has_mode(ui::AXMode::kPDFOcr)) { - current_mode |= ui::AXMode::kPDFOcr; - scoped_accessibility_mode_ = - content::BrowserAccessibilityState::GetInstance() - ->CreateScopedModeForWebContents(inner_web_contents_, - current_mode); - } - pdf_load_observer_ = - std::make_unique(inner_web_contents_, this); - } // Manually check when pdf extraction requested so we don't always rely on // a11y events to prevent stale callback. It can happens during background // pdf tab loading or bug in upstream kPdfOCR that an empty page in pdf will @@ -274,7 +258,7 @@ void AIChatTabHelper::GetPageContent(GetPageContentCallback callback, CheckPDFA11yTree(); return; } - if (base::Contains(kPrintPreviewRetrievalHosts, GetPageURL().host_piece())) { + if (kPrintPreviewRetrievalHosts.contains(GetPageURL().host_piece())) { // Get content using a printing / OCR mechanism, instead of // directly from the source, if available. DVLOG(1) << __func__ << " print preview url"; diff --git a/components/ai_chat/content/browser/ai_chat_tab_helper.h b/components/ai_chat/content/browser/ai_chat_tab_helper.h index 1c6d9d532a5f..46a6147421e4 100644 --- a/components/ai_chat/content/browser/ai_chat_tab_helper.h +++ b/components/ai_chat/content/browser/ai_chat_tab_helper.h @@ -29,7 +29,6 @@ class ScopedAccessibilityMode; } class AIChatUIBrowserTest; -class UpstreamPDFIntegratoinTest; namespace ai_chat { class AIChatMetrics; @@ -110,7 +109,6 @@ class AIChatTabHelper : public content::WebContentsObserver, friend class content::WebContentsUserData; friend class ::AIChatUIBrowserTest; friend class AIChatTabHelperUnitTest; - friend class ::UpstreamPDFIntegratoinTest; // To observe PDF InnerWebContents for "Finished loading PDF" event which // means PDF content has been loaded to an accessibility tree. diff --git a/components/ai_chat/content/browser/pdf_utils.cc b/components/ai_chat/content/browser/pdf_utils.cc index b2439d5f16a3..94c28018416e 100644 --- a/components/ai_chat/content/browser/pdf_utils.cc +++ b/components/ai_chat/content/browser/pdf_utils.cc @@ -35,64 +35,6 @@ ui::AXNode* FindPdfRoot(const ui::AXNode* start_node) { return nullptr; } -#if BUILDFLAG(ENABLE_PDF) -ui::AXNode* FindOcrResultBeginBanner(const ui::AXNode* start_node) { - if (!start_node) { - return nullptr; - } - for (const auto& node : start_node->GetAllChildren()) { - if (node->GetStringAttribute(ax::mojom::StringAttribute::kName) == - l10n_util::GetStringUTF8(IDS_PDF_OCR_RESULT_BEGIN) && - node->GetParent()->GetRole() == ax::mojom::Role::kBanner) { - return node->GetParent(); - } - ui::AXNode* result = FindOcrResultBeginBanner(node); - if (result) { - return result; - } - } - return nullptr; -} - -bool IsOcrResultEndContentInfo(const ui::AXNode* node) { - if (!node) { - return false; - } - if (node->GetRole() == ax::mojom::Role::kContentInfo && - node->GetChildCount() == 1u && - node->GetFirstChild()->GetStringAttribute( - ax::mojom::StringAttribute::kName) == - l10n_util::GetStringUTF8(IDS_PDF_OCR_RESULT_END)) { - return true; - } - return false; -} -#endif - -std::optional GetOcrResult(const ui::AXNode* start_node) { -#if BUILDFLAG(ENABLE_PDF) - if (!start_node) { - return std::nullopt; - } - const auto* ocr_result_begin_banner = FindOcrResultBeginBanner(start_node); - if (!ocr_result_begin_banner) { - return std::nullopt; - } - std::string result; - ui::AXNode* node = ocr_result_begin_banner->GetNextSibling(); - while (node && !IsOcrResultEndContentInfo(node)) { - base::StrAppend( - &result, - {node->GetTextContentUTF8(), - IsOcrResultEndContentInfo(node->GetNextSibling()) ? "" : "\n"}); - node = node->GetNextSibling(); - } - return result; -#else - return std::nullopt; -#endif -} - } // namespace bool IsPdf(content::WebContents* web_contents) { @@ -132,9 +74,7 @@ bool IsPdfLoaded(const ui::AXNode* pdf_root) { const auto& name = pdf_root->GetChildAtIndex(0)->GetChildAtIndex(0)->GetStringAttribute( ax::mojom::StringAttribute::kName); - if (name == l10n_util::GetStringUTF8(IDS_PDF_OCR_IN_PROGRESS) || - name == l10n_util::GetStringUTF8(IDS_PDF_LOADING_TO_A11Y_TREE) || - name == l10n_util::GetStringUTF8(IDS_PDF_OCR_FEATURE_ALERT)) { + if (name == l10n_util::GetStringUTF8(IDS_PDF_LOADING_TO_A11Y_TREE)) { return false; } #endif @@ -153,10 +93,8 @@ std::string ExtractPdfContent(const ui::AXNode* pdf_root) { for (auto it = children.cbegin() + 1; it != children.cend(); ++it) { const ui::AXNode* node = *it; if (node->GetRole() == ax::mojom::Role::kRegion) { - auto ocr_result = GetOcrResult(node); - base::StrAppend(&pdf_content, - {ocr_result ? *ocr_result : node->GetTextContentUTF8(), - it == children.cend() - 1 ? "" : "\n"}); + base::StrAppend(&pdf_content, {node->GetTextContentUTF8(), + it == children.cend() - 1 ? "" : "\n"}); } } return pdf_content; diff --git a/components/ai_chat/core/browser/ai_chat_service.cc b/components/ai_chat/core/browser/ai_chat_service.cc index 33c8b2ede049..6ca39f53c09c 100644 --- a/components/ai_chat/core/browser/ai_chat_service.cc +++ b/components/ai_chat/core/browser/ai_chat_service.cc @@ -27,7 +27,7 @@ namespace ai_chat { namespace { -static const auto kAllowedSchemes = base::MakeFixedFlatSet( +constexpr auto kAllowedSchemes = base::MakeFixedFlatSet( {url::kHttpsScheme, url::kHttpScheme, url::kFileScheme, url::kDataScheme}); } // namespace @@ -158,7 +158,7 @@ void AIChatService::MaybeAssociateContentWithConversation( base::WeakPtr associated_content) { if (associated_content && - base::Contains(kAllowedSchemes, associated_content->GetURL().scheme())) { + kAllowedSchemes.contains(associated_content->GetURL().scheme())) { conversation->SetAssociatedContentDelegate(associated_content); } // Record that this is the latest conversation for this content. Even diff --git a/components/ai_chat/core/browser/constants.cc b/components/ai_chat/core/browser/constants.cc index d3272a211f87..056f6ffd9d5c 100644 --- a/components/ai_chat/core/browser/constants.cc +++ b/components/ai_chat/core/browser/constants.cc @@ -5,6 +5,7 @@ #include "brave/components/ai_chat/core/browser/constants.h" +#include #include #include "base/strings/strcat.h" @@ -13,155 +14,156 @@ namespace ai_chat { base::span GetLocalizedStrings() { - constexpr webui::LocalizedString kLocalizedStrings[] = { - {"siteTitle", IDS_CHAT_UI_TITLE}, - {"summarizeFailedLabel", IDS_CHAT_UI_SUMMARIZE_FAILED_LABEL}, - {"acceptButtonLabel", IDS_CHAT_UI_ACCEPT_BUTTON_LABEL}, - {"summarizeButtonLabel", IDS_CHAT_UI_SUMMARIZE_BUTTON_LABEL}, - {"aboutTitle", IDS_CHAT_UI_ABOUT_TITLE}, - {"aboutDescription", IDS_CHAT_UI_ABOUT_DESCRIPTION}, - {"aboutDescription_2", IDS_CHAT_UI_ABOUT_DESCRIPTION_2}, - {"aboutDescription_3", IDS_CHAT_UI_ABOUT_DESCRIPTION_3}, - {"placeholderLabel", IDS_CHAT_UI_PLACEHOLDER_LABEL}, - {"pageContentWarning", IDS_CHAT_UI_PAGE_CONTENT_WARNING}, - {"errorNetworkLabel", IDS_CHAT_UI_ERROR_NETWORK}, - {"errorRateLimit", IDS_CHAT_UI_ERROR_RATE_LIMIT}, - {"retryButtonLabel", IDS_CHAT_UI_RETRY_BUTTON_LABEL}, - {"introMessage-chat-basic", IDS_CHAT_UI_INTRO_MESSAGE_CHAT_BASIC}, - {"introMessage-chat-leo-expanded", - IDS_CHAT_UI_INTRO_MESSAGE_CHAT_LEO_EXPANDED}, - {"introMessage-chat-claude-instant", - IDS_CHAT_UI_INTRO_MESSAGE_CHAT_LEO_CLAUDE_INSTANT}, - {"introMessage-chat-claude-haiku", - IDS_CHAT_UI_INTRO_MESSAGE_CHAT_LEO_CLAUDE_HAIKU}, - {"introMessage-chat-claude-sonnet", - IDS_CHAT_UI_INTRO_MESSAGE_CHAT_LEO_CLAUDE_SONNET}, - {"modelNameSyntax", IDS_CHAT_UI_MODEL_NAME_SYNTAX}, - {"modelPremiumLabelNonPremium", - IDS_CHAT_UI_MODEL_PREMIUM_LABEL_NON_PREMIUM}, - {"modelCategory-chat", IDS_CHAT_UI_MODEL_CATEGORY_CHAT}, - {"menuNewChat", IDS_CHAT_UI_MENU_NEW_CHAT}, - {"openFullPageLabel", IDS_CHAT_UI_LABEL_OPEN_FULL_PAGE}, - {"closeLabel", IDS_CHAT_UI_LABEL_CLOSE}, - {"menuGoPremium", IDS_CHAT_UI_MENU_GO_PREMIUM}, - {"menuManageSubscription", IDS_CHAT_UI_MENU_MANAGE_SUBSCRIPTION}, - {"menuConversationHistory", IDS_CHAT_UI_MENU_CONVERSATION_HISTORY}, - {"menuSettings", IDS_CHAT_UI_MENU_SETTINGS}, - {"menuTitleModels", IDS_CHAT_UI_MENU_TITLE_MODELS}, - {"suggestQuestionsLabel", IDS_CHAT_UI_SUGGEST_QUESTIONS_LABEL}, - {"upgradeButtonLabel", IDS_CHAT_UI_UPGRADE_BUTTON_LABEL}, - {"rateLimitReachedTitle", IDS_CHAT_UI_RATE_LIMIT_REACHED_TITLE}, - {"rateLimitReachedDesc", IDS_CHAT_UI_RATE_LIMIT_REACHED_DESC}, - {"premiumFeature_1", IDS_CHAT_UI_PREMIUM_FEATURE_1}, - {"premiumFeature_2", IDS_CHAT_UI_PREMIUM_FEATURE_2}, - {"premiumFeature_3", IDS_CHAT_UI_PREMIUM_FEATURE_3}, - {"premiumFeature_4", IDS_CHAT_UI_PREMIUM_FEATURE_4}, - {"premiumFeature_1_desc", IDS_CHAT_UI_PREMIUM_FEATURE_1_DESC}, - {"premiumFeature_2_desc", IDS_CHAT_UI_PREMIUM_FEATURE_2_DESC}, - {"premiumFeature_3_desc", IDS_CHAT_UI_PREMIUM_FEATURE_3_DESC}, - {"premiumFeature_4_desc", IDS_CHAT_UI_PREMIUM_FEATURE_4_DESC}, - {"premiumLabel", IDS_CHAT_UI_PREMIUM_LABEL}, - {"premiumPricing", IDS_CHAT_UI_PREMIUM_PRICING}, - {"switchToBasicModelButtonLabel", - IDS_CHAT_UI_SWITCH_TO_BASIC_MODEL_BUTTON_LABEL}, - {"dismissButtonLabel", IDS_CHAT_UI_DISMISS_BUTTON_LABEL}, - {"unlockPremiumTitle", IDS_CHAT_UI_UNLOCK_PREMIUM_TITLE}, - {"premiumRefreshWarningDescription", - IDS_CHAT_UI_PREMIUM_REFRESH_WARNING_DESCRIPTION}, - {"premiumRefreshWarningAction", - IDS_CHAT_UI_PREMIUM_REFRESH_WARNING_ACTION}, - {"feedbackSent", IDS_CHAT_UI_FEEDBACK_SENT}, - {"answerDisliked", IDS_CHAT_UI_ANSWER_DISLIKED}, - {"answerLiked", IDS_CHAT_UI_ANSWER_LIKED}, - {"addFeedbackButtonLabel", IDS_CHAT_UI_ADD_FEEDBACK_BUTTON_LABEL}, - {"copyButtonLabel", IDS_CHAT_UI_COPY_BUTTON_LABEL}, - {"likeAnswerButtonLabel", IDS_CHAT_UI_LIKE_ANSWER_BUTTON_LABEL}, - {"dislikeAnswerButtonLabel", IDS_CHAT_UI_DISLIKE_ANSWER_BUTTON_LABEL}, - {"provideFeedbackTitle", IDS_CHAT_UI_PROVIDE_FEEDBACK_TITLE}, - {"selectFeedbackTopic", IDS_CHAT_UI_SELECT_FEEDBACK_TOPIC}, - {"feedbackCategoryLabel", IDS_CHAT_UI_FEEDBACK_CATEGORY_LABEL}, - {"feedbackDescriptionLabel", IDS_CHAT_UI_FEEDBACK_DESCRIPTION_LABEL}, - {"feedbackPremiumNote", IDS_CHAT_UI_FEEDBACK_PREMIUM_NOTE}, - {"submitButtonLabel", IDS_CHAT_UI_SUBMIT_BUTTON_LABEL}, - {"cancelButtonLabel", IDS_CHAT_UI_CANCEL_BUTTON_LABEL}, - {"saveButtonLabel", IDS_CHAT_UI_SAVE_BUTTON_LABEL}, - {"editedLabel", IDS_CHAT_UI_EDITED_LABEL}, - {"editButtonLabel", IDS_CHAT_UI_EDIT_BUTTON_LABEL}, - {"editAnswerLabel", IDS_CHAT_UI_EDIT_ANSWER_LABEL}, - {"optionNotHelpful", IDS_CHAT_UI_OPTION_NOT_HELPFUL}, - {"optionIncorrect", IDS_CHAT_UI_OPTION_INCORRECT}, - {"optionUnsafeHarmful", IDS_CHAT_UI_OPTION_UNSAFE_HARMFUL}, - {"optionOther", IDS_CHAT_UI_OPTION_OTHER}, - {"feedbackError", IDS_CHAT_UI_FEEDBACK_SUBMIT_ERROR}, - {"ratingError", IDS_CHAT_UI_RATING_ERROR}, - {"braveLeoModelSubtitle-chat-basic", IDS_CHAT_UI_CHAT_BASIC_SUBTITLE}, - {"braveLeoModelSubtitle-chat-leo-expanded", - IDS_CHAT_UI_CHAT_LEO_EXPANDED_SUBTITLE}, - {"braveLeoModelSubtitle-chat-claude-instant", - IDS_CHAT_UI_CHAT_CLAUDE_INSTANT_SUBTITLE}, - {"braveLeoModelSubtitle-chat-claude-haiku", - IDS_CHAT_UI_CHAT_CLAUDE_HAIKU_SUBTITLE}, - {"braveLeoModelSubtitle-chat-claude-sonnet", - IDS_CHAT_UI_CHAT_CLAUDE_SONNET_SUBTITLE}, - {"clearChatButtonLabel", IDS_CHAT_UI_CLEAR_CHAT_BUTTON_LABEL}, - {"newChatButtonLabel", IDS_CHAT_UI_NEW_CONVERSATION_BUTTON_LABEL}, - {"menuRenameConversation", IDS_CHAT_UI_MENU_RENAME_CONVERSATION}, - {"menuDeleteConversation", IDS_CHAT_UI_MENU_DELETE_CONVERSATION}, - {"sendChatButtonLabel", IDS_CHAT_UI_SEND_CHAT_BUTTON_LABEL}, - {"errorContextLimitReaching", IDS_CHAT_UI_ERROR_CONTEXT_LIMIT_REACHING}, - {"gotItButtonLabel", IDS_CHAT_UI_GOT_IT_BUTTON_LABEL}, - {"pageContentTooLongWarning", IDS_CHAT_UI_PAGE_CONTENT_TOO_LONG_WARNING}, - {"pageContentRefinedWarning", IDS_CHAT_UI_PAGE_CONTENT_REFINED_WARNING}, - {"pageContentRefinedInProgress", - IDS_CHAT_UI_PAGE_CONTENT_REFINED_IN_PROGRESS}, - {"errorConversationEnd", IDS_CHAT_UI_CONVERSATION_END_ERROR}, - {"searchInProgress", IDS_CHAT_UI_SEARCH_IN_PROGRESS}, - {"searchQueries", IDS_CHAT_UI_SEARCH_QUERIES}, - {"learnMore", IDS_CHAT_UI_LEARN_MORE}, - {"leoSettingsTooltipLabel", IDS_CHAT_UI_LEO_SETTINGS_TOOLTIP_LABEL}, - {"summarizePageButtonLabel", IDS_CHAT_UI_SUMMARIZE_PAGE}, - {"welcomeGuideTitle", IDS_CHAT_UI_WELCOME_GUIDE_TITLE}, - {"welcomeGuideSubtitle", IDS_CHAT_UI_WELCOME_GUIDE_SUBTITLE}, - {"welcomeGuideSiteHelpCardTitle", - IDS_CHAT_UI_WELCOME_GUIDE_SITE_HELP_CARD_TITLE}, - {"welcomeGuideSiteHelpCardDesc", - IDS_CHAT_UI_WELCOME_GUIDE_SITE_HELP_CARD_DESC}, - {"welcomeGuideSiteHelpCardDescWithAction", - IDS_CHAT_UI_WELCOME_GUIDE_SITE_HELP_CARD_WITH_ACTION}, - {"welcomeGuideShatCardTitle", IDS_CHAT_UI_WELCOME_GUIDE_CHAT_CARD_TITLE}, - {"welcomeGuideShatCardDesc", IDS_CHAT_UI_WELCOME_GUIDE_CHAT_CARD_DESC}, - {"privacyTitle", IDS_CHAT_UI_PRIVACY_TITLE}, - {"contextToggleLabel", IDS_CHAT_UI_CONTEXT_TOGGLE_LABEL}, - {"contextToggleTooltipInfo", IDS_CHAT_UI_CONTEXT_TOGGLE_TOOLTIP_INFO}, - {"subscriptionPolicyInfo", IDS_CHAT_UI_SUBSCRIPTION_POLICY_INFO}, - {"explainLabel", IDS_AI_CHAT_CONTEXT_EXPLAIN}, - {"summarizeLabel", IDS_AI_CHAT_CONTEXT_SUMMARIZE_TEXT}, - {"paraphraseLabel", IDS_AI_CHAT_CONTEXT_PARAPHRASE}, - {"createCategoryTitle", IDS_AI_CHAT_CONTEXT_CREATE}, - {"taglineLabel", IDS_AI_CHAT_CONTEXT_CREATE_TAGLINE}, - {"socialMediaPostLabel", IDS_AI_CHAT_CONTEXT_CREATE_SOCIAL_MEDIA_POST}, - {"socialMediaShortLabel", - IDS_AI_CHAT_CONTEXT_CREATE_SOCIAL_MEDIA_COMMENT_SHORT}, - {"socialMediaLongLabel", - IDS_AI_CHAT_CONTEXT_CREATE_SOCIAL_MEDIA_COMMENT_LONG}, - {"rewriteCategoryTitle", IDS_AI_CHAT_CONTEXT_REWRITE}, - {"improveLabel", IDS_AI_CHAT_CONTEXT_IMPROVE}, - {"changeToneLabel", IDS_AI_CHAT_CONTEXT_CHANGE_TONE}, - {"changeLengthLabel", IDS_AI_CHAT_CONTEXT_CHANGE_LENGTH}, - {"academicizeLabel", IDS_AI_CHAT_CONTEXT_ACADEMICIZE}, - {"professionalizeLabel", IDS_AI_CHAT_CONTEXT_PROFESSIONALIZE}, - {"persuasiveToneLabel", IDS_AI_CHAT_CONTEXT_PERSUASIVE_TONE}, - {"casualizeLabel", IDS_AI_CHAT_CONTEXT_CASUALIZE}, - {"funnyToneLabel", IDS_AI_CHAT_CONTEXT_FUNNY_TONE}, - {"shortenLabel", IDS_AI_CHAT_CONTEXT_SHORTEN}, - {"expandLabel", IDS_AI_CHAT_CONTEXT_EXPAND}, - {"sendSiteHostnameLabel", IDS_CHAT_UI_SEND_SITE_HOSTNAME_LABEL}, - {"maybeLaterLabel", IDS_AI_CHAT_MAYBE_LATER_LABEL}, - {"toolsMenuButtonLabel", IDS_AI_CHAT_LEO_TOOLS_BUTTON_LABEL}, - {"useMicButtonLabel", IDS_AI_CHAT_USE_MICROPHONE_BUTTON_LABEL}, - {"menuTitleCustomModels", IDS_AI_CHAT_MENU_TITLE_CUSTOM_MODELS}, - {"startConversationLabel", IDS_AI_CHAT_START_CONVERSATION_LABEL}, - {"conversationListUntitled", IDS_AI_CHAT_CONVERSATION_LIST_UNTITLED}}; + static constexpr auto kLocalizedStrings = std::to_array< + webui::LocalizedString>( + {{"siteTitle", IDS_CHAT_UI_TITLE}, + {"summarizeFailedLabel", IDS_CHAT_UI_SUMMARIZE_FAILED_LABEL}, + {"acceptButtonLabel", IDS_CHAT_UI_ACCEPT_BUTTON_LABEL}, + {"summarizeButtonLabel", IDS_CHAT_UI_SUMMARIZE_BUTTON_LABEL}, + {"aboutTitle", IDS_CHAT_UI_ABOUT_TITLE}, + {"aboutDescription", IDS_CHAT_UI_ABOUT_DESCRIPTION}, + {"aboutDescription_2", IDS_CHAT_UI_ABOUT_DESCRIPTION_2}, + {"aboutDescription_3", IDS_CHAT_UI_ABOUT_DESCRIPTION_3}, + {"placeholderLabel", IDS_CHAT_UI_PLACEHOLDER_LABEL}, + {"pageContentWarning", IDS_CHAT_UI_PAGE_CONTENT_WARNING}, + {"errorNetworkLabel", IDS_CHAT_UI_ERROR_NETWORK}, + {"errorRateLimit", IDS_CHAT_UI_ERROR_RATE_LIMIT}, + {"retryButtonLabel", IDS_CHAT_UI_RETRY_BUTTON_LABEL}, + {"introMessage-chat-basic", IDS_CHAT_UI_INTRO_MESSAGE_CHAT_BASIC}, + {"introMessage-chat-leo-expanded", + IDS_CHAT_UI_INTRO_MESSAGE_CHAT_LEO_EXPANDED}, + {"introMessage-chat-claude-instant", + IDS_CHAT_UI_INTRO_MESSAGE_CHAT_LEO_CLAUDE_INSTANT}, + {"introMessage-chat-claude-haiku", + IDS_CHAT_UI_INTRO_MESSAGE_CHAT_LEO_CLAUDE_HAIKU}, + {"introMessage-chat-claude-sonnet", + IDS_CHAT_UI_INTRO_MESSAGE_CHAT_LEO_CLAUDE_SONNET}, + {"modelNameSyntax", IDS_CHAT_UI_MODEL_NAME_SYNTAX}, + {"modelPremiumLabelNonPremium", + IDS_CHAT_UI_MODEL_PREMIUM_LABEL_NON_PREMIUM}, + {"modelCategory-chat", IDS_CHAT_UI_MODEL_CATEGORY_CHAT}, + {"menuNewChat", IDS_CHAT_UI_MENU_NEW_CHAT}, + {"openFullPageLabel", IDS_CHAT_UI_LABEL_OPEN_FULL_PAGE}, + {"closeLabel", IDS_CHAT_UI_LABEL_CLOSE}, + {"menuGoPremium", IDS_CHAT_UI_MENU_GO_PREMIUM}, + {"menuManageSubscription", IDS_CHAT_UI_MENU_MANAGE_SUBSCRIPTION}, + {"menuConversationHistory", IDS_CHAT_UI_MENU_CONVERSATION_HISTORY}, + {"menuSettings", IDS_CHAT_UI_MENU_SETTINGS}, + {"menuTitleModels", IDS_CHAT_UI_MENU_TITLE_MODELS}, + {"suggestQuestionsLabel", IDS_CHAT_UI_SUGGEST_QUESTIONS_LABEL}, + {"upgradeButtonLabel", IDS_CHAT_UI_UPGRADE_BUTTON_LABEL}, + {"rateLimitReachedTitle", IDS_CHAT_UI_RATE_LIMIT_REACHED_TITLE}, + {"rateLimitReachedDesc", IDS_CHAT_UI_RATE_LIMIT_REACHED_DESC}, + {"premiumFeature_1", IDS_CHAT_UI_PREMIUM_FEATURE_1}, + {"premiumFeature_2", IDS_CHAT_UI_PREMIUM_FEATURE_2}, + {"premiumFeature_3", IDS_CHAT_UI_PREMIUM_FEATURE_3}, + {"premiumFeature_4", IDS_CHAT_UI_PREMIUM_FEATURE_4}, + {"premiumFeature_1_desc", IDS_CHAT_UI_PREMIUM_FEATURE_1_DESC}, + {"premiumFeature_2_desc", IDS_CHAT_UI_PREMIUM_FEATURE_2_DESC}, + {"premiumFeature_3_desc", IDS_CHAT_UI_PREMIUM_FEATURE_3_DESC}, + {"premiumFeature_4_desc", IDS_CHAT_UI_PREMIUM_FEATURE_4_DESC}, + {"premiumLabel", IDS_CHAT_UI_PREMIUM_LABEL}, + {"premiumPricing", IDS_CHAT_UI_PREMIUM_PRICING}, + {"switchToBasicModelButtonLabel", + IDS_CHAT_UI_SWITCH_TO_BASIC_MODEL_BUTTON_LABEL}, + {"dismissButtonLabel", IDS_CHAT_UI_DISMISS_BUTTON_LABEL}, + {"unlockPremiumTitle", IDS_CHAT_UI_UNLOCK_PREMIUM_TITLE}, + {"premiumRefreshWarningDescription", + IDS_CHAT_UI_PREMIUM_REFRESH_WARNING_DESCRIPTION}, + {"premiumRefreshWarningAction", + IDS_CHAT_UI_PREMIUM_REFRESH_WARNING_ACTION}, + {"feedbackSent", IDS_CHAT_UI_FEEDBACK_SENT}, + {"answerDisliked", IDS_CHAT_UI_ANSWER_DISLIKED}, + {"answerLiked", IDS_CHAT_UI_ANSWER_LIKED}, + {"addFeedbackButtonLabel", IDS_CHAT_UI_ADD_FEEDBACK_BUTTON_LABEL}, + {"copyButtonLabel", IDS_CHAT_UI_COPY_BUTTON_LABEL}, + {"likeAnswerButtonLabel", IDS_CHAT_UI_LIKE_ANSWER_BUTTON_LABEL}, + {"dislikeAnswerButtonLabel", IDS_CHAT_UI_DISLIKE_ANSWER_BUTTON_LABEL}, + {"provideFeedbackTitle", IDS_CHAT_UI_PROVIDE_FEEDBACK_TITLE}, + {"selectFeedbackTopic", IDS_CHAT_UI_SELECT_FEEDBACK_TOPIC}, + {"feedbackCategoryLabel", IDS_CHAT_UI_FEEDBACK_CATEGORY_LABEL}, + {"feedbackDescriptionLabel", IDS_CHAT_UI_FEEDBACK_DESCRIPTION_LABEL}, + {"feedbackPremiumNote", IDS_CHAT_UI_FEEDBACK_PREMIUM_NOTE}, + {"submitButtonLabel", IDS_CHAT_UI_SUBMIT_BUTTON_LABEL}, + {"cancelButtonLabel", IDS_CHAT_UI_CANCEL_BUTTON_LABEL}, + {"saveButtonLabel", IDS_CHAT_UI_SAVE_BUTTON_LABEL}, + {"editedLabel", IDS_CHAT_UI_EDITED_LABEL}, + {"editButtonLabel", IDS_CHAT_UI_EDIT_BUTTON_LABEL}, + {"editAnswerLabel", IDS_CHAT_UI_EDIT_ANSWER_LABEL}, + {"optionNotHelpful", IDS_CHAT_UI_OPTION_NOT_HELPFUL}, + {"optionIncorrect", IDS_CHAT_UI_OPTION_INCORRECT}, + {"optionUnsafeHarmful", IDS_CHAT_UI_OPTION_UNSAFE_HARMFUL}, + {"optionOther", IDS_CHAT_UI_OPTION_OTHER}, + {"feedbackError", IDS_CHAT_UI_FEEDBACK_SUBMIT_ERROR}, + {"ratingError", IDS_CHAT_UI_RATING_ERROR}, + {"braveLeoModelSubtitle-chat-basic", IDS_CHAT_UI_CHAT_BASIC_SUBTITLE}, + {"braveLeoModelSubtitle-chat-leo-expanded", + IDS_CHAT_UI_CHAT_LEO_EXPANDED_SUBTITLE}, + {"braveLeoModelSubtitle-chat-claude-instant", + IDS_CHAT_UI_CHAT_CLAUDE_INSTANT_SUBTITLE}, + {"braveLeoModelSubtitle-chat-claude-haiku", + IDS_CHAT_UI_CHAT_CLAUDE_HAIKU_SUBTITLE}, + {"braveLeoModelSubtitle-chat-claude-sonnet", + IDS_CHAT_UI_CHAT_CLAUDE_SONNET_SUBTITLE}, + {"clearChatButtonLabel", IDS_CHAT_UI_CLEAR_CHAT_BUTTON_LABEL}, + {"newChatButtonLabel", IDS_CHAT_UI_NEW_CONVERSATION_BUTTON_LABEL}, + {"menuRenameConversation", IDS_CHAT_UI_MENU_RENAME_CONVERSATION}, + {"menuDeleteConversation", IDS_CHAT_UI_MENU_DELETE_CONVERSATION}, + {"sendChatButtonLabel", IDS_CHAT_UI_SEND_CHAT_BUTTON_LABEL}, + {"errorContextLimitReaching", IDS_CHAT_UI_ERROR_CONTEXT_LIMIT_REACHING}, + {"gotItButtonLabel", IDS_CHAT_UI_GOT_IT_BUTTON_LABEL}, + {"pageContentTooLongWarning", IDS_CHAT_UI_PAGE_CONTENT_TOO_LONG_WARNING}, + {"pageContentRefinedWarning", IDS_CHAT_UI_PAGE_CONTENT_REFINED_WARNING}, + {"pageContentRefinedInProgress", + IDS_CHAT_UI_PAGE_CONTENT_REFINED_IN_PROGRESS}, + {"errorConversationEnd", IDS_CHAT_UI_CONVERSATION_END_ERROR}, + {"searchInProgress", IDS_CHAT_UI_SEARCH_IN_PROGRESS}, + {"searchQueries", IDS_CHAT_UI_SEARCH_QUERIES}, + {"learnMore", IDS_CHAT_UI_LEARN_MORE}, + {"leoSettingsTooltipLabel", IDS_CHAT_UI_LEO_SETTINGS_TOOLTIP_LABEL}, + {"summarizePageButtonLabel", IDS_CHAT_UI_SUMMARIZE_PAGE}, + {"welcomeGuideTitle", IDS_CHAT_UI_WELCOME_GUIDE_TITLE}, + {"welcomeGuideSubtitle", IDS_CHAT_UI_WELCOME_GUIDE_SUBTITLE}, + {"welcomeGuideSiteHelpCardTitle", + IDS_CHAT_UI_WELCOME_GUIDE_SITE_HELP_CARD_TITLE}, + {"welcomeGuideSiteHelpCardDesc", + IDS_CHAT_UI_WELCOME_GUIDE_SITE_HELP_CARD_DESC}, + {"welcomeGuideSiteHelpCardDescWithAction", + IDS_CHAT_UI_WELCOME_GUIDE_SITE_HELP_CARD_WITH_ACTION}, + {"welcomeGuideShatCardTitle", IDS_CHAT_UI_WELCOME_GUIDE_CHAT_CARD_TITLE}, + {"welcomeGuideShatCardDesc", IDS_CHAT_UI_WELCOME_GUIDE_CHAT_CARD_DESC}, + {"privacyTitle", IDS_CHAT_UI_PRIVACY_TITLE}, + {"contextToggleLabel", IDS_CHAT_UI_CONTEXT_TOGGLE_LABEL}, + {"contextToggleTooltipInfo", IDS_CHAT_UI_CONTEXT_TOGGLE_TOOLTIP_INFO}, + {"subscriptionPolicyInfo", IDS_CHAT_UI_SUBSCRIPTION_POLICY_INFO}, + {"explainLabel", IDS_AI_CHAT_CONTEXT_EXPLAIN}, + {"summarizeLabel", IDS_AI_CHAT_CONTEXT_SUMMARIZE_TEXT}, + {"paraphraseLabel", IDS_AI_CHAT_CONTEXT_PARAPHRASE}, + {"createCategoryTitle", IDS_AI_CHAT_CONTEXT_CREATE}, + {"taglineLabel", IDS_AI_CHAT_CONTEXT_CREATE_TAGLINE}, + {"socialMediaPostLabel", IDS_AI_CHAT_CONTEXT_CREATE_SOCIAL_MEDIA_POST}, + {"socialMediaShortLabel", + IDS_AI_CHAT_CONTEXT_CREATE_SOCIAL_MEDIA_COMMENT_SHORT}, + {"socialMediaLongLabel", + IDS_AI_CHAT_CONTEXT_CREATE_SOCIAL_MEDIA_COMMENT_LONG}, + {"rewriteCategoryTitle", IDS_AI_CHAT_CONTEXT_REWRITE}, + {"improveLabel", IDS_AI_CHAT_CONTEXT_IMPROVE}, + {"changeToneLabel", IDS_AI_CHAT_CONTEXT_CHANGE_TONE}, + {"changeLengthLabel", IDS_AI_CHAT_CONTEXT_CHANGE_LENGTH}, + {"academicizeLabel", IDS_AI_CHAT_CONTEXT_ACADEMICIZE}, + {"professionalizeLabel", IDS_AI_CHAT_CONTEXT_PROFESSIONALIZE}, + {"persuasiveToneLabel", IDS_AI_CHAT_CONTEXT_PERSUASIVE_TONE}, + {"casualizeLabel", IDS_AI_CHAT_CONTEXT_CASUALIZE}, + {"funnyToneLabel", IDS_AI_CHAT_CONTEXT_FUNNY_TONE}, + {"shortenLabel", IDS_AI_CHAT_CONTEXT_SHORTEN}, + {"expandLabel", IDS_AI_CHAT_CONTEXT_EXPAND}, + {"sendSiteHostnameLabel", IDS_CHAT_UI_SEND_SITE_HOSTNAME_LABEL}, + {"maybeLaterLabel", IDS_AI_CHAT_MAYBE_LATER_LABEL}, + {"toolsMenuButtonLabel", IDS_AI_CHAT_LEO_TOOLS_BUTTON_LABEL}, + {"useMicButtonLabel", IDS_AI_CHAT_USE_MICROPHONE_BUTTON_LABEL}, + {"menuTitleCustomModels", IDS_AI_CHAT_MENU_TITLE_CUSTOM_MODELS}, + {"startConversationLabel", IDS_AI_CHAT_START_CONVERSATION_LABEL}, + {"conversationListUntitled", IDS_AI_CHAT_CONVERSATION_LIST_UNTITLED}}); return kLocalizedStrings; } @@ -304,14 +306,4 @@ std::vector GetActionMenuList() { return action_list; } - -const base::fixed_flat_set kPrintPreviewRetrievalHosts = - base::MakeFixedFlatSet(base::sorted_unique, - { - "docs.google.com", - }); - -constexpr char kLeoModelSupportUrl[] = - "https://support.brave.com/hc/en-us/categories/" - "20990938292237-Brave-Leo"; } // namespace ai_chat diff --git a/components/ai_chat/core/browser/constants.h b/components/ai_chat/core/browser/constants.h index 25ce8bca9952..4296b65d611d 100644 --- a/components/ai_chat/core/browser/constants.h +++ b/components/ai_chat/core/browser/constants.h @@ -19,11 +19,15 @@ namespace ai_chat { base::span GetLocalizedStrings(); std::vector GetActionMenuList(); -extern const base::fixed_flat_set - kPrintPreviewRetrievalHosts; - -constexpr uint8_t kMaxPreviewPages = 20; -extern const char kLeoModelSupportUrl[]; +inline constexpr auto kPrintPreviewRetrievalHosts = + base::MakeFixedFlatSet({ + "docs.google.com", + }); + +inline constexpr uint8_t kMaxPreviewPages = 20; +inline constexpr char kLeoModelSupportUrl[] = + "https://support.brave.com/hc/en-us/categories/" + "20990938292237-Brave-Leo"; // Upon registering a custom model, users have the ability to explicitly // provide a context size (in tokens). When present, we'll use this value to diff --git a/components/ai_chat/core/browser/engine/conversation_api_client.cc b/components/ai_chat/core/browser/engine/conversation_api_client.cc index 28cb1d5dff95..babb0bb00698 100644 --- a/components/ai_chat/core/browser/engine/conversation_api_client.cc +++ b/components/ai_chat/core/browser/engine/conversation_api_client.cc @@ -151,19 +151,13 @@ base::Value::List ConversationEventsToList( // Set role auto role_it = kRoleMap->find(event.role); - if (role_it != kRoleMap->end()) { - event_dict.Set("role", role_it->second); - } else { - NOTREACHED_NORETURN(); - } + CHECK(role_it != kRoleMap->end()); + event_dict.Set("role", role_it->second); // Set type auto type_it = kTypeMap->find(event.type); - if (type_it != kTypeMap->end()) { - event_dict.Set("type", type_it->second); - } else { - NOTREACHED_NORETURN(); - } + CHECK(type_it != kTypeMap->end()); + event_dict.Set("type", type_it->second); event_dict.Set("content", event.content); events.Append(std::move(event_dict)); diff --git a/components/ai_chat/core/browser/local_models_updater.cc b/components/ai_chat/core/browser/local_models_updater.cc index 7c1cd229d0ad..32695fb3cb3f 100644 --- a/components/ai_chat/core/browser/local_models_updater.cc +++ b/components/ai_chat/core/browser/local_models_updater.cc @@ -25,8 +25,8 @@ constexpr base::FilePath::CharType kComponentInstallDir[] = FILE_PATH_LITERAL("AIChatLocalModels"); constexpr base::FilePath::CharType kDeprecatedComponentInstallDir[] = FILE_PATH_LITERAL("LeoLocalModels"); -constexpr const char kComponentName[] = "Leo Local Models Updater"; -constexpr const char kComponentId[] = "ejhejjmaoaohpghnblcdcjilndkangfe"; +constexpr char kComponentName[] = "Leo Local Models Updater"; +constexpr char kComponentId[] = "ejhejjmaoaohpghnblcdcjilndkangfe"; constexpr uint8_t kPublicKeySHA256[32] = { 0x49, 0x74, 0x99, 0xc0, 0xe0, 0xe7, 0xf6, 0x7d, 0x1b, 0x23, 0x29, 0x8b, 0xd3, 0xa0, 0xd6, 0x54, 0xb6, 0xc3, 0x23, 0x87, 0x75, 0xec, @@ -50,9 +50,6 @@ base::FilePath GetDeprecatedComponentDir() { } // namespace -constexpr const char kUniversalQAModelName[] = - "universal_sentence_encoder_qa_with_metadata.tflite"; - LocalModelsComponentInstallerPolicy:: LocalModelsComponentInstallerPolicy() = default; LocalModelsComponentInstallerPolicy:: diff --git a/components/ai_chat/core/browser/local_models_updater.h b/components/ai_chat/core/browser/local_models_updater.h index 6be66ca2ec73..90a1298bb957 100644 --- a/components/ai_chat/core/browser/local_models_updater.h +++ b/components/ai_chat/core/browser/local_models_updater.h @@ -18,7 +18,8 @@ class ComponentUpdateService; namespace ai_chat { -extern const char kUniversalQAModelName[]; +inline constexpr char kUniversalQAModelName[] = + "universal_sentence_encoder_qa_with_metadata.tflite"; class LocalModelsComponentInstallerPolicy : public ::component_updater::ComponentInstallerPolicy { diff --git a/components/ai_chat/core/browser/local_models_updater_unittest.cc b/components/ai_chat/core/browser/local_models_updater_unittest.cc index 9a3e9daa895f..182035e95c6d 100644 --- a/components/ai_chat/core/browser/local_models_updater_unittest.cc +++ b/components/ai_chat/core/browser/local_models_updater_unittest.cc @@ -28,7 +28,7 @@ constexpr base::FilePath::CharType kComponentInstallDir[] = FILE_PATH_LITERAL("AIChatLocalModels"); constexpr base::FilePath::CharType kDeprecatedComponentInstallDir[] = FILE_PATH_LITERAL("LeoLocalModels"); -constexpr const char kComponentId[] = "ejhejjmaoaohpghnblcdcjilndkangfe"; +constexpr char kComponentId[] = "ejhejjmaoaohpghnblcdcjilndkangfe"; } // namespace class LocalModelsUpdaterUnitTest : public testing::Test { diff --git a/components/ai_chat/core/browser/model_service.cc b/components/ai_chat/core/browser/model_service.cc index 460166ec85ed..26ebdfbeb2ab 100644 --- a/components/ai_chat/core/browser/model_service.cc +++ b/components/ai_chat/core/browser/model_service.cc @@ -32,16 +32,16 @@ namespace ai_chat { -inline constexpr char kDefaultModelKey[] = "brave.ai_chat.default_model_key"; -inline constexpr char kCustomModelsList[] = "brave.ai_chat.custom_models"; namespace { -inline constexpr char kCustomModelItemLabelKey[] = "label"; -inline constexpr char kCustomModelItemModelKey[] = "model_request_name"; -inline constexpr char kCustomModelContextSizeKey[] = "context_size"; -inline constexpr char kCustomModelSystemPromptKey[] = "model_system_prompt"; -inline constexpr char kCustomModelItemEndpointUrlKey[] = "endpoint_url"; -inline constexpr char kCustomModelItemApiKey[] = "api_key"; -inline constexpr char kCustomModelItemKey[] = "key"; +constexpr char kDefaultModelKey[] = "brave.ai_chat.default_model_key"; +constexpr char kCustomModelsList[] = "brave.ai_chat.custom_models"; +constexpr char kCustomModelItemLabelKey[] = "label"; +constexpr char kCustomModelItemModelKey[] = "model_request_name"; +constexpr char kCustomModelContextSizeKey[] = "context_size"; +constexpr char kCustomModelSystemPromptKey[] = "model_system_prompt"; +constexpr char kCustomModelItemEndpointUrlKey[] = "endpoint_url"; +constexpr char kCustomModelItemApiKey[] = "api_key"; +constexpr char kCustomModelItemKey[] = "key"; // When adding new models, especially for display, make sure to add the UI // strings to ai_chat_ui_strings.grdp and ai_chat/core/constants.cc. diff --git a/components/ai_chat/core/browser/model_service_unittest.cc b/components/ai_chat/core/browser/model_service_unittest.cc index 05be61af7279..09ced41f80d0 100644 --- a/components/ai_chat/core/browser/model_service_unittest.cc +++ b/components/ai_chat/core/browser/model_service_unittest.cc @@ -188,11 +188,11 @@ TEST_F(ModelServiceTest, ChangeOldDefaultKey) { } TEST_F(ModelServiceTest, AddAndModifyCustomModel) { - static const char kRequestName[] = "request_name"; - static const char kModelSystemPrompt[] = "model_system_prompt"; + static constexpr char kRequestName[] = "request_name"; + static constexpr char kModelSystemPrompt[] = "model_system_prompt"; static const GURL kEndpoint = GURL("http://brave.com"); - static const char kAPIKey[] = "foo_api_key"; - static const char kDisplayName[] = "Custom display name"; + static constexpr char kAPIKey[] = "foo_api_key"; + static constexpr char kDisplayName[] = "Custom display name"; { mojom::ModelPtr model = mojom::Model::New(); diff --git a/components/ai_chat/renderer/ai_chat_resource_sniffer.cc b/components/ai_chat/renderer/ai_chat_resource_sniffer.cc index 829c967ea9ad..fa675df04340 100644 --- a/components/ai_chat/renderer/ai_chat_resource_sniffer.cc +++ b/components/ai_chat/renderer/ai_chat_resource_sniffer.cc @@ -15,7 +15,7 @@ namespace ai_chat { namespace { -constexpr const char kYouTubePlayerAPIPath[] = "/youtubei/v1/player"; +constexpr char kYouTubePlayerAPIPath[] = "/youtubei/v1/player"; } AIChatResourceSniffer::AIChatResourceSniffer( diff --git a/components/api_request_helper/api_request_helper.cc b/components/api_request_helper/api_request_helper.cc index 54e8fdb955ae..a7c15f62608b 100644 --- a/components/api_request_helper/api_request_helper.cc +++ b/components/api_request_helper/api_request_helper.cc @@ -19,7 +19,6 @@ #include "base/memory/raw_ptr.h" #include "base/metrics/histogram_functions.h" #include "base/ranges/algorithm.h" -#include "base/rust_buildflags.h" #include "base/strings/string_split.h" #include "base/task/thread_pool.h" #include "base/time/time.h" @@ -32,27 +31,24 @@ #include "services/network/public/cpp/shared_url_loader_factory.h" #include "services/network/public/mojom/url_response_head.mojom.h" -static_assert(BUILDFLAG(BUILD_RUST_JSON_READER), - "To use Rust sanitizer BUILD_RUST_JSON_READER should be enabled"); - namespace api_request_helper { namespace { const unsigned int kRetriesCountOnNetworkChange = 1; -BASE_FEATURE(kUseBraveRustJSONSanitizer, - "UseBraveRustJSONSanitizer", - base::FEATURE_ENABLED_BY_DEFAULT); - -void ParseJsonUsingRust( +void ParseJsonInWorkerTaskRunner( std::string json, - data_decoder::DataDecoder::ValueParseCallback callback, - const scoped_refptr& task_runner) { + base::SequencedTaskRunner* task_runner, + data_decoder::DataDecoder::ValueParseCallback callback) { task_runner->PostTaskAndReplyWithResult( FROM_HERE, - base::BindOnce(&base::DecodeJSONInRust, std::move(json), - base::JSON_PARSE_RFC), + base::BindOnce( + [](std::string json) { + return base::JSONReader::ReadAndReturnValueWithError( + json, base::JSON_PARSE_RFC); + }, + std::move(json)), base::BindOnce( [](data_decoder::DataDecoder::ValueParseCallback callback, base::JSONReader::Result result) { @@ -390,8 +386,9 @@ void APIRequestHelper::URLLoaderHandler::send_sse_data_for_testing( void APIRequestHelper::URLLoaderHandler::ParseJsonImpl( std::string json, base::OnceCallback callback) { - if (base::FeatureList::IsEnabled(kUseBraveRustJSONSanitizer)) { - ParseJsonUsingRust(std::move(json), std::move(callback), task_runner_); + if (base::JSONReader::UsingRust()) { + ParseJsonInWorkerTaskRunner(std::move(json), task_runner_.get(), + std::move(callback)); return; } @@ -591,11 +588,12 @@ void APIRequestHelper::SetUrlLoaderFactoryForTesting( url_loader_factory_ = std::move(url_loader_factory); } -void SanitizeAndParseJson(std::string json, +void ParseJsonNonBlocking(std::string json, base::OnceCallback callback) { - if (base::FeatureList::IsEnabled(kUseBraveRustJSONSanitizer)) { - ParseJsonUsingRust(std::move(json), std::move(callback), - MakeDecoderTaskRunner()); + if (base::JSONReader::UsingRust()) { + auto task_runner = MakeDecoderTaskRunner(); + ParseJsonInWorkerTaskRunner(std::move(json), task_runner.get(), + std::move(callback)); return; } diff --git a/components/api_request_helper/api_request_helper.h b/components/api_request_helper/api_request_helper.h index 7ad3eabe5c81..46f25a543945 100644 --- a/components/api_request_helper/api_request_helper.h +++ b/components/api_request_helper/api_request_helper.h @@ -274,7 +274,7 @@ class APIRequestHelper { base::WeakPtrFactory weak_ptr_factory_{this}; }; -void SanitizeAndParseJson(std::string json, +void ParseJsonNonBlocking(std::string json, base::OnceCallback callback); } // namespace api_request_helper diff --git a/components/autofill_payments_strings.grdp b/components/autofill_payments_strings.grdp index 426e98d5104d..6be01f70a419 100644 --- a/components/autofill_payments_strings.grdp +++ b/components/autofill_payments_strings.grdp @@ -248,6 +248,9 @@ Saving card info + + Saving IBAN info + @@ -765,37 +768,37 @@ Add virtual card - + Virtual card details - - Virtual card not filled in? Click virtual card details to copy to clipboard. $1Learn about virtual cards + + Virtual card not filled in? Click virtual card details to copy to clipboard. $1Learn about virtual cards - + Learn about virtual cards - + Virtual card number: - + Expiration date: - + Name on card: - + CVC: - + Virtual card - + View your virtual card number - + Click to copy - + Copied @@ -886,16 +889,16 @@ CVC for virtual card - + Virtual card number: - + Expiration date: - + Name on card: - + CVC: @@ -1110,6 +1113,18 @@ Add card + + Scan card + + + Check out faster with autofill + + + Save a payment method in your Brave sync chain to autofill it for purchases made in Brave + + + Add payment method + diff --git a/components/autofill_prediction_improvements_strings.grdp b/components/autofill_prediction_improvements_strings.grdp index 60ab161dc693..be2451867722 100644 --- a/components/autofill_prediction_improvements_strings.grdp +++ b/components/autofill_prediction_improvements_strings.grdp @@ -34,7 +34,7 @@ Save - Info you have saved and this page get sent to Brave to see if autofill can help fill this form. Data may be seen by human reviewers to improve this feature. + Saved info and the page from $1airline.com are sent to Brave and may be seen by human reviewers to improve this feature. @@ -55,10 +55,13 @@ Manage your info - + Loading suggestions + + Suggestions loaded + @@ -84,9 +87,6 @@ Send feedback for Autofill with AI. - - Suggestions loaded - @@ -98,4 +98,10 @@ Go to settings + + This feature uses information you've already saved with autofill, such as your address + + + This feature uses information you've already saved with autofill, such as your address. You can review and manage this data on this page. + diff --git a/components/autofill_strings.grdp b/components/autofill_strings.grdp index 68350df54a3e..9d833dd8d189 100644 --- a/components/autofill_strings.grdp +++ b/components/autofill_strings.grdp @@ -18,8 +18,8 @@ - - Automatic credit card filling is disabled because this form does not use a secure connection. + + Automatic payment methods filling is disabled because this form does not use a secure connection. This form is not secure. Autofill has been turned off. @@ -116,7 +116,7 @@ You are currently on a menu - + Dialog with credit card details was shown @@ -269,12 +269,6 @@ Loading... - - Select - - - No saved addresses - diff --git a/components/body_sniffer/body_sniffer_url_loader.cc b/components/body_sniffer/body_sniffer_url_loader.cc index b34e4647c2cc..4889cee8c76e 100644 --- a/components/body_sniffer/body_sniffer_url_loader.cc +++ b/components/body_sniffer/body_sniffer_url_loader.cc @@ -20,7 +20,7 @@ namespace body_sniffer { -constexpr const uint32_t kReadBufferSize = 64 * 1024; +constexpr uint32_t kReadBufferSize = 64 * 1024; // static std::tuple, diff --git a/components/brave_ads/browser/ads_service_impl.cc b/components/brave_ads/browser/ads_service_impl.cc index 56bd62ddc4f3..f6bf906e3226 100644 --- a/components/brave_ads/browser/ads_service_impl.cc +++ b/components/brave_ads/browser/ads_service_impl.cc @@ -89,7 +89,7 @@ int ResourceBundleId(const std::string& name) { return IDR_ADS_CATALOG_SCHEMA; } - NOTREACHED_NORETURN(); + NOTREACHED(); } std::string URLMethodToRequestType( diff --git a/components/brave_ads/browser/reminder/reminder_util.cc b/components/brave_ads/browser/reminder/reminder_util.cc index 1e659917f048..5b08dd8fd050 100644 --- a/components/brave_ads/browser/reminder/reminder_util.cc +++ b/components/brave_ads/browser/reminder/reminder_util.cc @@ -62,8 +62,8 @@ base::Value::Dict BuildReminder(const mojom::ReminderType mojom_reminder_type) { } } - NOTREACHED_NORETURN() << "Unexpected value for mojom::ReminderType: " - << mojom_reminder_type; + NOTREACHED() << "Unexpected value for mojom::ReminderType: " + << mojom_reminder_type; } bool IsReminder(const std::string& placement_id) { diff --git a/components/brave_ads/core/internal/BUILD.gn b/components/brave_ads/core/internal/BUILD.gn index 834b766d4e15..3d35af0892f7 100644 --- a/components/brave_ads/core/internal/BUILD.gn +++ b/components/brave_ads/core/internal/BUILD.gn @@ -299,7 +299,6 @@ static_library("internal") { "ads_client/ads_client_pref_provider.h", "ads_client/ads_client_util.cc", "ads_client/ads_client_util.h", - "ads_constants.cc", "ads_core/ads_core.cc", "ads_core/ads_core.h", "ads_core/ads_core_util.cc", diff --git a/components/brave_ads/core/internal/account/account_util.cc b/components/brave_ads/core/internal/account/account_util.cc index 3f52cde35687..f34c9b383177 100644 --- a/components/brave_ads/core/internal/account/account_util.cc +++ b/components/brave_ads/core/internal/account/account_util.cc @@ -53,8 +53,8 @@ bool IsAllowedToDeposit(const mojom::AdType mojom_ad_type, } } - NOTREACHED_NORETURN() << "Unexpected value for mojom::AdType: " - << base::to_underlying(mojom_ad_type); + NOTREACHED() << "Unexpected value for mojom::AdType: " + << base::to_underlying(mojom_ad_type); } } // namespace brave_ads diff --git a/components/brave_ads/core/internal/account/confirmations/confirmation_type.cc b/components/brave_ads/core/internal/account/confirmations/confirmation_type.cc index 0e82db1f05e7..395e7da56431 100644 --- a/components/brave_ads/core/internal/account/confirmations/confirmation_type.cc +++ b/components/brave_ads/core/internal/account/confirmations/confirmation_type.cc @@ -76,8 +76,7 @@ mojom::ConfirmationType ToMojomConfirmationType(const std::string_view value) { return mojom_confirmation_type; } - NOTREACHED_NORETURN() << "Unexpected value for mojom::ConfirmationType: " - << value; + NOTREACHED() << "Unexpected value for mojom::ConfirmationType: " << value; } const char* ToString(const mojom::ConfirmationType mojom_confirmation_type) { @@ -88,8 +87,8 @@ const char* ToString(const mojom::ConfirmationType mojom_confirmation_type) { return confirmation_type.data(); } - NOTREACHED_NORETURN() << "Unexpected value for mojom::ConfirmationType: " - << base::to_underlying(mojom_confirmation_type); + NOTREACHED() << "Unexpected value for mojom::ConfirmationType: " + << base::to_underlying(mojom_confirmation_type); } } // namespace brave_ads diff --git a/components/brave_ads/core/internal/account/deposits/deposits_factory.cc b/components/brave_ads/core/internal/account/deposits/deposits_factory.cc index 7949818953bf..8ac244d0b256 100644 --- a/components/brave_ads/core/internal/account/deposits/deposits_factory.cc +++ b/components/brave_ads/core/internal/account/deposits/deposits_factory.cc @@ -48,8 +48,8 @@ std::unique_ptr DepositsFactory::Build( } } - NOTREACHED_NORETURN() << "Unexpected value for mojom::ConfirmationType: " - << base::to_underlying(mojom_confirmation_type); + NOTREACHED() << "Unexpected value for mojom::ConfirmationType: " + << base::to_underlying(mojom_confirmation_type); } } // namespace brave_ads diff --git a/components/brave_ads/core/internal/account/issuers/token_issuers/token_issuer_value_util.cc b/components/brave_ads/core/internal/account/issuers/token_issuers/token_issuer_value_util.cc index 8e4eb02191ec..7ba1ae726556 100644 --- a/components/brave_ads/core/internal/account/issuers/token_issuers/token_issuer_value_util.cc +++ b/components/brave_ads/core/internal/account/issuers/token_issuers/token_issuer_value_util.cc @@ -43,8 +43,8 @@ std::optional ToString(const TokenIssuerType token_issuer_type) { } } - NOTREACHED_NORETURN() << "Unexpected value for TokenIssuerType: " - << base::to_underlying(token_issuer_type); + NOTREACHED() << "Unexpected value for TokenIssuerType: " + << base::to_underlying(token_issuer_type); } std::optional ParseTokenIssuerType( diff --git a/components/brave_ads/core/internal/ad_units/ad_type.cc b/components/brave_ads/core/internal/ad_units/ad_type.cc index 652c6b73f7ff..4aa27c5a44fe 100644 --- a/components/brave_ads/core/internal/ad_units/ad_type.cc +++ b/components/brave_ads/core/internal/ad_units/ad_type.cc @@ -50,7 +50,7 @@ mojom::AdType ToMojomAdType(std::string_view value) { return mojom_ad_type; } - NOTREACHED_NORETURN() << "Unexpected value for mojom::AdType: " << value; + NOTREACHED() << "Unexpected value for mojom::AdType: " << value; } const char* ToString(mojom::AdType mojom_ad_type) { @@ -60,8 +60,8 @@ const char* ToString(mojom::AdType mojom_ad_type) { return ad_type.data(); } - NOTREACHED_NORETURN() << "Unexpected value for mojom::AdType: " - << base::to_underlying(mojom_ad_type); + NOTREACHED() << "Unexpected value for mojom::AdType: " + << base::to_underlying(mojom_ad_type); } } // namespace brave_ads diff --git a/components/brave_ads/core/internal/ads_constants.cc b/components/brave_ads/core/internal/ads_constants.cc deleted file mode 100644 index 214ccd1777f3..000000000000 --- a/components/brave_ads/core/internal/ads_constants.cc +++ /dev/null @@ -1,18 +0,0 @@ -/* Copyright (c) 2022 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at https://mozilla.org/MPL/2.0/. */ - -#include "brave/components/brave_ads/core/public/ads_constants.h" - -namespace brave_ads { - -constexpr char kDatabaseFilename[] = "database.sqlite"; - -constexpr char kClientJsonFilename[] = "client.json"; - -constexpr char kConfirmationsJsonFilename[] = "confirmations.json"; - -constexpr char kCatalogJsonSchemaDataResourceName[] = "catalog-schema.json"; - -} // namespace brave_ads diff --git a/components/brave_ads/core/internal/common/test/internal/tag_parser_test_util_internal.cc b/components/brave_ads/core/internal/common/test/internal/tag_parser_test_util_internal.cc index edf7a8411345..e9876b3fffaf 100644 --- a/components/brave_ads/core/internal/common/test/internal/tag_parser_test_util_internal.cc +++ b/components/brave_ads/core/internal/common/test/internal/tag_parser_test_util_internal.cc @@ -114,7 +114,7 @@ void ReplaceTagsForText(const std::vector& tags, CHECK(time_tag_value) << "Invalid time tag value: " << value; value = *time_tag_value; } else { - NOTREACHED_NORETURN() << "Unsupported tag: " << tag; + NOTREACHED() << "Unsupported tag: " << tag; } const std::string enclosed_tag = diff --git a/components/brave_ads/core/internal/common/test/internal/url_response_test_util_internal.cc b/components/brave_ads/core/internal/common/test/internal/url_response_test_util_internal.cc index c2fb6af77109..98acea606450 100644 --- a/components/brave_ads/core/internal/common/test/internal/url_response_test_util_internal.cc +++ b/components/brave_ads/core/internal/common/test/internal/url_response_test_util_internal.cc @@ -123,7 +123,7 @@ std::optional GetNextUrlResponseForRequest( const base::FilePath path = UrlResponsesDataPath().AppendASCII( ParseFilenameFromResponseBody(response_body)); if (!base::ReadFileToString(path, &response_body)) { - NOTREACHED_NORETURN() << path << " not found"; + NOTREACHED() << path << " not found"; } ParseAndReplaceTags(response_body); diff --git a/components/brave_ads/core/internal/common/test/mock_test_util.cc b/components/brave_ads/core/internal/common/test/mock_test_util.cc index 32900dff409a..3cbad639d6fd 100644 --- a/components/brave_ads/core/internal/common/test/mock_test_util.cc +++ b/components/brave_ads/core/internal/common/test/mock_test_util.cc @@ -113,8 +113,8 @@ void MockBuildChannel(const BuildChannelType type) { } } - NOTREACHED_NORETURN() << "Unexpected value for BuildChannelType: " - << base::to_underlying(type); + NOTREACHED() << "Unexpected value for BuildChannelType: " + << base::to_underlying(type); } void MockIsNetworkConnectionAvailable(const AdsClientMock& ads_client_mock, diff --git a/components/brave_ads/core/internal/common/url/request_builder/host/url_host_factory.cc b/components/brave_ads/core/internal/common/url/request_builder/host/url_host_factory.cc index acd6ecaac8c0..d0355ce7450b 100644 --- a/components/brave_ads/core/internal/common/url/request_builder/host/url_host_factory.cc +++ b/components/brave_ads/core/internal/common/url/request_builder/host/url_host_factory.cc @@ -41,8 +41,8 @@ std::unique_ptr UrlHostFactory::Build( } } - NOTREACHED_NORETURN() << "Unexpected value for UrlHostType: " - << base::to_underlying(type); + NOTREACHED() << "Unexpected value for UrlHostType: " + << base::to_underlying(type); } } // namespace brave_ads diff --git a/components/brave_ads/core/internal/common/url/url_request_string_util.cc b/components/brave_ads/core/internal/common/url/url_request_string_util.cc index 0272b5cb01f5..f48ce1aee49b 100644 --- a/components/brave_ads/core/internal/common/url/url_request_string_util.cc +++ b/components/brave_ads/core/internal/common/url/url_request_string_util.cc @@ -20,10 +20,10 @@ namespace brave_ads { namespace { -bool ShouldAllowHeader(const std::string& header) { - static const auto kAllowedHeaders = base::MakeFixedFlatSet( - {"accept", "content-type", "digest", "signature"}); +constexpr auto kAllowedHeaders = base::MakeFixedFlatSet( + {"accept", "content-type", "digest", "signature"}); +bool ShouldAllowHeader(const std::string& header) { return base::ranges::any_of(kAllowedHeaders, [&header](const std::string_view allowed_header) { return header.starts_with(allowed_header); diff --git a/components/brave_ads/core/internal/flags/environment/environment_command_line_switch_parser_util.cc b/components/brave_ads/core/internal/flags/environment/environment_command_line_switch_parser_util.cc index 846ee9da2bca..6a685dae1ea0 100644 --- a/components/brave_ads/core/internal/flags/environment/environment_command_line_switch_parser_util.cc +++ b/components/brave_ads/core/internal/flags/environment/environment_command_line_switch_parser_util.cc @@ -30,8 +30,8 @@ std::optional ParseEnvironmentCommandLineSwitch() { } } - NOTREACHED_NORETURN() << "Unexpected value for Environment: " - << base::to_underlying(*rewards_flags.environment); + NOTREACHED() << "Unexpected value for Environment: " + << base::to_underlying(*rewards_flags.environment); } } // namespace brave_ads diff --git a/components/brave_ads/core/internal/ml/pipeline/linear_pipeline_util.cc b/components/brave_ads/core/internal/ml/pipeline/linear_pipeline_util.cc index 26b3ec8f043c..cb20a426d210 100644 --- a/components/brave_ads/core/internal/ml/pipeline/linear_pipeline_util.cc +++ b/components/brave_ads/core/internal/ml/pipeline/linear_pipeline_util.cc @@ -79,7 +79,7 @@ std::optional LoadTransformations( } case linear_text_classification::flat::TransformationType:: TransformationType_NONE: { - NOTREACHED_NORETURN(); + NOTREACHED(); } } if (!transformation_ptr) { diff --git a/components/brave_ads/core/internal/ml/pipeline/neural_pipeline_util.cc b/components/brave_ads/core/internal/ml/pipeline/neural_pipeline_util.cc index 0a9e95917849..52547c393c2f 100644 --- a/components/brave_ads/core/internal/ml/pipeline/neural_pipeline_util.cc +++ b/components/brave_ads/core/internal/ml/pipeline/neural_pipeline_util.cc @@ -71,7 +71,7 @@ std::optional LoadTransformations( } case neural_text_classification::flat::TransformationType:: TransformationType_NONE: { - NOTREACHED_NORETURN(); + NOTREACHED(); } } if (!transformation_ptr) { diff --git a/components/brave_ads/core/internal/serving/prediction/model_based/sampling/creative_ad_model_based_predictor_sampling.h b/components/brave_ads/core/internal/serving/prediction/model_based/sampling/creative_ad_model_based_predictor_sampling.h index c3b7f2fa5039..1dd6f12a506b 100644 --- a/components/brave_ads/core/internal/serving/prediction/model_based/sampling/creative_ad_model_based_predictor_sampling.h +++ b/components/brave_ads/core/internal/serving/prediction/model_based/sampling/creative_ad_model_based_predictor_sampling.h @@ -57,7 +57,7 @@ std::optional MaybeSampleCreativeAd( } } - NOTREACHED_NORETURN() << "Sum should always be less than probability"; + NOTREACHED() << "Sum should always be less than probability"; } } // namespace brave_ads diff --git a/components/brave_ads/core/internal/serving/targeting/condition_matcher/prefs/internal/condition_matcher_pref_util_internal.cc b/components/brave_ads/core/internal/serving/targeting/condition_matcher/prefs/internal/condition_matcher_pref_util_internal.cc index 88da962f65b6..1e0dd88d0925 100644 --- a/components/brave_ads/core/internal/serving/targeting/condition_matcher/prefs/internal/condition_matcher_pref_util_internal.cc +++ b/components/brave_ads/core/internal/serving/targeting/condition_matcher/prefs/internal/condition_matcher_pref_util_internal.cc @@ -45,8 +45,8 @@ std::optional ToString(const base::Value& value) { } } - NOTREACHED_NORETURN() << "Unexpected value for base::Value::Type: " - << base::to_underlying(value.type()); + NOTREACHED() << "Unexpected value for base::Value::Type: " + << base::to_underlying(value.type()); } std::optional MaybeGetRootPrefValue( diff --git a/components/brave_ads/core/internal/serving/targeting/condition_matcher/prefs/internal/condition_matcher_pref_util_internal_unittest.cc b/components/brave_ads/core/internal/serving/targeting/condition_matcher/prefs/internal/condition_matcher_pref_util_internal_unittest.cc index 4ffa682bd260..277b108d8646 100644 --- a/components/brave_ads/core/internal/serving/targeting/condition_matcher/prefs/internal/condition_matcher_pref_util_internal_unittest.cc +++ b/components/brave_ads/core/internal/serving/targeting/condition_matcher/prefs/internal/condition_matcher_pref_util_internal_unittest.cc @@ -62,12 +62,10 @@ TEST_F(BraveAdsConditionMatcherPrefUtilTest, TEST_F(BraveAdsConditionMatcherPrefUtilTest, DoNotConvertBinaryValueTypeToString) { // Arrange - const base::span binary({0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x2C, - 0x20, 0x57, 0x6F, 0x72, 0x6C, 0x64, - 0x21}); - // Act & Assert - EXPECT_FALSE(ToString(base::Value(binary))); + EXPECT_FALSE(ToString(base::Value( + base::span({0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x2C, 0x20, 0x57, + 0x6F, 0x72, 0x6C, 0x64, 0x21})))); } TEST_F(BraveAdsConditionMatcherPrefUtilTest, GetVirtualPrefValue) { diff --git a/components/brave_ads/core/internal/user_engagement/conversions/actions/conversion_action_types_util.cc b/components/brave_ads/core/internal/user_engagement/conversions/actions/conversion_action_types_util.cc index 34eb5de1f19d..cb1f7230d3fb 100644 --- a/components/brave_ads/core/internal/user_engagement/conversions/actions/conversion_action_types_util.cc +++ b/components/brave_ads/core/internal/user_engagement/conversions/actions/conversion_action_types_util.cc @@ -28,8 +28,8 @@ ConversionActionType ToConversionActionType( } } - NOTREACHED_NORETURN() << "Unexpected value for mojom::ConfirmationType: " - << base::to_underlying(mojom_confirmation_type); + NOTREACHED() << "Unexpected value for mojom::ConfirmationType: " + << base::to_underlying(mojom_confirmation_type); } ConversionActionType ToConversionActionType( @@ -42,7 +42,7 @@ ConversionActionType ToConversionActionType( return ConversionActionType::kClickThrough; } - NOTREACHED_NORETURN() << "Unexpected value for action_type: " << action_type; + NOTREACHED() << "Unexpected value for action_type: " << action_type; } std::string ToString(const ConversionActionType action_type) { @@ -60,8 +60,8 @@ std::string ToString(const ConversionActionType action_type) { } } - NOTREACHED_NORETURN() << "Unexpected value for ConversionActionType: " - << base::to_underlying(action_type); + NOTREACHED() << "Unexpected value for ConversionActionType: " + << base::to_underlying(action_type); } } // namespace brave_ads diff --git a/components/brave_ads/core/internal/user_engagement/conversions/conversions_util.cc b/components/brave_ads/core/internal/user_engagement/conversions/conversions_util.cc index 4a17344c2338..2599506eaa5a 100644 --- a/components/brave_ads/core/internal/user_engagement/conversions/conversions_util.cc +++ b/components/brave_ads/core/internal/user_engagement/conversions/conversions_util.cc @@ -59,8 +59,8 @@ bool IsAllowedToConvertAdEvent(const AdEventInfo& ad_event) { } } - NOTREACHED_NORETURN() << "Unexpected value for mojom::AdType: " - << base::to_underlying(ad_event.type); + NOTREACHED() << "Unexpected value for mojom::AdType: " + << base::to_underlying(ad_event.type); } bool DidAdEventOccurWithinObservationWindow( diff --git a/components/brave_ads/core/internal/user_engagement/reactions/reactions_type_util.cc b/components/brave_ads/core/internal/user_engagement/reactions/reactions_type_util.cc index 88f0a7d647a2..dfad98df6993 100644 --- a/components/brave_ads/core/internal/user_engagement/reactions/reactions_type_util.cc +++ b/components/brave_ads/core/internal/user_engagement/reactions/reactions_type_util.cc @@ -25,8 +25,8 @@ mojom::ReactionType ToggleLikedReactionType( } } - NOTREACHED_NORETURN() << "Unexpected value for mojom::ReactionType: " - << mojom_reaction_type; + NOTREACHED() << "Unexpected value for mojom::ReactionType: " + << mojom_reaction_type; } mojom::ReactionType ToggleDislikedReactionType( @@ -44,8 +44,8 @@ mojom::ReactionType ToggleDislikedReactionType( } } - NOTREACHED_NORETURN() << "Unexpected value for mojom::ReactionType: " - << mojom_reaction_type; + NOTREACHED() << "Unexpected value for mojom::ReactionType: " + << mojom_reaction_type; } } // namespace brave_ads diff --git a/components/brave_ads/core/internal/user_engagement/site_visit/site_visit_util.cc b/components/brave_ads/core/internal/user_engagement/site_visit/site_visit_util.cc index a570fcce207c..c4c39da7dbd3 100644 --- a/components/brave_ads/core/internal/user_engagement/site_visit/site_visit_util.cc +++ b/components/brave_ads/core/internal/user_engagement/site_visit/site_visit_util.cc @@ -50,8 +50,8 @@ bool IsAllowedToLandOnPage(const mojom::AdType mojom_ad_type) { } } - NOTREACHED_NORETURN() << "Unexpected value for mojom::AdType: " - << base::to_underlying(mojom_ad_type); + NOTREACHED() << "Unexpected value for mojom::AdType: " + << base::to_underlying(mojom_ad_type); } bool DidLandOnPage(const int32_t tab_id, const GURL& url) { diff --git a/components/brave_ads/core/public/ads_constants.h b/components/brave_ads/core/public/ads_constants.h index 79471fa99b91..29e4b245401c 100644 --- a/components/brave_ads/core/public/ads_constants.h +++ b/components/brave_ads/core/public/ads_constants.h @@ -10,17 +10,18 @@ namespace brave_ads { -ADS_EXPORT extern const char kDatabaseFilename[]; +inline constexpr char kDatabaseFilename[] = "database.sqlite"; // TODO(https://github.com/brave/brave-browser/issues/39795): Transition away // from using JSON state to a more efficient data approach. -ADS_EXPORT extern const char kClientJsonFilename[]; +inline constexpr char kClientJsonFilename[] = "client.json"; // TODO(https://github.com/brave/brave-browser/issues/39795): Transition away // from using JSON state to a more efficient data approach. -ADS_EXPORT extern const char kConfirmationsJsonFilename[]; +inline constexpr char kConfirmationsJsonFilename[] = "confirmations.json"; -ADS_EXPORT extern const char kCatalogJsonSchemaDataResourceName[]; +inline constexpr char kCatalogJsonSchemaDataResourceName[] = + "catalog-schema.json"; } // namespace brave_ads diff --git a/components/brave_component_updater/browser/dat_file_util.cc b/components/brave_component_updater/browser/dat_file_util.cc index ce8c9f55e8db..378158e501e8 100644 --- a/components/brave_component_updater/browser/dat_file_util.cc +++ b/components/brave_component_updater/browser/dat_file_util.cc @@ -17,20 +17,14 @@ namespace { void GetDATFileData(const base::FilePath& file_path, brave_component_updater::DATFileDataBuffer* buffer) { - int64_t size = 0; - if (!base::PathExists(file_path) || - !base::GetFileSize(file_path, &size) || - 0 == size) { - LOG(ERROR) << "GetDATFileData: " - << "the dat file is not found or corrupted " - << file_path; + if (!base::PathExists(file_path)) { + LOG(ERROR) << "GetDATFileData: the dat file is not found. " << file_path; return; } - buffer->resize(size); - if (size != base::ReadFile(file_path, - reinterpret_cast(&buffer->front()), - size)) { + if (auto bytes = base::ReadFileToBytes(file_path)) { + *buffer = std::move(*bytes); + } else { LOG(ERROR) << "GetDATFileData: cannot " << "read dat file " << file_path; } diff --git a/components/brave_federated/features_unittest.cc b/components/brave_federated/features_unittest.cc index a9092623bf37..8b5131f1acd9 100644 --- a/components/brave_federated/features_unittest.cc +++ b/components/brave_federated/features_unittest.cc @@ -49,7 +49,7 @@ TEST(BraveFederatedLearningFeaturesTest, OperationalPatternsEnabled) { // Arrange std::vector enabled_features; base::FieldTrialParams kFederatedLearningParameters; - const char kFieldTrialParameterOperationalPatternsEnabled[] = + static constexpr char kFieldTrialParameterOperationalPatternsEnabled[] = "operational_patterns_enabled"; kFederatedLearningParameters[kFieldTrialParameterOperationalPatternsEnabled] = "true"; @@ -92,7 +92,7 @@ TEST(BraveFederatedLearningFeaturesTest, CollectionSizeInSeconds) { // Arrange std::vector enabled_features; base::FieldTrialParams kFederatedLearningParameters; - const char kFieldTrialParameterCollectionSlotSizeInSeconds[] = + static constexpr char kFieldTrialParameterCollectionSlotSizeInSeconds[] = "collection_slot_size_in_seconds"; kFederatedLearningParameters [kFieldTrialParameterCollectionSlotSizeInSeconds] = "420"; @@ -133,7 +133,7 @@ TEST(BraveFederatedLearningFeaturesTest, MockTaskDuration) { // Arrange std::vector enabled_features; base::FieldTrialParams kFederatedLearningParameters; - const char kFieldTrialParameterMockTaskDurationInSeconds[] = + static constexpr char kFieldTrialParameterMockTaskDurationInSeconds[] = "mock_task_duration_in_seconds"; kFederatedLearningParameters[kFieldTrialParameterMockTaskDurationInSeconds] = "600"; @@ -177,7 +177,7 @@ TEST(BraveFederatedLearningFeaturesTest, CollectionIdLifetimeInSeconds) { // Arrange std::vector enabled_features; base::FieldTrialParams kFederatedLearningParameters; - const char kFieldTrialParameterCollectionIdLifetimeInSeconds[] = + static constexpr char kFieldTrialParameterCollectionIdLifetimeInSeconds[] = "collection_id_lifetime_in_seconds"; kFederatedLearningParameters [kFieldTrialParameterCollectionIdLifetimeInSeconds] = "2592000"; diff --git a/components/brave_news/browser/combined_feed_parsing.cc b/components/brave_news/browser/combined_feed_parsing.cc index df36c0528968..75dd3f0f24f8 100644 --- a/components/brave_news/browser/combined_feed_parsing.cc +++ b/components/brave_news/browser/combined_feed_parsing.cc @@ -13,7 +13,6 @@ #include "base/feature_list.h" #include "base/logging.h" -#include "base/notreached.h" #include "base/strings/strcat.h" #include "base/strings/utf_string_conversions.h" #include "base/time/time.h" @@ -145,7 +144,8 @@ base::expected ParseFeedItem( std::vector ParseFeedItems(const base::Value& value) { std::vector items; if (!value.is_list()) { - NOTREACHED_IN_MIGRATION(); + VLOG(1) << "Expected combined feed json to be a list but was " + << value.type() << ". Returning an empty list of items."; return items; } for (const base::Value& feed_item : value.GetList()) { diff --git a/components/brave_news/browser/feed_generation_info.h b/components/brave_news/browser/feed_generation_info.h index a47a685fe951..930a775705e6 100644 --- a/components/brave_news/browser/feed_generation_info.h +++ b/components/brave_news/browser/feed_generation_info.h @@ -12,6 +12,7 @@ #include "base/containers/flat_map.h" #include "base/containers/span.h" +#include "base/memory/raw_span.h" #include "brave/components/brave_news/browser/feed_fetcher.h" #include "brave/components/brave_news/browser/feed_sampling.h" #include "brave/components/brave_news/browser/publishers_controller.h" @@ -61,10 +62,10 @@ class FeedGenerationInfo { FeedItems& raw_feed_items() { return feed_items_; } // A modifiable span of the available topics. - base::span& topics() { return topics_span_; } + base::span topics() { return topics_span_; } // A modifiable span - base::span& suggested_publisher_ids() { + base::span suggested_publisher_ids() { return suggested_publisher_ids_span_; } @@ -84,12 +85,12 @@ class FeedGenerationInfo { FeedItems feed_items_; std::vector suggested_publisher_ids_; - base::span suggested_publisher_ids_span_; + base::raw_span suggested_publisher_ids_span_; Signals signals_; - base::span topics_span_; TopicsResult topics_; + base::raw_span topics_span_; std::optional article_infos_; std::optional> content_groups_; diff --git a/components/brave_news/browser/feed_v2_builder.cc b/components/brave_news/browser/feed_v2_builder.cc index 29ad7f1092e1..200f88736589 100644 --- a/components/brave_news/browser/feed_v2_builder.cc +++ b/components/brave_news/browser/feed_v2_builder.cc @@ -313,7 +313,7 @@ mojom::FeedItemMetadataPtr FromTopicArticle( // (more or less) what Brave Search does. std::vector GenerateTopTopicsBlock( FeedGenerationInfo& info) { - auto& topics = info.topics(); + auto topics = info.topics(); if (topics.empty()) { return {}; } @@ -422,7 +422,7 @@ std::vector GenerateSpecialBlock( FeedGenerationInfo& info) { DVLOG(1) << __FUNCTION__; - auto& suggested_publisher_ids = info.suggested_publisher_ids(); + auto suggested_publisher_ids = info.suggested_publisher_ids(); std::vector result; if (!suggested_publisher_ids.empty()) { size_t preferred_count = 3; @@ -592,7 +592,7 @@ mojom::FeedV2Ptr FeedV2Builder::GenerateAllFeed(FeedGenerationInfo info) { items = GenerateAd(); } } else { - NOTREACHED_IN_MIGRATION(); + NOTREACHED(); } // If we couldn't generate a normal block, break. diff --git a/components/brave_rewards/browser/BUILD.gn b/components/brave_rewards/browser/BUILD.gn index 4185ed4eb8af..3ec2f42a30c3 100644 --- a/components/brave_rewards/browser/BUILD.gn +++ b/components/brave_rewards/browser/BUILD.gn @@ -81,6 +81,7 @@ source_set("testutil") { "//brave/components/brave_rewards/common", "//brave/components/brave_rewards/core:headers", "//chrome/browser/bitmap_fetcher:bitmap_fetcher", + "//chrome/browser/prefs", "//chrome/test:test_support", "//content/public/browser", "//testing/gtest", diff --git a/components/brave_rewards/browser/diagnostic_log.cc b/components/brave_rewards/browser/diagnostic_log.cc index ac5117a6f8ce..ffa1cac90b11 100644 --- a/components/brave_rewards/browser/diagnostic_log.cc +++ b/components/brave_rewards/browser/diagnostic_log.cc @@ -22,8 +22,8 @@ namespace { -const int64_t kChunkSize = 1024; -const size_t kDividerLength = 80; +constexpr int64_t kChunkSize = 1024; +constexpr size_t kDividerLength = 80; std::string FormatTime(const base::Time& time) { return base::UnlocalizedTimeFormatWithPattern( diff --git a/components/brave_rewards/browser/rewards_service_impl.cc b/components/brave_rewards/browser/rewards_service_impl.cc index c64e387c193d..222d0e0f6788 100644 --- a/components/brave_rewards/browser/rewards_service_impl.cc +++ b/components/brave_rewards/browser/rewards_service_impl.cc @@ -1029,7 +1029,7 @@ void RewardsServiceImpl::OnURLLoaderComplete( [](std::unique_ptr response_body, LoadURLCallback callback, mojom::UrlResponsePtr response, scoped_refptr post_response_runner) { - api_request_helper::SanitizeAndParseJson( + api_request_helper::ParseJsonNonBlocking( *response_body, base::BindOnce( [](LoadURLCallback callback, diff --git a/components/brave_rewards/browser/test/common/rewards_browsertest_context_util.cc b/components/brave_rewards/browser/test/common/rewards_browsertest_context_util.cc index 2821c500c247..a7a3913403fe 100644 --- a/components/brave_rewards/browser/test/common/rewards_browsertest_context_util.cc +++ b/components/brave_rewards/browser/test/common/rewards_browsertest_context_util.cc @@ -10,7 +10,9 @@ namespace brave_rewards::test_util { -static const char kWaitForElementToAppearScript[] = R"( +namespace { + +constexpr char kWaitForElementToAppearScript[] = R"( const waitForElementToAppear = (selector) => { const TIMEOUT_SECONDS = 10; @@ -45,6 +47,8 @@ static const char kWaitForElementToAppearScript[] = R"( }; )"; +} // namespace + void WaitForElementToAppear( content::WebContents* context, const std::string& selector, @@ -449,7 +453,7 @@ std::vector GetSiteBannerTipOptions(content::WebContents* context) { content::ISOLATED_WORLD_ID_CONTENT_END).ExtractList(); std::vector result; - for (const auto& value : options.GetList()) { + for (const auto& value : options) { result.push_back(value.GetDouble()); } return result; diff --git a/components/brave_rewards/core/common/random_util.cc b/components/brave_rewards/core/common/random_util.cc index 0c5fa7c73f32..578377e411cb 100644 --- a/components/brave_rewards/core/common/random_util.cc +++ b/components/brave_rewards/core/common/random_util.cc @@ -14,6 +14,8 @@ namespace { +constexpr size_t kLengthHexString = 32; + std::string EncodeStringForPKCE(const std::string& data) { std::string encoded_data; @@ -30,8 +32,7 @@ std::string EncodeStringForPKCE(const std::string& data) { namespace brave_rewards::internal::util { std::string GenerateRandomHexString() { - const size_t kLength = 32; - uint8_t bytes[kLength]; + uint8_t bytes[kLengthHexString]; crypto::RandBytes(bytes); return base::HexEncode(bytes, sizeof(bytes)); } diff --git a/components/brave_rewards/core/publisher/prefix_util.cc b/components/brave_rewards/core/publisher/prefix_util.cc index 8abce2549532..d7f32e333015 100644 --- a/components/brave_rewards/core/publisher/prefix_util.cc +++ b/components/brave_rewards/core/publisher/prefix_util.cc @@ -10,9 +10,6 @@ namespace brave_rewards::internal::publisher { -const size_t kMinPrefixSize = 4; -const size_t kMaxPrefixSize = 32; - std::string GetHashPrefixRaw(const std::string& publisher_key, size_t prefix_size) { DCHECK(!publisher_key.empty()); diff --git a/components/brave_rewards/core/publisher/prefix_util.h b/components/brave_rewards/core/publisher/prefix_util.h index 47a47a51df99..458ee1e9a397 100644 --- a/components/brave_rewards/core/publisher/prefix_util.h +++ b/components/brave_rewards/core/publisher/prefix_util.h @@ -11,8 +11,8 @@ namespace brave_rewards::internal { namespace publisher { -extern const size_t kMinPrefixSize; -extern const size_t kMaxPrefixSize; +inline constexpr size_t kMinPrefixSize = 4; +inline constexpr size_t kMaxPrefixSize = 32; // Returns a hash prefix for the specified publisher key std::string GetHashPrefixRaw(const std::string& publisher_key, diff --git a/components/brave_rewards/core/rewards_engine_helper.h b/components/brave_rewards/core/rewards_engine_helper.h index bcc250930eae..72f8bd8f047e 100644 --- a/components/brave_rewards/core/rewards_engine_helper.h +++ b/components/brave_rewards/core/rewards_engine_helper.h @@ -50,7 +50,7 @@ class WithHelperKey { static const void* GetHelperKey() { return std::addressof(kHelperKey); } private: - static inline const int kHelperKey = 0; + static constexpr int kHelperKey = 0; }; } // namespace brave_rewards::internal diff --git a/components/brave_search_conversion/p3a.cc b/components/brave_search_conversion/p3a.cc index af8157143048..a1bd04392562 100644 --- a/components/brave_search_conversion/p3a.cc +++ b/components/brave_search_conversion/p3a.cc @@ -57,10 +57,10 @@ const char* GetPromoShownKeyName(ConversionType type) { return kButtonShownKey; case ConversionType::kNTP: return kNTPShownKey; - default: + case ConversionType::kNone: break; } - NOTREACHED_NORETURN(); + NOTREACHED(); } const char* GetPromoTriggeredKeyName(ConversionType type) { @@ -82,10 +82,10 @@ const char* GetPromoTriggeredKeyName(ConversionType type) { return kButtonTriggeredKey; case ConversionType::kNTP: return kNTPTriggeredKey; - default: + case ConversionType::kNone: break; } - NOTREACHED_NORETURN(); + NOTREACHED(); } const char* GetPromoTypeHistogramName(ConversionType type) { @@ -107,10 +107,10 @@ const char* GetPromoTypeHistogramName(ConversionType type) { return kSearchPromoButtonHistogramName; case ConversionType::kNTP: return kSearchPromoNTPHistogramName; - default: + case ConversionType::kNone: break; } - NOTREACHED_NORETURN(); + NOTREACHED(); } void UpdateHistograms(PrefService* prefs) { diff --git a/components/brave_service_keys/brave_service_key_utils.cc b/components/brave_service_keys/brave_service_key_utils.cc index 40d3325542d4..acb0f016a5cf 100644 --- a/components/brave_service_keys/brave_service_key_utils.cc +++ b/components/brave_service_keys/brave_service_key_utils.cc @@ -61,10 +61,8 @@ std::pair CreateSignatureString( // For all the headers to sign, we expect their values to be be in the // headers flat_map and use the value there to add to the signature string. auto header = headers.find(header_to_sign); - if (header == headers.end()) { - NOTREACHED_NORETURN() - << "Can't sign over non-existent header " << header_to_sign; - } + CHECK(header != headers.end()) + << "Can't sign over non-existent header " << header_to_sign; signature_string.append( base::StrCat({header_to_sign, ": ", header->second})); } diff --git a/components/brave_shields/content/browser/ad_block_custom_filters_provider.cc b/components/brave_shields/content/browser/ad_block_custom_filters_provider.cc index 6aa5e76a3d2c..1af34f41efed 100644 --- a/components/brave_shields/content/browser/ad_block_custom_filters_provider.cc +++ b/components/brave_shields/content/browser/ad_block_custom_filters_provider.cc @@ -25,7 +25,7 @@ void AddDATBufferToFilterSet(uint8_t permission_mask, // Custom filters get all permissions granted, i.e. all bits of the mask set, // i.e. the maximum possible uint8_t. -const uint8_t kCustomFiltersPermissionLevel = UINT8_MAX; +constexpr uint8_t kCustomFiltersPermissionLevel = UINT8_MAX; } // namespace diff --git a/components/brave_shields/content/browser/ad_block_subscription_service_manager.cc b/components/brave_shields/content/browser/ad_block_subscription_service_manager.cc index 9ff4173ae440..a4fe2b609469 100644 --- a/components/brave_shields/content/browser/ad_block_subscription_service_manager.cc +++ b/components/brave_shields/content/browser/ad_block_subscription_service_manager.cc @@ -34,13 +34,11 @@ namespace brave_shields { -constexpr uint16_t kSubscriptionDefaultExpiresHours = 7 * 24; - base::TimeDelta* g_testing_subscription_retry_interval = nullptr; namespace { -const uint16_t kSubscriptionMaxExpiresHours = 14 * 24; +constexpr uint16_t kSubscriptionMaxExpiresHours = 14 * 24; constexpr base::TimeDelta kListRetryInterval = base::Hours(1); constexpr base::TimeDelta kListCheckInitialDelay = base::Minutes(1); diff --git a/components/brave_shields/content/browser/ad_block_subscription_service_manager.h b/components/brave_shields/content/browser/ad_block_subscription_service_manager.h index 3abc22f0528e..65386cf4c547 100644 --- a/components/brave_shields/content/browser/ad_block_subscription_service_manager.h +++ b/components/brave_shields/content/browser/ad_block_subscription_service_manager.h @@ -42,7 +42,7 @@ class AdBlockServiceTest; namespace brave_shields { -extern const uint16_t kSubscriptionDefaultExpiresHours; +inline constexpr uint16_t kSubscriptionDefaultExpiresHours = 7 * 24; struct SubscriptionInfo { SubscriptionInfo(); diff --git a/components/brave_shields/content/browser/domain_block_navigation_throttle.cc b/components/brave_shields/content/browser/domain_block_navigation_throttle.cc index 4649b755f66e..b5b2d624ddef 100644 --- a/components/brave_shields/content/browser/domain_block_navigation_throttle.cc +++ b/components/brave_shields/content/browser/domain_block_navigation_throttle.cc @@ -245,7 +245,7 @@ void DomainBlockNavigationThrottle::OnShouldBlockDomain( ShowInterstitial(proceed_with_resume_cancel); break; case DomainBlockingType::kNone: - NOTREACHED_NORETURN(); + NOTREACHED(); } } } diff --git a/components/brave_shields/core/browser/ad_block_component_service_manager.cc b/components/brave_shields/core/browser/ad_block_component_service_manager.cc index 2d9dd884a468..334c76680af5 100644 --- a/components/brave_shields/core/browser/ad_block_component_service_manager.cc +++ b/components/brave_shields/core/browser/ad_block_component_service_manager.cc @@ -6,11 +6,13 @@ #include "brave/components/brave_shields/core/browser/ad_block_component_service_manager.h" #include +#include #include #include #include "base/feature_list.h" #include "base/files/file_path.h" +#include "base/memory/raw_ptr_exclusion.h" #include "base/memory/raw_ref.h" #include "base/metrics/histogram_macros.h" #include "base/time/time.h" @@ -35,25 +37,23 @@ namespace brave_shields { namespace { typedef struct ListDefaultOverrideConstants { - const raw_ref feature; - const char* list_uuid; + RAW_PTR_EXCLUSION const base::Feature& feature; + std::string_view list_uuid; } ListDefaultOverrideConstants; -const ListDefaultOverrideConstants kCookieListConstants{ - .feature = raw_ref(kBraveAdblockCookieListDefault), +constexpr ListDefaultOverrideConstants kCookieListConstants{ + .feature = kBraveAdblockCookieListDefault, .list_uuid = kCookieListUuid}; -const ListDefaultOverrideConstants kMobileNotificationsListConstants{ - .feature = raw_ref( - kBraveAdblockMobileNotificationsListDefault), +constexpr ListDefaultOverrideConstants kMobileNotificationsListConstants{ + .feature = kBraveAdblockMobileNotificationsListDefault, .list_uuid = kMobileNotificationsListUuid}; -const ListDefaultOverrideConstants kExperimentalListConstants{ - .feature = - raw_ref(kBraveAdblockExperimentalListDefault), +constexpr ListDefaultOverrideConstants kExperimentalListConstants{ + .feature = kBraveAdblockExperimentalListDefault, .list_uuid = kExperimentalListUuid}; -const ListDefaultOverrideConstants kOverrideConstants[3] = { +constexpr ListDefaultOverrideConstants kOverrideConstants[] = { kCookieListConstants, kMobileNotificationsListConstants, kExperimentalListConstants}; @@ -217,7 +217,7 @@ bool AdBlockComponentServiceManager::IsFilterListEnabled( // Apply feature overrides from Griffin without overriding user preference for (const auto& constants : kOverrideConstants) { if (uuid == constants.list_uuid && - base::FeatureList::IsEnabled(*constants.feature) && !list_touched) { + base::FeatureList::IsEnabled(constants.feature) && !list_touched) { return true; } } diff --git a/components/brave_sync/qr_code_validator.cc b/components/brave_sync/qr_code_validator.cc index ea190b159994..ba30f69234f6 100644 --- a/components/brave_sync/qr_code_validator.cc +++ b/components/brave_sync/qr_code_validator.cc @@ -109,7 +109,8 @@ bool QrCodeDataValidator::IsValidSeedHex(const std::string& seed_hex) { base::SplitResult::SPLIT_WANT_NONEMPTY); if (words.size() != kPassphraseWordsCount) { - NOTREACHED_IN_MIGRATION() << "Passphrase words number is " << words.size(); + VLOG(1) << "IsValidSeedHex: unexpected passphrase words number: " + << words.size(); return false; } diff --git a/components/brave_sync/time_limited_words.cc b/components/brave_sync/time_limited_words.cc index 5a11fc325f4a..3559d7f9677e 100644 --- a/components/brave_sync/time_limited_words.cc +++ b/components/brave_sync/time_limited_words.cc @@ -196,9 +196,7 @@ TimeLimitedWords::ParseImpl(const std::string& time_limited_words, } else { return base::unexpected(ValidationStatus::kWrongWordsNumber); } - - NOTREACHED_IN_MIGRATION(); - return base::unexpected(ValidationStatus::kNotValidPureWords); + NOTREACHED(); } base::expected diff --git a/components/brave_vpn/browser/connection/brave_vpn_region_data_manager.cc b/components/brave_vpn/browser/connection/brave_vpn_region_data_manager.cc index fc515a9666ba..817f1904b10d 100644 --- a/components/brave_vpn/browser/connection/brave_vpn_region_data_manager.cc +++ b/components/brave_vpn/browser/connection/brave_vpn_region_data_manager.cc @@ -84,8 +84,7 @@ std::string BraveVPNRegionDataManager::GetRegionPrecisionForName( } } } - - NOTREACHED_NORETURN(); + NOTREACHED(); } void BraveVPNRegionDataManager::SetFallbackDeviceRegion() { diff --git a/components/brave_vpn/common/brave_vpn_utils.cc b/components/brave_vpn/common/brave_vpn_utils.cc index 61d6d75a5f76..9085841443fb 100644 --- a/components/brave_vpn/common/brave_vpn_utils.cc +++ b/components/brave_vpn/common/brave_vpn_utils.cc @@ -105,11 +105,9 @@ std::string_view GetMigratedNameIfNeeded(PrefService* local_prefs, return name; } - if (kV1ToV2Map.contains(name)) { - return kV1ToV2Map.at(name); - } - - NOTREACHED_NORETURN(); + auto it = kV1ToV2Map.find(name); + CHECK(it != kV1ToV2Map.end()); + return it->second; } bool IsBraveVPNWireguardEnabled(PrefService* local_state) { diff --git a/components/brave_wallet/browser/android_page_appearing_browsertest.cc b/components/brave_wallet/browser/android_page_appearing_browsertest.cc index 14d34b8b0a0a..f2e04ecfa4da 100644 --- a/components/brave_wallet/browser/android_page_appearing_browsertest.cc +++ b/components/brave_wallet/browser/android_page_appearing_browsertest.cc @@ -27,7 +27,6 @@ #include "brave/components/brave_wallet/browser/test_utils.h" #include "brave/components/constants/webui_url_constants.h" #include "brave/components/cosmetic_filters/browser/cosmetic_filters_resources.h" -#include "chrome/browser/prefs/browser_prefs.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/android/tab_model/tab_model.h" #include "chrome/browser/ui/android/tab_model/tab_model_list.h" diff --git a/components/brave_wallet/browser/eip1559_transaction.cc b/components/brave_wallet/browser/eip1559_transaction.cc index 9541436c8e2d..cb6444c66fc1 100644 --- a/components/brave_wallet/browser/eip1559_transaction.cc +++ b/components/brave_wallet/browser/eip1559_transaction.cc @@ -9,6 +9,7 @@ #include #include +#include "base/containers/to_vector.h" #include "base/values.h" #include "brave/components/brave_wallet/browser/rlp_encode.h" #include "brave/components/brave_wallet/common/hash_utils.h" @@ -289,7 +290,7 @@ std::vector Eip1559Transaction::GetMessageToSign(uint256_t chain_id, const std::string rlp_msg = RLPEncode(base::Value(std::move(list))); result.insert(result.end(), rlp_msg.begin(), rlp_msg.end()); - return hash ? KeccakHash(result) : result; + return hash ? base::ToVector(KeccakHash(result)) : result; } std::string Eip1559Transaction::GetSignedTransaction() const { diff --git a/components/brave_wallet/browser/eip2930_transaction.cc b/components/brave_wallet/browser/eip2930_transaction.cc index e3b4e6440691..b68c26b354f6 100644 --- a/components/brave_wallet/browser/eip2930_transaction.cc +++ b/components/brave_wallet/browser/eip2930_transaction.cc @@ -8,6 +8,7 @@ #include #include +#include "base/containers/to_vector.h" #include "base/values.h" #include "brave/components/brave_wallet/browser/rlp_encode.h" #include "brave/components/brave_wallet/common/eth_address.h" @@ -179,7 +180,7 @@ std::vector Eip2930Transaction::GetMessageToSign(uint256_t chain_id, const std::string rlp_msg = RLPEncode(base::Value(std::move(list))); result.insert(result.end(), rlp_msg.begin(), rlp_msg.end()); - return hash ? KeccakHash(result) : result; + return hash ? base::ToVector(KeccakHash(result)) : result; } std::string Eip2930Transaction::GetSignedTransaction() const { diff --git a/components/brave_wallet/browser/eth_abi_decoder.cc b/components/brave_wallet/browser/eth_abi_decoder.cc index af9041a3630c..9971ed12ffac 100644 --- a/components/brave_wallet/browser/eth_abi_decoder.cc +++ b/components/brave_wallet/browser/eth_abi_decoder.cc @@ -3,21 +3,16 @@ * 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/. */ -#ifdef UNSAFE_BUFFERS_BUILD -// TODO(https://github.com/brave/brave-browser/issues/41661): Remove this and -// convert code to safer constructs. -#pragma allow_unsafe_buffers -#endif - #include "brave/components/brave_wallet/browser/eth_abi_decoder.h" #include -#include #include #include #include #include "base/containers/span.h" +#include "base/containers/span_reader.h" +#include "base/memory/raw_span.h" #include "base/strings/strcat.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" @@ -70,7 +65,7 @@ struct DecoderResult { consumed(consumed) {} T result; // decoded value - ByteView remaining; // remaining calldata + base::raw_span remaining; // remaining calldata size_t consumed; // number of bytes consumed }; @@ -96,8 +91,7 @@ std::optional> GetAddressFromData(ByteView input) { } return DecoderResult( - base::Value("0x" + HexEncodeLower(input.data() + kWordSize - kAddressSize, - kAddressSize)), + base::Value(ToHex(input.first(kWordSize).last(kAddressSize))), GetSubByteView(input, kWordSize), kWordSize); } @@ -114,10 +108,12 @@ std::optional> GetUintFromData(ByteView input) { return std::nullopt; } - auto arg = HexEncodeLower(input.data(), kWordSize); - uint256_t value; - if (!HexValueToUint256("0x" + arg, &value)) { + // TODO(apaymyshev): we don't need string in this bytes->string->bytes + // conversion here. + if (!HexValueToUint256( + base::StrCat({"0x", HexEncodeLower(input.first(kWordSize))}), + &value)) { return std::nullopt; } @@ -206,7 +202,7 @@ std::optional> GetBytesHexFromData( size_t parts_size = parts_count * kWordSize; return DecoderResult( - base::Value("0x" + HexEncodeLower(remaining.data(), size)), + base::Value(base::StrCat({"0x", HexEncodeLower(remaining.first(size))})), GetSubByteView(remaining, parts_size), consumed + parts_size); } @@ -293,7 +289,7 @@ std::optional> DecodeParam(const eth_abi::Type& type, } // Unrecognized types are considered errors. - NOTREACHED_NORETURN(); + NOTREACHED(); } std::optional> DecodeParam( @@ -472,37 +468,35 @@ std::optional> UniswapEncodedPathDecode( if (!PrefixedHexStringToBytes(encoded_path, &data)) { return std::nullopt; } - size_t offset = 0; std::vector path; + auto reader = base::SpanReader(base::as_byte_span(data)); + // The path should be long enough to encode a single-hop swap. // 43 = 20(address) + 3(fee) + 20(address) - if (data.size() < 43) { + if (reader.remaining() < 43) { return std::nullopt; } // Parse first hop address. - path.push_back("0x" + HexEncodeLower(data.data(), 20)); - offset += 20; + path.push_back(base::StrCat({"0x", HexEncodeLower(*reader.Read(20u))})); while (true) { - if (offset == data.size()) { + if (!reader.remaining()) { break; } // Parse the pool fee, and ignore. - if (data.size() - offset < 3) { + if (!reader.Skip(3u)) { return std::nullopt; } - offset += 3; - // Parse next hop. - if (data.size() - offset < 20) { + if (auto address = reader.Read(20u)) { + path.push_back(base::StrCat({"0x", HexEncodeLower(*address)})); + } else { return std::nullopt; } - path.push_back("0x" + HexEncodeLower(data.data() + offset, 20)); - offset += 20; } // Require a minimum of 2 addresses for a single-hop swap. @@ -514,9 +508,7 @@ std::optional> UniswapEncodedPathDecode( } std::optional ABIDecode(const eth_abi::Type& type, - const ByteArray& data) { - ByteView input = base::make_span(data.data(), data.size()); - + base::span input) { auto decoded = DecodeParam(type, input); if (!decoded) { return std::nullopt; diff --git a/components/brave_wallet/browser/eth_abi_decoder.h b/components/brave_wallet/browser/eth_abi_decoder.h index 0b69749fd308..7f713e100de8 100644 --- a/components/brave_wallet/browser/eth_abi_decoder.h +++ b/components/brave_wallet/browser/eth_abi_decoder.h @@ -8,7 +8,6 @@ #include #include -#include #include #include "base/values.h" @@ -20,7 +19,7 @@ std::optional> UniswapEncodedPathDecode( const std::string& encoded_path); std::optional ABIDecode(const eth_abi::Type& type, - const std::vector& data); + base::span input); } // namespace brave_wallet diff --git a/components/brave_wallet/browser/eth_allowance_manager.cc b/components/brave_wallet/browser/eth_allowance_manager.cc index 78693c31b7fb..c29bffb06f47 100644 --- a/components/brave_wallet/browser/eth_allowance_manager.cc +++ b/components/brave_wallet/browser/eth_allowance_manager.cc @@ -164,7 +164,8 @@ void EthAllowanceManager::OnGetCurrentBlock( return; } - const auto approval_topic_hash = KeccakHash(kApprovalTopicFunctionSignature); + const auto approval_topic_hash = ToHex(KeccakHash( + base::byte_span_from_cstring(kApprovalTopicFunctionSignature))); for (const auto& account_address : account_addresses) { std::string account_address_hex; if (!PadHexEncodedParameter(account_address, &account_address_hex)) { diff --git a/components/brave_wallet/browser/eth_data_parser.cc b/components/brave_wallet/browser/eth_data_parser.cc index aefb3d2627fe..7d220d863d7f 100644 --- a/components/brave_wallet/browser/eth_data_parser.cc +++ b/components/brave_wallet/browser/eth_data_parser.cc @@ -266,10 +266,10 @@ std::optional SquidDecodeCall(const base::Value::List& call) { return std::nullopt; } - std::vector calldata(calldata_with_selector->begin() + 4, - calldata_with_selector->end()); + auto [selector_span, calldata] = + base::span(*calldata_with_selector).split_at(4); - auto selector = "0x" + HexEncodeLower(calldata_with_selector->data(), 4); + auto selector = ToHex(selector_span); if (selector == kSquidExactInputSingle) { // exactInputSingle((address tokenIn, @@ -544,8 +544,9 @@ GetTransactionInfoFromData(const std::vector& data) { std::vector(), nullptr); } - std::string selector = "0x" + HexEncodeLower(data.data(), 4); - std::vector calldata(data.begin() + 4, data.end()); + auto [selector_span, calldata] = base::span(data).split_at(4); + + std::string selector = ToHex(selector_span); if (selector == kFilForwarderTransferSelector) { auto type = eth_abi::Tuple().AddTupleType(eth_abi::Bytes()).build(); auto decoded = ABIDecode(type, calldata); diff --git a/components/brave_wallet/browser/eth_topics_builder.cc b/components/brave_wallet/browser/eth_topics_builder.cc index eb39c88ac80e..3d2fc3c18bf6 100644 --- a/components/brave_wallet/browser/eth_topics_builder.cc +++ b/components/brave_wallet/browser/eth_topics_builder.cc @@ -17,7 +17,8 @@ bool MakeAssetDiscoveryTopics( const std::vector& to_account_addresses, base::Value::List* topics) { // First topic matches full keccak hash of the erc20::Transfer event signature - topics->Append(brave_wallet::KeccakHash("Transfer(address,address,uint256)")); + topics->Append(ToHex(KeccakHash( + base::byte_span_from_cstring("Transfer(address,address,uint256)")))); // Second topic matches everything (any from_address) topics->Append(base::Value()); diff --git a/components/brave_wallet/browser/eth_transaction.cc b/components/brave_wallet/browser/eth_transaction.cc index 5c23c6de2b8d..9757814b21ea 100644 --- a/components/brave_wallet/browser/eth_transaction.cc +++ b/components/brave_wallet/browser/eth_transaction.cc @@ -9,6 +9,7 @@ #include #include "base/base64.h" +#include "base/containers/to_vector.h" #include "base/logging.h" #include "base/strings/string_number_conversions.h" #include "base/values.h" @@ -189,7 +190,7 @@ std::vector EthTransaction::GetMessageToSign(uint256_t chain_id, const std::string message = RLPEncode(base::Value(std::move(list))); auto result = std::vector(message.begin(), message.end()); - return hash ? KeccakHash(result) : result; + return hash ? base::ToVector(KeccakHash(result)) : result; } std::string EthTransaction::GetSignedTransaction() const { @@ -202,7 +203,7 @@ std::string EthTransaction::GetTransactionHash() const { DCHECK(IsSigned()); DCHECK(nonce_); - return KeccakHash(RLPEncode(Serialize())); + return ToHex(KeccakHash(base::as_byte_span(RLPEncode(Serialize())))); } bool EthTransaction::ProcessVRS(const std::vector& v, diff --git a/components/brave_wallet/browser/ethereum_keyring.cc b/components/brave_wallet/browser/ethereum_keyring.cc index def6cd757fb0..15066d207cd5 100644 --- a/components/brave_wallet/browser/ethereum_keyring.cc +++ b/components/brave_wallet/browser/ethereum_keyring.cc @@ -8,7 +8,10 @@ #include #include "base/base64.h" +#include "base/containers/extend.h" #include "base/containers/span.h" +#include "base/containers/to_vector.h" +#include "base/strings/strcat.h" #include "base/strings/string_number_conversions.h" #include "brave/components/brave_wallet/browser/eth_transaction.h" #include "brave/components/brave_wallet/common/eth_address.h" @@ -20,12 +23,11 @@ namespace { // Get the 32 byte message hash std::vector GetMessageHash(base::span message) { - std::string prefix("\x19"); - prefix += std::string("Ethereum Signed Message:\n" + - base::NumberToString(message.size())); + std::string prefix = base::StrCat({"\x19", "Ethereum Signed Message:\n", + base::NumberToString(message.size())}); std::vector hash_input(prefix.begin(), prefix.end()); - hash_input.insert(hash_input.end(), message.begin(), message.end()); - return brave_wallet::KeccakHash(hash_input); + base::Extend(hash_input, message); + return base::ToVector(KeccakHash(hash_input)); } } // namespace diff --git a/components/brave_wallet/browser/ethereum_provider_impl.cc b/components/brave_wallet/browser/ethereum_provider_impl.cc index 2c3afc66069d..ee2b9c8ea45d 100644 --- a/components/brave_wallet/browser/ethereum_provider_impl.cc +++ b/components/brave_wallet/browser/ethereum_provider_impl.cc @@ -12,6 +12,7 @@ #include #include "base/containers/contains.h" +#include "base/containers/to_vector.h" #include "base/json/json_reader.h" #include "base/json/json_writer.h" #include "base/strings/strcat.h" @@ -602,7 +603,7 @@ void EthereumProviderImpl::Decrypt( return; } - api_request_helper::SanitizeAndParseJson( + api_request_helper::ParseJsonNonBlocking( untrusted_encrypted_data_json, base::BindOnce(&EthereumProviderImpl::ContinueDecryptWithSanitizedJson, weak_factory_.GetWeakPtr(), std::move(callback), @@ -685,7 +686,7 @@ void EthereumProviderImpl::SignTypedMessage( mojom::SignDataUnion::NewEthSignTypedData(std::move(eth_sign_typed_data)); SignMessageInternal(account_id, std::move(sign_data), - std::move(message_to_sign), std::move(callback), + base::ToVector(message_to_sign), std::move(callback), std::move(id)); } diff --git a/components/brave_wallet/browser/internal/hd_key.cc b/components/brave_wallet/browser/internal/hd_key.cc index 4efa32a57bb7..9ff922674ba4 100644 --- a/components/brave_wallet/browser/internal/hd_key.cc +++ b/components/brave_wallet/browser/internal/hd_key.cc @@ -16,6 +16,7 @@ #include "base/check.h" #include "base/containers/span.h" +#include "base/containers/to_vector.h" #include "base/json/json_reader.h" #include "base/logging.h" #include "base/numerics/byte_conversions.h" @@ -25,6 +26,7 @@ #include "base/strings/string_util.h" #include "brave/components/brave_wallet/common/bitcoin_utils.h" #include "brave/components/brave_wallet/common/hash_utils.h" +#include "brave/components/brave_wallet/common/hex_utils.h" #include "brave/components/brave_wallet/common/zcash_utils.h" #include "brave/third_party/bitcoin-core/src/src/base58.h" #include "brave/vendor/bat-native-tweetnacl/tweetnacl.h" @@ -78,8 +80,7 @@ bool UTCPasswordVerification(const std::string& derived_key, mac_verification_input.insert(mac_verification_input.end(), ciphertext.begin(), ciphertext.end()); // verify password - std::vector mac_verification(KeccakHash(mac_verification_input)); - if (base::ToLowerASCII(base::HexEncode(mac_verification)) != mac) { + if (HexEncodeLower(KeccakHash(mac_verification_input)) != mac) { VLOG(0) << __func__ << ": password does not match"; return false; } @@ -397,7 +398,7 @@ void HDKey::SetPrivateKey(base::span value) { } private_key_.assign(value.begin(), value.end()); GeneratePublicKey(); - identifier_ = Hash160(public_key_); + identifier_ = base::ToVector(Hash160(public_key_)); const uint8_t* ptr = identifier_.data(); fingerprint_ = ptr[0] << 24 | ptr[1] << 16 | ptr[2] << 8 | ptr[3] << 0; @@ -425,8 +426,8 @@ void HDKey::SetPublicKey( LOG(ERROR) << __func__ << ": not a valid public key"; return; } - public_key_.assign(value.begin(), value.end()); - identifier_ = Hash160(public_key_); + public_key_ = base::ToVector(value); + identifier_ = base::ToVector(Hash160(public_key_)); const uint8_t* ptr = identifier_.data(); fingerprint_ = ptr[0] << 24 | ptr[1] << 16 | ptr[2] << 8 | ptr[3] << 0; diff --git a/components/brave_wallet/browser/keyring_service.cc b/components/brave_wallet/browser/keyring_service.cc index 13b143ca4688..c9d7c3862e47 100644 --- a/components/brave_wallet/browser/keyring_service.cc +++ b/components/brave_wallet/browser/keyring_service.cc @@ -1855,7 +1855,7 @@ void KeyringService::CreateKeyringInternal(mojom::KeyringId keyring_id, bitcoin_hardware_keyrings_[keyring_id] = std::make_unique(true); } else { - NOTREACHED_NORETURN() << keyring_id; + NOTREACHED() << keyring_id; } } diff --git a/components/brave_wallet/browser/keyring_service_prefs.cc b/components/brave_wallet/browser/keyring_service_prefs.cc index ade0afc64305..9c3c169212f9 100644 --- a/components/brave_wallet/browser/keyring_service_prefs.cc +++ b/components/brave_wallet/browser/keyring_service_prefs.cc @@ -6,6 +6,8 @@ #include "brave/components/brave_wallet/browser/keyring_service_prefs.h" #include +#include +#include #include "base/values.h" #include "brave/components/brave_wallet/browser/pref_names.h" @@ -47,7 +49,7 @@ std::string KeyringIdPrefString(mojom::KeyringId keyring_id) { case mojom::KeyringId::kBitcoinHardwareTestnet: return "bitcoin_hardware_test"; } - NOTREACHED_NORETURN(); + NOTREACHED(); } const base::Value* GetPrefForKeyring(PrefService* profile_prefs, diff --git a/components/brave_wallet/browser/network_manager.cc b/components/brave_wallet/browser/network_manager.cc index f2ebba637843..083475b3c575 100644 --- a/components/brave_wallet/browser/network_manager.cc +++ b/components/brave_wallet/browser/network_manager.cc @@ -961,7 +961,7 @@ GURL NetworkManager::GetUnstoppableDomainsRpcUrl(const std::string& chain_id) { return GetPolygonMainnet()->rpc_endpoints.front(); } - NOTREACHED_NORETURN(); + NOTREACHED(); } // static @@ -1291,18 +1291,19 @@ std::string NetworkManager::GetCurrentChainId( return chain_id_from_prefs; } } - if (coin == mojom::CoinType::ETH) { - return mojom::kMainnetChainId; - } else if (coin == mojom::CoinType::SOL) { - return mojom::kSolanaMainnet; - } else if (coin == mojom::CoinType::FIL) { - return mojom::kFilecoinMainnet; - } else if (coin == mojom::CoinType::BTC) { - return mojom::kBitcoinMainnet; - } else if (coin == mojom::CoinType::ZEC) { - return mojom::kZCashMainnet; + switch (coin) { + case mojom::CoinType::ETH: + return mojom::kMainnetChainId; + case mojom::CoinType::SOL: + return mojom::kSolanaMainnet; + case mojom::CoinType::FIL: + return mojom::kFilecoinMainnet; + case mojom::CoinType::BTC: + return mojom::kBitcoinMainnet; + case mojom::CoinType::ZEC: + return mojom::kZCashMainnet; } - NOTREACHED_NORETURN() << coin; + NOTREACHED() << coin; } bool NetworkManager::SetCurrentChainId(mojom::CoinType coin, diff --git a/components/brave_wallet/browser/nft_metadata_fetcher.cc b/components/brave_wallet/browser/nft_metadata_fetcher.cc index 013568eb8905..c3c00955e2a4 100644 --- a/components/brave_wallet/browser/nft_metadata_fetcher.cc +++ b/components/brave_wallet/browser/nft_metadata_fetcher.cc @@ -183,7 +183,7 @@ void NftMetadataFetcher::FetchMetadata( } // Sanitize JSON - api_request_helper::SanitizeAndParseJson( + api_request_helper::ParseJsonNonBlocking( std::move(metadata_json), base::BindOnce(&NftMetadataFetcher::OnSanitizeTokenMetadata, weak_ptr_factory_.GetWeakPtr(), std::move(callback))); diff --git a/components/brave_wallet/browser/sns_resolver_task.cc b/components/brave_wallet/browser/sns_resolver_task.cc index 4d9df75a222c..72f8f81def36 100644 --- a/components/brave_wallet/browser/sns_resolver_task.cc +++ b/components/brave_wallet/browser/sns_resolver_task.cc @@ -11,6 +11,8 @@ #include #include "base/base64.h" +#include "base/containers/span.h" +#include "base/memory/raw_span.h" #include "base/no_destructor.h" #include "base/notreached.h" #include "base/numerics/byte_conversions.h" @@ -132,7 +134,7 @@ struct SnsRecordV2 { uint32_t content_length = 0; SolanaAddress staleness_validation_id = SolanaAddress::ZeroAddress(); SolanaAddress roa_validation_id = SolanaAddress::ZeroAddress(); - base::span content; + base::raw_span content; }; base::span ExtractSpan(base::span& data, @@ -301,7 +303,7 @@ std::optional ParseAndVerifySolRecordData( } else if (record_item.version == SnsRecordsVersion::kRecordsV2) { return ParseAndVerifySolRecordV2Data(sol_record_payload, domain_owner); } - NOTREACHED_NORETURN(); + NOTREACHED(); } std::optional ParseAndVerifyTextRecordData( @@ -329,7 +331,7 @@ std::optional ParseAndVerifyTextRecordData( } return std::nullopt; } - NOTREACHED_NORETURN(); + NOTREACHED(); } // https://github.com/solana-labs/solana-program-library/blob/f97a3dc7cf0e6b8e346d473a8c9d02de7b213cfd/token/program/src/state.rs#L16 diff --git a/components/brave_wallet/browser/swap_request_helper.cc b/components/brave_wallet/browser/swap_request_helper.cc index 0037e863176e..749f70168b89 100644 --- a/components/brave_wallet/browser/swap_request_helper.cc +++ b/components/brave_wallet/browser/swap_request_helper.cc @@ -212,19 +212,15 @@ std::optional EncodeToken( } std::string EncodeStepType(const mojom::LiFiStepType type) { - if (type == mojom::LiFiStepType::kSwap) { - return "swap"; - } - - if (type == mojom::LiFiStepType::kCross) { - return "cross"; - } - - if (type == mojom::LiFiStepType::kLiFi) { - return "lifi"; - } - - NOTREACHED_NORETURN(); + switch (type) { + case mojom::LiFiStepType::kSwap: + return "swap"; + case mojom::LiFiStepType::kCross: + return "cross"; + case mojom::LiFiStepType::kLiFi: + return "lifi"; + } + NOTREACHED(); } std::optional EncodeStepAction(mojom::LiFiActionPtr action) { diff --git a/components/brave_wallet/browser/tx_service.cc b/components/brave_wallet/browser/tx_service.cc index fd0a54b6314f..c71cf35110b5 100644 --- a/components/brave_wallet/browser/tx_service.cc +++ b/components/brave_wallet/browser/tx_service.cc @@ -58,8 +58,7 @@ std::string GetToAddressFromTxDataUnion( if (tx_data_union.is_zec_tx_data()) { return tx_data_union.get_zec_tx_data()->to; } - - NOTREACHED_NORETURN(); + NOTREACHED(); } size_t CalculatePendingTxCount( diff --git a/components/brave_wallet/browser/zcash/zcash_keyring.cc b/components/brave_wallet/browser/zcash/zcash_keyring.cc index 1c8ab747eaa8..81fc7508a983 100644 --- a/components/brave_wallet/browser/zcash/zcash_keyring.cc +++ b/components/brave_wallet/browser/zcash/zcash_keyring.cc @@ -9,6 +9,7 @@ #include #include "base/check.h" +#include "base/containers/to_vector.h" #include "brave/components/brave_wallet/common/common_utils.h" #include "brave/components/brave_wallet/common/hash_utils.h" #include "brave/components/brave_wallet/common/zcash_utils.h" @@ -72,7 +73,7 @@ std::optional> ZCashKeyring::GetPubkeyHash( return std::nullopt; } - return Hash160(hd_key_base->GetPublicKeyBytes()); + return base::ToVector(Hash160(hd_key_base->GetPublicKeyBytes())); } #if BUILDFLAG(ENABLE_ORCHARD) diff --git a/components/brave_wallet/common/common_utils.cc b/components/brave_wallet/common/common_utils.cc index 72abb2122b27..b986803bad4d 100644 --- a/components/brave_wallet/common/common_utils.cc +++ b/components/brave_wallet/common/common_utils.cc @@ -194,7 +194,7 @@ mojom::CoinType GetCoinForKeyring(mojom::KeyringId keyring_id) { return mojom::CoinType::ZEC; } - NOTREACHED_NORETURN() << "Unknown keyring: " << keyring_id; + NOTREACHED() << "Unknown keyring: " << keyring_id; } mojom::CoinType GetCoinTypeFromTxDataUnion( @@ -219,7 +219,7 @@ mojom::CoinType GetCoinTypeFromTxDataUnion( return mojom::CoinType::ZEC; } - NOTREACHED_NORETURN(); + NOTREACHED(); } GURL GetActiveEndpointUrl(const mojom::NetworkInfo& chain) { @@ -303,9 +303,8 @@ std::vector GetSupportedKeyringsForNetwork( } else { return {mojom::KeyringId::kZCashTestnet}; } - default: - NOTREACHED_NORETURN(); } + NOTREACHED(); } mojom::AccountIdPtr MakeAccountId(mojom::CoinType coin, @@ -367,7 +366,7 @@ std::string GetNetworkForBitcoinKeyring(const mojom::KeyringId& keyring_id) { if (IsBitcoinTestnetKeyring(keyring_id)) { return mojom::kBitcoinTestnet; } - NOTREACHED_NORETURN(); + NOTREACHED(); } std::string GetNetworkForBitcoinAccount(const mojom::AccountIdPtr& account_id) { @@ -383,7 +382,7 @@ std::string GetNetworkForZCashKeyring(const mojom::KeyringId& keyring_id) { if (IsZCashTestnetKeyring(keyring_id)) { return mojom::kZCashTestnet; } - NOTREACHED_NORETURN(); + NOTREACHED(); } bool IsHTTPSOrLocalhostURL(const std::string& url_string) { diff --git a/components/brave_wallet/common/encoding_utils.cc b/components/brave_wallet/common/encoding_utils.cc index 3f86f60b73aa..f627c7e8a057 100644 --- a/components/brave_wallet/common/encoding_utils.cc +++ b/components/brave_wallet/common/encoding_utils.cc @@ -38,10 +38,6 @@ std::optional> Base58Decode(const std::string& str, return {}; } -std::string Base58Encode(const std::vector& bytes) { - return EncodeBase58(bytes); -} - std::string Base58Encode(base::span bytes) { return EncodeBase58(bytes); } diff --git a/components/brave_wallet/common/encoding_utils.h b/components/brave_wallet/common/encoding_utils.h index c69e65847ca2..82b0eeec024f 100644 --- a/components/brave_wallet/common/encoding_utils.h +++ b/components/brave_wallet/common/encoding_utils.h @@ -24,7 +24,6 @@ std::optional> Base58Decode(const std::string& str, int len, bool strict = true); // A bridge function to call EncodeBase58 in bitcoin-core. -std::string Base58Encode(const std::vector& bytes); std::string Base58Encode(base::span bytes); std::string Base58EncodeWithCheck(const std::vector& bytes); diff --git a/components/brave_wallet/common/eth_address.cc b/components/brave_wallet/common/eth_address.cc index 5eaa17a41729..2ef19dc05089 100644 --- a/components/brave_wallet/common/eth_address.cc +++ b/components/brave_wallet/common/eth_address.cc @@ -3,19 +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/. */ -#ifdef UNSAFE_BUFFERS_BUILD -// TODO(https://github.com/brave/brave-browser/issues/41661): Remove this and -// convert code to safer constructs. -#pragma allow_unsafe_buffers -#endif - #include "brave/components/brave_wallet/common/eth_address.h" #include -#include "base/check_op.h" +#include "base/containers/span.h" #include "base/logging.h" #include "base/ranges/algorithm.h" +#include "base/strings/strcat.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "brave/components/brave_wallet/common/hash_utils.h" @@ -39,18 +34,15 @@ bool EthAddress::operator!=(const EthAddress& other) const { } // static -EthAddress EthAddress::FromPublicKey(const std::vector& public_key) { +EthAddress EthAddress::FromPublicKey(base::span public_key) { + // TODO(apaymyshev): should be a fixed-size span. if (public_key.size() != 64) { VLOG(1) << __func__ << ": public key size should be 64 bytes"; return EthAddress(); } - std::vector hash = KeccakHash(public_key); - std::vector result(hash.end() - kEthAddressLength, hash.end()); - - DCHECK_EQ(result.size(), kEthAddressLength); - - return EthAddress(std::move(result)); + return EthAddress( + base::as_byte_span(KeccakHash(public_key)).last(kEthAddressLength)); } // static @@ -95,8 +87,7 @@ bool EthAddress::IsValidAddress(const std::string& input) { } std::string EthAddress::ToHex() const { - const std::string input(bytes_.begin(), bytes_.end()); - return ::brave_wallet::ToHex(input); + return ::brave_wallet::ToHex(bytes_); } // static @@ -121,21 +112,19 @@ std::optional EthAddress::ToEip1191ChecksumAddress( std::string EthAddress::ToChecksumAddress(uint256_t eip1191_chaincode) const { std::string result = "0x"; - std::string input; + std::string prefix; if (eip1191_chaincode == static_cast(30) || eip1191_chaincode == static_cast(31)) { // TODO(jocelyn): We will need to revise this if there are supported chains // with ID larger than uint64_t. - input += + prefix = base::NumberToString(static_cast(eip1191_chaincode)) + "0x"; } - input += std::string(ToHex().data() + 2); - - const std::string hash_str(KeccakHash(input).data() + 2); - const std::string address_str = - base::ToLowerASCII(base::HexEncode(bytes_.data(), bytes_.size())); + const std::string address_str = HexEncodeLower(bytes_); + const std::string hash_str = base::HexEncode( + KeccakHash(base::as_byte_span(base::StrCat({prefix, address_str})))); for (size_t i = 0; i < address_str.length(); ++i) { if (isdigit(address_str[i])) { diff --git a/components/brave_wallet/common/eth_address.h b/components/brave_wallet/common/eth_address.h index 1ec46ff55c1e..a4c89dfd1c43 100644 --- a/components/brave_wallet/common/eth_address.h +++ b/components/brave_wallet/common/eth_address.h @@ -20,7 +20,7 @@ class EthAddress { public: // public key must be uncompressed and no header byte so its length is 64 // bytes - static EthAddress FromPublicKey(const std::vector& public_key); + static EthAddress FromPublicKey(base::span public_key); // input should be a valid address with 20 bytes hex representation starting // with 0x static EthAddress FromHex(const std::string& input); diff --git a/components/brave_wallet/common/eth_request_helper.cc b/components/brave_wallet/common/eth_request_helper.cc index e721c156bb7a..7c2a48d80318 100644 --- a/components/brave_wallet/common/eth_request_helper.cc +++ b/components/brave_wallet/common/eth_request_helper.cc @@ -12,6 +12,7 @@ #include "base/base64.h" #include "base/compiler_specific.h" +#include "base/containers/to_vector.h" #include "base/json/json_reader.h" #include "base/json/json_writer.h" #include "base/ranges/algorithm.h" @@ -528,12 +529,12 @@ mojom::EthSignTypedDataPtr ParseEthSignTypedDataParams( result->meta = nullptr; } - result->domain_hash = domain_hash->first; + result->domain_hash = base::ToVector(domain_hash->first); if (!base::JSONWriter::Write(domain_hash->second, &result->domain_json)) { return nullptr; } - result->primary_hash = primary_hash->first; + result->primary_hash = base::ToVector(primary_hash->first); if (!base::JSONWriter::Write(primary_hash->second, &result->message_json)) { return nullptr; } diff --git a/components/brave_wallet/common/eth_sign_typed_data_helper.cc b/components/brave_wallet/common/eth_sign_typed_data_helper.cc index c2a40825bc56..dcbedfd7688b 100644 --- a/components/brave_wallet/common/eth_sign_typed_data_helper.cc +++ b/components/brave_wallet/common/eth_sign_typed_data_helper.cc @@ -3,16 +3,10 @@ * 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/. */ -#ifdef UNSAFE_BUFFERS_BUILD -// TODO(https://github.com/brave/brave-browser/issues/41661): Remove this and -// convert code to safer constructs. -#pragma allow_unsafe_buffers -#endif - #include "brave/components/brave_wallet/common/eth_sign_typed_data_helper.h" -#include #include +#include #include #include "base/containers/extend.h" @@ -53,7 +47,7 @@ void EthSignTypedDataHelper::SetVersion(Version version) { void EthSignTypedDataHelper::FindAllDependencyTypes( base::flat_map* known_types, - const std::string& anchor_type_name) const { + const std::string_view anchor_type_name) const { DCHECK(!anchor_type_name.empty()); DCHECK(known_types); @@ -71,9 +65,9 @@ void EthSignTypedDataHelper::FindAllDependencyTypes( } const std::string* type = field.GetDict().FindString("type"); if (type) { - auto type_split = base::SplitString(*type, "[", base::KEEP_WHITESPACE, - base::SPLIT_WANT_ALL); - std::string lookup_type = *type; + const auto type_split = base::SplitStringPiece( + *type, "[", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL); + std::string_view lookup_type = *type; if (type_split.size() == 2) { lookup_type = type_split[0]; } @@ -87,7 +81,7 @@ void EthSignTypedDataHelper::FindAllDependencyTypes( std::string EthSignTypedDataHelper::EncodeType( const base::Value& type, - const std::string& type_name) const { + const std::string_view type_name) const { if (!type.is_list()) { return std::string(); } @@ -113,7 +107,7 @@ std::string EthSignTypedDataHelper::EncodeType( } std::string EthSignTypedDataHelper::EncodeTypes( - const std::string& primary_type_name) const { + const std::string_view primary_type_name) const { std::string result; base::flat_map types_map; @@ -132,15 +126,14 @@ std::string EthSignTypedDataHelper::EncodeTypes( return result; } -std::vector EthSignTypedDataHelper::GetTypeHash( - const std::string& primary_type_name) const { - const std::string type_hash = - KeccakHash(EncodeTypes(primary_type_name), false); - return std::vector(type_hash.begin(), type_hash.end()); +EthSignTypedDataHelper::Eip712HashArray EthSignTypedDataHelper::GetTypeHash( + const std::string_view primary_type_name) const { + return KeccakHash(base::as_byte_span(EncodeTypes(primary_type_name))); } -std::optional, base::Value::Dict>> -EthSignTypedDataHelper::HashStruct(const std::string& primary_type_name, +std::optional< + std::pair> +EthSignTypedDataHelper::HashStruct(const std::string_view primary_type_name, const base::Value::Dict& data) const { auto encoded_data = EncodeData(primary_type_name, data); if (!encoded_data) { @@ -153,16 +146,17 @@ EthSignTypedDataHelper::HashStruct(const std::string& primary_type_name, // Encode the json data by the its type defined in json custom types starting // from primary type. See unittests for some examples. std::optional, base::Value::Dict>> -EthSignTypedDataHelper::EncodeData(const std::string& primary_type_name, +EthSignTypedDataHelper::EncodeData(const std::string_view primary_type_name, const base::Value::Dict& data) const { const auto* primary_type = types_.FindList(primary_type_name); if (!primary_type) { return std::nullopt; } std::vector result; + // 32 bytes for type hash and for each item in schema. + result.reserve(Eip712HashArray().size() * (1 + primary_type->size())); - const std::vector type_hash = GetTypeHash(primary_type_name); - result.insert(result.end(), type_hash.begin(), type_hash.end()); + base::Extend(result, GetTypeHash(primary_type_name)); base::Value::Dict sanitized_data; @@ -179,27 +173,27 @@ EthSignTypedDataHelper::EncodeData(const std::string& primary_type_name, if (!encoded_field) { return std::nullopt; } - result.insert(result.end(), encoded_field->begin(), encoded_field->end()); + base::Extend(result, *encoded_field); sanitized_data.Set(*name_str, value->Clone()); } else { if (version_ == Version::kV4) { - for (size_t i = 0; i < 32; ++i) { - result.push_back(0); - } + // https://github.com/MetaMask/eth-sig-util/blob/66a8c0935c14d6ef80b583148d0c758c198a9c4a/src/sign-typed-data.ts#L248 + // Insert null line in case of a missing field. + result.insert(result.end(), 32, 0); } } } + return std::make_pair(result, std::move(sanitized_data)); } // Encode each field of a custom type, if a field is also a custom type it // will call EncodeData recursively until it reaches an atomic type -std::optional> EthSignTypedDataHelper::EncodeField( - const std::string& type, - const base::Value& value) const { +std::optional +EthSignTypedDataHelper::EncodeField(const std::string_view type, + const base::Value& value) const { // ES6 section 20.1.2.6 Number.MAX_SAFE_INTEGER constexpr double kMaxSafeInteger = static_cast(kMaxSafeIntegerUint64); - std::vector result; if (type.ends_with(']')) { if (version_ != Version::kV4) { @@ -209,34 +203,31 @@ std::optional> EthSignTypedDataHelper::EncodeField( if (!value.is_list()) { return std::nullopt; } - auto type_split = base::SplitString(type, "[", base::KEEP_WHITESPACE, - base::SPLIT_WANT_ALL); + const auto type_split = base::SplitStringPiece( + type, "[", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL); if (type_split.size() != 2) { return std::nullopt; } - const std::string array_type = type_split[0]; std::vector array_result; for (const auto& item : value.GetList()) { - auto encoded_item = EncodeField(array_type, item); + auto encoded_item = EncodeField(type_split[0], item); if (!encoded_item) { return std::nullopt; } - array_result.insert(array_result.end(), encoded_item->begin(), - encoded_item->end()); + base::Extend(array_result, *encoded_item); } - auto array_hash = KeccakHash(array_result); - result.insert(result.end(), array_hash.begin(), array_hash.end()); - } else if (type == "string") { + return KeccakHash(array_result); + } + + if (type == "string") { const std::string* value_str = value.GetIfString(); if (!value_str) { return std::nullopt; } - const std::string encoded_value = KeccakHash(*value_str, false); - const std::vector encoded_value_bytes(encoded_value.begin(), - encoded_value.end()); - result.insert(result.end(), encoded_value_bytes.begin(), - encoded_value_bytes.end()); - } else if (type == "bytes") { + return KeccakHash(base::as_byte_span(*value_str)); + } + + if (type == "bytes") { const std::string* value_str = value.GetIfString(); if (!value_str || (!value_str->empty() && !IsValidHexString(*value_str))) { return std::nullopt; @@ -245,19 +236,21 @@ std::optional> EthSignTypedDataHelper::EncodeField( if (!value_str->empty()) { CHECK(PrefixedHexStringToBytes(*value_str, &bytes)); } - const std::vector encoded_value = KeccakHash(bytes); - result.insert(result.end(), encoded_value.begin(), encoded_value.end()); - } else if (type == "bool") { + return KeccakHash(bytes); + } + + if (type == "bool") { std::optional value_bool = value.GetIfBool(); if (!value_bool) { return std::nullopt; } - uint256_t encoded_value = (uint256_t)*value_bool; - // Append the encoded value to byte array result in big endian order - for (int i = 256 - 8; i >= 0; i -= 8) { - result.push_back(static_cast((encoded_value >> i) & 0xFF)); - } - } else if (type == "address") { + + Eip712HashArray result = {}; + result.back() = value_bool.value() ? 1 : 0; + return result; + } + + if (type == "address") { const std::string* value_str = value.GetIfString(); if (!value_str || !IsValidHexString(*value_str)) { return std::nullopt; @@ -267,13 +260,15 @@ std::optional> EthSignTypedDataHelper::EncodeField( if (address.size() != 20u) { return std::nullopt; } - for (size_t i = 0; i < 256 - 160; i += 8) { - result.push_back(0); - } - result.insert(result.end(), address.begin(), address.end()); - } else if (type.starts_with("bytes")) { + + Eip712HashArray result = {}; + base::as_writable_byte_span(result).last(20u).copy_from(address); + return result; + } + + if (type.starts_with("bytes")) { unsigned num_bits; - if (!base::StringToUint(type.data() + 5, &num_bits) || num_bits > 32) { + if (!base::StringToUint(type.substr(5), &num_bits) || num_bits > 32) { return std::nullopt; } const std::string* value_str = value.GetIfString(); @@ -285,14 +280,15 @@ std::optional> EthSignTypedDataHelper::EncodeField( if (bytes.size() > 32) { return std::nullopt; } - result.insert(result.end(), bytes.begin(), bytes.end()); - for (size_t i = 0; i < 32u - bytes.size(); ++i) { - result.push_back(0); - } - } else if (type.starts_with("uint")) { + Eip712HashArray result = {}; + base::as_writable_byte_span(result).copy_prefix_from(bytes); + return result; + } + + if (type.starts_with("uint")) { // uint8 to uint256 in steps of 8 unsigned num_bits; - if (!base::StringToUint(type.data() + 4, &num_bits) || + if (!base::StringToUint(type.substr(4), &num_bits) || !ValidSolidityBits(num_bits)) { return std::nullopt; } @@ -324,14 +320,17 @@ std::optional> EthSignTypedDataHelper::EncodeField( return std::nullopt; } - // Append the encoded value to byte array result in big endian order - for (int i = 256 - 8; i >= 0; i -= 8) { - result.push_back(static_cast((encoded_value >> i) & 0xFF)); - } - } else if (type.starts_with("int")) { + Eip712HashArray result = {}; + base::span(result).copy_from(base::byte_span_from_ref(encoded_value)); + base::ranges::reverse(result); + + return result; + } + + if (type.starts_with("int")) { // int8 to int256 in steps of 8 unsigned num_bits; - if (!base::StringToUint(type.data() + 3, &num_bits) || + if (!base::StringToUint(type.substr(3), &num_bits) || !ValidSolidityBits(num_bits)) { return std::nullopt; } @@ -364,32 +363,32 @@ std::optional> EthSignTypedDataHelper::EncodeField( return std::nullopt; } - // Append the encoded value to byte array result in big endian order - for (int i = 256 - 8; i >= 0; i -= 8) { - result.push_back(static_cast((encoded_value >> i) & 0xFF)); - } - } else { - if (!value.is_dict()) { - return std::nullopt; - } - auto encoded_data = EncodeData(type, value.GetDict()); - if (!encoded_data) { - return std::nullopt; - } - std::vector encoded_value = KeccakHash(encoded_data->first); + Eip712HashArray result = {}; + base::span(result).copy_from(base::byte_span_from_ref(encoded_value)); + base::ranges::reverse(result); - result.insert(result.end(), encoded_value.begin(), encoded_value.end()); + return result; } - return result; + + if (!value.is_dict()) { + return std::nullopt; + } + auto encoded_data = EncodeData(type, value.GetDict()); + if (!encoded_data) { + return std::nullopt; + } + return KeccakHash(encoded_data->first); } -std::optional, base::Value::Dict>> +std::optional< + std::pair> EthSignTypedDataHelper::GetTypedDataDomainHash( const base::Value::Dict& domain) const { return HashStruct("EIP712Domain", domain); } -std::optional, base::Value::Dict>> +std::optional< + std::pair> EthSignTypedDataHelper::GetTypedDataPrimaryHash( const std::string& primary_type_name, const base::Value::Dict& message) const { @@ -397,7 +396,8 @@ EthSignTypedDataHelper::GetTypedDataPrimaryHash( } // static -std::vector EthSignTypedDataHelper::GetTypedDataMessageToSign( +EthSignTypedDataHelper::Eip712HashArray +EthSignTypedDataHelper::GetTypedDataMessageToSign( base::span domain_hash, base::span primary_hash) { DCHECK(!domain_hash.empty()); diff --git a/components/brave_wallet/common/eth_sign_typed_data_helper.h b/components/brave_wallet/common/eth_sign_typed_data_helper.h index f4655c33328d..97949f031b70 100644 --- a/components/brave_wallet/common/eth_sign_typed_data_helper.h +++ b/components/brave_wallet/common/eth_sign_typed_data_helper.h @@ -16,6 +16,7 @@ #include "base/containers/span.h" #include "base/gtest_prod_util.h" #include "base/values.h" +#include "brave/components/brave_wallet/common/hash_utils.h" namespace brave_wallet { @@ -23,6 +24,7 @@ namespace brave_wallet { // https://eips.ethereum.org/EIPS/eip-712 class EthSignTypedDataHelper { public: + using Eip712HashArray = KeccakHashArray; enum class Version { kV3, kV4 }; static std::unique_ptr Create(base::Value::Dict types, Version version); @@ -34,20 +36,20 @@ class EthSignTypedDataHelper { void SetTypes(base::Value::Dict types); void SetVersion(Version version); - std::vector GetTypeHash(const std::string& primary_type_name) const; - std::optional, base::Value::Dict>> HashStruct( - const std::string& primary_type_name, + Eip712HashArray GetTypeHash(const std::string_view primary_type_name) const; + std::optional> HashStruct( + const std::string_view primary_type_name, const base::Value::Dict& data) const; std::optional, base::Value::Dict>> EncodeData( - const std::string& primary_type_name, + const std::string_view primary_type_name, const base::Value::Dict& data) const; - static std::vector GetTypedDataMessageToSign( + static Eip712HashArray GetTypedDataMessageToSign( base::span domain_hash, base::span primary_hash); - std::optional, base::Value::Dict>> + std::optional> GetTypedDataPrimaryHash(const std::string& primary_type_name, const base::Value::Dict& message) const; - std::optional, base::Value::Dict>> + std::optional> GetTypedDataDomainHash(const base::Value::Dict& domain) const; private: @@ -61,14 +63,13 @@ class EthSignTypedDataHelper { void FindAllDependencyTypes( base::flat_map* known_types, - const std::string& anchor_type_name) const; + const std::string_view anchor_type_name) const; std::string EncodeType(const base::Value& type, - const std::string& type_name) const; - std::string EncodeTypes(const std::string& primary_type_name) const; + const std::string_view type_name) const; + std::string EncodeTypes(const std::string_view primary_type_name) const; - std::optional> EncodeField( - const std::string& type, - const base::Value& value) const; + std::optional EncodeField(const std::string_view type_string, + const base::Value& value) const; base::Value::Dict types_; Version version_; diff --git a/components/brave_wallet/common/f4_jumble.cc b/components/brave_wallet/common/f4_jumble.cc index 429a3403fe51..07b1317758ea 100644 --- a/components/brave_wallet/common/f4_jumble.cc +++ b/components/brave_wallet/common/f4_jumble.cc @@ -66,17 +66,10 @@ std::vector Blake2b(base::span payload, FillBlake2bParamPersonal(personalizer, params); - if (blake2b_init_param(&blake_state, ¶ms) != 0) { - NOTREACHED_NORETURN(); - } - if (blake2b_update(&blake_state, payload.data(), payload.size()) != 0) { - NOTREACHED_NORETURN(); - } + CHECK_EQ(blake2b_init_param(&blake_state, ¶ms), 0); + CHECK_EQ(blake2b_update(&blake_state, payload.data(), payload.size()), 0); std::vector result(digest_len); - if (blake2b_final(&blake_state, result.data(), digest_len) != 0) { - NOTREACHED_NORETURN(); - } - + CHECK_EQ(blake2b_final(&blake_state, result.data(), digest_len), 0); return result; } diff --git a/components/brave_wallet/common/fil_address_unittest.cc b/components/brave_wallet/common/fil_address_unittest.cc index f7cb9f83699d..83e4155f3380 100644 --- a/components/brave_wallet/common/fil_address_unittest.cc +++ b/components/brave_wallet/common/fil_address_unittest.cc @@ -283,7 +283,7 @@ TEST(FilAddressUnitTest, GetBytes) { "4t" "pa4mvigcrayh4a"); EXPECT_EQ( - ToHex(base::make_span(fil_address.GetBytes())), + ToHex(fil_address.GetBytes()), base::ToLowerASCII("0x03B5774F3D8546D3E797653A5423EFFA7AB06D4CD3587" "697D3647798D9FE739167EBEAF1EF" "053F957A7678EE4DE0E32A83")); diff --git a/components/brave_wallet/common/hash_utils.cc b/components/brave_wallet/common/hash_utils.cc index f66a178c0cc1..7bfb02ec89f3 100644 --- a/components/brave_wallet/common/hash_utils.cc +++ b/components/brave_wallet/common/hash_utils.cc @@ -8,8 +8,6 @@ #include #include -#include "base/check.h" -#include "base/compiler_specific.h" #include "base/containers/adapters.h" #include "base/containers/span.h" #include "base/ranges/algorithm.h" @@ -31,47 +29,34 @@ std::array ConcatArrays(const std::array& arr1, } } // namespace -std::string KeccakHash(const std::string& input, bool to_hex) { - std::vector bytes(input.begin(), input.end()); - std::vector result = KeccakHash(bytes); - std::string result_str(result.begin(), result.end()); - return to_hex ? ToHex(result_str) : result_str; -} - -std::vector KeccakHash(const std::vector& input) { - auto hash = ethash_keccak256(input.data(), input.size()); - return UNSAFE_TODO(std::vector(hash.bytes, hash.bytes + 32)); -} - -eth_abi::Bytes32 KeccakHashBytes32(base::span input) { +KeccakHashArray KeccakHash(base::span input) { auto hash = ethash_keccak256(input.data(), input.size()); - eth_abi::Bytes32 result; + KeccakHashArray result; static_assert(sizeof(result) == sizeof(hash.bytes)); base::ranges::copy(hash.bytes, result.begin()); return result; } std::string GetFunctionHash(const std::string& input) { - std::string result = KeccakHash(input); - return result.substr(0, std::min(static_cast(10), result.length())); + return ToHex(GetFunctionHashBytes4(input)); } eth_abi::Bytes4 GetFunctionHashBytes4(const std::string& input) { - auto full_hash = KeccakHashBytes32(base::as_bytes(base::make_span(input))); eth_abi::Bytes4 bytes_result; - base::ranges::copy(base::make_span(full_hash).first<4>(), - bytes_result.begin()); + base::span(bytes_result) + .copy_from( + base::as_byte_span(KeccakHash(base::as_byte_span(input))).first<4>()); return bytes_result; } eth_abi::Bytes32 Namehash(const std::string& name) { eth_abi::Bytes32 hash = {}; - std::vector labels = - SplitString(name, ".", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); + auto labels = SplitStringPiece(name, ".", base::KEEP_WHITESPACE, + base::SPLIT_WANT_NONEMPTY); for (const auto& label : base::Reversed(labels)) { - auto label_hash = KeccakHashBytes32(base::as_bytes(base::make_span(label))); - hash = KeccakHashBytes32(ConcatArrays(hash, label_hash)); + auto label_hash = KeccakHash(base::as_byte_span(label)); + hash = KeccakHash(ConcatArrays(hash, label_hash)); } return hash; } @@ -80,15 +65,11 @@ SHA256HashArray DoubleSHA256Hash(base::span input) { return crypto::SHA256Hash(crypto::SHA256Hash(input)); } -std::vector Hash160(base::span input) { - std::vector result(CRIPEMD160::OUTPUT_SIZE); - - std::array sha256hash = - crypto::SHA256Hash(input); - DCHECK(!sha256hash.empty()); +Ripemd160HashArray Hash160(base::span input) { + Ripemd160HashArray result = {}; CRIPEMD160() - .Write(sha256hash.data(), sha256hash.size()) + .Write(crypto::SHA256Hash(input).data(), crypto::kSHA256Length) .Finalize(result.data()); return result; diff --git a/components/brave_wallet/common/hash_utils.h b/components/brave_wallet/common/hash_utils.h index 63d093548b10..2af8e272f15e 100644 --- a/components/brave_wallet/common/hash_utils.h +++ b/components/brave_wallet/common/hash_utils.h @@ -8,17 +8,20 @@ #include #include -#include #include "brave/components/brave_wallet/common/eth_abi_utils.h" #include "crypto/sha2.h" namespace brave_wallet { -// Equivalent to web3.utils.keccak256(string) -std::string KeccakHash(const std::string& input, bool to_hex = true); -std::vector KeccakHash(const std::vector& input); -eth_abi::Bytes32 KeccakHashBytes32(base::span input); +inline constexpr size_t kKeccakHashLength = 32; +inline constexpr size_t kRipemd160HashLength = 20; + +using KeccakHashArray = std::array; +using SHA256HashArray = std::array; +using Ripemd160HashArray = std::array; + +KeccakHashArray KeccakHash(base::span input); // Returns the hex encoding of the first 4 bytes of the hash. // For example: keccak('balanceOf(address)') @@ -31,11 +34,10 @@ eth_abi::Bytes4 GetFunctionHashBytes4(const std::string& input); eth_abi::Bytes32 Namehash(const std::string& name); // sha256(sha256(input)) -using SHA256HashArray = std::array; SHA256HashArray DoubleSHA256Hash(base::span input); // ripemd160(sha256(input)) -std::vector Hash160(base::span input); +Ripemd160HashArray Hash160(base::span input); } // namespace brave_wallet diff --git a/components/brave_wallet/common/hash_utils_unittest.cc b/components/brave_wallet/common/hash_utils_unittest.cc index 55da6011d88c..587b4740a162 100644 --- a/components/brave_wallet/common/hash_utils_unittest.cc +++ b/components/brave_wallet/common/hash_utils_unittest.cc @@ -7,6 +7,7 @@ #include +#include "base/containers/span.h" #include "brave/components/brave_wallet/common/hex_utils.h" #include "testing/gtest/include/gtest/gtest.h" @@ -14,10 +15,10 @@ namespace brave_wallet { TEST(HashUtilsUnitTest, KeccakHash) { ASSERT_EQ( - KeccakHash(""), + ToHex(KeccakHash({})), "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"); ASSERT_EQ( - KeccakHash("hello world"), + ToHex(KeccakHash(base::byte_span_from_cstring("hello world"))), "0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad"); } diff --git a/components/brave_wallet/common/hex_utils.cc b/components/brave_wallet/common/hex_utils.cc index 9cf037c0c645..ed543bd98d31 100644 --- a/components/brave_wallet/common/hex_utils.cc +++ b/components/brave_wallet/common/hex_utils.cc @@ -31,10 +31,6 @@ std::string ToHex(base::span data) { // Returns a hex string representation of a binary buffer. The returned hex // string will be in lower case, without the 0x prefix. -std::string HexEncodeLower(const void* bytes, size_t size) { - return base::ToLowerASCII(base::HexEncode(bytes, size)); -} - std::string HexEncodeLower(base::span bytes) { return base::ToLowerASCII(base::HexEncode(bytes)); } diff --git a/components/brave_wallet/common/hex_utils.h b/components/brave_wallet/common/hex_utils.h index e8559690f2c1..831792f8bbc7 100644 --- a/components/brave_wallet/common/hex_utils.h +++ b/components/brave_wallet/common/hex_utils.h @@ -16,12 +16,12 @@ namespace brave_wallet { // Equivalent to web3.utils.toHex(string); +// TODO(apaymyshev): rename it to To0xHex or something like that. std::string ToHex(const std::string& data); std::string ToHex(base::span data); // Returns a hex string representation of a binary buffer. The returned hex // string will be in lower case, without the 0x prefix. -std::string HexEncodeLower(const void* bytes, size_t size); std::string HexEncodeLower(base::span bytes); // Determines if the passed in hex string is valid diff --git a/components/brave_wallet/common/hex_utils_unittest.cc b/components/brave_wallet/common/hex_utils_unittest.cc index e6f445bc99f6..554e249c7602 100644 --- a/components/brave_wallet/common/hex_utils_unittest.cc +++ b/components/brave_wallet/common/hex_utils_unittest.cc @@ -9,7 +9,7 @@ #include #include -#include "base/logging.h" +#include "base/containers/span.h" #include "testing/gtest/include/gtest/gtest.h" namespace brave_wallet { @@ -18,8 +18,7 @@ TEST(HexUtilsUnitTest, ToHex) { const std::string_view str = "hello world"; ASSERT_EQ(ToHex(""), "0x0"); ASSERT_EQ(ToHex(std::string(str)), "0x68656c6c6f20776f726c64"); - ASSERT_EQ(ToHex(base::as_bytes(base::make_span(str))), - "0x68656c6c6f20776f726c64"); + ASSERT_EQ(ToHex(base::as_byte_span(str)), "0x68656c6c6f20776f726c64"); ASSERT_EQ(ToHex(std::vector()), "0x0"); ASSERT_EQ(ToHex(std::vector(str.begin(), str.end())), @@ -28,9 +27,7 @@ TEST(HexUtilsUnitTest, ToHex) { TEST(HexUtilsUnitTest, HexEncodeLower) { std::string test_string = "hello world"; - ASSERT_EQ(HexEncodeLower(base::as_bytes(base::make_span(test_string))), - "68656c6c6f20776f726c64"); - ASSERT_EQ(HexEncodeLower(test_string.data(), test_string.size()), + ASSERT_EQ(HexEncodeLower(base::as_byte_span(test_string)), "68656c6c6f20776f726c64"); } diff --git a/components/brave_wallet/common/zcash_utils.cc b/components/brave_wallet/common/zcash_utils.cc index 997ec72b76d9..e0fa83732668 100644 --- a/components/brave_wallet/common/zcash_utils.cc +++ b/components/brave_wallet/common/zcash_utils.cc @@ -10,6 +10,7 @@ #include #include +#include "base/containers/extend.h" #include "base/containers/span.h" #include "base/numerics/byte_conversions.h" #include "base/types/expected.h" @@ -39,7 +40,7 @@ std::array GetPaddedHRP(bool is_testnet) { "Wrong kPaddedHrpSize size"); std::string hrp = is_testnet ? kTestnetHRP : kMainnetHRP; std::array padded_hrp = {}; - base::ranges::copy(base::make_span(hrp), padded_hrp.begin()); + base::ranges::copy(base::as_byte_span(hrp), padded_hrp.begin()); return padded_hrp; } @@ -189,8 +190,8 @@ std::string PubkeyToTransparentAddress(base::span pubkey, bool testnet) { std::vector result = GetNetworkPrefix(testnet); - std::vector data_part = Hash160(pubkey); - result.insert(result.end(), data_part.begin(), data_part.end()); + base::Extend(result, Hash160(pubkey)); + return Base58EncodeWithCheck(result); } @@ -282,18 +283,15 @@ std::optional> ExtractParsedAddresses( return std::nullopt; } - auto padded_hrp = GetPaddedHRP(is_testnet); + auto [body, hrp] = + base::span(*reverted).split_at(reverted->size() - kPaddedHrpSize); // Check that HRP is similar to the padded HRP - if (!std::equal(padded_hrp.begin(), padded_hrp.end(), - reverted->end() - kPaddedHrpSize)) { + if (GetPaddedHRP(is_testnet) != hrp) { return std::nullopt; } - auto parts = ParseUnifiedAddressBody( - base::make_span(*reverted).subspan(0, reverted->size() - kPaddedHrpSize)); - - return parts; + return ParseUnifiedAddressBody(body); } // https://zips.z.cash/zip-0316#encoding-of-unified-addresses diff --git a/components/brave_wallet/renderer/js_solana_provider.cc b/components/brave_wallet/renderer/js_solana_provider.cc index 3f7854d81980..3dc34b73218b 100644 --- a/components/brave_wallet/renderer/js_solana_provider.cc +++ b/components/brave_wallet/renderer/js_solana_provider.cc @@ -1165,7 +1165,7 @@ v8::Local JSSolanaProvider::CreateTransaction( versioned_transaction_module, kDeserialize, std::move(args)); } else { - NOTREACHED_NORETURN(); + NOTREACHED(); } if (transaction.IsEmpty()) { diff --git a/components/brave_wallet/renderer/resource_helper.cc b/components/brave_wallet/renderer/resource_helper.cc index e82dc4ffae2f..957f60551a82 100644 --- a/components/brave_wallet/renderer/resource_helper.cc +++ b/components/brave_wallet/renderer/resource_helper.cc @@ -35,14 +35,14 @@ std::optional LoadImageResourceAsDataUrl(const int id) { return std::nullopt; } - std::vector data; - if (!gfx::PNGCodec::EncodeBGRASkBitmap(image.AsBitmap(), - /*discard_transparency=*/false, - &data)) { + std::optional> data = + gfx::PNGCodec::EncodeBGRASkBitmap(image.AsBitmap(), + /*discard_transparency=*/false); + if (!data) { return std::nullopt; } - return "data:image/png;base64," + base::Base64Encode(data); + return "data:image/png;base64," + base::Base64Encode(*data); } } // namespace brave_wallet diff --git a/components/brave_webtorrent/browser/webtorrent_util.cc b/components/brave_webtorrent/browser/webtorrent_util.cc index d423fe60fc80..4d56e70c3b97 100644 --- a/components/brave_webtorrent/browser/webtorrent_util.cc +++ b/components/brave_webtorrent/browser/webtorrent_util.cc @@ -20,12 +20,13 @@ namespace webtorrent { bool TorrentFileNameMatched(const net::HttpResponseHeaders* headers) { - std::string disposition; - if (!headers->GetNormalizedHeader("Content-Disposition", &disposition)) { + std::optional disposition = + headers->GetNormalizedHeader("Content-Disposition"); + if (!disposition) { return false; } - net::HttpContentDisposition cd_headers(disposition, std::string()); + net::HttpContentDisposition cd_headers(*disposition, std::string()); if (base::EndsWith(cd_headers.filename(), ".torrent", base::CompareCase::INSENSITIVE_ASCII) || base::EndsWith(cd_headers.filename(), ".torrent\"", diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BraveSingleCategorySettings.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BraveSingleCategorySettings.java index 41cdb3c7cf00..99aeeca2a42d 100644 --- a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BraveSingleCategorySettings.java +++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BraveSingleCategorySettings.java @@ -9,7 +9,6 @@ import org.chromium.base.BraveReflectionUtil; import org.chromium.build.annotations.UsedByReflection; -import org.chromium.content_public.browser.BrowserContextHandle; @UsedByReflection("brave_site_settings_preferences.xml") public class BraveSingleCategorySettings extends BaseSiteSettingsFragment @@ -19,12 +18,12 @@ public class BraveSingleCategorySettings extends BaseSiteSettingsFragment @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {} - public String getAddExceptionDialogMessage() { - BrowserContextHandle browserContextHandle = - getSiteSettingsDelegate().getBrowserContextHandle(); + public int getAddExceptionDialogMessageResourceId() { int resource = 0; - SiteSettingsCategory mCategory = (SiteSettingsCategory) BraveReflectionUtil.getField( - SingleCategorySettings.class, "mCategory", this); + SiteSettingsCategory mCategory = + (SiteSettingsCategory) + BraveReflectionUtil.getField( + SingleCategorySettings.class, "mCategory", this); if (mCategory.getType() == SiteSettingsCategory.Type.AUTOPLAY) { resource = R.string.website_settings_add_site_description_autoplay; @@ -33,21 +32,23 @@ public String getAddExceptionDialogMessage() { } else if (mCategory.getType() == SiteSettingsCategory.Type.BRAVE_LOCALHOST_ACCESS) { resource = R.string.website_settings_localhost_allow_exceptions; } else { - return (String) + return (int) BraveReflectionUtil.invokeMethod( - SingleCategorySettings.class, this, "getAddExceptionDialogMessage"); + SingleCategorySettings.class, + this, + "getAddExceptionDialogMessageResourceId"); } assert resource > 0; - return getString(resource); + return resource; } public void resetList() { BraveReflectionUtil.invokeMethod(SingleCategorySettings.class, this, "resetList"); - BrowserContextHandle browserContextHandle = - getSiteSettingsDelegate().getBrowserContextHandle(); boolean exception = false; - SiteSettingsCategory mCategory = (SiteSettingsCategory) BraveReflectionUtil.getField( - SingleCategorySettings.class, "mCategory", this); + SiteSettingsCategory mCategory = + (SiteSettingsCategory) + BraveReflectionUtil.getField( + SingleCategorySettings.class, "mCategory", this); if (mCategory.getType() == SiteSettingsCategory.Type.AUTOPLAY || mCategory.getType() == SiteSettingsCategory.Type.BRAVE_GOOGLE_SIGN_IN @@ -55,9 +56,14 @@ public void resetList() { exception = true; } if (exception) { - getPreferenceScreen().addPreference( - new AddExceptionPreference(getPreferenceManager().getContext(), - ADD_EXCEPTION_KEY, getAddExceptionDialogMessage(), mCategory, this)); + getPreferenceScreen() + .addPreference( + new AddExceptionPreference( + getPreferenceManager().getContext(), + ADD_EXCEPTION_KEY, + getString(getAddExceptionDialogMessageResourceId()), + mCategory, + this)); } } diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BraveSiteSettingsPreferencesBase.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BraveSiteSettingsPreferencesBase.java index 3c53b5deef92..4c02a2c10bde 100644 --- a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BraveSiteSettingsPreferencesBase.java +++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BraveSiteSettingsPreferencesBase.java @@ -16,8 +16,6 @@ public class BraveSiteSettingsPreferencesBase extends BaseSiteSettingsFragment { private static final String ADS_KEY = "ads"; private static final String BACKGROUND_SYNC_KEY = "background_sync"; - private static final String PLAY_YT_VIDEO_IN_BROWSER_KEY = "play_yt_video_in_browser"; - private static final String DESKTOP_MODE_KEY = "desktop_mode"; private static final String IDLE_DETECTION = "idle_detection"; private final HashMap mRemovedPreferences = new HashMap<>(); diff --git a/components/browsing_data_strings.grdp b/components/browsing_data_strings.grdp index 104515d7564a..79f642e2ca78 100644 --- a/components/browsing_data_strings.grdp +++ b/components/browsing_data_strings.grdp @@ -94,10 +94,10 @@ None - + {COUNT, plural, - =1 {1 credit card} - other {# credit cards}} + =1 {1 payment method} + other {# payment methods}} {COUNT, plural, @@ -119,28 +119,28 @@ =1 {1 other suggestion} other {# other suggestions}} - + {COUNT, plural, =1 {1 other} other {# others}} - $12 credit cards (synced) + $12 payment methods (synced) - $12 credit cards, $21 address + $12 payment methods, $21 address - $12 credit cards, $21 address (synced) + $12 payment methods, $21 address (synced) - $12 credit cards, $21 address, $35 others + $12 payment methods, $21 address, $35 others - $12 credit cards, $21 address, $35 others (synced) + $12 payment methods, $21 address, $35 others (synced) - $12 credit cards; $21 suggestion (device only) + $12 payment methods; $21 suggestion (device only) This will sign you out of most websites. diff --git a/components/cached_flags/android/java/src/org/chromium/components/cached_flags/BraveCachedFlag.java b/components/cached_flags/android/java/src/org/chromium/components/cached_flags/BraveCachedFlag.java index e6d16ce1c98e..e7b777c550e8 100644 --- a/components/cached_flags/android/java/src/org/chromium/components/cached_flags/BraveCachedFlag.java +++ b/components/cached_flags/android/java/src/org/chromium/components/cached_flags/BraveCachedFlag.java @@ -31,6 +31,7 @@ public class BraveCachedFlag extends CachedFlag { } // Will be deleted in bytecode. Variable from the parent class will be used instead. + @SuppressWarnings("UnusedVariable") private boolean mDefaultValue; public BraveCachedFlag( diff --git a/components/facilitated_payments_strings.grdp b/components/facilitated_payments_strings.grdp index 6b61c7ec0d6e..7a1eac0bd605 100644 --- a/components/facilitated_payments_strings.grdp +++ b/components/facilitated_payments_strings.grdp @@ -47,13 +47,13 @@ To turn off Pix in Brave, go to your <link1>payment settings</link1> - + Payment methods available to be selected for proceeding with the payment. Keyboard hidden. - + Payment methods available to be selected for proceeding with the payment opened at full height. - + The bottom sheet is closed. diff --git a/components/filecoin/rs/BUILD.gn b/components/filecoin/rs/BUILD.gn index 09c5028b15f6..e13e0deab388 100644 --- a/components/filecoin/rs/BUILD.gn +++ b/components/filecoin/rs/BUILD.gn @@ -19,12 +19,12 @@ rust_static_library("rust_lib") { deps = [ "//brave/third_party/rust/blake2b_simd/v1:lib", "//brave/third_party/rust/bls_signatures/v0_12:lib", - "//brave/third_party/rust/cid/v0_10:lib", + "//brave/third_party/rust/cid/v0_11:lib", "//brave/third_party/rust/forest_bigint/v0_1:lib", - "//brave/third_party/rust/fvm_ipld_encoding/v0_4:lib", - "//brave/third_party/rust/fvm_shared/v3:lib", + "//brave/third_party/rust/fvm_ipld_encoding/v0_5:lib", + "//brave/third_party/rust/fvm_shared/v4:lib", "//brave/third_party/rust/libsecp256k1/v0_7:lib", - "//brave/third_party/rust/multihash/v0_18:lib", + "//brave/third_party/rust/multihash_codetable/v0_1:lib", "//brave/third_party/rust/thiserror/v1:lib", "//third_party/rust/base64/v0_13:lib", "//third_party/rust/serde/v1:lib", diff --git a/components/filecoin/rs/Cargo.toml b/components/filecoin/rs/Cargo.toml index 7237affaa2c8..f76ec5680270 100644 --- a/components/filecoin/rs/Cargo.toml +++ b/components/filecoin/rs/Cargo.toml @@ -9,16 +9,16 @@ license = "MPL-2.0" base64 = "0.13.0" bls-signatures = { version = "0.12", default-features = false, features = ["pairing"] } cxx = "1" -fvm_shared = { version = "3.10.0" } +fvm_shared = { version = "4.5.1" } libsecp256k1 = "0.7" num_bigint_chainsafe = { package = "forest_bigint", version = "0.1.2"} serde = { version = "^1.0.117", features = ["derive"] } serde_json = "^1.0.59" thiserror = "^1.0.30" blake2b_simd = "1" -cid = { version = "0.10", default-features = false } -multihash = { version = "0.18.0", default-features = false, features = [ "multihash-impl", "blake2b"] } -fvm_ipld_encoding = "0.4" +cid = { version = "^0.11.1", default-features = false } +multihash-codetable = { version = "0.1.4", default-features = false } +fvm_ipld_encoding = "0.5.1" [lib] name = "filecoin_cxx" diff --git a/components/filecoin/rs/src/signature.rs b/components/filecoin/rs/src/signature.rs index ab3f38fe1985..0a172254b5c1 100644 --- a/components/filecoin/rs/src/signature.rs +++ b/components/filecoin/rs/src/signature.rs @@ -7,14 +7,14 @@ use crate::message::MessageAPI; use blake2b_simd::Params; use bls_signatures::Serialize; use core::{array::TryFromSliceError, num::ParseIntError}; -use fvm_ipld_encoding::to_vec; use fvm_ipld_encoding::DAG_CBOR; -use fvm_shared::address::set_current_network; +use fvm_ipld_encoding::to_vec; use fvm_shared::address::Network; +use fvm_shared::address::set_current_network; use fvm_shared::crypto::signature::Signature; use fvm_shared::message::Message as UnsignedMessage; use libsecp256k1::util::{SECRET_KEY_SIZE, SIGNATURE_SIZE}; -use multihash::{Code, MultihashDigest}; +use multihash_codetable::{Code, MultihashDigest}; use thiserror::Error; pub struct PrivateKey(pub [u8; SECRET_KEY_SIZE]); diff --git a/components/ipfs/test/BUILD.gn b/components/ipfs/test/BUILD.gn index 73c749325ad3..f68d4092d435 100644 --- a/components/ipfs/test/BUILD.gn +++ b/components/ipfs/test/BUILD.gn @@ -18,6 +18,7 @@ source_set("brave_ipfs_unit_tests") { "//base/test:test_support", "//brave/components/ipfs", "//chrome/browser:browser", + "//chrome/browser/prefs", "//chrome/browser/sync:factories", "//chrome/browser/sync:sync", "//chrome/test:test_support", diff --git a/components/live_caption_strings.grdp b/components/live_caption_strings.grdp index a962d9f07b3f..5d9c677755fa 100644 --- a/components/live_caption_strings.grdp +++ b/components/live_caption_strings.grdp @@ -56,4 +56,7 @@ Failed to download $1Spanish + + Translating + diff --git a/components/management_strings.grdp b/components/management_strings.grdp index 426104c214a1..0bfe2a2d9469 100644 --- a/components/management_strings.grdp +++ b/components/management_strings.grdp @@ -463,15 +463,6 @@ Profile management - Your organization, $1manager.com, requires you to sign in using a specific profile - - - Your organization requires you to sign in using a specific profile. - - - To continue, sign in to $1alice@example.com, then setup a new profile - - - Sign in + Sign-in is required diff --git a/components/omnibox/browser/search_suggestions/query_check_utils.cc b/components/omnibox/browser/search_suggestions/query_check_utils.cc index cbee7f6092d9..db36ee6b732f 100644 --- a/components/omnibox/browser/search_suggestions/query_check_utils.cc +++ b/components/omnibox/browser/search_suggestions/query_check_utils.cc @@ -33,7 +33,7 @@ size_t GetPosForHashChars(char c) { return c - 'A' + 10 + 26; } - NOTREACHED_NORETURN(); + NOTREACHED(); } double GetHashProb(const std::string& query) { diff --git a/components/omnibox_strings.grdp b/components/omnibox_strings.grdp index d34cbd1ad709..d323923f3388 100644 --- a/components/omnibox_strings.grdp +++ b/components/omnibox_strings.grdp @@ -403,6 +403,9 @@ Search the web + + History + diff --git a/components/pdf_strings.grdp b/components/pdf_strings.grdp index 4308ecad43ad..fb8afc890b83 100644 --- a/components/pdf_strings.grdp +++ b/components/pdf_strings.grdp @@ -387,5 +387,8 @@ Extracting text in next few pages + + Extracting text from PDF... + diff --git a/components/permissions/contexts/brave_wallet_permission_context.cc b/components/permissions/contexts/brave_wallet_permission_context.cc index 21b0503f3ee9..46c34485b5d0 100644 --- a/components/permissions/contexts/brave_wallet_permission_context.cc +++ b/components/permissions/contexts/brave_wallet_permission_context.cc @@ -242,7 +242,7 @@ BraveWalletPermissionContext::GetAllowedAccounts( } const ContentSettingsType content_settings_type = - PermissionUtil::PermissionTypeToContentSettingTypeSafe(permission); + PermissionUtil::PermissionTypeToContentSettingsTypeSafe(permission); std::vector allowed_accounts; url::Origin origin = url::Origin::Create(rfh->GetLastCommittedURL()); @@ -295,7 +295,7 @@ bool BraveWalletPermissionContext::AddPermission( } const ContentSettingsType content_settings_type = - PermissionUtil::PermissionTypeToContentSettingTypeSafe(permission); + PermissionUtil::PermissionTypeToContentSettingsTypeSafe(permission); url::Origin origin_wallet_address; if (!brave_wallet::GetSubRequestOrigin( @@ -333,7 +333,7 @@ bool BraveWalletPermissionContext::HasPermission( } const ContentSettingsType content_settings_type = - PermissionUtil::PermissionTypeToContentSettingTypeSafe(permission); + PermissionUtil::PermissionTypeToContentSettingsTypeSafe(permission); url::Origin origin_wallet_address; if (!brave_wallet::GetSubRequestOrigin( @@ -363,7 +363,7 @@ bool BraveWalletPermissionContext::ResetPermission( } const ContentSettingsType content_settings_type = - PermissionUtil::PermissionTypeToContentSettingTypeSafe(permission); + PermissionUtil::PermissionTypeToContentSettingsTypeSafe(permission); url::Origin origin_wallet_address; if (!brave_wallet::GetSubRequestOrigin( @@ -383,7 +383,7 @@ BraveWalletPermissionContext::GetWebSitesWithPermission( blink::PermissionType permission, content::BrowserContext* context) { const ContentSettingsType content_settings_type = - PermissionUtil::PermissionTypeToContentSettingTypeSafe(permission); + PermissionUtil::PermissionTypeToContentSettingsTypeSafe(permission); HostContentSettingsMap* map = PermissionsClient::Get()->GetSettingsMap(context); diff --git a/components/privacy_sandbox/brave_privacy_sandbox_settings.cc b/components/privacy_sandbox/brave_privacy_sandbox_settings.cc index d382ab0c4c60..6a106e50bdae 100644 --- a/components/privacy_sandbox/brave_privacy_sandbox_settings.cc +++ b/components/privacy_sandbox/brave_privacy_sandbox_settings.cc @@ -162,7 +162,7 @@ bool BravePrivacySandboxSettings::IsSharedStorageSelectURLAllowed( return false; } -bool BravePrivacySandboxSettings::IsLocalUnpartitionedDataAccessAllowed( +bool BravePrivacySandboxSettings::IsFencedStorageReadAllowed( const url::Origin& top_frame_origin, const url::Origin& accessing_origin, content::RenderFrameHost* console_frame) const { diff --git a/components/privacy_sandbox/brave_privacy_sandbox_settings.h b/components/privacy_sandbox/brave_privacy_sandbox_settings.h index d37cc2a65d2c..9ec0617524a6 100644 --- a/components/privacy_sandbox/brave_privacy_sandbox_settings.h +++ b/components/privacy_sandbox/brave_privacy_sandbox_settings.h @@ -90,7 +90,7 @@ class BravePrivacySandboxSettings const url::Origin& accessing_origin, std::string* out_debug_message, bool* out_block_is_site_setting_specific) const override; - bool IsLocalUnpartitionedDataAccessAllowed( + bool IsFencedStorageReadAllowed( const url::Origin& top_frame_origin, const url::Origin& accessing_origin, content::RenderFrameHost* console_frame) const override; diff --git a/components/privacy_sandbox_chrome_strings.grdp b/components/privacy_sandbox_chrome_strings.grdp index 1937872ea06a..77ad6a2082e1 100644 --- a/components/privacy_sandbox_chrome_strings.grdp +++ b/components/privacy_sandbox_chrome_strings.grdp @@ -249,7 +249,7 @@ <a href="$1" aria-label="$2" aria-description="$3" target="_blank">Learn more</a> - + Learn more about managing your ad privacy in Brave. diff --git a/components/site_settings_strings.grdp b/components/site_settings_strings.grdp index 6e6e52079b98..8412223dfcc2 100644 --- a/components/site_settings_strings.grdp +++ b/components/site_settings_strings.grdp @@ -71,12 +71,15 @@ Camera use & movement ($11) - - Scrolling & zooming - scrolling & zooming + + Shared tabs + + + Scrolling & zooming + Clipboard @@ -198,14 +201,14 @@ embedded content - - File editing file editing + + Fonts diff --git a/components/subresource_filter_strings.grdp b/components/subresource_filter_strings.grdp index 3a2f601b5c44..f5e3c90e0e8f 100644 --- a/components/subresource_filter_strings.grdp +++ b/components/subresource_filter_strings.grdp @@ -4,13 +4,16 @@ Always allow ads on this site - - Ads blocked - This site shows intrusive or misleading ads. + + + Ads blocked + + + Ads blocked. diff --git a/components/supervised_user_strings.grdp b/components/supervised_user_strings.grdp index 1484ce8c0140..ac5c0fbb6853 100644 --- a/components/supervised_user_strings.grdp +++ b/components/supervised_user_strings.grdp @@ -71,12 +71,6 @@ Your parents can unblock it for you - - New: Family Link choices for Brave apply here - - - The settings your parent chose are now keeping you safer online - YouTube diff --git a/components/sync/service/brave_sync_service_impl_unittest.cc b/components/sync/service/brave_sync_service_impl_unittest.cc index f0b0b2e87af6..a2b29de761de 100644 --- a/components/sync/service/brave_sync_service_impl_unittest.cc +++ b/components/sync/service/brave_sync_service_impl_unittest.cc @@ -759,9 +759,8 @@ class BraveSyncServiceImplGACookiesTest primary_accountchange_event); }, this); - default: - NOTREACHED_NORETURN(); } + NOTREACHED(); } }; @@ -796,9 +795,8 @@ INSTANTIATE_TEST_SUITE_P( return "OnAccountsInCookieUpdated"; case GACookiesMethodType::kOnPrimaryAccountChanged: return "OnPrimaryAccountChanged"; - default: - NOTREACHED_NORETURN(); } + NOTREACHED(); }); } // namespace syncer diff --git a/components/version_ui_strings.grdp b/components/version_ui_strings.grdp index 68bf0db48533..ae58f6018732 100644 --- a/components/version_ui_strings.grdp +++ b/components/version_ui_strings.grdp @@ -87,7 +87,13 @@ Variations Seed Type - Command-line variations + Command-line Variations + + + Copy variations string + + + Copied variations string to clipboard diff --git a/ios/app/brave_core_main.mm b/ios/app/brave_core_main.mm index e28bdbe1b11c..b6d0e9690342 100644 --- a/ios/app/brave_core_main.mm +++ b/ios/app/brave_core_main.mm @@ -219,15 +219,14 @@ - (instancetype)initWithUserAgent:(NSString*)userAgent false); // Setup main browser - _browserList = BrowserListFactory::GetForBrowserState(_main_profile); + _browserList = BrowserListFactory::GetForProfile(_main_profile); _browser = Browser::Create(_main_profile, {}); _browserList->AddBrowser(_browser.get()); // Setup otr browser ProfileIOS* otr_last_used_profile = last_used_profile->GetOffTheRecordProfile(); - _otr_browserList = - BrowserListFactory::GetForBrowserState(otr_last_used_profile); + _otr_browserList = BrowserListFactory::GetForProfile(otr_last_used_profile); _otr_browser = Browser::Create(otr_last_used_profile, {}); _otr_browserList->AddBrowser(_otr_browser.get()); @@ -253,7 +252,7 @@ - (instancetype)initWithUserAgent:(NSString*)userAgent #if BUILDFLAG(IOS_CREDENTIAL_PROVIDER_ENABLED) if (IsCredentialProviderExtensionSupported()) { - CredentialProviderServiceFactory::GetForBrowserState(_main_profile); + CredentialProviderServiceFactory::GetForProfile(_main_profile); } #endif } @@ -274,14 +273,14 @@ - (void)dealloc { _webImageDownloader = nil; _otr_browserList = - BrowserListFactory::GetForBrowserState(_otr_browser->GetProfile()); + BrowserListFactory::GetForProfile(_otr_browser->GetProfile()); [_otr_browser->GetCommandDispatcher() prepareForShutdown]; _otr_browserList->RemoveBrowser(_otr_browser.get()); CloseAllWebStates(*_otr_browser->GetWebStateList(), WebStateList::CLOSE_NO_FLAGS); _otr_browser.reset(); - _browserList = BrowserListFactory::GetForBrowserState(_browser->GetProfile()); + _browserList = BrowserListFactory::GetForProfile(_browser->GetProfile()); [_browser->GetCommandDispatcher() prepareForShutdown]; _browserList->RemoveBrowser(_browser.get()); CloseAllWebStates(*_browser->GetWebStateList(), WebStateList::CLOSE_NO_FLAGS); @@ -381,10 +380,10 @@ - (BraveHistoryAPI*)historyAPI { - (BraveOpenTabsAPI*)openTabsAPI { if (!_openTabsAPI) { syncer::SyncService* sync_service_ = - SyncServiceFactory::GetForBrowserState(_main_profile); + SyncServiceFactory::GetForProfile(_main_profile); sync_sessions::SessionSyncService* session_sync_service_ = - SessionSyncServiceFactory::GetForBrowserState(_main_profile); + SessionSyncServiceFactory::GetForProfile(_main_profile); _openTabsAPI = [[BraveOpenTabsAPI alloc] initWithSyncService:sync_service_ @@ -396,7 +395,7 @@ - (BraveOpenTabsAPI*)openTabsAPI { - (BravePasswordAPI*)passwordAPI { if (!_passwordAPI) { scoped_refptr password_store_ = - IOSChromeProfilePasswordStoreFactory::GetForBrowserState( + IOSChromeProfilePasswordStoreFactory::GetForProfile( _main_profile, ServiceAccessType::EXPLICIT_ACCESS) .get(); @@ -426,7 +425,7 @@ - (BraveSyncAPI*)syncAPI { - (BraveSyncProfileServiceIOS*)syncProfileService { if (!_syncProfileService) { syncer::SyncService* sync_service_ = - SyncServiceFactory::GetForBrowserState(_main_profile); + SyncServiceFactory::GetForProfile(_main_profile); _syncProfileService = [[BraveSyncProfileServiceIOS alloc] initWithProfileSyncService:sync_service_]; } @@ -524,7 +523,7 @@ - (void)performFaviconsCleanup { return; } base::SequencedTaskRunner::GetCurrentDefault()->PostTask( - FROM_HERE, base::BindOnce(&UpdateFaviconsStorageForBrowserState, + FROM_HERE, base::BindOnce(&UpdateFaviconsStorageForProfile, browserState->AsWeakPtr(), /*fallback_to_google_server=*/false)); } diff --git a/ios/browser/api/bookmarks/exporter/bookmark_html_writer.cc b/ios/browser/api/bookmarks/exporter/bookmark_html_writer.cc index 3b39fdd02a38..a10298792212 100644 --- a/ios/browser/api/bookmarks/exporter/bookmark_html_writer.cc +++ b/ios/browser/api/bookmarks/exporter/bookmark_html_writer.cc @@ -457,8 +457,7 @@ BookmarkFaviconFetcher::BookmarkFaviconFetcher( void BookmarkFaviconFetcher::ExportBookmarks() { // bookmark_bar, mobile and other are children of the root node. - ExtractUrls( - ios::BookmarkModelFactory::GetForBrowserState(profile_)->root_node()); + ExtractUrls(ios::BookmarkModelFactory::GetForProfile(profile_)->root_node()); if (!bookmark_urls_.empty()) { FetchNextFavicon(); } else { @@ -486,7 +485,7 @@ void BookmarkFaviconFetcher::ExecuteWriter() { // for the duration of the write), as such we make a copy of the // BookmarkModel using BookmarkCodec then write from that. bookmarks::BookmarkModel* bookmark_model = - ios::BookmarkModelFactory::GetForBrowserState(profile_); + ios::BookmarkModelFactory::GetForProfile(profile_); BookmarkCodec codec; base::ThreadPool::PostTask( FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT}, @@ -508,7 +507,7 @@ bool BookmarkFaviconFetcher::FetchNextFavicon() { URLFaviconMap::const_iterator iter = favicons_map_->find(url); if (favicons_map_->end() == iter) { favicon::FaviconService* favicon_service = - ios::FaviconServiceFactory::GetForBrowserState( + ios::FaviconServiceFactory::GetForProfile( profile_, ServiceAccessType::EXPLICIT_ACCESS); favicon_service->GetRawFaviconForPageURL( GURL(url), {favicon_base::IconType::kFavicon}, gfx::kFaviconSize, diff --git a/ios/browser/api/bookmarks/importer/bookmarks_importer.mm b/ios/browser/api/bookmarks/importer/bookmarks_importer.mm index 9f7a528d3f7a..625789f9e961 100644 --- a/ios/browser/api/bookmarks/importer/bookmarks_importer.mm +++ b/ios/browser/api/bookmarks/importer/bookmarks_importer.mm @@ -83,7 +83,7 @@ void ShowBookmarkBar(ProfileIOS* profile) { ProfileIOS* last_used_profile = profiles.at(0); bookmarks::BookmarkModel* model = - ios::BookmarkModelFactory::GetForBrowserState(last_used_profile); + ios::BookmarkModelFactory::GetForProfile(last_used_profile); DCHECK(model->loaded()); // If the bookmark bar is currently empty, we should import directly to it. diff --git a/ios/browser/api/brave_wallet/brave_wallet_api.mm b/ios/browser/api/brave_wallet/brave_wallet_api.mm index d4987fbcd3b4..7469902c30c5 100644 --- a/ios/browser/api/brave_wallet/brave_wallet_api.mm +++ b/ios/browser/api/brave_wallet/brave_wallet_api.mm @@ -66,23 +66,23 @@ - (instancetype)initWithBrowserState:(ProfileIOS*)profile { ethereumProviderWithDelegate:(id)delegate isPrivateBrowsing:(bool)isPrivateBrowsing { DCHECK_CURRENTLY_ON(web::WebThread::UI); - auto* browserState = _profile.get(); + auto* profile = _profile.get(); if (isPrivateBrowsing) { - browserState = browserState->GetOffTheRecordProfile(); + profile = profile->GetOffTheRecordProfile(); } auto* brave_wallet_service = - brave_wallet::BraveWalletServiceFactory::GetServiceForState(browserState); + brave_wallet::BraveWalletServiceFactory::GetServiceForState(profile); if (!brave_wallet_service) { return nil; } auto provider = std::make_unique( - ios::HostContentSettingsMapFactory::GetForBrowserState(browserState), + ios::HostContentSettingsMapFactory::GetForProfile(profile), brave_wallet_service, std::make_unique( delegate), - browserState->GetPrefs()); + profile->GetPrefs()); return [[BraveWalletEthereumProviderMojoImpl alloc] initWithEthereumProviderImpl:std::move(provider)]; } @@ -91,19 +91,19 @@ - (instancetype)initWithBrowserState:(ProfileIOS*)profile { solanaProviderWithDelegate:(id)delegate isPrivateBrowsing:(bool)isPrivateBrowsing { DCHECK_CURRENTLY_ON(web::WebThread::UI); - auto* browserState = _profile.get(); + auto* profile = _profile.get(); if (isPrivateBrowsing) { - browserState = browserState->GetOffTheRecordProfile(); + profile = profile->GetOffTheRecordProfile(); } auto* brave_wallet_service = - brave_wallet::BraveWalletServiceFactory::GetServiceForState(browserState); + brave_wallet::BraveWalletServiceFactory::GetServiceForState(profile); if (!brave_wallet_service) { return nil; } auto* host_content_settings_map = - ios::HostContentSettingsMapFactory::GetForBrowserState(browserState); + ios::HostContentSettingsMapFactory::GetForProfile(profile); if (!host_content_settings_map) { return nil; } diff --git a/ios/browser/api/favicon/favicon_driver.mm b/ios/browser/api/favicon/favicon_driver.mm index 0db9235a334d..2be7196cdf06 100644 --- a/ios/browser/api/favicon/favicon_driver.mm +++ b/ios/browser/api/favicon/favicon_driver.mm @@ -86,7 +86,7 @@ - (instancetype)initWithWebState:(WebState*)webState { brave_favicon::BraveIOSWebFaviconDriver::CreateForWebState( real_web_state, - ios::FaviconServiceFactory::GetForBrowserState( + ios::FaviconServiceFactory::GetForProfile( original_profile, ServiceAccessType::EXPLICIT_ACCESS)); } return self; diff --git a/ios/browser/api/history/brave_history_api.mm b/ios/browser/api/history/brave_history_api.mm index 8ab1a023a110..a2079deb2c64 100644 --- a/ios/browser/api/history/brave_history_api.mm +++ b/ios/browser/api/history/brave_history_api.mm @@ -37,7 +37,7 @@ base::WeakPtr profile) { DCHECK(profile.get()) << "Getter should not be called after ProfileIOS destruction."; - return ios::WebHistoryServiceFactory::GetForBrowserState(profile.get()); + return ios::WebHistoryServiceFactory::GetForProfile(profile.get()); } } // anonymous namespace @@ -167,28 +167,27 @@ @interface BraveHistoryAPI () { @end @implementation BraveHistoryAPI { - raw_ptr _mainBrowserState; // NOT OWNED + raw_ptr _profile; // NOT OWNED } -- (instancetype)initWithBrowserState:(ProfileIOS*)mainBrowserState { +- (instancetype)initWithBrowserState:(ProfileIOS*)profile { if ((self = [super init])) { DCHECK_CURRENTLY_ON(web::WebThread::UI); - _mainBrowserState = mainBrowserState; + _profile = profile; history_service_ = ios::HistoryServiceFactory::GetForProfile( - _mainBrowserState, ServiceAccessType::EXPLICIT_ACCESS); + _profile, ServiceAccessType::EXPLICIT_ACCESS); web_history_service_ = - ios::WebHistoryServiceFactory::GetForBrowserState(_mainBrowserState); + ios::WebHistoryServiceFactory::GetForProfile(_profile); - _browsingHistoryDriver = - std::make_unique(base::BindRepeating( - &WebHistoryServiceGetter, _mainBrowserState->AsWeakPtr())); + _browsingHistoryDriver = std::make_unique( + base::BindRepeating(&WebHistoryServiceGetter, _profile->AsWeakPtr())); _browsingHistoryService = std::make_unique( _browsingHistoryDriver.get(), ios::HistoryServiceFactory::GetForProfile( - _mainBrowserState, ServiceAccessType::EXPLICIT_ACCESS), - SyncServiceFactory::GetForBrowserState(_mainBrowserState)); + _profile, ServiceAccessType::EXPLICIT_ACCESS), + SyncServiceFactory::GetForProfile(_profile)); } return self; } @@ -227,9 +226,8 @@ - (void)addHistory:(IOSHistoryNode*)history { /*transition*/ ui::PAGE_TRANSITION_TYPED, /*hidden=*/false, /*visit_source*/ history::VisitSource::SOURCE_BROWSED, /*did_replace_entry=*/false, /*consider_for_ntp_most_visited=*/true, - /*title*/ base::SysNSStringToUTF16(history.title), - /*opener*/ std::nullopt, - /*bookmark_id*/ std::nullopt); + /*is_ephemeral*/ false, + /*title*/ base::SysNSStringToUTF16(history.title)); history_service_->AddPage(args); } diff --git a/ios/browser/api/https_upgrades/https_upgrade_service_factory.mm b/ios/browser/api/https_upgrades/https_upgrade_service_factory.mm index 0e9442eb6e23..f6c1f643ae84 100644 --- a/ios/browser/api/https_upgrades/https_upgrade_service_factory.mm +++ b/ios/browser/api/https_upgrades/https_upgrade_service_factory.mm @@ -11,7 +11,7 @@ #include "ios/components/security_interstitials/https_only_mode/https_upgrade_service.h" @implementation BraveHttpsUpgradeServiceFactory -+ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { ++ (nullable id)serviceForProfile:(ProfileIOS*)profile { auto* service = HttpsUpgradeServiceFactory::GetForProfile(profile); if (!service) { return nil; diff --git a/ios/browser/api/omnibox/autocomplete_classifier.mm b/ios/browser/api/omnibox/autocomplete_classifier.mm index 831647122e35..bcce1dd4cdec 100644 --- a/ios/browser/api/omnibox/autocomplete_classifier.mm +++ b/ios/browser/api/omnibox/autocomplete_classifier.mm @@ -43,9 +43,8 @@ return AutocompleteMatch::Type::CLIPBOARD_TEXT; case BraveIOSAutocompleteMatchTypeOpenTab: return AutocompleteMatch::Type::OPEN_TAB; - default: - NOTREACHED_NORETURN(); } + NOTREACHED(); } BraveIOSAutocompleteMatchType BraveTypeFromMatchType( @@ -74,7 +73,7 @@ BraveIOSAutocompleteMatchType BraveTypeFromMatchType( case AutocompleteMatch::Type::OPEN_TAB: return BraveIOSAutocompleteMatchTypeOpenTab; default: - NOTREACHED_NORETURN(); + NOTREACHED(); } } } // namespace brave @@ -100,7 +99,7 @@ + (BraveIOSAutocompleteMatch*)classify:(NSString*)text { ProfileIOS* last_used_profile = profiles.at(0); AutocompleteClassifier* classifier = - ios::AutocompleteClassifierFactory::GetForBrowserState(last_used_profile); + ios::AutocompleteClassifierFactory::GetForProfile(last_used_profile); if (classifier) { AutocompleteMatch match; classifier->Classify(base::SysNSStringToUTF16(text), false, false, diff --git a/ios/browser/api/sync/brave_sync_api.mm b/ios/browser/api/sync/brave_sync_api.mm index 503cca380314..7d49e7a336c5 100644 --- a/ios/browser/api/sync/brave_sync_api.mm +++ b/ios/browser/api/sync/brave_sync_api.mm @@ -381,7 +381,7 @@ - (id)createSyncDeviceObserver:(void (^)())onDeviceInfoChanged { - (id)createSyncServiceObserver:(void (^)())onSyncServiceStateChanged onSyncServiceShutdown:(void (^)())onSyncServiceShutdown { auto* service = static_cast( - SyncServiceFactory::GetForBrowserState(_profile)); + SyncServiceFactory::GetForProfile(_profile)); return [[BraveSyncServiceObserver alloc] initWithSyncServiceImpl:service stateChangedCallback:onSyncServiceStateChanged diff --git a/ios/browser/api/sync/brave_sync_worker.cc b/ios/browser/api/sync/brave_sync_worker.cc index cfc109595526..7a34fe5c0830 100644 --- a/ios/browser/api/sync/brave_sync_worker.cc +++ b/ios/browser/api/sync/brave_sync_worker.cc @@ -365,7 +365,7 @@ void BraveSyncWorker::PermanentlyDeleteAccount( syncer::BraveSyncServiceImpl* BraveSyncWorker::GetSyncService() const { DCHECK_CURRENTLY_ON(web::WebThread::UI); return static_cast( - SyncServiceFactory::GetForBrowserState(profile_)); + SyncServiceFactory::GetForProfile(profile_)); } void BraveSyncWorker::SetEncryptionPassphrase(syncer::SyncService* service) { diff --git a/ios/browser/api/webcompat_reporter/webcompat_reporter_service_factory_wrapper.mm b/ios/browser/api/webcompat_reporter/webcompat_reporter_service_factory_wrapper.mm index b9956a8b7c35..fe3d346c6e9a 100644 --- a/ios/browser/api/webcompat_reporter/webcompat_reporter_service_factory_wrapper.mm +++ b/ios/browser/api/webcompat_reporter/webcompat_reporter_service_factory_wrapper.mm @@ -11,10 +11,10 @@ #include "ios/chrome/browser/shared/model/profile/profile_ios.h" @implementation WebcompatReporterServiceFactory -+ (nullable id)serviceForBrowserState:(ChromeBrowserState*)browserState { ++ (nullable id)serviceForProfile:(ProfileIOS*)profile { auto handler = webcompat_reporter::WebcompatReporterServiceFactory::GetHandlerForContext( - browserState); + profile); if (!handler) { return nil; } diff --git a/ios/browser/brave_wallet/brave_wallet_factory_wrappers.mm b/ios/browser/brave_wallet/brave_wallet_factory_wrappers.mm index bb79a4a586e4..f206d6fa3b63 100644 --- a/ios/browser/brave_wallet/brave_wallet_factory_wrappers.mm +++ b/ios/browser/brave_wallet/brave_wallet_factory_wrappers.mm @@ -24,7 +24,7 @@ #endif @implementation BraveWalletAssetRatioServiceFactory -+ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { ++ (nullable id)serviceForProfile:(ProfileIOS*)profile { auto service = brave_wallet::AssetRatioServiceFactory::GetForBrowserState(profile); if (!service) { @@ -36,7 +36,7 @@ + (nullable id)serviceForBrowserState:(ProfileIOS*)profile { @end @implementation BraveWalletBitcoinWalletServiceFactory -+ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { ++ (nullable id)serviceForProfile:(ProfileIOS*)profile { auto* brave_wallet_service = brave_wallet::BraveWalletServiceFactory::GetServiceForState(profile); if (!brave_wallet_service) { @@ -51,7 +51,7 @@ + (nullable id)serviceForBrowserState:(ProfileIOS*)profile { @end @implementation BraveWalletJsonRpcServiceFactory -+ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { ++ (nullable id)serviceForProfile:(ProfileIOS*)profile { auto* brave_wallet_service = brave_wallet::BraveWalletServiceFactory::GetServiceForState(profile); if (!brave_wallet_service) { @@ -65,7 +65,7 @@ + (nullable id)serviceForBrowserState:(ProfileIOS*)profile { @end @implementation BraveWalletTxServiceFactory -+ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { ++ (nullable id)serviceForProfile:(ProfileIOS*)profile { auto* brave_wallet_service = brave_wallet::BraveWalletServiceFactory::GetServiceForState(profile); if (!brave_wallet_service) { @@ -79,7 +79,7 @@ + (nullable id)serviceForBrowserState:(ProfileIOS*)profile { @end @implementation BraveWalletEthTxManagerProxyFactory -+ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { ++ (nullable id)serviceForProfile:(ProfileIOS*)profile { auto* brave_wallet_service = brave_wallet::BraveWalletServiceFactory::GetServiceForState(profile); if (!brave_wallet_service) { @@ -93,7 +93,7 @@ + (nullable id)serviceForBrowserState:(ProfileIOS*)profile { @end @implementation BraveWalletSolanaTxManagerProxyFactory -+ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { ++ (nullable id)serviceForProfile:(ProfileIOS*)profile { auto* brave_wallet_service = brave_wallet::BraveWalletServiceFactory::GetServiceForState(profile); if (!brave_wallet_service) { @@ -107,7 +107,7 @@ + (nullable id)serviceForBrowserState:(ProfileIOS*)profile { @end @implementation BraveWalletKeyringServiceFactory -+ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { ++ (nullable id)serviceForProfile:(ProfileIOS*)profile { auto* brave_wallet_service = brave_wallet::BraveWalletServiceFactory::GetServiceForState(profile); if (!brave_wallet_service) { @@ -121,7 +121,7 @@ + (nullable id)serviceForBrowserState:(ProfileIOS*)profile { @end @implementation BraveWalletMeldIntegrationServiceFactory -+ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { ++ (nullable id)serviceForProfile:(ProfileIOS*)profile { auto service = brave_wallet::MeldIntegrationServiceFactory::GetForBrowserState(profile); if (!service) { @@ -133,7 +133,7 @@ + (nullable id)serviceForBrowserState:(ProfileIOS*)profile { @end @implementation BraveWalletServiceFactory -+ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { ++ (nullable id)serviceForProfile:(ProfileIOS*)profile { auto* brave_wallet_service = brave_wallet::BraveWalletServiceFactory::GetServiceForState(profile); if (!brave_wallet_service) { @@ -147,7 +147,7 @@ + (nullable id)serviceForBrowserState:(ProfileIOS*)profile { @end @implementation BraveWalletSwapServiceFactory -+ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { ++ (nullable id)serviceForProfile:(ProfileIOS*)profile { auto service = brave_wallet::SwapServiceFactory::GetForBrowserState(profile); if (!service) { return nil; @@ -158,7 +158,7 @@ + (nullable id)serviceForBrowserState:(ProfileIOS*)profile { @end @implementation BraveWalletIpfsServiceFactory -+ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { ++ (nullable id)serviceForProfile:(ProfileIOS*)profile { auto service = brave_wallet::BraveWalletIpfsServiceFactory::GetForBrowserState(profile); if (!service) { @@ -170,7 +170,7 @@ + (nullable id)serviceForBrowserState:(ProfileIOS*)profile { @end @implementation BraveWalletZCashWalletServiceFactory -+ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { ++ (nullable id)serviceForProfile:(ProfileIOS*)profile { auto* brave_wallet_service = brave_wallet::BraveWalletServiceFactory::GetServiceForState(profile); if (!brave_wallet_service) { diff --git a/ios/browser/debounce/debounce_service_factory.mm b/ios/browser/debounce/debounce_service_factory.mm index 6bc350bf8623..22eea8c9a2bf 100644 --- a/ios/browser/debounce/debounce_service_factory.mm +++ b/ios/browser/debounce/debounce_service_factory.mm @@ -22,7 +22,7 @@ #include "ios/web/public/browser_state.h" @implementation DebounceServiceFactory -+ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { ++ (nullable id)serviceForProfile:(ProfileIOS*)profile { // Create and start the local data file service and component installer debounce::DebounceService* debounceService = debounce::DebounceServiceFactory::GetServiceForState(profile); diff --git a/ios/browser/favicon/brave_ios_favicon_loader_factory.mm b/ios/browser/favicon/brave_ios_favicon_loader_factory.mm index 5cb414ea1894..22508188ed30 100644 --- a/ios/browser/favicon/brave_ios_favicon_loader_factory.mm +++ b/ios/browser/favicon/brave_ios_favicon_loader_factory.mm @@ -23,7 +23,7 @@ std::unique_ptr BuildFaviconLoader(web::BrowserState* context) { ProfileIOS* profile = ProfileIOS::FromBrowserState(context); return std::make_unique( - ios::FaviconServiceFactory::GetForBrowserState( + ios::FaviconServiceFactory::GetForProfile( profile, ServiceAccessType::EXPLICIT_ACCESS)); } diff --git a/ios/browser/keyed_service/keyed_service_factory_wrapper+private.h b/ios/browser/keyed_service/keyed_service_factory_wrapper+private.h index 71cd33919c0a..d6ddbc29b4ff 100644 --- a/ios/browser/keyed_service/keyed_service_factory_wrapper+private.h +++ b/ios/browser/keyed_service/keyed_service_factory_wrapper+private.h @@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN @interface KeyedServiceFactoryWrapper (Private) -+ (nullable id)serviceForBrowserState:(ProfileIOS*)profile; ++ (nullable id)serviceForProfile:(ProfileIOS*)profile; @end diff --git a/ios/browser/keyed_service/keyed_service_factory_wrapper.h b/ios/browser/keyed_service/keyed_service_factory_wrapper.h index 4f2e8f23f532..9f3cc1bbea63 100644 --- a/ios/browser/keyed_service/keyed_service_factory_wrapper.h +++ b/ios/browser/keyed_service/keyed_service_factory_wrapper.h @@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN /// /// Create a subclass of this class for each factory you want to expose to Swift /// using the concrete return type and then implement the required -/// `serviceForBrowserState:` method. +/// `serviceForProfile:` method. /// /// This must be an Obj-C interface instead of a protocol due to limitations /// of Obj-C's lightweight generics diff --git a/ios/browser/keyed_service/keyed_service_factory_wrapper.mm b/ios/browser/keyed_service/keyed_service_factory_wrapper.mm index 6ad1ce770538..7d698a9b38e4 100644 --- a/ios/browser/keyed_service/keyed_service_factory_wrapper.mm +++ b/ios/browser/keyed_service/keyed_service_factory_wrapper.mm @@ -26,10 +26,10 @@ + (nullable id)getForPrivateMode:(bool)isPrivateBrowsing { if (isPrivateBrowsing) { last_used_profile = last_used_profile->GetOffTheRecordProfile(); } - return [self serviceForBrowserState:last_used_profile]; + return [self serviceForProfile:last_used_profile]; } -+ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { ++ (nullable id)serviceForProfile:(ProfileIOS*)profile { NOTIMPLEMENTED(); return nil; } diff --git a/ios/browser/skus/skus_sdk_factory_wrappers.mm b/ios/browser/skus/skus_sdk_factory_wrappers.mm index f448e614490c..a16c51482c2c 100644 --- a/ios/browser/skus/skus_sdk_factory_wrappers.mm +++ b/ios/browser/skus/skus_sdk_factory_wrappers.mm @@ -15,7 +15,7 @@ #endif @implementation SkusSkusServiceFactory -+ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { ++ (nullable id)serviceForProfile:(ProfileIOS*)profile { auto service = skus::SkusServiceFactory::GetForBrowserState(profile); if (!service) { return nil; diff --git a/ios/browser/url_sanitizer/url_sanitizer_service_factory.mm b/ios/browser/url_sanitizer/url_sanitizer_service_factory.mm index bc611623073d..5234e08676f9 100644 --- a/ios/browser/url_sanitizer/url_sanitizer_service_factory.mm +++ b/ios/browser/url_sanitizer/url_sanitizer_service_factory.mm @@ -24,7 +24,7 @@ #endif @implementation URLSanitizerServiceFactory -+ (nullable id)serviceForBrowserState:(ProfileIOS*)profile { ++ (nullable id)serviceForProfile:(ProfileIOS*)profile { // Create and start the local data file service and component installer brave::URLSanitizerService* urlSanitizer = brave::URLSanitizerServiceFactory::GetServiceForState(profile); diff --git a/package.json b/package.json index 139e6e295124..959adabd9984 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "projects": { "chrome": { "dir": "src", - "tag": "131.0.6778.108", + "tag": "132.0.6834.33", "repository": { "url": "https://github.com/brave/chromium" } diff --git a/patches/.rustfmt.toml.patch b/patches/.rustfmt.toml.patch index f61dca476c85..57755d078076 100644 --- a/patches/.rustfmt.toml.patch +++ b/patches/.rustfmt.toml.patch @@ -1,11 +1,12 @@ diff --git a/.rustfmt.toml b/.rustfmt.toml -index b0be00850d55ec480c3fd4475abea98c836add40..562addd3f4518d8e52afccbd8cb1bfb582d237b0 100644 +index 0be5c8f05d51ca3f1a0000bb96161e84fd2e4721..070fcc06e132b139308796394e6bae7f92b7f417 100644 --- a/.rustfmt.toml +++ b/.rustfmt.toml -@@ -23,4 +23,6 @@ use_small_heuristics = "Max" +@@ -23,4 +23,7 @@ use_small_heuristics = "Max" ignore = [ "third_party/rust/**/crate", "third_party/rust/chromium_crates_io/vendor", + "brave/third_party/rust/**/crate", + "brave/third_party/rust/chromium_crates_io/vendor", ++ "brave/tools/crates/", ] diff --git a/patches/base-BUILD.gn.patch b/patches/base-BUILD.gn.patch index ff597ac2b7aa..d585a9d511e8 100644 --- a/patches/base-BUILD.gn.patch +++ b/patches/base-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/base/BUILD.gn b/base/BUILD.gn -index 4c0e4645f64e3e9f4466bd59972f8587866da8c5..dae4b156f37f51893f27c1e6ab24542f4b03edbb 100644 +index 5dee8a9226d2422e98878067e35552ca366dc18e..fadbf09102524340edcaa9004ca8e444faad380e 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn -@@ -4438,6 +4438,7 @@ if (is_android) { +@@ -4450,6 +4450,7 @@ if (is_android) { "android/java/src/org/chromium/base/ValueChangedCallback.java", "android/java/src/org/chromium/base/WrappedClassLoader.java", ] @@ -10,7 +10,7 @@ index 4c0e4645f64e3e9f4466bd59972f8587866da8c5..dae4b156f37f51893f27c1e6ab24542f if (use_clang_profiling) { sources += [ -@@ -4906,6 +4907,7 @@ if (is_android) { +@@ -4924,6 +4925,7 @@ if (is_android) { "android/java/src/org/chromium/base/shared_preferences/SharedPreferencesManager.java", "android/java/src/org/chromium/base/shared_preferences/StrictPreferenceKeyChecker.java", ] diff --git a/patches/base-test-BUILD.gn.patch b/patches/base-test-BUILD.gn.patch index bbf9100f4519..7e1cad456f06 100644 --- a/patches/base-test-BUILD.gn.patch +++ b/patches/base-test-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/base/test/BUILD.gn b/base/test/BUILD.gn -index c37ba6534270c3c4f7c2d20e6a84824875d9a6b4..09df14d7cba4c3e2173d1c8e5978a5ac41a39676 100644 +index ddf58b1d496e01e7f5865a0ec726f67eef8b0cde..e129cf16da86a1c5c964234b6bf803aaa5de22e0 100644 --- a/base/test/BUILD.gn +++ b/base/test/BUILD.gn -@@ -346,6 +346,7 @@ static_library("test_support") { +@@ -357,6 +357,7 @@ static_library("test_support") { "trace_to_file.h", ] } diff --git a/patches/base-threading-thread_restrictions.h.patch b/patches/base-threading-thread_restrictions.h.patch index 3e88d2ceef4b..00292761efe6 100644 --- a/patches/base-threading-thread_restrictions.h.patch +++ b/patches/base-threading-thread_restrictions.h.patch @@ -1,8 +1,8 @@ diff --git a/base/threading/thread_restrictions.h b/base/threading/thread_restrictions.h -index 149838be725f2e09274421d087ce4494ecf4bc1d..61e21d7ea50d0e2d9fd14a45053f0e61a6b9f20b 100644 +index 8eb5907fd9278f8f246fcbd83a354ebe757bdc1e..3f29a1a3c349be38d635890f912218ef89a6ffca 100644 --- a/base/threading/thread_restrictions.h +++ b/base/threading/thread_restrictions.h -@@ -736,6 +736,7 @@ class BASE_EXPORT ScopedAllowBaseSyncPrimitives { +@@ -729,6 +729,7 @@ class BASE_EXPORT ScopedAllowBaseSyncPrimitives { ScopedAllowBaseSyncPrimitives& operator=( const ScopedAllowBaseSyncPrimitives&) = delete; diff --git a/patches/base-trace_event-builtin_categories.h.patch b/patches/base-trace_event-builtin_categories.h.patch index 2bd1939c213b..471034dc356d 100644 --- a/patches/base-trace_event-builtin_categories.h.patch +++ b/patches/base-trace_event-builtin_categories.h.patch @@ -1,5 +1,5 @@ diff --git a/base/trace_event/builtin_categories.h b/base/trace_event/builtin_categories.h -index 9a07b21450ccd5978864efab35262757c80f38b7..11ab026710a9023a5dfb537de369538d3c8ee573 100644 +index ef993705e4a3624d06e3a74255bbec5c73eb6dfb..ef226f1fca872beb520ce9595be4df3675ef0c8b 100644 --- a/base/trace_event/builtin_categories.h +++ b/base/trace_event/builtin_categories.h @@ -200,6 +200,7 @@ diff --git a/patches/build-android-gradle-generate_gradle.py.patch b/patches/build-android-gradle-generate_gradle.py.patch index 5efb5eb165ab..3941d00d7f27 100644 --- a/patches/build-android-gradle-generate_gradle.py.patch +++ b/patches/build-android-gradle-generate_gradle.py.patch @@ -1,5 +1,5 @@ diff --git a/build/android/gradle/generate_gradle.py b/build/android/gradle/generate_gradle.py -index f6dce230f4609e53e55d453bed50e8d6e60d3e96..1f6b7212c5f524fbe04bc0af4a882b960a47947c 100755 +index 5a3002368867ebab7dbaa2f3597e1479901b06bb..63e1da12ecbbae046be6107663b77ba4c2f8dc6d 100755 --- a/build/android/gradle/generate_gradle.py +++ b/build/android/gradle/generate_gradle.py @@ -938,5 +938,6 @@ def main(): diff --git a/patches/build-android-gyp-proguard.py.patch b/patches/build-android-gyp-proguard.py.patch index 0beb9e39f544..4d8a268e3936 100644 --- a/patches/build-android-gyp-proguard.py.patch +++ b/patches/build-android-gyp-proguard.py.patch @@ -1,8 +1,8 @@ diff --git a/build/android/gyp/proguard.py b/build/android/gyp/proguard.py -index a42ce1c8312080ac8cfa0042827c6b6fd059ae22..fcf96a1892a3e0be9312143fd15f216e3db6448d 100755 +index 53ec7373755170ce0f0364b855a34e69b5fc51cd..388e7f2689ba9cf3092f52c9a8eafb28cc94a388 100755 --- a/build/android/gyp/proguard.py +++ b/build/android/gyp/proguard.py -@@ -378,6 +378,7 @@ def _OptimizeWithR8(options, config_paths, libraries, dynamic_config_data): +@@ -376,6 +376,7 @@ def _OptimizeWithR8(options, config_paths, libraries, dynamic_config_data): '--pg-map-output', tmp_mapping_path, ] diff --git a/patches/build-config-BUILDCONFIG.gn.patch b/patches/build-config-BUILDCONFIG.gn.patch index df69bbcf20b6..9dca64ab4e8b 100644 --- a/patches/build-config-BUILDCONFIG.gn.patch +++ b/patches/build-config-BUILDCONFIG.gn.patch @@ -1,8 +1,8 @@ diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn -index c9a3ce41465b38594c5eba3f152e4f127859ebb2..3d9c3eb009302e99c933e51435d19d7ad0d816ec 100644 +index 8e0c3761f1634312dad5fe16a01653e5e80935f5..8a2691918fb3c7e86ac57fbed1d5a7d3a5ca6be5 100644 --- a/build/config/BUILDCONFIG.gn +++ b/build/config/BUILDCONFIG.gn -@@ -335,6 +335,7 @@ is_posix = !is_win && !is_fuchsia +@@ -340,6 +340,7 @@ is_posix = !is_win && !is_fuchsia # Holds all configs used for running the compiler. default_compiler_configs = [ diff --git a/patches/build-config-android-config.gni.patch b/patches/build-config-android-config.gni.patch index d91419b9c72a..7b5ee8ef7aa3 100644 --- a/patches/build-config-android-config.gni.patch +++ b/patches/build-config-android-config.gni.patch @@ -1,5 +1,5 @@ diff --git a/build/config/android/config.gni b/build/config/android/config.gni -index 8cf49d09545e00e9378bc1cb1c200da4d1c7c26d..1fedaf038f1b880099aaed098a503917d1805b0b 100644 +index db376254dc40742de74272f570cae77a4dbae2bb..6621b2d3d5e84824e116329e2602d87db5c97287 100644 --- a/build/config/android/config.gni +++ b/build/config/android/config.gni @@ -29,6 +29,7 @@ assert(!(incremental_install && !is_java_debug), diff --git a/patches/build-config-android-internal_rules.gni.patch b/patches/build-config-android-internal_rules.gni.patch index 953f14b98700..46b6b5db4c06 100644 --- a/patches/build-config-android-internal_rules.gni.patch +++ b/patches/build-config-android-internal_rules.gni.patch @@ -1,8 +1,8 @@ diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni -index b849838c5642430959890e554821b4eea7916a7a..cafae6ee551f2a57e5ed9442ccf5dd27679bebb7 100644 +index b2b04e27db94aa359c5d5a23b974d03dd625ea0a..a0055064f7702dbc42bad60d7d9f9d6fc0bbf288 100644 --- a/build/config/android/internal_rules.gni +++ b/build/config/android/internal_rules.gni -@@ -4190,6 +4190,7 @@ if (enable_java_templates) { +@@ -4202,6 +4202,7 @@ if (enable_java_templates) { } else { not_needed(invoker, [ "missing_classes_allowlist" ]) } diff --git a/patches/build-config-android-rules.gni.patch b/patches/build-config-android-rules.gni.patch index f8f7b18e9b3d..0be9f348567d 100644 --- a/patches/build-config-android-rules.gni.patch +++ b/patches/build-config-android-rules.gni.patch @@ -1,8 +1,8 @@ diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni -index aa6a2fe716646df02b4fe58d288ad2edda3641b6..0659f4ca0cde17f12de3520d429eda07e449aba9 100644 +index 053550dd0365db499b6d958818c8c4f9f0be3b35..3482dcb276995f0b343197a79d06c303d6ae866f 100644 --- a/build/config/android/rules.gni +++ b/build/config/android/rules.gni -@@ -207,6 +207,7 @@ if (!is_robolectric && enable_java_templates) { +@@ -208,6 +208,7 @@ if (!is_robolectric && enable_java_templates) { # ] # } template("java_cpp_enum") { @@ -10,7 +10,7 @@ index aa6a2fe716646df02b4fe58d288ad2edda3641b6..0659f4ca0cde17f12de3520d429eda07 action_with_pydeps(target_name) { forward_variables_from(invoker, TESTONLY_AND_VISIBILITY + [ "sources" ]) -@@ -382,6 +383,7 @@ if (!is_robolectric && enable_java_templates) { +@@ -383,6 +384,7 @@ if (!is_robolectric && enable_java_templates) { # output = "$target_gen_dir/AndroidManifest.xml" # } template("jinja_template") { diff --git a/patches/build-rust-cargo_crate.gni.patch b/patches/build-rust-cargo_crate.gni.patch index 9718317e0b7b..b8bb61c8ae15 100644 --- a/patches/build-rust-cargo_crate.gni.patch +++ b/patches/build-rust-cargo_crate.gni.patch @@ -1,5 +1,5 @@ diff --git a/build/rust/cargo_crate.gni b/build/rust/cargo_crate.gni -index ad5d0020c8e140d7fc92eb13e7aa44f697f1a3f3..f80c18be047063dc4a9c5dbce14a278d99444ad4 100644 +index 8266c44cbd1dfb8a53797dbe911ea74c32ce070e..ef069866a1692971c7313e06c1c4cfe4a4199bea 100644 --- a/build/rust/cargo_crate.gni +++ b/build/rust/cargo_crate.gni @@ -158,6 +158,7 @@ template("cargo_crate") { @@ -10,7 +10,7 @@ index ad5d0020c8e140d7fc92eb13e7aa44f697f1a3f3..f80c18be047063dc4a9c5dbce14a278d # cargo_crate() should set library_configs, executable_configs, # proc_macro_configs. Not configs. -@@ -259,6 +260,7 @@ template("cargo_crate") { +@@ -253,6 +254,7 @@ template("cargo_crate") { testonly = _testonly if (defined(invoker.visibility)) { visibility = invoker.visibility diff --git a/patches/build-rust-rust_target.gni.patch b/patches/build-rust-rust_target.gni.patch index 9384b3208547..3c20b0b4f18e 100644 --- a/patches/build-rust-rust_target.gni.patch +++ b/patches/build-rust-rust_target.gni.patch @@ -1,8 +1,8 @@ diff --git a/build/rust/rust_target.gni b/build/rust/rust_target.gni -index b8b0e3a0ea1f02f5ebd72116e1d9d7f88a143514..b937393d6910ebd2e2fc6a663e207da32a2bfbeb 100644 +index 1a2f96337d43619b3facf74ff4f252e6ba3511cc..76b7745fdc31710462e632894688afca890b07a3 100644 --- a/build/rust/rust_target.gni +++ b/build/rust/rust_target.gni -@@ -192,7 +192,7 @@ template("rust_target") { +@@ -224,7 +224,7 @@ template("rust_target") { _cxx_bindings = invoker.cxx_bindings } _rustenv = [ "OUT_DIR=" + diff --git a/patches/chrome-BUILD.gn.patch b/patches/chrome-BUILD.gn.patch index 751ea3f12a55..8f44eb0ba565 100644 --- a/patches/chrome-BUILD.gn.patch +++ b/patches/chrome-BUILD.gn.patch @@ -1,5 +1,5 @@ diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn -index e2d2446670d358346b5c7399596625087627d5e4..b08871f4036fb5ba5dc93a17a8c144df3c2420b4 100644 +index c785db2fe2a24d33db6499da7806defbdec78a7e..81b1ccf63de98ac61480f9ed66c657de862d7b59 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn @@ -199,6 +199,7 @@ if (!is_android && !is_mac) { @@ -10,7 +10,7 @@ index e2d2446670d358346b5c7399596625087627d5e4..b08871f4036fb5ba5dc93a17a8c144df deps += [ ":chrome_dll", -@@ -516,11 +517,12 @@ if (is_win) { +@@ -513,11 +514,12 @@ if (is_win) { args += [ "--keystone=0" ] } } @@ -24,7 +24,7 @@ index e2d2446670d358346b5c7399596625087627d5e4..b08871f4036fb5ba5dc93a17a8c144df extra_substitutions = [ "CHROMIUM_BUNDLE_ID=$chrome_mac_bundle_id", "CHROMIUM_SHORT_NAME=$chrome_product_short_name", -@@ -540,6 +542,7 @@ if (is_win) { +@@ -537,6 +539,7 @@ if (is_win) { "//chrome/common:buildflags", "//chrome/common:version_header", ] @@ -32,7 +32,7 @@ index e2d2446670d358346b5c7399596625087627d5e4..b08871f4036fb5ba5dc93a17a8c144df if (enable_updater) { deps += [ ":chromium_updater_privileged_helper" ] -@@ -682,6 +685,7 @@ if (is_win) { +@@ -679,6 +682,7 @@ if (is_win) { # this dependency directly copies the file into the framework's # resources directory. public_deps += [ ":chrome_framework_widevine_signature" ] @@ -40,7 +40,7 @@ index e2d2446670d358346b5c7399596625087627d5e4..b08871f4036fb5ba5dc93a17a8c144df } } -@@ -725,9 +729,11 @@ if (is_win) { +@@ -722,9 +726,11 @@ if (is_win) { "--scm=0", ] } @@ -52,7 +52,7 @@ index e2d2446670d358346b5c7399596625087627d5e4..b08871f4036fb5ba5dc93a17a8c144df if (is_chrome_branded && include_branded_entitlements) { # These entitlements are bound to the official Google Chrome signing # certificate and will not necessarily work in any other build. -@@ -752,6 +758,7 @@ if (is_win) { +@@ -749,6 +755,7 @@ if (is_win) { info_plist_target = invoker.info_plist_target } else { info_plist_target = ":chrome_helper_plist" @@ -60,7 +60,7 @@ index e2d2446670d358346b5c7399596625087627d5e4..b08871f4036fb5ba5dc93a17a8c144df } extra_substitutions = [ -@@ -930,6 +937,7 @@ if (is_win) { +@@ -927,6 +934,7 @@ if (is_win) { if (enable_updater) { if (is_chrome_branded) { sources += [ "//third_party/updater/chrome_mac_universal_prod/cipd/${updater_product_full_name}.app" ] @@ -68,7 +68,7 @@ index e2d2446670d358346b5c7399596625087627d5e4..b08871f4036fb5ba5dc93a17a8c144df } else { sources += [ "$root_out_dir/${updater_product_full_name}.app" ] -@@ -1235,6 +1243,7 @@ if (is_win) { +@@ -1232,6 +1240,7 @@ if (is_win) { "-current_version", chrome_dylib_version, ] @@ -76,7 +76,7 @@ index e2d2446670d358346b5c7399596625087627d5e4..b08871f4036fb5ba5dc93a17a8c144df if (!is_component_build) { # Specify a sensible install_name for static builds. The library is -@@ -1416,6 +1425,7 @@ if (is_win) { +@@ -1413,6 +1422,7 @@ if (is_win) { group("dependencies") { public_deps = [ @@ -84,7 +84,7 @@ index e2d2446670d358346b5c7399596625087627d5e4..b08871f4036fb5ba5dc93a17a8c144df "//build:branding_buildflags", "//build:chromeos_buildflags", "//chrome/browser", -@@ -1471,7 +1481,7 @@ group("dependencies") { +@@ -1468,7 +1478,7 @@ group("dependencies") { if (is_win) { process_version_rc_template("chrome_exe_version") { @@ -93,7 +93,7 @@ index e2d2446670d358346b5c7399596625087627d5e4..b08871f4036fb5ba5dc93a17a8c144df output = "$target_gen_dir/chrome_exe_version.rc" } -@@ -1520,6 +1530,7 @@ group("resources") { +@@ -1517,6 +1527,7 @@ group("resources") { "//chrome/browser:resources", "//chrome/common:resources", "//chrome/renderer:resources", @@ -101,7 +101,7 @@ index e2d2446670d358346b5c7399596625087627d5e4..b08871f4036fb5ba5dc93a17a8c144df ] } -@@ -1573,6 +1584,7 @@ if (!is_android) { +@@ -1570,6 +1581,7 @@ if (!is_android) { if (enable_resource_allowlist_generation) { repack_allowlist = _chrome_resource_allowlist deps = [ ":resource_allowlist" ] diff --git a/patches/chrome-android-BUILD.gn.patch b/patches/chrome-android-BUILD.gn.patch index 10e40631a5d9..26dcbe8e42fe 100644 --- a/patches/chrome-android-BUILD.gn.patch +++ b/patches/chrome-android-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn -index 2d866288c143aa30273ff2bdd6f47c29e25ff83f..bdb795e49b4b0868851aad1b4e4102ec83353f7e 100644 +index fd15a5d6881bfa6767bd98b7e5a715caaba20c62..55f1e90d2b3b34846b925194d26c131d54f015d8 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn -@@ -192,6 +192,7 @@ if (current_toolchain == default_toolchain) { +@@ -193,6 +193,7 @@ if (current_toolchain == default_toolchain) { "java/res_chromium_base/mipmap-xxxhdpi/layered_app_icon_background.png", "java/res_chromium_base/values/channel_constants.xml", ] @@ -10,15 +10,15 @@ index 2d866288c143aa30273ff2bdd6f47c29e25ff83f..bdb795e49b4b0868851aad1b4e4102ec } android_resources("chrome_app_java_resources") { -@@ -282,6 +283,7 @@ if (current_toolchain == default_toolchain) { - } else { - deps += [ "//components/plus_addresses/android:java_resources" ] +@@ -288,6 +289,7 @@ if (current_toolchain == default_toolchain) { + if (enable_screen_capture) { + deps += [ "//chrome/browser:screen_capture_java_resources" ] } + deps += brave_chrome_app_java_resources_deps sources += brave_java_resources resource_overlay = true } android_resources("java_overlay_resources") { -@@ -737,6 +739,7 @@ if (current_toolchain == default_toolchain) { +@@ -751,6 +753,7 @@ if (current_toolchain == default_toolchain) { ] deps += feed_deps @@ -26,7 +26,7 @@ index 2d866288c143aa30273ff2bdd6f47c29e25ff83f..bdb795e49b4b0868851aad1b4e4102ec srcjar_deps = [ ":chrome_android_java_enums_srcjar", -@@ -754,6 +757,7 @@ if (current_toolchain == default_toolchain) { +@@ -768,6 +771,7 @@ if (current_toolchain == default_toolchain) { "//components/sharing_message:sharing_send_message_result_generated_enum", "//components/supervised_user/core/browser:supervised_user_utils_enum_javagen", ] @@ -34,7 +34,7 @@ index 2d866288c143aa30273ff2bdd6f47c29e25ff83f..bdb795e49b4b0868851aad1b4e4102ec # From java_sources.gni. sources = chrome_java_sources -@@ -883,6 +887,7 @@ if (current_toolchain == default_toolchain) { +@@ -899,6 +903,7 @@ if (current_toolchain == default_toolchain) { "//components/saved_tab_groups/public:conversion_utils_java", "//components/segmentation_platform/internal:internal_java", ] @@ -42,7 +42,7 @@ index 2d866288c143aa30273ff2bdd6f47c29e25ff83f..bdb795e49b4b0868851aad1b4e4102ec } action_with_pydeps("chrome_android_java_google_api_keys_srcjar") { -@@ -1525,6 +1530,7 @@ if (current_toolchain == default_toolchain) { +@@ -1550,6 +1555,7 @@ if (current_toolchain == default_toolchain) { "javatests/src/org/chromium/chrome/browser/toolbar/ToolbarSecurityIconTest.java", "javatests/src/org/chromium/chrome/browser/webapps/WebappLaunchCauseMetricsTest.java", ] @@ -50,7 +50,7 @@ index 2d866288c143aa30273ff2bdd6f47c29e25ff83f..bdb795e49b4b0868851aad1b4e4102ec deps = [ ":chrome_app_java_resources", ":chrome_unit_test_java_resources", -@@ -2286,6 +2292,7 @@ if (current_toolchain == default_toolchain) { +@@ -2317,6 +2323,7 @@ if (current_toolchain == default_toolchain) { "java/res_chromium_base/mipmap-xxxhdpi/layered_app_icon_background.png", "java/res_chromium_base/values/channel_constants.xml", ] @@ -58,7 +58,7 @@ index 2d866288c143aa30273ff2bdd6f47c29e25ff83f..bdb795e49b4b0868851aad1b4e4102ec # Dep needed to ensure override works properly. deps = [ ":chrome_base_module_resources" ] -@@ -2498,6 +2505,7 @@ if (current_toolchain == default_toolchain) { +@@ -2529,6 +2536,7 @@ if (current_toolchain == default_toolchain) { ":${_variant}_locale_pak_assets", ":${_variant}_paks", ] @@ -66,7 +66,7 @@ index 2d866288c143aa30273ff2bdd6f47c29e25ff83f..bdb795e49b4b0868851aad1b4e4102ec if (_is_monochrome) { deps += [ "//android_webview:locale_pak_assets" ] } -@@ -2772,6 +2780,7 @@ if (current_toolchain == default_toolchain) { +@@ -2804,6 +2812,7 @@ if (current_toolchain == default_toolchain) { "//components/payments/content/android:service_java", "//third_party/androidx:androidx_browser_browser_java", ] @@ -74,11 +74,11 @@ index 2d866288c143aa30273ff2bdd6f47c29e25ff83f..bdb795e49b4b0868851aad1b4e4102ec # More deps for DFMs. if (dfmify_dev_ui) { -@@ -3879,6 +3888,7 @@ generate_jni("chrome_jni_headers") { +@@ -3908,6 +3917,7 @@ generate_jni("chrome_jni_headers") { "java/src/org/chromium/chrome/browser/webapps/WebApkUpdateManager.java", "java/src/org/chromium/chrome/browser/webapps/WebappRegistry.java", ] + sources += brave_jni_headers_sources - # Used for testing only, should not be shipped to end users. - if (enable_offline_pages_harness) { + if (enable_screen_capture) { + sources += [ "java/src/org/chromium/chrome/browser/media/MediaCapturePickerDialogBridge.java" ] diff --git a/patches/chrome-android-chrome_java_sources.gni.patch b/patches/chrome-android-chrome_java_sources.gni.patch index 6a35f67757ae..3328e5031f4d 100644 --- a/patches/chrome-android-chrome_java_sources.gni.patch +++ b/patches/chrome-android-chrome_java_sources.gni.patch @@ -1,10 +1,9 @@ diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java_sources.gni -index aab8e9a5a54059b2f502c702fcccfb535af20d49..45ed6f2ac6bd37c00c0e0c60d07aa78d2ed14bf1 100644 +index ec788ea2a0b111fd02a59dfe86b57b6e1deb990d..85cbecbecf8fe0bbc961095ef1982e28e500bc6a 100644 --- a/chrome/android/chrome_java_sources.gni +++ b/chrome/android/chrome_java_sources.gni -@@ -1219,3 +1219,4 @@ chrome_java_sources = [ - "java/src/org/chromium/chrome/browser/webauth/authenticator/CableAuthenticatorActivity.java", - "java/src/org/chromium/chrome/browser/webshare/ShareServiceImplementationFactory.java", - ] +@@ -1229,3 +1229,4 @@ if (enable_screen_capture) { + "java/src/org/chromium/chrome/browser/media/MediaCapturePickerItemViewBinder.java", + ] + } +chrome_java_sources -= ["java/src/org/chromium/chrome/browser/ntp/IncognitoNewTabPageView.java",] -\ No newline at end of file diff --git a/patches/chrome-android-expectations-lint-suppressions.xml.patch b/patches/chrome-android-expectations-lint-suppressions.xml.patch index 14b50748ebd0..c4d3f7cb8b02 100644 --- a/patches/chrome-android-expectations-lint-suppressions.xml.patch +++ b/patches/chrome-android-expectations-lint-suppressions.xml.patch @@ -1,8 +1,8 @@ diff --git a/chrome/android/expectations/lint-suppressions.xml b/chrome/android/expectations/lint-suppressions.xml -index 107a2fb1b557b66dc2c5ee81ef941e658ff2b7c5..236ef5b8fa2048037226c63c8a5ae96cf3ed1535 100644 +index 814a84c9b838db7bbd52873344f366ed2f9a73e5..513b3889a4c9ae85af74515b74896909b6b2ab91 100644 --- a/chrome/android/expectations/lint-suppressions.xml +++ b/chrome/android/expectations/lint-suppressions.xml -@@ -300,4 +300,5 @@ https://chromium.googlesource.com/chromium/src/+/main/build/android/docs/lint.md +@@ -302,4 +302,5 @@ https://chromium.googlesource.com/chromium/src/+/main/build/android/docs/lint.md diff --git a/patches/chrome-android-features-tab_ui-BUILD.gn.patch b/patches/chrome-android-features-tab_ui-BUILD.gn.patch index 9289a4fb70a8..b023483d08c8 100644 --- a/patches/chrome-android-features-tab_ui-BUILD.gn.patch +++ b/patches/chrome-android-features-tab_ui-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/chrome/android/features/tab_ui/BUILD.gn b/chrome/android/features/tab_ui/BUILD.gn -index 15eb0b937d56a30420a5a78487d64ffd88971dd8..abe7c93379b73dfb0ce4ea9a42541d00824102d1 100644 +index 54953d07033702790b664e0ffeb372034d88b3b5..6aab2848e43c0ccbb2ea46adc4f12e460131aa0f 100644 --- a/chrome/android/features/tab_ui/BUILD.gn +++ b/chrome/android/features/tab_ui/BUILD.gn -@@ -112,6 +112,7 @@ android_resources("java_resources") { +@@ -111,6 +111,7 @@ android_resources("java_resources") { "java/res/xml/tab_archive_time_delta_preference.xml", "java/res/xml/tabs_settings.xml", ] diff --git a/patches/chrome-android-feed-core-java-src-org-chromium-chrome-browser-feed-FeedSurfaceMediator.java.patch b/patches/chrome-android-feed-core-java-src-org-chromium-chrome-browser-feed-FeedSurfaceMediator.java.patch index 0e45bef7226e..8ab807e7483e 100644 --- a/patches/chrome-android-feed-core-java-src-org-chromium-chrome-browser-feed-FeedSurfaceMediator.java.patch +++ b/patches/chrome-android-feed-core-java-src-org-chromium-chrome-browser-feed-FeedSurfaceMediator.java.patch @@ -1,5 +1,5 @@ diff --git a/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedSurfaceMediator.java b/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedSurfaceMediator.java -index 4f48a5ce2593de9989d7c661b424cd9b1b277c48..77d4e0b97bac1cdb4b66ccdae1cdc466148c9c25 100644 +index 1b0c91434ee4fc45cbaaee6fa9c156a20b205f5a..87ea6e9f7776dd64f35b95485de063f0a24429b3 100644 --- a/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedSurfaceMediator.java +++ b/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedSurfaceMediator.java @@ -303,7 +303,7 @@ public class FeedSurfaceMediator diff --git a/patches/chrome-android-java-AndroidManifest.xml.patch b/patches/chrome-android-java-AndroidManifest.xml.patch index 83fd191d9526..d744904e7844 100644 --- a/patches/chrome-android-java-AndroidManifest.xml.patch +++ b/patches/chrome-android-java-AndroidManifest.xml.patch @@ -1,5 +1,5 @@ diff --git a/chrome/android/java/AndroidManifest.xml b/chrome/android/java/AndroidManifest.xml -index ab689d4788bf3be40731a8734af7eedfe360c2f4..d29dfc2e69d047d8ede3a3d43fa1d7c44cf4872d 100644 +index 9bb1c95729a7a34b7099117d2e4cea37845e6fc4..0b6ad2791fb66ce9a6866386b47da0e320e0818c 100644 --- a/chrome/android/java/AndroidManifest.xml +++ b/chrome/android/java/AndroidManifest.xml @@ -28,6 +28,7 @@ by a child template that "extends" this file. @@ -66,7 +66,7 @@ index ab689d4788bf3be40731a8734af7eedfe360c2f4..d29dfc2e69d047d8ede3a3d43fa1d7c4 -@@ -1194,6 +1208,7 @@ by a child template that "extends" this file. +@@ -1186,6 +1200,7 @@ by a child template that "extends" this file. {% endif %} diff --git a/patches/chrome-android-java-src-org-chromium-chrome-browser-SwipeRefreshHandler.java.patch b/patches/chrome-android-java-src-org-chromium-chrome-browser-SwipeRefreshHandler.java.patch index 5f46eea82f96..7f286002faf9 100644 --- a/patches/chrome-android-java-src-org-chromium-chrome-browser-SwipeRefreshHandler.java.patch +++ b/patches/chrome-android-java-src-org-chromium-chrome-browser-SwipeRefreshHandler.java.patch @@ -1,5 +1,5 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/SwipeRefreshHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/SwipeRefreshHandler.java -index 08111da566c6a8e832c732dd9580b5a990de51d5..6c7db1687046dfd39f18fd7e16f55d3ea3a76226 100644 +index 04b773ec01e971282222c98c45f82f1a42f2a001..9f453746a337e46f4f589326b9455185a1ddfb1b 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/SwipeRefreshHandler.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/SwipeRefreshHandler.java @@ -140,7 +140,7 @@ public class SwipeRefreshHandler extends TabWebContentsUserData diff --git a/patches/chrome-android-java-src-org-chromium-chrome-browser-contextmenu-ChromeContextMenuPopulator.java.patch b/patches/chrome-android-java-src-org-chromium-chrome-browser-contextmenu-ChromeContextMenuPopulator.java.patch index 2ecebee721a3..0faacc2ee1e4 100644 --- a/patches/chrome-android-java-src-org-chromium-chrome-browser-contextmenu-ChromeContextMenuPopulator.java.patch +++ b/patches/chrome-android-java-src-org-chromium-chrome-browser-contextmenu-ChromeContextMenuPopulator.java.patch @@ -1,8 +1,8 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java b/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java -index 9a27d978b5733fdcf4768d279e3e19ef717bcd0d..f04dfff4516850bbefd7c7d859c23980d6fb4c66 100644 +index f7e05309b3847c16ed50d0471d497d8cf728f6e0..2d6bb654f97b414532283919e7eb765635c18154 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java -@@ -163,7 +163,7 @@ public class ChromeContextMenuPopulator implements ContextMenuPopulator { +@@ -161,7 +161,7 @@ public class ChromeContextMenuPopulator implements ContextMenuPopulator { Action.SHARE_HIGHLIGHT, Action.REMOVE_HIGHLIGHT, Action.LEARN_MORE, @@ -11,7 +11,7 @@ index 9a27d978b5733fdcf4768d279e3e19ef717bcd0d..f04dfff4516850bbefd7c7d859c23980 }) @Retention(RetentionPolicy.SOURCE) public @interface Action { -@@ -208,7 +208,7 @@ public class ChromeContextMenuPopulator implements ContextMenuPopulator { +@@ -206,7 +206,7 @@ public class ChromeContextMenuPopulator implements ContextMenuPopulator { int LEARN_MORE = 38; int OPEN_IN_NEW_TAB_IN_GROUP = 39; int OPEN_IN_NEW_WINDOW = 40; @@ -20,7 +20,7 @@ index 9a27d978b5733fdcf4768d279e3e19ef717bcd0d..f04dfff4516850bbefd7c7d859c23980 } } -@@ -300,6 +300,7 @@ public class ChromeContextMenuPopulator implements ContextMenuPopulator { +@@ -296,6 +296,7 @@ public class ChromeContextMenuPopulator implements ContextMenuPopulator { if (!MailTo.isMailTo(mParams.getLinkUrl().getSpec()) && !UrlUtilities.isTelScheme(mParams.getLinkUrl())) { linkGroup.add(createListItem(Item.COPY_LINK_ADDRESS)); diff --git a/patches/chrome-android-java-src-org-chromium-chrome-browser-notifications-NotificationPlatformBridge.java.patch b/patches/chrome-android-java-src-org-chromium-chrome-browser-notifications-NotificationPlatformBridge.java.patch index e0d78a2e7b86..605948f7e5d6 100644 --- a/patches/chrome-android-java-src-org-chromium-chrome-browser-notifications-NotificationPlatformBridge.java.patch +++ b/patches/chrome-android-java-src-org-chromium-chrome-browser-notifications-NotificationPlatformBridge.java.patch @@ -1,9 +1,9 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java -index 0f69d6975ee9225e14ae925b5f81f127ead41403..aa56e1c8e829c517efa285ffa7021af16cd19a4d 100644 +index d7eb705ce3a5e7376efd361bc78cb21fdc78ff54..d4c322455d6f545b81dfcc14571cb29682eb050e 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java -@@ -141,7 +141,7 @@ public class NotificationPlatformBridge { - private TrustedWebActivityClient mTwaClient; +@@ -138,7 +138,7 @@ public class NotificationPlatformBridge { + private static long sLastPreUnsubscribePreNativeTaskStartRealMillis = -1; /** Encapsulates attributes that identify a notification and where it originates from. */ - private static class NotificationIdentifyingAttributes { diff --git a/patches/chrome-android-java-src-org-chromium-chrome-browser-privacy-settings-PrivacySettings.java.patch b/patches/chrome-android-java-src-org-chromium-chrome-browser-privacy-settings-PrivacySettings.java.patch index a8460980df7c..16d81460d8fb 100644 --- a/patches/chrome-android-java-src-org-chromium-chrome-browser-privacy-settings-PrivacySettings.java.patch +++ b/patches/chrome-android-java-src-org-chromium-chrome-browser-privacy-settings-PrivacySettings.java.patch @@ -1,8 +1,8 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java b/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java -index 76a5bd263d4e13edc5800c576cb3dc02031b105f..82a660a432a9be54d4b6ec9340d1455006bb0b52 100644 +index e3b5027f95fba7619f4ff58cd51a343a9c105043..2744dd404dc879c9915eaac9aebf0df670a854f9 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java -@@ -54,7 +54,7 @@ import org.chromium.components.user_prefs.UserPrefs; +@@ -55,7 +55,7 @@ import org.chromium.components.user_prefs.UserPrefs; import org.chromium.ui.text.SpanApplier; /** Fragment to keep track of the all the privacy related preferences. */ @@ -11,7 +11,7 @@ index 76a5bd263d4e13edc5800c576cb3dc02031b105f..82a660a432a9be54d4b6ec9340d14550 implements Preference.OnPreferenceChangeListener { private static final String PREF_CAN_MAKE_PAYMENT = "can_make_payment"; private static final String PREF_PRELOAD_PAGES = "preload_pages"; -@@ -423,6 +423,7 @@ public class PrivacySettings extends ChromeBaseSettingsFragment +@@ -428,6 +428,7 @@ public class PrivacySettings extends ChromeBaseSettingsFragment @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { menu.clear(); @@ -19,7 +19,7 @@ index 76a5bd263d4e13edc5800c576cb3dc02031b105f..82a660a432a9be54d4b6ec9340d14550 MenuItem help = menu.add(Menu.NONE, R.id.menu_id_targeted_help, Menu.NONE, R.string.menu_help); help.setIcon( -@@ -437,7 +438,7 @@ public class PrivacySettings extends ChromeBaseSettingsFragment +@@ -442,7 +443,7 @@ public class PrivacySettings extends ChromeBaseSettingsFragment .show(getActivity(), getString(R.string.help_context_privacy), null); return true; } diff --git a/patches/chrome-app-chrome_crash_reporter_client.cc.patch b/patches/chrome-app-chrome_crash_reporter_client.cc.patch index 2b8ff9efb998..ee39f60aa1af 100644 --- a/patches/chrome-app-chrome_crash_reporter_client.cc.patch +++ b/patches/chrome-app-chrome_crash_reporter_client.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/app/chrome_crash_reporter_client.cc b/chrome/app/chrome_crash_reporter_client.cc -index fba475a9c6bf96263f3b09f46a4ae5e3b8860260..e10626c8b733182bb70a9e7c293983056b7f9d96 100644 +index a8df5a2baafde30f98a7c05921851d25372104e4..df8be74a6e9f69c511f5737753d62654f94ad714 100644 --- a/chrome/app/chrome_crash_reporter_client.cc +++ b/chrome/app/chrome_crash_reporter_client.cc @@ -176,7 +176,7 @@ bool ChromeCrashReporterClient::IsRunningUnattended() { diff --git a/patches/chrome-browser-BUILD.gn.patch b/patches/chrome-browser-BUILD.gn.patch index 363c5690c948..fa8076b374d4 100644 --- a/patches/chrome-browser-BUILD.gn.patch +++ b/patches/chrome-browser-BUILD.gn.patch @@ -1,16 +1,16 @@ diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index 54279426733f7eeec00ee2ccf7c82771ae424c65..6cb0f560164665f7744986a2a425be4d30858632 100644 +index c2c22a92bccb2487319affed384cac10dbc839a8..b46d77cd7226986a8f31a70b295d8c53f271f9e3 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -2517,6 +2517,7 @@ static_library("browser") { - "performance_monitor/metric_evaluator_helper_posix.h", - ] +@@ -2506,6 +2506,7 @@ static_library("browser") { + } else { + sources += [ "net/net_error_diagnostics_dialog_stub.cc" ] } + import("//brave/browser/sources.gni") sources += brave_chrome_browser_sources deps += brave_chrome_browser_deps public_deps += brave_chrome_browser_public_deps allow_circular_includes_from += brave_chrome_browser_allow_circular_includes_from - if (!is_chromeos_ash) { + if (is_android) { sources += [ -@@ -8604,6 +8605,7 @@ static_library("browser_public_dependencies") { +@@ -8628,6 +8629,7 @@ static_library("browser_public_dependencies") { "//rlz:rlz_lib", ] } diff --git a/patches/chrome-browser-about_flags.cc.patch b/patches/chrome-browser-about_flags.cc.patch index 3453196f86c2..100306726d82 100644 --- a/patches/chrome-browser-about_flags.cc.patch +++ b/patches/chrome-browser-about_flags.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc -index ad599311ac46db300ec62d8841b8c89e3d6fd1fa..eb3763b158c650165c5dfb4344666431c7f632a4 100644 +index 41583cc15dddd096ace0e5aa72d1e1828ce2cdf2..ca4d1fd0af53942ae115351ba3a2e545d7db8ace 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc -@@ -4234,6 +4234,7 @@ const FeatureEntry::FeatureVariation +@@ -4333,6 +4333,7 @@ const FeatureEntry::FeatureVariation kServiceWorkerAutoPreloadVariations[] = { // // When adding a new choice, add it to the end of the list. const FeatureEntry kFeatureEntries[] = { diff --git a/patches/chrome-browser-android-browsing_data-browsing_data_bridge.cc.patch b/patches/chrome-browser-android-browsing_data-browsing_data_bridge.cc.patch index 80863f73deea..cf6d50450391 100644 --- a/patches/chrome-browser-android-browsing_data-browsing_data_bridge.cc.patch +++ b/patches/chrome-browser-android-browsing_data-browsing_data_bridge.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/android/browsing_data/browsing_data_bridge.cc b/chrome/browser/android/browsing_data/browsing_data_bridge.cc -index b9ca5b3b7c48ae9c2c386b9e01e9dd74429b375b..7a092cbaf0950abe964e5942434268bad5408666 100644 +index 85ab118765e543f4c04f7380b104546f371fda7e..216c64957b8dcebd33e1f4884f1ccc6df7a47404 100644 --- a/chrome/browser/android/browsing_data/browsing_data_bridge.cc +++ b/chrome/browser/android/browsing_data/browsing_data_bridge.cc @@ -133,6 +133,7 @@ static void JNI_BrowsingDataBridge_ClearBrowsingData( @@ -9,4 +9,4 @@ index b9ca5b3b7c48ae9c2c386b9e01e9dd74429b375b..7a092cbaf0950abe964e5942434268ba + BRAVE_CLEAR_BROWSING_DATA case browsing_data::BrowsingDataType::HOSTED_APPS_DATA: // Only implemented on Desktop. - NOTREACHED_IN_MIGRATION(); + NOTREACHED(); diff --git a/patches/chrome-browser-app_controller_mac.mm.patch b/patches/chrome-browser-app_controller_mac.mm.patch index 70cf8d3aba5f..819cb31e40f3 100644 --- a/patches/chrome-browser-app_controller_mac.mm.patch +++ b/patches/chrome-browser-app_controller_mac.mm.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm -index 390413f227e3bcb7b3842f5f864ad9b2450a2338..5b7f5d9c9d6bc1759bcfbc951aafc3762d1a310f 100644 +index cdc779979f779bfea2778b492313c028f0f5cab3..109b928101c1a8feb079021bdaa1ff78624c7ee7 100644 --- a/chrome/browser/app_controller_mac.mm +++ b/chrome/browser/app_controller_mac.mm @@ -742,7 +742,7 @@ class AppControllerNativeThemeObserver : public ui::NativeThemeObserver { diff --git a/patches/chrome-browser-browser_process_impl.h.patch b/patches/chrome-browser-browser_process_impl.h.patch index 4af95fd02c5f..79ea17cae7f3 100644 --- a/patches/chrome-browser-browser_process_impl.h.patch +++ b/patches/chrome-browser-browser_process_impl.h.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/browser_process_impl.h b/chrome/browser/browser_process_impl.h -index 9b6380d7fe36ce94b2068f02daad4deade3bb392..4dbc3d81398ffc7c809e066ea50e1362c6843210 100644 +index 839558f24a06e1bb7bdb1bed15086a9cb7650122..c49e79efba0c8b04df3c97e65ab9345b04506391 100644 --- a/chrome/browser/browser_process_impl.h +++ b/chrome/browser/browser_process_impl.h @@ -242,6 +242,7 @@ class BrowserProcessImpl : public BrowserProcess, diff --git a/patches/chrome-browser-browsing_data-chrome_browsing_data_remover_delegate.cc.patch b/patches/chrome-browser-browsing_data-chrome_browsing_data_remover_delegate.cc.patch index 70364e419fac..720ca6b84140 100644 --- a/patches/chrome-browser-browsing_data-chrome_browsing_data_remover_delegate.cc.patch +++ b/patches/chrome-browser-browsing_data-chrome_browsing_data_remover_delegate.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc -index bba15cbd93207c47512ba1a15546983a189ff575..80919dfb7feb6db465fc7c86c47ccb42924fa383 100644 +index 8fc9f731879a9ac0f2948f34199c0a254242d732..ceecd3c0c5b26fba1b6220c03e209b23fe538021 100644 --- a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc +++ b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc -@@ -1654,6 +1654,7 @@ const char* ChromeBrowsingDataRemoverDelegate::GetHistogramSuffix( +@@ -1662,6 +1662,7 @@ const char* ChromeBrowsingDataRemoverDelegate::GetHistogramSuffix( return "WebrtcVideoPerfHistory"; case TracingDataType::kMediaDeviceSalts: return "MediaDeviceSalts"; diff --git a/patches/chrome-browser-browsing_data-chrome_browsing_data_remover_delegate.h.patch b/patches/chrome-browser-browsing_data-chrome_browsing_data_remover_delegate.h.patch index 264c93983b4a..3e4d013f4281 100644 --- a/patches/chrome-browser-browsing_data-chrome_browsing_data_remover_delegate.h.patch +++ b/patches/chrome-browser-browsing_data-chrome_browsing_data_remover_delegate.h.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h -index 99101411ce40137b106131e12e2f0cd8b16659f3..5e5776c8afed519fe018d75736f03eadcc07068e 100644 +index 24a1de14d83e5317ddb6ce481c4c46c9b3f86768..0cdb5d08be22f08a5f9ce13d898922de8f4795b4 100644 --- a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h +++ b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h -@@ -95,6 +95,7 @@ class ChromeBrowsingDataRemoverDelegate +@@ -96,6 +96,7 @@ class ChromeBrowsingDataRemoverDelegate void OverrideDomainReliabilityClearerForTesting( DomainReliabilityClearer clearer); @@ -10,7 +10,7 @@ index 99101411ce40137b106131e12e2f0cd8b16659f3..5e5776c8afed519fe018d75736f03ead private: using WebRtcEventLogManager = webrtc_event_logging::WebRtcEventLogManager; -@@ -150,8 +151,9 @@ class ChromeBrowsingDataRemoverDelegate +@@ -151,8 +152,9 @@ class ChromeBrowsingDataRemoverDelegate kMediaDeviceSalts = 45, // See also kDisableAutoSigninForProfilePasswords. kDisableAutoSigninForAccountPasswords = 46, diff --git a/patches/chrome-browser-content_settings-page_specific_content_settings_delegate.cc.patch b/patches/chrome-browser-content_settings-page_specific_content_settings_delegate.cc.patch index 8160053fa176..87b37743f30b 100644 --- a/patches/chrome-browser-content_settings-page_specific_content_settings_delegate.cc.patch +++ b/patches/chrome-browser-content_settings-page_specific_content_settings_delegate.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/content_settings/page_specific_content_settings_delegate.cc b/chrome/browser/content_settings/page_specific_content_settings_delegate.cc -index 6447bd038f86a7b52f50f20c161db51879aea2f2..36f03a541c2cb2e21a75b83542794d25a7668ada 100644 +index b682eae28e7944e59d2e7ec9f9e490ac4bafa3dc..e824dd6f5ada080d893302b5b859f5cb72135bad 100644 --- a/chrome/browser/content_settings/page_specific_content_settings_delegate.cc +++ b/chrome/browser/content_settings/page_specific_content_settings_delegate.cc -@@ -167,6 +167,7 @@ void GetGuestViewDefaultContentSettingRules( +@@ -204,6 +204,7 @@ void GetGuestViewDefaultContentSettingRules( ContentSettingsPattern::Wildcard(), ContentSettingsPattern::Wildcard(), content_settings::ContentSettingToValue(CONTENT_SETTING_BLOCK), content_settings::ProviderType::kNone, incognito)); diff --git a/patches/chrome-browser-download-download_target_determiner.cc.patch b/patches/chrome-browser-download-download_target_determiner.cc.patch index 914aa5875533..5827062a2640 100644 --- a/patches/chrome-browser-download-download_target_determiner.cc.patch +++ b/patches/chrome-browser-download-download_target_determiner.cc.patch @@ -1,16 +1,16 @@ diff --git a/chrome/browser/download/download_target_determiner.cc b/chrome/browser/download/download_target_determiner.cc -index ccb0cb0898c4b1d784e3047473b5535acd954512..49e9f3f46f4eff02dbb25362f73d7e67511a9c04 100644 +index f5734fdaaf90f2846266ec06080809a102adaa3d..062fe9b00ba5b74cd3dda183161f0ce39c19fb31 100644 --- a/chrome/browser/download/download_target_determiner.cc +++ b/chrome/browser/download/download_target_determiner.cc -@@ -1300,6 +1300,7 @@ DownloadFileType::DangerLevel DownloadTargetDeterminer::GetDangerLevel( +@@ -1309,6 +1309,7 @@ DownloadFileType::DangerLevel DownloadTargetDeterminer::GetDangerLevel( download_->GetDownloadSource() != download::DownloadSource::DRAG_AND_DROP; if (HasPromptedForPath() || confirmation_reason_ != DownloadConfirmationReason::NONE || + BRAVE_DOWNLOAD_TARGET_DETERMINER_GET_DANGER_LEVEL user_approved_path) { - return DownloadFileType::NOT_DANGEROUS; - } -@@ -1339,6 +1340,7 @@ DownloadFileType::DangerLevel DownloadTargetDeterminer::GetDangerLevel( + // If the "DownloadRestrictions" enterprise policy explicitly disallows the + // download, don't let the user gesture bypass the dangerous verdict. +@@ -1351,6 +1352,7 @@ DownloadFileType::DangerLevel DownloadTargetDeterminer::GetDangerLevel( ui::PAGE_TRANSITION_FROM_ADDRESS_BAR) != 0 || (download_->HasUserGesture() && visits == VISITED_REFERRER))) return DownloadFileType::NOT_DANGEROUS; diff --git a/patches/chrome-browser-extensions-BUILD.gn.patch b/patches/chrome-browser-extensions-BUILD.gn.patch index 2732dabf6b7e..86eda1347d8a 100644 --- a/patches/chrome-browser-extensions-BUILD.gn.patch +++ b/patches/chrome-browser-extensions-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/extensions/BUILD.gn b/chrome/browser/extensions/BUILD.gn -index 85da6b1a223e06f72c62f1c87081cc8f3766a8ea..04b2e327bba1cfb36d35048b48325a3ddf4ec559 100644 +index 132702a6a7ed2f8fd3333d25334cd0aa1f6f30d0..ef17c31e60cab39ccaa5c28f63071a4ffa2f5614 100644 --- a/chrome/browser/extensions/BUILD.gn +++ b/chrome/browser/extensions/BUILD.gn -@@ -1483,6 +1483,7 @@ source_set("extensions") { +@@ -1470,6 +1470,7 @@ source_set("extensions") { "//components/enterprise/data_controls/core/browser", ] } diff --git a/patches/chrome-browser-extensions-api-developer_private-extension_info_generator.cc.patch b/patches/chrome-browser-extensions-api-developer_private-extension_info_generator.cc.patch index a8ef0f30f6cf..d22f9c821372 100644 --- a/patches/chrome-browser-extensions-api-developer_private-extension_info_generator.cc.patch +++ b/patches/chrome-browser-extensions-api-developer_private-extension_info_generator.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/extensions/api/developer_private/extension_info_generator.cc b/chrome/browser/extensions/api/developer_private/extension_info_generator.cc -index ec62f6c16e7944a84cee3c0450ed508511656fcf..5682c257b265dfb833f214211b906acd3e72cca9 100644 +index 854892f76b3ded588f5d74019b79b53fe655dc93..859efe747100ab5b7ecb789f63d6e7752990cb6c 100644 --- a/chrome/browser/extensions/api/developer_private/extension_info_generator.cc +++ b/chrome/browser/extensions/api/developer_private/extension_info_generator.cc -@@ -678,6 +678,7 @@ void ExtensionInfoGenerator::CreateExtensionInfoHelper( +@@ -676,6 +676,7 @@ void ExtensionInfoGenerator::CreateExtensionInfoHelper( info->incognito_access.is_enabled = util::CanBeIncognitoEnabled(&extension); info->incognito_access.is_active = util::IsIncognitoEnabled(extension.id(), browser_context_); diff --git a/patches/chrome-browser-extensions-api-identity-identity_get_auth_token_function.cc.patch b/patches/chrome-browser-extensions-api-identity-identity_get_auth_token_function.cc.patch index 79cb6834f59a..a53ac9ad6bf6 100644 --- a/patches/chrome-browser-extensions-api-identity-identity_get_auth_token_function.cc.patch +++ b/patches/chrome-browser-extensions-api-identity-identity_get_auth_token_function.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/extensions/api/identity/identity_get_auth_token_function.cc b/chrome/browser/extensions/api/identity/identity_get_auth_token_function.cc -index da0938c298483c3c28deac413c6c8a9356247bd3..dff529029877f182aee728bc8fe2b5df21de841b 100644 +index 937a4ea9d621feb557b4ac900a53fb31a16e0e4e..6ff6a11ce88640f22e19a27ae2dcd63fe7f6bdba 100644 --- a/chrome/browser/extensions/api/identity/identity_get_auth_token_function.cc +++ b/chrome/browser/extensions/api/identity/identity_get_auth_token_function.cc @@ -186,6 +186,7 @@ ExtensionFunction::ResponseAction IdentityGetAuthTokenFunction::Run() { diff --git a/patches/chrome-browser-extensions-extension_management.cc.patch b/patches/chrome-browser-extensions-extension_management.cc.patch index 10d35447affd..5d5e501d1234 100644 --- a/patches/chrome-browser-extensions-extension_management.cc.patch +++ b/patches/chrome-browser-extensions-extension_management.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/extensions/extension_management.cc b/chrome/browser/extensions/extension_management.cc -index e7c575b4d4616779d3c73887bbb9b8bf06a991c8..e5a10157fe7ecf885e560e63d644bb8024fd577f 100644 +index e1c3ea8242ef8446ec8b55eb5425bf35a02b8c5f..90c18457ef324041d7908d3147e2a8ae3f74e2b9 100644 --- a/chrome/browser/extensions/extension_management.cc +++ b/chrome/browser/extensions/extension_management.cc -@@ -1053,6 +1053,7 @@ ExtensionManagementFactory::BuildServiceInstanceForBrowserContext( +@@ -1044,6 +1044,7 @@ ExtensionManagementFactory::BuildServiceInstanceForBrowserContext( content::BrowserContext* context) const { TRACE_EVENT0("browser,startup", "ExtensionManagementFactory::BuildServiceInstanceFor"); diff --git a/patches/chrome-browser-extensions-extension_tab_util.cc.patch b/patches/chrome-browser-extensions-extension_tab_util.cc.patch index 43d3247d80c7..2541fb394766 100644 --- a/patches/chrome-browser-extensions-extension_tab_util.cc.patch +++ b/patches/chrome-browser-extensions-extension_tab_util.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/extensions/extension_tab_util.cc b/chrome/browser/extensions/extension_tab_util.cc -index a896cb1079d975fc68cfaf2bd2aa4aa38e7d0af1..a1bbe5c1990b609e951e296d69eeb337c03a7443 100644 +index 4d2c067a060417c703466d0cbea3a0144dbfd63e..cb795f8399d706348ed7f29e1106f5ad5a02b244 100644 --- a/chrome/browser/extensions/extension_tab_util.cc +++ b/chrome/browser/extensions/extension_tab_util.cc -@@ -994,6 +994,7 @@ bool ExtensionTabUtil::IsKillURL(const GURL& url) { +@@ -1011,6 +1011,7 @@ bool ExtensionTabUtil::IsKillURL(const GURL& url) { } if (!url.SchemeIs(content::kChromeUIScheme)) { diff --git a/patches/chrome-browser-extensions-updater-chrome_update_client_config.h.patch b/patches/chrome-browser-extensions-updater-chrome_update_client_config.h.patch index 37099f680a9f..1360e5a9c535 100644 --- a/patches/chrome-browser-extensions-updater-chrome_update_client_config.h.patch +++ b/patches/chrome-browser-extensions-updater-chrome_update_client_config.h.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/extensions/updater/chrome_update_client_config.h b/chrome/browser/extensions/updater/chrome_update_client_config.h -index de6c63b9c0853df7bef89fb0121a622ea842cf4d..ee72ffd6c9f05d2ac4e9f699bdee67e32b18d3ed 100644 +index cacc95a3f90cc87242417c0683b7ba087c9834db..30334d1552c423dfebaaf4da3614c7bddaee8893 100644 --- a/chrome/browser/extensions/updater/chrome_update_client_config.h +++ b/chrome/browser/extensions/updater/chrome_update_client_config.h @@ -86,6 +86,7 @@ class ChromeUpdateClientConfig : public update_client::Configurator { diff --git a/patches/chrome-browser-external_protocol-external_protocol_handler.cc.patch b/patches/chrome-browser-external_protocol-external_protocol_handler.cc.patch index b18e158660af..687049d4459b 100644 --- a/patches/chrome-browser-external_protocol-external_protocol_handler.cc.patch +++ b/patches/chrome-browser-external_protocol-external_protocol_handler.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/external_protocol/external_protocol_handler.cc b/chrome/browser/external_protocol/external_protocol_handler.cc -index b44735d5eedeb988445e030f9b4d64c85be1b120..d5c44d4e1d3e2f7981f89f5a20d258a0e4b9dd7c 100644 +index 79cf46499669fab949ad31627ba64bdf300524d1..80710b463ee55464a5558c0b56b7278d9aef94fa 100644 --- a/chrome/browser/external_protocol/external_protocol_handler.cc +++ b/chrome/browser/external_protocol/external_protocol_handler.cc @@ -409,7 +409,7 @@ ExternalProtocolHandler::BlockState ExternalProtocolHandler::GetBlockState( diff --git a/patches/chrome-browser-first_run-upgrade_util_win.cc.patch b/patches/chrome-browser-first_run-upgrade_util_win.cc.patch index 3875c2cb9576..c1e76443629f 100644 --- a/patches/chrome-browser-first_run-upgrade_util_win.cc.patch +++ b/patches/chrome-browser-first_run-upgrade_util_win.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/first_run/upgrade_util_win.cc b/chrome/browser/first_run/upgrade_util_win.cc -index 6ccdc7b64a7280de0d35ad518093a181b64b29da..01e75feed101a16e80b45ffd9e76fdefc76c728e 100644 +index 98b9f65bc2bfe747c245eafa9835993fd16b0121..2fc922c81266970cb9ad787202a16f721e0185da 100644 --- a/chrome/browser/first_run/upgrade_util_win.cc +++ b/chrome/browser/first_run/upgrade_util_win.cc @@ -58,7 +58,7 @@ diff --git a/patches/chrome-browser-hub-internal-BUILD.gn.patch b/patches/chrome-browser-hub-internal-BUILD.gn.patch index 2d5dbcafc8c1..e04bed314e1d 100644 --- a/patches/chrome-browser-hub-internal-BUILD.gn.patch +++ b/patches/chrome-browser-hub-internal-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/hub/internal/BUILD.gn b/chrome/browser/hub/internal/BUILD.gn -index 248b2853c853bddcd11b7fa499d093be1f258757..07dd8808809064efc9fd197f512f907cbfa22e83 100644 +index 814f1719c0a6230bae7f94d300b6204248db9443..f387c3817abe90ece28fab3732f535af8ba430c6 100644 --- a/chrome/browser/hub/internal/BUILD.gn +++ b/chrome/browser/hub/internal/BUILD.gn -@@ -43,6 +43,7 @@ android_library("java") { +@@ -46,6 +46,7 @@ android_library("java") { "android/java/src/org/chromium/chrome/browser/hub/TranslateHubLayoutAnimationFactory.java", "android/java/src/org/chromium/chrome/browser/hub/TranslateHubLayoutAnimationFactoryImpl.java", ] diff --git a/patches/chrome-browser-importer-in_process_importer_bridge.cc.patch b/patches/chrome-browser-importer-in_process_importer_bridge.cc.patch index a4fe49e6c955..a8e6d662d54f 100644 --- a/patches/chrome-browser-importer-in_process_importer_bridge.cc.patch +++ b/patches/chrome-browser-importer-in_process_importer_bridge.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/importer/in_process_importer_bridge.cc b/chrome/browser/importer/in_process_importer_bridge.cc -index a790dff1dce88b40db1381d0fee32c20cfc1daec..f6295395655a8d0a37143d761f017304e8adc536 100644 +index 6cf54e82d96e8e887e420b34cdc10a79225625d7..8293a720dcf54ad52737414f375466e50d9804b5 100644 --- a/chrome/browser/importer/in_process_importer_bridge.cc +++ b/chrome/browser/importer/in_process_importer_bridge.cc @@ -53,6 +53,8 @@ history::VisitSource ConvertImporterVisitSourceToHistoryVisitSource( @@ -9,5 +9,5 @@ index a790dff1dce88b40db1381d0fee32c20cfc1daec..f6295395655a8d0a37143d761f017304 + case importer::VISIT_SOURCE_CHROME_IMPORTED: + return history::SOURCE_CHROME_IMPORTED; } - NOTREACHED_IN_MIGRATION(); - return history::SOURCE_SYNCED; + NOTREACHED(); + } diff --git a/patches/chrome-browser-net-profile_network_context_service.cc.patch b/patches/chrome-browser-net-profile_network_context_service.cc.patch index d6b4a7add2c8..aefe85d669e1 100644 --- a/patches/chrome-browser-net-profile_network_context_service.cc.patch +++ b/patches/chrome-browser-net-profile_network_context_service.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/net/profile_network_context_service.cc b/chrome/browser/net/profile_network_context_service.cc -index f63eddccb64da91beaaca2684ad63e5c3815e5f9..5f6cfd585807ae5a1ed66b9b118d4c909b684260 100644 +index 3956f9fea2546b645e2712b5434414735e82ca79..71bef9c8f01e8dd98ab413dffc53f91d6cfe53cf 100644 --- a/chrome/browser/net/profile_network_context_service.cc +++ b/chrome/browser/net/profile_network_context_service.cc -@@ -588,6 +588,7 @@ network::mojom::CTPolicyPtr ProfileNetworkContextService::GetCTPolicy() { +@@ -614,6 +614,7 @@ network::mojom::CTPolicyPtr ProfileNetworkContextService::GetCTPolicy() { std::vector excluded_spkis( TranslateStringArray(ct_excluded_spkis)); diff --git a/patches/chrome-browser-net-proxy_config_monitor.cc.patch b/patches/chrome-browser-net-proxy_config_monitor.cc.patch index c085e8fd4b0a..64994edf1a69 100644 --- a/patches/chrome-browser-net-proxy_config_monitor.cc.patch +++ b/patches/chrome-browser-net-proxy_config_monitor.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/net/proxy_config_monitor.cc b/chrome/browser/net/proxy_config_monitor.cc -index bb520c729dae1d37d78c5ed48191dcd5e5047831..10441cf4697de38558f823d36c4ea53c2380ad98 100644 +index ecc6f393533139045b9153c428bfb34a45e9c272..33c0023bacb77db9c888edf5ba4928ff5dd08a37 100644 --- a/chrome/browser/net/proxy_config_monitor.cc +++ b/chrome/browser/net/proxy_config_monitor.cc @@ -52,6 +52,7 @@ ProxyConfigMonitor::ProxyConfigMonitor(Profile* profile) { diff --git a/patches/chrome-browser-net-system_network_context_manager.cc.patch b/patches/chrome-browser-net-system_network_context_manager.cc.patch index 60e2ff836861..78a9084bb429 100644 --- a/patches/chrome-browser-net-system_network_context_manager.cc.patch +++ b/patches/chrome-browser-net-system_network_context_manager.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/net/system_network_context_manager.cc b/chrome/browser/net/system_network_context_manager.cc -index 1730a008726665c27d3275b98644cc3d1d94a670..10ceb57bf010493f9fa0050795ff22e7de17ac60 100644 +index ab75dd72b49fc2461f8bcb7694b710bd563a4b6b..9ade9db18b900d24b19557f6c4f4de90ffb39ad9 100644 --- a/chrome/browser/net/system_network_context_manager.cc +++ b/chrome/browser/net/system_network_context_manager.cc -@@ -406,7 +406,7 @@ class SystemNetworkContextManager::URLLoaderFactoryForSystem +@@ -407,7 +407,7 @@ class SystemNetworkContextManager::URLLoaderFactoryForSystem if (!manager_) return; manager_->GetURLLoaderFactory()->CreateLoaderAndStart( diff --git a/patches/chrome-browser-notifications-notification_display_service_impl.cc.patch b/patches/chrome-browser-notifications-notification_display_service_impl.cc.patch index 44ecf30a9618..4cfaab48622f 100644 --- a/patches/chrome-browser-notifications-notification_display_service_impl.cc.patch +++ b/patches/chrome-browser-notifications-notification_display_service_impl.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/notifications/notification_display_service_impl.cc b/chrome/browser/notifications/notification_display_service_impl.cc -index 2689c1b3d1d12ede89245df1d16c687b7e4d2b8f..e5f70850ea00a59a797ef424ccd166c3deb432a0 100644 +index 52f7fc857ec38cd9be2cb9b0fbbc8498fabac0c4..30c6c9052408d5b3bcf1265b200c86538350073a 100644 --- a/chrome/browser/notifications/notification_display_service_impl.cc +++ b/chrome/browser/notifications/notification_display_service_impl.cc -@@ -123,6 +123,7 @@ NotificationDisplayServiceImpl::NotificationDisplayServiceImpl(Profile* profile) +@@ -115,6 +115,7 @@ NotificationDisplayServiceImpl::NotificationDisplayServiceImpl(Profile* profile) std::make_unique()); } #endif diff --git a/patches/chrome-browser-notifications-notification_platform_bridge_android.h.patch b/patches/chrome-browser-notifications-notification_platform_bridge_android.h.patch deleted file mode 100644 index 14d6808b32ac..000000000000 --- a/patches/chrome-browser-notifications-notification_platform_bridge_android.h.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/chrome/browser/notifications/notification_platform_bridge_android.h b/chrome/browser/notifications/notification_platform_bridge_android.h -index e401e810324b5cdea8645c8efcf092818601d432..6c24de709839b9c30fde8fbcc3e5072b20024ff9 100644 ---- a/chrome/browser/notifications/notification_platform_bridge_android.h -+++ b/chrome/browser/notifications/notification_platform_bridge_android.h -@@ -102,6 +102,7 @@ class NotificationPlatformBridgeAndroid : public NotificationPlatformBridge { - static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); - - private: -+ friend class BraveNotificationPlatformBridgeHelperAndroid; - // Contains information necessary in order to enable closing notifications - // that were not created by this instance of the manager. This list may not - // contain the notifications that have not been interacted with since the last diff --git a/patches/chrome-browser-prefs-browser_prefs.cc.patch b/patches/chrome-browser-prefs-browser_prefs.cc.patch index e185354e6046..2fea5a0bbb38 100644 --- a/patches/chrome-browser-prefs-browser_prefs.cc.patch +++ b/patches/chrome-browser-prefs-browser_prefs.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc -index 3e27913d47dc75eddcf96b829f5440ba73e6357a..c2506c63c9b80059e6f723040bac0db14dd96118 100644 +index 7d352058fb59f8ab77c8a35a8b16f15a2f3d216d..91990f59deec51633f2917a2e4e308cb611dc683 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc -@@ -1940,6 +1940,7 @@ void RegisterLocalState(PrefRegistrySimple* registry) { +@@ -1903,6 +1903,7 @@ void RegisterLocalState(PrefRegistrySimple* registry) { registry->RegisterBooleanPref(prefs::kQRCodeGeneratorEnabled, true); // This is intentionally last. @@ -10,7 +10,7 @@ index 3e27913d47dc75eddcf96b829f5440ba73e6357a..c2506c63c9b80059e6f723040bac0db1 RegisterLocalStatePrefsForMigration(registry); } -@@ -2380,6 +2381,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry, +@@ -2344,6 +2345,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry, registry->RegisterDictionaryPref(prefs::kReportingEndpoints); registry->RegisterBooleanPref(prefs::kCompactModeEnabled, false); diff --git a/patches/chrome-browser-profiles-profile.cc.patch b/patches/chrome-browser-profiles-profile.cc.patch index 28d0f5c463af..f7ce328c5cce 100644 --- a/patches/chrome-browser-profiles-profile.cc.patch +++ b/patches/chrome-browser-profiles-profile.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc -index 89254771117da2948bc176b881873e0d22f5ade6..6d7915b59f0fdc153262c2e30b1cc2c15932fdc3 100644 +index 4385d5d90f9c8a91a3fdefd5ce7d938575ac8ecb..fbcd54dd9795da725bc11d04e3a3cfb817554518 100644 --- a/chrome/browser/profiles/profile.cc +++ b/chrome/browser/profiles/profile.cc -@@ -101,6 +101,7 @@ bool Profile::OTRProfileID::AllowsBrowserWindows() const { +@@ -104,6 +104,7 @@ bool Profile::OTRProfileID::AllowsBrowserWindows() const { // DevTools::BrowserContext, MediaRouter::Presentation, and // CaptivePortal::Signin are exceptions to this ban. if (*this == PrimaryID() || diff --git a/patches/chrome-browser-profiles-profile_attributes_entry.cc.patch b/patches/chrome-browser-profiles-profile_attributes_entry.cc.patch index b97cdb56808e..a4e68dbbdc9f 100644 --- a/patches/chrome-browser-profiles-profile_attributes_entry.cc.patch +++ b/patches/chrome-browser-profiles-profile_attributes_entry.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/profiles/profile_attributes_entry.cc b/chrome/browser/profiles/profile_attributes_entry.cc -index 640b8198e61c8f3a724b283ef13b4ecf0cfbccea..07183ca537ec58e83cf0c775fd25028a4ec203b2 100644 +index 0c74d9d6fcc86633bbc25cb1d4d478a46195a68d..2c1582cb0113cb8b4fe3dfd9a89718a1c9d9f44b 100644 --- a/chrome/browser/profiles/profile_attributes_entry.cc +++ b/chrome/browser/profiles/profile_attributes_entry.cc -@@ -1054,6 +1054,7 @@ bool ProfileAttributesEntry::ClearValue(const char* key) { +@@ -1052,6 +1052,7 @@ bool ProfileAttributesEntry::ClearValue(const char* key) { // This method should be periodically pruned of year+ old migrations. void ProfileAttributesEntry::MigrateObsoleteProfileAttributes() { diff --git a/patches/chrome-browser-renderer_context_menu-render_view_context_menu.cc.patch b/patches/chrome-browser-renderer_context_menu-render_view_context_menu.cc.patch index 363ef01f5118..f02c99bd57a0 100644 --- a/patches/chrome-browser-renderer_context_menu-render_view_context_menu.cc.patch +++ b/patches/chrome-browser-renderer_context_menu-render_view_context_menu.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/chrome/browser/renderer_context_menu/render_view_context_menu.cc -index 31f179bf8f410adfffaa540f4b0f0b84c8a32fea..b4e769b8ab905560c84f27f72152859f9dd94a14 100644 +index a1564ffe50f305c2fb88cfe03136ec316b92b841..4d7c3241d883ffe5129de98689564d172deec562 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc -@@ -2414,6 +2414,7 @@ void RenderViewContextMenu::AppendSearchProvider() { +@@ -2405,6 +2405,7 @@ void RenderViewContextMenu::AppendSearchProvider() { if (!selection_navigation_url_.is_valid()) { return; } diff --git a/patches/chrome-browser-renderer_context_menu-render_view_context_menu.h.patch b/patches/chrome-browser-renderer_context_menu-render_view_context_menu.h.patch index 30d512293159..b63761e92f67 100644 --- a/patches/chrome-browser-renderer_context_menu-render_view_context_menu.h.patch +++ b/patches/chrome-browser-renderer_context_menu-render_view_context_menu.h.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.h b/chrome/browser/renderer_context_menu/render_view_context_menu.h -index 0bb9353cb7da0a6603984809247075e6168c8e20..82d856b538096ee631bed6a169883118b2563827 100644 +index b9ab5b1295599c8fe8507e8a735ace61260349d5..a0f567b05065fe6a7d646c031b6108d5da86efe4 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu.h +++ b/chrome/browser/renderer_context_menu/render_view_context_menu.h @@ -198,6 +198,7 @@ class RenderViewContextMenu diff --git a/patches/chrome-browser-renderer_context_menu-spelling_options_submenu_observer.h.patch b/patches/chrome-browser-renderer_context_menu-spelling_options_submenu_observer.h.patch index 93c5b5d08a51..101ac14d4139 100644 --- a/patches/chrome-browser-renderer_context_menu-spelling_options_submenu_observer.h.patch +++ b/patches/chrome-browser-renderer_context_menu-spelling_options_submenu_observer.h.patch @@ -1,9 +1,9 @@ diff --git a/chrome/browser/renderer_context_menu/spelling_options_submenu_observer.h b/chrome/browser/renderer_context_menu/spelling_options_submenu_observer.h -index ead951efd696685e52a8e125357aad9aabfead0c..8dd52683fa07f44b6af853182cc040f18b92e65a 100644 +index 4954048e718931075079e74a76ec70cd78239dfd..4c731efe3c35aa57978f9d09b6d3dc65dfca4658 100644 --- a/chrome/browser/renderer_context_menu/spelling_options_submenu_observer.h +++ b/chrome/browser/renderer_context_menu/spelling_options_submenu_observer.h @@ -15,10 +15,12 @@ - #include "ui/base/models/simple_menu_model.h" + #include "ui/menus/simple_menu_model.h" class RenderViewContextMenuProxy; +class BraveSpellingOptionsSubMenuObserver; diff --git a/patches/chrome-browser-resources-bookmarks-command_manager.ts.patch b/patches/chrome-browser-resources-bookmarks-command_manager.ts.patch index dc3324d022a9..ed6d2045c155 100644 --- a/patches/chrome-browser-resources-bookmarks-command_manager.ts.patch +++ b/patches/chrome-browser-resources-bookmarks-command_manager.ts.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/resources/bookmarks/command_manager.ts b/chrome/browser/resources/bookmarks/command_manager.ts -index bb32532feaa4b9a32f1467091b47205894d27e22..0ab4125fa0cac25217b4923352d1cf3535805b2d 100644 +index 0a1326419929ce335ffb24dbbc4d538bc5e1dd1d..a0ac193f3fb6ade59b290dbb2ef5c0319ade5a15 100644 --- a/chrome/browser/resources/bookmarks/command_manager.ts +++ b/chrome/browser/resources/bookmarks/command_manager.ts @@ -426,7 +426,7 @@ export class BookmarksCommandManagerElement extends diff --git a/patches/chrome-browser-resources-extensions-BUILD.gn.patch b/patches/chrome-browser-resources-extensions-BUILD.gn.patch index a13f13649122..776bdb848e07 100644 --- a/patches/chrome-browser-resources-extensions-BUILD.gn.patch +++ b/patches/chrome-browser-resources-extensions-BUILD.gn.patch @@ -1,10 +1,10 @@ diff --git a/chrome/browser/resources/extensions/BUILD.gn b/chrome/browser/resources/extensions/BUILD.gn -index 875fd23fc501c93ed2dd22e91d44352f904e97d4..5e5203f5fe0a1f7dc276a53f172f88af75834481 100644 +index ee8cbb304d95e41884ba56331d7c187940e1f33f..ecd5657c519d894485bb656674a4732898f111aa 100644 --- a/chrome/browser/resources/extensions/BUILD.gn +++ b/chrome/browser/resources/extensions/BUILD.gn -@@ -126,4 +126,5 @@ build_webui("build") { +@@ -163,4 +163,5 @@ build_webui("build") { optimize_webui_host = "extensions" optimize_webui_in_files = [ "extensions.js" ] } -+ import("//brave/browser/resources/extensions/sources.gni") web_component_files += brave_extensions_web_component_files non_web_component_files += brave_extensions_non_web_component_files exclude_ts_preprocess_files = brave_extensions_local_ts_files exclude_html_css_preprocess_files = brave_extensions_local_html_files preprocess_deps = brave_extensions_preprocess_extra_deps ++ import("//brave/browser/resources/extensions/sources.gni") non_web_component_files += brave_extensions_non_web_component_files css_files += brave_extensions_css_files exclude_ts_preprocess_files = brave_extensions_local_ts_files exclude_html_css_preprocess_files = brave_extensions_local_html_css_files preprocess_deps = brave_extensions_preprocess_extra_deps } diff --git a/patches/chrome-browser-resources-extensions-extensions.ts.patch b/patches/chrome-browser-resources-extensions-extensions.ts.patch index a7f0281837e1..250c1c2d2a51 100644 --- a/patches/chrome-browser-resources-extensions-extensions.ts.patch +++ b/patches/chrome-browser-resources-extensions-extensions.ts.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/resources/extensions/extensions.ts b/chrome/browser/resources/extensions/extensions.ts -index 74acc182a99b7864509335588b6a60893c0661d4..60ed52f2970c5a8f263e72f6d71bec216023ebf3 100644 +index ea5661d9af7ee277c1106f839ce0daa28cfc5d8c..6916f3132b14d156b361c56532ad89738be71eee 100644 --- a/chrome/browser/resources/extensions/extensions.ts +++ b/chrome/browser/resources/extensions/extensions.ts @@ -2,6 +2,7 @@ diff --git a/patches/chrome-browser-resources-extensions-item_list.html.patch b/patches/chrome-browser-resources-extensions-item_list.html.patch deleted file mode 100644 index 33a1096787a3..000000000000 --- a/patches/chrome-browser-resources-extensions-item_list.html.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff --git a/chrome/browser/resources/extensions/item_list.html b/chrome/browser/resources/extensions/item_list.html -index 0142e7b64129a4b30505d8951f19d08ebef273e7..a027bc9045bcc4917702a07db9c41462fd58026d 100644 ---- a/chrome/browser/resources/extensions/item_list.html -+++ b/chrome/browser/resources/extensions/item_list.html -@@ -165,5 +165,6 @@ - - - -+ - - diff --git a/patches/chrome-browser-resources-extensions-item_list.ts.patch b/patches/chrome-browser-resources-extensions-item_list.ts.patch index 1c8a36bc6d99..5ead15874a2b 100644 --- a/patches/chrome-browser-resources-extensions-item_list.ts.patch +++ b/patches/chrome-browser-resources-extensions-item_list.ts.patch @@ -1,10 +1,10 @@ diff --git a/chrome/browser/resources/extensions/item_list.ts b/chrome/browser/resources/extensions/item_list.ts -index 22b0f8711ef0388f249d2a206c658ffc7813ebd6..8749d81790c85b8a71dea14c8eed182c24a2aadc 100644 +index 6f56fabeb936f8a747a9ef0988fc6bdefc745622..530dca5f5d8a44702046728276511bc8e10f4419 100644 --- a/chrome/browser/resources/extensions/item_list.ts +++ b/chrome/browser/resources/extensions/item_list.ts -@@ -16,6 +16,7 @@ import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bu - import type {ExtensionsItemElement, ItemDelegate} from './item.js'; - import {getTemplate} from './item_list.html.js'; +@@ -18,6 +18,7 @@ import type {ExtensionsItemElement, ItemDelegate} from './item.js'; + import {getCss} from './item_list.css.js'; + import {getHtml} from './item_list.html.js'; import {getMv2ExperimentStage, Mv2ExperimentStage} from './mv2_deprecation_util.js'; +import './brave_item_list_more_items.js' diff --git a/patches/chrome-browser-resources-extensions-sidebar.html.patch b/patches/chrome-browser-resources-extensions-sidebar.html.patch deleted file mode 100644 index c5a01726ffa2..000000000000 --- a/patches/chrome-browser-resources-extensions-sidebar.html.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/chrome/browser/resources/extensions/sidebar.html b/chrome/browser/resources/extensions/sidebar.html -index ff74778591b553de60c1125656f1108d70c6d868..bfa71e3cc8ddc6fee2539f87a2f24a3837913922 100644 ---- a/chrome/browser/resources/extensions/sidebar.html -+++ b/chrome/browser/resources/extensions/sidebar.html -@@ -24,6 +24,7 @@ - - - -+ diff --git a/patches/chrome-browser-resources-history-BUILD.gn.patch b/patches/chrome-browser-resources-history-BUILD.gn.patch index 61a2bcef7d7c..008ace2a488d 100644 --- a/patches/chrome-browser-resources-history-BUILD.gn.patch +++ b/patches/chrome-browser-resources-history-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/resources/history/BUILD.gn b/chrome/browser/resources/history/BUILD.gn -index 372975618eebc2d5cba0961cbca4e0113f04d60a..84234b138014b51fc288ac008ea5ba46166d054d 100644 +index 7b7b44c0ba80fb83a0e705650537ab4505977ebe..41ad31824164428df023cdd2ca82df224dd11494 100644 --- a/chrome/browser/resources/history/BUILD.gn +++ b/chrome/browser/resources/history/BUILD.gn -@@ -86,4 +86,5 @@ build_webui("build") { +@@ -89,4 +89,5 @@ build_webui("build") { "lazy_load.js", ] } diff --git a/patches/chrome-browser-resources-history-history.ts.patch b/patches/chrome-browser-resources-history-history.ts.patch index 73467a8b6e24..cf95c53537cb 100644 --- a/patches/chrome-browser-resources-history-history.ts.patch +++ b/patches/chrome-browser-resources-history-history.ts.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/resources/history/history.ts b/chrome/browser/resources/history/history.ts -index df7ce3f1cfb1adf3cad7f58cdfffb655e4547f3a..ccba80a32d4a9db2c9158dd737059cfab614e2a9 100644 +index 5aa8bff2a95f6016605a70b785af0865a9a5f168..32abc81e135a543388e0fc48be4e7a39edc3e799 100644 --- a/chrome/browser/resources/history/history.ts +++ b/chrome/browser/resources/history/history.ts @@ -2,6 +2,7 @@ @@ -9,4 +9,4 @@ index df7ce3f1cfb1adf3cad7f58cdfffb655e4547f3a..ccba80a32d4a9db2c9158dd737059cfa +import './brave_overrides/index.js'; import './app.js'; - export {BrowserProxyImpl as ShoppingBrowserProxyImpl} from 'chrome://resources/cr_components/commerce/browser_proxy.js'; + export {PageCallbackRouter as ProductSpecificationsCallbackRouter} from 'chrome://resources/cr_components/commerce/product_specifications.mojom-webui.js'; diff --git a/patches/chrome-browser-resources-history-history_item.ts.patch b/patches/chrome-browser-resources-history-history_item.ts.patch index 62921c423019..7cc9da92d11f 100644 --- a/patches/chrome-browser-resources-history-history_item.ts.patch +++ b/patches/chrome-browser-resources-history-history_item.ts.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/resources/history/history_item.ts b/chrome/browser/resources/history/history_item.ts -index 0349af62bc595150b87232f899b978a6eb4b56a1..f4b115e5819443cf64af6d507b9f90996faaf524 100644 +index e4d05d936ff198633691ab5fc871683a1f8dcfb0..e7da86a54fc022ac467285c6507cbd91e8f9b8c1 100644 --- a/chrome/browser/resources/history/history_item.ts +++ b/chrome/browser/resources/history/history_item.ts @@ -10,6 +10,7 @@ import 'chrome://resources/cr_elements/cr_icon/cr_icon.js'; diff --git a/patches/chrome-browser-resources-password_manager-BUILD.gn.patch b/patches/chrome-browser-resources-password_manager-BUILD.gn.patch index e754dd85bc83..ee76b16f131b 100644 --- a/patches/chrome-browser-resources-password_manager-BUILD.gn.patch +++ b/patches/chrome-browser-resources-password_manager-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/resources/password_manager/BUILD.gn b/chrome/browser/resources/password_manager/BUILD.gn -index db130bfc91f9743c31d2042393238032c4803680..81f04d556c4f82fbd32743704e4a4bfbb9e504c2 100644 +index 7ec2ef22a1c79b0a593d263dc4d4c6291e975701..618e5fbf0ac7c132dafe2d76142d0e3d8c7ff4c4 100644 --- a/chrome/browser/resources/password_manager/BUILD.gn +++ b/chrome/browser/resources/password_manager/BUILD.gn -@@ -168,4 +168,5 @@ build_webui("build") { +@@ -154,4 +154,5 @@ build_webui("build") { "$root_gen_dir/chrome/browser/resources/settings_shared/tsc", root_build_dir) ] } diff --git a/patches/chrome-browser-resources-password_manager-password_manager.ts.patch b/patches/chrome-browser-resources-password_manager-password_manager.ts.patch index 5540f1597cba..53e795143c98 100644 --- a/patches/chrome-browser-resources-password_manager-password_manager.ts.patch +++ b/patches/chrome-browser-resources-password_manager-password_manager.ts.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/resources/password_manager/password_manager.ts b/chrome/browser/resources/password_manager/password_manager.ts -index 12ca0e4a9e9d124e32fa0282e15d2f8f719a402f..88151643da3fc5668c0f5162e6c453473ed1ef99 100644 +index 4552775cabcce17c42d85eee4abc4e0b57ef6de8..f61100606951cf62b6e189f20c960f65fb499793 100644 --- a/chrome/browser/resources/password_manager/password_manager.ts +++ b/chrome/browser/resources/password_manager/password_manager.ts @@ -2,6 +2,7 @@ diff --git a/patches/chrome-browser-resources-settings-BUILD.gn.patch b/patches/chrome-browser-resources-settings-BUILD.gn.patch index 585ed672fbdd..5075b9b61e15 100644 --- a/patches/chrome-browser-resources-settings-BUILD.gn.patch +++ b/patches/chrome-browser-resources-settings-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/resources/settings/BUILD.gn b/chrome/browser/resources/settings/BUILD.gn -index 4f67e62a9d29966790ce80c5926e4a9f57f30ae2..f1199b0ec883f7fafc151a64a59d657232d0291d 100644 +index 15fe00363df93896ee6a64ec238744491e8efe91..811cb5622c96e491320fa1f6b9fa0866ad347e4a 100644 --- a/chrome/browser/resources/settings/BUILD.gn +++ b/chrome/browser/resources/settings/BUILD.gn -@@ -456,4 +456,5 @@ build_webui("build") { +@@ -446,4 +446,5 @@ build_webui("build") { "$root_gen_dir/chrome/browser/resources/settings_shared/tsc", root_build_dir) ] } diff --git a/patches/chrome-browser-resources-settings-people_page-sync_controls.ts.patch b/patches/chrome-browser-resources-settings-people_page-sync_controls.ts.patch index 1ea61e078197..efe4e337ed4f 100644 --- a/patches/chrome-browser-resources-settings-people_page-sync_controls.ts.patch +++ b/patches/chrome-browser-resources-settings-people_page-sync_controls.ts.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/resources/settings/people_page/sync_controls.ts b/chrome/browser/resources/settings/people_page/sync_controls.ts -index 6227bb90a5bdedd03cf15522502166a80fd2a4a2..bf6b8bc86871714deeda4de5e38afd1ebeb3a4ed 100644 +index 7ddd141129a0efd475849b991c0b92a325c30a32..2ae494a21f67b099a4f7c6126aeabda027b8d337 100644 --- a/chrome/browser/resources/settings/people_page/sync_controls.ts +++ b/chrome/browser/resources/settings/people_page/sync_controls.ts -@@ -117,7 +117,7 @@ export class SettingsSyncControlsElement extends +@@ -98,7 +98,7 @@ export class SettingsSyncControlsElement extends const router = Router.getInstance(); if (router.getCurrentRoute() === diff --git a/patches/chrome-browser-resources-settings-privacy_page-personalization_options.html.patch b/patches/chrome-browser-resources-settings-privacy_page-personalization_options.html.patch index 7bede01313a1..fd04ec728f0a 100644 --- a/patches/chrome-browser-resources-settings-privacy_page-personalization_options.html.patch +++ b/patches/chrome-browser-resources-settings-privacy_page-personalization_options.html.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/resources/settings/privacy_page/personalization_options.html b/chrome/browser/resources/settings/privacy_page/personalization_options.html -index b86ef3f0d419048dceb1b3d76cf885bbcfd84fcc..279b9bdcbd515d6c1280898455cea7800d840e91 100644 +index 65aa8917b210bae3261b5592eb9615f608b283b8..317ea88f3edec6a22ba03fcdb5599588f317015e 100644 --- a/chrome/browser/resources/settings/privacy_page/personalization_options.html +++ b/chrome/browser/resources/settings/privacy_page/personalization_options.html @@ -23,7 +23,7 @@ @@ -11,15 +11,15 @@ index b86ef3f0d419048dceb1b3d76cf885bbcfd84fcc..279b9bdcbd515d6c1280898455cea780