Add theme support
This commit is contained in:
@@ -11,10 +11,10 @@
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "brave/browser/themes/brave_dark_mode_utils.h"
|
||||
#include "brave/components/ipfs/ipfs_constants.h"
|
||||
#include "brave/components/ipfs/ipfs_service.h"
|
||||
#include "brave/components/ipfs/pref_names.h"
|
||||
#include "chrome/browser/shell_integration.h"
|
||||
#include "components/grit/brave_components_resources.h"
|
||||
#include "components/grit/brave_components_strings.h"
|
||||
#include "components/prefs/pref_service.h"
|
||||
@@ -148,6 +148,10 @@ void IPFSOnboardingPage::PopulateInterstitialStrings(
|
||||
"footerText", l10n_util::GetStringUTF16(IDS_IPFS_ONBOARDING_FOOTER_TEXT));
|
||||
load_time_data->SetString(
|
||||
"settings", l10n_util::GetStringUTF16(IDS_IPFS_ONBOARDING_SETTINGS));
|
||||
const std::string theme_type =
|
||||
dark_mode::GetStringFromBraveDarkModeType(
|
||||
dark_mode::GetActiveBraveDarkModeType());
|
||||
load_time_data->SetString("braveTheme", base::ToLowerASCII(theme_type));
|
||||
}
|
||||
|
||||
int IPFSOnboardingPage::GetHTMLTemplateId() {
|
||||
|
||||
@@ -4,13 +4,12 @@
|
||||
<meta name="theme-color" content="#fff">
|
||||
<title>$i18n{tabTitle}</title>
|
||||
<link rel="stylesheet" href="ipfs_onboarding.css">
|
||||
<link rel="stylesheet" href="chrome://brave-resources/fonts/poppins.css">
|
||||
<script src="../../../../../ui/webui/resources/js/assert.js"></script>
|
||||
<script src="../../../../../ui/webui/resources/js/util.js"></script>
|
||||
<script src="../../../../../components/security_interstitials/core/common/resources/interstitial_common.js"></script>
|
||||
<script src="ipfs_onboarding.js"></script>
|
||||
</head>
|
||||
<body id="body">
|
||||
<body id="body" class="$i18nRaw{braveTheme}" >
|
||||
<div class="interstitial-wrapper">
|
||||
<div id="main-content">
|
||||
<div class="header-logo">
|
||||
@@ -22,10 +21,9 @@
|
||||
</span>
|
||||
<p class="copy">
|
||||
$i18nRaw{primaryParagraph}
|
||||
<a
|
||||
<a id="learn-more"
|
||||
class="info-link"
|
||||
target="_blank"
|
||||
href="https://support.brave.com/hc/en-us/sections/360010974932-InterPlanetary-File-System-IPFS-">
|
||||
href>
|
||||
$i18nRaw{learnMore}
|
||||
</a>
|
||||
</p>
|
||||
@@ -56,10 +54,9 @@
|
||||
<div class="footer">
|
||||
<p class="copy">
|
||||
$i18nRaw{footerText}
|
||||
<a
|
||||
<a id="open-settings"
|
||||
class="info-link"
|
||||
target="_blank"
|
||||
href="https://support.brave.com/hc/en-us/sections/360010974932-InterPlanetary-File-System-IPFS-">
|
||||
href>
|
||||
$i18nRaw{settings}.
|
||||
</a>
|
||||
</p>
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
/** @enum {number} */
|
||||
const IPFSOnboardingCommandId = {
|
||||
USE_LOCAL_NODE: 0,
|
||||
USE_PUBLIC_GATEWAY: 1
|
||||
USE_PUBLIC_GATEWAY: 1,
|
||||
LEARN_MORE: 2,
|
||||
OPEN_SETTINGS: 3
|
||||
};
|
||||
|
||||
// Should match ipfs::IPFSOnboardingPage::IPFSOnboardingResponse
|
||||
@@ -26,12 +28,21 @@ function setupEvents() {
|
||||
sendCommand(IPFSOnboardingCommandId.USE_PUBLIC_GATEWAY);
|
||||
});
|
||||
|
||||
$('learn-more').addEventListener('click', function() {
|
||||
sendCommand(IPFSOnboardingCommandId.LEARN_MORE);
|
||||
});
|
||||
|
||||
$('open-settings').addEventListener('click', function() {
|
||||
sendCommand(IPFSOnboardingCommandId.OPEN_SETTINGS);
|
||||
});
|
||||
|
||||
// ToDo: Either grant the interstitial page access to chrome.braveTheme
|
||||
// or find another way to grab it.
|
||||
/*
|
||||
const setTheme = (theme) => {
|
||||
document.body.className = `${theme.toLowerCase()}`;
|
||||
}
|
||||
|
||||
chrome.braveTheme.getBraveThemeType((type) => setTheme(type));
|
||||
chrome.braveTheme.onBraveThemeTypeChanged.addListener((type) => setTheme(type));
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user