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

Use temporal AutocompleteClassifier to get proper selection navigation url #5407

Merged
merged 5 commits into from
May 28, 2020

Conversation

simonhong
Copy link
Member

@simonhong simonhong commented Apr 28, 2020

To get proper selection navigation url for profile, use tempral
AutocompleteClassfier. We can't use AutocompleteClassifierFactory
for this because AutocompleteClassifierFactory doesn't create service
for otr profile. But we need different navigation url for OTR profile.

This is code refactoring that fixes brave/brave-browser#1758

Resolves brave/brave-browser#9239

Submitter Checklist:

Test Plan:

After this change, brave/brave-browser#1758 should be handled properly.

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions
  • Verify test plan is specified in PR before merging to source

After-merge Checklist:

  • The associated issue milestone is set to the smallest version that the
    changes has landed on.
  • All relevant documentation has been updated.

@simonhong simonhong added this to the 1.10.x - Nightly milestone Apr 28, 2020
@simonhong simonhong self-assigned this Apr 28, 2020
@simonhong simonhong changed the title Use temporal AutocompleteClassifier to get proper navigation url Use temporal AutocompleteClassifier to get proper selection navigation url Apr 28, 2020
@simonhong simonhong marked this pull request as draft April 29, 2020 00:44
@simonhong
Copy link
Member Author

Changed to draft state because SearchEngineProviderServiceTest.GuestWindowControllerTest is failed.

@simonhong simonhong marked this pull request as ready for review April 29, 2020 04:51
Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look great! Much better patch than before. Great work here 😄 👍

Copy link
Member

@darkdh darkdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

@simonhong
Copy link
Member Author

kindly ping to owners @bridiver :)

@simonhong simonhong force-pushed the simon_issue_9293 branch 2 times, most recently from 42d6846 to e05546e Compare May 6, 2020 05:22

#define BRAVE_APPEND_SEARCH_PROVIDER \
if (GetProfile()->IsOffTheRecord()) { \
selection_navigation_url_ = \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused here, the selection_navigation_url_ is set from AutocompleteClassifierFactory::GetForProfile(GetProfile())->Classify( so why aren't we just setting the correct url from the AutocompleteClassifier?

Copy link
Member Author

@simonhong simonhong May 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AutocompleteClassifierFactory always uses normal profile.
So we did https://github.com/brave/brave-core/pull/5407/files#diff-ffcd3bd1d7f1c7ee80c4637a3f919142L10. This PR reverts it and instead set correct url by patching here.
As you found previously, that service used normal & incognito profile mixed for incognito profile.
https://github.com/brave/brave-core/pull/5407/files#diff-2325211a427ac6f007ad338411e100aaL14

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bridiver PTAL again.

@simonhong simonhong requested a review from bridiver May 12, 2020 00:29
@NejcZdovc NejcZdovc removed this from the 1.10.x - Beta milestone May 15, 2020
@simonhong simonhong added this to the 1.11.x - Nightly milestone May 15, 2020
@simonhong
Copy link
Member Author

@bridiver Kindly ping.

To get proper selection navigation url for profile, use tempral
AutocompleteClassfier. We can't use AutocompleteClassifierFactory
for this because AutocompleteClassifierFactory doesn't create service
for otr profile. But we need different navigation url for OTR profile.
GuestWindowControllerTest was failed because OTR's TemplateURLService
is not in loaded state while test case is running. If it's not in
loaded state, it doesn't call observer.
So, explicitly call OnTemplateURLServiceChanged().
@@ -1,44 +0,0 @@
/* Copyright 2019 The Brave Authors. All rights reserved.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we deleting the test? We still need some kind of test for this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test was for BraveAutocompleteProviderClientForClassifier and it's not used anymore.
Instead, we use AutocompleteClassifier directly.

@simonhong simonhong merged commit 07ab4af into master May 28, 2020
@simonhong simonhong deleted the simon_issue_9293 branch May 28, 2020 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants