diff --git a/.gitignore b/.gitignore index 2648954d79ba..16652ab22505 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ patches/**/*.patchinfo /third_party/argon2/src /third_party/ethash/src /third_party/bitcoin-core/src +/third_party/rapidjson/src /third_party/rust/cxx *.xcodeproj *.swp diff --git a/.storybook/BUILD.gn b/.storybook/BUILD.gn index 09924b57b12d..974acb0ddee8 100644 --- a/.storybook/BUILD.gn +++ b/.storybook/BUILD.gn @@ -20,7 +20,6 @@ group("storybook") { "//mojo/public/js:bindings", "//mojo/public/js:resources", "//ui/webui/resources/js:cr.m", - "//ui/webui/resources/js:modulize", "//ui/webui/resources/js:preprocess", ] } diff --git a/DEPS b/DEPS index b69433c769ad..5f0b5bd30543 100644 --- a/DEPS +++ b/DEPS @@ -14,7 +14,6 @@ deps = { "url": "https://github.com/brave/Sparkle.git@f69ba7b7fae7dda475ba6cda12fba8d72270478d", "condition": "checkout_mac", }, - "vendor/bat-native-rapidjson": "https://github.com/brave-intl/bat-native-rapidjson.git@60b7e4574cebdd79f441bdd6f0f3ab469fd7e04c", "vendor/bip39wally-core-native": "https://github.com/brave-intl/bat-native-bip39wally-core.git@0d3a8713a2b388d2156fe49a70ef3f7cdb44b190", "vendor/bat-native-tweetnacl": "https://github.com/brave-intl/bat-native-tweetnacl.git@800f9d40b7409239ff192e0be634764e747c7a75", "vendor/challenge_bypass_ristretto_ffi": "https://github.com/brave-intl/challenge-bypass-ristretto-ffi.git@419995e4a873c294f1eaefca276f8ad25328e89f", @@ -23,6 +22,7 @@ deps = { "third_party/ethash/src": "https://github.com/chfast/ethash.git@e4a15c3d76dc09392c7efd3e30d84ee3b871e9ce", "third_party/bitcoin-core/src": "https://github.com/bitcoin/bitcoin.git@95ea54ba089610019a74c1176a2c7c0dba144b1c", "third_party/argon2/src": "https://github.com/P-H-C/phc-winner-argon2.git@62358ba2123abd17fccf2a108a301d4b52c01a7c", + "third_party/rapidjson/src": "https://github.com/Tencent/rapidjson.git@06d58b9e848c650114556a23294d0b6440078c61", } recursedeps = [ diff --git a/android/android_browser_tests.gni b/android/android_browser_tests.gni index ce4d4fb2b887..e80670676807 100644 --- a/android/android_browser_tests.gni +++ b/android/android_browser_tests.gni @@ -155,6 +155,7 @@ android_only_test_sources = [ android_only_test_deps = [ ":test_support", + "//android_webview/common", "//brave/browser/partnerbookmarks:delegate_public_impl_java", "//brave/browser/partnercustomizations:delegate_public_impl_java", "//chrome:chrome_android_core", diff --git a/android/feed/core/java/src/org/chromium/chrome/browser/feed/BraveFeedSurfaceCoordinator.java b/android/feed/core/java/src/org/chromium/chrome/browser/feed/BraveFeedSurfaceCoordinator.java index d75d64674aa7..75ed8dad1d60 100644 --- a/android/feed/core/java/src/org/chromium/chrome/browser/feed/BraveFeedSurfaceCoordinator.java +++ b/android/feed/core/java/src/org/chromium/chrome/browser/feed/BraveFeedSurfaceCoordinator.java @@ -17,7 +17,6 @@ import org.chromium.base.ApiCompatibilityUtils; import org.chromium.base.supplier.Supplier; import org.chromium.chrome.R; -import org.chromium.chrome.browser.bookmarks.BookmarkBridge; import org.chromium.chrome.browser.feed.hooks.FeedHooks; import org.chromium.chrome.browser.feed.sections.SectionHeaderView; import org.chromium.chrome.browser.feedback.HelpAndFeedbackLauncher; diff --git a/android/java/apk_for_test.flags b/android/java/apk_for_test.flags index d54e06f3435f..67e1b591308c 100644 --- a/android/java/apk_for_test.flags +++ b/android/java/apk_for_test.flags @@ -128,7 +128,7 @@ *** mActionModeController; *** mLocationBarModel; *** mToolbar; - *** mBookmarkBridgeSupplier; + *** mBookmarkModelSupplier; *** mLayoutManager; *** mOverlayPanelVisibilitySupplier; *** mTabModelSelector; diff --git a/android/java/org/chromium/chrome/browser/BraveDialogFragment.java b/android/java/org/chromium/chrome/browser/BraveDialogFragment.java index c1997447a1ba..9002e2f1ca71 100644 --- a/android/java/org/chromium/chrome/browser/BraveDialogFragment.java +++ b/android/java/org/chromium/chrome/browser/BraveDialogFragment.java @@ -7,7 +7,6 @@ package org.chromium.chrome.browser; -import android.content.DialogInterface; import android.content.res.Configuration; import android.util.DisplayMetrics; import android.view.WindowManager; @@ -29,24 +28,15 @@ public void onConfigurationChanged(Configuration newConfig) { @Override public void onResume() { super.onResume(); - getDialog().setOnKeyListener(new DialogInterface.OnKeyListener() { - @Override - public boolean onKey(android.content.DialogInterface dialog, int keyCode, - android.view.KeyEvent event) { - if ((keyCode == android.view.KeyEvent.KEYCODE_BACK)) { - dismiss(); - return true; - } else - return false; - } - }); + + getDialog().setCanceledOnTouchOutside(false); + setDialogParams(); } private void setDialogParams() { DisplayMetrics displayMetrics = new DisplayMetrics(); getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); - int mDeviceHeight = displayMetrics.heightPixels; int mDeviceWidth = displayMetrics.widthPixels; WindowManager.LayoutParams params = getDialog().getWindow().getAttributes(); diff --git a/android/java/org/chromium/chrome/browser/app/BraveActivity.java b/android/java/org/chromium/chrome/browser/app/BraveActivity.java index cef7443e04c5..f7e1d85cba2b 100644 --- a/android/java/org/chromium/chrome/browser/app/BraveActivity.java +++ b/android/java/org/chromium/chrome/browser/app/BraveActivity.java @@ -1087,7 +1087,6 @@ public void setDormantUsersPrefs() { private void showVpnCalloutDialog() { BraveVpnCalloutDialogFragment braveVpnCalloutDialogFragment = new BraveVpnCalloutDialogFragment(); - braveVpnCalloutDialogFragment.setCancelable(false); braveVpnCalloutDialogFragment.show( getSupportFragmentManager(), "BraveVpnCalloutDialogFragment"); } @@ -1106,7 +1105,6 @@ private void showAdFreeCalloutDialog() { BraveAdFreeCalloutDialogFragment braveAdFreeCalloutDialogFragment = new BraveAdFreeCalloutDialogFragment(); - braveAdFreeCalloutDialogFragment.setCancelable(false); braveAdFreeCalloutDialogFragment.show( getSupportFragmentManager(), "BraveAdFreeCalloutDialogFragment"); } @@ -1541,13 +1539,12 @@ private void clearObservers() { private void showBraveRateDialog() { RateDialogFragment mRateDialogFragment = new RateDialogFragment(); - mRateDialogFragment.setCancelable(false); mRateDialogFragment.show(getSupportFragmentManager(), "RateDialogFragment"); } private void showCrossPromotionalDialog() { - CrossPromotionalModalDialogFragment mCrossPromotionalModalDialogFragment = new CrossPromotionalModalDialogFragment(); - mCrossPromotionalModalDialogFragment.setCancelable(false); + CrossPromotionalModalDialogFragment mCrossPromotionalModalDialogFragment = + new CrossPromotionalModalDialogFragment(); mCrossPromotionalModalDialogFragment.show(getSupportFragmentManager(), "CrossPromotionalModalDialogFragment"); } @@ -1556,7 +1553,6 @@ public void showDormantUsersEngagementDialog(String notificationType) { && !BraveSetDefaultBrowserUtils.isBraveDefaultDontAsk()) { DormantUsersEngagementDialogFragment dormantUsersEngagementDialogFragment = new DormantUsersEngagementDialogFragment(); - dormantUsersEngagementDialogFragment.setCancelable(false); dormantUsersEngagementDialogFragment.setNotificationType(notificationType); dormantUsersEngagementDialogFragment.show( getSupportFragmentManager(), "DormantUsersEngagementDialogFragment"); diff --git a/android/java/org/chromium/chrome/browser/app/appmenu/AppMenuIconRowFooter.java b/android/java/org/chromium/chrome/browser/app/appmenu/AppMenuIconRowFooter.java index 4f14846f032a..05ad8213bae3 100644 --- a/android/java/org/chromium/chrome/browser/app/appmenu/AppMenuIconRowFooter.java +++ b/android/java/org/chromium/chrome/browser/app/appmenu/AppMenuIconRowFooter.java @@ -17,11 +17,12 @@ import org.chromium.base.ApiCompatibilityUtils; import org.chromium.chrome.R; -import org.chromium.chrome.browser.bookmarks.BookmarkBridge; +import org.chromium.chrome.browser.bookmarks.BookmarkModel; import org.chromium.chrome.browser.download.DownloadUtils; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.ui.appmenu.AppMenuDelegate; import org.chromium.chrome.browser.ui.appmenu.AppMenuHandler; +import org.chromium.components.bookmarks.BookmarkItem; /** * A {@link LinearLayout} that displays a horizontal row of icons for page actions. @@ -71,12 +72,12 @@ protected void onFinishInflate() { /** * Initializes the icons, setting enabled state, drawables, and content descriptions. * @param appMenuHandler The {@link AppMenu} that contains the icon row. - * @param bookmarkBridge The {@link BookmarkBridge} used to retrieve information about + * @param bookmarkBridge The {@link BookmarkModel} used to retrieve information about * bookmarks. * @param currentTab The current activity {@link Tab}. * @param appMenuDelegate The AppMenuDelegate to handle options item selection. */ - public void initialize(AppMenuHandler appMenuHandler, BookmarkBridge bookmarkBridge, + public void initialize(AppMenuHandler appMenuHandler, BookmarkModel bookmarkBridge, Tab currentTab, AppMenuDelegate appMenuDelegate) { mAppMenuHandler = appMenuHandler; mAppMenuDelegate = appMenuDelegate; @@ -109,7 +110,7 @@ public void loadingStateChanged(boolean isLoading) { : getContext().getString(R.string.accessibility_btn_refresh)); } - private void updateBookmarkMenuItem(BookmarkBridge bookmarkBridge, Tab currentTab) { + private void updateBookmarkMenuItem(BookmarkModel bookmarkBridge, Tab currentTab) { mBookmarkButton.setEnabled(bookmarkBridge.isEditBookmarksEnabled()); if (bookmarkBridge.hasBookmarkIdForTab(currentTab)) { diff --git a/android/java/org/chromium/chrome/browser/app/appmenu/BraveAppMenuPropertiesDelegateImpl.java b/android/java/org/chromium/chrome/browser/app/appmenu/BraveAppMenuPropertiesDelegateImpl.java index d6368ebd89e3..7eb7c0964380 100644 --- a/android/java/org/chromium/chrome/browser/app/appmenu/BraveAppMenuPropertiesDelegateImpl.java +++ b/android/java/org/chromium/chrome/browser/app/appmenu/BraveAppMenuPropertiesDelegateImpl.java @@ -17,7 +17,7 @@ import org.chromium.base.supplier.OneshotSupplier; import org.chromium.chrome.R; import org.chromium.chrome.browser.ActivityTabProvider; -import org.chromium.chrome.browser.bookmarks.BookmarkBridge; +import org.chromium.chrome.browser.bookmarks.BookmarkModel; import org.chromium.chrome.browser.feed.webfeed.WebFeedBridge; import org.chromium.chrome.browser.incognito.reauth.IncognitoReauthController; import org.chromium.chrome.browser.layouts.LayoutStateProvider; @@ -39,7 +39,7 @@ public BraveAppMenuPropertiesDelegateImpl(Context context, TabModelSelector tabModelSelector, ToolbarManager toolbarManager, View decorView, @Nullable OneshotSupplier layoutStateProvidersSupplier, @Nullable OneshotSupplier startSurfaceSupplier, - ObservableSupplier bookmarkBridgeSupplier, + ObservableSupplier bookmarkBridgeSupplier, @Nullable OneshotSupplier incognitoReauthControllerOneshotSupplier) { super(context, activityTabProvider, multiWindowModeStateDispatcher, tabModelSelector, diff --git a/android/java/org/chromium/chrome/browser/appmenu/BraveTabbedAppMenuPropertiesDelegate.java b/android/java/org/chromium/chrome/browser/appmenu/BraveTabbedAppMenuPropertiesDelegate.java index 2cebd58a09c9..966d4fbe4bad 100644 --- a/android/java/org/chromium/chrome/browser/appmenu/BraveTabbedAppMenuPropertiesDelegate.java +++ b/android/java/org/chromium/chrome/browser/appmenu/BraveTabbedAppMenuPropertiesDelegate.java @@ -23,7 +23,7 @@ import org.chromium.chrome.browser.ActivityTabProvider; import org.chromium.chrome.browser.BraveConfig; import org.chromium.chrome.browser.app.appmenu.AppMenuIconRowFooter; -import org.chromium.chrome.browser.bookmarks.BookmarkBridge; +import org.chromium.chrome.browser.bookmarks.BookmarkModel; import org.chromium.chrome.browser.feed.webfeed.WebFeedBridge; import org.chromium.chrome.browser.feed.webfeed.WebFeedSnackbarController; import org.chromium.chrome.browser.flags.ChromeFeatureList; @@ -50,7 +50,7 @@ public class BraveTabbedAppMenuPropertiesDelegate extends TabbedAppMenuPropertiesDelegate { private Menu mMenu; private AppMenuDelegate mAppMenuDelegate; - private ObservableSupplier mBookmarkBridgeSupplier; + private ObservableSupplier mBookmarkModelSupplier; public BraveTabbedAppMenuPropertiesDelegate(Context context, ActivityTabProvider activityTabProvider, @@ -59,7 +59,7 @@ public BraveTabbedAppMenuPropertiesDelegate(Context context, AppMenuDelegate appMenuDelegate, OneshotSupplier layoutStateProvider, OneshotSupplier startSurfaceSupplier, - ObservableSupplier bookmarkBridgeSupplier, + ObservableSupplier bookmarkBridgeSupplier, WebFeedSnackbarController.FeedLauncher feedLauncher, ModalDialogManager modalDialogManager, SnackbarManager snackbarManager, @NonNull OneshotSupplier @@ -70,7 +70,7 @@ public BraveTabbedAppMenuPropertiesDelegate(Context context, snackbarManager, incognitoReauthControllerOneshotSupplier); mAppMenuDelegate = appMenuDelegate; - mBookmarkBridgeSupplier = bookmarkBridgeSupplier; + mBookmarkModelSupplier = bookmarkBridgeSupplier; } @Override @@ -188,7 +188,7 @@ public void onMenuDismissed() { @Override public void onFooterViewInflated(AppMenuHandler appMenuHandler, View view) { // If it's still null, just hide the whole view - if (mBookmarkBridgeSupplier.get() == null) { + if (mBookmarkModelSupplier.get() == null) { if (view != null) { view.setVisibility(View.GONE); } @@ -200,7 +200,7 @@ public void onFooterViewInflated(AppMenuHandler appMenuHandler, View view) { if (view instanceof AppMenuIconRowFooter) { ((AppMenuIconRowFooter) view) - .initialize(appMenuHandler, mBookmarkBridgeSupplier.get(), + .initialize(appMenuHandler, mBookmarkModelSupplier.get(), mActivityTabProvider.get(), mAppMenuDelegate); } diff --git a/android/java/org/chromium/chrome/browser/bookmarks/BraveBookmarkUtils.java b/android/java/org/chromium/chrome/browser/bookmarks/BraveBookmarkUtils.java index 9ddc17ccdcee..fee6154d6690 100644 --- a/android/java/org/chromium/chrome/browser/bookmarks/BraveBookmarkUtils.java +++ b/android/java/org/chromium/chrome/browser/bookmarks/BraveBookmarkUtils.java @@ -15,7 +15,6 @@ import org.chromium.base.Log; import org.chromium.chrome.R; import org.chromium.chrome.browser.app.appmenu.AppMenuPropertiesDelegateImpl; -import org.chromium.chrome.browser.bookmarks.BookmarkBridge.BookmarkItem; import org.chromium.chrome.browser.bookmarks.BookmarkUtils; import org.chromium.chrome.browser.flags.CachedFeatureFlags; import org.chromium.chrome.browser.flags.ChromeFeatureList; @@ -24,6 +23,7 @@ import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager; import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager.SnackbarController; import org.chromium.components.bookmarks.BookmarkId; +import org.chromium.components.bookmarks.BookmarkItem; import org.chromium.components.bookmarks.BookmarkType; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; diff --git a/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPage.java b/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPage.java index 05c907c30134..796355e99b5c 100644 --- a/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPage.java +++ b/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPage.java @@ -14,7 +14,6 @@ import org.chromium.base.supplier.ObservableSupplier; import org.chromium.base.supplier.Supplier; import org.chromium.chrome.R; -import org.chromium.chrome.browser.bookmarks.BookmarkBridge; import org.chromium.chrome.browser.browser_controls.BrowserControlsStateProvider; import org.chromium.chrome.browser.feed.BraveFeedSurfaceCoordinator; import org.chromium.chrome.browser.feed.FeedFeatures; diff --git a/android/java/org/chromium/chrome/browser/omnibox/BraveLocationBarCoordinator.java b/android/java/org/chromium/chrome/browser/omnibox/BraveLocationBarCoordinator.java index ccf13e6573d2..29a838e0dd4d 100644 --- a/android/java/org/chromium/chrome/browser/omnibox/BraveLocationBarCoordinator.java +++ b/android/java/org/chromium/chrome/browser/omnibox/BraveLocationBarCoordinator.java @@ -24,6 +24,7 @@ import org.chromium.chrome.browser.omnibox.LocationBarMediator.SaveOfflineButtonState; import org.chromium.chrome.browser.omnibox.status.StatusCoordinator.PageInfoAction; import org.chromium.chrome.browser.omnibox.suggestions.OmniboxPedalDelegate; +import org.chromium.chrome.browser.omnibox.suggestions.OmniboxSuggestionsDropdownScrollListener; import org.chromium.chrome.browser.omnibox.suggestions.basic.BasicSuggestionProcessor.BookmarkState; import org.chromium.chrome.browser.privacy.settings.PrivacyPreferencesManager; import org.chromium.chrome.browser.profiles.Profile; @@ -62,7 +63,9 @@ public BraveLocationBarCoordinator(View locationBarLayout, View autocompleteAnch @NonNull OmniboxPedalDelegate omniboxPedalDelegate, BrowserStateBrowserControlsVisibilityDelegate browserControlsVisibilityDelegate, Callback reportExceptionCallback, - @Nullable BackPressManager backPressManager) { + @Nullable BackPressManager backPressManager, + @NonNull OmniboxSuggestionsDropdownScrollListener + omniboxSuggestionsDropdownScrollListener) { super(locationBarLayout, autocompleteAnchorView, profileObservableSupplier, privacyPreferencesManager, locationBarDataProvider, actionModeCallback, windowDelegate, windowAndroid, activityTabSupplier, modalDialogManagerSupplier, @@ -72,7 +75,7 @@ public BraveLocationBarCoordinator(View locationBarLayout, View autocompleteAnch saveOfflineButtonState, omniboxUma, tabWindowManagerSupplier, bookmarkState, isToolbarMicEnabledSupplier, jankTracker, merchantTrustSignalsCoordinatorSupplier, omniboxPedalDelegate, browserControlsVisibilityDelegate, reportExceptionCallback, - backPressManager); + backPressManager, omniboxSuggestionsDropdownScrollListener); if (mLocationBarMediator instanceof BraveLocationBarMediator) { mQRButton = locationBarLayout.findViewById(R.id.qr_button); diff --git a/android/java/org/chromium/chrome/browser/rate/RateDialogFragment.java b/android/java/org/chromium/chrome/browser/rate/RateDialogFragment.java index 61e2c3fe3e19..40e0b92fb562 100644 --- a/android/java/org/chromium/chrome/browser/rate/RateDialogFragment.java +++ b/android/java/org/chromium/chrome/browser/rate/RateDialogFragment.java @@ -47,8 +47,6 @@ public class RateDialogFragment extends BraveDialogFragment implements View.OnCl private EditText mRateFeedbackEditText; private Button mPositiveButton; private Button mNegativeButton; - private Button mRateButton; - private Button mLaterButton; private LinearLayout mSmileyLayout; private LinearLayout mRateActionLayout; @@ -63,7 +61,8 @@ public void onCreate(Bundle savedInstanceState) { } @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + public View onCreateView( + LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_rate_dialog, container, false); } @@ -110,7 +109,9 @@ public void onClick(View view) { mRateFeedbackEditText.startAnimation(shake); return; } else { - RateFeedbackUtils.RateFeedbackWorkerTask mWorkerTask = new RateFeedbackUtils.RateFeedbackWorkerTask(mUserSelection, feedback, rateFeedbackCallback); + RateFeedbackUtils.RateFeedbackWorkerTask mWorkerTask = + new RateFeedbackUtils.RateFeedbackWorkerTask( + mUserSelection, feedback, rateFeedbackCallback); mWorkerTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } } else if (mIsSuccessShown) { @@ -134,7 +135,9 @@ private void openPlaystore() { try { getActivity().startActivity(new Intent(Intent.ACTION_VIEW, marketUri)); } catch (android.content.ActivityNotFoundException ex) { - Toast.makeText(getActivity(), "Couldn't find PlayStore on this device", Toast.LENGTH_SHORT).show(); + Toast.makeText(getActivity(), "Couldn't find PlayStore on this device", + Toast.LENGTH_SHORT) + .show(); } RateUtils.getInstance(getActivity()).setNextRateDateAndCount(); dismiss(); @@ -164,14 +167,16 @@ private void showRateSuccess() { mPositiveButton.setText(getResources().getString(R.string.rate)); mNegativeButton.setText(getResources().getString(R.string.later)); - mRateTitleTextView.setText(getResources().getString(R.string.would_you_mind_leaving_rating)); + mRateTitleTextView.setText( + getResources().getString(R.string.would_you_mind_leaving_rating)); } - private RateFeedbackUtils.RateFeedbackCallback rateFeedbackCallback = new RateFeedbackUtils.RateFeedbackCallback() { - @Override - public void rateFeedbackSubmitted() { - RateUtils.getInstance(getActivity()).setNextRateDateAndCount(); - dismiss(); - } - }; + private RateFeedbackUtils.RateFeedbackCallback rateFeedbackCallback = + new RateFeedbackUtils.RateFeedbackCallback() { + @Override + public void rateFeedbackSubmitted() { + RateUtils.getInstance(getActivity()).setNextRateDateAndCount(); + dismiss(); + } + }; } \ No newline at end of file diff --git a/android/java/org/chromium/chrome/browser/settings/BraveMainPreferencesBase.java b/android/java/org/chromium/chrome/browser/settings/BraveMainPreferencesBase.java index 5194f25d7b81..706e24335054 100644 --- a/android/java/org/chromium/chrome/browser/settings/BraveMainPreferencesBase.java +++ b/android/java/org/chromium/chrome/browser/settings/BraveMainPreferencesBase.java @@ -364,7 +364,6 @@ public boolean onPreferenceClick(Preference preference) { bundle.putBoolean(RateUtils.FROM_SETTINGS, true); RateDialogFragment mRateDialogFragment = new RateDialogFragment(); - mRateDialogFragment.setCancelable(false); mRateDialogFragment.setArguments(bundle); mRateDialogFragment.show(getParentFragmentManager(), "RateDialogFragment"); return true; diff --git a/android/java/org/chromium/chrome/browser/toolbar/BraveToolbarManager.java b/android/java/org/chromium/chrome/browser/toolbar/BraveToolbarManager.java index 64c8f5ea0a79..a2605a936c22 100644 --- a/android/java/org/chromium/chrome/browser/toolbar/BraveToolbarManager.java +++ b/android/java/org/chromium/chrome/browser/toolbar/BraveToolbarManager.java @@ -29,7 +29,7 @@ import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.app.tab_activity_glue.TabReparentingController; import org.chromium.chrome.browser.back_press.BackPressManager; -import org.chromium.chrome.browser.bookmarks.BookmarkBridge; +import org.chromium.chrome.browser.bookmarks.BookmarkModel; import org.chromium.chrome.browser.browser_controls.BrowserControlsSizer; import org.chromium.chrome.browser.compositor.CompositorViewHolder; import org.chromium.chrome.browser.compositor.Invalidator; @@ -102,7 +102,7 @@ public class BraveToolbarManager extends ToolbarManager { private ActionModeController mActionModeController; private LocationBarModel mLocationBarModel; private TopToolbarCoordinator mToolbar; - private ObservableSupplier mBookmarkBridgeSupplier; + private ObservableSupplier mBookmarkModelSupplier; private LayoutManagerImpl mLayoutManager; private ObservableSupplierImpl mOverlayPanelVisibilitySupplier; private TabModelSelector mTabModelSelector; @@ -141,7 +141,7 @@ public BraveToolbarManager(AppCompatActivity activity, BrowserControlsSizer cont List buttonDataProviders, ActivityTabProvider tabProvider, ScrimCoordinator scrimCoordinator, ToolbarActionModeCallback toolbarActionModeCallback, FindToolbarManager findToolbarManager, ObservableSupplier profileSupplier, - ObservableSupplier bookmarkBridgeSupplier, + ObservableSupplier bookmarkBridgeSupplier, @Nullable Supplier canAnimateNativeBrowserControls, OneshotSupplier layoutStateProviderSupplier, OneshotSupplier appMenuCoordinatorSupplier, @@ -328,7 +328,7 @@ protected void onOrientationChange(int newOrientation) { protected void updateBookmarkButtonStatus() { Tab currentTab = mLocationBarModel.getTab(); - BookmarkBridge bridge = mBookmarkBridgeSupplier.get(); + BookmarkModel bridge = mBookmarkModelSupplier.get(); boolean isBookmarked = currentTab != null && bridge != null && bridge.hasBookmarkIdForTab(currentTab); boolean editingAllowed = diff --git a/android/java/org/chromium/chrome/browser/toolbar/top/BraveToolbarLayoutImpl.java b/android/java/org/chromium/chrome/browser/toolbar/top/BraveToolbarLayoutImpl.java index 8059d04157ca..85c0b4126957 100644 --- a/android/java/org/chromium/chrome/browser/toolbar/top/BraveToolbarLayoutImpl.java +++ b/android/java/org/chromium/chrome/browser/toolbar/top/BraveToolbarLayoutImpl.java @@ -207,7 +207,7 @@ public BraveToolbarLayoutImpl(Context context, AttributeSet attrs) { } @Override - void destroy() { + public void destroy() { if (mBraveShieldsContentSettings != null) { mBraveShieldsContentSettings.removeObserver(mBraveShieldsContentSettingsObserver); } diff --git a/android/java/org/chromium/chrome/browser/toolbar/top/BraveTopToolbarCoordinator.java b/android/java/org/chromium/chrome/browser/toolbar/top/BraveTopToolbarCoordinator.java index 013671e9e32f..06ba4e75d62f 100644 --- a/android/java/org/chromium/chrome/browser/toolbar/top/BraveTopToolbarCoordinator.java +++ b/android/java/org/chromium/chrome/browser/toolbar/top/BraveTopToolbarCoordinator.java @@ -6,6 +6,7 @@ package org.chromium.chrome.browser.toolbar.top; import android.content.Context; +import android.view.View; import android.view.ViewStub; import org.chromium.base.Callback; @@ -14,6 +15,7 @@ import org.chromium.base.supplier.OneshotSupplier; import org.chromium.base.supplier.Supplier; import org.chromium.chrome.R; +import org.chromium.chrome.browser.browser_controls.BrowserStateBrowserControlsVisibilityDelegate; import org.chromium.chrome.browser.identity_disc.IdentityDiscController; import org.chromium.chrome.browser.layouts.LayoutStateProvider; import org.chromium.chrome.browser.profiles.Profile; @@ -66,8 +68,11 @@ public BraveTopToolbarCoordinator(ToolbarControlContainer controlContainer, HistoryDelegate historyDelegate, BooleanSupplier partnerHomepageEnabledSupplier, OfflineDownloader offlineDownloader, boolean initializeWithIncognitoColors, Callback startSurfaceLogoClickedCallback, - boolean isStartSurfaceRefactorEnabled, - ObservableSupplier constraintsSupplier) { + boolean isStartSurfaceRefactorEnabled, ObservableSupplier constraintsSupplier, + ObservableSupplier compositorInMotionSupplier, + BrowserStateBrowserControlsVisibilityDelegate + browserStateBrowserControlsVisibilityDelegate, + boolean shouldCreateLogoInStartToolbar) { super(controlContainer, toolbarStub, fullscreenToolbarStub, toolbarLayout, toolbarDataProvider, tabController, userEducationHelper, buttonDataProviders, layoutStateProviderSupplier, normalThemeColorProvider, overviewThemeColorProvider, @@ -79,8 +84,9 @@ public BraveTopToolbarCoordinator(ToolbarControlContainer controlContainer, isTabToGtsAnimationEnabled, isStartSurfaceEnabled, isTabGroupsAndroidContinuationEnabled, historyDelegate, partnerHomepageEnabledSupplier, offlineDownloader, initializeWithIncognitoColors, - startSurfaceLogoClickedCallback, isStartSurfaceRefactorEnabled, - constraintsSupplier); + startSurfaceLogoClickedCallback, isStartSurfaceRefactorEnabled, constraintsSupplier, + compositorInMotionSupplier, browserStateBrowserControlsVisibilityDelegate, + shouldCreateLogoInStartToolbar); mBraveToolbarLayout = toolbarLayout; mBraveMenuButtonCoordinator = browsingModeMenuButtonCoordinator; @@ -123,4 +129,16 @@ public MenuButton getMenuButtonWrapper() { public ObservableSupplier getConstraintsProxy() { return mConstraintsProxy; } + + @Override + public void setTabSwitcherMode( + boolean inTabSwitcherMode, boolean showToolbar, boolean delayAnimation) { + super.setTabSwitcherMode(inTabSwitcherMode, showToolbar, delayAnimation); + + if (mBraveToolbarLayout instanceof ToolbarPhone) { + mBraveToolbarLayout.setVisibility( + ((ToolbarPhone) mBraveToolbarLayout).isInTabSwitcherMode() ? View.INVISIBLE + : View.VISIBLE); + } + } } diff --git a/android/java/org/chromium/chrome/browser/vpn/utils/BraveVpnUtils.java b/android/java/org/chromium/chrome/browser/vpn/utils/BraveVpnUtils.java index 87b771c9bf4a..958a04370a2b 100644 --- a/android/java/org/chromium/chrome/browser/vpn/utils/BraveVpnUtils.java +++ b/android/java/org/chromium/chrome/browser/vpn/utils/BraveVpnUtils.java @@ -258,7 +258,6 @@ public static void updateProfileConfiguration(Activity activity) { public static void showVpnAlwaysOnErrorDialog(Activity activity) { BraveVpnAlwaysOnErrorDialogFragment mBraveVpnAlwaysOnErrorDialogFragment = new BraveVpnAlwaysOnErrorDialogFragment(); - mBraveVpnAlwaysOnErrorDialogFragment.setCancelable(false); mBraveVpnAlwaysOnErrorDialogFragment.show( ((FragmentActivity) activity).getSupportFragmentManager(), "BraveVpnAlwaysOnErrorDialogFragment"); @@ -267,7 +266,6 @@ public static void showVpnAlwaysOnErrorDialog(Activity activity) { public static void showVpnConfirmDialog(Activity activity) { BraveVpnConfirmDialogFragment braveVpnConfirmDialogFragment = new BraveVpnConfirmDialogFragment(); - braveVpnConfirmDialogFragment.setCancelable(false); braveVpnConfirmDialogFragment.show( ((FragmentActivity) activity).getSupportFragmentManager(), "BraveVpnConfirmDialogFragment"); diff --git a/android/java/res/layout/new_tab_page_layout.xml b/android/java/res/layout/new_tab_page_layout.xml index 1181b0b1cc73..78dbc1a82984 100644 --- a/android/java/res/layout/new_tab_page_layout.xml +++ b/android/java/res/layout/new_tab_page_layout.xml @@ -140,16 +140,6 @@ android:layout_weight="0" android:visibility="invisible" /> - - - - Something went wrong. Try again later + + To cast with a code, turn on Brave browser sync settings + Type the access code to start casting diff --git a/app/brave_main_delegate_browsertest.cc b/app/brave_main_delegate_browsertest.cc index a25303421af3..fcea4cd0e72d 100644 --- a/app/brave_main_delegate_browsertest.cc +++ b/app/brave_main_delegate_browsertest.cc @@ -27,6 +27,8 @@ #include "components/permissions/features.h" #include "components/privacy_sandbox/privacy_sandbox_features.h" #include "components/reading_list/features/reading_list_switches.h" +#include "components/segmentation_platform/public/features.h" +#include "components/send_tab_to_self/features.h" #include "components/shared_highlighting/core/common/shared_highlighting_features.h" #include "content/public/common/content_features.h" #include "content/public/test/browser_test.h" @@ -38,6 +40,7 @@ #include "third_party/blink/public/common/features.h" #if BUILDFLAG(IS_ANDROID) +#include "android_webview/common/aw_features.h" #include "chrome/test/base/android/android_browser_test.h" #else #include "chrome/browser/browser_features.h" @@ -81,6 +84,9 @@ IN_PROC_BROWSER_TEST_F(BraveMainDelegateBrowserTest, OriginTrialsTest) { IN_PROC_BROWSER_TEST_F(BraveMainDelegateBrowserTest, DisabledFeatures) { // Please, keep alphabetized const base::Feature* disabled_features[] = { +#if BUILDFLAG(IS_ANDROID) + &android_webview::features::kWebViewClientHintsControllerDelegate, +#endif &autofill::features::kAutofillEnableAccountWalletStorage, &autofill::features::kAutofillEnableOfferNotificationForPromoCodes, &autofill::features::kAutofillEnableRemadeDownstreamMetrics, @@ -133,7 +139,6 @@ IN_PROC_BROWSER_TEST_F(BraveMainDelegateBrowserTest, DisabledFeatures) { &features::kSCTAuditing, &features::kSignedExchangeReportingForDistributors, &features::kSignedHTTPExchange, - &features::kSubresourceWebBundles, #if !BUILDFLAG(IS_ANDROID) &features::kTrustSafetySentimentSurvey, #endif @@ -148,6 +153,7 @@ IN_PROC_BROWSER_TEST_F(BraveMainDelegateBrowserTest, DisabledFeatures) { &media::kLiveCaption, &net::features::kNoncedPartitionedCookies, &net::features::kPartitionedCookies, + &net::features::kSamePartyAttributeEnabled, &network::features::kTrustTokens, &network_time::kNetworkTimeServiceQuerying, &optimization_guide::features::kOptimizationHints, @@ -161,6 +167,9 @@ IN_PROC_BROWSER_TEST_F(BraveMainDelegateBrowserTest, DisabledFeatures) { &permissions::features::kPermissionOnDeviceNotificationPredictions, &privacy_sandbox::kOverridePrivacySandboxSettingsLocalTesting, &privacy_sandbox::kPrivacySandboxSettings3, + &segmentation_platform::features::kSegmentationPlatformFeature, + &send_tab_to_self::kSendTabToSelfSigninPromo, + &shared_highlighting::kIOSSharedHighlightingV2, &shared_highlighting::kSharedHighlightingAmp, #if !BUILDFLAG(IS_ANDROID) &translate::kTFLiteLanguageDetectionEnabled, diff --git a/app/brave_strings.grd b/app/brave_strings.grd index bcbbb02100bf..157446404c01 100644 --- a/app/brave_strings.grd +++ b/app/brave_strings.grd @@ -406,6 +406,21 @@ If you update this file, be sure also to update google_chrome_strings.grd. --> Brave may not function correctly because it is no longer supported on Windows XP or Windows Vista + + + To get future Brave updates, you'll need Windows 10 or later. This computer is using Windows 7. + + + + + To get future Brave updates, you'll need Windows 10 or later. This computer is using Windows 8. + + + + + To get future Brave updates, you'll need Windows 10 or later. This computer is using Windows 8.1. + + Brave may not function correctly because it is no longer supported on this Linux distribution @@ -722,7 +737,7 @@ Permissions you've already given to websites and apps may apply to this account. Warning: Brave cannot prevent extensions from recording your browsing history. To disable this extension in Private mode, unselect this option. - Remove from Brave... + Remove from Brave In Brave @@ -1381,6 +1396,11 @@ Permissions you've already given to websites and apps may apply to this account. Your account is managed by $1example.com. Your administrator can see and edit this Brave browser profile and its data like bookmarks, history, and passwords. + + + You can enjoy the most out of Brave + + @@ -1556,9 +1576,40 @@ Permissions you've already given to websites and apps may apply to this account. - - As needed, Brave reclaims memory from tabs you aren't actively using. You can change this anytime in settings. - + + + Memory Saver Made Brave Faster + + + + + Memory Saver made Brave faster + + + + + + + + + Memory Saver Made Brave Faster + + + + + Memory Saver made Brave faster + + + + + Make Brave Faster + + + + + Make Brave faster + + diff --git a/app/brave_strings_override.grd b/app/brave_strings_override.grd index 9915c203a17f..6073393f16a1 100644 --- a/app/brave_strings_override.grd +++ b/app/brave_strings_override.grd @@ -119,6 +119,12 @@ If you update this file, be sure also to update google_chrome_strings.grd. --> + + + + + + @@ -318,6 +324,8 @@ Permissions you've already given to websites and apps may apply to this account. + + @@ -327,7 +335,22 @@ Permissions you've already given to websites and apps may apply to this account. - + + + + + + + + + + + + + + + + diff --git a/app/extensions_strings.grdp b/app/extensions_strings.grdp index 9e6eef3470b7..9989501e6eae 100644 --- a/app/extensions_strings.grdp +++ b/app/extensions_strings.grdp @@ -86,9 +86,12 @@ Errors - + Allow all extensions to read and change $1 + + Customize for each extension + Don't allow any extensions on $1 @@ -219,7 +222,7 @@ Export Activities - <span>ID: </span>$1cfhdojbkjhnklbpkdaibdccddilifddb + ID: $1cfhdojbkjhnklbpkdaibdccddilifddb Inspect views @@ -410,6 +413,12 @@ $1 extensions + + Always on all sites + + + Always on this site + All extensions allowed @@ -434,6 +443,9 @@ Edit site permissions + + On click for this site + Not a valid web address diff --git a/app/generated_resources.grd b/app/generated_resources.grd index 503d09d25337..db93da332dd5 100644 --- a/app/generated_resources.grd +++ b/app/generated_resources.grd @@ -546,6 +546,12 @@ are declared in tools/grit/grit_rule.gni. No thanks + + &Enable Live Caption + + + &Disable Live Caption + &Back @@ -857,7 +863,6 @@ are declared in tools/grit/grit_rule.gni. &View Frame Source - Open Link in New &Tab @@ -2536,6 +2541,9 @@ are declared in tools/grit/grit_rule.gni. This file contains malware that can compromise your personal or social network accounts + + This file contains malware that can compromise your personal or social network accounts, including $1john@google.com + @@ -4568,6 +4576,9 @@ are declared in tools/grit/grit_rule.gni. Read ChromeOS Flex device and component serial numbers. + + Read ChromeOS Flex network information. + @@ -4579,6 +4590,9 @@ are declared in tools/grit/grit_rule.gni. Read ChromeOS device and component serial numbers. + + Read ChromeOS network information. + @@ -4744,7 +4758,7 @@ are declared in tools/grit/grit_rule.gni. Allow $13? - Click to allow "$1Extension A"" on $2google.com: + Click to allow "$1Extension A" on $2google.com: Click to allow on $1google.com: @@ -4782,6 +4796,9 @@ are declared in tools/grit/grit_rule.gni. Click this extension's icon to read & change $1google.com + + Pinned by your administrator + @@ -5634,9 +5651,11 @@ Keep your key file in a safe place. You will need it to create new versions of y Sign back in to Brave Password Manager - - Sign in - + + + Sign in + + Save password for $1example.com? @@ -6791,6 +6810,11 @@ Keep your key file in a safe place. You will need it to create new versions of y + + + {NUM_BOOKMARKS, plural, =1 {1 bookmark} other {# bookmarks}} + + @@ -6861,9 +6885,6 @@ Keep your key file in a safe place. You will need it to create new versions of y Side Panel - - Google Lens - Side Panel Resize Handle @@ -6894,9 +6915,24 @@ Keep your key file in a safe place. You will need it to create new versions of y Theme + + Line height + Letter spacing + + Tight + + + Default + + + Loose + + + Very loose + @@ -6980,6 +7016,45 @@ Keep your key file in a safe place. You will need it to create new versions of y Search by voice + + Search by image + + + Close + + + Search any image with Google Lens + + + Drag an image here or + + + upload a file + + + or + + + Paste image link + + + Search + + + Drop an image here + + + Uploading... + + + No network connection + + + please check your internet connection and try again + + + Try again + Save card @@ -7270,15 +7345,55 @@ Keep your key file in a safe place. You will need it to create new versions of y To create a highlight like this one, select any text and right-click. - - Battery Saver is on + + + Energy Saver Turned On + + + + + Energy Saver turned on + + + + + This extends battery power by limiting background activity and visual effects like smooth scrolling. + + + + + This extends battery power by limiting background activity and visual effects like smooth scrolling + + + + Settings - - You can control when Battery Saver turns on in settings + + While this tab was inactive, Memory Saver freed up memory for other tasks. You can change this anytime in settings. - + Settings + + + Memory Saver frees up memory from inactive tabs so it can be used by active tabs and other apps. + + + + + Memory Saver frees up memory from inactive tabs so it can be used by active tabs and other apps + + + + + Turn On + + + + + Turn on + + @@ -7530,6 +7645,9 @@ Check your passwords anytime in $1Brave P Move your password + + Protect your passwords + Import Passwords To Brave @@ -7619,6 +7737,9 @@ Check your passwords anytime in $1Brave P Never for this site + + Edit password + @@ -9124,6 +9245,75 @@ Check your passwords anytime in $1Brave P Partitioned + + + Cookies and site data + + + + From the site you’re viewing + + + + Including sites from the same domain, for example, google.com and mail.google.com. Sites you’re viewing can save data on your device. + + + + From other sites + + + + A site you’re viewing can embed content from other sites, for example images, ads, and text. These embedded sites can save data on your device. + + + + If a site uses cookies, it will appear here + + + + Allow to save data + + + + Allow to set third-party cookies + + + + Don’t allow to save data + + + + Delete when you close all windows + + + + Allowed to save data to your device + + + + Not allowed to save data to your device + + + + Delete data when you close all windows + + + + Data is treated the same as the site you’re viewing + + + + Delete data when you close all windows. Data is treated the same as the site you’re viewing + + + + More actions for $1example.com + + + + Delete saved data for $1example.com + + @@ -9552,12 +9742,19 @@ Check your passwords anytime in $1Brave P Welcome, $1Bob - - Turn on sync to get your bookmarks, passwords, history, and more on this device and anywhere else you're syncing. - - - Turn on sync + + Turn on sync to get your bookmarks, passwords, history, and more on this device and anywhere else you're syncing. Brave may use your history to personalize Search and other Brave services. + + + Turn on sync + + + + + Turn On Sync + + @@ -11319,6 +11516,12 @@ Please help our engineers fix this problem. Tell us what happened right before y Options for sharing are managed by your organization. Some items may be hidden. + + Choose a different screen + + + Choose a different window + This Tab @@ -12239,6 +12442,12 @@ Please help our engineers fix this problem. Tell us what happened right before y You already registered this security key. You don't have to register it again. + + Try a different device + + + You already registered this device. You don't have to register it again. + You're using a security key that's not registered with this website @@ -12303,12 +12512,18 @@ Please help our engineers fix this problem. Tell us what happened right before y Check your phone + + Check your device + Unlock your phone A notification was sent to your phone to confirm it's you. + + A notification was sent to $1Ted's Pixel 6 Pro + accounts.google.com$1 sent a notification to your phone. To confirm it's you, follow the steps there. @@ -12334,6 +12549,9 @@ Please help our engineers fix this problem. Tell us what happened right before y Use phone with a QR code + + A different device + Unlock your phone and confirm it's you @@ -12479,6 +12697,57 @@ Please help our engineers fix this problem. Tell us what happened right before y Manage devices + + Create a passkey for $1example.com + + + This passkey will only be saved on this device + + + This passkey will only be saved on this device. It will remain on this device after you close all Private windows. + + + This passkey will only be saved in Windows Hello + + + This passkey will be saved only in Windows Hello. It will remain on this device after you close all Private windows. + + + Create a passkey + + + Choose how you want to create a passkey for $1example.com + + + Use your passkey + + + Choose which device has the passkey for $1example.com + + + Use your passkey for $1example.com + + + Choose a passkey + + + Which passkey do you want to use for $1example.com? + + + Create a passkey on another device + + + Scan this QR code with the device where you want to create a passkey for $1example.com + + + Use a passkey from another device? + + + Scan this QR code with the device that has the passkey you want to use for $1example.com + + + Try another way + @@ -13056,6 +13325,9 @@ Please help our engineers fix this problem. Tell us what happened right before y Sign in to $1rp.example with $2idp.example + + on $1rp-main.example + Continue as $1Albus (or Albus Dumbledore) @@ -13236,6 +13508,12 @@ Please help our engineers fix this problem. Tell us what happened right before y + + Assistant + + + Automatic password change + Let Brave Assistant help you change your password @@ -13248,6 +13526,9 @@ Please help our engineers fix this problem. Tell us what happened right before y Learn more + + Learn more about automatic password change + Cancel @@ -13257,59 +13538,92 @@ Please help our engineers fix this problem. Tell us what happened right before y Opening $1example.com... - + Successfully changed the compromised password - + + Check your email to choose a new password + + Check your passwords anytime in $1Brave Password Manager. - + Done - + + OK + + Something went wrong. - + Check the site and try changing your password. - + Try again - + Your password didn't change. To change it, try again and leave this tab and side panel open. $1Try again - + Brave Assistant stopped - Battery Saver is on + Energy Saver is on - Battery Saver is on + Energy Saver is on - Battery Saver is on - - - Background activity and some visual effects, like smooth scrolling, may be limited. - - - Turn off now + Energy Saver is on + + + Background activity and some visual effects, like smooth scrolling, may be limited. + + + + + Background activity and some visual effects, like smooth scrolling, may be limited + + + + + Turn Off Now + + + + + Turn off now + + - - Memory Saver is on - + + + Tab Active Again + + + + + Tab active again + + - Memory Saver is on + Tab active again + + + While this tab was inactive, Memory Saver freed up memory for other tasks. You can change this anytime in $1Settings. + + + Settings - - Memory Saver is on + + While this tab was inactive, Memory Saver freed up $1175MB of memory for other tasks. You can change this anytime in $2Settings. diff --git a/app/generated_resources_override.grd b/app/generated_resources_override.grd index 0d9b3ca47449..140f78ee6cb1 100644 --- a/app/generated_resources_override.grd +++ b/app/generated_resources_override.grd @@ -548,7 +548,9 @@ are declared in tools/grit/grit_rule.gni. - + + + @@ -635,6 +637,23 @@ are declared in tools/grit/grit_rule.gni. To browse privately, click the dots icon menu to open a Private window + + + + + + + + + + + + + + + + + @@ -852,6 +871,11 @@ are declared in tools/grit/grit_rule.gni. + + + + + @@ -1049,6 +1073,12 @@ are declared in tools/grit/grit_rule.gni. Sign-in data will be stored on this device after you exit Private mode. You'll be able to sign in to this website with your device again later. + + This passkey will only be saved on this device. It will remain on this device after you close all Private windows. + + + This passkey will be saved only in Windows Hello. It will remain on this device after you close all Private windows. + @@ -1103,8 +1133,20 @@ are declared in tools/grit/grit_rule.gni. - + + + + + + + + + + + + + diff --git a/app/gmc_strings.grdp b/app/gmc_strings.grdp index 0bb9db1338b6..1ba73d0bda8e 100644 --- a/app/gmc_strings.grdp +++ b/app/gmc_strings.grdp @@ -30,7 +30,7 @@ Can't download speech files. Try again later. - Restart needed to install speech files. + Can't install speech files. Your device needs to be updated. Restart your device and try again. Global Media Controls diff --git a/app/os_settings_search_tag_strings.grdp b/app/os_settings_search_tag_strings.grdp index 0ac29522b6e6..e334bdab3658 100644 --- a/app/os_settings_search_tag_strings.grdp +++ b/app/os_settings_search_tag_strings.grdp @@ -203,9 +203,6 @@ Unpair Bluetooth device - - Forget Bluetooth device - Turn off Bluetooth @@ -688,15 +685,6 @@ - - Personalization - - - Customization - - - Personal - Change device account image @@ -712,15 +700,6 @@ Profile image - - Change wallpaper - - - Background - - - Desktop - diff --git a/app/os_settings_strings.grdp b/app/os_settings_strings.grdp index 70f647e32fa4..d915b2ebdbf4 100644 --- a/app/os_settings_strings.grdp +++ b/app/os_settings_strings.grdp @@ -498,6 +498,9 @@ Customize spell check + + User dictionaries + Add words you want spell check to skip @@ -583,6 +586,36 @@ Section + + Automatically switch to halfwidth + + + Shift Key Mode Style + + + Off + + + Alphanumeric + + + Katakana + + + Use Input History + + + Use system dictionary + + + Number of suggestions + + + Disable personalized conversions and suggestions as well as user dictionary + + + Automatically send usage statistics and crash reports to Brave + Double-space to type period @@ -715,6 +748,15 @@ ChromeOS + + Manage user dictionaries + + + Clear personalization data... + + + Add your own words to the user dictionaries in order to customize the conversion candidates. + Initial punctuation width is Full @@ -773,62 +815,6 @@ Personalization - - Take photo - - - Capture video - - - Discard photo or video - - - User image preview - - - Switch to video recorder - - - Choose a picture to display for your account on the sign-in screen - - - Switch to camera mode - - - Choose a file - - - Existing photo from camera or file - - - Existing video from camera or file - - - Photo by $1John Doe - - - Photo was captured - - - Photo was discarded - - - Photo mode entered - - - Video mode entered - - - - - Wallpaper - - - Open the wallpaper app - - - Change device account image - Set your wallpaper & style @@ -840,9 +826,6 @@ Preferred search engine - - Configure - Set your default search engine for Brave browser and $1Chromebook Launcher @@ -2154,21 +2137,12 @@ Press an assigned switch or key to remove assignment. Connected - - Connected, $1100% battery - Connecting... - - Paired devices - Bluetooth configuration is controlled by $1joe@gmail.com. - - Unpaired devices - Connect @@ -2268,15 +2242,6 @@ Press an assigned switch or key to remove assignment. Show available Bluetooth devices - - No paired devices - - - No Bluetooth devices found - - - Not connected - Bluetooth @@ -2313,26 +2278,23 @@ Press an assigned switch or key to remove assignment. Cancel - + Remove - + Remove $1Beats from $2john@google.com? Cancel - + Forget $1Beats will be removed from this Chromebook and won’t be saved to $2john@google.com. - - Forget device - - - Connect to Bluetooth device + + Forget this device? Remove from list @@ -2344,7 +2306,7 @@ Press an assigned switch or key to remove assignment. Scan for new devices - Easily connect and set up Fast Pair devices close by + Connect and quickly set up Fast Pair devices close by Bluetooth enabled @@ -3031,6 +2993,9 @@ Press an assigned switch or key to remove assignment. Forget + + Sign in + View Account @@ -3284,6 +3249,9 @@ Press an assigned switch or key to remove assignment. Recent Brave tabs + + Apps (Beta) + Apps @@ -4471,7 +4439,7 @@ Press an assigned switch or key to remove assignment. Hide notification content when someone else is detected - Privacy Hub + Privacy controls Internal camera deactivated by hardware switch @@ -4488,6 +4456,12 @@ Press an assigned switch or key to remove assignment. No microphone connected + + No camera is connected + + + No microphone is connected + Geolocation diff --git a/app/password_manager_ui_strings.grdp b/app/password_manager_ui_strings.grdp index 065a00b76b33..b4f8f7847298 100644 --- a/app/password_manager_ui_strings.grdp +++ b/app/password_manager_ui_strings.grdp @@ -49,4 +49,55 @@ Download a copy to use elsewhere + + Password Checkup + + + {COUNT, plural, + =0 {No saved passwords.} + =1 {Checked passwords for {COUNT} site} + other {Checked passwords for {COUNT} sites and apps}} + + + Just now + + + {COUNT, plural, + =0 {No compromised passwords} + =1 {{COUNT} compromised password} + other {{COUNT} compromised passwords}} + + + If your passwords are compromised, we’ll let you know. + + + You should change these now + + + {COUNT, plural, + =0 {Your passwords are unique} + =1 {{COUNT} reused password} + other {{COUNT} reused passwords}} + + + You’re not reusing any passwords + + + Create unique passwords + + + {COUNT, plural, + =0 {Your passwords look strong} + =1 {{COUNT} weak password} + other {{COUNT} weak passwords}} + + + You’re using passwords that look hard to guess + + + Create strong passwords + + + Try again + diff --git a/app/profiles_strings.grdp b/app/profiles_strings.grdp index ecbfbbed868c..90cdda4e1cf7 100644 --- a/app/profiles_strings.grdp +++ b/app/profiles_strings.grdp @@ -729,5 +729,36 @@ + + + + Sign in for more benefits + + + Across devices + + + Pick up where you left off on any device + + + Stronger security + + + Extra protection to your passwords and more + + + Back up your stuff + + + Store your bookmarks and more with sync + + + Don't sign in + + + Sign in + + + diff --git a/app/profiles_strings_override.grdp b/app/profiles_strings_override.grdp index 8bae6ef7b8cd..c9f7430aa73f 100644 --- a/app/profiles_strings_override.grdp +++ b/app/profiles_strings_override.grdp @@ -63,5 +63,8 @@ + + + diff --git a/app/settings_brave_strings.grdp b/app/settings_brave_strings.grdp index 37edcd20aafb..047ba61d7fd5 100644 --- a/app/settings_brave_strings.grdp +++ b/app/settings_brave_strings.grdp @@ -278,8 +278,11 @@ - - When on, Brave reclaims memory from tabs you aren't actively using. This frees up your computer's resources for other tasks and keeps Brave speedy. Inactive tabs appear empty and automatically reload when you click them. <a id="highEfficiencyLearnMore" target="_blank" href="$1">Learn more</a> or <a id="highEfficiencySendFeedback" href="#">send feedback</a> + + When on, Brave frees up memory from inactive tabs. This gives active tabs and other apps more computer resources and keeps Brave fast. Your inactive tabs automatically become active again when you go back to them. <a id="highEfficiencyLearnMore" target="_blank" href="$1" aria-label="$2">Learn more</a> + + + When on, Brave conserves battery power by limiting background activity and visual effects, such as smooth scrolling and video frame rates. <a id="batterySaverLearnMore" target="_blank" href="$1" aria-label="$2">Learn more</a> diff --git a/app/settings_strings.grdp b/app/settings_strings.grdp index 11a938aaee6e..73fdc7f62ecd 100644 --- a/app/settings_strings.grdp +++ b/app/settings_strings.grdp @@ -94,7 +94,7 @@ Can't download speech files. Try again later. - Restart needed to install speech files. + Can't install speech files. Your device needs to be updated. Restart your device and try again. Navigate pages with a text cursor @@ -114,6 +114,11 @@ Show a quick highlight on the focused object + + + Manage accessibility features + + @@ -670,6 +675,18 @@ =1 {To keep your passwords safe, Brave Password Manager locks after 1 minute of inactivity} other {To keep your passwords safe, Brave Password Manager locks after {NUM_MINS} minutes of inactivity}} + + Enter your username + + + Site + + + Edit passkey + + + When you edit your passkey, your $1relyingPartyId account won't change + Got it @@ -926,27 +943,43 @@ - + Manage passkeys - + To manage passkeys, use a newer version of Windows - + Passkeys - - These passkeys are stored in Windows Hello on this computer. They aren't saved to your Brave sync chain. + + + These passkeys are saved to Windows Hello on this computer. They aren't saved to your Brave sync chain. - + + + + These passkeys are only saved on this device. They aren't saved to your Brave sync chain. + + + Search passkeys - + + Delete passkey + + + Are you sure you want to delete this passkey? + + Can't delete passkey - + You need this passkey to sign in to your computer + + More actions, passkey options for $1example@gmail.com on $2www.google.com + @@ -1391,12 +1424,48 @@ - + Performance - + Memory Saver + + Learn more about memory saver + + + Send feedback about memory saver + + + Add to the "always keep these sites active" list + + + Save to the "always keep these sites active" list + + + Always keep these sites active + + + Power + + + Energy Saver + + + Turn on when my computer is unplugged + + + Turn on only when my battery is at $120% or lower + + + Learn more about energy saver + + + Send feedback about energy saver + + + Energy saver options + @@ -1571,24 +1640,6 @@ About Privacy Sandbox - - With <a href="$1" target="_blank">Privacy Sandbox</a>, Brave is developing new technologies to safeguard you from cross-site tracking while preserving the open web. - - - Privacy Sandbox trials are still in active development and are available in selected regions. For now, sites may try out Privacy Sandbox while continuing to use current web technologies like third-party cookies. - - - Privacy Sandbox trials - - - When on, sites may use the privacy-preserving techniques shown here to provide their content and services. These include alternatives to cross-site tracking. More trials may be added over time. - - - Advertisers and publishers can use FLoC, described later on this page. - - - Advertisers and publishers can study the effectiveness of ads in a way that does not track you across sites. - Details @@ -1598,28 +1649,6 @@ Trial features are off - - FLoC - - - When on and the status is active, Brave uses your browsing history over 7 days to determine a group, or “cohort”, that you’re in. Advertisers can select ads for the group. Your browsing history is kept private on your device. This trial is active only in - <a href="$1" target="_blank">some regions</a>. - - - This trial is active only in <a target="_blank" href="$1">some regions</a>. - - - Status - - - Group number - - - Next update - - - Reset group - Learn about and control new technologies that aim to replace third-party cookies @@ -1928,9 +1957,6 @@ Warning - - Review sites that recently sent a lot of notifications - Review @@ -2000,26 +2026,68 @@ Review extensions - - Review websites that sent a lot of notifications + + {NUM_SITES, plural, + =1 {Review 1 site that recently sent a lot of notifications} + other {Review {NUM_SITES} sites that recently sent a lot of notifications}} + + + These sites sent a lot of notifications recently. You can stop them from sending future notifications. - - These sites sent a lot of notifications in the last 2 months. You can stop them from sending future notifications. + + Notifications allowed for $1www.example.com - + + Notifications not allowed for $1www.example.com + + + Notifications not allowed for $1www.example.com. You’ll be asked again on your next visit. + + {NUM_NOTIFICATION, plural, =1 {About 1 notification a day} other {About {NUM_NOTIFICATION} notifications a day}} - + + All done for now + + Don't allow - + + Don't allow notifications from $1website.com + + Always allow notifications from this site - + + Always allow notifications from $1website.com + + Don’t allow but ask later + + Don’t allow notifications from $1website.com but ask later + + + More actions for $1website.com + + + Undo + + + {NUM_SITES, plural, + =1 {Review <b>1 site</b> that recently sent a lot of notifications} + other {Review <b>{NUM_SITES} sites</b> that recently sent a lot of notifications}} + + + Block all + + + {NUM_SITES, plural, + =1 {Notifications not allowed for 1 site} + other {Notifications not allowed for {NUM_SITES} sites}} + Device software @@ -2496,6 +2564,9 @@ Sites automatically follow this setting when you visit them + + Sites automatically follow this setting when you visit them. Sites usually send notifications to let you know about breaking news or chat messages. + Customized behaviors @@ -3031,11 +3102,11 @@ Features on many sites may not work - - Allow related sites to remember you across sites + + Allow related sites to see your activity in the group - - Related sites use cookies to help with things like keeping you signed in + + A company can define a group of sites that can use cookies to share your activity in the group. This is off in Private. Clear cookies and site data when you close all windows @@ -3316,33 +3387,6 @@ Clear data - - All cookies and site data - - - See all cookies and site data - - - Remove - - - Remove All - - - Remove All Shown - - - Remove Third-Party Cookies - - - Clear third-party cookies - - - This will delete all cookies and site data available in third-party contexts. Do you want to continue? - - - Clear third-party cookies - Including third-party cookies on this site @@ -3352,6 +3396,9 @@ Clear displayed data? + + These sites are in a group defined by $1google.com. Sites in a group can see your activity in the group. <a>Learn more</a> + Total storage used by sites: $18 GB @@ -3363,15 +3410,18 @@ Clear displayed data - + {MEMBERS, plural, - =1 {Allowed for 1 $1google.com site} - other {Allowed for {MEMBERS} {FPS_OWNER}google.com sites}} + =1 {1 site in {FPS_OWNER}google.com's group} + other {{MEMBERS} sites in {FPS_OWNER}google.com's group}} + + + More actions for $1google.com - - Show related sites + + Show sites in same group - + Clear data and permissions @@ -3392,12 +3442,6 @@ You'll be signed out of displayed sites, including in open tabs - - Clear site data - - - $1www.example.com locally stored data - Reset site permissions for $1www.example.com? @@ -3449,15 +3493,6 @@ Offline data in installed apps will also be cleared - - This will clear all data and cookies stored by $1www.example.com - - - This will clear all data and cookies stored by $1www.example.com and its installed apps - - - This will delete any data stored on your device for all the sites shown. Do you want to continue? - Clear site data and permissions for $1www.example.com? @@ -3494,18 +3529,12 @@ Remove $1google.com - - Clear all - Reset Clear - - Search cookies - Default diff --git a/app/settings_strings_override.grdp b/app/settings_strings_override.grdp index dc53ee27ebfe..fc4d401d7b5c 100644 --- a/app/settings_strings_override.grdp +++ b/app/settings_strings_override.grdp @@ -29,6 +29,8 @@ + + @@ -51,6 +53,10 @@ + + + + @@ -129,6 +135,9 @@ 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. + + A company can define a group of sites that can use cookies to share your activity in the group. This is off in Private. + diff --git a/app/supervised_user_error_page_strings.grdp b/app/supervised_user_error_page_strings.grdp index 6eb68edad5c2..c5a2c50cf7e8 100644 --- a/app/supervised_user_error_page_strings.grdp +++ b/app/supervised_user_error_page_strings.grdp @@ -20,8 +20,8 @@ You need permission to visit this site - - You need permission to visit this site. It may have inappropriate content. + + A parent or guardian has to say that it's OK for you to visit this website Questions? Contact the profile who supervises your profile. @@ -57,13 +57,13 @@ You asked your parents if it's OK to visit this site - Waiting for parent approval + Waiting for permission... - An approval request has been sent to your parent on their Brave Family Link app and at families.google.com. You will get a notification if your parent approves the request. + You asked to visit this site. Your parent can reply in Family Link. - An approval request has been sent to your parents on their Brave Family Link app and at families.google.com. You will get a notification if one of your parents approves the request. + You asked to visit this site. Your parents can reply in Family Link. We could not reach your parent at the moment. Please try again. @@ -87,13 +87,10 @@ This site is blocked because it may have mature content - Your parent hasn't approved it yet + Your parent hasn't said it's OK yet - Your parents haven't approved it yet - - - Your manager hasn't approved it yet + Your parents haven't said it's OK yet It may have mature content @@ -104,9 +101,6 @@ Your parents can unblock it for you - - Your manager can unblock it for you - Please start and sign in to Brave so that Brave can check whether you are allowed to access this site. diff --git a/browser/android/preferences/features.cc b/browser/android/preferences/features.cc index 029bc2c86f94..66ab0f820344 100644 --- a/browser/android/preferences/features.cc +++ b/browser/android/preferences/features.cc @@ -11,8 +11,9 @@ namespace preferences { namespace features { -const base::Feature kBraveBackgroundVideoPlayback{ - "BraveBackgroundVideoPlayback", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kBraveBackgroundVideoPlayback, + "BraveBackgroundVideoPlayback", + base::FEATURE_DISABLED_BY_DEFAULT); } // namespace features } // namespace preferences diff --git a/browser/android/preferences/features.h b/browser/android/preferences/features.h index 99e57f4b3622..d877482a0164 100644 --- a/browser/android/preferences/features.h +++ b/browser/android/preferences/features.h @@ -11,7 +11,7 @@ namespace preferences { namespace features { -extern const base::Feature kBraveBackgroundVideoPlayback; +BASE_DECLARE_FEATURE(kBraveBackgroundVideoPlayback); } // namespace features } // namespace preferences diff --git a/browser/brave_rewards/android/brave_rewards_native_worker.cc b/browser/brave_rewards/android/brave_rewards_native_worker.cc index 247003298c1f..b2f373ea3277 100644 --- a/browser/brave_rewards/android/brave_rewards_native_worker.cc +++ b/browser/brave_rewards/android/brave_rewards_native_worker.cc @@ -571,16 +571,13 @@ void BraveRewardsNativeWorker::GetReconcileStamp(JNIEnv* env) { } void BraveRewardsNativeWorker::ResetTheWholeState(JNIEnv* env) { - if (brave_rewards_service_) { - brave_rewards_service_->CompleteReset( - base::BindOnce(&BraveRewardsNativeWorker::OnResetTheWholeState, - weak_factory_.GetWeakPtr())); - } else { - JNIEnv* env = base::android::AttachCurrentThread(); - - Java_BraveRewardsNativeWorker_OnResetTheWholeState(env, - weak_java_brave_rewards_native_worker_.get(env), false); + if (!brave_rewards_service_) { + OnResetTheWholeState(false); + return; } + brave_rewards_service_->CompleteReset( + base::BindOnce(&BraveRewardsNativeWorker::OnResetTheWholeState, + weak_factory_.GetWeakPtr())); } void BraveRewardsNativeWorker::OnResetTheWholeState(const bool success) { diff --git a/browser/brave_wallet/brave_wallet_ethereum_chain_browsertest.cc b/browser/brave_wallet/brave_wallet_ethereum_chain_browsertest.cc index dc80cd6e98c4..15ee57e2ec05 100644 --- a/browser/brave_wallet/brave_wallet_ethereum_chain_browsertest.cc +++ b/browser/brave_wallet/brave_wallet_ethereum_chain_browsertest.cc @@ -26,6 +26,7 @@ #include "content/public/browser/browser_task_traits.h" #include "content/public/test/browser_test.h" #include "content/public/test/browser_test_utils.h" +#include "content/public/test/content_mock_cert_verifier.h" #include "mojo/public/cpp/bindings/self_owned_receiver.h" #include "net/dns/mock_host_resolver.h" #include "url/origin.h" @@ -160,8 +161,19 @@ class BraveWalletEthereumChainTest : public InProcessBrowserTest { brave_wallet::features::kNativeBraveWalletFeature); } + void SetUpInProcessBrowserTestFixture() override { + InProcessBrowserTest::SetUpInProcessBrowserTestFixture(); + mock_cert_verifier_.SetUpInProcessBrowserTestFixture(); + } + + void TearDownInProcessBrowserTestFixture() override { + InProcessBrowserTest::TearDownInProcessBrowserTestFixture(); + mock_cert_verifier_.TearDownInProcessBrowserTestFixture(); + } + void SetUpOnMainThread() override { InProcessBrowserTest::SetUpOnMainThread(); + mock_cert_verifier_.mock_cert_verifier()->set_default_result(net::OK); host_resolver()->AddRule("*", "127.0.0.1"); https_server_ = std::make_unique( @@ -181,9 +193,8 @@ class BraveWalletEthereumChainTest : public InProcessBrowserTest { } void SetUpCommandLine(base::CommandLine* command_line) override { - // HTTPS server only serves a valid cert for localhost, so this is needed - // to load pages from other hosts without an error. - command_line->AppendSwitch(switches::kIgnoreCertificateErrors); + InProcessBrowserTest::SetUpCommandLine(command_line); + mock_cert_verifier_.SetUpCommandLine(command_line); } std::unique_ptr HandleChainRequest( @@ -252,6 +263,7 @@ class BraveWalletEthereumChainTest : public InProcessBrowserTest { } private: + content::ContentMockCertVerifier mock_cert_verifier_; std::unique_ptr https_server_; base::test::ScopedFeatureList feature_list_; }; diff --git a/browser/brave_wallet/brave_wallet_event_emitter_browsertest.cc b/browser/brave_wallet/brave_wallet_event_emitter_browsertest.cc index c465d9d198d1..fa3f6bbe954a 100644 --- a/browser/brave_wallet/brave_wallet_event_emitter_browsertest.cc +++ b/browser/brave_wallet/brave_wallet_event_emitter_browsertest.cc @@ -30,6 +30,7 @@ #include "content/public/browser/browser_task_traits.h" #include "content/public/test/browser_test.h" #include "content/public/test/browser_test_utils.h" +#include "content/public/test/content_mock_cert_verifier.h" #include "net/dns/mock_host_resolver.h" #include "url/gurl.h" #include "url/origin.h" @@ -59,8 +60,19 @@ class BraveWalletEventEmitterTest : public InProcessBrowserTest { brave_wallet::features::kNativeBraveWalletFeature); } + void SetUpInProcessBrowserTestFixture() override { + InProcessBrowserTest::SetUpInProcessBrowserTestFixture(); + mock_cert_verifier_.SetUpInProcessBrowserTestFixture(); + } + + void TearDownInProcessBrowserTestFixture() override { + InProcessBrowserTest::TearDownInProcessBrowserTestFixture(); + mock_cert_verifier_.TearDownInProcessBrowserTestFixture(); + } + void SetUpOnMainThread() override { InProcessBrowserTest::SetUpOnMainThread(); + mock_cert_verifier_.mock_cert_verifier()->set_default_result(net::OK); host_resolver()->AddRule("*", "127.0.0.1"); https_server_ = std::make_unique( @@ -80,9 +92,8 @@ class BraveWalletEventEmitterTest : public InProcessBrowserTest { } void SetUpCommandLine(base::CommandLine* command_line) override { - // HTTPS server only serves a valid cert for localhost, so this is needed - // to load pages from other hosts without an error. - command_line->AppendSwitch(switches::kIgnoreCertificateErrors); + InProcessBrowserTest::SetUpCommandLine(command_line); + mock_cert_verifier_.SetUpCommandLine(command_line); } net::EmbeddedTestServer* https_server() { return https_server_.get(); } @@ -152,6 +163,7 @@ class BraveWalletEventEmitterTest : public InProcessBrowserTest { } private: + content::ContentMockCertVerifier mock_cert_verifier_; mojo::Remote json_rpc_service_; raw_ptr keyring_service_ = nullptr; std::unique_ptr https_server_; diff --git a/browser/brave_wallet/brave_wallet_sign_message_browsertest.cc b/browser/brave_wallet/brave_wallet_sign_message_browsertest.cc index 81ded27556ab..432176b93d43 100644 --- a/browser/brave_wallet/brave_wallet_sign_message_browsertest.cc +++ b/browser/brave_wallet/brave_wallet_sign_message_browsertest.cc @@ -26,6 +26,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test.h" #include "content/public/test/browser_test_utils.h" +#include "content/public/test/content_mock_cert_verifier.h" #include "content/public/test/test_utils.h" #include "net/dns/mock_host_resolver.h" #include "net/test/embedded_test_server/embedded_test_server.h" @@ -46,10 +47,21 @@ class BraveWalletSignMessageBrowserTest : public InProcessBrowserTest { void SetUpCommandLine(base::CommandLine* command_line) override { InProcessBrowserTest::SetUpCommandLine(command_line); - command_line->AppendSwitch(switches::kIgnoreCertificateErrors); + mock_cert_verifier_.SetUpCommandLine(command_line); + } + + void SetUpInProcessBrowserTestFixture() override { + InProcessBrowserTest::SetUpInProcessBrowserTestFixture(); + mock_cert_verifier_.SetUpInProcessBrowserTestFixture(); + } + + void TearDownInProcessBrowserTestFixture() override { + InProcessBrowserTest::TearDownInProcessBrowserTestFixture(); + mock_cert_verifier_.TearDownInProcessBrowserTestFixture(); } void SetUpOnMainThread() override { + mock_cert_verifier_.mock_cert_verifier()->set_default_result(net::OK); host_resolver()->AddRule("*", "127.0.0.1"); brave::RegisterPathProvider(); @@ -113,6 +125,7 @@ class BraveWalletSignMessageBrowserTest : public InProcessBrowserTest { "signMessageViaSendAsync"}; private: + content::ContentMockCertVerifier mock_cert_verifier_; base::test::ScopedFeatureList scoped_feature_list_; net::test_server::EmbeddedTestServer https_server_; raw_ptr keyring_service_ = nullptr; diff --git a/browser/brave_wallet/brave_wallet_tab_helper_browsertest.cc b/browser/brave_wallet/brave_wallet_tab_helper_browsertest.cc index c3c61f45d44c..2c95bc9a6eb6 100644 --- a/browser/brave_wallet/brave_wallet_tab_helper_browsertest.cc +++ b/browser/brave_wallet/brave_wallet_tab_helper_browsertest.cc @@ -28,6 +28,7 @@ #include "content/public/browser/browser_task_traits.h" #include "content/public/test/browser_test.h" #include "content/public/test/browser_test_utils.h" +#include "content/public/test/content_mock_cert_verifier.h" #include "content/public/test/test_navigation_observer.h" #include "content/public/test/web_contents_tester.h" #include "net/dns/mock_host_resolver.h" @@ -96,8 +97,19 @@ class BraveWalletTabHelperBrowserTest : public InProcessBrowserTest { brave_wallet::features::kNativeBraveWalletFeature); } + void SetUpInProcessBrowserTestFixture() override { + InProcessBrowserTest::SetUpInProcessBrowserTestFixture(); + mock_cert_verifier_.SetUpInProcessBrowserTestFixture(); + } + + void TearDownInProcessBrowserTestFixture() override { + InProcessBrowserTest::TearDownInProcessBrowserTestFixture(); + mock_cert_verifier_.TearDownInProcessBrowserTestFixture(); + } + void SetUpOnMainThread() override { InProcessBrowserTest::SetUpOnMainThread(); + mock_cert_verifier_.mock_cert_verifier()->set_default_result(net::OK); host_resolver()->AddRule("*", "127.0.0.1"); https_server_ = std::make_unique( @@ -117,10 +129,10 @@ class BraveWalletTabHelperBrowserTest : public InProcessBrowserTest { } void SetUpCommandLine(base::CommandLine* command_line) override { - // HTTPS server only serves a valid cert for localhost, so this is needed - // to load pages from other hosts without an error. - command_line->AppendSwitch(switches::kIgnoreCertificateErrors); + InProcessBrowserTest::SetUpCommandLine(command_line); + mock_cert_verifier_.SetUpCommandLine(command_line); } + std::unique_ptr HandleChainRequest( const net::test_server::HttpRequest& request) { GURL absolute_url = https_server_->GetURL(request.relative_url); @@ -146,6 +158,7 @@ class BraveWalletTabHelperBrowserTest : public InProcessBrowserTest { net::EmbeddedTestServer* https_server() { return https_server_.get(); } private: + content::ContentMockCertVerifier mock_cert_verifier_; std::unique_ptr https_server_; base::test::ScopedFeatureList feature_list_; }; diff --git a/browser/brave_wallet/ethereum_provider_browsertest.cc b/browser/brave_wallet/ethereum_provider_browsertest.cc index c3d6367e1c82..37d8a7f0bc07 100644 --- a/browser/brave_wallet/ethereum_provider_browsertest.cc +++ b/browser/brave_wallet/ethereum_provider_browsertest.cc @@ -18,6 +18,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test.h" #include "content/public/test/browser_test_utils.h" +#include "content/public/test/content_mock_cert_verifier.h" #include "content/public/test/test_utils.h" #include "net/dns/mock_host_resolver.h" #include "net/test/embedded_test_server/embedded_test_server.h" @@ -48,10 +49,21 @@ class EthereumProviderBrowserTest : public InProcessBrowserTest { void SetUpCommandLine(base::CommandLine* command_line) override { InProcessBrowserTest::SetUpCommandLine(command_line); - command_line->AppendSwitch(switches::kIgnoreCertificateErrors); + mock_cert_verifier_.SetUpCommandLine(command_line); + } + + void SetUpInProcessBrowserTestFixture() override { + InProcessBrowserTest::SetUpInProcessBrowserTestFixture(); + mock_cert_verifier_.SetUpInProcessBrowserTestFixture(); + } + + void TearDownInProcessBrowserTestFixture() override { + InProcessBrowserTest::TearDownInProcessBrowserTestFixture(); + mock_cert_verifier_.TearDownInProcessBrowserTestFixture(); } void SetUpOnMainThread() override { + mock_cert_verifier_.mock_cert_verifier()->set_default_result(net::OK); host_resolver()->AddRule("*", "127.0.0.1"); brave::RegisterPathProvider(); @@ -87,6 +99,7 @@ class EthereumProviderBrowserTest : public InProcessBrowserTest { } private: + content::ContentMockCertVerifier mock_cert_verifier_; net::test_server::EmbeddedTestServer https_server_; raw_ptr keyring_service_ = nullptr; }; diff --git a/browser/brave_wallet/send_transaction_browsertest.cc b/browser/brave_wallet/send_transaction_browsertest.cc index 7b1c44198e0f..c24f88f5ea20 100644 --- a/browser/brave_wallet/send_transaction_browsertest.cc +++ b/browser/brave_wallet/send_transaction_browsertest.cc @@ -39,6 +39,7 @@ #include "content/public/test/browser_task_environment.h" #include "content/public/test/browser_test.h" #include "content/public/test/browser_test_utils.h" +#include "content/public/test/content_mock_cert_verifier.h" #include "content/public/test/test_utils.h" #include "net/dns/mock_host_resolver.h" #include "net/test/embedded_test_server/embedded_test_server.h" @@ -124,10 +125,21 @@ class SendTransactionBrowserTest : public InProcessBrowserTest { void SetUpCommandLine(base::CommandLine* command_line) override { InProcessBrowserTest::SetUpCommandLine(command_line); - command_line->AppendSwitch(switches::kIgnoreCertificateErrors); + mock_cert_verifier_.SetUpCommandLine(command_line); + } + + void SetUpInProcessBrowserTestFixture() override { + InProcessBrowserTest::SetUpInProcessBrowserTestFixture(); + mock_cert_verifier_.SetUpInProcessBrowserTestFixture(); + } + + void TearDownInProcessBrowserTestFixture() override { + InProcessBrowserTest::TearDownInProcessBrowserTestFixture(); + mock_cert_verifier_.TearDownInProcessBrowserTestFixture(); } void SetUpOnMainThread() override { + mock_cert_verifier_.mock_cert_verifier()->set_default_result(net::OK); host_resolver()->AddRule("*", "127.0.0.1"); brave::RegisterPathProvider(); @@ -233,12 +245,20 @@ class SendTransactionBrowserTest : public InProcessBrowserTest { json_rpc_service_->AddEthereumChainRequestCompleted(chain_id, true); } - void CallEthereumEnable() { + void CallEthereumEnable(bool is_repeat_call = false) { + base::RunLoop run_loop; + auto* tab_helper = + brave_wallet::BraveWalletTabHelper::FromWebContents(web_contents()); + tab_helper->SetShowBubbleCallbackForTesting(run_loop.QuitClosure()); + ASSERT_TRUE(ExecJs(web_contents(), "ethereumEnable()")); - base::RunLoop().RunUntilIdle(); - ASSERT_TRUE( - brave_wallet::BraveWalletTabHelper::FromWebContents(web_contents()) - ->IsShowingBubble()); + if (!is_repeat_call) { + run_loop.Run(); + } + + // The bubble should be showing at this point. If it's a repeat call then + // the bubble should already be shown from the initial call. + ASSERT_TRUE(tab_helper->IsShowingBubble()); } void UserGrantPermission(bool granted) { @@ -487,6 +507,7 @@ class SendTransactionBrowserTest : public InProcessBrowserTest { raw_ptr brave_wallet_service_ = nullptr; private: + content::ContentMockCertVerifier mock_cert_verifier_; TestTxServiceObserver observer_; base::test::ScopedFeatureList scoped_feature_list_; net::test_server::EmbeddedTestServer https_server_for_files_; @@ -767,7 +788,7 @@ IN_PROC_BROWSER_TEST_F(SendTransactionBrowserTest, SecondEnableCallFails) { CallEthereumEnable(); // 2nd call should fail - CallEthereumEnable(); + CallEthereumEnable(/*is_repeat_call*/ true); ASSERT_EQ(EvalJs(web_contents(), "getPermissionGranted()", content::EXECUTE_SCRIPT_USE_MANUAL_REPLY) .ExtractBool(), @@ -793,7 +814,7 @@ IN_PROC_BROWSER_TEST_F(SendTransactionBrowserTest, CallEthereumEnable(); // 2nd call should fail - CallEthereumEnable(); + CallEthereumEnable(/*is_repeat_call*/ true); ASSERT_EQ(EvalJs(web_contents(), "getPermissionGranted()", content::EXECUTE_SCRIPT_USE_MANUAL_REPLY) .ExtractBool(), diff --git a/browser/brave_wallet/solana_provider_browsertest.cc b/browser/brave_wallet/solana_provider_browsertest.cc index 6a2e8602592f..4bb6318560cd 100644 --- a/browser/brave_wallet/solana_provider_browsertest.cc +++ b/browser/brave_wallet/solana_provider_browsertest.cc @@ -396,12 +396,18 @@ class SolanaProviderTest : public InProcessBrowserTest { void CallSolanaConnect(const content::ToRenderFrameHost& execution_target, bool is_expect_bubble = true) { + base::RunLoop run_loop; + auto* tab_helper = + brave_wallet::BraveWalletTabHelper::FromWebContents(web_contents()); + tab_helper->SetShowBubbleCallbackForTesting(run_loop.QuitClosure()); + ASSERT_TRUE(ExecJs(execution_target, "solanaConnect()")); - base::RunLoop().RunUntilIdle(); + if (is_expect_bubble) { - ASSERT_TRUE( - brave_wallet::BraveWalletTabHelper::FromWebContents(web_contents()) - ->IsShowingBubble()); + run_loop.Run(); + ASSERT_TRUE(tab_helper->IsShowingBubble()); + } else { + run_loop.RunUntilIdle(); } } diff --git a/browser/brave_wallet/wallet_watch_asset_browsertest.cc b/browser/brave_wallet/wallet_watch_asset_browsertest.cc index 772f84370c98..c2f74d94623d 100644 --- a/browser/brave_wallet/wallet_watch_asset_browsertest.cc +++ b/browser/brave_wallet/wallet_watch_asset_browsertest.cc @@ -23,6 +23,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test.h" #include "content/public/test/browser_test_utils.h" +#include "content/public/test/content_mock_cert_verifier.h" #include "content/public/test/test_utils.h" #include "net/dns/mock_host_resolver.h" #include "net/test/embedded_test_server/embedded_test_server.h" @@ -40,10 +41,21 @@ class WalletWatchAssetBrowserTest : public InProcessBrowserTest { void SetUpCommandLine(base::CommandLine* command_line) override { InProcessBrowserTest::SetUpCommandLine(command_line); - command_line->AppendSwitch(switches::kIgnoreCertificateErrors); + mock_cert_verifier_.SetUpCommandLine(command_line); + } + + void SetUpInProcessBrowserTestFixture() override { + InProcessBrowserTest::SetUpInProcessBrowserTestFixture(); + mock_cert_verifier_.SetUpInProcessBrowserTestFixture(); + } + + void TearDownInProcessBrowserTestFixture() override { + InProcessBrowserTest::TearDownInProcessBrowserTestFixture(); + mock_cert_verifier_.TearDownInProcessBrowserTestFixture(); } void SetUpOnMainThread() override { + mock_cert_verifier_.mock_cert_verifier()->set_default_result(net::OK); host_resolver()->AddRule("*", "127.0.0.1"); brave::RegisterPathProvider(); @@ -117,6 +129,7 @@ class WalletWatchAssetBrowserTest : public InProcessBrowserTest { std::vector decimals_{6, 6, 2, 18}; private: + content::ContentMockCertVerifier mock_cert_verifier_; net::test_server::EmbeddedTestServer https_server_; raw_ptr keyring_service_ = nullptr; }; diff --git a/browser/ethereum_remote_client/features.cc b/browser/ethereum_remote_client/features.cc index 8720c9f58344..4993c341ec6d 100644 --- a/browser/ethereum_remote_client/features.cc +++ b/browser/ethereum_remote_client/features.cc @@ -10,8 +10,9 @@ namespace ethereum_remote_client { namespace features { -const base::Feature kCryptoWalletsForNewInstallsFeature{ - "CryptoWalletsForNewInstallsFeature", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kCryptoWalletsForNewInstallsFeature, + "CryptoWalletsForNewInstallsFeature", + base::FEATURE_DISABLED_BY_DEFAULT); } // namespace features } // namespace ethereum_remote_client diff --git a/browser/ethereum_remote_client/features.h b/browser/ethereum_remote_client/features.h index 74cecffe7c95..29eadef6d742 100644 --- a/browser/ethereum_remote_client/features.h +++ b/browser/ethereum_remote_client/features.h @@ -11,7 +11,7 @@ namespace ethereum_remote_client { namespace features { -extern const base::Feature kCryptoWalletsForNewInstallsFeature; +BASE_DECLARE_FEATURE(kCryptoWalletsForNewInstallsFeature); } // namespace features } // namespace ethereum_remote_client diff --git a/browser/importer/brave_external_process_importer_host_unittest.cc b/browser/importer/brave_external_process_importer_host_unittest.cc index 7b53caee80fd..c8b35e237548 100644 --- a/browser/importer/brave_external_process_importer_host_unittest.cc +++ b/browser/importer/brave_external_process_importer_host_unittest.cc @@ -63,7 +63,6 @@ class BraveExternalProcessImporterHostUnitTest : public testing::Test { void SetUp() override { TestingProfile::Builder profile_builder; - brave::RegisterPathProvider(); EXPECT_TRUE(brave_profile_dir_.CreateUniqueTempDir()); profile_builder.SetPath(GetProductProfilePath("Brave")); profile_ = profile_builder.Build(); diff --git a/browser/importer/extensions_import_helpers_unittest.cc b/browser/importer/extensions_import_helpers_unittest.cc index 8a2ef4ce0b6e..c15389cf8a66 100644 --- a/browser/importer/extensions_import_helpers_unittest.cc +++ b/browser/importer/extensions_import_helpers_unittest.cc @@ -29,7 +29,6 @@ class ExtensionsImportHelperstUnitTest : public testing::Test { void SetUp() override { TestingProfile::Builder profile_builder; - brave::RegisterPathProvider(); EXPECT_TRUE(brave_profile_dir_.CreateUniqueTempDir()); profile_builder.SetPath(GetProductProfilePath("Brave")); profile_ = profile_builder.Build(); diff --git a/browser/ntp_background/ntp_background_prefs.cc b/browser/ntp_background/ntp_background_prefs.cc index b3720540394c..be4c3bab5d93 100644 --- a/browser/ntp_background/ntp_background_prefs.cc +++ b/browser/ntp_background/ntp_background_prefs.cc @@ -132,15 +132,17 @@ absl::variant NTPBackgroundPrefs::GetSelectedValue() const { } void NTPBackgroundPrefs::AddCustomImageToList(const std::string& file_name) { - ListPrefUpdate update(service_, NTPBackgroundPrefs::kCustomImageListPrefName); - update->GetList().Append(file_name); + ScopedListPrefUpdate update(service_, + NTPBackgroundPrefs::kCustomImageListPrefName); + update->Append(file_name); } void NTPBackgroundPrefs::RemoveCustomImageFromList( const std::string& file_name) { - ListPrefUpdate update(service_, NTPBackgroundPrefs::kCustomImageListPrefName); - auto& list = update->GetList(); - list.erase(base::ranges::remove(update->GetList(), file_name), list.end()); + ScopedListPrefUpdate update(service_, + NTPBackgroundPrefs::kCustomImageListPrefName); + update->erase(base::ranges::remove(update.Get(), file_name), + update.Get().end()); } std::vector NTPBackgroundPrefs::GetCustomImageList() const { diff --git a/browser/permissions/mock_permission_lifetime_prompt.cc b/browser/permissions/mock_permission_lifetime_prompt.cc index cdf6afd42d70..5dc3790a979f 100644 --- a/browser/permissions/mock_permission_lifetime_prompt.cc +++ b/browser/permissions/mock_permission_lifetime_prompt.cc @@ -19,7 +19,9 @@ MockPermissionLifetimePrompt::~MockPermissionLifetimePrompt() { factory_->HideView(this); } -void MockPermissionLifetimePrompt::UpdateAnchor() {} +bool MockPermissionLifetimePrompt::UpdateAnchor() { + return false; +} PermissionPrompt::TabSwitchingBehavior MockPermissionLifetimePrompt::GetTabSwitchingBehavior() { diff --git a/browser/permissions/mock_permission_lifetime_prompt.h b/browser/permissions/mock_permission_lifetime_prompt.h index ebd8172e1347..4cd8277ec16d 100644 --- a/browser/permissions/mock_permission_lifetime_prompt.h +++ b/browser/permissions/mock_permission_lifetime_prompt.h @@ -19,7 +19,7 @@ class MockPermissionLifetimePrompt : public PermissionPrompt { ~MockPermissionLifetimePrompt() override; // PermissionPrompt: - void UpdateAnchor() override; + bool UpdateAnchor() override; TabSwitchingBehavior GetTabSwitchingBehavior() override; PermissionPromptDisposition GetPromptDisposition() const override; diff --git a/browser/permissions/permission_manager_browsertest.cc b/browser/permissions/permission_manager_browsertest.cc index f1831c966f98..809c8920217f 100644 --- a/browser/permissions/permission_manager_browsertest.cc +++ b/browser/permissions/permission_manager_browsertest.cc @@ -55,8 +55,8 @@ class PermissionRequestManagerObserver } // PermissionRequestManager::Observer: - void OnBubbleAdded() override { is_showing_bubble_ = true; } - void OnBubbleRemoved() override { is_showing_bubble_ = false; } + void OnPromptAdded() override { is_showing_bubble_ = true; } + void OnPromptRemoved() override { is_showing_bubble_ = false; } void OnRequestsFinalized() override { is_requests_finalized_ = true; } bool IsShowingBubble() { return is_showing_bubble_; } diff --git a/browser/resources/extensions/brave_item_list_more_items.ts b/browser/resources/extensions/brave_item_list_more_items.ts index 41e62bebc363..1c7b4e0a9399 100644 --- a/browser/resources/extensions/brave_item_list_more_items.ts +++ b/browser/resources/extensions/brave_item_list_more_items.ts @@ -3,33 +3,47 @@ * 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/. */ -// @ts-nocheck TODO(petemill): Convert to Polymer class and remove ts-nocheck - -import {I18nBehavior} from 'chrome://resources/cr_elements/i18n_behavior.js'; -import {Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js' +import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js' +import {I18nMixin, I18nMixinInterface} from 'chrome://resources/cr_elements/i18n_mixin.js' import 'chrome://resources/cr_elements/cr_shared_style.css.js' import 'chrome://resources/js/cr.m.js' import {getTemplate} from './brave_item_list_more_items.html.js' -Polymer({ - is: 'extensions-brave-item-list-more-items', +const ExtensionsBraveItemListMoreItemsElementBase = + I18nMixin(PolymerElement) as { + new(): PolymerElement & I18nMixinInterface + } + +export class ExtensionsBraveItemListMoreItemsElement extends ExtensionsBraveItemListMoreItemsElementBase { + static get is() { + return 'extensions-brave-item-list-more-items' + } - _template: getTemplate(), + static get template() { + return getTemplate() + } - behaviors: [I18nBehavior], + static get properties() { + return { + /** @type {!Array} */ + apps: Array, - properties: { - /** @type {!Array} */ - apps: Array, + /** @type {!Array} */ + extensions: Array, + }; + } - /** @type {!Array} */ - extensions: Array, - }, + private apps: chrome.developerPrivate.ExtensionInfo[]; + private extensions: chrome.developerPrivate.ExtensionInfo[]; - shouldShowMoreItemsMessage_: function() { + shouldShowMoreItemsMessage_() { if (!this.apps || !this.extensions) return; return this.apps.length !== 0 || this.extensions.length !== 0; - }, -}); + } +} + +customElements.define( + ExtensionsBraveItemListMoreItemsElement.is, ExtensionsBraveItemListMoreItemsElement) + diff --git a/browser/resources/extensions/brave_overrides/extensions_detail_view.ts b/browser/resources/extensions/brave_overrides/extensions_detail_view.ts index a2bf1bf0441a..0126b88a63e4 100644 --- a/browser/resources/extensions/brave_overrides/extensions_detail_view.ts +++ b/browser/resources/extensions/brave_overrides/extensions_detail_view.ts @@ -6,7 +6,7 @@ // @ts-nocheck TODO(petemill): Define types and remove ts-nocheck import {RegisterPolymerTemplateModifications, RegisterPolymerComponentBehaviors} from 'chrome://resources/polymer_overriding.js' -import {I18nBehavior} from 'chrome://resources/cr_elements/i18n_behavior.js' +import {I18nBehavior} from 'chrome://resources/i18n_behavior.js' RegisterPolymerTemplateModifications({ diff --git a/browser/resources/federated_internals/BUILD.gn b/browser/resources/federated_internals/BUILD.gn index b3b1cfd07b85..a0ad7ebb33b4 100644 --- a/browser/resources/federated_internals/BUILD.gn +++ b/browser/resources/federated_internals/BUILD.gn @@ -74,8 +74,8 @@ js_type_check("closure_compile") { js_library("federated_internals") { deps = [ ":federated_internals_browser_proxy", - "//ui/webui/resources/js:assert.m", - "//ui/webui/resources/js:util.m", + "//ui/webui/resources/js:assert", + "//ui/webui/resources/js:util", ] } @@ -83,7 +83,7 @@ js_library("federated_internals_browser_proxy") { deps = [ "//brave/browser/ui/webui/brave_federated:mojo_bindings_webui_js", "//brave/components/brave_federated/public/interfaces:interfaces_webui_js", - "//ui/webui/resources/js:assert.m", - "//ui/webui/resources/js:util.m", + "//ui/webui/resources/js:assert", + "//ui/webui/resources/js:util", ] } diff --git a/browser/resources/settings/brave_appearance_page/brave_theme.ts b/browser/resources/settings/brave_appearance_page/brave_theme.ts index fd98324427d5..3322359c4ec2 100644 --- a/browser/resources/settings/brave_appearance_page/brave_theme.ts +++ b/browser/resources/settings/brave_appearance_page/brave_theme.ts @@ -4,7 +4,7 @@ // you can obtain one at http://mozilla.org/MPL/2.0/. import {PolymerElement, html} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js' -import {WebUIListenerMixin, WebUIListenerMixinInterface} from 'chrome://resources/js/web_ui_listener_mixin.js' +import {WebUIListenerMixin, WebUIListenerMixinInterface} from 'chrome://resources/cr_elements/web_ui_listener_mixin.js' import {routes} from '../route.js' import {Router} from '../router.js' import 'chrome://resources/cr_elements/md_select.css.js'; diff --git a/browser/resources/settings/brave_appearance_page/sidebar.ts b/browser/resources/settings/brave_appearance_page/sidebar.ts index 15d8b2e8616a..b6be5c50f381 100644 --- a/browser/resources/settings/brave_appearance_page/sidebar.ts +++ b/browser/resources/settings/brave_appearance_page/sidebar.ts @@ -4,7 +4,7 @@ // you can obtain one at http://mozilla.org/MPL/2.0/. import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js' -import {I18nMixin, I18nMixinInterface} from 'chrome://resources/js/i18n_mixin.js' +import {I18nMixin, I18nMixinInterface} from 'chrome://resources/cr_elements/i18n_mixin.js' import {PrefsMixin, PrefsMixinInterface} from '../prefs/prefs_mixin.js' import '../settings_shared.css.js' import '../settings_vars.css.js' diff --git a/browser/resources/settings/brave_appearance_page/super_referral.ts b/browser/resources/settings/brave_appearance_page/super_referral.ts index 0fdf8eb73b24..c5c269314caa 100644 --- a/browser/resources/settings/brave_appearance_page/super_referral.ts +++ b/browser/resources/settings/brave_appearance_page/super_referral.ts @@ -4,8 +4,8 @@ // you can obtain one at http://mozilla.org/MPL/2.0/. import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {assert} from 'chrome://resources/js/assert.m.js'; -import {I18nMixin, I18nMixinInterface} from 'chrome://resources/js/i18n_mixin.js' +import {assert} from 'chrome://resources/js/assert.js'; +import {I18nMixin, I18nMixinInterface} from 'chrome://resources/cr_elements/i18n_mixin.js' import {loadTimeData} from "../i18n_setup.js" import {AppearanceBrowserProxy, AppearanceBrowserProxyImpl} from '../appearance_page/appearance_browser_proxy.js'; import {getTemplate} from './super_referral.html.js' diff --git a/browser/resources/settings/brave_appearance_page/toolbar.ts b/browser/resources/settings/brave_appearance_page/toolbar.ts index d42690469feb..8692105bf14c 100644 --- a/browser/resources/settings/brave_appearance_page/toolbar.ts +++ b/browser/resources/settings/brave_appearance_page/toolbar.ts @@ -4,7 +4,7 @@ // you can obtain one at http://mozilla.org/MPL/2.0/. import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {I18nMixin, I18nMixinInterface} from 'chrome://resources/js/i18n_mixin.js' +import {I18nMixin, I18nMixinInterface} from 'chrome://resources/cr_elements/i18n_mixin.js' import {loadTimeData} from "../i18n_setup.js" import '../settings_shared.css.js'; import '../settings_vars.css.js'; diff --git a/browser/resources/settings/brave_clear_browsing_data_dialog/brave_clear_browsing_data_dialog_behavior.ts b/browser/resources/settings/brave_clear_browsing_data_dialog/brave_clear_browsing_data_dialog_behavior.ts index 524934b523be..6b7b90597e15 100644 --- a/browser/resources/settings/brave_clear_browsing_data_dialog/brave_clear_browsing_data_dialog_behavior.ts +++ b/browser/resources/settings/brave_clear_browsing_data_dialog/brave_clear_browsing_data_dialog_behavior.ts @@ -8,7 +8,7 @@ import "./brave_clear_browsing_data_on_exit_page.js" import {loadTimeData} from "../i18n_setup.js" -import {WebUIListenerMixin} from 'chrome://resources/js/web_ui_listener_mixin.js'; +import {WebUIListenerMixin} from 'chrome://resources/cr_elements/web_ui_listener_mixin.js'; import {SettingsClearBrowsingDataDialogElement} from '../clear_browsing_data_dialog/clear_browsing_data_dialog.js' import type {SettingsClearBrowsingDataDialogElement as BraveSettingsClearBrowsingDataDialogElement} from '../clear_browsing_data_dialog/clear_browsing_data_dialog.js' diff --git a/browser/resources/settings/brave_default_extensions_page/brave_default_extensions_page.ts b/browser/resources/settings/brave_default_extensions_page/brave_default_extensions_page.ts index 1be4b1c056a0..bdc50e825416 100644 --- a/browser/resources/settings/brave_default_extensions_page/brave_default_extensions_page.ts +++ b/browser/resources/settings/brave_default_extensions_page/brave_default_extensions_page.ts @@ -4,7 +4,7 @@ // you can obtain one at http://mozilla.org/MPL/2.0/. import { PolymerElement } from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js' -import { WebUIListenerMixin, WebUIListenerMixinInterface } from 'chrome://resources/js/web_ui_listener_mixin.js' +import { WebUIListenerMixin, WebUIListenerMixinInterface } from 'chrome://resources/cr_elements/web_ui_listener_mixin.js' import {SettingsCheckboxElement} from '../controls/settings_checkbox.js'; import { loadTimeData } from '../i18n_setup.js'; import { PrefsMixin, PrefsMixinInterface } from '../prefs/prefs_mixin.js' diff --git a/browser/resources/settings/brave_help_tips_page/brave_help_tips_page.ts b/browser/resources/settings/brave_help_tips_page/brave_help_tips_page.ts index bd3e776660d5..7fdfc5ce5b0d 100644 --- a/browser/resources/settings/brave_help_tips_page/brave_help_tips_page.ts +++ b/browser/resources/settings/brave_help_tips_page/brave_help_tips_page.ts @@ -4,7 +4,7 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ import {html, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; - import {WebUIListenerMixin} from 'chrome://resources/js/web_ui_listener_mixin.js'; + import {WebUIListenerMixin} from 'chrome://resources/cr_elements/web_ui_listener_mixin.js'; import {PrefsMixin} from '../prefs/prefs_mixin.js'; import {getTemplate} from './brave_help_tips_page.html.js' diff --git a/browser/resources/settings/brave_ipfs_page/add_ipfs_peer_dialog.ts b/browser/resources/settings/brave_ipfs_page/add_ipfs_peer_dialog.ts index d00be6223847..81085dfe8330 100644 --- a/browser/resources/settings/brave_ipfs_page/add_ipfs_peer_dialog.ts +++ b/browser/resources/settings/brave_ipfs_page/add_ipfs_peer_dialog.ts @@ -3,52 +3,66 @@ // 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/. -// @ts-nocheck TODO(petemill): Convert to Polymer class and remove ts-nocheck - import 'chrome://resources/cr_elements/cr_button/cr_button.js'; import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; -import 'chrome://resources/cr_elements/cr_input/cr_input.js'; -import {Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {I18nBehavior} from 'chrome://resources/cr_elements/i18n_behavior.js'; +import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {I18nMixin, I18nMixinInterface} from 'chrome://resources/cr_elements/i18n_mixin.js' +import {BaseMixin} from '../base_mixin.js' import {BraveIPFSBrowserProxyImpl} from './brave_ipfs_browser_proxy.js'; +import {CrInputElement} from 'chrome://resources/cr_elements/cr_input/cr_input.js' import {getTemplate} from './add_ipfs_peer_dialog.html.js' -Polymer({ - is: 'add-ipfs-peer-dialog', +const SettingsBraveIpfsPeersDialogElementBase = + I18nMixin(BaseMixin(PolymerElement)) as { + new(): PolymerElement & I18nMixinInterface + } + +export interface PeersListItem { + name: string; + value: string; +} - _template: getTemplate(), +export interface SettingsBraveIpfsPeersDialogElement { + $: { + peer: CrInputElement, + }; +} - behaviors: [ - I18nBehavior - ], +export class SettingsBraveIpfsPeersDialogElement extends SettingsBraveIpfsPeersDialogElementBase { + static get is() { + return 'add-ipfs-peer-dialog' + } - properties: { - validValue_: Boolean, + static get template() { + return getTemplate() + } - peers: { - type: Array, - value() { - return []; + static get properties() { + return { + validValue_: Boolean, + + peers: { + type: Array, + value() { + return []; + }, }, - }, - isSubmitButtonEnabled_: { - type: Boolean, - value: false, - } - }, + isSubmitButtonEnabled_: { + type: Boolean, + value: false, + } + }; + } - browserProxy_: null, + private validValue_: boolean; + private peers: PeersListItem[]; + private isSubmitButtonEnabled_: boolean; - /** @override */ - created: function() { - this.browserProxy_ = BraveIPFSBrowserProxyImpl.getInstance(); - this.needToApply = true; - }, + browserProxy_: BraveIPFSBrowserProxyImpl = BraveIPFSBrowserProxyImpl.getInstance(); - /** @private */ - nameChanged_: function() { + nameChanged_() { const value = this.$.peer.value.trim() // Disable the submit button if input text is empty if (value == '') { @@ -62,7 +76,7 @@ Polymer({ } let parts = value.split("/p2p/"); let has_address = parts.length === 2 - var result = this.peers.find(function(element, index) { + var result = this.peers.find((element: PeersListItem) => { if (has_address) { return element.value == parts[0]; } else return element.name == parts[0]; @@ -70,14 +84,18 @@ Polymer({ let valid = result === undefined this.validValue_ = valid; this.isSubmitButtonEnabled_ = valid; - }, - handleSubmit_: function() { + } + + handleSubmit_() { var value = this.$.peer.value - this.browserProxy_.addIpfsPeer(value).then(success => { + this.browserProxy_.addIpfsPeer(value).then((success: boolean) => { this.validValue_ = success; if (success) { - this.fire('close') + this.dispatchEvent(new CustomEvent('close')); } }); - }, -}); + } +} + +customElements.define( + SettingsBraveIpfsPeersDialogElement.is, SettingsBraveIpfsPeersDialogElement) diff --git a/browser/resources/settings/brave_ipfs_page/add_p2p_key_dialog.ts b/browser/resources/settings/brave_ipfs_page/add_p2p_key_dialog.ts index c300b4a729b4..94838e01496c 100644 --- a/browser/resources/settings/brave_ipfs_page/add_p2p_key_dialog.ts +++ b/browser/resources/settings/brave_ipfs_page/add_p2p_key_dialog.ts @@ -3,51 +3,66 @@ // 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/. -// @ts-nocheck TODO(petemill): Convert to Polymer class and remove ts-nocheck - import 'chrome://resources/cr_elements/cr_button/cr_button.js'; import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; -import 'chrome://resources/cr_elements/cr_input/cr_input.js'; -import {Polymer, html} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {I18nBehavior} from 'chrome://resources/cr_elements/i18n_behavior.js'; +import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {I18nMixin, I18nMixinInterface} from 'chrome://resources/cr_elements/i18n_mixin.js' +import {BaseMixin} from '../base_mixin.js' import {BraveIPFSBrowserProxyImpl} from './brave_ipfs_browser_proxy.js'; +import {CrInputElement} from 'chrome://resources/cr_elements/cr_input/cr_input.js' import {getTemplate} from './add_p2p_key_dialog.html.js' -Polymer({ - is: 'add-p2p-key-dialog', +const SettingsBraveAddP2pKeyDialogElementBase = + I18nMixin(BaseMixin(PolymerElement)) as { + new(): PolymerElement & I18nMixinInterface + } + +export interface KeysListItem { + name: string; + value: string; +} - _template: getTemplate(), +export interface SettingsBraveAddP2pKeyDialogElement { + $: { + key: CrInputElement, + } +} - behaviors: [ - I18nBehavior - ], +export class SettingsBraveAddP2pKeyDialogElement extends SettingsBraveAddP2pKeyDialogElementBase { + static get is() { + return 'add-p2p-key-dialog' + } - properties: { - isNameValid_: Boolean, + static get template() { + return getTemplate() + } - keys: { - type: Array, - value() { - return []; + static get properties() { + return { + isNameValid_: Boolean, + + keys: { + type: Array, + value() { + return []; + }, }, - }, - isSubmitButtonEnabled_: { - type: Boolean, - value: false, - } - }, + isSubmitButtonEnabled_: { + type: Boolean, + value: false, + } + }; + } - browserProxy_: null, + private isNameValid_: boolean; + private keys: KeysListItem[]; + private isSubmitButtonEnabled_: boolean; - /** @override */ - created: function() { - this.browserProxy_ = BraveIPFSBrowserProxyImpl.getInstance(); - }, + browserProxy_: BraveIPFSBrowserProxyImpl = BraveIPFSBrowserProxyImpl.getInstance(); - /** @private */ - nameChanged_: function() { + nameChanged_() { const name = this.$.key.value.trim() // Disable the submit button if input text is empty but don't show the name // invalid error message. @@ -61,28 +76,33 @@ Polymer({ this.isSubmitButtonEnabled_ = false; return; } - var result = this.keys.find(function(element, index) { + var result = this.keys.find(function(element) { return element.name == name; }); let value = result === undefined this.isNameValid_ = value; this.isSubmitButtonEnabled_ = value; - }, - onImportKeyTap_: function(item) { + } + + onImportKeyTap_() { this.browserProxy_.importIpnsKey(this.$.key.value) - this.fire('close'); - }, - handleSubmit_: function() { + this.dispatchEvent(new CustomEvent('close')); + } + + handleSubmit_() { var name = this.$.key.value - this.browserProxy_.addIpnsKey(name).then(json => { + this.browserProxy_.addIpnsKey(name).then((json: string) => { if (!json) return; var added = JSON.parse(json); if (added.name === name) { - this.fire('close'); + this.dispatchEvent(new CustomEvent('close')); return; } this.isNameValid_ = false; }); - }, -}); + } +} + +customElements.define( + SettingsBraveAddP2pKeyDialogElement.is, SettingsBraveAddP2pKeyDialogElement) diff --git a/browser/resources/settings/brave_ipfs_page/brave_ipfs_browser_proxy.ts b/browser/resources/settings/brave_ipfs_page/brave_ipfs_browser_proxy.ts index 1808182afdf3..01a3c00539a3 100644 --- a/browser/resources/settings/brave_ipfs_page/brave_ipfs_browser_proxy.ts +++ b/browser/resources/settings/brave_ipfs_page/brave_ipfs_browser_proxy.ts @@ -27,7 +27,7 @@ export class BraveIPFSBrowserProxyImpl { } launchIPFSService () { - return new Promise(resolve => { + return new Promise(resolve => { if (!chrome.ipfs) { resolve(false) return @@ -37,7 +37,7 @@ export class BraveIPFSBrowserProxyImpl { } shutdownIPFSService () { - return new Promise(resolve => { + return new Promise(resolve => { if (!chrome.ipfs) { resolve(false) return @@ -47,7 +47,7 @@ export class BraveIPFSBrowserProxyImpl { } getIPFSResolveMethodList () { - return new Promise(resolve => { + return new Promise(resolve => { if (!chrome.ipfs) { resolve(false) return @@ -56,8 +56,8 @@ export class BraveIPFSBrowserProxyImpl { }) } - removeIpfsPeer (id, address) { - return new Promise(resolve => { + removeIpfsPeer (id: string, address: string) { + return new Promise(resolve => { if (!chrome.ipfs) { resolve(false) return @@ -67,7 +67,7 @@ export class BraveIPFSBrowserProxyImpl { } getIpfsPeersList () { - return new Promise(resolve => { + return new Promise(resolve => { if (!chrome.ipfs) { resolve(false) return @@ -76,8 +76,8 @@ export class BraveIPFSBrowserProxyImpl { }) } - addIpfsPeer (value) { - return new Promise(resolve => { + addIpfsPeer (value: string) { + return new Promise(resolve => { if (!chrome.ipfs) { resolve(false) return @@ -87,7 +87,7 @@ export class BraveIPFSBrowserProxyImpl { } getIpnsKeysList () { - return new Promise(resolve => { + return new Promise(resolve => { if (!chrome.ipfs) { resolve(false) return @@ -96,8 +96,8 @@ export class BraveIPFSBrowserProxyImpl { }) } - rotateKey (name) { - return new Promise(resolve => { + rotateKey (name: string) { + return new Promise(resolve => { if (!chrome.ipfs) { resolve(false) return @@ -106,8 +106,8 @@ export class BraveIPFSBrowserProxyImpl { }) } - addIpnsKey (name) { - return new Promise(resolve => { + addIpnsKey (name: string) { + return new Promise(resolve => { if (!chrome.ipfs) { resolve(false) return @@ -116,8 +116,8 @@ export class BraveIPFSBrowserProxyImpl { }) } - removeIpnsKey (name) { - return new Promise(resolve => { + removeIpnsKey (name: string) { + return new Promise(resolve => { if (!chrome.ipfs) { resolve(false) return @@ -127,7 +127,7 @@ export class BraveIPFSBrowserProxyImpl { } getIPFSEnabled () { - return new Promise(resolve => { + return new Promise(resolve => { if (!chrome.ipfs) { resolve(false) return @@ -136,8 +136,8 @@ export class BraveIPFSBrowserProxyImpl { }) } - validateGatewayUrl (url) { - return new Promise(resolve => { + validateGatewayUrl (url: string) { + return new Promise(resolve => { if (!chrome.ipfs) { resolve(false) return diff --git a/browser/resources/settings/brave_ipfs_page/brave_ipfs_page.ts b/browser/resources/settings/brave_ipfs_page/brave_ipfs_page.ts index 3258ae286472..d6fad0750792 100644 --- a/browser/resources/settings/brave_ipfs_page/brave_ipfs_page.ts +++ b/browser/resources/settings/brave_ipfs_page/brave_ipfs_page.ts @@ -6,7 +6,7 @@ // @ts-nocheck TODO(petemill): Define types and remove ts-nocheck import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {WebUIListenerMixin} from 'chrome://resources/js/web_ui_listener_mixin.js'; +import {WebUIListenerMixin} from 'chrome://resources/cr_elements/web_ui_listener_mixin.js'; import {Router, RouteObserverMixin} from '../router.js'; import {BraveIPFSBrowserProxyImpl} from './brave_ipfs_browser_proxy.js'; import {PrefsMixin} from '../prefs/prefs_mixin.js'; diff --git a/browser/resources/settings/brave_ipfs_page/change_ipfs_gateway_dialog.ts b/browser/resources/settings/brave_ipfs_page/change_ipfs_gateway_dialog.ts index d2c556678938..707d5918fd03 100644 --- a/browser/resources/settings/brave_ipfs_page/change_ipfs_gateway_dialog.ts +++ b/browser/resources/settings/brave_ipfs_page/change_ipfs_gateway_dialog.ts @@ -15,7 +15,7 @@ import 'chrome://resources/cr_elements/cr_button/cr_button.js'; import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js'; +import {I18nMixin} from 'chrome://resources/cr_elements/i18n_mixin.js'; import {PrefsMixin} from '../prefs/prefs_mixin.js'; import '../settings_shared.css.js'; import {BraveIPFSBrowserProxyImpl} from './brave_ipfs_browser_proxy.js'; diff --git a/browser/resources/settings/brave_ipfs_page/ipfs_peers_subpage.ts b/browser/resources/settings/brave_ipfs_page/ipfs_peers_subpage.ts index 254c59e2f6dc..15dde6c54a1f 100644 --- a/browser/resources/settings/brave_ipfs_page/ipfs_peers_subpage.ts +++ b/browser/resources/settings/brave_ipfs_page/ipfs_peers_subpage.ts @@ -3,121 +3,141 @@ // 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/. -// @ts-nocheck TODO(petemill): Convert to Polymer class and remove ts-nocheck - import 'chrome://resources/cr_elements/cr_link_row/cr_link_row.js' import '../settings_page/settings_section.js' import '../settings_shared.css.js' import '../settings_vars.css.js' import './add_ipfs_peer_dialog.js' -import {Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {I18nBehavior} from 'chrome://resources/cr_elements/i18n_behavior.js'; -import {WebUIListenerBehavior} from 'chrome://resources/cr_elements/web_ui_listener_behavior.js'; +import {DomRepeatEvent, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {I18nMixin, I18nMixinInterface} from 'chrome://resources/cr_elements/i18n_mixin.js' +import {WebUIListenerMixin, WebUIListenerMixinInterface} from 'chrome://resources/cr_elements/web_ui_listener_mixin.js'; import {BraveIPFSBrowserProxyImpl} from './brave_ipfs_browser_proxy.js'; +import {BaseMixin} from '../base_mixin.js' import {getTemplate} from './ipfs_peers_subpage.html.js' +import {IronListElement} from 'chrome://resources/polymer/v3_0/iron-list/iron-list.js'; /** * @fileoverview * 'settings-sync-subpage' is the settings page content */ -Polymer({ - is: 'settings-ipfs-peers-subpage', - - _template: getTemplate(), - - behaviors: [ - I18nBehavior, - WebUIListenerBehavior - ], - - properties: { - /** - * Array of sites to display in the widget. - * @type {!Array} - */ - peers: { - type: Array, - value() { - return []; + +const SettingsBraveIpfsPeersSubpageElementBase = + I18nMixin(WebUIListenerMixin(BaseMixin(PolymerElement))) as { + new(): PolymerElement & WebUIListenerMixinInterface & I18nMixinInterface + } + +export interface PeersListItem { + name: string; + value: string; +} + +export interface SettingsBraveIpfsPeersSubpageElement { + $: { + peersList: IronListElement, + } +} + +export class SettingsBraveIpfsPeersSubpageElement extends SettingsBraveIpfsPeersSubpageElementBase { + static get is() { + return 'settings-ipfs-peers-subpage' + } + + static get template() { + return getTemplate() + } + + static get properties() { + return { + peers: { + type: Array, + value() { + return []; + }, }, - }, - needToApply: { - type: Boolean, - value: false, - reflectToAttribute: true - }, - localNodeLaunched: { - type: Boolean, - value: false - }, - localNodeLaunchError_: { - type: Boolean, - value: false, - }, - showAddPeerDialog_: { - type: Boolean, - value: false, - }, - nodeRestarting_: { - type: Boolean, - value: false, - } - }, + needToApply: { + type: Boolean, + value: false, + reflectToAttribute: true + }, + localNodeLaunched: { + type: Boolean, + value: false + }, + localNodeLaunchError_: { + type: Boolean, + value: false, + }, + showAddPeerDialog_: { + type: Boolean, + value: false, + }, + nodeRestarting_: { + type: Boolean, + value: false, + } + }; + } + + private peers: PeersListItem[]; + private needToApply: boolean; + private localNodeLaunched: boolean; + private localNodeLaunchError_: boolean; + private showAddPeerDialog_: boolean; + private nodeRestarting_: boolean; - browserProxy_: null, + browserProxy_: BraveIPFSBrowserProxyImpl = BraveIPFSBrowserProxyImpl.getInstance(); - /** @override */ - created: function() { - this.browserProxy_ = BraveIPFSBrowserProxyImpl.getInstance(); - this.addWebUIListener('brave-ipfs-node-status-changed', (launched) => { + override ready() { + super.ready() + this.addWebUIListener('brave-ipfs-node-status-changed', (launched: boolean) => { this.onServiceLaunched(launched) }) - }, - toggleUILayout: function(launched) { + this.onServiceLaunched(this.localNodeLaunched) + this.updatePeers(); + } + + private toggleUILayout(launched: boolean) { this.localNodeLaunched = launched if (launched) { this.localNodeLaunchError_ = false } else { this.showAddPeerDialog_ = false } - }, - onServiceLaunched: function(success) { + } + + private onServiceLaunched(success: boolean) { this.toggleUILayout(success) if (success) { this.updatePeers(); } - }, - onRestartNodeTap_: function() { + } + + private onRestartNodeTap() { this.nodeRestarting_ = true this.localNodeLaunchError_ = false this.browserProxy_.shutdownIPFSService().then(() => { this.browserProxy_.launchIPFSService().then(success => { - this.isLocalNodeLaunched_ = success + this.localNodeLaunched = success this.localNodeLaunchError_ = !success this.needToApply = !success this.nodeRestarting_ = false }) }) - }, - notifyPeerslist: function() { - const peersList = - /** @type {IronListElement} */ (this.$$('#peersList')); - if (peersList) { - peersList.notifyResize(); + } + + private notifyPeerslist() { + if (this.$.peersList) { + this.$.peersList.notifyResize(); } - }, - /*++++++ - * @override */ - ready: function() { - this.onServiceLaunched(this.localNodeLaunched) - this.updatePeers(); - }, - onAddPeerTap_: function(item) { + } + + private onAddPeerTap_() { this.showAddPeerDialog_ = true - }, - updatePeers: function() { - this.browserProxy_.getIpfsPeersList().then(peers => { + } + + private updatePeers() { + this.browserProxy_.getIpfsPeersList().then((peers: string) => { if (!peers) return; let currentSize = this.peers.length @@ -127,14 +147,14 @@ Polymer({ } this.notifyPeerslist(); }); - }, + } - onAddPeerDialogClosed_: function(value) { + private onAddPeerDialogClosed_() { this.showAddPeerDialog_ = false this.updatePeers(); - }, + } - onPeerDeleteTapped_: function(event) { + private onPeerDeleteTapped_(event: DomRepeatEvent) { let id_to_remove = event.model.item.name let address_to_remove = event.model.item.value var message = this.i18n('ipfsDeletePeerConfirmation', id_to_remove) @@ -147,4 +167,7 @@ Polymer({ } }); } -}) +} + +customElements.define( + SettingsBraveIpfsPeersSubpageElement.is, SettingsBraveIpfsPeersSubpageElement) diff --git a/browser/resources/settings/brave_ipfs_page/p2p_keys_subpage.html b/browser/resources/settings/brave_ipfs_page/p2p_keys_subpage.html index 1b2ac0fa35a1..57fd87256888 100644 --- a/browser/resources/settings/brave_ipfs_page/p2p_keys_subpage.html +++ b/browser/resources/settings/brave_ipfs_page/p2p_keys_subpage.html @@ -51,7 +51,7 @@
$i18n{ipfsKeysListTitle} - @@ -59,7 +59,7 @@
-
+ + + diff --git a/browser/resources/settings/brave_ipfs_page/p2p_keys_subpage.ts b/browser/resources/settings/brave_ipfs_page/p2p_keys_subpage.ts index 100d7fee78d0..b3023578070e 100644 --- a/browser/resources/settings/brave_ipfs_page/p2p_keys_subpage.ts +++ b/browser/resources/settings/brave_ipfs_page/p2p_keys_subpage.ts @@ -2,8 +2,6 @@ * 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/. */ -// @ts-nocheck TODO(petemill): Convert to Polymer class and remove ts-nocheck - import 'chrome://resources/cr_elements/cr_link_row/cr_link_row.js' import '../settings_page/settings_section.js' import '../settings_shared.css.js' @@ -11,94 +9,120 @@ import '../settings_vars.css.js' import './rotate_p2p_key_dialog.js' import './add_p2p_key_dialog.js' -import {Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {I18nBehavior} from 'chrome://resources/cr_elements/i18n_behavior.js'; -import {WebUIListenerBehavior} from 'chrome://resources/cr_elements/web_ui_listener_behavior.js'; +import {DomRepeatEvent, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {I18nMixin, I18nMixinInterface} from 'chrome://resources/cr_elements/i18n_mixin.js' +import {WebUIListenerMixin, WebUIListenerMixinInterface} from 'chrome://resources/cr_elements/web_ui_listener_mixin.js'; +import {BaseMixin} from '../base_mixin.js' import {BraveIPFSBrowserProxyImpl} from './brave_ipfs_browser_proxy.js'; import {getTemplate} from './p2p_keys_subpage.html.js' - -(function() { - 'use strict'; +import {IronListElement} from 'chrome://resources/polymer/v3_0/iron-list/iron-list.js'; +import {CrLazyRenderElement} from 'chrome://resources/cr_elements/cr_lazy_render/cr_lazy_render.js'; +import {CrActionMenuElement} from 'chrome://resources/cr_elements/cr_action_menu/cr_action_menu.js'; /** * @fileoverview * 'settings-sync-subpage' is the settings page content */ -Polymer({ - is: 'settings-p2p-keys-subpage', - - _template: getTemplate(), - - behaviors: [ - I18nBehavior, - WebUIListenerBehavior - ], - - properties: { - /** - * Array of sites to display in the widget. - * @type {!Array} - */ - keys: { - type: Array, - value() { - return []; + +const SettingsBraveP2pKeysSubpageElementBase = + I18nMixin(WebUIListenerMixin(BaseMixin(PolymerElement))) as { + new(): PolymerElement & WebUIListenerMixinInterface & I18nMixinInterface + } + +export interface KeysListItem { + name: string; + value: string; +} + +export interface SettingsBraveP2pKeysSubpageElement { + $: { + keysList: IronListElement, + keyMenu: CrLazyRenderElement, + keyError: HTMLDivElement + } +} + +export class SettingsBraveP2pKeysSubpageElement extends SettingsBraveP2pKeysSubpageElementBase { + static get is() { + return 'settings-p2p-keys-subpage' + } + + static get template() { + return getTemplate() + } + + static get properties() { + return { + keys: { + type: Array, + value() { + return []; + }, }, - }, - localNodeMethod: { - type: Boolean, - value: false, - reflectToAttribute: true - }, - localNodeLaunched: { - type: Boolean, - value: false - }, - launchNodeButtonEnabled_: { - type: Boolean, - value: true, - }, - localNodeLaunchError_: { - type: Boolean, - value: false, - }, - actionKeysError_: { - type: Boolean, - value: false, - }, - showAddp2pKeyDialog_: { - type: Boolean, - value: false, - }, - showRotatep2pKeyDialog_: { - type: Boolean, - value: false, - } - }, - - browserProxy_: null, - actionItemName : String, - /** @override */ - created: function() { - this.browserProxy_ = BraveIPFSBrowserProxyImpl.getInstance(); - this.addWebUIListener('brave-ipfs-node-status-changed', (launched) => { + localNodeMethod: { + type: Boolean, + value: false, + reflectToAttribute: true + }, + localNodeLaunched: { + type: Boolean, + value: false + }, + launchNodeButtonEnabled_: { + type: Boolean, + value: true, + }, + localNodeLaunchError_: { + type: Boolean, + value: false, + }, + actionKeysError_: { + type: Boolean, + value: false, + }, + showAddp2pKeyDialog_: { + type: Boolean, + value: false, + }, + showRotatep2pKeyDialog_: { + type: Boolean, + value: false, + } + }; + } + + private keys: KeysListItem[]; + private localNodeMethod: boolean; + private localNodeLaunched: boolean; + private launchNodeButtonEnabled_: boolean; + private localNodeLaunchError_: boolean; + private actionKeysError_: boolean; + private showAddp2pKeyDialog_: boolean; + private showRotatep2pKeyDialog_: boolean; + private actionItemName: string + + browserProxy_: BraveIPFSBrowserProxyImpl = BraveIPFSBrowserProxyImpl.getInstance(); + + override ready() { + super.ready() + this.addWebUIListener('brave-ipfs-node-status-changed', (launched: boolean) => { this.onServiceLaunched(launched) }) - this.addWebUIListener('brave-ipfs-keys-loaded', (success) => { + this.addWebUIListener('brave-ipfs-keys-loaded', () => { this.updateKeys() }) - this.addWebUIListener('brave-ipfs-key-exported', (key, success) => { + this.addWebUIListener('brave-ipfs-key-exported', (key: string, success: boolean) => { this.actionKeysError_ = !success - if (this.actionKeysError_ ) { - const errorLabel = (this.$$('#key-error')); + if (this.actionKeysError_) { + const errorLabel = (this.$.keyError); errorLabel.textContent = this.i18n('ipfsKeyExportError', key) return; } }) - this.addWebUIListener('brave-ipfs-key-imported', (key, value, success) => { + this.addWebUIListener('brave-ipfs-key-imported', (key: string, success: boolean) => { this.actionKeysError_ = !success if (this.actionKeysError_ ) { - const errorLabel = (this.$$('#key-error')); + const errorLabel = (this.$.keyError); errorLabel.textContent = this.i18n('ipfsImporKeysError', key) return; } @@ -109,18 +133,19 @@ Polymer({ this.onLoad_() } this.browserProxy_.notifyIpfsNodeStatus(); - }, - onLoad_: function() { + } + + onLoad_() { this.updateKeys(); - }, - notifyKeylist: function() { - const keysList = - /** @type {IronListElement} */ (this.$$('#keysList')); - if (keysList) { - keysList.notifyResize(); + } + + notifyKeylist() { + if (this.$.keysList) { + this.$.keysList.notifyResize(); } - }, - toggleUILayout: function(launched) { + } + + toggleUILayout(launched: boolean) { this.launchNodeButtonEnabled_ = !launched; this.localNodeLaunched = launched this.actionKeysError_ = false @@ -129,73 +154,73 @@ Polymer({ } else { this.showAddp2pKeyDialog_ = false } - }, + } - onServiceLaunched: function(success) { + onServiceLaunched(success: boolean) { this.toggleUILayout(success) this.localNodeMethod = success if (success) { this.updateKeys(); } - }, + } - onStartNodeKeyTap_: function() { + onStartNodeKeyTap_() { this.launchNodeButtonEnabled_ = false; - this.browserProxy_.launchIPFSService().then((success) => { + this.browserProxy_.launchIPFSService().then((success: boolean) => { this.localNodeLaunchError_ = !success; this.onServiceLaunched(success) }); - }, + } - isDefaultKey_: function(name) { + isDefaultKey_(name: string) { return name == 'self'; - }, + } - getIconForKey: function(name) { + getIconForKey(name: string) { return name == 'self' ? 'icon-button-self' : 'icon-button' - }, + } - onAddKeyTap_: function(item) { + onAddKeyTap_() { this.showAddp2pKeyDialog_ = true - }, + } - onRotateKeyDialogClosed_: function() { + onRotateKeyDialogClosed_() { this.showRotatep2pKeyDialog_ = false this.updateKeys(); - }, + } - updateKeys: function() { - this.browserProxy_.getIpnsKeysList().then(keys => { + updateKeys() { + this.browserProxy_.getIpnsKeysList().then((keys: string) => { if (!keys) return; - this.keys_ = JSON.parse(keys); + this.keys = JSON.parse(keys); this.toggleUILayout(true) this.notifyKeylist(); }); - }, + } - onAddKeyDialogClosed_: function() { + onAddKeyDialogClosed_() { this.showAddp2pKeyDialog_ = false this.actionItemName = "" this.updateKeys(); - }, + } - onKeyActionTapped_: function(event) { + onKeyActionTapped_(event: DomRepeatEvent) { let name = event.model.item.name if (name != 'self') return; this.showRotatep2pKeyDialog_ = true return; - }, + } - onKeyDeleteTapped_: function(event) { - this.$$('cr-action-menu').close(); + onKeyDeleteTapped_() { + this.$.keyMenu.get().close(); let name_to_remove = this.actionItemName var message = this.i18n('ipfsDeleteKeyConfirmation', name_to_remove) if (!window.confirm(message)) return - this.browserProxy_.removeIpnsKey(name_to_remove).then(removed_name => { + this.browserProxy_.removeIpnsKey(name_to_remove).then((removed_name: string) => { if (!removed_name) return; if (removed_name === name_to_remove) { @@ -204,20 +229,21 @@ Polymer({ } }); this.actionItemName = "" - }, + } - onExportTap_: function(event) { + onExportTap_() { let name_to_export = this.actionItemName - this.$$('cr-action-menu').close(); + this.$.keyMenu.get().close(); this.browserProxy_.exportIPNSKey(name_to_export); this.actionItemName = "" - }, + } - onKeyMenuTapped_: function(event) { - this.actionItemName = event.model.item.name - const actionMenu = - /** @type {!CrActionMenuElement} */ (this.$$('#key-menu').get()); - actionMenu.showAt(event.target); + onKeyMenuTapped_(event: DomRepeatEvent) { + this.actionItemName = event.model.item.name; + const actionMenu = this.$.keyMenu.get(); + actionMenu.showAt(event.target as HTMLElement); } -}); -})(); +} + +customElements.define( + SettingsBraveP2pKeysSubpageElement.is, SettingsBraveP2pKeysSubpageElement) diff --git a/browser/resources/settings/brave_ipfs_page/rotate_p2p_key_dialog.ts b/browser/resources/settings/brave_ipfs_page/rotate_p2p_key_dialog.ts index 612c80eb0fda..260481bb8bcf 100644 --- a/browser/resources/settings/brave_ipfs_page/rotate_p2p_key_dialog.ts +++ b/browser/resources/settings/brave_ipfs_page/rotate_p2p_key_dialog.ts @@ -3,63 +3,84 @@ // 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/. -// @ts-nocheck TODO(petemill): Convert to Polymer class and remove ts-nocheck - import 'chrome://resources/cr_elements/cr_button/cr_button.js' import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js' -import 'chrome://resources/cr_elements/cr_input/cr_input.js' -import {Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js' -import {I18nBehavior} from 'chrome://resources/cr_elements/i18n_behavior.js' +import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js' +import {I18nMixin, I18nMixinInterface} from 'chrome://resources/cr_elements/i18n_mixin.js' +import { BaseMixin } from '../base_mixin.js' import {BraveIPFSBrowserProxyImpl} from './brave_ipfs_browser_proxy.js' +import {CrInputElement} from 'chrome://resources/cr_elements/cr_input/cr_input.js' import {getTemplate} from './rotate_p2p_key_dialog.html.js' -Polymer({ - is: 'rotate-p2p-key-dialog', - - _template: getTemplate(), - - behaviors: [ - I18nBehavior - ], - - properties: { - isAllowed_: Boolean, - errorText_: String, - - showError_: { - type: Boolean, - value: false, - }, +const SettingsBraveRotateP2pKeyDialogElementBase = + I18nMixin(BaseMixin(PolymerElement)) as { + new(): PolymerElement & I18nMixinInterface + } + +export interface KeysListItem { + name: string; + value: string; +} + +export interface SettingsBraveRotateP2pKeyDialogElement { + $: { + key: CrInputElement, + } +} + +export class SettingsBraveRotateP2pKeyDialogElement extends SettingsBraveRotateP2pKeyDialogElementBase { + static get is() { + return 'rotate-p2p-key-dialog' + } + + static get template() { + return getTemplate() + } + + static get properties() { + return { + isAllowed_: Boolean, + errorText_: String, + + showError_: { + type: Boolean, + value: false, + }, - keys: { - type: Array, - value() { - return []; + keys: { + type: Array, + value() { + return []; + }, }, - }, - isSubmitButtonEnabled_: { - type: Boolean, - value: false, - } - }, + isSubmitButtonEnabled_: { + type: Boolean, + value: false, + } + }; + } - browserProxy_: null, + private isAllowed_: boolean; + private errorText_: string; + private showError_: boolean; + private keys: KeysListItem[]; + private isSubmitButtonEnabled_: boolean; - /** @override */ - created: function() { - this.browserProxy_ = BraveIPFSBrowserProxyImpl.getInstance(); + browserProxy_: BraveIPFSBrowserProxyImpl = BraveIPFSBrowserProxyImpl.getInstance(); + + override ready() { + super.ready() this.showError(false, "") - }, + } - showError: function(show, error) { + showError(show: boolean, error: string) { this.errorText_ = error ? this.i18n(error) : "" this.showError_ = show - }, + } - /** @private */ - nameChanged_: function() { + nameChanged_() { this.showError(false, "") const name = this.$.key.value.trim() // Disable the submit button if input text is empty but don't show the name @@ -74,41 +95,44 @@ Polymer({ this.isSubmitButtonEnabled_ = false; return; } - var result = this.keys.find(function(element, index) { + var result = this.keys.find((element: KeysListItem) => { return element.name == name; }); let value = result === undefined this.isAllowed_ = value this.isSubmitButtonEnabled_ = value; - }, + } - launchService: function() { - this.browserProxy_.launchIPFSService().then((launched) => { + launchService() { + this.browserProxy_.launchIPFSService().then((launched: boolean) => { if (!launched) { this.showError(true, "ipfsRotationLaunchError"); return; } if (launched) { - this.fire('close'); + this.dispatchEvent(new CustomEvent('close')); } }); - }, + } - rotateKey: function(name) { - this.browserProxy_.rotateKey(name).then((success) => { + rotateKey(name: string) { + this.browserProxy_.rotateKey(name).then(() => { this.launchService(); }); - }, + } - handleSubmit_: function() { + handleSubmit_() { this.showError(false, ""); var name = this.$.key.value - this.browserProxy_.shutdownIPFSService().then((launched) => { + this.browserProxy_.shutdownIPFSService().then((launched: boolean) => { if (!launched) { this.showError(true, "ipfsRotationStopError") return; } this.rotateKey(name); }) - }, -}); + } +} + +customElements.define( + SettingsBraveRotateP2pKeyDialogElement.is, SettingsBraveRotateP2pKeyDialogElement) diff --git a/browser/resources/settings/brave_new_tab_page/brave_new_tab_browser_proxy.ts b/browser/resources/settings/brave_new_tab_page/brave_new_tab_browser_proxy.ts index 28c5e7683083..df84351c3cc0 100644 --- a/browser/resources/settings/brave_new_tab_page/brave_new_tab_browser_proxy.ts +++ b/browser/resources/settings/brave_new_tab_page/brave_new_tab_browser_proxy.ts @@ -8,10 +8,11 @@ export type NewTabOption = { name: string value: number // corresponds to NewTabPageShowsOptions enum } + export interface BraveNewTabBrowserProxy { - getNewTabShowsOptionsList(): Promise - shouldShowNewTabDashboardSettings(): Promise - } + getNewTabShowsOptionsList(): Promise + shouldShowNewTabDashboardSettings(): Promise +} export class BraveNewTabBrowserProxyImpl implements BraveNewTabBrowserProxy { getNewTabShowsOptionsList() { @@ -28,4 +29,3 @@ export class BraveNewTabBrowserProxyImpl implements BraveNewTabBrowserProxy { } let instance: BraveNewTabBrowserProxyImpl|null = null - diff --git a/browser/resources/settings/brave_new_tab_page/brave_new_tab_page.ts b/browser/resources/settings/brave_new_tab_page/brave_new_tab_page.ts index d28dc07ad2bc..57fadebe94ed 100644 --- a/browser/resources/settings/brave_new_tab_page/brave_new_tab_page.ts +++ b/browser/resources/settings/brave_new_tab_page/brave_new_tab_page.ts @@ -3,56 +3,62 @@ // 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/. -// @ts-nocheck TODO(petemill): Convert to Polymer class and remove ts-nocheck - -import {Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {WebUIListenerBehavior} from 'chrome://resources/cr_elements/web_ui_listener_behavior.js'; -import {BraveNewTabBrowserProxyImpl} from './brave_new_tab_browser_proxy.js' +import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {WebUIListenerMixin, WebUIListenerMixinInterface} from 'chrome://resources/cr_elements/web_ui_listener_mixin.js'; +import {BaseMixin} from '../base_mixin.js' +import {NewTabOption, BraveNewTabBrowserProxy, BraveNewTabBrowserProxyImpl} from './brave_new_tab_browser_proxy.js' import {getTemplate} from './brave_new_tab_page.html.js' /** * 'settings-brave-new-tab-page' is the settings page containing * brave's new tab features. */ -Polymer({ - is: 'settings-brave-new-tab-page', - _template: getTemplate(), +const SettingsBraveNewTabPageElementBase = + WebUIListenerMixin(BaseMixin(PolymerElement)) as { + new(): PolymerElement & WebUIListenerMixinInterface + } - browserProxy_: null, +export class SettingsBraveNewTabPageElement extends SettingsBraveNewTabPageElementBase { + static get is() { + return 'settings-brave-new-tab-page' + } + + static get template() { + return getTemplate() + } - behaviors: [ - WebUIListenerBehavior, - ], + static get properties() { + return { + newTabShowOptions_: Array, + showNewTabDashboardSettings_: Boolean, + }; + } - properties: { - newTabShowOptions_: Array, - shouldNewTabShowDashboardSettings_: Boolean, - }, + private newTabShowOptions_: NewTabOption[]; + private showNewTabDashboardSettings_: boolean; - /** @override */ - created: function() { - this.browserProxy_ = BraveNewTabBrowserProxyImpl.getInstance() - this.showNewTabDashboardSettings_ = false - }, + browserProxy_: BraveNewTabBrowserProxy = BraveNewTabBrowserProxyImpl.getInstance(); - /** @override */ - ready: function() { + override ready() { + super.ready() this.openNewTabPage_ = this.openNewTabPage_.bind(this) - this.browserProxy_.getNewTabShowsOptionsList().then(list => { + this.browserProxy_.getNewTabShowsOptionsList().then((list: NewTabOption[]) => { this.newTabShowOptions_ = list }) - this.browserProxy_.shouldShowNewTabDashboardSettings().then(showNewTabDashboardSettings => { - this.showNewTabDashboardSettings_ = showNewTabDashboardSettings + this.browserProxy_.shouldShowNewTabDashboardSettings().then((show: boolean) => { + this.showNewTabDashboardSettings_ = show }) - - this.addWebUIListener('show-new-tab-dashboard-settings-changed', (show) => { + this.addWebUIListener('show-new-tab-dashboard-settings-changed', (show: boolean) => { this.showNewTabDashboardSettings_ = show }) - }, + } - openNewTabPage_: function () { + openNewTabPage_() { window.open("chrome://newTab?openSettings=1", "_self") } -}) +} + +customElements.define( + SettingsBraveNewTabPageElement.is, SettingsBraveNewTabPageElement) diff --git a/browser/resources/settings/brave_overrides/appearance_page.ts b/browser/resources/settings/brave_overrides/appearance_page.ts index 5c1fcbe80cad..acd73e186614 100644 --- a/browser/resources/settings/brave_overrides/appearance_page.ts +++ b/browser/resources/settings/brave_overrides/appearance_page.ts @@ -6,7 +6,7 @@ // @ts-nocheck TODO(petemill): Define types and remove ts-nocheck import {RegisterPolymerTemplateModifications} from 'chrome://resources/polymer_overriding.js' -import {I18nBehavior} from 'chrome://resources/cr_elements/i18n_behavior.js' +import {I18nBehavior} from 'chrome://resources/i18n_behavior.js' import {Router} from '../router.js' import {loadTimeData} from '../i18n_setup.js' diff --git a/browser/resources/settings/brave_overrides/import_data_dialog.ts b/browser/resources/settings/brave_overrides/import_data_dialog.ts index 5b30841825bf..056c4af81ed3 100644 --- a/browser/resources/settings/brave_overrides/import_data_dialog.ts +++ b/browser/resources/settings/brave_overrides/import_data_dialog.ts @@ -6,7 +6,7 @@ // @ts-nocheck TODO(petemill): Define types and remove ts-nocheck import {html, RegisterPolymerTemplateModifications, RegisterPolymerComponentBehaviors} from 'chrome://resources/polymer_overriding.js' -import {I18nBehavior} from 'chrome://resources/cr_elements/i18n_behavior.js' +import {I18nBehavior} from 'chrome://resources/i18n_behavior.js' RegisterPolymerTemplateModifications({ 'settings-import-data-dialog': (templateContent) => { diff --git a/browser/resources/settings/brave_overrides/passwords_section.ts b/browser/resources/settings/brave_overrides/passwords_section.ts index 7561ef8f1723..71532aa1b09a 100644 --- a/browser/resources/settings/brave_overrides/passwords_section.ts +++ b/browser/resources/settings/brave_overrides/passwords_section.ts @@ -13,11 +13,5 @@ RegisterPolymerTemplateModifications({ } else { checkPasswordsLinkRow.remove() } - const manageLink = templateContent.querySelector('#manageLink') - if (!manageLink) { - console.error('[Brave Settings Overrides] Could not find manageLink in passwords_section') - } else { - manageLink.remove() - } } }) diff --git a/browser/resources/settings/brave_overrides/privacy_page.ts b/browser/resources/settings/brave_overrides/privacy_page.ts index 26390194338f..a54d64865270 100644 --- a/browser/resources/settings/brave_overrides/privacy_page.ts +++ b/browser/resources/settings/brave_overrides/privacy_page.ts @@ -6,7 +6,7 @@ // @ts-nocheck TODO(petemill): Define types and remove ts-nocheck import {RegisterPolymerTemplateModifications} from 'chrome://resources/polymer_overriding.js' -import {I18nBehavior} from 'chrome://resources/cr_elements/i18n_behavior.js' +import {I18nBehavior} from 'chrome://resources/i18n_behavior.js' import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; RegisterPolymerTemplateModifications({ diff --git a/browser/resources/settings/brave_overrides/site_details.ts b/browser/resources/settings/brave_overrides/site_details.ts index a5877c56cc12..47dc2af80da9 100644 --- a/browser/resources/settings/brave_overrides/site_details.ts +++ b/browser/resources/settings/brave_overrides/site_details.ts @@ -6,7 +6,7 @@ // @ts-nocheck TODO(petemill): Define types and remove ts-nocheck import {RegisterPolymerTemplateModifications} from 'chrome://resources/polymer_overriding.js' -import {I18nBehavior} from 'chrome://resources/cr_elements/i18n_behavior.js' +import {I18nBehavior} from 'chrome://resources/i18n_behavior.js' import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; RegisterPolymerTemplateModifications({ diff --git a/browser/resources/settings/brave_overrides/site_settings_page.ts b/browser/resources/settings/brave_overrides/site_settings_page.ts index 14666205e52e..9b766f7262fb 100644 --- a/browser/resources/settings/brave_overrides/site_settings_page.ts +++ b/browser/resources/settings/brave_overrides/site_settings_page.ts @@ -8,7 +8,7 @@ import {RegisterPolymerComponentReplacement, RegisterPolymerTemplateModifications} from 'chrome://resources/polymer_overriding.js' import {ContentSettingsTypes} from '../site_settings/constants.js' import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; -import {I18nBehavior} from 'chrome://resources/cr_elements/i18n_behavior.js'; +import {I18nBehavior} from 'chrome://resources/i18n_behavior.js'; import {SettingsSiteSettingsPageElement} from '../site_settings_page/site_settings_page.js' import {routes} from '../route.js' import './config.js' diff --git a/browser/resources/settings/brave_privacy_page/brave_personalization_options.ts b/browser/resources/settings/brave_privacy_page/brave_personalization_options.ts index de2603344830..c2a4bf76cfcf 100644 --- a/browser/resources/settings/brave_privacy_page/brave_personalization_options.ts +++ b/browser/resources/settings/brave_privacy_page/brave_personalization_options.ts @@ -2,111 +2,128 @@ * 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/. */ -// @ts-nocheck TODO(petemill): Define types and remove ts-nocheck - -import { Polymer } from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {WebUIListenerBehavior} from 'chrome://resources/cr_elements/web_ui_listener_behavior.js'; +import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {WebUIListenerMixin, WebUIListenerMixinInterface} from 'chrome://resources/cr_elements/web_ui_listener_mixin.js'; +import {BaseMixin} from '../base_mixin.js' import {BravePrivacyBrowserProxy, BravePrivacyBrowserProxyImpl} from './brave_privacy_page_browser_proxy.js' -import { getTemplate } from './brave_personalization_options.html.js' - -Polymer({ - is: 'settings-brave-personalization-options', - - _template: getTemplate(), - - behaviors: [ - WebUIListenerBehavior, - ], - - properties: { - webRTCPolicies_: { - readOnly: true, - type: Array, - value: function() { - return [ - {value: 'default', name: loadTimeData.getString('webRTCDefault')}, - {value: 'default_public_and_private_interfaces', name: loadTimeData.getString('defaultPublicAndPrivateInterfaces')}, - {value: 'default_public_interface_only', name: loadTimeData.getString('defaultPublicInterfaceOnly')}, - {value: 'disable_non_proxied_udp', name: loadTimeData.getString('disableNonProxiedUdp')} - ] +import {loadTimeData} from '../i18n_setup.js'; +import {SettingsToggleButtonElement} from '../controls/settings_toggle_button.js'; +import {getTemplate} from './brave_personalization_options.html.js' + +const SettingsBravePersonalizationOptionsBase = + WebUIListenerMixin(BaseMixin(PolymerElement)) as { + new(): PolymerElement & WebUIListenerMixinInterface + } + +export interface SettingsBravePersonalizationOptions { + $: { + p3aEnabled: SettingsToggleButtonElement, + statsUsagePingEnabled: SettingsToggleButtonElement, + } +} + +export class SettingsBravePersonalizationOptions extends SettingsBravePersonalizationOptionsBase { + static get is() { + return 'settings-brave-personalization-options' + } + + static get template() { + return getTemplate() + } + + static get properties() { + return { + webRTCPolicies_: { + readOnly: true, + type: Array, + value: function () { + return [ + { value: 'default', name: loadTimeData.getString('webRTCDefault') }, + { value: 'default_public_and_private_interfaces', name: loadTimeData.getString('defaultPublicAndPrivateInterfaces') }, + { value: 'default_public_interface_only', name: loadTimeData.getString('defaultPublicInterfaceOnly') }, + { value: 'disable_non_proxied_udp', name: loadTimeData.getString('disableNonProxiedUdp') } + ] + }, }, - }, - - webRTCPolicy_: String, - p3aEnabledPref_: { - type: Object, - value() { - // TODO(dbeam): this is basically only to appease PrefControlMixin. - // Maybe add a no-validate attribute instead? This makes little sense. - return {}; + webRTCPolicy_: String, + p3aEnabledPref_: { + type: Object, + value() { + // TODO(dbeam): this is basically only to appease PrefControlMixin. + // Maybe add a no-validate attribute instead? This makes little sense. + return {}; + }, }, - }, - statsUsagePingEnabledPref_: { - type: Object, - value() { - // TODO(dbeam): this is basically only to appease PrefControlMixin. - // Maybe add a no-validate attribute instead? This makes little sense. - return {}; + statsUsagePingEnabledPref_: { + type: Object, + value() { + // TODO(dbeam): this is basically only to appease PrefControlMixin. + // Maybe add a no-validate attribute instead? This makes little sense. + return {}; + }, }, - }, - }, + }; + } - /** @private {?BravePrivacyBrowserProxy} */ - browserProxy_: null, + private webRTCPolicies_: Object[]; + private webRTCPolicy_: String; + private p3aEnabledPref_: Object; + private statsUsagePingEnabledPref_: Object; - /** @override */ - created: function() { - this.browserProxy_ = BravePrivacyBrowserProxyImpl.getInstance(); - }, + browserProxy_: BravePrivacyBrowserProxy = BravePrivacyBrowserProxyImpl.getInstance(); - /** @override */ - ready: function() { + override ready() { + super.ready() // Used for first time initialization of checked state. // Can't use `prefs` property of `settings-toggle-button` directly // because p3a enabled is a local state setting, but PrefControlMixin // checks for a pref being valid, so have to fake it, same as upstream. - const setP3AEnabledPref = (enabled) => this.setP3AEnabledPref_(enabled); + const setP3AEnabledPref = (enabled: boolean) => this.setP3AEnabledPref_(enabled); this.addWebUIListener('p3a-enabled-changed', setP3AEnabledPref); - this.browserProxy_.getP3AEnabled().then(setP3AEnabledPref); + this.browserProxy_.getP3AEnabled().then( + (enabled: boolean) => setP3AEnabledPref(enabled)); - const setStatsUsagePingEnabledPref = (enabled) => this.setStatsUsagePingEnabledPref_(enabled); + const setStatsUsagePingEnabledPref = (enabled: boolean) => this.setStatsUsagePingEnabledPref_(enabled); this.addWebUIListener('stats-usage-ping-enabled-changed', setStatsUsagePingEnabledPref); - this.browserProxy_.getStatsUsagePingEnabled().then(setStatsUsagePingEnabledPref); - }, + this.browserProxy_.getStatsUsagePingEnabled().then( + (enabled: boolean) => setStatsUsagePingEnabledPref(enabled)); + } - setP3AEnabledPref_: function (enabled) { + setP3AEnabledPref_(enabled: boolean) { const pref = { key: '', type: chrome.settingsPrivate.PrefType.BOOLEAN, value: enabled, }; this.p3aEnabledPref_ = pref; - }, + } - onP3AEnabledChange_: function() { + onP3AEnabledChange_() { this.browserProxy_.setP3AEnabled(this.$.p3aEnabled.checked); - }, + } - setStatsUsagePingEnabledPref_: function (enabled) { + setStatsUsagePingEnabledPref_(enabled: boolean) { const pref = { key: '', type: chrome.settingsPrivate.PrefType.BOOLEAN, value: enabled, }; this.statsUsagePingEnabledPref_ = pref; - }, + } - onStatsUsagePingEnabledChange_: function() { + onStatsUsagePingEnabledChange_() { this.browserProxy_.setStatsUsagePingEnabled(this.$.statsUsagePingEnabled.checked); - }, + } - shouldShowRestart_: function(enabled) { + shouldShowRestart_(enabled: boolean) { return enabled != this.browserProxy_.wasPushMessagingEnabledAtStartup(); - }, + } - restartBrowser_: function(e) { + restartBrowser_(e: Event) { e.stopPropagation(); window.open("chrome://restart", "_self"); - }, + } +} -}); +customElements.define( + SettingsBravePersonalizationOptions.is, SettingsBravePersonalizationOptions) diff --git a/browser/resources/settings/brave_privacy_page/brave_privacy_page_browser_proxy.ts b/browser/resources/settings/brave_privacy_page/brave_privacy_page_browser_proxy.ts index 5709b2448777..9156d1855070 100644 --- a/browser/resources/settings/brave_privacy_page/brave_privacy_page_browser_proxy.ts +++ b/browser/resources/settings/brave_privacy_page/brave_privacy_page_browser_proxy.ts @@ -3,36 +3,35 @@ // 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/. -// @ts-nocheck TODO(petemill): Define types and remove ts-nocheck - import {sendWithPromise} from 'chrome://resources/js/cr.m.js'; +import {loadTimeData} from '../i18n_setup.js'; export interface BravePrivacyBrowserProxy { - getP3AEnabled(): Promise - setP3AEnabled(value: boolean) - getStatsUsagePingEnabled(): Promise - setStatsUsagePingEnabled(value: boolean) + getP3AEnabled(): Promise + setP3AEnabled(value: boolean): void + getStatsUsagePingEnabled(): Promise + setStatsUsagePingEnabled(value: boolean): void wasPushMessagingEnabledAtStartup(): boolean } export class BravePrivacyBrowserProxyImpl implements BravePrivacyBrowserProxy { - getP3AEnabled() { + getP3AEnabled(): Promise { return sendWithPromise('getP3AEnabled'); } - setP3AEnabled(value) { + setP3AEnabled(value: boolean): void { chrome.send('setP3AEnabled', [value]) } - getStatsUsagePingEnabled() { + getStatsUsagePingEnabled(): Promise { return sendWithPromise('getStatsUsagePingEnabled'); } - setStatsUsagePingEnabled(value) { + setStatsUsagePingEnabled(value: boolean): void { chrome.send('setStatsUsagePingEnabled', [value]) } - wasPushMessagingEnabledAtStartup() { + wasPushMessagingEnabledAtStartup(): boolean { return loadTimeData.getBoolean('pushMessagingEnabledAtStartup'); } @@ -41,4 +40,4 @@ export class BravePrivacyBrowserProxyImpl implements BravePrivacyBrowserProxy { } } -let instance: BravePrivacyBrowserProxy|null = null \ No newline at end of file +let instance: BravePrivacyBrowserProxy | null = null \ No newline at end of file diff --git a/browser/resources/settings/brave_rewards_page/brave_rewards_page.ts b/browser/resources/settings/brave_rewards_page/brave_rewards_page.ts index aa109acab505..822c01448119 100644 --- a/browser/resources/settings/brave_rewards_page/brave_rewards_page.ts +++ b/browser/resources/settings/brave_rewards_page/brave_rewards_page.ts @@ -11,7 +11,7 @@ import {loadTimeData} from '../i18n_setup.js'; import '//resources/js/cr.m.js'; import {PolymerElement} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js'; +import {I18nMixin} from 'chrome://resources/cr_elements/i18n_mixin.js'; import {PrefsMixin} from '../prefs/prefs_mixin.js'; import {BraveRewardsBrowserProxyImpl} from './brave_rewards_browser_proxy.js'; import {getTemplate} from './brave_rewards_page.html.js' diff --git a/browser/resources/settings/brave_search_engines_page/brave_search_engines_page.ts b/browser/resources/settings/brave_search_engines_page/brave_search_engines_page.ts index a988fee98fef..d04117354567 100644 --- a/browser/resources/settings/brave_search_engines_page/brave_search_engines_page.ts +++ b/browser/resources/settings/brave_search_engines_page/brave_search_engines_page.ts @@ -9,7 +9,7 @@ import '../settings_shared.css.js'; import '../settings_vars.css.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {WebUIListenerMixin} from 'chrome://resources/js/web_ui_listener_mixin.js'; +import {WebUIListenerMixin} from 'chrome://resources/cr_elements/web_ui_listener_mixin.js'; import {loadTimeData} from "../i18n_setup.js" import {BraveSearchEnginesPageBrowserProxyImpl} from './brave_search_engines_page_browser_proxy.js'; import {getTemplate} from './brave_search_engines_page.html.js' diff --git a/browser/resources/settings/brave_sync_page/brave_sync_browser_proxy.ts b/browser/resources/settings/brave_sync_page/brave_sync_browser_proxy.ts index d962656c7020..1eb1f454a5f3 100644 --- a/browser/resources/settings/brave_sync_page/brave_sync_browser_proxy.ts +++ b/browser/resources/settings/brave_sync_page/brave_sync_browser_proxy.ts @@ -3,30 +3,42 @@ // 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/. -// @ts-nocheck TODO(petemill): Define types and remove ts-nocheck - import {sendWithPromise} from 'chrome://resources/js/cr.m.js'; +export type BraveDeviceInfo = { + name: string + guid: string + id: string + os: string + type: string + chromeVersion: string + lastUpdatedTimestamp: number + sendTabToSelfReceivingEnabled: boolean + supportsSelfDelete: boolean + isCurrentDevice: boolean + hasSharingInfo: boolean +} + export class BraveSyncBrowserProxy { - getSyncCode() { + getSyncCode(): Promise { return sendWithPromise('SyncSetupGetSyncCode'); } - getPureSyncCode() { + getPureSyncCode(): Promise { return sendWithPromise('SyncSetupGetPureSyncCode'); } - getQRCode(syncCode) { + getQRCode(syncCode: string): Promise { return sendWithPromise('SyncGetQRCode', syncCode); } - getDeviceList() { + getDeviceList(): Promise { return sendWithPromise('SyncGetDeviceList'); } - setSyncCode(syncCode) { + setSyncCode(syncCode: string): Promise { return sendWithPromise('SyncSetupSetSyncCode', syncCode); } - resetSyncChain() { + resetSyncChain(): Promise { return sendWithPromise('SyncSetupReset'); } - deleteDevice(deviceId) { + deleteDevice(deviceId: string): Promise { return sendWithPromise('SyncDeleteDevice', deviceId); } static getInstance() { diff --git a/browser/resources/settings/brave_sync_page/brave_sync_code_dialog.ts b/browser/resources/settings/brave_sync_page/brave_sync_code_dialog.ts index 5338271c6274..15fc760049ee 100644 --- a/browser/resources/settings/brave_sync_page/brave_sync_code_dialog.ts +++ b/browser/resources/settings/brave_sync_page/brave_sync_code_dialog.ts @@ -3,16 +3,15 @@ // 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/. -// @ts-nocheck TODO(petemill): Define types and remove ts-nocheck - import '../settings_shared.css.js'; import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_button/cr_button.js'; import 'chrome://resources/cr_elements/cr_icon_button/cr_icon_button.js'; -import {Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {I18nBehavior} from 'chrome://resources/cr_elements/i18n_behavior.js'; +import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {I18nMixin, I18nMixinInterface} from 'chrome://resources/cr_elements/i18n_mixin.js' +import {BaseMixin} from '../base_mixin.js' import {BraveSyncBrowserProxy} from './brave_sync_browser_proxy.js'; import {getTemplate} from './brave_sync_code_dialog.html.js' @@ -23,102 +22,115 @@ import {getTemplate} from './brave_sync_code_dialog.html.js' * words, qr-code, or a 'chooser' which will allow the user to choose words or * qr-code. */ -Polymer({ - is: 'settings-brave-sync-code-dialog', - - _template: getTemplate(), - - behaviors: [ - I18nBehavior - ], - - properties: { - syncCode: { - type: String, - notify: true - }, - /** - * 'qr' | 'words' | 'choose' | 'input' - */ - codeType: { - type: String, - value: 'choose', - notify: true - }, - syncCodeValidationError: { - type: String, - value: '', - notify: true - }, - syncCodeWordCount_: { - type: Number, - computed: 'computeSyncCodeWordCount_(syncCode)' - }, - hasCopiedSyncCode_: { - type: Boolean, - value: false - }, - qrCodeImageUrl_: { - type: String, - value: null - }, - }, - - observers: [ - 'getQRCode_(syncCode, codeType)', - ], - - /** @private {?BraveSyncBrowserProxy} */ - syncBrowserProxy_: null, - - created: function() { - this.syncBrowserProxy_ = BraveSyncBrowserProxy.getInstance(); - }, - - computeSyncCodeWordCount_: function() { + +const SettingsBraveSyncCodeDialogElementBase = + I18nMixin(BaseMixin(PolymerElement)) as { + new(): PolymerElement & I18nMixinInterface + } + +export class SettingsBraveSyncCodeDialogElement extends SettingsBraveSyncCodeDialogElementBase { + static get is() { + return 'settings-brave-sync-code-dialog' + } + + static get template() { + return getTemplate() + } + + static get properties() { + return { + syncCode: { + type: String, + notify: true + }, + /** + * 'qr' | 'words' | 'choose' | 'input' + */ + codeType: { + type: String, + value: 'choose', + notify: true + }, + syncCodeValidationError: { + type: String, + value: '', + notify: true + }, + syncCodeWordCount_: { + type: Number, + computed: 'computeSyncCodeWordCount_(syncCode)' + }, + hasCopiedSyncCode_: { + type: Boolean, + value: false + }, + qrCodeImageUrl_: { + type: String, + value: null + }, + }; + } + + static get observers() { + return [ + 'getQRCode_(syncCode, codeType)', + ]; + } + + private syncCode: string; + private codeType: 'qr' | 'words' | 'choose' | 'input' | null; + private syncCodeValidationError: string; + private syncCodeWordCount_: number; + private hasCopiedSyncCode_: boolean; + private qrCodeImageUrl_: string; + private hasCopiedSyncCodeTimer_: ReturnType; + + syncBrowserProxy_: BraveSyncBrowserProxy = BraveSyncBrowserProxy.getInstance(); + + computeSyncCodeWordCount_() { if (!this.syncCode) { return 0 } return this.syncCode.trim().split(' ').length - }, + } - isCodeType: function(askingType) { + isCodeType(askingType: string) { return (this.codeType === askingType) - }, + } - handleClose_: function() { + handleClose_() { this.codeType = null this.syncCodeValidationError = '' - }, + } - handleChooseMobile_: function() { + handleChooseMobile_() { this.codeType = null window.setTimeout(() => { this.codeType = 'qr' }, 0) - }, + } - handleChooseComputer_: function() { + handleChooseComputer_() { this.codeType = null window.setTimeout(() => { this.codeType = 'words' }, 0) - }, + } - handleSyncCodeCopy_: function() { + handleSyncCodeCopy_() { window.clearTimeout(this.hasCopiedSyncCodeTimer_) navigator.clipboard.writeText(this.syncCode) this.hasCopiedSyncCode_ = true this.hasCopiedSyncCodeTimer_ = window.setTimeout(() => { this.hasCopiedSyncCode_ = false }, 4000) - }, + } - handleDone_: function() { - this.fire('done') - }, + handleDone_() { + this.dispatchEvent(new CustomEvent('done')) + } - getQRCode_: async function() { + async getQRCode_() { if (this.codeType !== 'qr') { return } @@ -131,6 +143,8 @@ Polymer({ } catch (e) { console.error('getQRCode failed', e) } - }, + } +} -}); +customElements.define( + SettingsBraveSyncCodeDialogElement.is, SettingsBraveSyncCodeDialogElement) diff --git a/browser/resources/settings/brave_sync_page/brave_sync_configure.html b/browser/resources/settings/brave_sync_page/brave_sync_configure.html index ad480254aaef..e2603caa8185 100644 --- a/browser/resources/settings/brave_sync_page/brave_sync_configure.html +++ b/browser/resources/settings/brave_sync_page/brave_sync_configure.html @@ -109,7 +109,7 @@

$i18n{braveSyncDeviceListTitle}

diff --git a/browser/resources/settings/brave_sync_page/brave_sync_configure.ts b/browser/resources/settings/brave_sync_page/brave_sync_configure.ts index ca02fa900708..d45a3e17d539 100644 --- a/browser/resources/settings/brave_sync_page/brave_sync_configure.ts +++ b/browser/resources/settings/brave_sync_page/brave_sync_configure.ts @@ -3,7 +3,16 @@ // 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/. -// @ts-nocheck TODO(petemill): Define types and remove ts-nocheck +import './brave_sync_code_dialog.js'; + +import {DomRepeatEvent, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {I18nMixin, I18nMixinInterface} from 'chrome://resources/cr_elements/i18n_mixin.js' +import {WebUIListenerMixin, WebUIListenerMixinInterface} from 'chrome://resources/cr_elements/web_ui_listener_mixin.js'; +import {BaseMixin} from '../base_mixin.js' +import {Route,Router} from '../router.js'; +import {BraveDeviceInfo, BraveSyncBrowserProxy} from './brave_sync_browser_proxy.js'; +import {SyncStatus} from '../people_page/sync_browser_proxy.js'; +import {getTemplate} from './brave_sync_configure.html.js' /** * @fileoverview @@ -11,102 +20,98 @@ * and updates the sync configuration. */ -import './brave_sync_code_dialog.js'; +const SettingsBraveSyncConfigureElementBase = + I18nMixin(WebUIListenerMixin(BaseMixin(PolymerElement))) as { + new(): PolymerElement & WebUIListenerMixinInterface & I18nMixinInterface + } -import {Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {I18nBehavior} from 'chrome://resources/cr_elements/i18n_behavior.js'; -import {WebUIListenerBehavior} from 'chrome://resources/cr_elements/web_ui_listener_behavior.js'; +export class SettingsBraveSyncConfigureElement extends SettingsBraveSyncConfigureElementBase { + static get is() { + return 'settings-brave-sync-configure' + } -import {Router} from '../router.js'; -import {BraveSyncBrowserProxy} from './brave_sync_browser_proxy.js'; -import {getTemplate} from './brave_sync_configure.html.js' + static get template() { + return getTemplate() + } + + static get properties() { + return { + /** + * The current sync status, supplied by parent element. + * @type {!SyncStatus} + */ + syncStatus: Object, + /** + * Configured sync code + */ + syncCode: { + type: String, + notify: true + }, + /** + * List of devices in sync chain + * @private + */ + deviceList_: Array, + /** + * Sync code dialog type. Can only have 1 at a time, so use a single property. + * 'qr' | 'words' | 'input' | 'choose' | null + * @private + */ + syncCodeDialogType_: String, + }; + } + + private syncStatus: SyncStatus; + private syncCode: string | undefined; + private deviceList_: BraveDeviceInfo[]; + private syncCodeDialogType_: string | null; -Polymer({ - is: 'settings-brave-sync-configure', - - _template: getTemplate(), - - behaviors: [ - I18nBehavior, - WebUIListenerBehavior, - ], - - properties: { - /** - * The current sync status, supplied by parent element. - * @type {!SyncStatus} - */ - syncStatus: Object, - /** - * Configured sync code - */ - syncCode: { - type: String, - notify: true - }, - /** - * List of devices in sync chain - * @private - */ - deviceList_: Array, - /** - * Sync code dialog type. Can only have 1 at a time, so use a single property. - * 'qr' | 'words' | 'input' | 'choose' | null - * @private - */ - syncCodeDialogType_: String, - }, - - /** @private {?SyncBrowserProxy} */ - browserProxy_: null, - - /** @override */ - created: function() { - this.browserProxy_ = BraveSyncBrowserProxy.getInstance(); - }, - - attached: async function() { + browserProxy_: BraveSyncBrowserProxy = BraveSyncBrowserProxy.getInstance(); + + override async connectedCallback() { + super.connectedCallback() const deviceList = await this.browserProxy_.getDeviceList() this.addWebUIListener('device-info-changed', this.handleDeviceInfo_.bind(this)) this.handleDeviceInfo_(deviceList) - }, + } - handleDeviceInfo_: function(deviceList) { + handleDeviceInfo_(deviceList: BraveDeviceInfo[]) { this.deviceList_ = deviceList - }, + } - getDeviceDisplayDate: function(device) { + getDeviceDisplayDate(device: BraveDeviceInfo): string { const displayDate = new Date(0) displayDate.setUTCSeconds(device.lastUpdatedTimestamp) return displayDate.toDateString() - }, + } /* * This only sets sync code when it is not already set. It needs to be cleared * when sync chain reset */ - ensureSetSyncCode_: async function() { + async ensureSetSyncCode_() { if (!!this.syncCode) return const syncCode = await this.browserProxy_.getSyncCode() this.syncCode = syncCode - }, + } - onViewSyncCode_: async function() { + async onViewSyncCode_() { await this.ensureSetSyncCode_() this.syncCodeDialogType_ = 'words' - }, + } - onAddDevice_: async function() { + async onAddDevice_() { await this.ensureSetSyncCode_() this.syncCodeDialogType_ = 'choose' - }, + } - onSyncCodeDialogDone_: function() { + onSyncCodeDialogDone_() { this.syncCodeDialogType_ = null - }, + } - onResetSyncChain_: async function() { + async onResetSyncChain_() { const messageText = this.i18n('braveSyncResetConfirmation') const shouldReset = confirm(messageText) if (!shouldReset) { @@ -117,17 +122,19 @@ Polymer({ // chain without reload this.syncCode = undefined const router = Router.getInstance(); - router.navigateTo(router.getRoutes().BRAVE_SYNC); - }, + router.navigateTo((router.getRoutes() as {BRAVE_SYNC: Route}).BRAVE_SYNC); + } - onDeleteDevice_: async function(e) { + async onDeleteDevice_(e: DomRepeatEvent) { const messageText = this.i18n('braveSyncDeleteDeviceConfirmation') const shouldDeleteDevice = confirm(messageText) if (!shouldDeleteDevice) { return } - - const deviceGuid = e.currentTarget.arg - await this.browserProxy_.deleteDevice(deviceGuid); + const device: BraveDeviceInfo = e.model.item + await this.browserProxy_.deleteDevice(device.guid); } -}); +} + +customElements.define( + SettingsBraveSyncConfigureElement.is, SettingsBraveSyncConfigureElement) diff --git a/browser/resources/settings/brave_sync_page/brave_sync_page.ts b/browser/resources/settings/brave_sync_page/brave_sync_page.ts index 2a1c14c0c7ff..a4a94b205222 100644 --- a/browser/resources/settings/brave_sync_page/brave_sync_page.ts +++ b/browser/resources/settings/brave_sync_page/brave_sync_page.ts @@ -3,12 +3,6 @@ * 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/. */ -// @ts-nocheck TODO(petemill): Define types and remove ts-nocheck - -/** - * 'settings-brave-sync-page' is the settings page containing brave's - * custom sync. - */ import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/icons.html.js'; import '../settings_page/settings_animated_pages.js'; @@ -17,90 +11,93 @@ import '../settings_shared.css.js'; import '../settings_vars.css.js'; import './brave_sync_subpage.js'; -import {I18nBehavior} from 'chrome://resources/cr_elements/i18n_behavior.js'; -import {WebUIListenerBehavior} from 'chrome://resources/cr_elements/web_ui_listener_behavior.js'; -import {Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; - -import {Router} from '../router.js'; -import {SyncBrowserProxyImpl} from '../people_page/sync_browser_proxy.js'; +import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {I18nMixin, I18nMixinInterface} from 'chrome://resources/cr_elements/i18n_mixin.js' +import {WebUIListenerMixin, WebUIListenerMixinInterface} from 'chrome://resources/cr_elements/web_ui_listener_mixin.js'; +import {BaseMixin} from '../base_mixin.js' +import {Route, Router} from '../router.js'; +import {SyncStatus, SyncPrefs, SyncBrowserProxy, SyncBrowserProxyImpl} from '../people_page/sync_browser_proxy.js'; import {BraveSyncBrowserProxy} from './brave_sync_browser_proxy.js'; import {getTemplate} from './brave_sync_page.html.js' -Polymer({ - is: 'settings-brave-sync-page', +/** + * @fileoverview + * 'settings-brave-sync-page' is the settings page containing brave's + * custom sync. + */ + +const SettingsBraveSyncPageElementBase = + I18nMixin(WebUIListenerMixin(BaseMixin(PolymerElement))) as { + new(): PolymerElement & WebUIListenerMixinInterface & I18nMixinInterface + } - _template: getTemplate(), +export class SettingsBraveSyncPageElement extends SettingsBraveSyncPageElementBase { + static get is() { + return 'settings-brave-sync-page' + } - behaviors: [ - I18nBehavior, - WebUIListenerBehavior, - ], + static get template() { + return getTemplate() + } - properties: { - /** - * The current sync status, supplied by SyncBrowserProxy. - * @type {?SyncStatus} - */ - syncStatus_: Object, - isEncryptionSet_: { - type: Boolean, - value: false - }, - syncLabel_: { - type: String, - computed: 'computeSyncLabel_(syncStatus_.firstSetupInProgress)' - }, - }, + static get properties() { + return { + /** + * The current sync status, supplied by SyncBrowserProxy. + * @type {?SyncStatus} + */ + syncStatus_: Object, + isEncryptionSet_: { + type: Boolean, + value: false + }, + syncLabel_: { + type: String, + computed: 'computeSyncLabel_(syncStatus_.firstSetupInProgress)' + }, + }; + } - /** @private {?SyncBrowserProxy} */ - browserProxy_: null, - /** @private */ - braveBrowserProxy_: null, + private syncStatus_: SyncStatus; + private isEncryptionSet_: boolean; + private syncLabel_: string; - /** @override */ - created: function() { - this.browserProxy_ = SyncBrowserProxyImpl.getInstance(); - this.braveBrowserProxy_ = BraveSyncBrowserProxy.getInstance(); - }, + browserProxy_: SyncBrowserProxy = SyncBrowserProxyImpl.getInstance(); + braveBrowserProxy_: BraveSyncBrowserProxy = BraveSyncBrowserProxy.getInstance(); - /** @private */ computeSyncLabel_() { const isAlreadySetup = this.syncStatus_ !== undefined && !this.syncStatus_.firstSetupInProgress; const key = isAlreadySetup ? 'braveSyncManageActionLabel' : 'braveSyncSetupActionLabel'; - return I18nBehavior.i18n(key); - }, + return this.i18n(key); + } - /** @override */ - attached: function() { + override connectedCallback() { + super.connectedCallback() const onSyncStatus = this.handleSyncStatus_.bind(this) - this.browserProxy_.getSyncStatus().then(onSyncStatus); + this.browserProxy_.getSyncStatus().then((status: SyncStatus) => onSyncStatus(status)); this.addWebUIListener( 'sync-prefs-changed', this.handleSyncPrefsChanged_.bind(this)); this.addWebUIListener('sync-status-changed', onSyncStatus); - }, + } - /** @private */ - onSyncTap_: function() { + onSyncTap_() { // Users can go to sync subpage regardless of sync status. const router = Router.getInstance(); - router.navigateTo(router.getRoutes().BRAVE_SYNC_SETUP); - }, + router.navigateTo((router.getRoutes() as {BRAVE_SYNC_SETUP: Route}).BRAVE_SYNC_SETUP); + } /** * Handler for when the sync state is pushed from the browser. - * @param {?SyncStatus} syncStatus - * @private */ - handleSyncStatus_: async function(syncStatus) { + async handleSyncStatus_(syncStatus: SyncStatus) { this.syncStatus_ = syncStatus; - }, + } /** * Handler for when the sync preferences are updated. - * @private */ - handleSyncPrefsChanged_: async function(syncPrefs) { + async handleSyncPrefsChanged_(syncPrefs: SyncPrefs) { if (this.syncStatus_ && !this.syncStatus_.firstSetupInProgress) { const pureSyncCode = await this.braveBrowserProxy_.getPureSyncCode() if (syncPrefs.passphraseRequired) { @@ -112,5 +109,8 @@ Polymer({ }) } } - }, -}); + } +} + +customElements.define( + SettingsBraveSyncPageElement.is, SettingsBraveSyncPageElement) diff --git a/browser/resources/settings/brave_sync_page/brave_sync_setup.ts b/browser/resources/settings/brave_sync_page/brave_sync_setup.ts index 28bb6496b325..7fd33bbbf606 100644 --- a/browser/resources/settings/brave_sync_page/brave_sync_setup.ts +++ b/browser/resources/settings/brave_sync_page/brave_sync_setup.ts @@ -3,76 +3,83 @@ // 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/. -// @ts-nocheck TODO(petemill): Define types and remove ts-nocheck +import './brave_sync_code_dialog.js'; + +import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {I18nMixin, I18nMixinInterface} from 'chrome://resources/cr_elements/i18n_mixin.js' +import {BaseMixin} from '../base_mixin.js' +import {BraveSyncBrowserProxy} from './brave_sync_browser_proxy.js'; +import {getTemplate} from './brave_sync_setup.html.js' /** * @fileoverview * 'brave-sync-setup' is the UI for starting or joining a sync chain * settings. */ -import './brave_sync_code_dialog.js'; -import {Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {I18nBehavior} from 'chrome://resources/cr_elements/i18n_behavior.js'; +const SettingsBraveSyncSetupElementBase = + I18nMixin(BaseMixin(PolymerElement)) as { + new(): PolymerElement & I18nMixinInterface + } -import {BraveSyncBrowserProxy} from './brave_sync_browser_proxy.js'; -import {getTemplate} from './brave_sync_setup.html.js' +export class SettingsBraveSyncSetupElement extends SettingsBraveSyncSetupElementBase { + static get is() { + return 'settings-brave-sync-setup' + } -Polymer({ - is: 'settings-brave-sync-setup', - - _template: getTemplate(), - - behaviors: [ - I18nBehavior, - ], - - properties: { - syncCode: { - type: String, - notify: true - }, - /** - * Sync code dialog type. Can only have 1 at a time, so use a single property. - * 'qr' | 'words' | 'input' | 'choose' | null - * @private - */ - syncCodeDialogType_: String, - isSubmittingSyncCode_: { - type: Boolean, - value: false, - }, - isGettingSyncCode_: { - type: Boolean, - value: false, - }, - syncCodeValidationError_: { - type: String, - value: '', - } - }, - - /** @private {?BraveSyncBrowserProxy} */ - syncBrowserProxy_: null, - - created: function() { - this.syncBrowserProxy_ = BraveSyncBrowserProxy.getInstance(); - }, - - handleStartSyncChain_: async function () { + static get template() { + return getTemplate() + } + + static get properties() { + return { + syncCode: { + type: String, + notify: true + }, + /** + * Sync code dialog type. Can only have 1 at a time, so use a single property. + * 'qr' | 'words' | 'input' | 'choose' | null + * @private + */ + syncCodeDialogType_: String, + isSubmittingSyncCode_: { + type: Boolean, + value: false, + }, + isGettingSyncCode_: { + type: Boolean, + value: false, + }, + syncCodeValidationError_: { + type: String, + value: '', + } + }; + } + + private syncCode: string | undefined; + private syncCodeDialogType_: 'qr' | 'words' | 'input' | 'choose' | null; + private isSubmittingSyncCode_: boolean; + private isGettingSyncCode_: boolean; + private syncCodeValidationError_: string; + + syncBrowserProxy_: BraveSyncBrowserProxy = BraveSyncBrowserProxy.getInstance(); + + async handleStartSyncChain_() { this.isGettingSyncCode_ = true const syncCode = await this.syncBrowserProxy_.getSyncCode() this.isGettingSyncCode_ = false this.syncCode = syncCode; this.syncCodeDialogType_ = 'choose' - }, + } - handleJoinSyncChain_: function () { + handleJoinSyncChain_() { this.syncCode = undefined this.syncCodeDialogType_ = 'input' - }, + } - handleSyncCodeDialogDone_: function (e) { + handleSyncCodeDialogDone_() { if (this.syncCodeDialogType_ === 'input') { const messageText = this.i18n('braveSyncFinalSecurityWarning') const shouldProceed = confirm(messageText) @@ -82,22 +89,26 @@ Polymer({ } this.submitSyncCode_() - }, + } - submitSyncCode_: async function () { + async submitSyncCode_() { this.isSubmittingSyncCode_ = true const syncCodeToSubmit = this.syncCode || '' let success = false try { success = await this.syncBrowserProxy_.setSyncCode(syncCodeToSubmit) - } catch (e) { - this.syncCodeValidationError_ = e + } catch (e: unknown) { + this.syncCodeValidationError_ = (e as Error).message success = false } this.isSubmittingSyncCode_ = false if (success) { - this.syncCodeDialogType_ = undefined - this.fire('setup-success') + this.syncCodeDialogType_ = null + this.dispatchEvent(new CustomEvent('setup-success')) } - }, -}); + } +} + +customElements.define( + SettingsBraveSyncSetupElement.is, SettingsBraveSyncSetupElement) + diff --git a/browser/resources/settings/brave_sync_page/brave_sync_subpage.ts b/browser/resources/settings/brave_sync_page/brave_sync_subpage.ts index 177893e3dbc3..5c0b3f3920a1 100644 --- a/browser/resources/settings/brave_sync_page/brave_sync_subpage.ts +++ b/browser/resources/settings/brave_sync_page/brave_sync_subpage.ts @@ -5,7 +5,7 @@ // @ts-nocheck TODO(petemill): Define types and remove ts-nocheck -import 'chrome://resources/js/util.m.js'; +import 'chrome://resources/js/util.js'; import 'chrome://resources/cr_elements/cr_button/cr_button.js'; import 'chrome://resources/cr_elements/cr_icon_button/cr_icon_button.js'; @@ -18,9 +18,9 @@ import '../people_page/sync_controls.js'; import './brave_sync_configure.js'; import './brave_sync_setup.js'; -import { assert } from 'chrome://resources/js/assert.m.js'; +import { assert } from 'chrome://resources/js/assert.js'; import { PolymerElement } from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import { I18nMixin } from 'chrome://resources/js/i18n_mixin.js'; +import { I18nMixin } from 'chrome://resources/cr_elements/i18n_mixin.js'; import { Route, RouteObserverMixin, Router } from '../router.js'; import { SyncBrowserProxyImpl, StatusAction } from '../people_page/sync_browser_proxy.js'; diff --git a/browser/resources/settings/brave_tor_page/brave_tor_bridges_dialog.ts b/browser/resources/settings/brave_tor_page/brave_tor_bridges_dialog.ts index 74afbbe024d4..2e27af1a702c 100644 --- a/browser/resources/settings/brave_tor_page/brave_tor_bridges_dialog.ts +++ b/browser/resources/settings/brave_tor_page/brave_tor_bridges_dialog.ts @@ -9,7 +9,7 @@ import 'chrome://resources/cr_elements/cr_button/cr_button.js'; import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.js'; import { PolymerElement } from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import { I18nMixin } from 'chrome://resources/js/i18n_mixin.js'; +import { I18nMixin } from 'chrome://resources/cr_elements/i18n_mixin.js'; import { PrefsMixin } from '../prefs/prefs_mixin.js'; import '../settings_shared.css.js'; import { BraveTorBrowserProxyImpl } from './brave_tor_browser_proxy.js' diff --git a/browser/resources/settings/brave_tor_page/brave_tor_subpage.ts b/browser/resources/settings/brave_tor_page/brave_tor_subpage.ts index 1a9363effea0..57ada85fd40a 100644 --- a/browser/resources/settings/brave_tor_page/brave_tor_subpage.ts +++ b/browser/resources/settings/brave_tor_page/brave_tor_subpage.ts @@ -6,8 +6,8 @@ // @ts-nocheck TODO(petemill): Define types and remove ts-nocheck import { PolymerElement } from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js' -import { WebUIListenerMixin } from 'chrome://resources/js/web_ui_listener_mixin.js' -import { I18nMixin } from 'chrome://resources/js/i18n_mixin.js'; +import { WebUIListenerMixin } from 'chrome://resources/cr_elements/web_ui_listener_mixin.js' +import { I18nMixin } from 'chrome://resources/cr_elements/i18n_mixin.js'; import { RouteObserverMixin } from '../router.js' import { PrefsMixin } from '../prefs/prefs_mixin.js' import { BraveTorBrowserProxyImpl } from './brave_tor_browser_proxy.js' diff --git a/browser/resources/settings/brave_wallet_page/add_wallet_network_dialog.ts b/browser/resources/settings/brave_wallet_page/add_wallet_network_dialog.ts index e94895dd4fe4..4b75d78239de 100644 --- a/browser/resources/settings/brave_wallet_page/add_wallet_network_dialog.ts +++ b/browser/resources/settings/brave_wallet_page/add_wallet_network_dialog.ts @@ -3,134 +3,180 @@ // 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/. -// @ts-nocheck TODO(petemill): Define types and remove ts-nocheck - import 'chrome://resources/cr_elements/cr_button/cr_button.js'; import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; -import 'chrome://resources/cr_elements/cr_input/cr_input.js'; import 'chrome://resources/cr_elements/cr_searchable_drop_down/cr_searchable_drop_down.js'; -import { Polymer, html } from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import { I18nBehavior } from 'chrome://resources/cr_elements/i18n_behavior.js'; -import { BraveWalletBrowserProxyImpl } from './brave_wallet_browser_proxy.js'; -import { getTemplate } from './add_wallet_network_dialog.html.js' - -Polymer({ - is: 'add-wallet-network-dialog', - - _template: getTemplate(), - - behaviors: [ - I18nBehavior - ], - - properties: { - addNewAllowed: { - type: Boolean, - value: false - }, - coin: { - type: Number, - value: 0 - }, - networks: { - type: Array, - value() { - return []; +import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {I18nMixin, I18nMixinInterface} from 'chrome://resources/cr_elements/i18n_mixin.js' +import {BaseMixin} from '../base_mixin.js' +import {loadTimeData} from '../i18n_setup.js' +import {NetworkInfo, BraveWalletBrowserProxy, BraveWalletBrowserProxyImpl} from './brave_wallet_browser_proxy.js'; +import {CrInputElement} from 'chrome://resources/cr_elements/cr_input/cr_input.js' +import {getTemplate} from './add_wallet_network_dialog.html.js' + +const SettingsBraveAddWalletNetworkDialogElementBase = + I18nMixin(BaseMixin(PolymerElement)) as { + new(): PolymerElement & I18nMixinInterface + } + +export interface Url { + value: string; +} + +export interface ExtendedNetworkInfo extends NetworkInfo { + searchString: string; +} + +export type UrlType = 'rpc' | 'icon' | 'block'; + +declare global { + interface Window { + testing: any; + } +} + +export class SettingsBraveAddWalletNetworkDialogElement extends SettingsBraveAddWalletNetworkDialogElementBase { + static get is() { + return 'add-wallet-network-dialog' + } + + static get template() { + return getTemplate() + } + + static get properties() { + return { + addNewAllowed: { + type: Boolean, + value: false }, - }, - selectedRpcUrl: { - type: String, - value: '' - }, - rpcUrls: { - type: Array, - value() { - return [{ value: '' }]; - } - }, - iconUrls: { - type: Array, - value() { - return [{ value: '' }]; - } - }, - blockUrls: { - type: Array, - value() { - return [{ value: '' }]; - } - }, - isRpcPlusButtonDisabled_: { - type: Boolean, - value: true, - }, - isIconPlusButtonDisabled_: { - type: Boolean, - value: true, - }, - isBlockPlusButtonDisabled_: { - type: Boolean, - value: true, - }, - isSubmitButtonEnabled_: { - type: Boolean, - value: false, - }, - - chainIdValue_: String, - invalidChainIdMessage_: String, - chainIdInvalid_: { - type: Boolean, - value: false, - }, - - chainNameValue_: String, - chainNameInvalid_: { - type: Boolean, - value: false, - }, - isCurrencyErrorHidden_: { - type: Boolean, - value: true, - }, - isSubmissionErrorHidden_: { - type: Boolean, - value: true, - }, - submissionErrorMessage_: { - type: String, - value: true - }, - selected: { - type: Object, - value: {} - }, - currencyNameValue_: String, - currencySymbolValue_: String, - currencyDecimalsValue_: Number, - prepopulatedNetworks_: { - type: Array, - value: [] - }, - searchValue_: { - type: String, - value: '', - observer: 'onSearchValueChanged_', - }, - searchItems_: { - type: Array, - value: [] - }, - }, - - browserProxy_: null, - - /** @override */ - created: function () { - this.browserProxy_ = BraveWalletBrowserProxyImpl.getInstance(); - }, - - ready: function () { + coin: { + type: Number, + value: 0 + }, + networks: { + type: Array, + value() { + return []; + }, + }, + selectedRpcUrl: { + type: String, + value: '' + }, + rpcUrls: { + type: Array, + value() { + return [{ value: '' }]; + } + }, + iconUrls: { + type: Array, + value() { + return [{ value: '' }]; + } + }, + blockUrls: { + type: Array, + value() { + return [{ value: '' }]; + } + }, + isRpcPlusButtonDisabled_: { + type: Boolean, + value: true, + }, + isIconPlusButtonDisabled_: { + type: Boolean, + value: true, + }, + isBlockPlusButtonDisabled_: { + type: Boolean, + value: true, + }, + isSubmitButtonEnabled_: { + type: Boolean, + value: false, + }, + + chainIdValue_: String, + invalidChainIdMessage_: String, + chainIdInvalid_: { + type: Boolean, + value: false, + }, + + chainNameValue_: String, + chainNameInvalid_: { + type: Boolean, + value: false, + }, + isCurrencyErrorHidden_: { + type: Boolean, + value: true, + }, + isSubmissionErrorHidden_: { + type: Boolean, + value: true, + }, + submissionErrorMessage_: { + type: String, + value: true + }, + selected: { + type: Object, + value: {} + }, + currencyNameValue_: String, + currencySymbolValue_: String, + currencyDecimalsValue_: Number, + prepopulatedNetworks_: { + type: Array, + value: [] + }, + searchValue_: { + type: String, + value: '', + observer: 'onSearchValueChanged_', + }, + searchItems_: { + type: Array, + value: [] + }, + }; + } + + private addNewAllowed: boolean; + private coin: number; + private networks: NetworkInfo[]; + private selectedRpcUrl: string; + private rpcUrls: Url[]; + private iconUrls: Url[]; + private blockUrls: Url[]; + private isRpcPlusButtonDisabled_: boolean; + private isIconPlusButtonDisabled_: boolean; + private isBlockPlusButtonDisabled_: boolean; + private isSubmitButtonEnabled_: boolean; + private chainIdValue_: string; + private invalidChainIdMessage_: string; + private chainIdInvalid_: boolean; + private chainNameValue_: string; + private chainNameInvalid_: boolean; + private isCurrencyErrorHidden_: boolean; + private isSubmissionErrorHidden_: boolean; + private submissionErrorMessage_: string; + private selected: NetworkInfo; + private currencyNameValue_: string; + private currencySymbolValue_: string; + private currencyDecimalsValue_: number; + private prepopulatedNetworks_: ExtendedNetworkInfo[]; + private searchValue_: string; + private searchItems_: string[]; + + browserProxy_: BraveWalletBrowserProxy = BraveWalletBrowserProxyImpl.getInstance(); + + override ready() { + super.ready() this.updatePrepopulatedNetworks() if (Object.keys(this.selected).length === 0) @@ -153,20 +199,22 @@ Polymer({ this.updatePlusButtonState('rpc') this.updatePlusButtonState('icon') this.updatePlusButtonState('block') - }, + } - connectedCallback: function () { + override connectedCallback() { + super.connectedCallback() if (loadTimeData.getBoolean('shouldExposeElementsForTesting')) { window.testing = window.testing || {} window.testing['addWalletNetworkDialog'] = this.shadowRoot } - }, + } - disconnectedCallback: function () { + override disconnectedCallback() { + super.disconnectedCallback() if (loadTimeData.getBoolean('shouldExposeElementsForTesting')) { delete window.testing['addWalletNetworkDialog'] } - }, + } updatePrepopulatedNetworks() { if (!this.addNewAllowed) @@ -175,13 +223,18 @@ Polymer({ if (!payload) return - this.prepopulatedNetworks_ = payload - this.prepopulatedNetworks_.forEach(item => item.searchString = `${item.chainId}(${BigInt(item.chainId)}) ${item.chainName}`) + payload.forEach(item => { + this.prepopulatedNetworks_.push( + {...item, searchString: `${item.chainId}(${BigInt(item.chainId)}) ${item.chainName}`} + ) + }) + // this.prepopulatedNetworks_ = payload + // this.prepopulatedNetworks_.forEach(item => item.searchString = `${item.chainId}(${BigInt(item.chainId)}) ${item.chainName}`) this.searchItems_ = this.prepopulatedNetworks_.map(item => item.searchString) }) - }, + } - validateURL: function (value) { + validateURL(value: string) { const url_ = value if (url_.trim() == '') { return false; @@ -194,39 +247,40 @@ Polymer({ } return url.protocol === "http:" || url.protocol === "https:" - }, - /** @private */ - chainIdChanged_: function (event) { - const value = event.target.value + } + + chainIdChanged_() { + const value = this.chainIdValue_ this.chainIdInvalid_ = value.length === 0 if (this.chainIdInvalid_) { this.invalidChainIdMessage_ = this.i18n('walletAddNetworkInvalidChainId') } this.updateSubmitButtonState_() - }, + } - chainNameChanged_: function (event) { - const element = event.target - this.chainNameInvalid_ = element.value.trim() === '' + chainNameChanged_() { + this.chainNameInvalid_ = this.chainNameValue_.trim() === '' this.updateSubmitButtonState_() - }, + } - isInvalidInputForList_: function (value, list) { + isInvalidInputForList_(value: string, list: string) { if (value.trim() === '') { return (list === 'icon' || list === 'block') ? false : true } return !this.validateURL(value) - }, - getTailOfUrlsArray: function (list) { + } + + getTailOfUrlsArray(list: UrlType) { if (list === 'rpc') { - return this.rpcUrls.at(0).value + return this.rpcUrls.at(0)!.value } else if (list === 'icon') { - return this.iconUrls.at(0).value - } else if (list === 'block') { - return this.blockUrls.at(0).value + return this.iconUrls.at(0)!.value + } else /* (list === 'block') */ { + return this.blockUrls.at(0)!.value } - }, - updatePlusButtonState: function (list) { + } + + updatePlusButtonState(list: UrlType) { const inputElementValue = this.getTailOfUrlsArray(list) const disabled = (!inputElementValue || inputElementValue.trim() === '') if (list === 'rpc') { @@ -236,15 +290,18 @@ Polymer({ } else if (list === 'block') { this.isBlockPlusButtonDisabled_ = disabled } - }, - updateSubmitButtonState_: function () { - for (const input of this.shadowRoot.querySelectorAll('.mandatory')) { + } + + updateSubmitButtonState_() { + for (const inputElement of this.shadowRoot!.querySelectorAll('.mandatory')) { + const input = inputElement as CrInputElement if (input && (input.invalid || !input.value || (input.value.trim && input.value.trim() === ''))) { this.isSubmitButtonEnabled_ = false return; } } - for (const input of this.shadowRoot.querySelectorAll('.wallet-input')) { + for (const inputElement of this.shadowRoot!.querySelectorAll('.wallet-input')) { + const input = inputElement as CrInputElement if (input && input.invalid) { this.isSubmitButtonEnabled_ = false return; @@ -265,14 +322,16 @@ Polymer({ } this.isSubmitButtonEnabled_ = true - }, - nativeCurrencyChanged_: function (event) { + } + + nativeCurrencyChanged_() { this.isCurrencyErrorHidden_ = true - }, + } + // Called for any change in the urls inputs // validates value of focused one and shows error if the value is invalid - // calls update for Plus buton state - urlChangedImpl_: function (element, list) { + // calls update for Plus button state + urlChangedImpl_(element: CrInputElement, list: UrlType) { element.invalid = this.isInvalidInputForList_(element.value, list) this.updateSubmitButtonState_() const empty = element.value.trim() === '' @@ -284,33 +343,41 @@ Polymer({ if (!element.invalid || empty) { this.updatePlusButtonState(list) } - }, - hasValidRPCUrls: function () { + } + + hasValidRPCUrls() { return this.rpcUrls.find(element => this.validateURL(element.value)) - }, - urlChangedIcons_: function (event) { - return this.urlChangedImpl_(event.target, 'icon') - }, - urlChangedRpc_: function (event) { - return this.urlChangedImpl_(event.target, 'rpc') - }, - urlChangedBlock_: function (event) { - return this.urlChangedImpl_(event.target, 'block') - }, - onAddRpcUrlTap_: function (item) { + } + + urlChangedIcons_(event: Event) { + return this.urlChangedImpl_((event.target as CrInputElement), 'icon') + } + + urlChangedRpc_(event: Event) { + return this.urlChangedImpl_((event.target as CrInputElement), 'rpc') + } + + urlChangedBlock_(event: Event) { + return this.urlChangedImpl_((event.target as CrInputElement), 'block') + } + + onAddRpcUrlTap_() { this.splice('rpcUrls', 0, 0, { value: '' }); this.isRpcPlusButtonDisabled_ = true - }, - onAddIconUrlTap_: function (item) { + } + + onAddIconUrlTap_() { this.splice('iconUrls', 0, 0, { value: '' }); this.isIconPlusButtonDisabled_ = true - }, - onAddBlockUrlTap_: function (item) { + } + + onAddBlockUrlTap_() { this.splice('blockUrls', 0, 0, { value: '' }); this.isBlockPlusButtonDisabled_ = true - }, - transformListForSerializaion_: function (list) { - return list.reduce((filtered, item) => { + } + + transformListForSerializaion_(list: Url[]) { + return list.reduce((filtered: string[] | null, item: Url) => { if (item && item.value.trim() !== '') { if (!filtered) { filtered = [] @@ -319,34 +386,39 @@ Polymer({ } return filtered }, null) - }, - showCurrencyError: function () { + } + + showCurrencyError() { this.isSubmissionErrorHidden_ = true this.isCurrencyErrorHidden_ = false - }, - setSubmissionResult: function (success, errorMessage) { + } + + setSubmissionResult(success: boolean, errorMessage: string) { this.isCurrencyErrorHidden_ = this.isSubmissionErrorHidden_ = true if (!success) { this.isSubmissionErrorHidden_ = false this.submissionErrorMessage_ = errorMessage } - }, - addNewNetwork: function (payload) { + } + + addNewNetwork(payload: NetworkInfo) { this.browserProxy_.addChain(payload) .then(([success, errorMessage]) => { this.setSubmissionResult(success, errorMessage) if (success) { - this.fire('close'); + this.dispatchEvent(new CustomEvent('close')); return } }) - }, - getHexNumber: function (value) { + } + + getHexNumber(value: string) { if (!isNaN(Number(value))) return '0x' + Number(value).toString(16) return value - }, - onAddNetworkTap_: function (item) { + } + + onAddNetworkTap_() { let payload = Object({ chainId: this.getHexNumber(this.chainIdValue_), chainName: this.chainNameValue_, @@ -354,7 +426,7 @@ Polymer({ const nativeCurrency = Object({ name: this.currencyNameValue_.trim(), symbol: this.currencySymbolValue_.trim(), - decimals: parseInt(this.currencyDecimalsValue_) + decimals: this.currencyDecimalsValue_ }) if ((nativeCurrency.name || nativeCurrency.symbol || nativeCurrency.decimals)) { if (!nativeCurrency.name || !nativeCurrency.symbol || !nativeCurrency.decimals) { @@ -365,7 +437,7 @@ Polymer({ } payload.coin = this.coin payload.rpcUrls = this.transformListForSerializaion_(this.rpcUrls) - payload.activeRpcEndpointIndex = payload.rpcUrls.findIndex(it => it === this.selectedRpcUrl) + payload.activeRpcEndpointIndex = payload.rpcUrls.findIndex((it: string) => it === this.selectedRpcUrl) if (payload.activeRpcEndpointIndex < 0) payload.activeRpcEndpointIndex = 0 payload.blockExplorerUrls = this.transformListForSerializaion_(this.blockUrls) @@ -382,8 +454,9 @@ Polymer({ return } this.addNewNetwork(payload) - }, - onSearchValueChanged_(newValue, oldValue) { + } + + onSearchValueChanged_(newValue: string) { if (!newValue) return const found = this.prepopulatedNetworks_.find(item => item.searchString === newValue) @@ -413,4 +486,7 @@ Polymer({ this.searchValue_ = '' } } -}); +} + +customElements.define( + SettingsBraveAddWalletNetworkDialogElement.is, SettingsBraveAddWalletNetworkDialogElement) diff --git a/browser/resources/settings/brave_wallet_page/brave_wallet_browser_proxy.ts b/browser/resources/settings/brave_wallet_page/brave_wallet_browser_proxy.ts index 0dd9e4b150a0..040b73ce50f9 100644 --- a/browser/resources/settings/brave_wallet_page/brave_wallet_browser_proxy.ts +++ b/browser/resources/settings/brave_wallet_page/brave_wallet_browser_proxy.ts @@ -3,100 +3,119 @@ * 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/. */ -// @ts-nocheck TODO(petemill): Define types and remove ts-nocheck - import {sendWithPromise} from 'chrome://resources/js/cr.m.js'; +export enum CoinType { + ETH = 60, + FIL = 461, + SOL = 501 +} + +export type Currency = { + symbol: string + name: string + decimals: number +} + +export type NetworkInfo = { + chainId: string + chainName: string + blockExplorerUrls: string[] + iconUrls: string[] + activeRpcEndpointIndex: number + rpcUrls: string[] + coin: CoinType + is_eip1559: boolean + nativeCurrency: Currency +} + +export type NetworksList = { + activeNetwork: string + networks: NetworkInfo[] + knownNetworks: string[] + customNetworks: string[] + hiddenNetworks: string[] +} + +export type SolanaProvider = { + name: string + value: number +} + export interface BraveWalletBrowserProxy { - setBraveWalletEnabled (value: boolean) - getWeb3ProviderList () // TODO(petemill): Define the expected type - getSolanaProviderList () // TODO(petemill): Define the expected type - isNativeWalletEnabled () // TODO(petemill): Define the expected type - getAutoLockMinutes () // TODO(petemill): Define the expected type - getNetworksList (coin) // TODO(petemill): Define the expected type - getPrepopulatedNetworksList () // TODO(petemill): Define the expected type - removeChain (chainId, coin) // TODO(petemill): Define the expected type - resetChain (chainId, coin) // TODO(petemill): Define the expected type - addChain (value) // TODO(petemill): Define the expected type - addHiddenNetwork (chainId, coin) // TODO(petemill): Define the expected type - removeHiddenNetwork (chainId, coin) // TODO(petemill): Define the expected type - setActiveNetwork (chainId, coin) // TODO(petemill): Define the expected type - resetTransactionInfo () + setBraveWalletEnabled(value: boolean): void + getWeb3ProviderList(): Promise + getSolanaProviderOptions(): Promise + isNativeWalletEnabled(): Promise + getAutoLockMinutes(): Promise + getNetworksList(coin: number): Promise + getPrepopulatedNetworksList(): Promise + removeChain(chainId: string, coin: number): Promise + resetChain(chainId: string, coin: number): Promise + addChain(value: NetworkInfo): Promise<[boolean, string]> + addHiddenNetwork(chainId: string, coin: number): Promise + removeHiddenNetwork(chainId: string, coin: number): Promise + setActiveNetwork(chainId: string, coin: number): Promise + resetTransactionInfo (): void } -/** - * @implements {settings.BraveWalletBrowserProxy} - */ -export class BraveWalletBrowserProxyImpl { - /** @override */ +export class BraveWalletBrowserProxyImpl implements BraveWalletBrowserProxy { resetWallet () { chrome.send('resetWallet', []) } - /** @override */ + resetTransactionInfo () { chrome.send('resetTransactionInfo', []) } - /** @override */ - setBraveWalletEnabled (value) { + + setBraveWalletEnabled (value: boolean) { chrome.send('setBraveWalletEnabled', [value]) } - /** @override */ - getNetworksList (coin) { + getNetworksList (coin: number) { return sendWithPromise('getNetworksList', coin) } - /** @override */ getPrepopulatedNetworksList () { return sendWithPromise('getPrepopulatedNetworksList') } - /** @override */ - setActiveNetwork (chainId, coin) { + setActiveNetwork (chainId: string, coin: number) { return sendWithPromise('setActiveNetwork', chainId, coin) } - /** @override */ - removeChain (chainId, coin) { + removeChain (chainId: string, coin: number) { return sendWithPromise('removeChain', chainId, coin) } - /** @override */ - resetChain (chainId, coin) { + resetChain (chainId: string, coin: number) { return sendWithPromise('resetChain', chainId, coin) } - /** @override */ - addChain (payload) { + addChain (payload: NetworkInfo) { return sendWithPromise('addChain', payload) } - /** @override */ - addHiddenNetwork (chainId, coin) { + addHiddenNetwork (chainId: string, coin: number) { return sendWithPromise('addHiddenNetwork', chainId, coin) } - /** @override */ - removeHiddenNetwork (chainId, coin) { + removeHiddenNetwork (chainId: string, coin: number) { return sendWithPromise('removeHiddenNetwork', chainId, coin) } - /** @override */ getWeb3ProviderList () { - return new Promise(resolve => chrome.braveWallet.getWeb3ProviderList(resolve)) + return new Promise(resolve => chrome.braveWallet.getWeb3ProviderList(resolve)) } - /** @override */ - isNativeWalletEnabled () { - return new Promise(resolve => chrome.braveWallet.isNativeWalletEnabled(resolve)) + isNativeWalletEnabled() { + return new Promise(resolve => chrome.braveWallet.isNativeWalletEnabled(resolve)) } - /** @override */ getAutoLockMinutes () { return sendWithPromise('getAutoLockMinutes') } - /** @override */ getSolanaProviderOptions() { return sendWithPromise('getSolanaProviderOptions') } diff --git a/browser/resources/settings/brave_wallet_page/brave_wallet_page.ts b/browser/resources/settings/brave_wallet_page/brave_wallet_page.ts index a040b7196739..9821c91a4cfe 100644 --- a/browser/resources/settings/brave_wallet_page/brave_wallet_page.ts +++ b/browser/resources/settings/brave_wallet_page/brave_wallet_page.ts @@ -8,11 +8,11 @@ import 'chrome://resources/cr_elements/cr_input/cr_input.js'; import './wallet_networks_subpage.js'; import {BraveWalletBrowserProxy, BraveWalletBrowserProxyImpl} from './brave_wallet_browser_proxy.js'; -import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js'; +import {I18nMixin} from 'chrome://resources/cr_elements/i18n_mixin.js'; import {PrefsMixin} from '../prefs/prefs_mixin.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {Router, RouteObserverMixin} from '../router.js'; -import {WebUIListenerMixin} from 'chrome://resources/js/web_ui_listener_mixin.js'; +import {WebUIListenerMixin} from 'chrome://resources/cr_elements/web_ui_listener_mixin.js'; import {getTemplate} from './brave_wallet_page.html.js' const SettingsBraveWalletPageBase = WebUIListenerMixin(PrefsMixin(I18nMixin(RouteObserverMixin(PolymerElement)))) diff --git a/browser/resources/settings/brave_wallet_page/wallet_networks_list.ts b/browser/resources/settings/brave_wallet_page/wallet_networks_list.ts index f32f41d14e79..f0d55e3f9673 100644 --- a/browser/resources/settings/brave_wallet_page/wallet_networks_list.ts +++ b/browser/resources/settings/brave_wallet_page/wallet_networks_list.ts @@ -8,7 +8,7 @@ import 'chrome://resources/cr_elements/cr_button/cr_button.js'; import './add_wallet_network_dialog.js'; import { BraveWalletBrowserProxyImpl } from './brave_wallet_browser_proxy.js'; -import { I18nMixin } from 'chrome://resources/js/i18n_mixin.js'; +import { I18nMixin } from 'chrome://resources/cr_elements/i18n_mixin.js'; import { PolymerElement } from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import { BaseMixin } from '../base_mixin.js'; import {getTemplate} from './wallet_networks_list.html.js' diff --git a/browser/resources/settings/brave_wallet_page/wallet_networks_subpage.ts b/browser/resources/settings/brave_wallet_page/wallet_networks_subpage.ts index 405d8769292a..743586f31efa 100644 --- a/browser/resources/settings/brave_wallet_page/wallet_networks_subpage.ts +++ b/browser/resources/settings/brave_wallet_page/wallet_networks_subpage.ts @@ -8,7 +8,7 @@ import 'chrome://resources/cr_elements/cr_button/cr_button.js'; import './add_wallet_network_dialog.js'; import './wallet_networks_list.js'; -import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js'; +import {I18nMixin} from 'chrome://resources/cr_elements/i18n_mixin.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {BaseMixin} from '../base_mixin.js'; import {PrefsMixin} from '../prefs/prefs_mixin.js'; diff --git a/browser/resources/settings/default_brave_shields_page/brave_adblock_subpage.ts b/browser/resources/settings/default_brave_shields_page/brave_adblock_subpage.ts index 7379d9da64ea..0adfdb43b99f 100644 --- a/browser/resources/settings/default_brave_shields_page/brave_adblock_subpage.ts +++ b/browser/resources/settings/default_brave_shields_page/brave_adblock_subpage.ts @@ -5,7 +5,7 @@ // @ts-nocheck TODO(petemill): Define types and remove ts-nocheck -import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js'; +import {I18nMixin} from 'chrome://resources/cr_elements/i18n_mixin.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {BaseMixin} from '../base_mixin.js'; import {PrefsMixin} from '../prefs/prefs_mixin.js'; diff --git a/browser/resources/settings/default_brave_shields_page/components/brave_adblock_editor.ts b/browser/resources/settings/default_brave_shields_page/components/brave_adblock_editor.ts index 16affbe9b38f..a381132829c8 100644 --- a/browser/resources/settings/default_brave_shields_page/components/brave_adblock_editor.ts +++ b/browser/resources/settings/default_brave_shields_page/components/brave_adblock_editor.ts @@ -5,7 +5,7 @@ // @ts-nocheck TODO(petemill): Define types and remove ts-nocheck -import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js'; +import {I18nMixin} from 'chrome://resources/cr_elements/i18n_mixin.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {BaseMixin} from '../../base_mixin.js'; import {PrefsMixin} from '../../prefs/prefs_mixin.js'; diff --git a/browser/resources/settings/default_brave_shields_page/components/brave_adblock_subscribe_dropdown.ts b/browser/resources/settings/default_brave_shields_page/components/brave_adblock_subscribe_dropdown.ts index 8ea2463a4b9e..f911b693485e 100644 --- a/browser/resources/settings/default_brave_shields_page/components/brave_adblock_subscribe_dropdown.ts +++ b/browser/resources/settings/default_brave_shields_page/components/brave_adblock_subscribe_dropdown.ts @@ -4,7 +4,7 @@ // @ts-nocheck TODO(petemill): Define types and remove ts-nocheck -import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js'; +import {I18nMixin} from 'chrome://resources/cr_elements/i18n_mixin.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {BaseMixin} from '../../base_mixin.js'; import {PrefsMixin} from '../../prefs/prefs_mixin.js'; diff --git a/browser/resources/settings/default_brave_shields_page/default_brave_shields_page.ts b/browser/resources/settings/default_brave_shields_page/default_brave_shields_page.ts index ea559450fd82..35f462a21549 100644 --- a/browser/resources/settings/default_brave_shields_page/default_brave_shields_page.ts +++ b/browser/resources/settings/default_brave_shields_page/default_brave_shields_page.ts @@ -12,7 +12,7 @@ import { DefaultBraveShieldsBrowserProxyImpl } from './default_brave_shields_bro import {Router, RouteObserverMixin} from '../router.js'; import {loadTimeData} from '../i18n_setup.js'; -import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js'; +import {I18nMixin} from 'chrome://resources/cr_elements/i18n_mixin.js'; import {PrefsMixin} from '../prefs/prefs_mixin.js'; import {getTemplate} from './default_brave_shields_page.html.js' diff --git a/browser/resources/settings/pin_shortcut_page/pin_shortcut_page.ts b/browser/resources/settings/pin_shortcut_page/pin_shortcut_page.ts index f84c66c0f907..90be4a74922b 100644 --- a/browser/resources/settings/pin_shortcut_page/pin_shortcut_page.ts +++ b/browser/resources/settings/pin_shortcut_page/pin_shortcut_page.ts @@ -9,7 +9,7 @@ import '../settings_shared.css.js'; import '../settings_vars.css.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {WebUIListenerMixin} from 'chrome://resources/js/web_ui_listener_mixin.js'; +import {WebUIListenerMixin} from 'chrome://resources/cr_elements/web_ui_listener_mixin.js'; import {SettingsPinShortcutPageBrowserProxyImpl} from './pin_shortcut_page_browser_proxy.js'; import {getTemplate} from './pin_shortcut_page.html.js' diff --git a/browser/test/disabled_features/disable_client_hints_browsertest.cc b/browser/test/disabled_features/disable_client_hints_browsertest.cc index 8f48be1f8e75..6b112d2232dc 100644 --- a/browser/test/disabled_features/disable_client_hints_browsertest.cc +++ b/browser/test/disabled_features/disable_client_hints_browsertest.cc @@ -90,13 +90,13 @@ class ClientHintsBrowserTest void SetUp() override { // Test that even with CH features enabled, there is no header. - std::vector enabled_features; - std::vector disabled_features; + std::vector enabled_features; + std::vector disabled_features; for (const auto& feature : kTestFeatures) { if (IsClientHintHeaderEnabled()) { - enabled_features.push_back(feature); + enabled_features.push_back(feature.get()); } else { - disabled_features.push_back(feature); + disabled_features.push_back(feature.get()); } } diff --git a/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/BraveAutocompleteCoordinator.java b/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/BraveAutocompleteCoordinator.java index eac1b48a5f80..db151bc7ff53 100644 --- a/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/BraveAutocompleteCoordinator.java +++ b/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/BraveAutocompleteCoordinator.java @@ -23,7 +23,6 @@ import org.chromium.base.jank_tracker.JankTracker; import org.chromium.base.supplier.ObservableSupplier; import org.chromium.base.supplier.Supplier; -import org.chromium.chrome.browser.omnibox.LocationBarDataProvider; import org.chromium.chrome.browser.omnibox.R; import org.chromium.chrome.browser.omnibox.UrlBarEditingTextStateProvider; import org.chromium.chrome.browser.omnibox.suggestions.SuggestionListViewBinder.SuggestionListViewHolder; @@ -58,13 +57,12 @@ import java.util.List; public class BraveAutocompleteCoordinator { - public ViewProvider createViewProvider(Context context, - MVCListAdapter.ModelList modelList, LocationBarDataProvider locationBarDataProvider) { + public ViewProvider createViewProvider( + Context context, MVCListAdapter.ModelList modelList) { ViewProvider provider = (ViewProvider) BraveReflectionUtil.InvokeMethod( AutocompleteCoordinator.class, this, "createViewProvider", Context.class, - context, MVCListAdapter.ModelList.class, modelList, - LocationBarDataProvider.class, locationBarDataProvider); + context, MVCListAdapter.ModelList.class, modelList); return new ViewProvider() { private List> mCallbacks = new ArrayList<>(); diff --git a/browser/ui/android/strings/android_chrome_strings.grd b/browser/ui/android/strings/android_chrome_strings.grd index a8813f105731..960ac818e138 100644 --- a/browser/ui/android/strings/android_chrome_strings.grd +++ b/browser/ui/android/strings/android_chrome_strings.grd @@ -1694,14 +1694,6 @@ Your Brave account may have other forms of browsing history like searches and ac Discard
- - - Next - - - Ask when to save files - - Download location @@ -1844,26 +1836,26 @@ Your Brave account may have other forms of browsing history like searches and ac Allow all sites - - + + %1$sAlice wants you to approve this website: - + All pages of %1$snetflix.com - + Approve - + Don’t approve - + Option to approve or not approve a website - + Option to approve or not approve a website opened at full height - + Option to approve or not approve a website closed @@ -2253,20 +2245,6 @@ To change this setting, <resetlink>reset sync

- - {FILE_COUNT, plural, - =1 {1 download scheduled} - other {# downloads scheduled}} - - - Download will start when on Wi-Fi - - - Download will start on %1$sFeb 28 2020. - - - Download will start at %1$s8:30PM. - Download file? @@ -2426,9 +2404,6 @@ To change this setting, <resetlink>reset sync

Add to reading list <new>New</new> - - Fast page - Share highlight @@ -2746,9 +2721,6 @@ To change this setting, <resetlink>reset sync

Just now - - Scheduled for later - Offline Home @@ -2982,7 +2954,7 @@ To change this setting, <resetlink>reset sync

- + Continue as %1$sJohn @@ -3133,6 +3105,9 @@ To change this setting, <resetlink>reset sync

Manage + + Creator Profile + Activity @@ -3203,6 +3178,7 @@ To change this setting, <resetlink>reset sync

Control your stories and activity here + New Options for Discover @@ -3262,9 +3238,6 @@ To change this setting, <resetlink>reset sync

Explore - - More categories - Finding the best from the web… @@ -3558,6 +3531,9 @@ To change this setting, <resetlink>reset sync

Group tabs + + Select tabs + Track prices @@ -3855,6 +3831,9 @@ To change this setting, <resetlink>reset sync

View + + Simplify page + Bookmarks and web history @@ -4183,8 +4162,8 @@ To change this setting, <resetlink>reset sync

Following %1$sReuters - - Go to feed + + Go to Following Can’t follow. Something went wrong. @@ -4213,8 +4192,11 @@ To change this setting, <resetlink>reset sync

Soon, you’ll see stories from %1$sReuters when you open a new tab. Sites you follow are saved in your Brave account. You can manage them in Discover settings. - - Open a new tab + + Go to Following + + + Got it @@ -4558,18 +4540,6 @@ To change this setting, <resetlink>reset sync

To manage your Brave account, tap the "Manage account" button - - Search with your voice - - - Tap the mic to search with your voice - - - Try “What’s the weather today?” - - - To check the weather, tap the mic and say “What’s the weather today?” - See your top sites diff --git a/browser/ui/toolbar/brave_app_menu_model.cc b/browser/ui/toolbar/brave_app_menu_model.cc index 98ead09b02e6..b126b7480d7f 100644 --- a/browser/ui/toolbar/brave_app_menu_model.cc +++ b/browser/ui/toolbar/brave_app_menu_model.cc @@ -138,8 +138,9 @@ bool IpnsKeysAvailable(content::BrowserContext* browser_context) { BraveAppMenuModel::BraveAppMenuModel( ui::AcceleratorProvider* provider, Browser* browser, - AppMenuIconController* app_menu_icon_controller) - : AppMenuModel(provider, browser, app_menu_icon_controller) + AppMenuIconController* app_menu_icon_controller, + AlertMenuItem alert_item) + : AppMenuModel(provider, browser, app_menu_icon_controller, alert_item) #if BUILDFLAG(ENABLE_IPFS_LOCAL_NODE) , ipfs_submenu_model_(this), diff --git a/browser/ui/toolbar/brave_app_menu_model.h b/browser/ui/toolbar/brave_app_menu_model.h index 787ab242b491..72e149df3056 100644 --- a/browser/ui/toolbar/brave_app_menu_model.h +++ b/browser/ui/toolbar/brave_app_menu_model.h @@ -28,7 +28,8 @@ class BraveAppMenuModel : public AppMenuModel { public: BraveAppMenuModel(ui::AcceleratorProvider* provider, Browser* browser, - AppMenuIconController* app_menu_icon_controller = nullptr); + AppMenuIconController* app_menu_icon_controller = nullptr, + AlertMenuItem alert_item = AlertMenuItem::kNone); ~BraveAppMenuModel() override; BraveAppMenuModel(const BraveAppMenuModel&) = delete; diff --git a/browser/ui/views/brave_first_run_dialog.cc b/browser/ui/views/brave_first_run_dialog.cc index 14bcad2afee9..bc4d033aa6c2 100644 --- a/browser/ui/views/brave_first_run_dialog.cc +++ b/browser/ui/views/brave_first_run_dialog.cc @@ -33,7 +33,7 @@ namespace { -void ShowBraveFirstRunDialogViews(Profile* profile) { +void ShowBraveFirstRunDialogViews() { base::RunLoop run_loop(base::RunLoop::Type::kNestableTasksAllowed); BraveFirstRunDialog::Show(run_loop.QuitClosure()); run_loop.Run(); @@ -71,14 +71,14 @@ END_METADATA namespace first_run { -void ShowFirstRunDialog(Profile* profile) { +void ShowFirstRunDialog() { #if BUILDFLAG(IS_MAC) if (base::FeatureList::IsEnabled(features::kViewsFirstRunDialog)) - ShowBraveFirstRunDialogViews(profile); + ShowBraveFirstRunDialogViews(); else - ShowFirstRunDialogCocoa(profile); + ShowFirstRunDialogCocoa(); #else - ShowBraveFirstRunDialogViews(profile); + ShowBraveFirstRunDialogViews(); #endif } diff --git a/browser/ui/views/permission_bubble/brave_wallet_permission_prompt_impl.cc b/browser/ui/views/permission_bubble/brave_wallet_permission_prompt_impl.cc index 44616bfc8e2f..53e083855050 100644 --- a/browser/ui/views/permission_bubble/brave_wallet_permission_prompt_impl.cc +++ b/browser/ui/views/permission_bubble/brave_wallet_permission_prompt_impl.cc @@ -30,7 +30,10 @@ void BraveWalletPermissionPromptImpl::ShowBubble() { ->ShowBubble(); } -void BraveWalletPermissionPromptImpl::UpdateAnchor() {} +bool BraveWalletPermissionPromptImpl::UpdateAnchor() { + // Returning false will force the caller to recreate the view. + return false; +} permissions::PermissionPrompt::TabSwitchingBehavior BraveWalletPermissionPromptImpl::GetTabSwitchingBehavior() { diff --git a/browser/ui/views/permission_bubble/brave_wallet_permission_prompt_impl.h b/browser/ui/views/permission_bubble/brave_wallet_permission_prompt_impl.h index 520e1df28e7b..21756417ad28 100644 --- a/browser/ui/views/permission_bubble/brave_wallet_permission_prompt_impl.h +++ b/browser/ui/views/permission_bubble/brave_wallet_permission_prompt_impl.h @@ -25,7 +25,7 @@ class BraveWalletPermissionPromptImpl : public permissions::PermissionPrompt { const BraveWalletPermissionPromptImpl&) = delete; // permissions::PermissionPrompt: - void UpdateAnchor() override; + bool UpdateAnchor() override; TabSwitchingBehavior GetTabSwitchingBehavior() override; permissions::PermissionPromptDisposition GetPromptDisposition() const override; diff --git a/browser/ui/views/sidebar/sidebar_items_contents_view.cc b/browser/ui/views/sidebar/sidebar_items_contents_view.cc index 982069807824..db61a0f6645c 100644 --- a/browser/ui/views/sidebar/sidebar_items_contents_view.cc +++ b/browser/ui/views/sidebar/sidebar_items_contents_view.cc @@ -34,7 +34,7 @@ #include "ui/base/default_style.h" #include "ui/base/metadata/metadata_impl_macros.h" #include "ui/base/resource/resource_bundle.h" -#include "ui/base/window_open_disposition.h" +#include "ui/base/window_open_disposition_utils.h" #include "ui/compositor/compositor.h" #include "ui/events/event.h" #include "ui/gfx/canvas.h" diff --git a/browser/ui/views/tabs/brave_tab_context_menu_contents.h b/browser/ui/views/tabs/brave_tab_context_menu_contents.h index da570cb8ad8b..a617bdb3b127 100644 --- a/browser/ui/views/tabs/brave_tab_context_menu_contents.h +++ b/browser/ui/views/tabs/brave_tab_context_menu_contents.h @@ -17,6 +17,10 @@ class BraveTabMenuModel; class Browser; class Tab; +namespace gfx { +class Point; +} // namespace gfx + namespace sessions { class TabRestoreService; } // namespace sessions diff --git a/browser/ui/views/tabs/features.cc b/browser/ui/views/tabs/features.cc index 75758a4fc4ca..8f5046ab9312 100644 --- a/browser/ui/views/tabs/features.cc +++ b/browser/ui/views/tabs/features.cc @@ -10,8 +10,9 @@ namespace tabs { namespace features { -const base::Feature kBraveVerticalTabs{"BraveVerticalTabs", - base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kBraveVerticalTabs, + "BraveVerticalTabs", + base::FEATURE_DISABLED_BY_DEFAULT); bool ShouldShowVerticalTabs() { // TODO(sangwoo.ko) This should consider pref too. diff --git a/browser/ui/views/tabs/features.h b/browser/ui/views/tabs/features.h index 08064b25fa3b..48e77c4179d6 100644 --- a/browser/ui/views/tabs/features.h +++ b/browser/ui/views/tabs/features.h @@ -7,6 +7,7 @@ #define BRAVE_BROWSER_UI_VIEWS_TABS_FEATURES_H_ #include "base/compiler_specific.h" +#include "base/feature_list.h" namespace base { struct LOGICALLY_CONST Feature; @@ -15,7 +16,7 @@ struct LOGICALLY_CONST Feature; namespace tabs { namespace features { -extern const base::Feature kBraveVerticalTabs; +BASE_DECLARE_FEATURE(kBraveVerticalTabs); // Returns true when users chose to use vertical tabs bool ShouldShowVerticalTabs(); diff --git a/browser/ui/views/toolbar/brave_toolbar_view.cc b/browser/ui/views/toolbar/brave_toolbar_view.cc index e5240069789d..baaa4d851041 100644 --- a/browser/ui/views/toolbar/brave_toolbar_view.cc +++ b/browser/ui/views/toolbar/brave_toolbar_view.cc @@ -28,7 +28,7 @@ #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h" #include "components/bookmarks/common/bookmark_pref_names.h" #include "components/prefs/pref_service.h" -#include "ui/base/window_open_disposition.h" +#include "ui/base/window_open_disposition_utils.h" #include "ui/events/event.h" #if BUILDFLAG(ENABLE_BRAVE_VPN) diff --git a/browser/ui/webui/brave_wallet/ledger/ledger_ui.cc b/browser/ui/webui/brave_wallet/ledger/ledger_ui.cc index 014f94582c1a..e1dcbd6a2bcb 100644 --- a/browser/ui/webui/brave_wallet/ledger/ledger_ui.cc +++ b/browser/ui/webui/brave_wallet/ledger/ledger_ui.cc @@ -28,8 +28,8 @@ UntrustedLedgerUI::UntrustedLedgerUI(content::WebUI* web_ui) untrusted_source->OverrideContentSecurityPolicy( network::mojom::CSPDirectiveName::StyleSrc, std::string("style-src 'unsafe-inline';")); - untrusted_source->AddResourcePath("load_time_data.js", - IDR_WEBUI_JS_LOAD_TIME_DATA_JS); + untrusted_source->AddResourcePath("load_time_data_deprecated.js", + IDR_WEBUI_JS_LOAD_TIME_DATA_DEPRECATED_JS); untrusted_source->UseStringsJs(); untrusted_source->AddString("braveWalletLedgerBridgeUrl", kUntrustedLedgerURL); diff --git a/browser/ui/webui/brave_wallet/market/market_ui.cc b/browser/ui/webui/brave_wallet/market/market_ui.cc index b4526a693c1a..1fc033e72b60 100644 --- a/browser/ui/webui/brave_wallet/market/market_ui.cc +++ b/browser/ui/webui/brave_wallet/market/market_ui.cc @@ -54,8 +54,8 @@ UntrustedMarketUI::UntrustedMarketUI(content::WebUI* web_ui) network::mojom::CSPDirectiveName::ImgSrc, std::string("img-src 'self' https://assets.cgproxy.brave.com;")); - untrusted_source->AddResourcePath("load_time_data.js", - IDR_WEBUI_JS_LOAD_TIME_DATA_JS); + untrusted_source->AddResourcePath("load_time_data_deprecated.js", + IDR_WEBUI_JS_LOAD_TIME_DATA_DEPRECATED_JS); untrusted_source->UseStringsJs(); untrusted_source->AddString("braveWalletTrezorBridgeUrl", kUntrustedTrezorURL); diff --git a/browser/ui/webui/brave_wallet/nft/nft_ui.cc b/browser/ui/webui/brave_wallet/nft/nft_ui.cc index ef7de858dba0..d6d636e67176 100644 --- a/browser/ui/webui/brave_wallet/nft/nft_ui.cc +++ b/browser/ui/webui/brave_wallet/nft/nft_ui.cc @@ -49,8 +49,8 @@ UntrustedNftUI::UntrustedNftUI(content::WebUI* web_ui) untrusted_source->OverrideContentSecurityPolicy( network::mojom::CSPDirectiveName::FontSrc, std::string("font-src 'self' data:;")); - untrusted_source->AddResourcePath("load_time_data.js", - IDR_WEBUI_JS_LOAD_TIME_DATA_JS); + untrusted_source->AddResourcePath("load_time_data_deprecated.js", + IDR_WEBUI_JS_LOAD_TIME_DATA_DEPRECATED_JS); untrusted_source->UseStringsJs(); untrusted_source->AddString("braveWalletNftBridgeUrl", kUntrustedNftURL); untrusted_source->AddString("braveWalletTrezorBridgeUrl", diff --git a/browser/ui/webui/brave_wallet/trezor/trezor_ui.cc b/browser/ui/webui/brave_wallet/trezor/trezor_ui.cc index 735be5a8620d..567dfb76a50d 100644 --- a/browser/ui/webui/brave_wallet/trezor/trezor_ui.cc +++ b/browser/ui/webui/brave_wallet/trezor/trezor_ui.cc @@ -39,8 +39,8 @@ UntrustedTrezorUI::UntrustedTrezorUI(content::WebUI* web_ui) untrusted_source->OverrideContentSecurityPolicy( network::mojom::CSPDirectiveName::StyleSrc, std::string("style-src 'unsafe-inline';")); - untrusted_source->AddResourcePath("load_time_data.js", - IDR_WEBUI_JS_LOAD_TIME_DATA_JS); + untrusted_source->AddResourcePath("load_time_data_deprecated.js", + IDR_WEBUI_JS_LOAD_TIME_DATA_DEPRECATED_JS); untrusted_source->UseStringsJs(); untrusted_source->AddString("braveWalletTrezorBridgeUrl", kUntrustedTrezorURL); diff --git a/browser/ui/webui/ethereum_remote_client/ethereum_remote_client_page.html b/browser/ui/webui/ethereum_remote_client/ethereum_remote_client_page.html index 7839cbc87dd3..6d1d95aa1334 100644 --- a/browser/ui/webui/ethereum_remote_client/ethereum_remote_client_page.html +++ b/browser/ui/webui/ethereum_remote_client/ethereum_remote_client_page.html @@ -7,7 +7,7 @@ - + diff --git a/browser/ui/webui/settings/brave_sync_handler.cc b/browser/ui/webui/settings/brave_sync_handler.cc index a511fcaf7317..03a818439ad8 100644 --- a/browser/ui/webui/settings/brave_sync_handler.cc +++ b/browser/ui/webui/settings/brave_sync_handler.cc @@ -189,7 +189,7 @@ void BraveSyncHandler::HandleGetQRCode(const base::Value::List& args) { qrcode_generator::mojom::GenerateQRCodeRequest::New(); request->data = qr_code_string; request->should_render = true; - request->render_dino = true; + request->center_image = qrcode_generator::mojom::CenterImage::CHROME_DINO; request->render_module_style = qrcode_generator::mojom::ModuleStyle::CIRCLES; request->render_locator_style = qrcode_generator::mojom::LocatorStyle::ROUNDED; diff --git a/browser/ui/window_closing_confirm_browsertest.cc b/browser/ui/window_closing_confirm_browsertest.cc index 137d4777abab..1d0cc97b97aa 100644 --- a/browser/ui/window_closing_confirm_browsertest.cc +++ b/browser/ui/window_closing_confirm_browsertest.cc @@ -12,6 +12,7 @@ #include "chrome/browser/download/download_manager_utils.h" #include "chrome/browser/download/download_prefs.h" #include "chrome/browser/lifetime/application_lifetime.h" +#include "chrome/browser/lifetime/application_lifetime_desktop.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" diff --git a/browser/widevine/widevine_permission_request_browsertest.cc b/browser/widevine/widevine_permission_request_browsertest.cc index 9c439c4ed71f..683b8da4f783 100644 --- a/browser/widevine/widevine_permission_request_browsertest.cc +++ b/browser/widevine/widevine_permission_request_browsertest.cc @@ -39,7 +39,7 @@ namespace { class TestObserver : public permissions::PermissionRequestManager::Observer { public: - void OnBubbleAdded() override { + void OnPromptAdded() override { added_count_++; bubble_added_ = true; } diff --git a/build/android/bytecode/java/org/brave/bytecode/BraveToolbarManagerClassAdapter.java b/build/android/bytecode/java/org/brave/bytecode/BraveToolbarManagerClassAdapter.java index 6aeb408fe82c..5c99109c2aa6 100644 --- a/build/android/bytecode/java/org/brave/bytecode/BraveToolbarManagerClassAdapter.java +++ b/build/android/bytecode/java/org/brave/bytecode/BraveToolbarManagerClassAdapter.java @@ -62,8 +62,8 @@ public BraveToolbarManagerClassAdapter(ClassVisitor visitor) { deleteField(sBraveToolbarManagerClassName, "mToolbar"); makeProtectedField(sToolbarManagerClassName, "mToolbar"); - deleteField(sBraveToolbarManagerClassName, "mBookmarkBridgeSupplier"); - makeProtectedField(sToolbarManagerClassName, "mBookmarkBridgeSupplier"); + deleteField(sBraveToolbarManagerClassName, "mBookmarkModelSupplier"); + makeProtectedField(sToolbarManagerClassName, "mBookmarkModelSupplier"); deleteField(sBraveToolbarManagerClassName, "mLayoutManager"); makeProtectedField(sToolbarManagerClassName, "mLayoutManager"); diff --git a/build/commands/lib/config.js b/build/commands/lib/config.js index 61a26b4a3e62..eb8d371be08f 100644 --- a/build/commands/lib/config.js +++ b/build/commands/lib/config.js @@ -193,7 +193,7 @@ const Config = function () { } } -Config.prototype.isOfficialBuild = function () { +Config.prototype.isReleaseBuild = function () { return this.buildConfig === 'Release' } @@ -263,10 +263,11 @@ Config.prototype.buildArgs = function () { proprietary_codecs: true, ffmpeg_branding: "Chrome", branding_path_component: "brave", + branding_path_product: "brave", enable_nacl: false, enable_widevine: true, target_cpu: this.targetArch, - is_official_build: this.isOfficialBuild() && !this.isAsan(), + is_official_build: this.isReleaseBuild() && !this.isAsan(), is_debug: this.isDebug(), dcheck_always_on: getNPMConfig(['dcheck_always_on']) || this.isComponentBuild(), brave_channel: this.channel, @@ -323,6 +324,10 @@ Config.prototype.buildArgs = function () { ...this.extraGnArgs, } + if (!args.is_official_build) { + args.branding_path_product += "-development" + } + if (!this.isBraveReleaseBuild()) { args.chrome_pgo_phase = 0 @@ -392,13 +397,13 @@ Config.prototype.buildArgs = function () { args.cc_wrapper = path.join(this.nativeRedirectCCDir, 'redirect_cc') } - if (this.targetArch === 'x86' && - (process.platform === 'linux' || this.getTargetOS() === 'win')) { + if ((this.getTargetOS() === 'linux' && this.targetArch === 'x86') || + (this.getTargetOS() === 'win' && this.isBraveReleaseBuild())) { // Minimal symbols to work around size restrictions: // On Linux x86, ELF32 cannot be > 4GiB. - // For x86 Windows, chrome.dll.pdb sometimes becomes > 4 GiB and - // llvm-pdbutil on that file errors out with "The data is in an unexpected - // format. Too many directory blocks". Associated llvm issue: + // For x86, x64, and Arm64 Windows, chrome.dll.pdb sometimes becomes + // > 4 GiB and llvm-pdbutil on that file errors out with "The data is in an + // unexpected format. Too many directory blocks". Associated llvm issue: // https://github.com/llvm/llvm-project/issues/54445 args.symbol_level = 1 } @@ -449,7 +454,7 @@ Config.prototype.buildArgs = function () { if (this.targetOS === 'android') { args.android_channel = this.channel args.enable_jdk_library_desugaring = false - if (!this.isOfficialBuild()) { + if (!this.isReleaseBuild()) { args.android_channel = 'default' args.chrome_public_manifest_package = 'com.brave.browser_default' } else if (this.channel === '') { @@ -545,8 +550,8 @@ Config.prototype.buildArgs = function () { delete args.proprietary_codecs delete args.ffmpeg_branding delete args.branding_path_component + delete args.branding_path_product delete args.enable_nacl - delete args.branding_path_component delete args.enable_widevine delete args.enable_hangout_services_extension delete args.brave_google_api_endpoint diff --git a/build/commands/scripts/checkSecurity.js b/build/commands/scripts/checkSecurity.js index b3c924ba823e..1a594d3c4a32 100644 --- a/build/commands/scripts/checkSecurity.js +++ b/build/commands/scripts/checkSecurity.js @@ -7,7 +7,7 @@ const execSync = require('child_process').execSync // Grep for any usage of innerHTML / document.write. // Ping @security-team before changing this. -const cmd = "git grep -i -E --not -e '^\\s*//' --and -e '(innerHTML|document\\.write)' ':(exclude)*test.cc' ':(exclude)test/*' ':(exclude)*.json' ':(exclude)build/*' ':(exclude)*browsertest*.cc'" +const cmd = "git grep -i -E --not -e '^\\s*//' --and -e '(innerHTML|document\\.write)' ':(exclude)*test.cc' ':(exclude)test/*' ':(exclude)*.json' ':(exclude)build/*' ':(exclude)*browsertest*.cc' ':(exclude)ui/webui/resources/i18n_behavior.ts'" try { const stdout = execSync(cmd) diff --git a/build/ios/mojom/mojom_objc_generator.py b/build/ios/mojom/mojom_objc_generator.py index 11de5e5ca8c5..adc824a1fda1 100644 --- a/build/ios/mojom/mojom_objc_generator.py +++ b/build/ios/mojom/mojom_objc_generator.py @@ -173,15 +173,16 @@ def DefaultObjCValue(self, default): return "@[]" def ObjCToCpp(self, accessor): local_var_name = _RandomLocalVarName() - args = (self.wrappedTypemap.ExpectedCppType(), + args = (self.wrappedTypemap.ExpectedCppType(), local_var_name, self.wrappedTypemap.ObjCWrappedType(), local_var_name, - accessor, self.wrappedTypemap.ObjCToCpp(local_var_name)) + accessor, local_var_name, self.wrappedTypemap.ObjCToCpp( + local_var_name), local_var_name) return """^{ - std::vector<%s> array; + std::vector<%s> array_%s; for (%s %s in %s) { - array.push_back(%s); + array_%s.push_back(%s); } - return array; + return array_%s; }()""" % args def CppToObjC(self, accessor): args = (accessor, self.wrappedTypemap.CppToObjC("o")) diff --git a/build/ios/mojom/objc_templates/private_interface_implementation.tmpl b/build/ios/mojom/objc_templates/private_interface_implementation.tmpl index 3c56b7237ef2..64b0fd667147 100644 --- a/build/ios/mojom/objc_templates/private_interface_implementation.tmpl +++ b/build/ios/mojom/objc_templates/private_interface_implementation.tmpl @@ -24,13 +24,13 @@ {%- if method.response_parameters %} auto callback = ^( {%- for param in method.response_parameters -%} -{{param.kind|expected_cpp_param_type}} {{param.name}} +{{param.kind|expected_cpp_param_type}} {{param.name}}_arg {%- if not loop.last %}, {% endif -%} {%- endfor -%} ) { completion( {%- for param in method.response_parameters -%} -{{param|cpp_to_objc_assign}} +{{param|cpp_to_objc_assign('','_arg')}} {%- if not loop.last %}, {% endif -%} {%- endfor -%} ); diff --git a/chromium_src/android_webview/common/aw_features.cc b/chromium_src/android_webview/common/aw_features.cc new file mode 100644 index 000000000000..e9ae570035ba --- /dev/null +++ b/chromium_src/android_webview/common/aw_features.cc @@ -0,0 +1,20 @@ +/* Copyright (c) 2022 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#include "android_webview/common/aw_features.h" + +#include "src/android_webview/common/aw_features.cc" + +#include "base/feature_override.h" + +namespace android_webview { +namespace features { + +OVERRIDE_FEATURE_DEFAULT_STATES({{ + {kWebViewClientHintsControllerDelegate, base::FEATURE_DISABLED_BY_DEFAULT}, +}}); + +} // namespace features +} // namespace android_webview diff --git a/chromium_src/chrome/browser/first_run/first_run_dialog.h b/chromium_src/chrome/browser/first_run/first_run_dialog.h index 69e6fef1ba30..9fa264f3727c 100644 --- a/chromium_src/chrome/browser/first_run/first_run_dialog.h +++ b/chromium_src/chrome/browser/first_run/first_run_dialog.h @@ -18,7 +18,7 @@ namespace first_run { // Enable first run dialog on Win also. // Upstream only uses it for macOS/Linux. -void ShowFirstRunDialog(Profile* profile); +void ShowFirstRunDialog(); } // namespace first_run diff --git a/chromium_src/chrome/browser/first_run/first_run_internal_win.cc b/chromium_src/chrome/browser/first_run/first_run_internal_win.cc index 46ecb78f71ea..f54560a1ecab 100644 --- a/chromium_src/chrome/browser/first_run/first_run_internal_win.cc +++ b/chromium_src/chrome/browser/first_run/first_run_internal_win.cc @@ -28,12 +28,12 @@ bool ShouldShowFirstRunDialog() { namespace first_run { namespace internal { -void DoPostImportPlatformSpecificTasks(Profile* profile) { +void DoPostImportPlatformSpecificTasks() { if (ShouldShowFirstRunDialog()) { - ShowFirstRunDialog(profile); + ShowFirstRunDialog(); } - DoPostImportPlatformSpecificTasks_ChromiumImpl(profile); + DoPostImportPlatformSpecificTasks_ChromiumImpl(); } } // namespace internal diff --git a/chromium_src/chrome/browser/privacy_sandbox/BUILD.gn b/chromium_src/chrome/browser/privacy_sandbox/BUILD.gn deleted file mode 100644 index 166e91b8b754..000000000000 --- a/chromium_src/chrome/browser/privacy_sandbox/BUILD.gn +++ /dev/null @@ -1,37 +0,0 @@ -# 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_service_unittest.cc" ] - - deps = [ - "//base", - "//chrome/browser", - "//chrome/common:chrome_features", - "//chrome/test:test_support", - "//components/browsing_topics", - "//components/content_settings/core/browser", - "//components/content_settings/core/common", - "//components/content_settings/core/test:test_support", - "//components/policy/core/common:test_support", - "//components/privacy_sandbox:privacy_sandbox", - "//components/privacy_sandbox:privacy_sandbox_prefs", - "//components/privacy_sandbox:test_support", - "//components/signin/public/identity_manager", - "//components/signin/public/identity_manager:test_support", - "//components/strings:components_strings", - "//components/sync:test_support", - "//components/sync/base", - "//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_service_unittest.cc b/chromium_src/chrome/browser/privacy_sandbox/privacy_sandbox_service_unittest.cc deleted file mode 100644 index 59bfde2564f1..000000000000 --- a/chromium_src/chrome/browser/privacy_sandbox/privacy_sandbox_service_unittest.cc +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright 2021 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. - -#include "chrome/browser/privacy_sandbox/privacy_sandbox_service.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/privacy_sandbox/privacy_sandbox_service.h" -#include "chrome/browser/privacy_sandbox/privacy_sandbox_settings_factory.h" -#include "chrome/browser/signin/identity_manager_factory.h" -#include "chrome/common/chrome_features.h" -#include "chrome/test/base/testing_profile.h" -#include "components/browsing_topics/browsing_topics_service.h" -#include "components/browsing_topics/test_util.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/policy/core/common/mock_policy_service.h" -#include "components/privacy_sandbox/privacy_sandbox_prefs.h" -#include "components/privacy_sandbox/privacy_sandbox_settings.h" -#include "components/privacy_sandbox/privacy_sandbox_test_util.h" -#include "components/profile_metrics/browser_profile_type.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/test/test_sync_service.h" -#include "components/sync_preferences/testing_pref_service_syncable.h" -#include "content/public/browser/browsing_data_remover.h" -#include "content/public/browser/interest_group_manager.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 "ui/base/l10n/l10n_util.h" -#include "url/origin.h" - -#if !BUILDFLAG(IS_ANDROID) -#include "chrome/browser/ui/hats/mock_trust_safety_sentiment_service.h" -#endif - -namespace { - -class TestInterestGroupManager : public content::InterestGroupManager { - public: - void SetInterestGroupJoiningOrigins(const std::vector& origins) { - origins_ = origins; - } - - // content::InterestGroupManager: - void GetAllInterestGroupJoiningOrigins( - base::OnceCallback)> callback) override { - std::move(callback).Run(origins_); - } - - private: - std::vector origins_; -}; - -} // namespace - -class PrivacySandboxServiceTest : public testing::Test { - public: - PrivacySandboxServiceTest() - : browser_task_environment_( - base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} - - void SetUp() override { - InitializePrefsBeforeStart(); - -#if !BUILDFLAG(IS_ANDROID) - mock_sentiment_service_ = - std::make_unique<::testing::NiceMock>( - profile()); -#endif - privacy_sandbox_service_ = std::make_unique( - PrivacySandboxSettingsFactory::GetForProfile(profile()), - CookieSettingsFactory::GetForProfile(profile()).get(), - profile()->GetPrefs(), test_interest_group_manager(), - profile_metrics::BrowserProfileType::kRegular, browsing_data_remover(), -#if !BUILDFLAG(IS_ANDROID) - mock_sentiment_service(), -#endif - mock_browsing_topics_service()); - } - - virtual void InitializePrefsBeforeStart() {} - - TestingProfile* profile() { return &profile_; } - PrivacySandboxService* privacy_sandbox_service() { - return privacy_sandbox_service_.get(); - } - privacy_sandbox::PrivacySandboxSettings* privacy_sandbox_settings() { - return PrivacySandboxSettingsFactory::GetForProfile(profile()); - } - - base::test::ScopedFeatureList* feature_list() { return &feature_list_; } - sync_preferences::TestingPrefServiceSyncable* prefs() { - return profile()->GetTestingPrefService(); - } - HostContentSettingsMap* host_content_settings_map() { - return HostContentSettingsMapFactory::GetForProfile(profile()); - } - syncer::TestSyncService* sync_service() { return &sync_service_; } - policy::MockPolicyService* policy_service() { return &mock_policy_service_; } - signin::IdentityTestEnvironment* identity_test_env() { - return &identity_test_env_; - } - TestInterestGroupManager* test_interest_group_manager() { - return &test_interest_group_manager_; - } - content::BrowsingDataRemover* browsing_data_remover() { - return profile()->GetBrowsingDataRemover(); - } - browsing_topics::MockBrowsingTopicsService* mock_browsing_topics_service() { - return mock_browsing_topics_service_; - } -#if !BUILDFLAG(IS_ANDROID) - MockTrustSafetySentimentService* mock_sentiment_service() { - return mock_sentiment_service_.get(); - } -#endif - - 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_; - TestInterestGroupManager test_interest_group_manager_; - - std::unique_ptr privacy_sandbox_service_; - browsing_topics::MockBrowsingTopicsService* mock_browsing_topics_service_; -#if !BUILDFLAG(IS_ANDROID) - std::unique_ptr mock_sentiment_service_; -#endif -}; diff --git a/chromium_src/chrome/browser/search_engines/template_url_service_factory.h b/chromium_src/chrome/browser/search_engines/template_url_service_factory.h index ea94a616b3bb..368a484b7f7c 100644 --- a/chromium_src/chrome/browser/search_engines/template_url_service_factory.h +++ b/chromium_src/chrome/browser/search_engines/template_url_service_factory.h @@ -6,6 +6,7 @@ #ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_FACTORY_H_ #define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_FACTORY_H_ +#include "chrome/browser/profiles/profile_keyed_service_factory.h" #include "components/keyed_service/content/browser_context_keyed_service_factory.h" #include "content/public/browser/browser_context.h" diff --git a/chromium_src/chrome/browser/ui/views/first_run_dialog.cc b/chromium_src/chrome/browser/ui/views/first_run_dialog.cc index ac3ba84d308a..098d0e9dae90 100644 --- a/chromium_src/chrome/browser/ui/views/first_run_dialog.cc +++ b/chromium_src/chrome/browser/ui/views/first_run_dialog.cc @@ -3,6 +3,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include "chrome/browser/ui/views/first_run_dialog.h" + // We use our own FirstRun dialog on Windows/Linux. // ShowFirstRunDialog() is re-defined at brave_first_run_dialog.cc. #define ShowFirstRunDialog ShowFirstRunDialog_UnUsed diff --git a/chromium_src/chrome/browser/ui/views/permissions/chip_controller.cc b/chromium_src/chrome/browser/ui/views/permissions/chip_controller.cc new file mode 100644 index 000000000000..37cded55bade --- /dev/null +++ b/chromium_src/chrome/browser/ui/views/permissions/chip_controller.cc @@ -0,0 +1,10 @@ +// Copyright (c) 2022 The Brave Authors. All rights reserved. +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this file, +// you can obtain one at http://mozilla.org/MPL/2.0/. + +// Workaround for startup crash when GetLocationBarView() here returns nullptr. +#define BRAVE_CHIP_CONTROLLER_HIDE_CHIP if (GetLocationBarView()) + +#include "src/chrome/browser/ui/views/permissions/chip_controller.cc" +#undef BRAVE_CHIP_CONTROLLER_HIDE_CHIP diff --git a/chromium_src/chrome/browser/ui/views/tabs/tab_hover_card_bubble_view_browsertest.cc b/chromium_src/chrome/browser/ui/views/tabs/tab_hover_card_bubble_view_browsertest.cc index 5d4c90fe5719..ad4c6573cf71 100644 --- a/chromium_src/chrome/browser/ui/views/tabs/tab_hover_card_bubble_view_browsertest.cc +++ b/chromium_src/chrome/browser/ui/views/tabs/tab_hover_card_bubble_view_browsertest.cc @@ -11,102 +11,68 @@ #include "chrome/browser/ui/browser_command_controller.h" #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_list.h" +#include "chrome/browser/ui/tabs/tab_renderer_data.h" #include "chrome/browser/ui/test/test_browser_dialog.h" -#include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/tabs/tab.h" -#include "chrome/browser/ui/views/tabs/tab_close_button.h" -#include "chrome/browser/ui/views/tabs/tab_hover_card_bubble_view.h" -#include "chrome/browser/ui/views/tabs/tab_hover_card_controller.h" -#include "chrome/browser/ui/views/tabs/tab_hover_card_metrics.h" +#include "chrome/browser/ui/views/tabs/tab_hover_card_test_util.h" #include "chrome/browser/ui/views/tabs/tab_strip.h" -#include "chrome/grit/generated_resources.h" -#include "chrome/test/base/ui_test_utils.h" #include "content/public/test/browser_test.h" -#include "ui/gfx/animation/animation_test_api.h" -#include "ui/views/controls/label.h" -#include "ui/views/test/widget_test.h" -#include "ui/views/widget/widget.h" -#include "ui/views/widget/widget_observer.h" +#include "url/gurl.h" -using views::Widget; +namespace { -class TabHoverCardBubbleViewBrowserTest : public DialogBrowserTest { +constexpr char16_t kTabDomain[] = u"brave://settings"; +constexpr char16_t kTabTitle[] = u"Settings - Addresses and more"; +constexpr char kTabUrl[] = "chrome://settings/addresses"; + +} // namespace + +class TabHoverCardBubbleViewBrowserTest : public DialogBrowserTest, + public test::TabHoverCardTestUtil { public: - TabHoverCardBubbleViewBrowserTest() - : animation_mode_reset_(gfx::AnimationTestApi::SetRichAnimationRenderMode( - gfx::Animation::RichAnimationRenderMode::FORCE_DISABLED)) { - TabHoverCardController::disable_animations_for_testing_ = true; - } + TabHoverCardBubbleViewBrowserTest() = default; + TabHoverCardBubbleViewBrowserTest(const TabHoverCardBubbleViewBrowserTest&) = delete; TabHoverCardBubbleViewBrowserTest& operator=( const TabHoverCardBubbleViewBrowserTest&) = delete; - ~TabHoverCardBubbleViewBrowserTest() override = default; - - void SetUpOnMainThread() override { - DialogBrowserTest::SetUpOnMainThread(); - tab_strip_ = BrowserView::GetBrowserViewForBrowser(browser())->tabstrip(); - } - - TabStrip* tab_strip() { return tab_strip_; } - - TabHoverCardBubbleView* hover_card() { - return tab_strip()->hover_card_controller_->hover_card_; - } - - std::u16string GetHoverCardTitle() { - return hover_card()->GetTitleTextForTesting(); - } - - std::u16string GetHoverCardDomain() { - return hover_card()->GetDomainTextForTesting(); - } - - int GetHoverCardsSeenCount() { - return tab_strip() - ->hover_card_controller_->metrics_for_testing() - ->cards_seen_count(); - } - - void MouseExitTabStrip() { - ui::MouseEvent stop_hover_event(ui::ET_MOUSE_EXITED, gfx::Point(), - gfx::Point(), base::TimeTicks(), - ui::EF_NONE, 0); - tab_strip()->OnMouseExited(stop_hover_event); - } - - void ClickMouseOnTab(int index) { - Tab* const tab = tab_strip()->tab_at(index); - ui::MouseEvent click_event(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), - base::TimeTicks(), ui::EF_NONE, 0); - tab->OnMousePressed(click_event); - } - void HoverMouseOverTabAt(int index) { - // We don't use Tab::OnMouseEntered here to invoke the hover card because - // that path is disabled in browser tests. If we enabled it, the real mouse - // might interfere with the test. - tab_strip()->UpdateHoverCard( - tab_strip()->tab_at(index), - TabSlotController::HoverCardUpdateType::kHover); - } + ~TabHoverCardBubbleViewBrowserTest() override = default; // DialogBrowserTest: void ShowUi(const std::string& name) override { - HoverMouseOverTabAt(0); - views::test::WidgetVisibleWaiter(hover_card()->GetWidget()).Wait(); - } + TabRendererData new_tab_data = TabRendererData(); + new_tab_data.title = kTabTitle; + new_tab_data.last_committed_url = GURL(kTabUrl); + GetTabStrip(browser())->AddTabAt(1, new_tab_data); - private: - std::unique_ptr> - animation_mode_reset_; + SimulateHoverTab(browser(), 1); + } - TabStrip* tab_strip_ = nullptr; + bool VerifyUi() override { + if (!DialogBrowserTest::VerifyUi()) + return false; + + TabStrip* const tab_strip = GetTabStrip(browser()); + Tab* const tab = tab_strip->tab_at(1); + if (!tab) { + NOTREACHED(); + return false; + } + + TabHoverCardBubbleView* const hover_card = GetHoverCard(tab_strip); + if (!hover_card) { + NOTREACHED(); + return false; + } + + EXPECT_EQ(kTabTitle, hover_card->GetTitleTextForTesting()); + EXPECT_EQ(kTabDomain, hover_card->GetDomainTextForTesting()); + return true; + } }; -// This test appears to be flaky on Windows. Upstream tests were also found to -// be flaky, so for now we'll follow the upstream lead and disable this one on -// Windows. See crbug.com/1050765. +// This test times out on Windows CI, but works fine locally. #if BUILDFLAG(IS_WIN) #define MAYBE_ChromeSchemeUrl DISABLED_ChromeSchemeUrl #else @@ -114,16 +80,5 @@ class TabHoverCardBubbleViewBrowserTest : public DialogBrowserTest { #endif IN_PROC_BROWSER_TEST_F(TabHoverCardBubbleViewBrowserTest, MAYBE_ChromeSchemeUrl) { - TabRendererData new_tab_data = TabRendererData(); - new_tab_data.title = u"Settings - Addresses and more"; - new_tab_data.last_committed_url = GURL("chrome://settings/addresses"); - tab_strip()->AddTabAt(1, new_tab_data); - - ShowUi("default"); - Widget* widget = hover_card()->GetWidget(); - EXPECT_TRUE(widget != nullptr); - EXPECT_TRUE(widget->IsVisible()); - HoverMouseOverTabAt(1); - EXPECT_EQ(GetHoverCardTitle(), u"Settings - Addresses and more"); - EXPECT_EQ(GetHoverCardDomain(), u"brave://settings"); + ShowAndVerifyUi(); } diff --git a/chromium_src/chrome/browser/ui/views/tabs/tab_hover_card_test_util.cc b/chromium_src/chrome/browser/ui/views/tabs/tab_hover_card_test_util.cc new file mode 100644 index 000000000000..44a3d28cd740 --- /dev/null +++ b/chromium_src/chrome/browser/ui/views/tabs/tab_hover_card_test_util.cc @@ -0,0 +1,15 @@ +/* Copyright (c) 2022 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * you can obtain one at http://mozilla.org/MPL/2.0/. */ + +// This following include is needed because of the upstream change +// https://chromium.googlesource.com/chromium/src/+/4021762e. It added +// TabHoverCardController* hover_card_controller_for_testing() method to +// TabStrip class, which is called in this file.But, we use chromium_src +// override on TabStrip to replace TabHoverCardController with +// BraveTabHoverCardController, so we need to add the header to avoid the +// member access into incomplete type error. +#include "brave/browser/ui/views/tabs/brave_tab_hover_card_controller.h" + +#include "src/chrome/browser/ui/views/tabs/tab_hover_card_test_util.cc" diff --git a/chromium_src/chrome/common/url_constants.cc b/chromium_src/chrome/common/url_constants.cc index 9cef0533b338..277a1afcb12c 100644 --- a/chromium_src/chrome/common/url_constants.cc +++ b/chromium_src/chrome/common/url_constants.cc @@ -21,7 +21,9 @@ const char kAutomaticSettingsResetLearnMoreURL[] = "360017903152-How-do-I-reset-Brave-settings-to-default-"; const char kAdvancedProtectionDownloadLearnMoreURL[] = - "https://support.brave.com"; + "https://support.brave.com/"; + +const char kBatterySaverModeLearnMoreUrl[] = "https://support.brave.com/"; const char kBluetoothAdapterOffHelpURL[] = "https://support.brave.com/"; @@ -247,7 +249,9 @@ const char kChromeCleanerLearnMoreURL[] = const char kWindowsXPVistaDeprecationURL[] = "https://support.brave.com/"; -#endif + +const char kWindows78DeprecationURL[] = "https://support.brave.com/"; +#endif // BUILDFLAG(IS_WIN) const char kChromeSyncLearnMoreURL[] = "https://support.brave.com/"; diff --git a/chromium_src/components/autofill/core/browser/autofill_experiments_unittest.cc b/chromium_src/components/autofill/core/browser/autofill_experiments_unittest.cc index 1c622d1d0772..7059f28d4d5d 100644 --- a/chromium_src/components/autofill/core/browser/autofill_experiments_unittest.cc +++ b/chromium_src/components/autofill/core/browser/autofill_experiments_unittest.cc @@ -76,8 +76,11 @@ TEST_F( // Update the active types to only include Wallet. This disables all other // types, including profiles. - sync_service_.SetActiveDataTypes( - syncer::ModelTypeSet(syncer::AUTOFILL_WALLET_DATA)); + sync_service_.GetUserSettings()->SetSelectedTypes( + /*sync_everything=*/false, + /*types=*/syncer::UserSelectableTypeSet( + syncer::UserSelectableType::kAutofill)); + sync_service_.SetFailedDataTypes(syncer::AUTOFILL_PROFILE); EXPECT_FALSE(IsCreditCardUploadEnabled( AutofillSyncSigninState::kSignedInAndSyncFeatureEnabled)); diff --git a/chromium_src/components/autofill_assistant/browser/features.cc b/chromium_src/components/autofill_assistant/browser/features.cc index 12bac98cf531..f070a1ae2444 100644 --- a/chromium_src/components/autofill_assistant/browser/features.cc +++ b/chromium_src/components/autofill_assistant/browser/features.cc @@ -14,8 +14,9 @@ namespace autofill_assistant { namespace features { -const base::Feature kAutofillAssistantFeedbackChip{ - "AutofillAssistantFeedbackChip", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kAutofillAssistantFeedbackChip, + "AutofillAssistantFeedbackChip", + base::FEATURE_DISABLED_BY_DEFAULT); } // namespace features } // namespace autofill_assistant diff --git a/chromium_src/components/component_updater/component_updater_service.cc b/chromium_src/components/component_updater/component_updater_service.cc index 5c6798e55413..b9f8e8ce7610 100644 --- a/chromium_src/components/component_updater/component_updater_service.cc +++ b/chromium_src/components/component_updater/component_updater_service.cc @@ -7,8 +7,9 @@ #include "components/update_client/update_client.h" namespace { -const base::Feature kEnforceCRX3PublisherProof{ - "EnforceCRX3PublisherProof", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kEnforceCRX3PublisherProof, + "EnforceCRX3PublisherProof", + base::FEATURE_ENABLED_BY_DEFAULT); crx_file::VerifierFormat GetVerifierFormat() { if (base::FeatureList::IsEnabled(kEnforceCRX3PublisherProof)) diff --git a/chromium_src/components/content_settings/core/common/features.cc b/chromium_src/components/content_settings/core/common/features.cc index e4a3209959cb..dd60643c058f 100644 --- a/chromium_src/components/content_settings/core/common/features.cc +++ b/chromium_src/components/content_settings/core/common/features.cc @@ -7,7 +7,8 @@ namespace content_settings { -const base::Feature kAllowIncognitoPermissionInheritance{ - "AllowIncognitoPermissionInheritance", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kAllowIncognitoPermissionInheritance, + "AllowIncognitoPermissionInheritance", + base::FEATURE_DISABLED_BY_DEFAULT); } // namespace content_settings diff --git a/chromium_src/components/content_settings/core/common/features.h b/chromium_src/components/content_settings/core/common/features.h index adaafc080ec0..7b5165529deb 100644 --- a/chromium_src/components/content_settings/core/common/features.h +++ b/chromium_src/components/content_settings/core/common/features.h @@ -11,7 +11,7 @@ namespace content_settings { COMPONENT_EXPORT(CONTENT_SETTINGS_FEATURES) -extern const base::Feature kAllowIncognitoPermissionInheritance; +BASE_DECLARE_FEATURE(kAllowIncognitoPermissionInheritance); } // namespace content_settings diff --git a/chromium_src/components/omnibox/browser/in_memory_url_index.h b/chromium_src/components/omnibox/browser/in_memory_url_index.h deleted file mode 100644 index e86f303d1560..000000000000 --- a/chromium_src/components/omnibox/browser/in_memory_url_index.h +++ /dev/null @@ -1,20 +0,0 @@ -/* Copyright (c) 2022 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef BRAVE_CHROMIUM_SRC_COMPONENTS_OMNIBOX_BROWSER_IN_MEMORY_URL_INDEX_H_ -#define BRAVE_CHROMIUM_SRC_COMPONENTS_OMNIBOX_BROWSER_IN_MEMORY_URL_INDEX_H_ - -class BraveHistoryQuickProviderTest; - -#define ClearPrivateData \ - ClearPrivateDataUnused(); \ - friend class ::BraveHistoryQuickProviderTest; \ - void ClearPrivateData - -#include "src/components/omnibox/browser/in_memory_url_index.h" - -#undef ClearPrivateData - -#endif // BRAVE_CHROMIUM_SRC_COMPONENTS_OMNIBOX_BROWSER_IN_MEMORY_URL_INDEX_H_ diff --git a/chromium_src/components/permissions/features.cc b/chromium_src/components/permissions/features.cc index cf12bb7b5d32..6cd4ac183067 100644 --- a/chromium_src/components/permissions/features.cc +++ b/chromium_src/components/permissions/features.cc @@ -11,8 +11,9 @@ namespace permissions { namespace features { // Enables the option of an automatic permission expiration time. -const base::Feature kPermissionLifetime{"PermissionLifetime", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kPermissionLifetime, + "PermissionLifetime", + base::FEATURE_ENABLED_BY_DEFAULT); OVERRIDE_FEATURE_DEFAULT_STATES({{ {kPermissionOnDeviceNotificationPredictions, diff --git a/chromium_src/components/permissions/features.h b/chromium_src/components/permissions/features.h index 8397d9299225..4f4ad0f3152c 100644 --- a/chromium_src/components/permissions/features.h +++ b/chromium_src/components/permissions/features.h @@ -12,7 +12,7 @@ namespace permissions { namespace features { COMPONENT_EXPORT(PERMISSIONS_COMMON) -extern const base::Feature kPermissionLifetime; +BASE_DECLARE_FEATURE(kPermissionLifetime); } // namespace features } // namespace permissions diff --git a/chromium_src/components/permissions/permission_manager.h b/chromium_src/components/permissions/permission_manager.h index 3e17f275bb83..bac3f802ef13 100644 --- a/chromium_src/components/permissions/permission_manager.h +++ b/chromium_src/components/permissions/permission_manager.h @@ -11,13 +11,13 @@ // In case this fails compilation in the future, simply apply to any // other private member, more obscure name is better so it doesn't // affect other included header files from this header file. -#define devtools_global_overrides_origin_ \ - devtools_global_overrides_origin_; \ - friend class BravePermissionManager; \ +#define subscription_type_counts_ \ + subscription_type_counts_; \ + friend class BravePermissionManager; \ GURL forced_requesting_origin_ #include "src/components/permissions/permission_manager.h" -#undef devtools_global_overrides_origin_ +#undef subscription_type_counts_ #endif // BRAVE_CHROMIUM_SRC_COMPONENTS_PERMISSIONS_PERMISSION_MANAGER_H_ diff --git a/chromium_src/components/segmentation_platform/public/features.cc b/chromium_src/components/segmentation_platform/public/features.cc new file mode 100644 index 000000000000..43209742abda --- /dev/null +++ b/chromium_src/components/segmentation_platform/public/features.cc @@ -0,0 +1,18 @@ +/* Copyright (c) 2022 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#include "components/segmentation_platform/public/features.h" + +#include "src/components/segmentation_platform/public/features.cc" + +#include "base/feature_override.h" + +namespace segmentation_platform::features { + +OVERRIDE_FEATURE_DEFAULT_STATES({{ + {kSegmentationPlatformFeature, base::FEATURE_DISABLED_BY_DEFAULT}, +}}); + +} // namespace segmentation_platform::features diff --git a/chromium_src/components/send_tab_to_self/features.cc b/chromium_src/components/send_tab_to_self/features.cc new file mode 100644 index 000000000000..488deb3ef1a7 --- /dev/null +++ b/chromium_src/components/send_tab_to_self/features.cc @@ -0,0 +1,18 @@ +/* Copyright (c) 2022 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#include "components/send_tab_to_self/features.h" + +#include "src/components/send_tab_to_self/features.cc" + +#include "base/feature_override.h" + +namespace send_tab_to_self { + +OVERRIDE_FEATURE_DEFAULT_STATES({{ + {kSendTabToSelfSigninPromo, base::FEATURE_DISABLED_BY_DEFAULT}, +}}); + +} // namespace send_tab_to_self diff --git a/chromium_src/components/shared_highlighting/core/common/shared_highlighting_features.cc b/chromium_src/components/shared_highlighting/core/common/shared_highlighting_features.cc index 426c847f7f0a..29025de4f28e 100644 --- a/chromium_src/components/shared_highlighting/core/common/shared_highlighting_features.cc +++ b/chromium_src/components/shared_highlighting/core/common/shared_highlighting_features.cc @@ -10,6 +10,7 @@ namespace shared_highlighting { OVERRIDE_FEATURE_DEFAULT_STATES({{ + {kIOSSharedHighlightingV2, base::FEATURE_DISABLED_BY_DEFAULT}, {kSharedHighlightingAmp, base::FEATURE_DISABLED_BY_DEFAULT}, }}); diff --git a/chromium_src/components/sync_device_info/device_info_sync_bridge.cc b/chromium_src/components/sync_device_info/device_info_sync_bridge.cc index 141cf1564965..46e2684afef7 100644 --- a/chromium_src/components/sync_device_info/device_info_sync_bridge.cc +++ b/chromium_src/components/sync_device_info/device_info_sync_bridge.cc @@ -60,9 +60,11 @@ std::unique_ptr BraveSpecificsToModel( return std::make_unique( specifics.cache_guid(), specifics.client_name(), specifics.chrome_version(), specifics.sync_user_agent(), - specifics.device_type(), specifics.signin_scoped_device_id(), - specifics.manufacturer(), specifics.model(), - ProtoTimeToTime(specifics.last_updated_timestamp()), + specifics.device_type(), + DeriveOSfromDeviceType(specifics.device_type(), specifics.manufacturer()), + DeriveFormFactorfromDeviceType(specifics.device_type()), + specifics.signin_scoped_device_id(), specifics.manufacturer(), + specifics.model(), ProtoTimeToTime(specifics.last_updated_timestamp()), GetPulseIntervalFromSpecifics(specifics), specifics.feature_fields().send_tab_to_self_receiving_enabled(), SpecificsToSharingInfo(specifics), diff --git a/chromium_src/content/public/browser/permission_controller_delegate.h b/chromium_src/content/public/browser/permission_controller_delegate.h index 816816e04330..277e243b7dd6 100644 --- a/chromium_src/content/public/browser/permission_controller_delegate.h +++ b/chromium_src/content/public/browser/permission_controller_delegate.h @@ -6,8 +6,8 @@ #ifndef BRAVE_CHROMIUM_SRC_CONTENT_PUBLIC_BROWSER_PERMISSION_CONTROLLER_DELEGATE_H_ #define BRAVE_CHROMIUM_SRC_CONTENT_PUBLIC_BROWSER_PERMISSION_CONTROLLER_DELEGATE_H_ -#define ResetPermissionOverridesForDevTools \ - NotUsed() {} \ +#define UnsubscribePermissionStatusChange \ + PermissionControllerDelegateNotUsed() {} \ virtual void RequestPermissionsForOrigin( \ const std::vector& permissions, \ content::RenderFrameHost* render_frame_host, \ @@ -20,10 +20,10 @@ content::RenderFrameHost* render_frame_host, \ const GURL& requesting_origin); \ \ - virtual void ResetPermissionOverridesForDevTools + virtual void UnsubscribePermissionStatusChange #include "src/content/public/browser/permission_controller_delegate.h" -#undef ResetPermissionOverridesForDevTools +#undef UnsubscribePermissionStatusChange #endif // BRAVE_CHROMIUM_SRC_CONTENT_PUBLIC_BROWSER_PERMISSION_CONTROLLER_DELEGATE_H_ diff --git a/chromium_src/content/public/common/content_features.cc b/chromium_src/content/public/common/content_features.cc index 5e00633d1162..0404a4750349 100644 --- a/chromium_src/content/public/common/content_features.cc +++ b/chromium_src/content/public/common/content_features.cc @@ -22,7 +22,6 @@ OVERRIDE_FEATURE_DEFAULT_STATES({{ {kSignedExchangeReportingForDistributors, base::FEATURE_DISABLED_BY_DEFAULT}, {kSignedHTTPExchange, base::FEATURE_DISABLED_BY_DEFAULT}, - {kSubresourceWebBundles, base::FEATURE_DISABLED_BY_DEFAULT}, #if BUILDFLAG(IS_ANDROID) {kWebNfc, base::FEATURE_DISABLED_BY_DEFAULT}, #endif diff --git a/chromium_src/ios/chrome/browser/application_context/application_context_impl.mm b/chromium_src/ios/chrome/browser/application_context/application_context_impl.mm index 8c9ad57a814e..b38ebc7ab0b2 100644 --- a/chromium_src/ios/chrome/browser/application_context/application_context_impl.mm +++ b/chromium_src/ios/chrome/browser/application_context/application_context_impl.mm @@ -44,7 +44,7 @@ #include "ios/chrome/browser/prefs/ios_chrome_pref_service_factory.h" #include "ios/chrome/browser/prefs/pref_names.h" #import "ios/chrome/browser/promos_manager/features.h" -#import "ios/chrome/browser/promos_manager/promos_manager.h" +#import "ios/chrome/browser/promos_manager/promos_manager_impl.h" #include "ios/chrome/browser/push_notification/push_notification_service.h" #include "ios/chrome/browser/segmentation_platform/otr_web_state_observer.h" #import "ios/components/security_interstitials/safe_browsing/safe_browsing_service.h" @@ -380,7 +380,7 @@ void BindNetworkChangeManagerReceiver( PromosManager* ApplicationContextImpl::GetPromosManager() { DCHECK(thread_checker_.CalledOnValidThread()); if (IsFullscreenPromosManagerEnabled() && !promos_manager_) { - promos_manager_ = std::make_unique(GetLocalState()); + promos_manager_ = std::make_unique(GetLocalState()); } return promos_manager_.get(); } diff --git a/chromium_src/ios/chrome/browser/browser_state/browser_state_keyed_service_factories.mm b/chromium_src/ios/chrome/browser/browser_state/browser_state_keyed_service_factories.mm index 449b0c494546..8cd68210b192 100644 --- a/chromium_src/ios/chrome/browser/browser_state/browser_state_keyed_service_factories.mm +++ b/chromium_src/ios/chrome/browser/browser_state/browser_state_keyed_service_factories.mm @@ -7,6 +7,7 @@ #include "ios/chrome/browser/autofill/personal_data_manager_factory.h" #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" +#include "ios/chrome/browser/consent_auditor/consent_auditor_factory.h" #include "ios/chrome/browser/content_settings/host_content_settings_map_factory.h" #include "ios/chrome/browser/favicon/favicon_service_factory.h" #include "ios/chrome/browser/favicon/ios_chrome_favicon_loader_factory.h" @@ -20,7 +21,6 @@ #include "ios/chrome/browser/search_engines/template_url_service_factory.h" #include "ios/chrome/browser/signin/account_consistency_service_factory.h" #include "ios/chrome/browser/signin/identity_manager_factory.h" -#include "ios/chrome/browser/sync/consent_auditor_factory.h" #include "ios/chrome/browser/sync/ios_user_event_service_factory.h" #include "ios/chrome/browser/sync/model_type_store_service_factory.h" #include "ios/chrome/browser/sync/session_sync_service_factory.h" diff --git a/chromium_src/net/base/features.cc b/chromium_src/net/base/features.cc index 1c41f84e1c5c..a64ebbe786b9 100644 --- a/chromium_src/net/base/features.cc +++ b/chromium_src/net/base/features.cc @@ -22,28 +22,34 @@ OVERRIDE_FEATURE_DEFAULT_STATES({{ base::FEATURE_ENABLED_BY_DEFAULT}, {kPartitionSSLSessionsByNetworkIsolationKey, base::FEATURE_ENABLED_BY_DEFAULT}, + {kSamePartyAttributeEnabled, base::FEATURE_DISABLED_BY_DEFAULT}, {kSplitHostCacheByNetworkIsolationKey, base::FEATURE_ENABLED_BY_DEFAULT}, }}); -const base::Feature kBraveEphemeralStorage{"EphemeralStorage", - base::FEATURE_ENABLED_BY_DEFAULT}; -const base::Feature kBraveEphemeralStorageKeepAlive{ - "BraveEphemeralStorageKeepAlive", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kBraveEphemeralStorage, + "EphemeralStorage", + base::FEATURE_ENABLED_BY_DEFAULT); +BASE_FEATURE(kBraveEphemeralStorageKeepAlive, + "BraveEphemeralStorageKeepAlive", + base::FEATURE_ENABLED_BY_DEFAULT); const base::FeatureParam kBraveEphemeralStorageKeepAliveTimeInSeconds = { &kBraveEphemeralStorageKeepAlive, "BraveEphemeralStorageKeepAliveTimeInSeconds", 30}; -const base::Feature kBraveFirstPartyEphemeralStorage{ - "BraveFirstPartyEphemeralStorage", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kBraveFirstPartyEphemeralStorage, + "BraveFirstPartyEphemeralStorage", + base::FEATURE_ENABLED_BY_DEFAULT); // Partition Blob storage in ephemeral context. -const base::Feature kBravePartitionBlobStorage{ - "BravePartitionBlobStorage", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kBravePartitionBlobStorage, + "BravePartitionBlobStorage", + base::FEATURE_ENABLED_BY_DEFAULT); // Partition HSTS state storage by top frame site. -const base::Feature kBravePartitionHSTS{"BravePartitionHSTS", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kBravePartitionHSTS, + "BravePartitionHSTS", + base::FEATURE_ENABLED_BY_DEFAULT); } // namespace features } // namespace net diff --git a/chromium_src/net/base/features.h b/chromium_src/net/base/features.h index 35d469d5ec49..9df9a2feea4c 100644 --- a/chromium_src/net/base/features.h +++ b/chromium_src/net/base/features.h @@ -13,13 +13,13 @@ namespace net { namespace features { -NET_EXPORT extern const base::Feature kBraveEphemeralStorage; -NET_EXPORT extern const base::Feature kBraveEphemeralStorageKeepAlive; +NET_EXPORT BASE_DECLARE_FEATURE(kBraveEphemeralStorage); +NET_EXPORT BASE_DECLARE_FEATURE(kBraveEphemeralStorageKeepAlive); NET_EXPORT extern const base::FeatureParam kBraveEphemeralStorageKeepAliveTimeInSeconds; -NET_EXPORT extern const base::Feature kBraveFirstPartyEphemeralStorage; -NET_EXPORT extern const base::Feature kBravePartitionBlobStorage; -NET_EXPORT extern const base::Feature kBravePartitionHSTS; +NET_EXPORT BASE_DECLARE_FEATURE(kBraveFirstPartyEphemeralStorage); +NET_EXPORT BASE_DECLARE_FEATURE(kBravePartitionBlobStorage); +NET_EXPORT BASE_DECLARE_FEATURE(kBravePartitionHSTS); } // namespace features } // namespace net diff --git a/chromium_src/net/cookies/cookie_monster.cc b/chromium_src/net/cookies/cookie_monster.cc index 3ce154ee6d36..a011e94bbab4 100644 --- a/chromium_src/net/cookies/cookie_monster.cc +++ b/chromium_src/net/cookies/cookie_monster.cc @@ -15,20 +15,15 @@ namespace net { CookieMonster::CookieMonster(scoped_refptr store, - NetLog* net_log, - bool first_party_sets_enabled) - : ChromiumCookieMonster(store, net_log, first_party_sets_enabled), + NetLog* net_log) + : ChromiumCookieMonster(store, net_log), net_log_( NetLogWithSource::Make(net_log, NetLogSourceType::COOKIE_STORE)) {} CookieMonster::CookieMonster(scoped_refptr store, base::TimeDelta last_access_threshold, - NetLog* net_log, - bool first_party_sets_enabled) - : ChromiumCookieMonster(store, - last_access_threshold, - net_log, - first_party_sets_enabled), + NetLog* net_log) + : ChromiumCookieMonster(store, last_access_threshold, net_log), net_log_( NetLogWithSource::Make(net_log, NetLogSourceType::COOKIE_STORE)) {} @@ -43,9 +38,8 @@ CookieMonster::GetOrCreateEphemeralCookieStoreForTopFrameURL( return it->second.get(); return ephemeral_cookie_stores_ - .emplace(domain, new ChromiumCookieMonster( - nullptr /* store */, net_log_.net_log(), - /*first_party_sets_enabled=*/false)) + .emplace(domain, new ChromiumCookieMonster(nullptr /* store */, + net_log_.net_log())) .first->second.get(); } diff --git a/chromium_src/net/cookies/cookie_monster.h b/chromium_src/net/cookies/cookie_monster.h index fa68c525f9d2..2e7d29cf0dd6 100644 --- a/chromium_src/net/cookies/cookie_monster.h +++ b/chromium_src/net/cookies/cookie_monster.h @@ -16,13 +16,10 @@ class NET_EXPORT CookieMonster : public ChromiumCookieMonster { public: // These constructors and destructors must be kept in sync with those in // Chromium's CookieMonster. - CookieMonster(scoped_refptr store, - NetLog* net_log, - bool first_party_sets_enabled); + CookieMonster(scoped_refptr store, NetLog* net_log); CookieMonster(scoped_refptr store, base::TimeDelta last_access_threshold, - NetLog* net_log, - bool first_party_sets_enabled); + NetLog* net_log); ~CookieMonster() override; // CookieStore implementation. diff --git a/chromium_src/net/tools/transport_security_state_generator/input_file_parsers.cc b/chromium_src/net/tools/transport_security_state_generator/input_file_parsers.cc index 647d21a3dc66..4c0f856bf219 100644 --- a/chromium_src/net/tools/transport_security_state_generator/input_file_parsers.cc +++ b/chromium_src/net/tools/transport_security_state_generator/input_file_parsers.cc @@ -17,9 +17,9 @@ bool ParseCertificatesFile(base::StringPiece certs_input, Pinsets* pinsets, base::Time* timestamp) { base::StringPiece brave_certs = R"brave_certs( -# Last updated: Tue Nov 8 23:36:26 UTC 2022 +# Last updated: Wed Nov 16 19:47:05 UTC 2022 PinsListTimestamp -1667950586 +1668628025 # =====BEGIN BRAVE ROOTS ASC===== #From https://www.amazontrust.com/repository/ diff --git a/chromium_src/services/network/cookie_settings.cc b/chromium_src/services/network/cookie_settings.cc index 4e393aa4213f..da3e052f6035 100644 --- a/chromium_src/services/network/cookie_settings.cc +++ b/chromium_src/services/network/cookie_settings.cc @@ -76,6 +76,7 @@ bool CookieSettings::AnnotateAndMoveUserBlockedEphemeralCookies( const GURL& url, const net::SiteForCookies& site_for_cookies, const url::Origin* top_frame_origin, + const net::FirstPartySetMetadata& first_party_set_metadata, net::CookieAccessResultList& maybe_included_cookies, net::CookieAccessResultList& excluded_cookies) const { absl::optional top_frame_origin_opt; @@ -89,8 +90,8 @@ bool CookieSettings::AnnotateAndMoveUserBlockedEphemeralCookies( } return AnnotateAndMoveUserBlockedCookies( - url, site_for_cookies, top_frame_origin, maybe_included_cookies, - excluded_cookies); + url, site_for_cookies, top_frame_origin, first_party_set_metadata, + maybe_included_cookies, excluded_cookies); } } // namespace network diff --git a/chromium_src/services/network/cookie_settings.h b/chromium_src/services/network/cookie_settings.h index f8950250f07e..60dfc5f5b4bb 100644 --- a/chromium_src/services/network/cookie_settings.h +++ b/chromium_src/services/network/cookie_settings.h @@ -24,6 +24,7 @@ AnnotateAndMoveUserBlockedEphemeralCookies( \ const GURL& url, const net::SiteForCookies& site_for_cookies, \ const url::Origin* top_frame_origin, \ + const net::FirstPartySetMetadata& first_party_set_metadata, \ net::CookieAccessResultList& maybe_included_cookies, \ net::CookieAccessResultList& excluded_cookies) const; \ bool AnnotateAndMoveUserBlockedCookies diff --git a/chromium_src/storage/browser/blob/blob_url_store_impl.cc b/chromium_src/storage/browser/blob/blob_url_store_impl.cc index c4fc4469fc76..e23d73c47c71 100644 --- a/chromium_src/storage/browser/blob/blob_url_store_impl.cc +++ b/chromium_src/storage/browser/blob/blob_url_store_impl.cc @@ -42,7 +42,8 @@ bool IsBlobUrlValidForPartitionedOrigin(const url::Origin& origin, #define BlobURLStoreImpl BlobURLStoreImpl_ChromiumImpl #define BRAVE_BLOB_URL_STORE_IMPL_BLOB_URL_IS_VALID \ if (!valid_origin) { \ - valid_origin = IsBlobUrlValidForPartitionedOrigin(origin_, url_origin); \ + valid_origin = \ + IsBlobUrlValidForPartitionedOrigin(storage_key_origin, url_origin); \ } #include "src/storage/browser/blob/blob_url_store_impl.cc" @@ -52,10 +53,10 @@ bool IsBlobUrlValidForPartitionedOrigin(const url::Origin& origin, namespace storage { -BlobURLStoreImpl::BlobURLStoreImpl(const url::Origin& origin, +BlobURLStoreImpl::BlobURLStoreImpl(const blink::StorageKey& storage_key, base::WeakPtr registry) : BlobURLStoreImpl_ChromiumImpl::BlobURLStoreImpl_ChromiumImpl( - origin, + storage_key, std::move(registry)) {} void BlobURLStoreImpl::Register( @@ -120,7 +121,8 @@ void BlobURLStoreImpl::ResolveForNavigation( } GURL BlobURLStoreImpl::GetPartitionedOrOriginalUrl(const GURL& url) const { - if (!CanUseOriginForPartitioning(origin_)) { + const url::Origin& storage_key_origin = storage_key_.origin(); + if (!CanUseOriginForPartitioning(storage_key_origin)) { return url; } @@ -129,7 +131,7 @@ GURL BlobURLStoreImpl::GetPartitionedOrOriginalUrl(const GURL& url) const { std::string partitioned_path = base::StrCat( {clean_url.path_piece(), "_", net::EphemeralStorageOriginUtils::GetNonceForEphemeralStorageKeying( - origin_) + storage_key_origin) .ToString()}); GURL::Replacements replacements; replacements.SetPathStr(partitioned_path); diff --git a/chromium_src/storage/browser/blob/blob_url_store_impl.h b/chromium_src/storage/browser/blob/blob_url_store_impl.h index 1dea38d1a370..f5b4fb6ba11a 100644 --- a/chromium_src/storage/browser/blob/blob_url_store_impl.h +++ b/chromium_src/storage/browser/blob/blob_url_store_impl.h @@ -27,7 +27,7 @@ namespace storage { class COMPONENT_EXPORT(STORAGE_BROWSER) BlobURLStoreImpl : public BlobURLStoreImpl_ChromiumImpl { public: - BlobURLStoreImpl(const url::Origin& origin, + BlobURLStoreImpl(const blink::StorageKey& storage_key, base::WeakPtr registry); void Register(mojo::PendingRemote blob, diff --git a/chromium_src/third_party/blink/common/features.cc b/chromium_src/third_party/blink/common/features.cc index 5d7ccdd5067d..4e9fd33e5baf 100644 --- a/chromium_src/third_party/blink/common/features.cc +++ b/chromium_src/third_party/blink/common/features.cc @@ -37,30 +37,37 @@ OVERRIDE_FEATURE_DEFAULT_STATES({{ }}); // Allow certain client hints in request header. -const base::Feature kAllowCertainClientHints{"AllowCertainClientHints", - base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kAllowCertainClientHints, + "AllowCertainClientHints", + base::FEATURE_DISABLED_BY_DEFAULT); -const base::Feature kFileSystemAccessAPI{"FileSystemAccessAPI", - base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kFileSystemAccessAPI, + "FileSystemAccessAPI", + base::FEATURE_DISABLED_BY_DEFAULT); -const base::Feature kNavigatorConnectionAttribute{ - "NavigatorConnectionAttribute", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kNavigatorConnectionAttribute, + "NavigatorConnectionAttribute", + base::FEATURE_DISABLED_BY_DEFAULT); // Enable blink::MemoryCache partitioning for non SameSite requests. -const base::Feature kPartitionBlinkMemoryCache{ - "PartitionBlinkMemoryCache", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kPartitionBlinkMemoryCache, + "PartitionBlinkMemoryCache", + base::FEATURE_ENABLED_BY_DEFAULT); // Enable WebSockets connection pool limit per eTLD+1 for each renderer. -const base::Feature kRestrictWebSocketsPool{"RestrictWebSocketsPool", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kRestrictWebSocketsPool, + "RestrictWebSocketsPool", + base::FEATURE_ENABLED_BY_DEFAULT); // Disable protection against fingerprinting on screen dimensions by default. -const base::Feature kBraveBlockScreenFingerprinting{ - "BraveBlockScreenFingerprinting", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kBraveBlockScreenFingerprinting, + "BraveBlockScreenFingerprinting", + base::FEATURE_DISABLED_BY_DEFAULT); // Enable HTTPS-Only Mode in Private Windows with Tor by default. -const base::Feature kBraveTorWindowsHttpsOnly{"BraveTorWindowsHttpsOnly", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kBraveTorWindowsHttpsOnly, + "BraveTorWindowsHttpsOnly", + base::FEATURE_ENABLED_BY_DEFAULT); } // namespace features } // namespace blink diff --git a/chromium_src/third_party/blink/common/permissions/permission_utils.cc b/chromium_src/third_party/blink/common/permissions/permission_utils.cc new file mode 100644 index 000000000000..4ac6a41ef8a1 --- /dev/null +++ b/chromium_src/third_party/blink/common/permissions/permission_utils.cc @@ -0,0 +1,32 @@ +/* Copyright (c) 2022 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#define PERMISSION_UTIL_GET_PERMISSION_STRING \ + case PermissionType::BRAVE_ADS: \ + return "BraveAds"; \ + case PermissionType::BRAVE_COSMETIC_FILTERING: \ + return "BraveCosmeticFiltering"; \ + case PermissionType::BRAVE_TRACKERS: \ + return "BraveTrackers"; \ + case PermissionType::BRAVE_HTTP_UPGRADABLE_RESOURCES: \ + return "BraveHttpUpgradableResource"; \ + case PermissionType::BRAVE_FINGERPRINTING_V2: \ + return "BraveFingerprintingV2"; \ + case PermissionType::BRAVE_SHIELDS: \ + return "BraveShields"; \ + case PermissionType::BRAVE_REFERRERS: \ + return "BraveReferrers"; \ + case PermissionType::BRAVE_COOKIES: \ + return "BraveCookies"; \ + case PermissionType::BRAVE_SPEEDREADER: \ + return "BraveSpeedreaders"; \ + case PermissionType::BRAVE_ETHEREUM: \ + return "BraveEthereum"; \ + case PermissionType::BRAVE_SOLANA: \ + return "BraveSolana"; + +#include "src/third_party/blink/common/permissions/permission_utils.cc" + +#undef PERMISSION_UTIL_GET_PERMISSION_STRING diff --git a/chromium_src/third_party/blink/public/common/features.h b/chromium_src/third_party/blink/public/common/features.h index 6698648a474e..c3fb2c8a91a5 100644 --- a/chromium_src/third_party/blink/public/common/features.h +++ b/chromium_src/third_party/blink/public/common/features.h @@ -11,13 +11,13 @@ namespace blink { namespace features { -BLINK_COMMON_EXPORT extern const base::Feature kAllowCertainClientHints; -BLINK_COMMON_EXPORT extern const base::Feature kFileSystemAccessAPI; -BLINK_COMMON_EXPORT extern const base::Feature kNavigatorConnectionAttribute; -BLINK_COMMON_EXPORT extern const base::Feature kPartitionBlinkMemoryCache; -BLINK_COMMON_EXPORT extern const base::Feature kRestrictWebSocketsPool; -BLINK_COMMON_EXPORT extern const base::Feature kBraveBlockScreenFingerprinting; -BLINK_COMMON_EXPORT extern const base::Feature kBraveTorWindowsHttpsOnly; +BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kAllowCertainClientHints); +BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kFileSystemAccessAPI); +BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kNavigatorConnectionAttribute); +BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kPartitionBlinkMemoryCache); +BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kRestrictWebSocketsPool); +BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kBraveBlockScreenFingerprinting); +BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kBraveTorWindowsHttpsOnly); } // namespace features } // namespace blink diff --git a/chromium_src/third_party/blink/renderer/bindings/core/v8/scheduled_action.cc b/chromium_src/third_party/blink/renderer/bindings/core/v8/scheduled_action.cc index b099e472af3a..c6c81134ddd1 100644 --- a/chromium_src/third_party/blink/renderer/bindings/core/v8/scheduled_action.cc +++ b/chromium_src/third_party/blink/renderer/bindings/core/v8/scheduled_action.cc @@ -13,7 +13,7 @@ #define BRAVE_SCHEDULED_ACTION_STRING_HANDLER_CONSTRUCTOR \ IF_BUILDFLAG(ENABLE_BRAVE_PAGE_GRAPH, { \ - if (!code_.IsEmpty() && \ + if (!code_.empty() && \ CoreProbeSink::HasAgentsGlobal(CoreProbeSink::kPageGraph)) { \ parent_script_id_ = \ v8::page_graph::GetExecutingScript(script_state->GetIsolate()) \ diff --git a/chromium_src/third_party/blink/renderer/core/dom/events/event_listener_map.cc b/chromium_src/third_party/blink/renderer/core/dom/events/event_listener_map.cc index 5d76d7215ba8..77e31a946eac 100644 --- a/chromium_src/third_party/blink/renderer/core/dom/events/event_listener_map.cc +++ b/chromium_src/third_party/blink/renderer/core/dom/events/event_listener_map.cc @@ -20,7 +20,7 @@ bool EventListenerMap::AddListenerToVector( registered_listener); if (result && CoreProbeSink::HasAgentsGlobal(CoreProbeSink::kPageGraph)) { DCHECK(registered_listener); - DCHECK(vector && !vector->IsEmpty()); + DCHECK(vector && !vector->empty()); DCHECK(*registered_listener == vector->back()); const int id = RegisteredEventListener::GenerateId(); // Set id to the returned object. diff --git a/chromium_src/third_party/blink/renderer/core/html/html_script_element.cc b/chromium_src/third_party/blink/renderer/core/html/html_script_element.cc new file mode 100644 index 000000000000..129423238a10 --- /dev/null +++ b/chromium_src/third_party/blink/renderer/core/html/html_script_element.cc @@ -0,0 +1,23 @@ +/* Copyright (c) 2022 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "third_party/blink/renderer/core/html/html_script_element.h" + +#define supports supports_ChromiumImpl +#include "src/third_party/blink/renderer/core/html/html_script_element.cc" +#undef supports + +namespace blink { + +// static +bool HTMLScriptElement::supports(ScriptState* script_state, + const AtomicString& type) { + if (type == script_type_names::kWebbundle) + return false; + + return supports_ChromiumImpl(script_state, type); +} + +} // namespace blink diff --git a/chromium_src/third_party/blink/renderer/core/html/html_script_element.h b/chromium_src/third_party/blink/renderer/core/html/html_script_element.h new file mode 100644 index 000000000000..15bc799336f6 --- /dev/null +++ b/chromium_src/third_party/blink/renderer/core/html/html_script_element.h @@ -0,0 +1,16 @@ +/* Copyright (c) 2022 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_CHROMIUM_SRC_THIRD_PARTY_BLINK_RENDERER_CORE_HTML_HTML_SCRIPT_ELEMENT_H_ +#define BRAVE_CHROMIUM_SRC_THIRD_PARTY_BLINK_RENDERER_CORE_HTML_HTML_SCRIPT_ELEMENT_H_ + +#define supports \ + supports_ChromiumImpl(ScriptState*, const AtomicString&); \ + static bool supports + +#include "src/third_party/blink/renderer/core/html/html_script_element.h" +#undef supports + +#endif // BRAVE_CHROMIUM_SRC_THIRD_PARTY_BLINK_RENDERER_CORE_HTML_HTML_SCRIPT_ELEMENT_H_ diff --git a/chromium_src/third_party/blink/renderer/core/loader/frame_fetch_context.cc b/chromium_src/third_party/blink/renderer/core/loader/frame_fetch_context.cc index 0abc69d8ce3b..e30bfc8892b1 100644 --- a/chromium_src/third_party/blink/renderer/core/loader/frame_fetch_context.cc +++ b/chromium_src/third_party/blink/renderer/core/loader/frame_fetch_context.cc @@ -23,7 +23,7 @@ String FrameFetchContext::GetCacheIdentifierIfCrossSiteSubframe() const { // calls when nothing has changed. top_frame_origin_for_cache_identifier_ = top_frame_origin; cache_identifier = top_frame_origin->RegistrableDomain(); - if (cache_identifier.IsEmpty()) + if (cache_identifier.empty()) cache_identifier = top_frame_origin->Host(); } } diff --git a/chromium_src/third_party/blink/renderer/core/script/script_loader.cc b/chromium_src/third_party/blink/renderer/core/script/script_loader.cc index 010d16f15ffb..2c73a3bb821a 100644 --- a/chromium_src/third_party/blink/renderer/core/script/script_loader.cc +++ b/chromium_src/third_party/blink/renderer/core/script/script_loader.cc @@ -5,6 +5,7 @@ #include "brave/components/brave_page_graph/common/buildflags.h" #include "third_party/blink/renderer/core/probe/core_probes.h" +#include "third_party/blink/renderer/core/script_type_names.h" #define BRAVE_SCRIPT_LOADER_PREPARE_SCRIPT \ IF_BUILDFLAG(ENABLE_BRAVE_PAGE_GRAPH, { \ @@ -13,6 +14,12 @@ } \ }) +// Make ScriptLoader::GetScriptTypeAtPrepare return +// ScriptTypeAtPrepare::kInvalid, so that ScriptLoader::PrepareScript never +// handles web bundles. +#define kWebbundle kWebbundle) && (false + #include "src/third_party/blink/renderer/core/script/script_loader.cc" +#undef kWebbundle #undef BRAVE_SCRIPT_LOADER_PREPARE_SCRIPT diff --git a/chromium_src/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.cc b/chromium_src/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.cc index abd877726941..76ebe57cdef2 100644 --- a/chromium_src/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.cc +++ b/chromium_src/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.cc @@ -9,9 +9,9 @@ #include "third_party/blink/renderer/platform/loader/fetch/memory_cache.h" // Replace DefaultCacheIdentifier call with our method using this macro. -#define DefaultCacheIdentifier \ - DefaultCacheIdentifier().IsEmpty() ? GetContextCacheIdentifier() \ - : GetContextCacheIdentifier +#define DefaultCacheIdentifier \ + DefaultCacheIdentifier().empty() ? GetContextCacheIdentifier() \ + : GetContextCacheIdentifier #include "src/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.cc" diff --git a/components/arc_strings.grdp b/components/arc_strings.grdp index 487c705ac68d..741009718133 100644 --- a/components/arc_strings.grdp +++ b/components/arc_strings.grdp @@ -78,4 +78,8 @@ App launching throbber + + Updating Android System + Starting your app may take longer than usual. + diff --git a/components/autofill_payments_strings.grdp b/components/autofill_payments_strings.grdp index de722fba3129..5e52ae8123ba 100644 --- a/components/autofill_payments_strings.grdp +++ b/components/autofill_payments_strings.grdp @@ -515,9 +515,6 @@ Virtual card - - Linked with - {NUM_CARDS, plural, =1 {Use a virtual number for this card} diff --git a/components/brave_adblock_ui/brave_adblock.html b/components/brave_adblock_ui/brave_adblock.html index e0669f82a661..0771bd926769 100644 --- a/components/brave_adblock_ui/brave_adblock.html +++ b/components/brave_adblock_ui/brave_adblock.html @@ -5,7 +5,7 @@ Ad Block - + - + diff --git a/components/brave_rewards/resources/tip/index.html b/components/brave_rewards/resources/tip/index.html index d307922fbff4..5678530ff3ee 100644 --- a/components/brave_rewards/resources/tip/index.html +++ b/components/brave_rewards/resources/tip/index.html @@ -6,7 +6,7 @@ Rewards Tip - + diff --git a/components/brave_rewards/test/BUILD.gn b/components/brave_rewards/test/BUILD.gn index ef528fe0e523..1c5b0b3a3a42 100644 --- a/components/brave_rewards/test/BUILD.gn +++ b/components/brave_rewards/test/BUILD.gn @@ -26,9 +26,9 @@ source_set("brave_rewards_unit_tests") { "//brave/components/challenge_bypass_ristretto", "//brave/components/greaselion/browser/buildflags:buildflags", "//brave/components/l10n/common:test_support", + "//brave/third_party/rapidjson", "//brave/vendor/bat-native-ledger", "//brave/vendor/bat-native-ledger:publishers_proto", - "//brave/vendor/bat-native-rapidjson", "//chrome/browser:browser", "//chrome/browser/profiles:profile", "//chrome/test:test_support", diff --git a/components/brave_search/common/features.cc b/components/brave_search/common/features.cc index e8e3f7b6a34c..2ae486a97d25 100644 --- a/components/brave_search/common/features.cc +++ b/components/brave_search/common/features.cc @@ -10,8 +10,9 @@ namespace brave_search { namespace features { -const base::Feature kBraveSearchDefaultAPIFeature{ - "BraveSearchDefaultAPI", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kBraveSearchDefaultAPIFeature, + "BraveSearchDefaultAPI", + base::FEATURE_ENABLED_BY_DEFAULT); const base::FeatureParam kBraveSearchDefaultAPIDailyLimit{ &kBraveSearchDefaultAPIFeature, kBraveSearchDefaultAPIDailyLimitName, 3}; diff --git a/components/brave_search/common/features.h b/components/brave_search/common/features.h index 4fb5f58f9be8..aa889d8cdc0a 100644 --- a/components/brave_search/common/features.h +++ b/components/brave_search/common/features.h @@ -17,7 +17,7 @@ constexpr char kBraveSearchDefaultAPIDailyLimitName[] = constexpr char kBraveSearchDefaultAPITotalLimitName[] = "BraveSearchDefaultAPITotalLimit"; -extern const base::Feature kBraveSearchDefaultAPIFeature; +BASE_DECLARE_FEATURE(kBraveSearchDefaultAPIFeature); extern const base::FeatureParam kBraveSearchDefaultAPIDailyLimit; extern const base::FeatureParam kBraveSearchDefaultAPITotalLimit; diff --git a/components/brave_search_conversion/features.cc b/components/brave_search_conversion/features.cc index a3d0935ceded..78537231c774 100644 --- a/components/brave_search_conversion/features.cc +++ b/components/brave_search_conversion/features.cc @@ -13,16 +13,18 @@ namespace features { // Brave search promotion match located at last low in omnibox popup. // This type seems more like ads banner. -const base::Feature kOmniboxBanner{"BraveSearchOmniboxBanner", - base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kOmniboxBanner, + "BraveSearchOmniboxBanner", + base::FEATURE_DISABLED_BY_DEFAULT); // Brave search promotion match located at second low in omnibox popup. // This looks very similar with other normal matches. -const base::Feature kOmniboxButton{"BraveSearchOmniboxButton", - base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kOmniboxButton, + "BraveSearchOmniboxButton", + base::FEATURE_DISABLED_BY_DEFAULT); // Brave search promotion at NTP. -const base::Feature kNTP{"BraveSearchNTP", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kNTP, "BraveSearchNTP", base::FEATURE_DISABLED_BY_DEFAULT); } // namespace features diff --git a/components/brave_search_conversion/features.h b/components/brave_search_conversion/features.h index e7c5c0500e81..a4f8c7a0f237 100644 --- a/components/brave_search_conversion/features.h +++ b/components/brave_search_conversion/features.h @@ -11,9 +11,9 @@ namespace brave_search_conversion { namespace features { -extern const base::Feature kOmniboxBanner; -extern const base::Feature kOmniboxButton; -extern const base::Feature kNTP; +BASE_DECLARE_FEATURE(kOmniboxBanner); +BASE_DECLARE_FEATURE(kOmniboxButton); +BASE_DECLARE_FEATURE(kNTP); } // namespace features } // namespace brave_search_conversion diff --git a/components/brave_shields/common/features.cc b/components/brave_shields/common/features.cc index 541c9da22449..568bc0db5180 100644 --- a/components/brave_shields/common/features.cc +++ b/components/brave_shields/common/features.cc @@ -14,66 +14,81 @@ namespace features { // list when Shields is in "standard" blocking mode. When disabled, Brave will // allow first-party requests in "standard" blocking mode regardless of whether // or not they appear in a filter list. -const base::Feature kBraveAdblockDefault1pBlocking{ - "BraveAdblockDefault1pBlocking", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kBraveAdblockDefault1pBlocking, + "BraveAdblockDefault1pBlocking", + base::FEATURE_DISABLED_BY_DEFAULT); // When enabled, Brave will issue DNS queries for requests that the adblock // engine has not blocked, then check them again with the original hostname // substituted for any canonical name found. -const base::Feature kBraveAdblockCnameUncloaking{ - "BraveAdblockCnameUncloaking", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kBraveAdblockCnameUncloaking, + "BraveAdblockCnameUncloaking", + base::FEATURE_ENABLED_BY_DEFAULT); // When enabled, Brave will apply HTML element collapsing to all images and // iframes that initiate a blocked network request. -const base::Feature kBraveAdblockCollapseBlockedElements{ - "BraveAdblockCollapseBlockedElements", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kBraveAdblockCollapseBlockedElements, + "BraveAdblockCollapseBlockedElements", + base::FEATURE_ENABLED_BY_DEFAULT); // When enabled, Brave will treat "Easylist-Cookie List" as a default, // always-on list, overriding any locally set preference. -const base::Feature kBraveAdblockCookieListDefault{ - "BraveAdblockCookieListDefault", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kBraveAdblockCookieListDefault, + "BraveAdblockCookieListDefault", + base::FEATURE_DISABLED_BY_DEFAULT); // When enabled, Brave will display a bubble inviting the user to turn on the // "Easylist-Cookie List" filter. -const base::Feature kBraveAdblockCookieListOptIn{ - "BraveAdblockCookieListOptIn", base::FEATURE_DISABLED_BY_DEFAULT}; -const base::Feature kBraveAdblockCosmeticFiltering{ - "BraveAdblockCosmeticFiltering", base::FEATURE_ENABLED_BY_DEFAULT}; -const base::Feature kBraveAdblockCosmeticFilteringChildFrames{ - "BraveAdblockCosmeticFilteringChildFrames", - base::FEATURE_DISABLED_BY_DEFAULT}; -const base::Feature kBraveAdblockCspRules{"BraveAdblockCspRules", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kBraveAdblockCookieListOptIn, + "BraveAdblockCookieListOptIn", + base::FEATURE_DISABLED_BY_DEFAULT); +BASE_FEATURE(kBraveAdblockCosmeticFiltering, + "BraveAdblockCosmeticFiltering", + base::FEATURE_ENABLED_BY_DEFAULT); +BASE_FEATURE(kBraveAdblockCosmeticFilteringChildFrames, + "BraveAdblockCosmeticFilteringChildFrames", + base::FEATURE_DISABLED_BY_DEFAULT); +BASE_FEATURE(kBraveAdblockCspRules, + "BraveAdblockCspRules", + base::FEATURE_ENABLED_BY_DEFAULT); // When enabled, Brave will block domains listed in the user's selected adblock // filters and present a security interstitial with choice to proceed and // optionally whitelist the domain. // Domain block filters look like this: // ||ads.example.com^ -const base::Feature kBraveDomainBlock{"BraveDomainBlock", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kBraveDomainBlock, + "BraveDomainBlock", + base::FEATURE_ENABLED_BY_DEFAULT); // When enabled, Brave will attempt to enable 1PES mode in a standard blocking // mode when a user visists a domain that is present in currently active adblock // filters. 1PES will be enabled only if neither cookies nor localStorage data // is stored for the website. -const base::Feature kBraveDomainBlock1PES{"BraveDomainBlock1PES", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kBraveDomainBlock1PES, + "BraveDomainBlock1PES", + base::FEATURE_ENABLED_BY_DEFAULT); // When enabled, network requests initiated by extensions will be checked and // potentially blocked by Brave Shields. -const base::Feature kBraveExtensionNetworkBlocking{ - "BraveExtensionNetworkBlocking", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kBraveExtensionNetworkBlocking, + "BraveExtensionNetworkBlocking", + base::FEATURE_DISABLED_BY_DEFAULT); // When enabled, language headers and APIs may be altered by Brave Shields. -const base::Feature kBraveReduceLanguage{"BraveReduceLanguage", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kBraveReduceLanguage, + "BraveReduceLanguage", + base::FEATURE_ENABLED_BY_DEFAULT); // When enabled, Brave will always report Light in Fingerprinting: Strict mode -const base::Feature kBraveDarkModeBlock{"BraveDarkModeBlock", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kBraveDarkModeBlock, + "BraveDarkModeBlock", + base::FEATURE_ENABLED_BY_DEFAULT); // load the cosmetic filter rules using sync ipc -const base::Feature kCosmeticFilteringSyncLoad{ - "CosmeticFilterSyncLoad", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kCosmeticFilteringSyncLoad, + "CosmeticFilterSyncLoad", + base::FEATURE_ENABLED_BY_DEFAULT); // Enables extra TRACE_EVENTs in content filter js. The feature is // primary designed for local debugging. -const base::Feature kCosmeticFilteringExtraPerfMetrics{ - "CosmeticFilteringExtraPerfMetrics", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kCosmeticFilteringExtraPerfMetrics, + "CosmeticFilteringExtraPerfMetrics", + base::FEATURE_DISABLED_BY_DEFAULT); -const base::Feature kCosmeticFilteringJsPerformance{ - "CosmeticFilteringJsPerformance", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kCosmeticFilteringJsPerformance, + "CosmeticFilteringJsPerformance", + base::FEATURE_DISABLED_BY_DEFAULT); constexpr base::FeatureParam kCosmeticFilteringSubFrameFirstSelectorsPollingDelayMs{ diff --git a/components/brave_shields/common/features.h b/components/brave_shields/common/features.h index 023a276e013c..3cd86c253cdf 100644 --- a/components/brave_shields/common/features.h +++ b/components/brave_shields/common/features.h @@ -13,22 +13,22 @@ namespace brave_shields { namespace features { -extern const base::Feature kBraveAdblockDefault1pBlocking; -extern const base::Feature kBraveAdblockCnameUncloaking; -extern const base::Feature kBraveAdblockCollapseBlockedElements; -extern const base::Feature kBraveAdblockCookieListDefault; -extern const base::Feature kBraveAdblockCookieListOptIn; -extern const base::Feature kBraveAdblockCosmeticFiltering; -extern const base::Feature kBraveAdblockCosmeticFilteringChildFrames; -extern const base::Feature kBraveAdblockCspRules; -extern const base::Feature kBraveDomainBlock; -extern const base::Feature kBraveDomainBlock1PES; -extern const base::Feature kBraveExtensionNetworkBlocking; -extern const base::Feature kBraveReduceLanguage; -extern const base::Feature kBraveDarkModeBlock; -extern const base::Feature kCosmeticFilteringSyncLoad; -extern const base::Feature kCosmeticFilteringExtraPerfMetrics; -extern const base::Feature kCosmeticFilteringJsPerformance; +BASE_DECLARE_FEATURE(kBraveAdblockDefault1pBlocking); +BASE_DECLARE_FEATURE(kBraveAdblockCnameUncloaking); +BASE_DECLARE_FEATURE(kBraveAdblockCollapseBlockedElements); +BASE_DECLARE_FEATURE(kBraveAdblockCookieListDefault); +BASE_DECLARE_FEATURE(kBraveAdblockCookieListOptIn); +BASE_DECLARE_FEATURE(kBraveAdblockCosmeticFiltering); +BASE_DECLARE_FEATURE(kBraveAdblockCosmeticFilteringChildFrames); +BASE_DECLARE_FEATURE(kBraveAdblockCspRules); +BASE_DECLARE_FEATURE(kBraveDomainBlock); +BASE_DECLARE_FEATURE(kBraveDomainBlock1PES); +BASE_DECLARE_FEATURE(kBraveExtensionNetworkBlocking); +BASE_DECLARE_FEATURE(kBraveReduceLanguage); +BASE_DECLARE_FEATURE(kBraveDarkModeBlock); +BASE_DECLARE_FEATURE(kCosmeticFilteringSyncLoad); +BASE_DECLARE_FEATURE(kCosmeticFilteringExtraPerfMetrics); +BASE_DECLARE_FEATURE(kCosmeticFilteringJsPerformance); extern const base::FeatureParam kCosmeticFilteringSubFrameFirstSelectorsPollingDelayMs; extern const base::FeatureParam diff --git a/components/brave_shields/resources/cookie_list_opt_in/cookie_list_opt_in.html b/components/brave_shields/resources/cookie_list_opt_in/cookie_list_opt_in.html index c58c6a0aeba8..ec39eece8cea 100644 --- a/components/brave_shields/resources/cookie_list_opt_in/cookie_list_opt_in.html +++ b/components/brave_shields/resources/cookie_list_opt_in/cookie_list_opt_in.html @@ -5,7 +5,7 @@ Cookie Consent Blocker - +