Skip to content

Commit 29f2955

Browse files
Fix dig_url_loader_factory for Chromium 149 API drift (dig:// content loader)
The chia:// content loader failed to compile on 149 — two API changes: - base::Environment::GetVar changed bool GetVar(name, std::string* out) → std::optional<std::string> GetVar(name). The 3 DigNodeConfigDir() sites (DIG_NODE_CONFIG_DIR / LOCALAPPDATA / HOME) now take the optional return. - network::SimpleURLLoader::DownloadToString's body callback param changed std::unique_ptr<std::string> → std::optional<std::string>. The 2 callbacks (OnHealthProbed / OnLocalNodeResponse) now take the optional (bodies already used *body / body->empty(), which work on optional). Verified: dig_url_loader_factory.obj compiles clean against 149. Captured into windows-dig-browser-ux.patch (LF, no domain-sub artifacts, hunks intact).
1 parent c1c7a25 commit 29f2955

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

patches/ungoogled-chromium/windows/windows-dig-browser-ux.patch

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,24 +1386,24 @@
13861386
+// Windows / $HOME/DigNode elsewhere — the same location dig-node resolves.
13871387
+base::FilePath DigNodeConfigDir() {
13881388
+ std::unique_ptr<base::Environment> env = base::Environment::Create();
1389-
+ std::string override_dir;
1390-
+ if (env->GetVar("DIG_NODE_CONFIG_DIR", &override_dir) && !override_dir.empty()) {
1391-
+ return base::FilePath::FromUTF8Unsafe(override_dir);
1389+
+ std::optional<std::string> override_dir = env->GetVar("DIG_NODE_CONFIG_DIR");
1390+
+ if (override_dir && !override_dir->empty()) {
1391+
+ return base::FilePath::FromUTF8Unsafe(*override_dir);
13921392
+ }
13931393
+#if BUILDFLAG(IS_WIN)
1394-
+ std::string local_app_data;
1395-
+ if (env->GetVar("LOCALAPPDATA", &local_app_data) && !local_app_data.empty()) {
1396-
+ return base::FilePath::FromUTF8Unsafe(local_app_data).AppendASCII("DigNode");
1394+
+ std::optional<std::string> local_app_data = env->GetVar("LOCALAPPDATA");
1395+
+ if (local_app_data && !local_app_data->empty()) {
1396+
+ return base::FilePath::FromUTF8Unsafe(*local_app_data).AppendASCII("DigNode");
13971397
+ }
13981398
+ base::FilePath dir;
13991399
+ if (base::PathService::Get(base::DIR_LOCAL_APP_DATA, &dir)) {
14001400
+ return dir.AppendASCII("DigNode");
14011401
+ }
14021402
+ return base::FilePath();
14031403
+#else
1404-
+ std::string home;
1405-
+ if (env->GetVar("HOME", &home) && !home.empty()) {
1406-
+ return base::FilePath::FromUTF8Unsafe(home).AppendASCII("DigNode");
1404+
+ std::optional<std::string> home = env->GetVar("HOME");
1405+
+ if (home && !home->empty()) {
1406+
+ return base::FilePath::FromUTF8Unsafe(*home).AppendASCII("DigNode");
14071407
+ }
14081408
+ return base::FilePath();
14091409
+#endif
@@ -1703,7 +1703,7 @@
17031703
+ size_t index,
17041704
+ std::string request_json,
17051705
+ NodeResponseCallback on_response,
1706-
+ std::unique_ptr<std::string> body) {
1706+
+ std::optional<std::string> body) {
17071707
+ bool reachable = body && IsHealthyDigNode(*body);
17081708
+ PutProbeVerdict(base_url, reachable);
17091709
+ if (reachable) {
@@ -1748,7 +1748,7 @@
17481748
+ size_t index,
17491749
+ std::string request_json,
17501750
+ NodeResponseCallback on_response,
1751-
+ std::unique_ptr<std::string> body) {
1751+
+ std::optional<std::string> body) {
17521752
+ if (body && !body->empty()) {
17531753
+ std::move(on_response).Run(std::move(*body));
17541754
+ return;

0 commit comments

Comments
 (0)