-
Notifications
You must be signed in to change notification settings - Fork 816
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
Disable translate url fetcher request #3293
Conversation
@@ -0,0 +1,6 @@ | |||
source_set("browser") { | |||
public_deps = [ | |||
# TODO(jocelyn): move buildflags to brave/components/translate/core/browser |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR will need to be uplifted to dev and beta, so I would like to separate this work into a follow up PR which only goes into master.
] | ||
deps += [ "//components/infobars/core" ] | ||
} | ||
+ deps += ["//brave/components/translate/core/browser"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this because we'll need to use our translate buildflags in the chromium_src override.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we need multiple patches anyway, why are we using chromium_src overrides?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pilgrim-brave If we subclass TranslateURLFetcher, we'll need 1) this one line deps patch. 2) two line patch in translate_url_fetcher.h
for adding virtual keyword to its destructor and Request method. 3) one line patch to s/TranslateURLFetcher/BraveTranslateURLFetcher
in translate_language_list.cc
. 4) chromium_src override to s/TranslateURLFetcher/BraveTranslateURLFetcher
in translate_script.cc
.
Current PR has two lines less patching comparing to subclass it so I went for direct patching Request at first. I can change to subclass if that's more preferable in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I don't foresee we'll need to override more methods on TranslateURLFetcher in the near future given how this class is right now. It's more likely that we might just decommission go-translate in the future at least for the desktops and then at that point we can go back to just one line patch in the Request method without this deps patch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK I'll defer to @bridiver who might have ideas on further reducing the patches. Otherwise LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can just replace the class .h/.cc a minimal no-op dummy class in chromium_src and avoid the second patch. We'll still need this for the buildflag dep, but at least this is an extensible patch that allows us to add more deps to this component if we need them later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also @pilgrim-brave just for reference, if we don't make the change I suggested we would still use a chromium_src override for the second patch because it decreases the size of the patch and also allows us to change the code in the patch without changing the patch itself. Using a define
for patches is now the preferred approach for that reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bool TranslateURLFetcher::Request(const GURL& url, | ||
TranslateURLFetcher::Callback callback, | ||
bool is_incognito) { | ||
+ BRAVE_REQUEST |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Subclass this seems to require more patching to me, at least one line in translate_url_fetcher.h and one line in translate_language_list.cc, and the deps patch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed in 9244c81
… list when go-translate is not used. This was original committed at 8eec750.
f49ba19
to
b4c00ae
Compare
Encountered known intermittent error below at windows-x64, which is not related to this PR.
|
Fix brave/brave-browser#5829
Submitter Checklist:
npm run lint
)git rebase master
(if needed).git rebase -i
to squash commits (if needed).Test Plan:
auto test: npm test brave_unit_tests -- --filter=TranslateLanguageListTest.*
manual test plan is specified in brave/brave-browser#5829, browser connections could be observed using little snitch or similar tools.
Reviewer Checklist:
After-merge Checklist:
changes has landed on.