Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Brave to Handle Searches from Windows Shell and Cortana #13875

Closed
jonathansampson opened this issue Feb 1, 2021 · 5 comments · Fixed by brave/brave-core#9778
Closed

Comments

@jonathansampson
Copy link
Contributor

Description

Even when Brave is the default browser, the user may still find themselves unintentionally using Microsoft Edge. This is because searches from the start menu and elsewhere in Windows open results in Microsoft Edge, rather than in the user's preferred browser.

Steps to Reproduce

  1. Set Brave as your default browser on Windows 10
  2. Press the Windows Key
  3. Type "brave deviations from chromium"
  4. Press Enter

Actual result:

Results are opened in Microsoft Edge.

Expected result:

Results are opened in Brave (if Brave is the default browser).

Reproduces how often:

Always.

Brave version (brave://version info)

1.19.88

Miscellaneous Information:

Note: The "Command" portion is caused by Windows thinking "deviations from chromium" should be passed as arguments to the "brave" executable. As such, selecting that option opens 3 new tabs in Brave (i.e. /deviations, /from, /chromium), which is clearly not the intended result, and is wholly unrelated to this issue :)

image

@jonathansampson
Copy link
Contributor Author

jonathansampson commented Feb 1, 2021

From another thread, the https://github.com/da2x/EdgeDeflector has tackled this issue in the past. It registers itself as the handler for the microsoft-edge: protocol, and then passes the received URL to the shell for execution. The shell will then open it in whichever app is registered to handle HTTP/HTTPS.

Note that EdgeDeflector registers itself as a handler for the microsoft-edge: protocol. If Brave were do to that, this alone may be sufficient (enabling users to then set Brave as the default handler).

image

Relevant

chrome/installer/util/shell_util.cc

const wchar_t* ShellUtil::kBrowserProtocolAssociations[] = {
    L"ftp", L"http", L"https", nullptr
};
const wchar_t* ShellUtil::kPotentialProtocolAssociations[] = {
    L"ftp", L"http",  L"https", L"irc", L"mailto", L"mms", L"news", L"nntp",
    L"sms", L"smsto", L"snews", L"tel", L"urn", L"webcal", nullptr};
``

@rebron rebron added the priority/P4 Planned work. We expect to get to it "soon". label Feb 2, 2021
@bsclifton
Copy link
Member

This would be a great one to do- we'd need to make it an option (under System maybe?) in settings defaulted to false. When toggled, it could update the registry. The hardest part would be the parsing of the microsoft-edge: if we didn't consider using an existing library (like EdgeDeflector)

@lukemulks
Copy link

+1 for this.

Any time I click on a "Help" or "Help from web" link within the Windows OS, I'm navigated directly via Edge (even though Brave is set as my default browser).

Interestingly enough, the navigation is to an https destination, which technically is the default protocol that Brave should be handling when Brave is set as the default browser.

It also appears to be very difficult to manually change this within the OS, as the only applications Microsoft surfaces as available to set as the default for the edge-related protocols is Microsoft Edge, or an option to select another app from the Microsoft Store, which does not include Brave.

@simonhong simonhong self-assigned this Aug 13, 2021
@rebron rebron added priority/P3 The next thing for us to work on. It'll ride the trains. and removed priority/P4 Planned work. We expect to get to it "soon". labels Aug 13, 2021
@simonhong
Copy link
Member

simonhong commented Aug 17, 2021

When brave is set as a default app for microsoft-edge protocol via control panel ,
image

additional command line args are passed like below. Brave browser needs to fetch url and load it.

microsoft-edge:?launchContext1=Microsoft.Windows.Cortana_cw5n1h2txyewy&url=https%3A%2F%2Fwww.bing.com%2Fsearch%3Fq%3Dtest%26form%3DWNSGPH%26qs%3DSW%26cvid%3D935e77bf08484a92a230ddb119a8e594%26pq%3Dtest%26cc%3DKR%26setlang%3Den-US%26nclid%3D9896661371B25E91DFE2753D62351D4A%26ts%3D1629177294875%26nclidts%3D1629177294%26tsms%3D875%26wsso%3DModerate

another example - uninstall survey from chrome

microsoft-edge:https://support.google.com/chrome?p=chrome_uninstall_survey&crversion=94.0.4603.0&os=10.0.19041

Below is full command line when brave is launched via windows search panel.

"C:\Program Files\BraveSoftware\Brave-Browser-Nightly\Application\brave.exe" --enable-dom-distiller --disable-domain-reliability --no-pings --origin-trial-public-key=bYUKPJoPnCxeNvu72j4EmPuK7tr1PAC7SHh8ld9Mw3E=,fMS4mpO6buLQ/QMd+zJmxzty/VQ6B1EUZqoCU04zoRU= --sync-url=https://sync-v2.brave.com/v2 --lso-url=https://no-thanks.invalid --variations-server-url=https://variations.brave.com/seed --enable-features=LegacyTLSEnforced,WebUIDarkMode,PrefetchPrivacyChanges,PasswordImport,ReducedReferrerGranularity,AutoupgradeMixedContent,SafetyTip,WinrtGeolocationImplementation --disable-features=AutofillEnableAccountWalletStorage,FledgeInterestGroupAPI,HandwritingRecognitionWebPlatformApi,TrustTokens,DirectSockets,HandwritingRecognitionWebPlatformApiFinch,FlocIdComputedEventLogging,SignedExchangePrefetchCacheForNavigations,NetworkTimeServiceQuerying,SubresourceWebBundles,InterestCohortAPIOriginTrial,FirstPartySets,FederatedLearningOfCohorts,PrivacySandboxSettings,FledgeInterestGroups,InterestCohortFeaturePolicy,NotificationTriggers,WebOTP,AutofillServerCommunication,LiveCaption,LangClientHintHeader,IdleDetection,SignedExchangeSubresourcePrefetch,EnablePasswordsAccountStorage,TextFragmentAnchor,EnableProfilePickerOnStartup --flag-switches-begin --enable-features=LegacyTLSEnforced,WebUIDarkMode,PrefetchPrivacyChanges,PasswordImport,ReducedReferrerGranularity,AutoupgradeMixedContent,SafetyTip,WinrtGeolocationImplementation,Sidebar --flag-switches-end microsoft-edge:?launchContext1=Microsoft.Windows.Cortana_cw5n1h2txyewy&url=https%3A%2F%2Fwww.bing.com%2Fsearch%3Fq%3Dtest%26form%3DWNSGPH%26qs%3DSW%26cvid%3D935e77bf08484a92a230ddb119a8e594%26pq%3Dtest%26cc%3DKR%26setlang%3Den-US%26nclid%3D9896661371B25E91DFE2753D62351D4A%26ts%3D1629177294875%26nclidts%3D1629177294%26tsms%3D875%26wsso%3DModerate

To make Brave as a microsoft-edge protocol suported app, Brave should have microsoft-edge entry in URLAssociations like below.
image


When Brave is set a a default app for microsoft-edge, registry is set like below.
image


When I try to set default app for microsoft-edge protocol manually w/o using control panel,
it doesn't work. I can set reg value but it's reverted to edge by Windows OS.
I think we should launch control panel for setting this like we do for default browser app.


When Brave is set as a default app for microsoft-edge protocol, we just need to delete regstry UserChoice value for this protocol while uninstalling Brave.
Then, edge will be set implicitely.

When Brave is set as a default app for microsoft-edge protocol, we don't need to do anything during the uninstall.
When uninstalled app is still set as a default app for microsoft-edge, Windows will ask again to users to choose default app for it.

@stephendonner
Copy link

Verified PASSED using the testplan from brave/brave-core#9778 with build

Brave 1.30.44 Chromium: 93.0.4577.51 (Official Build) nightly (64-bit)
Revision 762d21050e2da59930c784c09b134d0b0b148188-refs/branch-heads/4577@{#915}
OS Windows 10 OS Version 2009 (Build 22000.160)

Steps:

Test 1 - from chrome uninstall process

  1. Set Brave as a default app for microsoft-edge protocol
  2. Install Chrome and then uninstall
  3. Check uninstall survey page is loaded in Brave

chrome-uninstall

Test 2 - search from windows task bar

  1. Set Brave as a default app for microsoft-edge protocol
  2. Searched from Windows taskbar.
  3. Check Bing search URL is loaded in brave
  4. Search another keyword from windows taskbar
  5. Check another tab is created and new tab loads Bing search URL
example example example
cortana-search brave-default-search brave-search

Test 3 - uninstall

  1. Set Brave as a default app for microsoft-edge protocol
  2. Uninstall Brave
  3. Search any keyword from Windows taskbar
  4. Check Windows asks users to set default app for microsoft-edge protocol again
example example
non-chrome-web-results-cortana ms-edge-file-association-dialog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants