Complete refactor of Browser Integration classes

* Removed option to attach KeePassXC to the browser extension. Users must use the proxy application to communicate with KeePassXC.
* Significantly streamlined proxy code. Used same implementation of stdin/stdout interface across all platforms.
* Moved browser service entry point to BrowserService class instead of NativeMessagingHost. BrowserService now coordinates the communication to/from clients.
* Moved settings page definition out of MainWindow
* Decoupled BrowserService from DatabaseTabWidget
* Reduced complexity of various functions and cleaned the ABI (public vs private).
* Eliminated BrowserClients class, moved functionality into the BrowserService
* Renamed HostInstaller to NativeMessageInstaller and renamed NativeMessageHost to BrowserHost.
* Recognize XDG_CONFIG_HOME when installing native message file on Linux. Fix #4121 and fix #4123.
This commit is contained in:
Jonathan White 2020-05-10 21:20:00 -04:00
parent 3b4057a78c
commit a145bf9119
43 changed files with 1221 additions and 1919 deletions

View file

@ -162,16 +162,6 @@ void BrowserSettings::setNoMigrationPrompt(bool prompt)
config()->set(Config::Browser_NoMigrationPrompt, prompt);
}
bool BrowserSettings::supportBrowserProxy()
{
return config()->get(Config::Browser_SupportBrowserProxy).toBool();
}
void BrowserSettings::setSupportBrowserProxy(bool enabled)
{
config()->set(Config::Browser_SupportBrowserProxy, enabled);
}
bool BrowserSettings::useCustomProxy()
{
return config()->get(Config::Browser_UseCustomProxy).toBool();
@ -184,9 +174,6 @@ void BrowserSettings::setUseCustomProxy(bool enabled)
QString BrowserSettings::customProxyLocation()
{
if (!useCustomProxy()) {
return QString();
}
return config()->get(Config::Browser_CustomProxyLocation).toString();
}
@ -195,6 +182,11 @@ void BrowserSettings::setCustomProxyLocation(const QString& location)
config()->set(Config::Browser_CustomProxyLocation, location);
}
QString BrowserSettings::proxyLocation()
{
return m_nativeMessageInstaller.getProxyPath();
}
bool BrowserSettings::updateBinaryPath()
{
return config()->get(Config::Browser_UpdateBinaryPath).toBool();
@ -215,81 +207,14 @@ void BrowserSettings::setAllowExpiredCredentials(bool enabled)
config()->set(Config::Browser_AllowExpiredCredentials, enabled);
}
bool BrowserSettings::chromeSupport()
bool BrowserSettings::browserSupport(BrowserShared::SupportedBrowsers browser)
{
return m_hostInstaller.checkIfInstalled(HostInstaller::SupportedBrowsers::CHROME);
return m_nativeMessageInstaller.isBrowserEnabled(browser);
}
void BrowserSettings::setChromeSupport(bool enabled)
void BrowserSettings::setBrowserSupport(BrowserShared::SupportedBrowsers browser, bool enabled)
{
m_hostInstaller.installBrowser(
HostInstaller::SupportedBrowsers::CHROME, enabled, supportBrowserProxy(), customProxyLocation());
}
bool BrowserSettings::chromiumSupport()
{
return m_hostInstaller.checkIfInstalled(HostInstaller::SupportedBrowsers::CHROMIUM);
}
void BrowserSettings::setChromiumSupport(bool enabled)
{
m_hostInstaller.installBrowser(
HostInstaller::SupportedBrowsers::CHROMIUM, enabled, supportBrowserProxy(), customProxyLocation());
}
bool BrowserSettings::firefoxSupport()
{
return m_hostInstaller.checkIfInstalled(HostInstaller::SupportedBrowsers::FIREFOX);
}
void BrowserSettings::setFirefoxSupport(bool enabled)
{
m_hostInstaller.installBrowser(
HostInstaller::SupportedBrowsers::FIREFOX, enabled, supportBrowserProxy(), customProxyLocation());
}
bool BrowserSettings::vivaldiSupport()
{
return m_hostInstaller.checkIfInstalled(HostInstaller::SupportedBrowsers::VIVALDI);
}
void BrowserSettings::setVivaldiSupport(bool enabled)
{
m_hostInstaller.installBrowser(
HostInstaller::SupportedBrowsers::VIVALDI, enabled, supportBrowserProxy(), customProxyLocation());
}
bool BrowserSettings::braveSupport()
{
return m_hostInstaller.checkIfInstalled(HostInstaller::SupportedBrowsers::BRAVE);
}
void BrowserSettings::setBraveSupport(bool enabled)
{
m_hostInstaller.installBrowser(
HostInstaller::SupportedBrowsers::BRAVE, enabled, supportBrowserProxy(), customProxyLocation());
}
bool BrowserSettings::torBrowserSupport()
{
return m_hostInstaller.checkIfInstalled(HostInstaller::SupportedBrowsers::TOR_BROWSER);
}
void BrowserSettings::setTorBrowserSupport(bool enabled)
{
m_hostInstaller.installBrowser(
HostInstaller::SupportedBrowsers::TOR_BROWSER, enabled, supportBrowserProxy(), customProxyLocation());
}
bool BrowserSettings::edgeSupport()
{
return m_hostInstaller.checkIfInstalled(HostInstaller::SupportedBrowsers::EDGE);
}
void BrowserSettings::setEdgeSupport(bool enabled)
{
m_hostInstaller.installBrowser(
HostInstaller::SupportedBrowsers::EDGE, enabled, supportBrowserProxy(), customProxyLocation());
m_nativeMessageInstaller.setBrowserEnabled(browser, enabled);
}
bool BrowserSettings::passwordUseNumbers()
@ -563,13 +488,7 @@ QJsonObject BrowserSettings::generatePassword()
return password;
}
void BrowserSettings::updateBinaryPaths(const QString& customProxyLocation)
void BrowserSettings::updateBinaryPaths()
{
bool isProxy = supportBrowserProxy();
m_hostInstaller.updateBinaryPaths(isProxy, customProxyLocation);
}
bool BrowserSettings::checkIfProxyExists(QString& path)
{
return m_hostInstaller.checkIfProxyExists(supportBrowserProxy(), customProxyLocation(), path);
m_nativeMessageInstaller.updateBinaryPaths();
}