Simplify override for chrome/install_static/install_modes.cc
Put our Brave-specific code in the overrides for GetClientsKeyPath, GetClientStateKeyPath and GetClientStateMediumKeyPath instead of doing more complex overrides, since otherwise we would end up changing four one-liner methods and ignoring the rest anyway.
This commit is contained in:
@@ -5,67 +5,44 @@
|
||||
|
||||
#include "chrome/install_static/install_modes.h"
|
||||
|
||||
#include "chrome/install_static/buildflags.h"
|
||||
|
||||
namespace install_static {
|
||||
|
||||
namespace {
|
||||
|
||||
#if defined(OFFICIAL_BUILD)
|
||||
std::wstring GetClientsKeyPathForApp(const wchar_t* app_guid) {
|
||||
return std::wstring(L"Software\\BraveSoftware\\Update\\Clients\\")
|
||||
.append(app_guid);
|
||||
}
|
||||
|
||||
std::wstring GetClientStateKeyPathForApp(const wchar_t* app_guid) {
|
||||
return std::wstring(L"Software\\BraveSoftware\\Update\\ClientState\\")
|
||||
.append(app_guid);
|
||||
}
|
||||
|
||||
std::wstring GetClientStateMediumKeyPathForApp(const wchar_t* app_guid) {
|
||||
return std::wstring(L"Software\\BraveSoftware\\Update\\ClientStateMedium\\")
|
||||
.append(app_guid);
|
||||
#if !defined(OFFICIAL_BUILD)
|
||||
std::wstring GetUnregisteredKeyPathForProduct() {
|
||||
return std::wstring(L"Software\\").append(kProductPathName);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace
|
||||
|
||||
#define GetClientsKeyPathForApp GetClientsKeyPathForApp_Unused
|
||||
#define GetClientStateKeyPathForApp GetClientStateKeyPathForApp_Unused
|
||||
#define GetClientStateMediumKeyPathForApp \
|
||||
GetClientStateMediumKeyPathForApp_Unused
|
||||
#define GetClientsKeyPath GetClientsKeyPath_ChromiumImpl
|
||||
#define GetClientStateKeyPath GetClientStateKeyPath_ChromiumImpl
|
||||
#define GetClientStateMediumKeyPath GetClientStateMediumKeyPath_ChromiumImpl
|
||||
|
||||
#include "../../../../chrome/install_static/install_modes.cc"
|
||||
|
||||
#undef GetClientsKeyPath
|
||||
#undef GetClientStateKeyPath
|
||||
#undef GetClientStateMediumKeyPath
|
||||
#undef GetClientsKeyPathForApp
|
||||
#undef GetClientStateKeyPathForApp
|
||||
#undef GetClientStateMediumKeyPathForApp
|
||||
|
||||
namespace install_static {
|
||||
|
||||
std::wstring GetClientsKeyPath(const wchar_t* app_guid) {
|
||||
#if defined(OFFICIAL_BUILD)
|
||||
return GetClientsKeyPathForApp(app_guid);
|
||||
return std::wstring(L"Software\\BraveSoftware\\Update\\Clients\\")
|
||||
.append(app_guid);
|
||||
#else
|
||||
return GetClientsKeyPath_ChromiumImpl(app_guid);
|
||||
return GetUnregisteredKeyPathForProduct();
|
||||
#endif
|
||||
}
|
||||
|
||||
std::wstring GetClientStateKeyPath(const wchar_t* app_guid) {
|
||||
#if defined(OFFICIAL_BUILD)
|
||||
return GetClientStateKeyPathForApp(app_guid);
|
||||
return std::wstring(L"Software\\BraveSoftware\\Update\\ClientState\\")
|
||||
.append(app_guid);
|
||||
#else
|
||||
return GetClientStateKeyPath_ChromiumImpl(app_guid);
|
||||
return GetUnregisteredKeyPathForProduct();
|
||||
#endif
|
||||
}
|
||||
|
||||
std::wstring GetClientStateMediumKeyPath(const wchar_t* app_guid) {
|
||||
#if defined(OFFICIAL_BUILD)
|
||||
return GetClientStateMediumKeyPathForApp(app_guid);
|
||||
return std::wstring(L"Software\\BraveSoftware\\Update\\ClientStateMedium\\")
|
||||
.append(app_guid);
|
||||
#else
|
||||
return GetClientStateMediumKeyPath_ChromiumImpl(app_guid);
|
||||
return GetUnregisteredKeyPathForProduct();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
/* Copyright 2021 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 http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef BRAVE_CHROMIUM_SRC_CHROME_INSTALL_STATIC_INSTALL_MODES_H_
|
||||
#define BRAVE_CHROMIUM_SRC_CHROME_INSTALL_STATIC_INSTALL_MODES_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#define GetClientsKeyPath \
|
||||
GetClientsKeyPath_ChromiumImpl(const wchar_t* app_guid); \
|
||||
std::wstring GetClientsKeyPath
|
||||
|
||||
#define GetClientStateKeyPath \
|
||||
GetClientStateKeyPath_ChromiumImpl(const wchar_t* app_guid); \
|
||||
std::wstring GetClientStateKeyPath
|
||||
|
||||
#define GetClientStateMediumKeyPath \
|
||||
GetClientStateMediumKeyPath_ChromiumImpl(const wchar_t* app_guid); \
|
||||
std::wstring GetClientStateMediumKeyPath
|
||||
|
||||
#include "../../../../chrome/install_static/install_modes.h"
|
||||
|
||||
#undef GetClientsKeyPath
|
||||
#undef GetClientStateKeyPath
|
||||
#undef GetClientStateMediumKeyPath
|
||||
|
||||
#endif // BRAVE_CHROMIUM_SRC_CHROME_INSTALL_STATIC_INSTALL_MODES_H_
|
||||
Reference in New Issue
Block a user