diff --git a/android/brave_java_sources.gni b/android/brave_java_sources.gni index 87ca4dd404c..a087901073c 100644 --- a/android/brave_java_sources.gni +++ b/android/brave_java_sources.gni @@ -138,7 +138,6 @@ brave_java_sources = [ "../../brave/android/java/org/chromium/chrome/browser/rate/RateFeedbackUtils.java", "../../brave/android/java/org/chromium/chrome/browser/rate/RateUtils.java", "../../brave/android/java/org/chromium/chrome/browser/safe_browsing/settings/BraveStandardProtectionSettingsFragment.java", - "../../brave/android/java/org/chromium/chrome/browser/search_engines/settings/BraveBaseSearchEngineAdapter.java", "../../brave/android/java/org/chromium/chrome/browser/settings/AppearancePreferences.java", "../../brave/android/java/org/chromium/chrome/browser/settings/BackgroundImagesPreferences.java", "../../brave/android/java/org/chromium/chrome/browser/settings/BackgroundVideoPlaybackPreference.java", @@ -147,16 +146,12 @@ brave_java_sources = [ "../../brave/android/java/org/chromium/chrome/browser/settings/BraveLicensePreferences.java", "../../brave/android/java/org/chromium/chrome/browser/settings/BraveMainPreferencesBase.java", "../../brave/android/java/org/chromium/chrome/browser/settings/BravePreferenceFragment.java", - "../../brave/android/java/org/chromium/chrome/browser/settings/BravePrivateSearchEnginePreference.java", "../../brave/android/java/org/chromium/chrome/browser/settings/BraveRewardsPreferences.java", "../../brave/android/java/org/chromium/chrome/browser/settings/BraveRewardsResetPreference.java", "../../brave/android/java/org/chromium/chrome/browser/settings/BraveRewardsResetPreferenceDialog.java", - "../../brave/android/java/org/chromium/chrome/browser/settings/BraveSearchEngineAdapter.java", - "../../brave/android/java/org/chromium/chrome/browser/settings/BraveSearchEnginePreference.java", "../../brave/android/java/org/chromium/chrome/browser/settings/BraveSearchEngineUtils.java", "../../brave/android/java/org/chromium/chrome/browser/settings/BraveSettingsActivity.java", "../../brave/android/java/org/chromium/chrome/browser/settings/BraveSettingsLauncherImpl.java", - "../../brave/android/java/org/chromium/chrome/browser/settings/BraveStandardSearchEnginePreference.java", "../../brave/android/java/org/chromium/chrome/browser/settings/BraveStatsPreferences.java", "../../brave/android/java/org/chromium/chrome/browser/settings/BraveWebrtcPolicyPreference.java", "../../brave/android/java/org/chromium/chrome/browser/settings/BraveWebrtcPolicyPreferencesFragment.java", 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 1112044b1ee..ca17da3defd 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 @@ -36,18 +36,17 @@ public class BraveFeedSurfaceCoordinator extends FeedSurfaceCoordinator { private FrameLayout mRootView; public BraveFeedSurfaceCoordinator(Activity activity, SnackbarManager snackbarManager, - TabModelSelector tabModelSelector, WindowAndroid windowAndroid, - @Nullable SnapScrollHelper snapScrollHelper, @Nullable View ntpHeader, - @Nullable SectionHeaderView sectionHeaderView, FeedV1ActionOptions actionOptions, + WindowAndroid windowAndroid, @Nullable SnapScrollHelper snapScrollHelper, + @Nullable View ntpHeader, @Nullable SectionHeaderView sectionHeaderView, boolean showDarkBackground, FeedSurfaceDelegate delegate, @Nullable NativePageNavigationDelegate pageNavigationDelegate, Profile profile, boolean isPlaceholderShownInitially, BottomSheetController bottomSheetController, Supplier shareDelegateSupplier, @Nullable ScrollableContainerDelegate externalScrollableContainerDelegate) { - super(activity, snackbarManager, tabModelSelector, windowAndroid, snapScrollHelper, - ntpHeader, sectionHeaderView, actionOptions, showDarkBackground, delegate, - pageNavigationDelegate, profile, isPlaceholderShownInitially, bottomSheetController, - shareDelegateSupplier, externalScrollableContainerDelegate); + super(activity, snackbarManager, windowAndroid, snapScrollHelper, ntpHeader, + sectionHeaderView, showDarkBackground, delegate, pageNavigationDelegate, profile, + isPlaceholderShownInitially, bottomSheetController, shareDelegateSupplier, + externalScrollableContainerDelegate); } @Override @@ -77,4 +76,8 @@ public class BraveFeedSurfaceCoordinator extends FeedSurfaceCoordinator { mScrollViewForPolicy.setFillViewport(true); mScrollViewForPolicy.requestFocus(); } + + public boolean isEnhancedProtectionPromoEnabled() { + return false; + } } diff --git a/android/java/apk_for_test.flags b/android/java/apk_for_test.flags index f3986de3b47..ee9338a6d9f 100644 --- a/android/java/apk_for_test.flags +++ b/android/java/apk_for_test.flags @@ -70,6 +70,11 @@ *** sortAndFilterUnnecessaryTemplateUrl(...); } +-keep class org.chromium.chrome.browser.search_engines.settings.SearchEngineSettings { + *** mSearchEngineAdapter; + *** createAdapterIfNecessary(...); +} + -keep class org.chromium.base.CommandLineInitUtil { *** initCommandLine(...); } diff --git a/android/java/org/chromium/chrome/browser/BraveHelper.java b/android/java/org/chromium/chrome/browser/BraveHelper.java index 80f4a3238bf..2585c1ade4a 100644 --- a/android/java/org/chromium/chrome/browser/BraveHelper.java +++ b/android/java/org/chromium/chrome/browser/BraveHelper.java @@ -7,30 +7,27 @@ package org.chromium.chrome.browser; import org.chromium.base.CommandLine; import org.chromium.base.ContextUtils; -import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.firstrun.FirstRunStatus; +import org.chromium.chrome.browser.flags.ChromeSwitches; public class BraveHelper { - public static final String SHARED_PREF_DISPLAYED_INFOBAR_PROMO = + public static final String SHARED_PREF_DISPLAYED_INFOBAR_PROMO = "displayed_data_reduction_infobar_promo"; - // Used to indicate were the settings migrated to the new - // brave-core based version - public static final String PREF_TABS_SETTINGS_MIGRATED = + // Used to indicate were the settings migrated to the new + // brave-core based version + public static final String PREF_TABS_SETTINGS_MIGRATED = "android_tabs_settings_to_core_migrated"; - // New search engines settings - public static final String PRIVATE_DSE_SHORTNAME = "private_dse_shortname"; - public static final String STANDARD_DSE_SHORTNAME = "standard_dse_shortname"; - public BraveHelper() {} + public BraveHelper() {} - public static void DisableFREDRP() { - CommandLine.getInstance().appendSwitch(ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE); - FirstRunStatus.setFirstRunFlowComplete(true); - - // Disables data reduction promo dialog - ContextUtils.getAppSharedPreferences() - .edit() - .putBoolean(SHARED_PREF_DISPLAYED_INFOBAR_PROMO, true) - .apply(); - } + public static void DisableFREDRP() { + CommandLine.getInstance().appendSwitch(ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE); + FirstRunStatus.setFirstRunFlowComplete(true); + + // Disables data reduction promo dialog + ContextUtils.getAppSharedPreferences() + .edit() + .putBoolean(SHARED_PREF_DISPLAYED_INFOBAR_PROMO, true) + .apply(); + } } 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 ffba7d070fc..cf7b41ac3ea 100644 --- a/android/java/org/chromium/chrome/browser/app/appmenu/BraveAppMenuPropertiesDelegateImpl.java +++ b/android/java/org/chromium/chrome/browser/app/appmenu/BraveAppMenuPropertiesDelegateImpl.java @@ -32,11 +32,9 @@ public class BraveAppMenuPropertiesDelegateImpl extends AppMenuPropertiesDelegat MultiWindowModeStateDispatcher multiWindowModeStateDispatcher, TabModelSelector tabModelSelector, ToolbarManager toolbarManager, View decorView, @Nullable OneshotSupplier overviewModeBehaviorSupplier, - ObservableSupplier bookmarkBridgeSupplier, - ModalDialogManager modalDialogManager, WebFeedBridge webFeedBridge) { + ObservableSupplier bookmarkBridgeSupplier) { super(context, activityTabProvider, multiWindowModeStateDispatcher, tabModelSelector, - toolbarManager, decorView, overviewModeBehaviorSupplier, bookmarkBridgeSupplier, - modalDialogManager, webFeedBridge); + toolbarManager, decorView, overviewModeBehaviorSupplier, bookmarkBridgeSupplier); } @Override diff --git a/android/java/org/chromium/chrome/browser/appmenu/BraveTabbedAppMenuPropertiesDelegate.java b/android/java/org/chromium/chrome/browser/appmenu/BraveTabbedAppMenuPropertiesDelegate.java index a8b5c1c9aad..c0d6a65ba34 100644 --- a/android/java/org/chromium/chrome/browser/appmenu/BraveTabbedAppMenuPropertiesDelegate.java +++ b/android/java/org/chromium/chrome/browser/appmenu/BraveTabbedAppMenuPropertiesDelegate.java @@ -35,6 +35,7 @@ import org.chromium.chrome.browser.toolbar.bottom.BottomToolbarConfiguration; import org.chromium.chrome.browser.toolbar.menu_button.BraveMenuButtonCoordinator; import org.chromium.chrome.browser.ui.appmenu.AppMenuDelegate; import org.chromium.chrome.browser.ui.appmenu.AppMenuHandler; +import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager; import org.chromium.ui.modaldialog.ModalDialogManager; public class BraveTabbedAppMenuPropertiesDelegate extends TabbedAppMenuPropertiesDelegate { @@ -48,10 +49,10 @@ public class BraveTabbedAppMenuPropertiesDelegate extends TabbedAppMenuPropertie AppMenuDelegate appMenuDelegate, OneshotSupplier overviewModeBehaviorSupplier, ObservableSupplier bookmarkBridgeSupplier, - ModalDialogManager modalDialogManager, WebFeedBridge webFeedBridge) { + SnackbarManager snackbarManager, WebFeedBridge webFeedBridge) { super(context, activityTabProvider, multiWindowModeStateDispatcher, tabModelSelector, toolbarManager, decorView, appMenuDelegate, overviewModeBehaviorSupplier, - bookmarkBridgeSupplier, modalDialogManager, webFeedBridge); + bookmarkBridgeSupplier, snackbarManager, webFeedBridge); mAppMenuDelegate = appMenuDelegate; } diff --git a/android/java/org/chromium/chrome/browser/bookmarks/BraveBookmarkUtils.java b/android/java/org/chromium/chrome/browser/bookmarks/BraveBookmarkUtils.java index 7c646c5e7b4..c6444f13cab 100644 --- a/android/java/org/chromium/chrome/browser/bookmarks/BraveBookmarkUtils.java +++ b/android/java/org/chromium/chrome/browser/bookmarks/BraveBookmarkUtils.java @@ -61,12 +61,7 @@ public class BraveBookmarkUtils extends BookmarkUtils { return; } - boolean isAddToOptionVariation = - CachedFeatureFlags.isEnabled( - ChromeFeatureList.TABBED_APP_OVERFLOW_MENU_THREE_BUTTON_ACTIONBAR) - && AppMenuPropertiesDelegateImpl.THREE_BUTTON_ACTION_BAR_VARIATION.getValue() - .equals("add_to_option"); - if (CachedFeatureFlags.isEnabled(ChromeFeatureList.READ_LATER) && !isAddToOptionVariation) { + if (CachedFeatureFlags.isEnabled(ChromeFeatureList.READ_LATER)) { // Show a bottom sheet to let the user select target bookmark folder. showBookmarkBottomSheet(bookmarkModel, tab, snackbarManager, bottomSheetController, activity, fromCustomTab, callback); diff --git a/android/java/org/chromium/chrome/browser/night_mode/settings/BraveRadioButtonGroupThemePreference.java b/android/java/org/chromium/chrome/browser/night_mode/settings/BraveRadioButtonGroupThemePreference.java index c8d1a5bd68d..7a32f3b122e 100644 --- a/android/java/org/chromium/chrome/browser/night_mode/settings/BraveRadioButtonGroupThemePreference.java +++ b/android/java/org/chromium/chrome/browser/night_mode/settings/BraveRadioButtonGroupThemePreference.java @@ -12,7 +12,7 @@ import android.view.View; import androidx.preference.PreferenceViewHolder; -import org.chromium.chrome.R; +import org.chromium.chrome.browser.night_mode.R; public class BraveRadioButtonGroupThemePreference extends RadioButtonGroupThemePreference { public BraveRadioButtonGroupThemePreference(Context context, AttributeSet attrs) { diff --git a/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPage.java b/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPage.java index 006856476e5..3300eeb4d70 100644 --- a/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPage.java +++ b/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPage.java @@ -49,19 +49,20 @@ public class BraveNewTabPage extends NewTabPage { @Override protected void initializeMainView(Activity activity, WindowAndroid windowAndroid, - SnackbarManager snackbarManager, TabModelSelector tabModelSelector, NewTabPageUma uma, - boolean isInNightMode, BottomSheetController bottomSheetController, + SnackbarManager snackbarManager, NewTabPageUma uma, boolean isInNightMode, + BottomSheetController bottomSheetController, ObservableSupplier shareDelegateSupplier) { - super.initializeMainView(activity, windowAndroid, snackbarManager, tabModelSelector, uma, - isInNightMode, bottomSheetController, shareDelegateSupplier); + super.initializeMainView(activity, windowAndroid, snackbarManager, uma, isInNightMode, + bottomSheetController, shareDelegateSupplier); // Override surface provider Profile profile = Profile.fromWebContents(mTab.getWebContents()); assert !FeedFeatures.isFeedEnabled(); mFeedSurfaceProvider = new BraveFeedSurfaceCoordinator(activity, snackbarManager, - tabModelSelector, windowAndroid, - new SnapScrollHelper(mNewTabPageManager, mNewTabPageLayout), mNewTabPageLayout, - null, null, isInNightMode, this, mNewTabPageManager.getNavigationDelegate(), - profile, false, bottomSheetController, shareDelegateSupplier, null); + windowAndroid, new SnapScrollHelper(mNewTabPageManager, mNewTabPageLayout), + mNewTabPageLayout, null, isInNightMode, this, + mNewTabPageManager.getNavigationDelegate(), profile, + /* isPlaceholderShownInitially= */ false, bottomSheetController, + shareDelegateSupplier, /* externalScrollableContainerDelegate= */ null); } } diff --git a/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPageLayout.java b/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPageLayout.java index c00a209574a..ee8f08a5217 100644 --- a/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPageLayout.java +++ b/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPageLayout.java @@ -930,8 +930,10 @@ public class BraveNewTabPageLayout countDownTimer = new Timer(); final Handler handler = new Handler(); countDownTimer.scheduleAtFixedRate(new TimerTask() { + @Override public void run() { handler.post(new Runnable() { + @Override public void run() { if (BinanceWidgetManager.getInstance() .isUserAuthenticatedForBinance()) { diff --git a/android/java/org/chromium/chrome/browser/search_engines/settings/BUILD.gn b/android/java/org/chromium/chrome/browser/search_engines/settings/BUILD.gn new file mode 100644 index 00000000000..b9a963e672e --- /dev/null +++ b/android/java/org/chromium/chrome/browser/search_engines/settings/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (c) 2021 The Brave Authors. All rights reserved. +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this file, +# You can obtain one at http://mozilla.org/MPL/2.0/. + +import("//build/config/android/rules.gni") + +android_library("java") { + sources = [ + "BraveBaseSearchEngineAdapter.java", + "BravePrivateSearchEnginePreference.java", + "BraveSearchEngineAdapter.java", + "BraveSearchEnginePreference.java", + "BraveStandardSearchEnginePreference.java", + ] + deps = [ + ":java_resources", + "//base:base_java", + "//chrome/browser/search_engines/android:java", + "//components/search_engines/android:java", + "//third_party/androidx:androidx_annotation_annotation_java", + ] + + resources_package = "org.chromium.chrome.browser.search_engines" +} + +android_resources("java_resources") { + deps = [ + "//brave/build/android:android_brave_strings_grd", + "//chrome/browser/search_engines/android:java_resources", + ] +} diff --git a/android/java/org/chromium/chrome/browser/settings/BravePrivateSearchEnginePreference.java b/android/java/org/chromium/chrome/browser/search_engines/settings/BravePrivateSearchEnginePreference.java similarity index 88% rename from android/java/org/chromium/chrome/browser/settings/BravePrivateSearchEnginePreference.java rename to android/java/org/chromium/chrome/browser/search_engines/settings/BravePrivateSearchEnginePreference.java index 9400796b98f..19b0c11b7cb 100644 --- a/android/java/org/chromium/chrome/browser/settings/BravePrivateSearchEnginePreference.java +++ b/android/java/org/chromium/chrome/browser/search_engines/settings/BravePrivateSearchEnginePreference.java @@ -3,7 +3,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -package org.chromium.chrome.browser.settings; +package org.chromium.chrome.browser.search_engines.settings; public class BravePrivateSearchEnginePreference extends BraveSearchEnginePreference { public BravePrivateSearchEnginePreference() { diff --git a/android/java/org/chromium/chrome/browser/search_engines/settings/BraveSearchEngineAdapter.java b/android/java/org/chromium/chrome/browser/search_engines/settings/BraveSearchEngineAdapter.java new file mode 100644 index 00000000000..420169340f5 --- /dev/null +++ b/android/java/org/chromium/chrome/browser/search_engines/settings/BraveSearchEngineAdapter.java @@ -0,0 +1,100 @@ +/* Copyright (c) 2019 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package org.chromium.chrome.browser.search_engines.settings; + +import android.content.Context; +import android.content.SharedPreferences; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import org.chromium.base.ContextUtils; +import org.chromium.chrome.browser.search_engines.R; +import org.chromium.chrome.browser.search_engines.TemplateUrlServiceFactory; +import org.chromium.components.search_engines.TemplateUrl; + +import java.util.List; + +public class BraveSearchEngineAdapter extends SearchEngineAdapter { + public static final String PRIVATE_DSE_SHORTNAME = "private_dse_shortname"; + public static final String STANDARD_DSE_SHORTNAME = "standard_dse_shortname"; + + private boolean mIsPrivate; + + static public void setDSEPrefs(TemplateUrl templateUrl, boolean isPrivate) { + SharedPreferences.Editor sharedPreferencesEditor = + ContextUtils.getAppSharedPreferences().edit(); + sharedPreferencesEditor.putString( + isPrivate ? PRIVATE_DSE_SHORTNAME : STANDARD_DSE_SHORTNAME, + templateUrl.getShortName()); + sharedPreferencesEditor.apply(); + } + + static public void updateActiveDSE(boolean isPrivate) { + TemplateUrl templateUrl = getTemplateUrlByShortName(getDSEShortName(isPrivate)); + if (templateUrl == null) { + return; + } + String keyword = templateUrl.getKeyword(); + TemplateUrlServiceFactory.get().setSearchEngine(keyword); + } + + static public String getDSEShortName(boolean isPrivate) { + String defaultSearchEngineName = null; + TemplateUrl dseTemplateUrl = + TemplateUrlServiceFactory.get().getDefaultSearchEngineTemplateUrl(); + if (dseTemplateUrl != null) defaultSearchEngineName = dseTemplateUrl.getShortName(); + + return ContextUtils.getAppSharedPreferences().getString( + isPrivate ? PRIVATE_DSE_SHORTNAME : STANDARD_DSE_SHORTNAME, + defaultSearchEngineName); + } + + static public TemplateUrl getTemplateUrlByShortName(String name) { + List templateUrls = TemplateUrlServiceFactory.get().getTemplateUrls(); + for (int index = 0; index < templateUrls.size(); ++index) { + TemplateUrl templateUrl = templateUrls.get(index); + if (templateUrl.getShortName().equals(name)) { + return templateUrl; + } + } + assert false : "This should not happen!"; + return null; + } + + public BraveSearchEngineAdapter(Context context, boolean isPrivate) { + super(context); + mIsPrivate = isPrivate; + } + + @Override + public void onClick(View view) { + super.onClick(view); + + if (view.getTag() == null) { + return; + } + + TemplateUrl templateUrl = (TemplateUrl) getItem((int) view.getTag()); + setDSEPrefs(templateUrl, mIsPrivate); + } + + @Override + public void start() { + updateActiveDSE(mIsPrivate); + super.start(); + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + View view = super.getView(position, convertView, parent); + TextView url = (TextView) view.findViewById(R.id.url); + if (url != null) { + url.setVisibility(View.GONE); + } + return view; + } +} diff --git a/android/java/org/chromium/chrome/browser/settings/BraveSearchEnginePreference.java b/android/java/org/chromium/chrome/browser/search_engines/settings/BraveSearchEnginePreference.java similarity index 56% rename from android/java/org/chromium/chrome/browser/settings/BraveSearchEnginePreference.java rename to android/java/org/chromium/chrome/browser/search_engines/settings/BraveSearchEnginePreference.java index fac3cc1de56..9c538c0c6d6 100644 --- a/android/java/org/chromium/chrome/browser/settings/BraveSearchEnginePreference.java +++ b/android/java/org/chromium/chrome/browser/search_engines/settings/BraveSearchEnginePreference.java @@ -3,7 +3,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -package org.chromium.chrome.browser.settings; +package org.chromium.chrome.browser.search_engines.settings; import android.os.Bundle; import android.view.View; @@ -11,11 +11,13 @@ import android.widget.ListView; import androidx.fragment.app.ListFragment; -import org.chromium.chrome.R; -import org.chromium.chrome.browser.search_engines.settings.SearchEngineAdapter; +import org.chromium.chrome.browser.search_engines.R; -public class BraveSearchEnginePreference extends ListFragment { +public class BraveSearchEnginePreference extends SearchEngineSettings { + // These members will be deleted in bytecode, member from parent class will be used instead. private SearchEngineAdapter mSearchEngineAdapter; + + // Own members. private boolean mPrivate; public BraveSearchEnginePreference(boolean isPrivate) { @@ -27,27 +29,10 @@ public class BraveSearchEnginePreference extends ListFragment { super.onCreate(savedInstanceState); getActivity().setTitle(mPrivate ? R.string.prefs_private_search_engine : R.string.prefs_standard_search_engine); + } + + public void createAdapterIfNecessary() { + if (mSearchEngineAdapter != null) return; mSearchEngineAdapter = new BraveSearchEngineAdapter(getActivity(), mPrivate); - setListAdapter(mSearchEngineAdapter); - } - - @Override - public void onViewCreated(View view, Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - ListView listView = getListView(); - listView.setDivider(null); - listView.setItemsCanFocus(true); - } - - @Override - public void onStart() { - super.onStart(); - mSearchEngineAdapter.start(); - } - - @Override - public void onStop() { - super.onStop(); - mSearchEngineAdapter.stop(); } } diff --git a/android/java/org/chromium/chrome/browser/settings/BraveStandardSearchEnginePreference.java b/android/java/org/chromium/chrome/browser/search_engines/settings/BraveStandardSearchEnginePreference.java similarity index 88% rename from android/java/org/chromium/chrome/browser/settings/BraveStandardSearchEnginePreference.java rename to android/java/org/chromium/chrome/browser/search_engines/settings/BraveStandardSearchEnginePreference.java index b9f629d4f76..602a654ddb9 100644 --- a/android/java/org/chromium/chrome/browser/settings/BraveStandardSearchEnginePreference.java +++ b/android/java/org/chromium/chrome/browser/search_engines/settings/BraveStandardSearchEnginePreference.java @@ -3,7 +3,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -package org.chromium.chrome.browser.settings; +package org.chromium.chrome.browser.search_engines.settings; public class BraveStandardSearchEnginePreference extends BraveSearchEnginePreference { public BraveStandardSearchEnginePreference() { diff --git a/android/java/org/chromium/chrome/browser/settings/BraveSearchEngineAdapter.java b/android/java/org/chromium/chrome/browser/settings/BraveSearchEngineAdapter.java deleted file mode 100644 index c3076388592..00000000000 --- a/android/java/org/chromium/chrome/browser/settings/BraveSearchEngineAdapter.java +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (c) 2019 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -package org.chromium.chrome.browser.settings; - -import android.content.Context; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; - -import org.chromium.chrome.R; -import org.chromium.chrome.browser.search_engines.settings.SearchEngineAdapter; -import org.chromium.components.search_engines.TemplateUrl; - -public class BraveSearchEngineAdapter extends SearchEngineAdapter { - private boolean mIsPrivate; - - public BraveSearchEngineAdapter(Context context, boolean isPrivate) { - super(context); - mIsPrivate = isPrivate; - } - - @Override - public void onClick(View view) { - super.onClick(view); - - if (view.getTag() == null) { - return; - } - - TemplateUrl templateUrl = (TemplateUrl) getItem((int) view.getTag()); - BraveSearchEngineUtils.setDSEPrefs(templateUrl, mIsPrivate); - } - - @Override - public void start() { - BraveSearchEngineUtils.updateActiveDSE(mIsPrivate); - super.start(); - } - - @Override - public View getView(int position, View convertView, ViewGroup parent) { - View view = super.getView(position, convertView, parent); - TextView url = (TextView) view.findViewById(R.id.url); - if (url != null) { - url.setVisibility(View.GONE); - } - return view; - } -} diff --git a/android/java/org/chromium/chrome/browser/settings/BraveSearchEngineUtils.java b/android/java/org/chromium/chrome/browser/settings/BraveSearchEngineUtils.java index f84a63cc93d..cd003dc7e23 100644 --- a/android/java/org/chromium/chrome/browser/settings/BraveSearchEngineUtils.java +++ b/android/java/org/chromium/chrome/browser/settings/BraveSearchEngineUtils.java @@ -8,45 +8,13 @@ package org.chromium.chrome.browser.settings; import android.content.SharedPreferences; import org.chromium.base.ContextUtils; -import org.chromium.chrome.browser.BraveHelper; import org.chromium.chrome.browser.search_engines.TemplateUrlServiceFactory; +import org.chromium.chrome.browser.search_engines.settings.BraveSearchEngineAdapter; import org.chromium.chrome.browser.tabmodel.TabModelSelector; -import org.chromium.components.search_engines.TemplateUrlService; import org.chromium.components.search_engines.TemplateUrl; - -import java.util.List; +import org.chromium.components.search_engines.TemplateUrlService; public class BraveSearchEngineUtils { - static public String getDSEShortName(boolean isPrivate) { - String defaultSearchEngineName = null; - TemplateUrl dseTemplateUrl = - TemplateUrlServiceFactory.get().getDefaultSearchEngineTemplateUrl(); - if (dseTemplateUrl != null) - defaultSearchEngineName = dseTemplateUrl.getShortName(); - - return ContextUtils.getAppSharedPreferences().getString( - isPrivate ? BraveHelper.PRIVATE_DSE_SHORTNAME : - BraveHelper.STANDARD_DSE_SHORTNAME, defaultSearchEngineName); - } - - static public void updateActiveDSE(boolean isPrivate) { - TemplateUrl templateUrl = getTemplateUrlByShortName(getDSEShortName(isPrivate)); - if (templateUrl == null) { - return; - } - String keyword = templateUrl.getKeyword(); - TemplateUrlServiceFactory.get().setSearchEngine(keyword); - } - - static public void setDSEPrefs(TemplateUrl templateUrl, boolean isPrivate) { - SharedPreferences.Editor sharedPreferencesEditor = - ContextUtils.getAppSharedPreferences().edit(); - sharedPreferencesEditor.putString( - isPrivate ? BraveHelper.PRIVATE_DSE_SHORTNAME : - BraveHelper.STANDARD_DSE_SHORTNAME, templateUrl.getShortName()); - sharedPreferencesEditor.apply(); - } - static public void initializeBraveSearchEngineStates(TabModelSelector tabModelSelector) { tabModelSelector.addObserver(new SearchEngineTabModelSelectorObserver(tabModelSelector)); @@ -71,18 +39,17 @@ public class BraveSearchEngineUtils { // At first run, we should set initial default prefs to each standard/private DSE prefs. // Those pref values will be used until user change DES options explicitly. final String notInitialized = "notInitialized"; - if (notInitialized.equals( - ContextUtils.getAppSharedPreferences().getString( - BraveHelper.STANDARD_DSE_SHORTNAME, notInitialized))) { + if (notInitialized.equals(ContextUtils.getAppSharedPreferences().getString( + BraveSearchEngineAdapter.STANDARD_DSE_SHORTNAME, notInitialized))) { TemplateUrl templateUrl = - TemplateUrlServiceFactory.get().getDefaultSearchEngineTemplateUrl(); + TemplateUrlServiceFactory.get().getDefaultSearchEngineTemplateUrl(); SharedPreferences.Editor sharedPreferencesEditor = - ContextUtils.getAppSharedPreferences().edit(); - sharedPreferencesEditor.putString(BraveHelper.STANDARD_DSE_SHORTNAME, - templateUrl.getShortName()); - sharedPreferencesEditor.putString(BraveHelper.PRIVATE_DSE_SHORTNAME, - templateUrl.getShortName()); + ContextUtils.getAppSharedPreferences().edit(); + sharedPreferencesEditor.putString( + BraveSearchEngineAdapter.STANDARD_DSE_SHORTNAME, templateUrl.getShortName()); + sharedPreferencesEditor.putString( + BraveSearchEngineAdapter.PRIVATE_DSE_SHORTNAME, templateUrl.getShortName()); sharedPreferencesEditor.apply(); } } @@ -95,16 +62,19 @@ public class BraveSearchEngineUtils { updateActiveDSE(false); } + static public void setDSEPrefs(TemplateUrl templateUrl, boolean isPrivate) { + BraveSearchEngineAdapter.setDSEPrefs(templateUrl, isPrivate); + } + + static public void updateActiveDSE(boolean isPrivate) { + BraveSearchEngineAdapter.updateActiveDSE(isPrivate); + } + + static public String getDSEShortName(boolean isPrivate) { + return BraveSearchEngineAdapter.getDSEShortName(isPrivate); + } + static public TemplateUrl getTemplateUrlByShortName(String name) { - List templateUrls = TemplateUrlServiceFactory.get().getTemplateUrls(); - for (int index = 0; index < templateUrls.size(); ++index) { - TemplateUrl templateUrl = templateUrls.get(index); - if (templateUrl.getShortName().equals(name)) { - return templateUrl; - } - } - // This should not happen - assert false; - return null; + return BraveSearchEngineAdapter.getTemplateUrlByShortName(name); } } diff --git a/android/java/org/chromium/chrome/browser/settings/BraveSyncScreensPreference.java b/android/java/org/chromium/chrome/browser/settings/BraveSyncScreensPreference.java index 84a8ccdbf8d..d52155f195d 100644 --- a/android/java/org/chromium/chrome/browser/settings/BraveSyncScreensPreference.java +++ b/android/java/org/chromium/chrome/browser/settings/BraveSyncScreensPreference.java @@ -345,7 +345,7 @@ public class BraveSyncScreensPreference extends BravePreferenceFragment @Override public void onActivityCreated(Bundle savedInstanceState) { - getActivity().setTitle(R.string.sign_in_sync); + getActivity().setTitle(R.string.sync_category_title); mScrollViewSyncInitial = (ScrollView) getView().findViewById(R.id.view_sync_initial); mScrollViewSyncChainCode = (ScrollView) getView().findViewById(R.id.view_sync_chain_code); diff --git a/android/java/org/chromium/chrome/browser/settings/themes/BraveRadioButtonGroupCustomHomepageThemePreference.java b/android/java/org/chromium/chrome/browser/settings/themes/BraveRadioButtonGroupCustomHomepageThemePreference.java index bae83792dd8..e512b4247e4 100644 --- a/android/java/org/chromium/chrome/browser/settings/themes/BraveRadioButtonGroupCustomHomepageThemePreference.java +++ b/android/java/org/chromium/chrome/browser/settings/themes/BraveRadioButtonGroupCustomHomepageThemePreference.java @@ -6,19 +6,20 @@ package org.chromium.chrome.browser.settings.themes; import android.content.Context; -import androidx.preference.PreferenceViewHolder; import android.util.AttributeSet; import android.view.View; import android.widget.RadioGroup; -import org.chromium.chrome.R; -import org.chromium.components.browser_ui.widget.RadioButtonWithDescription; -import org.chromium.chrome.browser.profiles.Profile; -import org.chromium.chrome.browser.preferences.BravePref; -import org.chromium.components.user_prefs.UserPrefs; +import androidx.preference.PreferenceViewHolder; + +import org.chromium.chrome.browser.BraveRelaunchUtils; +import org.chromium.chrome.browser.night_mode.R; import org.chromium.chrome.browser.night_mode.settings.RadioButtonGroupThemePreference; import org.chromium.chrome.browser.ntp_background_images.NTPBackgroundImagesBridge; -import org.chromium.chrome.browser.BraveRelaunchUtils; +import org.chromium.chrome.browser.preferences.BravePref; +import org.chromium.chrome.browser.profiles.Profile; +import org.chromium.components.browser_ui.widget.RadioButtonWithDescription; +import org.chromium.components.user_prefs.UserPrefs; public class BraveRadioButtonGroupCustomHomepageThemePreference extends RadioButtonGroupThemePreference { @@ -50,7 +51,8 @@ public class BraveRadioButtonGroupCustomHomepageThemePreference extends RadioBut braveDefaultView.setChecked(true); } } - braveDefaultView.setPrimaryText(getContext().getResources().getString(R.string.brave_default)); + braveDefaultView.setPrimaryText( + getContext().getResources().getString(org.chromium.chrome.R.string.brave_default)); } @Override diff --git a/android/java/org/chromium/chrome/browser/signin/BraveSigninManager.java b/android/java/org/chromium/chrome/browser/signin/BraveSigninManager.java index abfe16b4999..65d3f752013 100644 --- a/android/java/org/chromium/chrome/browser/signin/BraveSigninManager.java +++ b/android/java/org/chromium/chrome/browser/signin/BraveSigninManager.java @@ -5,21 +5,28 @@ package org.chromium.chrome.browser.signin; +import android.accounts.Account; + +import androidx.annotation.MainThread; +import androidx.annotation.Nullable; + +import org.chromium.base.Callback; import org.chromium.base.annotations.CalledByNative; import org.chromium.chrome.browser.AppHooks; import org.chromium.chrome.browser.signin.services.SigninManager; -import org.chromium.chrome.browser.sync.AndroidSyncSettings; -import org.chromium.components.externalauth.ExternalAuthUtils; import org.chromium.components.signin.AccountTrackerService; +import org.chromium.components.signin.base.CoreAccountInfo; +import org.chromium.components.signin.identitymanager.AccountInfoService; import org.chromium.components.signin.identitymanager.IdentityManager; import org.chromium.components.signin.identitymanager.IdentityMutator; +import org.chromium.components.signin.metrics.SigninAccessPoint; +import org.chromium.components.signin.metrics.SignoutReason; -public class BraveSigninManager extends SigninManagerImpl { - BraveSigninManager(long nativeSigninManagerAndroid, AccountTrackerService accountTrackerService, - IdentityManager identityManager, IdentityMutator identityMutator, - AndroidSyncSettings androidSyncSettings, ExternalAuthUtils externalAuthUtils) { - super(nativeSigninManagerAndroid, accountTrackerService, identityManager, identityMutator, - androidSyncSettings, externalAuthUtils); +public class BraveSigninManager implements SigninManager { + private final IdentityManager mIdentityManager; + + BraveSigninManager(IdentityManager identityManager) { + mIdentityManager = identityManager; } @Override @@ -32,16 +39,79 @@ public class BraveSigninManager extends SigninManagerImpl { return false; } + @Override + public void isAccountManaged(String email, final Callback callback) {} + + @Override + public String getManagementDomain() { + return ""; + } + + @Override + public void signOut(@SignoutReason int signoutSource, SignOutCallback signOutCallback, + boolean forceWipeUserData) {} + + @Override + @MainThread + public void runAfterOperationInProgress(Runnable runnable) {} + + @Override + public void signinAndEnableSync(@SigninAccessPoint int accessPoint, CoreAccountInfo accountInfo, + @Nullable SignInCallback callback) {} + + @Override + @Deprecated + public void signinAndEnableSync(@SigninAccessPoint int accessPoint, Account account, + @Nullable SignInCallback callback) {} + + @Override + public void signin(CoreAccountInfo accountInfo, @Nullable SignInCallback callback) {} + + @Override + public void removeSignInAllowedObserver(SignInAllowedObserver observer) {} + + @Override + public void addSignInAllowedObserver(SignInAllowedObserver observer) {} + + @Override + public void removeSignInStateObserver(SignInStateObserver observer) {} + + @Override + public void addSignInStateObserver(SignInStateObserver observer) {} + + @Override + public boolean isForceSigninEnabled() { + return false; + } + + @Override + public boolean isSigninDisabledByPolicy() { + return false; + } + + @Override + public void onFirstRunCheckDone() {} + + @Override + public IdentityManager getIdentityManager() { + return mIdentityManager; + } + + @Override + public String extractDomainName(String accountEmail) { + return ""; + }; + @CalledByNative - private static SigninManager create(long nativeSigninManagerAndroid, + static SigninManager create(long nativeSigninManagerAndroid, AccountTrackerService accountTrackerService, IdentityManager identityManager, IdentityMutator identityMutator) { - assert nativeSigninManagerAndroid != 0; - assert accountTrackerService != null; - assert identityManager != null; - assert identityMutator != null; - return new BraveSigninManager(nativeSigninManagerAndroid, accountTrackerService, - identityManager, identityMutator, AndroidSyncSettings.get(), - ExternalAuthUtils.getInstance()); + AccountInfoService.init(identityManager); + return new BraveSigninManager(identityManager); + } + + @CalledByNative + void destroy() { + AccountInfoService.get().destroy(); } } diff --git a/android/java/org/chromium/chrome/browser/tabmodel/BraveTabCreator.java b/android/java/org/chromium/chrome/browser/tabmodel/BraveTabCreator.java index 6346df0598f..2b0a7aa198c 100644 --- a/android/java/org/chromium/chrome/browser/tabmodel/BraveTabCreator.java +++ b/android/java/org/chromium/chrome/browser/tabmodel/BraveTabCreator.java @@ -5,13 +5,16 @@ package org.chromium.chrome.browser.tabmodel; +import android.app.Activity; import android.os.Build; import org.chromium.base.BraveReflectionUtil; +import org.chromium.base.supplier.ObservableSupplier; import org.chromium.base.supplier.Supplier; import org.chromium.chrome.browser.ChromeTabbedActivity; import org.chromium.chrome.browser.app.BraveActivity; import org.chromium.chrome.browser.app.ChromeActivity; +import org.chromium.chrome.browser.compositor.CompositorViewHolder; import org.chromium.chrome.browser.init.StartupTabPreloader; import org.chromium.chrome.browser.ntp_background_images.NTPBackgroundImagesBridge; import org.chromium.chrome.browser.ntp_background_images.util.SponsoredImageUtil; @@ -25,12 +28,15 @@ import org.chromium.components.user_prefs.UserPrefs; import org.chromium.ui.base.WindowAndroid; public class BraveTabCreator extends ChromeTabCreator { - - public BraveTabCreator(ChromeActivity activity, WindowAndroid nativeWindow, + public BraveTabCreator(Activity activity, WindowAndroid nativeWindow, StartupTabPreloader startupTabPreloader, Supplier tabDelegateFactory, boolean incognito, - OverviewNTPCreator overviewNTPCreator, AsyncTabParamsManager asyncTabParamsManager) { - super(activity, nativeWindow, startupTabPreloader, tabDelegateFactory, incognito, overviewNTPCreator, asyncTabParamsManager); + OverviewNTPCreator overviewNTPCreator, AsyncTabParamsManager asyncTabParamsManager, + ObservableSupplier tabModelSelectorSupplier, + ObservableSupplier compositorViewHolderSupplier) { + super(activity, nativeWindow, startupTabPreloader, tabDelegateFactory, incognito, + overviewNTPCreator, asyncTabParamsManager, tabModelSelectorSupplier, + compositorViewHolderSupplier); } @Override diff --git a/android/java/org/chromium/chrome/browser/toolbar/BraveToolbarManager.java b/android/java/org/chromium/chrome/browser/toolbar/BraveToolbarManager.java index 709efb6915b..1faa721fbd2 100644 --- a/android/java/org/chromium/chrome/browser/toolbar/BraveToolbarManager.java +++ b/android/java/org/chromium/chrome/browser/toolbar/BraveToolbarManager.java @@ -130,7 +130,7 @@ public class BraveToolbarManager extends ToolbarManager { ObservableSupplier omniboxFocusStateSupplier, OneshotSupplier intentMetadataOneshotSupplier, OneshotSupplier promoShownOneshotSupplier, WindowAndroid windowAndroid, - Supplier isInOverviewModeSupplier, boolean isCustomTab, + Supplier isInOverviewModeSupplier, Supplier modalDialogManagerSupplier, StatusBarColorController statusBarColorController, AppMenuDelegate appMenuDelegate, ActivityLifecycleDispatcher activityLifecycleDispatcher, @@ -143,9 +143,8 @@ public class BraveToolbarManager extends ToolbarManager { layoutStateProviderSupplier, appMenuCoordinatorSupplier, shouldShowUpdateBadge, tabModelSelectorSupplier, startSurfaceSupplier, omniboxFocusStateSupplier, intentMetadataOneshotSupplier, promoShownOneshotSupplier, windowAndroid, - isInOverviewModeSupplier, isCustomTab, modalDialogManagerSupplier, - statusBarColorController, appMenuDelegate, activityLifecycleDispatcher, - startSurfaceParentTabSupplier); + isInOverviewModeSupplier, modalDialogManagerSupplier, statusBarColorController, + appMenuDelegate, activityLifecycleDispatcher, startSurfaceParentTabSupplier); mOmniboxFocusStateSupplier = omniboxFocusStateSupplier; mLayoutStateProviderSupplier = layoutStateProviderSupplier; mActivity = activity; diff --git a/android/java/res/xml/brave_main_preferences.xml b/android/java/res/xml/brave_main_preferences.xml index fab13861964..4ba6fe910ad 100644 --- a/android/java/res/xml/brave_main_preferences.xml +++ b/android/java/res/xml/brave_main_preferences.xml @@ -12,12 +12,12 @@ android:order="0" android:title="@string/prefs_section_search_engine"/> diff --git a/android/javatests/org/chromium/chrome/browser/BytecodeTest.java b/android/javatests/org/chromium/chrome/browser/BytecodeTest.java index c36061d3ecf..87a4b3e96da 100644 --- a/android/javatests/org/chromium/chrome/browser/BytecodeTest.java +++ b/android/javatests/org/chromium/chrome/browser/BytecodeTest.java @@ -5,6 +5,7 @@ package org.chromium.chrome.browser; +import android.app.Activity; import android.content.Context; import android.support.test.filters.SmallTest; import android.view.View; @@ -42,6 +43,7 @@ import org.chromium.chrome.browser.toolbar.top.ToolbarActionModeCallback; import org.chromium.chrome.browser.toolbar.top.ToolbarControlContainer; import org.chromium.chrome.browser.ui.TabObscuringHandler; import org.chromium.chrome.browser.ui.appmenu.AppMenuDelegate; +import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager; import org.chromium.chrome.browser.ui.system.StatusBarColorController; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.components.browser_ui.widget.scrim.ScrimCoordinator; @@ -78,6 +80,8 @@ public class BytecodeTest { classExists("org/chromium/chrome/browser/sync/settings/ManageSyncSettings")); Assert.assertTrue(classExists( "org/chromium/chrome/browser/search_engines/settings/SearchEngineAdapter")); + Assert.assertTrue(classExists( + "org/chromium/chrome/browser/search_engines/settings/SearchEngineSettings")); Assert.assertTrue(classExists("org/chromium/base/CommandLineInitUtil")); Assert.assertTrue(classExists("org/chromium/chrome/browser/ui/appmenu/AppMenu")); Assert.assertTrue(classExists( @@ -214,6 +218,9 @@ public class BytecodeTest { "getModel", false, null)); Assert.assertTrue(methodExists("org/chromium/components/permissions/PermissionDialogModel", "getModel", false, null)); + Assert.assertTrue(methodExists( + "org/chromium/chrome/browser/search_engines/settings/SearchEngineSettings", + "createAdapterIfNecessary", false, null)); } @Test @@ -235,12 +242,13 @@ public class BytecodeTest { "org/chromium/chrome/browser/appmenu/BraveTabbedAppMenuPropertiesDelegate", Context.class, ActivityTabProvider.class, MultiWindowModeStateDispatcher.class, TabModelSelector.class, ToolbarManager.class, View.class, AppMenuDelegate.class, - OneshotSupplier.class, ObservableSupplier.class, ModalDialogManager.class, + OneshotSupplier.class, ObservableSupplier.class, SnackbarManager.class, WebFeedBridge.class)); Assert.assertTrue(constructorsMatch("org/chromium/chrome/browser/tabmodel/ChromeTabCreator", - "org/chromium/chrome/browser/tabmodel/BraveTabCreator", ChromeActivity.class, + "org/chromium/chrome/browser/tabmodel/BraveTabCreator", Activity.class, WindowAndroid.class, StartupTabPreloader.class, Supplier.class, boolean.class, - ChromeTabCreator.OverviewNTPCreator.class, AsyncTabParamsManager.class)); + ChromeTabCreator.OverviewNTPCreator.class, AsyncTabParamsManager.class, + ObservableSupplier.class, ObservableSupplier.class)); Assert.assertTrue(constructorsMatch("org/chromium/chrome/browser/toolbar/ToolbarManager", "org/chromium/chrome/browser/toolbar/BraveToolbarManager", AppCompatActivity.class, BrowserControlsSizer.class, FullscreenManager.class, ToolbarControlContainer.class, @@ -251,8 +259,8 @@ public class BytecodeTest { ObservableSupplier.class, Supplier.class, OneshotSupplier.class, OneshotSupplier.class, boolean.class, ObservableSupplier.class, OneshotSupplier.class, ObservableSupplier.class, OneshotSupplier.class, - OneshotSupplier.class, WindowAndroid.class, Supplier.class, boolean.class, - Supplier.class, StatusBarColorController.class, AppMenuDelegate.class, + OneshotSupplier.class, WindowAndroid.class, Supplier.class, Supplier.class, + StatusBarColorController.class, AppMenuDelegate.class, ActivityLifecycleDispatcher.class, Supplier.class)); Assert.assertTrue(constructorsMatch( "org/chromium/chrome/browser/toolbar/bottom/BottomControlsMediator", @@ -264,7 +272,7 @@ public class BytecodeTest { "org/chromium/chrome/browser/app/appmenu/BraveAppMenuPropertiesDelegateImpl", Context.class, ActivityTabProvider.class, MultiWindowModeStateDispatcher.class, TabModelSelector.class, ToolbarManager.class, View.class, OneshotSupplier.class, - ObservableSupplier.class, ModalDialogManager.class, WebFeedBridge.class)); + ObservableSupplier.class)); Assert.assertTrue( constructorsMatch("org/chromium/chrome/browser/settings/SettingsLauncherImpl", "org/chromium/chrome/browser/settings/BraveSettingsLauncherImpl")); @@ -399,6 +407,9 @@ public class BytecodeTest { Assert.assertTrue(fieldExists( "org/chromium/chrome/browser/tasks/tab_management/TabGroupUiCoordinator", "mToolbarView")); + Assert.assertTrue(fieldExists( + "org/chromium/chrome/browser/search_engines/settings/SearchEngineSettings", + "mSearchEngineAdapter")); } @Test diff --git a/android/javatests/org/chromium/chrome/browser/safe_browsing/settings/BraveSafeBrowsingSettingsFragmentTest.java b/android/javatests/org/chromium/chrome/browser/safe_browsing/settings/BraveSafeBrowsingSettingsFragmentTest.java new file mode 100644 index 00000000000..d3fc37b7f7c --- /dev/null +++ b/android/javatests/org/chromium/chrome/browser/safe_browsing/settings/BraveSafeBrowsingSettingsFragmentTest.java @@ -0,0 +1,47 @@ +/* Copyright (c) 2021 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package org.chromium.chrome.browser.safe_browsing.settings; + +import android.support.test.filters.SmallTest; +import android.view.View; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.chromium.chrome.browser.safe_browsing.settings.SafeBrowsingSettingsFragment; +import org.chromium.chrome.browser.settings.SettingsActivityTestRule; +import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.content_public.browser.test.util.TestThreadUtils; + +@RunWith(ChromeJUnit4ClassRunner.class) +public class BraveSafeBrowsingSettingsFragmentTest { + @Rule + public SettingsActivityTestRule mTestRule = + new SettingsActivityTestRule<>(SafeBrowsingSettingsFragment.class); + private SafeBrowsingSettingsFragment mSafeBrowsingSettingsFragment; + private RadioButtonGroupSafeBrowsingPreference mSafeBrowsingPreference; + + @Before + public void setUp() { + mTestRule.startSettingsActivity(); + mSafeBrowsingSettingsFragment = mTestRule.getFragment(); + mSafeBrowsingPreference = mSafeBrowsingSettingsFragment.findPreference( + SafeBrowsingSettingsFragment.PREF_SAFE_BROWSING); + } + + @Test + @SmallTest + public void testEnhancedProtectionNotVisible() { + TestThreadUtils.runOnUiThreadBlocking(() -> { + Assert.assertEquals( + mSafeBrowsingPreference.getEnhancedProtectionButtonForTesting().getVisibility(), + View.GONE); + }); + } +} diff --git a/android/javatests/org/chromium/chrome/browser/safety_check/BraveSafetyCheckSettingsFragmentTest.java b/android/javatests/org/chromium/chrome/browser/safety_check/BraveSafetyCheckSettingsFragmentTest.java index 1362beb4c38..c6bb6cc5e67 100644 --- a/android/javatests/org/chromium/chrome/browser/safety_check/BraveSafetyCheckSettingsFragmentTest.java +++ b/android/javatests/org/chromium/chrome/browser/safety_check/BraveSafetyCheckSettingsFragmentTest.java @@ -15,7 +15,6 @@ import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; -import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.settings.SettingsActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.util.browser.Features; @@ -24,7 +23,6 @@ import org.chromium.chrome.test.util.browser.Features; // Main purpose of these tests id to detect that something new, that we may consider valuable, is // appeared in this section . @RunWith(ChromeJUnit4ClassRunner.class) -@Features.EnableFeatures(ChromeFeatureList.SAFETY_CHECK_ANDROID) public class BraveSafetyCheckSettingsFragmentTest { private static final String PASSWORDS = "passwords"; private static final String SAFE_BROWSING = "safe_browsing"; diff --git a/app/BUILD.gn b/app/BUILD.gn index 29b42e014f4..bf8b760048b 100644 --- a/app/BUILD.gn +++ b/app/BUILD.gn @@ -18,7 +18,7 @@ grit("brave_generated_resources_grit") { "brave_generated_resources.pak", ] - foreach(locale, locales_with_fake_bidi) { + foreach(locale, locales_with_pseudolocales) { outputs += [ "brave_generated_resources_$locale.pak" ] } diff --git a/app/DEPS b/app/DEPS index 8013e786e39..62e998bc400 100644 --- a/app/DEPS +++ b/app/DEPS @@ -22,6 +22,7 @@ include_rules = [ "+components/password_manager/core/common", "+components/safe_browsing/core/features.h", "+components/security_state/core/features.h", + "+components/signin/public/base", "+components/sync/base/sync_base_switches.h", "+components/translate/core/browser/translate_prefs.h", "+components/variations/variations_switches.h", diff --git a/app/brave_command_line_helper_unittest.cc b/app/brave_command_line_helper_unittest.cc index 43503972cb3..dd0eab735ef 100644 --- a/app/brave_command_line_helper_unittest.cc +++ b/app/brave_command_line_helper_unittest.cc @@ -22,7 +22,7 @@ int CountA(const base::CommandLine::StringVector& sv) { for (const auto& argv : sv) { std::string value; #if defined(OS_WIN) - value = base::UTF16ToASCII(argv); + value = base::WideToUTF8(argv); #else value = argv; #endif @@ -41,14 +41,14 @@ std::set FeaturesToSet(const std::string& features) { return result; } -void CheckEnabledFeatures(base::CommandLine& command_line, +void CheckEnabledFeatures(const base::CommandLine& command_line, const std::string& expected) { EXPECT_EQ(FeaturesToSet( command_line.GetSwitchValueASCII(switches::kEnableFeatures)), FeaturesToSet(expected)); } -void CheckDisabledFeatures(base::CommandLine& command_line, +void CheckDisabledFeatures(const base::CommandLine& command_line, const std::string& expected) { EXPECT_EQ(FeaturesToSet( command_line.GetSwitchValueASCII(switches::kDisableFeatures)), diff --git a/app/brave_main_delegate.cc b/app/brave_main_delegate.cc index 19b50cbd7d2..dbafad26fe3 100644 --- a/app/brave_main_delegate.cc +++ b/app/brave_main_delegate.cc @@ -38,7 +38,6 @@ #include "components/offline_pages/core/offline_page_feature.h" #include "components/omnibox/common/omnibox_features.h" #include "components/password_manager/core/common/password_manager_features.h" -#include "components/safe_browsing/core/features.h" #include "components/security_state/core/features.h" #include "components/sync/base/sync_base_switches.h" #include "components/translate/core/browser/translate_prefs.h" @@ -59,6 +58,7 @@ #if defined(OS_ANDROID) #include "base/android/jni_android.h" #include "brave/build/android/jni_headers/BraveQAPreferences_jni.h" +#include "components/signin/public/base/account_consistency_method.h" #else #include "chrome/browser/ui/profile_picker.h" #endif @@ -224,16 +224,15 @@ bool BraveMainDelegate::BasicStartupComplete(int* exit_code) { features::kWebOTP.name, federated_learning::kFederatedLearningOfCohorts.name, federated_learning::kFlocIdComputedEventLogging.name, - federated_learning::kFlocIdSortingLshBasedComputation.name, kSharingQRCodeGenerator.name, + net::features::kFirstPartySets.name, network_time::kNetworkTimeServiceQuerying.name, - safe_browsing::kEnhancedProtection.name, - safe_browsing::kEnhancedProtectionMessageInInterstitials.name, #if defined(OS_ANDROID) features::kWebNfc.name, feed::kInterestFeedContentSuggestions.name, feed::kInterestFeedV2.name, offline_pages::kPrefetchingOfflinePagesFeature.name, + signin::kMobileIdentityConsistency.name, translate::kTranslate.name, #else kEnableProfilePickerOnStartupFeature.name, diff --git a/app/brave_main_delegate_browsertest.cc b/app/brave_main_delegate_browsertest.cc index e847d8dd7e1..40ee2ded9bb 100644 --- a/app/brave_main_delegate_browsertest.cc +++ b/app/brave_main_delegate_browsertest.cc @@ -20,7 +20,6 @@ #include "components/network_time/network_time_tracker.h" #include "components/omnibox/common/omnibox_features.h" #include "components/password_manager/core/common/password_manager_features.h" -#include "components/safe_browsing/core/features.h" #include "components/security_state/core/features.h" #include "content/public/browser/render_view_host.h" #include "content/public/common/content_features.h" @@ -82,12 +81,10 @@ IN_PROC_BROWSER_TEST_F(BraveMainDelegateBrowserTest, DisabledFeatures) { &features::kWebOTP, &federated_learning::kFederatedLearningOfCohorts, &federated_learning::kFlocIdComputedEventLogging, - &federated_learning::kFlocIdSortingLshBasedComputation, &kEnableProfilePickerOnStartupFeature, &kSharingQRCodeGenerator, + &net::features::kFirstPartySets, &network_time::kNetworkTimeServiceQuerying, - &safe_browsing::kEnhancedProtection, - &safe_browsing::kEnhancedProtectionMessageInInterstitials, }; for (const auto* feature : disabled_features) diff --git a/app/brave_strings.grd b/app/brave_strings.grd index 34bef7f5ffa..43a7cc85c80 100644 --- a/app/brave_strings.grd +++ b/app/brave_strings.grd @@ -298,9 +298,6 @@ If you update this file, be sure also to update google_chrome_strings.grd. --> Not used in Brave. Placeholder to keep resource maps in sync. - - This computer will soon stop receiving Brave updates because its hardware is no longer supported. - To get future Brave updates, you'll need OS X 10.11 or later. This computer is using OS X 10.10. @@ -557,7 +554,6 @@ Brave is unable to recover your settings. Brave API keys are missing. Some functionality of Brave will be disabled. - @@ -568,18 +564,6 @@ Brave is unable to recover your settings. Also clear data from Brave ($1www.google.com) - - - - - Hide in Brave menu - - - - - Hide in Brave Menu - - @@ -592,9 +576,6 @@ Brave is unable to recover your settings. In Brave - - Brave recommends disabling this extension because it does not currently meet Enhanced Safe Browsing standards. - @@ -721,6 +702,11 @@ Brave is unable to recover your settings. + + + Customize Brave + + @@ -728,8 +714,8 @@ Brave is unable to recover your settings. - + Continue in a new Brave profile? @@ -754,6 +740,11 @@ Brave is unable to recover your settings. This will create a new Brave profile for $1foo@gmail.com + + + + Customize your new Brave profile + + Welcome to Brave profiles @@ -1213,18 +1195,13 @@ Brave is unable to recover your settings. A Brave profile with this account already exists on this device - - - - - To enable Brave to play protected media, you need to install Rosetta. Do you want to install it now? + + + You can switch between Brave profiles here - - Rosetta enables Brave to play the protected media on this page. - - - To use Rosetta to play protected media, you must restart Brave. + + $1CTRL+SHIFT+M can switch between Brave profiles diff --git a/app/brave_strings_override.grd b/app/brave_strings_override.grd index 5c146cf8f64..924e324a198 100644 --- a/app/brave_strings_override.grd +++ b/app/brave_strings_override.grd @@ -148,11 +148,7 @@ If you update this file, be sure also to update google_chrome_strings.grd. --> - - - - - + Warning: Brave cannot prevent extensions from recording your browsing history. To disable this extension in private mode, unselect this option. @@ -299,9 +295,6 @@ If you update this file, be sure also to update google_chrome_strings.grd. --> - - - diff --git a/app/extensions_strings.grdp b/app/extensions_strings.grdp index 8a51286d3bb..fb28d52f0a4 100644 --- a/app/extensions_strings.grdp +++ b/app/extensions_strings.grdp @@ -389,6 +389,9 @@ Load unpacked + + Extension loaded + Pack extension diff --git a/app/generated_resources.grd b/app/generated_resources.grd index 3bce8a32e5b..788ccfbfeba 100644 --- a/app/generated_resources.grd +++ b/app/generated_resources.grd @@ -386,6 +386,9 @@ are declared in tools/grit/grit_rule.gni. Permission requested, press F6 to respond + + Permission request expired + $1google.com wants to @@ -606,6 +609,10 @@ are declared in tools/grit/grit_rule.gni. Copy link to highlight + + Remove highlights + + Sa&ve image as... @@ -831,6 +838,10 @@ are declared in tools/grit/grit_rule.gni. Copy Link to Highlight + + Remove Highlights + + Sa&ve Image As... @@ -1229,6 +1240,9 @@ are declared in tools/grit/grit_rule.gni. R&eopen closed window + + Reopen closed group + Name &window... @@ -1264,6 +1278,9 @@ are declared in tools/grit/grit_rule.gni. R&eopen Closed Window + + Reopen Closed Group + Name &Window... @@ -1288,7 +1305,7 @@ are declared in tools/grit/grit_rule.gni. - Brave’s Terms of Service are changing March 31 + Brave's Terms of Service are changing March 31 Please review the new terms @@ -1717,6 +1734,9 @@ are declared in tools/grit/grit_rule.gni. $1bla.exe may be dangerous. Send to Brave Advanced Protection for scanning? + + + $1bla.exe may be dangerous. Send to Brave for scanning? This file is not commonly downloaded and may be dangerous. @@ -1763,6 +1783,13 @@ are declared in tools/grit/grit_rule.gni. Dangerous download blocked + + + + Scan file before opening? + + + Confirm download @@ -1930,16 +1957,28 @@ are declared in tools/grit/grit_rule.gni. - + $1file.exe may be dangerous. Send to Brave Advanced Protection for scanning? - + $1file.exe may be dangerous. Send to Brave Advanced Protection for scanning? Press Shift+F6 to cycle to the downloads bar area. + + + + $1file.exe may be dangerous. Send to Brave for scanning? + + + + + $1file.exe may be dangerous. Send to Brave for scanning? Press Shift+F6 to cycle to the downloads bar area. + + + $1file.exe is being scanned. @@ -4216,15 +4255,6 @@ are declared in tools/grit/grit_rule.gni. Disable - - Hide button - - - Keep in toolbar - - - Show in toolbar - Pin @@ -4337,7 +4367,15 @@ Keep your key file in a safe place. You will need it to create new versions of y $1c:\users\aa\myextension.crx - + + Continue to install + + + Proceed with caution + + + This extension is not trusted by Enhanced Safe Browsing. + Add @@ -4782,9 +4820,6 @@ Keep your key file in a safe place. You will need it to create new versions of y $1Username $2***** will be saved to your Brave sync chain, $3user@gmail.com - - $1Username $2***** will be saved to $3user@gmail.com - Passwords are saved in your Brave sync chain so you can use them on any device @@ -4835,28 +4870,6 @@ Keep your key file in a safe place. You will need it to create new versions of y - - - Updated $130 min ago - - - Updated 1hr ago - - - Updated $14 hrs ago - - - Updated just now - - - - - Lite mode now makes browsing faster on all pages, including HTTPS. - - - Settings - - WebRTC logs @@ -4984,7 +4997,7 @@ Keep your key file in a safe place. You will need it to create new versions of y - Lacros is an experimental browser. Please report any issues with Help > "Report an issue..." + Lacros is an experimental Browser. Please report issues with: Help > "Report an issue..." The standard browser can be found by typing "Brave" into Launcher. @@ -5241,13 +5254,13 @@ Keep your key file in a safe place. You will need it to create new versions of y Type a valid URL - Can’t create shortcut + Can't create shortcut - Can’t edit shortcut + Can't edit shortcut - Can’t remove shortcut + Can't remove shortcut Shortcut removed @@ -5327,9 +5340,6 @@ Keep your key file in a safe place. You will need it to create new versions of y Doodle Link - - Customize - Background @@ -5345,8 +5355,8 @@ Keep your key file in a safe place. You will need it to create new versions of y Color and theme - - No background + + Classic Brave Upload from device @@ -5384,6 +5394,12 @@ Keep your key file in a safe place. You will need it to create new versions of y Custom color + + Theme is set by your Organization + + + Your administrator has set a default theme which cannot be changed. + Default color @@ -5513,7 +5529,7 @@ Keep your key file in a safe place. You will need it to create new versions of y Even Better Module - Recently from Google Drive + From Google Drive Top picks for you @@ -5522,7 +5538,7 @@ Keep your key file in a safe place. You will need it to create new versions of y Why am I seeing this? - You’re seeing this item based on your previous activity using Brave services. You can see your data, delete it, and change your settings at <a href="$1" target="_blank" rel="noopener noreferrer">myactivity.google.com</a>. + You're seeing this item based on your previous activity using Brave services. You can see your data, delete it, and change your settings at <a href="$1" target="_blank" rel="noopener noreferrer">myactivity.google.com</a>. Learn about the data Brave collects and why at <a href="$1" target="_blank" rel="noopener noreferrer">policies.google.com</a>. @@ -5537,13 +5553,13 @@ Keep your key file in a safe place. You will need it to create new versions of y Find what you added to shopping carts and check out when you're ready - Carts hidden. They’ll reappear when you make changes. + Carts hidden. They'll reappear when you make changes. Hide $1Amazon - $1Amazon hidden. You’ll see it again when you revisit your cart. + $1Amazon hidden. You'll see it again when you revisit your cart. Never show $1Amazon @@ -5551,6 +5567,30 @@ Keep your key file in a safe place. You will need it to create new versions of y You won't see $1Amazon again + + $115% off + + + Up to $115% off + + + Ask Brave to find discounts on what you’ve added to your carts? + + + Get discounts + + + If Brave finds a discount, you will see it on this page + + + No thanks + + + Discounts are off. You can turn them on in the customize menu + + + Got it + Web browsing should be fast. Take a moment to <a href="chrome://extensions">check your extensions</a> now. @@ -5636,7 +5676,13 @@ Keep your key file in a safe place. You will need it to create new versions of y Press to go back, context menu to see history - Experiments + Enable featured experiments + + + Select experiment state for $1Tab Scrolling + + + Send feedback for $1Tab Scrolling Click to go forward, hold to see history @@ -5763,6 +5809,21 @@ Keep your key file in a safe place. You will need it to create new versions of y Bookmark folder button + + Experiments + + + Enterprise policy changed. Experiments button added to toolbar. Click the button to open a dialog to enable experiments. + + + Enterprise policy changed. Experiments button removed from toolbar. + + + Select experiment state for the $1Tab Scrolling experiment. + + + Select experiment state for the $1Tab Scrolling experiment. Experiment description: $2Enables tab strip to scroll left and right when full. + Separator @@ -5860,6 +5921,9 @@ Keep your key file in a safe place. You will need it to create new versions of y When you're ready, find your reading list here + + Add this page to reading list + Reopen a tab if you accidentally closed it @@ -5970,15 +6034,16 @@ Keep your key file in a safe place. You will need it to create new versions of y No thanks + + Username + + + Password + Password updated - - {COUNT, plural, - =1 {You have 1 compromised password} - other {You have # compromised passwords}} - {COUNT, plural, =1 {Successfully changed the compromised password. You have # more compromised password. Brave recommends checking this password now.} @@ -5990,17 +6055,9 @@ Keep your key file in a safe place. You will need it to create new versions of y Settings - - {COUNT, plural, - =1 {Brave recommends checking this password now} - other {Brave recommends checking these passwords now}} - Check remaining passwords - - Check passwords - Save @@ -6062,12 +6119,6 @@ Keep your key file in a safe place. You will need it to create new versions of y Export Passwords From Brave - - Username - - - Password - Move to Brave sync chain? @@ -6121,6 +6172,12 @@ Keep your key file in a safe place. You will need it to create new versions of y Suggest strong password + + Update password for $1example.com + + + Passwords are saved in your Brave sync chain ($1user@gmail.com) so you can use them on any device + @@ -6239,7 +6296,7 @@ Keep your key file in a safe place. You will need it to create new versions of y Attach <a href="#" id="bluetooth-logs-info-link">Bluetooth Logs</a> (Brave internal) - This information helps us better understand your Assistant issue. It’s stored for up to 90 days and access is restricted to appropriate engineering and feedback teams. + This information helps us better understand your Assistant issue. It's stored for up to 90 days and access is restricted to appropriate engineering and feedback teams. To better diagnose Bluetooth issues, Bravers can include additional Bluetooth logs with their feedback reports. When this option is checked, your report will include btsnoop and HCI logs from your current session, sanitized to remove as much PII as possible. Access to these logs will be restricted to managers of the Chrome OS product group in Listnr. Logs will be purged after 90 days. @@ -6462,6 +6519,21 @@ Keep your key file in a safe place. You will need it to create new versions of y Skip Ad + + Mute microphone + + + Unmute microphone + + + Turn on camera + + + Turn off camera + + + Hang up + Close @@ -6725,6 +6797,12 @@ Keep your key file in a safe place. You will need it to create new versions of y Found $12 Tabs For '$2google' + + Open Tabs + + + Recently Closed Tabs + @@ -7072,6 +7150,11 @@ Keep your key file in a safe place. You will need it to create new versions of y Disabled by Brave. This extension may be unsafe. + + + This extension is not trusted by Enhanced Safe Browsing. + + This will reset your startup page, new tab page, search engine, and pinned tabs. It will also disable all extensions and clear temporary data like cookies. Your bookmarks, history and saved passwords will not be cleared. @@ -7270,6 +7353,9 @@ Keep your key file in a safe place. You will need it to create new versions of y Processing image + + Tap the notification on $1Jimmy's Pixel to verify your phone number + Call from your device @@ -7582,16 +7668,16 @@ Keep your key file in a safe place. You will need it to create new versions of y Apps - You’re browsing as a Guest + You're browsing as a Guest - Pages you view in this window won’t appear in the browser history and they won’t leave other traces, like cookies, on the computer after you sign out. Files you download and bookmarks you create won’t be preserved. + Pages you view in this window won't appear in the browser history and they won't leave other traces, like cookies, on the computer after you sign out. Files you download and bookmarks you create won't be preserved. - Pages you view in this window won’t appear in the browser history and they won’t leave other traces, like cookies, on the computer after you close all open Guest windows. Any files you download will be preserved, however. + Pages you view in this window won't appear in the browser history and they won't leave other traces, like cookies, on the computer after you close all open Guest windows. Any files you download will be preserved, however. @@ -7814,6 +7900,11 @@ Keep your key file in a safe place. You will need it to create new versions of y Cancel sign in + + + Loading account information... + + @@ -8042,6 +8133,12 @@ Please help our engineers fix this problem. Tell us what happened right before y {NUM_TABS, plural, =1 {1 Tab} other {# Tabs}} + + {NUM_TABS, plural, =1 {$1MyGroup - 1 Tab} other {$1MyGroup - # Tabs}} + + + {NUM_TABS, plural, =1 {Unnamed Group - 1 Tab} other {Unnamed Group - # Tabs}} + No Tabs From Other Devices @@ -8053,6 +8150,12 @@ Please help our engineers fix this problem. Tell us what happened right before y {NUM_TABS, plural, =1 {1 tab} other {# tabs}} + + {NUM_TABS, plural, =1 {$1MyGroup - 1 tab} other {$1MyGroup - # tabs}} + + + {NUM_TABS, plural, =1 {Unnamed group - 1 tab} other {Unnamed group - # tabs}} + No tabs from other devices @@ -8129,7 +8232,7 @@ Please help our engineers fix this problem. Tell us what happened right before y Sign-in error - Sync error + Sync isn't working Sync isn't working @@ -8150,10 +8253,10 @@ Please help our engineers fix this problem. Tell us what happened right before y Enter passphrase - Fix now + Verify it's you - Fix now + Verify it's you Sign in again @@ -8165,6 +8268,18 @@ Please help our engineers fix this problem. Tell us what happened right before y Open settings + + + To start sync, enter your passphrase + + + To sync your passwords, verify it's you + + + To start sync, verify it's you + + + OK... @@ -8222,10 +8337,10 @@ Please help our engineers fix this problem. Tell us what happened right before y Setup in progress... - Sync isn’t working. Try signing in again. + Sync isn't working. Try signing in again. - Sync isn’t working. Try signing out and back in again. + Sync isn't working. Try signing out and back in again. Enter your passphrase to sync your data @@ -8234,7 +8349,7 @@ Please help our engineers fix this problem. Tell us what happened right before y Enter passphrase - Fix now + Verify it's you @@ -9565,6 +9680,9 @@ Please help our engineers fix this problem. Tell us what happened right before y {SCREEN_INDEX, plural, =1{Screen #} other{Screen #}} + + Presenter Tools + This Tab @@ -10083,12 +10201,8 @@ Please help our engineers fix this problem. Tell us what happened right before y "$1Brave Extension Name" wants to connect to a HID device - - Unknown Device (Vendor: $10x1234, Product: $20xabcd) - - - $1Wireless Controller (Vendor: $20x1234, Product: $30xabcd) - + + Unknown Device ($11234:abcd) Finding devices... @@ -10135,20 +10249,6 @@ Please help our engineers fix this problem. Tell us what happened right before y Ads blocked on this site - - - Details - - - Ad removed. - - - This ad used too many resources for your device, so Brave removed it. - - - Reload and show anyway - - Windows Utilities @@ -10368,7 +10468,7 @@ Please help our engineers fix this problem. Tell us what happened right before y Can't open this folder - $1example.com can’t open this folder because it contains system files + $1example.com can't open this folder because it contains system files Choose a different folder @@ -10377,7 +10477,7 @@ Please help our engineers fix this problem. Tell us what happened right before y Can't open this file - $1example.com can’t open files in this folder because it contains system files + $1example.com can't open files in this folder because it contains system files Choose a different file @@ -10426,6 +10526,9 @@ Please help our engineers fix this problem. Tell us what happened right before y Your phone + + Your phone with a USB cable + External security key or built-in sensor @@ -10495,6 +10598,9 @@ Please help our engineers fix this problem. Tell us what happened right before y Verify via your phone + + Verify via your phone with a USB cable + Check your phone @@ -10576,13 +10682,13 @@ Please help our engineers fix this problem. Tell us what happened right before y Touch your security key again to complete the request. - The PINs you entered don’t match + The PINs you entered don't match The security key is locked because the wrong PIN was entered too many times. To unlock it, remove and reinsert it. - The security key is locked because the wrong PIN was entered too many times. You’ll need to reset the security key. + The security key is locked because the wrong PIN was entered too many times. You'll need to reset the security key. Reinsert your security key and try again @@ -10797,9 +10903,12 @@ Please help our engineers fix this problem. Tell us what happened right before y Scan file before opening? - + $1bla.exe may be dangerous. Send to Brave Advanced Protection for scanning? + + $1bla.exe may be dangerous. Send to Google Safe Browsing for scanning? + Send @@ -10907,25 +11016,6 @@ Please help our engineers fix this problem. Tell us what happened right before y - - - - To play protected media on this page, you need to install Rosetta. - - - Learn more - - - Install Rosetta - - - Restart Now - - - Restart Later - - - Name this window @@ -10943,6 +11033,65 @@ Please help our engineers fix this problem. Tell us what happened right before y Experiments + + + Send Feedback + + + + + Send feedback + + + + Send feedback for $1Tab Scrolling. + + + Default + + + Enabled + + + Disabled + + + Enabled – $1tabs shrink to pinned tab width + + + + + Reading List + + + Right click on a tab or click the Bookmark icon to add tabs to a reading list. Access from the Bookmarks bar. + + + + Tab Scrolling + + + Enables tab strip to scroll left and right when full. + + + Tabs shrink to pinned tab width + + + Tabs shrink to a medium width + + + Tabs shrink to a large width + + + Tabs don't shrink + + + + Tab Search + + + Enable a popup bubble in Top Brave UI to search over currently open tabs. + diff --git a/app/generated_resources_override.grd b/app/generated_resources_override.grd index 97f26c2d7df..f016f0bc971 100644 --- a/app/generated_resources_override.grd +++ b/app/generated_resources_override.grd @@ -234,6 +234,10 @@ are declared in tools/grit/grit_rule.gni. + + + + @@ -265,6 +269,12 @@ are declared in tools/grit/grit_rule.gni. + + + + + + @@ -718,6 +728,9 @@ are declared in tools/grit/grit_rule.gni. + + + @@ -911,9 +924,10 @@ are declared in tools/grit/grit_rule.gni. - + + + - diff --git a/app/global_media_controls_strings.grdp b/app/global_media_controls_strings.grdp index 080652f54a6..42bfb431488 100644 --- a/app/global_media_controls_strings.grdp +++ b/app/global_media_controls_strings.grdp @@ -16,10 +16,13 @@ Stop casting - - + + Live Caption (English only) + + Live Caption + Downloading... $117% diff --git a/app/media_router_strings.grdp b/app/media_router_strings.grdp index 8362b793812..556c00c02f0 100644 --- a/app/media_router_strings.grdp +++ b/app/media_router_strings.grdp @@ -36,9 +36,6 @@ About - - Enable cloud services - Help @@ -148,20 +145,6 @@ This option is no longer supported. To present a tab, use $1Brave Meet. - - - Enable cloud services for Cast? - - - Use of Hangouts and Cast for Education is governed by the Brave Privacy Policy. - - - Enable - - - Cancel - - Presenting ($1example.com) diff --git a/app/nearby_share_strings.grdp b/app/nearby_share_strings.grdp index 7a71b5443ef..71a4cb0663d 100644 --- a/app/nearby_share_strings.grdp +++ b/app/nearby_share_strings.grdp @@ -348,4 +348,10 @@ Nearby Share + + $1Ted's Pixel 2 did not accept the file + + + $1Ted's Pixel 2 cancelled the transfer + diff --git a/app/os_settings_search_tag_strings.grdp b/app/os_settings_search_tag_strings.grdp index 16c4ca342f4..a349d0ce1e6 100644 --- a/app/os_settings_search_tag_strings.grdp +++ b/app/os_settings_search_tag_strings.grdp @@ -147,6 +147,12 @@ Auto connect to network + + Hidden network + + + Hidden SSID + Configure IP address automatically diff --git a/app/os_settings_strings.grdp b/app/os_settings_strings.grdp index 461c8b3ad00..dc7298412bb 100644 --- a/app/os_settings_strings.grdp +++ b/app/os_settings_strings.grdp @@ -172,6 +172,9 @@ Your $1Bravebook is up to date + + Updates are managed by your administrator + This device will get automatic software and security updates until $1September 2020. <a target="_blank" rel="noopener noreferrer" href="$2https://google.com/">Learn more</a> @@ -358,6 +361,15 @@ Languages for spell check are based on your language preference + + Add spell check languages + + + Your administrator doesn't allow this spell check language + + + Remove $1English (United States) + Couldn’t download spell check dictionary @@ -747,6 +759,9 @@ Invalid URL format. Server must be specified as a host name when SSO authentication is used. + + Invalid username + Share mounted successfully. @@ -817,6 +832,9 @@ Enable fullscreen magnifier + + Press Ctrl+$1Search+M to turn fullscreen magnifier on or off. Press Ctrl+Alt+Arrow keys to move around when zoomed in. + Move screen continuously as mouse moves @@ -830,7 +848,11 @@ Zoomed in screen follows keyboard focus - Fullscreen zoom level: + Fullscreen zoom level + + + Press Ctrl+Alt+Brightness up to zoom in, +and Ctrl+Alt+Brightness down to zoom out. Enable docked magnifier @@ -1021,6 +1043,9 @@ Keyboard scanning speed + + Point scanning speed + $11.5s @@ -1276,8 +1301,8 @@ Press an assigned switch to remove assignment. Your administrator has disabled the addition of more Brave sync chains - - Your administrator doesn’t allow additional Brave sync chains + + Your administrator doesn’t allow additional Brave sync chains. Addition of more Brave sync chains is disabled @@ -2247,6 +2272,12 @@ Press an assigned switch to remove assignment. Automatically connect to this network + + Hidden network + + + Using a hidden network isn't recommended for security reasons. + Automatically connect to cellular network @@ -2265,6 +2296,9 @@ Press an assigned switch to remove assignment. Unable to connect to this profile. For technical support, please contact your carrier. + + Profile could not be downloaded. Please try again later or contact carrier for help. + Rename Profile @@ -2292,6 +2326,21 @@ Press an assigned switch to remove assignment. This may cause a brief cellular network disconnection. + + Installing profile. This may take up to 30 seconds. + + + Removing profile. This may take up to 30 seconds. + + + Renaming profile. This may take up to 30 seconds. + + + Connecting to profile. This may take up to 30 seconds. + + + Refreshing profile list. This may take up to 30 seconds. + Profile could not be removed. Please try again or contact your carrier for technical support. @@ -2373,12 +2422,6 @@ Press an assigned switch to remove assignment. Network out of range - - Trouble connecting. Please contact $1Brave Fi for assistance. - - - Trouble connecting. Please contact your carrier for assistance. - Set up new network @@ -2455,10 +2498,10 @@ Press an assigned switch to remove assignment. Instant Tethering - No available eSIM profiles. Download a new profile <a href="#" id="cellularEsimLink">here</a> + No available eSIM profiles. Download a new profile <a href="#" id="cellularEsimLink">here.</a> - - No available SIM profiles. Setup a new profile <a href="#" id="cellularPsimLink">here.</a> + + No SIM card inserted No device detected <a target="_blank" rel="noopener noreferrer" href="$1">Learn more</a> @@ -2466,6 +2509,9 @@ Press an assigned switch to remove assignment. Show device EID and QR code popup + + Establish an internet connection first + @@ -2683,7 +2729,9 @@ Press an assigned switch to remove assignment. Change PIN - $11 fingerprints set up + {COUNT, plural, + =1 {1 fingerprint set up} + other {{COUNT} fingerprints set up}} Sign in automatically @@ -2824,6 +2872,9 @@ Press an assigned switch to remove assignment. Failed to parse configuration + + Too many nested groups: $1[appdefaults] + Refresh @@ -3213,6 +3264,9 @@ Press an assigned switch to remove assignment. Note: Your fingerprint may be less secure than a strong password or PIN. + + Your fingerprint data is stored securely and never leaves your $1Bravebook. <a>Learn more</a> + diff --git a/app/profiles_strings.grdp b/app/profiles_strings.grdp index 98c3a11da73..442b9dd97e3 100644 --- a/app/profiles_strings.grdp +++ b/app/profiles_strings.grdp @@ -563,8 +563,8 @@ Done - - Pick a theme color + + Welcome, $1Bob Rename your profile @@ -597,8 +597,11 @@ Guest mode - - Back + + Back from $1Set up your new Brave profile page + + + Back from sign in Sign in diff --git a/app/settings_brave_strings.grdp b/app/settings_brave_strings.grdp index 8e1d837bb04..4b8280b2277 100644 --- a/app/settings_brave_strings.grdp +++ b/app/settings_brave_strings.grdp @@ -119,6 +119,11 @@ By turning this off, you can sign in to Brave sites like Gmail without signing in to Brave + + + Open PDFs in Brave + + Brave can help keep you safe from data breaches, bad extensions, and more diff --git a/app/settings_strings.grdp b/app/settings_strings.grdp index 2c62b3527d0..b0b764d41c8 100644 --- a/app/settings_strings.grdp +++ b/app/settings_strings.grdp @@ -58,14 +58,20 @@ Live Caption - + Automatically creates captions for media in Brave browser (currently available in English). Audio and captions are processed locally and never leave the device. + + Automatically creates captions for media in Brave browser. Audio and captions are processed locally and never leave the device. + - + Automatically creates captions for English audio and video. Audio and captions never leave your device. + + Automatically creates captions for audio and video. Audio and captions never leave your device. + Downloading speech recognition files... $117% @@ -1101,6 +1107,12 @@ This language is used when translating pages + + Language is set by your Organization + + + Your administrator has set a default language which cannot be modified. + Keyboard apps @@ -1775,7 +1787,7 @@ Sites can ask to track your camera position - Block sites from tracking your camera position + Don't allow sites to track your camera position Allowed to track your camera position @@ -1790,7 +1802,7 @@ Sites can ask to automatically download multiple files (recommended) - Block sites from automatically downloading multiple files + Don't allow sites to automatically download multiple files Allowed to automatically download multiple files @@ -1799,13 +1811,13 @@ Not allowed to automatically download multiple files - After you leave or go offline, sites usually keep syncing to finish tasks, like uploading photos or sending a chat message + After you leave a site, it can keep syncing to finish tasks, like uploading photos or sending a chat message Recently closed sites can finish sending and receiving data (recommended) - Block closed sites from sending and receiving data + Don't allow closed sites to finish sending or receiving data Allowed to finish sending and receiving data @@ -1813,6 +1825,15 @@ Not allowed to finish sending or receiving data + + Sites usually connect to Bluetooth devices for features like setting up or syncing a low-energy beacon, a health or fitness tracker, or a smart light bulb + + + Sites can ask to connect to Bluetooth devices + + + Don't allow sites to connect to Bluetooth devices + Sites usually use your video camera for communication features like video chatting @@ -1820,7 +1841,7 @@ Sites can ask to use your camera (recommended) - Block sites from using your camera + Don't allow sites to use your camera Features that need a camera won't work @@ -1838,7 +1859,7 @@ Sites can ask to see text and images on your clipboard - Block sites from seeing text and images on your clipboard + Don't allow sites to see text or images on your clipboard Allowed to see your clipboard @@ -1846,17 +1867,110 @@ Not allowed to see your clipboard + + Sites usually detect when you're actively using your device to set your availability on chat apps + + + Sites can ask to know when you're actively using your device + + + Don't allow sites to know when you're actively using your device + + + Allowed to know when you're actively using your device + + + Not allowed to know when you're actively using your device + + + Web apps typically ask to open certain types of files so you can work on those files where you want, like opening documents in your preferred word processor + + + Web apps can ask to open types of files + + + Don't allow web apps to open types of files + + + Allowed to open types of files + + + Not allowed to open types of files + Sites usually access files and folders on your device for features like automatically saving your work - Sites can ask to edit files or folders on your device (recommended) + Sites can ask to edit files and folders on your device (recommended) - Block sites from editing files and folders on your device + Don't allow sites to edit files or folders on your device - Not allowed to edit files and folders on your device + Not allowed to edit files or folders on your device + + + Sites usually use your fonts so you can create high-fidelity content with online design and graphics tools + + + Sites can ask to use fonts installed on your device + + + Don't allow sites to use fonts installed on your device + + + Allowed to use fonts installed on your device + + + Not allowed to use fonts installed on your device + + + Sites usually connect to HID devices for features that use uncommon keyboards, game controllers, and other devices + + + Sites can ask to connect to HID devices + + + Don't allow sites to connect to HID devices + + + Sites usually show images to provide illustration, like photos for online stores or news articles + + + Sites can show images (recommended) + + + Don't allow sites to show images + + + Allowed to show images + + + Not allowed to show images + + + Secure sites might embed content like images or web frames that aren't secure + + + Allowed to show insecure content + + + Not allowed to show insecure content + + + Sites usually use Javascript to display interactive features, like video games or web forms + + + Sites can use Javascript (recommended) + + + Don't allow sites to use Javascript + + + Allowed to use Javascript + + + Not allowed to use Javascript Sites usually use your location for relevant features or info, like local news or nearby shops @@ -1865,7 +1979,7 @@ Sites can ask for your location (recommended) - Block sites from seeing your location + Don't allow sites to see your location Features that need your location won't work @@ -1876,36 +1990,6 @@ Not allowed to see your location - - Sites usually show images to provide illustration, like photos for online stores or news articles - - - Sites can show images (recommended) - - - Block images - - - Allowed to show images - - - Not allowed to show images - - - Sites usually use Javascript to display interactive features, like video games or web forms - - - Sites can use Javascript (recommended) - - - Block Javascript - - - Allowed to use Javascript - - - Not allowed to use Javascript - Sites usually use your microphone for communication features like video chatting @@ -1913,7 +1997,7 @@ Sites can ask to use your microphone (recommended) - Block sites from using your microphone + Don't allow sites to use your microphone Features that need a microphone won't work @@ -1931,7 +2015,7 @@ Sites can ask to connect to MIDI devices - Block sites from connecting to MIDI devices + Don't allow sites to connect to MIDI devices Allowed to connect to MIDI devices @@ -1939,11 +2023,23 @@ Not allowed to connect to MIDI devices - - Allowed to show insecure content + + Sites usually use your device's motion sensors for features like virtual reality or fitness tracking - - Not allowed to show insecure content + + Sites can use motion sensors + + + Don't allow sites to use motion sensors + + + Features that need motion sensors won't work + + + Allowed to use motion sensors + + + Not allowed to use motion sensors Sites usually send notifications to let you know about breaking news or chat messages @@ -1952,13 +2048,13 @@ Sites can ask to send notifications - Use quieter messaging (recommended) + Use quieter messaging - Sites can't interrupt you by asking to send notifications + Sites are blocked from interrupting you when they ask to send notifications - Block notifications + Don't allow sites to send notifications Features that need notifications won't work @@ -1976,7 +2072,7 @@ Sites can install payment handlers (recommended) - Block payment handlers + Don't allow sites to install payment handlers Allowed to install payment handlers @@ -1984,6 +2080,12 @@ Not allowed to install payment handlers + + Sites sometimes publish PDFs, like documents, contracts, and forms + + + Download PDFs + Sites might send pop-ups to show ads, or use redirects to lead you to websites you may not want to visit @@ -1991,7 +2093,7 @@ Sites can send pop-ups and use redirects - Block pop-ups and redirects (recommended) + Don't allow sites to send pop-ups or use redirects (recommended) Allowed to send pop-ups and use redirects @@ -2006,7 +2108,7 @@ Sites can ask to play protected content (recommended) - Block protected content + Don't allow sites to play protected content Allowed to play protected content @@ -2014,32 +2116,26 @@ Not allowed to play protected content - - Sites usually use your device's motion sensors for features like virtual reality or step counting + + Sites can handle special tasks when you click on certain types of links, like creating a new message in your email client or adding new events to your online calendar - - Sites can use motion sensors + + Sites can ask to handle protocols - - Block sites from using motion sensors + + Don't allow sites to handle protocols - - Features that need motion sensors won't work - - - Allowed to use motion sensors - - - Not allowed to use motion sensors + + Not allowed to handle protocols - Sites usually connect to serial devices for data transfer features, like setting up your network + Sites usually connect to serial ports for data transfer features, like setting up your network - Sites can ask to connect to serial devices + Sites can ask to connect to serial ports - Block sites from connecting to serial devices + Don't allow sites to connect to serial ports Sites might play sound to provide audio for music, videos, and other media @@ -2048,7 +2144,7 @@ Sites can play sound (recommended) - Mute sound + Don't allow sites to play sound Allowed to play sound @@ -2063,7 +2159,7 @@ Sites can ask to connect to USB devices - Block sites from connecting to USB devices + Don't allow sites to connect to USB devices Sites usually use your virtual reality devices and data to let you enter VR sessions @@ -2072,13 +2168,13 @@ Sites can ask to use virtual reality devices and data - Block sites from using virtual reality devices and data + Don't allow sites to use virtual reality devices or data Allowed to use virtual reality devices and data - Not allowed to use virtual reality devices and data + Not allowed to use virtual reality devices or data You can set how much you zoom in or out on certain websites @@ -2270,7 +2366,7 @@ Javascript - Payment Handlers + Payment handlers payment handlers @@ -2412,19 +2508,19 @@ Do not allow any sites to access serial ports - + File editing - + file editing - + Ask when a site wants to edit files or folders on your device - + Ask when a site wants to edit files or folders on your device (recommended) - + Do not allow any sites to edit files or folders on your device @@ -2598,6 +2694,18 @@ Block sites from knowing when you're actively using this device + + File handlers + + + file handlers + + + Ask when a web app wants to open types of files + + + Block web apps from opening types of files + Allowed diff --git a/app/shared_settings_strings.grdp b/app/shared_settings_strings.grdp index a46a03de10b..23d8e8ea933 100644 --- a/app/shared_settings_strings.grdp +++ b/app/shared_settings_strings.grdp @@ -20,8 +20,8 @@ Customize caption size and style for apps and sites that support this setting - - Text size (Also applies to Live Caption) + + Text size Text font @@ -116,7 +116,7 @@ Current device name is $1Michael's Bravebook - Manage Contacts + Manage contacts Contacts @@ -234,7 +234,7 @@ Sync isn't working - Error syncing passwords + Password sync isn't working Manage sync @@ -255,7 +255,7 @@ - Addresses, phone numbers, and more + Addresses and more History @@ -264,7 +264,7 @@ Extensions - Open Tabs + Open tabs Wi-Fi networks @@ -299,13 +299,13 @@ Submit - Encrypt synced passwords with your Brave username and password + Encrypt synced passwords with your Brave sync chain Bookmarks - Reading List + Reading list Encryption options diff --git a/browser/brave_ads/ads_tab_helper.cc b/browser/brave_ads/ads_tab_helper.cc index ba6be207427..39b00ca7169 100644 --- a/browser/brave_ads/ads_tab_helper.cc +++ b/browser/brave_ads/ads_tab_helper.cc @@ -138,7 +138,8 @@ void AdsTabHelper::DidFinishNavigation( RunIsolatedJavaScript(render_frame_host); } -void AdsTabHelper::DocumentOnLoadCompletedInMainFrame() { +void AdsTabHelper::DocumentOnLoadCompletedInMainFrame( + content::RenderFrameHost* render_frame_host) { if (!IsAdsEnabled() || !should_process_) { return; } @@ -147,9 +148,6 @@ void AdsTabHelper::DocumentOnLoadCompletedInMainFrame() { std::make_unique( web_contents(), false); - content::RenderFrameHost* render_frame_host = - handle->web_contents()->GetMainFrame(); - RunIsolatedJavaScript(render_frame_host); } diff --git a/browser/brave_ads/ads_tab_helper.h b/browser/brave_ads/ads_tab_helper.h index 18889abd994..20748f0a7a1 100644 --- a/browser/brave_ads/ads_tab_helper.h +++ b/browser/brave_ads/ads_tab_helper.h @@ -68,7 +68,8 @@ class AdsTabHelper : public content::WebContentsObserver, // content::WebContentsObserver overrides void DidFinishNavigation( content::NavigationHandle* navigation_handle) override; - void DocumentOnLoadCompletedInMainFrame() override; + void DocumentOnLoadCompletedInMainFrame( + content::RenderFrameHost* render_frame_host) override; void DidFinishLoad(content::RenderFrameHost* render_frame_host, const GURL& validated_url) override; void MediaStartedPlaying(const MediaPlayerInfo& video_type, diff --git a/browser/brave_ads/android/java/org/chromium/chrome/browser/notifications/BraveAdsNotificationBuilder.java b/browser/brave_ads/android/java/org/chromium/chrome/browser/notifications/BraveAdsNotificationBuilder.java index bc6b8db44fc..6293d43d032 100644 --- a/browser/brave_ads/android/java/org/chromium/chrome/browser/notifications/BraveAdsNotificationBuilder.java +++ b/browser/brave_ads/android/java/org/chromium/chrome/browser/notifications/BraveAdsNotificationBuilder.java @@ -33,6 +33,7 @@ import org.chromium.chrome.browser.notifications.channels.BraveChannelDefinition import org.chromium.components.browser_ui.notifications.NotificationMetadata; import org.chromium.components.browser_ui.notifications.NotificationWrapper; import org.chromium.components.browser_ui.notifications.NotificationWrapperBuilder; +import org.chromium.components.browser_ui.notifications.PendingIntentProvider; /** * Builds a notification according to BraveAds spec. @@ -189,7 +190,7 @@ public class BraveAdsNotificationBuilder extends NotificationBuilderBase { @Override public NotificationBuilderBase addButtonAction(@Nullable Bitmap iconBitmap, - @Nullable CharSequence title, @Nullable PendingIntent intent) { + @Nullable CharSequence title, PendingIntentProvider intent) { return this; } @@ -200,13 +201,13 @@ public class BraveAdsNotificationBuilder extends NotificationBuilderBase { */ @Override public NotificationBuilderBase addTextAction(@Nullable Bitmap iconBitmap, - @Nullable CharSequence title, @Nullable PendingIntent intent, String placeholder) { + @Nullable CharSequence title, PendingIntentProvider intent, String placeholder) { return this; } @Override public NotificationBuilderBase addSettingsAction( - int iconId, @Nullable CharSequence title, @Nullable PendingIntent intent) { + int iconId, @Nullable CharSequence title, PendingIntentProvider intent) { return this; } diff --git a/browser/brave_browser_main_parts.cc b/browser/brave_browser_main_parts.cc index 759647edbb6..6fbb9075ba6 100644 --- a/browser/brave_browser_main_parts.cc +++ b/browser/brave_browser_main_parts.cc @@ -76,8 +76,8 @@ void BraveBrowserMainParts::PostBrowserStart() { ProfileAttributesEntry* entry = storage.GetProfileAttributesWithPath(tor_legacy_path); if (!entry) { - storage.AddProfile(tor_legacy_path, base::string16(), std::string(), - base::string16(), + storage.AddProfile(tor_legacy_path, std::u16string(), std::string(), + std::u16string(), /* is_consented_primary_account*/ false, 0, std::string(), EmptyAccountId()); } diff --git a/browser/brave_content_browser_client.cc b/browser/brave_content_browser_client.cc index 392e02866be..1aaef295e62 100644 --- a/browser/brave_content_browser_client.cc +++ b/browser/brave_content_browser_client.cc @@ -300,6 +300,7 @@ bool BraveContentBrowserClient::HandleExternalProtocol( const GURL& url, content::WebContents::OnceGetter web_contents_getter, int child_id, + int frame_tree_node_id, content::NavigationUIData* navigation_data, bool is_main_frame, ui::PageTransition page_transition, @@ -342,9 +343,9 @@ bool BraveContentBrowserClient::HandleExternalProtocol( #endif return ChromeContentBrowserClient::HandleExternalProtocol( - url, std::move(web_contents_getter), child_id, navigation_data, - is_main_frame, page_transition, has_user_gesture, initiating_origin, - out_factory); + url, std::move(web_contents_getter), child_id, frame_tree_node_id, + navigation_data, is_main_frame, page_transition, has_user_gesture, + initiating_origin, out_factory); } void BraveContentBrowserClient::AppendExtraCommandLineSwitches( diff --git a/browser/brave_content_browser_client.h b/browser/brave_content_browser_client.h index f78cd26b9c2..908000a7791 100644 --- a/browser/brave_content_browser_client.h +++ b/browser/brave_content_browser_client.h @@ -44,6 +44,7 @@ class BraveContentBrowserClient : public ChromeContentBrowserClient { const GURL& url, content::WebContents::OnceGetter web_contents_getter, int child_id, + int frame_tree_node_id, content::NavigationUIData* navigation_data, bool is_main_frame, ui::PageTransition page_transition, diff --git a/browser/brave_rewards/tip_dialog.cc b/browser/brave_rewards/tip_dialog.cc index 6316b80257b..3d47bcda4c1 100644 --- a/browser/brave_rewards/tip_dialog.cc +++ b/browser/brave_rewards/tip_dialog.cc @@ -47,7 +47,7 @@ class TipDialogDelegate : public ui::WebDialogDelegate { ~TipDialogDelegate() override; ui::ModalType GetDialogModalType() const override; - base::string16 GetDialogTitle() const override; + std::u16string GetDialogTitle() const override; GURL GetDialogContentURL() const override; void GetWebUIMessageHandlers( std::vector* handlers) const override; @@ -78,9 +78,9 @@ ui::ModalType TipDialogDelegate::GetDialogModalType() const { return ui::MODAL_TYPE_WINDOW; } -base::string16 TipDialogDelegate::GetDialogTitle() const { +std::u16string TipDialogDelegate::GetDialogTitle() const { // Only used on Windows? - return base::string16(); + return std::u16string(); } GURL TipDialogDelegate::GetDialogContentURL() const { diff --git a/browser/brave_shields/domain_block_page_browsertest.cc b/browser/brave_shields/domain_block_page_browsertest.cc index deb9ba5c750..2b6b6255599 100644 --- a/browser/brave_shields/domain_block_page_browsertest.cc +++ b/browser/brave_shields/domain_block_page_browsertest.cc @@ -137,7 +137,7 @@ IN_PROC_BROWSER_TEST_F(DomainBlockTest, ShowInterstitialAndProceed) { // originally requested page. ClickAndWaitForNavigation("primary-button"); ASSERT_FALSE(IsShowingInterstitial()); - base::string16 expected_title = base::ASCIIToUTF16("OK"); + std::u16string expected_title(u"OK"); content::TitleWatcher watcher(web_contents(), expected_title); EXPECT_EQ(expected_title, watcher.WaitAndGetTitle()); } @@ -182,7 +182,7 @@ IN_PROC_BROWSER_TEST_F(DomainBlockTest, ProceedAndReload) { // originally requested page. ClickAndWaitForNavigation("primary-button"); ASSERT_FALSE(IsShowingInterstitial()); - base::string16 expected_title = base::ASCIIToUTF16("OK"); + std::u16string expected_title(u"OK"); content::TitleWatcher watcher(web_contents(), expected_title); EXPECT_EQ(expected_title, watcher.WaitAndGetTitle()); @@ -215,7 +215,7 @@ IN_PROC_BROWSER_TEST_F(DomainBlockTest, ProceedDoesNotAffectNewTabs) { // originally requested page. ClickAndWaitForNavigation("primary-button"); ASSERT_FALSE(IsShowingInterstitial()); - base::string16 expected_title = base::ASCIIToUTF16("OK"); + std::u16string expected_title(u"OK"); content::TitleWatcher watcher(web_contents(), expected_title); EXPECT_EQ(expected_title, watcher.WaitAndGetTitle()); @@ -255,7 +255,7 @@ IN_PROC_BROWSER_TEST_F(DomainBlockTest, DontWarnAgainAndProceed) { ClickAndWaitForNavigation("primary-button"); WaitForAdBlockServiceThreads(); ASSERT_FALSE(IsShowingInterstitial()); - base::string16 expected_title = base::ASCIIToUTF16("OK"); + std::u16string expected_title(u"OK"); content::TitleWatcher watcher(web_contents(), expected_title); EXPECT_EQ(expected_title, watcher.WaitAndGetTitle()); @@ -400,7 +400,7 @@ IN_PROC_BROWSER_TEST_F(DomainBlockDisabledTest, NoInterstitial) { ASSERT_FALSE(IsShowingInterstitial()); // Ensure we ended up on the expected page. - base::string16 expected_title = base::ASCIIToUTF16("OK"); + std::u16string expected_title(u"OK"); content::TitleWatcher watcher(web_contents(), expected_title); EXPECT_EQ(expected_title, watcher.WaitAndGetTitle()); } diff --git a/browser/component_updater/brave_component_updater_delegate.cc b/browser/component_updater/brave_component_updater_delegate.cc index 8fc648829e3..fc497d9377d 100644 --- a/browser/component_updater/brave_component_updater_delegate.cc +++ b/browser/component_updater/brave_component_updater_delegate.cc @@ -9,6 +9,7 @@ #include "base/sequenced_task_runner.h" #include "base/task/post_task.h" +#include "base/task/thread_pool.h" #include "brave/browser/component_updater/brave_component_installer.h" #include "brave/components/brave_component_updater/browser/brave_on_demand_updater.h" #include "chrome/browser/browser_process.h" @@ -20,9 +21,8 @@ using brave_component_updater::BraveOnDemandUpdater; namespace brave { BraveComponentUpdaterDelegate::BraveComponentUpdaterDelegate() - : task_runner_(base::CreateSequencedTaskRunner( - {base::ThreadPool(), base::MayBlock(), - base::TaskPriority::USER_VISIBLE, + : task_runner_(base::ThreadPool::CreateSequencedTaskRunner( + {base::MayBlock(), base::TaskPriority::USER_VISIBLE, base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN})) {} BraveComponentUpdaterDelegate::~BraveComponentUpdaterDelegate() {} diff --git a/browser/download/brave_download_item_model.cc b/browser/download/brave_download_item_model.cc index 0056dc6d24a..d8f0cccc46f 100644 --- a/browser/download/brave_download_item_model.cc +++ b/browser/download/brave_download_item_model.cc @@ -7,7 +7,6 @@ #include -#include "base/strings/string16.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/download/download_ui_model.h" @@ -28,17 +27,17 @@ BraveDownloadItemModel::BraveDownloadItemModel(DownloadUIModel* model) BraveDownloadItemModel::~BraveDownloadItemModel() {} // Adds origin url to the tooltip text and "Not secure", if needed. -base::string16 BraveDownloadItemModel::GetTooltipText() { - base::string16 tooltip = model_->GetTooltipText(); +std::u16string BraveDownloadItemModel::GetTooltipText() { + std::u16string tooltip = model_->GetTooltipText(); bool is_secure; - base::string16 origin_url = GetOriginURLText(&is_secure); + std::u16string origin_url = GetOriginURLText(&is_secure); if (!origin_url.empty()) { - tooltip += base::ASCIIToUTF16("\n"); + tooltip += u"\n"; if (!is_secure) { tooltip += l10n_util::GetStringUTF16(IDS_NOT_SECURE_VERBOSE_STATE) + - base::char16(' '); + char16_t(' '); } tooltip += origin_url; } @@ -47,11 +46,11 @@ base::string16 BraveDownloadItemModel::GetTooltipText() { } // Returns origin url text and sets |is_secure|. -base::string16 BraveDownloadItemModel::GetOriginURLText(bool* is_secure) { +std::u16string BraveDownloadItemModel::GetOriginURLText(bool* is_secure) { *is_secure = false; const GURL gurl = model_->download()->GetURL(); if (gurl.is_empty()) { - return base::string16(); + return std::u16string(); } std::string origin; diff --git a/browser/download/brave_download_item_model.h b/browser/download/brave_download_item_model.h index d4431fee14e..8713852e56e 100644 --- a/browser/download/brave_download_item_model.h +++ b/browser/download/brave_download_item_model.h @@ -6,8 +6,9 @@ #ifndef BRAVE_BROWSER_DOWNLOAD_BRAVE_DOWNLOAD_ITEM_MODEL_H_ #define BRAVE_BROWSER_DOWNLOAD_BRAVE_DOWNLOAD_ITEM_MODEL_H_ +#include + #include "base/macros.h" -#include "base/strings/string16.h" // The purpose of this class is to extend DonwloadItemModel's class // functionality by adding a method for the origin URL text and @@ -28,11 +29,11 @@ class BraveDownloadItemModel { // a regular download, the tooltip is the filename and the origin URL with an // indicator if the URL is secure. For an interrupted download, falls back on // the base class behavior. - base::string16 GetTooltipText(); + std::u16string GetTooltipText(); // Returns a string suitable for use as the origin URL. |is_secure| is set to // true if the url is considered secure. - base::string16 GetOriginURLText(bool* is_secure); + std::u16string GetOriginURLText(bool* is_secure); // Encapsulated model. DownloadUIModel* model_; diff --git a/browser/download/brave_download_item_model_unittest.cc b/browser/download/brave_download_item_model_unittest.cc index d1e66ccbced..c7932e1c370 100644 --- a/browser/download/brave_download_item_model_unittest.cc +++ b/browser/download/brave_download_item_model_unittest.cc @@ -14,7 +14,6 @@ #include "base/logging.h" #include "base/macros.h" #include "base/stl_util.h" -#include "base/strings/string16.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" diff --git a/browser/extensions/api/brave_wallet_api.cc b/browser/extensions/api/brave_wallet_api.cc index a5d63e8db75..cd9f2b1e43f 100644 --- a/browser/extensions/api/brave_wallet_api.cc +++ b/browser/extensions/api/brave_wallet_api.cc @@ -37,7 +37,7 @@ BraveWalletService* GetBraveWalletService( return BraveWalletServiceFactory::GetInstance()->GetForContext(context); } -base::Value MakeSelectValue(const base::string16& name, +base::Value MakeSelectValue(const std::u16string& name, BraveWalletWeb3ProviderTypes value) { base::Value item(base::Value::Type::DICTIONARY); item.SetKey("value", base::Value(static_cast(value))); diff --git a/browser/extensions/api/ipfs_api.cc b/browser/extensions/api/ipfs_api.cc index ee4bd8c29a6..368108ca8ff 100644 --- a/browser/extensions/api/ipfs_api.cc +++ b/browser/extensions/api/ipfs_api.cc @@ -32,7 +32,7 @@ bool IsIpfsEnabled(content::BrowserContext* context) { return ipfs::IsIpfsEnabled(context); } -base::Value MakeSelectValue(const base::string16& name, +base::Value MakeSelectValue(const std::u16string& name, IPFSResolveMethodTypes value) { base::Value item(base::Value::Type::DICTIONARY); item.SetKey("value", base::Value(static_cast(value))); diff --git a/browser/extensions/brave_component_loader.cc b/browser/extensions/brave_component_loader.cc index 5f3e6b6e3b8..b53b2a152d8 100644 --- a/browser/extensions/brave_component_loader.cc +++ b/browser/extensions/brave_component_loader.cc @@ -31,6 +31,7 @@ #include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_system.h" #include "extensions/common/constants.h" +#include "extensions/common/mojom/manifest.mojom.h" #if BUILDFLAG(BRAVE_WALLET_ENABLED) #include "brave/browser/extensions/brave_wallet_util.h" @@ -38,6 +39,8 @@ #include "brave/components/brave_wallet/browser/pref_names.h" #endif +using extensions::mojom::ManifestLocation; + namespace extensions { BraveComponentLoader::BraveComponentLoader(ExtensionSystem* extension_system, @@ -84,11 +87,11 @@ void BraveComponentLoader::ReinstallAsNonComponent( extensions::ExtensionRegistry::Get(profile_); const Extension* extension = registry->GetInstalledExtension(extension_id); DCHECK(extension); - if (extension->location() == Manifest::COMPONENT) { + if (extension->location() == ManifestLocation::kComponent) { service->RemoveComponentExtension(extension_id); std::string error; scoped_refptr normal_extension = Extension::Create( - extension->path(), Manifest::EXTERNAL_PREF, + extension->path(), ManifestLocation::kExternalPref, *extension->manifest()->value(), extension->creation_flags(), &error); service->AddExtension(normal_extension.get()); } diff --git a/browser/extensions/brave_extension_functional_test.cc b/browser/extensions/brave_extension_functional_test.cc index d5e94d19622..f080ad1769a 100644 --- a/browser/extensions/brave_extension_functional_test.cc +++ b/browser/extensions/brave_extension_functional_test.cc @@ -10,6 +10,7 @@ #include "extensions/browser/extension_registry.h" #include "extensions/browser/notification_types.h" #include "extensions/browser/test_extension_registry_observer.h" +#include "extensions/common/mojom/manifest.mojom.h" #include "brave/common/brave_paths.h" #include "chrome/test/base/ui_test_utils.h" @@ -27,7 +28,7 @@ ExtensionFunctionalTest::InstallExtensionSilently( scoped_refptr installer(CrxInstaller::CreateSilent(service)); installer->set_is_gallery_install(false); installer->set_allow_silent_install(true); - installer->set_install_source(Manifest::INTERNAL); + installer->set_install_source(extensions::mojom::ManifestLocation::kInternal); installer->set_off_store_install_allow_reason( CrxInstaller::OffStoreInstallAllowedInTest); diff --git a/browser/extensions/brave_extension_provider.cc b/browser/extensions/brave_extension_provider.cc index d145f9db29f..0a0c920bdbc 100644 --- a/browser/extensions/brave_extension_provider.cc +++ b/browser/extensions/brave_extension_provider.cc @@ -55,7 +55,7 @@ std::string BraveExtensionProvider::GetDebugPolicyProviderName() const { } bool BraveExtensionProvider::UserMayLoad(const Extension* extension, - base::string16* error) const { + std::u16string* error) const { if (IsBlacklisted(extension)) { if (error) { *error = l10n_util::GetStringFUTF16(IDS_EXTENSION_CANT_INSTALL_ON_BRAVE, @@ -71,7 +71,7 @@ bool BraveExtensionProvider::UserMayLoad(const Extension* extension, } bool BraveExtensionProvider::MustRemainInstalled(const Extension* extension, - base::string16* error) const { + std::u16string* error) const { return extension->id() == brave_extension_id || extension->id() == brave_rewards_extension_id; } diff --git a/browser/extensions/brave_extension_provider.h b/browser/extensions/brave_extension_provider.h index 73499ab5eb1..85ff6f13925 100644 --- a/browser/extensions/brave_extension_provider.h +++ b/browser/extensions/brave_extension_provider.h @@ -18,9 +18,9 @@ class BraveExtensionProvider : public ManagementPolicy::Provider { ~BraveExtensionProvider() override; std::string GetDebugPolicyProviderName() const override; bool UserMayLoad(const Extension* extension, - base::string16* error) const override; + std::u16string* error) const override; bool MustRemainInstalled(const Extension* extension, - base::string16* error) const override; + std::u16string* error) const override; private: DISALLOW_COPY_AND_ASSIGN(BraveExtensionProvider); diff --git a/browser/extensions/brave_webtorrent_navigation_throttle.cc b/browser/extensions/brave_webtorrent_navigation_throttle.cc index 29b33fc6667..0a6d3b78931 100644 --- a/browser/extensions/brave_webtorrent_navigation_throttle.cc +++ b/browser/extensions/brave_webtorrent_navigation_throttle.cc @@ -33,11 +33,9 @@ namespace extensions { BraveWebTorrentNavigationThrottle::BraveWebTorrentNavigationThrottle( content::NavigationHandle* navigation_handle) : content::NavigationThrottle(navigation_handle), - extension_registry_observer_(this), resume_pending_(false) { - extension_registry_observer_.Add( - ExtensionRegistry::Get( - navigation_handle->GetWebContents()->GetBrowserContext())); + extension_registry_observer_.Observe(ExtensionRegistry::Get( + navigation_handle->GetWebContents()->GetBrowserContext())); } BraveWebTorrentNavigationThrottle::~BraveWebTorrentNavigationThrottle() { diff --git a/browser/extensions/brave_webtorrent_navigation_throttle.h b/browser/extensions/brave_webtorrent_navigation_throttle.h index 61881c6f39b..3ad80538511 100644 --- a/browser/extensions/brave_webtorrent_navigation_throttle.h +++ b/browser/extensions/brave_webtorrent_navigation_throttle.h @@ -7,6 +7,7 @@ #define BRAVE_BROWSER_EXTENSIONS_BRAVE_WEBTORRENT_NAVIGATION_THROTTLE_H_ #include "base/macros.h" +#include "base/scoped_observation.h" #include "base/timer/timer.h" #include "content/public/browser/navigation_throttle.h" #include "extensions/browser/test_extension_registry_observer.h" @@ -41,8 +42,8 @@ class BraveWebTorrentNavigationThrottle : public content::NavigationThrottle, // ExtensionRegistryObserver: void OnExtensionReady(content::BrowserContext* browser_context, const extensions::Extension* extension) override; - ScopedObserver - extension_registry_observer_; + base::ScopedObservation + extension_registry_observer_{this}; bool resume_pending_; base::OneShotTimer timer_; DISALLOW_COPY_AND_ASSIGN(BraveWebTorrentNavigationThrottle); diff --git a/browser/farbling/brave_navigator_useragent_farbling_browsertest.cc b/browser/farbling/brave_navigator_useragent_farbling_browsertest.cc index 44711ef90c3..bfb8b86b3bf 100644 --- a/browser/farbling/brave_navigator_useragent_farbling_browsertest.cc +++ b/browser/farbling/brave_navigator_useragent_farbling_browsertest.cc @@ -116,7 +116,7 @@ class BraveNavigatorUserAgentFarblingBrowserTest : public InProcessBrowserTest { // Tests results of farbling user agent IN_PROC_BROWSER_TEST_F(BraveNavigatorUserAgentFarblingBrowserTest, FarbleNavigatorUserAgent) { - base::string16 expected_title = base::ASCIIToUTF16("pass"); + std::u16string expected_title(u"pass"); std::string domain_b = "b.com"; std::string domain_z = "z.com"; GURL url_b = embedded_test_server()->GetURL(domain_b, "/simple.html"); diff --git a/browser/gcm_driver/brave_gcm_utils.cc b/browser/gcm_driver/brave_gcm_utils.cc index 01d8d357eed..0af71bfa37a 100644 --- a/browser/gcm_driver/brave_gcm_utils.cc +++ b/browser/gcm_driver/brave_gcm_utils.cc @@ -18,8 +18,8 @@ const char kGCMChannelStatus[] = "gcm.channel_status"; void RegisterGCMProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { // Deprecated Chromium pref. - registry->SetDefaultPrefValue(kGCMChannelStatus, base::Value(false)); - // Current Brave eqiuvalent of the deprecated pref. + registry->RegisterBooleanPref(kGCMChannelStatus, false); + // Current Brave equivalent of the deprecated pref. registry->RegisterBooleanPref(kBraveGCMChannelStatus, false); } @@ -29,6 +29,7 @@ void MigrateGCMPrefs(Profile* profile) { auto* pref = prefs->FindPreference(kGCMChannelStatus); if (pref && !pref->IsDefaultValue()) prefs->SetBoolean(kBraveGCMChannelStatus, pref->GetValue()->GetBool()); + prefs->ClearPref(kGCMChannelStatus); } } // namespace gcm diff --git a/browser/importer/brave_external_process_importer_client.cc b/browser/importer/brave_external_process_importer_client.cc index 0ff6c76113f..aeb7da300b6 100644 --- a/browser/importer/brave_external_process_importer_client.cc +++ b/browser/importer/brave_external_process_importer_client.cc @@ -100,10 +100,10 @@ void BraveExternalProcessImporterClient::OnImportItemFinished( } void BraveExternalProcessImporterClient::OnCreditCardImportReady( - const base::string16& name_on_card, - const base::string16& expiration_month, - const base::string16& expiration_year, - const base::string16& decrypted_card_number, + const std::u16string& name_on_card, + const std::u16string& expiration_month, + const std::u16string& expiration_year, + const std::u16string& decrypted_card_number, const std::string& origin) { if (cancelled_) return; diff --git a/browser/importer/brave_external_process_importer_client.h b/browser/importer/brave_external_process_importer_client.h index bc0d6ea4d3c..6d60bc1b5ed 100644 --- a/browser/importer/brave_external_process_importer_client.h +++ b/browser/importer/brave_external_process_importer_client.h @@ -9,7 +9,6 @@ #include #include "base/memory/weak_ptr.h" -#include "base/strings/string16.h" #include "brave/common/importer/profile_import.mojom.h" #include "chrome/browser/importer/external_process_importer_client.h" #include "mojo/public/cpp/bindings/receiver.h" @@ -37,12 +36,11 @@ class BraveExternalProcessImporterClient void OnImportItemFinished(importer::ImportItem import_item) override; // brave::mojom::ProfileImportObserver overrides: - void OnCreditCardImportReady( - const base::string16& name_on_card, - const base::string16& expiration_month, - const base::string16& expiration_year, - const base::string16& decrypted_card_number, - const std::string& origin) override; + void OnCreditCardImportReady(const std::u16string& name_on_card, + const std::u16string& expiration_month, + const std::u16string& expiration_year, + const std::u16string& decrypted_card_number, + const std::string& origin) override; protected: ~BraveExternalProcessImporterClient() override; diff --git a/browser/importer/brave_external_process_importer_host.cc b/browser/importer/brave_external_process_importer_host.cc index dd7c902ca9a..2f47688a31e 100644 --- a/browser/importer/brave_external_process_importer_host.cc +++ b/browser/importer/brave_external_process_importer_host.cc @@ -12,7 +12,7 @@ #include "base/files/file_util.h" #include "base/json/json_reader.h" #include "base/task/post_task.h" -#include "base/task/task_traits.h" +#include "base/task/thread_pool.h" #include "brave/browser/importer/brave_importer_p3a.h" #include "brave/common/importer/chrome_importer_utils.h" #include "brave/common/importer/importer_constants.h" @@ -72,9 +72,9 @@ void BraveExternalProcessImporterHost::LaunchExtensionsImport() { const base::FilePath pref_file = source_profile_.source_path.AppendASCII( kChromeExtensionsPreferencesFile); - base::PostTaskAndReplyWithResult( + base::ThreadPool::PostTaskAndReplyWithResult( FROM_HERE, - {base::ThreadPool(), base::MayBlock(), base::TaskPriority::USER_VISIBLE, + {base::MayBlock(), base::TaskPriority::USER_VISIBLE, base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, base::BindOnce(&GetChromeExtensionsList, pref_file), base::BindOnce( diff --git a/browser/importer/brave_in_process_importer_bridge.cc b/browser/importer/brave_in_process_importer_bridge.cc index 23483483af0..2c772998fbb 100644 --- a/browser/importer/brave_in_process_importer_bridge.cc +++ b/browser/importer/brave_in_process_importer_bridge.cc @@ -10,10 +10,10 @@ BraveInProcessImporterBridge::~BraveInProcessImporterBridge() = default; void BraveInProcessImporterBridge::SetCreditCard( - const base::string16& name_on_card, - const base::string16& expiration_month, - const base::string16& expiration_year, - const base::string16& decrypted_card_number, + const std::u16string& name_on_card, + const std::u16string& expiration_month, + const std::u16string& expiration_year, + const std::u16string& decrypted_card_number, const std::string& origin) { writer_->AddCreditCard(name_on_card, expiration_month, diff --git a/browser/importer/brave_in_process_importer_bridge.h b/browser/importer/brave_in_process_importer_bridge.h index 0e088d0f0be..1c347cda290 100644 --- a/browser/importer/brave_in_process_importer_bridge.h +++ b/browser/importer/brave_in_process_importer_bridge.h @@ -21,10 +21,10 @@ class BraveInProcessImporterBridge : public InProcessImporterBridge, const BraveInProcessImporterBridge&) = delete; // BraveImporterBridge overrides: - void SetCreditCard(const base::string16& name_on_card, - const base::string16& expiration_month, - const base::string16& expiration_year, - const base::string16& decrypted_card_number, + void SetCreditCard(const std::u16string& name_on_card, + const std::u16string& expiration_month, + const std::u16string& expiration_year, + const std::u16string& decrypted_card_number, const std::string& origin) override; private: diff --git a/browser/infobars/brave_confirm_p3a_infobar_delegate.cc b/browser/infobars/brave_confirm_p3a_infobar_delegate.cc index 9e469a3b581..20171ca33ef 100644 --- a/browser/infobars/brave_confirm_p3a_infobar_delegate.cc +++ b/browser/infobars/brave_confirm_p3a_infobar_delegate.cc @@ -66,7 +66,7 @@ void BraveConfirmP3AInfoBarDelegate::InfoBarDismissed() { } } -base::string16 BraveConfirmP3AInfoBarDelegate::GetMessageText() const { +std::u16string BraveConfirmP3AInfoBarDelegate::GetMessageText() const { return l10n_util::GetStringUTF16(IDS_BRAVE_CONFIRM_P3A_INFO_BAR); } @@ -74,7 +74,7 @@ int BraveConfirmP3AInfoBarDelegate::GetButtons() const { return BUTTON_OK | BUTTON_CANCEL; } -base::string16 BraveConfirmP3AInfoBarDelegate::GetButtonLabel( +std::u16string BraveConfirmP3AInfoBarDelegate::GetButtonLabel( InfoBarButton button) const { if (button == BUTTON_CANCEL) { return l10n_util::GetStringUTF16(IDS_BRAVE_CONFIRM_P3A_INFO_BAR_DISABLE); @@ -82,7 +82,7 @@ base::string16 BraveConfirmP3AInfoBarDelegate::GetButtonLabel( return l10n_util::GetStringUTF16(IDS_BRAVE_CONFIRM_P3A_INFO_BAR_ACKNOWLEDGE); } -base::string16 BraveConfirmP3AInfoBarDelegate::GetLinkText() const { +std::u16string BraveConfirmP3AInfoBarDelegate::GetLinkText() const { return l10n_util::GetStringUTF16(IDS_LEARN_MORE); } diff --git a/browser/infobars/brave_confirm_p3a_infobar_delegate.h b/browser/infobars/brave_confirm_p3a_infobar_delegate.h index 218a57d3b79..9b26574fa4b 100644 --- a/browser/infobars/brave_confirm_p3a_infobar_delegate.h +++ b/browser/infobars/brave_confirm_p3a_infobar_delegate.h @@ -8,7 +8,6 @@ #include "base/compiler_specific.h" #include "base/macros.h" -#include "base/strings/string16.h" #include "components/infobars/core/confirm_infobar_delegate.h" #include "url/gurl.h" @@ -28,10 +27,10 @@ class BraveConfirmP3AInfoBarDelegate : public ConfirmInfoBarDelegate { const gfx::VectorIcon& GetVectorIcon() const override; bool ShouldExpire(const NavigationDetails& details) const override; void InfoBarDismissed() override; - base::string16 GetMessageText() const override; + std::u16string GetMessageText() const override; int GetButtons() const override; - base::string16 GetButtonLabel(InfoBarButton button) const override; - base::string16 GetLinkText() const override; + std::u16string GetButtonLabel(InfoBarButton button) const override; + std::u16string GetLinkText() const override; GURL GetLinkURL() const override; bool Accept() override; bool Cancel() override; diff --git a/browser/infobars/crypto_wallets_infobar_delegate.cc b/browser/infobars/crypto_wallets_infobar_delegate.cc index f5edf5dfc9c..ec2e3776626 100644 --- a/browser/infobars/crypto_wallets_infobar_delegate.cc +++ b/browser/infobars/crypto_wallets_infobar_delegate.cc @@ -54,7 +54,7 @@ const gfx::VectorIcon& CryptoWalletsInfoBarDelegate::GetVectorIcon() const { void CryptoWalletsInfoBarDelegate::InfoBarDismissed() { } -base::string16 CryptoWalletsInfoBarDelegate::GetMessageText() const { +std::u16string CryptoWalletsInfoBarDelegate::GetMessageText() const { if (subtype_ == InfobarSubType::LOAD_CRYPTO_WALLETS) { return l10n_util::GetStringUTF16(IDS_BRAVE_CRYPTO_WALLETS_LAZY_LOAD_TEXT); } @@ -65,7 +65,7 @@ int CryptoWalletsInfoBarDelegate::GetButtons() const { return BUTTON_OK | BUTTON_CANCEL; } -base::string16 CryptoWalletsInfoBarDelegate::GetButtonLabel( +std::u16string CryptoWalletsInfoBarDelegate::GetButtonLabel( InfoBarButton button) const { if (subtype_ == InfobarSubType::LOAD_CRYPTO_WALLETS) { if (button == BUTTON_CANCEL) { @@ -83,7 +83,7 @@ base::string16 CryptoWalletsInfoBarDelegate::GetButtonLabel( IDS_BRAVE_CRYPTO_WALLETS_SETUP_CRYPTO_WALLETS); } -base::string16 CryptoWalletsInfoBarDelegate::GetLinkText() const { +std::u16string CryptoWalletsInfoBarDelegate::GetLinkText() const { return l10n_util::GetStringUTF16(IDS_LEARN_MORE); } diff --git a/browser/infobars/crypto_wallets_infobar_delegate.h b/browser/infobars/crypto_wallets_infobar_delegate.h index c555bf24614..2c2239dd848 100644 --- a/browser/infobars/crypto_wallets_infobar_delegate.h +++ b/browser/infobars/crypto_wallets_infobar_delegate.h @@ -8,7 +8,6 @@ #include "base/compiler_specific.h" #include "base/memory/weak_ptr.h" -#include "base/strings/string16.h" #include "components/infobars/core/confirm_infobar_delegate.h" #include "url/gurl.h" @@ -37,10 +36,10 @@ class CryptoWalletsInfoBarDelegate : public ConfirmInfoBarDelegate { infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; const gfx::VectorIcon& GetVectorIcon() const override; void InfoBarDismissed() override; - base::string16 GetMessageText() const override; + std::u16string GetMessageText() const override; int GetButtons() const override; - base::string16 GetButtonLabel(InfoBarButton button) const override; - base::string16 GetLinkText() const override; + std::u16string GetButtonLabel(InfoBarButton button) const override; + std::u16string GetLinkText() const override; GURL GetLinkURL() const override; bool Accept() override; bool Cancel() override; diff --git a/browser/infobars/sync_v2_migrate_infobar_delegate.cc b/browser/infobars/sync_v2_migrate_infobar_delegate.cc index afecbbf65e2..07fea6ecf8c 100644 --- a/browser/infobars/sync_v2_migrate_infobar_delegate.cc +++ b/browser/infobars/sync_v2_migrate_infobar_delegate.cc @@ -95,7 +95,7 @@ void SyncV2MigrateInfoBarDelegate::InfoBarDismissed() { brave_sync_prefs.SetDismissSyncMigrateNotice(true); } -base::string16 SyncV2MigrateInfoBarDelegate::GetMessageText() const { +std::u16string SyncV2MigrateInfoBarDelegate::GetMessageText() const { return l10n_util::GetStringUTF16(IDS_BRAVE_SYNC_V2_MIGRATE_INFOBAR_MESSAGE); } @@ -103,7 +103,7 @@ int SyncV2MigrateInfoBarDelegate::GetButtons() const { return BUTTON_OK; } -base::string16 SyncV2MigrateInfoBarDelegate::GetButtonLabel( +std::u16string SyncV2MigrateInfoBarDelegate::GetButtonLabel( InfoBarButton button) const { return l10n_util::GetStringUTF16(IDS_BRAVE_SYNC_V2_MIGRATE_INFOBAR_COMMAND); } diff --git a/browser/infobars/sync_v2_migrate_infobar_delegate.h b/browser/infobars/sync_v2_migrate_infobar_delegate.h index b6dab364bff..41e22249b5f 100644 --- a/browser/infobars/sync_v2_migrate_infobar_delegate.h +++ b/browser/infobars/sync_v2_migrate_infobar_delegate.h @@ -8,7 +8,6 @@ #include "base/compiler_specific.h" #include "base/macros.h" -#include "base/strings/string16.h" #include "components/infobars/core/confirm_infobar_delegate.h" #include "url/gurl.h" @@ -35,9 +34,9 @@ class SyncV2MigrateInfoBarDelegate : public ConfirmInfoBarDelegate { const gfx::VectorIcon& GetVectorIcon() const override; bool ShouldExpire(const NavigationDetails& details) const override; void InfoBarDismissed() override; - base::string16 GetMessageText() const override; + std::u16string GetMessageText() const override; int GetButtons() const override; - base::string16 GetButtonLabel(InfoBarButton button) const override; + std::u16string GetButtonLabel(InfoBarButton button) const override; bool Accept() override; Profile* profile_; diff --git a/browser/ipfs/import/ipfs_import_controller.cc b/browser/ipfs/import/ipfs_import_controller.cc index cdbabf603db..e9a160e601d 100644 --- a/browser/ipfs/import/ipfs_import_controller.cc +++ b/browser/ipfs/import/ipfs_import_controller.cc @@ -13,6 +13,7 @@ #include "base/guid.h" #include "base/strings/utf_string_conversions.h" #include "base/task/post_task.h" +#include "base/task/thread_pool.h" #include "brave/browser/ipfs/import/save_package_observer.h" #include "brave/browser/ipfs/ipfs_service_factory.h" #include "brave/common/webui_url_constants.h" @@ -60,7 +61,7 @@ const char kNotifierId[] = "service.ipfs"; // Imported shareable link should have filename parameter. const char kImportFileNameParam[] = "filename"; -base::string16 GetImportNotificationTitle(ipfs::ImportState state) { +std::u16string GetImportNotificationTitle(ipfs::ImportState state) { switch (state) { case ipfs::IPFS_IMPORT_SUCCESS: return l10n_util::GetStringUTF16(IDS_IPFS_IMPORT_NOTIFICATION_TITLE); @@ -76,10 +77,10 @@ base::string16 GetImportNotificationTitle(ipfs::ImportState state) { NOTREACHED(); break; } - return base::string16(); + return std::u16string(); } -base::string16 GetImportNotificationBody(ipfs::ImportState state, +std::u16string GetImportNotificationBody(ipfs::ImportState state, const GURL& shareable_link) { switch (state) { case ipfs::IPFS_IMPORT_SUCCESS: @@ -98,12 +99,12 @@ base::string16 GetImportNotificationBody(ipfs::ImportState state, NOTREACHED(); break; } - return base::string16(); + return std::u16string(); } std::unique_ptr CreateMessageCenterNotification( - const base::string16& title, - const base::string16& body, + const std::u16string& title, + const std::u16string& body, const std::string& uuid, const GURL& link) { message_center::RichNotificationData notification_data; @@ -112,7 +113,7 @@ std::unique_ptr CreateMessageCenterNotification( notification_data.context_message = base::ASCIIToUTF16(" "); auto notification = std::make_unique( message_center::NOTIFICATION_TYPE_SIMPLE, uuid, title, body, gfx::Image(), - base::string16(), link, + std::u16string(), link, message_center::NotifierId(message_center::NotifierType::SYSTEM_COMPONENT, kNotifierId), notification_data, nullptr); @@ -139,9 +140,8 @@ IpfsImportController::IpfsImportController(content::WebContents* web_contents) : web_contents_(web_contents), ipfs_service_(ipfs::IpfsServiceFactory::GetForContext( web_contents->GetBrowserContext())), - file_task_runner_(base::CreateSequencedTaskRunner( - {base::ThreadPool(), base::MayBlock(), - base::TaskPriority::BEST_EFFORT, + file_task_runner_(base::ThreadPool::CreateSequencedTaskRunner( + {base::MayBlock(), base::TaskPriority::BEST_EFFORT, base::TaskShutdownBehavior::BLOCK_SHUTDOWN})) { DCHECK(web_contents_); DCHECK(ipfs_service_); @@ -291,8 +291,8 @@ void IpfsImportController::OnImportCompleted(const ipfs::ImportedData& data) { } } -void IpfsImportController::PushNotification(const base::string16& title, - const base::string16& body, +void IpfsImportController::PushNotification(const std::u16string& title, + const std::u16string& body, const GURL& link) { auto notification = CreateMessageCenterNotification(title, body, base::GenerateGUID(), link); @@ -340,7 +340,7 @@ void IpfsImportController::ShowImportDialog(ui::SelectFileDialog::Type type) { file_types.allowed_paths = ui::SelectFileDialog::FileTypeInfo::ANY_PATH_OR_URL; dialog_type_ = type; - select_file_dialog_->SelectFile(type, base::string16(), directory, + select_file_dialog_->SelectFile(type, std::u16string(), directory, &file_types, 0, base::FilePath::StringType(), parent_window, nullptr); } diff --git a/browser/ipfs/import/ipfs_import_controller.h b/browser/ipfs/import/ipfs_import_controller.h index 96eb4a52e64..d340cf24f15 100644 --- a/browser/ipfs/import/ipfs_import_controller.h +++ b/browser/ipfs/import/ipfs_import_controller.h @@ -71,8 +71,8 @@ class IpfsImportController : public ui::SelectFileDialog::Listener { download::DownloadItem* download); void SaveWebPage(const base::FilePath& directory); - void PushNotification(const base::string16& title, - const base::string16& body, + void PushNotification(const std::u16string& title, + const std::u16string& body, const GURL& link); GURL CreateAndCopyShareableLink(const ipfs::ImportedData& data); void OnImportCompleted(const ipfs::ImportedData& data); diff --git a/browser/mac/sparkle_glue.h b/browser/mac/sparkle_glue.h index a22e34cfacb..73272d199c4 100644 --- a/browser/mac/sparkle_glue.h +++ b/browser/mac/sparkle_glue.h @@ -6,7 +6,6 @@ #ifndef BRAVE_BROWSER_MAC_SPARKLE_GLUE_H_ #define BRAVE_BROWSER_MAC_SPARKLE_GLUE_H_ -#include "base/strings/string16.h" #import "chrome/browser/mac/keystone_glue.h" #if defined(__OBJC__) @@ -45,7 +44,7 @@ namespace sparkle_glue { bool SparkleEnabled(); -base::string16 CurrentlyInstalledVersion(); +std::u16string CurrentlyInstalledVersion(); } // namespace sparkle_glue diff --git a/browser/mac/sparkle_glue.mm b/browser/mac/sparkle_glue.mm index a4dc2048f6b..207976e14ce 100644 --- a/browser/mac/sparkle_glue.mm +++ b/browser/mac/sparkle_glue.mm @@ -15,6 +15,7 @@ #include "base/memory/ref_counted.h" #include "base/strings/sys_string_conversions.h" #include "base/task/post_task.h" +#include "base/task/thread_pool.h" #import "brave/browser/mac/su_updater.h" #include "brave/browser/update_util.h" #include "chrome/common/channel_info.h" @@ -45,10 +46,10 @@ class PerformBridge : public base::RefCountedThreadSafe { DCHECK(sel); scoped_refptr op = new PerformBridge(target, sel, arg); - base::PostTask( + base::ThreadPool::PostTask( FROM_HERE, - {base::ThreadPool(), base::MayBlock(), base::TaskPriority::BEST_EFFORT, - base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, + {base::MayBlock(), base::TaskPriority::BEST_EFFORT, + base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, base::Bind(&PerformBridge::Run, op.get())); } @@ -280,7 +281,7 @@ class PerformBridge : public base::RefCountedThreadSafe { return; } - channel_ = chrome::GetChannelName(); + channel_ = chrome::GetChannelName(chrome::WithExtendedStable(false)); appPath_ = [appPath retain]; url_ = [url retain]; } @@ -489,7 +490,7 @@ bool SparkleEnabled() { return [SparkleGlue sharedSparkleGlue] != nil; } -base::string16 CurrentlyInstalledVersion() { +std::u16string CurrentlyInstalledVersion() { SparkleGlue* sparkleGlue = [SparkleGlue sharedSparkleGlue]; NSString* version = [sparkleGlue currentlyInstalledVersion]; return base::SysNSStringToUTF16(version); diff --git a/browser/net/brave_ad_block_tp_network_delegate_helper.cc b/browser/net/brave_ad_block_tp_network_delegate_helper.cc index 003d6ad939b..40a9f1658bb 100644 --- a/browser/net/brave_ad_block_tp_network_delegate_helper.cc +++ b/browser/net/brave_ad_block_tp_network_delegate_helper.cc @@ -40,29 +40,8 @@ namespace brave { -namespace { - network::HostResolver* g_testing_host_resolver; -content::WebContents* GetWebContents(int render_process_id, - int render_frame_id, - int frame_tree_node_id) { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - content::WebContents* web_contents = - content::WebContents::FromFrameTreeNodeId(frame_tree_node_id); - if (!web_contents) { - content::RenderFrameHost* rfh = - content::RenderFrameHost::FromID(render_process_id, render_frame_id); - if (!rfh) { - return nullptr; - } - web_contents = content::WebContents::FromRenderFrameHost(rfh); - } - return web_contents; -} - -} // namespace - void SetAdblockCnameHostResolverForTesting( network::HostResolver* host_resolver) { g_testing_host_resolver = host_resolver; @@ -109,8 +88,7 @@ void OnShouldBlockAdResult(const ResponseCallback& next_callback, DCHECK_CURRENTLY_ON(content::BrowserThread::UI); if (ctx->blocked_by == kAdBlocked) { brave_shields::DispatchBlockedEvent( - ctx->request_url, ctx->render_frame_id, ctx->render_process_id, - ctx->frame_tree_node_id, brave_shields::kAds); + ctx->request_url, ctx->frame_tree_node_id, brave_shields::kAds); } next_callback.Run(); } @@ -140,16 +118,6 @@ class AdblockCnameResolveHostClient : public network::mojom::ResolveHostClient { cb_ = base::BindOnce(&ShouldBlockAdWithOptionalCname, task_runner, std::move(next_callback), ctx); - auto* web_contents = GetWebContents( - ctx->render_process_id, ctx->render_frame_id, ctx->frame_tree_node_id); - if (!web_contents) { - start_time_ = base::TimeTicks::Now(); - this->OnComplete(net::ERR_FAILED, net::ResolveErrorInfo(), base::nullopt); - return; - } - - content::BrowserContext* context = web_contents->GetBrowserContext(); - const auto network_isolation_key = ctx->network_isolation_key; network::mojom::ResolveHostParametersPtr optional_parameters = @@ -166,7 +134,8 @@ class AdblockCnameResolveHostClient : public network::mojom::ResolveHostClient { optional_parameters->source = net::HostResolverSource::DNS; network::mojom::NetworkContext* network_context = - content::BrowserContext::GetDefaultStoragePartition(context) + content::BrowserContext::GetDefaultStoragePartition( + ctx->browser_context) ->GetNetworkContext(); start_time_ = base::TimeTicks::Now(); diff --git a/browser/net/brave_httpse_network_delegate_helper.cc b/browser/net/brave_httpse_network_delegate_helper.cc index 32ac1d7733b..38396a36d62 100644 --- a/browser/net/brave_httpse_network_delegate_helper.cc +++ b/browser/net/brave_httpse_network_delegate_helper.cc @@ -38,8 +38,8 @@ void OnBeforeURLRequest_HttpsePostFileWork( if (!ctx->new_url_spec.empty() && ctx->new_url_spec != ctx->request_url.spec()) { - brave_shields::DispatchBlockedEvent(ctx->request_url, - ctx->render_frame_id, ctx->render_process_id, ctx->frame_tree_node_id, + brave_shields::DispatchBlockedEvent( + ctx->request_url, ctx->frame_tree_node_id, brave_shields::kHTTPUpgradableResources); } @@ -85,9 +85,8 @@ int OnBeforeURLRequest_HttpsePreFileWork( return net::ERR_IO_PENDING; } else { if (!ctx->new_url_spec.empty()) { - brave_shields::DispatchBlockedEvent(ctx->request_url, - ctx->render_frame_id, ctx->render_process_id, - ctx->frame_tree_node_id, + brave_shields::DispatchBlockedEvent( + ctx->request_url, ctx->frame_tree_node_id, brave_shields::kHTTPUpgradableResources); } } diff --git a/browser/net/brave_proxying_url_loader_factory.cc b/browser/net/brave_proxying_url_loader_factory.cc index f87543aeed7..ca7153276e8 100644 --- a/browser/net/brave_proxying_url_loader_factory.cc +++ b/browser/net/brave_proxying_url_loader_factory.cc @@ -28,6 +28,7 @@ #include "net/url_request/redirect_util.h" #include "net/url_request/url_request.h" #include "services/network/public/cpp/features.h" +#include "services/network/public/cpp/parsed_headers.h" #include "url/origin.h" namespace { @@ -88,7 +89,6 @@ BraveProxyingURLLoaderFactory::InProgressRequest::InProgressRequest( BraveProxyingURLLoaderFactory* factory, uint64_t request_id, int32_t network_service_request_id, - int32_t routing_id, int render_process_id, int frame_tree_node_id, uint32_t options, @@ -103,7 +103,6 @@ BraveProxyingURLLoaderFactory::InProgressRequest::InProgressRequest( network_service_request_id_(network_service_request_id), render_process_id_(render_process_id), frame_tree_node_id_(frame_tree_node_id), - routing_id_(routing_id), options_(options), browser_context_(browser_context), traffic_annotation_(traffic_annotation), @@ -217,6 +216,9 @@ void BraveProxyingURLLoaderFactory::InProgressRequest:: target_loader_->ResumeReadingBodyFromNet(); } +void BraveProxyingURLLoaderFactory::InProgressRequest::OnReceiveEarlyHints( + network::mojom::EarlyHintsPtr early_hints) {} + void BraveProxyingURLLoaderFactory::InProgressRequest::OnReceiveResponse( network::mojom::URLResponseHeadPtr head) { current_response_ = std::move(head); @@ -435,7 +437,7 @@ void BraveProxyingURLLoaderFactory::InProgressRequest::ContinueToStartRequest( // initiate the real network request. uint32_t options = options_; factory_->target_factory_->CreateLoaderAndStart( - target_loader_.BindNewPipeAndPassReceiver(), routing_id_, + target_loader_.BindNewPipeAndPassReceiver(), network_service_request_id_, options, request_, proxied_client_receiver_.BindNewPipeAndPassRemote(), traffic_annotation_); @@ -492,8 +494,14 @@ void BraveProxyingURLLoaderFactory::InProgressRequest:: return; } - if (override_headers_) + if (override_headers_) { current_response_->headers = override_headers_; + // Since we overrode headers we should reparse them: + // NavigationRequest::ComputePoliciesToCommit uses parsed headers to set + // CSP, so if we don't reparse our CSP header changes won't work. + current_response_->parsed_headers = network::PopulateParsedHeaders( + current_response_->headers.get(), request_.url); + } std::string redirect_location; if (override_headers_ && override_headers_->IsRedirect(&redirect_location)) { @@ -662,7 +670,6 @@ bool BraveProxyingURLLoaderFactory::MaybeProxyRequest( void BraveProxyingURLLoaderFactory::CreateLoaderAndStart( mojo::PendingReceiver loader_receiver, - int32_t routing_id, int32_t request_id, uint32_t options, const network::ResourceRequest& request, @@ -677,7 +684,7 @@ void BraveProxyingURLLoaderFactory::CreateLoaderAndStart( const uint64_t brave_request_id = request_id_generator_->Generate(); auto result = requests_.emplace(std::make_unique( - this, brave_request_id, request_id, routing_id, render_process_id_, + this, brave_request_id, request_id, render_process_id_, frame_tree_node_id_, options, request, browser_context_, traffic_annotation, std::move(loader_receiver), std::move(client))); (*result.first)->Restart(); diff --git a/browser/net/brave_proxying_url_loader_factory.h b/browser/net/brave_proxying_url_loader_factory.h index b7c51517b36..c4e3bbd243c 100644 --- a/browser/net/brave_proxying_url_loader_factory.h +++ b/browser/net/brave_proxying_url_loader_factory.h @@ -56,7 +56,6 @@ class BraveProxyingURLLoaderFactory int32_t network_service_request_id, int render_process_id, int frame_tree_node_id, - int32_t routing_id, uint32_t options, const network::ResourceRequest& request, content::BrowserContext* browser_context, @@ -79,6 +78,8 @@ class BraveProxyingURLLoaderFactory void ResumeReadingBodyFromNet() override; // network::mojom::URLLoaderClient: + void OnReceiveEarlyHints( + network::mojom::EarlyHintsPtr early_hints) override; void OnReceiveResponse( network::mojom::URLResponseHeadPtr response_head) override; void OnReceiveRedirect( @@ -120,7 +121,6 @@ class BraveProxyingURLLoaderFactory const int render_process_id_; const int frame_tree_node_id_; - const int32_t routing_id_; const uint32_t options_; content::BrowserContext* browser_context_; @@ -194,7 +194,6 @@ class BraveProxyingURLLoaderFactory // network::mojom::URLLoaderFactory: void CreateLoaderAndStart( mojo::PendingReceiver loader_receiver, - int32_t routing_id, int32_t request_id, uint32_t options, const network::ResourceRequest& request, diff --git a/browser/net/resource_context_data.cc b/browser/net/resource_context_data.cc index deedcef8502..d3ee487ed4f 100644 --- a/browser/net/resource_context_data.cc +++ b/browser/net/resource_context_data.cc @@ -92,7 +92,6 @@ BraveProxyingWebSocket* ResourceContextData::StartProxyingWebSocket( request.headers.SetHeader(net::HttpRequestHeaders::kUserAgent, *user_agent); } request.request_initiator = origin; - request.render_frame_id = frame_id; auto proxy = std::make_unique( std::move(factory), request, std::move(handshake_client), diff --git a/browser/net/url_context.cc b/browser/net/url_context.cc index 3b4e661c80d..c9b0cf00b06 100644 --- a/browser/net/url_context.cc +++ b/browser/net/url_context.cc @@ -86,8 +86,6 @@ std::shared_ptr BraveRequestInfo::MakeCTX( true; #endif - ctx->render_frame_id = request.render_frame_id; - ctx->render_process_id = render_process_id; ctx->frame_tree_node_id = frame_tree_node_id; // TODO(iefremov): remove tab_url. Change tab_origin from GURL to Origin. @@ -108,9 +106,7 @@ std::shared_ptr BraveRequestInfo::MakeCTX( // (See |BraveProxyingWebSocket|). if (ctx->tab_origin.is_empty()) { ctx->tab_origin = brave_shields::BraveShieldsWebContentsObserver:: - GetTabURLFromRenderFrameInfo(ctx->render_process_id, - ctx->render_frame_id, - ctx->frame_tree_node_id) + GetTabURLFromRenderFrameInfo(ctx->frame_tree_node_id) .GetOrigin(); } diff --git a/browser/net/url_context.h b/browser/net/url_context.h index 13a6f0930e1..af4bf8a9bce 100644 --- a/browser/net/url_context.h +++ b/browser/net/url_context.h @@ -78,8 +78,6 @@ struct BraveRequestInfo { bool allow_http_upgradable_resource = false; bool allow_referrers = false; bool is_webtorrent_disabled = false; - int render_process_id = 0; - int render_frame_id = 0; int frame_tree_node_id = 0; uint64_t request_identifier = 0; size_t next_url_request_index = 0; diff --git a/browser/notifications/ads_notification_handler.cc b/browser/notifications/ads_notification_handler.cc index 7bb073e0108..176070e27e1 100644 --- a/browser/notifications/ads_notification_handler.cc +++ b/browser/notifications/ads_notification_handler.cc @@ -48,7 +48,7 @@ void AdsNotificationHandler::OnClick( const GURL& origin, const std::string& id, const base::Optional& action_index, - const base::Optional& reply, + const base::Optional& reply, base::OnceClosure completed_closure) { AdsService* ads_service = AdsServiceFactory::GetForProfile(profile); if (!ads_service) { diff --git a/browser/notifications/ads_notification_handler.h b/browser/notifications/ads_notification_handler.h index d75f9dfd6af..2ca8cf015e0 100644 --- a/browser/notifications/ads_notification_handler.h +++ b/browser/notifications/ads_notification_handler.h @@ -32,7 +32,7 @@ class AdsNotificationHandler : public NotificationHandler { const GURL& origin, const std::string& id, const base::Optional& action_index, - const base::Optional& reply, + const base::Optional& reply, base::OnceClosure completed_closure) override; void OpenSettings(Profile* profile, const GURL& origin) override; diff --git a/browser/profiles/brave_bookmark_model_loaded_observer_browsertest.cc b/browser/profiles/brave_bookmark_model_loaded_observer_browsertest.cc index 601ffce5c83..c489cef50e2 100644 --- a/browser/profiles/brave_bookmark_model_loaded_observer_browsertest.cc +++ b/browser/profiles/brave_bookmark_model_loaded_observer_browsertest.cc @@ -23,13 +23,13 @@ void CreateOtherBookmarksFolder(bookmarks::BookmarkModel* model) { const bookmarks::BookmarkNode* other_node_folder = model->AddFolder( model->bookmark_bar_node(), model->bookmark_bar_node()->children().size(), model->other_node()->GetTitledUrlNodeTitle()); - model->AddFolder(other_node_folder, 0, base::ASCIIToUTF16("A")); + model->AddFolder(other_node_folder, 0, u"A"); } void CreateBraveSyncV1MetaInfo(bookmarks::BookmarkModel* model) { const bookmarks::BookmarkNode* node = model->AddURL( model->bookmark_bar_node(), model->bookmark_bar_node()->children().size(), - base::ASCIIToUTF16("Brave"), GURL("https://brave.com")); + u"Brave", GURL("https://brave.com")); model->SetNodeMetaInfo(node, "object_id", "object_id_value"); } diff --git a/browser/profiles/brave_profile_manager.cc b/browser/profiles/brave_profile_manager.cc index 5e866f724ed..6dd76a247bd 100644 --- a/browser/profiles/brave_profile_manager.cc +++ b/browser/profiles/brave_profile_manager.cc @@ -95,19 +95,6 @@ void BraveProfileManager::InitProfileUserPrefs(Profile* profile) { brave::SetDefaultSearchVersion(profile, profile->IsNewProfile()); } -std::string BraveProfileManager::GetLastUsedProfileName() { - PrefService* local_state = g_browser_process->local_state(); - DCHECK(local_state); - const std::string last_used_profile_name = - local_state->GetString(prefs::kProfileLastUsed); - // Keep this for legacy tor profile migration because tor profile might be - // last active profile before upgrading - if (last_used_profile_name == - base::FilePath(tor::kTorProfileDir).AsUTF8Unsafe()) - return chrome::kInitialProfile; - return ProfileManager::GetLastUsedProfileName(); -} - void BraveProfileManager::DoFinalInitForServices(Profile* profile, bool go_off_the_record) { ProfileManager::DoFinalInitForServices(profile, go_off_the_record); diff --git a/browser/profiles/brave_profile_manager.h b/browser/profiles/brave_profile_manager.h index 76cb356b738..1714ba7e33f 100644 --- a/browser/profiles/brave_profile_manager.h +++ b/browser/profiles/brave_profile_manager.h @@ -21,7 +21,6 @@ class BraveProfileManager : public ProfileManager, ~BraveProfileManager() override; void InitProfileUserPrefs(Profile* profile) override; - std::string GetLastUsedProfileName() override; void SetNonPersonalProfilePrefs(Profile* profile) override; bool IsAllowedProfilePath(const base::FilePath& path) const override; bool LoadProfileByPath(const base::FilePath& profile_path, diff --git a/browser/profiles/brave_profile_manager_browsertest.cc b/browser/profiles/brave_profile_manager_browsertest.cc index 56ec538898e..90555518c0b 100644 --- a/browser/profiles/brave_profile_manager_browsertest.cc +++ b/browser/profiles/brave_profile_manager_browsertest.cc @@ -10,6 +10,7 @@ #include "brave/browser/brave_rewards/rewards_service_factory.h" #include "brave/components/ipfs/buildflags/buildflags.h" #include "brave/components/tor/tor_constants.h" +#include "brave/components/tor/tor_utils.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_attributes_entry.h" @@ -41,8 +42,8 @@ void OnUnblockOnProfileCreation(base::RunLoop* run_loop, } struct TestProfileData { - base::string16 profile_name; - base::string16 profile_name_expected_after_migration; + std::u16string profile_name; + std::u16string profile_name_expected_after_migration; bool force_default_name; base::FilePath profile_path; }; @@ -50,21 +51,15 @@ struct TestProfileData { std::vector GetTestProfileData( ProfileManager* profile_manager) { const std::vector profile_data = { - { - base::ASCIIToUTF16("Person 1"), - base::ASCIIToUTF16("Profile 1"), true, - profile_manager->user_data_dir().Append( - profile_manager->GetInitialProfileDir())}, - { - base::ASCIIToUTF16("Person 2"), - base::ASCIIToUTF16("Profile 2"), true, - profile_manager->user_data_dir().Append( - FILE_PATH_LITERAL("testprofile2"))}, - { - base::ASCIIToUTF16("ZZCustom 3"), - base::ASCIIToUTF16("ZZCustom 3"), false, - profile_manager->user_data_dir().Append( - FILE_PATH_LITERAL("testprofile3"))}, + {u"Person 1", u"Profile 1", true, + profile_manager->user_data_dir().Append( + profile_manager->GetInitialProfileDir())}, + {u"Person 2", u"Profile 2", true, + profile_manager->user_data_dir().Append( + FILE_PATH_LITERAL("testprofile2"))}, + {u"ZZCustom 3", u"ZZCustom 3", false, + profile_manager->user_data_dir().Append( + FILE_PATH_LITERAL("testprofile3"))}, }; return profile_data; } @@ -109,8 +104,7 @@ IN_PROC_BROWSER_TEST_F(BraveProfileManagerTest, base::RunLoop run_loop; profile_manager->CreateProfileAsync( profile_data[i].profile_path, - base::Bind(&OnUnblockOnProfileCreation, &run_loop), base::string16(), - std::string()); + base::Bind(&OnUnblockOnProfileCreation, &run_loop)); run_loop.Run(); ProfileAttributesEntry* entry = storage.GetProfileAttributesWithPath(profile_data[i].profile_path); @@ -185,9 +179,14 @@ IN_PROC_BROWSER_TEST_F(BraveProfileManagerTest, g_browser_process->local_state()->SetString( prefs::kProfileLastUsed, base::FilePath(tor::kTorProfileDir).AsUTF8Unsafe()); + + // The migration happens during the initialization of the browser process, so + // we need to explicitly call the method here to test it actually works. + tor::MigrateLastUsedProfileFromLocalStatePrefs( + g_browser_process->local_state()); + ProfileManager* profile_manager = g_browser_process->profile_manager(); base::FilePath last_used_path = - g_browser_process->profile_manager()->GetLastUsedProfileDir( - profile_manager->user_data_dir()); + profile_manager->GetLastUsedProfileDir(profile_manager->user_data_dir()); EXPECT_EQ(last_used_path.BaseName().AsUTF8Unsafe(), chrome::kInitialProfile); } diff --git a/browser/profiles/brave_profile_shortcut_manager_win.cc b/browser/profiles/brave_profile_shortcut_manager_win.cc index 09a641bda6b..e9a053ec9c4 100644 --- a/browser/profiles/brave_profile_shortcut_manager_win.cc +++ b/browser/profiles/brave_profile_shortcut_manager_win.cc @@ -17,7 +17,7 @@ BraveProfileShortcutManagerWin::BraveProfileShortcutManagerWin( void BraveProfileShortcutManagerWin::GetShortcutProperties( const base::FilePath& profile_path, base::CommandLine* command_line, - base::string16* name, + std::wstring* name, base::FilePath* icon_path) { // Session profiles are currently not added into storage because they will // return early in ProfileManager::AddProfileToStorage because of the profile diff --git a/browser/profiles/brave_profile_shortcut_manager_win.h b/browser/profiles/brave_profile_shortcut_manager_win.h index 50b1f67365f..70b0cbd071d 100644 --- a/browser/profiles/brave_profile_shortcut_manager_win.h +++ b/browser/profiles/brave_profile_shortcut_manager_win.h @@ -15,7 +15,7 @@ class BraveProfileShortcutManagerWin : public ProfileShortcutManagerWin { void GetShortcutProperties(const base::FilePath& profile_path, base::CommandLine* command_line, - base::string16* name, + std::wstring* name, base::FilePath* icon_path) override; private: diff --git a/browser/renderer_context_menu/brave_mock_render_view_context_menu.cc b/browser/renderer_context_menu/brave_mock_render_view_context_menu.cc index 0da771ca39e..007a34240bf 100644 --- a/browser/renderer_context_menu/brave_mock_render_view_context_menu.cc +++ b/browser/renderer_context_menu/brave_mock_render_view_context_menu.cc @@ -84,7 +84,7 @@ void BraveMockRenderViewContextMenu::ExecuteCommand(int command_id, // RenderViewContextMenuProxy implementation. void BraveMockRenderViewContextMenu::AddMenuItem(int command_id, - const base::string16& title) { + const std::u16string& title) { MockMenuItem item; item.command_id = command_id; item.enabled = observer_->IsCommandIdEnabled(command_id); @@ -96,13 +96,13 @@ void BraveMockRenderViewContextMenu::AddMenuItem(int command_id, void BraveMockRenderViewContextMenu::AddMenuItemWithIcon( int command_id, - const base::string16& title, + const std::u16string& title, const ui::ImageModel& icon) { AddMenuItem(command_id, title); } void BraveMockRenderViewContextMenu::AddCheckItem(int command_id, - const base::string16& title) { + const std::u16string& title) { MockMenuItem item; item.command_id = command_id; item.enabled = observer_->IsCommandIdEnabled(command_id); @@ -122,7 +122,7 @@ void BraveMockRenderViewContextMenu::AddSeparator() { } void BraveMockRenderViewContextMenu::AddSubMenu(int command_id, - const base::string16& label, + const std::u16string& label, ui::MenuModel* model) { MockMenuItem item; item.command_id = command_id; @@ -165,7 +165,7 @@ void BraveMockRenderViewContextMenu::UpdateMenuItem( int command_id, bool enabled, bool hidden, - const base::string16& title) { + const std::u16string& title) { for (auto& item : items_) { if (item.command_id == command_id) { item.enabled = enabled; @@ -211,6 +211,9 @@ void BraveMockRenderViewContextMenu::RemoveMenuItem(int command_id) { void BraveMockRenderViewContextMenu::RemoveAdjacentSeparators() {} +void BraveMockRenderViewContextMenu::RemoveSeparatorBeforeMenuItem( + int command_id) {} + void BraveMockRenderViewContextMenu::AddSpellCheckServiceItem(bool is_checked) { // Call the static method of RenderViewContextMenu which should our override // that doesn't add the item. diff --git a/browser/renderer_context_menu/brave_mock_render_view_context_menu.h b/browser/renderer_context_menu/brave_mock_render_view_context_menu.h index 19e1fd577d5..d0dbdf293ef 100644 --- a/browser/renderer_context_menu/brave_mock_render_view_context_menu.h +++ b/browser/renderer_context_menu/brave_mock_render_view_context_menu.h @@ -12,7 +12,6 @@ #include #include "base/macros.h" -#include "base/strings/string16.h" #include "components/renderer_context_menu/render_view_context_menu_proxy.h" #include "ui/base/models/image_model.h" #include "ui/base/models/simple_menu_model.h" @@ -42,7 +41,7 @@ class BraveMockRenderViewContextMenu : public ui::SimpleMenuModel::Delegate, bool enabled; bool checked; bool hidden; - base::string16 title; + std::u16string title; bool is_submenu; // This item lives in a submenu. bool has_submenu; // This item is a submenu. }; @@ -56,14 +55,14 @@ class BraveMockRenderViewContextMenu : public ui::SimpleMenuModel::Delegate, void ExecuteCommand(int command_id, int event_flags) override; // RenderViewContextMenuProxy implementation. - void AddMenuItem(int command_id, const base::string16& title) override; + void AddMenuItem(int command_id, const std::u16string& title) override; void AddMenuItemWithIcon(int command_id, - const base::string16& title, + const std::u16string& title, const ui::ImageModel& icon) override; - void AddCheckItem(int command_id, const base::string16& title) override; + void AddCheckItem(int command_id, const std::u16string& title) override; void AddSeparator() override; void AddSubMenu(int command_id, - const base::string16& label, + const std::u16string& label, ui::MenuModel* model) override; void AddSubMenuWithStringIdAndIcon(int command_id, int message_id, @@ -72,10 +71,11 @@ class BraveMockRenderViewContextMenu : public ui::SimpleMenuModel::Delegate, void UpdateMenuItem(int command_id, bool enabled, bool hidden, - const base::string16& title) override; + const std::u16string& title) override; void UpdateMenuIcon(int command_id, const ui::ImageModel& image) override; void RemoveMenuItem(int command_id) override; void RemoveAdjacentSeparators() override; + void RemoveSeparatorBeforeMenuItem(int command_id) override; void AddSpellCheckServiceItem(bool is_checked) override; void AddAccessibilityLabelsServiceItem(bool is_checked) override; content::RenderViewHost* GetRenderViewHost() const override; diff --git a/browser/resources/settings/brave_appearance_page/BUILD.gn b/browser/resources/settings/brave_appearance_page/BUILD.gn index b9e2e2dee24..59dfe5387c1 100644 --- a/browser/resources/settings/brave_appearance_page/BUILD.gn +++ b/browser/resources/settings/brave_appearance_page/BUILD.gn @@ -33,7 +33,7 @@ js_library("brave_theme") { deps = [ ":brave_appearance_browser_proxy", "//chrome/browser/resources/settings:route", - "//chrome/browser/resources/settings:router.m", + "//chrome/browser/resources/settings:router", "//ui/webui/resources/js:cr.m", "//ui/webui/resources/js:load_time_data.m", "//ui/webui/resources/js:web_ui_listener_behavior.m", @@ -45,7 +45,7 @@ js_library("brave_theme") { js_library("super_referral") { deps = [ "//chrome/browser/resources/settings:route", - "//chrome/browser/resources/settings:router.m", + "//chrome/browser/resources/settings:router", "//ui/webui/resources/js:cr.m", "//ui/webui/resources/js:i18n_behavior.m", "//ui/webui/resources/js:load_time_data.m", diff --git a/browser/resources/settings/brave_appearance_page/brave_theme.js b/browser/resources/settings/brave_appearance_page/brave_theme.js index 3ceb3a9c8ed..e074f3eb79f 100644 --- a/browser/resources/settings/brave_appearance_page/brave_theme.js +++ b/browser/resources/settings/brave_appearance_page/brave_theme.js @@ -6,10 +6,10 @@ import {Polymer, html} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {WebUIListenerBehavior} from 'chrome://resources/js/web_ui_listener_behavior.m.js'; import {routes} from '../route.js'; -import {Router} from '../router.m.js'; +import {Router} from '../router.js'; import 'chrome://resources/cr_elements/md_select_css.m.js'; -import '../settings_shared_css.m.js'; -import '../settings_vars_css.m.js'; +import '../settings_shared_css.js'; +import '../settings_vars_css.js'; import {loadTimeData} from "../i18n_setup.js" import {BraveAppearanceBrowserProxy, BraveAppearanceBrowserProxyImpl} from './brave_appearance_browser_proxy.js'; diff --git a/browser/resources/settings/brave_appearance_page/sidebar.js b/browser/resources/settings/brave_appearance_page/sidebar.js index 4c438bb4d12..dd8e3a16927 100644 --- a/browser/resources/settings/brave_appearance_page/sidebar.js +++ b/browser/resources/settings/brave_appearance_page/sidebar.js @@ -4,8 +4,8 @@ // you can obtain one at http://mozilla.org/MPL/2.0/. import {Polymer, html} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import '../settings_shared_css.m.js'; -import '../settings_vars_css.m.js'; +import '../settings_shared_css.js'; +import '../settings_vars_css.js'; import {I18nBehavior} from 'chrome://resources/js/i18n_behavior.m.js' import {loadTimeData} from "../i18n_setup.js" diff --git a/browser/resources/settings/brave_appearance_page/toolbar.js b/browser/resources/settings/brave_appearance_page/toolbar.js index b76454427d0..1437b608733 100644 --- a/browser/resources/settings/brave_appearance_page/toolbar.js +++ b/browser/resources/settings/brave_appearance_page/toolbar.js @@ -4,8 +4,8 @@ // you can obtain one at http://mozilla.org/MPL/2.0/. import {Polymer, html} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import '../settings_shared_css.m.js'; -import '../settings_vars_css.m.js'; +import '../settings_shared_css.js'; +import '../settings_vars_css.js'; /** * 'settings-brave-appearance-toolbar' is the settings page area containing diff --git a/browser/resources/settings/brave_clear_browsing_data_dialog/brave_clear_browsing_data_on_exit_page.js b/browser/resources/settings/brave_clear_browsing_data_dialog/brave_clear_browsing_data_on_exit_page.js index cbc1ac69ca8..d687d1b4c05 100644 --- a/browser/resources/settings/brave_clear_browsing_data_dialog/brave_clear_browsing_data_on_exit_page.js +++ b/browser/resources/settings/brave_clear_browsing_data_dialog/brave_clear_browsing_data_on_exit_page.js @@ -4,8 +4,8 @@ // you can obtain one at http://mozilla.org/MPL/2.0/. import 'chrome://resources/cr_elements/shared_vars_css.m.js'; -import '../settings_shared_css.m.js'; -import '../settings_vars_css.m.js'; +import '../settings_shared_css.js'; +import '../settings_vars_css.js'; import '../controls/settings_checkbox.js'; import {Polymer, html} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; diff --git a/browser/resources/settings/brave_default_extensions_page/brave_default_extensions_page.html b/browser/resources/settings/brave_default_extensions_page/brave_default_extensions_page.html index 2a77a64a6cb..e1fdc5ce80b 100644 --- a/browser/resources/settings/brave_default_extensions_page/brave_default_extensions_page.html +++ b/browser/resources/settings/brave_default_extensions_page/brave_default_extensions_page.html @@ -1,13 +1,13 @@ - - - - + + + +