diff --git a/DEPS b/DEPS index bfc9c6958c56..65c943346500 100644 --- a/DEPS +++ b/DEPS @@ -39,17 +39,10 @@ hooks = [ 'action': ['vpython3', 'script/download_rust_deps.py', '--platform', 'ios'], }, { - # Download rust deps if necessary for Windows + # Download rust deps if necessary for Windows, Linux, and macOS 'name': 'download_rust_deps', 'pattern': '.', - 'condition': 'checkout_win', - 'action': ['vpython', 'script/download_rust_deps.py'], - }, - { - # Download rust deps if necessary for Linux and macOS - 'name': 'download_rust_deps', - 'pattern': '.', - 'condition': 'not checkout_android and not checkout_ios and not checkout_win', + 'condition': 'not checkout_android and not checkout_ios', 'action': ['vpython3', 'script/download_rust_deps.py'], }, { diff --git a/android/brave_java_sources.gni b/android/brave_java_sources.gni index 8ee9c69ca98f..c869bcc20018 100644 --- a/android/brave_java_sources.gni +++ b/android/brave_java_sources.gni @@ -205,7 +205,7 @@ brave_java_sources = [ "../../brave/android/java/org/chromium/chrome/browser/toolbar/menu_button/BraveMenuButtonCoordinator.java", "../../brave/android/java/org/chromium/chrome/browser/toolbar/top/BraveTabSwitcherModeTTCoordinatorPhone.java", "../../brave/android/java/org/chromium/chrome/browser/toolbar/top/BraveTabSwitcherModeTTPhone.java", - "../../brave/android/java/org/chromium/chrome/browser/toolbar/top/BraveToolbarLayout.java", + "../../brave/android/java/org/chromium/chrome/browser/toolbar/top/BraveToolbarLayoutImpl.java", "../../brave/android/java/org/chromium/chrome/browser/toolbar/top/BraveTopToolbarCoordinator.java", "../../brave/android/java/org/chromium/chrome/browser/ui/brave_tricks/checkbox_to_switch/CheckBoxPreference.java", "../../brave/android/java/org/chromium/chrome/browser/ui/messages/infobar/BraveSimpleConfirmInfoBarBuilder.java", @@ -288,7 +288,10 @@ brave_components_browser_ui_site_settings_android_java = [ brave_browser_ui_android_appmenu_internal_sources = [ "//brave/browser/ui/android/appmenu/internal/java/src/org/chromium/chrome/browser/ui/appmenu/BraveAppMenu.java" ] -brave_browser_ui_android_toolbar_sources = [ "//brave/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/bottom/BraveBottomControlsMediator.java" ] +brave_browser_ui_android_toolbar_sources = [ + "//brave/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/bottom/BraveBottomControlsMediator.java", + "//brave/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/BraveToolbarLayout.java", +] brave_java_base_sources = [ "//brave/android/java/org/chromium/base/BraveCommandLineInitUtil.java", diff --git a/android/browsertests_apk/AndroidManifest.xml.jinja2 b/android/browsertests_apk/AndroidManifest.xml.jinja2 index d3afded2bfdf..118c45569644 100644 --- a/android/browsertests_apk/AndroidManifest.xml.jinja2 +++ b/android/browsertests_apk/AndroidManifest.xml.jinja2 @@ -102,6 +102,13 @@ + + + + + + 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 b47dffbaab78..a1cfc368a016 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 @@ -10,6 +10,7 @@ import android.widget.FrameLayout; import android.widget.ScrollView; +import androidx.annotation.NonNull; import androidx.annotation.Nullable; import org.chromium.base.ApiCompatibilityUtils; @@ -21,18 +22,20 @@ import org.chromium.chrome.browser.ntp.ScrollableContainerDelegate; import org.chromium.chrome.browser.ntp.SnapScrollHelper; import org.chromium.chrome.browser.ntp.snippets.SectionHeaderView; +import org.chromium.chrome.browser.privacy.settings.PrivacyPreferencesManagerImpl; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.share.ShareDelegate; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tabmodel.TabModelSelector; +import org.chromium.chrome.browser.toolbar.top.Toolbar; import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; import org.chromium.ui.UiUtils; import org.chromium.ui.base.WindowAndroid; public class BraveFeedSurfaceCoordinator extends FeedSurfaceCoordinator { - private Activity mActivity; - private ScrollView mScrollViewForPolicy; + // To delete in bytecode, members from parent class will be used instead. + private @Nullable ScrollView mScrollViewForPolicy; private View mNtpHeader; private FrameLayout mRootView; @@ -44,11 +47,17 @@ public BraveFeedSurfaceCoordinator(Activity activity, SnackbarManager snackbarMa boolean isPlaceholderShownInitially, BottomSheetController bottomSheetController, Supplier shareDelegateSupplier, @Nullable ScrollableContainerDelegate externalScrollableContainerDelegate, - TabModelSelector tabModelSelector, @NewTabPageLaunchOrigin int launchOrigin) { + @NewTabPageLaunchOrigin int launchOrigin, + PrivacyPreferencesManagerImpl privacyPreferencesManager, + @NonNull Supplier toolbarSupplier, + FeedLaunchReliabilityLoggingState launchReliabilityLoggingState, + @Nullable FeedSwipeRefreshLayout swipeRefreshLayout, boolean overScrollDisabled) { super(activity, snackbarManager, windowAndroid, snapScrollHelper, ntpHeader, sectionHeaderView, showDarkBackground, delegate, pageNavigationDelegate, profile, isPlaceholderShownInitially, bottomSheetController, shareDelegateSupplier, - externalScrollableContainerDelegate, tabModelSelector, launchOrigin); + externalScrollableContainerDelegate, launchOrigin, privacyPreferencesManager, + toolbarSupplier, launchReliabilityLoggingState, swipeRefreshLayout, + overScrollDisabled); } @Override @@ -82,4 +91,8 @@ void createScrollViewForPolicy() { public boolean isEnhancedProtectionPromoEnabled() { return false; } + + public boolean isReliabilityLoggingEnabled() { + return false; + } } diff --git a/android/java/apk_for_test.flags b/android/java/apk_for_test.flags index c8d2d5f6f87b..d9be0453767d 100644 --- a/android/java/apk_for_test.flags +++ b/android/java/apk_for_test.flags @@ -59,9 +59,14 @@ } -keep class org.chromium.chrome.browser.omnibox.suggestions.editurl.EditUrlSuggestionProcessor { + public (...); *** mHasClearedOmniboxForFocus; } +-keep class org.chromium.chrome.browser.omnibox.suggestions.editurl.BraveEditUrlSuggestionProcessor { + public (...); +} + -keep class org.chromium.chrome.browser.sync.settings.ManageSyncSettings { *** mGoogleActivityControls; *** mSyncEncryption; @@ -132,6 +137,11 @@ -keep class org.chromium.chrome.browser.toolbar.top.TopToolbarCoordinator { *** mTabSwitcherModeCoordinatorPhone; *** mOptionalButtonController; + public (...); +} + +-keep class org.chromium.chrome.browser.toolbar.top.BraveTopToolbarCoordinator { + public (...); } -keep class org.chromium.chrome.browser.toolbar.top.TabSwitcherModeTTCoordinatorPhone { @@ -281,7 +291,7 @@ -keep class org.chromium.chrome.browser.customtabs.features.toolbar.CustomTabToolbar --keep class org.chromium.chrome.browser.toolbar.top.BraveToolbarLayout +-keep class org.chromium.chrome.browser.toolbar.top.BraveToolbarLayoutImpl -keep class org.chromium.chrome.browser.toolbar.top.ToolbarPhone @@ -321,4 +331,28 @@ -keep class org.chromium.chrome.browser.omnibox.status.BraveStatusMediator { public (...); -} \ No newline at end of file +} + +-keep class org.chromium.chrome.browser.feed.FeedSurfaceCoordinator { + *** mScrollViewForPolicy; + *** mNtpHeader; + *** mRootView; + *** isEnhancedProtectionPromoEnabled(...); + *** isReliabilityLoggingEnabled(...); +} + +-keep class org.chromium.chrome.browser.feed.BraveFeedSurfaceCoordinator { + *** mScrollViewForPolicy; + *** mNtpHeader; + *** mRootView; + *** isEnhancedProtectionPromoEnabled(...); + *** isReliabilityLoggingEnabled(...); +} + +-keep class org.chromium.chrome.browser.toolbar.menu_button.MenuButtonCoordinator { + public (...); +} + +-keep class org.chromium.chrome.browser.toolbar.menu_button.BraveMenuButtonCoordinator { + public (...); +} diff --git a/android/java/org/chromium/chrome/browser/BraveRewardsDonationSentActivity.java b/android/java/org/chromium/chrome/browser/BraveRewardsDonationSentActivity.java index e319c87dd20c..fc8d905b2aa2 100644 --- a/android/java/org/chromium/chrome/browser/BraveRewardsDonationSentActivity.java +++ b/android/java/org/chromium/chrome/browser/BraveRewardsDonationSentActivity.java @@ -45,13 +45,15 @@ public class BraveRewardsDonationSentActivity extends Activity implements BraveR protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.brave_rewards_donation_sent); - currentTabId_ = IntentUtils.safeGetIntExtra(getIntent(), BraveRewardsSiteBannerActivity.TAB_ID_EXTRA, -1); + currentTabId_ = IntentUtils.safeGetIntExtra( + getIntent(), BraveRewardsSiteBannerActivity.TAB_ID_EXTRA, -1); mBraveRewardsNativeWorker = BraveRewardsNativeWorker.getInstance(); mBraveRewardsNativeWorker.AddObserver(this); - String publisherFavIconURL = mBraveRewardsNativeWorker.GetPublisherFavIconURL(currentTabId_); + String publisherFavIconURL = + mBraveRewardsNativeWorker.GetPublisherFavIconURL(currentTabId_); Tab currentActiveTab = BraveRewardsHelper.currentActiveChromeTabbedActivityTab(); - String url = currentActiveTab.getUrlString(); + String url = currentActiveTab.getUrl().getSpec(); String favicon_url = (publisherFavIconURL.isEmpty()) ? url : publisherFavIconURL; mIconFetcher = new org.chromium.chrome.browser.BraveRewardsHelper(currentActiveTab); mIconFetcher.retrieveLargeIcon(favicon_url, this); diff --git a/android/java/org/chromium/chrome/browser/BraveRewardsHelper.java b/android/java/org/chromium/chrome/browser/BraveRewardsHelper.java index e8c2ccc34aec..4c3f15ba9308 100644 --- a/android/java/org/chromium/chrome/browser/BraveRewardsHelper.java +++ b/android/java/org/chromium/chrome/browser/BraveRewardsHelper.java @@ -218,7 +218,7 @@ private void retrieveLargeIconInternal() { //favIconURL (or content URL) is still not available, try to read it again if (mFaviconUrl == null || mFaviconUrl.isEmpty() || mFaviconUrl.equals("clear")) { if (mTab != null) { - mFaviconUrl = mTab.getUrlString(); + mFaviconUrl = mTab.getUrl().getSpec(); } mHandler.postDelayed(new Runnable() { diff --git a/android/java/org/chromium/chrome/browser/BraveRewardsNativeWorker.java b/android/java/org/chromium/chrome/browser/BraveRewardsNativeWorker.java index b1a31ae164cf..e81a5e3c9817 100644 --- a/android/java/org/chromium/chrome/browser/BraveRewardsNativeWorker.java +++ b/android/java/org/chromium/chrome/browser/BraveRewardsNativeWorker.java @@ -157,7 +157,7 @@ public void TriggerOnNotifyFrontTabUrlChanged() { public void run() { Tab tab = BraveRewardsHelper.currentActiveChromeTabbedActivityTab(); if (tab != null && !tab.isIncognito()) { - OnNotifyFrontTabUrlChanged(tab.getId(), tab.getUrlString()); + OnNotifyFrontTabUrlChanged(tab.getId(), tab.getUrl().getSpec()); } } }); diff --git a/android/java/org/chromium/chrome/browser/BraveRewardsPanelPopup.java b/android/java/org/chromium/chrome/browser/BraveRewardsPanelPopup.java index 5916e66906fa..4898f13d0860 100644 --- a/android/java/org/chromium/chrome/browser/BraveRewardsPanelPopup.java +++ b/android/java/org/chromium/chrome/browser/BraveRewardsPanelPopup.java @@ -938,22 +938,23 @@ public void ShowRewardsSummary() { public void ShowWebSiteView() { tvBrBatWallet.setText(String.format(Locale.getDefault(), "%.3f", 0.0)); - String usdText = String.format(this.root.getResources().getString(R.string.brave_ui_usd), "0.00"); - ((TextView)this.root.findViewById(R.id.br_usd_wallet)).setText(usdText); + String usdText = + String.format(this.root.getResources().getString(R.string.brave_ui_usd), "0.00"); + ((TextView) this.root.findViewById(R.id.br_usd_wallet)).setText(usdText); CreateUpdateBalanceTask(); - ScrollView sv_new = (ScrollView)this.root.findViewById(R.id.sv_no_website); + ScrollView sv_new = (ScrollView) this.root.findViewById(R.id.sv_no_website); sv_new.setVisibility(View.VISIBLE); ShowRewardsSummary(); - ((LinearLayout)this.root.findViewById(R.id.website_summary)).setVisibility(View.VISIBLE); + ((LinearLayout) this.root.findViewById(R.id.website_summary)).setVisibility(View.VISIBLE); EnableWalletDetails(true); Tab currentActiveTab = BraveRewardsHelper.currentActiveChromeTabbedActivityTab(); if (currentActiveTab != null && !currentActiveTab.isIncognito()) { - String url = currentActiveTab.getUrlString(); + String url = currentActiveTab.getUrl().getSpec(); if (URLUtil.isValidUrl(url)) { mBraveRewardsNativeWorker.GetPublisherInfo(currentActiveTab.getId(), url); mPublisherFetcher = new Timer(); mPublisherFetcher.schedule(new PublisherFetchTimer(currentActiveTab.getId(), url), - PUBLISHER_INFO_FETCH_RETRY, PUBLISHER_INFO_FETCH_RETRY); + PUBLISHER_INFO_FETCH_RETRY, PUBLISHER_INFO_FETCH_RETRY); } else { btRewardsSummary.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); btRewardsSummary.setClickable(false); @@ -1421,7 +1422,6 @@ public void run() { } } - @Override public void OnPublisherInfo(int tabId) { publisherExist = true; @@ -1433,14 +1433,14 @@ public void OnPublisherInfo(int tabId) { String publisherFavIconURL = mBraveRewardsNativeWorker.GetPublisherFavIconURL(currentTabId); Tab currentActiveTab = BraveRewardsHelper.currentActiveChromeTabbedActivityTab(); - String url = currentActiveTab.getUrlString(); + String url = currentActiveTab.getUrl().getSpec(); final String favicon_url = (publisherFavIconURL.isEmpty()) ? url : publisherFavIconURL; mIconFetcher.retrieveLargeIcon(favicon_url, this); - GridLayout gl = (GridLayout)this.root.findViewById(R.id.website_summary_grid); + GridLayout gl = (GridLayout) this.root.findViewById(R.id.website_summary_grid); gl.setVisibility(View.VISIBLE); - LinearLayout ll = (LinearLayout)this.root.findViewById(R.id.br_central_layout); + LinearLayout ll = (LinearLayout) this.root.findViewById(R.id.br_central_layout); ll.setBackgroundColor(Color.WHITE); String pubName = thisObject.mBraveRewardsNativeWorker.GetPublisherName(currentTabId); @@ -1452,22 +1452,25 @@ public void OnPublisherInfo(int tabId) { pubSuffix = thisObject.root.getResources().getString(R.string.brave_ui_on_twitch); } pubName = "" + pubName + " " + pubSuffix; - TextView tv = (TextView)thisObject.root.findViewById(R.id.publisher_name); + TextView tv = (TextView) thisObject.root.findViewById(R.id.publisher_name); tv.setText(Html.fromHtml(pubName)); - tv = (TextView)thisObject.root.findViewById(R.id.publisher_attention); - String percent = Integer.toString(thisObject.mBraveRewardsNativeWorker.GetPublisherPercent(currentTabId)) + "%"; + tv = (TextView) thisObject.root.findViewById(R.id.publisher_attention); + String percent = Integer.toString(thisObject.mBraveRewardsNativeWorker.GetPublisherPercent( + currentTabId)) + + "%"; tv.setText(percent); if (btAutoContribute != null) { btAutoContribute.setOnCheckedChangeListener(null); - btAutoContribute.setChecked(!thisObject.mBraveRewardsNativeWorker.GetPublisherExcluded(currentTabId)); + btAutoContribute.setChecked( + !thisObject.mBraveRewardsNativeWorker.GetPublisherExcluded(currentTabId)); btAutoContribute.setOnCheckedChangeListener(autoContributeSwitchListener); } UpdatePublisherStatus( - thisObject.mBraveRewardsNativeWorker.GetPublisherStatus(currentTabId)); + thisObject.mBraveRewardsNativeWorker.GetPublisherStatus(currentTabId)); - tv = (TextView)root.findViewById(R.id.br_no_activities_yet); - gl = (GridLayout)thisObject.root.findViewById(R.id.br_activities); + tv = (TextView) root.findViewById(R.id.br_no_activities_yet); + gl = (GridLayout) thisObject.root.findViewById(R.id.br_activities); if (tv != null && gl != null) { tv.setVisibility(View.GONE); gl.setVisibility(View.GONE); diff --git a/android/java/org/chromium/chrome/browser/BraveRewardsSiteBannerActivity.java b/android/java/org/chromium/chrome/browser/BraveRewardsSiteBannerActivity.java index 19184c149c41..3cd7e0168143 100644 --- a/android/java/org/chromium/chrome/browser/BraveRewardsSiteBannerActivity.java +++ b/android/java/org/chromium/chrome/browser/BraveRewardsSiteBannerActivity.java @@ -130,7 +130,7 @@ public void onClick(View view) { String publisherFavIconURL = mBraveRewardsNativeWorker.GetPublisherFavIconURL(currentTabId_); Tab currentActiveTab = BraveRewardsHelper.currentActiveChromeTabbedActivityTab(); - String url = currentActiveTab.getUrlString(); + String url = currentActiveTab.getUrl().getSpec(); String favicon_url = (publisherFavIconURL.isEmpty()) ? url : publisherFavIconURL; mIconFetcher = new BraveRewardsHelper(currentActiveTab); mIconFetcher.retrieveLargeIcon(favicon_url, this); diff --git a/android/java/org/chromium/chrome/browser/BraveSyncInformers.java b/android/java/org/chromium/chrome/browser/BraveSyncInformers.java index b65f230a1220..692dd549db34 100644 --- a/android/java/org/chromium/chrome/browser/BraveSyncInformers.java +++ b/android/java/org/chromium/chrome/browser/BraveSyncInformers.java @@ -19,7 +19,7 @@ import org.chromium.chrome.browser.preferences.BravePrefServiceBridge; import org.chromium.chrome.browser.settings.BraveSyncScreensPreference; import org.chromium.chrome.browser.settings.SettingsLauncherImpl; -import org.chromium.chrome.browser.sync.ProfileSyncService; +import org.chromium.chrome.browser.sync.SyncService; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.ui.messages.infobar.BraveSimpleConfirmInfoBarBuilder; import org.chromium.chrome.browser.ui.messages.infobar.SimpleConfirmInfoBarBuilder; @@ -43,7 +43,7 @@ private static void showSetupV2IfRequired() { return; } - boolean isV2User = ProfileSyncService.get() != null && ProfileSyncService.get().isFirstSetupComplete(); + boolean isV2User = SyncService.get() != null && SyncService.get().isFirstSetupComplete(); if (isV2User) { braveSyncWorker.setSyncV2MigrateNoticeDismissed(true); return; diff --git a/android/java/org/chromium/chrome/browser/app/BraveActivity.java b/android/java/org/chromium/chrome/browser/app/BraveActivity.java index a18d2f7fae55..ed5ac21a8778 100644 --- a/android/java/org/chromium/chrome/browser/app/BraveActivity.java +++ b/android/java/org/chromium/chrome/browser/app/BraveActivity.java @@ -99,7 +99,7 @@ import org.chromium.chrome.browser.tab.TabSelectionType; import org.chromium.chrome.browser.tabmodel.TabModel; import org.chromium.chrome.browser.tabmodel.TabModelUtils; -import org.chromium.chrome.browser.toolbar.top.BraveToolbarLayout; +import org.chromium.chrome.browser.toolbar.top.BraveToolbarLayoutImpl; import org.chromium.chrome.browser.util.BraveDbUtil; import org.chromium.chrome.browser.util.BraveReferrer; import org.chromium.chrome.browser.util.PackageUtils; @@ -499,10 +499,10 @@ private void checkForNotificationData() { case RetentionNotificationUtil.BRAVE_STATS_ADS_TRACKERS: case RetentionNotificationUtil.BRAVE_STATS_DATA: case RetentionNotificationUtil.BRAVE_STATS_TIME: - if (getActivityTab() != null - && getActivityTab().getUrlString() != null - && !UrlUtilities.isNTPUrl(getActivityTab().getUrlString())) { - getTabCreator(false).launchUrl(UrlConstants.NTP_URL, TabLaunchType.FROM_CHROME_UI); + if (getActivityTab() != null && getActivityTab().getUrl().getSpec() != null + && !UrlUtilities.isNTPUrl(getActivityTab().getUrl().getSpec())) { + getTabCreator(false).launchUrl( + UrlConstants.NTP_URL, TabLaunchType.FROM_CHROME_UI); } break; case RetentionNotificationUtil.DAY_10: @@ -518,8 +518,8 @@ public void checkForBraveStats() { if (OnboardingPrefManager.getInstance().isBraveStatsEnabled()) { BraveStatsUtil.showBraveStats(); } else { - if (getActivityTab() != null && getActivityTab().getUrlString() != null - && !UrlUtilities.isNTPUrl(getActivityTab().getUrlString())) { + if (getActivityTab() != null && getActivityTab().getUrl().getSpec() != null + && !UrlUtilities.isNTPUrl(getActivityTab().getUrl().getSpec())) { OnboardingPrefManager.getInstance().setFromNotification(true); if (getTabCreator(false) != null) { getTabCreator(false).launchUrl( @@ -555,7 +555,7 @@ public void showOnboardingV2(boolean fromStats) { } public void hideRewardsOnboardingIcon() { - BraveToolbarLayout layout = (BraveToolbarLayout)findViewById(R.id.toolbar); + BraveToolbarLayoutImpl layout = (BraveToolbarLayoutImpl) findViewById(R.id.toolbar); assert layout != null; if (layout != null) { layout.hideRewardsOnboardingIcon(); @@ -655,7 +655,7 @@ public void handleBraveSetDefaultBrowserDialog() { } public void OnRewardsPanelDismiss() { - BraveToolbarLayout layout = (BraveToolbarLayout)findViewById(R.id.toolbar); + BraveToolbarLayoutImpl layout = (BraveToolbarLayoutImpl) findViewById(R.id.toolbar); assert layout != null; if (layout != null) { layout.onRewardsPanelDismiss(); @@ -663,7 +663,7 @@ public void OnRewardsPanelDismiss() { } public void dismissRewardsPanel() { - BraveToolbarLayout layout = (BraveToolbarLayout)findViewById(R.id.toolbar); + BraveToolbarLayoutImpl layout = (BraveToolbarLayoutImpl) findViewById(R.id.toolbar); assert layout != null; if (layout != null) { layout.dismissRewardsPanel(); @@ -671,7 +671,7 @@ public void dismissRewardsPanel() { } public void dismissShieldsTooltip() { - BraveToolbarLayout layout = (BraveToolbarLayout)findViewById(R.id.toolbar); + BraveToolbarLayoutImpl layout = (BraveToolbarLayoutImpl) findViewById(R.id.toolbar); assert layout != null; if (layout != null) { layout.dismissShieldsTooltip(); @@ -679,7 +679,7 @@ public void dismissShieldsTooltip() { } public void openRewardsPanel() { - BraveToolbarLayout layout = (BraveToolbarLayout)findViewById(R.id.toolbar); + BraveToolbarLayoutImpl layout = (BraveToolbarLayoutImpl) findViewById(R.id.toolbar); assert layout != null; if (layout != null) { layout.openRewardsPanel(); @@ -688,7 +688,7 @@ public void openRewardsPanel() { public Tab selectExistingTab(String url) { Tab tab = getActivityTab(); - if (tab != null && tab.getUrlString().equals(url)) { + if (tab != null && tab.getUrl().getSpec().equals(url)) { return tab; } diff --git a/android/java/org/chromium/chrome/browser/appmenu/BraveTabbedAppMenuPropertiesDelegate.java b/android/java/org/chromium/chrome/browser/appmenu/BraveTabbedAppMenuPropertiesDelegate.java index 94840d4fac71..b495e7142332 100644 --- a/android/java/org/chromium/chrome/browser/appmenu/BraveTabbedAppMenuPropertiesDelegate.java +++ b/android/java/org/chromium/chrome/browser/appmenu/BraveTabbedAppMenuPropertiesDelegate.java @@ -52,12 +52,10 @@ public BraveTabbedAppMenuPropertiesDelegate(Context context, OneshotSupplier overviewModeBehaviorSupplier, ObservableSupplier bookmarkBridgeSupplier, WebFeedSnackbarController.FeedLauncher feedLauncher, - ModalDialogManager modalDialogManager, SnackbarManager snackbarManager, - WebFeedBridge webFeedBridge) { + ModalDialogManager modalDialogManager, SnackbarManager snackbarManager) { super(context, activityTabProvider, multiWindowModeStateDispatcher, tabModelSelector, toolbarManager, decorView, appMenuDelegate, overviewModeBehaviorSupplier, - bookmarkBridgeSupplier, feedLauncher, modalDialogManager, snackbarManager, - webFeedBridge); + bookmarkBridgeSupplier, feedLauncher, modalDialogManager, snackbarManager); mAppMenuDelegate = appMenuDelegate; } diff --git a/android/java/org/chromium/chrome/browser/compositor/layouts/BraveLayoutManagerChrome.java b/android/java/org/chromium/chrome/browser/compositor/layouts/BraveLayoutManagerChrome.java index 85bcc743b34d..f32049d1f800 100644 --- a/android/java/org/chromium/chrome/browser/compositor/layouts/BraveLayoutManagerChrome.java +++ b/android/java/org/chromium/chrome/browser/compositor/layouts/BraveLayoutManagerChrome.java @@ -10,6 +10,7 @@ import androidx.annotation.Nullable; +import org.chromium.base.jank_tracker.JankTracker; import org.chromium.base.supplier.ObservableSupplier; import org.chromium.base.supplier.OneshotSupplierImpl; import org.chromium.base.supplier.Supplier; @@ -40,9 +41,10 @@ public BraveLayoutManagerChrome(LayoutManagerHost host, ViewGroup contentContain ObservableSupplier tabContentManagerSupplier, Supplier layerTitleCacheSupplier, OneshotSupplierImpl overviewModeBehaviorSupplier, - Supplier topUiThemeColorProvider) { + Supplier topUiThemeColorProvider, JankTracker jankTracker) { super(host, contentContainer, createOverviewLayout, startSurface, tabContentManagerSupplier, - layerTitleCacheSupplier, overviewModeBehaviorSupplier, topUiThemeColorProvider); + layerTitleCacheSupplier, overviewModeBehaviorSupplier, topUiThemeColorProvider, + jankTracker); mCreateOverviewLayout = createOverviewLayout && startSurface == null; } diff --git a/android/java/org/chromium/chrome/browser/compositor/layouts/phone/StackLayout.java b/android/java/org/chromium/chrome/browser/compositor/layouts/phone/StackLayout.java index 30aaedc378e7..1bb5cb64760a 100644 --- a/android/java/org/chromium/chrome/browser/compositor/layouts/phone/StackLayout.java +++ b/android/java/org/chromium/chrome/browser/compositor/layouts/phone/StackLayout.java @@ -187,9 +187,4 @@ public void setActiveStackState(int stackIndex) { super.setActiveStackState(stackIndex); } - - @Override - public boolean shouldAllowIncognitoSwitching() { - return !mAnimatingStackSwitch; - } } diff --git a/android/java/org/chromium/chrome/browser/compositor/layouts/phone/StackLayoutBase.java b/android/java/org/chromium/chrome/browser/compositor/layouts/phone/StackLayoutBase.java index f88e1adb3dff..4c777584c844 100644 --- a/android/java/org/chromium/chrome/browser/compositor/layouts/phone/StackLayoutBase.java +++ b/android/java/org/chromium/chrome/browser/compositor/layouts/phone/StackLayoutBase.java @@ -1701,8 +1701,6 @@ protected void cancelAnimation(FloatProperty property) { } } - @Override - @VisibleForTesting public boolean isLayoutAnimating() { for (int i = 0; i < mLayoutAnimations.size(); i++) { if (mLayoutAnimations.get(i).first.isRunning()) return true; diff --git a/android/java/org/chromium/chrome/browser/informers/BraveAndroidSyncDisabledInformer.java b/android/java/org/chromium/chrome/browser/informers/BraveAndroidSyncDisabledInformer.java index 9a1544102bae..a6d08ffc59d9 100644 --- a/android/java/org/chromium/chrome/browser/informers/BraveAndroidSyncDisabledInformer.java +++ b/android/java/org/chromium/chrome/browser/informers/BraveAndroidSyncDisabledInformer.java @@ -16,7 +16,7 @@ import org.chromium.chrome.R; import org.chromium.chrome.browser.app.BraveActivity; import org.chromium.chrome.browser.infobar.InfoBarIdentifier; -import org.chromium.chrome.browser.sync.ProfileSyncService; +import org.chromium.chrome.browser.sync.SyncService; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.ui.messages.infobar.BraveSimpleConfirmInfoBarBuilder; import org.chromium.chrome.browser.ui.messages.infobar.SimpleConfirmInfoBarBuilder; @@ -49,7 +49,7 @@ private static void showIfRequired() { return; } - boolean brave_sync_is_enabled = ProfileSyncService.get().isFirstSetupComplete(); + boolean brave_sync_is_enabled = SyncService.get().isFirstSetupComplete(); boolean android_system_sync_disabled = !ContentResolver.getMasterSyncAutomatically(); if (!brave_sync_is_enabled || !android_system_sync_disabled) { diff --git a/android/java/org/chromium/chrome/browser/notifications/retention/RetentionNotificationPublisher.java b/android/java/org/chromium/chrome/browser/notifications/retention/RetentionNotificationPublisher.java index 795b32704229..2a8555d212ab 100644 --- a/android/java/org/chromium/chrome/browser/notifications/retention/RetentionNotificationPublisher.java +++ b/android/java/org/chromium/chrome/browser/notifications/retention/RetentionNotificationPublisher.java @@ -56,10 +56,12 @@ public void onReceive(Context context, Intent intent) { case RetentionNotificationUtil.BRAVE_STATS_ADS_TRACKERS: case RetentionNotificationUtil.BRAVE_STATS_DATA: case RetentionNotificationUtil.BRAVE_STATS_TIME: - if (braveActivity.getActivityTab() != null - && braveActivity.getActivityTab().getUrlString() != null - && !UrlUtilities.isNTPUrl(braveActivity.getActivityTab().getUrlString())) { - braveActivity.getTabCreator(false).launchUrl(UrlConstants.NTP_URL, TabLaunchType.FROM_CHROME_UI); + if (braveActivity.getActivityTab() != null + && braveActivity.getActivityTab().getUrl().getSpec() != null + && !UrlUtilities.isNTPUrl( + braveActivity.getActivityTab().getUrl().getSpec())) { + braveActivity.getTabCreator(false).launchUrl( + UrlConstants.NTP_URL, TabLaunchType.FROM_CHROME_UI); } break; case RetentionNotificationUtil.DAY_10: diff --git a/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPage.java b/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPage.java index 4e2097debdda..bc1cf3ccc5f8 100644 --- a/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPage.java +++ b/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPage.java @@ -9,24 +9,29 @@ import androidx.annotation.Nullable; +import org.chromium.base.jank_tracker.JankTracker; import org.chromium.base.supplier.ObservableSupplier; import org.chromium.base.supplier.Supplier; import org.chromium.chrome.browser.browser_controls.BrowserControlsStateProvider; import org.chromium.chrome.browser.compositor.layouts.OverviewModeBehavior; import org.chromium.chrome.browser.feed.BraveFeedSurfaceCoordinator; +import org.chromium.chrome.browser.feed.FeedSwipeRefreshLayout; import org.chromium.chrome.browser.feed.shared.FeedFeatures; import org.chromium.chrome.browser.feed.shared.FeedSurfaceProvider; import org.chromium.chrome.browser.lifecycle.ActivityLifecycleDispatcher; +import org.chromium.chrome.browser.privacy.settings.PrivacyPreferencesManagerImpl; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.share.ShareDelegate; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tabmodel.TabModelSelector; +import org.chromium.chrome.browser.toolbar.top.Toolbar; import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager; import org.chromium.chrome.browser.ui.native_page.NativePageHost; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; import org.chromium.ui.base.WindowAndroid; public class BraveNewTabPage extends NewTabPage { + private Supplier mToolbarSupplier; private NewTabPageLayout mNewTabPageLayout; private FeedSurfaceProvider mFeedSurfaceProvider; @@ -37,25 +42,28 @@ public BraveNewTabPage(Activity activity, boolean isTablet, NewTabPageUma uma, boolean isInNightMode, NativePageHost nativePageHost, Tab tab, String url, BottomSheetController bottomSheetController, - ObservableSupplier shareDelegateSupplier, WindowAndroid windowAndroid) { + Supplier shareDelegateSupplier, WindowAndroid windowAndroid, + JankTracker jankTracker, Supplier toolbarSupplier) { super(activity, browserControlsStateProvider, activityTabProvider, snackbarManager, lifecycleDispatcher, tabModelSelector, isTablet, uma, isInNightMode, nativePageHost, - tab, url, bottomSheetController, shareDelegateSupplier, windowAndroid); + tab, url, bottomSheetController, shareDelegateSupplier, windowAndroid, jankTracker, + toolbarSupplier); assert mNewTabPageLayout instanceof BraveNewTabPageLayout; if (mNewTabPageLayout instanceof BraveNewTabPageLayout) { ((BraveNewTabPageLayout) mNewTabPageLayout).setTab(tab); } + + mToolbarSupplier = toolbarSupplier; } @Override protected void initializeMainView(Activity activity, WindowAndroid windowAndroid, SnackbarManager snackbarManager, NewTabPageUma uma, boolean isInNightMode, BottomSheetController bottomSheetController, - ObservableSupplier shareDelegateSupplier, - TabModelSelector tabModelSelector, String url) { + Supplier shareDelegateSupplier, String url) { super.initializeMainView(activity, windowAndroid, snackbarManager, uma, isInNightMode, - bottomSheetController, shareDelegateSupplier, tabModelSelector, url); + bottomSheetController, shareDelegateSupplier, url); // Override surface provider Profile profile = Profile.fromWebContents(mTab.getWebContents()); @@ -66,6 +74,9 @@ windowAndroid, new SnapScrollHelper(mNewTabPageManager, mNewTabPageLayout), mNewTabPageManager.getNavigationDelegate(), profile, /* isPlaceholderShownInitially= */ false, bottomSheetController, shareDelegateSupplier, /* externalScrollableContainerDelegate= */ null, - tabModelSelector, NewTabPageUtils.decodeOriginFromNtpUrl(url)); + NewTabPageUtils.decodeOriginFromNtpUrl(url), + PrivacyPreferencesManagerImpl.getInstance(), mToolbarSupplier, + /* FeedLaunchReliabilityLoggingState */ null, + FeedSwipeRefreshLayout.create(activity), /* overScrollDisabled= */ false); } } diff --git a/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPageLayout.java b/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPageLayout.java index 6c96239a31ac..d2fc598b9b0e 100644 --- a/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPageLayout.java +++ b/android/java/org/chromium/chrome/browser/ntp/BraveNewTabPageLayout.java @@ -98,7 +98,6 @@ import org.chromium.chrome.browser.preferences.BravePref; import org.chromium.chrome.browser.preferences.BravePrefServiceBridge; import org.chromium.chrome.browser.profiles.Profile; -import org.chromium.chrome.browser.suggestions.tile.SiteSection; import org.chromium.chrome.browser.suggestions.tile.TileGroup; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; @@ -425,7 +424,7 @@ private void checkForBraveStats() { protected void insertSiteSectionView() { mainLayout = findViewById(R.id.ntp_main_layout); - mSiteSectionView = SiteSection.inflateSiteSection(mainLayout); + mSiteSectionView = NewTabPageLayout.inflateSiteSection(mainLayout); ViewGroup.LayoutParams layoutParams = mSiteSectionView.getLayoutParams(); layoutParams.width = ViewGroup.LayoutParams.WRAP_CONTENT; // If the explore sites section exists as its own section, then space it more closely. diff --git a/android/java/org/chromium/chrome/browser/settings/BraveMainPreferencesBase.java b/android/java/org/chromium/chrome/browser/settings/BraveMainPreferencesBase.java index 836f15e63dfe..dd5f3d40fab0 100644 --- a/android/java/org/chromium/chrome/browser/settings/BraveMainPreferencesBase.java +++ b/android/java/org/chromium/chrome/browser/settings/BraveMainPreferencesBase.java @@ -113,13 +113,13 @@ private void updateBravePreferences() { // Below prefs are removed from main settings. removePreferenceIfPresent(MainSettings.PREF_SYNC_PROMO); removePreferenceIfPresent(MainSettings.PREF_SIGN_IN); - removePreferenceIfPresent(MainSettings.PREF_ACCOUNT_SECTION); removePreferenceIfPresent(MainSettings.PREF_DATA_REDUCTION); - removePreferenceIfPresent(MainSettings.PREF_SYNC_AND_SERVICES); removePreferenceIfPresent(MainSettings.PREF_SEARCH_ENGINE); removePreferenceIfPresent(MainSettings.PREF_UI_THEME); removePreferenceIfPresent(MainSettings.PREF_DOWNLOADS); removePreferenceIfPresent(MainSettings.PREF_SAFETY_CHECK); + removePreferenceIfPresent(MainSettings.PREF_ACCOUNT_AND_GOOGLE_SERVICES_SECTION); + removePreferenceIfPresent(MainSettings.PREF_GOOGLE_SERVICES); removePreferenceIfPresent(PREF_LANGUAGES); removePreferenceIfPresent(PREF_BASICS_SECTION); // removePreferenceIfPresent(PREF_HOMEPAGE); diff --git a/android/java/org/chromium/chrome/browser/settings/BraveSyncScreensPreference.java b/android/java/org/chromium/chrome/browser/settings/BraveSyncScreensPreference.java index 1c724a93b25f..439768246f3a 100644 --- a/android/java/org/chromium/chrome/browser/settings/BraveSyncScreensPreference.java +++ b/android/java/org/chromium/chrome/browser/settings/BraveSyncScreensPreference.java @@ -82,7 +82,7 @@ import org.chromium.chrome.browser.settings.BravePreferenceFragment; import org.chromium.chrome.browser.settings.SettingsActivity; import org.chromium.chrome.browser.sync.BraveSyncDevices; -import org.chromium.chrome.browser.sync.ProfileSyncService; +import org.chromium.chrome.browser.sync.SyncService; import org.chromium.chrome.browser.sync.settings.BraveManageSyncSettings; import org.chromium.chrome.browser.sync.settings.SyncSettingsUtils; import org.chromium.chrome.browser.sync.settings.SyncSettingsUtils.SyncError; @@ -104,7 +104,7 @@ public class BraveSyncScreensPreference extends BravePreferenceFragment implements View.OnClickListener, SettingsActivity.OnBackPressedListener, BarcodeTracker.BarcodeGraphicTrackerCallback, BraveSyncDevices.DeviceInfoChangedListener, - ProfileSyncService.SyncStateChangedListener { + SyncService.SyncStateChangedListener { public static final int BIP39_WORD_COUNT = 24; private static final String TAG = "SYNC"; // Permission request codes need to be < 256 @@ -194,7 +194,7 @@ public void onConfigurationChanged(Configuration newConfig) { @Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - ProfileSyncService.get().addSyncStateChangedListener(this); + SyncService.get().addSyncStateChangedListener(this); InvalidateCodephrase(); @@ -883,7 +883,7 @@ public void onDestroy() { mCameraSourcePreview.release(); } - ProfileSyncService.get().removeSyncStateChangedListener(this); + SyncService.get().removeSyncStateChangedListener(this); if (deviceInfoObserverSet) { BraveSyncDevices.get().removeDeviceInfoChangedListener(this); @@ -1021,7 +1021,7 @@ private void leaveSyncChainComplete() { @Override public void syncStateChanged() { - if (ProfileSyncService.get().isFirstSetupComplete() == false) { + if (SyncService.get().isFirstSetupComplete() == false) { if (mLeaveSyncChainInProgress) { leaveSyncChainComplete(); } else { diff --git a/android/java/org/chromium/chrome/browser/shields/BraveShieldsHandler.java b/android/java/org/chromium/chrome/browser/shields/BraveShieldsHandler.java index a452007df88e..479ff1afcd92 100644 --- a/android/java/org/chromium/chrome/browser/shields/BraveShieldsHandler.java +++ b/android/java/org/chromium/chrome/browser/shields/BraveShieldsHandler.java @@ -202,7 +202,7 @@ public void addObserver(BraveShieldsMenuObserver menuObserver) { public void show(View anchorView, Tab tab) { if (mHardwareButtonMenuAnchor == null) return; - mHost = tab.getUrlString(); + mHost = tab.getUrl().getSpec(); mTitle = tab.getUrl().getHost(); mTabId = tab.getId(); mProfile = Profile.fromWebContents(tab.getWebContents()); @@ -401,7 +401,7 @@ private void initViews() { private void setUpMainLayout() { String favIconURL = mBraveRewardsNativeWorker.GetPublisherFavIconURL(mTabId); Tab currentActiveTab = mIconFetcher.getTab(); - String url = currentActiveTab.getUrlString(); + String url = currentActiveTab.getUrl().getSpec(); final String favicon_url = (favIconURL.isEmpty()) ? url : favIconURL; mIconFetcher.retrieveLargeIcon(favicon_url, this); diff --git a/android/java/org/chromium/chrome/browser/signin/BraveSigninManager.java b/android/java/org/chromium/chrome/browser/signin/BraveSigninManager.java index 4d0387042216..9adb8ef6ed8c 100644 --- a/android/java/org/chromium/chrome/browser/signin/BraveSigninManager.java +++ b/android/java/org/chromium/chrome/browser/signin/BraveSigninManager.java @@ -15,7 +15,7 @@ import org.chromium.chrome.browser.AppHooks; import org.chromium.chrome.browser.signin.services.SigninManager; import org.chromium.components.signin.base.CoreAccountInfo; -import org.chromium.components.signin.identitymanager.AccountInfoService; +import org.chromium.components.signin.identitymanager.AccountInfoServiceProvider; import org.chromium.components.signin.identitymanager.AccountTrackerService; import org.chromium.components.signin.identitymanager.IdentityManager; import org.chromium.components.signin.identitymanager.IdentityMutator; @@ -55,10 +55,6 @@ public void signOut(@SignoutReason int signoutSource, SignOutCallback signOutCal @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, @@ -106,12 +102,12 @@ public String extractDomainName(String accountEmail) { static SigninManager create(long nativeSigninManagerAndroid, AccountTrackerService accountTrackerService, IdentityManager identityManager, IdentityMutator identityMutator) { - AccountInfoService.init(identityManager, accountTrackerService); + AccountInfoServiceProvider.init(identityManager, accountTrackerService); return new BraveSigninManager(identityManager); } @CalledByNative void destroy() { - AccountInfoService.get().destroy(); + AccountInfoServiceProvider.get().destroy(); } } diff --git a/android/java/org/chromium/chrome/browser/site_settings/BraveSiteSettingsDelegate.java b/android/java/org/chromium/chrome/browser/site_settings/BraveSiteSettingsDelegate.java index 316a0e00a414..f1a71edda569 100644 --- a/android/java/org/chromium/chrome/browser/site_settings/BraveSiteSettingsDelegate.java +++ b/android/java/org/chromium/chrome/browser/site_settings/BraveSiteSettingsDelegate.java @@ -7,22 +7,34 @@ import android.content.Context; import android.content.Intent; +import android.graphics.Bitmap; -import org.chromium.chrome.browser.site_settings.ChromeSiteSettingsDelegate; -import org.chromium.chrome.browser.app.BraveActivity; +import org.chromium.base.Callback; import org.chromium.chrome.browser.ChromeTabbedActivity; +import org.chromium.chrome.browser.app.BraveActivity; +import org.chromium.chrome.browser.site_settings.ChromeSiteSettingsDelegate; import org.chromium.components.embedder_support.browser_context.BrowserContextHandle; - +import org.chromium.url.GURL; public class BraveSiteSettingsDelegate extends ChromeSiteSettingsDelegate { - public BraveSiteSettingsDelegate(Context context, BrowserContextHandle browserContextHandle) { - super(context, browserContextHandle); - } + public BraveSiteSettingsDelegate(Context context, BrowserContextHandle browserContextHandle) { + super(context, browserContextHandle); + } @Override public void closeButton() { - Intent intent = new Intent(BraveActivity.getChromeTabbedActivity(), ChromeTabbedActivity.class); + Intent intent = + new Intent(BraveActivity.getChromeTabbedActivity(), ChromeTabbedActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); BraveActivity.getChromeTabbedActivity().startActivity(intent); } + + @Override + public void getFaviconImageForURL(GURL faviconUrl, Callback callback) { + if (!faviconUrl.isValid()) { + callback.onResult(null); + return; + } + super.getFaviconImageForURL(faviconUrl, callback); + } } diff --git a/android/java/org/chromium/chrome/browser/sync/BraveAndroidSyncSettings.java b/android/java/org/chromium/chrome/browser/sync/BraveAndroidSyncSettings.java index 68ffb714adfe..e8713af1be20 100644 --- a/android/java/org/chromium/chrome/browser/sync/BraveAndroidSyncSettings.java +++ b/android/java/org/chromium/chrome/browser/sync/BraveAndroidSyncSettings.java @@ -8,7 +8,7 @@ import android.accounts.Account; import android.annotation.SuppressLint; -import org.chromium.chrome.browser.sync.ProfileSyncService; +import org.chromium.chrome.browser.sync.SyncService; // see org.brave.bytecode.BraveAndroidSyncSettingsAdapter public class BraveAndroidSyncSettings extends AndroidSyncSettings { @@ -28,7 +28,7 @@ public void disableChromeSync() { } // so pretend sync for Brave "account" is always on when sync is configured @Override public boolean isChromeSyncEnabled() { - ProfileSyncService profileSyncService = ProfileSyncService.get(); + SyncService profileSyncService = SyncService.get(); return profileSyncService != null && profileSyncService.isFirstSetupComplete(); } } diff --git a/android/java/org/chromium/chrome/browser/tabmodel/BraveTabCreator.java b/android/java/org/chromium/chrome/browser/tabmodel/BraveTabCreator.java index f8f65ca19759..1d28c9272ee0 100644 --- a/android/java/org/chromium/chrome/browser/tabmodel/BraveTabCreator.java +++ b/android/java/org/chromium/chrome/browser/tabmodel/BraveTabCreator.java @@ -33,8 +33,8 @@ public BraveTabCreator(Activity activity, WindowAndroid nativeWindow, StartupTabPreloader startupTabPreloader, Supplier tabDelegateFactory, boolean incognito, OverviewNTPCreator overviewNTPCreator, AsyncTabParamsManager asyncTabParamsManager, - ObservableSupplier tabModelSelectorSupplier, - ObservableSupplier compositorViewHolderSupplier) { + Supplier tabModelSelectorSupplier, + Supplier compositorViewHolderSupplier) { super(activity, nativeWindow, startupTabPreloader, tabDelegateFactory, incognito, overviewNTPCreator, asyncTabParamsManager, tabModelSelectorSupplier, compositorViewHolderSupplier); diff --git a/android/java/org/chromium/chrome/browser/toolbar/BraveToolbarManager.java b/android/java/org/chromium/chrome/browser/toolbar/BraveToolbarManager.java index 0dd421a85c63..7650186b43c1 100644 --- a/android/java/org/chromium/chrome/browser/toolbar/BraveToolbarManager.java +++ b/android/java/org/chromium/chrome/browser/toolbar/BraveToolbarManager.java @@ -18,6 +18,7 @@ import org.chromium.base.ApiCompatibilityUtils; import org.chromium.base.Callback; import org.chromium.base.CallbackController; +import org.chromium.base.jank_tracker.JankTracker; import org.chromium.base.supplier.ObservableSupplier; import org.chromium.base.supplier.ObservableSupplierImpl; import org.chromium.base.supplier.OneshotSupplier; @@ -152,7 +153,7 @@ public BraveToolbarManager(AppCompatActivity activity, BrowserControlsSizer cont @NonNull TabContentManager tabContentManager, @NonNull TabCreatorManager tabCreatorManager, @NonNull OneshotSupplier overviewModeBehaviorSupplier, - @NonNull SnackbarManager snackbarManager) { + @NonNull SnackbarManager snackbarManager, JankTracker jankTracker) { super(activity, controlsSizer, fullscreenManager, controlContainer, compositorViewHolder, urlFocusChangedCallback, topUiThemeColorProvider, tabObscuringHandler, shareDelegateSupplier, identityDiscController, buttonDataProviders, tabProvider, @@ -164,7 +165,7 @@ public BraveToolbarManager(AppCompatActivity activity, BrowserControlsSizer cont isInOverviewModeSupplier, modalDialogManagerSupplier, statusBarColorController, appMenuDelegate, activityLifecycleDispatcher, startSurfaceParentTabSupplier, bottomSheetController, isWarmOnResumeSupplier, tabContentManager, tabCreatorManager, - overviewModeBehaviorSupplier, snackbarManager); + overviewModeBehaviorSupplier, snackbarManager, jankTracker); mOmniboxFocusStateSupplier = omniboxFocusStateSupplier; mLayoutStateProviderSupplier = layoutStateProviderSupplier; mActivity = activity; diff --git a/android/java/org/chromium/chrome/browser/toolbar/bottom/BrowsingModeBottomToolbarCoordinator.java b/android/java/org/chromium/chrome/browser/toolbar/bottom/BrowsingModeBottomToolbarCoordinator.java index df3dcc90cc23..83a3e2cf4d41 100644 --- a/android/java/org/chromium/chrome/browser/toolbar/bottom/BrowsingModeBottomToolbarCoordinator.java +++ b/android/java/org/chromium/chrome/browser/toolbar/bottom/BrowsingModeBottomToolbarCoordinator.java @@ -14,11 +14,13 @@ import org.chromium.base.supplier.ObservableSupplier; import org.chromium.base.supplier.OneShotCallback; import org.chromium.base.supplier.OneshotSupplier; +import org.chromium.base.supplier.Supplier; import org.chromium.chrome.R; import org.chromium.chrome.browser.ActivityTabProvider; import org.chromium.chrome.browser.app.BraveActivity; import org.chromium.chrome.browser.compositor.layouts.OverviewModeBehavior; import org.chromium.chrome.browser.feature_engagement.TrackerFactory; +import org.chromium.chrome.browser.omaha.UpdateMenuItemHelper; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabImpl; @@ -30,7 +32,9 @@ import org.chromium.chrome.browser.toolbar.TabCountProvider; import org.chromium.chrome.browser.toolbar.TabSwitcherButtonCoordinator; import org.chromium.chrome.browser.toolbar.TabSwitcherButtonView; +import org.chromium.chrome.browser.toolbar.menu_button.BraveMenuButtonCoordinator; import org.chromium.chrome.browser.toolbar.menu_button.MenuButton; +import org.chromium.chrome.browser.toolbar.menu_button.MenuButtonState; import org.chromium.chrome.browser.ui.appmenu.AppMenuButtonHelper; import org.chromium.components.feature_engagement.FeatureConstants; import org.chromium.components.feature_engagement.Tracker; @@ -157,8 +161,13 @@ public class BrowsingModeBottomToolbarCoordinator { } mMenuButton = mToolbarRoot.findViewById(R.id.menu_button_wrapper); - if (!BottomToolbarVariationManager.isMenuButtonOnBottom()) { - mMenuButton.setVisibility(View.GONE); + if (mMenuButton != null) { + Supplier menuButtonStateSupplier = + () -> UpdateMenuItemHelper.getInstance().getUiState().buttonState; + BraveMenuButtonCoordinator.setupPropertyModel(mMenuButton, menuButtonStateSupplier); + if (!BottomToolbarVariationManager.isMenuButtonOnBottom()) { + mMenuButton.setVisibility(View.GONE); + } } } diff --git a/android/java/org/chromium/chrome/browser/toolbar/bottom/TabSwitcherBottomToolbarCoordinator.java b/android/java/org/chromium/chrome/browser/toolbar/bottom/TabSwitcherBottomToolbarCoordinator.java index 4dfb3c410f27..c57f8bfc506e 100644 --- a/android/java/org/chromium/chrome/browser/toolbar/bottom/TabSwitcherBottomToolbarCoordinator.java +++ b/android/java/org/chromium/chrome/browser/toolbar/bottom/TabSwitcherBottomToolbarCoordinator.java @@ -14,11 +14,15 @@ import org.chromium.base.ApiCompatibilityUtils; import org.chromium.base.supplier.ObservableSupplier; import org.chromium.base.supplier.OneShotCallback; +import org.chromium.base.supplier.Supplier; import org.chromium.chrome.R; +import org.chromium.chrome.browser.omaha.UpdateMenuItemHelper; import org.chromium.chrome.browser.tabmodel.IncognitoStateProvider; import org.chromium.chrome.browser.theme.ThemeColorProvider; import org.chromium.chrome.browser.toolbar.TabCountProvider; +import org.chromium.chrome.browser.toolbar.menu_button.BraveMenuButtonCoordinator; import org.chromium.chrome.browser.toolbar.menu_button.MenuButton; +import org.chromium.chrome.browser.toolbar.menu_button.MenuButtonState; import org.chromium.chrome.browser.ui.appmenu.AppMenuButtonHelper; import org.chromium.ui.modelutil.PropertyModelChangeProcessor; @@ -85,6 +89,11 @@ public class TabSwitcherBottomToolbarCoordinator { mNewTabButton.setThemeColorProvider(themeColorProvider); mMenuButton = root.findViewById(R.id.menu_button_wrapper); + if (mMenuButton != null) { + Supplier menuButtonStateSupplier = + () -> UpdateMenuItemHelper.getInstance().getUiState().buttonState; + BraveMenuButtonCoordinator.setupPropertyModel(mMenuButton, menuButtonStateSupplier); + } new OneShotCallback<>(menuButtonHelperSupplier, (menuButtonHelper) -> { assert menuButtonHelper != null; diff --git a/android/java/org/chromium/chrome/browser/toolbar/menu_button/BraveMenuButtonCoordinator.java b/android/java/org/chromium/chrome/browser/toolbar/menu_button/BraveMenuButtonCoordinator.java index 7f15de3bc577..2ac3e583ea2a 100644 --- a/android/java/org/chromium/chrome/browser/toolbar/menu_button/BraveMenuButtonCoordinator.java +++ b/android/java/org/chromium/chrome/browser/toolbar/menu_button/BraveMenuButtonCoordinator.java @@ -18,9 +18,11 @@ import org.chromium.chrome.R; import org.chromium.chrome.browser.browser_controls.BrowserStateBrowserControlsVisibilityDelegate; import org.chromium.chrome.browser.theme.ThemeColorProvider; -import org.chromium.chrome.browser.toolbar.top.BraveToolbarLayout; +import org.chromium.chrome.browser.toolbar.top.BraveToolbarLayoutImpl; import org.chromium.chrome.browser.ui.appmenu.AppMenuCoordinator; import org.chromium.ui.base.WindowAndroid; +import org.chromium.ui.modelutil.PropertyModel; +import org.chromium.ui.modelutil.PropertyModelChangeProcessor; public class BraveMenuButtonCoordinator extends MenuButtonCoordinator { private static final String BRAVE_IS_MENU_FROM_BOTTOM = "brave_is_menu_from_bottom"; @@ -33,10 +35,12 @@ public BraveMenuButtonCoordinator( WindowAndroid windowAndroid, SetFocusFunction setUrlBarFocusFunction, Runnable requestRenderRunnable, boolean shouldShowAppUpdateBadge, Supplier isInOverviewModeSupplier, ThemeColorProvider themeColorProvider, + Supplier menuButtonStateSupplier, Runnable onMenuButtonClicked, @IdRes int menuButtonId) { super(appMenuCoordinatorSupplier, controlsVisibilityDelegate, windowAndroid, setUrlBarFocusFunction, requestRenderRunnable, shouldShowAppUpdateBadge, - isInOverviewModeSupplier, themeColorProvider, menuButtonId); + isInOverviewModeSupplier, themeColorProvider, menuButtonStateSupplier, + onMenuButtonClicked, menuButtonId); mActivity = windowAndroid.getActivity().get(); } @@ -60,7 +64,8 @@ public void setVisibility(boolean visible) { } private void updateMenuButtonState() { - BraveToolbarLayout layout = (BraveToolbarLayout) mActivity.findViewById(R.id.toolbar); + BraveToolbarLayoutImpl layout = + (BraveToolbarLayoutImpl) mActivity.findViewById(R.id.toolbar); assert layout != null; if (layout != null) { layout.updateMenuButtonState(); @@ -76,4 +81,14 @@ public static boolean isMenuFromBottom() { SharedPreferences sharedPreferences = ContextUtils.getAppSharedPreferences(); return sharedPreferences.getBoolean(BRAVE_IS_MENU_FROM_BOTTOM, true); } + + public static void setupPropertyModel( + MenuButton menuButton, Supplier menuButtonStateSupplier) { + PropertyModel menuButtonPropertyModel = + new PropertyModel.Builder(MenuButtonProperties.ALL_KEYS) + .with(MenuButtonProperties.STATE_SUPPLIER, menuButtonStateSupplier) + .build(); + PropertyModelChangeProcessor.create( + menuButtonPropertyModel, menuButton, new MenuButtonViewBinder()); + } } diff --git a/android/java/org/chromium/chrome/browser/toolbar/top/BraveTabSwitcherModeTTCoordinatorPhone.java b/android/java/org/chromium/chrome/browser/toolbar/top/BraveTabSwitcherModeTTCoordinatorPhone.java index bc8555ace87a..cb92dabd4394 100644 --- a/android/java/org/chromium/chrome/browser/toolbar/top/BraveTabSwitcherModeTTCoordinatorPhone.java +++ b/android/java/org/chromium/chrome/browser/toolbar/top/BraveTabSwitcherModeTTCoordinatorPhone.java @@ -7,6 +7,7 @@ import android.view.ViewStub; +import org.chromium.base.supplier.BooleanSupplier; import org.chromium.chrome.browser.toolbar.menu_button.MenuButtonCoordinator; class BraveTabSwitcherModeTTCoordinatorPhone extends TabSwitcherModeTTCoordinatorPhone { @@ -17,9 +18,10 @@ class BraveTabSwitcherModeTTCoordinatorPhone extends TabSwitcherModeTTCoordinato BraveTabSwitcherModeTTCoordinatorPhone(ViewStub tabSwitcherToolbarStub, MenuButtonCoordinator menuButtonCoordinator, boolean isGridTabSwitcherEnabled, - boolean isTabToGtsAnimationEnabled, boolean isStartSurfaceEnabled) { + boolean isTabToGtsAnimationEnabled, boolean isStartSurfaceEnabled, + BooleanSupplier isIncognitoModeEnabledSupplier) { super(tabSwitcherToolbarStub, menuButtonCoordinator, isGridTabSwitcherEnabled, - isTabToGtsAnimationEnabled, isStartSurfaceEnabled); + isTabToGtsAnimationEnabled, isStartSurfaceEnabled, isIncognitoModeEnabledSupplier); mBraveMenuButtonCoordinator = menuButtonCoordinator; } diff --git a/android/java/org/chromium/chrome/browser/toolbar/top/BraveToolbarLayout.java b/android/java/org/chromium/chrome/browser/toolbar/top/BraveToolbarLayoutImpl.java similarity index 96% rename from android/java/org/chromium/chrome/browser/toolbar/top/BraveToolbarLayout.java rename to android/java/org/chromium/chrome/browser/toolbar/top/BraveToolbarLayoutImpl.java index ce9a6ca53bc8..ddaa58324c55 100644 --- a/android/java/org/chromium/chrome/browser/toolbar/top/BraveToolbarLayout.java +++ b/android/java/org/chromium/chrome/browser/toolbar/top/BraveToolbarLayoutImpl.java @@ -53,6 +53,7 @@ import org.chromium.base.MathUtils; import org.chromium.base.ThreadUtils; import org.chromium.base.supplier.BooleanSupplier; +import org.chromium.base.supplier.ObservableSupplier; import org.chromium.base.task.AsyncTask; import org.chromium.chrome.R; import org.chromium.chrome.browser.BraveAdsNativeHelper; @@ -104,7 +105,9 @@ import org.chromium.chrome.browser.toolbar.bottom.BottomToolbarVariationManager; import org.chromium.chrome.browser.toolbar.menu_button.BraveMenuButtonCoordinator; import org.chromium.chrome.browser.toolbar.menu_button.MenuButtonCoordinator; +import org.chromium.chrome.browser.toolbar.top.NavigationPopup.HistoryDelegate; import org.chromium.chrome.browser.toolbar.top.ToolbarLayout; +import org.chromium.chrome.browser.toolbar.top.ToolbarTablet.OfflineDownloader; import org.chromium.chrome.browser.util.PackageUtils; import org.chromium.components.browser_ui.styles.ChromeColors; import org.chromium.components.embedder_support.util.UrlConstants; @@ -124,9 +127,9 @@ import java.util.List; import java.util.Locale; -public abstract class BraveToolbarLayout extends ToolbarLayout - implements OnClickListener, View.OnLongClickListener, BraveRewardsObserver, - BraveRewardsNativeWorker.PublisherObserver { +public abstract class BraveToolbarLayoutImpl extends ToolbarLayout + implements BraveToolbarLayout, OnClickListener, View.OnLongClickListener, + BraveRewardsObserver, BraveRewardsNativeWorker.PublisherObserver { public static final String PREF_HIDE_BRAVE_REWARDS_ICON = "hide_brave_rewards_icon"; private static final String JAPAN_COUNTRY_CODE = "JP"; private static final long MB_10 = 10000000; @@ -160,7 +163,7 @@ public abstract class BraveToolbarLayout extends ToolbarLayout private boolean mIsBottomToolbarVisible; - public BraveToolbarLayout(Context context, AttributeSet attrs) { + public BraveToolbarLayoutImpl(Context context, AttributeSet attrs) { super(context, attrs); } @@ -181,7 +184,7 @@ void destroy() { protected void onFinishInflate() { super.onFinishInflate(); - if (this instanceof ToolbarTablet) { + if (BraveReflectionUtil.EqualTypes(this.getClass(), ToolbarTablet.class)) { ImageButton forwardButton = findViewById(R.id.forward_button); if (forwardButton != null) { final Drawable forwardButtonDrawable = UiUtils.getTintedDrawable(getContext(), @@ -248,7 +251,7 @@ public void blockEvent(int tabId, String block_type, String subresource) { && (block_type.equals(BraveShieldsContentSettings.RESOURCE_IDENTIFIER_ADS) || block_type.equals(BraveShieldsContentSettings .RESOURCE_IDENTIFIER_TRACKERS))) { - addStatsToDb(block_type, subresource, currentTab.getUrlString()); + addStatsToDb(block_type, subresource, currentTab.getUrl().getSpec()); } } @@ -382,11 +385,11 @@ public void onDidFinishNavigation(Tab tab, NavigationHandle navigation) { if (getToolbarDataProvider().getTab() == tab && mBraveRewardsNativeWorker != null && !tab.isIncognito()) { mBraveRewardsNativeWorker.OnNotifyFrontTabUrlChanged( - tab.getId(), tab.getUrlString()); + tab.getId(), tab.getUrl().getSpec()); } - if (PackageUtils.isFirstInstall(getContext()) && tab.getUrlString() != null - && (tab.getUrlString().equals(BraveActivity.REWARDS_SETTINGS_URL) - || tab.getUrlString().equals( + if (PackageUtils.isFirstInstall(getContext()) && tab.getUrl().getSpec() != null + && (tab.getUrl().getSpec().equals(BraveActivity.REWARDS_SETTINGS_URL) + || tab.getUrl().getSpec().equals( BraveActivity.BRAVE_REWARDS_SETTINGS_URL)) && !BraveAdsNativeHelper.nativeIsBraveAdsEnabled( Profile.getLastUsedRegularProfile()) @@ -410,7 +413,7 @@ public void didSelectTab(Tab tab, @TabSelectionType int type, int lastId) { if (getToolbarDataProvider().getTab() == tab && mBraveRewardsNativeWorker != null && !tab.isIncognito()) { mBraveRewardsNativeWorker.OnNotifyFrontTabUrlChanged( - tab.getId(), tab.getUrlString()); + tab.getId(), tab.getUrl().getSpec()); } } }; @@ -426,7 +429,7 @@ private void checkForTooltip(Tab tab) { BraveShieldsUtils.PREF_SHIELDS_TOOLTIP); } else if (!BraveShieldsUtils.hasShieldsTooltipShown( BraveShieldsUtils.PREF_SHIELDS_VIDEO_ADS_BLOCKED_TOOLTIP) - && shouldShowVideoTooltip(tab.getUrlString())) { + && shouldShowVideoTooltip(tab.getUrl().getSpec())) { showTooltip(ShieldsTooltipEnum.VIDEO_ADS_BLOCKED_TOOLTIP, BraveShieldsUtils.PREF_SHIELDS_VIDEO_ADS_BLOCKED_TOOLTIP); } else if (!BraveShieldsUtils.hasShieldsTooltipShown( @@ -469,7 +472,7 @@ private void chooseStatsShareTier(Tab tab, int trackersPlusAdsBlocked) { || BraveActivity.getBraveActivity() == null || BraveActivity.getBraveActivity().getActivityTab() == null || UrlUtilities.isNTPUrl( - BraveActivity.getBraveActivity().getActivityTab().getUrlString())) { + BraveActivity.getBraveActivity().getActivityTab().getUrl().getSpec())) { return; } @@ -839,10 +842,6 @@ public void hideRewardsOnboardingIcon() { } @Override - public void onClick(View v) { - onClickImpl(v); - } - public void onClickImpl(View v) { if (mBraveShieldsHandler == null) { assert false; @@ -881,6 +880,11 @@ public void onClickImpl(View v) { } } + @Override + public void onClick(View v) { + onClickImpl(v); + } + private boolean checkForRewardsOnboarding() { return PackageUtils.isFirstInstall(getContext()) && !BraveAdsNativeHelper.nativeIsBraveAdsEnabled( @@ -895,7 +899,7 @@ private void showShieldsMenu(View mBraveShieldsButton) { return; } try { - URL url = new URL(currentTab.getUrlString()); + URL url = new URL(currentTab.getUrl().getSpec()); // Don't show shields popup if protocol is not valid for shields. if (!isValidProtocolForShields(url.getProtocol())) { return; @@ -909,7 +913,7 @@ private void showShieldsMenu(View mBraveShieldsButton) { } @Override - public boolean onLongClick(View v) { + public boolean onLongClickImpl(View v) { // Use null as the default description since Toast.showAnchoredToast // will return false if it is null. String description = null; @@ -927,6 +931,11 @@ public boolean onLongClick(View v) { return Toast.showAnchoredToast(context, v, description); } + @Override + public boolean onLongClick(View v) { + return onLongClickImpl(v); + } + @Override public void onUrlFocusChange(boolean hasFocus) { Context context = getContext(); @@ -934,7 +943,7 @@ public void onUrlFocusChange(boolean hasFocus) { && BraveActivity.getBraveActivity() != null && BraveActivity.getBraveActivity().getActivityTab() != null && UrlUtilities.isNTPUrl( - BraveActivity.getBraveActivity().getActivityTab().getUrlString()) + BraveActivity.getBraveActivity().getActivityTab().getUrl().getSpec()) && !OnboardingPrefManager.getInstance().hasSearchEngineOnboardingShown()) { Intent searchActivityIntent = new Intent(context, SearchActivity.class); context.startActivity(searchActivityIntent); @@ -942,7 +951,8 @@ public void onUrlFocusChange(boolean hasFocus) { super.onUrlFocusChange(hasFocus); } - public void populateUrlAnimatorSet(boolean showExpandedState, + @Override + public void populateUrlAnimatorSetImpl(boolean showExpandedState, int urlFocusToolbarButtonsDuration, int urlClearFocusTabStackDelayMs, List animators) { if (mBraveShieldsButton != null) { @@ -979,10 +989,7 @@ public void populateUrlAnimatorSet(boolean showExpandedState, } } - private void updateModernLocationBarColor(int color) { - updateModernLocationBarColorImpl(color); - } - + @Override public void updateModernLocationBarColorImpl(int color) { if (mShieldsLayout != null && mShieldsLayoutIsColorBackground) { mShieldsLayout.setBackgroundColor( @@ -997,7 +1004,8 @@ public void updateModernLocationBarColorImpl(int color) { } } - public int getBoundsAfterAccountingForRightButtons(ViewGroup toolbarButtonsContainer) { + @Override + public int getBoundsAfterAccountingForRightButtonsImpl(ViewGroup toolbarButtonsContainer) { if (toolbarButtonsContainer == null || mShieldsLayout == null) { assert false; return 0; @@ -1052,7 +1060,7 @@ private boolean isShieldsOnForTab(Tab tab) { return false; } return BraveShieldsContentSettings.getShields( - Profile.fromWebContents(((TabImpl) tab).getWebContents()), tab.getUrlString(), + Profile.fromWebContents(((TabImpl) tab).getWebContents()), tab.getUrl().getSpec(), BraveShieldsContentSettings.RESOURCE_IDENTIFIER_BRAVE_SHIELDS); } @@ -1184,7 +1192,7 @@ private void updateNotificationBadgeForNewInstall() { public void onThemeColorChanged(int color, boolean shouldAnimate) { final int textBoxColor = ThemeUtils.getTextBoxColorForToolbarBackgroundInNonNativePage( getContext().getResources(), color, isIncognito()); - updateModernLocationBarColor(textBoxColor); + updateModernLocationBarColorImpl(textBoxColor); } /** @@ -1230,7 +1238,10 @@ && getMenuButtonCoordinator() != null) { } private void updateShieldsLayoutBackground(boolean rounded) { - if (!(this instanceof ToolbarTablet) || (mShieldsLayout == null)) return; + if (!BraveReflectionUtil.EqualTypes(this.getClass(), ToolbarTablet.class) + || (mShieldsLayout == null)) { + return; + } if (rounded) { mShieldsLayout.setBackgroundDrawable( @@ -1242,7 +1253,7 @@ private void updateShieldsLayoutBackground(boolean rounded) { ChromeColors.getDefaultThemeColor(getContext().getResources(), isIncognito())); mShieldsLayoutIsColorBackground = true; } - updateModernLocationBarColor(mCurrentToolbarColor); + updateModernLocationBarColorImpl(mCurrentToolbarColor); } private boolean isTabSwitcherOnBottom() { @@ -1256,8 +1267,12 @@ private boolean isMenuButtonOnBottom() { @Override protected void initialize(ToolbarDataProvider toolbarDataProvider, ToolbarTabController tabController, MenuButtonCoordinator menuButtonCoordinator, - BooleanSupplier isInVrSupplier) { - super.initialize(toolbarDataProvider, tabController, menuButtonCoordinator, isInVrSupplier); + ObservableSupplier isProgressBarVisibleSupplier, + HistoryDelegate historyDelegate, BooleanSupplier partnerHomepageEnabledSupplier, + OfflineDownloader offlineDownloader) { + super.initialize(toolbarDataProvider, tabController, menuButtonCoordinator, + isProgressBarVisibleSupplier, historyDelegate, partnerHomepageEnabledSupplier, + offlineDownloader); BraveMenuButtonCoordinator.setMenuFromBottom(isMenuButtonOnBottom()); } diff --git a/android/java/org/chromium/chrome/browser/toolbar/top/BraveTopToolbarCoordinator.java b/android/java/org/chromium/chrome/browser/toolbar/top/BraveTopToolbarCoordinator.java index 9fbccd9fe112..fe65a8c19a14 100644 --- a/android/java/org/chromium/chrome/browser/toolbar/top/BraveTopToolbarCoordinator.java +++ b/android/java/org/chromium/chrome/browser/toolbar/top/BraveTopToolbarCoordinator.java @@ -22,6 +22,8 @@ import org.chromium.chrome.browser.toolbar.ToolbarDataProvider; import org.chromium.chrome.browser.toolbar.ToolbarTabController; import org.chromium.chrome.browser.toolbar.menu_button.MenuButtonCoordinator; +import org.chromium.chrome.browser.toolbar.top.NavigationPopup.HistoryDelegate; +import org.chromium.chrome.browser.toolbar.top.ToolbarTablet.OfflineDownloader; import org.chromium.chrome.browser.ui.appmenu.AppMenuButtonHelper; import org.chromium.chrome.browser.user_education.UserEducationHelper; import org.chromium.chrome.features.start_surface.StartSurface; @@ -51,10 +53,12 @@ public BraveTopToolbarCoordinator(ToolbarControlContainer controlContainer, ObservableSupplier homepageManagedByPolicySupplier, ObservableSupplier identityDiscStateSupplier, Callback invalidatorCallback, Supplier identityDiscButtonSupplier, - OneshotSupplier startSurfaceSupplier, - Supplier resourceManagerSupplier, BooleanSupplier isInVrSupplier, - boolean isGridTabSwitcherEnabled, boolean isTabToGtsAnimationEnabled, - boolean isStartSurfaceEnabled, boolean isTabGroupsAndroidContinuationEnabled) { + Supplier resourceManagerSupplier, + ObservableSupplier isProgressBarVisibleSupplier, + BooleanSupplier isIncognitoModeEnabledSupplier, boolean isGridTabSwitcherEnabled, + boolean isTabToGtsAnimationEnabled, boolean isStartSurfaceEnabled, + boolean isTabGroupsAndroidContinuationEnabled, HistoryDelegate historyDelegate, + BooleanSupplier partnerHomepageEnabledSupplier, OfflineDownloader offlineDownloader) { super(controlContainer, toolbarLayout, toolbarDataProvider, tabController, userEducationHelper, buttonDataProviders, layoutStateProviderSupplier, normalThemeColorProvider, overviewThemeColorProvider, @@ -62,9 +66,11 @@ public BraveTopToolbarCoordinator(ToolbarControlContainer controlContainer, appMenuButtonHelperSupplier, tabModelSelectorSupplier, homepageEnabledSupplier, startSurfaceAsHomepageSupplier, homepageManagedByPolicySupplier, identityDiscStateSupplier, invalidatorCallback, identityDiscButtonSupplier, - startSurfaceSupplier, resourceManagerSupplier, isInVrSupplier, - isGridTabSwitcherEnabled, isTabToGtsAnimationEnabled, isStartSurfaceEnabled, - isTabGroupsAndroidContinuationEnabled); + resourceManagerSupplier, isProgressBarVisibleSupplier, + isIncognitoModeEnabledSupplier, isGridTabSwitcherEnabled, + isTabToGtsAnimationEnabled, isStartSurfaceEnabled, + isTabGroupsAndroidContinuationEnabled, historyDelegate, + partnerHomepageEnabledSupplier, offlineDownloader); mBraveToolbarLayout = toolbarLayout; @@ -73,14 +79,16 @@ public BraveTopToolbarCoordinator(ToolbarControlContainer controlContainer, mTabSwitcherModeCoordinatorPhone = new BraveTabSwitcherModeTTCoordinatorPhone( controlContainer.getRootView().findViewById(R.id.tab_switcher_toolbar_stub), overviewModeMenuButtonCoordinator, isGridTabSwitcherEnabled, - isTabToGtsAnimationEnabled, isStartSurfaceEnabled); + isTabToGtsAnimationEnabled, isStartSurfaceEnabled, + isIncognitoModeEnabledSupplier); } } } public void onBottomToolbarVisibilityChanged(boolean isVisible) { if (mBraveToolbarLayout instanceof BraveToolbarLayout) { - ((BraveToolbarLayout) mBraveToolbarLayout).onBottomToolbarVisibilityChanged(isVisible); + ((BraveToolbarLayoutImpl) mBraveToolbarLayout) + .onBottomToolbarVisibilityChanged(isVisible); } if (mTabSwitcherModeCoordinatorPhone instanceof BraveTabSwitcherModeTTCoordinatorPhone) { ((BraveTabSwitcherModeTTCoordinatorPhone) mTabSwitcherModeCoordinatorPhone) diff --git a/android/java/res/values/brave_colors.xml b/android/java/res/values/brave_colors.xml index 155cdb4b8d68..ec04f3a47a73 100644 --- a/android/java/res/values/brave_colors.xml +++ b/android/java/res/values/brave_colors.xml @@ -9,11 +9,16 @@ + #F9C3B6 + #FF7654 + #EA3A0D + @color/modern_blue_600 + @color/modern_blue_700 + #4D000000 + #80000000 #FF7654 #EA3A0D #C22700 - #4D000000 - #80000000 #fb542b diff --git a/android/javatests/org/chromium/chrome/browser/BytecodeTest.java b/android/javatests/org/chromium/chrome/browser/BytecodeTest.java index b42c3ce32a96..367cd7fad663 100644 --- a/android/javatests/org/chromium/chrome/browser/BytecodeTest.java +++ b/android/javatests/org/chromium/chrome/browser/BytecodeTest.java @@ -19,6 +19,8 @@ import org.junit.runner.RunWith; import org.chromium.base.Callback; +import org.chromium.base.jank_tracker.JankTracker; +import org.chromium.base.supplier.BooleanSupplier; import org.chromium.base.supplier.ObservableSupplier; import org.chromium.base.supplier.ObservableSupplierImpl; import org.chromium.base.supplier.OneshotSupplier; @@ -26,6 +28,7 @@ import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.browser_controls.BrowserControlsSizer; import org.chromium.chrome.browser.browser_controls.BrowserControlsStateProvider; +import org.chromium.chrome.browser.browser_controls.BrowserStateBrowserControlsVisibilityDelegate; import org.chromium.chrome.browser.compositor.CompositorViewHolder; import org.chromium.chrome.browser.compositor.layouts.content.TabContentManager; import org.chromium.chrome.browser.feed.webfeed.WebFeedBridge; @@ -41,6 +44,8 @@ import org.chromium.chrome.browser.omnibox.SearchEngineLogoUtils; import org.chromium.chrome.browser.omnibox.UrlBarEditingTextStateProvider; import org.chromium.chrome.browser.omnibox.status.PageInfoIPHController; +import org.chromium.chrome.browser.omnibox.suggestions.SuggestionHost; +import org.chromium.chrome.browser.omnibox.suggestions.UrlBarDelegate; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tabmodel.AsyncTabParamsManager; import org.chromium.chrome.browser.tabmodel.ChromeTabCreator; @@ -48,14 +53,21 @@ import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.theme.ThemeColorProvider; import org.chromium.chrome.browser.theme.TopUiThemeColorProvider; +import org.chromium.chrome.browser.toolbar.ToolbarDataProvider; import org.chromium.chrome.browser.toolbar.ToolbarManager; +import org.chromium.chrome.browser.toolbar.ToolbarTabController; +import org.chromium.chrome.browser.toolbar.menu_button.MenuButtonCoordinator; +import org.chromium.chrome.browser.toolbar.top.NavigationPopup.HistoryDelegate; import org.chromium.chrome.browser.toolbar.top.ToolbarActionModeCallback; import org.chromium.chrome.browser.toolbar.top.ToolbarControlContainer; +import org.chromium.chrome.browser.toolbar.top.ToolbarLayout; +import org.chromium.chrome.browser.toolbar.top.ToolbarTablet.OfflineDownloader; 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.native_page.NativePageHost; import org.chromium.chrome.browser.ui.system.StatusBarColorController; +import org.chromium.chrome.browser.user_education.UserEducationHelper; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; import org.chromium.components.browser_ui.widget.scrim.ScrimCoordinator; @@ -86,6 +98,8 @@ public void testClassesExist() throws Exception { Assert.assertTrue(classExists("org/chromium/chrome/browser/LaunchIntentDispatcher")); Assert.assertTrue(classExists("org/chromium/chrome/browser/ntp/NewTabPageLayout")); Assert.assertTrue(classExists("org/chromium/chrome/browser/feed/FeedSurfaceCoordinator")); + Assert.assertTrue( + classExists("org/chromium/chrome/browser/feed/BraveFeedSurfaceCoordinator")); Assert.assertTrue(classExists("org/chromium/chrome/browser/ntp/NewTabPage")); Assert.assertTrue(classExists("org/chromium/chrome/browser/ntp/BraveNewTabPage")); Assert.assertTrue(classExists( @@ -104,6 +118,8 @@ public void testClassesExist() throws Exception { Assert.assertTrue(classExists("org/chromium/chrome/browser/toolbar/BraveToolbarManager")); Assert.assertTrue( classExists("org/chromium/chrome/browser/toolbar/top/TopToolbarCoordinator")); + Assert.assertTrue( + classExists("org/chromium/chrome/browser/toolbar/top/BraveTopToolbarCoordinator")); Assert.assertTrue(classExists( "org/chromium/chrome/browser/toolbar/top/TabSwitcherModeTTCoordinatorPhone")); Assert.assertTrue( @@ -175,6 +191,10 @@ public void testClassesExist() throws Exception { Assert.assertTrue(classExists("org/chromium/chrome/browser/omnibox/status/StatusMediator")); Assert.assertTrue( classExists("org/chromium/chrome/browser/omnibox/status/BraveStatusMediator")); + Assert.assertTrue(classExists( + "org/chromium/chrome/browser/toolbar/menu_button/MenuButtonCoordinator")); + Assert.assertTrue(classExists( + "org/chromium/chrome/browser/toolbar/menu_button/BraveMenuButtonCoordinator")); } @Test @@ -261,6 +281,16 @@ public void testMethodsExist() throws Exception { Assert.assertTrue(methodExists( "org/chromium/chrome/browser/tasks/tab_management/BraveTabUiFeatureUtilities", "isTabGroupsAndroidEnabled", false, null)); + Assert.assertTrue(methodExists("org/chromium/chrome/browser/feed/FeedSurfaceCoordinator", + "isEnhancedProtectionPromoEnabled", false, null)); + Assert.assertTrue(methodExists("org/chromium/chrome/browser/feed/FeedSurfaceCoordinator", + "isReliabilityLoggingEnabled", false, null)); + Assert.assertTrue( + methodExists("org/chromium/chrome/browser/feed/BraveFeedSurfaceCoordinator", + "isEnhancedProtectionPromoEnabled", false, null)); + Assert.assertTrue( + methodExists("org/chromium/chrome/browser/feed/BraveFeedSurfaceCoordinator", + "isReliabilityLoggingEnabled", false, null)); } @Test @@ -284,12 +314,12 @@ public void testConstructorsExistAndMatch() throws Exception { TabModelSelector.class, ToolbarManager.class, View.class, AppMenuDelegate.class, OneshotSupplier.class, ObservableSupplier.class, WebFeedSnackbarController.FeedLauncher.class, ModalDialogManager.class, - SnackbarManager.class, WebFeedBridge.class)); + SnackbarManager.class)); Assert.assertTrue(constructorsMatch("org/chromium/chrome/browser/tabmodel/ChromeTabCreator", "org/chromium/chrome/browser/tabmodel/BraveTabCreator", Activity.class, WindowAndroid.class, StartupTabPreloader.class, Supplier.class, boolean.class, ChromeTabCreator.OverviewNTPCreator.class, AsyncTabParamsManager.class, - ObservableSupplier.class, ObservableSupplier.class)); + Supplier.class, Supplier.class)); Assert.assertTrue(constructorsMatch("org/chromium/chrome/browser/toolbar/ToolbarManager", "org/chromium/chrome/browser/toolbar/BraveToolbarManager", AppCompatActivity.class, BrowserControlsSizer.class, FullscreenManager.class, ToolbarControlContainer.class, @@ -304,7 +334,7 @@ public void testConstructorsExistAndMatch() throws Exception { StatusBarColorController.class, AppMenuDelegate.class, ActivityLifecycleDispatcher.class, Supplier.class, BottomSheetController.class, Supplier.class, TabContentManager.class, TabCreatorManager.class, - OneshotSupplier.class, SnackbarManager.class)); + OneshotSupplier.class, SnackbarManager.class, JankTracker.class)); Assert.assertTrue(constructorsMatch( "org/chromium/chrome/browser/toolbar/bottom/BottomControlsMediator", "org/chromium/chrome/browser/toolbar/bottom/BraveBottomControlsMediator", @@ -348,7 +378,32 @@ public void testConstructorsExistAndMatch() throws Exception { BrowserControlsStateProvider.class, Supplier.class, SnackbarManager.class, ActivityLifecycleDispatcher.class, TabModelSelector.class, boolean.class, NewTabPageUma.class, boolean.class, NativePageHost.class, Tab.class, String.class, - BottomSheetController.class, ObservableSupplier.class, WindowAndroid.class)); + BottomSheetController.class, Supplier.class, WindowAndroid.class, JankTracker.class, + Supplier.class)); + Assert.assertTrue(constructorsMatch( + "org/chromium/chrome/browser/omnibox/suggestions/editurl/EditUrlSuggestionProcessor", + "org/chromium/chrome/browser/omnibox/suggestions/editurl/BraveEditUrlSuggestionProcessor", + Context.class, SuggestionHost.class, UrlBarDelegate.class, Supplier.class, + Supplier.class, Supplier.class)); + Assert.assertTrue(constructorsMatch( + "org/chromium/chrome/browser/toolbar/top/TopToolbarCoordinator", + "org/chromium/chrome/browser/toolbar/top/BraveTopToolbarCoordinator", + ToolbarControlContainer.class, ToolbarLayout.class, ToolbarDataProvider.class, + ToolbarTabController.class, UserEducationHelper.class, List.class, + OneshotSupplier.class, ThemeColorProvider.class, ThemeColorProvider.class, + MenuButtonCoordinator.class, MenuButtonCoordinator.class, ObservableSupplier.class, + ObservableSupplier.class, ObservableSupplier.class, ObservableSupplier.class, + ObservableSupplier.class, ObservableSupplier.class, Callback.class, Supplier.class, + Supplier.class, ObservableSupplier.class, BooleanSupplier.class, boolean.class, + boolean.class, boolean.class, boolean.class, HistoryDelegate.class, + BooleanSupplier.class, OfflineDownloader.class)); + Assert.assertTrue(constructorsMatch( + "org/chromium/chrome/browser/toolbar/menu_button/MenuButtonCoordinator", + "org/chromium/chrome/browser/toolbar/menu_button/BraveMenuButtonCoordinator", + OneshotSupplier.class, BrowserStateBrowserControlsVisibilityDelegate.class, + WindowAndroid.class, MenuButtonCoordinator.SetFocusFunction.class, Runnable.class, + boolean.class, Supplier.class, ThemeColorProvider.class, Supplier.class, + Runnable.class, int.class)); } @Test @@ -364,8 +419,6 @@ public void testFieldsExist() throws Exception { "org/chromium/chrome/browser/ntp/NewTabPageLayout", "mSiteSectionView")); Assert.assertTrue( fieldExists("org/chromium/chrome/browser/ntp/NewTabPageLayout", "mTileGroup")); - Assert.assertTrue(fieldExists( - "org/chromium/chrome/browser/feed/FeedSurfaceCoordinator", "mActivity")); Assert.assertTrue(fieldExists( "org/chromium/chrome/browser/feed/FeedSurfaceCoordinator", "mScrollViewForPolicy")); Assert.assertTrue(fieldExists( @@ -521,9 +574,11 @@ public void testSuperNames() throws Exception { "org/chromium/chrome/browser/suggestions/tile/BraveTileView")); Assert.assertTrue(checkSuperName( "org/chromium/chrome/browser/customtabs/features/toolbar/CustomTabToolbar", - "org/chromium/chrome/browser/toolbar/top/BraveToolbarLayout")); + "org/chromium/chrome/browser/toolbar/top/BraveToolbarLayoutImpl")); Assert.assertTrue(checkSuperName("org/chromium/chrome/browser/toolbar/top/ToolbarPhone", - "org/chromium/chrome/browser/toolbar/top/BraveToolbarLayout")); + "org/chromium/chrome/browser/toolbar/top/BraveToolbarLayoutImpl")); + Assert.assertTrue(checkSuperName("org/chromium/chrome/browser/toolbar/top/ToolbarTablet", + "org/chromium/chrome/browser/toolbar/top/BraveToolbarLayoutImpl")); Assert.assertTrue(checkSuperName( "org/chromium/chrome/browser/compositor/layouts/LayoutManagerChromePhone", "org/chromium/chrome/browser/compositor/layouts/BraveLayoutManagerChrome")); diff --git a/app/DEPS b/app/DEPS index b0fd4d2e75bb..44f89d42b90e 100644 --- a/app/DEPS +++ b/app/DEPS @@ -20,7 +20,7 @@ include_rules = [ "+components/offline_pages/core/offline_page_feature.h", "+components/omnibox/common", "+components/password_manager/core/common", - "+components/safe_browsing/core/features.h", + "+components/safe_browsing/core/common/features.h", "+components/security_state/core/features.h", "+components/signin/public/base", "+components/sync/base/sync_base_switches.h", diff --git a/app/app_management_strings.grdp b/app/app_management_strings.grdp index 636d6aa05668..5cb7cab91822 100644 --- a/app/app_management_strings.grdp +++ b/app/app_management_strings.grdp @@ -25,6 +25,12 @@ Pin to shelf + + Preset window sizes + + + Use presets for phone, tablet, or resizable windows to prevent app from misbehaving + Printers @@ -43,4 +49,19 @@ This app has been installed by your administrator. + + Opening supported links + + + Open in $1Brave browser + + + Open in Brave browser + + + $1Gmail is set to open in a new browser tab, supported links will also open in the browser. + + + Learn more. + diff --git a/app/bookmarks_strings.grdp b/app/bookmarks_strings.grdp index 9b28ac159de5..9c909280e34f 100644 --- a/app/bookmarks_strings.grdp +++ b/app/bookmarks_strings.grdp @@ -180,7 +180,7 @@ Edit bookmark - + Name @@ -234,7 +234,7 @@ - + Name @@ -380,6 +380,12 @@ Import bookmarks + + Importing bookmarks... + + + Bookmarks imported. + Open all diff --git a/app/brave_generated_resources.grd b/app/brave_generated_resources.grd index 6573ec564a78..8bebd8aa0232 100644 --- a/app/brave_generated_resources.grd +++ b/app/brave_generated_resources.grd @@ -807,7 +807,7 @@ By installing this extension, you are agreeing to the Google Widevine Terms of U Method to resolve Unstoppable Domains - <a target="_blank" rel="noopener noreferrer" href="$1">Learn More</a> about DNS over HTTPS and Ethereum privacy considerations. + <a target="_blank" href="$1">Learn More</a> about DNS over HTTPS and Ethereum privacy considerations. Method to resolve Ethereum Name Service (ENS) @@ -876,7 +876,7 @@ By installing this extension, you are agreeing to the Google Widevine Terms of U Node is not launched - IPFS service launch error, more information is available on the <a target="_blank" rel="noopener noreferrer" style="text-decoration: underline;" href="chrome://ipfs-internals/">diagnostic page</a> + IPFS service launch error, more information is available on the <a target="_blank" style="text-decoration: underline;" href="chrome://ipfs-internals/">diagnostic page</a> '$1MyCustomKey' key import failed @@ -912,7 +912,7 @@ By installing this extension, you are agreeing to the Google Widevine Terms of U IPFS public gateway address - <a target="_blank" rel="noopener noreferrer" href="$1">Learn more</a> about IPFS local node and gateway privacy considerations. + <a target="_blank" href="$1">Learn more</a> about IPFS local node and gateway privacy considerations. Change @@ -953,9 +953,6 @@ By installing this extension, you are agreeing to the Google Widevine Terms of U Uses Hangouts component to enable screen sharing and other features in the browser. - - Uses Media Router component to enable Chromecast in the browser. - Your changes will take effect the next time you relaunch Brave. @@ -1332,8 +1329,8 @@ By installing this extension, you are agreeing to the Google Widevine Terms of U - Brave is made available to you under the <a target="_blank" rel="noopener noreferrer" href="$1">Mozilla Public License 2.0</a> (MPL) and includes <a target="_blank" rel="noopener noreferrer" href="$2">open source software</a> under a variety of other licenses. - You can read <a target="_blank" rel="noopener noreferrer" href="$3">instructions on how to download and build for yourself</a> the specific <a target="_blank" rel="noopener noreferrer" href="$4">source code used to create this copy</a>. + Brave is made available to you under the <a target="_blank" href="$1">Mozilla Public License 2.0</a> (MPL) and includes <a target="_blank" href="$2">open source software</a> under a variety of other licenses. + You can read <a target="_blank" href="$3">instructions on how to download and build for yourself</a> the specific <a target="_blank" href="$4">source code used to create this copy</a>. diff --git a/app/brave_main_delegate.cc b/app/brave_main_delegate.cc index 35882b50561c..2f8f9a345f63 100644 --- a/app/brave_main_delegate.cc +++ b/app/brave_main_delegate.cc @@ -207,7 +207,6 @@ bool BraveMainDelegate::BasicStartupComplete(int* exit_code) { autofill::features::kAutofillServerCommunication.name, blink::features::kFledgeInterestGroupAPI.name, blink::features::kFledgeInterestGroups.name, - blink::features::kHandwritingRecognitionWebPlatformApi.name, blink::features::kHandwritingRecognitionWebPlatformApiFinch.name, blink::features::kInterestCohortAPIOriginTrial.name, blink::features::kInterestCohortFeaturePolicy.name, @@ -235,8 +234,6 @@ bool BraveMainDelegate::BasicStartupComplete(int* exit_code) { offline_pages::kPrefetchingOfflinePagesFeature.name, signin::kMobileIdentityConsistency.name, translate::kTranslate.name, -#else - kEnableProfilePickerOnStartupFeature.name, #endif }; diff --git a/app/brave_main_delegate_browsertest.cc b/app/brave_main_delegate_browsertest.cc index b78671dc88a5..d44845424dc5 100644 --- a/app/brave_main_delegate_browsertest.cc +++ b/app/brave_main_delegate_browsertest.cc @@ -73,7 +73,6 @@ IN_PROC_BROWSER_TEST_F(BraveMainDelegateBrowserTest, DisabledFeatures) { &autofill::features::kAutofillServerCommunication, &blink::features::kFledgeInterestGroupAPI, &blink::features::kFledgeInterestGroups, - &blink::features::kHandwritingRecognitionWebPlatformApi, &blink::features::kHandwritingRecognitionWebPlatformApiFinch, &blink::features::kInterestCohortAPIOriginTrial, &blink::features::kInterestCohortFeaturePolicy, @@ -89,9 +88,6 @@ IN_PROC_BROWSER_TEST_F(BraveMainDelegateBrowserTest, DisabledFeatures) { &features::kWebOTP, &federated_learning::kFederatedLearningOfCohorts, &federated_learning::kFlocIdComputedEventLogging, -#if !defined(OS_ANDROID) - &kEnableProfilePickerOnStartupFeature, -#endif &media::kLiveCaption, &net::features::kFirstPartySets, &network::features::kTrustTokens, diff --git a/app/brave_strings.grd b/app/brave_strings.grd index 996abf0dee38..9d514230b741 100644 --- a/app/brave_strings.grd +++ b/app/brave_strings.grd @@ -291,10 +291,10 @@ If you update this file, be sure also to update google_chrome_strings.grd. --> - Chrome OS is made possible by additional <a target="_blank" rel="noopener noreferrer" href="$1">open source software</a>. + Chrome OS is made possible by additional <a target="_blank" href="$1">open source software</a>. - Chrome OS is made possible by additional <a target="_blank" rel="noopener noreferrer" href="$1">open source software</a>, as is <a target="_blank" rel="noopener noreferrer" href="$2">Linux development environment</a>. + Chrome OS is made possible by additional <a target="_blank" href="$1">open source software</a>, as is <a target="_blank" href="$2">Linux development environment</a>. Not used in Brave. Placeholder to keep resource maps in sync. @@ -536,7 +536,7 @@ Brave is unable to recover your settings. - Brave recommends that you don't download or open this file. + Brave recommends that you don't download or open this file @@ -734,15 +734,9 @@ Brave is unable to recover your settings. - + Continue in a new Brave profile? - - Move account to a new Brave profile? - - - Separate Brave profile? - Switch to existing Brave profile? @@ -1091,9 +1085,45 @@ Brave is unable to recover your settings. Install Chrome OS + Install Chrome OS + + Installing Chrome OS will overwrite all data on your device. + + + <p>Before we get started, please ensure that you have an up-to-date backup of your data. Installing Chrome OS will overwrite all data on your hard drive.</p> + <p>Brave is not responsible for any data loss, and makes no guarantee that Chrome OS will work on uncertified models. Please visit [TBD] to learn more about certified models.</p> + <p>Learn more about installing Chrome OS and data erasure: [TBD URL]</p> + <p>If you are ready to proceed, click “Install Chrome OS” and we'll guide you through the installation in just a couple easy steps. You'll have another chance to confirm before we make any changes to your computer.</p> + + + Install Chrome OS + + + Ready to install Chrome OS + + + <p>We’re ready to install Chrome OS! Once you proceed: + <ul> + <li>Files, data, and your current operating system will be erased. + <li>Chrome OS will be installed. + <li>Your device will shut down once the installation is complete. + </ul> + </p> + <p>One last reminder: installation will erase your entire hard drive. Please make sure you have any data you care about backed up.</p> + <p>Once installation starts it cannot be canceled.</p> + + + Erase Hard Drive & Install Chrome OS + + + Chrome OS installation in progress + + + Installation is in progress. Don't turn off the device. Install should take no longer than twenty minutes. The machine will automatically shut down after installing. + @@ -1235,12 +1265,6 @@ Brave is unable to recover your settings. Chrome OS system - - Chrome OS didn't shut down correctly. - - - Chrome OS can always restore your apps & pages after reboot without asking every time. - diff --git a/app/extensions_strings.grdp b/app/extensions_strings.grdp index aaee31b28418..0730d19d7467 100644 --- a/app/extensions_strings.grdp +++ b/app/extensions_strings.grdp @@ -315,7 +315,7 @@ No recent activities - Find extensions and themes in the <a target="_blank" rel="noopener noreferrer" href="https://chrome.google.com/webstore/category/extensions">Web Store</a></a> + Find extensions and themes in the <a target="_blank" href="https://chrome.google.com/webstore/category/extensions">Web Store</a></a> No description provided @@ -443,35 +443,6 @@ Type a letter - - - A healthier, happier Brave - - - Some extensions can slow you down - especially ones you didn't mean to install. - - - If you don’t recognize an extension, or if your browser isn’t working as expected, you can turn off or customize extensions here. - - - Check your extensions - - - Some extensions can see your browsing activity - including personal information. - - - If you don’t recognize an extension, or if your browser isn’t working as expected, you can turn off or customize extensions here. - - - Manage your extensions - - - On this page you can see all the extensions installed in Brave. - - - If you don't recognize an extension, or if your browser isn't working as expected, you can turn off or customize extensions here. - - diff --git a/app/extensions_strings_override.grdp b/app/extensions_strings_override.grdp index cde1493ae1e7..6adcd63df394 100644 --- a/app/extensions_strings_override.grdp +++ b/app/extensions_strings_override.grdp @@ -14,7 +14,7 @@ Web Store - Find extensions and themes in the <a target="_blank" rel="noopener noreferrer" href="https://chrome.google.com/webstore/category/extensions">Web Store</a></a> + Find extensions and themes in the <a target="_blank" href="https://chrome.google.com/webstore/category/extensions">Web Store</a></a> Open Web Store diff --git a/app/generated_resources.grd b/app/generated_resources.grd index 56548d5bda75..47b17fae60ac 100644 --- a/app/generated_resources.grd +++ b/app/generated_resources.grd @@ -291,9 +291,12 @@ are declared in tools/grit/grit_rule.gni. - + + + + @@ -324,6 +327,11 @@ are declared in tools/grit/grit_rule.gni. + + + + + @@ -739,6 +747,18 @@ are declared in tools/grit/grit_rule.gni. Search image with Brave Lens + + Search part of the page with Brave Lens + + + Drag to search images with Brave Lens + + + Drag over images to search with Brave Lens + + + Search your screen with Brave Lens + &Go to $1http://www.google.com/ @@ -980,6 +1000,18 @@ are declared in tools/grit/grit_rule.gni. Search Image with Brave Lens + + Search Part of the Page with Brave Lens + + + Drag to Search Images with Brave Lens + + + Drag over Images to Search with Brave Lens + + + Search Your Screen with Brave Lens + &Go to $1http://www.google.com/ @@ -1239,12 +1271,18 @@ are declared in tools/grit/grit_rule.gni. R&eopen closed tab - + R&eopen closed window - + Reopen closed group + + &Restore window + + + &Restore group + Name &window... @@ -1280,12 +1318,18 @@ are declared in tools/grit/grit_rule.gni. R&eopen Closed Tab - + R&eopen Closed Window - + Reopen Closed Group + + &Restore Window + + + &Restore Group + Name &Window... @@ -1337,6 +1381,9 @@ are declared in tools/grit/grit_rule.gni. Tips for Brave + + What's New + Import bookmarks and settings... @@ -1433,7 +1480,7 @@ are declared in tools/grit/grit_rule.gni. Keyword - + Name @@ -1572,6 +1619,9 @@ are declared in tools/grit/grit_rule.gni. Unknown server error. Please try again, or contact the server administrator. + + $1Storage limit reached. ($2Request ID 12345) + Shutdown @@ -1673,6 +1723,15 @@ are declared in tools/grit/grit_rule.gni. Removed + + Sending to $1Google Drive + + + Saved to $1Google Drive + + + Failed to save to $1Google Drive - $2Disk full + Failed - $1Disk full @@ -1850,6 +1909,9 @@ are declared in tools/grit/grit_rule.gni. Send + + Review + @@ -1879,6 +1941,9 @@ are declared in tools/grit/grit_rule.gni. Retry + + Show in $1Google Drive + Show in folder @@ -2253,6 +2318,36 @@ are declared in tools/grit/grit_rule.gni. Open as tabbed window + + + Review name update + + + Review icon update + + + Review name & icon updates + + + If this web app is trying to trick you into thinking it's a different app, uninstall it. + + + Current icon + + + New icon + + + + Uninstall app + + + + + Uninstall App + + + This app was added by your organization. Restart the app to finish installing it. @@ -3254,9 +3349,19 @@ are declared in tools/grit/grit_rule.gni. Share this tab instead - Stop + Stop sharing + + + View tab: $1meet.google.com + + + Switch to capturing tab + + + Switch to captured tab + @@ -3458,6 +3563,12 @@ are declared in tools/grit/grit_rule.gni. Background Page: $1http://www.google.com + + Back/Forward Cached Page: $1http://www.google.com + + + Private Back/Forward Cached Page: $1http://www.google.com + Plugin: $1Unknown Plugin @@ -3506,6 +3617,12 @@ are declared in tools/grit/grit_rule.gni. Private Subframe: $1https://youtube.com/ + + Back/Forward Cached Subframe: $1http://www.google.com + + + Private Back/Forward Cached Subframe: $1http://www.google.com + Portal: $1https://youtube.com/ @@ -3548,7 +3665,7 @@ are declared in tools/grit/grit_rule.gni. Profile Importer - + QR Code Generator @@ -4225,6 +4342,19 @@ are declared in tools/grit/grit_rule.gni. The folder you selected contains sensitive files. Are you sure you want to grant "$1Text" permanent write access to this folder? + + + + Connection Dialog + + + Address + + + Port + + + @@ -4712,6 +4842,12 @@ Keep your key file in a safe place. You will need it to create new versions of y Customize and control $1GMail + + Hide title bar + + + Show title bar + @@ -4805,9 +4941,6 @@ Keep your key file in a safe place. You will need it to create new versions of y Password saved - - Password saved on this device - Use suggested password @@ -5008,8 +5141,8 @@ 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 issues with: Help > "Report an issue...". + + Experimental (alpha-quality) browser! Some features missing or incomplete. Report issues with: Help > "Report an issue...". @@ -5218,11 +5351,6 @@ Keep your key file in a safe place. You will need it to create new versions of y This page will also be removed from your history and $1Brave activity. - - - Remove suggestion from clipboard? - - Always Show Full URLs @@ -5259,7 +5387,7 @@ Keep your key file in a safe place. You will need it to create new versions of y *.jpeg, *.jpg, *.png - + Name @@ -5513,6 +5641,12 @@ Keep your key file in a safe place. You will need it to create new versions of y Customize cards + + Viewed $15 days ago + + + Viewed today + Shopping suggestions @@ -5531,6 +5665,9 @@ Keep your key file in a safe place. You will need it to create new versions of y Your carts + + In your shopping cart + carts @@ -5568,7 +5705,7 @@ Keep your key file in a safe place. You will need it to create new versions of y You’re seeing your recent and suggested documents based on your previous activity using Google Drive. <br> <br> - Learn about the data Google Drive collects and why <a href="https://support.google.com/drive/answer/2450387" target="_blank" rel="noopener noreferrer">here</a>. + Learn about the data Google Drive collects and why <a href="https://support.google.com/drive/answer/2450387" target="_blank">here</a>. Top picks for you @@ -5577,14 +5714,20 @@ 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="https://myactivity.google.com/" 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="https://myactivity.google.com/" target="_blank">myactivity.google.com</a>. <br> <br> - Learn about the data Brave collects and why at <a href="https://policies.google.com/" target="_blank" rel="noopener noreferrer">policies.google.com</a>. + Learn about the data Brave collects and why at <a href="https://policies.google.com/" target="_blank">policies.google.com</a>. Close + + Related to your search + + + Recommended + New @@ -5706,6 +5849,20 @@ Keep your key file in a safe place. You will need it to create new versions of y To save a page for later, click the Bookmark icon + + Add current tab + + + + + Mark as unread + + + Mark as read + + + Delete + @@ -5747,6 +5904,12 @@ Keep your key file in a safe place. You will need it to create new versions of y Extensions + + Show side panel + + + Hide side panel + Close @@ -6402,7 +6565,7 @@ Keep your key file in a safe place. You will need it to create new versions of y Clear browsing data - The selected data has been removed from Brave and synced devices. Your Brave sync chain may have other forms of browsing history like searches and activity from other Brave services at <a target="_blank" rel="noopener noreferrer" href="$1">myactivity.google.com</a>. + The selected data has been removed from Brave and synced devices. Your Brave sync chain may have other forms of browsing history like searches and activity from other Brave services at <a target="_blank" href="$1">myactivity.google.com</a>. Cleared Brave data @@ -6412,7 +6575,7 @@ Keep your key file in a safe place. You will need it to create new versions of y - We were not able to delete all passwords stored in your Brave sync chain. Try again or visit <a target="_blank" rel="noopener noreferrer" href="$1">passwords.google.com</a>. + We were not able to delete all passwords stored in your Brave sync chain. Try again or visit <a target="_blank" href="$1">passwords.google.com</a>. Some passwords were not deleted @@ -6812,6 +6975,9 @@ Keep your key file in a safe place. You will need it to create new versions of y + + To search your tabs, click here + Search Tabs @@ -6845,12 +7011,24 @@ Keep your key file in a safe place. You will need it to create new versions of y Recently Closed Tab + + Recently Closed Tab Group + Open Tabs + + Recently Closed + Recently Closed Tabs + + $11 Tab + + + $12 Tabs + @@ -7304,6 +7482,21 @@ Keep your key file in a safe place. You will need it to create new versions of y Send to $1Ted's Pixel2 + + Shared from $1Ted's Pixel2 + + + Page shared from another device + + + Open in New Tab + + + Shared Tab + + + Choose a device. Then, to see the page, open Brave there. + Send to your devices @@ -7326,49 +7519,57 @@ Keep your key file in a safe place. You will need it to create new versions of y Send Link to $1Ted's Pixel2 + + + Page shared from $1Tanya's Pixel 2 + + + Open + + - + - - Create QR code for this page + + Create QR Code for this page - - Create QR code for this image + + Create QR Code for this image - - Create QR code for this Page + + Create QR Code for this Page - - Create QR code for this Image + + Create QR Code for this Image - - QR code + + QR Code - - Create QR code for this Page + + Create QR Code for this Page - Scan QR code + Scan QR Code - + URL - + To scan this code, you can use a QR scanner app on your phone, or some camera apps. - + Download - + Use $1300 characters or fewer - Can't create QR code + Can't create QR Code @@ -7378,6 +7579,9 @@ Keep your key file in a safe place. You will need it to create new versions of y Share this page + + Screenshot + Copy link @@ -7387,6 +7591,9 @@ Keep your key file in a safe place. You will need it to create new versions of y Cast... + + Share link to + @@ -7409,9 +7616,6 @@ Keep your key file in a safe place. You will need it to create new versions of y Press $1Ctrl+V to paste - - Tap the notification on $1Jimmy's Pixel to verify your phone number - Call from your device @@ -7598,10 +7802,10 @@ Keep your key file in a safe place. You will need it to create new versions of y - Your <a target="_blank" rel="noopener noreferrer" href="$1">$2Bravebook is managed</a> by your organization + Your <a target="_blank" href="$1">$2Bravebook is managed</a> by your organization - Your <a target="_blank" rel="noopener noreferrer" href="$1">$2Bravebook is managed</a> by $3example.com + Your <a target="_blank" href="$1">$2Bravebook is managed</a> by $3example.com @@ -7616,7 +7820,7 @@ Keep your key file in a safe place. You will need it to create new versions of y Remove - + Name @@ -7930,7 +8134,7 @@ Keep your key file in a safe place. You will need it to create new versions of y Sync your bookmarks, passwords, history, and more on all your devices - Brave may use your history to personalize Search, ads, and other Brave services + Brave may use your history to personalize Search and other Brave services You can always choose what to sync in settings. @@ -7982,7 +8186,7 @@ Keep your key file in a safe place. You will need it to create new versions of y Continue - Not your device? Use <a is="action-link" target="_blank" rel="noopener noreferrer">Guest mode</a>. + Not your device? Use <a is="action-link" target="_blank">Guest mode</a>. This will separate your browsing from $1bob@example.com @@ -8110,7 +8314,7 @@ Keep your key file in a safe place. You will need it to create new versions of y [parent directory] - + Name @@ -8287,12 +8491,18 @@ Please help our engineers fix this problem. Tell us what happened right before y Sync isn't working + + Password sync isn't working + Sync isn't working - + Password sync isn't working + + To continue saving passwords in your Brave sync chain, verify it’s you + Make sure you can always access your sync data @@ -8302,6 +8512,9 @@ Please help our engineers fix this problem. Tell us what happened right before y Sign in again + + Sync needs to verify it's you + Enter passphrase @@ -8328,6 +8541,12 @@ Please help our engineers fix this problem. Tell us what happened right before y To start sync, verify it's you + + To make sure you can always access your sync data, verify it's you + + + To make sure you can always access your saved passwords, verify it's you + @@ -8450,8 +8669,7 @@ Please help our engineers fix this problem. Tell us what happened right before y Data is encrypted with your sync passphrase. This doesn't include payment methods and addresses from Brave Pay. - Data was encrypted with your sync passphrase on - $1Sept 1, 2012. This doesn't include payment methods and addresses from Brave Pay. + Data was encrypted with your sync passphrase on $1Sept 1, 2012. This doesn't include payment methods and addresses from Brave Pay. @@ -8623,6 +8841,9 @@ Please help our engineers fix this problem. Tell us what happened right before y =1 {Show} other {Show all}} + + Snooze + @@ -8635,6 +8856,9 @@ Please help our engineers fix this problem. Tell us what happened right before y =1 {Show} other {Show All}} + + Snooze + @@ -9121,6 +9345,9 @@ Please help our engineers fix this problem. Tell us what happened right before y Location is turned off in Mac System Preferences + + Turn on "Brave" in Location Services on your Mac + Location turned off @@ -9671,8 +9898,14 @@ Please help our engineers fix this problem. Tell us what happened right before y $1Brave Hangouts wants to share the contents of your screen with $2https://google.com. - - Share audio + + Share system audio + + + Share window audio + + + Share tab audio Entire Screen @@ -9695,46 +9928,9 @@ Please help our engineers fix this problem. Tell us what happened right before y - - - Share this tab - - - $1https://google.com is asking for permission to capture the contents of this tab. - - - Share audio - - - Share - - - - - - {NUM_PRINTER, plural, - =1 {New printer on your network} - other {New printers on your network}} - - - {NUM_PRINTER, plural, - =1 {Add the printer to Google Cloud Print so you can print from anywhere.} - other {Add # printers to Google Cloud Print so you can print from anywhere.}} - - - Google Cloud Print - - - Add to Cloud Print - - - Don't show this again - - - - Documents are <a is="action-link" href="https://support.google.com/cloudprint/answer/2541843" target="_blank" rel="noopener noreferrer">sent to Brave</a> to prepare them for printing. View, edit and manage your printers and printer history on the <a is="action-link" href="https://www.google.com/cloudprint#jobs" target="_blank" rel="noopener noreferrer">Google Cloud Print dashboard</a>. + Documents are <a is="action-link" href="https://support.google.com/cloudprint/answer/2541843" target="_blank">sent to Brave</a> to prepare them for printing. View, edit and manage your printers and printer history on the <a is="action-link" href="https://www.google.com/cloudprint#jobs" target="_blank">Google Cloud Print dashboard</a>. @@ -10089,9 +10285,6 @@ Please help our engineers fix this problem. Tell us what happened right before y "$1Brave Extension Name" wants to connect - - $1device name ($2device id) - Compatible devices @@ -10104,23 +10297,6 @@ Please help our engineers fix this problem. Tell us what happened right before y Unknown device [$1123:$2123] - - - No nearby devices found. - - - $1www.google.com wants to scan for nearby Bluetooth devices. The following devices have been found: - - - Allow - - - Block - - - Unknown or unsupported device ($1A1:B2:C3:D4:E5:F6) - - Unknown product $1123 from $2Brave @@ -10201,9 +10377,32 @@ Please help our engineers fix this problem. Tell us what happened right before y Open $1.txt, .csv, .md files - + , ''' + + Open file? + + + Open files? + + + $1example.com wants to open this file: + + + $1example.com wants to open these files: + + + Don't ask again when opening this file format in this app: +$1TXT + + + Don't ask again when opening these file formats in this app: +$1TXT, CSV, DOC + + + Don't allow + @@ -10370,6 +10569,18 @@ Please help our engineers fix this problem. Tell us what happened right before y $1example.com will be able to view files in $2My Project until you close all tabs for this site + + $1example.com will be able to edit $2README.md + + + $1example.com will be able to edit files in $2My Project + + + $1example.com will be able to view $2README.md + + + $1example.com will be able to view files in $2My Project + Let site edit $1README.md? @@ -10625,11 +10836,11 @@ Please help our engineers fix this problem. Tell us what happened right before y Open Brave on your Android phone, and go to "Settings > Passwords > Use phone as a security key", and follow the instructions there. - + Add new phone - - To set up an Android phone to be used as a security key with this computer for the first time, open Brave on your phone and go to "Settings > Passwords > Use phone as a security key". Then tap "Connect new device" and scan this QR code. + + To set up an Android phone to be used as a security key with this computer for the first time, open Brave on your phone and go to "Settings > Passwords > Use phone as a security key". Then tap "Connect new device" and scan this QR Code. @@ -10796,6 +11007,17 @@ Please help our engineers fix this problem. Tell us what happened right before y Close Private + + + To clear data, close all Private windows + + + This only affects Private windows + + + Close windows + + {0, plural, @@ -10886,9 +11108,15 @@ Please help our engineers fix this problem. Tell us what happened right before y Your administrator says "$1Please don't upload this type of data.". + + $1foo.txt has sensitive or dangerous data. Your administrator says "$2Please don't upload this type of data.". + Learn more + + Discard file + @@ -10939,6 +11167,33 @@ Please help our engineers fix this problem. Tell us what happened right before y Open now + + + Box + + + Google Drive + + + + + Sign into $1Google Drive to complete download + + + Your organization requires eligible downloads to be saved to $1Google Drive. Upon signing in, an unique authentication token will be stored and used for all future eligible downloads. + + + Cancel download + + + Sign in + + + + + Link $1Google Drive account for Downloads + + Uninstall "$1Gmail Checker"? @@ -11017,6 +11272,12 @@ Please help our engineers fix this problem. Tell us what happened right before y =1 {Click to view the extension} other {Click to view these extensions}} + + Justification for requesting this extension: + + + Enter justification... + @@ -11062,12 +11323,12 @@ Please help our engineers fix this problem. Tell us what happened right before y Enabled – $1tabs shrink to pinned tab width - - - Reading List + + + Side Panel - - Right click on a tab or click the Bookmark icon to add tabs to a reading list. Access from the Bookmarks bar. + + Enables a browser-level side panel for a useful and persistent way to access your Reading List and Bookmarks. @@ -11095,6 +11356,13 @@ Please help our engineers fix this problem. Tell us what happened right before y Enable a popup bubble in Top Brave UI to search over currently open tabs. + + + Search your screen with Brave Lens + + + Right click and select “Search part of the page with Brave Lens” to search any region of the site to learn more about the visual content you see while you browse and shop on the web. + diff --git a/app/generated_resources_override.grd b/app/generated_resources_override.grd index cbead8d64125..cae381d2fa24 100644 --- a/app/generated_resources_override.grd +++ b/app/generated_resources_override.grd @@ -94,6 +94,8 @@ are declared in tools/grit/grit_rule.gni. + + @@ -118,6 +120,9 @@ are declared in tools/grit/grit_rule.gni. + + + @@ -326,6 +331,11 @@ are declared in tools/grit/grit_rule.gni. + + + + + @@ -380,9 +390,15 @@ are declared in tools/grit/grit_rule.gni. Private Tab: $1Brave + + Private Back/Forward Cached Page: $1http://www.google.com + Private Subframe: $1https://youtube.com/ + + Private Back/Forward Cached Subframe: $1http://www.google.com + Private Portal: $1https://youtube.com/ @@ -427,6 +443,9 @@ are declared in tools/grit/grit_rule.gni. + + + @@ -477,8 +496,6 @@ are declared in tools/grit/grit_rule.gni. - - @@ -652,6 +669,8 @@ are declared in tools/grit/grit_rule.gni. + + @@ -843,9 +862,6 @@ are declared in tools/grit/grit_rule.gni. - - - @@ -919,7 +935,13 @@ are declared in tools/grit/grit_rule.gni. Close Private - + + To clear data, close all Private windows + + + This only affects Private windows + + diff --git a/app/global_media_controls_strings.grdp b/app/global_media_controls_strings.grdp index 42bfb431488c..890291739cf3 100644 --- a/app/global_media_controls_strings.grdp +++ b/app/global_media_controls_strings.grdp @@ -11,8 +11,8 @@ Dismiss - - Devices + + Select a device Stop casting diff --git a/app/media_router_strings.grdp b/app/media_router_strings.grdp index 353e2dab7e97..1ff778e4625c 100644 --- a/app/media_router_strings.grdp +++ b/app/media_router_strings.grdp @@ -169,7 +169,7 @@ Your feedback helps us to improve Brave Cast and is appreciated. For help troubleshooting issues with cast, please refer to the - <a href="$1" target="_blank" rel="noopener noreferrer"> + <a href="$1" target="_blank"> help center</a>. @@ -326,7 +326,7 @@ Are you able to see your Bravecast in the - <a href="$1" target="_blank" rel="noopener noreferrer"> + <a href="$1" target="_blank"> Brave Home app</a>? diff --git a/app/os_settings_search_tag_strings.grdp b/app/os_settings_search_tag_strings.grdp index 01c04b508fb9..7d5d72cd3d4b 100644 --- a/app/os_settings_search_tag_strings.grdp +++ b/app/os_settings_search_tag_strings.grdp @@ -712,6 +712,78 @@ Art gallery album + + Dark theme + + + Dark mode + + + Light theme + + + Light mode + + + Turn dark theme on + + + Enable dark theme + + + Turn dark mode on + + + Enable dark mode + + + Turn light theme off + + + Disable light theme + + + Turn dark theme off + + + Disable dark theme + + + Turn dark mode off + + + Disable dark mode + + + Turn light theme on + + + Enable light theme + + + Accent color + + + Color mode + + + Color theme + + + Dark theme schedule + + + Dark mode schedule + + + Automatic dark mode + + + Automatic light mode + + + Automatic dark theme + @@ -729,6 +801,15 @@ Right click card + + Quick Answers definition + + + Quick Answers translation + + + Quick Answers unit conversion + Brave Assistant @@ -991,6 +1072,15 @@ Emoji suggestions + + Predictive writing + + + Text suggestions + + + Next word prediction + diff --git a/app/os_settings_strings.grdp b/app/os_settings_strings.grdp index 3ea50407aa2e..2a16f70facb0 100644 --- a/app/os_settings_strings.grdp +++ b/app/os_settings_strings.grdp @@ -17,6 +17,9 @@ Dismiss + + Keyboard shortcut notice dismissed + @@ -24,11 +27,11 @@ {NUM_DAYS, plural, - =1 {{1}example.com requires you to back up your data and return this {2}Bravebook today. <a target="_blank" rel="noopener noreferrer" href="{3}https://google.com/">See details</a>} - other {{1}example.com requires you to back up your data and return this {2}Bravebook within {NUM_DAYS} days. <a target="_blank" rel="noopener noreferrer" href="{3}https://google.com/">See details</a>}} + =1 {{1}example.com requires you to back up your data and return this {2}Bravebook today. <a target="_blank" href="{3}https://google.com/">See details</a>} + other {{1}example.com requires you to back up your data and return this {2}Bravebook within {NUM_DAYS} days. <a target="_blank" href="{3}https://google.com/">See details</a>}} - $1example.com requires you to back up your data and return this $2Bravebook within 1 week. <a target="_blank" rel="noopener noreferrer" href="$3https://google.com/">See details</a> + $1example.com requires you to back up your data and return this $2Bravebook within 1 week. <a target="_blank" href="$3https://google.com/">See details</a> @@ -188,13 +191,13 @@ 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> + This device will get automatic software and security updates until $1September 2020. <a target="_blank" href="$2https://google.com/">Learn more</a> - This device stopped getting automatic software and security updates in $1September 2020. <a target="_blank" rel="noopener noreferrer" href="$2https://google.com/">Learn more</a> + This device stopped getting automatic software and security updates in $1September 2020. <a target="_blank" href="$2https://google.com/">Learn more</a> - This is the last automatic software and security update for this $1Bravebook. To get future updates, upgrade to a newer model. <a target="_blank" rel="noopener noreferrer" href="$2https://google.com/">Learn more</a> + This is the last automatic software and security update for this $1Bravebook. To get future updates, upgrade to a newer model. <a target="_blank" href="$2https://google.com/">Learn more</a> Diagnostics @@ -218,7 +221,7 @@ {COUNT, plural, - =1 {1 Brave sync chain added} + =1 {1 Brave sync chain} other {$22 Brave sync chains}} @@ -317,7 +320,7 @@ Change device language - You need to restart your Bravebook to change the device language. <a target="_blank" rel="noopener noreferrer" href="$1">Learn more</a> + You need to restart your Bravebook to change the device language. <a target="_blank" href="$1">Learn more</a> $1English selected. Press Search plus Space to unselect. @@ -332,17 +335,20 @@ Web content languages - Web content available in multiple languages will use the first supported language from this list. These preferences are synced with your browser settings. <a target="_blank" rel="noopener noreferrer" href="$1">Learn more</a> + Web content available in multiple languages will use the first supported language from this list. These preferences are synced with your browser settings. <a target="_blank" href="$1">Learn more</a> Website languages - Add and rank your preferred languages. Websites will show in your preferred languages, when possible. These preferences are synced with your browser settings. <a target="_blank" rel="noopener noreferrer" href="$1">Learn more</a> + Add and rank your preferred languages. Websites will show in your preferred languages, when possible. These preferences are synced with your browser settings. <a target="_blank" href="$1">Learn more</a> Language used when translating pages + + Language used for translating pages and Quick answers + Offer to translate pages in this language @@ -400,6 +406,12 @@ Spell check + + Spelling and grammar check + + + Grammar check currently available for English only + Enhanced spell check in Brave browser (text is sent to Brave for spelling suggestions) @@ -492,6 +504,12 @@ Get emoji suggestions based on what you're typing + + Predictive writing + + + Show inline writing suggestions that appear as you type + @@ -530,6 +548,24 @@ Edit dictionary entries + + Physical keyboard layout + + + Selection keys + + + Number of candidates to display per page + + + Korean keyboard layout + + + Input a syllable at a time + + + Show candidates in Hangul mode + Initial punctuation width is Full @@ -560,6 +596,15 @@ US + + Default + + + IBM + + + Eten + Dvorak @@ -683,10 +728,10 @@ Select $1Brave Photos albums - Relive your favorite memories. To add or edit albums, go to <a target="_blank" rel="noopener noreferrer" href="$1https://google.com/">Brave Photos</a>. + Relive your favorite memories. To add or edit albums, go to <a target="_blank" href="$1https://google.com/">Brave Photos</a>. - No albums. Create an album in <a target="_blank" rel="noopener noreferrer" href="$1https://google.com/">Brave Photos</a>. + No albums. Create an album in <a target="_blank" href="$1https://google.com/">Brave Photos</a>. Your best photos, selected automatically @@ -719,6 +764,59 @@ Celsius + + + Dark theme + + + On + + + Off + + + Accent color + + + Choose the color theme for Launcher, shelf, Quick Settings, and more + + + Based on your wallpaper + + + Neutral + + + Dark mode will turn on automatically at sunset + + + Dark mode will turn off automatically at sunrise + + + Custom + + + Schedule + + + Never + + + Sunset to sunrise + + + Off / Will turn on automatically at sunset + + + On / Will turn off automatically at sunrise + + + Off / Will turn on automatically at $16:30 PM + + + On / Will turn off automatically at $110:45 AM + + Preferred search engine @@ -758,6 +856,18 @@ With a right-click or long press, show related info for your text selection + + Definition + + + Translation + + + Add your preferred <a target="_blank" href="#">website languages</a>. The top language from the list will be used for translations. + + + Unit Conversion + @@ -996,6 +1106,15 @@ and Ctrl+Alt+Brightness down to zoom out. Can't download speech files. Dictation will continue to work by sending your voice to Brave. + + Language + + + $1English is processed locally and works offline. + + + $1English speech is sent to Brave for processing. + Enable on-screen keyboard @@ -1045,7 +1164,7 @@ and Ctrl+Alt+Brightness down to zoom out. Switch Access settings - Open setup guide + Rerun setup guide Switch action assignment @@ -1104,24 +1223,37 @@ and Ctrl+Alt+Brightness down to zoom out. Assign switch: $1Select - - Press a switch to assign “$1Select”. You can assign multiple switches to this action. + + Press a switch to assign “$1Select” +You can assign multiple switches to this action + + + Press a switch or key to assign "$1Select" + + + Press a new switch to start assignment +Press an assigned switch to remove assignment + + + Press “$1backspace” again to confirm assignment and $2exit - - Press a new switch to start assignment. -Press an assigned switch to remove assignment. + + exit - - Press “$1backspace” again to confirm assignment and exit. + + continue - - Press “$1backspace” again to remove assignment and exit. + + try again - - Keys do not match. Press any key to exit. + + Press “$1backspace” again to remove assignment and $2exit - - Can’t remove the only switch assigned to Select. Press any key to exit. + + Keys do not match. Press any key to $1exit. + + + Can’t remove the only switch assigned to Select. Press any key to $1exit. $1backspace ($2USB) @@ -1144,24 +1276,45 @@ Press an assigned switch to remove assignment. $1backspace, $2enter, $3escape, and $42 more switches - - '$1enter' is already assigned to the '$2Select' action. Press any key to exit. + + '$1enter' is already assigned to the '$2Select' action. Press any key to $3exit. - - Unrecognized key. Press any key to exit. + + Unrecognized key. Press any key to $1exit. No switch has been assigned yet + + No switch or key has been assigned yet + Exit + + Clear all switch assignments + + + Re-running the setup guide will clear your assigned switches. Do you want to continue? + Switch Access setup guide To get started, please make sure your USB or Bluetooth switch is connected to your Bravebook. You can also use keyboard keys. + + Assign switch: Select + + + Auto-scan enabled + + + Auto-scan will automatically cycle through and focus on items on the screen. When an item is focused, press the "Select" key you just assigned to activate it. + + + Activate the Next button to continue the setup or the Previous button to change the "Select" switch assignment. + Do you want to assign additional switches? @@ -1177,9 +1330,39 @@ Press an assigned switch to remove assignment. Assign two more switches - + Assign them to "Next" and "Previous" to move between items on the page + + Auto-scan speed + + + Choose how long the highlight should stay on each item + + + Assign switch: Next + + + Assign switch: Previous + + + You're all set! + + + Press your switch when the focus is on the Done button to close the guide. + + + Now that you have more switches to navigate, auto-scan has been turned off. Navigate to the Done button and press the Select switch to close the guide. + + + You can always change additional settings or open the setup guide again from Switch Access settings. + + + Slower + + + Faster + Pair Bluetooth switch @@ -1189,16 +1372,22 @@ Press an assigned switch to remove assignment. Previous - + + Start over setup + + + Done + + Assigned - + Add assignment - + Remove assignment - + Error @@ -1402,7 +1591,7 @@ Press an assigned switch to remove assignment. Managed by $1google.com - This account is managed by <a target="_blank" rel="noopener noreferrer">$1google.com</a> + This account is managed by <a target="_blank">$1google.com</a> Managed by Family Link @@ -1652,7 +1841,7 @@ Press an assigned switch to remove assignment. Reserve size - A factory reset of this Bravebook is required to enable ADB debugging. <a target="_blank" rel="noopener noreferrer" href="$1">Learn more</a> + A factory reset of this Bravebook is required to enable ADB debugging. <a target="_blank" href="$1">Learn more</a> To enable ADB debugging, a restart of this $1Bravebook is required. Disabling it requires a reset to factory settings. @@ -1661,7 +1850,7 @@ Press an assigned switch to remove assignment. Disabling ADB debugging will reset this $1Bravebook to factory settings. All user accounts and local data will be erased. - Run Linux tools, editors, and IDEs on your $1Bravebook. <a target="_blank" rel="noopener noreferrer" href="$2https://google.com/">Learn more</a> + Run Linux tools, editors, and IDEs on your $1Bravebook. <a target="_blank" href="$2https://google.com/">Learn more</a> Remove Linux development environment @@ -1785,7 +1974,11 @@ Press an assigned switch to remove assignment. Remove from list - + + + Your administrator has blocked some functionality for this device + + Pair @@ -1977,9 +2170,24 @@ Press an assigned switch to remove assignment. There are no printers available to save. + + Managed printers + + + There are $13 managed printers. + + + There is 1 managed printer. + + + There are no managed printers. + Edit + + View + Remove @@ -2046,7 +2254,7 @@ Press an assigned switch to remove assignment. URI - + Name @@ -2163,6 +2371,9 @@ Press an assigned switch to remove assignment. Edit printer + + View printer + Save @@ -2276,9 +2487,6 @@ Press an assigned switch to remove assignment. Join $1WiFi network - - Searching for mobile networks - Known Networks @@ -2357,9 +2565,6 @@ Press an assigned switch to remove assignment. VPN service - - Automatically connect to this network - Hidden network @@ -2526,13 +2731,13 @@ Press an assigned switch to remove assignment. This network is shared with you - This network is not synced to your account. <a target="_blank" rel="noopener noreferrer" href="$1https://google.com/">Learn more</a> + This network is not synced to your account. <a target="_blank" href="$1https://google.com/">Learn more</a> - Synced with other devices on your account. Settings modified by other users will not be synced. <a target="_blank" rel="noopener noreferrer" href="$1https://google.com/">Learn more</a> + Synced with other devices on your account. Settings modified by other users will not be synced. <a target="_blank" href="$1https://google.com/">Learn more</a> - Synced with other devices on your account. <a target="_blank" rel="noopener noreferrer" href="$1https://google.com/">Learn more</a> + Synced with other devices on your account. <a target="_blank" href="$1https://google.com/">Learn more</a> Network out of range @@ -2601,7 +2806,7 @@ Press an assigned switch to remove assignment. Connect - Looking for a mobile network. <a target="_blank" rel="noopener noreferrer" href="$1">Learn more</a> + Looking for a mobile network. <a target="_blank" href="$1">Learn more</a> eSIM @@ -2619,10 +2824,10 @@ Press an assigned switch to remove assignment. No SIM card inserted - No device detected. <a target="_blank" rel="noopener noreferrer" href="$1">Learn more</a> + No device detected. <a target="_blank" href="$1">Learn more</a> - - Show device EID and QR code popup + + Show device EID and QR Code popup Connect to Wi-Fi or Ethernet to set up eSIM @@ -2698,7 +2903,7 @@ Press an assigned switch to remove assignment. Messages - Send and receive text messages from your $1Bravebook. <a target="_blank" rel="noopener noreferrer" href="$2https://google.com/">Learn more</a> + Send and receive text messages from your $1Bravebook. <a target="_blank" href="$2https://google.com/">Learn more</a> Phone Hub @@ -2722,7 +2927,7 @@ Press an assigned switch to remove assignment. View recent Brave tabs from your phone - Turn on <a id="chromeSyncLink">Brave Sync</a> to view recent Brave tabs. <a target="_blank" rel="noopener noreferrer" id="learnMoreLink" href="$1https://google.com/">Learn More</a> + Turn on <a id="chromeSyncLink">Brave Sync</a> to view recent Brave tabs. <a target="_blank" id="learnMoreLink" href="$1https://google.com/">Learn More</a> Turn on Brave Sync to view recent Brave tabs from your phone @@ -2767,7 +2972,7 @@ Press an assigned switch to remove assignment. Could not set up notifications syncing - Notification syncing is not supported for phones in a work profile. <a target="_blank" rel="noopener noreferrer" href="$1https://google.com/">Learn more</a> + Notification syncing is not supported for phones in a work profile. <a target="_blank" href="$1https://google.com/">Learn more</a> Notification syncing is not supported for phones in a work profile @@ -2782,10 +2987,10 @@ Press an assigned switch to remove assignment. Wi-Fi Sync - Sync Wi-Fi networks with your phone. <a target="_blank" rel="noopener noreferrer" href="$1https://google.com/">Learn more</a> + Sync Wi-Fi networks with your phone. <a target="_blank" href="$1https://google.com/">Learn more</a> - Turn on <a id="chromeSyncLink">Brave Sync</a> to use Wi-Fi Sync. <a id="learnMoreLink" target="_blank" rel="noopener noreferrer" href="$1https://google.com/">Learn more</a> + Turn on <a id="chromeSyncLink">Brave Sync</a> to use Wi-Fi Sync. <a id="learnMoreLink" target="_blank" href="$1https://google.com/">Learn more</a> Turn on Brave Sync to use Wi-Fi Sync @@ -2879,16 +3084,16 @@ Press an assigned switch to remove assignment. Disconnect - Connect your $1Bravebook with your phone. <a target="_blank" rel="noopener noreferrer" href="$2https://google.com/">Learn more</a> + Connect your $1Bravebook with your phone. <a target="_blank" href="$2https://google.com/">Learn more</a> - No eligible devices. <a target="_blank" rel="noopener noreferrer" href="$1https://google.com/">Learn more</a> + No eligible devices. <a target="_blank" href="$1https://google.com/">Learn more</a> - Waiting for verification. <a target="_blank" rel="noopener noreferrer" href="$1https://google.com/">Learn more</a> + Waiting for verification. <a target="_blank" href="$1https://google.com/">Learn more</a> - Unlock your $1Bravebook with your phone. <a target="_blank" rel="noopener noreferrer" href="$2https://google.com/">Learn more</a> + Unlock your $1Bravebook with your phone. <a target="_blank" href="$2https://google.com/">Learn more</a> Lock screen from sleep mode @@ -3041,7 +3246,7 @@ Press an assigned switch to remove assignment. Valid for $17 hours 12 minutes - Choose a ticket to use for authentication. <a target="_blank" rel="noopener noreferrer" href="$1https://google.com/">Learn more</a> + Choose a ticket to use for authentication. <a target="_blank" href="$1https://google.com/">Learn more</a> Kerberos tickets @@ -3164,13 +3369,13 @@ Press an assigned switch to remove assignment. Brave Assistant - "Ok Brave" + "Hey Brave" - Access your Assistant when you say "Ok Brave." + Access your Assistant when you say "Hey Brave." - Access your Assistant when you say "Ok Brave." To save battery, choose “On (Recommended.)” Your Assistant will respond only when your device is plugged in or charging. + Access your Assistant when you say "Hey Brave." To save battery, choose “On (Recommended.)” Your Assistant will respond only when your device is plugged in or charging. On (Recommended) @@ -3199,6 +3404,9 @@ Press an assigned switch to remove assignment. Default to using voice instead of keyboard + + To get responses that are more tailored to you, let Brave Assistant access a screenshot of what’s on your screen when you ask questions. Your Assistant may also use info about songs or videos that are playing. + Brave Assistant settings @@ -3247,7 +3455,7 @@ Press an assigned switch to remove assignment. Never - Sunset to Sunrise + Sunset to sunrise Start time @@ -3575,6 +3783,9 @@ Press an assigned switch to remove assignment. Manage your apps + + Notifications + Google Play Store @@ -3582,7 +3793,7 @@ Press an assigned switch to remove assignment. Android settings - Install apps and games from Google Play on your $1Bravebook. <a target="_blank" rel="noopener noreferrer" href="$2https://google.com/">Learn more</a> + Install apps and games from Google Play on your $1Bravebook. <a target="_blank" href="$2https://google.com/">Learn more</a> @@ -3675,7 +3886,7 @@ Press an assigned switch to remove assignment. External storage preferences - Apps from Google Play may require full file system access to read and write files on external storage devices. Files and folders created on the device are visible to anyone who uses the external drive. <a target="_blank" rel="noopener noreferrer" href="$1https://google.com/">Learn more</a> + Apps from Google Play may require full file system access to read and write files on external storage devices. Files and folders created on the device are visible to anyone who uses the external drive. <a target="_blank" href="$1https://google.com/">Learn more</a> Available devices will appear here. @@ -3729,20 +3940,17 @@ Press an assigned switch to remove assignment. - - On Startup + + Restore apps on startup - - Restore apps and pages + + Always restore - - Always - - + Ask every time - - Do not restore + + Off diff --git a/app/profiles_strings.grdp b/app/profiles_strings.grdp index 373e2608259d..48fe432f43eb 100644 --- a/app/profiles_strings.grdp +++ b/app/profiles_strings.grdp @@ -43,17 +43,11 @@ Error - $1User: Sync isn't working - - - $1User: Password sync isn't working + $1User: $2Sync isn't working Paused - - $1User: Sync paused - $1Markus (Account for kids) @@ -65,9 +59,6 @@ - - Profiles - Profiles @@ -139,9 +130,6 @@ Addresses and more - - Other profiles - Other profiles @@ -151,14 +139,8 @@ Hide accounts - - Manage profiles - - - Other Profiles - Other Profiles @@ -168,9 +150,6 @@ Hide Accounts - - Manage Profiles - Manage profiles @@ -586,6 +565,12 @@ You’re adding a managed profile to this browser. Your administrator has control over the profile and can access its data. + + Your organization requires a profile + + + Create + diff --git a/app/profiles_strings_override.grdp b/app/profiles_strings_override.grdp index fc1cb7b05a4e..52a40f0e6386 100644 --- a/app/profiles_strings_override.grdp +++ b/app/profiles_strings_override.grdp @@ -16,9 +16,6 @@ You're Private - - Profiles - Add Profile... @@ -27,21 +24,9 @@ - - Other profiles - - - Manage profiles - - + - - Other Profiles - - - Manage Profiles - - + Profile $11 diff --git a/app/settings_brave_strings.grdp b/app/settings_brave_strings.grdp index e4c9cf2d1c48..3b37353e1896 100644 --- a/app/settings_brave_strings.grdp +++ b/app/settings_brave_strings.grdp @@ -52,7 +52,7 @@ No saved passwords. Brave can check your passwords when you save them. - Brave can't check your passwords. Try again after 24 hours or <a href="$1" target="_blank" rel="noopener noreferrer">check passwords in your Brave sync chain</a>. + Brave can't check your passwords. Try again after 24 hours or <a href="$1" target="_blank">check passwords in your Brave sync chain</a>. Brave can't check your passwords. Try again after 24 hours. @@ -127,7 +127,7 @@ Brave can't check for updates. Try checking your internet connection. - Brave didn't update, something went wrong. <a target="_blank" rel="noopener noreferrer" href="$1">Fix Brave update problems and failed updates.</a> + Brave didn't update, something went wrong. <a target="_blank" href="$1">Fix Brave update problems and failed updates.</a> Brave version $115.0.865.0 is installed @@ -199,6 +199,6 @@ - Help make Brave better by reporting the <a is="action-link" target="_blank" rel="noopener noreferrer">current settings</a> + Help make Brave better by reporting the <a is="action-link" target="_blank">current settings</a> diff --git a/app/settings_strings.grdp b/app/settings_strings.grdp index 90c0789fcb3a..d0f40b748a2e 100644 --- a/app/settings_strings.grdp +++ b/app/settings_strings.grdp @@ -193,7 +193,7 @@ Search settings - Go to <a target="_blank" rel="noopener noreferrer" href="$1">Brave help</a> if you can't find what you're looking for + Go to <a target="_blank" href="$1">Brave help</a> if you can't find what you're looking for Settings @@ -267,7 +267,7 @@ Email - + Title @@ -295,7 +295,7 @@ Edit card - To add or manage Brave Pay payment methods, visit your <a href="$1" target="_blank" rel="noopener noreferrer">Brave sync chain</a> + To add or manage Brave Pay payment methods, visit your <a href="$1" target="_blank">Brave sync chain</a> This card will be saved to this device only @@ -501,12 +501,6 @@ Search passwords - - Show password - - - Hide password - Password details @@ -636,19 +630,19 @@ See and manage passwords saved on this device - View and manage saved passwords in your <a is="action-link" href="$1" target="_blank" rel="noopener noreferrer">Brave sync chain</a> + View and manage saved passwords in your <a is="action-link" href="$1" target="_blank">Brave sync chain</a> View and manage saved passwords in your Brave sync chain - You can also show passwords from your <a is="action-link" href="$1" target="_blank" rel="noopener noreferrer">Brave sync chain</a> here + You can also show passwords from your <a is="action-link" href="$1" target="_blank">Brave sync chain</a> here Show - Showing passwords from your <a is="action-link" href="$1" target="_blank" rel="noopener noreferrer">Brave sync chain</a> + Showing passwords from your <a is="action-link" href="$1" target="_blank">Brave sync chain</a> Remove from device @@ -944,16 +938,16 @@ Time range - To clear browsing data from this device only, while keeping it in your Brave sync chain, <a href="#" target="_blank" rel="noopener noreferrer">sign out</a>. + To clear browsing data from this device only, while keeping it in your Brave sync chain, <a href="#" target="_blank">sign out</a>. - To clear browsing data from all of your synced devices and your Brave sync chain, <a href="#" target="_blank" rel="noopener noreferrer">visit sync settings</a>. + To clear browsing data from all of your synced devices and your Brave sync chain, <a href="#" target="_blank">visit sync settings</a>. - To clear browsing data from all of your synced devices and your Brave sync chain, <a href="#" target="_blank" rel="noopener noreferrer">enter your passphrase</a>. + To clear browsing data from all of your synced devices and your Brave sync chain, <a href="#" target="_blank">enter your passphrase</a>. - To clear browsing data from all of your synced devices and your Brave sync chain, <a href="#" target="_blank" rel="noopener noreferrer">sign in</a>. + To clear browsing data from all of your synced devices and your Brave sync chain, <a href="#" target="_blank">sign in</a>. Browsing history @@ -965,10 +959,10 @@ Signs you out of most sites. You'll stay signed in to your Brave sync chain so your synced data can be cleared. - Clears history and autocompletions in the search box + Clears history, including in the search box - Clears history and autocompletions in the search box. Your Brave sync chain may have other forms of browsing history at <a target='_blank' href='$1'>myactivity.google.com</a></a>. + Clears history in the search box. Your Brave sync chain may have other forms of browsing history at <a target='_blank' href='$1'>myactivity.google.com</a></a>. Clears history from all synced devices @@ -976,8 +970,17 @@ Clears history from all signed-in devices. Your Brave sync chain may have other forms of browsing history at <a target='_blank' href='$1'>myactivity.google.com</a></a>. - - To clear <a target="_blank" rel="noopener noreferrer" href="$1">search</a> or other forms of history, visit <a target="_blank" rel="noopener noreferrer" href="$2">My Brave sync chain</a> + + <a target="_blank" href="$1">Search history</a> and <a target="_blank" href="$2">other forms of activity</a> may be saved in your Brave sync chain when you're signed in. You can delete them anytime. + + + <a target="_blank" href="$1">Other forms of activity</a> may be saved in your Brave sync chain when you're signed in. You can delete them anytime. + + + Your search engine is $1Bing. See their instructions for deleting your search history, if applicable. + + + See your search engine's instructions for deleting your search history, if applicable Download history @@ -1238,10 +1241,10 @@ Privacy Sandbox preserves the vitality of the open web by creating better ways to perform these services—without breaking sites, and while preventing you from being surreptitiously tracked across the web. - Privacy Sandbox is still in active development and is available in selected regions. For now, sites may try out Privacy Sandbox while continuing to use current web technologies like third-party cookies. <a href="$1" target="_blank" rel="noopener noreferrer">Learn more</a> + Privacy Sandbox is still in active development and is available in selected regions. For now, sites may try out Privacy Sandbox while continuing to use current web technologies like third-party cookies. <a href="$1" target="_blank">Learn more</a> - With <a href="$1" target="_blank" rel="noopener noreferrer">Privacy Sandbox</a>, Brave is developing new technologies to safeguard you from cross-site tracking while preserving the open web. + With <a href="$1" target="_blank">Privacy Sandbox</a>, Brave is developing new technologies to safeguard you from cross-site tracking while preserving the open web. Privacy Sandbox trials are still in active development and are available in selected regions. For now, sites may try out Privacy Sandbox while continuing to use current web technologies like third-party cookies. @@ -1281,10 +1284,10 @@ When on and the status is active, Brave uses your browsing history over 7 days to determine a group, or “cohort”, that you’re in. Advertisers can select ads for the group. Your browsing history is kept private on your device. This trial is active only in - <a href="$1" target="_blank" rel="noopener noreferrer">some regions</a>. + <a href="$1" target="_blank">some regions</a>. - This trial is active only in <a target="_blank" rel="noopener noreferrer" href="$1">some regions</a>. + This trial is active only in <a target="_blank" href="$1">some regions</a>. Status @@ -1305,6 +1308,14 @@ More + + + Privacy and security review + + + Review the most important privacy and security controls in one place + + Safety check @@ -1376,7 +1387,7 @@ Updates - Updates are managed by <a target="_blank" rel="noopener noreferrer" href="$1">your administrator</a> + Updates are managed by <a target="_blank" href="$1">your administrator</a> Passwords @@ -1400,7 +1411,7 @@ Enhanced Protection is on - <a target="_blank" rel="noopener noreferrer" href="$1">Your administrator</a> has turned off Safe Browsing + <a target="_blank" href="$1">Your administrator</a> has turned off Safe Browsing An extension has turned off Safe Browsing @@ -1476,7 +1487,7 @@ Brave is removing harmful software from your computer... - <a target="_blank" rel="noopener noreferrer" href="$1">Your administrator</a> has turned off checking for harmful software + <a target="_blank" href="$1">Your administrator</a> has turned off checking for harmful software Something went wrong. Click for more details. @@ -1571,7 +1582,7 @@ Do Not Track - Enabling "Do Not Track" means that a request will be included with your browsing traffic. Any effect depends on whether a website responds to the request, and how the request is interpreted. For example, some websites may respond to this request by showing you ads that aren't based on other websites you've visited. Many websites will still collect and use your browsing data - for example to improve security, to provide content, services, ads and recommendations on their websites, and to generate reporting statistics. <a target="_blank" rel="noopener noreferrer" href="$1">Learn more</a></a> + Enabling "Do Not Track" means that a request will be included with your browsing traffic. Any effect depends on whether a website responds to the request, and how the request is interpreted. For example, some websites may respond to this request by showing you ads that aren't based on other websites you've visited. Many websites will still collect and use your browsing data - for example to improve security, to provide content, services, ads and recommendations on their websites, and to generate reporting statistics. <a target="_blank" href="$1">Learn more</a></a> Permissions and content settings @@ -1591,6 +1602,12 @@ Safeguards the personal Brave sync chains of anyone at risk of targeted attacks + + Always use secure connections + + + Upgrade all navigations to HTTPS and warn you before loading sites that don't support it + Manage certificates @@ -1619,7 +1636,7 @@ With - See this provider's <a target="_blank" rel="noopener noreferrer" href="$1https://google.com/">privacy policy</a> + See this provider's <a target="_blank" href="$1https://google.com/">privacy policy</a> This setting is disabled on managed browsers @@ -1754,6 +1771,9 @@ Default search engines + + Your search engines + Other search engines @@ -1826,7 +1846,7 @@ Data stored - + Name @@ -1844,6 +1864,9 @@ Sites listed below follow a custom setting instead of the default + + Sites listed below follow a custom setting + Sites usually show ads so they can provide content or services for free. But, some sites are known to show intrusive or misleading ads. @@ -2186,11 +2209,23 @@ Not allowed to send pop-ups or use redirects + + Protected content + + + protected content + + + Protected content IDs + + + Allow sites to play protected content (recommended) + - When a site plays content protected by copyright, it might ask to recognize your device + To play content protected by copyright, sites may need to use a content protection service - Sites can ask to play protected content + Sites can play protected content Don't allow sites to play protected content @@ -2198,12 +2233,29 @@ Media with a copyright might not play - - Allowed to play protected content - - - Not allowed to play protected content - + + + Sites may also need to recognize your device using an identifier + + + Allow identifiers for protected content (computer restart may be required) + + + Sites can use identifiers to play protected content + + + Don't allow sites to use identifiers to play protected content + + + Media quality may be reduced + + + Allowed to use identifiers to play protected content + + + Not allowed to use identifiers to play protected content + + 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 @@ -2394,10 +2446,10 @@ cookies and site data - Handlers + Protocol handlers - handlers + protocol handlers Location @@ -2483,18 +2535,6 @@ pop-ups and redirects - - Protected content - - - protected content - - - Protected content identifiers - - - Allow sites to play protected content (recommended) - Virtual reality @@ -2510,14 +2550,6 @@ Do not allow sites to use your virtual reality devices and data - - - Some content services use unique identifiers for the purposes of authorizing access to protected content - - - Allow identifiers for protected content (computer restart may be required) - - Recent activity @@ -3106,7 +3138,7 @@ - + Name @@ -3197,10 +3229,7 @@ Sign in - Because this account is managed by $1example.com, your bookmarks, history, passwords, and other settings will be cleared from this device. However, your data will remain stored in your Brave sync chain and can be managed on <a href="$2" target="_blank" rel="noopener noreferrer"><a href="$2" target="_blank">Brave Dashboard</a></a>. - - - Edit profile + Because this account is managed by $1example.com, your bookmarks, history, passwords, and other settings will be cleared from this device. However, your data will remain stored in your Brave sync chain and can be managed on <a href="$2" target="_blank"><a href="$2" target="_blank">Brave Dashboard</a></a>. Turn off sync and personalization? @@ -3216,7 +3245,7 @@ - + Name @@ -3240,7 +3269,7 @@ - Changes to your bookmarks, history, passwords, and other settings will no longer be synced to your Brave sync chain. However, your existing data will remain stored in your Brave sync chain and can be managed on <a href="$1" target="_blank" rel="noopener noreferrer"><a href="$1" target="_blank">Brave Dashboard</a></a>. + Changes to your bookmarks, history, passwords, and other settings will no longer be synced to your Brave sync chain. However, your existing data will remain stored in your Brave sync chain and can be managed on <a href="$1" target="_blank"><a href="$1" target="_blank">Brave Dashboard</a></a>. This will sign you out of your Brave sync chains. Your bookmarks, history, passwords, and more will no longer be synced. @@ -3267,22 +3296,22 @@ Manage synced data on Brave Dashboard - Encrypt synced data with your own <a href="$1" target="_blank" rel="noopener noreferrer"><a href="$1" target="_blank">sync passphrase</a></a>. This doesn't include payment methods and addresses from Brave Pay. + Encrypt synced data with your own <a href="$1" target="_blank"><a href="$1" target="_blank">sync passphrase</a></a>. This doesn't include payment methods and addresses from Brave Pay. - Only someone with your passphrase can read your encrypted data. The passphrase is not sent to or stored by Brave. If you forget your passphrase or want to change this setting, you'll need to <a href="$1" target="_blank" rel="noopener noreferrer"><a href="$1" target="_blank">reset sync</a></a>. + Only someone with your passphrase can read your encrypted data. The passphrase is not sent to or stored by Brave. If you forget your passphrase or want to change this setting, you'll need to <a href="$1" target="_blank"><a href="$1" target="_blank">reset sync</a></a>. - To change this setting, <a href="$1" target="_blank" rel="noopener noreferrer"><a href="$1" target="_blank">reset sync</a></a> to remove your sync passphrase + To change this setting, <a href="$1" target="_blank"><a href="$1" target="_blank">reset sync</a></a> to remove your sync passphrase - To turn this on, <a href="$1" target="_blank" rel="noopener noreferrer"><a href="$1" target="_blank">reset sync</a></a> to remove your sync passphrase + To turn this on, <a href="$1" target="_blank"><a href="$1" target="_blank">reset sync</a></a> to remove your sync passphrase - If you forgot your passphrase or want to change this setting, <a href="$1" target="_blank" rel="noopener noreferrer"><a href="$1" target="_blank">reset sync</a></a>. + If you forgot your passphrase or want to change this setting, <a href="$1" target="_blank"><a href="$1" target="_blank">reset sync</a></a>. - Control how your browsing history is used to personalize Search, ads, and more + Control how your browsing history is used to personalize Search and more @@ -3528,7 +3557,7 @@ other {To ensure that you can keep browsing the web, ask your administrator to remove these applications.}} - <a target="_blank" rel="noopener noreferrer" href="$1">Learn how to update applications</a> + <a target="_blank" href="$1">Learn how to update applications</a> {NUM_APLLICATIONS, plural, @@ -3721,7 +3750,7 @@ Enter a name for this fingerprint - + Name diff --git a/app/settings_strings_override.grdp b/app/settings_strings_override.grdp index 67f0101d7e60..3d798692e042 100644 --- a/app/settings_strings_override.grdp +++ b/app/settings_strings_override.grdp @@ -68,14 +68,14 @@ + + Block third-party cookies in Private While in Private, sites can't use your cookies to see your browsing activity across different sites, for example, to personalize ads. Features on some sites may break. - - Third-party cookies are blocked in Private mode @@ -88,9 +88,6 @@ - - Edit profile - diff --git a/app/theme/brave/android/res_brave_base/values/channel_constants.xml b/app/theme/brave/android/res_brave_base/values/channel_constants.xml index 4cf1649e1b58..4759d6a86c02 100644 --- a/app/theme/brave/android/res_brave_base/values/channel_constants.xml +++ b/app/theme/brave/android/res_brave_base/values/channel_constants.xml @@ -8,4 +8,5 @@ Brave Brave bookmarks Brave search + Brave quick action search diff --git a/app/theme/brave/android/res_brave_beta_base/values/channel_constants.xml b/app/theme/brave/android/res_brave_beta_base/values/channel_constants.xml index 2a149b5bc655..08ee9332ba16 100644 --- a/app/theme/brave/android/res_brave_beta_base/values/channel_constants.xml +++ b/app/theme/brave/android/res_brave_beta_base/values/channel_constants.xml @@ -10,4 +10,5 @@ Brave - Beta Brave bookmarks Brave search + Brave quick action search diff --git a/app/theme/brave/android/res_brave_default_base/values/channel_constants.xml b/app/theme/brave/android/res_brave_default_base/values/channel_constants.xml index bf3e867eaa07..6c19ba4a5398 100644 --- a/app/theme/brave/android/res_brave_default_base/values/channel_constants.xml +++ b/app/theme/brave/android/res_brave_default_base/values/channel_constants.xml @@ -8,4 +8,5 @@ Brave - Debug Brave bookmarks Brave search + Brave quick action search diff --git a/app/theme/brave/android/res_brave_dev_base/values/channel_constants.xml b/app/theme/brave/android/res_brave_dev_base/values/channel_constants.xml index 0be6d8638ab8..9ae924fefd1b 100644 --- a/app/theme/brave/android/res_brave_dev_base/values/channel_constants.xml +++ b/app/theme/brave/android/res_brave_dev_base/values/channel_constants.xml @@ -10,4 +10,5 @@ Brave - Dev Brave bookmarks Brave search + Brave quick action search diff --git a/app/theme/brave/android/res_brave_nightly_base/values/channel_constants.xml b/app/theme/brave/android/res_brave_nightly_base/values/channel_constants.xml index d1f7f510f8de..bcd336dcd3dd 100644 --- a/app/theme/brave/android/res_brave_nightly_base/values/channel_constants.xml +++ b/app/theme/brave/android/res_brave_nightly_base/values/channel_constants.xml @@ -10,4 +10,5 @@ Brave - Nightly Brave bookmarks Brave search + Brave quick action search diff --git a/app/theme/brave/android/values/channel_constants.xml b/app/theme/brave/android/values/channel_constants.xml index bf3e867eaa07..6c19ba4a5398 100644 --- a/app/theme/brave/android/values/channel_constants.xml +++ b/app/theme/brave/android/values/channel_constants.xml @@ -8,4 +8,5 @@ Brave - Debug Brave bookmarks Brave search + Brave quick action search diff --git a/app/url_handler_intent_picker_strings.grdp b/app/url_handler_intent_picker_strings.grdp new file mode 100644 index 000000000000..b2232835281c --- /dev/null +++ b/app/url_handler_intent_picker_strings.grdp @@ -0,0 +1,23 @@ + + + + + + Which application do you want to use? + + + Remember my choice + + + Open + + + Cancel + + + $1Demo App ($2Work) + + + Publisher: $1example.com + + diff --git a/app/whats_new_strings.grdp b/app/whats_new_strings.grdp new file mode 100644 index 000000000000..fb37bffbd17b --- /dev/null +++ b/app/whats_new_strings.grdp @@ -0,0 +1,10 @@ + + + + + This page can't be reached + + + Reload the page or try again later + + diff --git a/browser/android/BUILD.gn b/browser/android/BUILD.gn index a382414c640e..b4e1d29f84df 100644 --- a/browser/android/BUILD.gn +++ b/browser/android/BUILD.gn @@ -24,7 +24,7 @@ source_set("android_browser_process") { "//brave/components/brave_sync", "//brave/components/brave_sync:crypto", "//brave/components/brave_sync:prefs", - "//brave/components/brave_sync:profile_sync_service_helper", + "//brave/components/brave_sync:sync_service_impl_helper", "//brave/components/l10n/browser", "//chrome/android:jni_headers", "//chrome/common", diff --git a/browser/android/brave_sync_worker.cc b/browser/android/brave_sync_worker.cc index d40b62fe4123..4b60a204fde2 100644 --- a/browser/android/brave_sync_worker.cc +++ b/browser/android/brave_sync_worker.cc @@ -17,13 +17,13 @@ #include "brave/build/android/jni_headers/BraveSyncWorker_jni.h" #include "brave/components/brave_sync/brave_sync_prefs.h" #include "brave/components/brave_sync/crypto/crypto.h" -#include "brave/components/brave_sync/profile_sync_service_helper.h" -#include "brave/components/sync/driver/brave_sync_profile_sync_service.h" +#include "brave/components/brave_sync/sync_service_impl_helper.h" +#include "brave/components/sync/driver/brave_sync_service_impl.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/sync/device_info_sync_service_factory.h" -#include "chrome/browser/sync/profile_sync_service_factory.h" +#include "chrome/browser/sync/sync_service_factory.h" #include "components/sync/driver/sync_service.h" #include "components/sync/driver/sync_user_settings.h" @@ -33,7 +33,7 @@ #include "third_party/leveldatabase/src/include/leveldb/db.h" -// TODO(alexeybarabash): consider use of java ProfileSyncService methods: +// TODO(alexeybarabash): consider use of java SyncServiceImpl methods: // addSyncStateChangedListener // removeSyncStateChangedListener // requestStart @@ -116,10 +116,10 @@ void BraveSyncWorker::SaveCodeWords( passphrase_ = str_passphrase; } -syncer::BraveProfileSyncService* BraveSyncWorker::GetSyncService() const { - return ProfileSyncServiceFactory::IsSyncAllowed(profile_) - ? static_cast( - ProfileSyncServiceFactory::GetForProfile(profile_)) +syncer::BraveSyncServiceImpl* BraveSyncWorker::GetSyncService() const { + return SyncServiceFactory::IsSyncAllowed(profile_) + ? static_cast( + SyncServiceFactory::GetForProfile(profile_)) : nullptr; } @@ -127,8 +127,7 @@ syncer::BraveProfileSyncService* BraveSyncWorker::GetSyncService() const { // bring the logic of enabling / disabling sync from deskop to Android void BraveSyncWorker::RequestSync(JNIEnv* env) { - syncer::SyncService* service = - ProfileSyncServiceFactory::GetForProfile(profile_); + syncer::SyncService* service = SyncServiceFactory::GetForProfile(profile_); if (service && !sync_service_observer_.IsObservingSource(service)) { sync_service_observer_.AddObservation(service); diff --git a/browser/android/brave_sync_worker.h b/browser/android/brave_sync_worker.h index 730989566711..a0eb00fe30ac 100644 --- a/browser/android/brave_sync_worker.h +++ b/browser/android/brave_sync_worker.h @@ -17,7 +17,7 @@ class Profile; namespace syncer { -class BraveProfileSyncService; +class BraveSyncServiceImpl; } // namespace syncer namespace chrome { @@ -53,7 +53,7 @@ class BraveSyncWorker : public syncer::SyncServiceObserver { bool sync_v2_migration_notice_dismissed); private: - syncer::BraveProfileSyncService* GetSyncService() const; + syncer::BraveSyncServiceImpl* GetSyncService() const; void MarkFirstSetupComplete(); // syncer::SyncServiceObserver implementation. diff --git a/browser/brave_browser_main_parts.cc b/browser/brave_browser_main_parts.cc index b1a18e4a6dfb..2a24b8ae2e10 100644 --- a/browser/brave_browser_main_parts.cc +++ b/browser/brave_browser_main_parts.cc @@ -48,7 +48,7 @@ #if !defined(OS_ANDROID) #include "brave/browser/infobars/sync_v2_migrate_infobar_delegate.h" -#include "chrome/browser/sync/profile_sync_service_factory.h" +#include "chrome/browser/sync/sync_service_factory.h" #include "components/sync/driver/sync_service.h" #include "components/sync/driver/sync_user_settings.h" #endif @@ -114,10 +114,9 @@ void BraveBrowserMainParts::PostBrowserStart() { if (infobar_manager) { BraveConfirmP3AInfoBarDelegate::Create( infobar_manager, g_browser_process->local_state()); - auto* sync_service = - ProfileSyncServiceFactory::IsSyncAllowed(profile()) - ? ProfileSyncServiceFactory::GetForProfile(profile()) - : nullptr; + auto* sync_service = SyncServiceFactory::IsSyncAllowed(profile()) + ? SyncServiceFactory::GetForProfile(profile()) + : nullptr; const bool is_v2_user = sync_service && sync_service->GetUserSettings()->IsFirstSetupComplete(); diff --git a/browser/brave_content_browser_client.cc b/browser/brave_content_browser_client.cc index 6f0ce70cd0d8..7bd58e8a69ec 100644 --- a/browser/brave_content_browser_client.cc +++ b/browser/brave_content_browser_client.cc @@ -74,11 +74,13 @@ #include "content/public/common/content_switches.h" #include "extensions/buildflags/buildflags.h" #include "mojo/public/cpp/bindings/pending_receiver.h" +#include "mojo/public/cpp/bindings/self_owned_receiver.h" #include "net/base/registry_controlled_domains/registry_controlled_domain.h" #include "net/cookies/site_for_cookies.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h" #include "third_party/blink/public/common/loader/url_loader_throttle.h" #include "third_party/blink/public/mojom/webpreferences/web_preferences.mojom.h" +#include "third_party/widevine/cdm/buildflags.h" #include "ui/base/l10n/l10n_util.h" using blink::web_pref::WebPreferences; @@ -139,6 +141,10 @@ using extensions::ChromeContentBrowserClientExtensionsPart; #include "brave/browser/ftx/ftx_protocol_handler.h" #endif +#if BUILDFLAG(ENABLE_WIDEVINE) +#include "brave/browser/brave_drm_tab_helper.h" +#endif + #if BUILDFLAG(BRAVE_WALLET_ENABLED) #include "brave/browser/brave_wallet/brave_wallet_context_utils.h" #include "brave/browser/brave_wallet/rpc_controller_factory.h" @@ -305,6 +311,36 @@ void BraveContentBrowserClient::RenderProcessWillLaunch( ChromeContentBrowserClient::RenderProcessWillLaunch(host); } +bool BraveContentBrowserClient::BindAssociatedReceiverFromFrame( + content::RenderFrameHost* render_frame_host, + const std::string& interface_name, + mojo::ScopedInterfaceEndpointHandle* handle) { + if (ChromeContentBrowserClient::BindAssociatedReceiverFromFrame( + render_frame_host, interface_name, handle)) { + return true; + } + +#if BUILDFLAG(ENABLE_WIDEVINE) + if (interface_name == brave_drm::mojom::BraveDRM::Name_) { + BraveDrmTabHelper::BindBraveDRM( + mojo::PendingAssociatedReceiver( + std::move(*handle)), + render_frame_host); + return true; + } +#endif // BUILDFLAG(ENABLE_WIDEVINE) + + if (interface_name == brave_shields::mojom::BraveShieldsHost::Name_) { + brave_shields::BraveShieldsWebContentsObserver::BindBraveShieldsHost( + mojo::PendingAssociatedReceiver( + std::move(*handle)), + render_frame_host); + return true; + } + + return false; +} + content::ContentBrowserClient::AllowWebBluetoothResult BraveContentBrowserClient::AllowWebBluetooth( content::BrowserContext* browser_context, @@ -351,7 +387,7 @@ void BraveContentBrowserClient::RegisterBrowserInterfaceBindersForFrame( bool BraveContentBrowserClient::HandleExternalProtocol( const GURL& url, - content::WebContents::OnceGetter web_contents_getter, + content::WebContents::Getter web_contents_getter, int child_id, int frame_tree_node_id, content::NavigationUIData* navigation_data, @@ -362,49 +398,46 @@ bool BraveContentBrowserClient::HandleExternalProtocol( mojo::PendingRemote* out_factory) { #if BUILDFLAG(ENABLE_BRAVE_WEBTORRENT) if (webtorrent::IsMagnetProtocol(url)) { - webtorrent::HandleMagnetProtocol(url, std::move(web_contents_getter), - page_transition, has_user_gesture, - initiating_origin); + webtorrent::HandleMagnetProtocol(url, web_contents_getter, page_transition, + has_user_gesture, initiating_origin); return true; } #endif if (brave_rewards::IsRewardsProtocol(url)) { - brave_rewards::HandleRewardsProtocol(url, std::move(web_contents_getter), + brave_rewards::HandleRewardsProtocol(url, web_contents_getter, page_transition, has_user_gesture); return true; } #if BUILDFLAG(BINANCE_ENABLED) if (binance::IsBinanceProtocol(url)) { - binance::HandleBinanceProtocol(url, std::move(web_contents_getter), - page_transition, has_user_gesture, - initiating_origin); + binance::HandleBinanceProtocol(url, web_contents_getter, page_transition, + has_user_gesture, initiating_origin); return true; } #endif #if BUILDFLAG(GEMINI_ENABLED) if (gemini::IsGeminiProtocol(url)) { - gemini::HandleGeminiProtocol(url, std::move(web_contents_getter), - page_transition, has_user_gesture, - initiating_origin); + gemini::HandleGeminiProtocol(url, web_contents_getter, page_transition, + has_user_gesture, initiating_origin); return true; } #endif #if BUILDFLAG(ENABLE_FTX) if (ftx::IsFTXProtocol(url)) { - ftx::HandleFTXProtocol(url, std::move(web_contents_getter), page_transition, + ftx::HandleFTXProtocol(url, web_contents_getter, page_transition, has_user_gesture, initiating_origin); return true; } #endif return ChromeContentBrowserClient::HandleExternalProtocol( - 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); + url, 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( @@ -417,7 +450,15 @@ void BraveContentBrowserClient::AppendExtraCommandLineSwitches( if (process_type == switches::kRendererProcess) { uint64_t session_token = 12345; // the kinda thing an idiot would have on his luggage - if (!command_line->HasSwitch(switches::kTestType)) { + + // Command line parameters from the browser process are propagated to the + // renderers *after* ContentBrowserClient::AppendExtraCommandLineSwitches() + // is called from RenderProcessHostImpl::AppendRendererCommandLine(). This + // means we have to inspect the main browser process' parameters for the + // |switches::kTestType| as it will be too soon to find it on command_line. + const base::CommandLine& browser_command_line = + *base::CommandLine::ForCurrentProcess(); + if (!browser_command_line.HasSwitch(switches::kTestType)) { content::RenderProcessHost* process = content::RenderProcessHost::FromID(child_process_id); Profile* profile = diff --git a/browser/brave_content_browser_client.h b/browser/brave_content_browser_client.h index 66272575ebe0..69ca7930867a 100644 --- a/browser/brave_content_browser_client.h +++ b/browser/brave_content_browser_client.h @@ -42,10 +42,14 @@ class BraveContentBrowserClient : public ChromeContentBrowserClient { const content::MainFunctionParams& parameters) override; void BrowserURLHandlerCreated(content::BrowserURLHandler* handler) override; void RenderProcessWillLaunch(content::RenderProcessHost* host) override; + bool BindAssociatedReceiverFromFrame( + content::RenderFrameHost* render_frame_host, + const std::string& interface_name, + mojo::ScopedInterfaceEndpointHandle* handle) override; bool HandleExternalProtocol( const GURL& url, - content::WebContents::OnceGetter web_contents_getter, + content::WebContents::Getter web_contents_getter, int child_id, int frame_tree_node_id, content::NavigationUIData* navigation_data, diff --git a/browser/brave_drm_tab_helper.cc b/browser/brave_drm_tab_helper.cc index 086f62900b79..96d9ce3dde94 100644 --- a/browser/brave_drm_tab_helper.cc +++ b/browser/brave_drm_tab_helper.cc @@ -6,6 +6,7 @@ #include "brave/browser/brave_drm_tab_helper.h" #include +#include #include #include "brave/browser/widevine/widevine_utils.h" @@ -49,7 +50,7 @@ const char BraveDrmTabHelper::kWidevineComponentId[] = "oimompecagnajdejgnnjijobebaeigek"; BraveDrmTabHelper::BraveDrmTabHelper(content::WebContents* contents) - : WebContentsObserver(contents), receivers_(contents, this) { + : WebContentsObserver(contents), brave_drm_receivers_(contents, this) { auto* updater = g_browser_process->component_updater(); // We don't need to observe if widevine is already registered. if (!IsAlreadyRegistered(updater)) @@ -58,6 +59,20 @@ BraveDrmTabHelper::BraveDrmTabHelper(content::WebContents* contents) BraveDrmTabHelper::~BraveDrmTabHelper() {} +// static +void BraveDrmTabHelper::BindBraveDRM( + mojo::PendingAssociatedReceiver receiver, + content::RenderFrameHost* rfh) { + auto* web_contents = content::WebContents::FromRenderFrameHost(rfh); + if (!web_contents) + return; + + auto* tab_helper = BraveDrmTabHelper::FromWebContents(web_contents); + if (!tab_helper) + return; + tab_helper->brave_drm_receivers_.Bind(rfh, std::move(receiver)); +} + bool BraveDrmTabHelper::ShouldShowWidevineOptIn() const { // If the user already opted in, don't offer it. PrefService* prefs = diff --git a/browser/brave_drm_tab_helper.h b/browser/brave_drm_tab_helper.h index 220761a39324..d64778380b12 100644 --- a/browser/brave_drm_tab_helper.h +++ b/browser/brave_drm_tab_helper.h @@ -11,8 +11,8 @@ #include "base/scoped_observation.h" #include "brave/components/brave_drm/brave_drm.mojom.h" #include "components/component_updater/component_updater_service.h" +#include "content/public/browser/render_frame_host_receiver_set.h" #include "content/public/browser/web_contents_observer.h" -#include "content/public/browser/web_contents_receiver_set.h" #include "content/public/browser/web_contents_user_data.h" // Reacts to DRM content detected on the renderer side. @@ -29,6 +29,10 @@ class BraveDrmTabHelper final explicit BraveDrmTabHelper(content::WebContents* contents); ~BraveDrmTabHelper() override; + static void BindBraveDRM( + mojo::PendingAssociatedReceiver receiver, + content::RenderFrameHost* rfh); + bool ShouldShowWidevineOptIn() const; // content::WebContentsObserver @@ -44,7 +48,8 @@ class BraveDrmTabHelper final WEB_CONTENTS_USER_DATA_KEY_DECL(); private: - content::WebContentsFrameReceiverSet receivers_; + content::RenderFrameHostReceiverSet + brave_drm_receivers_; // Permission request is done only once during the navigation. If user // chooses dismiss/deny, additional request is added again only when new diff --git a/browser/brave_prefs_browsertest.cc b/browser/brave_prefs_browsertest.cc index f7c42ad51d6a..edf3715385a9 100644 --- a/browser/brave_prefs_browsertest.cc +++ b/browser/brave_prefs_browsertest.cc @@ -13,6 +13,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/net/prediction_options.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/webui/new_tab_page/ntp_pref_names.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/chrome_test_utils.h" #include "components/embedder_support/pref_names.h" @@ -145,7 +146,7 @@ IN_PROC_BROWSER_TEST_F(BraveProfilePrefsBrowserTest, prefs::kCloudPrintSubmitEnabled)); #if !defined(OS_ANDROID) EXPECT_TRUE(chrome_test_utils::GetProfile(this)->GetPrefs()->GetBoolean( - prefs::kNtpUseMostVisitedTiles)); + ntp_prefs::kNtpUseMostVisitedTiles)); #endif EXPECT_TRUE(chrome_test_utils::GetProfile(this)->GetPrefs()->GetBoolean( prefs::kHideWebStoreIcon)); diff --git a/browser/brave_profile_prefs.cc b/browser/brave_profile_prefs.cc index cd5a1ee930b9..237f1850b30c 100644 --- a/browser/brave_profile_prefs.cc +++ b/browser/brave_profile_prefs.cc @@ -38,6 +38,7 @@ #include "brave/components/tor/buildflags/buildflags.h" #include "chrome/browser/net/prediction_options.h" #include "chrome/browser/prefs/session_startup_pref.h" +#include "chrome/browser/ui/webui/new_tab_page/ntp_pref_names.h" #include "chrome/common/pref_names.h" #include "components/autofill/core/common/autofill_prefs.h" #include "components/content_settings/core/common/pref_names.h" @@ -236,19 +237,6 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { // Hangouts registry->RegisterBooleanPref(kHangoutsEnabled, true); - // Media Router - registry->SetDefaultPrefValue(prefs::kEnableMediaRouter, base::Value(false)); - - // 1. We do not want to enable the MediaRouter pref directly, so - // using a proxy pref to handle Media Router setting - // 2. On upgrade users might have enabled Media Router and the pref should - // be set correctly, so we use feature switch to set the initial value -#if BUILDFLAG(ENABLE_EXTENSIONS) - registry->RegisterBooleanPref( - kBraveEnabledMediaRouter, - FeatureSwitch::load_media_router_component_extension()->IsEnabled()); -#endif - // Restore last profile on restart registry->SetDefaultPrefValue( prefs::kRestoreOnStartup, @@ -404,7 +392,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { #if !defined(OS_ANDROID) // Turn on most visited mode on NTP by default. // We can turn customization mode on when we have add-shortcut feature. - registry->SetDefaultPrefValue(prefs::kNtpUseMostVisitedTiles, + registry->SetDefaultPrefValue(ntp_prefs::kNtpUseMostVisitedTiles, base::Value(true)); RegisterDefaultBraveBrowserPromptPrefs(registry); #endif diff --git a/browser/brave_resources_util_unittest.cc b/browser/brave_resources_util_unittest.cc index 6eec7a149d92..85fae80da2e1 100644 --- a/browser/brave_resources_util_unittest.cc +++ b/browser/brave_resources_util_unittest.cc @@ -5,8 +5,8 @@ #include +#include "base/cxx17_backports.h" #include "base/macros.h" -#include "base/stl_util.h" #include "brave/grit/brave_theme_resources.h" #include "build/build_config.h" #include "chrome/browser/resources_util.h" diff --git a/browser/brave_shields/brave_shields_web_contents_observer.cc b/browser/brave_shields/brave_shields_web_contents_observer.cc index 8a167a1b1483..07daa78ff3cf 100644 --- a/browser/brave_shields/brave_shields_web_contents_observer.cc +++ b/browser/brave_shields/brave_shields_web_contents_observer.cc @@ -48,8 +48,12 @@ using extensions::EventRouter; using content::RenderFrameHost; using content::WebContents; +namespace brave_shields { + namespace { +BraveShieldsWebContentsObserver* g_receiver_impl_for_testing = nullptr; + // Content Settings are only sent to the main frame currently. Chrome may fix // this at some point, but for now we do this as a work-around. You can verify // if this is fixed by running the following test: npm run test -- @@ -78,16 +82,13 @@ void UpdateContentSettingsToRendererFrames(content::WebContents* web_contents) { } // namespace -namespace brave_shields { - BraveShieldsWebContentsObserver::~BraveShieldsWebContentsObserver() { brave_shields_remotes_.clear(); } BraveShieldsWebContentsObserver::BraveShieldsWebContentsObserver( WebContents* web_contents) - : WebContentsObserver(web_contents), - brave_shields_receivers_(web_contents, this) {} + : WebContentsObserver(web_contents), receivers_(web_contents, this) {} void BraveShieldsWebContentsObserver::RenderFrameCreated(RenderFrameHost* rfh) { if (rfh && allowed_script_origins_.size()) { @@ -126,6 +127,27 @@ void BraveShieldsWebContentsObserver::AddBlockedSubresource( blocked_url_paths_.insert(subresource); } +// static +void BraveShieldsWebContentsObserver::BindBraveShieldsHost( + mojo::PendingAssociatedReceiver + receiver, + content::RenderFrameHost* rfh) { + if (g_receiver_impl_for_testing) { + g_receiver_impl_for_testing->BindReceiver(std::move(receiver), rfh); + return; + } + + auto* web_contents = content::WebContents::FromRenderFrameHost(rfh); + if (!web_contents) + return; + + auto* shields_host = + BraveShieldsWebContentsObserver::FromWebContents(web_contents); + if (!shields_host) + return; + shields_host->BindReceiver(std::move(receiver), rfh); +} + // static void BraveShieldsWebContentsObserver::DispatchBlockedEvent( const GURL& request_url, @@ -196,8 +218,8 @@ void BraveShieldsWebContentsObserver::DispatchBlockedEventForWebContents( void BraveShieldsWebContentsObserver::OnJavaScriptBlocked( const std::u16string& details) { - WebContents* web_contents = WebContents::FromRenderFrameHost( - brave_shields_receivers_.GetCurrentTargetFrame()); + WebContents* web_contents = + WebContents::FromRenderFrameHost(receivers_.GetCurrentTargetFrame()); if (!web_contents) return; @@ -246,6 +268,19 @@ void BraveShieldsWebContentsObserver::AllowScriptsOnce( allowed_script_origins_ = std::move(origins); } +// static +void BraveShieldsWebContentsObserver::SetReceiverImplForTesting( + BraveShieldsWebContentsObserver* impl) { + g_receiver_impl_for_testing = impl; +} + +void BraveShieldsWebContentsObserver::BindReceiver( + mojo::PendingAssociatedReceiver + receiver, + content::RenderFrameHost* rfh) { + receivers_.Bind(rfh, std::move(receiver)); +} + mojo::AssociatedRemote& BraveShieldsWebContentsObserver::GetBraveShieldsRemote( content::RenderFrameHost* rfh) { diff --git a/browser/brave_shields/brave_shields_web_contents_observer.h b/browser/brave_shields/brave_shields_web_contents_observer.h index d52f74320360..249c82e9dabb 100644 --- a/browser/brave_shields/brave_shields_web_contents_observer.h +++ b/browser/brave_shields/brave_shields_web_contents_observer.h @@ -15,8 +15,8 @@ #include "base/macros.h" #include "base/synchronization/lock.h" #include "brave/components/brave_shields/common/brave_shields.mojom.h" +#include "content/public/browser/render_frame_host_receiver_set.h" #include "content/public/browser/web_contents_observer.h" -#include "content/public/browser/web_contents_receiver_set.h" #include "content/public/browser/web_contents_user_data.h" namespace content { @@ -35,6 +35,11 @@ class BraveShieldsWebContentsObserver explicit BraveShieldsWebContentsObserver(content::WebContents*); ~BraveShieldsWebContentsObserver() override; + static void BindBraveShieldsHost( + mojo::PendingAssociatedReceiver + receiver, + content::RenderFrameHost* rfh); + static void RegisterProfilePrefs(PrefRegistrySimple* registry); static void DispatchBlockedEventForWebContents( const std::string& block_type, @@ -63,11 +68,23 @@ class BraveShieldsWebContentsObserver private: friend class content::WebContentsUserData; + friend class BraveShieldsWebContentsObserverBrowserTest; using BraveShieldsRemotesMap = base::flat_map< content::RenderFrameHost*, mojo::AssociatedRemote>; + // Allows indicating a implementor of brave_shields::mojom::BraveShieldsHost + // other than this own class, for testing purposes only. + static void SetReceiverImplForTesting(BraveShieldsWebContentsObserver* impl); + + // Only used from the BindBraveShieldsHost() static method, useful to bind the + // mojo receiver of brave_shields::mojom::BraveShieldsHost to a different + // implementor when needed, for testing purposes. + void BindReceiver(mojo::PendingAssociatedReceiver< + brave_shields::mojom::BraveShieldsHost> receiver, + content::RenderFrameHost* rfh); + // Return an already bound remote for the brave_shields::mojom::BraveShields // mojo interface. It is an error to call this method with an invalid |rfh|. mojo::AssociatedRemote& @@ -78,8 +95,8 @@ class BraveShieldsWebContentsObserver // continually tries to load the same blocked URLs. std::set blocked_url_paths_; - content::WebContentsFrameReceiverSet - brave_shields_receivers_; + content::RenderFrameHostReceiverSet + receivers_; // Map of remote endpoints for the brave_shields::mojom::BraveShields mojo // interface, to prevent binding a new remote each time it's used. diff --git a/browser/brave_shields/brave_shields_web_contents_observer_browsertest.cc b/browser/brave_shields/brave_shields_web_contents_observer_browsertest.cc index 63d929a149e3..973614ac6f1b 100644 --- a/browser/brave_shields/brave_shields_web_contents_observer_browsertest.cc +++ b/browser/brave_shields/brave_shields_web_contents_observer_browsertest.cc @@ -66,14 +66,20 @@ class BraveShieldsWebContentsObserverBrowserTest : public InProcessBrowserTest { HostContentSettingsMapFactory::GetForProfile(browser()->profile()); // We can't simply create a new BraveShieldsWebContentsObserver for the same - // WebContents, as that class will instatiate a WebContentsFrameReceiverSet - // and we can't have two at the same time for the same mojo interface. Thus, - // we need to remove the one created along with the initialization of the - // browser process before creating the one we need for testing. - content::RemoveWebContentsReceiverSet( - GetWebContents(), brave_shields::mojom::BraveShieldsHost::Name_); + // WebContents, as that class will instatiate a RenderFrameHostReceiverSet + // and we won't be able to intercept the mojo messages received for the + // brave_shields::mojom::BraveShieldsHost interface for testing purposes. + // Instead we call SetReceiverImplForTesting() to make sure that the mojo + // receiver will be bound to our TestBraveShieldsWebContentsObserver class, + // allowing us to intercept any message we are interested in. brave_shields_web_contents_observer_ = new TestBraveShieldsWebContentsObserver(GetWebContents()); + BraveShieldsWebContentsObserver::SetReceiverImplForTesting( + brave_shields_web_contents_observer_); + } + + void TearDownOnMainThread() override { + BraveShieldsWebContentsObserver::SetReceiverImplForTesting(nullptr); } content::WebContents* GetWebContents() { diff --git a/browser/brave_stats/brave_stats_updater_params.cc b/browser/brave_stats/brave_stats_updater_params.cc index eadfd78a92bb..7c88e7d1be35 100644 --- a/browser/brave_stats/brave_stats_updater_params.cc +++ b/browser/brave_stats/brave_stats_updater_params.cc @@ -8,6 +8,7 @@ #include "brave/browser/brave_stats/brave_stats_updater_params.h" #include "brave/components/brave_referrals/buildflags/buildflags.h" +#include "base/logging.h" #include "base/strings/string_util.h" #include "base/system/sys_info.h" #include "base/threading/thread_restrictions.h" diff --git a/browser/brave_wallet/brave_wallet_provider_delegate_impl.cc b/browser/brave_wallet/brave_wallet_provider_delegate_impl.cc index 9a979a2fac5a..1f519816e125 100644 --- a/browser/brave_wallet/brave_wallet_provider_delegate_impl.cc +++ b/browser/brave_wallet/brave_wallet_provider_delegate_impl.cc @@ -52,7 +52,7 @@ BraveWalletProviderDelegateImpl::BraveWalletProviderDelegateImpl( content::WebContents* web_contents, content::RenderFrameHost* const render_frame_host) : web_contents_(web_contents), - routing_id_(render_frame_host->GetGlobalFrameRoutingId()), + host_id_(render_frame_host->GetGlobalId()), weak_ptr_factory_(this) {} BraveWalletProviderDelegateImpl::~BraveWalletProviderDelegateImpl() = default; @@ -100,7 +100,7 @@ void BraveWalletProviderDelegateImpl::ContinueRequestEthereumPermissions( // Request accounts if no accounts are connected. keyring_controller_->GetDefaultKeyringInfo(base::BindOnce( - [](const content::GlobalFrameRoutingId& routing_id, + [](const content::GlobalRenderFrameHostId& host_id, RequestEthereumPermissionsCallback callback, brave_wallet::mojom::KeyringInfoPtr keyring_info) { std::vector addresses; @@ -108,18 +108,18 @@ void BraveWalletProviderDelegateImpl::ContinueRequestEthereumPermissions( addresses.push_back(account_info->address); } permissions::BraveEthereumPermissionContext::RequestPermissions( - content::RenderFrameHost::FromID(routing_id), addresses, + content::RenderFrameHost::FromID(host_id), addresses, base::BindOnce(&OnRequestEthereumPermissions, addresses, std::move(callback))); }, - routing_id_, std::move(callback))); + host_id_, std::move(callback))); } void BraveWalletProviderDelegateImpl::GetAllowedAccounts( GetAllowedAccountsCallback callback) { EnsureConnected(); keyring_controller_->GetDefaultKeyringInfo(base::BindOnce( - [](const content::GlobalFrameRoutingId& routing_id, + [](const content::GlobalRenderFrameHostId& host_id, GetAllowedAccountsCallback callback, brave_wallet::mojom::KeyringInfoPtr keyring_info) { std::vector addresses; @@ -127,10 +127,10 @@ void BraveWalletProviderDelegateImpl::GetAllowedAccounts( addresses.push_back(account_info->address); } permissions::BraveEthereumPermissionContext::GetAllowedAccounts( - content::RenderFrameHost::FromID(routing_id), addresses, + content::RenderFrameHost::FromID(host_id), addresses, base::BindOnce(&OnGetAllowedAccounts, std::move(callback))); }, - routing_id_, std::move(callback))); + host_id_, std::move(callback))); } } // namespace brave_wallet diff --git a/browser/brave_wallet/brave_wallet_provider_delegate_impl.h b/browser/brave_wallet/brave_wallet_provider_delegate_impl.h index 318db262ab62..26e48c7cb019 100644 --- a/browser/brave_wallet/brave_wallet_provider_delegate_impl.h +++ b/browser/brave_wallet/brave_wallet_provider_delegate_impl.h @@ -48,7 +48,7 @@ class BraveWalletProviderDelegateImpl : public BraveWalletProviderDelegate { mojo::Remote keyring_controller_; content::WebContents* web_contents_; - const content::GlobalFrameRoutingId routing_id_; + const content::GlobalRenderFrameHostId host_id_; base::WeakPtrFactory weak_ptr_factory_; }; diff --git a/browser/download/brave_download_item_model_unittest.cc b/browser/download/brave_download_item_model_unittest.cc index c7932e1c370f..d7f1f9505162 100644 --- a/browser/download/brave_download_item_model_unittest.cc +++ b/browser/download/brave_download_item_model_unittest.cc @@ -10,10 +10,10 @@ #include +#include "base/cxx17_backports.h" #include "base/i18n/rtl.h" #include "base/logging.h" #include "base/macros.h" -#include "base/stl_util.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/settings_private/brave_prefs_util.cc b/browser/extensions/api/settings_private/brave_prefs_util.cc index f2a7341fd1b0..fb32c74e72d8 100644 --- a/browser/extensions/api/settings_private/brave_prefs_util.cc +++ b/browser/extensions/api/settings_private/brave_prefs_util.cc @@ -230,9 +230,6 @@ const PrefsUtil::TypedPrefMap& BravePrefsUtil::GetAllowlistedKeys() { (*s_brave_allowlist)[kIpfsStorageMax] = settings_api::PrefType::PREF_TYPE_NUMBER; #endif - // Media Router Pref - (*s_brave_allowlist)[kBraveEnabledMediaRouter] = - settings_api::PrefType::PREF_TYPE_BOOLEAN; #if !BUILDFLAG(USE_GCM_FROM_PLATFORM) // Push Messaging Pref diff --git a/browser/extensions/ethereum_remote_client_unittest.cc b/browser/extensions/ethereum_remote_client_unittest.cc index e7adbc4a3c08..c7a2294b93a5 100644 --- a/browser/extensions/ethereum_remote_client_unittest.cc +++ b/browser/extensions/ethereum_remote_client_unittest.cc @@ -5,6 +5,8 @@ #include "brave/browser/ethereum_remote_client/ethereum_remote_client_service.h" +#include + #include "brave/browser/ethereum_remote_client/pref_names.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/test/base/testing_browser_process.h" @@ -46,77 +48,83 @@ TEST_F(BraveWalletUnitTest, TestGetRandomSeed) { } TEST_F(BraveWalletUnitTest, TestGetEthereumRemoteClientSeedFromRootSeed) { - const char seed[32] = {48, 196, 56, 174, 243, 75, 120, 235, 37, 174, 254, - 97, 37, 205, 101, 93, 181, 23, 190, 82, 53, 180, - 51, 198, 232, 187, 188, 220, 160, 187, 212, 28}; - const char expected_derived_seed[32] = { + constexpr std::array seed = { + 48, 196, 56, 174, 243, 75, 120, 235, 37, 174, 254, + 97, 37, 205, 101, 93, 181, 23, 190, 82, 53, 180, + 51, 198, 232, 187, 188, 220, 160, 187, 212, 28}; + constexpr std::array expected_derived_seed = { 142, 147, 10, 180, 36, 89, 142, 110, 52, 85, 216, 222, 83, 56, 38, 206, 104, 133, 77, 246, 219, 90, 105, 35, 52, 76, 223, 24, 183, 138, 244, 72}; std::string derived = EthereumRemoteClientService::GetEthereumRemoteClientSeedFromRootSeed( - std::string(seed, base::size(seed))); - ASSERT_EQ(derived, std::string(expected_derived_seed, - base::size(expected_derived_seed))); + std::string(seed.begin(), seed.end())); + ASSERT_EQ(derived, std::string(expected_derived_seed.begin(), + expected_derived_seed.end())); } TEST_F(BraveWalletUnitTest, TestBitGoSeedFromRootSeed) { - const char seed[32] = {48, 196, 56, 174, 243, 75, 120, 235, 37, 174, 254, - 97, 37, 205, 101, 93, 181, 23, 190, 82, 53, 180, - 51, 198, 232, 187, 188, 220, 160, 187, 212, 28}; - const char expected_derived_seed[32] = { + constexpr std::array seed = { + 48, 196, 56, 174, 243, 75, 120, 235, 37, 174, 254, + 97, 37, 205, 101, 93, 181, 23, 190, 82, 53, 180, + 51, 198, 232, 187, 188, 220, 160, 187, 212, 28}; + constexpr std::array expected_derived_seed = { 101, 6, 89, 61, 129, 81, 104, 13, 48, 59, 117, 46, 73, 177, 168, 248, 91, 84, 145, 54, 61, 157, 27, 254, 45, 203, 71, 123, 188, 29, 224, 203}; std::string derived = EthereumRemoteClientService::GetBitGoSeedFromRootSeed( - std::string(seed, base::size(seed))); - ASSERT_EQ(derived, std::string(expected_derived_seed, - base::size(expected_derived_seed))); + std::string(seed.begin(), seed.end())); + ASSERT_EQ(derived, std::string(expected_derived_seed.begin(), + expected_derived_seed.end())); } TEST_F(BraveWalletUnitTest, TestSealSeed) { - const char seed[32] = {48, 196, 56, 174, 243, 75, 120, 235, 37, 174, 254, - 97, 37, 205, 101, 93, 181, 23, 190, 82, 53, 180, - 51, 198, 232, 187, 188, 220, 160, 187, 212, 28}; - const char key[32] = {196, 34, 104, 152, 91, 63, 78, 171, 234, 163, 25, - 221, 80, 73, 158, 89, 52, 53, 227, 231, 152, 214, - 61, 210, 33, 54, 68, 171, 140, 239, 3, 158}; - const char nonce[12] = {200, 153, 224, 40, 58, 249, - 156, 33, 152, 207, 177, 12}; - const char expected_cipher_seed[48] = { + constexpr std::array seed = { + 48, 196, 56, 174, 243, 75, 120, 235, 37, 174, 254, + 97, 37, 205, 101, 93, 181, 23, 190, 82, 53, 180, + 51, 198, 232, 187, 188, 220, 160, 187, 212, 28}; + constexpr std::array key = { + 196, 34, 104, 152, 91, 63, 78, 171, 234, 163, 25, + 221, 80, 73, 158, 89, 52, 53, 227, 231, 152, 214, + 61, 210, 33, 54, 68, 171, 140, 239, 3, 158}; + constexpr std::array nonce = {200, 153, 224, 40, 58, 249, + 156, 33, 152, 207, 177, 12}; + constexpr std::array expected_cipher_seed = { 33, 11, 185, 125, 67, 27, 92, 110, 132, 238, 255, 8, 79, 7, 8, 40, 189, 211, 35, 122, 236, 183, 66, 212, 213, 68, 187, 103, 16, 138, 166, 0, 6, 128, 179, 64, 55, 160, 219, 8, 222, 231, 48, 93, 132, 131, 178, 177}; std::string cipher_seed; ASSERT_TRUE(EthereumRemoteClientService::SealSeed( - std::string(seed, base::size(seed)), std::string(key, base::size(key)), - std::string(nonce, base::size(nonce)), &cipher_seed)); - ASSERT_EQ(cipher_seed, std::string(expected_cipher_seed, - base::size(expected_cipher_seed))); + std::string(seed.begin(), seed.end()), + std::string(key.begin(), key.end()), + std::string(nonce.begin(), nonce.end()), &cipher_seed)); + ASSERT_EQ(cipher_seed, std::string(expected_cipher_seed.begin(), + expected_cipher_seed.end())); } TEST_F(BraveWalletUnitTest, TestOpenSeed) { - const char cipher_seed[48] = { + constexpr std::array cipher_seed = { 33, 11, 185, 125, 67, 27, 92, 110, 132, 238, 255, 8, 79, 7, 8, 40, 189, 211, 35, 122, 236, 183, 66, 212, 213, 68, 187, 103, 16, 138, 166, 0, 6, 128, 179, 64, 55, 160, 219, 8, 222, 231, 48, 93, 132, 131, 178, 177}; - const char key[32] = {196, 34, 104, 152, 91, 63, 78, 171, 234, 163, 25, - 221, 80, 73, 158, 89, 52, 53, 227, 231, 152, 214, - 61, 210, 33, 54, 68, 171, 140, 239, 3, 158}; - const char nonce[12] = {200, 153, 224, 40, 58, 249, - 156, 33, 152, 207, 177, 12}; - const char expected_seed[32] = {48, 196, 56, 174, 243, 75, 120, 235, - 37, 174, 254, 97, 37, 205, 101, 93, - 181, 23, 190, 82, 53, 180, 51, 198, - 232, 187, 188, 220, 160, 187, 212, 28}; + constexpr std::array key = { + 196, 34, 104, 152, 91, 63, 78, 171, 234, 163, 25, + 221, 80, 73, 158, 89, 52, 53, 227, 231, 152, 214, + 61, 210, 33, 54, 68, 171, 140, 239, 3, 158}; + constexpr std::array nonce = {200, 153, 224, 40, 58, 249, + 156, 33, 152, 207, 177, 12}; + constexpr std::array expected_seed = { + 48, 196, 56, 174, 243, 75, 120, 235, 37, 174, 254, + 97, 37, 205, 101, 93, 181, 23, 190, 82, 53, 180, + 51, 198, 232, 187, 188, 220, 160, 187, 212, 28}; std::string seed; ASSERT_TRUE(EthereumRemoteClientService::OpenSeed( - std::string(cipher_seed, base::size(cipher_seed)), - std::string(key, base::size(key)), std::string(nonce, base::size(nonce)), - &seed)); - ASSERT_EQ(seed, std::string(expected_seed, 32)); + std::string(cipher_seed.begin(), cipher_seed.end()), + std::string(key.begin(), key.end()), + std::string(nonce.begin(), nonce.end()), &seed)); + ASSERT_EQ(seed, std::string(expected_seed.begin(), expected_seed.end())); } TEST_F(BraveWalletUnitTest, TestLoadFromPrefs) { @@ -131,30 +139,31 @@ TEST_F(BraveWalletUnitTest, TestLoadFromPrefs) { ProfileManager::GetActiveUserProfile()->GetPrefs(), &cipher_seed, &nonce)); - const char expected_nonce[12] = {200, 153, 224, 40, 58, 249, - 156, 33, 152, 207, 177, 12}; - const char expected_cipher_seed[48] = { + constexpr std::array expected_nonce = { + 200, 153, 224, 40, 58, 249, 156, 33, 152, 207, 177, 12}; + constexpr std::array expected_cipher_seed = { 33, 11, 185, 125, 67, 27, 92, 110, 132, 238, 255, 8, 79, 7, 8, 40, 189, 211, 35, 122, 236, 183, 66, 212, 213, 68, 187, 103, 16, 138, 166, 0, 6, 128, 179, 64, 55, 160, 219, 8, 222, 231, 48, 93, 132, 131, 178, 177}; - ASSERT_EQ(nonce, std::string(expected_nonce, base::size(expected_nonce))); - ASSERT_EQ(std::string(expected_cipher_seed, base::size(expected_cipher_seed)), - cipher_seed); + ASSERT_EQ(nonce, std::string(expected_nonce.begin(), expected_nonce.end())); + ASSERT_EQ( + std::string(expected_cipher_seed.begin(), expected_cipher_seed.end()), + cipher_seed); } TEST_F(BraveWalletUnitTest, TestSaveToPrefs) { - const char nonce[12] = {200, 153, 224, 40, 58, 249, - 156, 33, 152, 207, 177, 12}; - const char cipher_seed[48] = { + constexpr std::array nonce = {200, 153, 224, 40, 58, 249, + 156, 33, 152, 207, 177, 12}; + constexpr std::array cipher_seed = { 33, 11, 185, 125, 67, 27, 92, 110, 132, 238, 255, 8, 79, 7, 8, 40, 189, 211, 35, 122, 236, 183, 66, 212, 213, 68, 187, 103, 16, 138, 166, 0, 6, 128, 179, 64, 55, 160, 219, 8, 222, 231, 48, 93, 132, 131, 178, 177}; EthereumRemoteClientService::SaveToPrefs( ProfileManager::GetActiveUserProfile()->GetPrefs(), - std::string(cipher_seed, base::size(cipher_seed)), - std::string(nonce, base::size(nonce))); + std::string(cipher_seed.begin(), cipher_seed.end()), + std::string(nonce.begin(), nonce.end())); ASSERT_EQ(GetPrefs()->GetString(kERCAES256GCMSivNonce), "yJngKDr5nCGYz7EM"); ASSERT_EQ(GetPrefs()->GetString(kERCEncryptedSeed), diff --git a/browser/net/brave_proxying_url_loader_factory.cc b/browser/net/brave_proxying_url_loader_factory.cc index 784bd0dfa4c6..34813f9bd7d1 100644 --- a/browser/net/brave_proxying_url_loader_factory.cc +++ b/browser/net/brave_proxying_url_loader_factory.cc @@ -30,6 +30,7 @@ #include "net/url_request/url_request.h" #include "services/network/public/cpp/features.h" #include "services/network/public/cpp/parsed_headers.h" +#include "services/network/public/mojom/early_hints.mojom.h" #include "url/origin.h" namespace { @@ -577,15 +578,14 @@ void BraveProxyingURLLoaderFactory::InProgressRequest:: override_headers_ = nullptr; redirect_url_ = GURL(); - net::CompletionRepeatingCallback copyable_callback = - base::AdaptCallbackForRepeating(std::move(continuation)); + auto split_once_callback = base::SplitOnceCallback(std::move(continuation)); if (request_.url.SchemeIsHTTPOrHTTPS()) { ctx_ = brave::BraveRequestInfo::MakeCTX(request_, render_process_id_, frame_tree_node_id_, request_id_, browser_context_, ctx_); int result = factory_->request_handler_->OnHeadersReceived( - ctx_, copyable_callback, current_response_->headers.get(), - &override_headers_, &redirect_url_); + ctx_, std::move(split_once_callback.first), + current_response_->headers.get(), &override_headers_, &redirect_url_); if (result == net::ERR_BLOCKED_BY_CLIENT) { OnRequestError(network::URLLoaderCompletionStatus(result)); @@ -605,7 +605,7 @@ void BraveProxyingURLLoaderFactory::InProgressRequest:: DCHECK_EQ(net::OK, result); } - copyable_callback.Run(net::OK); + std::move(split_once_callback.second).Run(net::OK); } void BraveProxyingURLLoaderFactory::InProgressRequest::OnRequestError( diff --git a/browser/net/brave_proxying_url_loader_factory.h b/browser/net/brave_proxying_url_loader_factory.h index 989eeafb7064..cdf96d2b7d3b 100644 --- a/browser/net/brave_proxying_url_loader_factory.h +++ b/browser/net/brave_proxying_url_loader_factory.h @@ -28,9 +28,11 @@ #include "net/base/completion_once_callback.h" #include "net/traffic_annotation/network_traffic_annotation.h" #include "services/network/public/cpp/resource_request.h" +#include "services/network/public/mojom/early_hints.mojom-forward.h" #include "services/network/public/mojom/network_context.mojom.h" #include "services/network/public/mojom/url_loader.mojom.h" #include "services/network/public/mojom/url_loader_factory.mojom.h" +#include "services/network/public/mojom/url_response_head.mojom.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "url/gurl.h" diff --git a/browser/net/brave_request_handler.cc b/browser/net/brave_request_handler.cc index 938d4fe544a0..5514ccfcbbaa 100644 --- a/browser/net/brave_request_handler.cc +++ b/browser/net/brave_request_handler.cc @@ -8,6 +8,7 @@ #include #include +#include "base/containers/contains.h" #include "base/feature_list.h" #include "base/task/post_task.h" #include "brave/browser/net/brave_ad_block_csp_network_delegate_helper.h" diff --git a/browser/net/brave_site_hacks_network_delegate_helper_browsertest.cc b/browser/net/brave_site_hacks_network_delegate_helper_browsertest.cc index 21ead2938ab4..f5776371ea70 100644 --- a/browser/net/brave_site_hacks_network_delegate_helper_browsertest.cc +++ b/browser/net/brave_site_hacks_network_delegate_helper_browsertest.cc @@ -4,6 +4,7 @@ * You can obtain one at https://mozilla.org/MPL/2.0/. */ #include "base/base64url.h" +#include "base/cxx17_backports.h" #include "base/path_service.h" #include "base/strings/stringprintf.h" #include "brave/common/brave_paths.h" diff --git a/browser/net/brave_system_request_handler_browsertest.cc b/browser/net/brave_system_request_handler_browsertest.cc index 831d8cabbb75..b2c52d41ed47 100644 --- a/browser/net/brave_system_request_handler_browsertest.cc +++ b/browser/net/brave_system_request_handler_browsertest.cc @@ -16,6 +16,7 @@ #include "net/test/embedded_test_server/http_request.h" #include "net/traffic_annotation/network_traffic_annotation.h" #include "net/traffic_annotation/network_traffic_annotation_test_helper.h" +#include "services/network/public/cpp/shared_url_loader_factory.h" #include "testing/gtest/include/gtest/gtest.h" #if defined(OS_ANDROID) diff --git a/browser/net/url_context.cc b/browser/net/url_context.cc index dadf75def4bc..0767ec2f891c 100644 --- a/browser/net/url_context.cc +++ b/browser/net/url_context.cc @@ -17,6 +17,7 @@ #include "chrome/browser/profiles/profile.h" #include "content/public/browser/browser_thread.h" #include "net/base/isolation_info.h" +#include "services/network/public/cpp/resource_request.h" #if BUILDFLAG(ENABLE_IPFS) #include "brave/components/ipfs/ipfs_constants.h" diff --git a/browser/profiles/brave_profile_impl.cc b/browser/profiles/brave_profile_impl.cc index 4bbfc374df32..4ddf04c5a95d 100644 --- a/browser/profiles/brave_profile_impl.cc +++ b/browser/profiles/brave_profile_impl.cc @@ -54,5 +54,6 @@ void BraveProfileImpl::OnProfileWillBeDestroyed(Profile* profile) { // this only happens when a profile is deleted because the profile manager // ensures that session profiles are destroyed before their parents // passing false for `success` removes the profile from the info cache - g_browser_process->profile_manager()->OnProfileCreated(this, false, false); + g_browser_process->profile_manager()->OnProfileCreationFinished( + this, Profile::CREATE_MODE_ASYNCHRONOUS, false, false); } diff --git a/browser/profiles/brave_profile_manager.cc b/browser/profiles/brave_profile_manager.cc index f1cc42c60c0b..58c148bbf3f5 100644 --- a/browser/profiles/brave_profile_manager.cc +++ b/browser/profiles/brave_profile_manager.cc @@ -72,7 +72,8 @@ BraveProfileManager::~BraveProfileManager() { for (Profile* profile : profiles) { if (brave::IsSessionProfile(profile)) { // passing false for `success` removes the profile from the info cache - OnProfileCreated(profile, false, false); + OnProfileCreationFinished(profile, Profile::CREATE_MODE_ASYNCHRONOUS, + false, false); } } RemoveObserver(this); diff --git a/browser/renderer_context_menu/brave_spelling_options_submenu_observer_browsertest.cc b/browser/renderer_context_menu/brave_spelling_options_submenu_observer_browsertest.cc index 9bbfed88271e..bbd1fc97834f 100644 --- a/browser/renderer_context_menu/brave_spelling_options_submenu_observer_browsertest.cc +++ b/browser/renderer_context_menu/brave_spelling_options_submenu_observer_browsertest.cc @@ -70,8 +70,10 @@ class BraveSpellingOptionsSubMenuObserverTest : public InProcessBrowserTest { enable_spellcheck); menu()->GetPrefs()->SetString(language::prefs::kAcceptLanguages, accept_languages); - base::ListValue dictionaries_value; - dictionaries_value.AppendStrings(dictionaries); + base::Value dictionaries_value(base::Value::Type::LIST); + for (auto dictionary : dictionaries) { + dictionaries_value.Append(dictionary); + } menu()->GetPrefs()->Set(spellcheck::prefs::kSpellCheckDictionaries, dictionaries_value); observer()->InitMenu(content::ContextMenuParams()); diff --git a/browser/resources/extensions/BUILD.gn b/browser/resources/extensions/BUILD.gn index 710dafcd3d76..493c6c7fe27f 100644 --- a/browser/resources/extensions/BUILD.gn +++ b/browser/resources/extensions/BUILD.gn @@ -5,7 +5,13 @@ import("//tools/grit/preprocess_if_expr.gni") import("//tools/polymer/polymer.gni") import("//ui/webui/resources/tools/generate_grd.gni") -preprocess_folder = "preprocessed" +# Due to the JavaScript -> TypeScript migration happening upstream, we can no +# longer use 'preprocessed' as the dirname below since generated files will be +# now placed under gen/chrome/browser/resources/extensions/tsc instead. Thus, +# let's adjust the preprocessed directory to match that expectation while our +# Brave-specific JavaScript files are not migrated to TypeScript. +# See https://github.com/brave/brave-browser/issues/16553 +preprocess_folder = "tsc" preprocess_manifest = "brave_preprocessed_manifest.json" preprocess_gen_manifest = "brave_preprocessed_gen_manifest.json" diff --git a/browser/resources/settings/BUILD.gn b/browser/resources/settings/BUILD.gn index 75fcaa084099..485a4fa283e3 100644 --- a/browser/resources/settings/BUILD.gn +++ b/browser/resources/settings/BUILD.gn @@ -93,6 +93,7 @@ preprocess_if_expr("preprocess") { "brave_overrides/appearance_page.js", "brave_overrides/basic_page.js", "brave_overrides/clear_browsing_data_dialog.js", + "brave_overrides/config.js", "brave_overrides/cookies_page.js", "brave_overrides/default_browser_page.js", "brave_overrides/icons.js", @@ -114,6 +115,7 @@ preprocess_if_expr("preprocess") { "brave_overrides/site_settings_page.js", "brave_overrides/sync_account_control.js", "brave_overrides/sync_controls.js", + "brave_routes.js", "brave_sync_page/brave_sync_browser_proxy.js", ] } diff --git a/browser/resources/settings/brave_clear_browsing_data_dialog/brave_clear_browsing_data_dialog_behavior.js b/browser/resources/settings/brave_clear_browsing_data_dialog/brave_clear_browsing_data_dialog_behavior.js index 59ee9b4a6791..478182c5da1a 100644 --- a/browser/resources/settings/brave_clear_browsing_data_dialog/brave_clear_browsing_data_dialog_behavior.js +++ b/browser/resources/settings/brave_clear_browsing_data_dialog/brave_clear_browsing_data_dialog_behavior.js @@ -115,5 +115,5 @@ const BraveClearBrowsingDataOnExitBehaviorImpl = { // Extend I18nBehavior so that we can use i18n. export const BraveClearBrowsingDataOnExitBehavior = [ - I18nBehavior, BraveClearBrowsingDataOnExitBehaviorImpl + BraveClearBrowsingDataOnExitBehaviorImpl ] 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 e1fdc5ce80b1..a656adf80bbf 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 @@ -102,13 +102,6 @@ menu-options="[[ensResolveMethod_]]"> - - + `${attribute}="${childAttributes[attribute]}"`) + .join(' ') + // This needs to be inside a template so that our components do not get created immediately. + // Otherwise the polymer bindings won't be setup correctly at first. + return html` + + <${childName} + ${childAttributesString} + > + + + ` } RegisterStyleOverride( @@ -63,56 +64,6 @@ RegisterStyleOverride( RegisterPolymerTemplateModifications({ 'settings-basic-page': (templateContent) => { - // Routes - const r = Router.getInstance().routes_ - if (!r.BASIC) { - console.error('[Brave Settings Overrides] Routes: could not find BASIC page') - } - if (pageVisibility.getStarted) { - r.GET_STARTED = r.BASIC.createSection('/getStarted', 'getStarted') - // bring back people's /manageProfile (now in getStarted) - r.MANAGE_PROFILE = r.GET_STARTED.createChild('/manageProfile'); - } - r.SHIELDS = r.BASIC.createSection('/shields', 'shields') - r.SOCIAL_BLOCKING = r.BASIC.createSection('/socialBlocking', 'socialBlocking') - r.EXTENSIONS = r.BASIC.createSection('/extensions', 'extensions') - if (pageVisibility.braveSync) { - r.BRAVE_SYNC = r.BASIC.createSection('/braveSync', 'braveSync') - r.BRAVE_SYNC_SETUP = r.BRAVE_SYNC.createChild('/braveSync/setup'); - } - if (pageVisibility.braveIPFS) { - r.BRAVE_IPFS = r.BASIC.createSection('/ipfs', 'ipfs') - r.BRAVE_IPFS_KEYS = r.BRAVE_IPFS.createChild('/ipfs/keys'); - r.BRAVE_IPFS_PEERS = r.BRAVE_IPFS.createChild('/ipfs/peers'); - } - if (pageVisibility.braveWallet) { - r.BRAVE_WALLET = r.BASIC.createSection('/wallet', 'wallet') - } - - r.BRAVE_HELP_TIPS = r.BASIC.createSection('/braveHelpTips', 'braveHelpTips') - r.BRAVE_NEW_TAB = r.BASIC.createSection('/newTab', 'newTab') - if (r.SITE_SETTINGS) { - r.SITE_SETTINGS_AUTOPLAY = r.SITE_SETTINGS.createChild('autoplay') - const isNativeBraveWalletFeatureEnabled = loadTimeData.getBoolean('isNativeBraveWalletFeatureEnabled') - if (isNativeBraveWalletFeatureEnabled) { - r.SITE_SETTINGS_ETHEREUM = r.SITE_SETTINGS.createChild('ethereum') - } - } else if (!isGuest) { - console.error('[Brave Settings Overrides] Routes: could not find SITE_SETTINGS page') - } - // Autofill route is moved to advanced, - // otherwise its sections won't show up when opened. - if (r.AUTOFILL && r.ADVANCED) { - r.AUTOFILL.parent = r.ADVANCED - } else if (!isGuest) { - console.error('[Brave Settings Overrides] Could not move autofill route to advanced route', r) - } - // Safety check route is moved to advanced. - if (r.SAFETY_CHECK && r.ADVANCED) { - r.SAFETY_CHECK.parent = r.ADVANCED - } else if (!isGuest) { - console.error('[Brave Settings Overrides] Could not move safety check route to advanced route', r) - } // Add 'Getting Started' section // Entire content is wrapped in another conditional template const actualTemplate = templateContent.querySelector('template') diff --git a/browser/resources/settings/brave_overrides/config.js b/browser/resources/settings/brave_overrides/config.js new file mode 100644 index 000000000000..1ab8dfb078f0 --- /dev/null +++ b/browser/resources/settings/brave_overrides/config.js @@ -0,0 +1,17 @@ +// Copyright (c) 2021 The Brave Authors. All rights reserved. +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this file, +// you can obtain one at http://mozilla.org/MPL/2.0/. + +import {RegisterPolymerComponentToIgnore} from 'chrome://brave-resources/polymer_overriding.js' + +// Replacing chromium polymer components with subclasses of them is a +// 2-step process: +// 1. Make sure we ignore the chromium components when they are defined +// 2. Override the chromium components with a subclass and define the +// components with their original chromium name. +// (This is because the chomium components define themselves via customElements.define +// in their module, so we want to register to ignore the component before the module +// is imported). + +RegisterPolymerComponentToIgnore('settings-site-settings-page') diff --git a/browser/resources/settings/brave_overrides/import_data_dialog.js b/browser/resources/settings/brave_overrides/import_data_dialog.js index 11c238c3c710..5860ccec3b62 100644 --- a/browser/resources/settings/brave_overrides/import_data_dialog.js +++ b/browser/resources/settings/brave_overrides/import_data_dialog.js @@ -3,47 +3,23 @@ // 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 {RegisterPolymerTemplateModifications, RegisterPolymerComponentBehaviors} from 'chrome://brave-resources/polymer_overriding.js' +import {html, RegisterPolymerTemplateModifications, RegisterPolymerComponentBehaviors} from 'chrome://brave-resources/polymer_overriding.js' import {I18nBehavior} from 'chrome://resources/js/i18n_behavior.m.js' RegisterPolymerTemplateModifications({ 'settings-import-data-dialog': (templateContent) => { let checkBoxesParent = templateContent.querySelector('#browserSelect').parentElement; - ['extensions', 'payments'].forEach((item) => { - const checkbox = document.createElement('settings-checkbox') - checkbox.setAttribute('hidden', `[[!selected_.${item}]]`) - checkbox.setAttribute('pref', `{{prefs.import_dialog_${item}}}`) - checkbox.setAttribute('label', - I18nBehavior.i18n(`import${item[0].toUpperCase()}${item.slice(1)}`)) - checkbox.setAttribute('no-set-pref', '') - checkBoxesParent.appendChild(checkbox) - }) + checkBoxesParent.appendChild(html` + + + `) } }) - -RegisterPolymerComponentBehaviors({ - 'settings-import-data-dialog': [{ - registered: function () { - const oldPrefsChanged = this.prefsChanged_ - if (!oldPrefsChanged) { - console.error('[Brave Settings Overrides] cannot find prefsChanged_ on ImportDataDialog') - return - } - this.prefsChanged_ = function () { - if (typeof this.noImportDataTypeSelected_ !== 'boolean') { - console.error('[Brave Settings Overrides] cannot find noImportDataTypeSelected_ on ImportDataDialog') - return - } - oldPrefsChanged.apply(this) - if (this.selected_ == undefined || this.prefs == undefined) { - return; - } - this.noImportDataTypeSelected_ = this.noImportDataTypeSelected_ && - !(this.getPref('import_dialog_extensions').value && - this.selected_.extensions) && - !(this.getPref('import_dialog_payments').value && - this.selected_.payments) - } - } - }] -}) diff --git a/browser/resources/settings/brave_overrides/index.js b/browser/resources/settings/brave_overrides/index.js index a64bf7beb6f1..6504f175f416 100644 --- a/browser/resources/settings/brave_overrides/index.js +++ b/browser/resources/settings/brave_overrides/index.js @@ -9,7 +9,8 @@ // where it is not consistant due to "network" responses) and // optimized (rollup controls the order in which modules are executed). -import { ContentSettingsTypes } from '../site_settings/constants' +import './config.js' +import { ContentSettingsTypes } from '../site_settings/constants.js' ContentSettingsTypes.ETHEREUM = 'ethereum' import './about_page.js' import './appearance_page.js' diff --git a/browser/resources/settings/brave_overrides/site_settings_page.js b/browser/resources/settings/brave_overrides/site_settings_page.js index c6f9cd5e01c3..f5be8ed30d21 100644 --- a/browser/resources/settings/brave_overrides/site_settings_page.js +++ b/browser/resources/settings/brave_overrides/site_settings_page.js @@ -3,9 +3,11 @@ // 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 {RegisterPolymerComponentBehaviors} from 'chrome://brave-resources/polymer_overriding.js' +import {define, RegisterPolymerComponentReplacement} from 'chrome://brave-resources/polymer_overriding.js' import {ContentSettingsTypes} from '../site_settings/constants.js' +import {SettingsSiteSettingsPageElement} from '../site_settings_page/site_settings_page.js' import {routes} from '../route.js' +import './config.js' const PERMISSIONS_BASIC_REMOVE_IDS = [ ContentSettingsTypes.BACKGROUND_SYNC, @@ -14,15 +16,17 @@ const CONTENT_ADVANCED_REMOVE_IDS = [ ContentSettingsTypes.ADS, ] -RegisterPolymerComponentBehaviors({ - 'settings-site-settings-page': [{ - registered: function() { - if (!this.properties || !this.properties.lists_ || !this.properties.lists_.value) { +RegisterPolymerComponentReplacement( + 'settings-site-settings-page', + class BraveComponent extends SettingsSiteSettingsPageElement { + static get properties() { + const properties = SettingsSiteSettingsPageElement.properties + if (!properties || !properties.lists_ || !properties.lists_.value) { console.error('[Brave Settings Overrides] Could not find polymer lists_ property') return } - const oldListsGetter = this.properties.lists_.value - this.properties.lists_.value = function () { + const oldListsGetter = properties.lists_.value + properties.lists_.value = function () { const lists_ = oldListsGetter() if (!lists_) { console.error('[Brave Settings Overrides] did not get lists_ data') @@ -72,6 +76,7 @@ RegisterPolymerComponentBehaviors({ } return lists_ } + return properties } - }] -}) + } +) diff --git a/browser/resources/settings/brave_routes.js b/browser/resources/settings/brave_routes.js new file mode 100644 index 000000000000..30616d29990e --- /dev/null +++ b/browser/resources/settings/brave_routes.js @@ -0,0 +1,62 @@ +// 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 {pageVisibility} from './brave_overrides/page_visibility.js' + +export default function addBraveRoutes(r) { + if (!r.BASIC) { + console.error('[Brave Settings Overrides] Routes: could not find BASIC page') + } + if (r.SITE_SETTINGS_ADS) { + delete r.SITE_SETTINGS_ADS + } else { + console.error('[Brave Settings Overrides] could not find expected route site_settings_ads') + } + if (pageVisibility.getStarted) { + r.GET_STARTED = r.BASIC.createSection('/getStarted', 'getStarted') + // bring back people's /manageProfile (now in getStarted) + r.MANAGE_PROFILE = r.GET_STARTED.createChild('/manageProfile'); + } + r.SHIELDS = r.BASIC.createSection('/shields', 'shields') + r.SOCIAL_BLOCKING = r.BASIC.createSection('/socialBlocking', 'socialBlocking') + r.EXTENSIONS = r.BASIC.createSection('/extensions', 'extensions') + if (pageVisibility.braveSync) { + r.BRAVE_SYNC = r.BASIC.createSection('/braveSync', 'braveSync') + r.BRAVE_SYNC_SETUP = r.BRAVE_SYNC.createChild('/braveSync/setup'); + } + if (pageVisibility.braveIPFS) { + r.BRAVE_IPFS = r.BASIC.createSection('/ipfs', 'ipfs') + r.BRAVE_IPFS_KEYS = r.BRAVE_IPFS.createChild('/ipfs/keys'); + r.BRAVE_IPFS_PEERS = r.BRAVE_IPFS.createChild('/ipfs/peers'); + } + if (pageVisibility.braveWallet) { + r.BRAVE_WALLET = r.BASIC.createSection('/wallet', 'wallet') + } + + r.BRAVE_HELP_TIPS = r.BASIC.createSection('/braveHelpTips', 'braveHelpTips') + r.BRAVE_NEW_TAB = r.BASIC.createSection('/newTab', 'newTab') + if (r.SITE_SETTINGS) { + r.SITE_SETTINGS_AUTOPLAY = r.SITE_SETTINGS.createChild('autoplay') + const isNativeBraveWalletFeatureEnabled = loadTimeData.getBoolean('isNativeBraveWalletFeatureEnabled') + if (isNativeBraveWalletFeatureEnabled) { + r.SITE_SETTINGS_ETHEREUM = r.SITE_SETTINGS.createChild('ethereum') + } + } else if (!isGuest) { + console.error('[Brave Settings Overrides] Routes: could not find SITE_SETTINGS page') + } + // Autofill route is moved to advanced, + // otherwise its sections won't show up when opened. + if (r.AUTOFILL && r.ADVANCED) { + r.AUTOFILL.parent = r.ADVANCED + } else if (!isGuest) { + console.error('[Brave Settings Overrides] Could not move autofill route to advanced route', r) + } + // Safety check route is moved to advanced. + if (r.SAFETY_CHECK && r.ADVANCED) { + r.SAFETY_CHECK.parent = r.ADVANCED + } else if (!isGuest) { + console.error('[Brave Settings Overrides] Could not move safety check route to advanced route', r) + } +} \ No newline at end of file diff --git a/browser/search/BUILD.gn b/browser/search/BUILD.gn index 8789a2f42fe3..533ae575d132 100644 --- a/browser/search/BUILD.gn +++ b/browser/search/BUILD.gn @@ -17,6 +17,7 @@ source_set("search") { "//brave/common:pref_names", "//brave/components/crypto_dot_com/browser/buildflags", "//brave/components/crypto_dot_com/common", + "//chrome/browser/ui", "//chrome/common", "//components/pref_registry", "//components/prefs", diff --git a/browser/search/ntp_utils.cc b/browser/search/ntp_utils.cc index ba50fefc567e..b132a4618433 100644 --- a/browser/search/ntp_utils.cc +++ b/browser/search/ntp_utils.cc @@ -9,7 +9,7 @@ #include "brave/browser/profiles/profile_util.h" #include "brave/common/pref_names.h" #include "brave/components/crypto_dot_com/browser/buildflags/buildflags.h" -#include "chrome/common/pref_names.h" +#include "chrome/browser/ui/webui/new_tab_page/ntp_pref_names.h" #include "components/pref_registry/pref_registry_syncable.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_service.h" @@ -46,8 +46,8 @@ void MigrateNewTabPagePrefs(Profile* profile) { const PrefService::Preference* top_sites_pref = prefs->FindPreference(kNewTabPageShowTopSites); if (top_sites_pref->HasUserSetting()) { - prefs->SetBoolean(prefs::kNtpShortcutsVisible, - prefs->GetBoolean(kNewTabPageShowTopSites)); + prefs->SetBoolean(ntp_prefs::kNtpShortcutsVisible, + prefs->GetBoolean(kNewTabPageShowTopSites)); } // The toggle to turn off all widgets used to simply turn off diff --git a/browser/sync/BUILD.gn b/browser/sync/BUILD.gn index 90a30e51c146..5e4584bc061c 100644 --- a/browser/sync/BUILD.gn +++ b/browser/sync/BUILD.gn @@ -1,7 +1,7 @@ source_set("sync") { sources = [ - "brave_profile_sync_service_delegate.cc", - "brave_profile_sync_service_delegate.h", + "brave_sync_service_impl_delegate.cc", + "brave_sync_service_impl_delegate.h", ] deps = [ diff --git a/browser/sync/brave_sync_devices_android.cc b/browser/sync/brave_sync_devices_android.cc index d7a3da5f22f1..c67f3b644870 100644 --- a/browser/sync/brave_sync_devices_android.cc +++ b/browser/sync/brave_sync_devices_android.cc @@ -13,13 +13,13 @@ #include "base/json/json_writer.h" #include "brave/build/android/jni_headers/BraveSyncDevices_jni.h" -#include "brave/components/brave_sync/profile_sync_service_helper.h" -#include "brave/components/sync/driver/brave_sync_profile_sync_service.h" +#include "brave/components/brave_sync/sync_service_impl_helper.h" +#include "brave/components/sync/driver/brave_sync_service_impl.h" #include "brave/components/sync_device_info/brave_device_info.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/sync/device_info_sync_service_factory.h" -#include "chrome/browser/sync/profile_sync_service_factory.h" +#include "chrome/browser/sync/sync_service_factory.h" #include "components/sync_device_info/device_info_sync_service.h" #include "components/sync_device_info/device_info_tracker.h" @@ -102,11 +102,10 @@ BraveSyncDevicesAndroid::GetSyncDeviceListJson(JNIEnv* env) { } // TODO(AlexeyBarabash): duplicate with BraveSyncWorker? -syncer::BraveProfileSyncService* BraveSyncDevicesAndroid::GetSyncService() - const { - return ProfileSyncServiceFactory::IsSyncAllowed(profile_) - ? static_cast( - ProfileSyncServiceFactory::GetForProfile(profile_)) +syncer::BraveSyncServiceImpl* BraveSyncDevicesAndroid::GetSyncService() const { + return SyncServiceFactory::IsSyncAllowed(profile_) + ? static_cast( + SyncServiceFactory::GetForProfile(profile_)) : nullptr; } diff --git a/browser/sync/brave_sync_devices_android.h b/browser/sync/brave_sync_devices_android.h index b8a71499e43e..e0edde5a0a33 100644 --- a/browser/sync/brave_sync_devices_android.h +++ b/browser/sync/brave_sync_devices_android.h @@ -11,11 +11,12 @@ #include "base/android/jni_weak_ref.h" #include "base/scoped_observation.h" #include "base/values.h" -#include "chrome/browser/sync/profile_sync_service_android.h" #include "components/sync_device_info/device_info_tracker.h" +class Profile; + namespace syncer { -class BraveProfileSyncService; +class BraveSyncServiceImpl; } namespace chrome { @@ -40,7 +41,7 @@ class BraveSyncDevicesAndroid : public syncer::DeviceInfoTracker::Observer { base::Value GetSyncDeviceList(); - syncer::BraveProfileSyncService* GetSyncService() const; + syncer::BraveSyncServiceImpl* GetSyncService() const; base::ScopedObservation diff --git a/browser/sync/brave_profile_sync_service_delegate.cc b/browser/sync/brave_sync_service_impl_delegate.cc similarity index 71% rename from browser/sync/brave_profile_sync_service_delegate.cc rename to browser/sync/brave_sync_service_impl_delegate.cc index 78f985040ff5..c5d3b9d70c83 100644 --- a/browser/sync/brave_profile_sync_service_delegate.cc +++ b/browser/sync/brave_sync_service_impl_delegate.cc @@ -3,20 +3,20 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "brave/browser/sync/brave_profile_sync_service_delegate.h" +#include "brave/browser/sync/brave_sync_service_impl_delegate.h" #include #include "base/task/post_task.h" #include "base/threading/thread_task_runner_handle.h" -#include "brave/components/sync/driver/brave_sync_profile_sync_service.h" +#include "brave/components/sync/driver/brave_sync_service_impl.h" #include "components/sync_device_info/device_info_sync_service.h" #include "components/sync_device_info/device_info_tracker.h" #include "components/sync_device_info/local_device_info_provider.h" namespace syncer { -BraveProfileSyncServiceDelegate::BraveProfileSyncServiceDelegate( +BraveSyncServiceImplDelegate::BraveSyncServiceImplDelegate( DeviceInfoSyncService* device_info_sync_service) : device_info_sync_service_(device_info_sync_service), weak_ptr_factory_(this) { @@ -31,10 +31,10 @@ BraveProfileSyncServiceDelegate::BraveProfileSyncServiceDelegate( device_info_observer_.Observe(device_info_tracker_); } -BraveProfileSyncServiceDelegate::~BraveProfileSyncServiceDelegate() {} +BraveSyncServiceImplDelegate::~BraveSyncServiceImplDelegate() {} -void BraveProfileSyncServiceDelegate::OnDeviceInfoChange() { - DCHECK(profile_sync_service_); +void BraveSyncServiceImplDelegate::OnDeviceInfoChange() { + DCHECK(sync_service_impl_); const syncer::DeviceInfo* local_device_info = local_device_info_provider_->GetLocalDeviceInfo(); @@ -55,21 +55,20 @@ void BraveProfileSyncServiceDelegate::OnDeviceInfoChange() { // remove device execution path, so posting task base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, - base::BindOnce( - &BraveProfileSyncServiceDelegate::OnSelfDeviceInfoDeleted, - weak_ptr_factory_.GetWeakPtr())); + base::BindOnce(&BraveSyncServiceImplDelegate::OnSelfDeviceInfoDeleted, + weak_ptr_factory_.GetWeakPtr())); } } -void BraveProfileSyncServiceDelegate::OnSelfDeviceInfoDeleted() { - profile_sync_service_->OnSelfDeviceInfoDeleted(base::DoNothing::Once()); +void BraveSyncServiceImplDelegate::OnSelfDeviceInfoDeleted() { + sync_service_impl_->OnSelfDeviceInfoDeleted(base::DoNothing::Once()); } -void BraveProfileSyncServiceDelegate::SuspendDeviceObserverForOwnReset() { +void BraveSyncServiceImplDelegate::SuspendDeviceObserverForOwnReset() { device_info_observer_.Reset(); } -void BraveProfileSyncServiceDelegate::ResumeDeviceObserver() { +void BraveSyncServiceImplDelegate::ResumeDeviceObserver() { if (!device_info_observer_.IsObserving()) { device_info_observer_.Observe(device_info_tracker_); } diff --git a/browser/sync/brave_profile_sync_service_delegate.h b/browser/sync/brave_sync_service_impl_delegate.h similarity index 60% rename from browser/sync/brave_profile_sync_service_delegate.h rename to browser/sync/brave_sync_service_impl_delegate.h index 4a4b2e2cee26..06bd9438d8be 100644 --- a/browser/sync/brave_profile_sync_service_delegate.h +++ b/browser/sync/brave_sync_service_impl_delegate.h @@ -3,14 +3,13 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef BRAVE_BROWSER_SYNC_BRAVE_PROFILE_SYNC_SERVICE_DELEGATE_H_ -#define BRAVE_BROWSER_SYNC_BRAVE_PROFILE_SYNC_SERVICE_DELEGATE_H_ +#ifndef BRAVE_BROWSER_SYNC_BRAVE_SYNC_SERVICE_IMPL_DELEGATE_H_ +#define BRAVE_BROWSER_SYNC_BRAVE_SYNC_SERVICE_IMPL_DELEGATE_H_ -#include "brave/components/sync/driver/profile_sync_service_delegate.h" +#include "brave/components/sync/driver/sync_service_impl_delegate.h" #include "base/memory/weak_ptr.h" #include "base/scoped_observation.h" -#include "components/sync/driver/profile_sync_service.h" #include "components/sync_device_info/device_info_tracker.h" class Profile; @@ -21,15 +20,15 @@ class DeviceInfoSyncService; class DeviceInfoTracker; class LocalDeviceInfoProvider; -// Helper class to prevent pass of profile pointer into BraveProfileSyncService +// Helper class to prevent pass of profile pointer into BraveSyncServiceImpl // and to keep DeviceInfoSyncService -class BraveProfileSyncServiceDelegate - : public ProfileSyncServiceDelegate, +class BraveSyncServiceImplDelegate + : public SyncServiceImplDelegate, public syncer::DeviceInfoTracker::Observer { public: - explicit BraveProfileSyncServiceDelegate( + explicit BraveSyncServiceImplDelegate( DeviceInfoSyncService* device_info_sync_service); - ~BraveProfileSyncServiceDelegate() override; + ~BraveSyncServiceImplDelegate() override; void SuspendDeviceObserverForOwnReset() override; void ResumeDeviceObserver() override; @@ -48,14 +47,13 @@ class BraveProfileSyncServiceDelegate DeviceInfoSyncService* device_info_sync_service_; - base::WeakPtrFactory weak_ptr_factory_; + base::WeakPtrFactory weak_ptr_factory_; - BraveProfileSyncServiceDelegate(const BraveProfileSyncServiceDelegate&) = + BraveSyncServiceImplDelegate(const BraveSyncServiceImplDelegate&) = delete; + BraveSyncServiceImplDelegate& operator=(const BraveSyncServiceImplDelegate&) = delete; - BraveProfileSyncServiceDelegate& operator=( - const BraveProfileSyncServiceDelegate&) = delete; }; } // namespace syncer -#endif // BRAVE_BROWSER_SYNC_BRAVE_PROFILE_SYNC_SERVICE_DELEGATE_H_ +#endif // BRAVE_BROWSER_SYNC_BRAVE_SYNC_SERVICE_IMPL_DELEGATE_H_ diff --git a/browser/ui/BUILD.gn b/browser/ui/BUILD.gn index 8b807f786cca..bb955e055f41 100644 --- a/browser/ui/BUILD.gn +++ b/browser/ui/BUILD.gn @@ -106,8 +106,8 @@ source_set("ui") { "webui/new_tab_page/brave_new_tab_ui.h", "webui/new_tab_page/brave_new_tab_ui_utils.cc", "webui/new_tab_page/brave_new_tab_ui_utils.h", - "webui/new_tab_page/instant_service_message_handler.cc", - "webui/new_tab_page/instant_service_message_handler.h", + "webui/new_tab_page/top_sites_message_handler.cc", + "webui/new_tab_page/top_sites_message_handler.h", "webui/settings/brave_appearance_handler.cc", "webui/settings/brave_appearance_handler.h", "webui/settings/brave_import_data_handler.h", @@ -386,7 +386,7 @@ source_set("ui") { "//brave/components/brave_new_tab_ui:generated_resources", "//brave/components/brave_perf_predictor/browser:buildflags", "//brave/components/brave_sync", - "//brave/components/brave_sync:profile_sync_service_helper", + "//brave/components/brave_sync:sync_service_impl_helper", "//brave/components/brave_welcome_ui:generated_resources", "//brave/components/version_info", "//chrome/app:chromium_strings", diff --git a/browser/ui/android/strings/android_chrome_strings.grd b/browser/ui/android/strings/android_chrome_strings.grd index 282724705df7..283abbc0d8c7 100644 --- a/browser/ui/android/strings/android_chrome_strings.grd +++ b/browser/ui/android/strings/android_chrome_strings.grd @@ -250,6 +250,12 @@ CHAR_LIMIT guidelines: Announcements + + Web apps + + + Web apps (quiet) + Permission requests @@ -265,21 +271,12 @@ CHAR_LIMIT guidelines: - - Account - You and Brave Sign in to Brave - - Sync and Brave services - - - You are currently customizing your Sync and Brave service settings. To finish turning on sync, tap the Confirm button near the bottom of the screen. Navigate up - You are currently customizing your Sync settings. To finish turning on sync, tap the Confirm button near the bottom of the screen. Navigate up @@ -289,9 +286,6 @@ CHAR_LIMIT guidelines: Sync and personalize across devices - - Sync is on - Disabled by the administrator of this device @@ -299,9 +293,6 @@ CHAR_LIMIT guidelines: Brave activity controls - Control how your browsing history is used to personalize Search, ads, and more - - Control how your browsing history is used to personalize Search and more @@ -317,15 +308,6 @@ CHAR_LIMIT guidelines: Sync - - Sync your Brave data - - - Manage sync - - - Other Brave services - Brave services @@ -460,7 +442,7 @@ CHAR_LIMIT guidelines: Country/Region - + Title @@ -541,6 +523,14 @@ CHAR_LIMIT guidelines: Keep your passwords safe from data breaches and other security issues + + + Trusted vault + + + + Opt in to trusted vault + Never saved @@ -868,7 +858,7 @@ Privacy Sandbox trials are still in active development and are available in sele Choose another provider - See this provider's <a target="_blank" rel="noopener noreferrer" href="$1https://google.com/">privacy policy</a> + See this provider's <a target="_blank" href="$1https://google.com/">privacy policy</a> This setting is disabled on managed browsers @@ -916,7 +906,7 @@ Your Brave account may have other forms of browsing history like searches and ac Signs you out of most sites. You won't be signed out of your Brave sync chain. - Clears history and autocompletions in the address bar. + Clears history, including in the search box. Clears history from all synced devices. @@ -928,10 +918,16 @@ Your Brave account may have other forms of browsing history like searches and ac Clears history from all synced devices. Your Brave sync chain may have other forms of browsing history at <link>myactivity.google.com</link>. - To clear <link1>search</link1> or other forms of history, visit <link2>My Brave Activity</link2> + <link1>Search history</link1> and <link2>other forms of activity</link2> may be saved in your Brave sync chain when you’re signed in. You can delete them anytime. + + + <link1>Other forms of activity</link1> may be saved in your Brave sync chain when you’re signed in. You can delete them anytime. - Your search engine is %1$sBing. If applicable, see their instructions to delete your search history. + Your search engine is %1$sBing. See their instructions for deleting your search history, if applicable. + + + See your search engine’s instructions for deleting your search history, if applicable Saved passwords @@ -963,9 +959,6 @@ Your Brave account may have other forms of browsing history like searches and ac Last 4 weeks - - Older than 30 days - All time @@ -1255,12 +1248,6 @@ Your Brave account may have other forms of browsing history like searches and ac Your keyboard won’t change - - No thanks - - - Change language - Loading %1$sHindi @@ -1611,15 +1598,15 @@ Your Brave account may have other forms of browsing history like searches and ac Android system sync disabled - - Sync is off + + On + + + Off No data selected to sync - - Initial sync setup was not finished. Sync is off. - Tap to set up sync @@ -1825,62 +1812,6 @@ To change this setting, <resetlink>reset sync

- - - %1$shttps://www.google.com wants to pair - - <link>Get help</link> while scanning for devices… - - - Pair - - - <link1>Get help</link1> or <link2>re-scan</link2> - - - No compatible devices found - - - <link>Turn on Bluetooth</link> to allow pairing - - - Brave is unable to turn on Bluetooth adapter - - - <link>Get help</link> - - - Brave needs location access to scan for devices. <permission_link>Update permissions</permission_link> - - - Brave needs location access to scan for devices. Location access is <services_link>turned off for this device</services_link>. - - - Brave needs location access to scan for devices. <permission_link>Update permissions</permission_link>. Location access is also <services_link>turned off for this device</services_link>. - - - <link>Get help</link> - - - Brave needs permission to scan for nearby devices. <permission_link>Update permissions</permission_link>. - - - Connected Device - - - {N_BARS, plural, - =1 {Signal Strength Level: # bar} - other {Signal Strength Level: # bars}} - - - - - %1$swww.google.com wants to scan for nearby Bluetooth devices. The following devices have been found: - - - Unknown or unsupported device (%1$sA1:B2:C3:D4:E5:F6) - - Sync isn't working @@ -1891,12 +1822,21 @@ To change this setting, <resetlink>reset sync

Initial sync setup not finished + + Sync needs to verify it's you + Open Android settings and re-enable Android system sync to start Brave sync Sign in again to start sync + + Make sure you can always access your sync data + + + Make sure you can always access your saved passwords + To start sync, verify it's you @@ -1909,9 +1849,6 @@ To change this setting, <resetlink>reset sync

Choose what to sync below - - To start sync, turn on "Sync your Brave data". - Try signing in again @@ -2212,15 +2149,9 @@ To change this setting, <resetlink>reset sync

Translate image with Brave Lens <new>New</new> - - Shop similar products <new>New</new> - Shop image with Brave Lens <new>New</new> - - Search similar products <new>New</new> - Search %1$sBrave for this image @@ -2308,6 +2239,9 @@ To change this setting, <resetlink>reset sync

Install this app + + The site’s connection is secure unless Brave tells you otherwise. + To get here quicker, add this page to your Home screen @@ -2668,9 +2602,6 @@ To change this setting, <resetlink>reset sync

- Brave may use your history to personalize Search, ads, and other Brave services - - Brave may use your history to personalize Search and other Brave services @@ -2847,6 +2778,9 @@ To change this setting, <resetlink>reset sync

Following + + You'll find sites you follow here + Updates Unavailable @@ -2886,6 +2820,14 @@ To change this setting, <resetlink>reset sync

Check back later for new stories Can't refresh Discover Check back later for new stories + You'll find stories here + To follow a site, go to the site, open the Brave menu, and tap Follow. + + For new stories, pull down to refresh + + + To refresh the feed content, pull down the page + @@ -3021,9 +2963,21 @@ To change this setting, <resetlink>reset sync

Quickly search with your voice. To edit this shortcut, touch and hold. + + Quickly open a new tab. To edit this shortcut, go to Settings. + + + Quickly share this page. To edit this shortcut, go to Settings. + + + Quickly search with your voice. To edit this shortcut, go to Settings. + Edit shortcut + + Edit toolbar shortcut + @@ -3101,6 +3055,12 @@ To change this setting, <resetlink>reset sync

Following + + Follow this site here + + + Adds the current web site to the list of web sites that you are following. + Request desktop site @@ -3237,7 +3197,7 @@ To change this setting, <resetlink>reset sync

Edit folder - + Name @@ -3375,6 +3335,12 @@ To change this setting, <resetlink>reset sync

Show simplified view + + View simplified page? + + + View + Bookmarks and web history @@ -3572,6 +3538,9 @@ To change this setting, <resetlink>reset sync

Remove suggestion from history? + + Remove suggestion from clipboard? + Frequently visited @@ -3792,11 +3761,6 @@ To change this setting, <resetlink>reset sync

- - - %1$sitem_name (%2$sitem id) - - Running in Brave @@ -3807,12 +3771,6 @@ To change this setting, <resetlink>reset sync

Got it - - Web apps - - - Web apps (quiet) - %1$sYouTube also has data in Brave @@ -4059,6 +4017,17 @@ To change this setting, <resetlink>reset sync

+ + + Search or type URL + + + Start Dino Game + + + Quick Action Search Widget Icon + + Remove and recreate this shortcut @@ -4101,6 +4070,18 @@ To change this setting, <resetlink>reset sync

Active today + + device + + + phone + + + computer + + + Page sent. To see it, open Brave on your %1$sphone + @@ -4202,11 +4183,18 @@ To change this setting, <resetlink>reset sync

- - Tap to verify your phone number on desktop + + Submit %1$s123 on %2$sZoe's Macbook? + + + Let %1$sexample.com verify it's you - - %1$s123 is your code for %2$sexample.com + + Let %1$spayment.com verify it's you for %2$sshopping.com + + + + Submit %1$s123 to %2$sexample.com? @@ -4386,12 +4374,20 @@ To change this setting, <resetlink>reset sync

+ + Turning on Bluetooth… + + + + Bluetooth will turn back off when you're done + + QR Code - + Share @@ -4399,20 +4395,20 @@ To change this setting, <resetlink>reset sync

- - To share with profiles nearby, let them scan this QR code + + To share with profiles nearby, let them scan this QR Code - + Download - - Can't create QR code. URL is more than %1$d300 characters. + + Can't create QR Code. URL is more than %1$d300 characters. - Can't create QR code + Can't create QR Code @@ -4448,6 +4444,14 @@ To change this setting, <resetlink>reset sync

+ + Move Up + + + + Move Down + + Can\u2019t go higher. Try starting from further up the page. @@ -4468,10 +4472,9 @@ To change this setting, <resetlink>reset sync

- - Stylize highlight + + Create card - Copied @@ -4484,24 +4487,24 @@ To change this setting, <resetlink>reset sync

- - Position QR/barcode in this frame. + + Position QR Code/barcode in this frame. - - To scan a QR code, let Brave use your camera + + To scan a QR Code, let Brave use your camera - - To scan a QR code, change your settings so that Brave can use your camera + + To scan a QR Code, change your settings so that Brave can use your camera - + Continue - To scan a QR code, use a device with a camera. + To scan a QR Code, use a device with a camera. @@ -4516,11 +4519,11 @@ To change this setting, <resetlink>reset sync

- + Open Settings - + This QR Code is not a URL: %1$sQR Code Text @@ -4583,6 +4586,11 @@ To change this setting, <resetlink>reset sync

+ + + Surveys + + Paint Preview captured successfully. @@ -4721,6 +4729,55 @@ To change this setting, <resetlink>reset sync

Results from\n%1$s + + Search results from Brave. + + + + + Create a %1$sairbnb.com account + + + Create a %1$sairbnb.com account… + + + Continue as %1$sAlbus (or Albus Dumbledore) + + + List of accounts to be selected. + + + List of accounts to be selected opened at half height. + + + List of accounts to be selected opened at full height. + + + List of accounts to be selected is closed. + + + + + Stylized highlight %1$s2020-09-16 + + + chrome_stylized_highlight_ + + + %1$sClassic template selected + + + Select a template for your highlight + + + Highlight was shortened + + + “ + + + ” + diff --git a/browser/ui/android/strings/android_chrome_strings_override.grd b/browser/ui/android/strings/android_chrome_strings_override.grd index cd2ecd3b45ba..e883a7b2f174 100644 --- a/browser/ui/android/strings/android_chrome_strings_override.grd +++ b/browser/ui/android/strings/android_chrome_strings_override.grd @@ -195,8 +195,8 @@ CHAR_LIMIT guidelines: - - To share with profiles nearby, let them scan this QR code + + To share with profiles nearby, let them scan this QR Code diff --git a/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/BraveToolbarLayout.java b/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/BraveToolbarLayout.java new file mode 100644 index 000000000000..9aada170522a --- /dev/null +++ b/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/BraveToolbarLayout.java @@ -0,0 +1,28 @@ +/* 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.toolbar.top; + +import android.animation.Animator; +import android.content.Context; +import android.util.AttributeSet; +import android.view.View; +import android.view.ViewGroup; + +import java.util.List; + +public interface BraveToolbarLayout { + public void onClickImpl(View v); + + public boolean onLongClickImpl(View v); + + public void updateModernLocationBarColorImpl(int color); + + public int getBoundsAfterAccountingForRightButtonsImpl(ViewGroup toolbarButtonsContainer); + + public void populateUrlAnimatorSetImpl(boolean showExpandedState, + int urlFocusToolbarButtonsDuration, int urlClearFocusTabStackDelayMs, + List animators); +} diff --git a/browser/ui/bookmark/BUILD.gn b/browser/ui/bookmark/BUILD.gn index 8111f3c54c98..3e419e72ef9f 100644 --- a/browser/ui/bookmark/BUILD.gn +++ b/browser/ui/bookmark/BUILD.gn @@ -25,9 +25,9 @@ source_set("bookmark") { # This can be removed when we can remove above check_includes. deps += [ "//chrome/browser/cart:mojo_bindings", + "//chrome/browser/new_tab_page/modules/drive:mojo_bindings", + "//chrome/browser/new_tab_page/modules/task_module:mojo_bindings", "//chrome/browser/promo_browser_command:mojo_bindings", - "//chrome/browser/search/drive:mojo_bindings", - "//chrome/browser/search/task_module:mojo_bindings", "//chrome/browser/ui/webui/new_tab_page:mojo_bindings", "//chrome/browser/ui/webui/realbox:mojo_bindings", ] diff --git a/browser/ui/omnibox/brave_omnibox_client_impl.cc b/browser/ui/omnibox/brave_omnibox_client_impl.cc index 293089086d0b..b52372badebb 100644 --- a/browser/ui/omnibox/brave_omnibox_client_impl.cc +++ b/browser/ui/omnibox/brave_omnibox_client_impl.cc @@ -7,8 +7,8 @@ #include +#include "base/cxx17_backports.h" #include "base/metrics/histogram_macros.h" -#include "base/stl_util.h" #include "base/values.h" #include "brave/browser/autocomplete/brave_autocomplete_scheme_classifier.h" #include "brave/common/pref_names.h" diff --git a/browser/ui/sidebar/BUILD.gn b/browser/ui/sidebar/BUILD.gn index 69a59ec08c32..40fc8cb2ec54 100644 --- a/browser/ui/sidebar/BUILD.gn +++ b/browser/ui/sidebar/BUILD.gn @@ -49,9 +49,9 @@ source_set("sidebar") { # see check_includes comment above deps += [ "//chrome/browser/cart:mojo_bindings", + "//chrome/browser/new_tab_page/modules/drive:mojo_bindings", + "//chrome/browser/new_tab_page/modules/task_module:mojo_bindings", "//chrome/browser/promo_browser_command:mojo_bindings", - "//chrome/browser/search/drive:mojo_bindings", - "//chrome/browser/search/task_module:mojo_bindings", "//chrome/browser/ui/webui/new_tab_page:mojo_bindings", "//chrome/browser/ui/webui/realbox:mojo_bindings", ] diff --git a/browser/ui/tabs/brave_tab_strip_model.cc b/browser/ui/tabs/brave_tab_strip_model.cc index cfa050b895c1..33944bf4d5f0 100644 --- a/browser/ui/tabs/brave_tab_strip_model.cc +++ b/browser/ui/tabs/brave_tab_strip_model.cc @@ -22,7 +22,7 @@ BraveTabStripModel::BraveTabStripModel(TabStripModelDelegate* delegate, : TabStripModel(delegate, profile) {} BraveTabStripModel::~BraveTabStripModel() {} -void BraveTabStripModel::SelectRelativeTab(bool forward, +void BraveTabStripModel::SelectRelativeTab(TabRelativeDirection direction, UserGestureDetails detail) { if (contents_data_.empty()) return; @@ -30,13 +30,14 @@ void BraveTabStripModel::SelectRelativeTab(bool forward, bool is_mru_enabled = profile()->GetPrefs()->GetBoolean(kMRUCyclingEnabled); if (is_mru_enabled) { - SelectMRUTab(forward, detail); + SelectMRUTab(direction, detail); } else { - TabStripModel::SelectRelativeTab(forward, detail); + TabStripModel::SelectRelativeTab(direction, detail); } } -void BraveTabStripModel::SelectMRUTab(bool forward, UserGestureDetails detail) { +void BraveTabStripModel::SelectMRUTab(TabRelativeDirection direction, + UserGestureDetails detail) { if (mru_cycle_list_.empty()) { // Start cycling @@ -59,13 +60,11 @@ void BraveTabStripModel::SelectMRUTab(bool forward, UserGestureDetails detail) { static_cast(browser->window())->StartTabCycling(); } - if (forward) { - std::rotate(mru_cycle_list_.begin(), - mru_cycle_list_.begin() + 1, + if (direction == TabRelativeDirection::kNext) { + std::rotate(mru_cycle_list_.begin(), mru_cycle_list_.begin() + 1, mru_cycle_list_.end()); } else { - std::rotate(mru_cycle_list_.rbegin(), - mru_cycle_list_.rbegin() + 1, + std::rotate(mru_cycle_list_.rbegin(), mru_cycle_list_.rbegin() + 1, mru_cycle_list_.rend()); } diff --git a/browser/ui/tabs/brave_tab_strip_model.h b/browser/ui/tabs/brave_tab_strip_model.h index d3ffb0b46ada..8fd1318a8dfb 100644 --- a/browser/ui/tabs/brave_tab_strip_model.h +++ b/browser/ui/tabs/brave_tab_strip_model.h @@ -20,11 +20,12 @@ class BraveTabStripModel : public TabStripModel { BraveTabStripModel(const BraveTabStripModel&) = delete; BraveTabStripModel operator=(const BraveTabStripModel&) = delete; - void SelectRelativeTab(bool forward, UserGestureDetails detail) override; + void SelectRelativeTab(TabRelativeDirection direction, + UserGestureDetails detail) override; // Set the next tab when doing a MRU cycling with Ctrl-tab void SelectMRUTab( - bool forward, + TabRelativeDirection direction, UserGestureDetails detail = UserGestureDetails(GestureType::kOther)); // Stop MRU cycling, called when releasing the Ctrl key diff --git a/browser/ui/views/brave_actions/brave_rewards_action_stub_view.cc b/browser/ui/views/brave_actions/brave_rewards_action_stub_view.cc index d49cdfec8b7d..67d3d585eb7d 100644 --- a/browser/ui/views/brave_actions/brave_rewards_action_stub_view.cc +++ b/browser/ui/views/brave_actions/brave_rewards_action_stub_view.cc @@ -62,14 +62,15 @@ BraveRewardsActionStubView::BraveRewardsActionStubView( std::u16string()), profile_(profile), delegate_(delegate) { - ink_drop()->SetMode(views::InkDropHost::InkDropMode::ON); - ink_drop()->SetBaseColorCallback(base::BindRepeating( + auto* ink_drop = views::InkDrop::Get(this); + ink_drop->SetMode(views::InkDropHost::InkDropMode::ON); + ink_drop->SetBaseColorCallback(base::BindRepeating( [](views::View* host) { return GetToolbarInkDropBaseColor(host); }, this)); SetHasInkDropActionOnClick(true); SetHorizontalAlignment(gfx::ALIGN_CENTER); - ink_drop()->SetVisibleOpacity(kToolbarInkDropVisibleOpacity); + ink_drop->SetVisibleOpacity(kToolbarInkDropVisibleOpacity); // Create badge-and-image source like an extension icon would auto preferred_size = GetPreferredSize(); ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); diff --git a/browser/ui/views/brave_ads/padded_image_button.cc b/browser/ui/views/brave_ads/padded_image_button.cc index aaddb7201721..140fff01d64e 100644 --- a/browser/ui/views/brave_ads/padded_image_button.cc +++ b/browser/ui/views/brave_ads/padded_image_button.cc @@ -36,7 +36,8 @@ const float kVisibleOpacity = 0.12f; PaddedImageButton::PaddedImageButton(PressedCallback callback) : views::ImageButton(callback) { - views::InkDrop::UseInkDropForSquareRipple(ink_drop(), + auto* ink_drop = views::InkDrop::Get(this); + views::InkDrop::UseInkDropForSquareRipple(ink_drop, /*highlight_on_hover=*/false, /*highlight_on_focus=*/false); @@ -46,8 +47,8 @@ PaddedImageButton::PaddedImageButton(PressedCallback callback) SetAnimateOnStateChange(false); - ink_drop()->SetMode(views::InkDropHost::InkDropMode::ON); - ink_drop()->SetVisibleOpacity(kVisibleOpacity); + ink_drop->SetMode(views::InkDropHost::InkDropMode::ON); + ink_drop->SetVisibleOpacity(kVisibleOpacity); SetHasInkDropActionOnClick(true); } @@ -69,7 +70,7 @@ void PaddedImageButton::OnThemeChanged() { const SkColor background_color = GetNativeTheme()->GetSystemColor( ui::NativeTheme::kColorId_WindowBackground); - ink_drop()->SetBaseColor( + views::InkDrop::Get(this)->SetBaseColor( color_utils::GetColorWithMaxContrast(background_color)); } diff --git a/browser/ui/views/brave_default_browser_dialog_view.cc b/browser/ui/views/brave_default_browser_dialog_view.cc index 1bd3340242b9..5548b37e0979 100644 --- a/browser/ui/views/brave_default_browser_dialog_view.cc +++ b/browser/ui/views/brave_default_browser_dialog_view.cc @@ -146,7 +146,7 @@ bool BraveDefaultBrowserDialogView::ShouldShowCloseButton() const { return false; } -void BraveDefaultBrowserDialogView::OnDialogInitialized() { +void BraveDefaultBrowserDialogView::OnWidgetInitialized() { SetButtonRowInsets(gfx::Insets(0, kPadding, kPadding, kPadding)); } diff --git a/browser/ui/views/brave_default_browser_dialog_view.h b/browser/ui/views/brave_default_browser_dialog_view.h index 3216f9bf2954..951fdeb826fb 100644 --- a/browser/ui/views/brave_default_browser_dialog_view.h +++ b/browser/ui/views/brave_default_browser_dialog_view.h @@ -29,7 +29,7 @@ class BraveDefaultBrowserDialogView : public views::DialogDelegateView { bool ShouldShowCloseButton() const override; std::unique_ptr CreateNonClientFrameView( views::Widget* widget) override; - void OnDialogInitialized() override; + void OnWidgetInitialized() override; private: void OnCancelButtonClicked(); diff --git a/browser/ui/views/crash_report_permission_ask_dialog_view.cc b/browser/ui/views/crash_report_permission_ask_dialog_view.cc index 22c925a637b2..2efbe298a25b 100644 --- a/browser/ui/views/crash_report_permission_ask_dialog_view.cc +++ b/browser/ui/views/crash_report_permission_ask_dialog_view.cc @@ -244,7 +244,7 @@ bool CrashReportPermissionAskDialogView::ShouldShowWindowTitle() const { return false; } -void CrashReportPermissionAskDialogView::OnDialogInitialized() { +void CrashReportPermissionAskDialogView::OnWidgetInitialized() { SetButtonRowInsets(gfx::Insets(0, 0, 18, 24)); } diff --git a/browser/ui/views/crash_report_permission_ask_dialog_view.h b/browser/ui/views/crash_report_permission_ask_dialog_view.h index 03ea080ecbd8..e397a34a64b5 100644 --- a/browser/ui/views/crash_report_permission_ask_dialog_view.h +++ b/browser/ui/views/crash_report_permission_ask_dialog_view.h @@ -31,7 +31,7 @@ class CrashReportPermissionAskDialogView : public views::DialogDelegateView { ui::ModalType GetModalType() const override; bool ShouldShowCloseButton() const override; bool ShouldShowWindowTitle() const override; - void OnDialogInitialized() override; + void OnWidgetInitialized() override; void OnAcceptButtonClicked(); void OnWindowClosing(); diff --git a/browser/ui/views/frame/brave_opaque_browser_frame_view.cc b/browser/ui/views/frame/brave_opaque_browser_frame_view.cc index 3c29a3e91a69..c9205bb73d49 100644 --- a/browser/ui/views/frame/brave_opaque_browser_frame_view.cc +++ b/browser/ui/views/frame/brave_opaque_browser_frame_view.cc @@ -31,8 +31,8 @@ void BraveOpaqueBrowserFrameView::OnPaint(gfx::Canvas* canvas) { gfx::ScopedCanvas scoped_canvas(canvas); gfx::Rect bounds_to_frame_graphic(bounds()); if (!IsFrameCondensed()) { - bounds_to_frame_graphic.Inset(layout()->FrameBorderThickness(false), - layout()->FrameTopThickness(false)); + bounds_to_frame_graphic.Inset(layout()->FrameBorderInsets(false).top(), + layout()->FrameEdgeInsets(false).top()); canvas->ClipRect(bounds_to_frame_graphic); } frame_graphic_->Paint(canvas, bounds_to_frame_graphic); diff --git a/browser/ui/views/location_bar/brave_location_bar_view.cc b/browser/ui/views/location_bar/brave_location_bar_view.cc index 689c23faf407..e2731ef5b49f 100644 --- a/browser/ui/views/location_bar/brave_location_bar_view.cc +++ b/browser/ui/views/location_bar/brave_location_bar_view.cc @@ -79,12 +79,13 @@ void BraveLocationBarView::Init() { // base method calls Update and Layout LocationBarView::Init(); // Change focus ring highlight path - if (focus_ring_) { - focus_ring_->SetPathGenerator( + views::FocusRing* focus_ring = views::FocusRing::Get(this); + if (focus_ring) { + focus_ring->SetPathGenerator( std::make_unique< BraveLocationBarViewFocusRingHighlightPathGenerator>()); if (const auto color = GetFocusRingColor(profile())) - focus_ring_->SetColor(color.value()); + focus_ring->SetColor(color.value()); } #if BUILDFLAG(ENABLE_TOR) onion_location_view_ = new OnionLocationView(browser_->profile()); diff --git a/browser/ui/views/location_bar/ipfs_location_view.cc b/browser/ui/views/location_bar/ipfs_location_view.cc index 2e3350fadfb2..0dc055c1b128 100644 --- a/browser/ui/views/location_bar/ipfs_location_view.cc +++ b/browser/ui/views/location_bar/ipfs_location_view.cc @@ -78,11 +78,12 @@ class IPFSLocationButtonView : public views::LabelButton { SetEnabledTextColors(kTextColor); SetHorizontalAlignment(gfx::ALIGN_RIGHT); SetImageLabelSpacing(6); - ink_drop()->SetMode(views::InkDropHost::InkDropMode::ON); + auto* ink_drop = views::InkDrop::Get(this); + ink_drop->SetMode(views::InkDropHost::InkDropMode::ON); SetBorder(views::CreateEmptyBorder( GetLayoutInsets(LOCATION_BAR_ICON_INTERIOR_PADDING))); SetHasInkDropActionOnClick(true); - ink_drop()->SetVisibleOpacity(kToolbarInkDropVisibleOpacity); + ink_drop->SetVisibleOpacity(kToolbarInkDropVisibleOpacity); UpdateBorder(); // Ensure focus ring follows border views::HighlightPathGenerator::Install( diff --git a/browser/ui/views/location_bar/onion_location_view.cc b/browser/ui/views/location_bar/onion_location_view.cc index 2a10372f81bb..795cdf6d2fa4 100644 --- a/browser/ui/views/location_bar/onion_location_view.cc +++ b/browser/ui/views/location_bar/onion_location_view.cc @@ -94,11 +94,13 @@ class OnionLocationButtonView : public views::LabelButton { SetEnabledTextColors(kTextColor); SetHorizontalAlignment(gfx::ALIGN_RIGHT); SetImageLabelSpacing(6); - ink_drop()->SetMode(views::InkDropHost::InkDropMode::ON); + + auto* ink_drop = views::InkDrop::Get(this); + ink_drop->SetMode(views::InkDropHost::InkDropMode::ON); SetBorder(views::CreateEmptyBorder( GetLayoutInsets(LOCATION_BAR_ICON_INTERIOR_PADDING))); SetHasInkDropActionOnClick(true); - ink_drop()->SetVisibleOpacity(kToolbarInkDropVisibleOpacity); + ink_drop->SetVisibleOpacity(kToolbarInkDropVisibleOpacity); UpdateBorder(); // Ensure focus ring follows border views::HighlightPathGenerator::Install( diff --git a/browser/ui/views/profiles/brave_incognito_menu_view.cc b/browser/ui/views/profiles/brave_incognito_menu_view.cc index 5330e1501109..099c0cad6eca 100644 --- a/browser/ui/views/profiles/brave_incognito_menu_view.cc +++ b/browser/ui/views/profiles/brave_incognito_menu_view.cc @@ -75,7 +75,7 @@ void BraveIncognitoMenuView::BuildMenu() { GetProfileMenuCloseButtonTextId(browser()->profile())), base::BindRepeating(&BraveIncognitoMenuView::OnExitButtonClicked, base::Unretained(this)), - kCloseAllIcon); + vector_icons::kCloseIcon); } void BraveIncognitoMenuView::AddTorButton() { diff --git a/browser/ui/views/profiles/brave_profile_menu_view.cc b/browser/ui/views/profiles/brave_profile_menu_view.cc index acfab5072dd6..08f36f453b78 100644 --- a/browser/ui/views/profiles/brave_profile_menu_view.cc +++ b/browser/ui/views/profiles/brave_profile_menu_view.cc @@ -23,12 +23,6 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/models/image_model.h" -namespace { -bool IsGuest(Profile* profile) { - return profile->IsGuestSession() || profile->IsEphemeralGuestProfile(); -} -} // namespace - void BraveProfileMenuView::BuildIdentity() { ProfileMenuView::BuildIdentity(); Profile* profile = browser()->profile(); @@ -59,12 +53,11 @@ void BraveProfileMenuView::BuildFeatureButtons() { if (!profile->IsOffTheRecord() && profile->HasPrimaryOTRProfile()) window_count += chrome::GetBrowserCount( profile->GetPrimaryOTRProfile(/*create_if_needed=*/true)); - if (base::FeatureList::IsEnabled(features::kNewProfilePicker) && - IsGuest(profile)) { + if (profile->IsGuestSession()) { AddFeatureButton( l10n_util::GetPluralStringFUTF16(IDS_GUEST_PROFILE_MENU_CLOSE_BUTTON, window_count), - base::BindRepeating(&BraveProfileMenuView::OnExitProfileButtonClicked, + base::BindRepeating(&ProfileMenuView::OnExitProfileButtonClicked, base::Unretained(this)), vector_icons::kCloseIcon); } else { @@ -72,7 +65,7 @@ void BraveProfileMenuView::BuildFeatureButtons() { AddFeatureButton( l10n_util::GetPluralStringFUTF16(IDS_PROFILES_CLOSE_X_WINDOWS_BUTTON, window_count), - base::BindRepeating(&BraveProfileMenuView::OnExitProfileButtonClicked, + base::BindRepeating(&ProfileMenuView::OnExitProfileButtonClicked, base::Unretained(this)), vector_icons::kCloseIcon); } diff --git a/browser/ui/views/sidebar/sidebar_add_item_bubble_delegate_view.cc b/browser/ui/views/sidebar/sidebar_add_item_bubble_delegate_view.cc index 2882ebd2a375..042e04c9d05f 100644 --- a/browser/ui/views/sidebar/sidebar_add_item_bubble_delegate_view.cc +++ b/browser/ui/views/sidebar/sidebar_add_item_bubble_delegate_view.cc @@ -23,6 +23,7 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/theme_provider.h" +#include "ui/gfx/canvas.h" #include "ui/views/bubble/bubble_frame_view.h" #include "ui/views/controls/button/label_button.h" #include "ui/views/controls/label.h" diff --git a/browser/ui/views/sidebar/sidebar_button_view.cc b/browser/ui/views/sidebar/sidebar_button_view.cc index 5db28445e769..b81bd96d04ce 100644 --- a/browser/ui/views/sidebar/sidebar_button_view.cc +++ b/browser/ui/views/sidebar/sidebar_button_view.cc @@ -12,7 +12,7 @@ SidebarButtonView::SidebarButtonView(Delegate* delegate) : delegate_(delegate) { SetImageHorizontalAlignment(views::ImageButton::ALIGN_CENTER); SetImageVerticalAlignment(views::ImageButton::ALIGN_MIDDLE); DCHECK(GetInstallFocusRingOnFocus()); - focus_ring()->SetColor(gfx::kBraveBlurple300); + views::FocusRing::Get(this)->SetColor(gfx::kBraveBlurple300); } SidebarButtonView::~SidebarButtonView() = default; diff --git a/browser/ui/views/sidebar/sidebar_item_drag_context.cc b/browser/ui/views/sidebar/sidebar_item_drag_context.cc index 58e5441aa7fd..4ad82525031b 100644 --- a/browser/ui/views/sidebar/sidebar_item_drag_context.cc +++ b/browser/ui/views/sidebar/sidebar_item_drag_context.cc @@ -38,6 +38,6 @@ bool SidebarItemDragContext::CanStartDrag(const gfx::Point press_pt, constexpr int kMinimumDragDistance = 10; int x_offset = abs(p.x() - press_pt.x()); int y_offset = abs(p.y() - press_pt.y()); - return sqrt(pow(float{x_offset}, 2) + pow(float{y_offset}, 2)) > - kMinimumDragDistance; + return sqrt(pow(static_cast(x_offset), 2) + + pow(static_cast(y_offset), 2)) > kMinimumDragDistance; } diff --git a/browser/ui/views/sidebar/sidebar_items_contents_view.cc b/browser/ui/views/sidebar/sidebar_items_contents_view.cc index 5073b630bab8..1c1dc1f7c1eb 100644 --- a/browser/ui/views/sidebar/sidebar_items_contents_view.cc +++ b/browser/ui/views/sidebar/sidebar_items_contents_view.cc @@ -31,6 +31,7 @@ #include "ui/base/resource/resource_bundle.h" #include "ui/base/theme_provider.h" #include "ui/compositor/compositor.h" +#include "ui/gfx/canvas.h" #include "ui/gfx/image/image_skia_operations.h" #include "ui/gfx/paint_vector_icon.h" #include "ui/views/background.h" @@ -79,8 +80,9 @@ gfx::Size SidebarItemsContentsView::CalculatePreferredSize() const { if (children().empty()) return {0, 0}; const gfx::Size child_size = children()[0]->GetPreferredSize(); - return {child_size.width() + GetInsets().width(), - children().size() * child_size.height() + GetInsets().height()}; + return gfx::Size( + child_size.width() + GetInsets().width(), + children().size() * child_size.height() + GetInsets().height()); } void SidebarItemsContentsView::OnThemeChanged() { diff --git a/browser/ui/views/sidebar/sidebar_items_scroll_view.cc b/browser/ui/views/sidebar/sidebar_items_scroll_view.cc index f1bf1bdf8361..32a3645b47dd 100644 --- a/browser/ui/views/sidebar/sidebar_items_scroll_view.cc +++ b/browser/ui/views/sidebar/sidebar_items_scroll_view.cc @@ -41,7 +41,7 @@ class SidebarItemsArrowView : public views::ImageButton { SetImageHorizontalAlignment(views::ImageButton::ALIGN_CENTER); SetImageVerticalAlignment(views::ImageButton::ALIGN_MIDDLE); DCHECK(GetInstallFocusRingOnFocus()); - focus_ring()->SetColor(gfx::kBraveBlurple300); + views::FocusRing::Get(this)->SetColor(gfx::kBraveBlurple300); } ~SidebarItemsArrowView() override = default; diff --git a/browser/ui/views/sidebar/sidebar_show_options_event_detect_widget.cc b/browser/ui/views/sidebar/sidebar_show_options_event_detect_widget.cc index 56020f55205c..728e4b144d34 100644 --- a/browser/ui/views/sidebar/sidebar_show_options_event_detect_widget.cc +++ b/browser/ui/views/sidebar/sidebar_show_options_event_detect_widget.cc @@ -11,6 +11,7 @@ #include "brave/browser/ui/views/frame/brave_browser_view.h" #include "brave/grit/brave_generated_resources.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/gfx/canvas.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/paint_vector_icon.h" #include "ui/views/background.h" diff --git a/browser/ui/views/speedreader/speedreader_icon_view.cc b/browser/ui/views/speedreader/speedreader_icon_view.cc index fa48e11089d5..15b9cf843a53 100644 --- a/browser/ui/views/speedreader/speedreader_icon_view.cc +++ b/browser/ui/views/speedreader/speedreader_icon_view.cc @@ -24,6 +24,7 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/metadata/metadata_impl_macros.h" #include "ui/base/theme_provider.h" +#include "ui/views/animation/ink_drop.h" #include "ui/views/animation/ink_drop_host_view.h" #include "ui/views/animation/ink_drop_state.h" @@ -55,8 +56,10 @@ void SpeedreaderIconView::UpdateImpl() { return; } - if (ink_drop()->GetHighlighted() && !IsBubbleShowing()) - ink_drop()->AnimateToState(views::InkDropState::HIDDEN, nullptr); + if (views::InkDrop::Get(this)->GetHighlighted() && !IsBubbleShowing()) { + views::InkDrop::Get(this)->AnimateToState(views::InkDropState::HIDDEN, + nullptr); + } const ui::ThemeProvider* theme_provider = GetThemeProvider(); const DistillState state = GetDistillState(); diff --git a/browser/ui/views/tabs/brave_alert_indicator.cc b/browser/ui/views/tabs/brave_alert_indicator.cc index 96c5e904c1c0..001aca4c9a56 100644 --- a/browser/ui/views/tabs/brave_alert_indicator.cc +++ b/browser/ui/views/tabs/brave_alert_indicator.cc @@ -18,6 +18,7 @@ #include "content/public/browser/web_contents.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/skia/include/core/SkPathTypes.h" +#include "ui/gfx/canvas.h" #include "ui/gfx/color_utils.h" #include "ui/views/background.h" diff --git a/browser/ui/webui/brave_welcome_ui.cc b/browser/ui/webui/brave_welcome_ui.cc index 458894d63075..10b82af1041a 100644 --- a/browser/ui/webui/brave_welcome_ui.cc +++ b/browser/ui/webui/brave_welcome_ui.cc @@ -121,7 +121,8 @@ std::string CountryIDToCountryString(int country_id) { if (country_id == country_codes::kCountryIDUnknown) return std::string(); - char chars[3] = {(country_id >> 8) & 0xFF, country_id & 0xFF, 0}; + char chars[3] = {static_cast(country_id >> 8), + static_cast(country_id), 0}; std::string country_string(chars); DCHECK_EQ(country_string.size(), 2U); return country_string; diff --git a/browser/ui/webui/ethereum_remote_client/ethereum_remote_client_page.html b/browser/ui/webui/ethereum_remote_client/ethereum_remote_client_page.html index ec212517abfa..e8b232d1a078 100644 --- a/browser/ui/webui/ethereum_remote_client/ethereum_remote_client_page.html +++ b/browser/ui/webui/ethereum_remote_client/ethereum_remote_client_page.html @@ -9,7 +9,7 @@ - + -

- - - \ No newline at end of file + + diff --git a/ui/webui/resources/br_elements/br_toolbar/br_toolbar.js b/ui/webui/resources/br_elements/br_toolbar/br_toolbar.js index 8da4d19e1b3b..cd7c583c69e4 100644 --- a/ui/webui/resources/br_elements/br_toolbar/br_toolbar.js +++ b/ui/webui/resources/br_elements/br_toolbar/br_toolbar.js @@ -2,6 +2,11 @@ // 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 {Polymer, html} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import 'chrome://resources/polymer/v3_0/iron-media-query/iron-media-query.js'; +import 'chrome://brave-resources/br_elements/shared_vars_css.m.js'; +import './br_toolbar_search_field.js'; + const customCurrentWebUINameMap = { extensions: 'settings', sync: 'settings', @@ -10,6 +15,8 @@ const customCurrentWebUINameMap = { Polymer({ is: 'cr-toolbar', + _template: html`{__html_template__}`, + properties: { // Name to display in the toolbar, in titlecase. pageName: String, diff --git a/ui/webui/resources/br_elements/br_toolbar/br_toolbar_search_field.html b/ui/webui/resources/br_elements/br_toolbar/br_toolbar_search_field.html index 701e180f4885..06531b5ff51f 100644 --- a/ui/webui/resources/br_elements/br_toolbar/br_toolbar_search_field.html +++ b/ui/webui/resources/br_elements/br_toolbar/br_toolbar_search_field.html @@ -1,163 +1,154 @@ + - .page-search_text:focus, .page-search_text:active { - outline: none; - border: none; - } - - .page-search_close-button { - margin: var(--search-padding); - cursor: pointer; - display: flex; - align-items: center; - } - .page-search_close-button svg { - height: var(--search-icon-size); - width: var(--search-icon-size); - padding: var(--search-icon-padding); - } - - - +
+ + +
diff --git a/ui/webui/resources/br_elements/br_toolbar/br_toolbar_search_field.js b/ui/webui/resources/br_elements/br_toolbar/br_toolbar_search_field.js index 5c6af950d3ff..8695099e504b 100644 --- a/ui/webui/resources/br_elements/br_toolbar/br_toolbar_search_field.js +++ b/ui/webui/resources/br_elements/br_toolbar/br_toolbar_search_field.js @@ -3,11 +3,14 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this file, // you can obtain one at http://mozilla.org/MPL/2.0/. +import {Polymer, html} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {CrSearchFieldBehavior} from 'chrome://resources/cr_elements/cr_search_field/cr_search_field_behavior.js'; Polymer({ is: 'br-toolbar-search-field', + _template: html`{__html_template__}`, + behaviors: [CrSearchFieldBehavior], properties: { @@ -166,4 +169,4 @@ Polymer({ this.setValue('') this.getSearchInput().blur() }, -}) +}); diff --git a/ui/webui/resources/br_elements_resources.grdp b/ui/webui/resources/br_elements_resources.grdp index 9a215780e498..8282a0647e89 100644 --- a/ui/webui/resources/br_elements_resources.grdp +++ b/ui/webui/resources/br_elements_resources.grdp @@ -8,23 +8,6 @@ file="br_elements/shared_vars_css.html" type="chrome_html" compress="gzip" /> - - - - - - diff --git a/ui/webui/resources/css/text_defaults_md.css b/ui/webui/resources/css/text_defaults_md.css index cd495831dcf1..82a76f8576cc 100644 --- a/ui/webui/resources/css/text_defaults_md.css +++ b/ui/webui/resources/css/text_defaults_md.css @@ -16,7 +16,7 @@ html { /* TODO(dbeam): remove this soon. Prefer dir= in HTML. */ - direction: $i18n{textDirection}; + direction: $i18n{textdirection}; } body { diff --git a/ui/webui/resources/polymer_overriding.js b/ui/webui/resources/polymer_overriding.js index 0b598aea1d32..452772a3b9b0 100644 --- a/ui/webui/resources/polymer_overriding.js +++ b/ui/webui/resources/polymer_overriding.js @@ -3,9 +3,10 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this file, // you can obtain one at http://mozilla.org/MPL/2.0/. -import {Polymer, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {html as polymerHtml, mixinBehaviors, Polymer, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; // Global overrides +import 'chrome://brave-resources/br_elements/br_toolbar/br_toolbar.js'; import CrButtonStyleTemplate from './overrides/cr_button.js' import CrToggleStyleTemplate from './overrides/cr_toggle.js' @@ -20,8 +21,11 @@ if (debug) { const allBehaviorsMap = {} const allPropertiesMap = {} const componentPropertyModifications = {} +const ignoredComponents = [ + 'cr-toolbar' +] -function addBraveBehaviors(moduleName, component) { +function addBraveBehaviorsLegacy(moduleName, component) { if (allBehaviorsMap[moduleName]) { component.behaviors = component.behaviors || [] component.behaviors.push(...allBehaviorsMap[moduleName]) @@ -45,7 +49,7 @@ function addBraveProperties(moduleName, component) { const allBraveTemplateModificationsMap = {} function addBraveTemplateModifications(moduleName, component, modifyFn) { - const template = component.template || component._template + const template = component._template || component.template if (template) { const templateContent = template.content const t0 = debug && performance.now() @@ -60,9 +64,7 @@ function addBraveTemplateModifications(moduleName, component, modifyFn) { const styleOverridePrefix = 'brave-override-style-' -function addBraveStyleOverride(moduleName, component) { - // does have template style element? - const template = component.template || component._template +function addBraveStyleOverride(moduleName, component, template = component._template || component.template) { if (!template) { console.error(`No template found for component (${moduleName}) with found style overrides`, component) return @@ -107,17 +109,34 @@ export function RegisterPolymerTemplateModifications(modificationsMap) { const awaitingComponentModifications = {} for (const componentName in modificationsMap) { const modifyFn = modificationsMap[componentName] - const existingComponent = window.customElements.get(componentName) - if (!existingComponent) { - awaitingComponentModifications[componentName] = modificationsMap[componentName] - continue - } - // Component is already defined, modify now. - addBraveTemplateModifications(componentName, existingComponent, modifyFn) + // const existingComponent = window.customElements.get(componentName) + // if (!existingComponent) { + awaitingComponentModifications[componentName] = modificationsMap[componentName] + // NOTE(petemill): If module has already been defined, it's not ideal as the unmodified + // template may already have been cloned for an element. However, we assume PolymerElement._prepareTemplate + // has not been called yet for the component. + // However, this would be more robust if we moved to a subclassing approach. } Object.assign(allBraveTemplateModificationsMap, awaitingComponentModifications) } +export function RegisterPolymerComponentReplacement(name, component) { + if (debug) { + console.log(`RegisterPolymerComponentReplacement: ${name}`) + } + if (!ignoredComponents.includes(name)) { + console.warn(`RegisterPolymerComponentReplacement: did not find component '${name}' as being ignored via RegisterPolymerComponentToIgnore`) + } + define(name, component) +} + +export function RegisterPolymerComponentToIgnore(name) { + if (debug) { + console.log(`RegisterPolymerComponentToIgnore ${name}`) + } + ignoredComponents.push(name) +} + const moduleNamesWithStyleOverrides = [] export async function RegisterStyleOverride(componentName, styleTemplate) { @@ -137,21 +156,11 @@ export async function RegisterStyleOverride(componentName, styleTemplate) { if (debug) { console.log(`REGISTERING STYLE OVERRIDE for ${componentName}`, styleTemplate) } - // If module has already been defined, it's not ideal as the unmodified - // template may already have been cloned for an element. However, let's make - // an attempt and apply it anyway. Otherwise, we wait until it's defined and - // then modify the template as soon as possible. - const existingComponent = window.customElements.get(componentName) - if (existingComponent) { - addBraveStyleOverride(componentName, existingComponent) - } else { - // Cannot await CustomElementRegistry.whenDefined here - // since getting in the async queue will mean this template - // mofification happens too late. Instead, save this in a list - // so that the template modification can happen inside the - // customElements.define hook. - moduleNamesWithStyleOverrides.push(componentName) - } + // NOTE(petemill): If module has already been defined, it's not ideal as the unmodified + // template may already have been cloned for an element. However, we assume PolymerElement._prepareTemplate + // has not been called yet for the component. + // However, this would be more robust if we moved to a subclassing approach. + moduleNamesWithStyleOverrides.push(componentName) } export function OverrideIronIcons(iconSetName, overridingIconSetName, iconOverrides) { @@ -198,32 +207,9 @@ export function OverrideIronIcons(iconSetName, overridingIconSetName, iconOverri srcIconSet.getIconNames() } -function PerformBraveModifications(name, component) { - if (debug) { - console.debug(`Polymer component registering: ${name}`, component) - } - addBraveBehaviors(name, component) - addBraveProperties(name, component) - const templateModifyFn = allBraveTemplateModificationsMap[name] - if (templateModifyFn) { - addBraveTemplateModifications(name, component, templateModifyFn) - delete allBraveTemplateModificationsMap[name] - } - if (moduleNamesWithStyleOverrides.includes(name)) { - addBraveStyleOverride(name, component) - } -} - -// TODO(petemill): Overriding Polymer.Class only works because -// chromium components at the moment are passing objects rather -// than classes. If this changes, or for something more robust, -// we can instead hook in to `window.customElements.define`. This -// will require changing how we inject behaviors to instead return a -// subclass of the original component, with the lifecycle methods added. -// That's because behaviors are a legacy polymer feature, -// now migrated to subclassing. -// That should work for any type of Polymer component (class or -// object-to-generated-class). +// Overriding Polymer.Class only works for some +// chromium components which call Polymer() and pass objects rather +// than classes. const oldClass = Polymer.Class Polymer.Class = function (info, mixin) { if (!info) { @@ -237,12 +223,99 @@ Polymer.Class = function (info, mixin) { return oldClass(info, mixin) } if (debug) { - console.log('defined', name) + console.debug(`Polymer component legacy registering: ${name}`, info) } - PerformBraveModifications(name, info) + addBraveBehaviorsLegacy(name, info) return oldClass(info, mixin) } +// Also override for components which do not call Polymer() but instead +// inherit from PolymerElement. +const oldPrepareTemplate = PolymerElement._prepareTemplate; +PolymerElement._prepareTemplate = function BravePolymer_PrepareTemplate() { + oldPrepareTemplate.call(this) + const name = this.is + if (!name) { + if (debug) { + console.warn('PolymerElement defined with no name', this, this.prototype) + } + return + } + if (debug) { + console.log('PolymerElement _prepareTemplate: ', name, this, this.prototype) + } + // Perform modifications that we want to change the original class / prototype + // features, such as editing template or properties. + // Other modifications, such as injecting overriden classes (aka behaviors), + // will happen at component definition time. + addBraveProperties(name, this.prototype) + const templateModifyFn = allBraveTemplateModificationsMap[name] + if (templateModifyFn) { + addBraveTemplateModifications(name, this.prototype, templateModifyFn) + // TODO(petemill): delete allBraveTemplateModificationsMap entry when done so that the + // function can be collected. We do not delete at the moment since + // _prepareTemplate can be called multiple times. We should move template + // modification to happen via automatic subclassing and overriding of template + // property. + } + if (moduleNamesWithStyleOverrides.includes(name)) { + addBraveStyleOverride(name, this.prototype) + } +} + +const oldDefine = window.customElements.define + +function BraveDefineCustomElements (name, component, options, useIgnoreList = true) { + if (component.polymerElementVersion) { + if (debug) { + console.log('BraveDefineCustomElements PolymerElement defined', name, component, options) + } + // Global ignore (likely due to manual replacement) + if (useIgnoreList && ignoredComponents.includes(name)) { + if (debug) { + console.log(`BraveDefineCustomElements ignored ${name}`) + } + return + } + // Inject behaviors + if (allBehaviorsMap[name]) { + if (debug) { + console.log('BraveDefineCustomElements added behavior', allBehaviorsMap[name]) + } + component = mixinBehaviors(allBehaviorsMap[name], component) + delete allBehaviorsMap[name] + } + } + oldDefine.call(this, name, component, options) +} + +window.customElements.define = BraveDefineCustomElements + +export function define (name, component, options) { + // We still want style and template overrides + BraveDefineCustomElements.call(window.customElements, name, component, options, false) +} + +/** + * Allows regular string tagged templating before parsing as html elements. + * Differs from polymer's html function only in that it allows strings and + * does not allow nested htmlelements. + * Named html for syntax highlighting in some IDEs. + * @param {*} strings + * @param {...any} values + * @returns HTMLTEmplateElement + */ + export function html(strings, ...values) { + // Get regular string placeholders first (basic `i am ${'a'} string` parsing) + // since Polymer's html tagged template only supports html element + // placeholders. + const htmlRaw = values.reduce((acc, v, idx) => + acc + v + strings[idx + 1], strings[0]) + // Utilize polymer's tagged template element creation for no other reason than we are allowed + // to call innerHTML there. + return polymerHtml([htmlRaw]).content.cloneNode(true) +} + // Overrides for all pages RegisterStyleOverride('cr-toggle', CrToggleStyleTemplate) RegisterStyleOverride('cr-button', CrButtonStyleTemplate) diff --git a/utility/importer/chrome_importer.cc b/utility/importer/chrome_importer.cc index 6ee8d0446f73..a324f8326b75 100644 --- a/utility/importer/chrome_importer.cc +++ b/utility/importer/chrome_importer.cc @@ -137,14 +137,13 @@ bool SetEncryptionKey(const base::FilePath& source_path) { return true; } -std::u16string DecryptedCardFromColumn(const sql::Statement& s, - int column_index) { +std::u16string DecryptedCardFromColumn(sql::Statement* s, int column_index) { std::u16string credit_card_number; - int encrypted_number_len = s.ColumnByteLength(column_index); + int encrypted_number_len = s->ColumnByteLength(column_index); if (encrypted_number_len) { std::string encrypted_number; encrypted_number.resize(encrypted_number_len); - memcpy(&encrypted_number[0], s.ColumnBlob(column_index), + memcpy(&encrypted_number[0], s->ColumnBlob(column_index), encrypted_number_len); OSCrypt::DecryptString16(encrypted_number, &credit_card_number); } @@ -409,7 +408,8 @@ void ChromeImporter::RecursiveReadBookmarksFolder( // Folders are added implicitly on adding children, so we only // explicitly add empty folders. const base::ListValue* children; - if (dict->GetList("children", &children) && children->empty()) { + if (dict->GetList("children", &children) && + children->GetList().empty()) { entry.in_toolbar = is_in_toolbar; entry.is_folder = true; entry.url = GURL(); @@ -503,7 +503,7 @@ void ChromeImporter::ImportPayments() { auto* brave_bridge = static_cast(bridge_.get()); while (s.Step()) { - const std::u16string card_number = DecryptedCardFromColumn(s, 3); + const std::u16string card_number = DecryptedCardFromColumn(&s, 3); // Empty means decryption is failed. Or chrome's data is invalid. // Skip it. if (card_number.empty()) diff --git a/vendor/bat-native-ads/include/bat/ads/page_transition_types.h b/vendor/bat-native-ads/include/bat/ads/page_transition_types.h index 402cc29fead6..671c93c1c4d7 100644 --- a/vendor/bat-native-ads/include/bat/ads/page_transition_types.h +++ b/vendor/bat-native-ads/include/bat/ads/page_transition_types.h @@ -19,7 +19,7 @@ namespace ads { // A type is made of a core value and a set of qualifiers. A type has one core // value and 0 or or more qualifiers. -enum PageTransitionType : int32_t { +enum PageTransitionType : uint32_t { // User got to this page by clicking a link on another page. kPageTransitionLink = 0, diff --git a/vendor/bat-native-ads/src/bat/ads/internal/security/crypto_util.cc b/vendor/bat-native-ads/src/bat/ads/internal/security/crypto_util.cc index c1202c9c43da..73ef386a4492 100644 --- a/vendor/bat-native-ads/src/bat/ads/internal/security/crypto_util.cc +++ b/vendor/bat-native-ads/src/bat/ads/internal/security/crypto_util.cc @@ -12,9 +12,9 @@ #include #include "base/base64.h" +#include "base/cxx17_backports.h" #include "base/json/json_reader.h" #include "base/rand_util.h" -#include "base/stl_util.h" #include "base/strings/string_number_conversions.h" #include "base/values.h" #include "bat/ads/internal/logging.h" diff --git a/vendor/bat-native-ledger/src/bat/ledger/internal/contribution/contribution_unblinded_unittest.cc b/vendor/bat-native-ledger/src/bat/ledger/internal/contribution/contribution_unblinded_unittest.cc index 499cf7c2e90f..cab2f9bb8517 100644 --- a/vendor/bat-native-ledger/src/bat/ledger/internal/contribution/contribution_unblinded_unittest.cc +++ b/vendor/bat-native-ledger/src/bat/ledger/internal/contribution/contribution_unblinded_unittest.cc @@ -6,6 +6,7 @@ #include #include +#include "base/cxx17_backports.h" #include "base/test/task_environment.h" #include "bat/ledger/internal/contribution/contribution_unblinded.h" #include "bat/ledger/internal/database/database_contribution_info.h" diff --git a/vendor/bat-native-ledger/src/bat/ledger/internal/credentials/credentials_promotion.cc b/vendor/bat-native-ledger/src/bat/ledger/internal/credentials/credentials_promotion.cc index d099e7727e0c..00c8c9340d2f 100644 --- a/vendor/bat-native-ledger/src/bat/ledger/internal/credentials/credentials_promotion.cc +++ b/vendor/bat-native-ledger/src/bat/ledger/internal/credentials/credentials_promotion.cc @@ -147,7 +147,7 @@ void CredentialsPromotion::Claim( auto blinded_creds = ParseStringToBaseList(creds->blinded_creds); - if (!blinded_creds || blinded_creds->empty()) { + if (!blinded_creds || blinded_creds->GetList().empty()) { BLOG(0, "Blinded creds are corrupted, we will try to blind again"); auto save_callback = std::bind(&CredentialsPromotion::RetryPreviousStepSaved, @@ -375,7 +375,7 @@ void CredentialsPromotion::VerifyPublicKey( auto promotion_keys = ParseStringToBaseList(promotion->public_keys); - if (!promotion_keys || promotion_keys->empty()) { + if (!promotion_keys || promotion_keys->GetList().empty()) { BLOG(0, "Public key is missing"); callback(type::Result::LEDGER_ERROR); return; diff --git a/vendor/bat-native-ledger/src/bat/ledger/internal/credentials/credentials_sku.cc b/vendor/bat-native-ledger/src/bat/ledger/internal/credentials/credentials_sku.cc index eaaa72577652..9deabf4df0a9 100644 --- a/vendor/bat-native-ledger/src/bat/ledger/internal/credentials/credentials_sku.cc +++ b/vendor/bat-native-ledger/src/bat/ledger/internal/credentials/credentials_sku.cc @@ -212,7 +212,7 @@ void CredentialsSKU::Claim( auto blinded_creds = ParseStringToBaseList(creds->blinded_creds); - if (!blinded_creds || blinded_creds->empty()) { + if (!blinded_creds || blinded_creds->GetList().empty()) { BLOG(0, "Blinded creds are corrupted, we will try to blind again"); auto save_callback = std::bind(&CredentialsSKU::RetryPreviousStepSaved, diff --git a/vendor/bat-native-ledger/src/bat/ledger/internal/database/database_migration_unittest.cc b/vendor/bat-native-ledger/src/bat/ledger/internal/database/database_migration_unittest.cc index f4ab87062a36..a5bff233b810 100644 --- a/vendor/bat-native-ledger/src/bat/ledger/internal/database/database_migration_unittest.cc +++ b/vendor/bat-native-ledger/src/bat/ledger/internal/database/database_migration_unittest.cc @@ -682,7 +682,7 @@ TEST_F(LedgerDatabaseMigrationTest, Migration_27_UnblindedTokens) { unblinded_token.value = sql.ColumnDouble(3); unblinded_token.creds_id = sql.ColumnString(4); unblinded_token.expires_at = sql.ColumnInt64(5); - reserved_at = sql.ColumnInt64(10); + reserved_at = sql.ColumnInt64(6); } EXPECT_EQ(unblinded_token.id, 1ull);