Skip to content

Commit 6bd6754

Browse files
committed
[ads] Changed variations_service patch to file override
1 parent 09a974f commit 6bd6754

File tree

4 files changed

+41
-21
lines changed

4 files changed

+41
-21
lines changed

chromium_src/components/variations/service/variations_service.cc

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@
33
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
44
// You can obtain one at https://mozilla.org/MPL/2.0/.
55

6-
// At browser startup, the country code is updated using the X-Country header
7-
// from the response if the status is `HTTP_NOT_MODIFIED`, avoiding the need
8-
// to wait for the next update, which happens every 5 hours.
9-
#define BRAVE_VARIATIONS_SERVICE_ON_SIMPLE_LOADER_COMPLETE \
10-
std::string_view country_code = GetHeaderValue(headers.get(), "X-Country"); \
11-
if (is_first_request && !country_code.empty()) { \
12-
local_state_->SetString(prefs::kVariationsCountry, country_code); \
13-
}
6+
#include "brave/chromium_src/components/variations/variations_seed_store.h"
7+
8+
#define UpdateSeedDateAndLogDayChange(...) \
9+
UpdateSeedDateAndLogDayChange(is_first_request, \
10+
GetHeaderValue(headers.get(), "X-Country"), \
11+
__VA_ARGS__)
1412

1513
#include "src/components/variations/service/variations_service.cc"
1614

17-
#undef BRAVE_VARIATIONS_SERVICE_ON_SIMPLE_LOADER_COMPLETE
15+
#undef UpdateSeedDateAndLogDayChange

chromium_src/components/variations/variations_seed_store.cc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@ class PublicKeyWrapper {
2222
#define VerifyInit(signature_algorithm, signature, public_key_info) \
2323
VerifyInit(signature_algorithm, signature, \
2424
PublicKeyWrapper::GetPublicKey(public_key_info))
25+
#define UpdateSeedDateAndLogDayChange(...) \
26+
UpdateSeedDateAndLogDayChange_ChromiumImpl(__VA_ARGS__)
2527

2628
#include "src/components/variations/variations_seed_store.cc"
2729

30+
#undef UpdateSeedDateAndLogDayChange
2831
#undef VerifyInit
2932

3033
namespace variations {
@@ -55,6 +58,19 @@ base::span<const uint8_t> PublicKeyWrapper::GetPublicKey(
5558
return kBravePublicKey;
5659
}
5760

61+
void VariationsSeedStore::UpdateSeedDateAndLogDayChange(
62+
bool is_first_request,
63+
std::string_view country_code,
64+
base::Time server_date_fetched) {
65+
// At browser startup, the country code is updated using the X-Country header
66+
// from the response if the status is `HTTP_NOT_MODIFIED`, avoiding the need
67+
// to wait for the next update, which happens every 5 hours.
68+
if (is_first_request && !country_code.empty()) {
69+
local_state_->SetString(prefs::kVariationsCountry, country_code);
70+
}
71+
UpdateSeedDateAndLogDayChange_ChromiumImpl(server_date_fetched);
72+
}
73+
5874
} // namespace variations
5975

6076
#undef BRAVE_K_PUBLIC_KEY
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/* Copyright (c) 2025 The Brave Authors. All rights reserved.
2+
* This Source Code Form is subject to the terms of the Mozilla Public
3+
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
4+
* You can obtain one at https://mozilla.org/MPL/2.0/. */
5+
6+
#ifndef BRAVE_CHROMIUM_SRC_COMPONENTS_VARIATIONS_VARIATIONS_SEED_STORE_H_
7+
#define BRAVE_CHROMIUM_SRC_COMPONENTS_VARIATIONS_VARIATIONS_SEED_STORE_H_
8+
9+
#define UpdateSeedDateAndLogDayChange(...) \
10+
UpdateSeedDateAndLogDayChange(bool is_first_request, \
11+
std::string_view country_code, __VA_ARGS__); \
12+
void UpdateSeedDateAndLogDayChange_ChromiumImpl(__VA_ARGS__)
13+
14+
#include "src/components/variations/variations_seed_store.h" // IWYU pragma: export
15+
16+
#undef UpdateSeedDateAndLogDayChange
17+
18+
#endif // BRAVE_CHROMIUM_SRC_COMPONENTS_VARIATIONS_VARIATIONS_SEED_STORE_H_

patches/components-variations-service-variations_service.cc.patch

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)