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 5b0094440c23..265d5936bdc2 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 @@ -21,9 +21,9 @@ import org.chromium.chrome.browser.compositor.layouts.content.TabContentManager; import org.chromium.chrome.browser.lifecycle.ActivityLifecycleDispatcher; import org.chromium.chrome.browser.share.ShareDelegate; +import org.chromium.chrome.browser.tabmodel.IncognitoStateProvider; import org.chromium.chrome.browser.tabmodel.TabCreatorManager; import org.chromium.chrome.browser.tabmodel.TabModelSelector; -import org.chromium.chrome.browser.theme.ThemeColorProvider; import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager; import org.chromium.chrome.tab_ui.R; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; @@ -36,7 +36,7 @@ public class BraveTabGroupUiCoordinator extends TabGroupUiCoordinator { private TabGroupUiToolbarView mToolbarView; public BraveTabGroupUiCoordinator(@NonNull Activity activity, @NonNull ViewGroup parentView, - @NonNull ThemeColorProvider themeColorProvider, + @NonNull IncognitoStateProvider incognitoStateProvider, @NonNull ScrimCoordinator scrimCoordinator, @NonNull ObservableSupplier omniboxFocusStateSupplier, @NonNull BottomSheetController bottomSheetController, @@ -49,15 +49,13 @@ public BraveTabGroupUiCoordinator(@NonNull Activity activity, @NonNull ViewGroup @NonNull Supplier shareDelegateSupplier, @NonNull OneshotSupplier overviewModeBehaviorSupplier, @NonNull SnackbarManager snackbarManager) { - super(activity, parentView, themeColorProvider, scrimCoordinator, omniboxFocusStateSupplier, - bottomSheetController, activityLifecycleDispatcher, isWarmOnResumeSupplier, - tabModelSelector, tabContentManager, rootView, dynamicResourceLoaderSupplier, - tabCreatorManager, shareDelegateSupplier, overviewModeBehaviorSupplier, - snackbarManager); + super(activity, parentView, incognitoStateProvider, scrimCoordinator, + omniboxFocusStateSupplier, bottomSheetController, activityLifecycleDispatcher, + isWarmOnResumeSupplier, tabModelSelector, tabContentManager, rootView, + dynamicResourceLoaderSupplier, tabCreatorManager, shareDelegateSupplier, + overviewModeBehaviorSupplier, snackbarManager); assert mToolbarView != null : "Make sure mToolbarView is properly patched in bytecode."; - mToolbarView.setBackgroundColor(ApiCompatibilityUtils.getColor( - mToolbarView.getResources(), R.color.toolbar_background_primary)); ChromeImageView fadingEdgeStart = mToolbarView.findViewById(R.id.tab_strip_fading_edge_start); assert fadingEdgeStart != null : "Something has changed in upstream."; 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 cb28cf3b3871..7bf15e747885 100644 --- a/android/java/org/chromium/chrome/browser/privacy/settings/BravePrivacySettings.java +++ b/android/java/org/chromium/chrome/browser/privacy/settings/BravePrivacySettings.java @@ -219,6 +219,7 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { removePreferenceIfPresent(PREF_AD_BLOCK); removePreferenceIfPresent(PREF_SYNC_AND_SERVICES_LINK); removePreferenceIfPresent(PREF_NETWORK_PREDICTIONS); + removePreferenceIfPresent(PREF_PRIVACY_SANDBOX); updatePreferences(); } diff --git a/android/java/org/chromium/chrome/browser/shields/BraveShieldsHandler.java b/android/java/org/chromium/chrome/browser/shields/BraveShieldsHandler.java index 3e3f51473d42..99faf42f7184 100644 --- a/android/java/org/chromium/chrome/browser/shields/BraveShieldsHandler.java +++ b/android/java/org/chromium/chrome/browser/shields/BraveShieldsHandler.java @@ -451,7 +451,7 @@ public void onClick(View view) { ImageView mPrivacyReportIcon = mPrivacyReportLayout.findViewById(R.id.toggle_favicon); mPrivacyReportIcon.setImageResource(R.drawable.ic_arrow_forward); mPrivacyReportIcon.setColorFilter( - mContext.getResources().getColor(R.color.default_icon_color_tint_list)); + mContext.getResources().getColor(R.color.default_icon_color)); TextView mViewPrivacyReportText = mPrivacyReportLayout.findViewById(R.id.toggle_text); mViewPrivacyReportText.setText(R.string.view_full_privacy_report); mPrivacyReportLayout.setOnClickListener(new View.OnClickListener() { @@ -579,7 +579,7 @@ public void onClick(View view) { ImageView mBlockShieldsIcon = mShieldsLayout.findViewById(R.id.toggle_favicon); mBlockShieldsIcon.setImageResource(R.drawable.ic_chevron_right); mBlockShieldsIcon.setColorFilter( - mContext.getResources().getColor(R.color.default_icon_color_tint_list)); + mContext.getResources().getColor(R.color.default_icon_color)); TextView mBlockShieldsText = mShieldsLayout.findViewById(R.id.toggle_text); mBlockShieldsText.setText(titleStringId); diff --git a/android/java/org/chromium/chrome/browser/signin/BraveSigninManager.java b/android/java/org/chromium/chrome/browser/signin/BraveSigninManager.java index 415027f34fcf..37c4af377f14 100644 --- a/android/java/org/chromium/chrome/browser/signin/BraveSigninManager.java +++ b/android/java/org/chromium/chrome/browser/signin/BraveSigninManager.java @@ -61,7 +61,7 @@ public void signinAndEnableSync(@SigninAccessPoint int accessPoint, Account acco @Nullable SignInCallback callback) {} @Override - public void signin(CoreAccountInfo accountInfo, @Nullable SignInCallback callback) {} + public void signin(Account account, @Nullable SignInCallback callback) {} @Override public void removeSignInStateObserver(SignInStateObserver observer) {} diff --git a/android/java/org/chromium/chrome/browser/site_settings/BraveSiteSettingsDelegate.java b/android/java/org/chromium/chrome/browser/site_settings/BraveSiteSettingsDelegate.java index 0b0c1601da27..49dbdf155343 100644 --- a/android/java/org/chromium/chrome/browser/site_settings/BraveSiteSettingsDelegate.java +++ b/android/java/org/chromium/chrome/browser/site_settings/BraveSiteSettingsDelegate.java @@ -12,13 +12,13 @@ import org.chromium.base.Callback; import org.chromium.chrome.browser.ChromeTabbedActivity; import org.chromium.chrome.browser.app.BraveActivity; +import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.site_settings.ChromeSiteSettingsDelegate; -import org.chromium.content_public.browser.BrowserContextHandle; import org.chromium.url.GURL; public class BraveSiteSettingsDelegate extends ChromeSiteSettingsDelegate { - public BraveSiteSettingsDelegate(Context context, BrowserContextHandle browserContextHandle) { - super(context, browserContextHandle); + public BraveSiteSettingsDelegate(Context context, Profile profile) { + super(context, profile); } @Override diff --git a/android/java/org/chromium/chrome/browser/toolbar/BraveToolbarManager.java b/android/java/org/chromium/chrome/browser/toolbar/BraveToolbarManager.java index 7650186b43c1..300347f4b053 100644 --- a/android/java/org/chromium/chrome/browser/toolbar/BraveToolbarManager.java +++ b/android/java/org/chromium/chrome/browser/toolbar/BraveToolbarManager.java @@ -207,7 +207,7 @@ public void enableBottomControls() { || TabUiFeatureUtilities.isConditionalTabStripEnabled()) { mTabGroupUi = TabManagementModuleProvider.getDelegate().createTabGroupUi(mActivity, mBottomControls.findViewById(R.id.bottom_container_slot), - mAppThemeColorProvider, mScrimCoordinator, mOmniboxFocusStateSupplier, + mIncognitoStateProvider, mScrimCoordinator, mOmniboxFocusStateSupplier, mBottomSheetController, mActivityLifecycleDispatcher, mIsWarmOnResumeSupplier, mTabModelSelector, mTabContentManager, mCompositorViewHolder, mCompositorViewHolder::getDynamicResourceLoader, @@ -220,11 +220,11 @@ public void enableBottomControls() { id -> ((ChromeActivity) mActivity).onOptionsItemSelected(id, null)), mActivityTabProvider, mToolbarTabController::openHomepage, mCallbackController.makeCancelable((reason) -> setUrlBarFocus(true, reason)), - mMenuButtonCoordinator.getMenuButtonHelperSupplier(), + mMenuButtonCoordinator.getMenuButtonHelperSupplier(), mAppThemeColorProvider, /* Below are parameters for BottomControlsCoordinator */ mActivity, mWindowAndroid, mLayoutManager, mCompositorViewHolder.getResourceManager(), mBrowserControlsSizer, - mFullscreenManager, mBottomControls, mAppThemeColorProvider, mTabGroupUi, + mFullscreenManager, mBottomControls, mTabGroupUi, mOverlayPanelVisibilitySupplier)); mBottomControls.setBottomControlsCoordinatorSupplier( mBottomControlsCoordinatorSupplier); 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 562752d0a01e..896a5e1a97bf 100644 --- a/android/java/org/chromium/chrome/browser/toolbar/bottom/BottomToolbarCoordinator.java +++ b/android/java/org/chromium/chrome/browser/toolbar/bottom/BottomToolbarCoordinator.java @@ -28,6 +28,7 @@ import org.chromium.chrome.browser.ActivityTabProvider; import org.chromium.chrome.browser.app.BraveActivity; import org.chromium.chrome.browser.app.ChromeActivity; +import org.chromium.chrome.browser.compositor.CompositorViewHolder; import org.chromium.chrome.browser.feature_engagement.TrackerFactory; import org.chromium.chrome.browser.homepage.HomepageManager; import org.chromium.chrome.browser.layouts.LayoutStateProvider; @@ -256,8 +257,9 @@ public void onStartedHiding( } if (mScrollingBottomView != null && activity != null) { + Supplier cvh = activity.getCompositorViewHolderSupplier(); mScrollingBottomView.setSwipeDetector( - activity.getCompositorViewHolder().getLayoutManager().getToolbarSwipeHandler()); + cvh.get().getLayoutManager().getToolbarSwipeHandler()); } } diff --git a/android/java/org/chromium/chrome/browser/toolbar/bottom/BraveBottomControlsCoordinator.java b/android/java/org/chromium/chrome/browser/toolbar/bottom/BraveBottomControlsCoordinator.java index 01e30a8c91d5..11ca690c94af 100644 --- a/android/java/org/chromium/chrome/browser/toolbar/bottom/BraveBottomControlsCoordinator.java +++ b/android/java/org/chromium/chrome/browser/toolbar/bottom/BraveBottomControlsCoordinator.java @@ -56,15 +56,15 @@ public BraveBottomControlsCoordinator( OnLongClickListener tabSwitcherLongclickListener, ActivityTabProvider tabProvider, Runnable openHomepageAction, Callback setUrlBarFocusAction, ObservableSupplier menuButtonHelperSupplier, + ThemeColorProvider themeColorProvider, /* Below are parameters from BottomControlsCoordinator */ Activity activity, WindowAndroid windowAndroid, LayoutManager layoutManager, ResourceManager resourceManager, BrowserControlsSizer controlsSizer, FullscreenManager fullscreenManager, ScrollingBottomViewResourceFrameLayout root, - ThemeColorProvider themeColorProvider, BottomControlsContentDelegate contentDelegate, + BottomControlsContentDelegate contentDelegate, ObservableSupplier overlayPanelVisibilitySupplier) { super(activity, windowAndroid, layoutManager, resourceManager, controlsSizer, - fullscreenManager, root, themeColorProvider, contentDelegate, - overlayPanelVisibilitySupplier); + fullscreenManager, root, contentDelegate, overlayPanelVisibilitySupplier); mTabSwitcherLongclickListener = tabSwitcherLongclickListener; mTabProvider = tabProvider; diff --git a/android/java/res/layout/new_tab_page_incognito.xml b/android/java/res/layout/new_tab_page_incognito.xml index c57526f603b4..bdc09ea94954 100644 --- a/android/java/res/layout/new_tab_page_incognito.xml +++ b/android/java/res/layout/new_tab_page_incognito.xml @@ -60,7 +60,7 @@ android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:text="@string/brave_new_tab_private_header" - android:textAppearance="@style/TextAppearance.Headline.Primary.Light" /> + android:textAppearance="@style/TextAppearance.Headline.Primary.Baseline.Light" /> #5B2A23 #F35333 @color/default_text_color_on_accent1_light + @color/toolbar_background_primary #F0F2FF #1E2029 diff --git a/android/java/res/values/brave_colors.xml b/android/java/res/values/brave_colors.xml index ca0ee9744c81..f67f517f3ca5 100644 --- a/android/java/res/values/brave_colors.xml +++ b/android/java/res/values/brave_colors.xml @@ -19,6 +19,7 @@ #FF7654 #EA3A0D #C22700 + @color/toolbar_background_primary_dark #fb542b diff --git a/android/javatests/org/chromium/chrome/browser/BytecodeTest.java b/android/javatests/org/chromium/chrome/browser/BytecodeTest.java index 60b1347bb92c..854bc588641f 100644 --- a/android/javatests/org/chromium/chrome/browser/BytecodeTest.java +++ b/android/javatests/org/chromium/chrome/browser/BytecodeTest.java @@ -47,10 +47,12 @@ import org.chromium.chrome.browser.omnibox.status.PageInfoIPHController; import org.chromium.chrome.browser.omnibox.suggestions.SuggestionHost; import org.chromium.chrome.browser.omnibox.suggestions.UrlBarDelegate; +import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.share.ShareDelegateImpl; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tabmodel.AsyncTabParamsManager; import org.chromium.chrome.browser.tabmodel.ChromeTabCreator; +import org.chromium.chrome.browser.tabmodel.IncognitoStateProvider; import org.chromium.chrome.browser.tabmodel.TabCreatorManager; import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.theme.ThemeColorProvider; @@ -435,15 +437,15 @@ public void testConstructorsExistAndMatch() throws Exception { Assert.assertTrue(constructorsMatch( "org/chromium/chrome/browser/tasks/tab_management/TabGroupUiCoordinator", "org/chromium/chrome/browser/tasks/tab_management/BraveTabGroupUiCoordinator", - Activity.class, ViewGroup.class, ThemeColorProvider.class, ScrimCoordinator.class, - ObservableSupplier.class, BottomSheetController.class, + Activity.class, ViewGroup.class, IncognitoStateProvider.class, + ScrimCoordinator.class, ObservableSupplier.class, BottomSheetController.class, ActivityLifecycleDispatcher.class, Supplier.class, TabModelSelector.class, TabContentManager.class, ViewGroup.class, Supplier.class, TabCreatorManager.class, Supplier.class, OneshotSupplier.class, SnackbarManager.class)); Assert.assertTrue(constructorsMatch( "org/chromium/chrome/browser/site_settings/ChromeSiteSettingsDelegate", "org/chromium/chrome/browser/site_settings/BraveSiteSettingsDelegate", - Context.class, BrowserContextHandle.class)); + Context.class, Profile.class)); Assert.assertTrue(constructorsMatch( "org/chromium/components/browser_ui/notifications/NotificationManagerProxyImpl", "org/chromium/chrome/browser/notifications/BraveNotificationManagerProxyImpl", diff --git a/android/javatests/org/chromium/chrome/browser/privacy/settings/BravePrivacySettingsTest.java b/android/javatests/org/chromium/chrome/browser/privacy/settings/BravePrivacySettingsTest.java index df41cbcd674a..c2411c2adbe2 100644 --- a/android/javatests/org/chromium/chrome/browser/privacy/settings/BravePrivacySettingsTest.java +++ b/android/javatests/org/chromium/chrome/browser/privacy/settings/BravePrivacySettingsTest.java @@ -91,7 +91,6 @@ private void checkPreferenceRemoved(String pref) { @SmallTest public void testDisabledOptions() { TestThreadUtils.runOnUiThreadBlocking(() -> { - assertFalse(PrivacySandboxBridge.isPrivacySandboxSettingsFunctional()); assertFalse(PrivacyPreferencesManagerImpl.getInstance().getNetworkPredictionEnabled()); }); } diff --git a/app/app_management_strings.grdp b/app/app_management_strings.grdp index 5cb7cab91822..1098612e9a1b 100644 --- a/app/app_management_strings.grdp +++ b/app/app_management_strings.grdp @@ -19,8 +19,8 @@ Permissions - - More settings and permissions + + More permissions Pin to shelf @@ -49,8 +49,8 @@ This app has been installed by your administrator. - - Opening supported links + + Opening <a href="#">supported links</a> Open in $1Brave browser @@ -59,9 +59,9 @@ Open in Brave browser - $1Gmail is set to open in a new browser tab, supported links will also open in the browser. + $1Gmail is set to open in a new browser tab, supported links will also open in the browser. <a href="https://support.google.com/chromebook?p=app_intent" target="_blank">Learn more</a> - - Learn more. + + Supported links diff --git a/app/brave_main_delegate.cc b/app/brave_main_delegate.cc index 869f471ade64..9f09f014bcbc 100644 --- a/app/brave_main_delegate.cc +++ b/app/brave_main_delegate.cc @@ -61,6 +61,7 @@ #include "brave/build/android/jni_headers/BraveQAPreferences_jni.h" #include "components/signin/public/base/account_consistency_method.h" #else +#include "chrome/browser/apps/app_discovery_service/app_discovery_features.h" #include "chrome/browser/browser_features.h" #include "chrome/browser/ui/profile_picker.h" #endif @@ -228,15 +229,18 @@ bool BraveMainDelegate::BasicStartupComplete(int* exit_code) { // Disabled features. std::unordered_set disabled_features = { +#if !defined(OS_ANDROID) + apps::kAppDiscoveryRemoteUrlSearch.name, +#endif autofill::features::kAutofillEnableAccountWalletStorage.name, autofill::features::kAutofillServerCommunication.name, + blink::features::kComputePressure.name, blink::features::kConversionMeasurement.name, blink::features::kFledgeInterestGroupAPI.name, blink::features::kFledgeInterestGroups.name, blink::features::kHandwritingRecognitionWebPlatformApiFinch.name, blink::features::kInterestCohortAPIOriginTrial.name, blink::features::kInterestCohortFeaturePolicy.name, - blink::features::kLangClientHintHeader.name, blink::features::kNavigatorPluginsFixed.name, blink::features::kTextFragmentAnchor.name, #if !defined(OS_ANDROID) @@ -245,25 +249,33 @@ bool BraveMainDelegate::BasicStartupComplete(int* exit_code) { features::kDirectSockets.name, features::kIdleDetection.name, features::kNotificationTriggers.name, - features::kPrivacySandboxSettings.name, + features::kPrivacySandboxSettings2.name, +#if !defined(OS_ANDROID) + features::kSettingsLandingPageRedesign.name, +#endif features::kSignedExchangePrefetchCacheForNavigations.name, features::kSignedExchangeSubresourcePrefetch.name, features::kSubresourceWebBundles.name, +#if defined(OS_ANDROID) + features::kWebNfc.name, +#endif features::kWebOTP.name, features::kTabGroupsFeedback.name, federated_learning::kFederatedLearningOfCohorts.name, federated_learning::kFlocIdComputedEventLogging.name, +#if defined(OS_ANDROID) + feed::kInterestFeedContentSuggestions.name, + feed::kInterestFeedV2.name, +#endif media::kLiveCaption.name, net::features::kFirstPartySets.name, network::features::kTrustTokens.name, network_time::kNetworkTimeServiceQuerying.name, - reading_list::switches::kReadLater.name, #if defined(OS_ANDROID) - features::kWebNfc.name, - feed::kInterestFeedContentSuggestions.name, - feed::kInterestFeedV2.name, offline_pages::kPrefetchingOfflinePagesFeature.name, - signin::kMobileIdentityConsistency.name, +#endif + reading_list::switches::kReadLater.name, +#if defined(OS_ANDROID) translate::kTranslate.name, #endif }; diff --git a/app/brave_main_delegate_browsertest.cc b/app/brave_main_delegate_browsertest.cc index c2ffff2788ea..867af21b504e 100644 --- a/app/brave_main_delegate_browsertest.cc +++ b/app/brave_main_delegate_browsertest.cc @@ -32,6 +32,7 @@ #if defined(OS_ANDROID) #include "chrome/test/base/android/android_browser_test.h" #else +#include "chrome/browser/apps/app_discovery_service/app_discovery_features.h" #include "chrome/browser/browser_features.h" #include "chrome/browser/ui/profile_picker.h" #include "chrome/browser/ui/ui_features.h" @@ -81,15 +82,18 @@ IN_PROC_BROWSER_TEST_F(BraveMainDelegateBrowserTest, OriginTrialsTest) { IN_PROC_BROWSER_TEST_F(BraveMainDelegateBrowserTest, DisabledFeatures) { const base::Feature* disabled_features[] = { +#if !defined(OS_ANDROID) + &apps::kAppDiscoveryRemoteUrlSearch, +#endif &autofill::features::kAutofillEnableAccountWalletStorage, &autofill::features::kAutofillServerCommunication, + &blink::features::kComputePressure, &blink::features::kConversionMeasurement, &blink::features::kFledgeInterestGroupAPI, &blink::features::kFledgeInterestGroups, &blink::features::kHandwritingRecognitionWebPlatformApiFinch, &blink::features::kInterestCohortAPIOriginTrial, &blink::features::kInterestCohortFeaturePolicy, - &blink::features::kLangClientHintHeader, &blink::features::kNavigatorPluginsFixed, &blink::features::kTextFragmentAnchor, #if !defined(OS_ANDROID) @@ -98,7 +102,10 @@ IN_PROC_BROWSER_TEST_F(BraveMainDelegateBrowserTest, DisabledFeatures) { &features::kDirectSockets, &features::kIdleDetection, &features::kNotificationTriggers, - &features::kPrivacySandboxSettings, + &features::kPrivacySandboxSettings2, +#if !defined(OS_ANDROID) + &features::kSettingsLandingPageRedesign, +#endif &features::kSignedExchangePrefetchCacheForNavigations, &features::kSignedExchangeSubresourcePrefetch, &features::kSubresourceWebBundles, diff --git a/app/brave_strings.grd b/app/brave_strings.grd index b782e5fd4cb7..6ccce9a9b91a 100644 --- a/app/brave_strings.grd +++ b/app/brave_strings.grd @@ -573,6 +573,14 @@ Brave is unable to recover your settings. Also clear data from Brave ($1www.google.com) + + + + Brave found that "$1Gmail Checker" contains malware + + + Brave found that these items contain malware: + @@ -1065,6 +1073,25 @@ Brave is unable to recover your settings. Brave needs storage access to download files + + + Brave needs camera permission to create a 3D map of your surroundings + + + Brave needs camera permission for this site + + + Brave needs microphone permission for this site + + + Brave needs camera and microphone permissions for this site + + + Brave needs location permission for this site + + + Brave needs storage access permission to download files + @@ -1101,22 +1128,15 @@ Brave is unable to recover your settings. Install Chrome OS - - Ready to install Chrome OS - - - <p>We’re ready to install Chrome OS! Once you proceed: - <ul> - <li>Files, data, and your current operating system will be erased. - <li>Chrome OS will be installed. - <li>Your device will shut down once the installation is complete. - </ul> - </p> - <p>One last reminder: installation will erase your entire hard drive. Please make sure you have any data you care about backed up.</p> - <p>Once installation starts it cannot be canceled.</p> - - - Erase Hard Drive & Install Chrome OS + + Install Chrome OS + + + <p>One last reminder: installation <b>will erase your entire hard drive</b>. Please make sure you have any data you care about backed up.</p> + <p>Once installation starts it cannot be canceled.</p> + + + Install Chrome OS Chrome OS installation in progress diff --git a/app/generated_resources.grd b/app/generated_resources.grd index 0ffff4b65b66..2032aaacf9f7 100644 --- a/app/generated_resources.grd +++ b/app/generated_resources.grd @@ -512,9 +512,16 @@ are declared in tools/grit/grit_rule.gni. No search results found - - Press Alt Shift A to show - + + + This dialog is not currently focused. Press Command-Shift-Option A to focus this dialog. + + + + + This dialog is not currently focused. Press Alt-Shift A to focus this dialog. + + @@ -748,16 +755,19 @@ are declared in tools/grit/grit_rule.gni. Search image with Brave Lens - Search part of the page with Brave Lens + Search part of the page with $1Brave Lens - Drag to search images with Brave Lens + Drag to search images with $1Brave Lens - Drag over images to search with Brave Lens + Drag over images to search with $1Brave Lens - Search your screen with Brave Lens + Search your screen with $1Brave Lens + + + Search images with $1Brave Lens &Go to $1http://www.google.com/ @@ -1001,16 +1011,19 @@ are declared in tools/grit/grit_rule.gni. Search Image with Brave Lens - Search Part of the Page with Brave Lens + Search Part of the Page with $1Brave Lens - Drag to Search Images with Brave Lens + Drag to Search Images with $1Brave Lens - Drag over Images to Search with Brave Lens + Drag over Images to Search with $1Brave Lens - Search Your Screen with Brave Lens + Search Your Screen with $1Brave Lens + + + Search Images with $1Brave Lens &Go to $1http://www.google.com/ @@ -3702,6 +3715,9 @@ are declared in tools/grit/grit_rule.gni. No-op Service + + Brave Document Analysis + Installed theme "$1Snowflake Theme" @@ -3831,27 +3847,32 @@ are declared in tools/grit/grit_rule.gni. - + {NUM_EXTENSIONS, plural, - =1 {This extension may be dangerous} - other {These extensions may be dangerous}} + =1 {This extension is blocked} + other {These extensions are blocked}} - + {NUM_APPS, plural, - =1 {This app may be dangerous} - other {These apps may be dangerous}} + =1 {This app is blocked} + other {Some apps are blocked}} - - These items may be dangerous + + Some items are blocked - - The extension "$1Gmail Checker" was automatically disabled. + + {NUM_EXTENSIONS, plural, + =1 {This extension is not allowed} + other {Some extensions are not allowed}} - - "$1Gmail Checker" has been disabled because it contains malware + + The following extensions were blocked by your administrator: - - The app "$1Gmail" was automatically removed. + + "$1Gmail Checker" + + + The extension "$1Gmail Checker" was blocked by your administrator OK @@ -5911,6 +5932,11 @@ Keep your key file in a safe place. You will need it to create new versions of y Delete + + + Side Panel + + Click to go back, hold to see history @@ -6143,6 +6169,9 @@ Keep your key file in a safe place. You will need it to create new versions of y Get back here fast by bookmarking this tab + + Close tutorial + New! Control your music, videos, and more. @@ -6185,6 +6214,9 @@ Keep your key file in a safe place. You will need it to create new versions of y $1CTRL+SHIFT+T can reopen accidentally closed tabs + + Your reading list has moved to the new side panel. Try it here. + To group tabs together, right-click a tab @@ -6436,6 +6468,9 @@ Keep your key file in a safe place. You will need it to create new versions of y Suggest strong password + + Password will be saved in your Brave sync chain, $1user@gmail.com. You won’t have to remember it. + Confirm your username @@ -7120,6 +7155,9 @@ Keep your key file in a safe place. You will need it to create new versions of y + + Save group + New tab in group @@ -7140,6 +7178,9 @@ Keep your key file in a safe place. You will need it to create new versions of y + + Save Group + New Tab in Group @@ -7600,6 +7641,9 @@ Keep your key file in a safe place. You will need it to create new versions of y Sending link to $1Ted's Pixel2 + + $1Your devices$2 · $3foo@gmail.com + @@ -8144,11 +8188,11 @@ Keep your key file in a safe place. You will need it to create new versions of y Install - - Split horizontal + + Linux - - Split vertical + + SSH @@ -8216,6 +8260,10 @@ Keep your key file in a safe place. You will need it to create new versions of y + + $1GMail (unsupported app) + + Turn on sync? @@ -8813,7 +8861,7 @@ Please help our engineers fix this problem. Tell us what happened right before y Always translate - Options + Translate options Page language: @@ -8869,7 +8917,7 @@ Please help our engineers fix this problem. Tell us what happened right before y Always Translate - Options + Translate Options Page Language: @@ -11200,10 +11248,10 @@ Please help our engineers fix this problem. Tell us what happened right before y other {Some of these files are encrypted. Ask their owner to decrypt.}} - Your administrator says "$1Please don't upload this type of data.". + Your administrator says: "$1Please don't upload this type of data." - $1foo.txt has sensitive or dangerous data. Your administrator says "$2Please don't upload this type of data.". + $1foo.txt has sensitive or dangerous data. Your administrator says: "$2Please don't upload this type of data." Learn more @@ -11469,7 +11517,11 @@ Please help our engineers fix this problem. Tell us what happened right before y Search your screen with Brave Lens - Right click and select “Search part of the page with Brave Lens” to search any region of the site to learn more about the visual content you see while you browse and shop on the web. + Right click and select “Search images with Brave Lens” to search any region of the site to learn more about the visual content you see while you browse and shop on the web. + + + + Drag over any image to search diff --git a/app/generated_resources_override.grd b/app/generated_resources_override.grd index c5d0176eeec0..918a860d1a65 100644 --- a/app/generated_resources_override.grd +++ b/app/generated_resources_override.grd @@ -151,7 +151,11 @@ are declared in tools/grit/grit_rule.gni. - + + + + + diff --git a/app/global_media_controls_strings.grdp b/app/global_media_controls_strings.grdp index 8010b5b23a20..c78fe3371ece 100644 --- a/app/global_media_controls_strings.grdp +++ b/app/global_media_controls_strings.grdp @@ -24,18 +24,22 @@ Live Caption - Downloading... $117% + Downloading... $117% - Can't download speech files. Try again later. + Can't download speech files. Try again later. - Global Media Controls + Global Media Controls - Show device list + Show device list - Hide device list + Hide device list + + Control the media you're casting + + diff --git a/app/os_settings_search_tag_strings.grdp b/app/os_settings_search_tag_strings.grdp index b3df5931d2c7..64ee08ac053c 100644 --- a/app/os_settings_search_tag_strings.grdp +++ b/app/os_settings_search_tag_strings.grdp @@ -286,6 +286,9 @@ Phone Hub task continuation + + Phone Hub apps + Wi-Fi Sync @@ -1313,6 +1316,12 @@ Terms of Service + + Change device name + + + Change hostname + Diagnostics diff --git a/app/os_settings_strings.grdp b/app/os_settings_strings.grdp index 46b631d98c33..f6e4dfc7836b 100644 --- a/app/os_settings_strings.grdp +++ b/app/os_settings_strings.grdp @@ -41,7 +41,7 @@ - Build Details + Build details Copy build details to clipboard @@ -175,6 +175,24 @@ Name can use letters, numbers, and hyphens (-) + + Name can use letters, numbers, and hyphens (-), and must be between 1 and 15 characters inclusive. + + + $110/$215 + + + Name device + + + Name device to $1MyBravebook + + + Change device name + + + Current device name is $1MyBravebook + Couldn't update your Bravebook. Please try again later. @@ -1100,14 +1118,14 @@ and Ctrl+Alt+Brightness down to zoom out. Enable dictation (speak to type) - - Speech files downloaded + + Type with your voice. Press Search + D, then start speaking. Downloading speech recognition files... $117% - Can't download speech files. Dictation will continue to work by sending your voice to Brave. + Couldn’t download $1English speech files. Download will be attempted later. Speech is sent to Brave for processing for now. Language @@ -1750,8 +1768,11 @@ Press an assigned switch to remove assignment An upgrade to Debian 10 (Buster) is available + + An upgrade to Debian 11 (Bullseye) is available + - Current version is Debian 9 (Stretch) + Current version is $1Debian GNU/Linux 9 (stretch) Upgrade @@ -1993,6 +2014,57 @@ Press an assigned switch to remove assignment Disconnect + + Connected + + + Disconnected + + + Forget + + + Device name + + + Change device name + + + Change device name for $1Beats + + + Battery level $190% + + + Connected to $1Beats + + + Disconnected from $1Beats + + + New device name + + + Cancel + + + Done + + + Change mouse settings + + + Change keyboard settings + + + Name can use letters, numbers, and special characters, and must be $120 characters or fewer + + + Name can use letters, numbers, and special characters + + + $115/$220 + Bluetooth enable @@ -2035,6 +2107,66 @@ Press an assigned switch to remove assignment On + + $132% + + + Device $11 of $215, $3Beats, Unknown device type + + + Device $11 of $215, $3Beats, Unknown device type, Battery level $450% + + + Device $11 of $215, $3Beats, Computer + + + Device $11 of $215, $3Beats, Computer, Battery level $450% + + + Device $11 of $215, $3Beats, Phone + + + Device $11 of $215, $3Beats, Phone, Battery level $450% + + + Device $11 of $215, $3Beats, Audio device + + + Device $11 of $215, $3Beats, Audio device, Battery level $450% + + + Device $11 of $215, $3Beats, Video camera + + + Device $11 of $215, $3Beats, Video camera, Battery level $450% + + + Device $11 of $215, $3Beats, Game controller + + + Device $11 of $215, $3Beats, Game controller, Battery level $450% + + + Device $11 of $215, $3Beats, Keyboard + + + Device $11 of $215, $3Beats, Keyboard, Battery level $450% + + + Device $11 of $215, $3Beats, Mouse + + + Device $11 of $215, $3Beats, Mouse, Battery level $450% + + + Device $11 of $215, $3Beats, Tablet + + + Device $11 of $215, $3Beats, Tablet, Battery level $450% + + + $1Beats, Details + Bluetooth device details @@ -2980,6 +3112,9 @@ Press an assigned switch to remove assignment Recent Brave tabs + + Apps + Access your phone's capabilities from your $1Bravebook @@ -2989,6 +3124,9 @@ Press an assigned switch to remove assignment View recent Brave tabs from your phone + + Temporarily your phone apps right from your $1Bravebook + Turn on <a id="chromeSyncLink">Brave Sync</a> to view recent Brave tabs. <a target="_blank" id="learnMoreLink" href="$1https://google.com/">Learn More</a> @@ -3520,12 +3658,6 @@ Press an assigned switch to remove assignment Sunset to sunrise - - Start time - - - End time - Make it easier to look at your screen or read in dim light diff --git a/app/profiles_strings.grdp b/app/profiles_strings.grdp index 2f4a05c51c5e..9ffecc6b34ce 100644 --- a/app/profiles_strings.grdp +++ b/app/profiles_strings.grdp @@ -553,6 +553,9 @@ This account is managed by $1example.com + + This account ($1john.doe@example.com) is managed by $2example.com + Your device is managed by $1example.com @@ -704,6 +707,9 @@ Choose an account + + Use another account + diff --git a/app/settings_brave_strings.grdp b/app/settings_brave_strings.grdp index 5bcc2d25a9de..12c414595dcf 100644 --- a/app/settings_brave_strings.grdp +++ b/app/settings_brave_strings.grdp @@ -119,6 +119,11 @@ Open PDFs in Brave + + + When you close Brave, it automatically clears cookies and site data from the pages you visited + + Brave can help keep you safe from data breaches, bad extensions, and more diff --git a/app/settings_strings.grdp b/app/settings_strings.grdp index 2002699d8692..c6bb0609493a 100644 --- a/app/settings_strings.grdp +++ b/app/settings_strings.grdp @@ -229,8 +229,11 @@ Edit + + End time + - Not valid + Not valid Not a valid web address @@ -239,11 +242,14 @@ Origin must be secure - Retry + Retry Slider: $1Slowest to $2Fastest + + Start time + @@ -1241,7 +1247,7 @@ More - + Manage secure DNS in Chrome OS settings @@ -1347,6 +1353,12 @@ Review my settings + + Back + + + Step $11 of $22 + Next @@ -1386,6 +1398,12 @@ The URLs are shared with Brave to understand the browsing behavior + + Review automatic data clearing + + + Sites you visit can still remember your information until you close Brave + @@ -1825,11 +1843,20 @@ Manage search engines + + Manage search engines and site search + + + Create shortcuts for searching sites and manage your search engine + Search Engines + + You can use shortcuts in the address bar to quickly search a specific site or to use a different search engine + Search @@ -1842,8 +1869,23 @@ Default search engines - - Your search engines + + Search engines + + + To use a search engine other than the default, type its shortcut followed by your preferred keyboard shortcut. You can also change your default search engine here. + + + Site search + + + To search a specific site or part of Brave, you can type the shortcuts here into the address bar, then press Tab or Space. + + + To search a specific site or part of Brave, you can use the shortcuts here. For example, to search only Gmail, type "@gmail", then press Tab or Space. + + + Inactive shortcuts Other search engines @@ -1852,14 +1894,26 @@ Other saved search engines will appear here - Search engines added by extensions + Extensions + + + Some extensions can add search engines to Brave Search engine + + Site or page + + + Inactive sites + Keyword + + Shortcut + Query URL @@ -1869,6 +1923,12 @@ Make default + + Activate + + + Deactivate + Remove from list @@ -1876,17 +1936,23 @@ Manage - Keyboard shortcuts for search keywords + Keyboard shortcut In the address bar, enter the keyword for the website you want to search. Then, use a keyboard shortcut to continue. + + In the address bar, enter the shortcut for the site you want to search, such as "@gmail". Then, press your preferred keyboard shortcut, and enter your search term. + Space or Tab Tab + + Show all + @@ -2280,15 +2346,6 @@ Not allowed to send pop-ups or use redirects - - Protected content - - - protected content - - - Protected content IDs - Allow sites to play protected content (recommended) @@ -2393,18 +2450,6 @@ You can set how much you zoom in or out on certain websites - - Ads - - - ads - - - Augmented reality - - - augmented reality - Ask when a site wants to create a 3D map of your surroundings or track camera position @@ -2414,33 +2459,6 @@ Do not allow sites to create a 3D map of your surroundings or track camera position - - Automatic downloads - - - automatic downloads - - - Background sync - - - background sync - - - Camera - - - camera - - - Camera - - - Clipboard - - - clipboard - Ask when a site wants to see text and images copied to the clipboard @@ -2472,7 +2490,7 @@ Sites can use cookies to improve your browsing experience, for example, to keep you signed in or to remember items in your shopping cart - While in Private, sites can't use your cookies to see your browsing activity across different sites, for example, to personalize ads. Features on some sites may break. + While in Private, sites can't use your cookies to see your browsing activity across different sites, for example, to personalize ads. Features on some sites may not work. Block third-party cookies @@ -2481,7 +2499,7 @@ Sites can use cookies to improve your browsing experience, for example, to keep you signed in or to remember items in your shopping cart - Sites can't use your cookies to see your browsing activity across different sites, for example, to personalize ads. Features on some sites may break. + Sites can't use your cookies to see your browsing activity across different sites, for example, to personalize ads. Features on some sites may not work. Block all cookies (not recommended) @@ -2493,11 +2511,14 @@ Sites can't use your cookies to see your browsing activity across different sites, for example, to personalize ads - Features on many sites may break + Features on many sites may not work Clear cookies and site data when you close all windows + + See all site data and permissions + Manage site specific exceptions @@ -2510,45 +2531,6 @@ Sites that can never use cookies - - Cookies and site data - - - cookies and site data - - - Protocol handlers - - - protocol handlers - - - Location - - - location - - - Microphone - - - microphone - - - Microphone - - - Notifications - - - notifications - - - HID devices - - - HID devices - Ask when a site wants to access HID devices @@ -2558,33 +2540,9 @@ Do not allow any sites to access HID devices - - Images - - - images - - - Insecure content - - - insecure content - Insecure content is blocked by default on secure sites - - JavaScript - - - Javascript - - - Payment handlers - - - payment handlers - Allow sites to install payment handlers @@ -2594,24 +2552,9 @@ Do not allow any site to install payment handlers - - PDF documents - Download PDF files instead of automatically opening them in Brave - - Pop-ups and redirects - - - pop-ups and redirects - - - Virtual reality - - - virtual reality - Ask when a site wants to use your virtual reality devices and data @@ -2624,12 +2567,6 @@ Recent activity - - MIDI devices - - - MIDI devices - Ask when a site wants to use system exclusive messages to access MIDI devices @@ -2639,30 +2576,6 @@ Do not allow any sites to use system exclusive messages to access MIDI devices - - Sound - - - sound - - - Motion or light sensors - - - motion or light sensors - - - Motion sensors - - - motion sensors - - - Bluetooth devices - - - Bluetooth devices - Ask when a site wants to access Bluetooth devices @@ -2672,12 +2585,6 @@ Do not allow any sites to access Bluetooth devices - - USB devices - - - USB devices - Ask when a site wants to access USB devices @@ -2687,12 +2594,6 @@ Do not allow any sites to access USB devices - - Serial ports - - - serial ports - Ask when a site wants to access serial ports @@ -2702,12 +2603,6 @@ Do not allow any sites to access serial ports - - File editing - - - file editing - Ask when a site wants to edit files or folders on your device @@ -2720,12 +2615,6 @@ Remove zoom level - - Zoom levels - - - zoom levels - Sites can save and read cookie data @@ -2852,12 +2741,6 @@ Do not allow any site to download multiple files automatically - - Window placement - - - window placement - Ask when a site wants to open and place windows on your screens @@ -2867,33 +2750,18 @@ Block sites from opening and placing windows on your screens - - fonts - Ask when a site wants to use fonts installed on your device Block sites from using fonts installed on your device - - Your device use - - - your device use - Ask when a site wants to know when you're actively using this device Block sites from knowing when you're actively using this device - - File handlers - - - file handlers - Ask when a web app wants to open types of files @@ -3165,12 +3033,6 @@ No sites found - - Bluetooth scanning - - - Bluetooth scanning - Ask when a site wants to discover nearby Bluetooth devices @@ -3601,9 +3463,6 @@ Report details to Brave about harmful software, system settings, and processes that were found on your computer during this cleanup - - Notify me when Brave has finished searching for harmful software - Cleanup is currently unavailable diff --git a/app/settings_strings_override.grdp b/app/settings_strings_override.grdp index 9ec9832aff24..85432488cefb 100644 --- a/app/settings_strings_override.grdp +++ b/app/settings_strings_override.grdp @@ -57,7 +57,7 @@ - + @@ -75,7 +75,7 @@ Block third-party cookies in Private - While in Private, sites can't use your cookies to see your browsing activity across different sites, for example, to personalize ads. Features on some sites may break. + While in Private, sites can't use your cookies to see your browsing activity across different sites, for example, to personalize ads. Features on some sites may not work. Third-party cookies are blocked in Private mode diff --git a/app/shared_settings_strings.grdp b/app/shared_settings_strings.grdp index c98caec2d621..ed74e3110b7c 100644 --- a/app/shared_settings_strings.grdp +++ b/app/shared_settings_strings.grdp @@ -112,6 +112,12 @@ Change device name + + Show notification + + + When devices are sharing nearby + Current device name is $1Michael's Bravebook diff --git a/browser/autoplay/autoplay_browsertest.cc b/browser/autoplay/autoplay_browsertest.cc index b21132eb7d18..a3f524097dde 100644 --- a/browser/autoplay/autoplay_browsertest.cc +++ b/browser/autoplay/autoplay_browsertest.cc @@ -96,7 +96,7 @@ class AutoplayBrowserTest : public InProcessBrowserTest { } bool NavigateToURLUntilLoadStop(const GURL& url) { - ui_test_utils::NavigateToURL(browser(), url); + EXPECT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); return WaitForLoadStop(contents()); } diff --git a/browser/brave_ads/request_ads_enabled_api_browsertest.cc b/browser/brave_ads/request_ads_enabled_api_browsertest.cc index 368532517b45..817a12aa4f35 100644 --- a/browser/brave_ads/request_ads_enabled_api_browsertest.cc +++ b/browser/brave_ads/request_ads_enabled_api_browsertest.cc @@ -160,7 +160,7 @@ IN_PROC_BROWSER_TEST_F(RequestAdsEnabledApiTestEnabled, AdsAlreadyEnabled) { GURL url = https_server()->GetURL(kAllowedDomain, "/simple.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); EXPECT_EQ(url, contents->GetVisibleURL()); @@ -184,7 +184,7 @@ IN_PROC_BROWSER_TEST_F(RequestAdsEnabledApiTestEnabled, rewards_browsertest_util::CreateWallet(rewards_service); rewards_browsertest_util::SetOnboardingBypassed(browser(), true); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); EXPECT_EQ(url, contents->GetVisibleURL()); @@ -205,7 +205,7 @@ IN_PROC_BROWSER_TEST_F(RequestAdsEnabledApiTestEnabled, rewards_browsertest_util::SetOnboardingBypassed(browser(), false); GetPrefs()->SetBoolean(ads::prefs::kEnabled, false); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); EXPECT_EQ(url, contents->GetVisibleURL()); @@ -225,7 +225,7 @@ IN_PROC_BROWSER_TEST_F(RequestAdsEnabledApiTestEnabled, GURL url = https_server()->GetURL(kAllowedDomain, "/simple.html"); GetPrefs()->SetBoolean(ads::prefs::kEnabled, false); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); EXPECT_EQ(url, contents->GetVisibleURL()); @@ -261,7 +261,7 @@ IN_PROC_BROWSER_TEST_F(RequestAdsEnabledApiTestEnabled, RunApiForWithoutUserGesture) { GURL url = https_server()->GetURL(kAllowedDomain, "/simple.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); EXPECT_EQ(url, contents->GetVisibleURL()); @@ -278,7 +278,7 @@ IN_PROC_BROWSER_TEST_F(RequestAdsEnabledApiTestEnabled, ApiNotAvailableForUnknownHost) { GURL url = https_server()->GetURL(kNotAllowedDomain, "/simple.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); EXPECT_EQ(url, contents->GetVisibleURL()); @@ -297,7 +297,7 @@ IN_PROC_BROWSER_TEST_F(RequestAdsEnabledApiTestDisabled, ApiNotAvailableWhenFeatureOff) { GURL url = https_server()->GetURL(kAllowedDomain, "/simple.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); EXPECT_EQ(url, contents->GetVisibleURL()); diff --git a/browser/brave_content_browser_client_browsertest.cc b/browser/brave_content_browser_client_browsertest.cc index d66e6066303f..f4473f4263b2 100644 --- a/browser/brave_content_browser_client_browsertest.cc +++ b/browser/brave_content_browser_client_browsertest.cc @@ -139,7 +139,8 @@ IN_PROC_BROWSER_TEST_F(BraveContentBrowserClientTest, CanLoadChromeURL) { for (const std::string& scheme : schemes) { content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); - ui_test_utils::NavigateToURL(browser(), GURL(scheme + page + "/")); + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), GURL(scheme + page + "/"))); ASSERT_TRUE(WaitForLoadStop(contents)); EXPECT_STREQ(base::UTF16ToUTF8( @@ -177,7 +178,8 @@ IN_PROC_BROWSER_TEST_F(BraveContentBrowserClientTest, CanLoadCustomBravePages) { for (const std::string& scheme : schemes) { content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); - ui_test_utils::NavigateToURL(browser(), GURL(scheme + page + "/")); + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), GURL(scheme + page + "/"))); ASSERT_TRUE(WaitForLoadStop(contents)); EXPECT_STREQ(base::UTF16ToUTF8( @@ -209,7 +211,8 @@ IN_PROC_BROWSER_TEST_F(BraveContentBrowserClientTest, CanLoadAboutHost) { for (const std::string& scheme : schemes) { content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); - ui_test_utils::NavigateToURL(browser(), GURL(scheme + "about/")); + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), GURL(scheme + "about/"))); ASSERT_TRUE(WaitForLoadStop(contents)); EXPECT_STREQ(base::UTF16ToUTF8( @@ -239,8 +242,8 @@ IN_PROC_BROWSER_TEST_F(BraveContentBrowserClientTest, RewriteChromeSync) { for (const std::string& scheme : schemes) { content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); - ui_test_utils::NavigateToURL(browser(), - GURL(scheme + chrome::kChromeUISyncHost)); + ASSERT_TRUE(ui_test_utils::NavigateToURL( + browser(), GURL(scheme + chrome::kChromeUISyncHost))); ASSERT_TRUE(WaitForLoadStop(contents)); EXPECT_STREQ(base::UTF16ToUTF8( @@ -266,7 +269,7 @@ IN_PROC_BROWSER_TEST_F(BraveContentBrowserClientTest, RewriteMagnetURLURLBar) { content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); - ui_test_utils::NavigateToURL(browser(), magnet_url()); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), magnet_url())); ASSERT_TRUE(WaitForLoadStop(contents)); EXPECT_STREQ(contents->GetLastCommittedURL().spec().c_str(), magnet_url().spec().c_str()) @@ -280,7 +283,7 @@ IN_PROC_BROWSER_TEST_F(BraveContentBrowserClientTest, RewriteMagnetURLURLBar) { IN_PROC_BROWSER_TEST_F(BraveContentBrowserClientTest, RewriteMagnetURLLink) { content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); - ui_test_utils::NavigateToURL(browser(), magnet_html_url()); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), magnet_html_url())); ASSERT_TRUE(WaitForLoadStop(contents)); bool value; EXPECT_TRUE( @@ -312,10 +315,10 @@ IN_PROC_BROWSER_TEST_F(BraveContentBrowserClientTest, browser()->tab_strip_model()->GetActiveWebContents(); // Used to add the extension - ui_test_utils::NavigateToURL(browser(), magnet_url()); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), magnet_url())); ASSERT_TRUE(WaitForLoadStop(contents)); - ui_test_utils::NavigateToURL(browser(), torrent_extension_url()); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), torrent_extension_url())); ASSERT_TRUE(WaitForLoadStop(contents)); EXPECT_STREQ(contents->GetLastCommittedURL().spec().c_str(), @@ -334,11 +337,11 @@ IN_PROC_BROWSER_TEST_F(BraveContentBrowserClientTest, browser()->tab_strip_model()->GetActiveWebContents(); // Used to add the extension - ui_test_utils::NavigateToURL(browser(), magnet_url()); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), magnet_url())); ASSERT_TRUE(WaitForLoadStop(contents)); - ui_test_utils::NavigateToURL(browser(), - torrent_invalid_query_extension_url()); + ASSERT_TRUE(ui_test_utils::NavigateToURL( + browser(), torrent_invalid_query_extension_url())); ASSERT_TRUE(WaitForLoadStop(contents)); EXPECT_STREQ(contents->GetLastCommittedURL().spec().c_str(), torrent_invalid_query_extension_url().spec().c_str()) @@ -361,7 +364,7 @@ IN_PROC_BROWSER_TEST_F(BraveContentBrowserClientTest, content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); - ui_test_utils::NavigateToURL(browser(), magnet_url()); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), magnet_url())); WaitForLoadStop(contents); ASSERT_TRUE( @@ -384,7 +387,7 @@ IN_PROC_BROWSER_TEST_F(BraveContentBrowserClientTest, content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); - ui_test_utils::NavigateToURL(browser(), magnet_url()); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), magnet_url())); ASSERT_TRUE(WaitForLoadStop(contents)); EXPECT_STREQ(contents->GetLastCommittedURL().spec().c_str(), "about:blank"); content::NavigationEntry* entry = @@ -408,7 +411,7 @@ IN_PROC_BROWSER_TEST_F(BraveContentBrowserClientTest, content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); - ui_test_utils::NavigateToURL(browser(), magnet_html_url()); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), magnet_html_url())); ASSERT_TRUE(WaitForLoadStop(contents)); bool value; EXPECT_TRUE( @@ -440,7 +443,7 @@ IN_PROC_BROWSER_TEST_F(BraveContentBrowserClientTest, content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); - ui_test_utils::NavigateToURL(browser(), torrent_extension_url()); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), torrent_extension_url())); WaitForLoadStop(contents); EXPECT_STREQ(contents->GetLastCommittedURL().spec().c_str(), diff --git a/browser/brave_profile_prefs.cc b/browser/brave_profile_prefs.cc index 3996a5b90773..4d463340e30b 100644 --- a/browser/brave_profile_prefs.cc +++ b/browser/brave_profile_prefs.cc @@ -49,6 +49,7 @@ #include "components/gcm_driver/gcm_buildflags.h" #include "components/password_manager/core/common/password_manager_pref_names.h" #include "components/pref_registry/pref_registry_syncable.h" +#include "components/privacy_sandbox/privacy_sandbox_prefs.h" #include "components/safe_browsing/core/common/safe_browsing_prefs.h" #include "components/search_engines/search_engines_pref_names.h" #include "components/signin/public/base/signin_pref_names.h" @@ -287,6 +288,14 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { // Disable default webstore icons in topsites or apps. registry->SetDefaultPrefValue(prefs::kHideWebStoreIcon, base::Value(true)); + // Disable Chromium's privacy sandbox + registry->SetDefaultPrefValue(prefs::kPrivacySandboxApisEnabled, + base::Value(false)); + + // Disable Chromium's privacy sandbox + registry->SetDefaultPrefValue(prefs::kPrivacySandboxFlocEnabled, + base::Value(false)); + // Importer: selected data types registry->RegisterBooleanPref(kImportDialogExtensions, true); registry->RegisterBooleanPref(kImportDialogPayments, true); diff --git a/browser/brave_scheme_load_browsertest.cc b/browser/brave_scheme_load_browsertest.cc index 1dc2b4618f8e..67eb596973a9 100644 --- a/browser/brave_scheme_load_browsertest.cc +++ b/browser/brave_scheme_load_browsertest.cc @@ -53,8 +53,8 @@ class BraveSchemeLoadBrowserTest : public InProcessBrowserTest, bool NavigateToURLUntilLoadStop(const std::string& origin, const std::string& path) { - ui_test_utils::NavigateToURL(browser(), - embedded_test_server()->GetURL(origin, path)); + EXPECT_TRUE(ui_test_utils::NavigateToURL( + browser(), embedded_test_server()->GetURL(origin, path))); return WaitForLoadStop(active_contents()); } diff --git a/browser/brave_search/brave_search_browsertest.cc b/browser/brave_search/brave_search_browsertest.cc index 60619db8635d..6ea043025485 100644 --- a/browser/brave_search/brave_search_browsertest.cc +++ b/browser/brave_search/brave_search_browsertest.cc @@ -150,7 +150,7 @@ class BraveSearchTestEnabled : public BraveSearchTest { IN_PROC_BROWSER_TEST_F(BraveSearchTest, CheckForAFunction) { GURL url = https_server()->GetURL(kAllowedDomain, "/bravesearch.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); WaitForLoadStop(contents); @@ -162,7 +162,7 @@ IN_PROC_BROWSER_TEST_F(BraveSearchTest, CheckForAFunction) { IN_PROC_BROWSER_TEST_F(BraveSearchTest, CheckForAFunctionDev) { GURL url = https_server()->GetURL(kAllowedDomainDev, "/bravesearch.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); WaitForLoadStop(contents); @@ -174,7 +174,7 @@ IN_PROC_BROWSER_TEST_F(BraveSearchTest, CheckForAFunctionDev) { IN_PROC_BROWSER_TEST_F(BraveSearchTest, CheckForAnUndefinedFunction) { GURL url = https_server()->GetURL(kNotAllowedDomain, "/bravesearch.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); WaitForLoadStop(contents); @@ -190,7 +190,7 @@ IN_PROC_BROWSER_TEST_F(BraveSearchTestEnabled, DefaultAPIVisibleKnownHost) { GURL url = https_server()->GetURL(kAllowedDomain, "/"); search_test_utils::WaitForTemplateURLServiceToLoad( TemplateURLServiceFactory::GetForProfile(browser()->profile())); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); WaitForLoadStop(contents); @@ -211,7 +211,7 @@ IN_PROC_BROWSER_TEST_F(BraveSearchTestEnabled, DefaultAPIHiddenUnknownHost) { GURL url = https_server()->GetURL(kNotAllowedDomain, "/"); search_test_utils::WaitForTemplateURLServiceToLoad( TemplateURLServiceFactory::GetForProfile(browser()->profile())); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); WaitForLoadStop(contents); @@ -229,7 +229,7 @@ IN_PROC_BROWSER_TEST_F(BraveSearchTestEnabled, GURL url = https_server()->GetURL(kAllowedDomain, "/bravesearch.html"); search_test_utils::WaitForTemplateURLServiceToLoad( TemplateURLServiceFactory::GetForProfile(browser()->profile())); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); WaitForLoadStop(contents); @@ -251,7 +251,7 @@ IN_PROC_BROWSER_TEST_F(BraveSearchTestEnabled, DefaultAPIFalsePrivateWindow) { Browser* private_browser = CreateIncognitoBrowser(nullptr); search_test_utils::WaitForTemplateURLServiceToLoad( TemplateURLServiceFactory::GetForProfile(private_browser->profile())); - ui_test_utils::NavigateToURL(private_browser, url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(private_browser, url)); content::WebContents* contents = private_browser->tab_strip_model()->GetActiveWebContents(); WaitForLoadStop(contents); @@ -272,7 +272,7 @@ IN_PROC_BROWSER_TEST_F(BraveSearchTestDisabled, DefaultAPIInvisibleKnownHost) { GURL url = https_server()->GetURL(kAllowedDomain, "/"); search_test_utils::WaitForTemplateURLServiceToLoad( TemplateURLServiceFactory::GetForProfile(browser()->profile())); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); WaitForLoadStop(contents); diff --git a/browser/brave_shields/ad_block_service_browsertest.cc b/browser/brave_shields/ad_block_service_browsertest.cc index f0fed5ff28a2..3fbec61168f0 100644 --- a/browser/brave_shields/ad_block_service_browsertest.cc +++ b/browser/brave_shields/ad_block_service_browsertest.cc @@ -257,7 +257,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, AdsGetBlockedByDefaultBlocker) { EXPECT_EQ(browser()->profile()->GetPrefs()->GetUint64(kAdsBlocked), 0ULL); GURL url = embedded_test_server()->GetURL(kAdBlockTestPage); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -277,7 +277,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, EXPECT_EQ(browser()->profile()->GetPrefs()->GetUint64(kAdsBlocked), 0ULL); GURL url = embedded_test_server()->GetURL(kAdBlockTestPage); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -299,7 +299,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, AdsGetBlockedByCustomBlocker) { ->UpdateCustomFilters("*ad_banner.png")); GURL url = embedded_test_server()->GetURL(kAdBlockTestPage); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -321,7 +321,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, DefaultBlockCustomException) { ->UpdateCustomFilters("@@ad_banner.png")); GURL url = embedded_test_server()->GetURL(kAdBlockTestPage); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -340,7 +340,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, CustomBlockDefaultException) { ->UpdateCustomFilters("*ad_banner.png")); GURL url = embedded_test_server()->GetURL(kAdBlockTestPage); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -358,7 +358,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, EXPECT_EQ(browser()->profile()->GetPrefs()->GetUint64(kAdsBlocked), 0ULL); GURL url = embedded_test_server()->GetURL(kAdBlockTestPage); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -380,7 +380,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, AdsGetBlockedByRegionalBlocker) { ASSERT_TRUE(StartAdBlockRegionalServices()); GURL url = embedded_test_server()->GetURL(kAdBlockTestPage); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -403,7 +403,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, ASSERT_TRUE(StartAdBlockRegionalServices()); GURL url = embedded_test_server()->GetURL(kAdBlockTestPage); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -428,7 +428,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, EXPECT_EQ(browser()->profile()->GetPrefs()->GetUint64(kAdsBlocked), 0ULL); GURL url = embedded_test_server()->GetURL(kAdBlockTestPage); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -445,7 +445,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, TwoSameAdsGetCountedAsOne) { EXPECT_EQ(browser()->profile()->GetPrefs()->GetUint64(kAdsBlocked), 0ULL); GURL url = embedded_test_server()->GetURL(kAdBlockTestPage); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -467,7 +467,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, TwoDiffAdsGetCountedAsTwo) { EXPECT_EQ(browser()->profile()->GetPrefs()->GetUint64(kAdsBlocked), 0ULL); GURL url = embedded_test_server()->GetURL(kAdBlockTestPage); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -489,7 +489,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, NewTabContinuesToBlock) { EXPECT_EQ(browser()->profile()->GetPrefs()->GetUint64(kAdsBlocked), 0ULL); GURL url = embedded_test_server()->GetURL(kAdBlockTestPage); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -498,7 +498,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, NewTabContinuesToBlock) { "xhr('adbanner.js')")); EXPECT_EQ(browser()->profile()->GetPrefs()->GetUint64(kAdsBlocked), 1ULL); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_EQ(true, EvalJs(contents, @@ -506,7 +506,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, NewTabContinuesToBlock) { "xhr('adbanner.js')")); EXPECT_EQ(browser()->profile()->GetPrefs()->GetUint64(kAdsBlocked), 2ULL); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); } // XHRs and ads in a cross-site iframe are blocked as well. @@ -515,7 +515,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, SubFrame) { EXPECT_EQ(browser()->profile()->GetPrefs()->GetUint64(kAdsBlocked), 0ULL); GURL url = embedded_test_server()->GetURL("a.com", "/iframe_blocking.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -549,7 +549,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, SubFrameShieldsOff) { brave_shields::SetBraveShieldsEnabled(content_settings(), false, url); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -581,7 +581,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, ServiceWorkerRequest) { EXPECT_EQ(browser()->profile()->GetPrefs()->GetUint64(kAdsBlocked), 0ULL); GURL url = embedded_test_server()->GetURL(kAdBlockTestPage); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -608,7 +608,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, ASSERT_TRUE(StartAdBlockRegionalServices()); GURL url = embedded_test_server()->GetURL(kAdBlockTestPage); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_EQ(true, EvalJs(contents, @@ -625,7 +625,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, AdBlockThirdPartyWorksByETLDP1) { GURL tab_url = embedded_test_server()->GetURL("test.a.com", kAdBlockTestPage); GURL resource_url = embedded_test_server()->GetURL("test2.a.com", "/logo.png"); - ui_test_utils::NavigateToURL(browser(), tab_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), tab_url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_EQ(true, @@ -642,7 +642,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, EXPECT_EQ(browser()->profile()->GetPrefs()->GetUint64(kAdsBlocked), 0ULL); GURL tab_url = embedded_test_server()->GetURL("b.com", kAdBlockTestPage); GURL resource_url = embedded_test_server()->GetURL("a.com", "/logo.png"); - ui_test_utils::NavigateToURL(browser(), tab_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), tab_url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_EQ(true, @@ -763,7 +763,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, } // Make sure the list is applied during browsing - ui_test_utils::NavigateToURL(browser(), tab_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), tab_url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); EXPECT_EQ(true, @@ -933,7 +933,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, brave::SetAdblockCnameHostResolverForTesting(&resolver); - ui_test_utils::NavigateToURL(browser(), tab_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), tab_url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -1019,7 +1019,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, brave::SetAdblockCnameHostResolverForTesting(&resolver); - ui_test_utils::NavigateToURL(browser(), tab_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), tab_url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -1112,7 +1112,7 @@ IN_PROC_BROWSER_TEST_F(CnameUncloakingFlagDisabledTest, NoDnsQueriesIssued) { brave::SetAdblockCnameHostResolverForTesting(&resolver); - ui_test_utils::NavigateToURL(browser(), tab_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), tab_url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -1165,7 +1165,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, BlockNYP) { GURL tab_url = embedded_test_server()->GetURL("b.com", kAdBlockTestPage); GURL resource_url = embedded_test_server()->GetURL("sp1.nypost.com", "/logo.png"); - ui_test_utils::NavigateToURL(browser(), tab_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), tab_url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_EQ(true, @@ -1180,7 +1180,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, FrameSourceURL) { UpdateAdBlockInstanceWithRules("adbanner.js$domain=a.com"); EXPECT_EQ(browser()->profile()->GetPrefs()->GetUint64(kAdsBlocked), 0ULL); GURL url = embedded_test_server()->GetURL("a.com", "/iframe_blocking.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -1190,7 +1190,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, FrameSourceURL) { EXPECT_EQ(browser()->profile()->GetPrefs()->GetUint64(kAdsBlocked), 0ULL); UpdateAdBlockInstanceWithRules("adbanner.js$domain=b.com"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_EQ(true, EvalJs(contents->GetAllFrames()[1], @@ -1212,7 +1212,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, SocialButttonAdBlockTagTest) { WaitForAdBlockServiceThreads(); GURL resource_url = embedded_test_server()->GetURL("example.com", "/logo.png"); - ui_test_utils::NavigateToURL(browser(), tab_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), tab_url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_EQ(true, @@ -1232,7 +1232,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, SocialButttonAdBlockDiffTagTest) { WaitForAdBlockServiceThreads(); GURL resource_url = embedded_test_server()->GetURL("example.com", "/logo.png"); - ui_test_utils::NavigateToURL(browser(), tab_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), tab_url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_EQ(true, @@ -1305,7 +1305,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, CollapseBlockedImage) { EXPECT_EQ(browser()->profile()->GetPrefs()->GetUint64(kAdsBlocked), 0ULL); GURL url = embedded_test_server()->GetURL(kAdBlockTestPage); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -1328,7 +1328,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, CollapseBlockedIframe) { EXPECT_EQ(browser()->profile()->GetPrefs()->GetUint64(kAdsBlocked), 0ULL); GURL url = embedded_test_server()->GetURL(kAdBlockTestPage); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -1360,7 +1360,7 @@ IN_PROC_BROWSER_TEST_F(CollapseBlockedElementsFlagDisabledTest, EXPECT_EQ(browser()->profile()->GetPrefs()->GetUint64(kAdsBlocked), 0ULL); GURL url = embedded_test_server()->GetURL(kAdBlockTestPage); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -1384,7 +1384,7 @@ IN_PROC_BROWSER_TEST_F(CollapseBlockedElementsFlagDisabledTest, EXPECT_EQ(browser()->profile()->GetPrefs()->GetUint64(kAdsBlocked), 0ULL); GURL url = embedded_test_server()->GetURL(kAdBlockTestPage); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -1417,7 +1417,7 @@ IN_PROC_BROWSER_TEST_F(Default1pBlockingFlagDisabledTest, Default1pBlocking) { UpdateAdBlockInstanceWithRules("^ad_banner.png"); GURL url = embedded_test_server()->GetURL(kAdBlockTestPage); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -1443,7 +1443,7 @@ IN_PROC_BROWSER_TEST_F(Default1pBlockingFlagDisabledTest, UpdateAdBlockInstanceWithRules("^ad_banner.png"); GURL url = embedded_test_server()->GetURL(kAdBlockTestPage); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -1468,7 +1468,7 @@ IN_PROC_BROWSER_TEST_F(Default1pBlockingFlagDisabledTest, Custom1pBlocking) { WaitForAdBlockServiceThreads(); GURL url = embedded_test_server()->GetURL(kAdBlockTestPage); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -1501,7 +1501,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, RedirectRulesAreRespected) { const GURL url = embedded_test_server()->GetURL("example.com", kAdBlockTestPage); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -1543,7 +1543,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, RedirectWithoutBlockIsNoop) { const GURL url = embedded_test_server()->GetURL("example.com", kAdBlockTestPage); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -1577,7 +1577,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, CspRule) { const GURL url = embedded_test_server()->GetURL("example.com", "/csp_rules.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -1610,7 +1610,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, CspRuleMerging) { const GURL url = embedded_test_server()->GetURL("sub.example.com", "/csp_rules.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -1637,7 +1637,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, CspRuleShieldsDown) { embedded_test_server()->GetURL("example.com", "/csp_rules.html"); ShieldsDown(url); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -1672,7 +1672,7 @@ IN_PROC_BROWSER_TEST_F(CosmeticFilteringFlagDisabledTest, GURL tab_url = embedded_test_server()->GetURL("b.com", "/cosmetic_filtering.html"); - ui_test_utils::NavigateToURL(browser(), tab_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), tab_url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -1698,7 +1698,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, CosmeticFilteringDisabled) { GURL tab_url = embedded_test_server()->GetURL("b.com", "/cosmetic_filtering.html"); - ui_test_utils::NavigateToURL(browser(), tab_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), tab_url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -1722,7 +1722,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, CosmeticFilteringSimple) { GURL tab_url = embedded_test_server()->GetURL("b.com", "/cosmetic_filtering.html"); - ui_test_utils::NavigateToURL(browser(), tab_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), tab_url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -1782,7 +1782,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, CosmeticFilteringProtect1p) { // It's a private suffix from https://publicsuffix.org/list/ GURL tab_url = embedded_test_server()->GetURL("test.lion.appspot.com", "/cosmetic_filtering.html"); - ui_test_utils::NavigateToURL(browser(), tab_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), tab_url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -1812,7 +1812,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, CosmeticFilteringHide1pContent) { GURL tab_url = embedded_test_server()->GetURL("b.com", "/cosmetic_filtering.html"); - ui_test_utils::NavigateToURL(browser(), tab_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), tab_url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -1839,7 +1839,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, CosmeticFilteringDynamic) { GURL tab_url = embedded_test_server()->GetURL("b.com", "/cosmetic_filtering.html"); - ui_test_utils::NavigateToURL(browser(), tab_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), tab_url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -1884,7 +1884,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, CosmeticFilteringGenerichide) { GURL tab_url = embedded_test_server()->GetURL("b.com", "/cosmetic_filtering.html"); - ui_test_utils::NavigateToURL(browser(), tab_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), tab_url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -1907,7 +1907,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, CosmeticFilteringCustomStyle) { GURL tab_url = embedded_test_server()->GetURL("b.com", "/cosmetic_filtering.html"); - ui_test_utils::NavigateToURL(browser(), tab_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), tab_url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -1938,7 +1938,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, CosmeticFilteringUnhide) { GURL tab_url = embedded_test_server()->GetURL("b.com", "/cosmetic_filtering.html"); - ui_test_utils::NavigateToURL(browser(), tab_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), tab_url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -1997,7 +1997,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, CosmeticFilteringWindowScriptlet) { GURL tab_url = embedded_test_server()->GetURL("b.com", "/cosmetic_filtering.html"); - ui_test_utils::NavigateToURL(browser(), tab_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), tab_url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -2037,7 +2037,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, CosmeticFilteringIframeScriptlet) { GURL tab_url = embedded_test_server()->GetURL("b.com", "/iframe_messenger.html"); - ui_test_utils::NavigateToURL(browser(), tab_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), tab_url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); diff --git a/browser/brave_shields/domain_block_page_browsertest.cc b/browser/brave_shields/domain_block_page_browsertest.cc index 5889cb510e36..02aba0f5cc3a 100644 --- a/browser/brave_shields/domain_block_page_browsertest.cc +++ b/browser/brave_shields/domain_block_page_browsertest.cc @@ -60,7 +60,7 @@ class DomainBlockTestBase : public AdBlockServiceTest { } void NavigateTo(const GURL& url) { - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::RenderFrameHost* frame = web_contents()->GetMainFrame(); ASSERT_TRUE(WaitForRenderFrameReady(frame)); } @@ -223,9 +223,9 @@ IN_PROC_BROWSER_TEST_F(DomainBlockTest, ProceedDoesNotAffectNewTabs) { // by the domain block interstitial, because the permission we gave by // clicking "Proceed anyway" in the other tab is tab-specific. ui_test_utils::AllBrowserTabAddedWaiter new_tab; - ui_test_utils::NavigateToURLWithDisposition( + ASSERT_TRUE(ui_test_utils::NavigateToURLWithDisposition( browser(), url, WindowOpenDisposition::NEW_FOREGROUND_TAB, - ui_test_utils::BROWSER_TEST_WAIT_FOR_LOAD_STOP); + ui_test_utils::BROWSER_TEST_WAIT_FOR_LOAD_STOP)); new_tab.Wait(); ASSERT_TRUE(IsShowingInterstitial()); } @@ -263,9 +263,9 @@ IN_PROC_BROWSER_TEST_F(DomainBlockTest, DontWarnAgainAndProceed) { // directly, because we previously saved the "don't warn again" choice for // this domain and are now respecting that choice. ui_test_utils::AllBrowserTabAddedWaiter new_tab; - ui_test_utils::NavigateToURLWithDisposition( + ASSERT_TRUE(ui_test_utils::NavigateToURLWithDisposition( browser(), url, WindowOpenDisposition::NEW_FOREGROUND_TAB, - ui_test_utils::BROWSER_TEST_WAIT_FOR_LOAD_STOP); + ui_test_utils::BROWSER_TEST_WAIT_FOR_LOAD_STOP)); new_tab.Wait(); ASSERT_FALSE(IsShowingInterstitial()); EXPECT_EQ(web_contents()->GetURL().host(), "a.com"); @@ -304,9 +304,9 @@ IN_PROC_BROWSER_TEST_F(DomainBlockTest, NoFetch) { SetCosmeticFilteringControlType(content_settings(), ControlType::BLOCK, url); BlockDomainByURL(url); ui_test_utils::AllBrowserTabAddedWaiter new_tab; - ui_test_utils::NavigateToURLWithDisposition( + ASSERT_TRUE(ui_test_utils::NavigateToURLWithDisposition( browser(), url, WindowOpenDisposition::NEW_FOREGROUND_TAB, - ui_test_utils::BROWSER_TEST_WAIT_FOR_LOAD_STOP); + ui_test_utils::BROWSER_TEST_WAIT_FOR_LOAD_STOP)); new_tab.Wait(); // Should be showing domain blocked interstitial page. diff --git a/browser/brave_wallet/brave_wallet_ethereum_chain_browsertest.cc b/browser/brave_wallet/brave_wallet_ethereum_chain_browsertest.cc index 38fa61a961ff..e8219bc37d3d 100644 --- a/browser/brave_wallet/brave_wallet_ethereum_chain_browsertest.cc +++ b/browser/brave_wallet/brave_wallet_ethereum_chain_browsertest.cc @@ -134,7 +134,7 @@ IN_PROC_BROWSER_TEST_F(BraveWalletEthereumChainTest, AddEthereumChainApproved) { GURL url = https_server()->GetURL("a.com", "/brave_wallet_ethereum_chain.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); WaitForLoadStop(contents); @@ -153,7 +153,7 @@ IN_PROC_BROWSER_TEST_F(BraveWalletEthereumChainTest, AddEthereumChainApproved) { IN_PROC_BROWSER_TEST_F(BraveWalletEthereumChainTest, AddEthereumChainRejected) { GURL url = https_server()->GetURL("a.com", "/brave_wallet_ethereum_chain.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); WaitForLoadStop(contents); @@ -168,7 +168,7 @@ IN_PROC_BROWSER_TEST_F(BraveWalletEthereumChainTest, AddEthereumChainRejected) { IN_PROC_BROWSER_TEST_F(BraveWalletEthereumChainTest, AddChainSameOrigin) { GURL url = https_server()->GetURL("a.com", "/brave_wallet_ethereum_chain.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); WaitForLoadStop(contents); @@ -191,7 +191,7 @@ IN_PROC_BROWSER_TEST_F(BraveWalletEthereumChainTest, AddSameChainDifferentOrigins) { GURL urlA = https_server()->GetURL("a.com", "/brave_wallet_ethereum_chain.html"); - ui_test_utils::NavigateToURL(browser(), urlA); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), urlA)); content::WebContents* contentsA = browser()->tab_strip_model()->GetActiveWebContents(); WaitForLoadStop(contentsA); @@ -227,7 +227,7 @@ IN_PROC_BROWSER_TEST_F(BraveWalletEthereumChainTest, AddDifferentChains) { GURL urlA = https_server()->GetURL("a.com", "/brave_wallet_ethereum_chain.html"); - ui_test_utils::NavigateToURL(browser(), urlA); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), urlA)); content::WebContents* contentsA = browser()->tab_strip_model()->GetActiveWebContents(); WaitForLoadStop(contentsA); @@ -266,7 +266,7 @@ IN_PROC_BROWSER_TEST_F(BraveWalletEthereumChainTest, AddDifferentChains) { IN_PROC_BROWSER_TEST_F(BraveWalletEthereumChainTest, AddChainAndCloseTab) { GURL urlA = https_server()->GetURL("a.com", "/brave_wallet_ethereum_chain.html"); - ui_test_utils::NavigateToURL(browser(), urlA); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), urlA)); content::WebContents* contentsA = browser()->tab_strip_model()->GetActiveWebContents(); WaitForLoadStop(contentsA); @@ -306,7 +306,7 @@ IN_PROC_BROWSER_TEST_F(BraveWalletEthereumChainTest, AddChainAndCloseTab) { IN_PROC_BROWSER_TEST_F(BraveWalletEthereumChainTest, AddBrokenChain) { GURL url = https_server()->GetURL("a.com", "/brave_wallet_ethereum_chain.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); WaitForLoadStop(contents); diff --git a/browser/brave_wallet/brave_wallet_event_emitter_browsertest.cc b/browser/brave_wallet/brave_wallet_event_emitter_browsertest.cc index 17d86a48c7fc..024e65f68cf9 100644 --- a/browser/brave_wallet/brave_wallet_event_emitter_browsertest.cc +++ b/browser/brave_wallet/brave_wallet_event_emitter_browsertest.cc @@ -115,7 +115,7 @@ class BraveWalletEventEmitterTest : public InProcessBrowserTest { IN_PROC_BROWSER_TEST_F(BraveWalletEventEmitterTest, CheckForAConnectEvent) { GURL url = https_server()->GetURL("a.com", "/brave_wallet_event_emitter.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); WaitForLoadStop(contents); @@ -130,7 +130,7 @@ IN_PROC_BROWSER_TEST_F(BraveWalletEventEmitterTest, CheckForAChainChangedEvent) { GURL url = https_server()->GetURL("a.com", "/brave_wallet_event_emitter.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); WaitForLoadStop(contents); diff --git a/browser/brave_wallet/brave_wallet_service_delegate_impl.cc b/browser/brave_wallet/brave_wallet_service_delegate_impl.cc index dcbdb379058d..b4f43ff89a49 100644 --- a/browser/brave_wallet/brave_wallet_service_delegate_impl.cc +++ b/browser/brave_wallet/brave_wallet_service_delegate_impl.cc @@ -39,6 +39,7 @@ using extensions::ExtensionRegistry; using extensions::IsOnBackendSequence; using extensions::StorageFrontend; using extensions::mojom::ManifestLocation; +using value_store::ValueStore; namespace brave_wallet { diff --git a/browser/brave_wallet/brave_wallet_service_delegate_impl.h b/browser/brave_wallet/brave_wallet_service_delegate_impl.h index 3f8a300f6cd1..46e0c9647f81 100644 --- a/browser/brave_wallet/brave_wallet_service_delegate_impl.h +++ b/browser/brave_wallet/brave_wallet_service_delegate_impl.h @@ -18,7 +18,9 @@ #include "brave/components/brave_wallet/common/brave_wallet.mojom.h" #include "mojo/public/cpp/bindings/remote.h" +namespace value_store { class ValueStore; +} namespace content { class BrowserContext; diff --git a/browser/brave_wallet/brave_wallet_tab_helper_browsertest.cc b/browser/brave_wallet/brave_wallet_tab_helper_browsertest.cc index f0a1e487fedc..6605098608a2 100644 --- a/browser/brave_wallet/brave_wallet_tab_helper_browsertest.cc +++ b/browser/brave_wallet/brave_wallet_tab_helper_browsertest.cc @@ -82,7 +82,7 @@ IN_PROC_BROWSER_TEST_F(BraveWalletTabHelperBrowserTest, DoNotHidePanelIfRequestedHIDPermissions) { GURL url = https_server()->GetURL("a.com", "/brave_wallet_ethereum_chain.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); WaitForLoadStop(contents); @@ -108,7 +108,7 @@ IN_PROC_BROWSER_TEST_F(BraveWalletTabHelperBrowserTest, HidePanelWhenOthersRequestedHIDPermissions) { GURL url = https_server()->GetURL("a.com", "/brave_wallet_ethereum_chain.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); WaitForLoadStop(contents); diff --git a/browser/browsing_data/brave_clear_browsing_data_browsertest.cc b/browser/browsing_data/brave_clear_browsing_data_browsertest.cc index 5bde2d73f511..97bcbed9f58d 100644 --- a/browser/browsing_data/brave_clear_browsing_data_browsertest.cc +++ b/browser/browsing_data/brave_clear_browsing_data_browsertest.cc @@ -32,11 +32,13 @@ #include "components/browsing_data/core/pref_names.h" #include "components/prefs/pref_service.h" #include "content/public/browser/browsing_data_remover.h" +#include "content/public/browser/render_frame_host.h" #include "content/public/browser/web_contents.h" #include "content/public/common/content_features.h" #include "content/public/test/browser_test.h" #include "content/public/test/browser_test_utils.h" #include "content/public/test/test_navigation_observer.h" +#include "url/url_constants.h" using content::BraveClearBrowsingData; using content::WebContents; @@ -247,7 +249,8 @@ class BraveClearDataOnExitTwoBrowsersTest : public BraveClearDataOnExitTest { search_test_utils::WaitForTemplateURLServiceToLoad( TemplateURLServiceFactory::GetForProfile(guest)); // Navigate to about:blank. - ui_test_utils::NavigateToURL(browser, GURL(url::kAboutBlankURL)); + EXPECT_TRUE( + ui_test_utils::NavigateToURL(browser, GURL(url::kAboutBlankURL))); return browser; } diff --git a/browser/debounce/debounce_browsertest.cc b/browser/debounce/debounce_browsertest.cc index ec5808a69d90..b893b6d0502b 100644 --- a/browser/debounce/debounce_browsertest.cc +++ b/browser/debounce/debounce_browsertest.cc @@ -151,7 +151,7 @@ class DebounceBrowserTest : public BaseLocalDataFilesBrowserTest { const GURL& landing_url) { ui_test_utils::UrlLoadObserver load_complete( landing_url, content::NotificationService::AllSources()); - ui_test_utils::NavigateToURL(browser(), original_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), original_url)); load_complete.Wait(); EXPECT_EQ(web_contents()->GetLastCommittedURL(), landing_url); } diff --git a/browser/decentralized_dns/test/decentralized_dns_navigation_throttle_browsertest.cc b/browser/decentralized_dns/test/decentralized_dns_navigation_throttle_browsertest.cc index 6187d19c7f23..cb6586311506 100644 --- a/browser/decentralized_dns/test/decentralized_dns_navigation_throttle_browsertest.cc +++ b/browser/decentralized_dns/test/decentralized_dns_navigation_throttle_browsertest.cc @@ -93,7 +93,8 @@ class DecentralizedDnsNavigationThrottleBrowserTest IN_PROC_BROWSER_TEST_F(DecentralizedDnsNavigationThrottleBrowserTest, ShowUnstoppableDomainsInterstitialAndProceed) { - ui_test_utils::NavigateToURL(browser(), GURL("http://test.crypto")); + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), GURL("http://test.crypto"))); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -113,7 +114,8 @@ IN_PROC_BROWSER_TEST_F(DecentralizedDnsNavigationThrottleBrowserTest, IN_PROC_BROWSER_TEST_F(DecentralizedDnsNavigationThrottleBrowserTest, ShowUnstoppableDomainsInterstitialAndReject) { - ui_test_utils::NavigateToURL(browser(), GURL("http://test.crypto")); + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), GURL("http://test.crypto"))); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -133,7 +135,7 @@ IN_PROC_BROWSER_TEST_F(DecentralizedDnsNavigationThrottleBrowserTest, IN_PROC_BROWSER_TEST_F(DecentralizedDnsNavigationThrottleBrowserTest, ShowENSInterstitialAndProceed) { - ui_test_utils::NavigateToURL(browser(), GURL("http://test.eth")); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), GURL("http://test.eth"))); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -153,7 +155,7 @@ IN_PROC_BROWSER_TEST_F(DecentralizedDnsNavigationThrottleBrowserTest, IN_PROC_BROWSER_TEST_F(DecentralizedDnsNavigationThrottleBrowserTest, ShowENSInterstitialAndReject) { - ui_test_utils::NavigateToURL(browser(), GURL("http://test.eth")); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), GURL("http://test.eth"))); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); diff --git a/browser/ephemeral_storage/ephemeral_storage_browsertest.cc b/browser/ephemeral_storage/ephemeral_storage_browsertest.cc index f44cc1d71be4..3bdf397f9bbf 100644 --- a/browser/ephemeral_storage/ephemeral_storage_browsertest.cc +++ b/browser/ephemeral_storage/ephemeral_storage_browsertest.cc @@ -243,9 +243,9 @@ class EphemeralStorageBrowserTest : public InProcessBrowserTest { WebContents* LoadURLInNewTab(GURL url) { ui_test_utils::AllBrowserTabAddedWaiter add_tab; - ui_test_utils::NavigateToURLWithDisposition( + EXPECT_TRUE(ui_test_utils::NavigateToURLWithDisposition( browser(), url, WindowOpenDisposition::NEW_FOREGROUND_TAB, - ui_test_utils::BROWSER_TEST_WAIT_FOR_LOAD_STOP); + ui_test_utils::BROWSER_TEST_WAIT_FOR_LOAD_STOP)); return add_tab.Wait(); } @@ -372,8 +372,8 @@ IN_PROC_BROWSER_TEST_F(EphemeralStorageBrowserTest, StorageIsPartitioned) { IN_PROC_BROWSER_TEST_F(EphemeralStorageBrowserTest, NavigatingClearsEphemeralStorageAfterKeepAlive) { - ui_test_utils::NavigateToURL( - browser(), a_site_ephemeral_storage_with_network_cookies_url_); + ASSERT_TRUE(ui_test_utils::NavigateToURL( + browser(), a_site_ephemeral_storage_with_network_cookies_url_)); auto* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); SetValuesInFrames(web_contents, "a.com value", "from=a.com"); @@ -392,8 +392,10 @@ IN_PROC_BROWSER_TEST_F(EphemeralStorageBrowserTest, EXPECT_EQ("name=bcom_simple; from=a.com", values.iframe_2.cookies); // Navigate away and then navigate back to the original site. - ui_test_utils::NavigateToURL(browser(), b_site_ephemeral_storage_url_); - ui_test_utils::NavigateToURL(browser(), a_site_ephemeral_storage_url_); + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), b_site_ephemeral_storage_url_)); + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), a_site_ephemeral_storage_url_)); // within keepalive values should be the same ValuesFromFrames before_timeout = GetValuesFromFrames(web_contents); @@ -411,7 +413,8 @@ IN_PROC_BROWSER_TEST_F(EphemeralStorageBrowserTest, EXPECT_EQ("name=bcom_simple; from=a.com", before_timeout.iframe_2.cookies); // after keepalive values should be cleared - ui_test_utils::NavigateToURL(browser(), b_site_ephemeral_storage_url_); + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), b_site_ephemeral_storage_url_)); base::RunLoop run_loop; base::SequencedTaskRunnerHandle::Get()->PostDelayedTask( @@ -419,7 +422,8 @@ IN_PROC_BROWSER_TEST_F(EphemeralStorageBrowserTest, base::TimeDelta::FromSeconds(kKeepAliveInterval)); run_loop.Run(); - ui_test_utils::NavigateToURL(browser(), a_site_ephemeral_storage_url_); + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), a_site_ephemeral_storage_url_)); ValuesFromFrames after_timeout = GetValuesFromFrames(web_contents); EXPECT_EQ("a.com value", after_timeout.main_frame.local_storage); @@ -466,7 +470,8 @@ IN_PROC_BROWSER_TEST_F(EphemeralStorageBrowserTest, EXPECT_TRUE(was_closed); // Navigate the main tab to the same site. - ui_test_utils::NavigateToURL(browser(), a_site_ephemeral_storage_url_); + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), a_site_ephemeral_storage_url_)); auto* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); // Closing the tab earlier should have cleared the ephemeral storage area. @@ -486,8 +491,8 @@ IN_PROC_BROWSER_TEST_F(EphemeralStorageBrowserTest, IN_PROC_BROWSER_TEST_F(EphemeralStorageBrowserTest, ReloadDoesNotClearEphemeralStorage) { - ui_test_utils::NavigateToURL( - browser(), a_site_ephemeral_storage_with_network_cookies_url_); + ASSERT_TRUE(ui_test_utils::NavigateToURL( + browser(), a_site_ephemeral_storage_with_network_cookies_url_)); auto* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); SetValuesInFrames(web_contents, "a.com value", "from=a.com"); @@ -506,7 +511,8 @@ IN_PROC_BROWSER_TEST_F(EphemeralStorageBrowserTest, EXPECT_EQ("name=bcom_simple; from=a.com", values_before.iframe_2.cookies); // Reload the page (without network cookies). - ui_test_utils::NavigateToURL(browser(), a_site_ephemeral_storage_url_); + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), a_site_ephemeral_storage_url_)); ValuesFromFrames values_after = GetValuesFromFrames(web_contents); EXPECT_EQ("a.com value", values_after.main_frame.local_storage); @@ -524,8 +530,8 @@ IN_PROC_BROWSER_TEST_F(EphemeralStorageBrowserTest, IN_PROC_BROWSER_TEST_F(EphemeralStorageBrowserTest, EphemeralStorageDoesNotLeakBetweenProfiles) { - ui_test_utils::NavigateToURL( - browser(), a_site_ephemeral_storage_with_network_cookies_url_); + ASSERT_TRUE(ui_test_utils::NavigateToURL( + browser(), a_site_ephemeral_storage_with_network_cookies_url_)); auto* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); SetValuesInFrames(web_contents, "a.com value", "from=a.com"); @@ -546,8 +552,8 @@ IN_PROC_BROWSER_TEST_F(EphemeralStorageBrowserTest, // A browser with the same profile should share all values with the // first browser, including ephemeral storage values. Browser* same_profile_browser = CreateBrowser(browser()->profile()); - ui_test_utils::NavigateToURL(same_profile_browser, - a_site_ephemeral_storage_url_); + ASSERT_TRUE(ui_test_utils::NavigateToURL(same_profile_browser, + a_site_ephemeral_storage_url_)); auto* same_profile_web_contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -571,7 +577,8 @@ IN_PROC_BROWSER_TEST_F(EphemeralStorageBrowserTest, // A browser with a different profile shouldn't share any values with // the first set of browsers. Browser* private_browser = CreateIncognitoBrowser(nullptr); - ui_test_utils::NavigateToURL(private_browser, a_site_ephemeral_storage_url_); + ASSERT_TRUE(ui_test_utils::NavigateToURL(private_browser, + a_site_ephemeral_storage_url_)); auto* private_web_contents = private_browser->tab_strip_model()->GetActiveWebContents(); @@ -596,9 +603,10 @@ IN_PROC_BROWSER_TEST_F(EphemeralStorageBrowserTest, GURL b_site_set_cookie_url = https_server_.GetURL( "b.com", "/set-cookie?name=bcom;path=/;SameSite=None;Secure"); - ui_test_utils::NavigateToURL(browser(), a_site_set_cookie_url); - ui_test_utils::NavigateToURL(browser(), b_site_set_cookie_url); - ui_test_utils::NavigateToURL(browser(), a_site_ephemeral_storage_url_); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), a_site_set_cookie_url)); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), b_site_set_cookie_url)); + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), a_site_ephemeral_storage_url_)); std::string a_cookie = content::GetCookies(browser()->profile(), GURL("https://a.com/")); @@ -632,7 +640,8 @@ IN_PROC_BROWSER_TEST_F(EphemeralStorageBrowserTest, // Navigating to a new TLD should clear all ephemeral cookies after keep-alive // timeout. - ui_test_utils::NavigateToURL(browser(), b_site_ephemeral_storage_url_); + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), b_site_ephemeral_storage_url_)); base::RunLoop run_loop; base::SequencedTaskRunnerHandle::Get()->PostDelayedTask( @@ -640,7 +649,8 @@ IN_PROC_BROWSER_TEST_F(EphemeralStorageBrowserTest, base::TimeDelta::FromSeconds(kKeepAliveInterval)); run_loop.Run(); - ui_test_utils::NavigateToURL(browser(), a_site_ephemeral_storage_url_); + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), a_site_ephemeral_storage_url_)); ValuesFromFrames values_after = GetValuesFromFrames(web_contents); EXPECT_EQ("name=acom", values_after.main_frame.cookies); @@ -878,8 +888,9 @@ IN_PROC_BROWSER_TEST_F(EphemeralStorageBrowserTest, GURL a_site_set_cookie_url = https_server_.GetURL( "a.com", "/set-cookie?name=acom;path=/;SameSite=None;Secure"); - ui_test_utils::NavigateToURL(browser(), a_site_set_cookie_url); - ui_test_utils::NavigateToURL(browser(), a_site_ephemeral_storage_url_); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), a_site_set_cookie_url)); + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), a_site_ephemeral_storage_url_)); RenderFrameHost* site_a_main_frame = web_contents->GetMainFrame(); RenderFrameHost* nested_frames_tab = @@ -932,8 +943,8 @@ class EphemeralStorageKeepAliveDisabledBrowserTest IN_PROC_BROWSER_TEST_F(EphemeralStorageKeepAliveDisabledBrowserTest, NavigatingClearsEphemeralStorageWhenKeepAliveDisabled) { - ui_test_utils::NavigateToURL( - browser(), a_site_ephemeral_storage_with_network_cookies_url_); + ASSERT_TRUE(ui_test_utils::NavigateToURL( + browser(), a_site_ephemeral_storage_with_network_cookies_url_)); auto* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); SetValuesInFrames(web_contents, "a.com value", "from=a.com"); @@ -952,8 +963,10 @@ IN_PROC_BROWSER_TEST_F(EphemeralStorageKeepAliveDisabledBrowserTest, EXPECT_EQ("name=bcom_simple; from=a.com", values_before.iframe_2.cookies); // Navigate away and then navigate back to the original site. - ui_test_utils::NavigateToURL(browser(), b_site_ephemeral_storage_url_); - ui_test_utils::NavigateToURL(browser(), a_site_ephemeral_storage_url_); + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), b_site_ephemeral_storage_url_)); + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), a_site_ephemeral_storage_url_)); ValuesFromFrames values_after = GetValuesFromFrames(web_contents); EXPECT_EQ("a.com value", values_after.main_frame.local_storage); @@ -986,7 +999,8 @@ class EphemeralStorageNoSiteIsolationAndKeepAliveDisabledBrowserTest IN_PROC_BROWSER_TEST_F( EphemeralStorageNoSiteIsolationAndKeepAliveDisabledBrowserTest, RenderInitiatedNavigationClearsEphemeralStorage) { - ui_test_utils::NavigateToURL(browser(), a_site_ephemeral_storage_url_); + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), a_site_ephemeral_storage_url_)); auto* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); SetValuesInFrames(web_contents, "a.com value", "from=a.com"); diff --git a/browser/ephemeral_storage/ephemeral_storage_qa_browsertest.cc b/browser/ephemeral_storage/ephemeral_storage_qa_browsertest.cc index a8f52aadd72a..28027e972548 100644 --- a/browser/ephemeral_storage/ephemeral_storage_qa_browsertest.cc +++ b/browser/ephemeral_storage/ephemeral_storage_qa_browsertest.cc @@ -394,7 +394,7 @@ class EphemeralStorageTest : public InProcessBrowserTest { GURL tab_url = embedded_test_server()->GetURL("dev-pages.brave.software", kEphemeralStorageTestPage); - ui_test_utils::NavigateToURL(browser(), tab_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), tab_url)); original_tab_ = tabs_->GetActiveWebContents(); ClickStartTest(original_tab_); diff --git a/browser/extensions/api/binance_api.cc b/browser/extensions/api/binance_api.cc index c3768d72ecea..6c4df9453155 100644 --- a/browser/extensions/api/binance_api.cc +++ b/browser/extensions/api/binance_api.cc @@ -128,7 +128,7 @@ BinanceGetConvertQuoteFunction::Run() { } std::unique_ptr params( - binance::GetConvertQuote::Params::Create(*args_)); + binance::GetConvertQuote::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); auto* service = GetBinanceService(browser_context()); @@ -175,7 +175,7 @@ BinanceGetDepositInfoFunction::Run() { } std::unique_ptr params( - binance::GetDepositInfo::Params::Create(*args_)); + binance::GetDepositInfo::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); auto* service = GetBinanceService(browser_context()); @@ -206,7 +206,7 @@ BinanceConfirmConvertFunction::Run() { } std::unique_ptr params( - binance::ConfirmConvert::Params::Create(*args_)); + binance::ConfirmConvert::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); auto* service = GetBinanceService(browser_context()); diff --git a/browser/extensions/api/brave_rewards_api.cc b/browser/extensions/api/brave_rewards_api.cc index 6e52a22c6a2d..d84a5867c9a9 100644 --- a/browser/extensions/api/brave_rewards_api.cc +++ b/browser/extensions/api/brave_rewards_api.cc @@ -51,7 +51,7 @@ BraveRewardsOpenBrowserActionUIFunction:: ExtensionFunction::ResponseAction BraveRewardsOpenBrowserActionUIFunction::Run() { std::unique_ptr params( - brave_rewards::OpenBrowserActionUI::Params::Create(*args_)); + brave_rewards::OpenBrowserActionUI::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); auto* profile = Profile::FromBrowserContext(browser_context()); @@ -88,7 +88,7 @@ BraveRewardsUpdateMediaDurationFunction:: ExtensionFunction::ResponseAction BraveRewardsUpdateMediaDurationFunction::Run() { std::unique_ptr params( - brave_rewards::UpdateMediaDuration::Params::Create(*args_)); + brave_rewards::UpdateMediaDuration::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); Profile* profile = Profile::FromBrowserContext(browser_context()); @@ -115,7 +115,7 @@ BraveRewardsGetPublisherInfoFunction:: ExtensionFunction::ResponseAction BraveRewardsGetPublisherInfoFunction::Run() { std::unique_ptr params( - brave_rewards::GetPublisherInfo::Params::Create(*args_)); + brave_rewards::GetPublisherInfo::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); Profile* profile = Profile::FromBrowserContext(browser_context()); @@ -162,7 +162,7 @@ BraveRewardsGetPublisherPanelInfoFunction:: ExtensionFunction::ResponseAction BraveRewardsGetPublisherPanelInfoFunction::Run() { std::unique_ptr params( - brave_rewards::GetPublisherPanelInfo::Params::Create(*args_)); + brave_rewards::GetPublisherPanelInfo::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); Profile* profile = Profile::FromBrowserContext(browser_context()); @@ -209,9 +209,8 @@ BraveRewardsSavePublisherInfoFunction:: ExtensionFunction::ResponseAction BraveRewardsSavePublisherInfoFunction::Run() { - std::unique_ptr - params(brave_rewards::SavePublisherInfo::Params::Create( - *args_)); + std::unique_ptr params( + brave_rewards::SavePublisherInfo::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); Profile* profile = Profile::FromBrowserContext(browser_context()); @@ -247,7 +246,7 @@ BraveRewardsTipSiteFunction::~BraveRewardsTipSiteFunction() { ExtensionFunction::ResponseAction BraveRewardsTipSiteFunction::Run() { std::unique_ptr params( - brave_rewards::TipSite::Params::Create(*args_)); + brave_rewards::TipSite::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); // Sanity check: don't allow tips in private / tor contexts, @@ -285,7 +284,7 @@ BraveRewardsTipUserFunction::~BraveRewardsTipUserFunction() { ExtensionFunction::ResponseAction BraveRewardsTipUserFunction::Run() { std::unique_ptr params( - brave_rewards::TipUser::Params::Create(*args_)); + brave_rewards::TipUser::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); // Sanity check: don't allow tips in private / tor contexts, @@ -350,7 +349,7 @@ void BraveRewardsTipUserFunction::OnTipUserGetPublisherInfo( } std::unique_ptr params( - brave_rewards::TipUser::Params::Create(*args_)); + brave_rewards::TipUser::Params::Create(args())); auto publisher_info = ledger::type::PublisherInfo::New(); publisher_info->id = params->publisher_key; @@ -385,7 +384,7 @@ void BraveRewardsTipUserFunction::OnTipUserSavePublisherInfo( void BraveRewardsTipUserFunction::ShowTipDialog() { std::unique_ptr params( - brave_rewards::TipUser::Params::Create(*args_)); + brave_rewards::TipUser::Params::Create(args())); if (!params) { Release(); return; @@ -434,7 +433,7 @@ BraveRewardsIncludeInAutoContributionFunction:: ExtensionFunction::ResponseAction BraveRewardsIncludeInAutoContributionFunction::Run() { std::unique_ptr params( - brave_rewards::IncludeInAutoContribution::Params::Create(*args_)); + brave_rewards::IncludeInAutoContribution::Params::Create(args())); Profile* profile = Profile::FromBrowserContext(browser_context()); RewardsService* rewards_service = RewardsServiceFactory::GetForProfile(profile); @@ -448,7 +447,7 @@ ExtensionFunction::ResponseAction ExtensionFunction::ResponseAction BraveRewardsGetPublisherDataFunction::Run() { std::unique_ptr params( - brave_rewards::GetPublisherData::Params::Create(*args_)); + brave_rewards::GetPublisherData::Params::Create(args())); Profile* profile = Profile::FromBrowserContext(browser_context()); auto* rewards_service = RewardsServiceFactory::GetForProfile(profile); if (rewards_service) { @@ -514,7 +513,7 @@ ExtensionFunction::ResponseAction BraveRewardsGetBalanceReportFunction::Run() { } std::unique_ptr params( - brave_rewards::GetBalanceReport::Params::Create(*args_)); + brave_rewards::GetBalanceReport::Params::Create(args())); rewards_service->GetBalanceReport( params->month, @@ -559,7 +558,7 @@ BraveRewardsClaimPromotionFunction:: ExtensionFunction::ResponseAction BraveRewardsClaimPromotionFunction::Run() { std::unique_ptr params( - brave_rewards::ClaimPromotion::Params::Create(*args_)); + brave_rewards::ClaimPromotion::Params::Create(args())); Profile* profile = Profile::FromBrowserContext(browser_context()); RewardsService* rewards_service = RewardsServiceFactory::GetForProfile(profile); @@ -598,7 +597,7 @@ BraveRewardsAttestPromotionFunction:: ExtensionFunction::ResponseAction BraveRewardsAttestPromotionFunction::Run() { std::unique_ptr params( - brave_rewards::AttestPromotion::Params::Create(*args_)); + brave_rewards::AttestPromotion::Params::Create(args())); Profile* profile = Profile::FromBrowserContext(browser_context()); RewardsService* rewards_service = RewardsServiceFactory::GetForProfile(profile); @@ -663,7 +662,7 @@ BraveRewardsSaveAdsSettingFunction::~BraveRewardsSaveAdsSettingFunction() { ExtensionFunction::ResponseAction BraveRewardsSaveAdsSettingFunction::Run() { std::unique_ptr params( - brave_rewards::SaveAdsSetting::Params::Create(*args_)); + brave_rewards::SaveAdsSetting::Params::Create(args())); Profile* profile = Profile::FromBrowserContext(browser_context()); RewardsService* rewards_service = RewardsServiceFactory::GetForProfile(profile); @@ -689,7 +688,7 @@ BraveRewardsSetAutoContributeEnabledFunction:: ExtensionFunction::ResponseAction BraveRewardsSetAutoContributeEnabledFunction::Run() { std::unique_ptr params( - brave_rewards::SetAutoContributeEnabled::Params::Create(*args_)); + brave_rewards::SetAutoContributeEnabled::Params::Create(args())); Profile* profile = Profile::FromBrowserContext(browser_context()); RewardsService* rewards_service = RewardsServiceFactory::GetForProfile(profile); @@ -733,7 +732,7 @@ BraveRewardsSaveRecurringTipFunction:: ExtensionFunction::ResponseAction BraveRewardsSaveRecurringTipFunction::Run() { std::unique_ptr params( - brave_rewards::SaveRecurringTip::Params::Create(*args_)); + brave_rewards::SaveRecurringTip::Params::Create(args())); Profile* profile = Profile::FromBrowserContext(browser_context()); RewardsService* rewards_service_ = @@ -764,7 +763,7 @@ BraveRewardsRemoveRecurringTipFunction:: ExtensionFunction::ResponseAction BraveRewardsRemoveRecurringTipFunction::Run() { std::unique_ptr params( - brave_rewards::RemoveRecurringTip::Params::Create(*args_)); + brave_rewards::RemoveRecurringTip::Params::Create(args())); Profile* profile = Profile::FromBrowserContext(browser_context()); RewardsService* rewards_service_ = @@ -821,7 +820,7 @@ BraveRewardsGetPublisherBannerFunction:: ExtensionFunction::ResponseAction BraveRewardsGetPublisherBannerFunction::Run() { std::unique_ptr params( - brave_rewards::GetPublisherBanner::Params::Create(*args_)); + brave_rewards::GetPublisherBanner::Params::Create(args())); Profile* profile = Profile::FromBrowserContext(browser_context()); RewardsService* rewards_service = @@ -855,7 +854,7 @@ void BraveRewardsGetPublisherBannerFunction::OnPublisherBanner( auto amounts = std::make_unique(); for (auto const& value : banner->amounts) { - amounts->AppendInteger(value); + amounts->Append(value); } result.SetList("amounts", std::move(amounts)); @@ -874,7 +873,7 @@ BraveRewardsRefreshPublisherFunction::~BraveRewardsRefreshPublisherFunction() { ExtensionFunction::ResponseAction BraveRewardsRefreshPublisherFunction::Run() { std::unique_ptr params( - brave_rewards::RefreshPublisher::Params::Create(*args_)); + brave_rewards::RefreshPublisher::Params::Create(args())); Profile* profile = Profile::FromBrowserContext(browser_context()); RewardsService* rewards_service = @@ -924,7 +923,7 @@ BraveRewardsGetAllNotificationsFunction::Run() { auto args = std::make_unique(); for (auto const& arg : notification.second.args_) { - args->AppendString(arg); + args->Append(arg); } item->SetList("args", std::move(args)); @@ -942,7 +941,7 @@ ExtensionFunction::ResponseAction BraveRewardsGetInlineTippingPlatformEnabledFunction::Run() { std::unique_ptr params(brave_rewards::GetInlineTippingPlatformEnabled::Params::Create( - *args_)); + args())); Profile* profile = Profile::FromBrowserContext(browser_context()); RewardsService* rewards_service = @@ -1232,7 +1231,7 @@ ExtensionFunction::ResponseAction BraveRewardsUpdateScheduledCaptchaResultFunction::Run() { #if BUILDFLAG(BRAVE_ADAPTIVE_CAPTCHA_ENABLED) auto params( - brave_rewards::UpdateScheduledCaptchaResult::Params::Create(*args_)); + brave_rewards::UpdateScheduledCaptchaResult::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); Profile* profile = Profile::FromBrowserContext(browser_context()); @@ -1306,7 +1305,7 @@ void BraveRewardsGetPrefsFunction::GetAutoContributePropertiesCallback( BraveRewardsUpdatePrefsFunction::~BraveRewardsUpdatePrefsFunction() = default; ExtensionFunction::ResponseAction BraveRewardsUpdatePrefsFunction::Run() { - auto params = brave_rewards::UpdatePrefs::Params::Create(*args_); + auto params = brave_rewards::UpdatePrefs::Params::Create(args()); EXTENSION_FUNCTION_VALIDATE(params); auto* profile = Profile::FromBrowserContext(browser_context()); @@ -1342,7 +1341,7 @@ BraveRewardsRequestAdsEnabledPopupClosedFunction:: ExtensionFunction::ResponseAction BraveRewardsRequestAdsEnabledPopupClosedFunction::Run() { auto params( - brave_rewards::RequestAdsEnabledPopupClosed::Params::Create(*args_)); + brave_rewards::RequestAdsEnabledPopupClosed::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); Profile* profile = Profile::FromBrowserContext(browser_context()); diff --git a/browser/extensions/api/brave_shields_api.cc b/browser/extensions/api/brave_shields_api.cc index 2cb8cb484645..cf7000f6f466 100644 --- a/browser/extensions/api/brave_shields_api.cc +++ b/browser/extensions/api/brave_shields_api.cc @@ -48,7 +48,7 @@ const char kInvalidControlTypeError[] = "Invalid ControlType."; ExtensionFunction::ResponseAction BraveShieldsAddSiteCosmeticFilterFunction::Run() { std::unique_ptr params( - brave_shields::AddSiteCosmeticFilter::Params::Create(*args_)); + brave_shields::AddSiteCosmeticFilter::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); auto* custom_filters_service = @@ -73,7 +73,7 @@ BraveShieldsOpenFilterManagementPageFunction::Run() { ExtensionFunction::ResponseAction BraveShieldsAllowScriptsOnceFunction::Run() { std::unique_ptr params( - brave_shields::AllowScriptsOnce::Params::Create(*args_)); + brave_shields::AllowScriptsOnce::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); // Get web contents for this tab @@ -98,7 +98,7 @@ BraveShieldsOpenBrowserActionUIFunction:: ExtensionFunction::ResponseAction BraveShieldsOpenBrowserActionUIFunction::Run() { std::unique_ptr params( - brave_shields::OpenBrowserActionUI::Params::Create(*args_)); + brave_shields::OpenBrowserActionUI::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); std::string error; if (!BraveActionAPI::ShowActionUI(this, @@ -113,7 +113,7 @@ BraveShieldsOpenBrowserActionUIFunction::Run() { ExtensionFunction::ResponseAction BraveShieldsSetBraveShieldsEnabledFunction::Run() { std::unique_ptr params( - brave_shields::SetBraveShieldsEnabled::Params::Create(*args_)); + brave_shields::SetBraveShieldsEnabled::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); const GURL url(params->url); @@ -135,7 +135,7 @@ BraveShieldsSetBraveShieldsEnabledFunction::Run() { ExtensionFunction::ResponseAction BraveShieldsGetBraveShieldsEnabledFunction::Run() { std::unique_ptr params( - brave_shields::GetBraveShieldsEnabled::Params::Create(*args_)); + brave_shields::GetBraveShieldsEnabled::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); const GURL url(params->url); @@ -155,8 +155,8 @@ BraveShieldsGetBraveShieldsEnabledFunction::Run() { ExtensionFunction::ResponseAction BraveShieldsSetCosmeticFilteringControlTypeFunction::Run() { std::unique_ptr - params( - brave_shields::SetCosmeticFilteringControlType::Params::Create(*args_)); + params(brave_shields::SetCosmeticFilteringControlType::Params::Create( + args())); EXTENSION_FUNCTION_VALIDATE(params.get()); const GURL url(params->url); @@ -185,7 +185,7 @@ BraveShieldsIsFirstPartyCosmeticFilteringEnabledFunction::Run() { std::unique_ptr params( brave_shields::IsFirstPartyCosmeticFilteringEnabled::Params::Create( - *args_)); + args())); EXTENSION_FUNCTION_VALIDATE(params.get()); const GURL url(params->url); @@ -203,7 +203,7 @@ BraveShieldsIsFirstPartyCosmeticFilteringEnabledFunction::Run() { ExtensionFunction::ResponseAction BraveShieldsSetAdControlTypeFunction::Run() { std::unique_ptr params( - brave_shields::SetAdControlType::Params::Create(*args_)); + brave_shields::SetAdControlType::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); const GURL url(params->url); @@ -229,7 +229,7 @@ ExtensionFunction::ResponseAction BraveShieldsSetAdControlTypeFunction::Run() { ExtensionFunction::ResponseAction BraveShieldsGetAdControlTypeFunction::Run() { std::unique_ptr params( - brave_shields::GetAdControlType::Params::Create(*args_)); + brave_shields::GetAdControlType::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); const GURL url(params->url); @@ -249,7 +249,7 @@ ExtensionFunction::ResponseAction BraveShieldsGetAdControlTypeFunction::Run() { ExtensionFunction::ResponseAction BraveShieldsSetCookieControlTypeFunction::Run() { std::unique_ptr params( - brave_shields::SetCookieControlType::Params::Create(*args_)); + brave_shields::SetCookieControlType::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); const GURL url(params->url); @@ -276,7 +276,7 @@ BraveShieldsSetCookieControlTypeFunction::Run() { ExtensionFunction::ResponseAction BraveShieldsGetCookieControlTypeFunction::Run() { std::unique_ptr params( - brave_shields::GetCookieControlType::Params::Create(*args_)); + brave_shields::GetCookieControlType::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); const GURL url(params->url); @@ -296,7 +296,7 @@ BraveShieldsGetCookieControlTypeFunction::Run() { ExtensionFunction::ResponseAction BraveShieldsSetFingerprintingControlTypeFunction::Run() { std::unique_ptr params( - brave_shields::SetFingerprintingControlType::Params::Create(*args_)); + brave_shields::SetFingerprintingControlType::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); const GURL url(params->url); @@ -323,7 +323,7 @@ BraveShieldsSetFingerprintingControlTypeFunction::Run() { ExtensionFunction::ResponseAction BraveShieldsGetFingerprintingControlTypeFunction::Run() { std::unique_ptr params( - brave_shields::GetFingerprintingControlType::Params::Create(*args_)); + brave_shields::GetFingerprintingControlType::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); const GURL url(params->url); @@ -343,7 +343,7 @@ BraveShieldsGetFingerprintingControlTypeFunction::Run() { ExtensionFunction::ResponseAction BraveShieldsSetHTTPSEverywhereEnabledFunction::Run() { std::unique_ptr params( - brave_shields::SetHTTPSEverywhereEnabled::Params::Create(*args_)); + brave_shields::SetHTTPSEverywhereEnabled::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); const GURL url(params->url); @@ -365,7 +365,7 @@ BraveShieldsSetHTTPSEverywhereEnabledFunction::Run() { ExtensionFunction::ResponseAction BraveShieldsGetHTTPSEverywhereEnabledFunction::Run() { std::unique_ptr params( - brave_shields::GetHTTPSEverywhereEnabled::Params::Create(*args_)); + brave_shields::GetHTTPSEverywhereEnabled::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); const GURL url(params->url); @@ -385,7 +385,7 @@ BraveShieldsGetHTTPSEverywhereEnabledFunction::Run() { ExtensionFunction::ResponseAction BraveShieldsSetNoScriptControlTypeFunction::Run() { std::unique_ptr params( - brave_shields::SetNoScriptControlType::Params::Create(*args_)); + brave_shields::SetNoScriptControlType::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); const GURL url(params->url); @@ -412,7 +412,7 @@ BraveShieldsSetNoScriptControlTypeFunction::Run() { ExtensionFunction::ResponseAction BraveShieldsGetNoScriptControlTypeFunction::Run() { std::unique_ptr params( - brave_shields::GetNoScriptControlType::Params::Create(*args_)); + brave_shields::GetNoScriptControlType::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); const GURL url(params->url); @@ -438,7 +438,7 @@ BraveShieldsOnShieldsPanelShownFunction::Run() { ExtensionFunction::ResponseAction BraveShieldsReportBrokenSiteFunction::Run() { std::unique_ptr params( - brave_shields::ReportBrokenSite::Params::Create(*args_)); + brave_shields::ReportBrokenSite::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); // Get web contents for this tab diff --git a/browser/extensions/api/brave_shields_api_browsertest.cc b/browser/extensions/api/brave_shields_api_browsertest.cc index 98074eee7aea..f805b4800c39 100644 --- a/browser/extensions/api/brave_shields_api_browsertest.cc +++ b/browser/extensions/api/brave_shields_api_browsertest.cc @@ -68,8 +68,8 @@ class BraveShieldsAPIBrowserTest : public InProcessBrowserTest { bool NavigateToURLUntilLoadStop(const std::string& origin, const std::string& path) { - ui_test_utils::NavigateToURL(browser(), - embedded_test_server()->GetURL(origin, path)); + EXPECT_TRUE(ui_test_utils::NavigateToURL( + browser(), embedded_test_server()->GetURL(origin, path))); return WaitForLoadStop(active_contents()); } @@ -143,18 +143,18 @@ IN_PROC_BROWSER_TEST_F(BraveShieldsAPIBrowserTest, AllowScriptsOnce) { << "Scripts from a.com should be temporarily allowed after reload."; // same doc navigation - ui_test_utils::NavigateToURL(browser(), - embedded_test_server()->GetURL( - "a.com", "/load_js_from_origins.html#foo")); + ASSERT_TRUE(ui_test_utils::NavigateToURL( + browser(), embedded_test_server()->GetURL( + "a.com", "/load_js_from_origins.html#foo"))); EXPECT_TRUE(WaitForLoadStop(active_contents())); EXPECT_EQ(active_contents()->GetAllFrames().size(), 2u) << "Scripts from a.com should be temporarily allowed for same doc " "navigation."; // navigate to a different origin - ui_test_utils::NavigateToURL( + ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), - embedded_test_server()->GetURL("b.com", "/load_js_from_origins.html")); + embedded_test_server()->GetURL("b.com", "/load_js_from_origins.html"))); EXPECT_TRUE(WaitForLoadStop(active_contents())); EXPECT_EQ(active_contents()->GetAllFrames().size(), 1u) << "All script loadings should be blocked after navigating away."; diff --git a/browser/extensions/api/brave_theme_api.cc b/browser/extensions/api/brave_theme_api.cc index 6400acc8984a..cbd460622eac 100644 --- a/browser/extensions/api/brave_theme_api.cc +++ b/browser/extensions/api/brave_theme_api.cc @@ -31,7 +31,7 @@ ExtensionFunction::ResponseAction BraveThemeGetBraveThemeTypeFunction::Run() { ExtensionFunction::ResponseAction BraveThemeSetBraveThemeTypeFunction::Run() { std::unique_ptr params( - brave_theme::SetBraveThemeType::Params::Create(*args_)); + brave_theme::SetBraveThemeType::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); dark_mode::SetBraveDarkModeType(params->type); diff --git a/browser/extensions/api/brave_wallet_api.cc b/browser/extensions/api/brave_wallet_api.cc index dcf2d6028341..4decba8ccd0e 100644 --- a/browser/extensions/api/brave_wallet_api.cc +++ b/browser/extensions/api/brave_wallet_api.cc @@ -116,7 +116,7 @@ ExtensionFunction::ResponseAction BraveWalletGetWalletSeedFunction::Run() { // make sure the passed in enryption key is 32 bytes. std::unique_ptr params( - brave_wallet::GetWalletSeed::Params::Create(*args_)); + brave_wallet::GetWalletSeed::Params::Create(args())); if (params->key.size() != 32) { return RespondNow(Error("Invalid input key size")); } @@ -139,7 +139,7 @@ ExtensionFunction::ResponseAction BraveWalletGetBitGoSeedFunction::Run() { // make sure the passed in enryption key is 32 bytes. std::unique_ptr params( - brave_wallet::GetBitGoSeed::Params::Create(*args_)); + brave_wallet::GetBitGoSeed::Params::Create(args())); if (params->key.size() != 32) { return RespondNow(Error("Invalid input key size")); } diff --git a/browser/extensions/api/brave_wallet_api_browsertest.cc b/browser/extensions/api/brave_wallet_api_browsertest.cc index 5de53351e97b..6d912e8245fb 100644 --- a/browser/extensions/api/brave_wallet_api_browsertest.cc +++ b/browser/extensions/api/brave_wallet_api_browsertest.cc @@ -94,8 +94,8 @@ class BraveWalletAPIBrowserTest : public InProcessBrowserTest { bool NavigateToURLUntilLoadStop(const std::string& origin, const std::string& path) { - ui_test_utils::NavigateToURL(browser(), - embedded_test_server()->GetURL(origin, path)); + EXPECT_TRUE(ui_test_utils::NavigateToURL( + browser(), embedded_test_server()->GetURL(origin, path))); return WaitForLoadStop(active_contents()); } diff --git a/browser/extensions/api/crypto_dot_com_api.cc b/browser/extensions/api/crypto_dot_com_api.cc index d61392cb0fda..b61af6fb5c1b 100644 --- a/browser/extensions/api/crypto_dot_com_api.cc +++ b/browser/extensions/api/crypto_dot_com_api.cc @@ -46,7 +46,7 @@ CryptoDotComGetTickerInfoFunction::Run() { } std::unique_ptr params( - crypto_dot_com::GetTickerInfo::Params::Create(*args_)); + crypto_dot_com::GetTickerInfo::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); auto* service = GetCryptoDotComService(browser_context()); @@ -81,7 +81,7 @@ CryptoDotComGetChartDataFunction::Run() { } std::unique_ptr params( - crypto_dot_com::GetChartData::Params::Create(*args_)); + crypto_dot_com::GetChartData::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); auto* service = GetCryptoDotComService(browser_context()); diff --git a/browser/extensions/api/ftx_api.cc b/browser/extensions/api/ftx_api.cc index dedd3e4deb38..b0dab77ca121 100644 --- a/browser/extensions/api/ftx_api.cc +++ b/browser/extensions/api/ftx_api.cc @@ -73,7 +73,7 @@ ExtensionFunction::ResponseAction FtxGetChartDataFunction::Run() { } std::unique_ptr params( - ftx::GetChartData::Params::Create(*args_)); + ftx::GetChartData::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); bool data_request = service->GetChartData( @@ -108,7 +108,7 @@ ExtensionFunction::ResponseAction FtxSetOauthHostFunction::Run() { } std::unique_ptr params( - ftx::SetOauthHost::Params::Create(*args_)); + ftx::SetOauthHost::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); if (params->host != "ftx.us" && params->host != "ftx.com") { @@ -197,7 +197,7 @@ ExtensionFunction::ResponseAction FtxGetConvertQuoteFunction::Run() { } std::unique_ptr params( - ftx::GetConvertQuote::Params::Create(*args_)); + ftx::GetConvertQuote::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); bool data_request = service->GetConvertQuote( @@ -222,7 +222,7 @@ ExtensionFunction::ResponseAction FtxGetConvertQuoteInfoFunction::Run() { } std::unique_ptr params( - ftx::GetConvertQuoteInfo::Params::Create(*args_)); + ftx::GetConvertQuoteInfo::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); bool data_request = service->GetConvertQuoteInfo( @@ -254,7 +254,7 @@ ExtensionFunction::ResponseAction FtxExecuteConvertQuoteFunction::Run() { } std::unique_ptr params( - ftx::ExecuteConvertQuote::Params::Create(*args_)); + ftx::ExecuteConvertQuote::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); bool data_request = service->ExecuteConvertQuote( diff --git a/browser/extensions/api/gemini_api.cc b/browser/extensions/api/gemini_api.cc index 9e721fc72d3f..5d56b7989418 100644 --- a/browser/extensions/api/gemini_api.cc +++ b/browser/extensions/api/gemini_api.cc @@ -80,7 +80,7 @@ void GeminiRefreshAccessTokenFunction::OnRefreshResult(bool success) { ExtensionFunction::ResponseAction GeminiGetTickerPriceFunction::Run() { std::unique_ptr params( - gemini::GetTickerPrice::Params::Create(*args_)); + gemini::GetTickerPrice::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); auto* service = GetGeminiService(browser_context()); @@ -132,7 +132,7 @@ void GeminiGetAccountBalancesFunction::OnGetAccountBalances( ExtensionFunction::ResponseAction GeminiGetDepositInfoFunction::Run() { std::unique_ptr params( - gemini::GetDepositInfo::Params::Create(*args_)); + gemini::GetDepositInfo::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); auto* service = GetGeminiService(browser_context()); @@ -174,7 +174,7 @@ void GeminiRevokeTokenFunction::OnRevokeToken(bool success) { ExtensionFunction::ResponseAction GeminiGetOrderQuoteFunction::Run() { std::unique_ptr params( - gemini::GetOrderQuote::Params::Create(*args_)); + gemini::GetOrderQuote::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); auto* service = GetGeminiService(browser_context()); @@ -207,7 +207,7 @@ void GeminiGetOrderQuoteFunction::OnOrderQuoteResult( ExtensionFunction::ResponseAction GeminiExecuteOrderFunction::Run() { std::unique_ptr params( - gemini::ExecuteOrder::Params::Create(*args_)); + gemini::ExecuteOrder::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); auto* service = GetGeminiService(browser_context()); diff --git a/browser/extensions/api/greaselion_api.cc b/browser/extensions/api/greaselion_api.cc index 497d9a5387b3..22a9e6cec021 100644 --- a/browser/extensions/api/greaselion_api.cc +++ b/browser/extensions/api/greaselion_api.cc @@ -26,7 +26,7 @@ GreaselionIsGreaselionExtensionFunction::Run() { } std::unique_ptr params( - greaselion::IsGreaselionExtension::Params::Create(*args_)); + greaselion::IsGreaselionExtension::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); bool result = greaselion_service->IsGreaselionExtension(params->id); diff --git a/browser/extensions/api/ipfs_api.cc b/browser/extensions/api/ipfs_api.cc index afec3f60d958..fca2f9da044d 100644 --- a/browser/extensions/api/ipfs_api.cc +++ b/browser/extensions/api/ipfs_api.cc @@ -97,7 +97,7 @@ ExtensionFunction::ResponseAction IpfsRemoveIpfsPeerFunction::Run() { return RespondNow(Error("Could not obtain IPFS service")); } std::unique_ptr params( - ipfs::RemoveIpfsPeer::Params::Create(*args_)); + ipfs::RemoveIpfsPeer::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); ipfs_service->GetConfig( base::BindOnce(&IpfsRemoveIpfsPeerFunction::OnConfigLoaded, @@ -143,7 +143,7 @@ ExtensionFunction::ResponseAction IpfsAddIpfsPeerFunction::Run() { return RespondNow(Error("Could not obtain IPFS service")); } std::unique_ptr params( - ipfs::AddIpfsPeer::Params::Create(*args_)); + ipfs::AddIpfsPeer::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); ipfs_service->GetConfig( base::BindOnce(&IpfsAddIpfsPeerFunction::OnConfigLoaded, @@ -218,7 +218,7 @@ ExtensionFunction::ResponseAction IpfsRemoveIpnsKeyFunction::Run() { return RespondNow(Error("IPFS node is not launched")); } std::unique_ptr params( - ipfs::RemoveIpnsKey::Params::Create(*args_)); + ipfs::RemoveIpnsKey::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); key_manager->RemoveKey( params->name, base::BindOnce(&IpfsRemoveIpnsKeyFunction::OnKeyRemoved, @@ -244,7 +244,7 @@ ExtensionFunction::ResponseAction IpfsRotateKeyFunction::Run() { return RespondNow(Error("Could not obtain IPFS service")); } std::unique_ptr params( - ipfs::RotateKey::Params::Create(*args_)); + ipfs::RotateKey::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); ipfs_service->RotateKey(params->name, base::BindOnce(&IpfsRotateKeyFunction::OnKeyRotated, @@ -268,7 +268,7 @@ ExtensionFunction::ResponseAction IpfsAddIpnsKeyFunction::Run() { return RespondNow(Error("IPFS node is not launched")); } std::unique_ptr params( - ipfs::AddIpnsKey::Params::Create(*args_)); + ipfs::AddIpnsKey::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); key_manager->GenerateNewKey( params->name, base::BindOnce(&IpfsAddIpnsKeyFunction::OnKeyCreated, @@ -432,7 +432,7 @@ ExtensionFunction::ResponseAction IpfsResolveIPFSURIFunction::Run() { } std::unique_ptr params( - ipfs::ResolveIPFSURI::Params::Create(*args_)); + ipfs::ResolveIPFSURI::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); GURL uri(params->uri); GURL ipfs_gateway_url; @@ -454,7 +454,7 @@ ExtensionFunction::ResponseAction IpfsValidateGatewayUrlFunction::Run() { return RespondNow(Error("Could not obtain IPFS service")); } std::unique_ptr params( - ipfs::ValidateGatewayUrl::Params::Create(*args_)); + ipfs::ValidateGatewayUrl::Params::Create(args())); EXTENSION_FUNCTION_VALIDATE(params.get()); ipfs_service->ValidateGateway( diff --git a/browser/extensions/api/rewards_notifications_api.cc b/browser/extensions/api/rewards_notifications_api.cc index 4e3f4a0d84d9..c07ea90c561c 100644 --- a/browser/extensions/api/rewards_notifications_api.cc +++ b/browser/extensions/api/rewards_notifications_api.cc @@ -26,7 +26,7 @@ RewardsNotificationsAddNotificationFunction:: ExtensionFunction::ResponseAction RewardsNotificationsAddNotificationFunction::Run() { std::unique_ptr params( - rewards_notifications::AddNotification::Params::Create(*args_)); + rewards_notifications::AddNotification::Params::Create(args())); Profile* profile = Profile::FromBrowserContext(browser_context()); RewardsNotificationService* rewards_notification_service = RewardsServiceFactory::GetForProfile(profile)->GetNotificationService(); @@ -45,7 +45,7 @@ RewardsNotificationsDeleteNotificationFunction:: ExtensionFunction::ResponseAction RewardsNotificationsDeleteNotificationFunction::Run() { std::unique_ptr params( - rewards_notifications::DeleteNotification::Params::Create(*args_)); + rewards_notifications::DeleteNotification::Params::Create(args())); Profile* profile = Profile::FromBrowserContext(browser_context()); RewardsNotificationService* rewards_notification_service = RewardsServiceFactory::GetForProfile(profile)->GetNotificationService(); @@ -77,7 +77,7 @@ RewardsNotificationsGetNotificationFunction:: ExtensionFunction::ResponseAction RewardsNotificationsGetNotificationFunction::Run() { std::unique_ptr params( - rewards_notifications::GetNotification::Params::Create(*args_)); + rewards_notifications::GetNotification::Params::Create(args())); Profile* profile = Profile::FromBrowserContext(browser_context()); RewardsNotificationService* rewards_notification_service = RewardsServiceFactory::GetForProfile(profile)->GetNotificationService(); diff --git a/browser/extensions/brave_extension_provider_browsertest.cc b/browser/extensions/brave_extension_provider_browsertest.cc index e05d14a94a0b..3ebb2ff567a2 100644 --- a/browser/extensions/brave_extension_provider_browsertest.cc +++ b/browser/extensions/brave_extension_provider_browsertest.cc @@ -57,7 +57,7 @@ IN_PROC_BROWSER_TEST_F(BraveExtensionProviderTest, GURL url = GURL(std::string(kChromeExtensionScheme) + "://" + extension->id() + "/blocking.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(content::WaitForLoadStop(contents)); @@ -83,7 +83,7 @@ IN_PROC_BROWSER_TEST_F(BraveExtensionProviderTest, ExtensionsCanGetCookies) { GURL url = GURL(std::string(kChromeExtensionScheme) + "://" + extension->id() + "/blocking.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(content::WaitForLoadStop(contents)); @@ -107,7 +107,7 @@ IN_PROC_BROWSER_TEST_F(BraveExtensionProviderTest, ExtensionsCanSetCookies) { GURL url = GURL(std::string(kChromeExtensionScheme) + "://" + extension->id() + "/blocking.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(content::WaitForLoadStop(contents)); diff --git a/browser/farbling/brave_dark_mode_fingerprint_protection_browsertest.cc b/browser/farbling/brave_dark_mode_fingerprint_protection_browsertest.cc index 4e0949cc03ed..0eb3776f2559 100644 --- a/browser/farbling/brave_dark_mode_fingerprint_protection_browsertest.cc +++ b/browser/farbling/brave_dark_mode_fingerprint_protection_browsertest.cc @@ -97,7 +97,7 @@ class BraveDarkModeFingerprintProtectionTest : public InProcessBrowserTest { } void NavigateToURLUntilLoadStop(const GURL& url) { - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); ASSERT_TRUE(WaitForLoadStop(contents())); } diff --git a/browser/farbling/brave_enumeratedevices_farbling_browsertest.cc b/browser/farbling/brave_enumeratedevices_farbling_browsertest.cc index d01da8420ed2..97a4be477fc2 100644 --- a/browser/farbling/brave_enumeratedevices_farbling_browsertest.cc +++ b/browser/farbling/brave_enumeratedevices_farbling_browsertest.cc @@ -26,6 +26,7 @@ #include "content/public/test/browser_test.h" #include "content/public/test/browser_test_utils.h" #include "net/dns/mock_host_resolver.h" +#include "url/gurl.h" using brave_shields::ControlType; @@ -126,7 +127,7 @@ class BraveEnumerateDevicesFarblingBrowserTest : public InProcessBrowserTest { } bool NavigateToURLUntilLoadStop(const GURL& url) { - ui_test_utils::NavigateToURL(browser(), url); + EXPECT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); return WaitForLoadStop(contents()); } diff --git a/browser/farbling/brave_navigator_devicememory_farbling_browsertest.cc b/browser/farbling/brave_navigator_devicememory_farbling_browsertest.cc index 47f3f97d3eaf..b6702c16c787 100644 --- a/browser/farbling/brave_navigator_devicememory_farbling_browsertest.cc +++ b/browser/farbling/brave_navigator_devicememory_farbling_browsertest.cc @@ -104,7 +104,7 @@ class BraveDeviceMemoryFarblingBrowserTest : public InProcessBrowserTest { } bool NavigateToURLUntilLoadStop(const GURL& url) { - ui_test_utils::NavigateToURL(browser(), url); + EXPECT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); return WaitForLoadStop(contents()); } diff --git a/browser/farbling/brave_navigator_hardwareconcurrency_farbling_browsertest.cc b/browser/farbling/brave_navigator_hardwareconcurrency_farbling_browsertest.cc index 4ab0e0538326..a405da226b47 100644 --- a/browser/farbling/brave_navigator_hardwareconcurrency_farbling_browsertest.cc +++ b/browser/farbling/brave_navigator_hardwareconcurrency_farbling_browsertest.cc @@ -103,7 +103,7 @@ class BraveNavigatorHardwareConcurrencyFarblingBrowserTest } bool NavigateToURLUntilLoadStop(const GURL& url) { - ui_test_utils::NavigateToURL(browser(), url); + EXPECT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); return WaitForLoadStop(contents()); } diff --git a/browser/farbling/brave_navigator_plugins_farbling_browsertest.cc b/browser/farbling/brave_navigator_plugins_farbling_browsertest.cc index 649abfd11f49..892c7dcbb789 100644 --- a/browser/farbling/brave_navigator_plugins_farbling_browsertest.cc +++ b/browser/farbling/brave_navigator_plugins_farbling_browsertest.cc @@ -99,7 +99,7 @@ class BraveNavigatorPluginsFarblingBrowserTest : public InProcessBrowserTest { } bool NavigateToURLUntilLoadStop(const GURL& url) { - ui_test_utils::NavigateToURL(browser(), url); + EXPECT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); return WaitForLoadStop(contents()); } diff --git a/browser/farbling/brave_navigator_useragent_farbling_browsertest.cc b/browser/farbling/brave_navigator_useragent_farbling_browsertest.cc index bfb8b86b3bfe..af5dd683760c 100644 --- a/browser/farbling/brave_navigator_useragent_farbling_browsertest.cc +++ b/browser/farbling/brave_navigator_useragent_farbling_browsertest.cc @@ -103,7 +103,7 @@ class BraveNavigatorUserAgentFarblingBrowserTest : public InProcessBrowserTest { } bool NavigateToURLUntilLoadStop(const GURL& url) { - ui_test_utils::NavigateToURL(browser(), url); + EXPECT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); return WaitForLoadStop(contents()); } diff --git a/browser/farbling/brave_offscreencanvas_farbling_browsertest.cc b/browser/farbling/brave_offscreencanvas_farbling_browsertest.cc index 892f132bc89b..2560d2de5997 100644 --- a/browser/farbling/brave_offscreencanvas_farbling_browsertest.cc +++ b/browser/farbling/brave_offscreencanvas_farbling_browsertest.cc @@ -93,7 +93,7 @@ class BraveOffscreenCanvasFarblingBrowserTest : public InProcessBrowserTest { } bool NavigateToURLUntilLoadStop(const GURL& url) { - ui_test_utils::NavigateToURL(browser(), url); + EXPECT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); return WaitForLoadStop(contents()); } diff --git a/browser/farbling/brave_webaudio_farbling_browsertest.cc b/browser/farbling/brave_webaudio_farbling_browsertest.cc index 3b15021523c2..f13be578c1fd 100644 --- a/browser/farbling/brave_webaudio_farbling_browsertest.cc +++ b/browser/farbling/brave_webaudio_farbling_browsertest.cc @@ -97,7 +97,7 @@ class BraveWebAudioFarblingBrowserTest : public InProcessBrowserTest { } bool NavigateToURLUntilLoadStop(const GURL& url) { - ui_test_utils::NavigateToURL(browser(), url); + EXPECT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); return WaitForLoadStop(contents()); } diff --git a/browser/farbling/brave_webgl_farbling_browsertest.cc b/browser/farbling/brave_webgl_farbling_browsertest.cc index b6a8c8611107..6f8121d8a1b0 100644 --- a/browser/farbling/brave_webgl_farbling_browsertest.cc +++ b/browser/farbling/brave_webgl_farbling_browsertest.cc @@ -85,7 +85,7 @@ class BraveWebGLFarblingBrowserTest : public InProcessBrowserTest { } bool NavigateToURLUntilLoadStop(const GURL& url) { - ui_test_utils::NavigateToURL(browser(), url); + EXPECT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); return WaitForLoadStop(contents()); } diff --git a/browser/greaselion/greaselion_browsertest.cc b/browser/greaselion/greaselion_browsertest.cc index d9e1016af7f6..b8e4e44213b4 100644 --- a/browser/greaselion/greaselion_browsertest.cc +++ b/browser/greaselion/greaselion_browsertest.cc @@ -234,7 +234,7 @@ IN_PROC_BROWSER_TEST_F(GreaselionServiceTest, ClearCache) { IN_PROC_BROWSER_TEST_F(GreaselionServiceTest, ScriptInjection) { ASSERT_TRUE(InstallMockExtension()); GURL url = embedded_test_server()->GetURL("www.a.com", "/simple.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(content::WaitForLoadStop(contents)); @@ -251,7 +251,7 @@ IN_PROC_BROWSER_TEST_F(GreaselionServiceTest, ScriptInjection) { IN_PROC_BROWSER_TEST_F(GreaselionServiceTest, ScriptInjectionDocumentStart) { ASSERT_TRUE(InstallMockExtension()); GURL url = embedded_test_server()->GetURL("runat1.b.com", "/intercept.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(content::WaitForLoadStop(contents)); @@ -268,7 +268,7 @@ IN_PROC_BROWSER_TEST_F(GreaselionServiceTest, ScriptInjectionDocumentStart) { IN_PROC_BROWSER_TEST_F(GreaselionServiceTest, ScriptInjectionDocumentEnd) { ASSERT_TRUE(InstallMockExtension()); GURL url = embedded_test_server()->GetURL("runat2.b.com", "/intercept.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(content::WaitForLoadStop(contents)); @@ -285,7 +285,7 @@ IN_PROC_BROWSER_TEST_F(GreaselionServiceTest, ScriptInjectionDocumentEnd) { IN_PROC_BROWSER_TEST_F(GreaselionServiceTest, ScriptInjectionRunAtDefault) { ASSERT_TRUE(InstallMockExtension()); GURL url = embedded_test_server()->GetURL("runat3.b.com", "/intercept.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(content::WaitForLoadStop(contents)); @@ -304,7 +304,7 @@ IN_PROC_BROWSER_TEST_F(GreaselionServiceTest, ASSERT_TRUE(InstallMockExtension()); GURL url = embedded_test_server()->GetURL("pre1.example.com", "/simple.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(content::WaitForLoadStop(contents)); @@ -327,7 +327,7 @@ IN_PROC_BROWSER_TEST_F(GreaselionServiceTest, ScriptInjectionWithPrecondition) { ASSERT_TRUE(InstallMockExtension()); GURL url = embedded_test_server()->GetURL("pre1.example.com", "/simple.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(content::WaitForLoadStop(contents)); @@ -373,7 +373,7 @@ IN_PROC_BROWSER_TEST_F(GreaselionServiceTest, GURL url = embedded_test_server()->GetURL( "version-low-wild.example.com", "/simple.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(content::WaitForLoadStop(contents)); @@ -394,7 +394,7 @@ IN_PROC_BROWSER_TEST_F(GreaselionServiceTest, GURL url = embedded_test_server()->GetURL( "version-low-format.example.com", "/simple.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(content::WaitForLoadStop(contents)); @@ -416,7 +416,7 @@ IN_PROC_BROWSER_TEST_F(GreaselionServiceTest, GURL url = embedded_test_server()->GetURL( "version-match-wild.example.com", "/simple.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(content::WaitForLoadStop(contents)); @@ -437,7 +437,7 @@ IN_PROC_BROWSER_TEST_F(GreaselionServiceTest, GURL url = embedded_test_server()->GetURL( "version-match-exact.example.com", "/simple.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(content::WaitForLoadStop(contents)); @@ -458,7 +458,7 @@ IN_PROC_BROWSER_TEST_F(GreaselionServiceTest, GURL url = embedded_test_server()->GetURL( "version-high-wild.example.com", "/simple.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(content::WaitForLoadStop(contents)); @@ -479,7 +479,7 @@ IN_PROC_BROWSER_TEST_F(GreaselionServiceTest, GURL url = embedded_test_server()->GetURL( "version-high-exact.example.com", "/simple.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(content::WaitForLoadStop(contents)); @@ -500,7 +500,7 @@ IN_PROC_BROWSER_TEST_F(GreaselionServiceTest, GURL url = embedded_test_server()->GetURL( "version-empty.example.com", "/simple.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(content::WaitForLoadStop(contents)); @@ -521,7 +521,7 @@ IN_PROC_BROWSER_TEST_F(GreaselionServiceTest, GURL url = embedded_test_server()->GetURL( "version-bad-format.example.com", "/simple.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(content::WaitForLoadStop(contents)); @@ -540,7 +540,7 @@ IN_PROC_BROWSER_TEST_F(GreaselionServiceTest, CleanShutdown) { ASSERT_TRUE(InstallMockExtension()); GURL url = embedded_test_server()->GetURL("www.a.com", "/simple.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); EXPECT_EQ(url, contents->GetURL()); @@ -563,7 +563,7 @@ IN_PROC_BROWSER_TEST_F(GreaselionServiceLocaleTestEnglish, const GURL url = embedded_test_server()->GetURL("messages.example.com", "/simple.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(content::WaitForLoadStop(contents)); @@ -587,7 +587,7 @@ IN_PROC_BROWSER_TEST_F(GreaselionServiceLocaleTestGerman, const GURL url = embedded_test_server()->GetURL("messages.example.com", "/simple.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(content::WaitForLoadStop(contents)); @@ -611,7 +611,7 @@ IN_PROC_BROWSER_TEST_F(GreaselionServiceLocaleTestFrench, const GURL url = embedded_test_server()->GetURL("messages.example.com", "/simple.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(content::WaitForLoadStop(contents)); diff --git a/browser/ipfs/import/save_package_observer_browsertest.cc b/browser/ipfs/import/save_package_observer_browsertest.cc index 295666f59786..6ac3faae8f3f 100644 --- a/browser/ipfs/import/save_package_observer_browsertest.cc +++ b/browser/ipfs/import/save_package_observer_browsertest.cc @@ -63,7 +63,7 @@ class FakePackageDownloadItem : public content::FakeDownloadItem { IN_PROC_BROWSER_TEST_F(SavePackageFinishedObserverBrowserTest, Success) { GURL url = embedded_test_server()->GetURL("/save_page/brave-text-content.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); auto* download_manager = web_contents()->GetBrowserContext()->GetDownloadManager(); { diff --git a/browser/ipfs/ipfs_tab_helper_browsertest.cc b/browser/ipfs/ipfs_tab_helper_browsertest.cc index fff0473a5538..5df0efab2349 100644 --- a/browser/ipfs/ipfs_tab_helper_browsertest.cc +++ b/browser/ipfs/ipfs_tab_helper_browsertest.cc @@ -119,14 +119,14 @@ IN_PROC_BROWSER_TEST_F(IpfsTabHelperBrowserTest, ResolvedIPFSLinkLocal) { SetXIpfsPathHeader("/ipfs/bafybeiemx/empty.html"); GURL test_url = https_server_.GetURL("/empty.html?query#ref"); - ui_test_utils::NavigateToURL(browser(), test_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), test_url)); ASSERT_TRUE(WaitForLoadStop(active_contents())); ASSERT_FALSE(resolver_raw->resolve_called()); std::string result = "ipfs://bafybeiemx/empty.html?query#ref"; EXPECT_EQ(helper->GetIPFSResolvedURL().spec(), result); test_url = https_server_.GetURL("/another.html?query#ref"); - ui_test_utils::NavigateToURL(browser(), test_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), test_url)); ASSERT_TRUE(WaitForLoadStop(active_contents())); ASSERT_FALSE(resolver_raw->resolve_called()); result = "ipfs://bafybeiemx/another.html?query#ref"; @@ -134,7 +134,7 @@ IN_PROC_BROWSER_TEST_F(IpfsTabHelperBrowserTest, ResolvedIPFSLinkLocal) { SetXIpfsPathHeader("/ipns/brave.eth/empty.html"); test_url = https_server_.GetURL("/?query#ref"); - ui_test_utils::NavigateToURL(browser(), test_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), test_url)); ASSERT_TRUE(WaitForLoadStop(active_contents())); ASSERT_FALSE(resolver_raw->resolve_called()); result = "ipns://brave.eth/?query#ref"; @@ -143,7 +143,7 @@ IN_PROC_BROWSER_TEST_F(IpfsTabHelperBrowserTest, ResolvedIPFSLinkLocal) { SetXIpfsPathHeader("/ipfs/bafy"); test_url = embedded_test_server()->GetURL( "a.com", "/ipfs/bafy/wiki/empty.html?query#ref"); - ui_test_utils::NavigateToURL(browser(), test_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), test_url)); ASSERT_TRUE(WaitForLoadStop(active_contents())); ASSERT_FALSE(resolver_raw->resolve_called()); result = "ipfs://bafy/wiki/empty.html?query#ref"; @@ -152,7 +152,7 @@ IN_PROC_BROWSER_TEST_F(IpfsTabHelperBrowserTest, ResolvedIPFSLinkLocal) { SetXIpfsPathHeader("/ipns/bafyb"); test_url = embedded_test_server()->GetURL( "a.com", "/ipns/bafyb/wiki/empty.html?query#ref"); - ui_test_utils::NavigateToURL(browser(), test_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), test_url)); ASSERT_TRUE(WaitForLoadStop(active_contents())); ASSERT_FALSE(resolver_raw->resolve_called()); result = "ipns://bafyb/wiki/empty.html?query#ref"; @@ -179,7 +179,7 @@ IN_PROC_BROWSER_TEST_F(IpfsTabHelperBrowserTest, ResolvedIPFSLinkGateway) { static_cast(ipfs::IPFSResolveMethodTypes::IPFS_GATEWAY)); SetXIpfsPathHeader("/ipfs/bafybeiemx/empty.html"); const GURL test_url = https_server_.GetURL("/empty.html"); - ui_test_utils::NavigateToURL(browser(), test_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), test_url)); ASSERT_TRUE(WaitForLoadStop(active_contents())); ASSERT_FALSE(resolver_raw->resolve_called()); GURL ipns = ReplaceScheme(test_url, ipfs::kIPNSScheme); @@ -206,7 +206,7 @@ IN_PROC_BROWSER_TEST_F(IpfsTabHelperBrowserTest, NoResolveIPFSLinkCalledMode) { static_cast(ipfs::IPFSResolveMethodTypes::IPFS_ASK)); SetXIpfsPathHeader("/ipfs/bafybeiemx/empty.html"); GURL test_url = https_server_.GetURL("/empty.html"); - ui_test_utils::NavigateToURL(browser(), test_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), test_url)); ASSERT_TRUE(WaitForLoadStop(active_contents())); ASSERT_FALSE(resolver_raw->resolve_called()); EXPECT_EQ(helper->GetIPFSResolvedURL().spec(), std::string()); @@ -215,7 +215,7 @@ IN_PROC_BROWSER_TEST_F(IpfsTabHelperBrowserTest, NoResolveIPFSLinkCalledMode) { kIPFSResolveMethod, static_cast(ipfs::IPFSResolveMethodTypes::IPFS_DISABLED)); - ui_test_utils::NavigateToURL(browser(), test_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), test_url)); ASSERT_TRUE(WaitForLoadStop(active_contents())); ASSERT_FALSE(resolver_raw->resolve_called()); EXPECT_EQ(helper->GetIPFSResolvedURL().spec(), std::string()); @@ -241,7 +241,7 @@ IN_PROC_BROWSER_TEST_F(IpfsTabHelperBrowserTest, static_cast(ipfs::IPFSResolveMethodTypes::IPFS_LOCAL)); GURL test_url = embedded_test_server()->GetURL("/empty.html"); - ui_test_utils::NavigateToURL(browser(), test_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), test_url)); ASSERT_TRUE(WaitForLoadStop(active_contents())); ASSERT_FALSE(resolver_raw->resolve_called()); EXPECT_EQ(helper->GetIPFSResolvedURL().spec(), std::string()); @@ -270,7 +270,7 @@ IN_PROC_BROWSER_TEST_F(IpfsTabHelperBrowserTest, ResolveIPFSLinkCalled5xx) { ASSERT_FALSE(resolver_raw->resolve_called()); SetHttpStatusCode(net::HTTP_INTERNAL_SERVER_ERROR); const GURL test_url = https_server_.GetURL("/5xx.html?query#fragment"); - ui_test_utils::NavigateToURL(browser(), test_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), test_url)); ASSERT_FALSE(WaitForLoadStop(active_contents())); ASSERT_TRUE(resolver_raw->resolve_called()); GURL ipns = ReplaceScheme(test_url, ipfs::kIPNSScheme); @@ -298,7 +298,7 @@ IN_PROC_BROWSER_TEST_F(IpfsTabHelperBrowserTest, ResolveNotCalled5xx) { EXPECT_EQ(helper->GetIPFSResolvedURL().spec(), std::string()); ASSERT_FALSE(resolver_raw->resolve_called()); const GURL test_url = https_server_.GetURL("/5xx.html"); - ui_test_utils::NavigateToURL(browser(), test_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), test_url)); ASSERT_FALSE(WaitForLoadStop(active_contents())); ASSERT_FALSE(resolver_raw->resolve_called()); EXPECT_EQ(helper->GetIPFSResolvedURL().spec(), std::string()); @@ -324,7 +324,7 @@ IN_PROC_BROWSER_TEST_F(IpfsTabHelperBrowserTest, ResolvedIPFSLinkBad) { SetXIpfsPathHeader("/http/bafybeiemx/empty.html"); const GURL test_url = https_server_.GetURL("/empty.html"); - ui_test_utils::NavigateToURL(browser(), test_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), test_url)); ASSERT_TRUE(WaitForLoadStop(active_contents())); ASSERT_FALSE(resolver_raw->resolve_called()); std::string result = ""; diff --git a/browser/ipfs/test/ipfs_navigation_throttle_browsertest.cc b/browser/ipfs/test/ipfs_navigation_throttle_browsertest.cc index 2586f313ebf6..ee11872a342c 100644 --- a/browser/ipfs/test/ipfs_navigation_throttle_browsertest.cc +++ b/browser/ipfs/test/ipfs_navigation_throttle_browsertest.cc @@ -175,7 +175,7 @@ IN_PROC_BROWSER_TEST_F(IpfsNavigationThrottleBrowserTest, // Navigate to IPFS URL and check if we'll show the interstitial when there // are no connected peers. - ui_test_utils::NavigateToURL(browser(), ipfs_url()); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), ipfs_url())); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -193,7 +193,7 @@ IN_PROC_BROWSER_TEST_F(IpfsNavigationThrottleBrowserTest, // Navigate to that URL again and see if we auto fallback to gateway this // time without interstitials. - ui_test_utils::NavigateToURL(browser(), ipfs_url()); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), ipfs_url())); web_contents = browser()->tab_strip_model()->GetActiveWebContents(); EXPECT_TRUE(WaitForRenderFrameReady(web_contents->GetMainFrame())); EXPECT_EQ(nullptr, GetInterstitialType(web_contents)); @@ -210,7 +210,7 @@ IN_PROC_BROWSER_TEST_F(IpfsNavigationThrottleBrowserTest, GetPrefs()->SetInteger(kIPFSResolveMethod, static_cast(IPFSResolveMethodTypes::IPFS_LOCAL)); - ui_test_utils::NavigateToURL(browser(), ipfs_url()); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), ipfs_url())); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); diff --git a/browser/ipfs/test/ipfs_not_connected_page_browsertest.cc b/browser/ipfs/test/ipfs_not_connected_page_browsertest.cc index a5b684fc912d..74134958d3fa 100644 --- a/browser/ipfs/test/ipfs_not_connected_page_browsertest.cc +++ b/browser/ipfs/test/ipfs_not_connected_page_browsertest.cc @@ -140,7 +140,7 @@ IN_PROC_BROWSER_TEST_F(IpfsNotConnectedPageBrowserTest, // Navigate to IPFS URL and check if we'll show the interstitial when there // are no connected peers. - ui_test_utils::NavigateToURL(browser(), ipfs_url()); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), ipfs_url())); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -156,7 +156,7 @@ IN_PROC_BROWSER_TEST_F(IpfsNotConnectedPageBrowserTest, // Navigate to that URL again and see if we auto fallback to gateway this // time without interstitials. - ui_test_utils::NavigateToURL(browser(), ipfs_url()); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), ipfs_url())); web_contents = browser()->tab_strip_model()->GetActiveWebContents(); EXPECT_TRUE(WaitForRenderFrameReady(web_contents->GetMainFrame())); EXPECT_EQ(nullptr, GetInterstitialType(web_contents)); diff --git a/browser/ipfs/test/ipfs_onboarding_page_browsertest.cc b/browser/ipfs/test/ipfs_onboarding_page_browsertest.cc index 737f43f25103..24a394ae6ccb 100644 --- a/browser/ipfs/test/ipfs_onboarding_page_browsertest.cc +++ b/browser/ipfs/test/ipfs_onboarding_page_browsertest.cc @@ -167,7 +167,7 @@ IN_PROC_BROWSER_TEST_F(IpfsOnboardingPageBrowserTest, ShowAndUseLocalNode) { // Navigate to IPFS URL and check if we'll show the interstitial when there // are no connected peers. - ui_test_utils::NavigateToURL(browser(), ipfs_url()); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), ipfs_url())); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -185,7 +185,7 @@ IN_PROC_BROWSER_TEST_F(IpfsOnboardingPageBrowserTest, ShowAndUseLocalNode) { // Navigate to that URL again and see if we auto fallback to gateway this // time without interstitials. - ui_test_utils::NavigateToURL(browser(), ipfs_url()); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), ipfs_url())); web_contents = browser()->tab_strip_model()->GetActiveWebContents(); EXPECT_TRUE(WaitForRenderFrameReady(web_contents->GetMainFrame())); EXPECT_EQ(nullptr, GetInterstitialType(web_contents)); @@ -202,7 +202,7 @@ IN_PROC_BROWSER_TEST_F(IpfsOnboardingPageBrowserTest, ShowAndUseGateway) { // Navigate to IPFS URL and check if we'll show the interstitial when there // are no connected peers. - ui_test_utils::NavigateToURL(browser(), ipfs_url()); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), ipfs_url())); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -219,7 +219,7 @@ IN_PROC_BROWSER_TEST_F(IpfsOnboardingPageBrowserTest, ShowAndUseGateway) { // Navigate to that URL again and see if we auto fallback to gateway this // time without interstitials. - ui_test_utils::NavigateToURL(browser(), ipfs_url()); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), ipfs_url())); web_contents = browser()->tab_strip_model()->GetActiveWebContents(); EXPECT_TRUE(WaitForRenderFrameReady(web_contents->GetMainFrame())); EXPECT_EQ(nullptr, GetInterstitialType(web_contents)); @@ -236,7 +236,7 @@ IN_PROC_BROWSER_TEST_F(IpfsOnboardingPageBrowserTest, LearnMore) { // Navigate to IPFS URL and check if we'll show the interstitial when there // are no connected peers. - ui_test_utils::NavigateToURL(browser(), ipfs_url()); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), ipfs_url())); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -265,7 +265,7 @@ IN_PROC_BROWSER_TEST_F(IpfsOnboardingPageBrowserTest, OpenSettings) { // Navigate to IPFS URL and check if we'll show the interstitial when there // are no connected peers. - ui_test_utils::NavigateToURL(browser(), ipfs_url()); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), ipfs_url())); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); diff --git a/browser/ipfs/test/ipfs_service_browsertest.cc b/browser/ipfs/test/ipfs_service_browsertest.cc index 1750809dc240..13752d8b30e7 100644 --- a/browser/ipfs/test/ipfs_service_browsertest.cc +++ b/browser/ipfs/test/ipfs_service_browsertest.cc @@ -765,7 +765,8 @@ IN_PROC_BROWSER_TEST_F(IpfsServiceBrowserTest, base::BindRepeating(&IpfsServiceBrowserTest::HandleEmbeddedSrvrRequest, base::Unretained(this))); SetIPFSDefaultGatewayForTest(GetURL("a.com", "/")); - ui_test_utils::NavigateToURL(browser(), GetURL("b.com", "/simple.html")); + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), GetURL("b.com", "/simple.html"))); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); auto error_caught = @@ -791,7 +792,7 @@ IN_PROC_BROWSER_TEST_F(IpfsServiceBrowserTest, CanFetchIPFSResourcesFromIPFS) { static_cast(ipfs::IPFSResolveMethodTypes::IPFS_GATEWAY)); GURL url("ipfs://Qmc2JTQo4iXf24g98otZmGFQq176eQ2Cdbb88qA5ToMEvC"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); auto got_fetch = @@ -815,7 +816,8 @@ IN_PROC_BROWSER_TEST_F(IpfsServiceBrowserTest, CannotLoadIframeFromHTTP) { base::BindRepeating(&IpfsServiceBrowserTest::HandleEmbeddedSrvrRequest, base::Unretained(this))); SetIPFSDefaultGatewayForTest(GetURL("b.com", "/")); - ui_test_utils::NavigateToURL(browser(), GetURL("b.com", "/iframe.html")); + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), GetURL("b.com", "/iframe.html"))); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -844,8 +846,9 @@ IN_PROC_BROWSER_TEST_F(IpfsServiceBrowserTest, CanLoadIFrameFromIPFS) { kIPFSResolveMethod, static_cast(ipfs::IPFSResolveMethodTypes::IPFS_GATEWAY)); - ui_test_utils::NavigateToURL( - browser(), GURL("ipfs://Qmc2JTQo4iXf24g98otZmGFQq176eQ2Cdbb88qA5ToMEvC")); + ASSERT_TRUE(ui_test_utils::NavigateToURL( + browser(), + GURL("ipfs://Qmc2JTQo4iXf24g98otZmGFQq176eQ2Cdbb88qA5ToMEvC"))); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); auto result = @@ -883,8 +886,9 @@ IN_PROC_BROWSER_TEST_F(IpfsServiceBrowserTest, CanLoadIPFSImageFromIPFS) { base::BindRepeating(&IpfsServiceBrowserTest::HandleEmbeddedSrvrRequest, base::Unretained(this))); SetIPFSDefaultGatewayForTest(GetURL("b.com", "/")); - ui_test_utils::NavigateToURL( - browser(), GURL("ipfs://Qmc2JTQo4iXf24g98otZmGFQq176eQ2Cdbb88qA5ToMEvC")); + ASSERT_TRUE(ui_test_utils::NavigateToURL( + browser(), + GURL("ipfs://Qmc2JTQo4iXf24g98otZmGFQq176eQ2Cdbb88qA5ToMEvC"))); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); auto loaded = EvalJs( @@ -909,7 +913,8 @@ IN_PROC_BROWSER_TEST_F(IpfsServiceBrowserTest, CannotLoadIPFSImageFromHTTP) { base::BindRepeating(&IpfsServiceBrowserTest::HandleEmbeddedSrvrRequest, base::Unretained(this))); SetIPFSDefaultGatewayForTest(GetURL("b.com", "/")); - ui_test_utils::NavigateToURL(browser(), GetURL("b.com", "/simple.html")); + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), GetURL("b.com", "/simple.html"))); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); auto loaded = EvalJs( @@ -935,7 +940,8 @@ IN_PROC_BROWSER_TEST_F(IpfsServiceBrowserTest, TopLevelAutoRedirectsOn) { browser()->profile()->GetPrefs()->SetBoolean(kIPFSAutoRedirectGateway, true); GURL gateway = GetURL("b.com", "/"); SetIPFSDefaultGatewayForTest(gateway); - ui_test_utils::NavigateToURL(browser(), GetURL("a.com", "/simple.html")); + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), GetURL("a.com", "/simple.html"))); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); EXPECT_EQ(contents->GetURL().host(), gateway.host()); @@ -947,7 +953,8 @@ IN_PROC_BROWSER_TEST_F(IpfsServiceBrowserTest, TopLevelAutoRedirectsOff) { base::Unretained(this))); SetIPFSDefaultGatewayForTest(GetURL("b.com", "/")); GURL other_gateway = GetURL("a.com", "/simple.html"); - ui_test_utils::NavigateToURL(browser(), GetURL("a.com", "/simple.html")); + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), GetURL("a.com", "/simple.html"))); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); EXPECT_EQ(contents->GetURL().host(), other_gateway.host()); diff --git a/browser/net/brave_network_delegate_browsertest.cc b/browser/net/brave_network_delegate_browsertest.cc index 5513c1cf8959..ab942521a015 100644 --- a/browser/net/brave_network_delegate_browsertest.cc +++ b/browser/net/brave_network_delegate_browsertest.cc @@ -178,7 +178,7 @@ class BraveNetworkDelegateBrowserTest : public InProcessBrowserTest { } void NavigateToPageWithFrame(const GURL url) { - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); } void ExpectCookiesOnHost(const GURL url, const std::string& expected) { @@ -239,7 +239,7 @@ class BraveNetworkDelegateBrowserTest : public InProcessBrowserTest { // It is important that cookies in following tests are set by response headers, // not by javascript. Fetching such cookies is controlled by NetworkDelegate. IN_PROC_BROWSER_TEST_F(BraveNetworkDelegateBrowserTest, Iframe3PCookieBlocked) { - ui_test_utils::NavigateToURL(browser(), url_); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url_)); const std::string cookie = content::GetCookies( browser()->profile(), https_server_.GetURL("c.com", "/")); EXPECT_TRUE(cookie.empty()) << "Actual cookie: " << cookie; @@ -247,7 +247,7 @@ IN_PROC_BROWSER_TEST_F(BraveNetworkDelegateBrowserTest, Iframe3PCookieBlocked) { IN_PROC_BROWSER_TEST_F(BraveNetworkDelegateBrowserTest, Iframe3PCookieAllowed) { AllowCookies(top_level_page_url_); - ui_test_utils::NavigateToURL(browser(), url_); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url_)); const std::string cookie = content::GetCookies( browser()->profile(), https_server_.GetURL("c.com", "/")); EXPECT_FALSE(cookie.empty()); @@ -255,7 +255,7 @@ IN_PROC_BROWSER_TEST_F(BraveNetworkDelegateBrowserTest, Iframe3PCookieAllowed) { IN_PROC_BROWSER_TEST_F(BraveNetworkDelegateBrowserTest, Iframe3PShieldsDown) { ShieldsDown(top_level_page_url_); - ui_test_utils::NavigateToURL(browser(), url_); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url_)); const std::string cookie = content::GetCookies(browser()->profile(), GURL("https://c.com/")); EXPECT_FALSE(cookie.empty()); @@ -265,13 +265,13 @@ IN_PROC_BROWSER_TEST_F(BraveNetworkDelegateBrowserTest, Iframe3PShieldsDownOverridesCookieBlock) { // create an explicit override BlockCookies(top_level_page_url_); - ui_test_utils::NavigateToURL(browser(), url_); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url_)); std::string cookie = content::GetCookies(browser()->profile(), GURL("https://c.com/")); EXPECT_TRUE(cookie.empty()) << "Actual cookie: " << cookie; ShieldsDown(top_level_page_url_); - ui_test_utils::NavigateToURL(browser(), url_); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url_)); cookie = content::GetCookies(browser()->profile(), GURL("https://c.com/")); EXPECT_FALSE(cookie.empty()); } @@ -279,7 +279,8 @@ IN_PROC_BROWSER_TEST_F(BraveNetworkDelegateBrowserTest, // Fetching not just a frame, but some other resource. IN_PROC_BROWSER_TEST_F(BraveNetworkDelegateBrowserTest, IframeJs3PCookieBlocked) { - ui_test_utils::NavigateToURL(browser(), nested_iframe_script_url_); + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), nested_iframe_script_url_)); const std::string cookie = content::GetCookies(browser()->profile(), GURL("https://c.com/")); EXPECT_TRUE(cookie.empty()) << "Actual cookie: " << cookie; @@ -288,7 +289,8 @@ IN_PROC_BROWSER_TEST_F(BraveNetworkDelegateBrowserTest, IN_PROC_BROWSER_TEST_F(BraveNetworkDelegateBrowserTest, IframeJs3PCookieAllowed) { AllowCookies(top_level_page_url_); - ui_test_utils::NavigateToURL(browser(), nested_iframe_script_url_); + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), nested_iframe_script_url_)); const std::string cookie = content::GetCookies(browser()->profile(), GURL("https://c.com/")); EXPECT_FALSE(cookie.empty()); @@ -296,7 +298,8 @@ IN_PROC_BROWSER_TEST_F(BraveNetworkDelegateBrowserTest, IN_PROC_BROWSER_TEST_F(BraveNetworkDelegateBrowserTest, DefaultCookiesBlocked) { DefaultBlockAllCookies(); - ui_test_utils::NavigateToURL(browser(), nested_iframe_script_url_); + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), nested_iframe_script_url_)); std::string cookie = content::GetCookies(browser()->profile(), GURL("https://c.com/")); EXPECT_TRUE(cookie.empty()) << "Actual cookie: " << cookie; @@ -309,7 +312,7 @@ IN_PROC_BROWSER_TEST_F(BraveNetworkDelegateBrowserTest, ThirdPartyCookiesBlockedNestedFirstPartyIframe) { DefaultBlockThirdPartyCookies(); - ui_test_utils::NavigateToURL(browser(), url_); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url_)); auto* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); diff --git a/browser/net/brave_network_delegate_hsts_fingerprinting_browsertest.cc b/browser/net/brave_network_delegate_hsts_fingerprinting_browsertest.cc index d25e9ec97eb0..d0830c1d8416 100644 --- a/browser/net/brave_network_delegate_hsts_fingerprinting_browsertest.cc +++ b/browser/net/brave_network_delegate_hsts_fingerprinting_browsertest.cc @@ -87,7 +87,7 @@ IN_PROC_BROWSER_TEST_F(BraveNetworkDelegateBaseBrowserTest, FirstPartySTS) { embedded_test_server()->GetURL("c.com", "/iframe_hsts.html"); RedirectObserver redirect_observer(active_contents()); - ui_test_utils::NavigateToURL(browser(), third_party); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), third_party)); EXPECT_TRUE(redirect_observer.has_sts_header(third_party)); } @@ -99,7 +99,7 @@ IN_PROC_BROWSER_TEST_F(BraveNetworkDelegateBaseBrowserTest, ThirdPartySTS) { embedded_test_server()->GetURL("a.com", "/hsts.html"); RedirectObserver redirect_observer(active_contents()); - ui_test_utils::NavigateToURL(browser(), first_party); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), first_party)); EXPECT_FALSE(redirect_observer.has_sts_header(third_party)); } diff --git a/browser/net/brave_service_key_network_delegate_helper_browsertest.cc b/browser/net/brave_service_key_network_delegate_helper_browsertest.cc index ff7bf2dc83ea..cfc3288cbb77 100644 --- a/browser/net/brave_service_key_network_delegate_helper_browsertest.cc +++ b/browser/net/brave_service_key_network_delegate_helper_browsertest.cc @@ -59,33 +59,33 @@ class BraveServiceKeyNetworkDelegateBrowserTest : public InProcessBrowserTest { IN_PROC_BROWSER_TEST_F(BraveServiceKeyNetworkDelegateBrowserTest, NotIncludesBraveServiceKey) { GURL target = https_server().GetURL("notbrave.com", "/index.html"); - ui_test_utils::NavigateToURL(browser(), target); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), target)); EXPECT_FALSE(header_result()); target = https_server().GetURL("brave.com", "/index.html"); - ui_test_utils::NavigateToURL(browser(), target); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), target)); EXPECT_FALSE(header_result()); target = https_server().GetURL("bravesoftware.com", "/index.html"); - ui_test_utils::NavigateToURL(browser(), target); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), target)); EXPECT_FALSE(header_result()); target = https_server().GetURL("brave.demo.com", "/index.html"); - ui_test_utils::NavigateToURL(browser(), target); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), target)); EXPECT_FALSE(header_result()); target = https_server().GetURL("demo.brave.com", "/index.html"); - ui_test_utils::NavigateToURL(browser(), target); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), target)); EXPECT_FALSE(header_result()); target = https_server().GetURL("randomdomain.com", "/index.html"); - ui_test_utils::NavigateToURL(browser(), target); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), target)); EXPECT_FALSE(header_result()); } IN_PROC_BROWSER_TEST_F(BraveServiceKeyNetworkDelegateBrowserTest, IncludesBraveServiceKey) { GURL target = https_server().GetURL(kExtensionUpdaterDomain, "/index.html"); - ui_test_utils::NavigateToURL(browser(), target); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), target)); EXPECT_TRUE(header_result()); } diff --git a/browser/net/brave_site_hacks_network_delegate_helper_browsertest.cc b/browser/net/brave_site_hacks_network_delegate_helper_browsertest.cc index f5776371ea70..db13a74ee084 100644 --- a/browser/net/brave_site_hacks_network_delegate_helper_browsertest.cc +++ b/browser/net/brave_site_hacks_network_delegate_helper_browsertest.cc @@ -105,7 +105,7 @@ class BraveSiteHacksNetworkDelegateBrowserTest : public InProcessBrowserTest { const GURL& landing_url) { ui_test_utils::UrlLoadObserver load_complete( landing_url, content::NotificationService::AllSources()); - ui_test_utils::NavigateToURL(browser(), original_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), original_url)); EXPECT_EQ(contents()->GetMainFrame()->GetLastCommittedURL(), original_url); load_complete.Wait(); @@ -252,7 +252,7 @@ IN_PROC_BROWSER_TEST_F(BraveSiteHacksNetworkDelegateBrowserTest, // Direct navigations go through the query filter. GURL input = landing_url(inputs[i], simple_landing_url()); GURL output = landing_url(outputs[i], simple_landing_url()); - ui_test_utils::NavigateToURL(browser(), input); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), input)); EXPECT_EQ(contents()->GetLastCommittedURL(), output); } } diff --git a/browser/net/global_privacy_control_network_delegate_helper_browsertest.cc b/browser/net/global_privacy_control_network_delegate_helper_browsertest.cc index c52acc1e255a..3bed13347136 100644 --- a/browser/net/global_privacy_control_network_delegate_helper_browsertest.cc +++ b/browser/net/global_privacy_control_network_delegate_helper_browsertest.cc @@ -79,7 +79,7 @@ class GlobalPrivacyControlNetworkDelegateBrowserTest IN_PROC_BROWSER_TEST_F(GlobalPrivacyControlNetworkDelegateBrowserTest, IncludesSecGPCHeader) { const GURL target = https_server().GetURL("example.com", "/index.html"); - ui_test_utils::NavigateToURL(browser(), target); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), target)); EXPECT_EQ(header_result(), GPCHeaderResult::kOk); } @@ -89,7 +89,7 @@ IN_PROC_BROWSER_TEST_F(GlobalPrivacyControlNetworkDelegateBrowserTest, IN_PROC_BROWSER_TEST_F(GlobalPrivacyControlNetworkDelegateBrowserTest, NavigatorGlobalPrivacyAPI) { const GURL target = https_server().GetURL("example.com", "/index.html"); - ui_test_utils::NavigateToURL(browser(), target); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), target)); auto* rfh = browser()->tab_strip_model()->GetActiveWebContents()->GetMainFrame(); diff --git a/browser/notifications/android/java/src/org/chromium/chrome/browser/notifications/BraveAdsNotificationBuilder.java b/browser/notifications/android/java/src/org/chromium/chrome/browser/notifications/BraveAdsNotificationBuilder.java index 5fd1f1a5bb31..920ed75b6de0 100644 --- a/browser/notifications/android/java/src/org/chromium/chrome/browser/notifications/BraveAdsNotificationBuilder.java +++ b/browser/notifications/android/java/src/org/chromium/chrome/browser/notifications/BraveAdsNotificationBuilder.java @@ -148,8 +148,7 @@ public NotificationWrapper build(NotificationMetadata metadata) { : BraveChannelDefinitions.ChannelId.BRAVE_ADS_BACKGROUND; NotificationWrapperBuilder builder = NotificationWrapperBuilderFactory.createNotificationWrapperBuilder( - false /* preferCompat */, channelId, mRemotePackageForBuilderContext, - metadata); + channelId, metadata); builder.setTicker(mTickerText); builder.setContentIntent(mContentIntent); builder.setDeleteIntent(mDeleteIntent); diff --git a/browser/permissions/brave_ethereum_permission_context_browsertest.cc b/browser/permissions/brave_ethereum_permission_context_browsertest.cc index 3fa0c1f7aa9a..9f6de6413246 100644 --- a/browser/permissions/brave_ethereum_permission_context_browsertest.cc +++ b/browser/permissions/brave_ethereum_permission_context_browsertest.cc @@ -105,7 +105,7 @@ IN_PROC_BROWSER_TEST_F(BraveEthereumPermissionContextBrowserTest, was_called = false; const GURL& url = https_server()->GetURL("a.com", "/empty.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); // No allowed accounts before setting permissions. BraveEthereumPermissionContext::GetAllowedAccounts( @@ -144,7 +144,7 @@ IN_PROC_BROWSER_TEST_F(BraveEthereumPermissionContextBrowserTest, "0xaf5Ad1E10926C0Ee4af4eDAC61DD60E853753f8B"}; GURL top_url(https_server()->GetURL("a.com", "/iframe.html")); - ui_test_utils::NavigateToURL(browser(), top_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), top_url)); GURL iframe_url(https_server()->GetURL("b.com", "/")); EXPECT_TRUE(NavigateIframeToURL(web_contents(), "test", iframe_url)); diff --git a/browser/permissions/permission_lifetime_manager_browsertest.cc b/browser/permissions/permission_lifetime_manager_browsertest.cc index 8a1b49e1e500..e279b778bac4 100644 --- a/browser/permissions/permission_lifetime_manager_browsertest.cc +++ b/browser/permissions/permission_lifetime_manager_browsertest.cc @@ -139,7 +139,7 @@ class PermissionLifetimeManagerBrowserTest : public InProcessBrowserTest { IN_PROC_BROWSER_TEST_F(PermissionLifetimeManagerBrowserTest, ExpirationSmoke) { const GURL& url = https_server()->GetURL("/empty.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); prompt_factory_->set_response_type( PermissionRequestManager::AutoResponseType::ACCEPT_ALL); @@ -183,7 +183,7 @@ IN_PROC_BROWSER_TEST_F(PermissionLifetimeManagerBrowserTest, ExpirationSmoke) { IN_PROC_BROWSER_TEST_F(PermissionLifetimeManagerBrowserTest, PRE_PermissionExpiredAfterRestart) { const GURL& url = https_server()->GetURL("/empty.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); prompt_factory_->set_response_type( PermissionRequestManager::AutoResponseType::ACCEPT_ALL); EXPECT_CALL(*prompt_factory_, OnPermissionPromptCreated(_)) @@ -241,7 +241,7 @@ IN_PROC_BROWSER_TEST_F(PermissionLifetimeManagerBrowserTest, IN_PROC_BROWSER_TEST_F(PermissionLifetimeManagerBrowserTest, ExpirationRemovedAfterManualReset) { const GURL& url = https_server()->GetURL("/empty.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); prompt_factory_->set_response_type( PermissionRequestManager::AutoResponseType::ACCEPT_ALL); EXPECT_CALL(*prompt_factory_, OnPermissionPromptCreated(_)) @@ -283,7 +283,7 @@ class PermissionLifetimeManagerWithOriginMonitorBrowserTest IN_PROC_BROWSER_TEST_F(PermissionLifetimeManagerWithOriginMonitorBrowserTest, DomainPermissionReset) { const GURL& url = https_server()->GetURL("host.com", "/empty.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); prompt_factory_->set_response_type( PermissionRequestManager::AutoResponseType::ACCEPT_ALL); @@ -307,7 +307,7 @@ IN_PROC_BROWSER_TEST_F(PermissionLifetimeManagerWithOriginMonitorBrowserTest, // Navigate to another domain. It should not reset the permission. const GURL& other_url = https_server()->GetURL("other_host.com", "/empty.html"); - ui_test_utils::NavigateToURL(browser(), other_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), other_url)); EXPECT_EQ(host_content_settings_map()->GetContentSetting( url, url, ContentSettingsType::GEOLOCATION), ContentSetting::CONTENT_SETTING_ALLOW); @@ -328,7 +328,7 @@ IN_PROC_BROWSER_TEST_F(PermissionLifetimeManagerWithOriginMonitorBrowserTest, IN_PROC_BROWSER_TEST_F(PermissionLifetimeManagerWithOriginMonitorBrowserTest, FriendlyDomainPermissionKept) { const GURL& url = https_server()->GetURL("example.com", "/empty.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); prompt_factory_->set_response_type( PermissionRequestManager::AutoResponseType::ACCEPT_ALL); @@ -352,7 +352,7 @@ IN_PROC_BROWSER_TEST_F(PermissionLifetimeManagerWithOriginMonitorBrowserTest, // Navigate to a subdomain, permission should be kept. const GURL& sub_url = https_server()->GetURL("sub.example.com", "/empty.html"); - ui_test_utils::NavigateToURL(browser(), sub_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), sub_url)); EXPECT_EQ(host_content_settings_map()->GetContentSetting( url, url, ContentSettingsType::GEOLOCATION), ContentSetting::CONTENT_SETTING_ALLOW); @@ -361,7 +361,7 @@ IN_PROC_BROWSER_TEST_F(PermissionLifetimeManagerWithOriginMonitorBrowserTest, // Navigate to another domain. It should keep the permission. const GURL& other_url = https_server()->GetURL("other_host.com", "/empty.html"); - ui_test_utils::NavigateToURL(browser(), other_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), other_url)); EXPECT_EQ(host_content_settings_map()->GetContentSetting( url, url, ContentSettingsType::GEOLOCATION), ContentSetting::CONTENT_SETTING_ALLOW); @@ -383,7 +383,7 @@ IN_PROC_BROWSER_TEST_F(PermissionLifetimeManagerWithOriginMonitorBrowserTest, IN_PROC_BROWSER_TEST_F(PermissionLifetimeManagerWithOriginMonitorBrowserTest, PublicSuffixListDomainPermissionReset) { const GURL& url = https_server()->GetURL("user.github.io", "/empty.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); prompt_factory_->set_response_type( PermissionRequestManager::AutoResponseType::ACCEPT_ALL); @@ -407,7 +407,7 @@ IN_PROC_BROWSER_TEST_F(PermissionLifetimeManagerWithOriginMonitorBrowserTest, // Navigate to a subdomain, permission should be kept. const GURL& sub_url = https_server()->GetURL("sub.user.github.io", "/empty.html"); - ui_test_utils::NavigateToURL(browser(), sub_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), sub_url)); EXPECT_EQ(host_content_settings_map()->GetContentSetting( url, url, ContentSettingsType::GEOLOCATION), ContentSetting::CONTENT_SETTING_ALLOW); @@ -416,7 +416,7 @@ IN_PROC_BROWSER_TEST_F(PermissionLifetimeManagerWithOriginMonitorBrowserTest, // Navigate to another domain in PSL. It should keep the permission. const GURL& other_url = https_server()->GetURL("user2.github.io", "/empty.html"); - ui_test_utils::NavigateToURL(browser(), other_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), other_url)); EXPECT_EQ(host_content_settings_map()->GetContentSetting( url, url, ContentSettingsType::GEOLOCATION), ContentSetting::CONTENT_SETTING_ALLOW); @@ -438,7 +438,7 @@ IN_PROC_BROWSER_TEST_F(PermissionLifetimeManagerWithOriginMonitorBrowserTest, IN_PROC_BROWSER_TEST_F(PermissionLifetimeManagerWithOriginMonitorBrowserTest, PRE_DomainPermissionResetAfterRestart) { const GURL& url = https_server()->GetURL("example.com", "/empty.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); prompt_factory_->set_response_type( PermissionRequestManager::AutoResponseType::ACCEPT_ALL); diff --git a/browser/permissions/permission_manager_browsertest.cc b/browser/permissions/permission_manager_browsertest.cc index f97c6930cdb5..36a2c5fe5508 100644 --- a/browser/permissions/permission_manager_browsertest.cc +++ b/browser/permissions/permission_manager_browsertest.cc @@ -127,7 +127,7 @@ class PermissionManagerBrowserTest : public InProcessBrowserTest { IN_PROC_BROWSER_TEST_F(PermissionManagerBrowserTest, RequestEthereumPermissions) { const GURL& url = https_server()->GetURL("/empty.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); auto* permission_request_manager = GetPermissionRequestManager(); EXPECT_FALSE(permission_request_manager->IsRequestInProgress()); @@ -221,7 +221,7 @@ IN_PROC_BROWSER_TEST_F(PermissionManagerBrowserTest, IN_PROC_BROWSER_TEST_F(PermissionManagerBrowserTest, RequestEthereumPermissionsTabClosed) { const GURL& url = https_server()->GetURL("/empty.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); auto* permission_request_manager = GetPermissionRequestManager(); EXPECT_FALSE(permission_request_manager->IsRequestInProgress()); @@ -281,7 +281,7 @@ IN_PROC_BROWSER_TEST_F(PermissionManagerBrowserTest, "0xaf5Ad1E10926C0Ee4af4eDAC61DD60E853753f8B"}; GURL top_url(https_server()->GetURL("a.com", "/iframe.html")); - ui_test_utils::NavigateToURL(browser(), top_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), top_url)); GURL iframe_url(https_server()->GetURL("b.com", "/")); EXPECT_TRUE(NavigateIframeToURL(web_contents(), "test", iframe_url)); @@ -300,7 +300,7 @@ IN_PROC_BROWSER_TEST_F(PermissionManagerBrowserTest, IN_PROC_BROWSER_TEST_F(PermissionManagerBrowserTest, GetCanonicalOrigin) { const GURL& url = https_server()->GetURL("/empty.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); std::vector addresses = { "0xaf5Ad1E10926C0Ee4af4eDAC61DD60E853753f8A", diff --git a/browser/resources/settings/BUILD.gn b/browser/resources/settings/BUILD.gn index 5eae68f397a6..9fdc2484ac3c 100644 --- a/browser/resources/settings/BUILD.gn +++ b/browser/resources/settings/BUILD.gn @@ -15,10 +15,11 @@ import("//tools/grit/grit_rule.gni") import("//tools/grit/preprocess_if_expr.gni") import("//tools/polymer/html_to_js.gni") import("//tools/polymer/polymer.gni") +import("//tools/typescript/ts_library.gni") import("//ui/webui/resources/tools/generate_grd.gni") import("//ui/webui/resources/tools/js_modulizer.gni") -preprocess_folder = "tsc" +preprocess_folder = "preprocessed" preprocess_manifest = "brave_preprocessed_manifest.json" preprocess_gen_manifest = "brave_preprocessed_gen_manifest.json" @@ -176,6 +177,93 @@ preprocess_if_expr("preprocess_generated") { ] } +ts_library("build_ts") { + root_dir = + "$root_gen_dir/chrome/browser/resources/settings/$preprocess_folder" + out_dir = "$root_gen_dir/chrome/browser/resources/settings/tsc" + tsconfig_base = "//chrome/browser/resources/settings/tsconfig_base.json" + in_files = [ + "brave_appearance_page/brave_appearance_browser_proxy.js", + "brave_appearance_page/brave_theme.js", + "brave_appearance_page/sidebar.js", + "brave_appearance_page/super_referral.js", + "brave_appearance_page/toolbar.js", + "brave_clear_browsing_data_dialog/brave_clear_browsing_data_dialog_behavior.js", + "brave_clear_browsing_data_dialog/brave_clear_browsing_data_on_exit_page.js", + "brave_default_extensions_page/brave_default_extensions_browser_proxy.m.js", + "brave_default_extensions_page/brave_default_extensions_page.m.js", + "brave_help_tips_page/brave_help_tips_page.m.js", + "brave_icons.m.js", + "brave_ipfs_page/brave_ipfs_browser_proxy.m.js", + "brave_ipfs_page/brave_ipfs_page.m.js", + "brave_ipfs_page/change_ipfs_gateway_dialog.js", + "brave_ipfs_page/add_p2p_key_dialog.js", + "brave_ipfs_page/rotate_p2p_key_dialog.js", + "brave_ipfs_page/p2p_keys_subpage.m.js", + "brave_ipfs_page/ipfs_peers_subpage.m.js", + "brave_ipfs_page/add_ipfs_peer_dialog.js", + "brave_new_tab_page/brave_new_tab_browser_proxy.m.js", + "brave_new_tab_page/brave_new_tab_page.m.js", + "brave_overrides/about_page.js", + "brave_overrides/appearance_page.js", + "brave_overrides/basic_page.js", + "brave_overrides/clear_browsing_data_dialog.js", + "brave_overrides/config.js", + "brave_overrides/cookies_page.js", + "brave_overrides/default_browser_page.js", + "brave_overrides/icons.js", + "brave_overrides/import_data_dialog.js", + "brave_overrides/index.js", + "brave_overrides/page_visibility.js", + "brave_overrides/passwords_section.js", + "brave_overrides/payments_section.js", + "brave_overrides/people_page.js", + "brave_overrides/personalization_options.js", + "brave_overrides/printing_page.js", + "brave_overrides/privacy_page.js", + "brave_overrides/reset_profile_dialog.js", + "brave_overrides/safety_check_passwords_child.js", + "brave_overrides/search_engines_section.js", + "brave_overrides/search_page.js", + "brave_overrides/security_page.js", + "brave_overrides/settings_menu.js", + "brave_overrides/settings_section.js", + "brave_overrides/settings_ui.js", + "brave_overrides/site_details.js", + "brave_overrides/site_settings_page.js", + "brave_overrides/sync_account_control.js", + "brave_overrides/sync_controls.js", + "brave_privacy_page/brave_personalization_options.m.js", + "brave_privacy_page/brave_privacy_page_browser_proxy.m.js", + "brave_reset_page/brave_reset_profile_dialog_behavior.js", + "brave_routes.js", + "brave_search_engines_page/brave_search_engines_page.m.js", + "brave_sync_page/brave_sync_browser_proxy.js", + "brave_sync_page/brave_sync_code_dialog.js", + "brave_sync_page/brave_sync_configure.js", + "brave_sync_page/brave_sync_page.js", + "brave_sync_page/brave_sync_setup.js", + "brave_sync_page/brave_sync_subpage.js", + "brave_wallet_page/brave_wallet_browser_proxy.m.js", + "brave_wallet_page/brave_wallet_page.m.js", + "default_brave_shields_page/default_brave_shields_browser_proxy.m.js", + "default_brave_shields_page/default_brave_shields_page.m.js", + "getting_started_page/getting_started.js", + "social_blocking_page/social_blocking_page.m.js", + ] + + definitions = [ + "//tools/typescript/definitions/chrome_send.d.ts", + "//tools/typescript/definitions/management.d.ts", + "//tools/typescript/definitions/settings_private.d.ts", + ] + + extra_deps = [ + ":preprocess", + ":preprocess_generated", + ] +} + group("web_modules") { public_deps = [ # local targets diff --git a/browser/resources/settings/brave_overrides/privacy_page.js b/browser/resources/settings/brave_overrides/privacy_page.js index 6b814cfecacf..3af2e3bfdf0e 100644 --- a/browser/resources/settings/brave_overrides/privacy_page.js +++ b/browser/resources/settings/brave_overrides/privacy_page.js @@ -57,5 +57,12 @@ RegisterPolymerTemplateModifications({ `) } } + + const privacySandboxLinkRow = templateContent.getElementById('privacySandboxLinkRow') + if (!privacySandboxLinkRow) { + console.error('[Brave Settings Overrides] Could not find privacySandboxLinkRow id on privacy page.') + } else { + privacySandboxLinkRow.setAttribute('hidden', 'true') + } }, }) diff --git a/browser/resources/settings/sources.gni b/browser/resources/settings/sources.gni index 8f120114c6d8..8bfa98f51336 100644 --- a/browser/resources/settings/sources.gni +++ b/browser/resources/settings/sources.gni @@ -3,7 +3,5 @@ # 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_deps_chrome_browser_resources_settings_build = [ - "//brave/browser/resources/settings:preprocess", - "//brave/browser/resources/settings:preprocess_generated", -] +brave_deps_chrome_browser_resources_settings_build = + [ "//brave/browser/resources/settings:build_ts" ] diff --git a/browser/sources.gni b/browser/sources.gni index 4d4026de6b9e..31681860fa36 100644 --- a/browser/sources.gni +++ b/browser/sources.gni @@ -169,6 +169,7 @@ brave_chrome_browser_deps = [ "//components/permissions", "//components/pref_registry", "//components/prefs", + "//components/privacy_sandbox:privacy_sandbox_prefs", "//components/safe_browsing/core/common:safe_browsing_prefs", "//components/search_engines", "//components/services/heap_profiling/public/mojom", diff --git a/browser/speedreader/speedreader_browsertest.cc b/browser/speedreader/speedreader_browsertest.cc index 38a5a9074b28..042edaa4f383 100644 --- a/browser/speedreader/speedreader_browsertest.cc +++ b/browser/speedreader/speedreader_browsertest.cc @@ -111,9 +111,9 @@ class SpeedReaderBrowserTest : public InProcessBrowserTest { WindowOpenDisposition disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB) { const GURL url = https_server_.GetURL(kTestHost, path); - ui_test_utils::NavigateToURLWithDisposition( + ASSERT_TRUE(ui_test_utils::NavigateToURLWithDisposition( browser(), url, disposition, - ui_test_utils::BROWSER_TEST_WAIT_FOR_LOAD_STOP); + ui_test_utils::BROWSER_TEST_WAIT_FOR_LOAD_STOP)); } protected: @@ -175,7 +175,7 @@ IN_PROC_BROWSER_TEST_F(SpeedReaderBrowserTest, DisableSiteWorks) { IN_PROC_BROWSER_TEST_F(SpeedReaderBrowserTest, DISABLED_SmokeTest) { ToggleSpeedreader(); const GURL url = https_server_.GetURL(kTestHost, kTestPageReadable); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = ActiveWebContents(); content::RenderFrameHost* rfh = contents->GetMainFrame(); @@ -191,7 +191,7 @@ IN_PROC_BROWSER_TEST_F(SpeedReaderBrowserTest, DISABLED_SmokeTest) { // Check that disabled speedreader doesn't affect the page. ToggleSpeedreader(); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); rfh = contents->GetMainFrame(); EXPECT_LT(106000, content::EvalJs(rfh, kGetContentLength)); } diff --git a/browser/tor/onion_location_navigation_throttle_browsertest.cc b/browser/tor/onion_location_navigation_throttle_browsertest.cc index f7a2e0b6ca61..2bca8e5fe81d 100644 --- a/browser/tor/onion_location_navigation_throttle_browsertest.cc +++ b/browser/tor/onion_location_navigation_throttle_browsertest.cc @@ -126,7 +126,7 @@ class OnionLocationNavigationThrottleBrowserTest : public InProcessBrowserTest { IN_PROC_BROWSER_TEST_F(OnionLocationNavigationThrottleBrowserTest, OnionLocationHeader) { GURL url1 = test_server()->GetURL("/onion"); - ui_test_utils::NavigateToURL(browser(), url1); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url1)); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); tor::OnionLocationTabHelper* helper = @@ -136,7 +136,7 @@ IN_PROC_BROWSER_TEST_F(OnionLocationNavigationThrottleBrowserTest, CheckOnionLocationLabel(browser(), GURL(kTestOnionURL)); GURL url2 = test_server()->GetURL("/no_onion"); - ui_test_utils::NavigateToURL(browser(), url2); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url2)); web_contents = browser()->tab_strip_model()->GetActiveWebContents(); helper = tor::OnionLocationTabHelper::FromWebContents(web_contents); EXPECT_FALSE(helper->should_show_icon()); @@ -148,7 +148,7 @@ IN_PROC_BROWSER_TEST_F(OnionLocationNavigationThrottleBrowserTest, content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); content::TestNavigationObserver nav_observer(web_contents); - ui_test_utils::NavigateToURL(browser(), GURL(kTestOnionURL)); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), GURL(kTestOnionURL))); nav_observer.Wait(); // Original request was blocked EXPECT_EQ(nav_observer.last_net_error_code(), net::ERR_BLOCKED_BY_CLIENT); @@ -158,7 +158,7 @@ IN_PROC_BROWSER_TEST_F(OnionLocationNavigationThrottleBrowserTest, EXPECT_EQ(helper->onion_location(), GURL(kTestOnionURL)); CheckOnionLocationLabel(browser(), GURL(kTestOnionURL)); - ui_test_utils::NavigateToURL(browser(), GURL(kTestNotOnionURL)); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), GURL(kTestNotOnionURL))); web_contents = browser()->tab_strip_model()->GetActiveWebContents(); helper = tor::OnionLocationTabHelper::FromWebContents(web_contents); EXPECT_FALSE(helper->should_show_icon()); @@ -170,7 +170,8 @@ IN_PROC_BROWSER_TEST_F(OnionLocationNavigationThrottleBrowserTest, browser()->profile()->GetPrefs()->SetBoolean(tor::prefs::kAutoOnionRedirect, true); BrowserList* browser_list = BrowserList::GetInstance(); - ui_test_utils::NavigateToURL(browser(), GURL("https://brave.com")); + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), GURL("https://brave.com"))); EXPECT_EQ(1U, browser_list->size()); ASSERT_FALSE(browser_list->get(0)->profile()->IsTor()); ASSERT_EQ(browser(), browser_list->get(0)); @@ -180,7 +181,7 @@ IN_PROC_BROWSER_TEST_F(OnionLocationNavigationThrottleBrowserTest, content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); content::TestNavigationObserver nav_observer(web_contents); - ui_test_utils::NavigateToURL(browser(), GURL(kTestOnionURL)); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), GURL(kTestOnionURL))); browser_creation_observer.Wait(); nav_observer.Wait(); // Original request was blocked @@ -200,9 +201,10 @@ IN_PROC_BROWSER_TEST_F(OnionLocationNavigationThrottleBrowserTest, IN_PROC_BROWSER_TEST_F(OnionLocationNavigationThrottleBrowserTest, OnionDomain_AutoOnionRedirect_OffByDefault) { BrowserList* browser_list = BrowserList::GetInstance(); - ui_test_utils::NavigateToURL(browser(), GURL("https://brave.com")); + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), GURL("https://brave.com"))); - ui_test_utils::NavigateToURL(browser(), GURL(kTestOnionURL)); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), GURL(kTestOnionURL))); EXPECT_EQ(1U, browser_list->size()); ASSERT_FALSE(browser_list->get(0)->profile()->IsTor()); @@ -219,7 +221,7 @@ IN_PROC_BROWSER_TEST_F(OnionLocationNavigationThrottleBrowserTest, nullptr, ui_test_utils::BrowserChangeObserver::ChangeType::kAdded); GURL url = test_server()->GetURL("/onion"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); browser_creation_observer.Wait(); // We don't close the original tab EXPECT_EQ(browser()->tab_strip_model()->count(), 1); @@ -260,7 +262,7 @@ IN_PROC_BROWSER_TEST_F(OnionLocationNavigationThrottleBrowserTest, // OnionLocationHeader_ GURL url = test_server()->GetURL("/onion"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); tor::OnionLocationTabHelper* helper = @@ -269,21 +271,21 @@ IN_PROC_BROWSER_TEST_F(OnionLocationNavigationThrottleBrowserTest, EXPECT_TRUE(helper->onion_location().is_empty()); // Onion Domain - ui_test_utils::NavigateToURL(browser(), GURL(kTestOnionURL)); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), GURL(kTestOnionURL))); BrowserList* browser_list = BrowserList::GetInstance(); EXPECT_EQ(1U, browser_list->size()); // AutoOnionLocationPref browser()->profile()->GetPrefs()->SetBoolean(tor::prefs::kAutoOnionRedirect, true); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); EXPECT_EQ(1U, browser_list->size()); } IN_PROC_BROWSER_TEST_F(OnionLocationNavigationThrottleBrowserTest, InvalidScheme) { GURL url = test_server()->GetURL("/invalid_scheme"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); tor::OnionLocationTabHelper* helper = @@ -293,7 +295,7 @@ IN_PROC_BROWSER_TEST_F(OnionLocationNavigationThrottleBrowserTest, browser()->profile()->GetPrefs()->SetBoolean(tor::prefs::kAutoOnionRedirect, true); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); BrowserList* browser_list = BrowserList::GetInstance(); EXPECT_EQ(1U, browser_list->size()); ASSERT_FALSE(browser_list->get(0)->profile()->IsTor()); @@ -305,7 +307,7 @@ IN_PROC_BROWSER_TEST_F(OnionLocationNavigationThrottleBrowserTest, IN_PROC_BROWSER_TEST_F(OnionLocationNavigationThrottleBrowserTest, NotOnion) { GURL url = test_server()->GetURL("/not_onion"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); tor::OnionLocationTabHelper* helper = @@ -315,7 +317,7 @@ IN_PROC_BROWSER_TEST_F(OnionLocationNavigationThrottleBrowserTest, NotOnion) { browser()->profile()->GetPrefs()->SetBoolean(tor::prefs::kAutoOnionRedirect, true); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); BrowserList* browser_list = BrowserList::GetInstance(); EXPECT_EQ(1U, browser_list->size()); ASSERT_FALSE(browser_list->get(0)->profile()->IsTor()); @@ -327,7 +329,7 @@ IN_PROC_BROWSER_TEST_F(OnionLocationNavigationThrottleBrowserTest, NotOnion) { IN_PROC_BROWSER_TEST_F(OnionLocationNavigationThrottleBrowserTest, HTTPHost) { GURL url = test_http_server()->GetURL("/onion"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); tor::OnionLocationTabHelper* helper = @@ -337,7 +339,7 @@ IN_PROC_BROWSER_TEST_F(OnionLocationNavigationThrottleBrowserTest, HTTPHost) { browser()->profile()->GetPrefs()->SetBoolean(tor::prefs::kAutoOnionRedirect, true); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); BrowserList* browser_list = BrowserList::GetInstance(); EXPECT_EQ(1U, browser_list->size()); ASSERT_FALSE(browser_list->get(0)->profile()->IsTor()); diff --git a/browser/ui/android/strings/android_chrome_strings.grd b/browser/ui/android/strings/android_chrome_strings.grd index cdd3282d78bf..61713ef68e2e 100644 --- a/browser/ui/android/strings/android_chrome_strings.grd +++ b/browser/ui/android/strings/android_chrome_strings.grd @@ -280,9 +280,6 @@ CHAR_LIMIT guidelines: You are currently customizing your Sync settings. To finish turning on sync, tap the Confirm button near the bottom of the screen. Navigate up - - Not signed in - Sync and personalize across devices @@ -739,9 +736,21 @@ Tap any word to search. To refine your search, touch & hold to select more o Touch & hold any word to search. To refine your search, select more or fewer words. To edit your search, open the panel, tap the icon to open in a new tab, and make your changes in the search box. + + Learn about topics on websites without leaving the page. Select one or more words on the page to search for them. + Touch to Search sends the selected word and the current page as context to Brave Search. You can turn it off in <link>Settings</link>. + + Include surrounding text in Brave searches? + + + By including more of a page’s text, you might see better results when using Touch to Search. You can always visit <link>settings</link> to change this. + + + Include + Allow @@ -757,6 +766,12 @@ Touch & hold any word to search. To refine your search, select more or fewer Tap to see search results + + Include surrounding text in Brave searches + + + By including more of a page’s text, you might see better results + “Do Not Track” @@ -993,6 +1008,14 @@ Your Brave account may have other forms of browsing history like searches and ac %1$s3 items deleted + + + Privacy guide + + + Review privacy and security settings + + Safety check @@ -1218,8 +1241,8 @@ Your Brave account may have other forms of browsing history like searches and ac %1$sBrave’s language - - Default device language + + Current device language Add language @@ -1233,7 +1256,7 @@ Your Brave account may have other forms of browsing history like searches and ac Suggested languages - + Other languages @@ -1437,6 +1460,9 @@ Your Brave account may have other forms of browsing history like searches and ac Do you want to download %1$smalware.exe anyway? + + Do you want to download %1$smalware.exe (%2$s100MB) anyway? + File might be harmful @@ -1562,6 +1588,20 @@ Your Brave account may have other forms of browsing history like searches and ac If you change the file extension, the file may open in a different application and potentially be a hazard to your device. + + + Download again + + + Do you want to download ^1malware.exe^2 (100MB) again? + + + Download file again? + + + Download page again? + + About Brave @@ -2328,6 +2368,12 @@ To change this setting, <resetlink>reset sync

Screenshot. Tap to close. + + Create a highlighted link like this one? + + + Learn More + @@ -2913,6 +2959,9 @@ To change this setting, <resetlink>reset sync

To refresh the feed content, pull down the page + + Back to top + @@ -3763,6 +3812,9 @@ To change this setting, <resetlink>reset sync

Can’t unfollow. Something went wrong. + + You're offline. Check your internet connection and try again. + Try again @@ -3867,9 +3919,6 @@ To change this setting, <resetlink>reset sync

You'll see your %1$swww.youtube.com sign-in status, browsing data, and site data in Brave - - Got it - %1$sYouTube also has data in Brave @@ -4071,9 +4120,6 @@ To change this setting, <resetlink>reset sync

Close window? - - Close window - The window will be closed @@ -4205,7 +4251,7 @@ To change this setting, <resetlink>reset sync

- + Brave Dino @@ -4221,12 +4267,6 @@ To change this setting, <resetlink>reset sync

%1$swww.google.com - Sent from %2$sTanya's Pixel 2XL - - Tab received - - - Open - List of devices to share a tab with. @@ -4263,6 +4303,13 @@ To change this setting, <resetlink>reset sync

Page sent. To see it, open Brave on your %1$sphone + + <link>Your devices</link> · %1$sfoo@gmail.com + + + You can send tabs between devices that are signed in with the same Brave sync chain + + @@ -4303,6 +4350,18 @@ To change this setting, <resetlink>reset sync

video + + List of sharing options. + + + List of sharing options opened at half height. + + + List of sharing options at full height. + + + List of sharing options is closed. + @@ -4527,6 +4586,10 @@ To change this setting, <resetlink>reset sync

+ + Updating Brave to connect to other devices + + Something went wrong @@ -4535,6 +4598,10 @@ To change this setting, <resetlink>reset sync

+ + %1$sBrave needs Nearby devices permission in order to connect to your device + + Try another verification option @@ -4559,10 +4626,6 @@ To change this setting, <resetlink>reset sync

- - Bluetooth will turn back off when you're done - - QR Code @@ -4613,6 +4676,10 @@ To change this setting, <resetlink>reset sync

+ + Add emotion + + Screenshot @@ -4649,13 +4716,14 @@ To change this setting, <resetlink>reset sync

- - Link to highlight - - Create card + + + Save to device + + Copied @@ -4712,19 +4780,15 @@ To change this setting, <resetlink>reset sync

%1$s1582667748515 - - Can’t create link to highlight. Share link to page. - - Can’t create link to highlight - + Include link to highlight - + Share text only @@ -4732,6 +4796,34 @@ To change this setting, <resetlink>reset sync

+ + Include a link to the page + + + + Include link + + + + Share card only + + + + Share screenshot only + + + + Share image only + + + + Share GIF only + + + + Share content only + + Edit @@ -4757,6 +4849,10 @@ To change this setting, <resetlink>reset sync

%1$s1582667748515 + + chrome_image_%1$s1582667748515 + + Brave Notifications Platform @@ -4915,12 +5011,16 @@ To change this setting, <resetlink>reset sync

- - Create a %1$sairbnb.com account + + Sign up for %1$srp.example + + + Choose an account to sign up for %1$srp.example - - Create a %1$sairbnb.com account… + + To sign up, %1$sprovider.example will share your name, email, address, and profile picture with the site. + Continue as %1$sAlbus (or Albus Dumbledore) @@ -4936,6 +5036,9 @@ To change this setting, <resetlink>reset sync

List of accounts to be selected is closed. + + Signing into %1$srp.example + diff --git a/browser/ui/bookmark/BUILD.gn b/browser/ui/bookmark/BUILD.gn index 3e419e72ef9f..3b157435de51 100644 --- a/browser/ui/bookmark/BUILD.gn +++ b/browser/ui/bookmark/BUILD.gn @@ -27,8 +27,8 @@ source_set("bookmark") { "//chrome/browser/cart:mojo_bindings", "//chrome/browser/new_tab_page/modules/drive:mojo_bindings", "//chrome/browser/new_tab_page/modules/task_module:mojo_bindings", - "//chrome/browser/promo_browser_command:mojo_bindings", "//chrome/browser/ui/webui/new_tab_page:mojo_bindings", "//chrome/browser/ui/webui/realbox:mojo_bindings", + "//ui/webui/resources/js/browser_command:mojo_bindings", ] } diff --git a/browser/ui/brave_browser_browsertest.cc b/browser/ui/brave_browser_browsertest.cc index 39b6ecf51c4c..a1c29833edcf 100644 --- a/browser/ui/brave_browser_browsertest.cc +++ b/browser/ui/brave_browser_browsertest.cc @@ -12,7 +12,7 @@ using BraveBrowserBrowserTest = InProcessBrowserTest; IN_PROC_BROWSER_TEST_F(BraveBrowserBrowserTest, NTPFaviconTest) { - ui_test_utils::NavigateToURL(browser(), GURL("brave://newtab/")); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), GURL("brave://newtab/"))); auto* tab_model = browser()->tab_strip_model(); EXPECT_FALSE( diff --git a/browser/ui/sidebar/BUILD.gn b/browser/ui/sidebar/BUILD.gn index 40fc8cb2ec54..09e8d3995b32 100644 --- a/browser/ui/sidebar/BUILD.gn +++ b/browser/ui/sidebar/BUILD.gn @@ -51,9 +51,9 @@ source_set("sidebar") { "//chrome/browser/cart:mojo_bindings", "//chrome/browser/new_tab_page/modules/drive:mojo_bindings", "//chrome/browser/new_tab_page/modules/task_module:mojo_bindings", - "//chrome/browser/promo_browser_command:mojo_bindings", "//chrome/browser/ui/webui/new_tab_page:mojo_bindings", "//chrome/browser/ui/webui/realbox:mojo_bindings", + "//ui/webui/resources/js/browser_command:mojo_bindings", ] } diff --git a/browser/ui/sidebar/sidebar_browsertest.cc b/browser/ui/sidebar/sidebar_browsertest.cc index 6c13ce94caab..dc27efcf5c78 100644 --- a/browser/ui/sidebar/sidebar_browsertest.cc +++ b/browser/ui/sidebar/sidebar_browsertest.cc @@ -53,7 +53,7 @@ IN_PROC_BROWSER_TEST_F(SidebarBrowserTest, BasicTest) { EXPECT_TRUE(CanAddCurrentActiveTabToSidebar(browser())); // If current active tab is NTP, we can't add current url to sidebar. - ui_test_utils::NavigateToURL(browser(), GURL("brave://newtab/")); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), GURL("brave://newtab/"))); EXPECT_FALSE(CanAddCurrentActiveTabToSidebar(browser())); // Currently we have 4 default items. @@ -104,7 +104,8 @@ IN_PROC_BROWSER_TEST_F(SidebarBrowserTest, BasicTest) { IN_PROC_BROWSER_TEST_F(SidebarBrowserTest, WebTypePanelTest) { // By default, sidebar has 4 items. EXPECT_EQ(4UL, model()->GetAllSidebarItems().size()); - ui_test_utils::NavigateToURL(browser(), GURL("brave://settings/")); + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), GURL("brave://settings/"))); EXPECT_TRUE(CanAddCurrentActiveTabToSidebar(browser())); controller()->AddItemWithCurrentTab(); @@ -115,10 +116,10 @@ IN_PROC_BROWSER_TEST_F(SidebarBrowserTest, WebTypePanelTest) { EXPECT_EQ(0, current_tab_index); // Load NTP in newtab and activate it. (tab index 1) - ui_test_utils::NavigateToURLWithDisposition( + ASSERT_TRUE(ui_test_utils::NavigateToURLWithDisposition( browser(), GURL("brave://newtab/"), WindowOpenDisposition::NEW_FOREGROUND_TAB, - ui_test_utils::BROWSER_TEST_WAIT_FOR_LOAD_STOP); + ui_test_utils::BROWSER_TEST_WAIT_FOR_LOAD_STOP)); current_tab_index = tab_model()->active_index(); EXPECT_EQ(1, tab_model()->active_index()); diff --git a/browser/ui/speedreader/speedreader_bubble_browsertest.cc b/browser/ui/speedreader/speedreader_bubble_browsertest.cc index 05444255e942..65efd18bd3d1 100644 --- a/browser/ui/speedreader/speedreader_bubble_browsertest.cc +++ b/browser/ui/speedreader/speedreader_bubble_browsertest.cc @@ -30,7 +30,8 @@ class SpeedreaderBubbleBrowserTest : public DialogBrowserTest { protected: bool NavigateToNewTab() { - ui_test_utils::NavigateToURL(browser(), GURL("chrome://newtab")); + EXPECT_TRUE( + ui_test_utils::NavigateToURL(browser(), GURL("chrome://newtab"))); return WaitForLoadStop(ActiveWebContents()); } diff --git a/browser/ui/views/omnibox/brave_omnibox_view_views_browsertest.cc b/browser/ui/views/omnibox/brave_omnibox_view_views_browsertest.cc index eea925096b23..f86c72c2a52d 100644 --- a/browser/ui/views/omnibox/brave_omnibox_view_views_browsertest.cc +++ b/browser/ui/views/omnibox/brave_omnibox_view_views_browsertest.cc @@ -27,7 +27,7 @@ class BraveOmniboxViewViewsTest : public InProcessBrowserTest { // Load brave url and check copied url also has brave scheme. IN_PROC_BROWSER_TEST_F(BraveOmniboxViewViewsTest, CopyURLToClipboardTest) { const std::string test_url("brave://version/"); - ui_test_utils::NavigateToURL(browser(), GURL(test_url)); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), GURL(test_url))); omnibox_view()->SelectAll(true); omnibox_view()->ExecuteCommand(views::Textfield::kCopy, 0); diff --git a/browser/ui/views/tabs/brave_tab_context_menu_contents_browsertest.cc b/browser/ui/views/tabs/brave_tab_context_menu_contents_browsertest.cc index 9898dff7eb9d..f5d53c95d9af 100644 --- a/browser/ui/views/tabs/brave_tab_context_menu_contents_browsertest.cc +++ b/browser/ui/views/tabs/brave_tab_context_menu_contents_browsertest.cc @@ -43,7 +43,8 @@ IN_PROC_BROWSER_TEST_F(BraveTabContextMenuContentsTest, Basics) { BraveTabMenuModel::CommandBookmarkAllTabs)); // When a tab is closed, restore tab menu item is enabled. - ui_test_utils::NavigateToURL(browser(), GURL("brave://version/")); + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), GURL("brave://version/"))); chrome::CloseTab(browser()); EXPECT_TRUE(menu.IsCommandIdEnabled( BraveTabMenuModel::CommandRestoreTab)); diff --git a/browser/ui/webui/brave_adblock_ui.cc b/browser/ui/webui/brave_adblock_ui.cc index 980a95434ea9..a49d5a115309 100644 --- a/browser/ui/webui/brave_adblock_ui.cc +++ b/browser/ui/webui/brave_adblock_ui.cc @@ -9,6 +9,7 @@ #include #include "base/scoped_observation.h" +#include "base/values.h" #include "brave/browser/brave_browser_process.h" #include "brave/browser/ui/webui/brave_webui_source.h" #include "brave/common/webui_url_constants.h" @@ -50,16 +51,16 @@ class AdblockDOMHandler void OnJavascriptDisallowed() override; private: - void HandleEnableFilterList(const base::ListValue* args); - void HandleGetCustomFilters(const base::ListValue* args); - void HandleGetRegionalLists(const base::ListValue* args); - void HandleGetListSubscriptions(const base::ListValue* args); - void HandleUpdateCustomFilters(const base::ListValue* args); - void HandleSubmitNewSubscription(const base::ListValue* args); - void HandleSetSubscriptionEnabled(const base::ListValue* args); - void HandleDeleteSubscription(const base::ListValue* args); - void HandleRefreshSubscription(const base::ListValue* args); - void HandleViewSubscriptionSource(const base::ListValue* args); + void HandleEnableFilterList(base::Value::ConstListView args); + void HandleGetCustomFilters(base::Value::ConstListView args); + void HandleGetRegionalLists(base::Value::ConstListView args); + void HandleGetListSubscriptions(base::Value::ConstListView args); + void HandleUpdateCustomFilters(base::Value::ConstListView args); + void HandleSubmitNewSubscription(base::Value::ConstListView args); + void HandleSetSubscriptionEnabled(base::Value::ConstListView args); + void HandleDeleteSubscription(base::Value::ConstListView args); + void HandleRefreshSubscription(base::Value::ConstListView args); + void HandleViewSubscriptionSource(base::Value::ConstListView args); void RefreshSubscriptionsList(); @@ -134,20 +135,21 @@ void AdblockDOMHandler::OnServiceUpdateEvent() { RefreshSubscriptionsList(); } -void AdblockDOMHandler::HandleEnableFilterList(const base::ListValue* args) { - DCHECK_EQ(args->GetSize(), 2U); - std::string uuid; - if (!args->GetString(0, &uuid)) - return; - bool enabled; - if (!args->GetBoolean(1, &enabled)) +void AdblockDOMHandler::HandleEnableFilterList( + base::Value::ConstListView args) { + DCHECK_EQ(args.size(), 2U); + if (!args[0].is_string() || !args[1].is_bool()) return; + + std::string uuid = args[0].GetString(); + bool enabled = args[1].GetBool(); g_brave_browser_process->ad_block_regional_service_manager() ->EnableFilterList(uuid, enabled); } -void AdblockDOMHandler::HandleGetCustomFilters(const base::ListValue* args) { - DCHECK_EQ(args->GetSize(), 0U); +void AdblockDOMHandler::HandleGetCustomFilters( + base::Value::ConstListView args) { + DCHECK_EQ(args.size(), 0U); AllowJavascript(); const std::string custom_filters = g_brave_browser_process->ad_block_custom_filters_service() @@ -156,8 +158,9 @@ void AdblockDOMHandler::HandleGetCustomFilters(const base::ListValue* args) { base::Value(custom_filters)); } -void AdblockDOMHandler::HandleGetRegionalLists(const base::ListValue* args) { - DCHECK_EQ(args->GetSize(), 0U); +void AdblockDOMHandler::HandleGetRegionalLists( + base::Value::ConstListView args) { + DCHECK_EQ(args.size(), 0U); AllowJavascript(); std::unique_ptr regional_lists = g_brave_browser_process->ad_block_regional_service_manager() @@ -166,30 +169,31 @@ void AdblockDOMHandler::HandleGetRegionalLists(const base::ListValue* args) { } void AdblockDOMHandler::HandleGetListSubscriptions( - const base::ListValue* args) { - DCHECK_EQ(args->GetSize(), 0U); + base::Value::ConstListView args) { + DCHECK_EQ(args.size(), 0U); AllowJavascript(); RefreshSubscriptionsList(); } -void AdblockDOMHandler::HandleUpdateCustomFilters(const base::ListValue* args) { - DCHECK_EQ(args->GetSize(), 1U); - std::string custom_filters; - if (!args->GetString(0, &custom_filters)) +void AdblockDOMHandler::HandleUpdateCustomFilters( + base::Value::ConstListView args) { + DCHECK_EQ(args.size(), 1U); + if (!args[0].is_string()) return; + std::string custom_filters = args[0].GetString(); g_brave_browser_process->ad_block_custom_filters_service() ->UpdateCustomFilters(custom_filters); } void AdblockDOMHandler::HandleSubmitNewSubscription( - const base::ListValue* args) { - DCHECK_EQ(args->GetSize(), 1U); + base::Value::ConstListView args) { + DCHECK_EQ(args.size(), 1U); AllowJavascript(); - std::string subscription_url_string; - if (!args->GetString(0, &subscription_url_string)) { + if (!args[0].is_string()) return; - } + + std::string subscription_url_string = args[0].GetString(); const GURL subscription_url = GURL(subscription_url_string); if (!subscription_url.is_valid()) { return; @@ -202,17 +206,14 @@ void AdblockDOMHandler::HandleSubmitNewSubscription( } void AdblockDOMHandler::HandleSetSubscriptionEnabled( - const base::ListValue* args) { - DCHECK_EQ(args->GetSize(), 2U); + base::Value::ConstListView args) { + DCHECK_EQ(args.size(), 2U); AllowJavascript(); - std::string subscription_url_string; - if (!args->GetString(0, &subscription_url_string)) { + if (!args[0].is_string() || !args[1].is_bool()) return; - } - bool enabled; - if (!args->GetBoolean(1, &enabled)) { - return; - } + + std::string subscription_url_string = args[0].GetString(); + bool enabled = args[1].GetBool(); const GURL subscription_url = GURL(subscription_url_string); if (!subscription_url.is_valid()) { return; @@ -223,13 +224,14 @@ void AdblockDOMHandler::HandleSetSubscriptionEnabled( RefreshSubscriptionsList(); } -void AdblockDOMHandler::HandleDeleteSubscription(const base::ListValue* args) { - DCHECK_EQ(args->GetSize(), 1U); +void AdblockDOMHandler::HandleDeleteSubscription( + base::Value::ConstListView args) { + DCHECK_EQ(args.size(), 1U); AllowJavascript(); - std::string subscription_url_string; - if (!args->GetString(0, &subscription_url_string)) { + if (!args[0].is_string()) return; - } + + std::string subscription_url_string = args[0].GetString(); const GURL subscription_url = GURL(subscription_url_string); if (!subscription_url.is_valid()) { return; @@ -240,15 +242,16 @@ void AdblockDOMHandler::HandleDeleteSubscription(const base::ListValue* args) { RefreshSubscriptionsList(); } -void AdblockDOMHandler::HandleRefreshSubscription(const base::ListValue* args) { - DCHECK_EQ(args->GetSize(), 1U); +void AdblockDOMHandler::HandleRefreshSubscription( + base::Value::ConstListView args) { + DCHECK_EQ(args.size(), 1U); // This handler does not call Javascript directly, but refreshing the // subscription will trigger the observer later, which will require it. AllowJavascript(); - std::string subscription_url_string; - if (!args->GetString(0, &subscription_url_string)) { + if (!args[0].is_string()) return; - } + + std::string subscription_url_string = args[0].GetString(); const GURL subscription_url = GURL(subscription_url_string); if (!subscription_url.is_valid()) { return; @@ -259,12 +262,12 @@ void AdblockDOMHandler::HandleRefreshSubscription(const base::ListValue* args) { } void AdblockDOMHandler::HandleViewSubscriptionSource( - const base::ListValue* args) { - DCHECK_EQ(args->GetSize(), 1U); - std::string subscription_url_string; - if (!args->GetString(0, &subscription_url_string)) { + base::Value::ConstListView args) { + DCHECK_EQ(args.size(), 1U); + if (!args[0].is_string()) return; - } + + std::string subscription_url_string = args[0].GetString(); const GURL subscription_url = GURL(subscription_url_string); if (!subscription_url.is_valid()) { return; diff --git a/browser/ui/webui/brave_rewards_internals_ui.cc b/browser/ui/webui/brave_rewards_internals_ui.cc index 22ea44715886..a19dd2ad3114 100644 --- a/browser/ui/webui/brave_rewards_internals_ui.cc +++ b/browser/ui/webui/brave_rewards_internals_ui.cc @@ -42,28 +42,27 @@ class RewardsInternalsDOMHandler : public content::WebUIMessageHandler { void RegisterMessages() override; private: - void HandleGetRewardsInternalsInfo(const base::ListValue* args); + void HandleGetRewardsInternalsInfo(base::Value::ConstListView args); void OnGetRewardsInternalsInfo(ledger::type::RewardsInternalsInfoPtr info); - void GetBalance(const base::ListValue* args); - void OnGetBalance( - const ledger::type::Result result, - ledger::type::BalancePtr balance); - void GetContributions(const base::ListValue* args); + void GetBalance(base::Value::ConstListView args); + void OnGetBalance(const ledger::type::Result result, + ledger::type::BalancePtr balance); + void GetContributions(base::Value::ConstListView args); void OnGetContributions(ledger::type::ContributionInfoList contributions); - void GetPromotions(const base::ListValue* args); + void GetPromotions(base::Value::ConstListView args); void OnGetPromotions(ledger::type::PromotionList list); - void GetPartialLog(const base::ListValue* args); + void GetPartialLog(base::Value::ConstListView args); void OnGetPartialLog(const std::string& log); - void GetFulllLog(const base::ListValue* args); + void GetFulllLog(base::Value::ConstListView args); void OnGetFulllLog(const std::string& log); - void ClearLog(const base::ListValue* args); + void ClearLog(base::Value::ConstListView args); void OnClearLog(const bool success); - void GetExternalWallet(const base::ListValue* args); + void GetExternalWallet(base::Value::ConstListView args); void OnGetExternalWallet(const ledger::type::Result result, ledger::type::ExternalWalletPtr wallet); - void GetEventLogs(const base::ListValue* args); + void GetEventLogs(base::Value::ConstListView args); void OnGetEventLogs(ledger::type::EventLogs logs); - void GetAdDiagnostics(const base::ListValue* args); + void GetAdDiagnostics(base::Value::ConstListView args); void OnGetAdDiagnostics(const bool success, const std::string& json); brave_rewards::RewardsService* rewards_service_; // NOT OWNED @@ -87,43 +86,36 @@ void RewardsInternalsDOMHandler::RegisterMessages() { base::Unretained(this))); web_ui()->RegisterMessageCallback( "brave_rewards_internals.getBalance", - base::BindRepeating( - &RewardsInternalsDOMHandler::GetBalance, - base::Unretained(this))); + base::BindRepeating(&RewardsInternalsDOMHandler::GetBalance, + base::Unretained(this))); web_ui()->RegisterMessageCallback( "brave_rewards_internals.getContributions", - base::BindRepeating( - &RewardsInternalsDOMHandler::GetContributions, - base::Unretained(this))); + base::BindRepeating(&RewardsInternalsDOMHandler::GetContributions, + base::Unretained(this))); web_ui()->RegisterMessageCallback( "brave_rewards_internals.getPromotions", - base::BindRepeating( - &RewardsInternalsDOMHandler::GetPromotions, - base::Unretained(this))); + base::BindRepeating(&RewardsInternalsDOMHandler::GetPromotions, + base::Unretained(this))); web_ui()->RegisterMessageCallback( "brave_rewards_internals.getPartialLog", - base::BindRepeating( - &RewardsInternalsDOMHandler::GetPartialLog, - base::Unretained(this))); + base::BindRepeating(&RewardsInternalsDOMHandler::GetPartialLog, + base::Unretained(this))); web_ui()->RegisterMessageCallback( "brave_rewards_internals.getFullLog", - base::BindRepeating( - &RewardsInternalsDOMHandler::GetFulllLog, - base::Unretained(this))); + base::BindRepeating(&RewardsInternalsDOMHandler::GetFulllLog, + base::Unretained(this))); web_ui()->RegisterMessageCallback( "brave_rewards_internals.clearLog", - base::BindRepeating( - &RewardsInternalsDOMHandler::ClearLog, - base::Unretained(this))); + base::BindRepeating(&RewardsInternalsDOMHandler::ClearLog, + base::Unretained(this))); web_ui()->RegisterMessageCallback( "brave_rewards_internals.getExternalWallet", base::BindRepeating(&RewardsInternalsDOMHandler::GetExternalWallet, base::Unretained(this))); web_ui()->RegisterMessageCallback( "brave_rewards_internals.getEventLogs", - base::BindRepeating( - &RewardsInternalsDOMHandler::GetEventLogs, - base::Unretained(this))); + base::BindRepeating(&RewardsInternalsDOMHandler::GetEventLogs, + base::Unretained(this))); web_ui()->RegisterMessageCallback( "brave_rewards_internals.getAdDiagnostics", base::BindRepeating(&RewardsInternalsDOMHandler::GetAdDiagnostics, @@ -145,7 +137,7 @@ void RewardsInternalsDOMHandler::OnJavascriptDisallowed() { } void RewardsInternalsDOMHandler::HandleGetRewardsInternalsInfo( - const base::ListValue* args) { + base::Value::ConstListView args) { if (!rewards_service_) { return; } @@ -173,16 +165,16 @@ void RewardsInternalsDOMHandler::OnGetRewardsInternalsInfo( info_dict); } -void RewardsInternalsDOMHandler::GetBalance(const base::ListValue* args) { +void RewardsInternalsDOMHandler::GetBalance(base::Value::ConstListView args) { if (!rewards_service_) { return; } AllowJavascript(); - rewards_service_->FetchBalance(base::BindOnce( - &RewardsInternalsDOMHandler::OnGetBalance, - weak_ptr_factory_.GetWeakPtr())); + rewards_service_->FetchBalance( + base::BindOnce(&RewardsInternalsDOMHandler::OnGetBalance, + weak_ptr_factory_.GetWeakPtr())); } void RewardsInternalsDOMHandler::OnGetBalance( @@ -208,16 +200,17 @@ void RewardsInternalsDOMHandler::OnGetBalance( std::move(balance_value)); } -void RewardsInternalsDOMHandler::GetContributions(const base::ListValue *args) { +void RewardsInternalsDOMHandler::GetContributions( + base::Value::ConstListView args) { if (!rewards_service_) { return; } AllowJavascript(); - rewards_service_->GetAllContributions(base::BindOnce( - &RewardsInternalsDOMHandler::OnGetContributions, - weak_ptr_factory_.GetWeakPtr())); + rewards_service_->GetAllContributions( + base::BindOnce(&RewardsInternalsDOMHandler::OnGetContributions, + weak_ptr_factory_.GetWeakPtr())); } void RewardsInternalsDOMHandler::OnGetContributions( @@ -227,7 +220,7 @@ void RewardsInternalsDOMHandler::OnGetContributions( } base::Value list(base::Value::Type::LIST); - for (const auto & item : contributions) { + for (const auto& item : contributions) { base::Value contribution(base::Value::Type::DICTIONARY); contribution.SetStringKey("id", item->contribution_id); contribution.SetDoubleKey("amount", item->amount); @@ -239,14 +232,11 @@ void RewardsInternalsDOMHandler::OnGetContributions( base::Value publishers(base::Value::Type::LIST); for (const auto& publisher_item : item->publishers) { base::Value publisher(base::Value::Type::DICTIONARY); - publisher.SetStringKey( - "contributionId", - publisher_item->contribution_id); + publisher.SetStringKey("contributionId", publisher_item->contribution_id); publisher.SetStringKey("publisherKey", publisher_item->publisher_key); publisher.SetDoubleKey("totalAmount", publisher_item->total_amount); - publisher.SetDoubleKey( - "contributedAmount", - publisher_item->contributed_amount); + publisher.SetDoubleKey("contributedAmount", + publisher_item->contributed_amount); publishers.Append(std::move(publisher)); } contribution.SetPath("publishers", std::move(publishers)); @@ -257,16 +247,17 @@ void RewardsInternalsDOMHandler::OnGetContributions( std::move(list)); } -void RewardsInternalsDOMHandler::GetPromotions(const base::ListValue *args) { +void RewardsInternalsDOMHandler::GetPromotions( + base::Value::ConstListView args) { if (!rewards_service_) { return; } AllowJavascript(); - rewards_service_->GetAllPromotions(base::BindOnce( - &RewardsInternalsDOMHandler::OnGetPromotions, - weak_ptr_factory_.GetWeakPtr())); + rewards_service_->GetAllPromotions( + base::BindOnce(&RewardsInternalsDOMHandler::OnGetPromotions, + weak_ptr_factory_.GetWeakPtr())); } void RewardsInternalsDOMHandler::OnGetPromotions( @@ -276,7 +267,7 @@ void RewardsInternalsDOMHandler::OnGetPromotions( } base::ListValue promotions; - for (const auto & item : list) { + for (const auto& item : list) { auto dict = std::make_unique(); dict->SetDouble("amount", item->approximate_value); dict->SetString("promotionId", item->id); @@ -294,7 +285,8 @@ void RewardsInternalsDOMHandler::OnGetPromotions( std::move(promotions)); } -void RewardsInternalsDOMHandler::GetPartialLog(const base::ListValue *args) { +void RewardsInternalsDOMHandler::GetPartialLog( + base::Value::ConstListView args) { if (!rewards_service_) { return; } @@ -303,9 +295,8 @@ void RewardsInternalsDOMHandler::GetPartialLog(const base::ListValue *args) { rewards_service_->LoadDiagnosticLog( g_partial_log_max_lines, - base::BindOnce( - &RewardsInternalsDOMHandler::OnGetPartialLog, - weak_ptr_factory_.GetWeakPtr())); + base::BindOnce(&RewardsInternalsDOMHandler::OnGetPartialLog, + weak_ptr_factory_.GetWeakPtr())); } void RewardsInternalsDOMHandler::OnGetPartialLog(const std::string& log) { @@ -317,7 +308,7 @@ void RewardsInternalsDOMHandler::OnGetPartialLog(const std::string& log) { base::Value(log)); } -void RewardsInternalsDOMHandler::GetFulllLog(const base::ListValue *args) { +void RewardsInternalsDOMHandler::GetFulllLog(base::Value::ConstListView args) { if (!rewards_service_) { return; } @@ -325,10 +316,8 @@ void RewardsInternalsDOMHandler::GetFulllLog(const base::ListValue *args) { AllowJavascript(); rewards_service_->LoadDiagnosticLog( - -1, - base::BindOnce( - &RewardsInternalsDOMHandler::OnGetFulllLog, - weak_ptr_factory_.GetWeakPtr())); + -1, base::BindOnce(&RewardsInternalsDOMHandler::OnGetFulllLog, + weak_ptr_factory_.GetWeakPtr())); } void RewardsInternalsDOMHandler::OnGetFulllLog(const std::string& log) { @@ -339,17 +328,15 @@ void RewardsInternalsDOMHandler::OnGetFulllLog(const std::string& log) { CallJavascriptFunction("brave_rewards_internals.fullLog", base::Value(log)); } -void RewardsInternalsDOMHandler::ClearLog(const base::ListValue *args) { +void RewardsInternalsDOMHandler::ClearLog(base::Value::ConstListView args) { if (!rewards_service_) { return; } AllowJavascript(); - rewards_service_->ClearDiagnosticLog( - base::BindOnce( - &RewardsInternalsDOMHandler::OnClearLog, - weak_ptr_factory_.GetWeakPtr())); + rewards_service_->ClearDiagnosticLog(base::BindOnce( + &RewardsInternalsDOMHandler::OnClearLog, weak_ptr_factory_.GetWeakPtr())); } void RewardsInternalsDOMHandler::OnClearLog(const bool success) { @@ -365,7 +352,7 @@ void RewardsInternalsDOMHandler::OnClearLog(const bool success) { } void RewardsInternalsDOMHandler::GetExternalWallet( - const base::ListValue* args) { + base::Value::ConstListView args) { if (!rewards_service_) { return; } @@ -400,7 +387,7 @@ void RewardsInternalsDOMHandler::OnGetExternalWallet( CallJavascriptFunction("brave_rewards_internals.externalWallet", data); } -void RewardsInternalsDOMHandler::GetEventLogs(const base::ListValue* args) { +void RewardsInternalsDOMHandler::GetEventLogs(base::Value::ConstListView args) { if (!rewards_service_) { return; } @@ -408,9 +395,8 @@ void RewardsInternalsDOMHandler::GetEventLogs(const base::ListValue* args) { AllowJavascript(); rewards_service_->GetEventLogs( - base::BindOnce( - &RewardsInternalsDOMHandler::OnGetEventLogs, - weak_ptr_factory_.GetWeakPtr())); + base::BindOnce(&RewardsInternalsDOMHandler::OnGetEventLogs, + weak_ptr_factory_.GetWeakPtr())); } void RewardsInternalsDOMHandler::OnGetEventLogs(ledger::type::EventLogs logs) { @@ -432,7 +418,8 @@ void RewardsInternalsDOMHandler::OnGetEventLogs(ledger::type::EventLogs logs) { CallJavascriptFunction("brave_rewards_internals.eventLogs", std::move(data)); } -void RewardsInternalsDOMHandler::GetAdDiagnostics(const base::ListValue* args) { +void RewardsInternalsDOMHandler::GetAdDiagnostics( + base::Value::ConstListView args) { if (!ads_service_) { NOTREACHED(); return; diff --git a/browser/ui/webui/brave_rewards_page_ui.cc b/browser/ui/webui/brave_rewards_page_ui.cc index bea6c837a2c2..dc325319b1ff 100644 --- a/browser/ui/webui/brave_rewards_page_ui.cc +++ b/browser/ui/webui/brave_rewards_page_ui.cc @@ -7,8 +7,8 @@ #include -#include #include +#include #include #include "base/i18n/time_formatting.h" @@ -41,9 +41,9 @@ #include "content/public/common/bindings_policy.h" #if defined(OS_ANDROID) -#include "content/public/browser/url_data_source.h" #include "chrome/browser/ui/webui/favicon_source.h" #include "components/favicon_base/favicon_url_parser.h" +#include "content/public/browser/url_data_source.h" #endif using content::WebUIMessageHandler; @@ -51,10 +51,11 @@ using content::WebUIMessageHandler; namespace { // The handler for Javascript messages for Brave about: pages -class RewardsDOMHandler : public WebUIMessageHandler, - public brave_ads::AdsServiceObserver, - public brave_rewards::RewardsNotificationServiceObserver, - public brave_rewards::RewardsServiceObserver { +class RewardsDOMHandler + : public WebUIMessageHandler, + public brave_ads::AdsServiceObserver, + public brave_rewards::RewardsNotificationServiceObserver, + public brave_rewards::RewardsServiceObserver { public: RewardsDOMHandler(); ~RewardsDOMHandler() override; @@ -67,65 +68,57 @@ class RewardsDOMHandler : public WebUIMessageHandler, void RegisterMessages() override; private: - void RestartBrowser(const base::ListValue* args); - void IsInitialized(const base::ListValue* args); - void GetRewardsParameters(const base::ListValue* args); - void GetAutoContributeProperties(const base::ListValue* args); - void FetchPromotions(const base::ListValue* args); - void ClaimPromotion(const base::ListValue* args); - void AttestPromotion(const base::ListValue* args); - void RecoverWallet(const base::ListValue* args); - void GetReconcileStamp(const base::ListValue* args); - void SaveSetting(const base::ListValue* args); + void RestartBrowser(base::Value::ConstListView args); + void IsInitialized(base::Value::ConstListView args); + void GetRewardsParameters(base::Value::ConstListView args); + void GetAutoContributeProperties(base::Value::ConstListView args); + void FetchPromotions(base::Value::ConstListView args); + void ClaimPromotion(base::Value::ConstListView args); + void AttestPromotion(base::Value::ConstListView args); + void RecoverWallet(base::Value::ConstListView args); + void GetReconcileStamp(base::Value::ConstListView args); + void SaveSetting(base::Value::ConstListView args); void OnPublisherList(ledger::type::PublisherInfoList list); void OnExcludedSiteList(ledger::type::PublisherInfoList list); - void ExcludePublisher(const base::ListValue* args); - void RestorePublishers(const base::ListValue* args); - void RestorePublisher(const base::ListValue* args); - void GetAutoContributionAmount(const base::ListValue* args); - void RemoveRecurringTip(const base::ListValue* args); - void GetRecurringTips(const base::ListValue* args); - void GetOneTimeTips(const base::ListValue* args); - void GetContributionList(const base::ListValue* args); - void GetAdsData(const base::ListValue* args); - void GetAdsHistory(const base::ListValue* args); + void ExcludePublisher(base::Value::ConstListView args); + void RestorePublishers(base::Value::ConstListView args); + void RestorePublisher(base::Value::ConstListView args); + void GetAutoContributionAmount(base::Value::ConstListView args); + void RemoveRecurringTip(base::Value::ConstListView args); + void GetRecurringTips(base::Value::ConstListView args); + void GetOneTimeTips(base::Value::ConstListView args); + void GetContributionList(base::Value::ConstListView args); + void GetAdsData(base::Value::ConstListView args); + void GetAdsHistory(base::Value::ConstListView args); void OnGetAdsHistory(const base::ListValue& history); - void ToggleAdThumbUp(const base::ListValue* args); - void OnToggleAdThumbUp( - const std::string& creative_instance_id, - const int action); - void ToggleAdThumbDown(const base::ListValue* args); - void OnToggleAdThumbDown( - const std::string& creative_instance_id, - const int action); - void ToggleAdOptInAction(const base::ListValue* args); - void OnToggleAdOptInAction( - const std::string& category, - const int action); - void ToggleAdOptOutAction(const base::ListValue* args); - void OnToggleAdOptOutAction( - const std::string& category, - const int action); - void ToggleSaveAd(const base::ListValue* args); - void OnToggleSaveAd( - const std::string& creative_instance_id, - const bool saved); - void ToggleFlagAd(const base::ListValue* args); - void OnToggleFlagAd( - const std::string& creative_instance_id, - const bool flagged); - void SaveAdsSetting(const base::ListValue* args); - void SetBackupCompleted(const base::ListValue* args); + void ToggleAdThumbUp(base::Value::ConstListView args); + void OnToggleAdThumbUp(const std::string& creative_instance_id, + const int action); + void ToggleAdThumbDown(base::Value::ConstListView args); + void OnToggleAdThumbDown(const std::string& creative_instance_id, + const int action); + void ToggleAdOptInAction(base::Value::ConstListView args); + void OnToggleAdOptInAction(const std::string& category, const int action); + void ToggleAdOptOutAction(base::Value::ConstListView args); + void OnToggleAdOptOutAction(const std::string& category, const int action); + void ToggleSaveAd(base::Value::ConstListView args); + void OnToggleSaveAd(const std::string& creative_instance_id, + const bool saved); + void ToggleFlagAd(base::Value::ConstListView args); + void OnToggleFlagAd(const std::string& creative_instance_id, + const bool flagged); + void SaveAdsSetting(base::Value::ConstListView args); + void SetBackupCompleted(base::Value::ConstListView args); void OnGetContributionAmount(double amount); void OnGetAutoContributeProperties( ledger::type::AutoContributePropertiesPtr properties); void OnGetReconcileStamp(uint64_t reconcile_stamp); void OnAutoContributePropsReady( ledger::type::AutoContributePropertiesPtr properties); - void GetPendingContributionsTotal(const base::ListValue* args); + void GetPendingContributionsTotal(base::Value::ConstListView args); void OnGetPendingContributionsTotal(double amount); - void GetStatement(const base::ListValue* args); - void GetExcludedSites(const base::ListValue* args); + void GetStatement(base::Value::ConstListView args); + void GetExcludedSites(base::Value::ConstListView args); void OnGetStatement(const bool success, const double next_payment_date, @@ -137,71 +130,68 @@ class RewardsDOMHandler : public WebUIMessageHandler, void OnGetOneTimeTips(ledger::type::PublisherInfoList list); - void GetEnabledInlineTippingPlatforms(const base::ListValue* args); - void SetInlineTippingPlatformEnabled(const base::ListValue* args); + void GetEnabledInlineTippingPlatforms(base::Value::ConstListView args); + void SetInlineTippingPlatformEnabled(base::Value::ConstListView args); - void GetPendingContributions(const base::ListValue* args); + void GetPendingContributions(base::Value::ConstListView args); void OnGetPendingContributions( ledger::type::PendingContributionInfoList list); - void RemovePendingContribution(const base::ListValue* args); - void RemoveAllPendingContributions(const base::ListValue* args); - void FetchBalance(const base::ListValue* args); - void OnFetchBalance( - const ledger::type::Result result, - ledger::type::BalancePtr balance); + void RemovePendingContribution(base::Value::ConstListView args); + void RemoveAllPendingContributions(base::Value::ConstListView args); + void FetchBalance(base::Value::ConstListView args); + void OnFetchBalance(const ledger::type::Result result, + ledger::type::BalancePtr balance); - void GetExternalWallet(const base::ListValue* args); + void GetExternalWallet(base::Value::ConstListView args); void OnGetExternalWallet(const ledger::type::Result result, ledger::type::ExternalWalletPtr wallet); - void ProcessRewardsPageUrl(const base::ListValue* args); + void ProcessRewardsPageUrl(base::Value::ConstListView args); void OnProcessRewardsPageUrl( - const ledger::type::Result result, - const std::string& wallet_type, - const std::string& action, - const base::flat_map& args); + const ledger::type::Result result, + const std::string& wallet_type, + const std::string& action, + const base::flat_map& args); - void DisconnectWallet(const base::ListValue* args); + void DisconnectWallet(base::Value::ConstListView args); - void GetBalanceReport(const base::ListValue* args); + void GetBalanceReport(base::Value::ConstListView args); - void OnGetBalanceReport( - const uint32_t month, - const uint32_t year, - const ledger::type::Result result, - ledger::type::BalanceReportInfoPtr report); + void OnGetBalanceReport(const uint32_t month, + const uint32_t year, + const ledger::type::Result result, + ledger::type::BalanceReportInfoPtr report); - void GetMonthlyReport(const base::ListValue* args); + void GetMonthlyReport(base::Value::ConstListView args); - void GetAllMonthlyReportIds(const base::ListValue* args); - void GetCountryCode(const base::ListValue* args); + void GetAllMonthlyReportIds(base::Value::ConstListView args); + void GetCountryCode(base::Value::ConstListView args); - void OnGetMonthlyReport( - const uint32_t month, - const uint32_t year, - ledger::type::MonthlyReportInfoPtr report); + void OnGetMonthlyReport(const uint32_t month, + const uint32_t year, + ledger::type::MonthlyReportInfoPtr report); void OnGetAllMonthlyReportIds(const std::vector& ids); void OnGetRewardsParameters(ledger::type::RewardsParametersPtr parameters); - void CompleteReset(const base::ListValue* args); + void CompleteReset(base::Value::ConstListView args); - void GetPaymentId(const base::ListValue* args); + void GetPaymentId(base::Value::ConstListView args); void OnWalletCreatedForPaymentId(ledger::type::Result result); void OnGetPaymentId(ledger::type::BraveWalletPtr wallet); - void GetWalletPassphrase(const base::ListValue* args); + void GetWalletPassphrase(base::Value::ConstListView args); void OnGetWalletPassphrase(const std::string& pass); - void GetOnboardingStatus(const base::ListValue* args); - void SaveOnboardingResult(const base::ListValue* args); - void GetExternalWalletProviders(const base::ListValue* args); - void SetExternalWalletType(const base::ListValue* args); + void GetOnboardingStatus(base::Value::ConstListView args); + void SaveOnboardingResult(base::Value::ConstListView args); + void GetExternalWalletProviders(base::Value::ConstListView args); + void SetExternalWalletType(base::Value::ConstListView args); void OnExternalWalletTypeUpdated(const ledger::type::Result result, ledger::type::ExternalWalletPtr wallet); @@ -209,21 +199,17 @@ class RewardsDOMHandler : public WebUIMessageHandler, // RewardsServiceObserver implementation void OnRewardsInitialized( brave_rewards::RewardsService* rewards_service) override; - void OnFetchPromotions( - brave_rewards::RewardsService* rewards_service, - const ledger::type::Result result, - const ledger::type::PromotionList& list) override; - void OnPromotionFinished( - brave_rewards::RewardsService* rewards_service, - const ledger::type::Result result, - ledger::type::PromotionPtr promotion) override; - void OnRecoverWallet( - brave_rewards::RewardsService* rewards_service, - const ledger::type::Result result) override; - void OnExcludedSitesChanged( - brave_rewards::RewardsService* rewards_service, - std::string publisher_id, - bool excluded) override; + void OnFetchPromotions(brave_rewards::RewardsService* rewards_service, + const ledger::type::Result result, + const ledger::type::PromotionList& list) override; + void OnPromotionFinished(brave_rewards::RewardsService* rewards_service, + const ledger::type::Result result, + ledger::type::PromotionPtr promotion) override; + void OnRecoverWallet(brave_rewards::RewardsService* rewards_service, + const ledger::type::Result result) override; + void OnExcludedSitesChanged(brave_rewards::RewardsService* rewards_service, + std::string publisher_id, + bool excluded) override; void OnReconcileComplete( brave_rewards::RewardsService* rewards_service, const ledger::type::Result result, @@ -236,47 +222,41 @@ class RewardsDOMHandler : public WebUIMessageHandler, brave_rewards::RewardsService* rewards_service, const ledger::type::Result result) override; - void OnPublisherListNormalized( - brave_rewards::RewardsService* rewards_service, - ledger::type::PublisherInfoList list) override; + void OnPublisherListNormalized(brave_rewards::RewardsService* rewards_service, + ledger::type::PublisherInfoList list) override; void OnStatementChanged( brave_rewards::RewardsService* rewards_service) override; - void OnRecurringTipSaved( - brave_rewards::RewardsService* rewards_service, - bool success) override; + void OnRecurringTipSaved(brave_rewards::RewardsService* rewards_service, + bool success) override; - void OnRecurringTipRemoved( - brave_rewards::RewardsService* rewards_service, - bool success) override; + void OnRecurringTipRemoved(brave_rewards::RewardsService* rewards_service, + bool success) override; void OnPendingContributionRemoved( brave_rewards::RewardsService* rewards_service, const ledger::type::Result result) override; - void OnDisconnectWallet( - brave_rewards::RewardsService* rewards_service, - const ledger::type::Result result, - const std::string& wallet_type) override; + void OnDisconnectWallet(brave_rewards::RewardsService* rewards_service, + const ledger::type::Result result, + const std::string& wallet_type) override; void OnAdsEnabled(brave_rewards::RewardsService* rewards_service, bool ads_enabled) override; - void OnClaimPromotion( - const std::string& promotion_id, - const ledger::type::Result result, - const std::string& captcha_image, - const std::string& hint, - const std::string& captcha_id); + void OnClaimPromotion(const std::string& promotion_id, + const ledger::type::Result result, + const std::string& captcha_image, + const std::string& hint, + const std::string& captcha_id); - void OnAttestPromotion( - const std::string& promotion_id, - const ledger::type::Result result, - ledger::type::PromotionPtr promotion); + void OnAttestPromotion(const std::string& promotion_id, + const ledger::type::Result result, + ledger::type::PromotionPtr promotion); void OnUnblindedTokensReady( - brave_rewards::RewardsService* rewards_service) override; + brave_rewards::RewardsService* rewards_service) override; void ReconcileStampReset() override; @@ -292,7 +272,7 @@ class RewardsDOMHandler : public WebUIMessageHandler, const brave_rewards::RewardsNotificationService::RewardsNotification& notification) override; void OnAllNotificationsDeleted(brave_rewards::RewardsNotificationService* - rewards_notification_service) override; + rewards_notification_service) override; void OnGetNotification( brave_rewards::RewardsNotificationService* rewards_notification_service, const brave_rewards::RewardsNotificationService::RewardsNotification& @@ -306,7 +286,7 @@ class RewardsDOMHandler : public WebUIMessageHandler, void OnAdRewardsChanged() override; brave_rewards::RewardsService* rewards_service_; // NOT OWNED - brave_ads::AdsService* ads_service_; // NOT OWNED + brave_ads::AdsService* ads_service_; // NOT OWNED base::ScopedObservation @@ -344,99 +324,126 @@ void RewardsDOMHandler::RegisterMessages() { profile, chrome::FaviconUrlFormat::kFaviconLegacy)); #endif - web_ui()->RegisterMessageCallback("brave_rewards.restartBrowser", + web_ui()->RegisterMessageCallback( + "brave_rewards.restartBrowser", base::BindRepeating(&RewardsDOMHandler::RestartBrowser, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.isInitialized", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.isInitialized", base::BindRepeating(&RewardsDOMHandler::IsInitialized, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.getRewardsParameters", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.getRewardsParameters", base::BindRepeating(&RewardsDOMHandler::GetRewardsParameters, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.getAutoContributeProperties", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.getAutoContributeProperties", base::BindRepeating(&RewardsDOMHandler::GetAutoContributeProperties, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.fetchPromotions", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.fetchPromotions", base::BindRepeating(&RewardsDOMHandler::FetchPromotions, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.claimPromotion", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.claimPromotion", base::BindRepeating(&RewardsDOMHandler::ClaimPromotion, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.attestPromotion", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.attestPromotion", base::BindRepeating(&RewardsDOMHandler::AttestPromotion, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.recoverWallet", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.recoverWallet", base::BindRepeating(&RewardsDOMHandler::RecoverWallet, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.getReconcileStamp", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.getReconcileStamp", base::BindRepeating(&RewardsDOMHandler::GetReconcileStamp, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.saveSetting", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.saveSetting", base::BindRepeating(&RewardsDOMHandler::SaveSetting, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.excludePublisher", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.excludePublisher", base::BindRepeating(&RewardsDOMHandler::ExcludePublisher, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.restorePublishers", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.restorePublishers", base::BindRepeating(&RewardsDOMHandler::RestorePublishers, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.restorePublisher", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.restorePublisher", base::BindRepeating(&RewardsDOMHandler::RestorePublisher, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.getContributionAmount", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.getContributionAmount", base::BindRepeating(&RewardsDOMHandler::GetAutoContributionAmount, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.removeRecurringTip", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.removeRecurringTip", base::BindRepeating(&RewardsDOMHandler::RemoveRecurringTip, - base::Unretained(this))); + base::Unretained(this))); web_ui()->RegisterMessageCallback( "brave_rewards.getRecurringTips", base::BindRepeating(&RewardsDOMHandler::GetRecurringTips, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.getOneTimeTips", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.getOneTimeTips", base::BindRepeating(&RewardsDOMHandler::GetOneTimeTips, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.getContributionList", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.getContributionList", base::BindRepeating(&RewardsDOMHandler::GetContributionList, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.getAdsData", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.getAdsData", base::BindRepeating(&RewardsDOMHandler::GetAdsData, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.getAdsHistory", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.getAdsHistory", base::BindRepeating(&RewardsDOMHandler::GetAdsHistory, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.toggleAdThumbUp", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.toggleAdThumbUp", base::BindRepeating(&RewardsDOMHandler::ToggleAdThumbUp, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.toggleAdThumbDown", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.toggleAdThumbDown", base::BindRepeating(&RewardsDOMHandler::ToggleAdThumbDown, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.toggleAdOptInAction", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.toggleAdOptInAction", base::BindRepeating(&RewardsDOMHandler::ToggleAdOptInAction, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.toggleAdOptOutAction", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.toggleAdOptOutAction", base::BindRepeating(&RewardsDOMHandler::ToggleAdOptOutAction, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.toggleSaveAd", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.toggleSaveAd", base::BindRepeating(&RewardsDOMHandler::ToggleSaveAd, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.toggleFlagAd", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.toggleFlagAd", base::BindRepeating(&RewardsDOMHandler::ToggleFlagAd, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.saveAdsSetting", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.saveAdsSetting", base::BindRepeating(&RewardsDOMHandler::SaveAdsSetting, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.setBackupCompleted", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.setBackupCompleted", base::BindRepeating(&RewardsDOMHandler::SetBackupCompleted, - base::Unretained(this))); + base::Unretained(this))); web_ui()->RegisterMessageCallback( "brave_rewards.getPendingContributionsTotal", base::BindRepeating(&RewardsDOMHandler::GetPendingContributionsTotal, - base::Unretained(this))); + base::Unretained(this))); web_ui()->RegisterMessageCallback( "brave_rewards.getStatement", base::BindRepeating(&RewardsDOMHandler::GetStatement, - base::Unretained(this))); + base::Unretained(this))); web_ui()->RegisterMessageCallback( "brave_rewards.getEnabledInlineTippingPlatforms", base::BindRepeating(&RewardsDOMHandler::GetEnabledInlineTippingPlatforms, @@ -444,60 +451,75 @@ void RewardsDOMHandler::RegisterMessages() { web_ui()->RegisterMessageCallback( "brave_rewards.setInlineTippingPlatformEnabled", base::BindRepeating(&RewardsDOMHandler::SetInlineTippingPlatformEnabled, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.getPendingContributions", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.getPendingContributions", base::BindRepeating(&RewardsDOMHandler::GetPendingContributions, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.removePendingContribution", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.removePendingContribution", base::BindRepeating(&RewardsDOMHandler::RemovePendingContribution, - base::Unretained(this))); + base::Unretained(this))); web_ui()->RegisterMessageCallback( "brave_rewards.removeAllPendingContribution", base::BindRepeating(&RewardsDOMHandler::RemoveAllPendingContributions, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.getExcludedSites", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.getExcludedSites", base::BindRepeating(&RewardsDOMHandler::GetExcludedSites, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.fetchBalance", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.fetchBalance", base::BindRepeating(&RewardsDOMHandler::FetchBalance, - base::Unretained(this))); + base::Unretained(this))); web_ui()->RegisterMessageCallback( "brave_rewards.getExternalWallet", base::BindRepeating(&RewardsDOMHandler::GetExternalWallet, base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.processRewardsPageUrl", + web_ui()->RegisterMessageCallback( + "brave_rewards.processRewardsPageUrl", base::BindRepeating(&RewardsDOMHandler::ProcessRewardsPageUrl, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.disconnectWallet", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.disconnectWallet", base::BindRepeating(&RewardsDOMHandler::DisconnectWallet, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.getBalanceReport", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.getBalanceReport", base::BindRepeating(&RewardsDOMHandler::GetBalanceReport, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.getMonthlyReport", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.getMonthlyReport", base::BindRepeating(&RewardsDOMHandler::GetMonthlyReport, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.getMonthlyReportIds", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.getMonthlyReportIds", base::BindRepeating(&RewardsDOMHandler::GetAllMonthlyReportIds, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.getCountryCode", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.getCountryCode", base::BindRepeating(&RewardsDOMHandler::GetCountryCode, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.completeReset", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.completeReset", base::BindRepeating(&RewardsDOMHandler::CompleteReset, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.getPaymentId", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.getPaymentId", base::BindRepeating(&RewardsDOMHandler::GetPaymentId, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.getWalletPassphrase", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.getWalletPassphrase", base::BindRepeating(&RewardsDOMHandler::GetWalletPassphrase, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.getOnboardingStatus", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.getOnboardingStatus", base::BindRepeating(&RewardsDOMHandler::GetOnboardingStatus, - base::Unretained(this))); - web_ui()->RegisterMessageCallback("brave_rewards.saveOnboardingResult", + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards.saveOnboardingResult", base::BindRepeating(&RewardsDOMHandler::SaveOnboardingResult, - base::Unretained(this))); + base::Unretained(this))); web_ui()->RegisterMessageCallback( "brave_rewards.getExternalWalletProviders", base::BindRepeating(&RewardsDOMHandler::GetExternalWalletProviders, @@ -518,12 +540,12 @@ void RewardsDOMHandler::Init() { ads_service_ = brave_ads::AdsServiceFactory::GetForProfile(profile); } -void RewardsDOMHandler::RestartBrowser(const base::ListValue* args) { +void RewardsDOMHandler::RestartBrowser(base::Value::ConstListView args) { AllowJavascript(); chrome::AttemptRestart(); } -void RewardsDOMHandler::IsInitialized(const base::ListValue* args) { +void RewardsDOMHandler::IsInitialized(base::Value::ConstListView args) { AllowJavascript(); if (rewards_service_ && rewards_service_->IsInitialized()) { @@ -550,15 +572,14 @@ void RewardsDOMHandler::OnJavascriptDisallowed() { weak_factory_.InvalidateWeakPtrs(); } -void RewardsDOMHandler::GetRewardsParameters(const base::ListValue* args) { +void RewardsDOMHandler::GetRewardsParameters(base::Value::ConstListView args) { if (!rewards_service_) return; AllowJavascript(); - rewards_service_->GetRewardsParameters( - base::BindOnce(&RewardsDOMHandler::OnGetRewardsParameters, - weak_factory_.GetWeakPtr())); + rewards_service_->GetRewardsParameters(base::BindOnce( + &RewardsDOMHandler::OnGetRewardsParameters, weak_factory_.GetWeakPtr())); } void RewardsDOMHandler::OnGetRewardsParameters( @@ -590,7 +611,7 @@ void RewardsDOMHandler::OnRewardsInitialized( } void RewardsDOMHandler::GetAutoContributeProperties( - const base::ListValue* args) { + base::Value::ConstListView args) { if (!rewards_service_) return; @@ -601,13 +622,13 @@ void RewardsDOMHandler::GetAutoContributeProperties( weak_factory_.GetWeakPtr())); } -void RewardsDOMHandler::SetExternalWalletType(const base::ListValue* args) { - CHECK_EQ(1U, args->GetSize()); +void RewardsDOMHandler::SetExternalWalletType(base::Value::ConstListView args) { + CHECK_EQ(1U, args.size()); if (!rewards_service_) return; AllowJavascript(); - const std::string wallet_type = args->GetList()[0].GetString(); + const std::string wallet_type = args[0].GetString(); rewards_service_->SetExternalWalletType(wallet_type); rewards_service_->GetExternalWallet( @@ -633,9 +654,9 @@ void RewardsDOMHandler::OnGetAutoContributeProperties( values.SetBoolean("enabledContribute", properties->enabled_contribute); values.SetInteger("contributionMinTime", properties->contribution_min_time); values.SetInteger("contributionMinVisits", - properties->contribution_min_visits); + properties->contribution_min_visits); values.SetBoolean("contributionNonVerified", - properties->contribution_non_verified); + properties->contribution_non_verified); values.SetBoolean("contributionVideos", properties->contribution_videos); CallJavascriptFunction("brave_rewards.autoContributeProperties", values); @@ -667,19 +688,18 @@ void RewardsDOMHandler::OnFetchPromotions( CallJavascriptFunction("brave_rewards.promotions", dict); } -void RewardsDOMHandler::FetchPromotions(const base::ListValue* args) { +void RewardsDOMHandler::FetchPromotions(base::Value::ConstListView args) { if (rewards_service_) { AllowJavascript(); rewards_service_->FetchPromotions(); } } -void RewardsDOMHandler::OnClaimPromotion( - const std::string& promotion_id, - const ledger::type::Result result, - const std::string& captcha_image, - const std::string& hint, - const std::string& captcha_id) { +void RewardsDOMHandler::OnClaimPromotion(const std::string& promotion_id, + const ledger::type::Result result, + const std::string& captcha_image, + const std::string& hint, + const std::string& captcha_id) { if (!IsJavascriptAllowed()) { return; } @@ -694,15 +714,15 @@ void RewardsDOMHandler::OnClaimPromotion( CallJavascriptFunction("brave_rewards.claimPromotion", response); } -void RewardsDOMHandler::ClaimPromotion(const base::ListValue* args) { - CHECK_EQ(1U, args->GetSize()); +void RewardsDOMHandler::ClaimPromotion(base::Value::ConstListView args) { + CHECK_EQ(1U, args.size()); if (!rewards_service_) { return; } AllowJavascript(); - const std::string promotion_id = args->GetList()[0].GetString(); + const std::string promotion_id = args[0].GetString(); #if !defined(OS_ANDROID) rewards_service_->ClaimPromotion( @@ -715,9 +735,8 @@ void RewardsDOMHandler::ClaimPromotion(const base::ListValue* args) { #endif } - -void RewardsDOMHandler::AttestPromotion(const base::ListValue *args) { - CHECK_EQ(2U, args->GetSize()); +void RewardsDOMHandler::AttestPromotion(base::Value::ConstListView args) { + CHECK_EQ(2U, args.size()); AllowJavascript(); if (!rewards_service_) { @@ -727,21 +746,18 @@ void RewardsDOMHandler::AttestPromotion(const base::ListValue *args) { return; } - const std::string promotion_id = args->GetList()[0].GetString(); - const std::string solution = args->GetList()[1].GetString(); + const std::string promotion_id = args[0].GetString(); + const std::string solution = args[1].GetString(); rewards_service_->AttestPromotion( - promotion_id, - solution, - base::BindOnce( - &RewardsDOMHandler::OnAttestPromotion, - weak_factory_.GetWeakPtr(), - promotion_id)); + promotion_id, solution, + base::BindOnce(&RewardsDOMHandler::OnAttestPromotion, + weak_factory_.GetWeakPtr(), promotion_id)); } void RewardsDOMHandler::OnAttestPromotion( const std::string& promotion_id, - const ledger::type::Result result, - ledger::type::PromotionPtr promotion) { + const ledger::type::Result result, + ledger::type::PromotionPtr promotion) { if (!IsJavascriptAllowed()) { return; } @@ -770,17 +786,14 @@ void RewardsDOMHandler::OnPromotionFinished( return; } - OnAttestPromotion( - promotion->id, - result, - promotion->Clone()); + OnAttestPromotion(promotion->id, result, promotion->Clone()); } -void RewardsDOMHandler::RecoverWallet(const base::ListValue *args) { - CHECK_EQ(1U, args->GetSize()); +void RewardsDOMHandler::RecoverWallet(base::Value::ConstListView args) { + CHECK_EQ(1U, args.size()); if (rewards_service_) { AllowJavascript(); - const std::string pass_phrase = args->GetList()[0].GetString(); + const std::string pass_phrase = args[0].GetString(); rewards_service_->RecoverWallet(pass_phrase); } } @@ -803,7 +816,7 @@ void RewardsDOMHandler::OnGetReconcileStamp(uint64_t reconcile_stamp) { } } -void RewardsDOMHandler::GetReconcileStamp(const base::ListValue* args) { +void RewardsDOMHandler::GetReconcileStamp(base::Value::ConstListView args) { if (rewards_service_) { AllowJavascript(); rewards_service_->GetReconcileStamp(base::BindOnce( @@ -814,9 +827,8 @@ void RewardsDOMHandler::GetReconcileStamp(const base::ListValue* args) { void RewardsDOMHandler::OnAutoContributePropsReady( ledger::type::AutoContributePropertiesPtr properties) { auto filter = ledger::type::ActivityInfoFilter::New(); - auto pair = ledger::type::ActivityInfoFilterOrderPair::New( - "ai.percent", - false); + auto pair = + ledger::type::ActivityInfoFilterOrderPair::New("ai.percent", false); filter->order_by.push_back(std::move(pair)); filter->min_duration = properties->contribution_min_time; filter->reconcile_stamp = properties->reconcile_stamp; @@ -831,7 +843,7 @@ void RewardsDOMHandler::OnAutoContributePropsReady( weak_factory_.GetWeakPtr())); } -void RewardsDOMHandler::GetExcludedSites(const base::ListValue* args) { +void RewardsDOMHandler::GetExcludedSites(base::Value::ConstListView args) { AllowJavascript(); rewards_service_->GetExcludedList(base::BindOnce( &RewardsDOMHandler::OnExcludedSiteList, weak_factory_.GetWeakPtr())); @@ -884,13 +896,13 @@ void RewardsDOMHandler::OnGetAllNotifications( const brave_rewards::RewardsNotificationService::RewardsNotificationsList& notifications_list) {} -void RewardsDOMHandler::SaveSetting(const base::ListValue* args) { - CHECK_EQ(2U, args->GetSize()); +void RewardsDOMHandler::SaveSetting(base::Value::ConstListView args) { + CHECK_EQ(2U, args.size()); AllowJavascript(); if (rewards_service_) { - const std::string key = args->GetList()[0].GetString(); - const std::string value = args->GetList()[1].GetString(); + const std::string key = args[0].GetString(); + const std::string value = args[1].GetString(); if (key == "contributionMonthly") { rewards_service_->SetAutoContributionAmount(std::stod(value)); @@ -930,18 +942,18 @@ void RewardsDOMHandler::SaveSetting(const base::ListValue* args) { } } -void RewardsDOMHandler::ExcludePublisher(const base::ListValue *args) { - CHECK_EQ(1U, args->GetSize()); +void RewardsDOMHandler::ExcludePublisher(base::Value::ConstListView args) { + CHECK_EQ(1U, args.size()); if (!rewards_service_) { return; } AllowJavascript(); - const std::string publisherKey = args->GetList()[0].GetString(); + const std::string publisherKey = args[0].GetString(); rewards_service_->SetPublisherExclude(publisherKey, true); } -void RewardsDOMHandler::RestorePublishers(const base::ListValue *args) { +void RewardsDOMHandler::RestorePublishers(base::Value::ConstListView args) { if (!rewards_service_) { return; } @@ -950,14 +962,14 @@ void RewardsDOMHandler::RestorePublishers(const base::ListValue *args) { rewards_service_->RestorePublishers(); } -void RewardsDOMHandler::RestorePublisher(const base::ListValue *args) { - CHECK_EQ(1U, args->GetSize()); +void RewardsDOMHandler::RestorePublisher(base::Value::ConstListView args) { + CHECK_EQ(1U, args.size()); if (!rewards_service_) { return; } AllowJavascript(); - std::string publisherKey = args->GetList()[0].GetString(); + std::string publisherKey = args[0].GetString(); rewards_service_->SetPublisherExclude(publisherKey, false); } @@ -1012,7 +1024,8 @@ void RewardsDOMHandler::OnGetContributionAmount(double amount) { } } -void RewardsDOMHandler::GetAutoContributionAmount(const base::ListValue* args) { +void RewardsDOMHandler::GetAutoContributionAmount( + base::Value::ConstListView args) { if (rewards_service_) { AllowJavascript(); rewards_service_->GetAutoContributionAmount( @@ -1039,22 +1052,20 @@ void RewardsDOMHandler::OnReconcileComplete( CallJavascriptFunction("brave_rewards.reconcileComplete", complete); } -void RewardsDOMHandler::RemoveRecurringTip(const base::ListValue *args) { - CHECK_EQ(1U, args->GetSize()); +void RewardsDOMHandler::RemoveRecurringTip(base::Value::ConstListView args) { + CHECK_EQ(1U, args.size()); if (rewards_service_) { AllowJavascript(); - const std::string publisherKey = args->GetList()[0].GetString(); + const std::string publisherKey = args[0].GetString(); rewards_service_->RemoveRecurringTip(publisherKey); } } -void RewardsDOMHandler::GetRecurringTips( - const base::ListValue *args) { +void RewardsDOMHandler::GetRecurringTips(base::Value::ConstListView args) { if (rewards_service_) { AllowJavascript(); rewards_service_->GetRecurringTips(base::BindOnce( - &RewardsDOMHandler::OnGetRecurringTips, - weak_factory_.GetWeakPtr())); + &RewardsDOMHandler::OnGetRecurringTips, weak_factory_.GetWeakPtr())); } } @@ -1107,16 +1118,15 @@ void RewardsDOMHandler::OnGetOneTimeTips(ledger::type::PublisherInfoList list) { CallJavascriptFunction("brave_rewards.currentTips", *publishers); } -void RewardsDOMHandler::GetOneTimeTips(const base::ListValue *args) { +void RewardsDOMHandler::GetOneTimeTips(base::Value::ConstListView args) { if (rewards_service_) { AllowJavascript(); rewards_service_->GetOneTimeTips(base::BindOnce( - &RewardsDOMHandler::OnGetOneTimeTips, - weak_factory_.GetWeakPtr())); + &RewardsDOMHandler::OnGetOneTimeTips, weak_factory_.GetWeakPtr())); } } -void RewardsDOMHandler::GetContributionList(const base::ListValue *args) { +void RewardsDOMHandler::GetContributionList(base::Value::ConstListView args) { if (!rewards_service_) { return; } @@ -1128,7 +1138,7 @@ void RewardsDOMHandler::GetContributionList(const base::ListValue *args) { weak_factory_.GetWeakPtr())); } -void RewardsDOMHandler::GetAdsData(const base::ListValue *args) { +void RewardsDOMHandler::GetAdsData(base::Value::ConstListView args) { if (!ads_service_) { return; } @@ -1153,19 +1163,19 @@ void RewardsDOMHandler::GetAdsData(const base::ListValue *args) { const std::string auto_detected_subdivision_targeting_code = ads_service_->GetAutoDetectedAdsSubdivisionTargetingCode(); ads_data.SetString(kAutoDetectedAdsSubdivisionTargeting, - auto_detected_subdivision_targeting_code); + auto_detected_subdivision_targeting_code); const bool should_allow_subdivision_ad_targeting = ads_service_->ShouldAllowAdsSubdivisionTargeting(); ads_data.SetBoolean(kShouldAllowAdsSubdivisionTargeting, - should_allow_subdivision_ad_targeting); + should_allow_subdivision_ad_targeting); ads_data.SetBoolean("adsUIEnabled", true); CallJavascriptFunction("brave_rewards.adsData", ads_data); } -void RewardsDOMHandler::GetAdsHistory(const base::ListValue* args) { +void RewardsDOMHandler::GetAdsHistory(base::Value::ConstListView args) { if (!ads_service_) { return; } @@ -1175,14 +1185,15 @@ void RewardsDOMHandler::GetAdsHistory(const base::ListValue* args) { const base::Time to_time = base::Time::Now(); const uint64_t to_timestamp = to_time.ToDoubleT(); - const base::Time from_time = to_time - - base::TimeDelta::FromDays(kDaysOfAdsHistory - 1); + const base::Time from_time = + to_time - base::TimeDelta::FromDays(kDaysOfAdsHistory - 1); const base::Time from_time_local_midnight = from_time.LocalMidnight(); const uint64_t from_timestamp = from_time_local_midnight.ToDoubleT(); - ads_service_->GetAdsHistory(from_timestamp, to_timestamp, + ads_service_->GetAdsHistory( + from_timestamp, to_timestamp, base::BindOnce(&RewardsDOMHandler::OnGetAdsHistory, - weak_factory_.GetWeakPtr())); + weak_factory_.GetWeakPtr())); } void RewardsDOMHandler::OnGetAdsHistory(const base::ListValue& ads_history) { @@ -1193,17 +1204,17 @@ void RewardsDOMHandler::OnGetAdsHistory(const base::ListValue& ads_history) { CallJavascriptFunction("brave_rewards.adsHistory", ads_history); } -void RewardsDOMHandler::ToggleAdThumbUp(const base::ListValue* args) { - CHECK_EQ(3U, args->GetSize()); +void RewardsDOMHandler::ToggleAdThumbUp(base::Value::ConstListView args) { + CHECK_EQ(3U, args.size()); if (!ads_service_) { return; } AllowJavascript(); - const std::string id = args->GetList()[0].GetString(); - const std::string creative_set_id = args->GetList()[1].GetString(); - const int action = args->GetList()[2].GetInt(); + const std::string id = args[0].GetString(); + const std::string creative_set_id = args[1].GetString(); + const int action = args[2].GetInt(); ads_service_->ToggleAdThumbUp( id, creative_set_id, action, base::BindOnce(&RewardsDOMHandler::OnToggleAdThumbUp, @@ -1223,17 +1234,17 @@ void RewardsDOMHandler::OnToggleAdThumbUp( CallJavascriptFunction("brave_rewards.onToggleAdThumbUp", result); } -void RewardsDOMHandler::ToggleAdThumbDown(const base::ListValue* args) { - CHECK_EQ(3U, args->GetSize()); +void RewardsDOMHandler::ToggleAdThumbDown(base::Value::ConstListView args) { + CHECK_EQ(3U, args.size()); if (!ads_service_) { return; } AllowJavascript(); - const std::string id = args->GetList()[0].GetString(); - const std::string creative_set_id = args->GetList()[1].GetString(); - const int action = args->GetList()[2].GetInt(); + const std::string id = args[0].GetString(); + const std::string creative_set_id = args[1].GetString(); + const int action = args[2].GetInt(); ads_service_->ToggleAdThumbDown( id, creative_set_id, action, base::BindOnce(&RewardsDOMHandler::OnToggleAdThumbDown, @@ -1253,16 +1264,16 @@ void RewardsDOMHandler::OnToggleAdThumbDown( CallJavascriptFunction("brave_rewards.onToggleAdThumbDown", result); } -void RewardsDOMHandler::ToggleAdOptInAction(const base::ListValue* args) { - CHECK_EQ(2U, args->GetSize()); +void RewardsDOMHandler::ToggleAdOptInAction(base::Value::ConstListView args) { + CHECK_EQ(2U, args.size()); if (!ads_service_) { return; } AllowJavascript(); - const std::string category = args->GetList()[0].GetString(); - const int action = args->GetList()[1].GetInt(); + const std::string category = args[0].GetString(); + const int action = args[1].GetInt(); ads_service_->ToggleAdOptInAction( category, action, base::BindOnce(&RewardsDOMHandler::OnToggleAdOptInAction, @@ -1281,16 +1292,16 @@ void RewardsDOMHandler::OnToggleAdOptInAction(const std::string& category, CallJavascriptFunction("brave_rewards.onToggleAdOptInAction", result); } -void RewardsDOMHandler::ToggleAdOptOutAction(const base::ListValue* args) { - CHECK_EQ(2U, args->GetSize()); +void RewardsDOMHandler::ToggleAdOptOutAction(base::Value::ConstListView args) { + CHECK_EQ(2U, args.size()); if (!ads_service_) { return; } AllowJavascript(); - const std::string category = args->GetList()[0].GetString(); - const int action = args->GetList()[1].GetInt(); + const std::string category = args[0].GetString(); + const int action = args[1].GetInt(); ads_service_->ToggleAdOptOutAction( category, action, base::BindOnce(&RewardsDOMHandler::OnToggleAdOptOutAction, @@ -1309,25 +1320,24 @@ void RewardsDOMHandler::OnToggleAdOptOutAction(const std::string& category, CallJavascriptFunction("brave_rewards.onToggleAdOptOutAction", result); } -void RewardsDOMHandler::ToggleSaveAd(const base::ListValue* args) { - CHECK_EQ(3U, args->GetSize()); +void RewardsDOMHandler::ToggleSaveAd(base::Value::ConstListView args) { + CHECK_EQ(3U, args.size()); if (!ads_service_) { return; } AllowJavascript(); - const std::string creative_instance_id = args->GetList()[0].GetString(); - const std::string creative_set_id = args->GetList()[1].GetString(); - const bool saved = args->GetList()[2].GetBool(); + const std::string creative_instance_id = args[0].GetString(); + const std::string creative_set_id = args[1].GetString(); + const bool saved = args[2].GetBool(); ads_service_->ToggleSaveAd(creative_instance_id, creative_set_id, saved, - base::BindOnce(&RewardsDOMHandler::OnToggleSaveAd, - weak_factory_.GetWeakPtr())); + base::BindOnce(&RewardsDOMHandler::OnToggleSaveAd, + weak_factory_.GetWeakPtr())); } -void RewardsDOMHandler::OnToggleSaveAd( - const std::string& creative_instance_id, - bool saved) { +void RewardsDOMHandler::OnToggleSaveAd(const std::string& creative_instance_id, + bool saved) { if (!IsJavascriptAllowed()) { return; } @@ -1338,24 +1348,24 @@ void RewardsDOMHandler::OnToggleSaveAd( CallJavascriptFunction("brave_rewards.onToggleSaveAd", result); } -void RewardsDOMHandler::ToggleFlagAd(const base::ListValue* args) { - CHECK_EQ(3U, args->GetSize()); +void RewardsDOMHandler::ToggleFlagAd(base::Value::ConstListView args) { + CHECK_EQ(3U, args.size()); if (!ads_service_) { return; } AllowJavascript(); - const std::string creative_instance_id = args->GetList()[0].GetString(); - const std::string creative_set_id = args->GetList()[1].GetString(); - const bool flagged = args->GetList()[2].GetBool(); + const std::string creative_instance_id = args[0].GetString(); + const std::string creative_set_id = args[1].GetString(); + const bool flagged = args[2].GetBool(); ads_service_->ToggleFlagAd(creative_instance_id, creative_set_id, flagged, - base::BindOnce(&RewardsDOMHandler::OnToggleFlagAd, - weak_factory_.GetWeakPtr())); + base::BindOnce(&RewardsDOMHandler::OnToggleFlagAd, + weak_factory_.GetWeakPtr())); } -void RewardsDOMHandler::OnToggleFlagAd( - const std::string& creative_instance_id, bool flagged) { +void RewardsDOMHandler::OnToggleFlagAd(const std::string& creative_instance_id, + bool flagged) { if (!IsJavascriptAllowed()) { return; } @@ -1366,16 +1376,16 @@ void RewardsDOMHandler::OnToggleFlagAd( CallJavascriptFunction("brave_rewards.onToggleFlagAd", result); } -void RewardsDOMHandler::SaveAdsSetting(const base::ListValue* args) { - CHECK_EQ(2U, args->GetSize()); +void RewardsDOMHandler::SaveAdsSetting(base::Value::ConstListView args) { + CHECK_EQ(2U, args.size()); if (!ads_service_) { return; } AllowJavascript(); - const std::string key = args->GetList()[0].GetString(); - const std::string value = args->GetList()[1].GetString(); + const std::string key = args[0].GetString(); + const std::string value = args[1].GetString(); if (key == "adsEnabled") { const auto is_enabled = @@ -1389,11 +1399,10 @@ void RewardsDOMHandler::SaveAdsSetting(const base::ListValue* args) { ads_service_->SetAutoDetectedAdsSubdivisionTargetingCode(value); } - base::ListValue* emptyArgs = nullptr; - GetAdsData(emptyArgs); + GetAdsData(base::Value::ConstListView()); } -void RewardsDOMHandler::SetBackupCompleted(const base::ListValue *args) { +void RewardsDOMHandler::SetBackupCompleted(base::Value::ConstListView args) { if (rewards_service_) { AllowJavascript(); rewards_service_->SetBackupCompleted(); @@ -1401,7 +1410,7 @@ void RewardsDOMHandler::SetBackupCompleted(const base::ListValue *args) { } void RewardsDOMHandler::GetPendingContributionsTotal( - const base::ListValue* args) { + base::Value::ConstListView args) { if (rewards_service_) { AllowJavascript(); rewards_service_->GetPendingContributionsTotal( @@ -1433,8 +1442,7 @@ void RewardsDOMHandler::OnPublisherListNormalized( OnPublisherList(std::move(list)); } -void RewardsDOMHandler::GetStatement( - const base::ListValue* args) { +void RewardsDOMHandler::GetStatement(base::Value::ConstListView args) { AllowJavascript(); ads_service_->GetAccountStatement(base::BindOnce( &RewardsDOMHandler::OnGetStatement, weak_factory_.GetWeakPtr())); @@ -1496,7 +1504,7 @@ void RewardsDOMHandler::OnRecurringTipRemoved( } void RewardsDOMHandler::GetEnabledInlineTippingPlatforms( - const base::ListValue* args) { + base::Value::ConstListView args) { AllowJavascript(); // TODO(zenparsing): Consider using a PrefChangeRegistrar to monitor changes @@ -1518,14 +1526,11 @@ void RewardsDOMHandler::GetEnabledInlineTippingPlatforms( } void RewardsDOMHandler::SetInlineTippingPlatformEnabled( - const base::ListValue* args) { + base::Value::ConstListView args) { AllowJavascript(); - std::string key; - args->GetString(0, &key); - - std::string value; - args->GetString(1, &value); + std::string key = args[0].GetString(); + std::string value = args[1].GetString(); if (rewards_service_) { rewards_service_->SetInlineTippingPlatformEnabled(key, value == "true"); @@ -1533,7 +1538,7 @@ void RewardsDOMHandler::SetInlineTippingPlatformEnabled( } void RewardsDOMHandler::GetPendingContributions( - const base::ListValue* args) { + base::Value::ConstListView args) { if (rewards_service_) { AllowJavascript(); rewards_service_->GetPendingContributions( @@ -1554,19 +1559,18 @@ void RewardsDOMHandler::OnGetPendingContributions( std::make_unique(base::Value::Type::DICTIONARY); contribution->SetKey("id", base::Value(static_cast(item->id))); contribution->SetKey("publisherKey", base::Value(item->publisher_key)); - contribution->SetKey("status", - base::Value(static_cast(item->status))); + contribution->SetKey("status", base::Value(static_cast(item->status))); contribution->SetKey("name", base::Value(item->name)); contribution->SetKey("provider", base::Value(item->provider)); contribution->SetKey("url", base::Value(item->url)); contribution->SetKey("favIcon", base::Value(item->favicon_url)); contribution->SetKey("amount", base::Value(item->amount)); contribution->SetKey("addedDate", - base::Value(std::to_string(item->added_date))); + base::Value(std::to_string(item->added_date))); contribution->SetKey("type", base::Value(static_cast(item->type))); contribution->SetKey("viewingId", base::Value(item->viewing_id)); contribution->SetKey("expirationDate", - base::Value(std::to_string(item->expiration_date))); + base::Value(std::to_string(item->expiration_date))); contributions->Append(std::move(contribution)); } @@ -1574,20 +1578,20 @@ void RewardsDOMHandler::OnGetPendingContributions( } void RewardsDOMHandler::RemovePendingContribution( - const base::ListValue* args) { - CHECK_EQ(1U, args->GetSize()); + base::Value::ConstListView args) { + CHECK_EQ(1U, args.size()); if (!rewards_service_) { return; } AllowJavascript(); - const uint64_t id = args->GetList()[0].GetInt(); + const uint64_t id = args[0].GetInt(); rewards_service_->RemovePendingContribution(id); } void RewardsDOMHandler::RemoveAllPendingContributions( - const base::ListValue* args) { + base::Value::ConstListView args) { if (rewards_service_) { AllowJavascript(); rewards_service_->RemoveAllPendingContributions(); @@ -1603,9 +1607,8 @@ void RewardsDOMHandler::OnPendingContributionRemoved( } } -void RewardsDOMHandler::OnFetchBalance( - const ledger::type::Result result, - ledger::type::BalancePtr balance) { +void RewardsDOMHandler::OnFetchBalance(const ledger::type::Result result, + ledger::type::BalancePtr balance) { if (!IsJavascriptAllowed()) { return; } @@ -1632,16 +1635,15 @@ void RewardsDOMHandler::OnFetchBalance( CallJavascriptFunction("brave_rewards.balance", data); } -void RewardsDOMHandler::FetchBalance(const base::ListValue* args) { +void RewardsDOMHandler::FetchBalance(base::Value::ConstListView args) { if (rewards_service_) { AllowJavascript(); rewards_service_->FetchBalance(base::BindOnce( - &RewardsDOMHandler::OnFetchBalance, - weak_factory_.GetWeakPtr())); + &RewardsDOMHandler::OnFetchBalance, weak_factory_.GetWeakPtr())); } } -void RewardsDOMHandler::GetExternalWallet(const base::ListValue* args) { +void RewardsDOMHandler::GetExternalWallet(base::Value::ConstListView args) { if (!rewards_service_) { return; } @@ -1700,23 +1702,22 @@ void RewardsDOMHandler::OnProcessRewardsPageUrl( CallJavascriptFunction("brave_rewards.processRewardsPageUrl", data); } -void RewardsDOMHandler::ProcessRewardsPageUrl(const base::ListValue* args) { - CHECK_EQ(2U, args->GetSize()); +void RewardsDOMHandler::ProcessRewardsPageUrl(base::Value::ConstListView args) { + CHECK_EQ(2U, args.size()); if (!rewards_service_) { return; } AllowJavascript(); - const std::string path = args->GetList()[0].GetString(); - const std::string query = args->GetList()[1].GetString(); + const std::string path = args[0].GetString(); + const std::string query = args[1].GetString(); rewards_service_->ProcessRewardsPageUrl( - path, - query, + path, query, base::BindOnce(&RewardsDOMHandler::OnProcessRewardsPageUrl, weak_factory_.GetWeakPtr())); } -void RewardsDOMHandler::DisconnectWallet(const base::ListValue* args) { +void RewardsDOMHandler::DisconnectWallet(base::Value::ConstListView args) { if (!rewards_service_) { return; } @@ -1725,9 +1726,9 @@ void RewardsDOMHandler::DisconnectWallet(const base::ListValue* args) { } void RewardsDOMHandler::OnDisconnectWallet( - brave_rewards::RewardsService* rewards_service, - const ledger::type::Result result, - const std::string& wallet_type) { + brave_rewards::RewardsService* rewards_service, + const ledger::type::Result result, + const std::string& wallet_type) { base::Value data(base::Value::Type::DICTIONARY); data.SetIntKey("result", static_cast(result)); data.SetStringKey("walletType", wallet_type); @@ -1742,10 +1743,9 @@ void RewardsDOMHandler::OnAdsEnabled( return; } - base::ListValue* emptyArgs = nullptr; - GetAdsData(emptyArgs); - GetAutoContributeProperties(emptyArgs); - GetOnboardingStatus(emptyArgs); + GetAdsData(base::Value::ConstListView()); + GetAutoContributeProperties(base::Value::ConstListView()); + GetOnboardingStatus(base::Value::ConstListView()); } void RewardsDOMHandler::OnUnblindedTokensReady( @@ -1789,23 +1789,20 @@ void RewardsDOMHandler::OnGetBalanceReport( CallJavascriptFunction("brave_rewards.balanceReport", data); } -void RewardsDOMHandler::GetBalanceReport(const base::ListValue* args) { - CHECK_EQ(2U, args->GetSize()); +void RewardsDOMHandler::GetBalanceReport(base::Value::ConstListView args) { + CHECK_EQ(2U, args.size()); if (!rewards_service_) { return; } AllowJavascript(); - const uint32_t month = args->GetList()[0].GetInt(); - const uint32_t year = args->GetList()[1].GetInt(); + const uint32_t month = args[0].GetInt(); + const uint32_t year = args[1].GetInt(); rewards_service_->GetBalanceReport( - month, - year, + month, year, base::BindOnce(&RewardsDOMHandler::OnGetBalanceReport, - weak_factory_.GetWeakPtr(), - month, - year)); + weak_factory_.GetWeakPtr(), month, year)); } void RewardsDOMHandler::OnGetMonthlyReport( @@ -1832,9 +1829,8 @@ void RewardsDOMHandler::OnGetMonthlyReport( base::Value transaction_report(base::Value::Type::DICTIONARY); transaction_report.SetDoubleKey("amount", item->amount); transaction_report.SetIntKey("type", static_cast(item->type)); - transaction_report.SetIntKey( - "processor", - static_cast(item->processor)); + transaction_report.SetIntKey("processor", + static_cast(item->processor)); transaction_report.SetIntKey("created_at", item->created_at); transactions.Append(std::move(transaction_report)); @@ -1860,9 +1856,8 @@ void RewardsDOMHandler::OnGetMonthlyReport( base::Value contribution_report(base::Value::Type::DICTIONARY); contribution_report.SetDoubleKey("amount", contribution->amount); contribution_report.SetIntKey("type", static_cast(contribution->type)); - contribution_report.SetIntKey( - "processor", - static_cast(contribution->processor)); + contribution_report.SetIntKey("processor", + static_cast(contribution->processor)); contribution_report.SetIntKey("created_at", contribution->created_at); contribution_report.SetKey("publishers", std::move(publishers)); contributions.Append(std::move(contribution_report)); @@ -1878,24 +1873,21 @@ void RewardsDOMHandler::OnGetMonthlyReport( CallJavascriptFunction("brave_rewards.monthlyReport", data); } -void RewardsDOMHandler::GetMonthlyReport(const base::ListValue* args) { - CHECK_EQ(2U, args->GetSize()); +void RewardsDOMHandler::GetMonthlyReport(base::Value::ConstListView args) { + CHECK_EQ(2U, args.size()); if (!rewards_service_) { return; } AllowJavascript(); - const uint32_t month = args->GetList()[0].GetInt(); - const uint32_t year = args->GetList()[1].GetInt(); + const uint32_t month = args[0].GetInt(); + const uint32_t year = args[1].GetInt(); rewards_service_->GetMonthlyReport( - month, - year, + month, year, base::BindOnce(&RewardsDOMHandler::OnGetMonthlyReport, - weak_factory_.GetWeakPtr(), - month, - year)); + weak_factory_.GetWeakPtr(), month, year)); } void RewardsDOMHandler::OnGetAllMonthlyReportIds( @@ -1908,7 +1900,8 @@ void RewardsDOMHandler::OnGetAllMonthlyReportIds( CallJavascriptFunction("brave_rewards.monthlyReportIds", list); } -void RewardsDOMHandler::GetAllMonthlyReportIds(const base::ListValue* args) { +void RewardsDOMHandler::GetAllMonthlyReportIds( + base::Value::ConstListView args) { if (!rewards_service_) { return; } @@ -1917,10 +1910,10 @@ void RewardsDOMHandler::GetAllMonthlyReportIds(const base::ListValue* args) { rewards_service_->GetAllMonthlyReportIds( base::BindOnce(&RewardsDOMHandler::OnGetAllMonthlyReportIds, - weak_factory_.GetWeakPtr())); + weak_factory_.GetWeakPtr())); } -void RewardsDOMHandler::GetCountryCode(const base::ListValue* args) { +void RewardsDOMHandler::GetCountryCode(base::Value::ConstListView args) { AllowJavascript(); const std::string locale = @@ -1931,7 +1924,7 @@ void RewardsDOMHandler::GetCountryCode(const base::ListValue* args) { base::Value(country_code)); } -void RewardsDOMHandler::CompleteReset(const base::ListValue* args) { +void RewardsDOMHandler::CompleteReset(base::Value::ConstListView args) { if (!rewards_service_) { return; } @@ -1948,7 +1941,7 @@ void RewardsDOMHandler::OnCompleteReset(const bool success) { CallJavascriptFunction("brave_rewards.completeReset", base::Value(success)); } -void RewardsDOMHandler::GetPaymentId(const base::ListValue* args) { +void RewardsDOMHandler::GetPaymentId(base::Value::ConstListView args) { if (!rewards_service_) { return; } @@ -1959,14 +1952,13 @@ void RewardsDOMHandler::GetPaymentId(const base::ListValue* args) { // to retrieve a payment ID. rewards_service_->CreateWallet( base::BindOnce(&RewardsDOMHandler::OnWalletCreatedForPaymentId, - weak_factory_.GetWeakPtr())); + weak_factory_.GetWeakPtr())); } void RewardsDOMHandler::OnWalletCreatedForPaymentId( ledger::type::Result result) { - rewards_service_->GetBraveWallet( - base::BindOnce(&RewardsDOMHandler::OnGetPaymentId, - weak_factory_.GetWeakPtr())); + rewards_service_->GetBraveWallet(base::BindOnce( + &RewardsDOMHandler::OnGetPaymentId, weak_factory_.GetWeakPtr())); } void RewardsDOMHandler::OnGetPaymentId(ledger::type::BraveWalletPtr wallet) { @@ -1982,7 +1974,7 @@ void RewardsDOMHandler::OnGetPaymentId(ledger::type::BraveWalletPtr wallet) { CallJavascriptFunction("brave_rewards.paymentId", base::Value(payment_id)); } -void RewardsDOMHandler::GetWalletPassphrase(const base::ListValue* args) { +void RewardsDOMHandler::GetWalletPassphrase(base::Value::ConstListView args) { if (!rewards_service_) { return; } @@ -2001,7 +1993,7 @@ void RewardsDOMHandler::OnGetWalletPassphrase(const std::string& passphrase) { base::Value(passphrase)); } -void RewardsDOMHandler::GetOnboardingStatus(const base::ListValue* args) { +void RewardsDOMHandler::GetOnboardingStatus(base::Value::ConstListView args) { if (!rewards_service_) { return; } @@ -2011,18 +2003,18 @@ void RewardsDOMHandler::GetOnboardingStatus(const base::ListValue* args) { CallJavascriptFunction("brave_rewards.onboardingStatus", data); } -void RewardsDOMHandler::SaveOnboardingResult(const base::ListValue* args) { - CHECK_EQ(1U, args->GetSize()); +void RewardsDOMHandler::SaveOnboardingResult(base::Value::ConstListView args) { + CHECK_EQ(1U, args.size()); if (!rewards_service_) return; AllowJavascript(); - if (args->GetList()[0].GetString() == "opted-in") + if (args[0].GetString() == "opted-in") rewards_service_->EnableRewards(); } void RewardsDOMHandler::GetExternalWalletProviders( - const base::ListValue* args) { + base::Value::ConstListView args) { if (!rewards_service_) return; @@ -2052,7 +2044,7 @@ BraveRewardsPageUI::BraveRewardsPageUI(content::WebUI* web_ui, #endif /*disable_trusted_types_csp=*/true); auto handler_owner = std::make_unique(); - RewardsDOMHandler * handler = handler_owner.get(); + RewardsDOMHandler* handler = handler_owner.get(); web_ui->AddMessageHandler(std::move(handler_owner)); handler->Init(); } diff --git a/browser/ui/webui/brave_tip_ui.cc b/browser/ui/webui/brave_tip_ui.cc index 5755a156e38e..ecec7097589e 100644 --- a/browser/ui/webui/brave_tip_ui.cc +++ b/browser/ui/webui/brave_tip_ui.cc @@ -52,13 +52,11 @@ class TipMessageHandler : public WebUIMessageHandler, void RegisterMessages() override; // RewardsServiceObserver: - void OnRecurringTipSaved( - RewardsService* rewards_service, - bool success) override; + void OnRecurringTipSaved(RewardsService* rewards_service, + bool success) override; - void OnRecurringTipRemoved( - RewardsService* rewards_service, - bool success) override; + void OnRecurringTipRemoved(RewardsService* rewards_service, + bool success) override; void OnReconcileComplete( RewardsService* rewards_service, @@ -72,21 +70,21 @@ class TipMessageHandler : public WebUIMessageHandler, private: // Message handlers - void DialogReady(const base::ListValue* args); - void GetPublisherBanner(const base::ListValue* args); - void GetRewardsParameters(const base::ListValue* args); - void GetOnboardingStatus(const base::ListValue* args); - void SaveOnboardingResult(const base::ListValue* args); - void OnTip(const base::ListValue* args); - void GetRecurringTips(const base::ListValue* args); - void GetReconcileStamp(const base::ListValue* args); - void GetAutoContributeAmount(const base::ListValue* args); - void SetAutoContributeAmount(const base::ListValue* args); - void GetAdsPerHour(const base::ListValue* args); - void SetAdsPerHour(const base::ListValue* args); - void TweetTip(const base::ListValue* args); - void GetExternalWallet(const base::ListValue* args); - void FetchBalance(const base::ListValue* args); + void DialogReady(base::Value::ConstListView args); + void GetPublisherBanner(base::Value::ConstListView args); + void GetRewardsParameters(base::Value::ConstListView args); + void GetOnboardingStatus(base::Value::ConstListView args); + void SaveOnboardingResult(base::Value::ConstListView args); + void OnTip(base::Value::ConstListView args); + void GetRecurringTips(base::Value::ConstListView args); + void GetReconcileStamp(base::Value::ConstListView args); + void GetAutoContributeAmount(base::Value::ConstListView args); + void SetAutoContributeAmount(base::Value::ConstListView args); + void GetAdsPerHour(base::Value::ConstListView args); + void SetAdsPerHour(base::Value::ConstListView args); + void TweetTip(base::Value::ConstListView args); + void GetExternalWallet(base::Value::ConstListView args); + void FetchBalance(base::Value::ConstListView args); // Rewards service callbacks void OnTipCallback(double amount, ledger::type::Result result); @@ -104,14 +102,13 @@ class TipMessageHandler : public WebUIMessageHandler, void GetShareURLCallback(const std::string& url); - void FetchBalanceCallback( - const ledger::type::Result result, - ledger::type::BalancePtr balance); + void FetchBalanceCallback(const ledger::type::Result result, + ledger::type::BalancePtr balance); void GetRewardsParametersCallback( - ledger::type::RewardsParametersPtr parameters); + ledger::type::RewardsParametersPtr parameters); - RewardsService* rewards_service_ = nullptr; // NOT OWNED + RewardsService* rewards_service_ = nullptr; // NOT OWNED brave_ads::AdsService* ads_service_ = nullptr; // NOT OWNED base::WeakPtrFactory weak_factory_{this}; }; @@ -126,52 +123,42 @@ TipMessageHandler::~TipMessageHandler() { void TipMessageHandler::RegisterMessages() { web_ui()->RegisterMessageCallback( - "dialogReady", - base::BindRepeating( - &TipMessageHandler::DialogReady, - base::Unretained(this))); + "dialogReady", base::BindRepeating(&TipMessageHandler::DialogReady, + base::Unretained(this))); web_ui()->RegisterMessageCallback( "getPublisherBanner", - base::BindRepeating( - &TipMessageHandler::GetPublisherBanner, - base::Unretained(this))); + base::BindRepeating(&TipMessageHandler::GetPublisherBanner, + base::Unretained(this))); web_ui()->RegisterMessageCallback( "getRewardsParameters", - base::BindRepeating( - &TipMessageHandler::GetRewardsParameters, - base::Unretained(this))); + base::BindRepeating(&TipMessageHandler::GetRewardsParameters, + base::Unretained(this))); web_ui()->RegisterMessageCallback( "getOnboardingStatus", - base::BindRepeating( - &TipMessageHandler::GetOnboardingStatus, - base::Unretained(this))); + base::BindRepeating(&TipMessageHandler::GetOnboardingStatus, + base::Unretained(this))); web_ui()->RegisterMessageCallback( "saveOnboardingResult", - base::BindRepeating( - &TipMessageHandler::SaveOnboardingResult, - base::Unretained(this))); + base::BindRepeating(&TipMessageHandler::SaveOnboardingResult, + base::Unretained(this))); web_ui()->RegisterMessageCallback( "onTip", - base::BindRepeating( - &TipMessageHandler::OnTip, - base::Unretained(this))); + base::BindRepeating(&TipMessageHandler::OnTip, base::Unretained(this))); web_ui()->RegisterMessageCallback( "getRecurringTips", - base::BindRepeating( - &TipMessageHandler::GetRecurringTips, - base::Unretained(this))); + base::BindRepeating(&TipMessageHandler::GetRecurringTips, + base::Unretained(this))); web_ui()->RegisterMessageCallback( "getReconcileStamp", - base::BindRepeating( - &TipMessageHandler::GetReconcileStamp, - base::Unretained(this))); + base::BindRepeating(&TipMessageHandler::GetReconcileStamp, + base::Unretained(this))); web_ui()->RegisterMessageCallback( "getAutoContributeAmount", @@ -192,27 +179,21 @@ void TipMessageHandler::RegisterMessages() { base::Unretained(this))); web_ui()->RegisterMessageCallback( - "tweetTip", - base::BindRepeating( - &TipMessageHandler::TweetTip, - base::Unretained(this))); + "tweetTip", base::BindRepeating(&TipMessageHandler::TweetTip, + base::Unretained(this))); web_ui()->RegisterMessageCallback( - "fetchBalance", - base::BindRepeating( - &TipMessageHandler::FetchBalance, - base::Unretained(this))); + "fetchBalance", base::BindRepeating(&TipMessageHandler::FetchBalance, + base::Unretained(this))); web_ui()->RegisterMessageCallback( "getExternalWallet", - base::BindRepeating( - &TipMessageHandler::GetExternalWallet, - base::Unretained(this))); + base::BindRepeating(&TipMessageHandler::GetExternalWallet, + base::Unretained(this))); } -void TipMessageHandler::OnRecurringTipRemoved( - RewardsService* rewards_service, - bool success) { +void TipMessageHandler::OnRecurringTipRemoved(RewardsService* rewards_service, + bool success) { if (!IsJavascriptAllowed()) { return; } @@ -220,9 +201,8 @@ void TipMessageHandler::OnRecurringTipRemoved( FireWebUIListener("recurringTipRemoved", base::Value(success)); } -void TipMessageHandler::OnRecurringTipSaved( - RewardsService* rewards_service, - bool success) { +void TipMessageHandler::OnRecurringTipSaved(RewardsService* rewards_service, + bool success) { if (!IsJavascriptAllowed()) { return; } @@ -257,7 +237,7 @@ void TipMessageHandler::OnUnblindedTokensReady( FireWebUIListener("unblindedTokensReady"); } -void TipMessageHandler::DialogReady(const base::ListValue* args) { +void TipMessageHandler::DialogReady(base::Value::ConstListView args) { Profile* profile = Profile::FromWebUI(web_ui()); if (!rewards_service_) { @@ -277,9 +257,9 @@ void TipMessageHandler::DialogReady(const base::ListValue* args) { } } -void TipMessageHandler::GetPublisherBanner(const base::ListValue* args) { - CHECK_EQ(1U, args->GetSize()); - const std::string publisher_key = args->GetList()[0].GetString(); +void TipMessageHandler::GetPublisherBanner(base::Value::ConstListView args) { + CHECK_EQ(1U, args.size()); + const std::string publisher_key = args[0].GetString(); if (publisher_key.empty() || !rewards_service_) { return; @@ -291,7 +271,7 @@ void TipMessageHandler::GetPublisherBanner(const base::ListValue* args) { weak_factory_.GetWeakPtr())); } -void TipMessageHandler::GetRewardsParameters(const base::ListValue* args) { +void TipMessageHandler::GetRewardsParameters(base::Value::ConstListView args) { if (!rewards_service_) { return; } @@ -301,7 +281,7 @@ void TipMessageHandler::GetRewardsParameters(const base::ListValue* args) { weak_factory_.GetWeakPtr())); } -void TipMessageHandler::GetOnboardingStatus(const base::ListValue* args) { +void TipMessageHandler::GetOnboardingStatus(base::Value::ConstListView args) { if (!rewards_service_) { return; } @@ -311,20 +291,20 @@ void TipMessageHandler::GetOnboardingStatus(const base::ListValue* args) { FireWebUIListener("onboardingStatusUpdated", data); } -void TipMessageHandler::SaveOnboardingResult(const base::ListValue* args) { - CHECK_EQ(1U, args->GetSize()); +void TipMessageHandler::SaveOnboardingResult(base::Value::ConstListView args) { + CHECK_EQ(1U, args.size()); if (!rewards_service_) return; - if (args->GetList()[0].GetString() == "opted-in") + if (args[0].GetString() == "opted-in") rewards_service_->EnableRewards(); } -void TipMessageHandler::OnTip(const base::ListValue* args) { - CHECK_EQ(3U, args->GetSize()); - const std::string publisher_key = args->GetList()[0].GetString(); - const double amount = args->GetList()[1].GetDouble(); - const bool recurring = args->GetList()[2].GetBool(); +void TipMessageHandler::OnTip(base::Value::ConstListView args) { + CHECK_EQ(3U, args.size()); + const std::string publisher_key = args[0].GetString(); + const double amount = args[1].GetDouble(); + const bool recurring = args[2].GetBool(); if (publisher_key.empty() || !rewards_service_) { return; @@ -339,7 +319,7 @@ void TipMessageHandler::OnTip(const base::ListValue* args) { } } -void TipMessageHandler::GetReconcileStamp(const base::ListValue* args) { +void TipMessageHandler::GetReconcileStamp(base::Value::ConstListView args) { if (!rewards_service_) { return; } @@ -349,7 +329,8 @@ void TipMessageHandler::GetReconcileStamp(const base::ListValue* args) { weak_factory_.GetWeakPtr())); } -void TipMessageHandler::GetAutoContributeAmount(const base::ListValue* args) { +void TipMessageHandler::GetAutoContributeAmount( + base::Value::ConstListView args) { if (!rewards_service_) { return; } @@ -359,9 +340,10 @@ void TipMessageHandler::GetAutoContributeAmount(const base::ListValue* args) { weak_factory_.GetWeakPtr())); } -void TipMessageHandler::SetAutoContributeAmount(const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 1U); - double amount = args->GetList()[0].GetDouble(); +void TipMessageHandler::SetAutoContributeAmount( + base::Value::ConstListView args) { + CHECK_EQ(args.size(), 1U); + double amount = args[0].GetDouble(); if (!rewards_service_ || amount < 0) { return; } @@ -370,7 +352,7 @@ void TipMessageHandler::SetAutoContributeAmount(const base::ListValue* args) { FireWebUIListener("autoContributeAmountUpdated", base::Value(amount)); } -void TipMessageHandler::GetAdsPerHour(const base::ListValue* args) { +void TipMessageHandler::GetAdsPerHour(base::Value::ConstListView args) { if (!ads_service_) { return; } @@ -379,9 +361,9 @@ void TipMessageHandler::GetAdsPerHour(const base::ListValue* args) { FireWebUIListener("adsPerHourUpdated", base::Value(adsPerHour)); } -void TipMessageHandler::SetAdsPerHour(const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 1U); - const double adsPerHour = args->GetList()[0].GetDouble(); +void TipMessageHandler::SetAdsPerHour(base::Value::ConstListView args) { + CHECK_EQ(args.size(), 1U); + const double adsPerHour = args[0].GetDouble(); if (!ads_service_ || adsPerHour < 0) { return; } @@ -390,18 +372,17 @@ void TipMessageHandler::SetAdsPerHour(const base::ListValue* args) { FireWebUIListener("adsPerHourUpdated", base::Value(adsPerHour)); } -void TipMessageHandler::TweetTip(const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 2U); - const std::string name = args->GetList()[0].GetString(); - const std::string tweet_id = args->GetList()[1].GetString(); +void TipMessageHandler::TweetTip(base::Value::ConstListView args) { + CHECK_EQ(args.size(), 2U); + const std::string name = args[0].GetString(); + const std::string tweet_id = args[1].GetString(); if (name.empty() || !rewards_service_) { return; } const std::string comment = l10n_util::GetStringFUTF8( - IDS_BRAVE_REWARDS_LOCAL_COMPLIMENT_TWEET, - base::UTF8ToUTF16(name)); + IDS_BRAVE_REWARDS_LOCAL_COMPLIMENT_TWEET, base::UTF8ToUTF16(name)); const std::string hashtag = l10n_util::GetStringUTF8( IDS_BRAVE_REWARDS_LOCAL_COMPLIMENT_TWEET_HASHTAG); @@ -417,16 +398,15 @@ void TipMessageHandler::TweetTip(const base::ListValue* args) { weak_factory_.GetWeakPtr())); } -void TipMessageHandler::FetchBalance(const base::ListValue* args) { +void TipMessageHandler::FetchBalance(base::Value::ConstListView args) { if (!rewards_service_) { return; } rewards_service_->FetchBalance(base::BindOnce( - &TipMessageHandler::FetchBalanceCallback, - weak_factory_.GetWeakPtr())); + &TipMessageHandler::FetchBalanceCallback, weak_factory_.GetWeakPtr())); } -void TipMessageHandler::GetExternalWallet(const base::ListValue* args) { +void TipMessageHandler::GetExternalWallet(base::Value::ConstListView args) { if (!rewards_service_) { return; } @@ -435,13 +415,13 @@ void TipMessageHandler::GetExternalWallet(const base::ListValue* args) { weak_factory_.GetWeakPtr())); } -void TipMessageHandler::GetRecurringTips(const base::ListValue* args) { +void TipMessageHandler::GetRecurringTips(base::Value::ConstListView args) { if (!rewards_service_) { return; } - rewards_service_->GetRecurringTips(base::BindOnce( - &TipMessageHandler::GetRecurringTipsCallback, - weak_factory_.GetWeakPtr())); + rewards_service_->GetRecurringTips( + base::BindOnce(&TipMessageHandler::GetRecurringTipsCallback, + weak_factory_.GetWeakPtr())); } void TipMessageHandler::GetRewardsParametersCallback( @@ -563,16 +543,12 @@ void TipMessageHandler::GetShareURLCallback(const std::string& url) { Profile::FromWebUI(web_ui())); browser_displayer.browser()->OpenURL(content::OpenURLParams( - gurl, - content::Referrer(), - WindowOpenDisposition::NEW_FOREGROUND_TAB, - ui::PAGE_TRANSITION_AUTO_TOPLEVEL, - false)); + gurl, content::Referrer(), WindowOpenDisposition::NEW_FOREGROUND_TAB, + ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false)); } -void TipMessageHandler::FetchBalanceCallback( - const ledger::type::Result result, - ledger::type::BalancePtr balance) { +void TipMessageHandler::FetchBalanceCallback(const ledger::type::Result result, + ledger::type::BalancePtr balance) { if (!IsJavascriptAllowed()) { return; } diff --git a/browser/ui/webui/brave_welcome_ui.cc b/browser/ui/webui/brave_welcome_ui.cc index c684cc7efab0..026f50d4c427 100644 --- a/browser/ui/webui/brave_welcome_ui.cc +++ b/browser/ui/webui/brave_welcome_ui.cc @@ -59,16 +59,15 @@ void RecordP3AHistogram(int screen_number, bool finished) { // The handler for Javascript messages for the chrome://welcome page class WelcomeDOMHandler : public WebUIMessageHandler { public: - WelcomeDOMHandler() { - } + WelcomeDOMHandler() {} ~WelcomeDOMHandler() override; // WebUIMessageHandler implementation. void RegisterMessages() override; private: - void HandleImportNowRequested(const base::ListValue* args); - void HandleRecordP3A(const base::ListValue* args); + void HandleImportNowRequested(base::Value::ConstListView args); + void HandleRecordP3A(base::Value::ConstListView args); Browser* GetBrowser(); int screen_number_ = 0; @@ -87,27 +86,27 @@ Browser* WelcomeDOMHandler::GetBrowser() { } void WelcomeDOMHandler::RegisterMessages() { - web_ui()->RegisterMessageCallback("importNowRequested", + web_ui()->RegisterMessageCallback( + "importNowRequested", base::BindRepeating(&WelcomeDOMHandler::HandleImportNowRequested, base::Unretained(this))); - web_ui()->RegisterMessageCallback("recordP3A", - base::BindRepeating(&WelcomeDOMHandler::HandleRecordP3A, - base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "recordP3A", base::BindRepeating(&WelcomeDOMHandler::HandleRecordP3A, + base::Unretained(this))); } -void WelcomeDOMHandler::HandleImportNowRequested(const base::ListValue* args) { +void WelcomeDOMHandler::HandleImportNowRequested( + base::Value::ConstListView args) { chrome::ShowSettingsSubPageInTabbedBrowser(GetBrowser(), - chrome::kImportDataSubPage); + chrome::kImportDataSubPage); } -void WelcomeDOMHandler::HandleRecordP3A(const base::ListValue* args) { - if (!args->GetList()[0].is_int()) - return; - screen_number_ = args->GetList()[0].GetInt(); - if (!args->GetBoolean(1, &finished_)) - return; - if (!args->GetBoolean(2, &skipped_)) +void WelcomeDOMHandler::HandleRecordP3A(base::Value::ConstListView args) { + if (!args[0].is_int() || !args[1].is_bool() || !args[2].is_bool()) return; + screen_number_ = args[0].GetInt(); + finished_ = args[1].GetBool(); + skipped_ = args[2].GetBool(); if (screen_number_) { // It is 1-based on JS side, we want 0-based. @@ -161,5 +160,4 @@ BraveWelcomeUI::BraveWelcomeUI(content::WebUI* web_ui, const std::string& name) profile->GetPrefs()->SetBoolean(prefs::kHasSeenWelcomePage, true); } -BraveWelcomeUI::~BraveWelcomeUI() { -} +BraveWelcomeUI::~BraveWelcomeUI() {} diff --git a/browser/ui/webui/brave_welcome_ui_browsertest.cc b/browser/ui/webui/brave_welcome_ui_browsertest.cc index d96c6e628e68..987de4e14107 100644 --- a/browser/ui/webui/brave_welcome_ui_browsertest.cc +++ b/browser/ui/webui/brave_welcome_ui_browsertest.cc @@ -26,7 +26,7 @@ Browser* OpenNewBrowser(Profile* profile) { base::CommandLine dummy(base::CommandLine::NO_PROGRAM); StartupBrowserCreatorImpl creator(base::FilePath(), dummy, chrome::startup::IS_FIRST_RUN); - creator.Launch(profile, std::vector(), false, nullptr); + creator.Launch(profile, false, nullptr); return chrome::FindBrowserWithProfile(profile); } } diff --git a/browser/ui/webui/ipfs_ui.cc b/browser/ui/webui/ipfs_ui.cc index bbb446cd9cc4..01c9102b10a6 100644 --- a/browser/ui/webui/ipfs_ui.cc +++ b/browser/ui/webui/ipfs_ui.cc @@ -100,8 +100,8 @@ IPFSUI::IPFSUI(content::WebUI* web_ui, const std::string& name) IPFSUI::~IPFSUI() {} -void IPFSDOMHandler::HandleGetConnectedPeers(const base::ListValue* args) { - DCHECK_EQ(args->GetSize(), 0U); +void IPFSDOMHandler::HandleGetConnectedPeers(base::Value::ConstListView args) { + DCHECK_EQ(args.size(), 0U); if (!web_ui()->CanCallJavascript()) return; @@ -125,8 +125,8 @@ void IPFSDOMHandler::OnGetConnectedPeers( std::move(stats_value)); } -void IPFSDOMHandler::HandleGetAddressesConfig(const base::ListValue* args) { - DCHECK_EQ(args->GetSize(), 0U); +void IPFSDOMHandler::HandleGetAddressesConfig(base::Value::ConstListView args) { + DCHECK_EQ(args.size(), 0U); if (!web_ui()->CanCallJavascript()) return; @@ -157,16 +157,16 @@ void IPFSDOMHandler::OnGetAddressesConfig(bool success, std::move(config_value)); } -void IPFSDOMHandler::HandleGetDaemonStatus(const base::ListValue* args) { - DCHECK_EQ(args->GetSize(), 0U); +void IPFSDOMHandler::HandleGetDaemonStatus(base::Value::ConstListView args) { + DCHECK_EQ(args.size(), 0U); if (!web_ui()->CanCallJavascript()) return; CallOnGetDaemonStatus(web_ui(), std::string()); } -void IPFSDOMHandler::HandleLaunchDaemon(const base::ListValue* args) { - DCHECK_EQ(args->GetSize(), 0U); +void IPFSDOMHandler::HandleLaunchDaemon(base::Value::ConstListView args) { + DCHECK_EQ(args.size(), 0U); if (!web_ui()->CanCallJavascript()) return; LaunchDaemon(); @@ -221,8 +221,8 @@ void IPFSDOMHandler::OnIpfsShutdown() { CallOnGetDaemonStatus(web_ui(), std::string()); } -void IPFSDOMHandler::HandleShutdownDaemon(const base::ListValue* args) { - DCHECK_EQ(args->GetSize(), 0U); +void IPFSDOMHandler::HandleShutdownDaemon(base::Value::ConstListView args) { + DCHECK_EQ(args.size(), 0U); if (!web_ui()->CanCallJavascript()) return; @@ -235,8 +235,8 @@ void IPFSDOMHandler::HandleShutdownDaemon(const base::ListValue* args) { service->ShutdownDaemon(base::NullCallback()); } -void IPFSDOMHandler::HandleRestartDaemon(const base::ListValue* args) { - DCHECK_EQ(args->GetSize(), 0U); +void IPFSDOMHandler::HandleRestartDaemon(base::Value::ConstListView args) { + DCHECK_EQ(args.size(), 0U); if (!web_ui()->CanCallJavascript()) return; @@ -250,8 +250,8 @@ void IPFSDOMHandler::HandleRestartDaemon(const base::ListValue* args) { } } -void IPFSDOMHandler::HandleGetRepoStats(const base::ListValue* args) { - DCHECK_EQ(args->GetSize(), 0U); +void IPFSDOMHandler::HandleGetRepoStats(base::Value::ConstListView args) { + DCHECK_EQ(args.size(), 0U); if (!web_ui()->CanCallJavascript()) return; @@ -281,8 +281,8 @@ void IPFSDOMHandler::OnGetRepoStats(bool success, std::move(stats_value)); } -void IPFSDOMHandler::HandleGetNodeInfo(const base::ListValue* args) { - DCHECK_EQ(args->GetSize(), 0U); +void IPFSDOMHandler::HandleGetNodeInfo(base::Value::ConstListView args) { + DCHECK_EQ(args.size(), 0U); if (!web_ui()->CanCallJavascript()) return; @@ -296,8 +296,8 @@ void IPFSDOMHandler::HandleGetNodeInfo(const base::ListValue* args) { weak_ptr_factory_.GetWeakPtr())); } -void IPFSDOMHandler::HandleGarbageCollection(const base::ListValue* args) { - DCHECK_EQ(args->GetSize(), 0U); +void IPFSDOMHandler::HandleGarbageCollection(base::Value::ConstListView args) { + DCHECK_EQ(args.size(), 0U); if (!web_ui()->CanCallJavascript()) return; diff --git a/browser/ui/webui/ipfs_ui.h b/browser/ui/webui/ipfs_ui.h index b695030a7482..4b8d6e0126ce 100644 --- a/browser/ui/webui/ipfs_ui.h +++ b/browser/ui/webui/ipfs_ui.h @@ -39,23 +39,23 @@ class IPFSDOMHandler : public content::WebUIMessageHandler, void OnInstallationEvent(ipfs::ComponentUpdaterEvents event) override; private: - void HandleGetConnectedPeers(const base::ListValue* args); - void HandleGetAddressesConfig(const base::ListValue* args); + void HandleGetConnectedPeers(base::Value::ConstListView args); + void HandleGetAddressesConfig(base::Value::ConstListView args); void OnGetAddressesConfig(bool success, const ipfs::AddressesConfig& config); - void HandleGetDaemonStatus(const base::ListValue* args); - void HandleLaunchDaemon(const base::ListValue* args); + void HandleGetDaemonStatus(base::Value::ConstListView args); + void HandleLaunchDaemon(base::Value::ConstListView args); void LaunchDaemon(); void OnLaunchDaemon(bool success); - void HandleShutdownDaemon(const base::ListValue* args); - void HandleRestartDaemon(const base::ListValue* args); + void HandleShutdownDaemon(base::Value::ConstListView args); + void HandleRestartDaemon(base::Value::ConstListView args); void OnShutdownDaemon(bool success); - void HandleGetRepoStats(const base::ListValue* args); + void HandleGetRepoStats(base::Value::ConstListView args); void OnGetRepoStats(bool success, const ipfs::RepoStats& stats); - void HandleGetNodeInfo(const base::ListValue* args); + void HandleGetNodeInfo(base::Value::ConstListView args); void OnGetNodeInfo(bool success, const ipfs::NodeInfo& info); - void HandleGarbageCollection(const base::ListValue* args); + void HandleGarbageCollection(base::Value::ConstListView args); void OnGarbageCollection(bool success, const std::string& error); base::ScopedObservation diff --git a/browser/ui/webui/new_tab_page/brave_new_tab_message_handler.cc b/browser/ui/webui/new_tab_page/brave_new_tab_message_handler.cc index b406a23eca59..74a696a168bc 100644 --- a/browser/ui/webui/new_tab_page/brave_new_tab_message_handler.cc +++ b/browser/ui/webui/new_tab_page/brave_new_tab_message_handler.cc @@ -42,11 +42,12 @@ #include "components/prefs/pref_service.h" #include "content/public/browser/web_ui_data_source.h" +using ntp_background_images::ViewCounterServiceFactory; using ntp_background_images::features::kBraveNTPBrandedWallpaper; -using ntp_background_images::prefs::kNewTabPageShowBackgroundImage; -using ntp_background_images::prefs::kNewTabPageShowSponsoredImagesBackgroundImage; // NOLINT using ntp_background_images::prefs::kBrandedWallpaperNotificationDismissed; -using ntp_background_images::ViewCounterServiceFactory; +using ntp_background_images::prefs::kNewTabPageShowBackgroundImage; +using ntp_background_images::prefs:: + kNewTabPageShowSponsoredImagesBackgroundImage; // NOLINT #if BUILDFLAG(CRYPTO_DOT_COM_ENABLED) #include "brave/components/crypto_dot_com/common/pref_names.h" @@ -69,14 +70,12 @@ bool IsPrivateNewTab(Profile* profile) { base::DictionaryValue GetStatsDictionary(PrefService* prefs) { base::DictionaryValue stats_data; stats_data.SetInteger( - "adsBlockedStat", - prefs->GetUint64(kAdsBlocked) + prefs->GetUint64(kTrackersBlocked)); - stats_data.SetInteger( - "javascriptBlockedStat", - prefs->GetUint64(kJavascriptBlocked)); - stats_data.SetInteger( - "fingerprintingBlockedStat", - prefs->GetUint64(kFingerprintingBlocked)); + "adsBlockedStat", + prefs->GetUint64(kAdsBlocked) + prefs->GetUint64(kTrackersBlocked)); + stats_data.SetInteger("javascriptBlockedStat", + prefs->GetUint64(kJavascriptBlocked)); + stats_data.SetInteger("fingerprintingBlockedStat", + prefs->GetUint64(kFingerprintingBlocked)); stats_data.SetDouble( "bandwidthSavedStat", prefs->GetUint64(brave_perf_predictor::prefs::kBandwidthSavedBytes)); @@ -138,12 +137,7 @@ base::DictionaryValue GetTorPropertiesDictionary(bool connected, // TODO(petemill): Move p3a to own NTP component so it can // be used by other platforms. -enum class NTPCustomizeUsage { - kNeverOpened, - kOpened, - kOpenedAndEdited, - kSize -}; +enum class NTPCustomizeUsage { kNeverOpened, kOpened, kOpenedAndEdited, kSize }; const char kNTPCustomizeUsageStatus[] = "brave.new_tab_page.customize_p3a_usage"; @@ -180,7 +174,8 @@ bool BraveNewTabMessageHandler::CanPromptBraveTalk(base::Time now) { } BraveNewTabMessageHandler* BraveNewTabMessageHandler::Create( - content::WebUIDataSource* source, Profile* profile) { + content::WebUIDataSource* source, + Profile* profile) { // // Initial Values // Should only contain data that is static @@ -196,19 +191,16 @@ BraveNewTabMessageHandler* BraveNewTabMessageHandler::Create( is_ads_supported_locale_ = ads_service_->IsSupportedLocale(); } - source->AddBoolean( - "featureFlagBraveNTPSponsoredImagesWallpaper", - base::FeatureList::IsEnabled(kBraveNTPBrandedWallpaper) && - is_ads_supported_locale_); + source->AddBoolean("featureFlagBraveNTPSponsoredImagesWallpaper", + base::FeatureList::IsEnabled(kBraveNTPBrandedWallpaper) && + is_ads_supported_locale_); source->AddBoolean("braveTalkPromptAllowed", BraveNewTabMessageHandler::CanPromptBraveTalk()); // Private Tab info if (IsPrivateNewTab(profile)) { - source->AddBoolean( - "isTor", profile->IsTor()); - source->AddBoolean( - "isQwant", brave::IsRegionForQwant(profile)); + source->AddBoolean("isTor", profile->IsTor()); + source->AddBoolean("isQwant", brave::IsRegionForQwant(profile)); } return new BraveNewTabMessageHandler(profile); } @@ -435,30 +427,31 @@ void BraveNewTabMessageHandler::OnJavascriptDisallowed() { } void BraveNewTabMessageHandler::HandleGetPreferences( - const base::ListValue* args) { + base::Value::ConstListView args) { AllowJavascript(); PrefService* prefs = profile_->GetPrefs(); auto data = GetPreferencesDictionary(prefs); - ResolveJavascriptCallback(args->GetList()[0], data); + ResolveJavascriptCallback(args[0], data); } -void BraveNewTabMessageHandler::HandleGetStats(const base::ListValue* args) { +void BraveNewTabMessageHandler::HandleGetStats( + base::Value::ConstListView args) { AllowJavascript(); PrefService* prefs = profile_->GetPrefs(); auto data = GetStatsDictionary(prefs); - ResolveJavascriptCallback(args->GetList()[0], data); + ResolveJavascriptCallback(args[0], data); } void BraveNewTabMessageHandler::HandleGetPrivateProperties( - const base::ListValue* args) { + base::Value::ConstListView args) { AllowJavascript(); PrefService* prefs = profile_->GetPrefs(); auto data = GetPrivatePropertiesDictionary(prefs); - ResolveJavascriptCallback(args->GetList()[0], data); + ResolveJavascriptCallback(args[0], data); } void BraveNewTabMessageHandler::HandleGetTorProperties( - const base::ListValue* args) { + base::Value::ConstListView args) { AllowJavascript(); #if BUILDFLAG(ENABLE_TOR) auto data = GetTorPropertiesDictionary( @@ -467,17 +460,17 @@ void BraveNewTabMessageHandler::HandleGetTorProperties( #else auto data = GetTorPropertiesDictionary(false, ""); #endif - ResolveJavascriptCallback(args->GetList()[0], data); + ResolveJavascriptCallback(args[0], data); } void BraveNewTabMessageHandler::HandleToggleAlternativeSearchEngineProvider( - const base::ListValue* args) { + base::Value::ConstListView args) { brave::ToggleUseAlternativeSearchEngineProvider(profile_); } void BraveNewTabMessageHandler::HandleSaveNewTabPagePref( - const base::ListValue* args) { - if (args->GetSize() != 2) { + base::Value::ConstListView args) { + if (args.size() != 2) { LOG(ERROR) << "Invalid input"; return; } @@ -486,8 +479,8 @@ void BraveNewTabMessageHandler::HandleSaveNewTabPagePref( kNTPCustomizeUsageStatus, g_browser_process->local_state()); PrefService* prefs = profile_->GetPrefs(); // Collect args - std::string settingsKeyInput = args->GetList()[0].GetString(); - auto settingsValue = args->GetList()[1].Clone(); + std::string settingsKeyInput = args[0].GetString(); + auto settingsValue = args[1].Clone(); std::string settingsKey; // Handle string settings @@ -557,7 +550,7 @@ void BraveNewTabMessageHandler::HandleSaveNewTabPagePref( } void BraveNewTabMessageHandler::HandleRegisterNewTabPageView( - const base::ListValue* args) { + base::Value::ConstListView args) { AllowJavascript(); // Decrement original value only if there's actual branded content @@ -566,20 +559,20 @@ void BraveNewTabMessageHandler::HandleRegisterNewTabPageView( } void BraveNewTabMessageHandler::HandleBrandedWallpaperLogoClicked( - const base::ListValue* args) { + base::Value::ConstListView args) { AllowJavascript(); - if (args->GetSize() != 1) { + if (args.size() != 1) { LOG(ERROR) << "Invalid input"; return; } if (auto* service = ViewCounterServiceFactory::GetForProfile(profile_)) { - auto* creative_instance_id = args->GetList()[0].FindStringKey( - ntp_background_images::kCreativeInstanceIDKey); - auto* destination_url = args->GetList()[0].FindStringPath( - ntp_background_images::kLogoDestinationURLPath); - auto* wallpaper_id = args->GetList()[0].FindStringPath( - ntp_background_images::kWallpaperIDKey); + auto* creative_instance_id = + args[0].FindStringKey(ntp_background_images::kCreativeInstanceIDKey); + auto* destination_url = + args[0].FindStringPath(ntp_background_images::kLogoDestinationURLPath); + auto* wallpaper_id = + args[0].FindStringPath(ntp_background_images::kWallpaperIDKey); DCHECK(creative_instance_id); DCHECK(destination_url); @@ -593,12 +586,12 @@ void BraveNewTabMessageHandler::HandleBrandedWallpaperLogoClicked( } void BraveNewTabMessageHandler::HandleGetBrandedWallpaperData( - const base::ListValue* args) { + base::Value::ConstListView args) { AllowJavascript(); auto* service = ViewCounterServiceFactory::GetForProfile(profile_); - auto data = service ? service->GetCurrentWallpaperForDisplay() - : base::Value(); + auto data = + service ? service->GetCurrentWallpaperForDisplay() : base::Value(); if (!data.is_none()) { DCHECK(data.is_dict()); @@ -607,11 +600,11 @@ void BraveNewTabMessageHandler::HandleGetBrandedWallpaperData( service->BrandedWallpaperWillBeDisplayed(wallpaper_id); } - ResolveJavascriptCallback(args->GetList()[0], std::move(data)); + ResolveJavascriptCallback(args[0], std::move(data)); } void BraveNewTabMessageHandler::HandleCustomizeClicked( - const base::ListValue* args) { + base::Value::ConstListView args) { AllowJavascript(); brave::RecordValueIfGreater( NTPCustomizeUsage::kOpened, "Brave.NTP.CustomizeUsageStatus", @@ -619,54 +612,51 @@ void BraveNewTabMessageHandler::HandleCustomizeClicked( } void BraveNewTabMessageHandler::HandleTodayInteractionBegin( - const base::ListValue* args) { + base::Value::ConstListView args) { AllowJavascript(); // Track if user has ever scrolled to Brave Today. UMA_HISTOGRAM_EXACT_LINEAR("Brave.Today.HasEverInteracted", 1, 1); // Track how many times in the past week // user has scrolled to Brave Today. - WeeklyStorage session_count_storage( - profile_->GetPrefs(), kBraveTodayWeeklySessionCount); + WeeklyStorage session_count_storage(profile_->GetPrefs(), + kBraveTodayWeeklySessionCount); session_count_storage.AddDelta(1); uint64_t total_session_count = session_count_storage.GetWeeklySum(); constexpr int kSessionCountBuckets[] = {0, 1, 3, 7, 12, 18, 25, 1000}; const int* it_count = std::lower_bound(kSessionCountBuckets, std::end(kSessionCountBuckets), - total_session_count); + total_session_count); int answer = it_count - kSessionCountBuckets; UMA_HISTOGRAM_EXACT_LINEAR("Brave.Today.WeeklySessionCount", answer, base::size(kSessionCountBuckets) + 1); } void BraveNewTabMessageHandler::HandleTodayOnCardVisit( - const base::ListValue* args) { + base::Value::ConstListView args) { // Argument should be how many cards visited in this session. // We need the front-end to give us this since this class // will be destroyed and re-created when the user navigates "back", // but the front-end will have access to history state in order to // keep a count for the session. - int cards_visited_total = args->GetList()[0].GetInt(); + int cards_visited_total = args[0].GetInt(); // Track how many Brave Today cards have been viewed per session // (each NTP / NTP Message Handler is treated as 1 session). - WeeklyStorage storage( - profile_->GetPrefs(), kBraveTodayWeeklyCardVisitsCount); + WeeklyStorage storage(profile_->GetPrefs(), kBraveTodayWeeklyCardVisitsCount); storage.ReplaceTodaysValueIfGreater(cards_visited_total); // Send the session with the highest count of cards viewed. uint64_t total = storage.GetHighestValueInWeek(); constexpr int kBuckets[] = {0, 1, 3, 6, 10, 15, 100}; - const int* it_count = - std::lower_bound(kBuckets, std::end(kBuckets), - total); + const int* it_count = std::lower_bound(kBuckets, std::end(kBuckets), total); int answer = it_count - kBuckets; UMA_HISTOGRAM_EXACT_LINEAR("Brave.Today.WeeklyMaxCardVisitsCount", answer, base::size(kBuckets) + 1); // Record ad click if a promoted card was read. - if (args->GetSize() < 4) { + if (args.size() < 4) { return; } - std::string item_id = args->GetList()[1].GetString(); - std::string creative_instance_id = args->GetList()[2].GetString(); - bool is_promoted = args->GetList()[3].GetBool(); + std::string item_id = args[1].GetString(); + std::string creative_instance_id = args[2].GetString(); + bool is_promoted = args[0].GetList()[3].GetBool(); if (is_promoted && !item_id.empty() && !creative_instance_id.empty()) { auto* ads_service_ = brave_ads::AdsServiceFactory::GetForProfile(profile_); ads_service_->OnPromotedContentAdEvent( @@ -676,30 +666,27 @@ void BraveNewTabMessageHandler::HandleTodayOnCardVisit( } void BraveNewTabMessageHandler::HandleTodayOnCardViews( - const base::ListValue* args) { + base::Value::ConstListView args) { // Argument should be how many cards viewed in this session. - int cards_viewed_total = args->GetList()[0].GetInt(); + int cards_viewed_total = args[0].GetInt(); // Track how many Brave Today cards have been viewed per session // (each NTP / NTP Message Handler is treated as 1 session). - WeeklyStorage storage( - profile_->GetPrefs(), kBraveTodayWeeklyCardViewsCount); + WeeklyStorage storage(profile_->GetPrefs(), kBraveTodayWeeklyCardViewsCount); storage.ReplaceTodaysValueIfGreater(cards_viewed_total); // Send the session with the highest count of cards viewed. uint64_t total = storage.GetHighestValueInWeek(); constexpr int kBuckets[] = {0, 1, 4, 12, 20, 40, 80, 1000}; - const int* it_count = - std::lower_bound(kBuckets, std::end(kBuckets), - total); + const int* it_count = std::lower_bound(kBuckets, std::end(kBuckets), total); int answer = it_count - kBuckets; UMA_HISTOGRAM_EXACT_LINEAR("Brave.Today.WeeklyMaxCardViewsCount", answer, base::size(kBuckets) + 1); } void BraveNewTabMessageHandler::HandleTodayOnPromotedCardView( - const base::ListValue* args) { + base::Value::ConstListView args) { // Argument should be how many cards viewed in this session. - std::string creative_instance_id = args->GetList()[0].GetString(); - std::string item_id = args->GetList()[1].GetString(); + std::string creative_instance_id = args[0].GetString(); + std::string item_id = args[1].GetString(); if (!item_id.empty() && !creative_instance_id.empty()) { auto* ads_service_ = brave_ads::AdsServiceFactory::GetForProfile(profile_); ads_service_->OnPromotedContentAdEvent( @@ -709,10 +696,9 @@ void BraveNewTabMessageHandler::HandleTodayOnPromotedCardView( } void BraveNewTabMessageHandler::HandleTodayGetDisplayAd( - const base::ListValue* args) { + base::Value::ConstListView args) { AllowJavascript(); - std::string callback_id; - args->GetString(0, &callback_id); + std::string callback_id = args[0].GetString(); auto* ads_service_ = brave_ads::AdsServiceFactory::GetForProfile(profile_); if (!ads_service_) { ResolveJavascriptCallback(base::Value(callback_id), @@ -745,12 +731,11 @@ void BraveNewTabMessageHandler::HandleTodayGetDisplayAd( } void BraveNewTabMessageHandler::HandleTodayOnDisplayAdVisit( - const base::ListValue* args) { + base::Value::ConstListView args) { // Collect params - std::string item_id; - std::string creative_instance_id; - args->GetString(0, &item_id); - args->GetString(1, &creative_instance_id); + std::string item_id = args[0].GetString(); + std::string creative_instance_id = args[1].GetString(); + // Validate if (item_id.empty()) { LOG(ERROR) << "News: asked to record visit for an ad without ad id"; @@ -775,12 +760,10 @@ void BraveNewTabMessageHandler::HandleTodayOnDisplayAdVisit( } void BraveNewTabMessageHandler::HandleTodayOnDisplayAdView( - const base::ListValue* args) { + base::Value::ConstListView args) { // Collect params - std::string item_id; - std::string creative_instance_id; - args->GetString(0, &item_id); - args->GetString(1, &creative_instance_id); + std::string item_id = args[0].GetString(); + std::string creative_instance_id = args[1].GetString(); // Validate if (item_id.empty()) { diff --git a/browser/ui/webui/new_tab_page/brave_new_tab_message_handler.h b/browser/ui/webui/new_tab_page/brave_new_tab_message_handler.h index f079eb074288..c9bb5595abfa 100644 --- a/browser/ui/webui/new_tab_page/brave_new_tab_message_handler.h +++ b/browser/ui/webui/new_tab_page/brave_new_tab_message_handler.h @@ -52,26 +52,26 @@ class BraveNewTabMessageHandler : public content::WebUIMessageHandler, void OnJavascriptAllowed() override; void OnJavascriptDisallowed() override; - void HandleGetPreferences(const base::ListValue* args); - void HandleGetStats(const base::ListValue* args); - void HandleGetPrivateProperties(const base::ListValue* args); - void HandleGetTorProperties(const base::ListValue* args); - void HandleSaveNewTabPagePref(const base::ListValue* args); + void HandleGetPreferences(base::Value::ConstListView args); + void HandleGetStats(base::Value::ConstListView args); + void HandleGetPrivateProperties(base::Value::ConstListView args); + void HandleGetTorProperties(base::Value::ConstListView args); + void HandleSaveNewTabPagePref(base::Value::ConstListView args); void HandleToggleAlternativeSearchEngineProvider( - const base::ListValue* args); - void HandleRegisterNewTabPageView(const base::ListValue* args); - void HandleBrandedWallpaperLogoClicked(const base::ListValue* args); - void HandleGetBrandedWallpaperData(const base::ListValue* args); - void HandleCustomizeClicked(const base::ListValue* args); + base::Value::ConstListView args); + void HandleRegisterNewTabPageView(base::Value::ConstListView args); + void HandleBrandedWallpaperLogoClicked(base::Value::ConstListView args); + void HandleGetBrandedWallpaperData(base::Value::ConstListView args); + void HandleCustomizeClicked(base::Value::ConstListView args); // TODO(petemill): Today should get it's own message handler // or service. - void HandleTodayInteractionBegin(const base::ListValue* args); - void HandleTodayOnCardVisit(const base::ListValue* args); - void HandleTodayOnCardViews(const base::ListValue* args); - void HandleTodayOnPromotedCardView(const base::ListValue* args); - void HandleTodayGetDisplayAd(const base::ListValue* args); - void HandleTodayOnDisplayAdVisit(const base::ListValue* args); - void HandleTodayOnDisplayAdView(const base::ListValue* args); + void HandleTodayInteractionBegin(base::Value::ConstListView args); + void HandleTodayOnCardVisit(base::Value::ConstListView args); + void HandleTodayOnCardViews(base::Value::ConstListView args); + void HandleTodayOnPromotedCardView(base::Value::ConstListView args); + void HandleTodayGetDisplayAd(base::Value::ConstListView args); + void HandleTodayOnDisplayAdVisit(base::Value::ConstListView args); + void HandleTodayOnDisplayAdView(base::Value::ConstListView args); void OnStatsChanged(); void OnPreferencesChanged(); diff --git a/browser/ui/webui/new_tab_page/brave_new_tab_ui_browsertest.cc b/browser/ui/webui/new_tab_page/brave_new_tab_ui_browsertest.cc index e46eca8d2033..a45bcb271625 100644 --- a/browser/ui/webui/new_tab_page/brave_new_tab_ui_browsertest.cc +++ b/browser/ui/webui/new_tab_page/brave_new_tab_ui_browsertest.cc @@ -59,11 +59,11 @@ IN_PROC_BROWSER_TEST_F(BraveNewTabUIBrowserTest, StartupURLTest) { ObserverLogger observer_logger(host); GURL new_tab_url(chrome::kChromeUINewTabURL); - ui_test_utils::NavigateToURL(browser(), new_tab_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), new_tab_url)); WaitForLoadStop(contents); GURL simple_url = embedded_test_server()->GetURL("/simple.html"); - ui_test_utils::NavigateToURL(browser(), simple_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), simple_url)); WaitForLoadStop(contents); GoBack(contents); @@ -76,7 +76,7 @@ IN_PROC_BROWSER_TEST_F(BraveNewTabUIBrowserTest, StartupURLTest) { IN_PROC_BROWSER_TEST_F(BraveNewTabUIBrowserTest, BraveNewTabIsDefault) { auto* contents = browser()->tab_strip_model()->GetActiveWebContents(); GURL new_tab_url(chrome::kChromeUINewTabURL); - ui_test_utils::NavigateToURL(browser(), new_tab_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), new_tab_url)); WaitForLoadStop(contents); bool is_brave_new_tab = false; ASSERT_TRUE(content::ExecuteScriptAndExtractBool( @@ -96,7 +96,7 @@ IN_PROC_BROWSER_TEST_F(BraveNewTabUIBrowserTest, NewTabPageLocationOverride) { auto* contents = browser()->tab_strip_model()->GetActiveWebContents(); GURL new_tab_url(chrome::kChromeUINewTabURL); - ui_test_utils::NavigateToURL(browser(), new_tab_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), new_tab_url)); WaitForLoadStop(contents); std::string inner_text; diff --git a/browser/ui/webui/new_tab_page/top_sites_message_handler.cc b/browser/ui/webui/new_tab_page/top_sites_message_handler.cc index 8956ae12146e..07463b730777 100644 --- a/browser/ui/webui/new_tab_page/top_sites_message_handler.cc +++ b/browser/ui/webui/new_tab_page/top_sites_message_handler.cc @@ -180,7 +180,7 @@ bool TopSitesMessageHandler::IsShortcutsVisible() const { } void TopSitesMessageHandler::HandleUpdateMostVisitedInfo( - const base::ListValue* args) { + base::Value::ConstListView args) { if (!most_visited_sites_) return; @@ -191,16 +191,16 @@ void TopSitesMessageHandler::HandleUpdateMostVisitedInfo( } void TopSitesMessageHandler::HandleDeleteMostVisitedTile( - const base::ListValue* args) { + base::Value::ConstListView args) { if (!most_visited_sites_) return; AllowJavascript(); - std::string url; - if (!args->GetString(0, &url)) + if (!args[0].is_string()) return; + std::string url = args[0].GetString(); GURL gurl(url); // same as `MostVisitedHandler::DeleteMostVisitedTile` @@ -213,29 +213,26 @@ void TopSitesMessageHandler::HandleDeleteMostVisitedTile( } void TopSitesMessageHandler::HandleReorderMostVisitedTile( - const base::ListValue* args) { + base::Value::ConstListView args) { if (!most_visited_sites_) return; AllowJavascript(); - std::string url; - if (!args->GetString(0, &url)) - return; - - if (!args->GetList()[1].is_int()) + if (!args[0].is_string() || !args[1].is_int()) return; // same as `MostVisitedHandler::ReorderMostVisitedTile` if (most_visited_sites_->IsCustomLinksEnabled()) { + std::string url = args[0].GetString(); GURL gurl(url); - int new_pos = args->GetList()[1].GetInt(); + int new_pos = args[1].GetInt(); most_visited_sites_->ReorderCustomLink(gurl, new_pos); } } void TopSitesMessageHandler::HandleRestoreMostVisitedDefaults( - const base::ListValue* args) { + base::Value::ConstListView args) { if (!most_visited_sites_) return; @@ -250,7 +247,7 @@ void TopSitesMessageHandler::HandleRestoreMostVisitedDefaults( } void TopSitesMessageHandler::HandleUndoMostVisitedTileAction( - const base::ListValue* args) { + base::Value::ConstListView args) { if (!most_visited_sites_) return; @@ -266,19 +263,17 @@ void TopSitesMessageHandler::HandleUndoMostVisitedTileAction( } void TopSitesMessageHandler::HandleSetMostVisitedSettings( - const base::ListValue* args) { + base::Value::ConstListView args) { if (!most_visited_sites_) return; AllowJavascript(); - bool custom_links_enabled; - if (!args->GetBoolean(0, &custom_links_enabled)) + if (!args[0].is_bool() || !args[1].is_bool()) return; - bool visible; - if (!args->GetBoolean(1, &visible)) - return; + bool custom_links_enabled = args[0].GetBool(); + bool visible = args[1].GetBool(); // similar to `NewTabPageHandler::SetMostVisitedSettings` bool old_visible = IsShortcutsVisible(); @@ -295,24 +290,21 @@ void TopSitesMessageHandler::HandleSetMostVisitedSettings( } } -void TopSitesMessageHandler::HandleEditTopSite(const base::ListValue* args) { +void TopSitesMessageHandler::HandleEditTopSite( + base::Value::ConstListView args) { if (!most_visited_sites_) return; AllowJavascript(); - std::string url; - if (!args->GetString(0, &url)) + if (!args[0].is_string() || !args[1].is_string() || !args[2].is_string()) return; - DCHECK(!url.empty()); - std::string new_url; - if (!args->GetString(1, &new_url)) - return; + std::string url = args[0].GetString(); + DCHECK(!url.empty()); - std::string title; - if (!args->GetString(2, &title)) - return; + std::string new_url = args[1].GetString(); + std::string title = args[2].GetString(); // |new_url| can be empty if user only want to change title. // Stop editing if we can't make |new_url| valid. @@ -342,20 +334,20 @@ void TopSitesMessageHandler::HandleEditTopSite(const base::ListValue* args) { } } -void TopSitesMessageHandler::HandleAddNewTopSite(const base::ListValue* args) { +void TopSitesMessageHandler::HandleAddNewTopSite( + base::Value::ConstListView args) { if (!most_visited_sites_) return; AllowJavascript(); - std::string url; - if (!args->GetString(0, &url)) + if (!args[0].is_string() || !args[1].is_string()) return; + + std::string url = args[0].GetString(); DCHECK(!url.empty()); - std::string title; - if (!args->GetString(1, &title)) - return; + std::string title = args[1].GetString(); // Stop adding if we can't make |url| valid. if (!GetValidURLStringForTopSite(&url)) diff --git a/browser/ui/webui/new_tab_page/top_sites_message_handler.h b/browser/ui/webui/new_tab_page/top_sites_message_handler.h index 52aabb23bba0..9ac6eadf6919 100644 --- a/browser/ui/webui/new_tab_page/top_sites_message_handler.h +++ b/browser/ui/webui/new_tab_page/top_sites_message_handler.h @@ -50,14 +50,14 @@ class TopSitesMessageHandler : public content::WebUIMessageHandler, bool IsShortcutsVisible() const; // handlers - void HandleUpdateMostVisitedInfo(const base::ListValue* args); - void HandleDeleteMostVisitedTile(const base::ListValue* args); - void HandleReorderMostVisitedTile(const base::ListValue* args); - void HandleRestoreMostVisitedDefaults(const base::ListValue* args); - void HandleUndoMostVisitedTileAction(const base::ListValue* args); - void HandleSetMostVisitedSettings(const base::ListValue* args); - void HandleEditTopSite(const base::ListValue* args); - void HandleAddNewTopSite(const base::ListValue* args); + void HandleUpdateMostVisitedInfo(base::Value::ConstListView args); + void HandleDeleteMostVisitedTile(base::Value::ConstListView args); + void HandleReorderMostVisitedTile(base::Value::ConstListView args); + void HandleRestoreMostVisitedDefaults(base::Value::ConstListView args); + void HandleUndoMostVisitedTileAction(base::Value::ConstListView args); + void HandleSetMostVisitedSettings(base::Value::ConstListView args); + void HandleEditTopSite(base::Value::ConstListView args); + void HandleAddNewTopSite(base::Value::ConstListView args); Profile* profile_; std::unique_ptr most_visited_sites_; diff --git a/browser/ui/webui/settings/brave_appearance_handler.cc b/browser/ui/webui/settings/brave_appearance_handler.cc index b1c0e56fe3f3..2fbb1c17d7ba 100644 --- a/browser/ui/webui/settings/brave_appearance_handler.cc +++ b/browser/ui/webui/settings/brave_appearance_handler.cc @@ -21,7 +21,6 @@ #include "components/prefs/pref_service.h" #include "content/public/browser/web_ui.h" - BraveAppearanceHandler::BraveAppearanceHandler() { local_state_change_registrar_.Init(g_browser_process->local_state()); local_state_change_registrar_.Add( @@ -39,15 +38,15 @@ void BraveAppearanceHandler::RegisterMessages() { profile_state_change_registrar_.Add( kNewTabPageShowsOptions, base::BindRepeating(&BraveAppearanceHandler::OnPreferenceChanged, - base::Unretained(this))); + base::Unretained(this))); profile_state_change_registrar_.Add( prefs::kHomePageIsNewTabPage, base::BindRepeating(&BraveAppearanceHandler::OnPreferenceChanged, - base::Unretained(this))); + base::Unretained(this))); profile_state_change_registrar_.Add( prefs::kHomePage, base::BindRepeating(&BraveAppearanceHandler::OnPreferenceChanged, - base::Unretained(this))); + base::Unretained(this))); web_ui()->RegisterMessageCallback( "setBraveThemeType", base::BindRepeating(&BraveAppearanceHandler::SetBraveThemeType, @@ -67,24 +66,25 @@ void BraveAppearanceHandler::RegisterMessages() { base::Unretained(this))); } -void BraveAppearanceHandler::SetBraveThemeType(const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 1U); - CHECK(args->GetList()[0].is_int()); +void BraveAppearanceHandler::SetBraveThemeType( + base::Value::ConstListView args) { + CHECK_EQ(args.size(), 1U); + CHECK(args[0].is_int()); AllowJavascript(); - int int_type = args->GetList()[0].GetInt(); + int int_type = args[0].GetInt(); dark_mode::SetBraveDarkModeType( static_cast(int_type)); } -void BraveAppearanceHandler::GetBraveThemeType(const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 1U); - +void BraveAppearanceHandler::GetBraveThemeType( + base::Value::ConstListView args) { + CHECK_EQ(args.size(), 1U); AllowJavascript(); // GetBraveThemeType() should be used because settings option displays all // available options including default. ResolveJavascriptCallback( - args->GetList()[0], + args[0], base::Value(static_cast(dark_mode::GetBraveDarkModeType()))); } @@ -105,8 +105,7 @@ void BraveAppearanceHandler::OnBackgroundPreferenceChanged( void BraveAppearanceHandler::OnPreferenceChanged(const std::string& pref_name) { if (IsJavascriptAllowed()) { - if (pref_name == kNewTabPageShowsOptions || - pref_name == prefs::kHomePage || + if (pref_name == kNewTabPageShowsOptions || pref_name == prefs::kHomePage || pref_name == prefs::kHomePageIsNewTabPage) { FireWebUIListener( "show-new-tab-dashboard-settings-changed", @@ -117,18 +116,17 @@ void BraveAppearanceHandler::OnPreferenceChanged(const std::string& pref_name) { } void BraveAppearanceHandler::GetNewTabShowsOptionsList( - const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 1U); + base::Value::ConstListView args) { + CHECK_EQ(args.size(), 1U); AllowJavascript(); - ResolveJavascriptCallback(args->GetList()[0], + ResolveJavascriptCallback(args[0], brave::GetNewTabShowsOptionsList(profile_)); } void BraveAppearanceHandler::ShouldShowNewTabDashboardSettings( - const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 1U); + base::Value::ConstListView args) { + CHECK_EQ(args.size(), 1U); AllowJavascript(); ResolveJavascriptCallback( - args->GetList()[0], - base::Value(brave::ShouldNewTabShowDashboard(profile_))); + args[0], base::Value(brave::ShouldNewTabShowDashboard(profile_))); } diff --git a/browser/ui/webui/settings/brave_appearance_handler.h b/browser/ui/webui/settings/brave_appearance_handler.h index ec94d1df4b59..b1cf0847d277 100644 --- a/browser/ui/webui/settings/brave_appearance_handler.h +++ b/browser/ui/webui/settings/brave_appearance_handler.h @@ -30,10 +30,10 @@ class BraveAppearanceHandler : public settings::SettingsPageUIHandler { void OnBraveDarkModeChanged(); void OnBackgroundPreferenceChanged(const std::string& pref_name); void OnPreferenceChanged(const std::string& pref_name); - void SetBraveThemeType(const base::ListValue* args); - void GetBraveThemeType(const base::ListValue* args); - void GetNewTabShowsOptionsList(const base::ListValue* args); - void ShouldShowNewTabDashboardSettings(const base::ListValue* args); + void SetBraveThemeType(base::Value::ConstListView args); + void GetBraveThemeType(base::Value::ConstListView args); + void GetNewTabShowsOptionsList(base::Value::ConstListView args); + void ShouldShowNewTabDashboardSettings(base::Value::ConstListView args); Profile* profile_ = nullptr; PrefChangeRegistrar local_state_change_registrar_; diff --git a/browser/ui/webui/settings/brave_default_extensions_handler.cc b/browser/ui/webui/settings/brave_default_extensions_handler.cc index 200f175ac4a1..ca4c18d0d056 100644 --- a/browser/ui/webui/settings/brave_default_extensions_handler.cc +++ b/browser/ui/webui/settings/brave_default_extensions_handler.cc @@ -192,19 +192,18 @@ bool BraveDefaultExtensionsHandler::IsRestartNeeded() { } void BraveDefaultExtensionsHandler::GetRestartNeeded( - const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 1U); + base::Value::ConstListView args) { + CHECK_EQ(args.size(), 1U); AllowJavascript(); - ResolveJavascriptCallback(args->GetList()[0], base::Value(IsRestartNeeded())); + ResolveJavascriptCallback(args[0], base::Value(IsRestartNeeded())); } void BraveDefaultExtensionsHandler::SetWebTorrentEnabled( - const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 1U); + base::Value::ConstListView args) { + CHECK_EQ(args.size(), 1U); CHECK(profile_); - bool enabled; - args->GetBoolean(0, &enabled); + bool enabled = args[0].GetBool(); extensions::ExtensionService* service = extensions::ExtensionSystem::Get(profile_)->extension_service(); @@ -226,11 +225,10 @@ void BraveDefaultExtensionsHandler::SetWebTorrentEnabled( } void BraveDefaultExtensionsHandler::SetHangoutsEnabled( - const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 1U); + base::Value::ConstListView args) { + CHECK_EQ(args.size(), 1U); CHECK(profile_); - bool enabled; - args->GetBoolean(0, &enabled); + bool enabled = args[0].GetBool(); extensions::ExtensionService* service = extensions::ExtensionSystem::Get(profile_)->extension_service(); @@ -274,21 +272,22 @@ void BraveDefaultExtensionsHandler::OnRestartNeededChanged() { } } -void BraveDefaultExtensionsHandler::SetTorEnabled(const base::ListValue* args) { +void BraveDefaultExtensionsHandler::SetTorEnabled( + base::Value::ConstListView args) { #if BUILDFLAG(ENABLE_TOR) - CHECK_EQ(args->GetSize(), 1U); - bool enabled; - args->GetBoolean(0, &enabled); + CHECK_EQ(args.size(), 1U); + bool enabled = args[0].GetBool(); AllowJavascript(); TorProfileServiceFactory::SetTorDisabled(!enabled); #endif } -void BraveDefaultExtensionsHandler::IsTorEnabled(const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 1U); +void BraveDefaultExtensionsHandler::IsTorEnabled( + base::Value::ConstListView args) { + CHECK_EQ(args.size(), 1U); AllowJavascript(); ResolveJavascriptCallback( - args->GetList()[0], + args[0], #if BUILDFLAG(ENABLE_TOR) base::Value(!TorProfileServiceFactory::IsTorDisabled())); #else @@ -307,8 +306,9 @@ void BraveDefaultExtensionsHandler::OnTorEnabledChanged() { } } -void BraveDefaultExtensionsHandler::IsTorManaged(const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 1U); +void BraveDefaultExtensionsHandler::IsTorManaged( + base::Value::ConstListView args) { + CHECK_EQ(args.size(), 1U); #if BUILDFLAG(ENABLE_TOR) const bool is_managed = g_browser_process->local_state() @@ -319,25 +319,24 @@ void BraveDefaultExtensionsHandler::IsTorManaged(const base::ListValue* args) { #endif AllowJavascript(); - ResolveJavascriptCallback(args->GetList()[0], base::Value(is_managed)); + ResolveJavascriptCallback(args[0], base::Value(is_managed)); } void BraveDefaultExtensionsHandler::SetWidevineEnabled( - const base::ListValue* args) { + base::Value::ConstListView args) { #if BUILDFLAG(ENABLE_WIDEVINE) - CHECK_EQ(args->GetSize(), 1U); - bool enabled; - args->GetBoolean(0, &enabled); + CHECK_EQ(args.size(), 1U); + bool enabled = args[0].GetBool(); enabled ? EnableWidevineCdmComponent() : DisableWidevineCdmComponent(); AllowJavascript(); #endif } void BraveDefaultExtensionsHandler::IsWidevineEnabled( - const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 1U); + base::Value::ConstListView args) { + CHECK_EQ(args.size(), 1U); AllowJavascript(); - ResolveJavascriptCallback(args->GetList()[0], + ResolveJavascriptCallback(args[0], #if BUILDFLAG(ENABLE_WIDEVINE) base::Value(IsWidevineOptedIn())); #else @@ -357,11 +356,11 @@ void BraveDefaultExtensionsHandler::OnWidevineEnabledChanged() { } } -void BraveDefaultExtensionsHandler::ExportIPNSKey(const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 1U); +void BraveDefaultExtensionsHandler::ExportIPNSKey( + base::Value::ConstListView args) { + CHECK_EQ(args.size(), 1U); CHECK(profile_); - std::string key_name; - args->GetString(0, &key_name); + std::string key_name = args[0].GetString(); DCHECK(!key_name.empty()); auto* web_contents = web_ui()->GetWebContents(); select_file_dialog_ = ui::SelectFileDialog::Create( @@ -386,11 +385,10 @@ void BraveDefaultExtensionsHandler::ExportIPNSKey(const base::ListValue* args) { } void BraveDefaultExtensionsHandler::SetIPFSCompanionEnabled( - const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 1U); + base::Value::ConstListView args) { + CHECK_EQ(args.size(), 1U); CHECK(profile_); - bool enabled; - args->GetBoolean(0, &enabled); + bool enabled = args[0].GetBool(); extensions::ExtensionService* service = extensions::ExtensionSystem::Get(profile_)->extension_service(); @@ -421,11 +419,10 @@ void BraveDefaultExtensionsHandler::SetIPFSCompanionEnabled( #if BUILDFLAG(ETHEREUM_REMOTE_CLIENT_ENABLED) void BraveDefaultExtensionsHandler::SetBraveWalletEnabled( - const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 1U); + base::Value::ConstListView args) { + CHECK_EQ(args.size(), 1U); CHECK(profile_); - bool enabled; - args->GetBoolean(0, &enabled); + bool enabled = args[0].GetBool(); extensions::ExtensionService* service = extensions::ExtensionSystem::Get(profile_)->extension_service(); @@ -440,11 +437,11 @@ void BraveDefaultExtensionsHandler::SetBraveWalletEnabled( #endif void BraveDefaultExtensionsHandler::IsDecentralizedDnsEnabled( - const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 1U); + base::Value::ConstListView args) { + CHECK_EQ(args.size(), 1U); AllowJavascript(); ResolveJavascriptCallback( - args->GetList()[0], + args[0], #if BUILDFLAG(DECENTRALIZED_DNS_ENABLED) base::Value(decentralized_dns::IsDecentralizedDnsEnabled())); #else @@ -453,24 +450,23 @@ void BraveDefaultExtensionsHandler::IsDecentralizedDnsEnabled( } void BraveDefaultExtensionsHandler::GetDecentralizedDnsResolveMethodList( - const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 2U); + base::Value::ConstListView args) { + CHECK_EQ(args.size(), 2U); AllowJavascript(); #if BUILDFLAG(DECENTRALIZED_DNS_ENABLED) decentralized_dns::Provider provider = - static_cast(args->GetList()[1].GetInt()); - ResolveJavascriptCallback(args->GetList()[0], + static_cast(args[1].GetInt()); + ResolveJavascriptCallback(args[0], decentralized_dns::GetResolveMethodList(provider)); #else - ResolveJavascriptCallback(args->GetList()[0], - base::Value(base::Value::Type::LIST)); + ResolveJavascriptCallback(args[0], base::Value(base::Value::Type::LIST)); #endif } #if BUILDFLAG(ENABLE_IPFS) void BraveDefaultExtensionsHandler::LaunchIPFSService( - const base::ListValue* args) { + base::Value::ConstListView args) { ipfs::IpfsService* service = ipfs::IpfsServiceFactory::GetForContext(profile_); if (!service) { @@ -481,11 +477,11 @@ void BraveDefaultExtensionsHandler::LaunchIPFSService( } void BraveDefaultExtensionsHandler::SetIPFSStorageMax( - const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 1U); - CHECK(args->GetList()[0].is_int()); + base::Value::ConstListView args) { + CHECK_EQ(args.size(), 1U); + CHECK(args[0].is_int()); CHECK(profile_); - int storage_max_gb = args->GetList()[0].GetInt(); + int storage_max_gb = args[0].GetInt(); PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); prefs->SetInteger(kIpfsStorageMax, storage_max_gb); ipfs::IpfsService* service = @@ -539,11 +535,11 @@ void BraveDefaultExtensionsHandler::FileSelectionCanceled(void* params) { dialog_key_.clear(); } -void BraveDefaultExtensionsHandler::ImportIpnsKey(const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 1U); +void BraveDefaultExtensionsHandler::ImportIpnsKey( + base::Value::ConstListView args) { + CHECK_EQ(args.size(), 1U); CHECK(profile_); - std::string key_name; - args->GetString(0, &key_name); + std::string key_name = args[0].GetString(); auto* web_contents = web_ui()->GetWebContents(); select_file_dialog_ = ui::SelectFileDialog::Create( this, std::make_unique(web_contents)); @@ -565,7 +561,7 @@ void BraveDefaultExtensionsHandler::ImportIpnsKey(const base::ListValue* args) { } void BraveDefaultExtensionsHandler::CheckIpfsNodeStatus( - const base::ListValue* args) { + base::Value::ConstListView args) { NotifyNodeStatus(); } diff --git a/browser/ui/webui/settings/brave_default_extensions_handler.h b/browser/ui/webui/settings/brave_default_extensions_handler.h index c8caa14c74e2..e64e6a028c26 100644 --- a/browser/ui/webui/settings/brave_default_extensions_handler.h +++ b/browser/ui/webui/settings/brave_default_extensions_handler.h @@ -42,23 +42,23 @@ class BraveDefaultExtensionsHandler : public settings::SettingsPageUIHandler void OnJavascriptAllowed() override {} void OnJavascriptDisallowed() override {} - void GetRestartNeeded(const base::ListValue* args); - void SetWebTorrentEnabled(const base::ListValue* args); - void SetHangoutsEnabled(const base::ListValue* args); - void SetIPFSCompanionEnabled(const base::ListValue* args); - void SetMediaRouterEnabled(const base::ListValue* args); + void GetRestartNeeded(base::Value::ConstListView args); + void SetWebTorrentEnabled(base::Value::ConstListView args); + void SetHangoutsEnabled(base::Value::ConstListView args); + void SetIPFSCompanionEnabled(base::Value::ConstListView args); + void SetMediaRouterEnabled(base::Value::ConstListView args); #if BUILDFLAG(ETHEREUM_REMOTE_CLIENT_ENABLED) - void SetBraveWalletEnabled(const base::ListValue* args); + void SetBraveWalletEnabled(base::Value::ConstListView args); #endif - void SetTorEnabled(const base::ListValue* args); - void IsTorEnabled(const base::ListValue* args); + void SetTorEnabled(base::Value::ConstListView args); + void IsTorEnabled(base::Value::ConstListView args); void OnTorEnabledChanged(); - void IsTorManaged(const base::ListValue* args); - void SetWidevineEnabled(const base::ListValue* args); - void IsWidevineEnabled(const base::ListValue* args); + void IsTorManaged(base::Value::ConstListView args); + void SetWidevineEnabled(base::Value::ConstListView args); + void IsWidevineEnabled(base::Value::ConstListView args); void OnWidevineEnabledChanged(); - void IsDecentralizedDnsEnabled(const base::ListValue* args); - void GetDecentralizedDnsResolveMethodList(const base::ListValue* args); + void IsDecentralizedDnsEnabled(base::Value::ConstListView args); + void GetDecentralizedDnsResolveMethodList(base::Value::ConstListView args); void InitializePrefCallbacks(); @@ -72,10 +72,10 @@ class BraveDefaultExtensionsHandler : public settings::SettingsPageUIHandler bool IsRestartNeeded(); #if BUILDFLAG(ENABLE_IPFS) - void SetIPFSStorageMax(const base::ListValue* args); - void ImportIpnsKey(const base::ListValue* args); - void LaunchIPFSService(const base::ListValue* args); - void ExportIPNSKey(const base::ListValue* args); + void SetIPFSStorageMax(base::Value::ConstListView args); + void ImportIpnsKey(base::Value::ConstListView args); + void LaunchIPFSService(base::Value::ConstListView args); + void ExportIPNSKey(base::Value::ConstListView args); // ui::SelectFileDialog::Listener void FileSelected(const base::FilePath& path, @@ -91,7 +91,7 @@ class BraveDefaultExtensionsHandler : public settings::SettingsPageUIHandler void OnIpfsLaunched(bool result, int64_t pid) override; void OnIpfsShutdown() override; void OnIpnsKeysLoaded(bool success) override; - void CheckIpfsNodeStatus(const base::ListValue* args); + void CheckIpfsNodeStatus(base::Value::ConstListView args); void NotifyNodeStatus(); std::string dialog_key_; diff --git a/browser/ui/webui/settings/brave_privacy_handler.cc b/browser/ui/webui/settings/brave_privacy_handler.cc index 474f68f268a6..bd2717f1f974 100644 --- a/browser/ui/webui/settings/brave_privacy_handler.cc +++ b/browser/ui/webui/settings/brave_privacy_handler.cc @@ -80,35 +80,35 @@ void BravePrivacyHandler::AddLoadTimeData(content::WebUIDataSource* data_source, void BravePrivacyHandler::SetLocalStateBooleanEnabled( const std::string& path, - const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 1U); - - bool enabled; - args->GetBoolean(0, &enabled); + base::Value::ConstListView args) { + CHECK_EQ(args.size(), 1U); + if (!args[0].is_bool()) + return; + bool enabled = args[0].GetBool(); PrefService* local_state = g_browser_process->local_state(); local_state->SetBoolean(path, enabled); } void BravePrivacyHandler::GetLocalStateBooleanEnabled( const std::string& path, - const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 1U); + base::Value::ConstListView args) { + CHECK_EQ(args.size(), 1U); PrefService* local_state = g_browser_process->local_state(); bool enabled = local_state->GetBoolean(path); AllowJavascript(); - ResolveJavascriptCallback(args->GetList()[0].Clone(), base::Value(enabled)); + ResolveJavascriptCallback(args[0].Clone(), base::Value(enabled)); } void BravePrivacyHandler::SetStatsUsagePingEnabled( - const base::ListValue* args) { + base::Value::ConstListView args) { SetLocalStateBooleanEnabled(kStatsReportingEnabled, args); } void BravePrivacyHandler::GetStatsUsagePingEnabled( - const base::ListValue* args) { + base::Value::ConstListView args) { GetLocalStateBooleanEnabled(kStatsReportingEnabled, args); } @@ -122,11 +122,11 @@ void BravePrivacyHandler::OnStatsUsagePingEnabledChanged() { } #if BUILDFLAG(BRAVE_P3A_ENABLED) -void BravePrivacyHandler::SetP3AEnabled(const base::ListValue* args) { +void BravePrivacyHandler::SetP3AEnabled(base::Value::ConstListView args) { SetLocalStateBooleanEnabled(brave::kP3AEnabled, args); } -void BravePrivacyHandler::GetP3AEnabled(const base::ListValue* args) { +void BravePrivacyHandler::GetP3AEnabled(base::Value::ConstListView args) { GetLocalStateBooleanEnabled(brave::kP3AEnabled, args); } diff --git a/browser/ui/webui/settings/brave_privacy_handler.h b/browser/ui/webui/settings/brave_privacy_handler.h index f5d56f0dabc0..f417860a0083 100644 --- a/browser/ui/webui/settings/brave_privacy_handler.h +++ b/browser/ui/webui/settings/brave_privacy_handler.h @@ -32,17 +32,17 @@ class BravePrivacyHandler : public settings::SettingsPageUIHandler { void OnJavascriptDisallowed() override {} void SetLocalStateBooleanEnabled(const std::string& path, - const base::ListValue* args); + base::Value::ConstListView args); void GetLocalStateBooleanEnabled(const std::string& path, - const base::ListValue* args); + base::Value::ConstListView args); - void SetStatsUsagePingEnabled(const base::ListValue* args); - void GetStatsUsagePingEnabled(const base::ListValue* args); + void SetStatsUsagePingEnabled(base::Value::ConstListView args); + void GetStatsUsagePingEnabled(base::Value::ConstListView args); void OnStatsUsagePingEnabledChanged(); #if BUILDFLAG(BRAVE_P3A_ENABLED) - void SetP3AEnabled(const base::ListValue* args); - void GetP3AEnabled(const base::ListValue* args); + void SetP3AEnabled(base::Value::ConstListView args); + void GetP3AEnabled(base::Value::ConstListView args); void OnP3AEnabledChanged(); #endif diff --git a/browser/ui/webui/settings/brave_relaunch_handler_mac.h b/browser/ui/webui/settings/brave_relaunch_handler_mac.h index 594dd1f2909e..17d16d7c9f32 100644 --- a/browser/ui/webui/settings/brave_relaunch_handler_mac.h +++ b/browser/ui/webui/settings/brave_relaunch_handler_mac.h @@ -1,9 +1,10 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public +/* Copyright (c) 2021 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef BRAVE_BROWSER_UI_WEBUI_SETTINGS_BRAVE_RELAUNCH_HANDLER_H_ -#define BRAVE_BROWSER_UI_WEBUI_SETTINGS_BRAVE_RELAUNCH_HANDLER_H_ +#ifndef BRAVE_BROWSER_UI_WEBUI_SETTINGS_BRAVE_RELAUNCH_HANDLER_MAC_H_ +#define BRAVE_BROWSER_UI_WEBUI_SETTINGS_BRAVE_RELAUNCH_HANDLER_MAC_H_ #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" @@ -20,9 +21,9 @@ class BraveRelaunchHandler : public settings::SettingsPageUIHandler { void OnJavascriptAllowed() override {} void OnJavascriptDisallowed() override {} - void Relaunch(const base::ListValue* args); + void Relaunch(base::Value::ConstListView args); DISALLOW_COPY_AND_ASSIGN(BraveRelaunchHandler); }; -#endif // BRAVE_BROWSER_UI_WEBUI_SETTINGS_BRAVE_RELAUNCH_HANDLER_H_ +#endif // BRAVE_BROWSER_UI_WEBUI_SETTINGS_BRAVE_RELAUNCH_HANDLER_MAC_H_ diff --git a/browser/ui/webui/settings/brave_relaunch_handler_mac.mm b/browser/ui/webui/settings/brave_relaunch_handler_mac.mm index c1996bb52c65..ef42554bfef6 100644 --- a/browser/ui/webui/settings/brave_relaunch_handler_mac.mm +++ b/browser/ui/webui/settings/brave_relaunch_handler_mac.mm @@ -9,11 +9,10 @@ void BraveRelaunchHandler::RegisterMessages() { web_ui()->RegisterMessageCallback( - "relaunchOnMac", - base::BindRepeating(&BraveRelaunchHandler::Relaunch, - base::Unretained(this))); + "relaunchOnMac", base::BindRepeating(&BraveRelaunchHandler::Relaunch, + base::Unretained(this))); } -void BraveRelaunchHandler::Relaunch(const base::ListValue* args) { +void BraveRelaunchHandler::Relaunch(base::Value::ConstListView args) { [[SparkleGlue sharedSparkleGlue] relaunch]; } diff --git a/browser/ui/webui/settings/brave_sync_handler.cc b/browser/ui/webui/settings/brave_sync_handler.cc index 4133b24ffe0b..9e311ff5a005 100644 --- a/browser/ui/webui/settings/brave_sync_handler.cc +++ b/browser/ui/webui/settings/brave_sync_handler.cc @@ -75,43 +75,34 @@ void BraveSyncHandler::OnDeviceInfoChange() { FireWebUIListener("device-info-changed", GetSyncDeviceList()); } -void BraveSyncHandler::HandleGetDeviceList(const base::ListValue* args) { +void BraveSyncHandler::HandleGetDeviceList(base::Value::ConstListView args) { AllowJavascript(); - const auto& list = args->GetList(); - CHECK_EQ(1U, list.size()); - const base::Value* callback_id; - CHECK(args->Get(0, &callback_id)); - - ResolveJavascriptCallback(*callback_id, GetSyncDeviceList()); + CHECK_EQ(1U, args.size()); + ResolveJavascriptCallback(args[0].Clone(), GetSyncDeviceList()); } -void BraveSyncHandler::HandleGetSyncCode(const base::ListValue* args) { +void BraveSyncHandler::HandleGetSyncCode(base::Value::ConstListView args) { AllowJavascript(); - - CHECK_EQ(1U, args->GetSize()); - const base::Value* callback_id; - CHECK(args->Get(0, &callback_id)); + CHECK_EQ(1U, args.size()); auto* sync_service = GetSyncService(); std::string sync_code; if (sync_service) sync_code = sync_service->GetOrCreateSyncCode(); - ResolveJavascriptCallback(*callback_id, base::Value(sync_code)); + ResolveJavascriptCallback(args[0].Clone(), base::Value(sync_code)); } -void BraveSyncHandler::HandleGetQRCode(const base::ListValue* args) { +void BraveSyncHandler::HandleGetQRCode(base::Value::ConstListView args) { AllowJavascript(); - CHECK_EQ(2U, args->GetSize()); - const base::Value* callback_id; - CHECK(args->Get(0, &callback_id)); - const base::Value* sync_code; - CHECK(args->Get(1, &sync_code)); + CHECK_EQ(2U, args.size()); + CHECK(args[1].is_string()); + const std::string sync_code = args[1].GetString(); std::vector seed; - if (!brave_sync::crypto::PassphraseToBytes32(sync_code->GetString(), &seed)) { + if (!brave_sync::crypto::PassphraseToBytes32(sync_code, &seed)) { LOG(ERROR) << "invalid sync code when generating qr code"; - RejectJavascriptCallback(*callback_id, base::Value("invalid sync code")); + RejectJavascriptCallback(args[0].Clone(), base::Value("invalid sync code")); return; } @@ -119,8 +110,8 @@ void BraveSyncHandler::HandleGetQRCode(const base::ListValue* args) { // seed then we will have 64 bytes input data const std::string sync_code_hex = base::HexEncode(seed.data(), seed.size()); - base::Value callback_id_disconnect(callback_id->Clone()); - base::Value callback_id_arg(callback_id->Clone()); + base::Value callback_id_disconnect(args[0].Clone()); + base::Value callback_id_arg(args[0].Clone()); qr_code_service_remote_ = qrcode_generator::LaunchQRCodeGeneratorService(); qr_code_service_remote_.set_disconnect_handler( @@ -147,42 +138,38 @@ void BraveSyncHandler::HandleGetQRCode(const base::ListValue* args) { std::move(callback_id_arg))); } -void BraveSyncHandler::HandleSetSyncCode(const base::ListValue* args) { +void BraveSyncHandler::HandleSetSyncCode(base::Value::ConstListView args) { AllowJavascript(); - CHECK_EQ(2U, args->GetSize()); - const base::Value* callback_id; - CHECK(args->Get(0, &callback_id)); - const base::Value* sync_code; - CHECK(args->Get(1, &sync_code)); + CHECK_EQ(2U, args.size()); + CHECK(args[1].is_string()); + const std::string sync_code = args[1].GetString(); - if (sync_code->GetString().empty()) { + if (sync_code.empty()) { LOG(ERROR) << "No sync code parameter provided!"; - RejectJavascriptCallback(*callback_id, base::Value(false)); + RejectJavascriptCallback(args[0].Clone(), base::Value(false)); return; } auto* sync_service = GetSyncService(); - if (!sync_service || !sync_service->SetSyncCode(sync_code->GetString())) { - RejectJavascriptCallback(*callback_id, base::Value(false)); + if (!sync_service || !sync_service->SetSyncCode(sync_code)) { + RejectJavascriptCallback(args[0].Clone(), base::Value(false)); return; } - ResolveJavascriptCallback(*callback_id, base::Value(true)); + ResolveJavascriptCallback(args[0].Clone(), base::Value(true)); } -void BraveSyncHandler::HandleReset(const base::ListValue* args) { +void BraveSyncHandler::HandleReset(base::Value::ConstListView args) { AllowJavascript(); - CHECK_EQ(1U, args->GetSize()); - const base::Value* callback_id; - CHECK(args->Get(0, &callback_id)); + CHECK_EQ(1U, args.size()); auto* sync_service = GetSyncService(); if (!sync_service) { - ResolveJavascriptCallback(*callback_id, base::Value(true)); + ResolveJavascriptCallback(args[0].Clone(), base::Value(true)); return; } - base::Value callback_id_arg(callback_id->Clone()); + base::Value callback_id_arg(args[0].Clone()); auto* device_info_sync_service = DeviceInfoSyncServiceFactory::GetForProfile(profile_); brave_sync::ResetSync(sync_service, device_info_sync_service, @@ -191,31 +178,28 @@ void BraveSyncHandler::HandleReset(const base::ListValue* args) { std::move(callback_id_arg))); } -void BraveSyncHandler::HandleDeleteDevice(const base::ListValue* args) { +void BraveSyncHandler::HandleDeleteDevice(base::Value::ConstListView args) { AllowJavascript(); - CHECK_EQ(2U, args->GetSize()); - const base::Value* callback_id; - CHECK(args->Get(0, &callback_id)); - const base::Value* device_id_value; - CHECK(args->Get(1, &device_id_value)); + CHECK_EQ(2U, args.size()); + CHECK(args[1].is_string()); + const std::string device_guid = args[1].GetString(); - std::string device_guid = device_id_value->GetString(); if (device_guid.empty()) { LOG(ERROR) << "No device id to remove!"; - RejectJavascriptCallback(*callback_id, base::Value(false)); + RejectJavascriptCallback(args[0].Clone(), base::Value(false)); return; } auto* sync_service = GetSyncService(); if (!sync_service) { - ResolveJavascriptCallback(*callback_id, base::Value(false)); + ResolveJavascriptCallback(args[0].Clone(), base::Value(false)); return; } - base::Value callback_id_arg(callback_id->Clone()); auto* device_info_sync_service = DeviceInfoSyncServiceFactory::GetForProfile(profile_); brave_sync::DeleteDevice(sync_service, device_info_sync_service, device_guid); + ResolveJavascriptCallback(args[0].Clone(), base::Value(true)); } syncer::BraveSyncServiceImpl* BraveSyncHandler::GetSyncService() const { diff --git a/browser/ui/webui/settings/brave_sync_handler.h b/browser/ui/webui/settings/brave_sync_handler.h index 3fbd450ace55..f6b4c7f85007 100644 --- a/browser/ui/webui/settings/brave_sync_handler.h +++ b/browser/ui/webui/settings/brave_sync_handler.h @@ -37,12 +37,12 @@ class BraveSyncHandler : public settings::SettingsPageUIHandler, void OnJavascriptDisallowed() override; // Custom message handlers: - void HandleGetDeviceList(const base::ListValue* args); - void HandleGetSyncCode(const base::ListValue* args); - void HandleSetSyncCode(const base::ListValue* args); - void HandleGetQRCode(const base::ListValue* args); - void HandleReset(const base::ListValue* args); - void HandleDeleteDevice(const base::ListValue* args); + void HandleGetDeviceList(base::Value::ConstListView args); + void HandleGetSyncCode(base::Value::ConstListView args); + void HandleSetSyncCode(base::Value::ConstListView args); + void HandleGetQRCode(base::Value::ConstListView args); + void HandleReset(base::Value::ConstListView args); + void HandleDeleteDevice(base::Value::ConstListView args); void OnResetDone(base::Value callback_id); diff --git a/browser/ui/webui/settings/default_brave_shields_handler.cc b/browser/ui/webui/settings/default_brave_shields_handler.cc index f3bc34a1a582..5b038d4efbb0 100644 --- a/browser/ui/webui/settings/default_brave_shields_handler.cc +++ b/browser/ui/webui/settings/default_brave_shields_handler.cc @@ -70,145 +70,120 @@ void DefaultBraveShieldsHandler::RegisterMessages() { } void DefaultBraveShieldsHandler::IsAdControlEnabled( - const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 1U); + base::Value::ConstListView args) { + CHECK_EQ(args.size(), 1U); CHECK(profile_); ControlType setting = brave_shields::GetAdControlType( HostContentSettingsMapFactory::GetForProfile(profile_), GURL()); AllowJavascript(); - ResolveJavascriptCallback( - args->GetList()[0].Clone(), - base::Value(setting == ControlType::BLOCK)); + ResolveJavascriptCallback(args[0].Clone(), + base::Value(setting == ControlType::BLOCK)); } -void DefaultBraveShieldsHandler::SetAdControlType(const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 1U); +void DefaultBraveShieldsHandler::SetAdControlType( + base::Value::ConstListView args) { + CHECK_EQ(args.size(), 1U); CHECK(profile_); - bool value; - args->GetBoolean(0, &value); + bool value = args[0].GetBool(); brave_shields::SetAdControlType( HostContentSettingsMapFactory::GetForProfile(profile_), - value ? ControlType::BLOCK - : ControlType::ALLOW, - GURL(), + value ? ControlType::BLOCK : ControlType::ALLOW, GURL(), g_browser_process->local_state()); } void DefaultBraveShieldsHandler::IsFirstPartyCosmeticFilteringEnabled( - const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 1U); + base::Value::ConstListView args) { + CHECK_EQ(args.size(), 1U); CHECK(profile_); bool enabled = brave_shields::IsFirstPartyCosmeticFilteringEnabled( - HostContentSettingsMapFactory::GetForProfile(profile_), - GURL()); + HostContentSettingsMapFactory::GetForProfile(profile_), GURL()); AllowJavascript(); - ResolveJavascriptCallback( - args->GetList()[0].Clone(), - base::Value(enabled)); + ResolveJavascriptCallback(args[0].Clone(), base::Value(enabled)); } void DefaultBraveShieldsHandler::SetCosmeticFilteringControlType( - const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 1U); + base::Value::ConstListView args) { + CHECK_EQ(args.size(), 1U); CHECK(profile_); - std::string value; - args->GetString(0, &value); + std::string value = args[0].GetString(); brave_shields::SetCosmeticFilteringControlType( HostContentSettingsMapFactory::GetForProfile(profile_), - ControlTypeFromString(value), - GURL(), - g_browser_process->local_state()); + ControlTypeFromString(value), GURL(), g_browser_process->local_state()); } void DefaultBraveShieldsHandler::GetCookieControlType( - const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 1U); + base::Value::ConstListView args) { + CHECK_EQ(args.size(), 1U); CHECK(profile_); ControlType setting = brave_shields::GetCookieControlType( - HostContentSettingsMapFactory::GetForProfile(profile_), - GURL()); + HostContentSettingsMapFactory::GetForProfile(profile_), GURL()); AllowJavascript(); - ResolveJavascriptCallback( - args->GetList()[0].Clone(), - base::Value(ControlTypeToString(setting))); + ResolveJavascriptCallback(args[0].Clone(), + base::Value(ControlTypeToString(setting))); } void DefaultBraveShieldsHandler::SetCookieControlType( - const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 1U); + base::Value::ConstListView args) { + CHECK_EQ(args.size(), 1U); CHECK(profile_); - std::string value; - args->GetString(0, &value); + std::string value = args[0].GetString(); brave_shields::SetCookieControlType( HostContentSettingsMapFactory::GetForProfile(profile_), - ControlTypeFromString(value), - GURL(), - g_browser_process->local_state()); + ControlTypeFromString(value), GURL(), g_browser_process->local_state()); } void DefaultBraveShieldsHandler::GetFingerprintingControlType( - const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 1U); + base::Value::ConstListView args) { + CHECK_EQ(args.size(), 1U); CHECK(profile_); ControlType setting = brave_shields::GetFingerprintingControlType( - HostContentSettingsMapFactory::GetForProfile(profile_), - GURL()); + HostContentSettingsMapFactory::GetForProfile(profile_), GURL()); AllowJavascript(); - ResolveJavascriptCallback( - args->GetList()[0].Clone(), - base::Value(ControlTypeToString(setting))); + ResolveJavascriptCallback(args[0].Clone(), + base::Value(ControlTypeToString(setting))); } void DefaultBraveShieldsHandler::SetFingerprintingControlType( - const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 1U); + base::Value::ConstListView args) { + CHECK_EQ(args.size(), 1U); CHECK(profile_); - std::string value; - args->GetString(0, &value); + std::string value = args[0].GetString(); brave_shields::SetFingerprintingControlType( HostContentSettingsMapFactory::GetForProfile(profile_), - ControlTypeFromString(value), - GURL(), - g_browser_process->local_state()); + ControlTypeFromString(value), GURL(), g_browser_process->local_state()); } void DefaultBraveShieldsHandler::SetHTTPSEverywhereEnabled( - const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 1U); + base::Value::ConstListView args) { + CHECK_EQ(args.size(), 1U); CHECK(profile_); - bool value; - args->GetBoolean(0, &value); + bool value = args[0].GetBool(); brave_shields::SetHTTPSEverywhereEnabled( - HostContentSettingsMapFactory::GetForProfile(profile_), - value, - GURL(), + HostContentSettingsMapFactory::GetForProfile(profile_), value, GURL(), g_browser_process->local_state()); } void DefaultBraveShieldsHandler::SetNoScriptControlType( - const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 1U); + base::Value::ConstListView args) { + CHECK_EQ(args.size(), 1U); CHECK(profile_); - bool value; - args->GetBoolean(0, &value); + bool value = args[0].GetBool(); brave_shields::SetNoScriptControlType( HostContentSettingsMapFactory::GetForProfile(profile_), - value ? ControlType::BLOCK - : ControlType::ALLOW, - GURL(), + value ? ControlType::BLOCK : ControlType::ALLOW, GURL(), g_browser_process->local_state()); } diff --git a/browser/ui/webui/settings/default_brave_shields_handler.h b/browser/ui/webui/settings/default_brave_shields_handler.h index 109841a146c1..5301a3240c2b 100644 --- a/browser/ui/webui/settings/default_brave_shields_handler.h +++ b/browser/ui/webui/settings/default_brave_shields_handler.h @@ -21,18 +21,18 @@ class DefaultBraveShieldsHandler : public settings::SettingsPageUIHandler { void OnJavascriptAllowed() override {} void OnJavascriptDisallowed() override {} - void SetAdControlType(const base::ListValue* args); - void IsAdControlEnabled(const base::ListValue* args); - void SetCosmeticFilteringControlType(const base::ListValue* args); - void IsFirstPartyCosmeticFilteringEnabled(const base::ListValue* args); - void SetCookieControlType(const base::ListValue* args); - void GetCookieControlType(const base::ListValue* args); - void SetFingerprintingControlType(const base::ListValue* args); - void GetFingerprintingControlType(const base::ListValue* args); - void SetHTTPSEverywhereEnabled(const base::ListValue* args); - void GetHTTPSEverywhereEnabled(const base::ListValue* args); - void SetNoScriptControlType(const base::ListValue* args); - void GetNoScriptControlType(const base::ListValue* args); + void SetAdControlType(base::Value::ConstListView args); + void IsAdControlEnabled(base::Value::ConstListView args); + void SetCosmeticFilteringControlType(base::Value::ConstListView args); + void IsFirstPartyCosmeticFilteringEnabled(base::Value::ConstListView args); + void SetCookieControlType(base::Value::ConstListView args); + void GetCookieControlType(base::Value::ConstListView args); + void SetFingerprintingControlType(base::Value::ConstListView args); + void GetFingerprintingControlType(base::Value::ConstListView args); + void SetHTTPSEverywhereEnabled(base::Value::ConstListView args); + void GetHTTPSEverywhereEnabled(base::Value::ConstListView args); + void SetNoScriptControlType(base::Value::ConstListView args); + void GetNoScriptControlType(base::Value::ConstListView args); Profile* profile_ = nullptr; diff --git a/browser/ui/webui/tor_internals_ui.cc b/browser/ui/webui/tor_internals_ui.cc index c0e9a01136b4..c7702c5b5b63 100644 --- a/browser/ui/webui/tor_internals_ui.cc +++ b/browser/ui/webui/tor_internals_ui.cc @@ -37,8 +37,8 @@ void TorInternalsDOMHandler::RegisterMessages() { } void TorInternalsDOMHandler::HandleGetTorGeneralInfo( - const base::ListValue* args) { - DCHECK_EQ(args->GetSize(), 0U); + base::Value::ConstListView args) { + DCHECK_EQ(args.size(), 0U); if (!web_ui()->CanCallJavascript()) return; @@ -53,8 +53,8 @@ void TorInternalsDOMHandler::HandleGetTorGeneralInfo( std::move(info)); } -void TorInternalsDOMHandler::HandleGetTorLog(const base::ListValue* args) { - DCHECK_EQ(args->GetSize(), 0U); +void TorInternalsDOMHandler::HandleGetTorLog(base::Value::ConstListView args) { + DCHECK_EQ(args.size(), 0U); if (!web_ui()->CanCallJavascript()) return; tor_launcher_factory_->GetTorLog(base::BindOnce( diff --git a/browser/ui/webui/tor_internals_ui.h b/browser/ui/webui/tor_internals_ui.h index 71eca07dc0ea..d76ebb11ee37 100644 --- a/browser/ui/webui/tor_internals_ui.h +++ b/browser/ui/webui/tor_internals_ui.h @@ -26,8 +26,8 @@ class TorInternalsDOMHandler : public content::WebUIMessageHandler, void RegisterMessages() override; private: - void HandleGetTorGeneralInfo(const base::ListValue* args); - void HandleGetTorLog(const base::ListValue* args); + void HandleGetTorGeneralInfo(base::Value::ConstListView args); + void HandleGetTorLog(base::Value::ConstListView args); void OnGetTorLog(bool success, const std::string& log); diff --git a/browser/ui/webui/webcompat_reporter_ui.cc b/browser/ui/webui/webcompat_reporter_ui.cc index 9e8bfdaa62b7..c907b07044ec 100644 --- a/browser/ui/webui/webcompat_reporter_ui.cc +++ b/browser/ui/webui/webcompat_reporter_ui.cc @@ -30,7 +30,7 @@ class WebcompatReporterDOMHandler : public content::WebUIMessageHandler { void RegisterMessages() override; private: - void HandleSubmitReport(const base::ListValue* args); + void HandleSubmitReport(base::Value::ConstListView args); std::unique_ptr uploader_; DISALLOW_COPY_AND_ASSIGN(WebcompatReporterDOMHandler); @@ -51,12 +51,12 @@ void WebcompatReporterDOMHandler::RegisterMessages() { } void WebcompatReporterDOMHandler::HandleSubmitReport( - const base::ListValue* args) { - DCHECK_EQ(args->GetSize(), 1U); - std::string site_url; - if (!args->GetString(0, &site_url)) + base::Value::ConstListView args) { + DCHECK_EQ(args.size(), 1U); + if (!args[0].is_string()) return; + std::string site_url = args[0].GetString(); uploader_->SubmitReport(site_url); } diff --git a/browser/widevine/widevine_permission_request_browsertest.cc b/browser/widevine/widevine_permission_request_browsertest.cc index 7f65849b41dc..2d9da6bccd9f 100644 --- a/browser/widevine/widevine_permission_request_browsertest.cc +++ b/browser/widevine/widevine_permission_request_browsertest.cc @@ -260,7 +260,7 @@ IN_PROC_BROWSER_TEST_F(ScriptTriggerWidevinePermissionRequestBrowserTest, SuggestPermissionIfWidevineDetected) { // In this test, we just want to know whether permission bubble is shown. GURL url = https_server_.GetURL("a.com", "/simple.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); EXPECT_FALSE(IsPermissionBubbleShown()); const std::string drm_js = @@ -284,7 +284,7 @@ IN_PROC_BROWSER_TEST_F(ScriptTriggerWidevinePermissionRequestBrowserTest, // Navigate to a page with some videos. url = https_server_.GetURL("a.com", "/media/youtube.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::RunAllTasksUntilIdle(); EXPECT_FALSE(IsPermissionBubbleShown()); ResetBubbleState(); diff --git a/build/commands/lib/config.js b/build/commands/lib/config.js index c3efb161e78e..b4b69ff25266 100755 --- a/build/commands/lib/config.js +++ b/build/commands/lib/config.js @@ -412,6 +412,7 @@ Config.prototype.buildArgs = function () { args.enable_stripping = !this.isDebug() args.use_xcode_clang = false args.use_clang_coverage = false + args.use_lld = false // Component builds are not supported for iOS: // https://chromium.googlesource.com/chromium/src/+/master/docs/component_build.md args.is_component_build = false diff --git a/build/config/compiler.gni b/build/config/compiler.gni index 4941a236cc7f..b60669817867 100644 --- a/build/config/compiler.gni +++ b/build/config/compiler.gni @@ -6,5 +6,5 @@ # Adjusts compiler flags in //build/config/compiler:chromium_code. brave_removed_chromium_code_cflags = [] if (is_clang) { - brave_removed_chromium_code_cflags += [ "-Wunreachable-code" ] + brave_removed_chromium_code_cflags += [ "-Wunreachable-code-aggressive" ] } diff --git a/chromium_src/chrome/browser/DEPS b/chromium_src/chrome/browser/DEPS index b2511d8db5ae..def8bc72b9e4 100644 --- a/chromium_src/chrome/browser/DEPS +++ b/chromium_src/chrome/browser/DEPS @@ -32,6 +32,7 @@ include_rules = [ "+../../../../../chrome/browser/permissions", "+../../../../../chrome/browser/policy", "+../../../../../chrome/browser/prefs", + "+../../../../../chrome/browser/privacy_sandbox", "+../../../../../chrome/browser/profiles", "+../../../../../chrome/browser/push_messaging", "+../../../../../chrome/browser/renderer_context_menu", @@ -77,7 +78,7 @@ include_rules = [ "+../../../../../../../chrome/browser/ui/webui/settings", "+../../../../../../../chrome/browser/ui/webui/signin", "+../../../../../../../chrome/browser/ui/webui/version", - "+../../../../../../chrome/browser/web_applications/components", + "+../../../../../chrome/browser/web_applications", "+../../../../../chrome/browser/webauthn", "+brave/app", "+brave/browser", diff --git a/chromium_src/chrome/browser/permissions/prediction_based_permission_ui_selector.cc b/chromium_src/chrome/browser/permissions/prediction_based_permission_ui_selector.cc new file mode 100644 index 000000000000..90a4a259e335 --- /dev/null +++ b/chromium_src/chrome/browser/permissions/prediction_based_permission_ui_selector.cc @@ -0,0 +1,15 @@ +/* Copyright (c) 2021 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "chrome/browser/permissions/prediction_based_permission_ui_selector.h" + +#define IsPermissionRequestSupported IsPermissionRequestSupported_ChromiumImpl +#include "../../../../../chrome/browser/permissions/prediction_based_permission_ui_selector.cc" +#undef IsPermissionRequestSupported + +bool PredictionBasedPermissionUiSelector::IsPermissionRequestSupported( + permissions::RequestType request_type) { + return false; +} diff --git a/chromium_src/chrome/browser/permissions/prediction_based_permission_ui_selector.h b/chromium_src/chrome/browser/permissions/prediction_based_permission_ui_selector.h new file mode 100644 index 000000000000..62e2ef2af5fe --- /dev/null +++ b/chromium_src/chrome/browser/permissions/prediction_based_permission_ui_selector.h @@ -0,0 +1,19 @@ +/* Copyright (c) 2021 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_PERMISSIONS_PREDICTION_BASED_PERMISSION_UI_SELECTOR_H_ +#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_PERMISSIONS_PREDICTION_BASED_PERMISSION_UI_SELECTOR_H_ + +#include "components/permissions/permission_ui_selector.h" + +#define IsPermissionRequestSupported \ + IsPermissionRequestSupported_ChromiumImpl( \ + permissions::RequestType request_type); \ + bool IsPermissionRequestSupported + +#include "../../../../../chrome/browser/permissions/prediction_based_permission_ui_selector.h" +#undef IsPermissionRequestSupported + +#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_PERMISSIONS_PREDICTION_BASED_PERMISSION_UI_SELECTOR_H_ diff --git a/chromium_src/chrome/browser/privacy_sandbox/BUILD.gn b/chromium_src/chrome/browser/privacy_sandbox/BUILD.gn new file mode 100644 index 000000000000..936dcc15001e --- /dev/null +++ b/chromium_src/chrome/browser/privacy_sandbox/BUILD.gn @@ -0,0 +1,36 @@ +# Copyright 2021 The Brave Authors. All rights reserved. +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this file, +# You can obtain one at http://mozilla.org/MPL/2.0/. + +source_set("unit_tests") { + testonly = true + sources = [ "privacy_sandbox_settings_unittest.cc" ] + + deps = [ + "//base", + "//chrome/browser", + "//chrome/browser/ui/webui/federated_learning:mojo_bindings", + "//chrome/common:chrome_features", + "//chrome/test:test_support", + "//components/content_settings/core/browser", + "//components/content_settings/core/common", + "//components/content_settings/core/test:test_support", + "//components/federated_learning", + "//components/policy/core/common:test_support", + "//components/privacy_sandbox:privacy_sandbox_prefs", + "//components/signin/public/identity_manager", + "//components/signin/public/identity_manager:test_support", + "//components/strings:components_strings", + "//components/sync/base", + "//components/sync/driver:test_support", + "//components/sync_preferences:test_support", + "//content/public/common", + "//content/test:test_support", + "//testing/gtest:gtest", + "//third_party/blink/public/common", + "//third_party/blink/public/mojom:mojom_platform_headers", + "//ui/base", + "//url", + ] +} diff --git a/chromium_src/chrome/browser/privacy_sandbox/privacy_sandbox_settings.cc b/chromium_src/chrome/browser/privacy_sandbox/privacy_sandbox_settings.cc new file mode 100644 index 000000000000..822e1b19bb7b --- /dev/null +++ b/chromium_src/chrome/browser/privacy_sandbox/privacy_sandbox_settings.cc @@ -0,0 +1,23 @@ +/* Copyright (c) 2021 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "chrome/browser/privacy_sandbox/privacy_sandbox_settings.h" + +#define OnPrivacySandboxPrefChanged() OnPrivacySandboxPrefChanged_ChromiumImpl() + +#include "../../../../../chrome/browser/privacy_sandbox/privacy_sandbox_settings.cc" // NOLINT + +#undef OnPrivacySandboxPrefChanged + +void PrivacySandboxSettings::OnPrivacySandboxPrefChanged() { + OnPrivacySandboxPrefChanged_ChromiumImpl(); + + // Make sure that Private Sandbox features remain disabled even if we manually + // access the Pref service and try to change the preference from there. + if (pref_service_->GetBoolean(prefs::kPrivacySandboxApisEnabled)) + pref_service_->SetBoolean(prefs::kPrivacySandboxApisEnabled, false); + if (pref_service_->GetBoolean(prefs::kPrivacySandboxFlocEnabled)) + pref_service_->SetBoolean(prefs::kPrivacySandboxFlocEnabled, false); +} diff --git a/chromium_src/chrome/browser/privacy_sandbox/privacy_sandbox_settings.h b/chromium_src/chrome/browser/privacy_sandbox/privacy_sandbox_settings.h new file mode 100644 index 000000000000..6af16317ae7f --- /dev/null +++ b/chromium_src/chrome/browser/privacy_sandbox/privacy_sandbox_settings.h @@ -0,0 +1,17 @@ +/* Copyright (c) 2021 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_PRIVACY_SANDBOX_PRIVACY_SANDBOX_SETTINGS_H_ +#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_PRIVACY_SANDBOX_PRIVACY_SANDBOX_SETTINGS_H_ + +#define OnPrivacySandboxPrefChanged() \ + OnPrivacySandboxPrefChanged(); \ + void OnPrivacySandboxPrefChanged_ChromiumImpl() + +#include "../../../../../chrome/browser/privacy_sandbox/privacy_sandbox_settings.h" // NOLINT + +#undef OnPrivacySandboxPrefChanged + +#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_PRIVACY_SANDBOX_PRIVACY_SANDBOX_SETTINGS_H_ diff --git a/chromium_src/chrome/browser/privacy_sandbox/privacy_sandbox_settings_unittest.cc b/chromium_src/chrome/browser/privacy_sandbox/privacy_sandbox_settings_unittest.cc index 2954e2ba1324..8a380cd78bba 100644 --- a/chromium_src/chrome/browser/privacy_sandbox/privacy_sandbox_settings_unittest.cc +++ b/chromium_src/chrome/browser/privacy_sandbox/privacy_sandbox_settings_unittest.cc @@ -1,7 +1,947 @@ -/* Copyright (c) 2021 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. -// THIS FILE IS INTENTIONALLY EMPTY TO DISABLE TESTS FROM CHROMIUM UPSTREAM. -// See https://github.com/brave/brave-browser/issues/8376 for more information. +#include "chrome/browser/privacy_sandbox/privacy_sandbox_settings.h" + +#include "base/json/values_util.h" +#include "base/test/gtest_util.h" +#include "base/test/icu_test_util.h" +#include "base/test/metrics/histogram_tester.h" +#include "base/test/metrics/user_action_tester.h" +#include "base/test/scoped_feature_list.h" +#include "chrome/browser/content_settings/cookie_settings_factory.h" +#include "chrome/browser/content_settings/host_content_settings_map_factory.h" +#include "chrome/browser/federated_learning/floc_id_provider.h" +#include "chrome/browser/privacy_sandbox/privacy_sandbox_settings.h" +#include "chrome/browser/signin/identity_manager_factory.h" +#include "chrome/browser/ui/webui/federated_learning/floc_internals.mojom.h" +#include "chrome/common/chrome_features.h" +#include "chrome/test/base/testing_profile.h" +#include "components/content_settings/core/browser/cookie_settings.h" +#include "components/content_settings/core/browser/host_content_settings_map.h" +#include "components/content_settings/core/common/pref_names.h" +#include "components/content_settings/core/test/content_settings_mock_provider.h" +#include "components/content_settings/core/test/content_settings_test_utils.h" +#include "components/federated_learning/features/features.h" +#include "components/federated_learning/floc_id.h" +#include "components/policy/core/common/mock_policy_service.h" +#include "components/privacy_sandbox/privacy_sandbox_prefs.h" +#include "components/signin/public/identity_manager/account_info.h" +#include "components/signin/public/identity_manager/identity_test_environment.h" +#include "components/strings/grit/components_strings.h" +#include "components/sync/base/user_selectable_type.h" +#include "components/sync/driver/test_sync_service.h" +#include "components/sync_preferences/testing_pref_service_syncable.h" +#include "content/public/common/content_features.h" +#include "content/public/test/browser_task_environment.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/common/features.h" +#include "third_party/blink/public/mojom/federated_learning/floc.mojom.h" +#include "ui/base/l10n/l10n_util.h" +#include "url/origin.h" + +namespace { + +class MockFlocIdProvider : public federated_learning::FlocIdProvider { + public: + blink::mojom::InterestCohortPtr GetInterestCohortForJsApi( + const GURL& url, + const absl::optional& top_frame_origin) const override { + return blink::mojom::InterestCohort::New(); + } + MOCK_METHOD(federated_learning::mojom::WebUIFlocStatusPtr, + GetFlocStatusForWebUi, + (), + (const, override)); + MOCK_METHOD(void, MaybeRecordFlocToUkm, (ukm::SourceId), (override)); + MOCK_METHOD(base::Time, GetApproximateNextComputeTime, (), (const, override)); +}; + +class MockPrivacySandboxObserver : public PrivacySandboxSettings::Observer { + public: + MOCK_METHOD(void, OnFlocDataAccessibleSinceUpdated, (bool), (override)); +}; + +// Define an additional content setting value to simulate an unmanaged default +// content setting. +const ContentSetting kNoSetting = static_cast(-1); + +struct CookieContentSettingException { + std::string primary_pattern; + std::string secondary_pattern; + ContentSetting content_setting; +}; + +} // namespace + +class PrivacySandboxSettingsTest : public testing::Test { + public: + PrivacySandboxSettingsTest() + : browser_task_environment_( + base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} + + void SetUp() override { + InitializePrefsBeforeStart(); + + privacy_sandbox_settings_ = std::make_unique( + HostContentSettingsMapFactory::GetForProfile(profile()), + CookieSettingsFactory::GetForProfile(profile()).get(), + profile()->GetPrefs(), policy_service(), sync_service(), + identity_test_env()->identity_manager()); + } + + virtual void InitializePrefsBeforeStart() {} + + // Sets up preferences and content settings based on provided parameters. + void SetupTestState( + bool privacy_sandbox_enabled, + bool block_third_party_cookies, + ContentSetting default_cookie_setting, + std::vector user_cookie_exceptions, + ContentSetting managed_cookie_setting, + std::vector managed_cookie_exceptions) { + // Setup block-third-party-cookies settings. + profile()->GetTestingPrefService()->SetUserPref( + prefs::kCookieControlsMode, + std::make_unique(static_cast( + block_third_party_cookies + ? content_settings::CookieControlsMode::kBlockThirdParty + : content_settings::CookieControlsMode::kOff))); + + // Setup cookie content settings. + auto* map = HostContentSettingsMapFactory::GetForProfile(profile()); + auto user_provider = std::make_unique(); + auto managed_provider = std::make_unique(); + + if (default_cookie_setting != kNoSetting) { + user_provider->SetWebsiteSetting( + ContentSettingsPattern::Wildcard(), + ContentSettingsPattern::Wildcard(), ContentSettingsType::COOKIES, + std::make_unique(default_cookie_setting)); + } + + for (const auto& exception : user_cookie_exceptions) { + user_provider->SetWebsiteSetting( + ContentSettingsPattern::FromString(exception.primary_pattern), + ContentSettingsPattern::FromString(exception.secondary_pattern), + ContentSettingsType::COOKIES, + std::make_unique(exception.content_setting)); + } + + if (managed_cookie_setting != kNoSetting) { + managed_provider->SetWebsiteSetting( + ContentSettingsPattern::Wildcard(), + ContentSettingsPattern::Wildcard(), ContentSettingsType::COOKIES, + std::make_unique(managed_cookie_setting)); + } + + for (const auto& exception : managed_cookie_exceptions) { + managed_provider->SetWebsiteSetting( + ContentSettingsPattern::FromString(exception.primary_pattern), + ContentSettingsPattern::FromString(exception.secondary_pattern), + ContentSettingsType::COOKIES, + std::make_unique(exception.content_setting)); + } + + content_settings::TestUtils::OverrideProvider( + map, std::move(user_provider), + HostContentSettingsMap::DEFAULT_PROVIDER); + content_settings::TestUtils::OverrideProvider( + map, std::move(managed_provider), + HostContentSettingsMap::POLICY_PROVIDER); + + privacy_sandbox_settings()->SetPrivacySandboxEnabled( + privacy_sandbox_enabled); + } + + TestingProfile* profile() { return &profile_; } + PrivacySandboxSettings* privacy_sandbox_settings() { + return privacy_sandbox_settings_.get(); + } + base::test::ScopedFeatureList* feature_list() { return &feature_list_; } + syncer::TestSyncService* sync_service() { return &sync_service_; } + policy::MockPolicyService* policy_service() { return &mock_policy_service_; } + signin::IdentityTestEnvironment* identity_test_env() { + return &identity_test_env_; + } + + private: + content::BrowserTaskEnvironment browser_task_environment_; + signin::IdentityTestEnvironment identity_test_env_; + testing::NiceMock mock_policy_service_; + + TestingProfile profile_; + base::test::ScopedFeatureList feature_list_; + syncer::TestSyncService sync_service_; + + std::unique_ptr privacy_sandbox_settings_; +}; + +TEST_F(PrivacySandboxSettingsTest, PreferenceOverridesDefaultContentSetting) { + // Even if we try to enable the Privacy Sandbox, it should remain disabled, so + // the sandbox preference should never override the default cookie content. + SetupTestState( + /*privacy_sandbox_enabled=*/true, + /*block_third_party_cookies=*/false, + /*default_cookie_setting=*/ContentSetting::CONTENT_SETTING_BLOCK, + /*user_cookie_exceptions=*/{}, + /*managed_cookie_setting=*/kNoSetting, + /*managed_cookie_exceptions=*/{}); + + // All should be DISABLED: FLoC, Conversion measurement & reporting, fledge... + EXPECT_FALSE(privacy_sandbox_settings()->IsFlocAllowedForContext( + GURL("https://embedded.com"), + url::Origin::Create(GURL("https://test.com")))); + EXPECT_FALSE(privacy_sandbox_settings()->IsConversionMeasurementAllowed( + url::Origin::Create(GURL("https://test.com")), + url::Origin::Create(GURL("https://embedded.com")))); + EXPECT_FALSE(privacy_sandbox_settings()->ShouldSendConversionReport( + url::Origin::Create(GURL("https://test.com")), + url::Origin::Create(GURL("https://another-test.com")), + url::Origin::Create(GURL("https://embedded.com")))); + EXPECT_FALSE(privacy_sandbox_settings()->IsFledgeAllowed( + url::Origin::Create(GURL("https://test.com")), + GURL("https://embedded.com"))); + EXPECT_EQ(std::vector{}, + privacy_sandbox_settings()->FilterFledgeAllowedParties( + url::Origin::Create(GURL("https://test.com")), + {GURL("https://embedded.com"), + GURL("https://another-embedded.com")})); + + // An allow exception should not override the preference value. + SetupTestState( + /*privacy_sandbox_enabled=*/false, + /*block_third_party_cookies=*/false, + /*default_cookie_setting=*/ContentSetting::CONTENT_SETTING_ALLOW, + /*user_cookie_exceptions=*/ + {{"https://embedded.com", "https://test.com", + ContentSetting::CONTENT_SETTING_ALLOW}, + {"https://another-embedded.com", "https://test.com", + ContentSetting::CONTENT_SETTING_ALLOW}, + {"https://embedded.com", "https://another-test.com", + ContentSetting::CONTENT_SETTING_ALLOW}}, + /*managed_cookie_setting=*/kNoSetting, + /*managed_cookie_exceptions=*/{}); + + EXPECT_FALSE(privacy_sandbox_settings()->IsFlocAllowedForContext( + GURL("https://embedded.com"), + url::Origin::Create(GURL("https://test.com")))); + + EXPECT_FALSE(privacy_sandbox_settings()->IsConversionMeasurementAllowed( + url::Origin::Create(GURL("https://test.com")), + url::Origin::Create(GURL("https://embedded.com")))); + EXPECT_FALSE(privacy_sandbox_settings()->ShouldSendConversionReport( + url::Origin::Create(GURL("https://test.com")), + url::Origin::Create(GURL("https://another-test.com")), + url::Origin::Create(GURL("https://embedded.com")))); + + EXPECT_FALSE(privacy_sandbox_settings()->IsFledgeAllowed( + url::Origin::Create(GURL("https://test.com")), + GURL("https://embedded.com"))); + EXPECT_EQ(std::vector{}, + privacy_sandbox_settings()->FilterFledgeAllowedParties( + url::Origin::Create(GURL("https://test.com")), + {GURL("https://embedded.com"), + GURL("https://another-embedded.com")})); +} + +TEST_F(PrivacySandboxSettingsTest, CookieBlockExceptionsNeverApply) { + // Even if we try to enable the Privacy Sandbox, it should remain disabled, so + // targeted cookie block exceptions should never apply. + SetupTestState( + /*privacy_sandbox_enabled=*/true, + /*block_third_party_cookies=*/false, + /*default_cookie_setting=*/ContentSetting::CONTENT_SETTING_ALLOW, + /*user_cookie_exceptions=*/ + {{"https://embedded.com", "https://test.com", + ContentSetting::CONTENT_SETTING_BLOCK}, + {"https://another-embedded.com", "*", + ContentSetting::CONTENT_SETTING_BLOCK}}, + /*managed_cookie_setting=*/kNoSetting, + /*managed_cookie_exceptions=*/{}); + + EXPECT_FALSE(privacy_sandbox_settings()->IsFlocAllowedForContext( + GURL("https://embedded.com"), + url::Origin::Create(GURL("https://test.com")))); + + EXPECT_FALSE(privacy_sandbox_settings()->IsConversionMeasurementAllowed( + url::Origin::Create(GURL("https://test.com")), + url::Origin::Create(GURL("https://embedded.com")))); + EXPECT_FALSE(privacy_sandbox_settings()->ShouldSendConversionReport( + url::Origin::Create(GURL("https://test.com")), + url::Origin::Create(GURL("https://another-test.com")), + url::Origin::Create(GURL("https://embedded.com")))); + + EXPECT_FALSE(privacy_sandbox_settings()->IsFledgeAllowed( + url::Origin::Create(GURL("https://test.com")), + GURL("https://embedded.com"))); + EXPECT_EQ(std::vector{}, + privacy_sandbox_settings()->FilterFledgeAllowedParties( + url::Origin::Create(GURL("https://test.com")), + {GURL("https://embedded.com"), + GURL("https://another-embedded.com")})); + + // User created exceptions should not apply if a managed default coookie + // setting exists. What the managed default setting actually is should *not* + // affect whether APIs are enabled. The cookie managed state is reflected in + // the privacy sandbox preferences directly. + SetupTestState( + /*privacy_sandbox_enabled=*/true, + /*block_third_party_cookies=*/false, + /*default_cookie_setting=*/ContentSetting::CONTENT_SETTING_ALLOW, + /*user_cookie_exceptions=*/ + {{"https://embedded.com", "https://test.com", + ContentSetting::CONTENT_SETTING_BLOCK}, + {"https://another-embedded.com", "https://test.com", + ContentSetting::CONTENT_SETTING_BLOCK}, + {"https://embedded.com", "https://another-test.com", + ContentSetting::CONTENT_SETTING_BLOCK}}, + /*managed_cookie_setting=*/ContentSetting::CONTENT_SETTING_BLOCK, + /*managed_cookie_exceptions=*/{}); + + // All should be DISABLED: FLoC, Conversion measurement & reporting, fledge... + EXPECT_FALSE(privacy_sandbox_settings()->IsFlocAllowedForContext( + GURL("https://embedded.com"), + url::Origin::Create(GURL("https://test.com")))); + EXPECT_FALSE(privacy_sandbox_settings()->IsConversionMeasurementAllowed( + url::Origin::Create(GURL("https://test.com")), + url::Origin::Create(GURL("https://embedded.com")))); + EXPECT_FALSE(privacy_sandbox_settings()->ShouldSendConversionReport( + url::Origin::Create(GURL("https://test.com")), + url::Origin::Create(GURL("https://another-test.com")), + url::Origin::Create(GURL("https://embedded.com")))); + EXPECT_FALSE(privacy_sandbox_settings()->IsFledgeAllowed( + url::Origin::Create(GURL("https://test.com")), + GURL("https://embedded.com"))); + EXPECT_EQ(std::vector{}, + privacy_sandbox_settings()->FilterFledgeAllowedParties( + url::Origin::Create(GURL("https://test.com")), + {GURL("https://embedded.com"), + GURL("https://another-embedded.com")})); + + // Managed content setting exceptions. + SetupTestState( + /*privacy_sandbox_enabled=*/true, + /*block_third_party_cookies=*/false, + /*default_cookie_setting=*/ContentSetting::CONTENT_SETTING_ALLOW, + /*user_cookie_exceptions=*/ + {{"https://embedded.com", "https://test.com", + ContentSetting::CONTENT_SETTING_ALLOW}, + {"https://another-embedded.com", "https://test.com", + ContentSetting::CONTENT_SETTING_ALLOW}, + {"https://embedded.com", "https://another-test.com", + ContentSetting::CONTENT_SETTING_ALLOW}}, + /*managed_cookie_setting=*/ContentSetting::CONTENT_SETTING_ALLOW, + {{"https://embedded.com", "https://test.com", + ContentSetting::CONTENT_SETTING_BLOCK}}); + + // It doesn't matter, everything should be DISABLED again. + EXPECT_FALSE(privacy_sandbox_settings()->IsFlocAllowedForContext( + GURL("https://embedded.com"), + url::Origin::Create(GURL("https://test.com")))); + EXPECT_FALSE(privacy_sandbox_settings()->IsFlocAllowedForContext( + GURL("https://unrelated.com"), + url::Origin::Create(GURL("https://unrelated.com")))); + + EXPECT_FALSE(privacy_sandbox_settings()->IsConversionMeasurementAllowed( + url::Origin::Create(GURL("https://test.com")), + url::Origin::Create(GURL("https://embedded.com")))); + EXPECT_FALSE(privacy_sandbox_settings()->ShouldSendConversionReport( + url::Origin::Create(GURL("https://test.com")), + url::Origin::Create(GURL("https://another-test.com")), + url::Origin::Create(GURL("https://embedded.com")))); + EXPECT_FALSE(privacy_sandbox_settings()->IsConversionMeasurementAllowed( + url::Origin::Create(GURL("https://unrelated-a.com")), + url::Origin::Create(GURL("https://unrelated-b.com")))); + EXPECT_FALSE(privacy_sandbox_settings()->ShouldSendConversionReport( + url::Origin::Create(GURL("https://unrelated-c.com")), + url::Origin::Create(GURL("https://unrelated-d.com")), + url::Origin::Create(GURL("https://unrelated-e.com")))); + + EXPECT_FALSE(privacy_sandbox_settings()->IsFledgeAllowed( + url::Origin::Create(GURL("https://test.com")), + GURL("https://embedded.com"))); + EXPECT_EQ(std::vector{}, + privacy_sandbox_settings()->FilterFledgeAllowedParties( + url::Origin::Create(GURL("https://test.com")), + {GURL("https://embedded.com"), + GURL("https://another-embedded.com")})); + + // A less specific block exception. + SetupTestState( + /*privacy_sandbox_enabled=*/true, + /*block_third_party_cookies=*/false, + /*default_cookie_setting=*/ContentSetting::CONTENT_SETTING_ALLOW, + /*user_cookie_exceptions=*/ + {{"https://embedded.com", "https://test.com", + ContentSetting::CONTENT_SETTING_ALLOW}, + {"https://embedded.com", "https://another-test.com", + ContentSetting::CONTENT_SETTING_ALLOW}, + {"https://[*.]embedded.com", "https://[*.]test.com", + ContentSetting::CONTENT_SETTING_BLOCK}, + {"https://[*.]embedded.com", "https://[*.]another-test.com", + ContentSetting::CONTENT_SETTING_BLOCK}}, + /*managed_cookie_setting=*/kNoSetting, + /*managed_cookie_exceptions=*/{}); + + // It doesn't matter, everything should be DISABLED again. + EXPECT_FALSE(privacy_sandbox_settings()->IsFlocAllowedForContext( + GURL("https://embedded.com"), + url::Origin::Create(GURL("https://test.com")))); + + EXPECT_FALSE(privacy_sandbox_settings()->IsFledgeAllowed( + url::Origin::Create(GURL("https://test.com")), + GURL("https://embedded.com"))); + + // Exceptions which specify a top frame origin. + SetupTestState( + /*privacy_sandbox_enabled=*/true, + /*block_third_party_cookies=*/false, + /*default_cookie_setting=*/ContentSetting::CONTENT_SETTING_BLOCK, + /*user_cookie_exceptions=*/ + {{"https://embedded.com", "https://test.com", + ContentSetting::CONTENT_SETTING_BLOCK}}, + /*managed_cookie_setting=*/kNoSetting, + /*managed_cookie_exceptions=*/ + {{"https://embedded.com", "https://test.com", + ContentSetting::CONTENT_SETTING_BLOCK}}); + + // It doesn't matter, everything should be DISABLED again. + EXPECT_FALSE(privacy_sandbox_settings()->IsFlocAllowedForContext( + GURL("https://embedded.com"), absl::nullopt)); + + EXPECT_FALSE(privacy_sandbox_settings()->IsConversionMeasurementAllowed( + url::Origin::Create(GURL("https://another-test.com")), + url::Origin::Create(GURL("https://embedded.com")))); + EXPECT_FALSE(privacy_sandbox_settings()->ShouldSendConversionReport( + url::Origin::Create(GURL("https://another-test.com")), + url::Origin::Create(GURL("https://yet-another-test.com")), + url::Origin::Create(GURL("https://embedded.com")))); + + EXPECT_FALSE(privacy_sandbox_settings()->IsFledgeAllowed( + url::Origin::Create(GURL("https://another-test.com")), + GURL("https://embedded.com"))); + EXPECT_EQ(std::vector{}, + privacy_sandbox_settings()->FilterFledgeAllowedParties( + url::Origin::Create(GURL("https://test.com")), + {GURL("https://embedded.com"), + GURL("https://another-embedded.com")})); + + // Exceptions which specify a wildcard top frame origin. + SetupTestState( + /*privacy_sandbox_enabled=*/true, + /*block_third_party_cookies=*/false, + /*default_cookie_setting=*/ContentSetting::CONTENT_SETTING_ALLOW, + /*user_cookie_exceptions=*/ + {{"https://embedded.com", "*", ContentSetting::CONTENT_SETTING_BLOCK}}, + /*managed_cookie_setting=*/kNoSetting, + /*managed_cookie_exceptions=*/{}); + + // It doesn't matter, everything should be DISABLED again. + EXPECT_FALSE(privacy_sandbox_settings()->IsFlocAllowedForContext( + GURL("https://embedded.com"), absl::nullopt)); + EXPECT_FALSE(privacy_sandbox_settings()->IsFlocAllowedForContext( + GURL("https://embedded.com"), + url::Origin::Create(GURL("https://test.com")))); + + EXPECT_FALSE(privacy_sandbox_settings()->IsConversionMeasurementAllowed( + url::Origin::Create(GURL("https://test.com")), + url::Origin::Create(GURL("https://embedded.com")))); + EXPECT_FALSE(privacy_sandbox_settings()->ShouldSendConversionReport( + url::Origin::Create(GURL("https://test.com")), + url::Origin::Create(GURL("https://another-test.com")), + url::Origin::Create(GURL("https://embedded.com")))); + + EXPECT_FALSE(privacy_sandbox_settings()->IsFledgeAllowed( + url::Origin::Create(GURL("https://test.com")), + GURL("https://embedded.com"))); + EXPECT_EQ(std::vector{}, + privacy_sandbox_settings()->FilterFledgeAllowedParties( + url::Origin::Create(GURL("https://test.com")), + {GURL("https://embedded.com"), + GURL("https://another-embedded.com")})); +} + +TEST_F(PrivacySandboxSettingsTest, IsFledgeAllowed) { + // FLEDGE should be disabled if 3P cookies are blocked. + SetupTestState( + /*privacy_sandbox_enabled=*/true, + /*block_third_party_cookies=*/true, + /*default_cookie_setting=*/ContentSetting::CONTENT_SETTING_ALLOW, + /*user_cookie_exceptions=*/{}, + /*managed_cookie_setting=*/kNoSetting, + /*managed_cookie_exceptions=*/{}); + + EXPECT_FALSE(privacy_sandbox_settings()->IsFledgeAllowed( + url::Origin::Create(GURL("https://test.com")), + GURL("https://embedded.com"))); + EXPECT_EQ(std::vector{}, + privacy_sandbox_settings()->FilterFledgeAllowedParties( + url::Origin::Create(GURL("https://test.com")), + {GURL("https://embedded.com")})); + + // FLEDGE should be disabled if all cookies are blocked. + SetupTestState( + /*privacy_sandbox_enabled=*/true, + /*block_third_party_cookies=*/false, + /*default_cookie_setting=*/ContentSetting::CONTENT_SETTING_BLOCK, + /*user_cookie_exceptions=*/{}, + /*managed_cookie_setting=*/kNoSetting, + /*managed_cookie_exceptions=*/{}); + + EXPECT_FALSE(privacy_sandbox_settings()->IsFledgeAllowed( + url::Origin::Create(GURL("https://test.com")), + GURL("https://embedded.com"))); + EXPECT_EQ(std::vector{}, + privacy_sandbox_settings()->FilterFledgeAllowedParties( + url::Origin::Create(GURL("https://test.com")), + {GURL("https://embedded.com")})); + + // FLEDGE should be disabled if the privacy sandbox is disabled, regardless + // of other cookie settings. + SetupTestState( + /*privacy_sandbox_enabled=*/false, + /*block_third_party_cookies=*/false, + /*default_cookie_setting=*/ContentSetting::CONTENT_SETTING_ALLOW, + /*user_cookie_exceptions=*/ + {{"https://embedded.com", "https://test.com", + ContentSetting::CONTENT_SETTING_ALLOW}}, + /*managed_cookie_setting=*/ContentSetting::CONTENT_SETTING_ALLOW, + /*managed_cookie_exceptions=*/ + {{"https://embedded.com", "https://test.com", + ContentSetting::CONTENT_SETTING_ALLOW}}); + + EXPECT_FALSE(privacy_sandbox_settings()->IsFledgeAllowed( + url::Origin::Create(GURL("https://test.com")), + GURL("https://embedded.com"))); + EXPECT_EQ(std::vector{}, + privacy_sandbox_settings()->FilterFledgeAllowedParties( + url::Origin::Create(GURL("https://test.com")), + {GURL("https://embedded.com")})); + + // The managed cookie content setting should not override a disabled privacy + // sandbox setting. + SetupTestState( + /*privacy_sandbox_enabled=*/false, + /*block_third_party_cookies=*/false, + /*default_cookie_setting=*/ContentSetting::CONTENT_SETTING_ALLOW, + /*user_cookie_exceptions=*/{}, + /*managed_cookie_setting=*/ContentSetting::CONTENT_SETTING_ALLOW, + /*managed_cookie_exceptions=*/{}); + + EXPECT_FALSE(privacy_sandbox_settings()->IsFledgeAllowed( + url::Origin::Create(GURL("https://test.com")), + GURL("https://embedded.com"))); + EXPECT_EQ(std::vector{}, + privacy_sandbox_settings()->FilterFledgeAllowedParties( + url::Origin::Create(GURL("https://test.com")), + {GURL("https://embedded.com")})); +} + +TEST_F(PrivacySandboxSettingsTest, IsPrivacySandboxAllowed) { + SetupTestState( + /*privacy_sandbox_enabled=*/false, + /*block_third_party_cookies=*/false, + /*default_cookie_setting=*/ContentSetting::CONTENT_SETTING_ALLOW, + /*user_cookie_exceptions=*/{}, + /*managed_cookie_setting=*/kNoSetting, + /*managed_cookie_exceptions=*/{}); + EXPECT_FALSE(privacy_sandbox_settings()->IsPrivacySandboxAllowed()); + + SetupTestState( + /*privacy_sandbox_enabled=*/false, + /*block_third_party_cookies=*/true, + /*default_cookie_setting=*/ContentSetting::CONTENT_SETTING_ALLOW, + /*user_cookie_exceptions=*/{}, + /*managed_cookie_setting=*/kNoSetting, + /*managed_cookie_exceptions=*/{}); + EXPECT_FALSE(privacy_sandbox_settings()->IsPrivacySandboxAllowed()); + + SetupTestState( + /*privacy_sandbox_enabled=*/true, + /*block_third_party_cookies=*/false, + /*default_cookie_setting=*/ContentSetting::CONTENT_SETTING_ALLOW, + /*user_cookie_exceptions=*/{}, + /*managed_cookie_setting=*/kNoSetting, + /*managed_cookie_exceptions=*/{}); + + // Trying to enable the privacy sandbox doesn't make a difference in Brave. + EXPECT_FALSE(privacy_sandbox_settings()->IsPrivacySandboxAllowed()); + + // Check that even bypassing PrivacySandboxSettings::SetPrivacySandboxEnabled, + // and manually updating the preference, we still don't get this enabled. + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxApisEnabled, true); + EXPECT_FALSE(privacy_sandbox_settings()->IsPrivacySandboxAllowed()); +} + +TEST_F(PrivacySandboxSettingsTest, IsFlocAllowed) { + SetupTestState( + /*privacy_sandbox_enabled=*/true, + /*block_third_party_cookies=*/true, + /*default_cookie_setting=*/ContentSetting::CONTENT_SETTING_BLOCK, + /*user_cookie_exceptions=*/{}, + /*managed_cookie_setting=*/kNoSetting, + /*managed_cookie_exceptions=*/{}); + + // FLoC should be disabled since the privacy sandbox APIs can't be enabled. + privacy_sandbox_settings()->SetFlocPrefEnabled(true); + EXPECT_FALSE(privacy_sandbox_settings()->IsFlocAllowed()); + + // Check that even bypassing PrivacySandboxSettings::SetFlocPrefEnabled, + // and manually updating the preferences, we still don't get this enabled. + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxApisEnabled, true); + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxFlocEnabled, true); + EXPECT_FALSE(privacy_sandbox_settings()->IsFlocAllowed()); + + SetupTestState( + /*privacy_sandbox_enabled=*/false, + /*block_third_party_cookies=*/false, + /*default_cookie_setting=*/ContentSetting::CONTENT_SETTING_BLOCK, + /*user_cookie_exceptions=*/{}, + /*managed_cookie_setting=*/kNoSetting, + /*managed_cookie_exceptions=*/{}); + privacy_sandbox_settings()->SetFlocPrefEnabled(true); + EXPECT_FALSE(privacy_sandbox_settings()->IsFlocAllowed()); + + SetupTestState( + /*privacy_sandbox_enabled=*/true, + /*block_third_party_cookies=*/false, + /*default_cookie_setting=*/ContentSetting::CONTENT_SETTING_ALLOW, + /*user_cookie_exceptions=*/{}, + /*managed_cookie_setting=*/kNoSetting, + /*managed_cookie_exceptions=*/{}); + privacy_sandbox_settings()->SetFlocPrefEnabled(false); + EXPECT_FALSE(privacy_sandbox_settings()->IsFlocAllowed()); + + SetupTestState( + /*privacy_sandbox_enabled=*/false, + /*block_third_party_cookies=*/false, + /*default_cookie_setting=*/ContentSetting::CONTENT_SETTING_ALLOW, + /*user_cookie_exceptions=*/{}, + /*managed_cookie_setting=*/kNoSetting, + /*managed_cookie_exceptions=*/{}); + privacy_sandbox_settings()->SetFlocPrefEnabled(true); + EXPECT_FALSE(privacy_sandbox_settings()->IsFlocAllowed()); +} + +TEST_F(PrivacySandboxSettingsTest, GetFlocIdForDisplay) { + // Check that the cohort identifier is correctly converted to a string when + // available. + feature_list()->InitWithFeatures( + {blink::features::kInterestCohortAPIOriginTrial}, {}); + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxFlocEnabled, true); + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxApisEnabled, true); + + // In Brave, we actually don't enable anything here. + EXPECT_FALSE(privacy_sandbox_settings()->IsPrivacySandboxAllowed()); + EXPECT_FALSE(privacy_sandbox_settings()->IsFlocAllowed()); + + federated_learning::FlocId floc_id = federated_learning::FlocId::CreateValid( + 123456, base::Time(), base::Time::Now(), + /*sorting_lsh_version=*/0); + floc_id.SaveToPrefs(profile()->GetTestingPrefService()); + + // No valid ID is obtained since FLoC is actually disabled. + EXPECT_EQ(l10n_util::GetStringUTF16(IDS_PRIVACY_SANDBOX_FLOC_INVALID), + privacy_sandbox_settings()->GetFlocIdForDisplay()); + + // If the FLoC preference, the Sandbox Preference, or the feature is disabled, + // or the FLoC ID is invalid, the invalid string should be returned. + feature_list()->Reset(); + feature_list()->InitWithFeatures( + {}, {blink::features::kInterestCohortAPIOriginTrial}); + EXPECT_EQ(l10n_util::GetStringUTF16(IDS_PRIVACY_SANDBOX_FLOC_INVALID), + privacy_sandbox_settings()->GetFlocIdForDisplay()); + + feature_list()->Reset(); + feature_list()->InitWithFeatures( + {blink::features::kInterestCohortAPIOriginTrial}, {}); + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxApisEnabled, false); + EXPECT_EQ(l10n_util::GetStringUTF16(IDS_PRIVACY_SANDBOX_FLOC_INVALID), + privacy_sandbox_settings()->GetFlocIdForDisplay()); + + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxApisEnabled, true); + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxFlocEnabled, false); + EXPECT_EQ(l10n_util::GetStringUTF16(IDS_PRIVACY_SANDBOX_FLOC_INVALID), + privacy_sandbox_settings()->GetFlocIdForDisplay()); + + floc_id.UpdateStatusAndSaveToPrefs( + profile()->GetTestingPrefService(), + federated_learning::FlocId::Status::kInvalidReset); + EXPECT_EQ(l10n_util::GetStringUTF16(IDS_PRIVACY_SANDBOX_FLOC_INVALID), + privacy_sandbox_settings()->GetFlocIdForDisplay()); +} + +TEST_F(PrivacySandboxSettingsTest, GetFlocIdNextUpdateForDisplay) { + // Check that date FLoC will be next updated is returned when available. + MockFlocIdProvider mock_floc_id_provider; + feature_list()->InitWithFeatures( + {blink::features::kInterestCohortAPIOriginTrial}, {}); + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxApisEnabled, true); + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxFlocEnabled, true); + + // In Brave, we actually don't enable anything here. + EXPECT_FALSE(privacy_sandbox_settings()->IsPrivacySandboxAllowed()); + EXPECT_FALSE(privacy_sandbox_settings()->IsFlocAllowed()); + + std::map offsets_to_expected_string = { + {base::TimeDelta::FromHours(23), + l10n_util::GetStringUTF16( + IDS_PRIVACY_SANDBOX_FLOC_TIME_TO_NEXT_COMPUTE_INVALID)}, + {base::TimeDelta::FromHours(25), + l10n_util::GetStringUTF16( + IDS_PRIVACY_SANDBOX_FLOC_TIME_TO_NEXT_COMPUTE_INVALID)}, + {base::TimeDelta::FromDays(2), + l10n_util::GetStringUTF16( + IDS_PRIVACY_SANDBOX_FLOC_TIME_TO_NEXT_COMPUTE_INVALID)}, + {base::TimeDelta::FromHours(60), + l10n_util::GetStringUTF16( + IDS_PRIVACY_SANDBOX_FLOC_TIME_TO_NEXT_COMPUTE_INVALID)}, + {base::TimeDelta::FromHours(167), // 1 hour less than 7 days. + l10n_util::GetStringUTF16( + IDS_PRIVACY_SANDBOX_FLOC_TIME_TO_NEXT_COMPUTE_INVALID)}}; + + for (const auto& offset_expected : offsets_to_expected_string) { + EXPECT_EQ( + offset_expected.second, + privacy_sandbox_settings()->GetFlocIdNextUpdateForDisplay( + &mock_floc_id_provider, profile()->GetPrefs(), base::Time::Now())); + testing::Mock::VerifyAndClearExpectations(&mock_floc_id_provider); + } + + // Disabling the FLoC feature should also invalidate the next compute time. + feature_list()->Reset(); + feature_list()->InitWithFeatures( + {}, {blink::features::kInterestCohortAPIOriginTrial}); + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxFlocEnabled, true); + testing::Mock::VerifyAndClearExpectations(&mock_floc_id_provider); +} + +TEST_F(PrivacySandboxSettingsTest, GetFlocStatusForDisplay) { + // Check the status of the user's FLoC is correctly returned. This depends + // on whether the FLoC origin trial feature is enabled, and whether the user + // has FLoC enabled. + feature_list()->InitWithFeatures( + {blink::features::kInterestCohortAPIOriginTrial}, {}); + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxFlocEnabled, true); + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxApisEnabled, true); + + // In Brave, we actually don't enable anything here. + EXPECT_FALSE(privacy_sandbox_settings()->IsPrivacySandboxAllowed()); + EXPECT_FALSE(privacy_sandbox_settings()->IsFlocAllowed()); + + // Will report not active since nothing is actually enabled. + EXPECT_EQ( + l10n_util::GetStringUTF16(IDS_PRIVACY_SANDBOX_FLOC_STATUS_NOT_ACTIVE), + privacy_sandbox_settings()->GetFlocStatusForDisplay()); + + // The Privacy Sandbox APIs pref & FLoC pref should disable the trial when + // either is disabled. + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxApisEnabled, false); + EXPECT_EQ( + l10n_util::GetStringUTF16(IDS_PRIVACY_SANDBOX_FLOC_STATUS_NOT_ACTIVE), + privacy_sandbox_settings()->GetFlocStatusForDisplay()); + + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxApisEnabled, true); + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxFlocEnabled, false); + EXPECT_EQ( + l10n_util::GetStringUTF16(IDS_PRIVACY_SANDBOX_FLOC_STATUS_NOT_ACTIVE), + privacy_sandbox_settings()->GetFlocStatusForDisplay()); + + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxFlocEnabled, true); + feature_list()->Reset(); + feature_list()->InitWithFeatures( + {}, {blink::features::kInterestCohortAPIOriginTrial}); + + // Will report not active again since nothing is actually enabled. + EXPECT_EQ( + l10n_util::GetStringUTF16(IDS_PRIVACY_SANDBOX_FLOC_STATUS_NOT_ACTIVE), + privacy_sandbox_settings()->GetFlocStatusForDisplay()); +} + +TEST_F(PrivacySandboxSettingsTest, IsFlocIdResettable) { + // Check that if FLoC is functional the FLoC ID is resettable, regardless of + // whether the FLoC ID is currently valid. + feature_list()->InitWithFeatures( + {blink::features::kInterestCohortAPIOriginTrial}, {}); + federated_learning::FlocId floc_id = federated_learning::FlocId::CreateValid( + 123456, base::Time(), base::Time::Now(), + /*sorting_lsh_version=*/0); + floc_id.SaveToPrefs(profile()->GetTestingPrefService()); + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxFlocEnabled, true); + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxApisEnabled, true); + + // In Brave, we actually don't enable anything here. + EXPECT_FALSE(privacy_sandbox_settings()->IsPrivacySandboxAllowed()); + EXPECT_FALSE(privacy_sandbox_settings()->IsFlocAllowed()); + EXPECT_FALSE(privacy_sandbox_settings()->IsFlocIdResettable()); + + feature_list()->Reset(); + feature_list()->InitWithFeatures( + {}, {blink::features::kInterestCohortAPIOriginTrial}); + EXPECT_FALSE(privacy_sandbox_settings()->IsFlocIdResettable()); + + feature_list()->Reset(); + feature_list()->InitWithFeatures( + {blink::features::kInterestCohortAPIOriginTrial}, {}); + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxFlocEnabled, false); + EXPECT_FALSE(privacy_sandbox_settings()->IsFlocIdResettable()); + + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxFlocEnabled, true); + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxFlocEnabled, false); + EXPECT_FALSE(privacy_sandbox_settings()->IsFlocIdResettable()); + + floc_id.UpdateStatusAndSaveToPrefs( + profile()->GetTestingPrefService(), + federated_learning::FlocId::Status::kInvalidReset); + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxFlocEnabled, true); + + // In Brave, trying to re-enable FLoC won't make a difference. + EXPECT_FALSE(privacy_sandbox_settings()->IsFlocIdResettable()); +} + +TEST_F(PrivacySandboxSettingsTest, IsFlocPrefEnabled) { + // IsFlocPrefEnabled should directly reflect the state of the FLoC pref, which + // will always be false regardless of our attempts to set it to true. + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxFlocEnabled, true); + EXPECT_FALSE(privacy_sandbox_settings()->IsFlocPrefEnabled()); + + // The Privacy Sandbox APIs pref should not impact the return value. + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxApisEnabled, false); + EXPECT_FALSE(privacy_sandbox_settings()->IsFlocPrefEnabled()); + + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxFlocEnabled, false); + EXPECT_FALSE(privacy_sandbox_settings()->IsFlocPrefEnabled()); +} + +TEST_F(PrivacySandboxSettingsTest, SetFlocPrefEnabled) { + // The FLoc pref should NEVER be updated by this function, regardless of + // other Sandbox State or any calls to SetFlocPrefEnabled(). + base::UserActionTester user_action_tester; + ASSERT_EQ(0, user_action_tester.GetActionCount( + "Settings.PrivacySandbox.FlocEnabled")); + ASSERT_EQ(0, user_action_tester.GetActionCount( + "Settings.PrivacySandbox.FlocDisabled")); + + privacy_sandbox_settings()->SetFlocPrefEnabled(false); + EXPECT_FALSE(profile()->GetTestingPrefService()->GetBoolean( + prefs::kPrivacySandboxFlocEnabled)); + ASSERT_EQ(0, user_action_tester.GetActionCount( + "Settings.PrivacySandbox.FlocEnabled")); + ASSERT_EQ(1, user_action_tester.GetActionCount( + "Settings.PrivacySandbox.FlocDisabled")); + + // Disabling the sandbox shouldn't make a difference on the FLoC preference, + // which should remain disabled regardless of calls to SetFlocPrefEnabled(). + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxApisEnabled, false); + privacy_sandbox_settings()->SetFlocPrefEnabled(true); + EXPECT_FALSE(profile()->GetTestingPrefService()->GetBoolean( + prefs::kPrivacySandboxFlocEnabled)); + ASSERT_EQ(1, user_action_tester.GetActionCount( + "Settings.PrivacySandbox.FlocEnabled")); + ASSERT_EQ(1, user_action_tester.GetActionCount( + "Settings.PrivacySandbox.FlocDisabled")); +} + +TEST_F(PrivacySandboxSettingsTest, OnPrivacySandboxPrefChanged) { + // When either the main Privacy Sandbox pref, or the FLoC pref, are changed + // the FLoC ID should be reset. + MockPrivacySandboxObserver mock_privacy_sandbox_observer; + privacy_sandbox_settings()->AddObserver(&mock_privacy_sandbox_observer); + EXPECT_CALL(mock_privacy_sandbox_observer, + OnFlocDataAccessibleSinceUpdated(/*reset_compute_timer=*/true)); + + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxApisEnabled, false); + testing::Mock::VerifyAndClearExpectations(&mock_privacy_sandbox_observer); + + EXPECT_CALL(mock_privacy_sandbox_observer, + OnFlocDataAccessibleSinceUpdated(/*reset_compute_timer=*/true)); + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxFlocEnabled, false); + testing::Mock::VerifyAndClearExpectations(&mock_privacy_sandbox_observer); + + // OnFlocDataAccessibleSinceUpdated() will be called twice because the attempt + // to enable the pref will be immediately followed by setting it to false. + EXPECT_CALL(mock_privacy_sandbox_observer, + OnFlocDataAccessibleSinceUpdated(/*reset_compute_timer=*/true)) + .Times(2); + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxFlocEnabled, true); + testing::Mock::VerifyAndClearExpectations(&mock_privacy_sandbox_observer); + + // OnFlocDataAccessibleSinceUpdated() will be called twice because the attempt + // to enable the pref will be immediately followed by setting it to false. + EXPECT_CALL(mock_privacy_sandbox_observer, + OnFlocDataAccessibleSinceUpdated(/*reset_compute_timer=*/true)) + .Times(2); + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxApisEnabled, true); + testing::Mock::VerifyAndClearExpectations(&mock_privacy_sandbox_observer); +} + +class PrivacySandboxSettingsTestCookiesClearOnExitTurnedOff + : public PrivacySandboxSettingsTest { + public: + void InitializePrefsBeforeStart() override { + profile()->GetTestingPrefService()->SetUserPref( + prefs::kPrivacySandboxFlocDataAccessibleSince, + std::make_unique( + ::base::TimeToValue(base::Time::FromTimeT(12345)))); + } +}; + +TEST_F(PrivacySandboxSettingsTestCookiesClearOnExitTurnedOff, + UseLastFlocDataAccessibleSince) { + EXPECT_EQ(base::Time::FromTimeT(12345), + privacy_sandbox_settings()->FlocDataAccessibleSince()); +} + +class PrivacySandboxSettingsTestCookiesClearOnExitTurnedOn + : public PrivacySandboxSettingsTest { + public: + void InitializePrefsBeforeStart() override { + auto* map = HostContentSettingsMapFactory::GetForProfile(profile()); + map->SetDefaultContentSetting(ContentSettingsType::COOKIES, + ContentSetting::CONTENT_SETTING_SESSION_ONLY); + + profile()->GetTestingPrefService()->SetUserPref( + prefs::kPrivacySandboxFlocDataAccessibleSince, + std::make_unique( + ::base::TimeToValue(base::Time::FromTimeT(12345)))); + } +}; + +TEST_F(PrivacySandboxSettingsTestCookiesClearOnExitTurnedOn, + UpdateFlocDataAccessibleSince) { + EXPECT_EQ(base::Time::Now(), + privacy_sandbox_settings()->FlocDataAccessibleSince()); +} diff --git a/chromium_src/chrome/browser/ui/startup/startup_browser_creator.cc b/chromium_src/chrome/browser/ui/startup/startup_browser_creator.cc index 235a501d1908..a47379cc6d2a 100644 --- a/chromium_src/chrome/browser/ui/startup/startup_browser_creator.cc +++ b/chromium_src/chrome/browser/ui/startup/startup_browser_creator.cc @@ -28,7 +28,6 @@ class BraveStartupBrowserCreatorImpl final : public StartupBrowserCreatorImpl { chrome::startup::IsFirstRun is_first_run); bool Launch(Profile* profile, - const std::vector& urls_to_open, bool process_startup, std::unique_ptr launch_mode_recorder); }; @@ -56,41 +55,22 @@ BraveStartupBrowserCreatorImpl::BraveStartupBrowserCreatorImpl( // won't be launched. bool BraveStartupBrowserCreatorImpl::Launch( Profile* profile, - const std::vector& urls_to_open, bool process_startup, std::unique_ptr launch_mode_recorder) { - std::vector revised_urls_to_open = urls_to_open; -#if defined(OS_WIN) - for (const std::wstring& arg : command_line_.GetArgs()) { - // Fetch url from command line args if it includes microsoft-edge protocol - // and url is delivered. - absl::optional url = GetURLFromMSEdgeProtocol(arg); - if (!url) - continue; - if (url->is_valid()) - revised_urls_to_open.push_back(std::move(*url)); - } -#endif - #if BUILDFLAG(ENABLE_TOR) if (StartupBrowserCreatorImpl::command_line_.HasSwitch(switches::kTor)) { LOG(INFO) << "Switching to Tor profile and starting Tor service."; profile = TorProfileManager::GetInstance().GetTorProfile(profile); - // Call GetURLsFromCommandLine so that if one runs - // brave-browser --tor "? search query" - // the search query is not passed to the default search engine of the - // regular profile. - const std::vector& my_urls_to_open = - GetURLsFromCommandLine(command_line_, cur_dir_, profile); - return StartupBrowserCreatorImpl::Launch(profile, my_urls_to_open, - process_startup, + // Call StartupBrowserCreatorImpl::Launch() with the Tor profile so that if + // one runs brave-browser --tor "? search query" the search query is not + // passed to the default search engine of the regular profile. + return StartupBrowserCreatorImpl::Launch(profile, process_startup, std::move(launch_mode_recorder)); } #endif - return StartupBrowserCreatorImpl::Launch(profile, revised_urls_to_open, - process_startup, + return StartupBrowserCreatorImpl::Launch(profile, process_startup, std::move(launch_mode_recorder)); } diff --git a/chromium_src/chrome/browser/ui/startup/startup_browser_creator.h b/chromium_src/chrome/browser/ui/startup/startup_browser_creator.h new file mode 100644 index 000000000000..e05d0d234894 --- /dev/null +++ b/chromium_src/chrome/browser/ui/startup/startup_browser_creator.h @@ -0,0 +1,15 @@ +/* Copyright (c) 2021 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_H_ +#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_H_ + +// Need to friend the right class, overriden to adapt GetCommandLineTabs() in +// chromium_src/chrome/browser/ui/startup/startup_tab_provider.{h,cc}. +#define StartupTabProviderImpl ChromiumStartupTabProviderImpl +#include "../../../../../../chrome/browser/ui/startup/startup_browser_creator.h" +#undef StartupTabProviderImpl + +#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_H_ diff --git a/chromium_src/chrome/browser/ui/startup/startup_tab_provider.cc b/chromium_src/chrome/browser/ui/startup/startup_tab_provider.cc new file mode 100644 index 000000000000..e68c073fd805 --- /dev/null +++ b/chromium_src/chrome/browser/ui/startup/startup_tab_provider.cc @@ -0,0 +1,36 @@ +/* Copyright (c) 2021 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "chrome/browser/ui/startup/startup_tab_provider.h" +#include "chrome/browser/ui/startup/startup_browser_creator.h" + +#if defined(OS_WIN) +#include "brave/browser/microsoft_edge_protocol_util.h" +#endif + +#define StartupTabProviderImpl ChromiumStartupTabProviderImpl +#include "../../../../../../chrome/browser/ui/startup/startup_tab_provider.cc" +#undef StartupTabProviderImpl + +StartupTabs StartupTabProviderImpl::GetCommandLineTabs( + const base::CommandLine& command_line, + const base::FilePath& cur_dir, + Profile* profile) const { + StartupTabs result = ChromiumStartupTabProviderImpl::GetCommandLineTabs( + command_line, cur_dir, profile); +#if defined(OS_WIN) + for (const std::wstring& arg : command_line.GetArgs()) { + // Fetch url from command line args if it includes microsoft-edge protocol + // and url is delivered. + absl::optional url = GetURLFromMSEdgeProtocol(arg); + if (!url) + continue; + if (url->is_valid()) + result.push_back(StartupTab(url.value(), false)); + } +#endif + + return result; +} diff --git a/chromium_src/chrome/browser/ui/startup/startup_tab_provider.h b/chromium_src/chrome/browser/ui/startup/startup_tab_provider.h new file mode 100644 index 000000000000..c764edbffd7b --- /dev/null +++ b/chromium_src/chrome/browser/ui/startup/startup_tab_provider.h @@ -0,0 +1,24 @@ +/* Copyright (c) 2021 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_STARTUP_STARTUP_TAB_PROVIDER_H_ +#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_STARTUP_STARTUP_TAB_PROVIDER_H_ + +#define StartupTabProviderImpl ChromiumStartupTabProviderImpl +#include "../../../../../../chrome/browser/ui/startup/startup_tab_provider.h" +#undef StartupTabProviderImpl + +class StartupTabProviderImpl : public ChromiumStartupTabProviderImpl { + public: + StartupTabProviderImpl() = default; + StartupTabProviderImpl(const StartupTabProviderImpl&) = delete; + StartupTabProviderImpl& operator=(const StartupTabProviderImpl&) = delete; + + StartupTabs GetCommandLineTabs(const base::CommandLine& command_line, + const base::FilePath& cur_dir, + Profile* profile) const override; +}; + +#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_STARTUP_STARTUP_TAB_PROVIDER_H_ diff --git a/chromium_src/chrome/browser/ui/views/location_bar/location_bar_view_browsertest.cc b/chromium_src/chrome/browser/ui/views/location_bar/location_bar_view_browsertest.cc index 8b1c067fa9b7..fad58ec1ab4f 100644 --- a/chromium_src/chrome/browser/ui/views/location_bar/location_bar_view_browsertest.cc +++ b/chromium_src/chrome/browser/ui/views/location_bar/location_bar_view_browsertest.cc @@ -103,8 +103,8 @@ IN_PROC_BROWSER_TEST_P(SecurityIndicatorTest, CheckIndicatorText) { auto c = GetParam(); SetUpInterceptor(c.cert_status); - ui_test_utils::NavigateToURL( - browser(), c.use_secure_url ? kMockSecureURL : kMockNonsecureURL); + ASSERT_TRUE(ui_test_utils::NavigateToURL( + browser(), c.use_secure_url ? kMockSecureURL : kMockNonsecureURL)); EXPECT_EQ(c.security_level, helper->GetSecurityLevel()); EXPECT_EQ(c.should_show_text, location_bar_view->location_icon_view()->ShouldShowLabel()); diff --git a/chromium_src/chrome/browser/web_applications/components/web_app_shortcut_mac.mm b/chromium_src/chrome/browser/web_applications/web_app_shortcut_mac.mm similarity index 92% rename from chromium_src/chrome/browser/web_applications/components/web_app_shortcut_mac.mm rename to chromium_src/chrome/browser/web_applications/web_app_shortcut_mac.mm index 2bf04f1d74fc..dcc4da1a8976 100644 --- a/chromium_src/chrome/browser/web_applications/components/web_app_shortcut_mac.mm +++ b/chromium_src/chrome/browser/web_applications/web_app_shortcut_mac.mm @@ -11,10 +11,11 @@ base::FilePath GetLocalizableBraveAppShortcutsSubdirName(); } -#include "../../../../../../chrome/browser/web_applications/components/web_app_shortcut_mac.mm" // NOLINT +#include "../../../../../chrome/browser/web_applications/web_app_shortcut_mac.mm" // NOLINT namespace { base::FilePath GetLocalizableBraveAppShortcutsSubdirName() { + // clang-format off static const char kBraveBrowserDevelopmentAppDirName[] = "Brave Browser Development Apps.localized"; static const char kBraveBrowserAppDirName[] = @@ -25,6 +26,7 @@ "Brave Browser Dev Apps.localized"; static const char kBraveBrowserNightlyAppDirName[] = "Brave Browser Nightly Apps.localized"; + // clang-format on switch (chrome::GetChannel()) { case version_info::Channel::STABLE: diff --git a/chromium_src/chrome/common/url_constants.cc b/chromium_src/chrome/common/url_constants.cc index d0c04219db49..08ca34e35aee 100644 --- a/chromium_src/chrome/common/url_constants.cc +++ b/chromium_src/chrome/common/url_constants.cc @@ -121,6 +121,8 @@ const char kGoogleAccountURL[] = "https://support.brave.com/"; const char kGoogleAccountChooserURL[] = "https://support.brave.com/"; +const char kGoogleAccountDeviceActivityURL[] = "https://support.brave.com/"; + const char kGooglePasswordManagerURL[] = "https://support.brave.com"; const char kLearnMoreReportingURL[] = diff --git a/chromium_src/components/content_settings/browser/content_settings_manager_impl.cc b/chromium_src/components/content_settings/browser/content_settings_manager_impl.cc index 0c2edeb905e0..c069231d9fc0 100644 --- a/chromium_src/components/content_settings/browser/content_settings_manager_impl.cc +++ b/chromium_src/components/content_settings/browser/content_settings_manager_impl.cc @@ -12,7 +12,7 @@ namespace content_settings { void ContentSettingsManagerImpl::AllowEphemeralStorageAccess( int32_t render_frame_id, const url::Origin& origin, - const GURL& site_for_cookies, + const net::SiteForCookies& site_for_cookies, const url::Origin& top_frame_origin, AllowEphemeralStorageAccessCallback callback) { url::Origin storage_origin; diff --git a/chromium_src/components/content_settings/browser/content_settings_manager_impl.h b/chromium_src/components/content_settings/browser/content_settings_manager_impl.h index 06b32393cfe3..3932d12edeab 100644 --- a/chromium_src/components/content_settings/browser/content_settings_manager_impl.h +++ b/chromium_src/components/content_settings/browser/content_settings_manager_impl.h @@ -9,12 +9,13 @@ #include "base/containers/flat_map.h" #include "components/content_settings/common/content_settings_manager.mojom.h" -#define OnContentBlocked \ - NotUsed() {} \ - void AllowEphemeralStorageAccess( \ - int32_t render_frame_id, const url::Origin& origin, \ - const GURL& site_for_cookies, const url::Origin& top_frame_origin, \ - AllowEphemeralStorageAccessCallback callback) override; \ +#define OnContentBlocked \ + NotUsed() {} \ + void AllowEphemeralStorageAccess( \ + int32_t render_frame_id, const url::Origin& origin, \ + const net::SiteForCookies& site_for_cookies, \ + const url::Origin& top_frame_origin, \ + AllowEphemeralStorageAccessCallback callback) override; \ void OnContentBlocked #include "../../../../../components/content_settings/browser/content_settings_manager_impl.h" diff --git a/chromium_src/components/content_settings/common/content_settings_manager.mojom b/chromium_src/components/content_settings/common/content_settings_manager.mojom index 7382dcc40b32..f70f05cafda9 100644 --- a/chromium_src/components/content_settings/common/content_settings_manager.mojom +++ b/chromium_src/components/content_settings/common/content_settings_manager.mojom @@ -1,7 +1,7 @@ module content_settings.mojom; +import "services/network/public/mojom/site_for_cookies.mojom"; import "url/mojom/origin.mojom"; -import "url/mojom/url.mojom"; [BraveExtend] interface ContentSettingsManager { @@ -9,6 +9,6 @@ interface ContentSettingsManager { AllowEphemeralStorageAccess( int32 render_frame_id, url.mojom.Origin origin, - url.mojom.Url site_for_cookies, + network.mojom.SiteForCookies site_for_cookies, url.mojom.Origin top_frame_origin) => (url.mojom.Origin? storage_origin); }; diff --git a/chromium_src/components/content_settings/core/browser/cookie_settings.cc b/chromium_src/components/content_settings/core/browser/cookie_settings.cc index 860b950facb3..c85596a274cb 100644 --- a/chromium_src/components/content_settings/core/browser/cookie_settings.cc +++ b/chromium_src/components/content_settings/core/browser/cookie_settings.cc @@ -22,7 +22,7 @@ void CookieSettings::ShutdownOnUIThread() { bool CookieSettings::ShouldUseEphemeralStorage( const url::Origin& origin, - const GURL& site_for_cookies, + const net::SiteForCookies& site_for_cookies, const absl::optional& top_frame_origin, url::Origin& storage_origin) { const bool should_use = CookieSettingsBase::ShouldUseEphemeralStorage( diff --git a/chromium_src/components/content_settings/core/browser/cookie_settings.h b/chromium_src/components/content_settings/core/browser/cookie_settings.h index 608db20a57e6..bdb4fb695556 100644 --- a/chromium_src/components/content_settings/core/browser/cookie_settings.h +++ b/chromium_src/components/content_settings/core/browser/cookie_settings.h @@ -11,24 +11,25 @@ #include "base/containers/flat_map.h" #include "components/content_settings/core/browser/content_settings_provider.h" #include "components/keyed_service/core/refcounted_keyed_service.h" +#include "net/cookies/site_for_cookies.h" #include "url/origin.h" -#define ShutdownOnUIThread \ - ShutdownOnUIThread_ChromiumImpl(); \ - bool ShouldUseEphemeralStorage( \ - const url::Origin& origin, const GURL& site_for_cookies, \ - const absl::optional& top_frame_origin, \ - url::Origin& storage_origin); \ - std::vector TakeEphemeralStorageOpaqueOrigins( \ - const std::string& ephemeral_storage_domain); \ - \ - private: \ - /* Ephemeral storage domain to non_opaque->opaque origins map. */ \ - using EphemeralStorageOrigins = \ - base::flat_map>; \ - EphemeralStorageOrigins ephemeral_storage_origins_; \ - \ - public: \ +#define ShutdownOnUIThread \ + ShutdownOnUIThread_ChromiumImpl(); \ + bool ShouldUseEphemeralStorage( \ + const url::Origin& origin, const net::SiteForCookies& site_for_cookies, \ + const absl::optional& top_frame_origin, \ + url::Origin& storage_origin); \ + std::vector TakeEphemeralStorageOpaqueOrigins( \ + const std::string& ephemeral_storage_domain); \ + \ + private: \ + /* Ephemeral storage domain to non_opaque->opaque origins map. */ \ + using EphemeralStorageOrigins = \ + base::flat_map>; \ + EphemeralStorageOrigins ephemeral_storage_origins_; \ + \ + public: \ void ShutdownOnUIThread #include "../../../../../../components/content_settings/core/browser/cookie_settings.h" diff --git a/chromium_src/components/content_settings/core/common/cookie_settings_base.cc b/chromium_src/components/content_settings/core/common/cookie_settings_base.cc index 36b2032b7f62..53b6a9240078 100644 --- a/chromium_src/components/content_settings/core/common/cookie_settings_base.cc +++ b/chromium_src/components/content_settings/core/common/cookie_settings_base.cc @@ -13,6 +13,7 @@ #include "components/content_settings/core/common/features.h" #include "net/base/features.h" #include "net/base/registry_controlled_domains/registry_controlled_domain.h" +#include "net/cookies/site_for_cookies.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "url/gurl.h" #include "url/origin.h" @@ -96,7 +97,7 @@ ScopedEphemeralStorageAwareness& ScopedEphemeralStorageAwareness::operator=( bool CookieSettingsBase::ShouldUseEphemeralStorage( const GURL& url, - const GURL& site_for_cookies, + const net::SiteForCookies& site_for_cookies, const absl::optional& top_frame_origin) const { if (!base::FeatureList::IsEnabled(net::features::kBraveEphemeralStorage)) return false; @@ -128,12 +129,13 @@ CookieSettingsBase::CreateScopedEphemeralStorageAwareness() const { bool CookieSettingsBase::IsEphemeralCookieAccessAllowed( const GURL& url, const GURL& first_party_url) const { - return IsEphemeralCookieAccessAllowed(url, first_party_url, absl::nullopt); + return IsEphemeralCookieAccessAllowed( + url, net::SiteForCookies::FromUrl(first_party_url), absl::nullopt); } bool CookieSettingsBase::IsEphemeralCookieAccessAllowed( const GURL& url, - const GURL& site_for_cookies, + const net::SiteForCookies& site_for_cookies, const absl::optional& top_frame_origin) const { auto scoped_ephemeral_storage_awareness = CreateScopedEphemeralStorageAwareness(); @@ -143,12 +145,13 @@ bool CookieSettingsBase::IsEphemeralCookieAccessAllowed( bool CookieSettingsBase::IsFullCookieAccessAllowed( const GURL& url, const GURL& first_party_url) const { - return IsFullCookieAccessAllowed(url, first_party_url, absl::nullopt); + return IsFullCookieAccessAllowed( + url, net::SiteForCookies::FromUrl(first_party_url), absl::nullopt); } bool CookieSettingsBase::IsFullCookieAccessAllowed( const GURL& url, - const GURL& site_for_cookies, + const net::SiteForCookies& site_for_cookies, const absl::optional& top_frame_origin) const { if (ephemeral_storage_aware_ && ShouldUseEphemeralStorage(url, site_for_cookies, top_frame_origin)) { @@ -160,7 +163,7 @@ bool CookieSettingsBase::IsFullCookieAccessAllowed( bool CookieSettingsBase::IsCookieAccessAllowedImpl( const GURL& url, - const GURL& site_for_cookies, + const net::SiteForCookies& site_for_cookies, const absl::optional& top_frame_origin) const { bool allow = IsChromiumFullCookieAccessAllowed(url, site_for_cookies, top_frame_origin); diff --git a/chromium_src/components/content_settings/core/common/cookie_settings_base.h b/chromium_src/components/content_settings/core/common/cookie_settings_base.h index 531cdf17b927..7d9af13821a7 100644 --- a/chromium_src/components/content_settings/core/common/cookie_settings_base.h +++ b/chromium_src/components/content_settings/core/common/cookie_settings_base.h @@ -26,24 +26,24 @@ class ScopedEphemeralStorageAwareness { #define IsCookieSessionOnly \ ShouldUseEphemeralStorage( \ - const GURL& url, const GURL& site_for_cookies, \ + const GURL& url, const net::SiteForCookies& site_for_cookies, \ const absl::optional& top_frame_origin) const; \ ScopedEphemeralStorageAwareness CreateScopedEphemeralStorageAwareness() \ const; \ bool IsEphemeralCookieAccessAllowed(const GURL& url, \ const GURL& first_party_url) const; \ bool IsEphemeralCookieAccessAllowed( \ - const GURL& url, const GURL& site_for_cookies, \ + const GURL& url, const net::SiteForCookies& site_for_cookies, \ const absl::optional& top_frame_origin) const; \ bool IsChromiumFullCookieAccessAllowed(const GURL& url, \ const GURL& first_party_url) const; \ bool IsChromiumFullCookieAccessAllowed( \ - const GURL& url, const GURL& site_for_cookies, \ + const GURL& url, const net::SiteForCookies& site_for_cookies, \ const absl::optional& top_frame_origin) const; \ \ private: \ bool IsCookieAccessAllowedImpl( \ - const GURL& url, const GURL& site_for_cookies, \ + const GURL& url, const net::SiteForCookies& site_for_cookies, \ const absl::optional& top_frame_origin) const; \ \ mutable bool ephemeral_storage_aware_ = false; \ diff --git a/chromium_src/components/favicon/core/favicon_database_browsertest.cc b/chromium_src/components/favicon/core/favicon_database_browsertest.cc index de0c7fe0f752..066bbe524540 100644 --- a/chromium_src/components/favicon/core/favicon_database_browsertest.cc +++ b/chromium_src/components/favicon/core/favicon_database_browsertest.cc @@ -147,7 +147,7 @@ class BraveFaviconDatabaseBrowserTest : public InProcessBrowserTest { void NavigateToURLAndWaitForRedirects(const GURL& url) { ui_test_utils::UrlLoadObserver load_complete( landing_url(), content::NotificationService::AllSources()); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); EXPECT_EQ(contents()->GetMainFrame()->GetLastCommittedURL(), url); load_complete.Wait(); @@ -155,7 +155,7 @@ class BraveFaviconDatabaseBrowserTest : public InProcessBrowserTest { EXPECT_EQ(GetLastRequest().path(), landing_url().path()); // Navigate again to make sure all of the favicons finished loading. - ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), GURL("about:blank"))); } private: diff --git a/chromium_src/net/base/host_port_pair.cc b/chromium_src/net/base/host_port_pair.cc index e13d41327e76..4da03b686eb9 100644 --- a/chromium_src/net/base/host_port_pair.cc +++ b/chromium_src/net/base/host_port_pair.cc @@ -19,13 +19,13 @@ bool HasAuthentication(const GURL& url) { return url.has_username() || url.has_password(); } -bool HasAuthentication(const std::string& str) { +bool HasAuthentication(base::StringPiece str) { std::vector auth_host = base::SplitStringPiece( str, "@", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); return auth_host.size() == 2; } -HostPortPair FromStringWithAuthentication(const std::string& str) { +HostPortPair FromStringWithAuthentication(base::StringPiece str) { std::vector auth_host = base::SplitStringPiece( str, "@", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); HostPortPair host_port_pair = diff --git a/chromium_src/services/network/cookie_access_delegate_impl.cc b/chromium_src/services/network/cookie_access_delegate_impl.cc index ced8161fbbda..a8de98c814e6 100644 --- a/chromium_src/services/network/cookie_access_delegate_impl.cc +++ b/chromium_src/services/network/cookie_access_delegate_impl.cc @@ -19,8 +19,8 @@ bool CookieAccessDelegateImpl::ShouldUseEphemeralStorage( const absl::optional& top_frame_origin) const { if (!cookie_settings_) return false; - return cookie_settings_->ShouldUseEphemeralStorage( - url, site_for_cookies.RepresentativeUrl(), top_frame_origin); + return cookie_settings_->ShouldUseEphemeralStorage(url, site_for_cookies, + top_frame_origin); } } // namespace network diff --git a/chromium_src/services/network/cookie_settings.cc b/chromium_src/services/network/cookie_settings.cc index eac6e95a447b..f5fb9bd5e522 100644 --- a/chromium_src/services/network/cookie_settings.cc +++ b/chromium_src/services/network/cookie_settings.cc @@ -12,7 +12,7 @@ namespace network { bool CookieSettings::IsEphemeralCookieAccessible( const net::CanonicalCookie& cookie, const GURL& url, - const GURL& site_for_cookies, + const net::SiteForCookies& site_for_cookies, const absl::optional& top_frame_origin) const { // Upstream now do single cookie-specific checks in some places to determine // whether cookie access should be granted. However, when ephemeral storage is @@ -27,7 +27,7 @@ bool CookieSettings::IsEphemeralCookieAccessible( bool CookieSettings::IsEphemeralPrivacyModeEnabled( const GURL& url, - const GURL& site_for_cookies, + const net::SiteForCookies& site_for_cookies, const absl::optional& top_frame_origin, net::SamePartyContext::Type same_party_cookie_context_type) const { if (IsEphemeralCookieAccessAllowed(url, site_for_cookies, top_frame_origin)) @@ -39,7 +39,7 @@ bool CookieSettings::IsEphemeralPrivacyModeEnabled( bool CookieSettings::AnnotateAndMoveUserBlockedEphemeralCookies( const GURL& url, - const GURL& site_for_cookies, + const net::SiteForCookies& site_for_cookies, const url::Origin* top_frame_origin, net::CookieAccessResultList& maybe_included_cookies, net::CookieAccessResultList& excluded_cookies) const { diff --git a/chromium_src/services/network/cookie_settings.h b/chromium_src/services/network/cookie_settings.h index 0f19f8ca1493..1f7d356f8e4a 100644 --- a/chromium_src/services/network/cookie_settings.h +++ b/chromium_src/services/network/cookie_settings.h @@ -9,23 +9,23 @@ #define IsCookieAccessible \ IsEphemeralCookieAccessible( \ const net::CanonicalCookie& cookie, const GURL& url, \ - const GURL& site_for_cookies, \ + const net::SiteForCookies& site_for_cookies, \ const absl::optional& top_frame_origin) const; \ bool IsCookieAccessible -#define IsPrivacyModeEnabled \ - IsEphemeralPrivacyModeEnabled( \ - const GURL& url, const GURL& site_for_cookies, \ - const absl::optional& top_frame_origin, \ - net::SamePartyContext::Type same_party_context_type) const; \ +#define IsPrivacyModeEnabled \ + IsEphemeralPrivacyModeEnabled( \ + const GURL& url, const net::SiteForCookies& site_for_cookies, \ + const absl::optional& top_frame_origin, \ + net::SamePartyContext::Type same_party_context_type) const; \ bool IsPrivacyModeEnabled -#define AnnotateAndMoveUserBlockedCookies \ - AnnotateAndMoveUserBlockedEphemeralCookies( \ - const GURL& url, const GURL& site_for_cookies, \ - const url::Origin* top_frame_origin, \ - net::CookieAccessResultList& maybe_included_cookies, \ - net::CookieAccessResultList& excluded_cookies) const; \ +#define AnnotateAndMoveUserBlockedCookies \ + AnnotateAndMoveUserBlockedEphemeralCookies( \ + const GURL& url, const net::SiteForCookies& site_for_cookies, \ + const url::Origin* top_frame_origin, \ + net::CookieAccessResultList& maybe_included_cookies, \ + net::CookieAccessResultList& excluded_cookies) const; \ bool AnnotateAndMoveUserBlockedCookies #include "../../../../services/network/cookie_settings.h" diff --git a/chromium_src/third_party/blink/common/client_hints/enabled_client_hints.cc b/chromium_src/third_party/blink/common/client_hints/enabled_client_hints.cc index 936840dc72f0..c424679df70b 100644 --- a/chromium_src/third_party/blink/common/client_hints/enabled_client_hints.cc +++ b/chromium_src/third_party/blink/common/client_hints/enabled_client_hints.cc @@ -18,4 +18,12 @@ void EnabledClientHints::SetIsEnabled(const WebClientHintsType type, enabled_types_[static_cast(type)] = false; } +void EnabledClientHints::SetIsEnabled( + const GURL& url, + const net::HttpResponseHeaders* response_headers, + const network::mojom::WebClientHintsType type, + const bool should_send) { + SetIsEnabled(type, false); +} + } // namespace blink diff --git a/chromium_src/third_party/blink/public/common/client_hints/enabled_client_hints.h b/chromium_src/third_party/blink/public/common/client_hints/enabled_client_hints.h index 08f00b6f0790..936e69f4effb 100644 --- a/chromium_src/third_party/blink/public/common/client_hints/enabled_client_hints.h +++ b/chromium_src/third_party/blink/public/common/client_hints/enabled_client_hints.h @@ -9,13 +9,13 @@ // We can't do a `#define SetIsEnabled SetIsEnabled_Unused` because there are // two different signatures for that method, so we redefine IsEnabled() instead // and make the most of that to squeeze those methods there instead. -// The above comment is not applicable right now because the upstream change -// adding the second signature has been temporarily reverted. Leaving the above -// comment here for when they reland. -#define IsEnabled \ - IsEnabled(network::mojom::WebClientHintsType type) const; \ - void SetIsEnabled_Unused(network::mojom::WebClientHintsType type, \ - bool should_send); \ +#define IsEnabled \ + IsEnabled(network::mojom::WebClientHintsType type) const; \ + void SetIsEnabled_Unused(network::mojom::WebClientHintsType type, \ + bool should_send); \ + void SetIsEnabled_Unused( \ + const GURL& url, const net::HttpResponseHeaders* response_headers, \ + network::mojom::WebClientHintsType type, bool should_send); \ bool IsEnabled_Unused #include "../../../../../../../third_party/blink/public/common/client_hints/enabled_client_hints.h" diff --git a/chromium_src/third_party/blink/public/platform/disable_client_hints_browsertest.cc b/chromium_src/third_party/blink/public/platform/disable_client_hints_browsertest.cc index 80100e9d489b..98fb8049a8b6 100644 --- a/chromium_src/third_party/blink/public/platform/disable_client_hints_browsertest.cc +++ b/chromium_src/third_party/blink/public/platform/disable_client_hints_browsertest.cc @@ -18,10 +18,17 @@ #include "net/http/http_request_headers.h" #include "net/test/embedded_test_server/embedded_test_server.h" #include "net/test/embedded_test_server/http_request.h" +#include "services/network/public/cpp/client_hints.h" #include "third_party/blink/public/common/client_hints/client_hints.h" #include "third_party/blink/public/common/features.h" +namespace { const char kClientHints[] = "/ch.html"; +const std::vector kTestFeatures = { + blink::features::kLangClientHintHeader, + blink::features::kViewportHeightClientHintHeader, +}; +} // namespace class ClientHintsBrowserTest : public InProcessBrowserTest, public ::testing::WithParamInterface { @@ -45,17 +52,15 @@ class ClientHintsBrowserTest : public InProcessBrowserTest, ~ClientHintsBrowserTest() override {} - bool IsLangClientHintHeaderEnabled() { return GetParam(); } + bool IsClientHintHeaderEnabled() { return GetParam(); } void SetUp() override { - if (IsLangClientHintHeaderEnabled()) { - // Test that even with Lang CH feature enabled, there is no header. - scoped_feature_list_.InitAndEnableFeature( - blink::features::kLangClientHintHeader); - } else { - scoped_feature_list_.InitAndDisableFeature( - blink::features::kLangClientHintHeader); - } + // Test that even with Lang CH feature enabled, there is no header. + scoped_feature_list_.InitWithFeatures( + IsClientHintHeaderEnabled() ? kTestFeatures + : std::vector(), + IsClientHintHeaderEnabled() ? std::vector() + : kTestFeatures); InProcessBrowserTest::SetUp(); } @@ -74,9 +79,9 @@ class ClientHintsBrowserTest : public InProcessBrowserTest, private: void MonitorResourceRequest(const net::test_server::HttpRequest& request) { - for (size_t i = 0; i < blink::kClientHintsMappingsCount; ++i) { + for (size_t i = 0; i < network::kClientHintsNameMappingCount; ++i) { if (base::Contains(request.headers, - blink::kClientHintsHeaderMapping[i])) { + network::kClientHintsNameMapping[i])) { count_client_hints_headers_seen_++; } } @@ -91,10 +96,11 @@ class ClientHintsBrowserTest : public InProcessBrowserTest, }; IN_PROC_BROWSER_TEST_P(ClientHintsBrowserTest, ClientHintsDisabled) { - EXPECT_EQ( - IsLangClientHintHeaderEnabled(), - base::FeatureList::IsEnabled(blink::features::kLangClientHintHeader)); - ui_test_utils::NavigateToURL(browser(), client_hints_url()); + for (const auto& feature : kTestFeatures) { + EXPECT_EQ(IsClientHintHeaderEnabled(), + base::FeatureList::IsEnabled(feature)); + } + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), client_hints_url())); EXPECT_EQ(0u, count_client_hints_headers_seen()); } 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 new file mode 100644 index 000000000000..f69043395ddc --- /dev/null +++ b/chromium_src/third_party/blink/renderer/core/execution_context/navigator_base.cc @@ -0,0 +1,31 @@ +/* Copyright (c) 2021 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "third_party/blink/renderer/core/execution_context/navigator_base.h" + +#include "third_party/blink/public/platform/web_content_settings_client.h" +#include "third_party/blink/renderer/core/frame/local_dom_window.h" +#include "third_party/blink/renderer/core/frame/local_frame.h" +#include "third_party/blink/renderer/core/loader/frame_loader.h" + +#define userAgent userAgent_ChromiumImpl +#include "../../../../../../../third_party/blink/renderer/core/execution_context/navigator_base.cc" +#undef userAgent + +namespace blink { + +String NavigatorBase::userAgent() const { + if (blink::WebContentSettingsClient* settings = + brave::GetContentSettingsClientFor(GetExecutionContext())) { + if (!settings->AllowFingerprinting(true)) { + return brave::BraveSessionCache::From(*(GetExecutionContext())) + .FarbledUserAgent(GetExecutionContext()->UserAgent()); + } + } + + return userAgent_ChromiumImpl(); +} + +} // namespace blink diff --git a/chromium_src/third_party/blink/renderer/core/execution_context/navigator_base.h b/chromium_src/third_party/blink/renderer/core/execution_context/navigator_base.h index c39bc99bc328..52bb89792ae9 100644 --- a/chromium_src/third_party/blink/renderer/core/execution_context/navigator_base.h +++ b/chromium_src/third_party/blink/renderer/core/execution_context/navigator_base.h @@ -6,22 +6,14 @@ #ifndef BRAVE_CHROMIUM_SRC_THIRD_PARTY_BLINK_RENDERER_CORE_EXECUTION_CONTEXT_NAVIGATOR_BASE_H_ #define BRAVE_CHROMIUM_SRC_THIRD_PARTY_BLINK_RENDERER_CORE_EXECUTION_CONTEXT_NAVIGATOR_BASE_H_ -#include "third_party/blink/public/platform/web_content_settings_client.h" -#include "third_party/blink/renderer/core/frame/local_dom_window.h" -#include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/frame/navigator_id.h" -#include "third_party/blink/renderer/core/loader/frame_loader.h" -#define BRAVE_NAVIGATOR_BASE_USER_AGENT \ - if (blink::WebContentSettingsClient* settings = \ - brave::GetContentSettingsClientFor(GetExecutionContext())) { \ - if (!settings->AllowFingerprinting(true)) { \ - return brave::BraveSessionCache::From(*(GetExecutionContext())) \ - .FarbledUserAgent(GetExecutionContext()->UserAgent()); \ - } \ - } +#define userAgent \ + userAgent_ChromiumImpl() const; \ + String userAgent #include "../../../../../../../third_party/blink/renderer/core/execution_context/navigator_base.h" -#undef BRAVE_NAVIGATOR_BASE_USER_AGENT + +#undef userAgent #endif // BRAVE_CHROMIUM_SRC_THIRD_PARTY_BLINK_RENDERER_CORE_EXECUTION_CONTEXT_NAVIGATOR_BASE_H_ diff --git a/chromium_src/third_party/blink/renderer/core/frame/local_dom_window.cc b/chromium_src/third_party/blink/renderer/core/frame/local_dom_window.cc new file mode 100644 index 000000000000..0887a627421b --- /dev/null +++ b/chromium_src/third_party/blink/renderer/core/frame/local_dom_window.cc @@ -0,0 +1,36 @@ +/* Copyright (c) 2021 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "third_party/blink/renderer/core/frame/local_dom_window.h" + +#include "../../../../../../../third_party/blink/renderer/core/frame/local_dom_window.cc" + +namespace blink { + +void LocalDOMWindow::SetEphemeralStorageOrigin( + const SecurityOrigin* ephemeral_storage_origin) { + DCHECK(ephemeral_storage_origin); + ephemeral_storage_key_ = BlinkStorageKey(ephemeral_storage_origin); +} + +const SecurityOrigin* LocalDOMWindow::GetEphemeralStorageOrigin() const { + return ephemeral_storage_key_ + ? ephemeral_storage_key_->GetSecurityOrigin().get() + : nullptr; +} + +const BlinkStorageKey& LocalDOMWindow::GetEphemeralStorageKeyOrStorageKey() + const { + return ephemeral_storage_key_ ? *ephemeral_storage_key_ : storage_key_; +} + +const SecurityOrigin* +LocalDOMWindow::GetEphemeralStorageOriginOrSecurityOrigin() const { + return ephemeral_storage_key_ + ? ephemeral_storage_key_->GetSecurityOrigin().get() + : GetSecurityOrigin(); +} + +} // namespace blink diff --git a/chromium_src/third_party/blink/renderer/core/frame/local_dom_window.h b/chromium_src/third_party/blink/renderer/core/frame/local_dom_window.h new file mode 100644 index 000000000000..b79d79423de0 --- /dev/null +++ b/chromium_src/third_party/blink/renderer/core/frame/local_dom_window.h @@ -0,0 +1,27 @@ +/* Copyright (c) 2021 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_CHROMIUM_SRC_THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_LOCAL_DOM_WINDOW_H_ +#define BRAVE_CHROMIUM_SRC_THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_LOCAL_DOM_WINDOW_H_ + +#include "third_party/abseil-cpp/absl/types/optional.h" + +#define SetStorageKey \ + SetEphemeralStorageOrigin(const SecurityOrigin* ephemeral_storage_origin); \ + const SecurityOrigin* GetEphemeralStorageOrigin() const; \ + const BlinkStorageKey& GetEphemeralStorageKeyOrStorageKey() const; \ + const SecurityOrigin* GetEphemeralStorageOriginOrSecurityOrigin() const; \ + \ + private: \ + absl::optional ephemeral_storage_key_; \ + \ + public: \ + void SetStorageKey + +#include "../../../../../../../third_party/blink/renderer/core/frame/local_dom_window.h" + +#undef SetStorageKey + +#endif // BRAVE_CHROMIUM_SRC_THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_LOCAL_DOM_WINDOW_H_ diff --git a/chromium_src/third_party/blink/renderer/core/frame/reporting_observer_browsertest.cc b/chromium_src/third_party/blink/renderer/core/frame/reporting_observer_browsertest.cc index 4c97bf210dd9..765ebc92d2c3 100644 --- a/chromium_src/third_party/blink/renderer/core/frame/reporting_observer_browsertest.cc +++ b/chromium_src/third_party/blink/renderer/core/frame/reporting_observer_browsertest.cc @@ -36,7 +36,7 @@ class ReportingObserverTest : public InProcessBrowserTest { IN_PROC_BROWSER_TEST_F(ReportingObserverTest, IsDisabled) { GURL url = embedded_test_server()->GetURL(kReportingObserver); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); diff --git a/chromium_src/third_party/blink/renderer/modules/battery/navigator_batterytest.cc b/chromium_src/third_party/blink/renderer/modules/battery/navigator_batterytest.cc index 027f476f1f2f..9fb82d256af2 100644 --- a/chromium_src/third_party/blink/renderer/modules/battery/navigator_batterytest.cc +++ b/chromium_src/third_party/blink/renderer/modules/battery/navigator_batterytest.cc @@ -29,7 +29,7 @@ class NavigatorGetBatteryDisabledTest : public InProcessBrowserTest { IN_PROC_BROWSER_TEST_F(NavigatorGetBatteryDisabledTest, IsDisabled) { GURL url = embedded_test_server()->GetURL(kBatteryTest); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(content::WaitForLoadStop(contents)); diff --git a/chromium_src/third_party/blink/renderer/modules/bluetooth/navigator_bluetoothtest.cc b/chromium_src/third_party/blink/renderer/modules/bluetooth/navigator_bluetoothtest.cc index 4070ac02023c..16ce19b1385f 100644 --- a/chromium_src/third_party/blink/renderer/modules/bluetooth/navigator_bluetoothtest.cc +++ b/chromium_src/third_party/blink/renderer/modules/bluetooth/navigator_bluetoothtest.cc @@ -29,7 +29,7 @@ class NavigatorBluetoothDisabledTest : public InProcessBrowserTest { IN_PROC_BROWSER_TEST_F(NavigatorBluetoothDisabledTest, IsDisabled) { GURL url = embedded_test_server()->GetURL(kBluetoothTest); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(content::WaitForLoadStop(contents)); diff --git a/chromium_src/third_party/blink/renderer/modules/quota/navigator_storagetest.cc b/chromium_src/third_party/blink/renderer/modules/quota/navigator_storagetest.cc index a5a9bfdce788..31f2743b0abd 100644 --- a/chromium_src/third_party/blink/renderer/modules/quota/navigator_storagetest.cc +++ b/chromium_src/third_party/blink/renderer/modules/quota/navigator_storagetest.cc @@ -29,7 +29,7 @@ class NavigatorStorageEstimateQuotaTest : public InProcessBrowserTest { IN_PROC_BROWSER_TEST_F(NavigatorStorageEstimateQuotaTest, Is2Gb) { GURL url = embedded_test_server()->GetURL(kStorageEstimateTest); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(content::WaitForLoadStop(contents)); diff --git a/chromium_src/third_party/blink/renderer/modules/storage/brave_dom_window_storage.h b/chromium_src/third_party/blink/renderer/modules/storage/brave_dom_window_storage.h index a17c8197f946..fad92696a502 100644 --- a/chromium_src/third_party/blink/renderer/modules/storage/brave_dom_window_storage.h +++ b/chromium_src/third_party/blink/renderer/modules/storage/brave_dom_window_storage.h @@ -36,8 +36,6 @@ class BraveDOMWindowStorage final private: StorageArea* ephemeralSessionStorage(); - StorageArea* ephemeralLocalStorage( - const SecurityOrigin* ephemeral_storage_origin); mutable Member ephemeral_session_storage_; mutable Member ephemeral_local_storage_; diff --git a/chromium_src/third_party/blink/renderer/modules/storage/dom_window_storage.cc b/chromium_src/third_party/blink/renderer/modules/storage/dom_window_storage.cc index 91528052b88b..5b5faba92a66 100644 --- a/chromium_src/third_party/blink/renderer/modules/storage/dom_window_storage.cc +++ b/chromium_src/third_party/blink/renderer/modules/storage/dom_window_storage.cc @@ -7,6 +7,7 @@ #include "net/base/features.h" #include "third_party/blink/public/common/dom_storage/session_storage_namespace_id.h" +#include "third_party/blink/public/common/storage_key/storage_key.h" #include "third_party/blink/public/platform/web_content_settings_client.h" #include "third_party/blink/public/web/web_view_client.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" @@ -168,8 +169,8 @@ StorageArea* BraveDOMWindowStorage::ephemeralSessionStorage() { if (!ephemeral_namespace) return nullptr; - auto storage_area = ephemeral_namespace->session_storage()->GetCachedArea( - window->GetSecurityOrigin()); + auto storage_area = + ephemeral_namespace->session_storage()->GetCachedArea(window); ephemeral_session_storage_ = StorageArea::Create(window, std::move(storage_area), @@ -180,29 +181,14 @@ StorageArea* BraveDOMWindowStorage::ephemeralSessionStorage() { StorageArea* BraveDOMWindowStorage::localStorage( ExceptionState& exception_state) { LocalDOMWindow* window = GetSupplementable(); - auto* storage = DOMWindowStorage::From(*window).localStorage(exception_state); - const SecurityOrigin* ephemeral_storage_origin = GetEphemeralStorageOrigin(window); - if (!ephemeral_storage_origin) - return storage; - - return ephemeralLocalStorage(ephemeral_storage_origin); -} - -StorageArea* BraveDOMWindowStorage::ephemeralLocalStorage( - const SecurityOrigin* ephemeral_storage_origin) { - DCHECK(ephemeral_storage_origin); - if (ephemeral_local_storage_) - return ephemeral_local_storage_; - - LocalDOMWindow* window = GetSupplementable(); - auto storage_area = StorageController::GetInstance()->GetLocalStorageArea( - ephemeral_storage_origin); + if (ephemeral_storage_origin && + window->GetEphemeralStorageOrigin() != ephemeral_storage_origin) { + window->SetEphemeralStorageOrigin(ephemeral_storage_origin); + } - ephemeral_local_storage_ = StorageArea::Create( - window, std::move(storage_area), StorageArea::StorageType::kLocalStorage); - return ephemeral_local_storage_; + return DOMWindowStorage::From(*window).localStorage(exception_state); } void BraveDOMWindowStorage::Trace(Visitor* visitor) const { diff --git a/chromium_src/third_party/blink/renderer/modules/storage/storage_namespace.cc b/chromium_src/third_party/blink/renderer/modules/storage/storage_namespace.cc new file mode 100644 index 000000000000..2ef8f4b38e5f --- /dev/null +++ b/chromium_src/third_party/blink/renderer/modules/storage/storage_namespace.cc @@ -0,0 +1,23 @@ +/* Copyright (c) 2021 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "third_party/blink/renderer/modules/storage/storage_namespace.h" + +#include "third_party/blink/renderer/core/frame/local_dom_window.h" +#include "third_party/blink/renderer/modules/storage/storage_controller.h" + +#define GetStorageKey GetEphemeralStorageKeyOrStorageKey + +#define OpenLocalStorage \ + OpenLocalStorage( \ + local_dom_window.GetEphemeralStorageOriginOrSecurityOrigin(), \ + std::move(receiver)); \ + if (false) \ + controller_->dom_storage()->OpenLocalStorage + +#include "../../../../../../../third_party/blink/renderer/modules/storage/storage_namespace.cc" + +#undef OpenLocalStorage +#undef GetStorageKey diff --git a/chromium_src/ui/accessibility/platform/ax_platform_node_mac.mm b/chromium_src/ui/accessibility/platform/ax_platform_node_cocoa.mm similarity index 99% rename from chromium_src/ui/accessibility/platform/ax_platform_node_mac.mm rename to chromium_src/ui/accessibility/platform/ax_platform_node_cocoa.mm index 77e32d731106..ee275328eec4 100644 --- a/chromium_src/ui/accessibility/platform/ax_platform_node_mac.mm +++ b/chromium_src/ui/accessibility/platform/ax_platform_node_cocoa.mm @@ -29,4 +29,4 @@ return nil; \ } -#include "../../../../../ui/accessibility/platform/ax_platform_node_mac.mm" +#include "../../../../../ui/accessibility/platform/ax_platform_node_cocoa.mm" diff --git a/chromium_src/ui/base/resource/resource_bundle_android.cc b/chromium_src/ui/base/resource/resource_bundle_android.cc index c5c333845ac4..beb0dd428825 100644 --- a/chromium_src/ui/base/resource/resource_bundle_android.cc +++ b/chromium_src/ui/base/resource/resource_bundle_android.cc @@ -24,7 +24,7 @@ void BraveLoadMainAndroidPackFile(const char* path_within_apk, &g_brave_resources_pack_region)) { ResourceBundle::GetSharedInstance().AddDataPackFromFileRegion( base::File(g_brave_resources_pack_fd), g_brave_resources_pack_region, - SCALE_FACTOR_NONE); + ui::kScaleFactorNone); } } @@ -36,7 +36,7 @@ void BraveLoadBrave100PercentPackFile(const char* path_within_apk, &g_brave_100_percent_pack_region)) { ResourceBundle::GetSharedInstance().AddDataPackFromFileRegion( base::File(g_brave_100_percent_pack_fd), - g_brave_100_percent_pack_region, SCALE_FACTOR_100P); + g_brave_100_percent_pack_region, ui::k100Percent); } } diff --git a/chromium_src/ui/views/bubble/bubble_border.h b/chromium_src/ui/views/bubble/bubble_border.h index 6775d14f2373..a673c21782a7 100644 --- a/chromium_src/ui/views/bubble/bubble_border.h +++ b/chromium_src/ui/views/bubble/bubble_border.h @@ -6,13 +6,6 @@ #ifndef BRAVE_CHROMIUM_SRC_UI_VIEWS_BUBBLE_BUBBLE_BORDER_H_ #define BRAVE_CHROMIUM_SRC_UI_VIEWS_BUBBLE_BUBBLE_BORDER_H_ -#include "build/build_config.h" - -#if defined(OS_WIN) -// Prevent overriding global GetClientRect Win32 api. -#include -#endif - #define GetClientRect virtual GetClientRect #include "../../../../../ui/views/bubble/bubble_border.h" #undef GetClientRect diff --git a/common/resource_bundle_helper.cc b/common/resource_bundle_helper.cc index 9131e1a8a15e..e4ba426e3f2c 100644 --- a/common/resource_bundle_helper.cc +++ b/common/resource_bundle_helper.cc @@ -44,12 +44,11 @@ base::FilePath GetResourcesPakFilePath() { #if !defined(OS_ANDROID) base::FilePath GetScaledResourcesPakFilePath( ui::ResourceScaleFactor scale_factor) { - DCHECK(scale_factor == ui::SCALE_FACTOR_100P || - scale_factor == ui::SCALE_FACTOR_200P); + DCHECK(scale_factor == ui::k100Percent || scale_factor == ui::k200Percent); - const char* pak_file = - (scale_factor == ui::SCALE_FACTOR_100P) ? "brave_100_percent.pak" - : "brave_200_percent.pak"; + const char* pak_file = (scale_factor == ui::k100Percent) + ? "brave_100_percent.pak" + : "brave_200_percent.pak"; #if defined(OS_MAC) base::ScopedCFTypeRef pak_file_mac( base::SysUTF8ToCFStringRef(pak_file)); @@ -75,12 +74,12 @@ void InitializeResourceBundle() { base::FilePath()); #else auto& rb = ui::ResourceBundle::GetSharedInstance(); - rb.AddDataPackFromPath(GetResourcesPakFilePath(), ui::SCALE_FACTOR_NONE); - rb.AddDataPackFromPath(GetScaledResourcesPakFilePath(ui::SCALE_FACTOR_100P), - ui::SCALE_FACTOR_100P); - if (ui::ResourceBundle::IsScaleFactorSupported(ui::SCALE_FACTOR_200P)) { - rb.AddDataPackFromPath(GetScaledResourcesPakFilePath(ui::SCALE_FACTOR_200P), - ui::SCALE_FACTOR_200P); + rb.AddDataPackFromPath(GetResourcesPakFilePath(), ui::kScaleFactorNone); + rb.AddDataPackFromPath(GetScaledResourcesPakFilePath(ui::k100Percent), + ui::k100Percent); + if (ui::ResourceBundle::IsScaleFactorSupported(ui::k200Percent)) { + rb.AddDataPackFromPath(GetScaledResourcesPakFilePath(ui::k200Percent), + ui::k200Percent); } #endif // OS_ANDROID } diff --git a/components/arc_strings.grdp b/components/arc_strings.grdp index ccc99ca70a32..327c1ceb7509 100644 --- a/components/arc_strings.grdp +++ b/components/arc_strings.grdp @@ -17,6 +17,9 @@ Don’t ask again for this app + + Preparing files + Phone diff --git a/components/autofill_payments_strings.grdp b/components/autofill_payments_strings.grdp index 0e302a57dd79..75cb29907530 100644 --- a/components/autofill_payments_strings.grdp +++ b/components/autofill_payments_strings.grdp @@ -97,6 +97,9 @@ Save to Brave sync chain + + Save… + diff --git a/components/binance/browser/binance_service_browsertest.cc b/components/binance/browser/binance_service_browsertest.cc index b4b3f72cfca2..e9375b4fd39a 100644 --- a/components/binance/browser/binance_service_browsertest.cc +++ b/components/binance/browser/binance_service_browsertest.cc @@ -418,12 +418,14 @@ class BinanceAPIBrowserTest : public InProcessBrowserTest { } bool NavigateToNewTabUntilLoadStop() { - ui_test_utils::NavigateToURL(browser(), GURL("chrome://newtab")); + EXPECT_TRUE( + ui_test_utils::NavigateToURL(browser(), GURL("chrome://newtab"))); return WaitForLoadStop(active_contents()); } bool NavigateToVersionTabUntilLoadStop() { - ui_test_utils::NavigateToURL(browser(), GURL("chrome://version")); + EXPECT_TRUE( + ui_test_utils::NavigateToURL(browser(), GURL("chrome://version"))); return WaitForLoadStop(active_contents()); } diff --git a/components/brave_ads/browser/background_helper_win.cc b/components/brave_ads/browser/background_helper_win.cc index a4df4b5267a6..d2ea4030ee43 100644 --- a/components/brave_ads/browser/background_helper_win.cc +++ b/components/brave_ads/browser/background_helper_win.cc @@ -5,6 +5,8 @@ #include "brave/components/brave_ads/browser/background_helper_win.h" +#include + #include "base/bind.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" diff --git a/components/brave_ads/browser/background_helper_win.h b/components/brave_ads/browser/background_helper_win.h index 2a0814a58dcb..80fef5998d67 100644 --- a/components/brave_ads/browser/background_helper_win.h +++ b/components/brave_ads/browser/background_helper_win.h @@ -6,11 +6,11 @@ #ifndef BRAVE_COMPONENTS_BRAVE_ADS_BROWSER_BACKGROUND_HELPER_WIN_H_ #define BRAVE_COMPONENTS_BRAVE_ADS_BROWSER_BACKGROUND_HELPER_WIN_H_ -#include #include #include "base/macros.h" #include "base/memory/singleton.h" +#include "base/win/windows_types.h" #include "brave/components/brave_ads/browser/background_helper.h" #include "ui/gfx/win/singleton_hwnd_observer.h" diff --git a/components/brave_perf_predictor/browser/perf_predictor_tab_helper_browsertest.cc b/components/brave_perf_predictor/browser/perf_predictor_tab_helper_browsertest.cc index 3ef2afcd17fc..8c3bf6a4f0bf 100644 --- a/components/brave_perf_predictor/browser/perf_predictor_tab_helper_browsertest.cc +++ b/components/brave_perf_predictor/browser/perf_predictor_tab_helper_browsertest.cc @@ -92,7 +92,7 @@ IN_PROC_BROWSER_TEST_F(PerfPredictorTabHelperTest, NoBlockNoSavings) { EXPECT_EQ(getProfileBandwidthSaved(browser()), 0ULL); GURL url = embedded_test_server()->GetURL("/blocking.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -110,7 +110,7 @@ IN_PROC_BROWSER_TEST_F(PerfPredictorTabHelperTest, ScriptBlockHasSavings) { EXPECT_EQ(getProfileBandwidthSaved(browser()), 0ULL); GURL url = embedded_test_server()->GetURL("/blocking.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -130,7 +130,7 @@ IN_PROC_BROWSER_TEST_F(PerfPredictorTabHelperTest, NewNavigationStoresSavings) { EXPECT_EQ(getProfileBandwidthSaved(browser()), 0ULL); GURL url = embedded_test_server()->GetURL("/blocking.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -142,7 +142,7 @@ IN_PROC_BROWSER_TEST_F(PerfPredictorTabHelperTest, NewNavigationStoresSavings) { // Prediction triggered when web contents are closed GURL second_url = embedded_test_server()->GetURL("example.com", "/blocking.html"); - ui_test_utils::NavigateToURL(browser(), second_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), second_url)); EXPECT_EQ(true, EvalJs(contents, "addImage('logo.png');" "setExpectations(0, 0, 0, 1);" diff --git a/components/brave_rewards/browser/rewards_notification_service_impl.cc b/components/brave_rewards/browser/rewards_notification_service_impl.cc index a832e9233a7a..e0d6d405ae3f 100644 --- a/components/brave_rewards/browser/rewards_notification_service_impl.cc +++ b/components/brave_rewards/browser/rewards_notification_service_impl.cc @@ -228,7 +228,7 @@ void RewardsNotificationServiceImpl::StoreRewardsNotifications() { dict->SetInteger("timestamp", item.second.timestamp_); auto args = std::make_unique(); for (auto& arg : item.second.args_) { - args->AppendString(arg); + args->Append(arg); } dict->SetList("args", std::move(args)); notifications->Append(std::move(dict)); @@ -236,7 +236,7 @@ void RewardsNotificationServiceImpl::StoreRewardsNotifications() { auto displayed = std::make_unique(); for (auto& item : rewards_notifications_displayed_) { - displayed->AppendString(item); + displayed->Append(item); } root.SetList("notifications", std::move(notifications)); diff --git a/components/brave_rewards/browser/test/common/rewards_browsertest_context_helper.cc b/components/brave_rewards/browser/test/common/rewards_browsertest_context_helper.cc index 1979d4232a1d..1d233cc89ff6 100644 --- a/components/brave_rewards/browser/test/common/rewards_browsertest_context_helper.cc +++ b/components/brave_rewards/browser/test/common/rewards_browsertest_context_helper.cc @@ -201,7 +201,7 @@ void RewardsBrowserTestContextHelper::VisitPublisher( } void RewardsBrowserTestContextHelper::LoadURL(GURL url) { - ui_test_utils::NavigateToURL(browser_, url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser_, url)); auto* contents = browser_->tab_strip_model()->GetActiveWebContents(); WaitForLoadStop(contents); } diff --git a/components/brave_shields/browser/domain_block_navigation_throttle.cc b/components/brave_shields/browser/domain_block_navigation_throttle.cc index 07efa0c5e141..397e35985dd5 100644 --- a/components/brave_shields/browser/domain_block_navigation_throttle.cc +++ b/components/brave_shields/browser/domain_block_navigation_throttle.cc @@ -186,7 +186,7 @@ void DomainBlockNavigationThrottle::ShowInterstitial() { // Replace the tab contents with our interstitial page. security_interstitials::SecurityInterstitialTabHelper::AssociateBlockingPage( - web_contents, handle->GetNavigationId(), std::move(blocked_page)); + handle, std::move(blocked_page)); // Navigation was deferred rather than canceled outright because the // call to the ad blocking service happens on a task runner, but now we diff --git a/components/brave_shields/browser/https_everywhere_service.cc b/components/brave_shields/browser/https_everywhere_service.cc index 440c8eaa0fa3..1b576ce2bff4 100644 --- a/components/brave_shields/browser/https_everywhere_service.cc +++ b/components/brave_shields/browser/https_everywhere_service.cc @@ -286,7 +286,7 @@ std::string HTTPSEverywhereService::ApplyHTTPSRule( const base::ListValue* eValues = nullptr; exclusion->GetAsList(&eValues); if (nullptr != eValues) { - for (size_t j = 0; j < eValues->GetSize(); ++j) { + for (size_t j = 0; j < eValues->GetList().size(); ++j) { const base::Value* pValue = nullptr; if (!eValues->Get(j, &pValue)) { continue; @@ -322,7 +322,7 @@ std::string HTTPSEverywhereService::ApplyHTTPSRule( return ""; } - for (size_t j = 0; j < rValues->GetSize(); ++j) { + for (size_t j = 0; j < rValues->GetList().size(); ++j) { const base::Value* pValue = nullptr; if (!rValues->Get(j, &pValue)) { continue; diff --git a/components/brave_shields/browser/https_everywhere_service_browsertest.cc b/components/brave_shields/browser/https_everywhere_service_browsertest.cc index e4cb5a144f14..87283f289cf3 100644 --- a/components/brave_shields/browser/https_everywhere_service_browsertest.cc +++ b/components/brave_shields/browser/https_everywhere_service_browsertest.cc @@ -101,7 +101,7 @@ IN_PROC_BROWSER_TEST_F(HTTPSEverywhereServiceTest, RedirectsKnownSite) { ASSERT_TRUE(InstallHTTPSEverywhereExtension()); GURL url = embedded_test_server()->GetURL("www.digg.com", "/"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); EXPECT_EQ(GURL("https://www.digg.com/"), contents->GetLastCommittedURL()); @@ -112,7 +112,7 @@ IN_PROC_BROWSER_TEST_F(HTTPSEverywhereServiceTest, NoRedirectsNotKnownSite) { ASSERT_TRUE(InstallHTTPSEverywhereExtension()); GURL url = embedded_test_server()->GetURL("www.brianbondy.com", "/"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -128,7 +128,7 @@ IN_PROC_BROWSER_TEST_F(HTTPSEverywhereServiceTest, NoRedirectsNotKnownSite) { IN_PROC_BROWSER_TEST_F(HTTPSEverywhereServiceTest, RedirectsKnownSiteInIframe) { ASSERT_TRUE(InstallHTTPSEverywhereExtension()); GURL url = embedded_test_server()->GetURL("a.com", "/iframe.html"); - ui_test_utils::NavigateToURL(browser(), url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); GURL iframe_url = embedded_test_server()->GetURL("www.digg.com", "/"); const char kIframeID[] = "test"; diff --git a/components/brave_vpn/brave_vpn_os_connection_api_win.cc b/components/brave_vpn/brave_vpn_os_connection_api_win.cc index f2947d4a7e76..a4ca566bb2ba 100644 --- a/components/brave_vpn/brave_vpn_os_connection_api_win.cc +++ b/components/brave_vpn/brave_vpn_os_connection_api_win.cc @@ -5,6 +5,8 @@ #include "brave/components/brave_vpn/brave_vpn_os_connection_api_win.h" +#include + #include #include "base/logging.h" diff --git a/components/brave_vpn/brave_vpn_os_connection_api_win.h b/components/brave_vpn/brave_vpn_os_connection_api_win.h index 6169ab23f09e..8250b3dc1b82 100644 --- a/components/brave_vpn/brave_vpn_os_connection_api_win.h +++ b/components/brave_vpn/brave_vpn_os_connection_api_win.h @@ -6,12 +6,12 @@ #ifndef BRAVE_COMPONENTS_BRAVE_VPN_BRAVE_VPN_OS_CONNECTION_API_WIN_H_ #define BRAVE_COMPONENTS_BRAVE_VPN_BRAVE_VPN_OS_CONNECTION_API_WIN_H_ -#include #include #include "base/memory/weak_ptr.h" #include "base/no_destructor.h" #include "base/win/object_watcher.h" +#include "base/win/windows_types.h" #include "brave/components/brave_vpn/brave_vpn_os_connection_api.h" namespace brave_vpn { diff --git a/components/brave_vpn/utils_win.cc b/components/brave_vpn/utils_win.cc index b5b88349ebdb..b7260bfa1bbb 100644 --- a/components/brave_vpn/utils_win.cc +++ b/components/brave_vpn/utils_win.cc @@ -5,6 +5,8 @@ #include "brave/components/brave_vpn/utils_win.h" +#include + #include #include #include diff --git a/components/brave_vpn/utils_win.h b/components/brave_vpn/utils_win.h index e8bfb98f5f4f..f28084df9f61 100644 --- a/components/brave_vpn/utils_win.h +++ b/components/brave_vpn/utils_win.h @@ -6,9 +6,10 @@ #ifndef BRAVE_COMPONENTS_BRAVE_VPN_UTILS_WIN_H_ #define BRAVE_COMPONENTS_BRAVE_VPN_UTILS_WIN_H_ -#include #include +#include "base/win/windows_types.h" + namespace brave_vpn { namespace internal { diff --git a/components/brave_wallet/browser/eth_tx_controller.cc b/components/brave_wallet/browser/eth_tx_controller.cc index 19d9c67b9830..e91e1b349286 100644 --- a/components/brave_wallet/browser/eth_tx_controller.cc +++ b/components/brave_wallet/browser/eth_tx_controller.cc @@ -12,6 +12,7 @@ #include "base/bind.h" #include "base/logging.h" +#include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "brave/components/brave_wallet/browser/asset_ratio_controller.h" #include "brave/components/brave_wallet/browser/brave_wallet_utils.h" diff --git a/components/brave_wallet/browser/eth_tx_state_manager.cc b/components/brave_wallet/browser/eth_tx_state_manager.cc index 93514ac07909..5a4fa3923063 100644 --- a/components/brave_wallet/browser/eth_tx_state_manager.cc +++ b/components/brave_wallet/browser/eth_tx_state_manager.cc @@ -10,6 +10,7 @@ #include "base/guid.h" #include "base/json/values_util.h" #include "base/logging.h" +#include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "base/values.h" #include "brave/components/brave_wallet/browser/brave_wallet_utils.h" diff --git a/components/brave_wallet/browser/rlp_decode_unittest.cc b/components/brave_wallet/browser/rlp_decode_unittest.cc index 96417808aa88..38bcc1e2c804 100644 --- a/components/brave_wallet/browser/rlp_decode_unittest.cc +++ b/components/brave_wallet/browser/rlp_decode_unittest.cc @@ -26,7 +26,7 @@ std::string RLPTestValueToString(const base::Value& val) { std::string elems; const base::ListValue* list; val.GetAsList(&list); - for (size_t i = 0; i < list->GetSize(); i++) { + for (size_t i = 0; i < list->GetList().size(); i++) { const base::Value* child; list->Get(i, &child); if (elems.size()) { diff --git a/components/brave_wallet/common/value_conversion_utils.cc b/components/brave_wallet/common/value_conversion_utils.cc index d547f9a2b6a9..7b36934e3f41 100644 --- a/components/brave_wallet/common/value_conversion_utils.cc +++ b/components/brave_wallet/common/value_conversion_utils.cc @@ -76,7 +76,7 @@ base::Value EthereumChainToValue(const mojom::EthereumChainPtr& chain) { base::ListValue blockExplorerUrlsValue; if (!chain->block_explorer_urls.empty()) { for (const auto& url : chain->block_explorer_urls) { - blockExplorerUrlsValue.AppendString(url); + blockExplorerUrlsValue.Append(url); } } dict.SetKey("blockExplorerUrls", std::move(blockExplorerUrlsValue)); @@ -84,14 +84,14 @@ base::Value EthereumChainToValue(const mojom::EthereumChainPtr& chain) { base::ListValue iconUrlsValue; if (!chain->icon_urls.empty()) { for (const auto& url : chain->icon_urls) { - iconUrlsValue.AppendString(url); + iconUrlsValue.Append(url); } } dict.SetKey("iconUrls", std::move(iconUrlsValue)); base::ListValue rpcUrlsValue; for (const auto& url : chain->rpc_urls) { - rpcUrlsValue.AppendString(url); + rpcUrlsValue.Append(url); } dict.SetKey("rpcUrls", std::move(rpcUrlsValue)); base::Value currency(base::Value::Type::DICTIONARY); diff --git a/components/components_settings_strings.grdp b/components/components_settings_strings.grdp index 6dd68e07aa95..40a6d6e611c0 100644 --- a/components/components_settings_strings.grdp +++ b/components/components_settings_strings.grdp @@ -16,7 +16,4 @@ Change proxy settings... - - Automatic Downloads - diff --git a/components/components_strings.grd b/components/components_strings.grd index 204c84844093..f242a08a541f 100644 --- a/components/components_strings.grd +++ b/components/components_strings.grd @@ -323,6 +323,7 @@ + diff --git a/components/content_settings/core/browser/brave_content_settings_pref_provider.cc b/components/content_settings/core/browser/brave_content_settings_pref_provider.cc index 3cf4356be7d3..cb4ec0f5540d 100644 --- a/components/content_settings/core/browser/brave_content_settings_pref_provider.cc +++ b/components/content_settings/core/browser/brave_content_settings_pref_provider.cc @@ -9,6 +9,7 @@ #include #include "base/bind.h" +#include "base/strings/string_number_conversions.h" #include "base/task/post_task.h" #include "brave/common/network_constants.h" #include "brave/common/pref_names.h" diff --git a/components/content_settings/renderer/brave_content_settings_agent_impl.cc b/components/content_settings/renderer/brave_content_settings_agent_impl.cc index f55bf9fc58d6..2e6ee6d57729 100644 --- a/components/content_settings/renderer/brave_content_settings_agent_impl.cc +++ b/components/content_settings/renderer/brave_content_settings_agent_impl.cc @@ -158,9 +158,8 @@ BraveContentSettingsAgentImpl::GetEphemeralStorageOriginSync() { absl::optional optional_ephemeral_storage_origin; GetContentSettingsManager().AllowEphemeralStorageAccess( - routing_id(), frame_origin, - frame->GetDocument().SiteForCookies().RepresentativeUrl(), top_origin, - &optional_ephemeral_storage_origin); + routing_id(), frame_origin, frame->GetDocument().SiteForCookies(), + top_origin, &optional_ephemeral_storage_origin); blink::WebSecurityOrigin ephemeral_storage_origin( optional_ephemeral_storage_origin ? blink::WebSecurityOrigin(*optional_ephemeral_storage_origin) diff --git a/components/content_settings/renderer/brave_content_settings_agent_impl_autoplay_browsertest.cc b/components/content_settings/renderer/brave_content_settings_agent_impl_autoplay_browsertest.cc index bb21e5aebe4b..5ad262842af9 100644 --- a/components/content_settings/renderer/brave_content_settings_agent_impl_autoplay_browsertest.cc +++ b/components/content_settings/renderer/brave_content_settings_agent_impl_autoplay_browsertest.cc @@ -43,7 +43,7 @@ class MockContentSettingsManagerImpl : public mojom::ContentSettingsManager { void AllowEphemeralStorageAccess( int32_t render_frame_id, const ::url::Origin& origin, - const ::GURL& site_for_cookies, + const ::net::SiteForCookies& site_for_cookies, const ::url::Origin& top_frame_origin, AllowEphemeralStorageAccessCallback callback) override {} diff --git a/components/content_settings/renderer/brave_content_settings_agent_impl_browsertest.cc b/components/content_settings/renderer/brave_content_settings_agent_impl_browsertest.cc index f47faeca8daf..e4506e90a469 100644 --- a/components/content_settings/renderer/brave_content_settings_agent_impl_browsertest.cc +++ b/components/content_settings/renderer/brave_content_settings_agent_impl_browsertest.cc @@ -320,7 +320,7 @@ class BraveContentSettingsAgentImplBrowserTest : public InProcessBrowserTest { const std::string link_query = referrer_policy.empty() ? "" : "?policy=" + referrer_policy; GURL link(link_url().spec() + link_query); - ui_test_utils::NavigateToURL(browser(), link); + EXPECT_TRUE(ui_test_utils::NavigateToURL(browser(), link)); std::string clickLink = "domAutomationController.send(clickLink('" + url.spec() + "'));"; @@ -340,7 +340,7 @@ class BraveContentSettingsAgentImplBrowserTest : public InProcessBrowserTest { } void NavigateToPageWithIframe() { - ui_test_utils::NavigateToURL(browser(), url()); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url())); ASSERT_EQ(contents()->GetAllFrames().size(), 2u) << "Two frames (main + iframe) should be created."; content::RenderFrameHost* main_frame = contents()->GetMainFrame(); @@ -349,8 +349,8 @@ class BraveContentSettingsAgentImplBrowserTest : public InProcessBrowserTest { void NavigateToURLUntilLoadStop(const std::string& origin, const std::string& path) { - ui_test_utils::NavigateToURL(browser(), - https_server().GetURL(origin, path)); + ASSERT_TRUE(ui_test_utils::NavigateToURL( + browser(), https_server().GetURL(origin, path))); } void NavigateIframe(const GURL& url) { @@ -1127,13 +1127,13 @@ IN_PROC_BROWSER_TEST_F(BraveContentSettingsAgentImplBrowserTest, // Throws when used on a data url. const GURL data_url("data:text/html,Data URL"); - ui_test_utils::NavigateToURL(browser(), data_url); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), data_url)); CheckLocalStorageThrows(contents()); // Throws in a sandboxed iframe. const GURL sandboxed( https_server().GetURL("a.com", "/sandboxed_iframe.html")); - ui_test_utils::NavigateToURL(browser(), sandboxed); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), sandboxed)); CheckLocalStorageThrows(child_frame()); } diff --git a/components/cosmetic_filters/browser/cosmetic_filters_resources.cc b/components/cosmetic_filters/browser/cosmetic_filters_resources.cc index 1026f78ea51a..4410fc7727c9 100644 --- a/components/cosmetic_filters/browser/cosmetic_filters_resources.cc +++ b/components/cosmetic_filters/browser/cosmetic_filters_resources.cc @@ -45,7 +45,7 @@ void CosmeticFiltersResources::HiddenClassIdSelectors( std::vector classes; base::ListValue* classes_list; if (input_dict->GetList("classes", &classes_list)) { - for (size_t i = 0; i < classes_list->GetSize(); i++) { + for (size_t i = 0; i < classes_list->GetList().size(); i++) { if (!classes_list->GetList()[i].is_string()) { continue; } @@ -55,7 +55,7 @@ void CosmeticFiltersResources::HiddenClassIdSelectors( std::vector ids; base::ListValue* ids_list; if (input_dict->GetList("ids", &ids_list)) { - for (size_t i = 0; i < ids_list->GetSize(); i++) { + for (size_t i = 0; i < ids_list->GetList().size(); i++) { if (!ids_list->GetList()[i].is_string()) { continue; } diff --git a/components/cosmetic_filters/renderer/cosmetic_filters_js_handler.cc b/components/cosmetic_filters/renderer/cosmetic_filters_js_handler.cc index c1b978d18a3b..a51a41f8777b 100644 --- a/components/cosmetic_filters/renderer/cosmetic_filters_js_handler.cc +++ b/components/cosmetic_filters/renderer/cosmetic_filters_js_handler.cc @@ -372,7 +372,7 @@ void CosmeticFiltersJSHandler::CSSRulesRoutine( blink::WebLocalFrame* web_frame = render_frame_->GetWebFrame(); base::ListValue* cf_exceptions_list; if (resources_dict->GetList("exceptions", &cf_exceptions_list)) { - for (size_t i = 0; i < cf_exceptions_list->GetSize(); i++) { + for (size_t i = 0; i < cf_exceptions_list->GetList().size(); i++) { exceptions_.push_back(cf_exceptions_list->GetList()[i].GetString()); } } @@ -386,7 +386,7 @@ void CosmeticFiltersJSHandler::CSSRulesRoutine( force_hide_selectors_list = nullptr; } - if (hide_selectors_list && hide_selectors_list->GetSize() != 0) { + if (hide_selectors_list && hide_selectors_list->GetList().size() != 0) { std::string json_selectors; if (!base::JSONWriter::Write(*hide_selectors_list, &json_selectors) || json_selectors.empty()) { @@ -400,7 +400,8 @@ void CosmeticFiltersJSHandler::CSSRulesRoutine( blink::BackForwardCacheAware::kAllow); } - if (force_hide_selectors_list && force_hide_selectors_list->GetSize() != 0) { + if (force_hide_selectors_list && + force_hide_selectors_list->GetList().size() != 0) { std::string json_selectors; if (!base::JSONWriter::Write(*force_hide_selectors_list, &json_selectors) || json_selectors.empty()) { @@ -458,7 +459,7 @@ void CosmeticFiltersJSHandler::OnHiddenClassIdSelectors(base::Value result) { // Building a script for stylesheet modifications std::string new_selectors_script = base::StringPrintf(kHideSelectorsInjectScript, json_selectors.c_str()); - if (selectors_list->GetSize() != 0) { + if (selectors_list->GetList().size() != 0) { web_frame->ExecuteScriptInIsolatedWorld( isolated_world_id_, blink::WebString::FromUTF8(new_selectors_script), blink::BackForwardCacheAware::kAllow); diff --git a/components/crypto_dot_com/browser/crypto_dot_com_service_browsertest.cc b/components/crypto_dot_com/browser/crypto_dot_com_service_browsertest.cc index 5c3fd2a4e673..45c27f35cfe1 100644 --- a/components/crypto_dot_com/browser/crypto_dot_com_service_browsertest.cc +++ b/components/crypto_dot_com/browser/crypto_dot_com_service_browsertest.cc @@ -265,12 +265,14 @@ class CryptoDotComAPIBrowserTest : public InProcessBrowserTest { } bool NavigateToNewTabUntilLoadStop() { - ui_test_utils::NavigateToURL(browser(), GURL("chrome://newtab")); + EXPECT_TRUE( + ui_test_utils::NavigateToURL(browser(), GURL("chrome://newtab"))); return WaitForLoadStop(active_contents()); } bool NavigateToVersionTabUntilLoadStop() { - ui_test_utils::NavigateToURL(browser(), GURL("chrome://version")); + EXPECT_TRUE( + ui_test_utils::NavigateToURL(browser(), GURL("chrome://version"))); return WaitForLoadStop(active_contents()); } diff --git a/components/decentralized_dns/decentralized_dns_navigation_throttle.cc b/components/decentralized_dns/decentralized_dns_navigation_throttle.cc index 6a76a7529968..3de427e0486c 100644 --- a/components/decentralized_dns/decentralized_dns_navigation_throttle.cc +++ b/components/decentralized_dns/decentralized_dns_navigation_throttle.cc @@ -83,7 +83,7 @@ void DecentralizedDnsNavigationThrottle::ShowInterstitial() { std::string page_content = page->GetHTMLContents(); security_interstitials::SecurityInterstitialTabHelper::AssociateBlockingPage( - web_contents, handle->GetNavigationId(), std::move(page)); + handle, std::move(page)); CancelDeferredNavigation(content::NavigationThrottle::ThrottleCheckResult( content::NavigationThrottle::CANCEL, net::ERR_BLOCKED_BY_CLIENT, diff --git a/components/gemini/browser/gemini_service_browsertest.cc b/components/gemini/browser/gemini_service_browsertest.cc index 859e3aa9b109..cf6aba060f0c 100644 --- a/components/gemini/browser/gemini_service_browsertest.cc +++ b/components/gemini/browser/gemini_service_browsertest.cc @@ -283,12 +283,14 @@ class GeminiAPIBrowserTest : public InProcessBrowserTest { } bool NavigateToNewTabUntilLoadStop() { - ui_test_utils::NavigateToURL(browser(), GURL("chrome://newtab")); + EXPECT_TRUE( + ui_test_utils::NavigateToURL(browser(), GURL("chrome://newtab"))); return WaitForLoadStop(active_contents()); } bool NavigateToVersionTabUntilLoadStop() { - ui_test_utils::NavigateToURL(browser(), GURL("chrome://version")); + EXPECT_TRUE( + ui_test_utils::NavigateToURL(browser(), GURL("chrome://version"))); return WaitForLoadStop(active_contents()); } diff --git a/components/ipfs/ipfs_navigation_throttle.cc b/components/ipfs/ipfs_navigation_throttle.cc index cec2868d1219..9112365c8f60 100644 --- a/components/ipfs/ipfs_navigation_throttle.cc +++ b/components/ipfs/ipfs_navigation_throttle.cc @@ -193,7 +193,7 @@ IpfsNavigationThrottle::ShowIPFSOnboardingInterstitial() { std::string page_content = page->GetHTMLContents(); security_interstitials::SecurityInterstitialTabHelper::AssociateBlockingPage( - web_contents, handle->GetNavigationId(), std::move(page)); + handle, std::move(page)); return content::NavigationThrottle::ThrottleCheckResult( content::NavigationThrottle::CANCEL, net::ERR_BLOCKED_BY_CLIENT, page_content); @@ -213,7 +213,7 @@ void IpfsNavigationThrottle::ShowInterstitial() { std::string page_content = page->GetHTMLContents(); security_interstitials::SecurityInterstitialTabHelper::AssociateBlockingPage( - web_contents, handle->GetNavigationId(), std::move(page)); + handle, std::move(page)); CancelDeferredNavigation(content::NavigationThrottle::ThrottleCheckResult( content::NavigationThrottle::CANCEL, net::ERR_BLOCKED_BY_CLIENT, diff --git a/components/l10n/browser/locale_helper_win.cc b/components/l10n/browser/locale_helper_win.cc index 570454bf31f4..1194913685d5 100644 --- a/components/l10n/browser/locale_helper_win.cc +++ b/components/l10n/browser/locale_helper_win.cc @@ -3,10 +3,12 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include - #include "brave/components/l10n/browser/locale_helper_win.h" +#include + +#include + namespace brave_l10n { LocaleHelperWin::LocaleHelperWin() = default; diff --git a/components/l10n/browser/locale_helper_win.h b/components/l10n/browser/locale_helper_win.h index 794c8d9cd03a..c39b223754e7 100644 --- a/components/l10n/browser/locale_helper_win.h +++ b/components/l10n/browser/locale_helper_win.h @@ -6,7 +6,6 @@ #ifndef BRAVE_COMPONENTS_L10N_BROWSER_LOCALE_HELPER_WIN_H_ #define BRAVE_COMPONENTS_L10N_BROWSER_LOCALE_HELPER_WIN_H_ -#include #include #include "brave/components/l10n/browser/locale_helper.h" diff --git a/components/management_strings.grdp b/components/management_strings.grdp index ef9384046f1c..0a08de6f3d31 100644 --- a/components/management_strings.grdp +++ b/components/management_strings.grdp @@ -240,7 +240,7 @@ Text is entered - Unsafe event occurs + Security event occurs Page is visited @@ -255,7 +255,7 @@ Text you paste or attach is sent to Brave Cloud or third parties for analysis. For example, it might be scanned for sensitive data. - When security events are flagged by Brave Enterprise Connectors, relevant data about the events is sent to your administrator. This can include URLs of pages you visit in Brave, file names or metadata, and the username that you use to sign in to your device and Brave. + When security events are flagged by Brave, relevant data about the events is sent to your administrator. This can include URLs of pages you visit in Brave, file names or metadata, and the username that you use to sign in to web based applications, your device and Brave. URLs of pages you visit are sent to Brave Cloud or third parties for analysis. For example, they might be scanned to detect unsafe websites. diff --git a/components/new_or_sad_tab_strings.grdp b/components/new_or_sad_tab_strings.grdp index 224b119c09e7..6d5b1b2e645d 100644 --- a/components/new_or_sad_tab_strings.grdp +++ b/components/new_or_sad_tab_strings.grdp @@ -176,4 +176,35 @@ When on, sites can't use cookies that track you across the web. Features on some sites may break. + + + + Private + + + What Private does + + + After closing all Private tabs, Brave clears: + <ul> + <li>Your browsing activity from this device</li> + <li>Your search history from this device</li> + <li>Information entered in forms</li> + </ul> + + + What Private doesn’t do + + + Private does not make you invisible online: + <ul> + <li>Sites know when you visit them</li> + <li>Employers or schools can track browsing activity</li> + <li>Internet service providers may monitor web traffic</li> + </ul> + + + <a>Learn more</a> about Private + + diff --git a/components/new_or_sad_tab_strings_override.grdp b/components/new_or_sad_tab_strings_override.grdp index f86ed3d0870d..1d924e04c0e7 100644 --- a/components/new_or_sad_tab_strings_override.grdp +++ b/components/new_or_sad_tab_strings_override.grdp @@ -64,4 +64,33 @@ Now you can browse privately, and other profiles who use this device won’t see your activity. However, downloads, bookmarks and reading list items will be saved. - + + Private + + + What Private does + + + After closing all Private tabs, Brave clears: + <ul> + <li>Your browsing activity from this device</li> + <li>Your search history from this device</li> + <li>Information entered in forms</li> + </ul> + + + What Private doesn’t do + + + Private does not make you invisible online: + <ul> + <li>Sites know when you visit them</li> + <li>Employers or schools can track browsing activity</li> + <li>Internet service providers may monitor web traffic</li> + </ul> + + + <a>Learn more</a> about Private + + + diff --git a/components/omnibox_strings.grdp b/components/omnibox_strings.grdp index 04c0f389d7bd..1e56a2fd9a09 100644 --- a/components/omnibox_strings.grdp +++ b/components/omnibox_strings.grdp @@ -434,6 +434,169 @@ Resume journey button, press Enter to resume your journey and see relevant activity in your Brave history + + + + + + + + Find my phone + + + Find my phone + + + $1The Brave Projects http://www.chromium.org bookmark, Find my phone + + + Find my phone + + + + Manage my privacy on Brave + + + Manage my privacy on Brave + + + $1The Brave Projects http://www.chromium.org bookmark, Manage my privacy on Brave + + + Manage my privacy on Brave + + + + Manage my Brave Ad Settings + + + Manage my Brave Ad Settings + + + $1The Brave Projects http://www.chromium.org bookmark, Manage my Brave Ad Settings + + + Manage my Brave Ad Settings + + + + Manage Brave settings + + + Manage your Brave settings + + + $1The Brave Projects http://www.chromium.org bookmark, Press Tab then Enter to manage your Brave settings + + + Manage Brave settings button, press Enter to visit your Brave settings + + + + Manage downloads in Brave + + + Manage files you have downloaded in Brave + + + $1The Brave Projects http://www.chromium.org bookmark, Press Tab then Enter to manage files you have downloaded in Brave + + + Manage downloads in Brave button, press Enter to manage files you have downloaded in Brave. + + + + View your Brave history + + + View and manage your browsing history in Brave settings + + + $1The Brave Projects http://www.chromium.org bookmark, Press tab then Enter to view your browsing history in Brave + + + View your Brave history button, Enter to view and manage your browsing history in Brave settings + + + + Share this page + + + Share this page by sharing the link, creating a QR code, casting, and more. + + + $1The Brave Projects http://www.chromium.org bookmark, Press tab then Enter to share this page, with options to share the link, create a QR code, cast, and more. + + + Share this page button, Enter to share this page with options to share the link, create a QR code, cast, and more. + + + + Manage accessibility settings + + + Personalize your accessibility tools in Brave settings + + + $1The Brave Projects http://www.chromium.org bookmark, Press tab then Enter to personalize your accessibility tools in Brave settings. + + + Manage accessibility settings button, Enter to personalize your accessibility tools in Brave settings. + + + + Customize fonts in Brave + + + Customize font sizes and typefaces in Brave + + + $1The Brave Projects http://www.chromium.org bookmark, Press tab then Enter to customize font sizes and typefaces in Brave + + + Customize fonts in Brave button, Enter to customize font sizes and typefaces in Brave + + + + Manage Brave themes + + + Customize the look of your browser with themes + + + $1The Brave Projects http://www.chromium.org bookmark, Press tab then Enter to customize the look of your browser with themes. + + + Manage Brave themes button, Enter to customize the look of your browser with themes. + + + + Manage site search + + + Manage site search and your default search engine + + + $1The Brave Projects http://www.chromium.org bookmark, Press tab then Enter to manage site search and your default search engine + + + Manage site search button, press Enter to manage site search and your default search engine + + + + Manage accessibility settings + + + Personalize your accessibility tools in Chrome OS settings + + + $1The Brave Projects http://www.chromium.org bookmark, Press tab then Enter to personalize your accessibility tools in Chrome OS settings. + + + Manage accessibility settings button, press Enter to personalize your accessibility tools in Chrome OS settings + + + diff --git a/components/page_info_strings.grdp b/components/page_info_strings.grdp index f7d1f983c1ed..64536acec5f9 100644 --- a/components/page_info_strings.grdp +++ b/components/page_info_strings.grdp @@ -306,96 +306,6 @@ - - - Ads - - - Protected content IDs - - - Background Sync - - - Your device use - - - Images - - - JavaScript - - - Pop-ups and redirects - - - Location - - - Notifications - - - Microphone - - - Camera - - - MIDI devices full control - - - Sound - - - Clipboard - - - Motion or Light Sensors - - - Motion Sensors - - - USB devices - - - Serial ports - - - Bluetooth devices - - - File editing - - - Bluetooth scanning - - - NFC devices - - - Virtual reality - - - Augmented reality - - - Camera use & movement - - - Window placement - - - Fonts - - - HID devices - - - File Handlers - - - Allow diff --git a/components/payments_strings.grdp b/components/payments_strings.grdp index aae9441dbaa1..5e5bc217e1da 100644 --- a/components/payments_strings.grdp +++ b/components/payments_strings.grdp @@ -629,33 +629,16 @@ Verify your purchase - - You can use your device to quickly verify it's you the next time you make a purchase with this payment method. - Use Touch ID to verify and complete your purchase? - - You can use Touch ID to quickly verify it's you the next time you use this device to make a purchase with this payment method. - - - - Use Touch ID - - Use Windows Hello to verify and complete your purchase? - - You can use Windows Hello to quickly verify it's you the next time you use this device to make a purchase with this payment method. - - - Use Windows Hello - Store @@ -666,15 +649,6 @@ Verify - - Check out faster next time - - - Sign-in data will be stored on this device after you exit Private mode. - - - No thanks - %1$smerchant.com may need to take additional steps to verify your payment @@ -688,15 +662,6 @@ - - Secure payment credential enrollment sheet - - - Secure payment credential enrollment sheet is opened - - - Secure payment credential enrollment sheet is closed - Secure payment credential authentication sheet diff --git a/components/payments_strings_override.grdp b/components/payments_strings_override.grdp index 0d44127ddf88..ee27406e0cac 100644 --- a/components/payments_strings_override.grdp +++ b/components/payments_strings_override.grdp @@ -34,12 +34,8 @@ - - - - Sign-in data will be stored on this device after you exit Private mode. - - + + diff --git a/components/permissions_strings.grdp b/components/permissions_strings.grdp index 12568c1bf607..1a240ddbce58 100644 --- a/components/permissions_strings.grdp +++ b/components/permissions_strings.grdp @@ -67,7 +67,23 @@ $1https://backgroundfetch.com wants to download multiple files - + + + Allow camera? + + + Allow storage access? + + + Allow microphone? + + + Allow location? + + + Allow 2 permissions? + + Know your unique device identifier @@ -132,6 +148,12 @@ This will otherwise be blocked by your privacy settings. This will allow the con See the make and model of your Security Key + + Use your Security Key + + + This site won't be able to use the U2F API after February 2022. If you own this site, you should change it to use the Web Authentication API. + Allow diff --git a/components/site_settings_strings.grdp b/components/site_settings_strings.grdp new file mode 100644 index 000000000000..1cd0a8776895 --- /dev/null +++ b/components/site_settings_strings.grdp @@ -0,0 +1,222 @@ + + + + + + Ads + + + ads + + + Augmented reality + + + augmented reality + + + Automatic downloads + + + automatic downloads + + + Background sync + + + background sync + + + Bluetooth devices + + + bluetooth devices + + + Bluetooth scanning + + + bluetooth scanning + + + Camera + + + camera + + + Camera use & movement + + + camera use & movement + + + Clipboard + + + clipboard + + + Cookies and site data + + + cookies and site data + + + Your device use + + + your device use + + + JavaScript + + + javascript + + + Location + + + location + + + Microphone + + + microphone + + + MIDI devices + + + MIDI devices + + + Motion sensors + + + motion sensors + + + NFC devices + + + NFC devices + + + Notifications + + + notifications + + + Pop-ups and redirects + + + pop-ups and redirects + + + Protected content IDs + + + protected content IDs + + + Motion or light sensors + + + motion or light sensors + + + Sound + + + sound + + + USB devices + + + USB devices + + + Virtual reality + + + virtual reality + + + + + + File handlers + + + file handlers + + + File editing + + + file editing + + + Fonts + + + fonts + + + Protocol handlers + + + protocol handlers + + + HID devices + + + HID devices + + + Images + + + images + + + Insecure content + + + insecure content + + + Payment handlers + + + payment handlers + + + PDF documents + + + Serial ports + + + serial ports + + + Zoom levels + + + zoom levels + + + Window placement + + + window placement + + + diff --git a/components/subresource_filter_strings.grdp b/components/subresource_filter_strings.grdp index daed0e66e8b0..cd0125a331cc 100644 --- a/components/subresource_filter_strings.grdp +++ b/components/subresource_filter_strings.grdp @@ -15,5 +15,20 @@ Ads blocked. + + Ads blocked + + + Ads blocked + + + This site shows intrusive or misleading ads + + + Allow for this site + + + Learn more + diff --git a/ios/browser/brave_web_main_parts.mm b/ios/browser/brave_web_main_parts.mm index 865eaf928fc9..6ee0d9f99969 100644 --- a/ios/browser/brave_web_main_parts.mm +++ b/ios/browser/brave_web_main_parts.mm @@ -45,7 +45,7 @@ base::FilePath resources_pack_path; base::PathService::Get(ios::FILE_RESOURCES_PACK, &resources_pack_path); ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( - resources_pack_path, ui::SCALE_FACTOR_100P); + resources_pack_path, ui::k100Percent); } void BraveWebMainParts::PreCreateThreads() { diff --git a/ios/browser/providers/BUILD.gn b/ios/browser/providers/BUILD.gn index 7a24d3aa6299..9e9f116d45b0 100644 --- a/ios/browser/providers/BUILD.gn +++ b/ios/browser/providers/BUILD.gn @@ -16,10 +16,14 @@ group("brave_providers") { "//ios/chrome/browser/providers/branded_images:chromium_branded_images", "//ios/chrome/browser/providers/lens:chromium_lens", "//ios/chrome/browser/providers/modals:chromium_modals", + "//ios/chrome/browser/providers/omaha:chromium_omaha", + "//ios/chrome/browser/providers/overrides:chromium_overrides", "//ios/chrome/browser/providers/risk_data:chromium_risk_data", "//ios/chrome/browser/providers/signin:chromium_signin_error", "//ios/chrome/browser/providers/signin:chromium_signin_resources", "//ios/chrome/browser/providers/text_zoom:chromium_text_zoom", + "//ios/chrome/browser/providers/url_rewriters:chromium_url_rewriters", + "//ios/chrome/browser/providers/voice_search:chromium_voice_search", # The provider API needs to provide MaterialDesignComponent API (as the # internal provider provides an alternate implementation). diff --git a/patches/base-BUILD.gn.patch b/patches/base-BUILD.gn.patch index 03709847701e..e99737b4baca 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 bafc85477602d8829665e5e780ef57f15a1d7cf6..6d396eebae43f960ea5e22f10ee35059324924f3 100644 +index 336ce46f03ad287bb09fb3cdef858f2ac5548a26..aa76e8ecab1f43b6389c58d522de7109e70b6086 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn -@@ -3987,6 +3987,7 @@ if (is_android) { +@@ -4014,6 +4014,7 @@ if (is_android) { "android/java/src/org/chromium/base/task/TaskTraits.java", "android/java/src/org/chromium/base/task/TaskTraitsExtensionDescriptor.java", ] diff --git a/patches/base-threading-thread_restrictions.h.patch b/patches/base-threading-thread_restrictions.h.patch index 084685ac58cd..9f7e20c79bce 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 088e966c9948d55fbb22daf4acd21072b220920d..86f6bbbd4c209ae911fab9e3a4f03f5ed9329a8b 100644 +index 0865f0faec715cfe5e1308007f8fc6e8e4c4a37e..0f356508a6e8dc8a4f12fda320950d0d516f37b8 100644 --- a/base/threading/thread_restrictions.h +++ b/base/threading/thread_restrictions.h -@@ -478,6 +478,7 @@ INLINE_IF_DCHECK_IS_OFF void DisallowBaseSyncPrimitives() +@@ -488,6 +488,7 @@ INLINE_IF_DCHECK_IS_OFF void DisallowBaseSyncPrimitives() EMPTY_BODY_IF_DCHECK_IS_OFF; class BASE_EXPORT ScopedAllowBaseSyncPrimitives { diff --git a/patches/build-android-gyp-dex.py.patch b/patches/build-android-gyp-dex.py.patch index 4ecb01e03554..7e9557b23d48 100644 --- a/patches/build-android-gyp-dex.py.patch +++ b/patches/build-android-gyp-dex.py.patch @@ -1,5 +1,5 @@ diff --git a/build/android/gyp/dex.py b/build/android/gyp/dex.py -index e55ab4eccf0549864273b8b8f80aa6e17ce228a7..ddeb3fa2932292891adc0b1ed851895c8333d268 100755 +index cac97985085897dbfdf27cd53c8523a3e34b3859..5ec306a9ff40267b7f9a97a88b0d06699e636e4b 100755 --- a/build/android/gyp/dex.py +++ b/build/android/gyp/dex.py @@ -48,6 +48,7 @@ _IGNORE_WARNINGS = ( diff --git a/patches/build-android-gyp-util-resource_utils.py.patch b/patches/build-android-gyp-util-resource_utils.py.patch index 905a243e9d02..f5cfa886b248 100644 --- a/patches/build-android-gyp-util-resource_utils.py.patch +++ b/patches/build-android-gyp-util-resource_utils.py.patch @@ -1,5 +1,5 @@ diff --git a/build/android/gyp/util/resource_utils.py b/build/android/gyp/util/resource_utils.py -index 263b7c23484c6225ef4fa410674d54863a58809a..c28f8a638be678353ee049acc096e624b18e66ef 100644 +index 4f64174193be3ea59e072787408f83360aa1674a..6554092c896b80e64effb319cf7f10613d54ca8e 100644 --- a/build/android/gyp/util/resource_utils.py +++ b/build/android/gyp/util/resource_utils.py @@ -257,6 +257,7 @@ class ResourceInfoFile(object): diff --git a/patches/build-config-BUILDCONFIG.gn.patch b/patches/build-config-BUILDCONFIG.gn.patch index cf96c25fa7ba..92d9787b88d1 100644 --- a/patches/build-config-BUILDCONFIG.gn.patch +++ b/patches/build-config-BUILDCONFIG.gn.patch @@ -1,5 +1,5 @@ diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn -index 725894d05274355be4ad5d6ac3388a489220a50c..33b519fd8ebdff03904f85f76b6f296b3626056b 100644 +index 62e7e4bcd3e6c1ef49e3c929af7ac4634a1e6e2b..7522c87aa5708b5d50937c694723d0849bbc9676 100644 --- a/build/config/BUILDCONFIG.gn +++ b/build/config/BUILDCONFIG.gn @@ -314,6 +314,7 @@ is_posix = !is_win && !is_fuchsia diff --git a/patches/build-config-android-rules.gni.patch b/patches/build-config-android-rules.gni.patch index fb43d6514918..d97fb8d0fcf8 100644 --- a/patches/build-config-android-rules.gni.patch +++ b/patches/build-config-android-rules.gni.patch @@ -1,5 +1,5 @@ diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni -index 1099c49fbff99028319f7ad2a66b717701d27e0f..07e9b140abd90596ff7c00f96f3e1d6b4e760506 100644 +index 7cbfb33e417c899827151dcb7578e985b9b8d059..e26b5dbaffad14395d0ac759e7d75d5f89e63fc2 100644 --- a/build/config/android/rules.gni +++ b/build/config/android/rules.gni @@ -476,6 +476,7 @@ if (enable_java_templates) { diff --git a/patches/build-config-compiler-BUILD.gn.patch b/patches/build-config-compiler-BUILD.gn.patch index 31fc58d78942..8eb21c61ecd6 100644 --- a/patches/build-config-compiler-BUILD.gn.patch +++ b/patches/build-config-compiler-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn -index d7073ad38f0bfa55524691e701d7b25fef2f5116..b031841c169c0dc17274afccf3aa6bac29326b2d 100644 +index 219a2be0e1a1f9d5cc5a852bf1d9c8c04f8387bf..b8c7153d39abe06f0c9e4a109c6008dad1599764 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn -@@ -1737,6 +1737,7 @@ config("chromium_code") { +@@ -1780,6 +1780,7 @@ config("chromium_code") { cflags += [ "-Wextra-semi" ] } } diff --git a/patches/chrome-BUILD.gn.patch b/patches/chrome-BUILD.gn.patch index 2f84261d18a3..d2aa0c912813 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 c25d483469dbc2580f12340daefb85f085b4e127..a78f9112b8948f2ee2583980af034df22d4dee05 100644 +index af3de1bc2d021f984bcf63b5b70182b5cf1961e7..8b99a72a994d0bf8fe54c13b47213e1266634e81 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn @@ -164,6 +164,7 @@ if (!is_android && !is_mac) { @@ -10,7 +10,7 @@ index c25d483469dbc2580f12340daefb85f085b4e127..a78f9112b8948f2ee2583980af034df2 deps += [ ":chrome_dll", -@@ -436,11 +437,12 @@ if (is_win) { +@@ -456,11 +457,12 @@ if (is_win) { args += [ "--keystone=0" ] } } @@ -24,7 +24,7 @@ index c25d483469dbc2580f12340daefb85f085b4e127..a78f9112b8948f2ee2583980af034df2 extra_substitutions = [ "CHROMIUM_BUNDLE_ID=$chrome_mac_bundle_id", "CHROMIUM_SHORT_NAME=$chrome_product_short_name", -@@ -458,6 +460,7 @@ if (is_win) { +@@ -478,6 +480,7 @@ if (is_win) { "//chrome/common:buildflags", "//chrome/common:version_header", ] @@ -32,7 +32,7 @@ index c25d483469dbc2580f12340daefb85f085b4e127..a78f9112b8948f2ee2583980af034df2 if (enable_stripping) { # At link time, preserve the global symbols specified in the .exports -@@ -530,7 +533,7 @@ if (is_win) { +@@ -550,7 +553,7 @@ if (is_win) { args = [ "-b", @@ -41,7 +41,7 @@ index c25d483469dbc2580f12340daefb85f085b4e127..a78f9112b8948f2ee2583980af034df2 "-v", chrome_version_full, "-g", -@@ -604,6 +607,7 @@ if (is_win) { +@@ -624,6 +627,7 @@ if (is_win) { # this dependency directly copies the file into the framework's # resources directory. public_deps += [ ":chrome_framework_widevine_signature" ] @@ -49,7 +49,7 @@ index c25d483469dbc2580f12340daefb85f085b4e127..a78f9112b8948f2ee2583980af034df2 } } -@@ -636,9 +640,11 @@ if (is_win) { +@@ -656,9 +660,11 @@ if (is_win) { "--scm=0", ] } @@ -61,7 +61,7 @@ index c25d483469dbc2580f12340daefb85f085b4e127..a78f9112b8948f2ee2583980af034df2 if (is_chrome_branded) { # These entitlements are bound to the official Google Chrome signing # certificate and will not necessarily work in any other build. -@@ -663,6 +669,7 @@ if (is_win) { +@@ -683,6 +689,7 @@ if (is_win) { info_plist_target = invoker.info_plist_target } else { info_plist_target = ":chrome_helper_plist" @@ -69,7 +69,7 @@ index c25d483469dbc2580f12340daefb85f085b4e127..a78f9112b8948f2ee2583980af034df2 } extra_substitutions = [ -@@ -1137,6 +1144,7 @@ if (is_win) { +@@ -1157,6 +1164,7 @@ if (is_win) { if (is_chrome_branded) { bundle_deps += [ ":preinstalled_apps" ] } @@ -77,7 +77,7 @@ index c25d483469dbc2580f12340daefb85f085b4e127..a78f9112b8948f2ee2583980af034df2 ldflags = [ "-compatibility_version", -@@ -1316,6 +1324,7 @@ if (is_win) { +@@ -1336,6 +1344,7 @@ if (is_win) { group("browser_dependencies") { public_deps = [ @@ -85,7 +85,7 @@ index c25d483469dbc2580f12340daefb85f085b4e127..a78f9112b8948f2ee2583980af034df2 "//build:branding_buildflags", "//build:chromeos_buildflags", "//chrome/browser", -@@ -1424,12 +1433,13 @@ group("child_dependencies") { +@@ -1444,12 +1453,13 @@ group("child_dependencies") { # this is OK because all of content is linked into one library. "//content/browser", ] @@ -100,7 +100,7 @@ index c25d483469dbc2580f12340daefb85f085b4e127..a78f9112b8948f2ee2583980af034df2 output = "$target_gen_dir/chrome_exe_version.rc" } -@@ -1483,6 +1493,7 @@ group("resources") { +@@ -1503,6 +1513,7 @@ group("resources") { "//chrome/browser:resources", "//chrome/common:resources", "//chrome/renderer:resources", diff --git a/patches/chrome-VERSION.patch b/patches/chrome-VERSION.patch index 9480264cd8ba..2f995e002cf3 100644 --- a/patches/chrome-VERSION.patch +++ b/patches/chrome-VERSION.patch @@ -1,12 +1,12 @@ diff --git a/chrome/VERSION b/chrome/VERSION -index 6de619ddbd5353393892d4e4688481b451cff819..3cff1a924404ad82a9cab449c284694117fa4b6e 100644 +index 35091de242d1aff685971ce059cde5a94b6e25e0..1808af88a4f31866dc551dca699f6edefb059a3f 100644 --- a/chrome/VERSION +++ b/chrome/VERSION @@ -1,4 +1,4 @@ - MAJOR=94 + MAJOR=95 -MINOR=0 --BUILD=4606 --PATCH=71 +-BUILD=4638 +-PATCH=32 +MINOR=1 +BUILD=32 +PATCH=45 diff --git a/patches/chrome-android-BUILD.gn.patch b/patches/chrome-android-BUILD.gn.patch index 782003b693e4..6115e7bba202 100644 --- a/patches/chrome-android-BUILD.gn.patch +++ b/patches/chrome-android-BUILD.gn.patch @@ -1,5 +1,5 @@ diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn -index dd4823f8558180d92cd2ab165130f64918b85a68..91cae183db61c4b1812b5cfc0af17eede25452cb 100644 +index d440e71a0d886d07d8fd935d1b688913159f1757..64e730918e392a87dc1e4470337796c8d10a605f 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn @@ -252,6 +252,7 @@ android_resources("chrome_app_java_resources") { @@ -10,7 +10,7 @@ index dd4823f8558180d92cd2ab165130f64918b85a68..91cae183db61c4b1812b5cfc0af17eed } if (enable_vr) { -@@ -603,6 +604,7 @@ android_library("chrome_java") { +@@ -608,6 +609,7 @@ android_library("chrome_java") { deps += feed_deps deps += web_feed_deps @@ -18,7 +18,7 @@ index dd4823f8558180d92cd2ab165130f64918b85a68..91cae183db61c4b1812b5cfc0af17eed srcjar_deps = [ ":autofill_verification_status_generated_enum", -@@ -634,6 +636,7 @@ android_library("chrome_java") { +@@ -640,6 +642,7 @@ android_library("chrome_java") { "//components/offline_pages/core:offline_page_model_enums_java", "//net:effective_connection_type_java", ] @@ -26,7 +26,7 @@ index dd4823f8558180d92cd2ab165130f64918b85a68..91cae183db61c4b1812b5cfc0af17eed # From java_sources.gni. sources = chrome_java_sources + [ app_hooks_impl ] -@@ -754,6 +757,7 @@ java_group("chrome_all_java") { +@@ -760,6 +763,7 @@ java_group("chrome_all_java") { "//chrome/android/features/tab_ui:module_desc_java", ] } @@ -34,7 +34,7 @@ index dd4823f8558180d92cd2ab165130f64918b85a68..91cae183db61c4b1812b5cfc0af17eed } # This is a list of all base module jni headers. New features should add their -@@ -797,6 +801,7 @@ group("jni_headers") { +@@ -804,6 +808,7 @@ group("jni_headers") { "//components/ukm/android:jni_headers", "//components/webauthn/android:jni_headers", ] @@ -42,7 +42,7 @@ index dd4823f8558180d92cd2ab165130f64918b85a68..91cae183db61c4b1812b5cfc0af17eed } action_with_pydeps("chrome_android_java_google_api_keys_srcjar") { -@@ -2078,6 +2083,7 @@ if (current_toolchain == default_toolchain) { +@@ -2139,6 +2144,7 @@ if (current_toolchain == default_toolchain) { ":${_variant}_locale_pak_assets", ":${_variant}_paks", ] @@ -50,7 +50,7 @@ index dd4823f8558180d92cd2ab165130f64918b85a68..91cae183db61c4b1812b5cfc0af17eed if (_is_monochrome) { deps += [ "//android_webview:locale_pak_assets" ] if (webview_includes_weblayer && !_is_bundle_module) { -@@ -2474,6 +2480,7 @@ android_library("base_module_java") { +@@ -2535,6 +2541,7 @@ android_library("base_module_java") { "//components/payments/content/android:service_java", "//third_party/androidx:androidx_browser_browser_java", ] diff --git a/patches/chrome-android-chrome_java_sources.gni.patch b/patches/chrome-android-chrome_java_sources.gni.patch index e5b819fd5327..c10c233854b7 100644 --- a/patches/chrome-android-chrome_java_sources.gni.patch +++ b/patches/chrome-android-chrome_java_sources.gni.patch @@ -1,8 +1,8 @@ diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java_sources.gni -index dd58dafd72a5f57758951dbe091ad8e980ccf1b1..c8e4f43839c5c2c972bdbc70fa8bb995e057aa05 100644 +index 143bf28a71d5475ed564d0eccd758bb8901cd389..3da3da69db4eb0cc19ade29603190c7bee990adf 100644 --- a/chrome/android/chrome_java_sources.gni +++ b/chrome/android/chrome_java_sources.gni -@@ -1266,3 +1266,4 @@ chrome_java_sources = [ +@@ -1264,3 +1264,4 @@ chrome_java_sources = [ "java/src/org/chromium/chrome/browser/webauth/authenticator/CableAuthenticatorActivity.java", "java/src/org/chromium/chrome/browser/webshare/ShareServiceImplementationFactory.java", ] diff --git a/patches/chrome-android-expectations-lint-suppressions.xml.patch b/patches/chrome-android-expectations-lint-suppressions.xml.patch index cf8bb551413d..e1bbbb541995 100644 --- a/patches/chrome-android-expectations-lint-suppressions.xml.patch +++ b/patches/chrome-android-expectations-lint-suppressions.xml.patch @@ -1,5 +1,5 @@ diff --git a/chrome/android/expectations/lint-suppressions.xml b/chrome/android/expectations/lint-suppressions.xml -index b6d0d195ca192093dc6801855fe031efe4d8ff7d..5d65177959a039b20ffe27fc5b50dac15dd9430b 100644 +index 6da95c1465693c8258f722075cd307a6a73ae734..fa92905e7bfed7cb74e7c50dfd9b60cb194f8615 100644 --- a/chrome/android/expectations/lint-suppressions.xml +++ b/chrome/android/expectations/lint-suppressions.xml @@ -121,6 +121,7 @@ https://chromium.googlesource.com/chromium/src/+/main/build/android/docs/lint.md @@ -10,7 +10,7 @@ index b6d0d195ca192093dc6801855fe031efe4d8ff7d..5d65177959a039b20ffe27fc5b50dac1 -@@ -294,4 +295,5 @@ https://chromium.googlesource.com/chromium/src/+/main/build/android/docs/lint.md +@@ -291,4 +292,5 @@ https://chromium.googlesource.com/chromium/src/+/main/build/android/docs/lint.md diff --git a/patches/chrome-android-java-AndroidManifest.xml.patch b/patches/chrome-android-java-AndroidManifest.xml.patch index 390be290d4bb..0c1e429fe31c 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 934324202e0577e9c925363fbec67a91bb3deb42..ebfae463ffd506b1bd8cfef82902a86d3d81f1ad 100644 +index 9de3983076996312367d8c2f1a8f27b817f8eef1..21a81c4ee10188f327949389ceefa0591f0627a2 100644 --- a/chrome/android/java/AndroidManifest.xml +++ b/chrome/android/java/AndroidManifest.xml @@ -59,7 +59,9 @@ by a child template that "extends" this file. @@ -65,7 +65,7 @@ index 934324202e0577e9c925363fbec67a91bb3deb42..ebfae463ffd506b1bd8cfef82902a86d -@@ -1212,6 +1226,7 @@ by a child template that "extends" this file. +@@ -1205,6 +1219,7 @@ by a child template that "extends" this file. android:configChanges="orientation|keyboardHidden|keyboard|screenSize|mcc|mnc|screenLayout|smallestScreenSize" > @@ -73,7 +73,7 @@ index 934324202e0577e9c925363fbec67a91bb3deb42..ebfae463ffd506b1bd8cfef82902a86d {% block extra_application_definitions %} {% endblock %} {% endmacro %} -@@ -1290,6 +1305,7 @@ by a child template that "extends" this file. +@@ -1283,6 +1298,7 @@ by a child template that "extends" this file. diff --git a/patches/chrome-android-java-src-org-chromium-chrome-browser-AppHooks.java.patch b/patches/chrome-android-java-src-org-chromium-chrome-browser-AppHooks.java.patch index 74e3b3755a7d..e9d7e5395b21 100644 --- a/patches/chrome-android-java-src-org-chromium-chrome-browser-AppHooks.java.patch +++ b/patches/chrome-android-java-src-org-chromium-chrome-browser-AppHooks.java.patch @@ -1,8 +1,8 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/AppHooks.java b/chrome/android/java/src/org/chromium/chrome/browser/AppHooks.java -index 8230cb72bc408777b756132673eb9bf779f3a171..fc5561d55fa03bb57fefedbca5036fed1c413081 100644 +index b50522a40419fb8f6ba40a2820ae5b21ba186387..ff9c53aa9069b4d64f72d284db2f6153b07d1ee4 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/AppHooks.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/AppHooks.java -@@ -71,7 +71,7 @@ public abstract class AppHooks { +@@ -74,7 +74,7 @@ public abstract class AppHooks { @CalledByNative public static AppHooks get() { diff --git a/patches/chrome-android-java-src-org-chromium-chrome-browser-ChromeTabbedActivity.java.patch b/patches/chrome-android-java-src-org-chromium-chrome-browser-ChromeTabbedActivity.java.patch index a341bf9969c5..626e8e2f190f 100644 --- a/patches/chrome-android-java-src-org-chromium-chrome-browser-ChromeTabbedActivity.java.patch +++ b/patches/chrome-android-java-src-org-chromium-chrome-browser-ChromeTabbedActivity.java.patch @@ -1,8 +1,8 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java -index 5aa0e513bef79ee77130e4d46662b9d6403abe72..0ab3eeb3582ec6b7cf9e140b45f1078e9938a5e1 100644 +index 10d890c3ec51ad9bbb0af1e99a2def14aa2e6d6e..904bd22c038c67af6914ccdb051d886b347b8bc3 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java -@@ -2340,6 +2340,7 @@ public class ChromeTabbedActivity extends ChromeActivity +@@ -395,7 +395,7 @@ public abstract class ChromeActivity private boolean mLastPictureInPictureModeForTesting; protected ChromeActivity() { 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 bd4cd46f8b1b..5720a60a41de 100644 --- a/patches/chrome-android-java-src-org-chromium-chrome-browser-notifications-NotificationPlatformBridge.java.patch +++ b/patches/chrome-android-java-src-org-chromium-chrome-browser-notifications-NotificationPlatformBridge.java.patch @@ -1,5 +1,5 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java -index 912ba1d1cae3d292599a0d29a9220a669bb0da3d..4acf6b62ba6c71656b8c020733123eeccdee3f5e 100644 +index 15fb74121d062b0ec43fe50315231a068f4276ba..ed719032a07fd7b4f23fe0422d7c651abfa4a4a2 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 @@ -81,7 +81,7 @@ public class NotificationPlatformBridge { @@ -20,8 +20,8 @@ index 912ba1d1cae3d292599a0d29a9220a669bb0da3d..4acf6b62ba6c71656b8c020733123eec mNativeNotificationPlatformBridge = nativeNotificationPlatformBridge; Context context = ContextUtils.getApplicationContext(); if (sNotificationManagerOverride != null) { -@@ -574,7 +574,7 @@ public class NotificationPlatformBridge { - }); +@@ -581,7 +581,7 @@ public class NotificationPlatformBridge { + } } - private NotificationBuilderBase prepareNotificationBuilder(String notificationId, @@ -29,7 +29,7 @@ index 912ba1d1cae3d292599a0d29a9220a669bb0da3d..4acf6b62ba6c71656b8c020733123eec @NotificationType int notificationType, String origin, String scopeUrl, String profileId, boolean incognito, boolean vibrateEnabled, String title, String body, Bitmap image, Bitmap icon, Bitmap badge, int[] vibrationPattern, long timestamp, -@@ -683,7 +683,7 @@ public class NotificationPlatformBridge { +@@ -690,7 +690,7 @@ public class NotificationPlatformBridge { notificationId /* notificationTag */, PLATFORM_ID /* notificationId */)); } 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 af505050c460..98f1fbef07ea 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 69bcd7e5e38574b6e1edba96cbfc61f2552b72bd..2c28f017de2911511d152b05117d34842bd9535c 100644 +index 9b051d977a1a40c91c3ad1d97238b344794bf502..dfc98f62c73e363cb98640cc49c92ee119c7a779 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 -@@ -46,7 +46,7 @@ import org.chromium.ui.text.SpanApplier; +@@ -45,7 +45,7 @@ import org.chromium.ui.text.SpanApplier; * Fragment to keep track of the all the privacy related preferences. */ public class PrivacySettings @@ -11,7 +11,7 @@ index 69bcd7e5e38574b6e1edba96cbfc61f2552b72bd..2c28f017de2911511d152b05117d3484 private static final String PREF_CAN_MAKE_PAYMENT = "can_make_payment"; private static final String PREF_NETWORK_PREDICTIONS = "preload_pages"; private static final String PREF_HTTPS_FIRST_MODE = "https_first_mode"; -@@ -246,6 +246,7 @@ public class PrivacySettings +@@ -245,6 +245,7 @@ public class PrivacySettings @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { menu.clear(); @@ -19,7 +19,7 @@ index 69bcd7e5e38574b6e1edba96cbfc61f2552b72bd..2c28f017de2911511d152b05117d3484 MenuItem help = menu.add(Menu.NONE, R.id.menu_id_targeted_help, Menu.NONE, R.string.menu_help); help.setIcon(VectorDrawableCompat.create( -@@ -260,6 +261,6 @@ public class PrivacySettings +@@ -259,6 +260,6 @@ public class PrivacySettings null); return true; } diff --git a/patches/chrome-android-java_sources.gni.patch b/patches/chrome-android-java_sources.gni.patch index afe6ad355cdd..e3e17657795d 100644 --- a/patches/chrome-android-java_sources.gni.patch +++ b/patches/chrome-android-java_sources.gni.patch @@ -1,5 +1,5 @@ diff --git a/chrome/android/java_sources.gni b/chrome/android/java_sources.gni -index 5d622d46a53ce8f37564500208aec3465bb060d0..c2c681246cb5d8d5ebf0df0cae9392cac231a96e 100644 +index 38b34fd3ae9fc9e3d1f6591244e6d970c4708171..a6774ef2e8be59c4d2cc1c19f31d540822203483 100644 --- a/chrome/android/java_sources.gni +++ b/chrome/android/java_sources.gni @@ -25,6 +25,7 @@ import("//components/omnibox/browser/test_java_sources.gni") diff --git a/patches/chrome-app-BUILD.gn.patch b/patches/chrome-app-BUILD.gn.patch index dc8931825071..f5440889a2b0 100644 --- a/patches/chrome-app-BUILD.gn.patch +++ b/patches/chrome-app-BUILD.gn.patch @@ -1,5 +1,5 @@ diff --git a/chrome/app/BUILD.gn b/chrome/app/BUILD.gn -index 84b98d0874b7b6f71fcfe96dfcc65759b31b8cb9..cab53ee9f8d8327f09e67a88a76c16f5616a2bb8 100644 +index 762296d08d6d898c2d6d44b73afe616459984f84..8348a8f34bef6931f7c5347d323c1c4a1fcafc11 100644 --- a/chrome/app/BUILD.gn +++ b/chrome/app/BUILD.gn @@ -89,6 +89,8 @@ grit("generated_resources") { diff --git a/patches/chrome-browser-BUILD.gn.patch b/patches/chrome-browser-BUILD.gn.patch index 962eea3fbe01..e1bc784803ac 100644 --- a/patches/chrome-browser-BUILD.gn.patch +++ b/patches/chrome-browser-BUILD.gn.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index 913813f344ca1c6301710ed983c80a358fa68443..f8fdd7beeb2cbc809ebf7e6477a0d6b881b47411 100644 +index 320526795a733a55661dc8ab947840485097c8b2..a3c4bc5e378621d4f8dcfe74755a02fb704c7c34 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -2486,6 +2486,7 @@ static_library("browser") { +@@ -2512,6 +2512,7 @@ static_library("browser") { "performance_monitor/metric_evaluator_helper_posix.h", ] } diff --git a/patches/chrome-browser-about_flags.cc.patch b/patches/chrome-browser-about_flags.cc.patch index 7d864cf6902a..10f858b0f6a8 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 e50714dc9f4f87fa315bd1757ba8f96ca8017bbd..f6c57fead42b8afe1bb49441378028c5ce1e496f 100644 +index f61143aeadd60212228f89cb84e9fbba75abf131..27723a8dd07340da3432e1cbd454f5120f3a6a63 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc -@@ -313,14 +313,14 @@ const FeatureEntry::Choice kTouchTextSelectionStrategyChoices[] = { +@@ -320,14 +320,14 @@ const FeatureEntry::Choice kTouchTextSelectionStrategyChoices[] = { const FeatureEntry::Choice kTraceUploadURL[] = { {flags_ui::kGenericExperimentChoiceDisabled, "", ""}, {flag_descriptions::kTraceUploadUrlChoiceOther, switches::kTraceUploadURL, @@ -21,7 +21,7 @@ index e50714dc9f4f87fa315bd1757ba8f96ca8017bbd..f6c57fead42b8afe1bb49441378028c5 const FeatureEntry::Choice kLiteVideoDefaultDownlinkBandwidthKbps[] = { {flags_ui::kGenericExperimentChoiceDefault, "", ""}, -@@ -7539,6 +7539,7 @@ const FeatureEntry kFeatureEntries[] = { +@@ -7745,6 +7745,7 @@ const FeatureEntry kFeatureEntries[] = { // "LoginCustomFlags" in tools/metrics/histograms/enums.xml. See "Flag // Histograms" in tools/metrics/histograms/README.md (run the // AboutFlagsHistogramTest unit test to verify this process). diff --git a/patches/chrome-browser-browser_process_impl.h.patch b/patches/chrome-browser-browser_process_impl.h.patch index 5e7954252a0a..345966b2f07f 100644 --- a/patches/chrome-browser-browser_process_impl.h.patch +++ b/patches/chrome-browser-browser_process_impl.h.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/browser_process_impl.h b/chrome/browser/browser_process_impl.h -index 2bb0b1ec912b007dec568400cfc16c534b2fe3fc..f5e635d621b5f251e347d719e7d26f75ab378bb3 100644 +index 80311eff04c56e9a165a13e1616f76587588b0ec..a849b786dd45ff5ee2dfea873fdc3899480b1140 100644 --- a/chrome/browser/browser_process_impl.h +++ b/chrome/browser/browser_process_impl.h -@@ -214,6 +214,7 @@ class BrowserProcessImpl : public BrowserProcess, +@@ -222,6 +222,7 @@ class BrowserProcessImpl : public BrowserProcess, static void RegisterPrefs(PrefRegistrySimple* registry); private: 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 96642ea66b96..8718ca57d440 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,5 +1,5 @@ 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 513a64cc3f34e4b9a88fe6fb1776fc2d60d1819e..e2e30875bd1b7e7aea88172b6fded4700c42865a 100644 +index 43d7fd5a7ecf0f746dc9f07ed074dd5e51084eb9..4b06e8a0349070f1748cefe073fde8137deae4c8 100644 --- a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h +++ b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h @@ -82,6 +82,7 @@ class ChromeBrowsingDataRemoverDelegate diff --git a/patches/chrome-browser-chrome_content_browser_client.h.patch b/patches/chrome-browser-chrome_content_browser_client.h.patch index 710d9e1b324c..4c3d94ceee7c 100644 --- a/patches/chrome-browser-chrome_content_browser_client.h.patch +++ b/patches/chrome-browser-chrome_content_browser_client.h.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h -index 06a82640d7e95e9d78887aba3747b4c95ee94691..4734952c67fed5b6dad63eaa8100d16db49aabc7 100644 +index b31f25ad0fbecaa7fd99ac36238aee75b509bdbb..0192e1a64b14cbca4a1509741dca70b39d2a8038 100644 --- a/chrome/browser/chrome_content_browser_client.h +++ b/chrome/browser/chrome_content_browser_client.h -@@ -756,6 +756,7 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient { +@@ -758,6 +758,7 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient { } private: diff --git a/patches/chrome-browser-devtools-devtools_ui_bindings.h.patch b/patches/chrome-browser-devtools-devtools_ui_bindings.h.patch index ead902b33d7a..674e0c4341f5 100644 --- a/patches/chrome-browser-devtools-devtools_ui_bindings.h.patch +++ b/patches/chrome-browser-devtools-devtools_ui_bindings.h.patch @@ -1,14 +1,13 @@ diff --git a/chrome/browser/devtools/devtools_ui_bindings.h b/chrome/browser/devtools/devtools_ui_bindings.h -index 32aa300af86ac1fcb4e923d17d4e9190741b323a..850afcc334317951130fc4c95a1f6950d8d8b849 100644 +index 579243c6907cb26947b4102c04b6eda92b62935e..8ee17a08f7cd4e878ac1ddec97efc67187887e2f 100644 --- a/chrome/browser/devtools/devtools_ui_bindings.h +++ b/chrome/browser/devtools/devtools_ui_bindings.h -@@ -95,6 +95,9 @@ class DevToolsUIBindings : public DevToolsEmbedderMessageDispatcher::Delegate, - bool IsAttachedTo(content::DevToolsAgentHost* agent_host); +@@ -98,6 +98,8 @@ class DevToolsUIBindings : public DevToolsEmbedderMessageDispatcher::Delegate, private: + using DevToolsUIBindingsList = std::vector; + friend class BraveDevToolsUIBindings; + FRIEND_TEST_ALL_PREFIXES(BraveDevToolsUIBindingsBrowserTest, ThemeTest); -+ + void HandleMessageFromDevToolsFrontend(base::Value); - // content::DevToolsAgentHostClient implementation. diff --git a/patches/chrome-browser-extensions-BUILD.gn.patch b/patches/chrome-browser-extensions-BUILD.gn.patch index c1f936074060..c4018dbe9a0c 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 3c3358ae9fad3a705be7daa2c1ac495a5f7987c3..0629e70156a054c41d4b0e838c97619075eb3ad4 100644 +index f5638422b5d7659588c1100503abecbf09fd78bc..825436f181367e1f4f13907667a2979e31f58ab2 100644 --- a/chrome/browser/extensions/BUILD.gn +++ b/chrome/browser/extensions/BUILD.gn -@@ -1313,6 +1313,7 @@ static_library("extensions") { +@@ -1312,6 +1312,7 @@ static_library("extensions") { } else { sources += [ "api/braille_display_private/braille_controller_stub.cc" ] } diff --git a/patches/chrome-browser-extensions-api-webrtc_logging_private-webrtc_logging_private_api.cc.patch b/patches/chrome-browser-extensions-api-webrtc_logging_private-webrtc_logging_private_api.cc.patch index 67918f1c598d..b24fdc614481 100644 --- a/patches/chrome-browser-extensions-api-webrtc_logging_private-webrtc_logging_private_api.cc.patch +++ b/patches/chrome-browser-extensions-api-webrtc_logging_private-webrtc_logging_private_api.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc b/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc -index 9a5fc00d8b8967128e4520348f14437263ea70dd..0f04c145e05d3cc28e8a7a76e3f628eb67f13e4d 100644 +index 1e433d614887409989ebc7a66cfb7dfc2add2ac3..bfa013b5ef14cf8d660505785d1cdc62e3d65daf 100644 --- a/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc +++ b/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc @@ -90,6 +90,7 @@ content::RenderProcessHost* WebrtcLoggingPrivateFunction::RphFromRequest( diff --git a/patches/chrome-browser-extensions-component_loader.h.patch b/patches/chrome-browser-extensions-component_loader.h.patch index 2b871ca9a6b9..5a1d0611f813 100644 --- a/patches/chrome-browser-extensions-component_loader.h.patch +++ b/patches/chrome-browser-extensions-component_loader.h.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/extensions/component_loader.h b/chrome/browser/extensions/component_loader.h -index a00e53760e5a1c255449e2bb84e536a3be018580..3021c796820f30fd825df890513162aa2ba17891 100644 +index 29f6c00483a4a97950edf6d8e9e6feece0bbd304..5116755f1ed263f5729c9b28fa63fc841cc37897 100644 --- a/chrome/browser/extensions/component_loader.h +++ b/chrome/browser/extensions/component_loader.h @@ -81,7 +81,7 @@ class ComponentLoader { diff --git a/patches/chrome-browser-extensions-extension_service.h.patch b/patches/chrome-browser-extensions-extension_service.h.patch index c868679881d2..5f5998b501ce 100644 --- a/patches/chrome-browser-extensions-extension_service.h.patch +++ b/patches/chrome-browser-extensions-extension_service.h.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/extensions/extension_service.h b/chrome/browser/extensions/extension_service.h -index aa2beca595cab77452532edfa930a1d9012900fa..48cb7a070c11614472ba297aea7e410f1d8b5c0a 100644 +index 9907cc7c78737b1696c645ff88081e615a3a5773..075aaa19dfbc6dbed2ab995f984963f670523458 100644 --- a/chrome/browser/extensions/extension_service.h +++ b/chrome/browser/extensions/extension_service.h -@@ -457,6 +457,7 @@ class ExtensionService : public ExtensionServiceInterface, +@@ -462,6 +462,7 @@ class ExtensionService : public ExtensionServiceInterface, static base::AutoReset DisableExternalUpdatesForTesting(); private: diff --git a/patches/chrome-browser-flags-android-chrome_feature_list.cc.patch b/patches/chrome-browser-flags-android-chrome_feature_list.cc.patch index 54c7b90f31a0..8c79ea03e948 100644 --- a/patches/chrome-browser-flags-android-chrome_feature_list.cc.patch +++ b/patches/chrome-browser-flags-android-chrome_feature_list.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/flags/android/chrome_feature_list.cc b/chrome/browser/flags/android/chrome_feature_list.cc -index 19cf18901df225e273de05ed4f54e9ac66395966..2989831cca393150732beffebc4935cb2c77f1c4 100644 +index 0a59da240517626738b80c1141fd4e5aeed8574e..46112524d9e7d7d16b8f0fa89e869056fbc9d257 100644 --- a/chrome/browser/flags/android/chrome_feature_list.cc +++ b/chrome/browser/flags/android/chrome_feature_list.cc -@@ -349,6 +349,7 @@ const base::Feature* const kFeaturesExposedToJava[] = { +@@ -352,6 +352,7 @@ const base::Feature* const kFeaturesExposedToJava[] = { }; const base::Feature* FindFeatureExposedToJava(const std::string& feature_name) { diff --git a/patches/chrome-browser-global_keyboard_shortcuts_mac.mm.patch b/patches/chrome-browser-global_keyboard_shortcuts_mac.mm.patch index 57dae7d4595a..9758ad9638e5 100644 --- a/patches/chrome-browser-global_keyboard_shortcuts_mac.mm.patch +++ b/patches/chrome-browser-global_keyboard_shortcuts_mac.mm.patch @@ -1,12 +1,12 @@ diff --git a/chrome/browser/global_keyboard_shortcuts_mac.mm b/chrome/browser/global_keyboard_shortcuts_mac.mm -index 13870261ecfe20c0f346be6b17faf88a254b5130..bc0e38992378ece71ff55c4c672fbf56449c53b5 100644 +index 35c02336382ec5424b9919eeb039b7089a7515ab..8bfca7e6e0b6d1febad40d2e1694858e0edc045c 100644 --- a/chrome/browser/global_keyboard_shortcuts_mac.mm +++ b/chrome/browser/global_keyboard_shortcuts_mac.mm -@@ -171,6 +171,7 @@ const std::vector& GetShortcutsNotPresentInMainMenu() { - - {true, false, false, true, kVK_DownArrow, IDC_FOCUS_NEXT_PANE}, +@@ -171,6 +171,7 @@ std::vector CreateKeyboardShortcutVector() { {true, false, false, true, kVK_UpArrow, IDC_FOCUS_PREVIOUS_PANE}, + {true, true, false, false, kVK_ANSI_A, IDC_TAB_SEARCH}, + {true, true, false, true, kVK_ANSI_A, IDC_FOCUS_INACTIVE_POPUP_FOR_ACCESSIBILITY}, + {true, false, false, true, kVK_ANSI_N, IDC_NEW_OFFTHERECORD_WINDOW_TOR}, }); + // clang-format on - keys->push_back({true, true, false, false, kVK_ANSI_A, IDC_TAB_SEARCH}); 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 1177d662954c..76f102bf324d 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 f483a6b0cbc8005203109b35ff0a45a4de275c60..4105cd79a0eee9c82b6d6c79e68a453a2c0d1dac 100644 +index e6caf4f3fb98596eb8665b7d2eeea7bed767367a..6aefd75b1c809f6f3711e9688534fbc0bc9bdf3a 100644 --- a/chrome/browser/net/system_network_context_manager.cc +++ b/chrome/browser/net/system_network_context_manager.cc -@@ -236,7 +236,7 @@ class SystemNetworkContextManager::URLLoaderFactoryForSystem +@@ -235,7 +235,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 cf352454cab0..ca465658192c 100644 --- a/patches/chrome-browser-notifications-notification_display_service_impl.cc.patch +++ b/patches/chrome-browser-notifications-notification_display_service_impl.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/notifications/notification_display_service_impl.cc b/chrome/browser/notifications/notification_display_service_impl.cc -index d5a4235f89141fe57e6b721ff9dd19ee95221334..bce13d6dc6c9874f6e352d6e5bf5841c93891d3b 100644 +index 77e4176b6466f4ec81f945ea0fbce815ceb27ab1..1ab00991b5f3fc0957623b377dd1cef6d2ce58b4 100644 --- a/chrome/browser/notifications/notification_display_service_impl.cc +++ b/chrome/browser/notifications/notification_display_service_impl.cc @@ -115,6 +115,7 @@ NotificationDisplayServiceImpl::NotificationDisplayServiceImpl(Profile* profile) diff --git a/patches/chrome-browser-prefs-browser_prefs.cc.patch b/patches/chrome-browser-prefs-browser_prefs.cc.patch index 45e1d9f4cfda..ca32bf420a99 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 8cdb9027574ef553a3b9c37859423ddc60310525..3e5a85300e0675ced82f75ec2d122254342f6159 100644 +index ce875b5837a369c254eae0f2b04e129b4241b92b..2f577caea593dfff31fd8bee3657c2ff4d027643 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc -@@ -1056,6 +1056,7 @@ void RegisterLocalState(PrefRegistrySimple* registry) { +@@ -1085,6 +1085,7 @@ void RegisterLocalState(PrefRegistrySimple* registry) { #if defined(TOOLKIT_VIEWS) RegisterBrowserViewLocalPrefs(registry); #endif @@ -10,7 +10,7 @@ index 8cdb9027574ef553a3b9c37859423ddc60310525..3e5a85300e0675ced82f75ec2d122254 // This is intentionally last. RegisterLocalStatePrefsForMigration(registry); -@@ -1359,6 +1360,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry, +@@ -1387,6 +1388,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry, #endif RegisterProfilePrefsForMigration(registry); diff --git a/patches/chrome-browser-profiles-profile.cc.patch b/patches/chrome-browser-profiles-profile.cc.patch index f16643c7c1d2..c222a4d902d2 100644 --- a/patches/chrome-browser-profiles-profile.cc.patch +++ b/patches/chrome-browser-profiles-profile.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc -index 403c59f81857a9d7fe640d55dcef0558194ca046..f9597e7f52dae3f0b5d7333423314b7d4bad7f07 100644 +index e184a2418982e6d24e90c035752ee6ce880b8b54..305c47333954f2e115b47b34f350b4102445ea1e 100644 --- a/chrome/browser/profiles/profile.cc +++ b/chrome/browser/profiles/profile.cc @@ -100,6 +100,7 @@ bool Profile::OTRProfileID::AllowsBrowserWindows() const { diff --git a/patches/chrome-browser-profiles-profile_impl.cc.patch b/patches/chrome-browser-profiles-profile_impl.cc.patch index 4ab82ffa8689..0a8a26a4ea6e 100644 --- a/patches/chrome-browser-profiles-profile_impl.cc.patch +++ b/patches/chrome-browser-profiles-profile_impl.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc -index 3a757e266d7f3bcde5a381b37ecc8f7b0161bf28..6d77545cd626d1b33290bbd85e4d1cfd46327a62 100644 +index 4d9987407277ff0141fcac440a753d98d7557abc..2fa8d41795e743db873c2c558508ac69cf2609b7 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc -@@ -380,7 +380,7 @@ std::unique_ptr Profile::CreateProfile(const base::FilePath& path, +@@ -389,7 +389,7 @@ std::unique_ptr Profile::CreateProfile(const base::FilePath& path, NOTREACHED(); } diff --git a/patches/chrome-browser-profiles-profile_impl.h.patch b/patches/chrome-browser-profiles-profile_impl.h.patch index fd6cc8d29bcb..3b5ac63deb8c 100644 --- a/patches/chrome-browser-profiles-profile_impl.h.patch +++ b/patches/chrome-browser-profiles-profile_impl.h.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/profiles/profile_impl.h b/chrome/browser/profiles/profile_impl.h -index 7f0357c05704c1ebb90d64a4b74fa5839efd5cac..07b9ec1db7e1c821e33f58753ad73cde41d6312f 100644 +index 57d976ef739c0aa3cf31fa40e8f18ce3e9d168b4..fc2c34501b49d67bf2276d43fb1ea5d288706ee6 100644 --- a/chrome/browser/profiles/profile_impl.h +++ b/chrome/browser/profiles/profile_impl.h -@@ -167,6 +167,7 @@ class ProfileImpl : public Profile { +@@ -171,6 +171,7 @@ class ProfileImpl : public Profile { void OnLogin() override; void InitChromeOSPreferences() override; #endif // BUILDFLAG(IS_CHROMEOS_ASH) diff --git a/patches/chrome-browser-profiles-profile_manager.h.patch b/patches/chrome-browser-profiles-profile_manager.h.patch index 58a2d3c0ca29..bd9ad7a09c1d 100644 --- a/patches/chrome-browser-profiles-profile_manager.h.patch +++ b/patches/chrome-browser-profiles-profile_manager.h.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/profiles/profile_manager.h b/chrome/browser/profiles/profile_manager.h -index 915a95e287c587a177c3c7244b9243d75518fa29..b37331c5c54bb480705c714a7bf0f8b3cc457f52 100644 +index 126faf0da6c278c9598dc69b6d80572cc914e8a9..4268830e5627d03dfda6f3b61ab5c29e997e6f93 100644 --- a/chrome/browser/profiles/profile_manager.h +++ b/chrome/browser/profiles/profile_manager.h -@@ -282,6 +282,7 @@ class ProfileManager : public Profile::Delegate { +@@ -289,6 +289,7 @@ class ProfileManager : public Profile::Delegate { void set_do_final_services_init(bool do_final_services_init) { do_final_services_init_ = do_final_services_init; } diff --git a/patches/chrome-browser-profiles-profile_shortcut_manager_win.cc.patch b/patches/chrome-browser-profiles-profile_shortcut_manager_win.cc.patch index 8c5ffa0b8588..39a33dcc9853 100644 --- a/patches/chrome-browser-profiles-profile_shortcut_manager_win.cc.patch +++ b/patches/chrome-browser-profiles-profile_shortcut_manager_win.cc.patch @@ -1,8 +1,8 @@ diff --git a/chrome/browser/profiles/profile_shortcut_manager_win.cc b/chrome/browser/profiles/profile_shortcut_manager_win.cc -index 3d9fdea931f2c5f7e9a520e38e1ffa8a0e525edb..00896f4ec7b9f2c7926d113549a164a8032928fa 100644 +index 3ec8880a31f5ed1cff96617433ed8ba6d92842db..c20c9b267d8510c70df9003590e6966d8f7a191e 100644 --- a/chrome/browser/profiles/profile_shortcut_manager_win.cc +++ b/chrome/browser/profiles/profile_shortcut_manager_win.cc -@@ -742,7 +742,7 @@ bool ProfileShortcutManager::IsFeatureEnabled() { +@@ -743,7 +743,7 @@ bool ProfileShortcutManager::IsFeatureEnabled() { // static std::unique_ptr ProfileShortcutManager::Create( ProfileManager* manager) { diff --git a/patches/chrome-browser-profiles-renderer_updater.cc.patch b/patches/chrome-browser-profiles-renderer_updater.cc.patch index cf79481ecee5..c98f59037230 100644 --- a/patches/chrome-browser-profiles-renderer_updater.cc.patch +++ b/patches/chrome-browser-profiles-renderer_updater.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/profiles/renderer_updater.cc b/chrome/browser/profiles/renderer_updater.cc -index 0757d75a24b28bf3cbc20234ae23742a78318993..3dad32e466ec8ae92b257b172797c10039e62384 100644 +index 96b9b82ffe61d60b31b309a7d8e42ab07903a15b..309e9908b7e0543f344ad8240a111745eb43eedb 100644 --- a/chrome/browser/profiles/renderer_updater.cc +++ b/chrome/browser/profiles/renderer_updater.cc @@ -54,6 +54,7 @@ void GetGuestViewDefaultContentSettingRules( 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 76b17c4ae4f5..31b61fef5c7f 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 5d5704536562b329098da2ce3a2b115f6703e49b..452b0c77f72efb920e0cbdbbe65cc63f1191c3be 100644 +index af6d0b7d98ef4eb86d224488fbce9f691d856407..f01d75254f33b0b18685f1fd8697a79d5165a21b 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc -@@ -1834,6 +1834,7 @@ void RenderViewContextMenu::AppendSearchProvider() { +@@ -1830,6 +1830,7 @@ void RenderViewContextMenu::AppendSearchProvider() { selection_navigation_url_ = match.destination_url; 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 af451f3e02fe..9739725da2fd 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,8 +1,8 @@ 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 fbcde566b8c9015ab98ecf4704ec0f126f7d15dd..761e8c3fedc32c0d636f6b30ea9c290c7c7060de 100644 +index 66ae6176ca84d2c158f3ec33378c0be7c4250272..1cc9b4d9004feb2c0c2817655dd9af153240bbfb 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu.h +++ b/chrome/browser/renderer_context_menu/render_view_context_menu.h -@@ -131,6 +131,7 @@ class RenderViewContextMenu : public RenderViewContextMenuBase, +@@ -135,6 +135,7 @@ class RenderViewContextMenu : public RenderViewContextMenuBase, // Returns true if keyboard lock is active and requires the user to press and // hold escape to exit exclusive access mode. bool IsPressAndHoldEscRequiredToExitFullscreen() const; diff --git a/patches/chrome-browser-resources-settings-BUILD.gn.patch b/patches/chrome-browser-resources-settings-BUILD.gn.patch index 0eaa589808e7..79db7dfc902c 100644 --- a/patches/chrome-browser-resources-settings-BUILD.gn.patch +++ b/patches/chrome-browser-resources-settings-BUILD.gn.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/resources/settings/BUILD.gn b/chrome/browser/resources/settings/BUILD.gn -index bad0412e514359f2d16e3ada97e6764fd47cfe79..20ed910811a994093b68b1675725fb2697ee9506 100644 +index b8f5c661c64e085cf155ce65e1f4ca3932ad99fa..37f8c3a672f0c67e8cb1ef691a010f846598b836 100644 --- a/chrome/browser/resources/settings/BUILD.gn +++ b/chrome/browser/resources/settings/BUILD.gn @@ -53,6 +53,7 @@ if (optimize_webui) { diff --git a/patches/chrome-browser-resources-settings-about_page-about_page.js.patch b/patches/chrome-browser-resources-settings-about_page-about_page.ts.patch similarity index 50% rename from patches/chrome-browser-resources-settings-about_page-about_page.js.patch rename to patches/chrome-browser-resources-settings-about_page-about_page.ts.patch index 34bb16f47a6a..b1028136fcdc 100644 --- a/patches/chrome-browser-resources-settings-about_page-about_page.js.patch +++ b/patches/chrome-browser-resources-settings-about_page-about_page.ts.patch @@ -1,11 +1,11 @@ -diff --git a/chrome/browser/resources/settings/about_page/about_page.js b/chrome/browser/resources/settings/about_page/about_page.js -index ad7ce9c1fbccecc591ffe920fefab524ed7e46d6..871d0db73b7be457670ad2eae5ddabc375ac7977 100644 ---- a/chrome/browser/resources/settings/about_page/about_page.js -+++ b/chrome/browser/resources/settings/about_page/about_page.js -@@ -215,7 +215,14 @@ export class SettingsAboutPageElement extends SettingsAboutPageElementBase { +diff --git a/chrome/browser/resources/settings/about_page/about_page.ts b/chrome/browser/resources/settings/about_page/about_page.ts +index 3b0c277609dcadc57200108df51582bf7ac55886..914290fbe33f9141cbe4d9756f4ef5f84796f610 100644 +--- a/chrome/browser/resources/settings/about_page/about_page.ts ++++ b/chrome/browser/resources/settings/about_page/about_page.ts +@@ -205,7 +205,14 @@ export class SettingsAboutPageElement extends SettingsAboutPageElementBase { + } - /** @private */ - onRelaunchTap_() { + private onRelaunchTap_() { + // + // Sparkle framework's relaunch api is used. + LifetimeBrowserProxyImpl.getInstance().relaunchOnMac(); diff --git a/patches/chrome-browser-resources-settings-privacy_page-privacy_page.html.patch b/patches/chrome-browser-resources-settings-privacy_page-privacy_page.html.patch index c65cd6880cd0..0ba5386d0415 100644 --- a/patches/chrome-browser-resources-settings-privacy_page-privacy_page.html.patch +++ b/patches/chrome-browser-resources-settings-privacy_page-privacy_page.html.patch @@ -1,5 +1,5 @@ diff --git a/chrome/browser/resources/settings/privacy_page/privacy_page.html b/chrome/browser/resources/settings/privacy_page/privacy_page.html -index 56a342be7add7a2227d9f66c0eb2d2e9d19337d6..80ac5a517f8a1b1d0fc3fe1f1d3cdccd8281dea4 100644 +index 19e8ebebce843516e2e193a7e600a38ee447512d..4e6de49767f434da0f4c123784ddec28647b4b07 100644 --- a/chrome/browser/resources/settings/privacy_page/privacy_page.html +++ b/chrome/browser/resources/settings/privacy_page/privacy_page.html @@ -35,6 +35,7 @@ @@ -10,33 +10,19 @@ index 56a342be7add7a2227d9f66c0eb2d2e9d19337d6..80ac5a517f8a1b1d0fc3fe1f1d3cdccd + + -