brave / brave-browser

Brave browser for Android, iOS, Linux, macOS, Windows.
https://brave.com
Mozilla Public License 2.0
17.52k stars 2.27k forks source link

Brave Search pages opened by omnibox banner should always be able to show "set default" UI #23657

Closed petemill closed 2 years ago

petemill commented 2 years ago

Steps to Reproduce

  1. Set a default search provider that is not Brave Search
  2. Visit search.brave.com and perform a search
  3. Repeat searches on search.brave.com more than 3 times
  4. Run with the flag to show any omnibox promotion for Brave Search
  5. Begin to type a search query in to the omnibox
  6. Click the omnibox suggestion to perform the search with Brave Search

Actual result:

The results page will not be able to create the button for the user to make Brave Search their default search provider, since we only currently allow 3 calls to that API in a 24-hour period.

Expected result:

Any search results page opened as a result of the omnibox promotion should not be restricted to the 24-hour limit. The user has decided to engage with the omnibox promotion and we wish to provide the option to set as default.

Reproduces how often:

Miscellaneous Information:

As far as I know it is not easy for the BraveSearchDefaultHost to know which WebContents has made the call (to receive some kind of flag set in WebContentsUserData when the load is initiated by the promotion banner. If this is the case then perhaps we can just use query parameter for now: BraveSearchRenderFrameObserver looks for action=makeDefault in Url, then sets a constructor flag for BraveSearchDefaultJSHandler if found (e.g. can_always_set_default) and then that binds to BraveSearchDefaultJSHandler::GetCanSetDefaultSearchProvider passing an extra param can_always_set_default, which also passes that param to brave_search_default_ (the browser host).

stephendonner commented 2 years ago

Verified PASSED using

Brave 1.43.61 Chromium: 104.0.5112.81 (Official Build) dev (x86_64)
Revision 5b7b76419d50f583022568b6764b630f6ddc9208-refs/branch-heads/5112@{#1309}
OS macOS Version 11.6.8 (Build 20G730)

Steps:

  1. installed 1.43.61
  2. launched browser with --enable-features=BraveSearchOmniboxBanner command line switch (with clean profile)
  3. set Startpage as the default search engine
  4. typed any keyword and check button type autocomplete is visible as a last item
  5. Click Try Brave Search button in the promotion banner from omnibox popup
  6. Check Set Brave Search as a default is visible in the search result page and click
  7. Check Brave search is set as a default
  8. Repeat step 2 to 6 above 4 times
  9. Repeat step 2
  10. Click Dismiss button from omnibox banner after typing any terms in the omnibox
  11. Load https://search.brave.com/search?q=test&action=makeDefault
  12. checked Set Brave Search as a default is not visible
  13. terminated Brave and launched Brave w/o command line switch
  14. set any search engine except brave search as a default search provider
  15. loaded https://search.brave.com/search?q=test&action=makeDefault
  16. confirmed Set Brave Search as default is not visible
step 3 step 4 steps 5-6 step 7 step 10 step 11-12 step 14 step 15-16
Screen Shot 2022-08-08 at 2 18 34 PM Screen Shot 2022-08-08 at 2 18 47 PM Screen Shot 2022-08-08 at 2 19 02 PM Screen Shot 2022-08-08 at 2 19 21 PM Screen Shot 2022-08-08 at 2 23 40 PM Screen Shot 2022-08-08 at 2 19 14 PM Screen Shot 2022-08-08 at 2 38 10 PM Screen Shot 2022-08-08 at 2 24 59 PM
MadhaviSeelam commented 2 years ago

Verification PASSED using

Brave | 1.43.63 Chromium: 104.0.5112.81 (Official Build) beta (64-bit)
-- | --
Revision | 5b7b76419d50f583022568b6764b630f6ddc9208-refs/branch-heads/5112@{#1309}
OS | Windows 11 Version 21H2 (Build 22000.795)
  1. installed 1.43.63
  2. launched browser with --enable-features=BraveSearchOmniboxBanner command line switch (with clean profile)
  3. open brave://settings/search and set Qwant as the default search engine
  4. typed a keyword (nf) and button type autocomplete is visible as a last item
  5. clicked Try Brave Search button in the promotion banner from omnibox popup
  6. confirmed Set Brave Search as a default is visible in the search result page
  7. clicked the button and confirmed Brave search is set as a default in brave://settings/search
  8. Repeat step 2 to 6 above 4 more times
  9. Repeat step 2
  10. Click Dismiss button from omnibox banner after typing any terms in the omnibox
  11. Load https://search.brave.com/search?q=nf&action=makeDefault
  12. checked Set Brave Search as a default is not visible
  13. terminated Brave and launched Brave w/o command line switch
  14. set any search engine except brave search as a default search provider
  15. loaded https://search.brave.com/search?q=test&ef=makeDefault
  16. confirmed Set Brave Search as default is not visible
  17. click (x) button and reload the page
Step 3 Step 4 Step5-6 Step 7 Step10 Step 12 Step 14 Step 15-17
step 3 step 3 step 3 step 3 step 3 step 3 step 3 step 3

Verification passed on

Brave 1.43.81 Chromium: 104.0.5112.102 (Official Build) (64-bit)
Revision 8e5396254975ef939f2ef7d0bd334e48a052b536-refs/branch-heads/5112@{#1478}
OS Ubuntu 18.04 LTS
![image](https://user-images.githubusercontent.com/34715963/186919799-94af1bf4-2410-4243-8e37-4d62ced14f94.png) ![image](https://user-images.githubusercontent.com/34715963/186919913-480e62e5-2578-42a7-9b0f-60f0e7288abc.png) ![image](https://user-images.githubusercontent.com/34715963/186920196-a2031b77-7a5c-4aa6-b5bb-93d3aed20c45.png) ![image](https://user-images.githubusercontent.com/34715963/186920351-e958eda0-e238-43fc-9665-3593b171e821.png) ![image](https://user-images.githubusercontent.com/34715963/186920920-9cca3654-bc3f-459d-85d2-657d77dd87ee.png)
kjozwiak commented 2 years ago

Verification PASSED on Samsung S10+ running Android 12 using the following build(s):

Brave | 1.43.87 Chromium: 105.0.5195.68 (Official Build) (32-bit)
--- | ---
Revision | ad13e82529051bac6a0e65f455e6d7a1e5fd7938-refs/branch-heads/5195@{#903}
OS | Android 12; Build/SP1A.210812.016
Example Example Example Example Example Example Example Example Example Example
Screenshot_20220831-214823_Brave Screenshot_20220831-214938_Brave Screenshot_20220831-214832_Brave Screenshot_20220831-215248_Brave Screenshot_20220831-215306_Brave Screenshot_20220831-215342_Brave Screenshot_20220831-215348_Brave Screenshot_20220831-215358_Brave Screenshot_20220831-215902_Brave Screenshot_20220831-215950_Brave

Verification PASSED on Samsung S8 Ultra Tablet running Android 12 using the following build(s):

Brave | 1.43.86 Chromium: 105.0.5195.68 (Official Build) (32-bit)
--- | ---
Revision | ad13e82529051bac6a0e65f455e6d7a1e5fd7938-refs/branch-heads/5195@{#903}
OS | Android 12; Build/SPSA.220305.013
Example Example Example Example Example Example Example Example
Screenshot_20220831_220932_Brave Screenshot_20220831_221114_Brave Screenshot_20220831_221120_Brave Screenshot_20220831_221154_Brave Screenshot_20220831_221301_Brave Screenshot_20220831_235618_Brave Screenshot_20220831_235851_Brave Screenshot_20220831_235907_Brave