-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
should contain info needed. Persist. Privacy.
- Loading branch information
1 parent
65515d7
commit 786f3d0
Showing
51 changed files
with
1,011 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn | ||
index 78087b873bd28..f33f72a86d7f1 100644 | ||
--- a/chrome/browser/BUILD.gn | ||
+++ b/chrome/browser/BUILD.gn | ||
@@ -39,6 +39,7 @@ import("//sandbox/features.gni") | ||
import("//services/screen_ai/buildflags/features.gni") | ||
import("//testing/libfuzzer/fuzzer_test.gni") | ||
import("//third_party/blink/public/public_features.gni") | ||
+import("//third_party/ipfs_client/args.gni") | ||
import("//third_party/protobuf/proto_library.gni") | ||
import("//third_party/webrtc/webrtc.gni") | ||
import("//third_party/widevine/cdm/widevine.gni") | ||
@@ -2644,6 +2645,14 @@ static_library("browser") { | ||
] | ||
} | ||
|
||
+ if (enable_ipfs) { | ||
+ sources += [ | ||
+ "ipfs_extra_parts.cc", | ||
+ "ipfs_extra_parts.h", | ||
+ ] | ||
+ deps += [ "//components/ipfs" ] | ||
+ } | ||
+ | ||
if (is_chromeos_ash) { | ||
deps += [ "//chrome/browser/screen_ai:screen_ai_dlc_installer" ] | ||
} |
38 changes: 38 additions & 0 deletions
38
chromium_edits/124.0.6329.0/chrome/browser/about_flags.cc.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc | ||
index f5761878e4373..e6cbc9e9719db 100644 | ||
--- a/chrome/browser/about_flags.cc | ||
+++ b/chrome/browser/about_flags.cc | ||
@@ -214,6 +214,7 @@ | ||
#include "third_party/blink/public/common/features_generated.h" | ||
#include "third_party/blink/public/common/forcedark/forcedark_switches.h" | ||
#include "third_party/blink/public/common/switches.h" | ||
+#include "third_party/ipfs_client/ipfs_buildflags.h" | ||
#include "ui/accessibility/accessibility_features.h" | ||
#include "ui/accessibility/accessibility_switches.h" | ||
#include "ui/base/ozone_buildflags.h" | ||
@@ -308,6 +309,10 @@ | ||
#include "extensions/common/switches.h" | ||
#endif // BUILDFLAG(ENABLE_EXTENSIONS) | ||
|
||
+#if BUILDFLAG(ENABLE_IPFS) | ||
+#include "components/ipfs/ipfs_features.h" | ||
+#endif | ||
+ | ||
#if BUILDFLAG(ENABLE_PDF) | ||
#include "pdf/pdf_features.h" | ||
#endif | ||
@@ -9480,6 +9485,14 @@ const FeatureEntry kFeatureEntries[] = { | ||
flag_descriptions::kOmitCorsClientCertDescription, kOsAll, | ||
FEATURE_VALUE_TYPE(network::features::kOmitCorsClientCert)}, | ||
|
||
+#if BUILDFLAG(ENABLE_IPFS) | ||
+ {"enable-ipfs", | ||
+ flag_descriptions::kEnableIpfsName, | ||
+ flag_descriptions::kEnableIpfsDescription, | ||
+ kOsMac | kOsWin | kOsLinux,//TODO: These are the only variants currently getting built, but that is not likely to remain the case | ||
+ FEATURE_VALUE_TYPE(ipfs::kEnableIpfs)}, | ||
+#endif | ||
+ | ||
{"use-idna2008-non-transitional", | ||
flag_descriptions::kUseIDNA2008NonTransitionalName, | ||
flag_descriptions::kUseIDNA2008NonTransitionalDescription, kOsAll, |
50 changes: 50 additions & 0 deletions
50
...s/124.0.6329.0/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
diff --git a/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc b/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc | ||
index 4c88614c68c25..f8bb12a3b0c2e 100644 | ||
--- a/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc | ||
+++ b/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc | ||
@@ -10,6 +10,8 @@ | ||
#include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" | ||
#include "chrome/browser/external_protocol/external_protocol_handler.h" | ||
#include "chrome/browser/profiles/profile.h" | ||
+#include "third_party/ipfs_client/ipfs_buildflags.h" | ||
+ | ||
#if BUILDFLAG(IS_ANDROID) | ||
#include "chrome/browser/profiles/profile_android.h" | ||
#endif | ||
@@ -18,6 +20,9 @@ | ||
#include "chrome/browser/ui/android/omnibox/jni_headers/ChromeAutocompleteSchemeClassifier_jni.h" | ||
#endif | ||
#include "components/custom_handlers/protocol_handler_registry.h" | ||
+#if BUILDFLAG(ENABLE_IPFS) | ||
+#include "components/ipfs/ipfs_features.h" | ||
+#endif | ||
#include "content/public/common/url_constants.h" | ||
#include "url/url_util.h" | ||
|
||
@@ -55,12 +60,20 @@ ChromeAutocompleteSchemeClassifier::GetInputTypeForScheme( | ||
if (scheme.empty()) { | ||
return metrics::OmniboxInputType::EMPTY; | ||
} | ||
- if (base::IsStringASCII(scheme) && | ||
- (ProfileIOData::IsHandledProtocol(scheme) || | ||
- base::EqualsCaseInsensitiveASCII(scheme, content::kViewSourceScheme) || | ||
- base::EqualsCaseInsensitiveASCII(scheme, url::kJavaScriptScheme) || | ||
- base::EqualsCaseInsensitiveASCII(scheme, url::kDataScheme))) { | ||
- return metrics::OmniboxInputType::URL; | ||
+ if (base::IsStringASCII(scheme)) { | ||
+ if (ProfileIOData::IsHandledProtocol(scheme) || | ||
+ base::EqualsCaseInsensitiveASCII(scheme, content::kViewSourceScheme) || | ||
+ base::EqualsCaseInsensitiveASCII(scheme, url::kJavaScriptScheme) || | ||
+ base::EqualsCaseInsensitiveASCII(scheme, url::kDataScheme)) { | ||
+ return metrics::OmniboxInputType::URL; | ||
+ } | ||
+#if BUILDFLAG(ENABLE_IPFS) | ||
+ if (base::FeatureList::IsEnabled(ipfs::kEnableIpfs) && | ||
+ (base::EqualsCaseInsensitiveASCII(scheme, "ipfs") || base::EqualsCaseInsensitiveASCII(scheme, "ipns")) | ||
+ ) { | ||
+ return metrics::OmniboxInputType::URL; | ||
+ } | ||
+#endif | ||
} | ||
|
||
// Also check for schemes registered via registerProtocolHandler(), which |
78 changes: 78 additions & 0 deletions
78
chromium_edits/124.0.6329.0/chrome/browser/chrome_content_browser_client.cc.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc | ||
index 10240bdcbc380..b9e82dac849c7 100644 | ||
--- a/chrome/browser/chrome_content_browser_client.cc | ||
+++ b/chrome/browser/chrome_content_browser_client.cc | ||
@@ -379,6 +379,7 @@ | ||
#include "third_party/blink/public/common/switches.h" | ||
#include "third_party/blink/public/mojom/browsing_topics/browsing_topics.mojom.h" | ||
#include "third_party/blink/public/public_buildflags.h" | ||
+#include "third_party/ipfs_client/ipfs_buildflags.h" | ||
#include "third_party/widevine/cdm/buildflags.h" | ||
#include "ui/base/clipboard/clipboard_format_type.h" | ||
#include "ui/base/l10n/l10n_util.h" | ||
@@ -500,6 +501,13 @@ | ||
#include "chrome/browser/fuchsia/chrome_browser_main_parts_fuchsia.h" | ||
#endif | ||
|
||
+#if BUILDFLAG(ENABLE_IPFS) | ||
+#include "chrome/browser/ipfs_extra_parts.h" | ||
+#include "components/ipfs/interceptor.h" | ||
+#include "components/ipfs/ipfs_features.h" | ||
+#include "components/ipfs/url_loader_factory.h" | ||
+#endif | ||
+ | ||
#if !BUILDFLAG(IS_ANDROID) | ||
#include "chrome/browser/preloading/preview/preview_navigation_throttle.h" | ||
#endif // !BUILDFLAG(IS_ANDROID) | ||
@@ -1691,6 +1699,11 @@ ChromeContentBrowserClient::CreateBrowserMainParts(bool is_integration_test) { | ||
main_parts->AddParts( | ||
std::make_unique<ChromeBrowserMainExtraPartsNaclDeprecation>()); | ||
|
||
+#if BUILDFLAG(ENABLE_IPFS) | ||
+ if (base::FeatureList::IsEnabled(ipfs::kEnableIpfs)) { | ||
+ main_parts->AddParts(std::make_unique<IpfsExtraParts>()); | ||
+ } | ||
+#endif | ||
return main_parts; | ||
} | ||
|
||
@@ -6076,12 +6089,25 @@ void ChromeContentBrowserClient:: | ||
const std::optional<url::Origin>& request_initiator_origin, | ||
NonNetworkURLLoaderFactoryMap* factories) { | ||
#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(ENABLE_EXTENSIONS) || \ | ||
- !BUILDFLAG(IS_ANDROID) | ||
+ !BUILDFLAG(IS_ANDROID) || BUILDFLAG(ENABLE_IPFS) | ||
content::RenderFrameHost* frame_host = | ||
RenderFrameHost::FromID(render_process_id, render_frame_id); | ||
WebContents* web_contents = WebContents::FromRenderFrameHost(frame_host); | ||
#endif // BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(ENABLE_EXTENSIONS) || \ | ||
- // !BUILDFLAG(IS_ANDROID) | ||
+ // !BUILDFLAG(IS_ANDROID) || BUILDFLAG(ENABLE_IPFS) | ||
+#if BUILDFLAG(ENABLE_IPFS) | ||
+ if (base::FeatureList::IsEnabled(ipfs::kEnableIpfs)) { | ||
+ network::mojom::URLLoaderFactory* default_factory = g_browser_process->system_network_context_manager()->GetURLLoaderFactory(); | ||
+ auto* context = web_contents->GetBrowserContext(); | ||
+ ipfs::IpfsURLLoaderFactory::Create( | ||
+ factories, | ||
+ context, | ||
+ default_factory, | ||
+ GetSystemNetworkContext(), | ||
+ Profile::FromBrowserContext(context)->GetPrefs() | ||
+ ); | ||
+ } | ||
+#endif // BUILDFLAG(ENABLE_IPFS) | ||
|
||
#if BUILDFLAG(IS_CHROMEOS_ASH) | ||
if (web_contents) { | ||
@@ -6218,6 +6244,11 @@ ChromeContentBrowserClient::WillCreateURLLoaderRequestInterceptors( | ||
scoped_refptr<base::SequencedTaskRunner> navigation_response_task_runner) { | ||
std::vector<std::unique_ptr<content::URLLoaderRequestInterceptor>> | ||
interceptors; | ||
+#if BUILDFLAG(ENABLE_IPFS) | ||
+ if (base::FeatureList::IsEnabled(ipfs::kEnableIpfs)) { | ||
+ interceptors.push_back(std::make_unique<ipfs::Interceptor>(g_browser_process->system_network_context_manager()->GetURLLoaderFactory(), GetSystemNetworkContext())); | ||
+ } | ||
+#endif | ||
#if BUILDFLAG(ENABLE_OFFLINE_PAGES) | ||
interceptors.push_back( | ||
std::make_unique<offline_pages::OfflinePageURLLoaderRequestInterceptor>( |
16 changes: 16 additions & 0 deletions
16
chromium_edits/124.0.6329.0/chrome/browser/flag-metadata.json.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json | ||
index 5d16c3affafb9..b8b25c386a3fc 100644 | ||
--- a/chrome/browser/flag-metadata.json | ||
+++ b/chrome/browser/flag-metadata.json | ||
@@ -3022,6 +3022,11 @@ | ||
"owners": [ "[email protected]", "[email protected]" ], | ||
"expiry_milestone": 130 | ||
}, | ||
+ { | ||
+ "name": "enable-ipfs", | ||
+ "owners": [ "//components/ipfs/OWNERS" ], | ||
+ "expiry_milestone": 150 | ||
+ }, | ||
{ | ||
"name": "enable-isolated-sandboxed-iframes", | ||
"owners": [ "[email protected]", "[email protected]", "[email protected]" ], |
16 changes: 16 additions & 0 deletions
16
chromium_edits/124.0.6329.0/chrome/browser/flag_descriptions.cc.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc | ||
index 9ac6c5b7fee08..127145c7e22dd 100644 | ||
--- a/chrome/browser/flag_descriptions.cc | ||
+++ b/chrome/browser/flag_descriptions.cc | ||
@@ -297,6 +297,11 @@ const char kEnableBenchmarkingChoiceDefaultFeatureStates[] = | ||
const char kEnableBenchmarkingChoiceMatchFieldTrialTestingConfig[] = | ||
"Match Field Trial Testing Config"; | ||
|
||
+#if BUILDFLAG(ENABLE_IPFS) | ||
+extern const char kEnableIpfsName[] = "Enable IPFS"; | ||
+extern const char kEnableIpfsDescription[] = "Enable ipfs:// and ipns:// URLs"; | ||
+#endif | ||
+ | ||
const char kPreloadingOnPerformancePageName[] = | ||
"Preloading Settings on Performance Page"; | ||
const char kPreloadingOnPerformancePageDescription[] = |
24 changes: 24 additions & 0 deletions
24
chromium_edits/124.0.6329.0/chrome/browser/flag_descriptions.h.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h | ||
index 61be8f64d42fd..c48ed1e54d4ed 100644 | ||
--- a/chrome/browser/flag_descriptions.h | ||
+++ b/chrome/browser/flag_descriptions.h | ||
@@ -23,6 +23,7 @@ | ||
#include "pdf/buildflags.h" | ||
#include "printing/buildflags/buildflags.h" | ||
#include "third_party/blink/public/common/buildflags.h" | ||
+#include "third_party/ipfs_client/ipfs_buildflags.h" | ||
|
||
// This file declares strings used in chrome://flags. These messages are not | ||
// translated, because instead of end-users they target Chromium developers and | ||
@@ -182,6 +183,11 @@ extern const char kEnableBenchmarkingChoiceDisabled[]; | ||
extern const char kEnableBenchmarkingChoiceDefaultFeatureStates[]; | ||
extern const char kEnableBenchmarkingChoiceMatchFieldTrialTestingConfig[]; | ||
|
||
+#if BUILDFLAG(ENABLE_IPFS) | ||
+extern const char kEnableIpfsName[]; | ||
+extern const char kEnableIpfsDescription[]; | ||
+#endif | ||
+ | ||
#if BUILDFLAG(USE_FONTATIONS_BACKEND) | ||
extern const char kFontationsFontBackendName[]; | ||
extern const char kFontationsFontBackendDescription[]; |
10 changes: 10 additions & 0 deletions
10
chromium_edits/124.0.6329.0/chrome/browser/ipfs_extra_parts.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include "ipfs_extra_parts.h" | ||
|
||
#include "profiles/profile.h" | ||
|
||
#include <components/ipfs/inter_request_state.h> | ||
|
||
void IpfsExtraParts::PostProfileInit(Profile* profile, bool /* is_initial_profile */ ) { | ||
DCHECK(profile); | ||
ipfs::InterRequestState::CreateForBrowserContext(profile, profile->GetPrefs()); | ||
} |
10 changes: 10 additions & 0 deletions
10
chromium_edits/124.0.6329.0/chrome/browser/ipfs_extra_parts.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#ifndef IPFS_EXTRA_PART_H_ | ||
#define IPFS_EXTRA_PART_H_ | ||
|
||
#include <chrome/browser/chrome_browser_main_extra_parts.h> | ||
|
||
class IpfsExtraParts : public ChromeBrowserMainExtraParts { | ||
void PostProfileInit(Profile* profile, bool is_initial_profile) override; | ||
}; | ||
|
||
#endif // IPFS_EXTRA_PART_H_ |
37 changes: 37 additions & 0 deletions
37
chromium_edits/124.0.6329.0/chrome/browser/prefs/browser_prefs.cc.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc | ||
index ead26a869cfe0..a979df933cd2f 100644 | ||
--- a/chrome/browser/prefs/browser_prefs.cc | ||
+++ b/chrome/browser/prefs/browser_prefs.cc | ||
@@ -192,6 +192,8 @@ | ||
#include "printing/buildflags/buildflags.h" | ||
#include "rlz/buildflags/buildflags.h" | ||
#include "services/screen_ai/buildflags/buildflags.h" | ||
+#include "third_party/ipfs_client/ipfs_buildflags.h" | ||
+ | ||
|
||
#if BUILDFLAG(ENABLE_BACKGROUND_MODE) | ||
#include "chrome/browser/background/background_mode_manager.h" | ||
@@ -236,6 +238,11 @@ | ||
#include "chrome/browser/pdf/pdf_pref_names.h" | ||
#endif // BUILDFLAG(ENABLE_PDF) | ||
|
||
+#if BUILDFLAG(ENABLE_IPFS) | ||
+#include "components/ipfs/ipfs_features.h" | ||
+#include "components/ipfs/preferences.h" | ||
+#endif | ||
+ | ||
#if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE) | ||
#include "chrome/browser/screen_ai/pref_names.h" | ||
#endif | ||
@@ -1775,6 +1782,11 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry, | ||
IncognitoModePrefs::RegisterProfilePrefs(registry); | ||
invalidation::PerUserTopicSubscriptionManager::RegisterProfilePrefs(registry); | ||
invalidation::InvalidatorRegistrarWithMemory::RegisterProfilePrefs(registry); | ||
+#if BUILDFLAG(ENABLE_IPFS) | ||
+ if (base::FeatureList::IsEnabled(ipfs::kEnableIpfs)) { | ||
+ ipfs::RegisterPreferences(registry); | ||
+ } | ||
+#endif | ||
language::LanguagePrefs::RegisterProfilePrefs(registry); | ||
login_detection::prefs::RegisterProfilePrefs(registry); | ||
lookalikes::RegisterProfilePrefs(registry); |
17 changes: 17 additions & 0 deletions
17
chromium_edits/124.0.6329.0/chrome/common/chrome_content_client.cc.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc | ||
index 76a5e7ea40232..60ae61f15612e 100644 | ||
--- a/chrome/common/chrome_content_client.cc | ||
+++ b/chrome/common/chrome_content_client.cc | ||
@@ -296,6 +296,12 @@ void ChromeContentClient::AddAdditionalSchemes(Schemes* schemes) { | ||
#if BUILDFLAG(IS_ANDROID) | ||
schemes->local_schemes.push_back(url::kContentScheme); | ||
#endif | ||
+ for ( const char* ip_s : {"ipfs", "ipns"} ) { | ||
+ schemes->standard_schemes.push_back(ip_s); | ||
+ schemes->cors_enabled_schemes.push_back(ip_s); | ||
+ schemes->secure_schemes.push_back(ip_s); | ||
+ schemes->csp_bypassing_schemes.push_back(ip_s); | ||
+ } | ||
} | ||
|
||
std::u16string ChromeContentClient::GetLocalizedString(int message_id) { |
44 changes: 44 additions & 0 deletions
44
chromium_edits/124.0.6329.0/components/cbor/reader.cc.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
diff --git a/components/cbor/reader.cc b/components/cbor/reader.cc | ||
index 3c31e3d05e5d3..5ad0dbb183884 100644 | ||
--- a/components/cbor/reader.cc | ||
+++ b/components/cbor/reader.cc | ||
@@ -22,7 +22,7 @@ | ||
namespace cbor { | ||
|
||
namespace constants { | ||
-const char kUnsupportedMajorType[] = "Unsupported major type."; | ||
+const char kUnsupportedMajorType[] = "Unsupported major type operation."; | ||
} | ||
|
||
namespace { | ||
@@ -156,7 +156,11 @@ std::optional<Value> Reader::DecodeCompleteDataItem(const Config& config, | ||
case Value::Type::FLOAT_VALUE: | ||
// Floating point values also go here since they are also type 7. | ||
return DecodeToSimpleValueOrFloat(*header, config); | ||
- case Value::Type::TAG: // We explicitly don't support TAG. | ||
+ case Value::Type::TAG: | ||
+ if (config.parse_tags) { | ||
+ return ReadTagContent(*header, config, max_nesting_level); | ||
+ } | ||
+ break; | ||
case Value::Type::NONE: | ||
case Value::Type::INVALID_UTF8: | ||
break; | ||
@@ -347,6 +351,17 @@ std::optional<Value> Reader::ReadByteStringContent( | ||
return Value(std::move(cbor_byte_string)); | ||
} | ||
|
||
+std::optional<Value> Reader::ReadTagContent( | ||
+ const Reader::DataItemHeader& header, | ||
+ const Config& config, | ||
+ int max_nesting_level) { | ||
+ auto tagged_content = DecodeCompleteDataItem(config, max_nesting_level); | ||
+ if (tagged_content.has_value()) { | ||
+ tagged_content.value().SetTag(header.value); | ||
+ } | ||
+ return tagged_content; | ||
+} | ||
+ | ||
std::optional<Value> Reader::ReadArrayContent( | ||
const Reader::DataItemHeader& header, | ||
const Config& config, |
Oops, something went wrong.