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

Deprecate in favor of navigator.brave.isBrave() #5831

Closed
wants to merge 1 commit into from

Conversation

kkuehlz
Copy link
Contributor

@kkuehlz kkuehlz commented Jun 12, 2020

Resolves brave/brave-browser#6041

Resolves

Submitter Checklist:

Test Plan:

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.

@kkuehlz kkuehlz requested review from bsclifton and bridiver June 12, 2020 19:48
@kkuehlz kkuehlz force-pushed the nuke_partner_headers branch 3 times, most recently from 404295c to 9eb7851 Compare June 12, 2020 19:56
navigator.brave.isBrave() can be used to identify brave.

Resolves brave/brave-browser#6041
@kkuehlz kkuehlz force-pushed the nuke_partner_headers branch from 9eb7851 to 8aa730b Compare June 13, 2020 00:53
@bershanskiy
Copy link
Contributor

I think there is a tiny left-over: the headers download URL fragment kBraveReferralsHeadersPath is probably no longer needed too.

@@ -44,11 +44,6 @@ class BraveReferralsService {
void SetReferralInitializedCallbackForTest(
ReferralInitializedCallback referral_initialized_callback);

static bool GetMatchingReferralHeaders(
Copy link
Contributor

Choose a reason for hiding this comment

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

please also check obsolete headers - e.g. it seems base/values.h and url/gurl.h are now unneeded

@@ -99,7 +83,6 @@ class BraveReferralsService {
std::unique_ptr<network::SimpleURLLoader> referral_init_loader_;
std::unique_ptr<network::SimpleURLLoader> referral_finalization_check_loader_;
std::unique_ptr<base::OneShotTimer> initialization_timer_;
std::unique_ptr<base::RepeatingTimer> fetch_referral_headers_timer_;
Copy link
Contributor

Choose a reason for hiding this comment

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

also remove referral_headers_loader_

continue;
}
for (const auto& domain_value : domains_list->GetList()) {
URLPattern url_pattern(URLPattern::SCHEME_HTTPS |
Copy link
Contributor

Choose a reason for hiding this comment

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

header for this is also not needed, probably there are others

@@ -116,7 +116,6 @@ test("brave_unit_tests") {
"//brave/chromium_src/components/variations/service/field_trial_unittest.cc",
"//brave/chromium_src/components/version_info/brave_version_info_unittest.cc",
"//brave/chromium_src/net/cookies/brave_canonical_cookie_unittest.cc",
"//brave/chromium_src/services/network/public/cpp/cors/cors_unittest.cc",
Copy link
Contributor

Choose a reason for hiding this comment

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

probably now can drop

"//services/network/public/cpp:cpp",
"//services/network:test_support",

from deps

// rewards service. Eliminating this will also help to avoid using
// PrefChangeRegistrar and corresponding |base::Unretained| usages, that are
// illegal.
std::unique_ptr<base::ListValue> referral_headers_list_;
std::map<uint64_t, net::CompletionOnceCallback> callbacks_;
std::unique_ptr<PrefChangeRegistrar, content::BrowserThread::DeleteOnUIThread>
Copy link
Contributor

Choose a reason for hiding this comment

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

drop this

Copy link
Contributor

Choose a reason for hiding this comment

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

also forward declaration for PrefChangeRegistrar

Copy link
Contributor

Choose a reason for hiding this comment

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

and #include "content/public/browser/browser_thread.h"

@@ -47,8 +47,6 @@ class BraveRequestHandler {

private:
void SetupCallbacks();
void InitPrefChangeRegistrar();
void OnReferralHeadersChanged();
void OnPreferenceChanged(const std::string& pref_name);
Copy link
Contributor

Choose a reason for hiding this comment

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

unrelated to this PR, but OnPreferenceChanged and UpdateAdBlockFromPref do not exist in .cc so also can be erased :)

@@ -17,7 +17,6 @@
#include "brave/browser/net/brave_stp_util.h"
#include "brave/browser/translate/buildflags/buildflags.h"
#include "brave/common/pref_names.h"
#include "brave/components/brave_referrals/buildflags/buildflags.h"
#include "brave/components/brave_rewards/browser/buildflags/buildflags.h"
#include "brave/components/brave_webtorrent/browser/buildflags/buildflags.h"
#include "chrome/browser/browser_process.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

not used now, also pref_change_registrar.h pref_service.h, probably pref_names.h

]

deps += [
"//brave/components/brave_referrals/browser",
Copy link
Contributor

Choose a reason for hiding this comment

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

also import("//brave/components/brave_referrals/buildflags/buildflags.gni")

Copy link
Contributor

Choose a reason for hiding this comment

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

also "//brave/components/brave_referrals/buildflags",

@bsclifton
Copy link
Member

We're going to have to leave these in for the moment as some Brave partners haven't updated to use the navigator.brave.isBrave method. Let's keep an eye on https://github.com/brave/brave-browser/wiki/Custom-Headers which should be getting updated as partners make progress

@bershanskiy
Copy link
Contributor

@bsclifton Since no new partners will sign up and the partner list is known, is it possible to at least remove the data fetch logic and cookie insertion logic? That's the part that makes me the most uncomfortable.
I'm asking because it looks like the partner list is rather short and does not use cookies.

@bsclifton
Copy link
Member

@bershanskiy that's a good suggestion - @bbondy what do you think about removing the service call and having the list hard-coded (as we won't be adding to it)?

@bbondy
Copy link
Member

bbondy commented Jun 22, 2020

I would love to see the list fully removed but it will require working with @lukemulks and others on a case by case basis until the list is empty.

@kkuehlz kkuehlz closed this Oct 27, 2021
@kkuehlz kkuehlz removed their assignment Oct 27, 2021
@bsclifton bsclifton deleted the nuke_partner_headers branch November 10, 2023 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove X-Brave-Partner from CORS safelist
5 participants