From e93c1afb7d0b304810fedfdbb67026a247d03a10 Mon Sep 17 00:00:00 2001 From: Shivan Kaul Sahib Date: Sun, 18 Feb 2024 00:21:24 -0800 Subject: [PATCH 1/4] Use Google Chrome as ProductName for Dial Service --- .../router/discovery/dial/dial_service_impl.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 chromium_src/chrome/browser/media/router/discovery/dial/dial_service_impl.cc diff --git a/chromium_src/chrome/browser/media/router/discovery/dial/dial_service_impl.cc b/chromium_src/chrome/browser/media/router/discovery/dial/dial_service_impl.cc new file mode 100644 index 000000000000..73a5abd62bc2 --- /dev/null +++ b/chromium_src/chrome/browser/media/router/discovery/dial/dial_service_impl.cc @@ -0,0 +1,18 @@ +/* Copyright (c) 2024 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#include "chrome/browser/media/router/discovery/dial/dial_service_impl.h" + +#include "components/version_info/version_info.h" + +namespace version_info { +constexpr base::StringPiece GetProductNameForChrome() { + return "Google Chrome"; +} +} // namespace version_info + +#define GetProductName GetProductNameForChrome +#include "src/chrome/browser/media/router/discovery/dial/dial_service_impl.cc" +#undef GetProductName From 27ef3633c5aa9c1131673e728224ab57eeb85881 Mon Sep 17 00:00:00 2001 From: Shivan Kaul Sahib Date: Sun, 18 Feb 2024 09:50:38 -0800 Subject: [PATCH 2/4] StringPiece => string_view --- .../browser/media/router/discovery/dial/dial_service_impl.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chromium_src/chrome/browser/media/router/discovery/dial/dial_service_impl.cc b/chromium_src/chrome/browser/media/router/discovery/dial/dial_service_impl.cc index 73a5abd62bc2..b698b6426cc8 100644 --- a/chromium_src/chrome/browser/media/router/discovery/dial/dial_service_impl.cc +++ b/chromium_src/chrome/browser/media/router/discovery/dial/dial_service_impl.cc @@ -8,7 +8,7 @@ #include "components/version_info/version_info.h" namespace version_info { -constexpr base::StringPiece GetProductNameForChrome() { +constexpr std::string_view GetProductNameForChrome() { return "Google Chrome"; } } // namespace version_info From 24590358216e92fe0c19f6cfb8705d240f5ca03e Mon Sep 17 00:00:00 2001 From: Shivan Kaul Sahib Date: Tue, 20 Feb 2024 16:41:01 -0800 Subject: [PATCH 3/4] Match Chrome for Version Number as well --- .../browser/media/router/discovery/dial/dial_service_impl.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/chromium_src/chrome/browser/media/router/discovery/dial/dial_service_impl.cc b/chromium_src/chrome/browser/media/router/discovery/dial/dial_service_impl.cc index b698b6426cc8..df76ca61952a 100644 --- a/chromium_src/chrome/browser/media/router/discovery/dial/dial_service_impl.cc +++ b/chromium_src/chrome/browser/media/router/discovery/dial/dial_service_impl.cc @@ -6,6 +6,7 @@ #include "chrome/browser/media/router/discovery/dial/dial_service_impl.h" #include "components/version_info/version_info.h" +#include "brave/components/version_info/version_info.h" namespace version_info { constexpr std::string_view GetProductNameForChrome() { @@ -13,6 +14,9 @@ constexpr std::string_view GetProductNameForChrome() { } } // namespace version_info +// We want to match Chrome behaviour for M-SEARCH USER-AGENT string. #define GetProductName GetProductNameForChrome +#define GetVersionNumber GetBraveChromiumVersionNumber #include "src/chrome/browser/media/router/discovery/dial/dial_service_impl.cc" #undef GetProductName +#undef GetVersionNumber From 596fa5de6ae7619aa52026aba60ace13de96c211 Mon Sep 17 00:00:00 2001 From: Shivan Kaul Sahib Date: Tue, 20 Feb 2024 18:14:38 -0800 Subject: [PATCH 4/4] Formatting fixes --- .../browser/media/router/discovery/dial/dial_service_impl.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chromium_src/chrome/browser/media/router/discovery/dial/dial_service_impl.cc b/chromium_src/chrome/browser/media/router/discovery/dial/dial_service_impl.cc index df76ca61952a..31155194ae0b 100644 --- a/chromium_src/chrome/browser/media/router/discovery/dial/dial_service_impl.cc +++ b/chromium_src/chrome/browser/media/router/discovery/dial/dial_service_impl.cc @@ -5,8 +5,8 @@ #include "chrome/browser/media/router/discovery/dial/dial_service_impl.h" -#include "components/version_info/version_info.h" #include "brave/components/version_info/version_info.h" +#include "components/version_info/version_info.h" namespace version_info { constexpr std::string_view GetProductNameForChrome() {