diff options
Diffstat (limited to 'toolkit/components/contentanalysis')
16 files changed, 13841 insertions, 0 deletions
diff --git a/toolkit/components/contentanalysis/ContentAnalysis.cpp b/toolkit/components/contentanalysis/ContentAnalysis.cpp new file mode 100644 index 0000000000..e749fd0acd --- /dev/null +++ b/toolkit/components/contentanalysis/ContentAnalysis.cpp @@ -0,0 +1,1190 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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/. */ + +#include "ContentAnalysis.h" +#include "ContentAnalysisIPCTypes.h" +#include "content_analysis/sdk/analysis_client.h" + +#include "base/process_util.h" +#include "GMPUtils.h" // ToHexString +#include "mozilla/Components.h" +#include "mozilla/dom/Promise.h" +#include "mozilla/Logging.h" +#include "mozilla/ScopeExit.h" +#include "mozilla/Services.h" +#include "mozilla/StaticPrefs_browser.h" +#include "nsAppRunner.h" +#include "nsComponentManagerUtils.h" +#include "nsIClassInfoImpl.h" +#include "nsIFile.h" +#include "nsIGlobalObject.h" +#include "nsIObserverService.h" +#include "ScopedNSSTypes.h" +#include "xpcpublic.h" + +#include <algorithm> +#include <sstream> + +#ifdef XP_WIN +# include <windows.h> +# define SECURITY_WIN32 1 +# include <security.h> +#endif // XP_WIN + +namespace mozilla::contentanalysis { + +LazyLogModule gContentAnalysisLog("contentanalysis"); +#define LOGD(...) \ + MOZ_LOG(mozilla::contentanalysis::gContentAnalysisLog, \ + mozilla::LogLevel::Debug, (__VA_ARGS__)) + +#define LOGE(...) \ + MOZ_LOG(mozilla::contentanalysis::gContentAnalysisLog, \ + mozilla::LogLevel::Error, (__VA_ARGS__)) + +} // namespace mozilla::contentanalysis + +namespace { + +const char* kIsDLPEnabledPref = "browser.contentanalysis.enabled"; +const char* kIsPerUserPref = "browser.contentanalysis.is_per_user"; +const char* kPipePathNamePref = "browser.contentanalysis.pipe_path_name"; +const char* kDefaultAllowPref = "browser.contentanalysis.default_allow"; + +static constexpr uint32_t kAnalysisTimeoutSecs = 30; // 30 sec + +nsresult MakePromise(JSContext* aCx, RefPtr<mozilla::dom::Promise>* aPromise) { + nsIGlobalObject* go = xpc::CurrentNativeGlobal(aCx); + if (NS_WARN_IF(!go)) { + return NS_ERROR_UNEXPECTED; + } + mozilla::ErrorResult result; + *aPromise = mozilla::dom::Promise::Create(go, result); + if (NS_WARN_IF(result.Failed())) { + return result.StealNSResult(); + } + return NS_OK; +} + +nsCString GenerateRequestToken() { + nsID id = nsID::GenerateUUID(); + return nsCString(id.ToString().get()); +} + +static nsresult GetFileDisplayName(const nsString& aFilePath, + nsString& aFileDisplayName) { + nsresult rv; + nsCOMPtr<nsIFile> file = do_CreateInstance("@mozilla.org/file/local;1", &rv); + NS_ENSURE_SUCCESS(rv, rv); + rv = file->InitWithPath(aFilePath); + NS_ENSURE_SUCCESS(rv, rv); + return file->GetDisplayName(aFileDisplayName); +} + +nsIContentAnalysisAcknowledgement::FinalAction ConvertResult( + nsIContentAnalysisResponse::Action aResponseResult) { + switch (aResponseResult) { + case nsIContentAnalysisResponse::Action::eReportOnly: + return nsIContentAnalysisAcknowledgement::FinalAction::eReportOnly; + case nsIContentAnalysisResponse::Action::eWarn: + return nsIContentAnalysisAcknowledgement::FinalAction::eWarn; + case nsIContentAnalysisResponse::Action::eBlock: + return nsIContentAnalysisAcknowledgement::FinalAction::eBlock; + case nsIContentAnalysisResponse::Action::eAllow: + return nsIContentAnalysisAcknowledgement::FinalAction::eAllow; + case nsIContentAnalysisResponse::Action::eUnspecified: + return nsIContentAnalysisAcknowledgement::FinalAction::eUnspecified; + default: + LOGE( + "ConvertResult got unexpected responseResult " + "%d", + static_cast<uint32_t>(aResponseResult)); + return nsIContentAnalysisAcknowledgement::FinalAction::eUnspecified; + } +} + +} // anonymous namespace + +namespace mozilla::contentanalysis { + +NS_IMETHODIMP +ContentAnalysisRequest::GetAnalysisType(AnalysisType* aAnalysisType) { + *aAnalysisType = mAnalysisType; + return NS_OK; +} + +NS_IMETHODIMP +ContentAnalysisRequest::GetTextContent(nsAString& aTextContent) { + aTextContent = mTextContent; + return NS_OK; +} + +NS_IMETHODIMP +ContentAnalysisRequest::GetFilePath(nsAString& aFilePath) { + aFilePath = mFilePath; + return NS_OK; +} + +NS_IMETHODIMP +ContentAnalysisRequest::GetUrl(nsIURI** aUrl) { + NS_ENSURE_ARG_POINTER(aUrl); + NS_IF_ADDREF(*aUrl = mUrl); + return NS_OK; +} + +NS_IMETHODIMP +ContentAnalysisRequest::GetEmail(nsAString& aEmail) { + aEmail = mEmail; + return NS_OK; +} + +NS_IMETHODIMP +ContentAnalysisRequest::GetSha256Digest(nsACString& aSha256Digest) { + aSha256Digest = mSha256Digest; + return NS_OK; +} + +NS_IMETHODIMP +ContentAnalysisRequest::GetResources( + nsTArray<RefPtr<nsIClientDownloadResource>>& aResources) { + aResources = mResources.Clone(); + return NS_OK; +} + +NS_IMETHODIMP +ContentAnalysisRequest::GetRequestToken(nsACString& aRequestToken) { + aRequestToken = mRequestToken; + return NS_OK; +} + +NS_IMETHODIMP +ContentAnalysisRequest::GetOperationTypeForDisplay( + OperationType* aOperationType) { + *aOperationType = mOperationTypeForDisplay; + return NS_OK; +} + +NS_IMETHODIMP +ContentAnalysisRequest::GetOperationDisplayString( + nsAString& aOperationDisplayString) { + aOperationDisplayString = mOperationDisplayString; + return NS_OK; +} + +NS_IMETHODIMP +ContentAnalysisRequest::GetWindowGlobalParent( + dom::WindowGlobalParent** aWindowGlobalParent) { + NS_IF_ADDREF(*aWindowGlobalParent = mWindowGlobalParent); + return NS_OK; +} + +nsresult ContentAnalysis::CreateContentAnalysisClient(nsCString&& aPipePathName, + bool aIsPerUser) { + MOZ_ASSERT(!NS_IsMainThread()); + // This method should only be called once + MOZ_ASSERT(!mCaClientPromise->IsResolved()); + + std::shared_ptr<content_analysis::sdk::Client> client( + content_analysis::sdk::Client::Create({aPipePathName.Data(), aIsPerUser}) + .release()); + LOGD("Content analysis is %s", client ? "connected" : "not available"); + mCaClientPromise->Resolve(client, __func__); + + return NS_OK; +} + +ContentAnalysisRequest::ContentAnalysisRequest( + AnalysisType aAnalysisType, nsString aString, bool aStringIsFilePath, + nsCString aSha256Digest, nsCOMPtr<nsIURI> aUrl, + OperationType aOperationType, dom::WindowGlobalParent* aWindowGlobalParent) + : mAnalysisType(aAnalysisType), + mUrl(std::move(aUrl)), + mSha256Digest(std::move(aSha256Digest)), + mWindowGlobalParent(aWindowGlobalParent) { + if (aStringIsFilePath) { + mFilePath = std::move(aString); + } else { + mTextContent = std::move(aString); + } + mOperationTypeForDisplay = aOperationType; + if (mOperationTypeForDisplay == OperationType::eCustomDisplayString) { + MOZ_ASSERT(aStringIsFilePath); + nsresult rv = GetFileDisplayName(mFilePath, mOperationDisplayString); + if (NS_FAILED(rv)) { + mOperationDisplayString = u"file"; + } + } + + mRequestToken = GenerateRequestToken(); +} + +nsresult ContentAnalysisRequest::GetFileDigest(const nsAString& aFilePath, + nsCString& aDigestString) { + MOZ_DIAGNOSTIC_ASSERT( + !NS_IsMainThread(), + "ContentAnalysisRequest::GetFileDigest does file IO and should " + "not run on the main thread"); + nsresult rv; + mozilla::Digest digest; + digest.Begin(SEC_OID_SHA256); + PRFileDesc* fd = nullptr; + nsCOMPtr<nsIFile> file = do_CreateInstance("@mozilla.org/file/local;1", &rv); + NS_ENSURE_SUCCESS(rv, rv); + rv = file->InitWithPath(aFilePath); + NS_ENSURE_SUCCESS(rv, rv); + rv = file->OpenNSPRFileDesc(PR_RDONLY | nsIFile::OS_READAHEAD, 0, &fd); + NS_ENSURE_SUCCESS(rv, rv); + auto closeFile = MakeScopeExit([fd]() { PR_Close(fd); }); + constexpr uint32_t kBufferSize = 1024 * 1024; + auto buffer = mozilla::MakeUnique<uint8_t[]>(kBufferSize); + if (!buffer) { + return NS_ERROR_OUT_OF_MEMORY; + } + PRInt32 bytesRead = PR_Read(fd, buffer.get(), kBufferSize); + while (bytesRead != 0) { + if (bytesRead == -1) { + return NS_ErrorAccordingToNSPR(); + } + digest.Update(mozilla::Span<const uint8_t>(buffer.get(), bytesRead)); + bytesRead = PR_Read(fd, buffer.get(), kBufferSize); + } + nsTArray<uint8_t> digestResults; + rv = digest.End(digestResults); + NS_ENSURE_SUCCESS(rv, rv); + aDigestString = mozilla::ToHexString(digestResults); + return NS_OK; +} + +static nsresult ConvertToProtobuf( + nsIClientDownloadResource* aIn, + content_analysis::sdk::ClientDownloadRequest_Resource* aOut) { + nsString url; + nsresult rv = aIn->GetUrl(url); + NS_ENSURE_SUCCESS(rv, rv); + aOut->set_url(NS_ConvertUTF16toUTF8(url).get()); + + uint32_t resourceType; + rv = aIn->GetType(&resourceType); + NS_ENSURE_SUCCESS(rv, rv); + aOut->set_type( + static_cast<content_analysis::sdk::ClientDownloadRequest_ResourceType>( + resourceType)); + + return NS_OK; +} + +static nsresult ConvertToProtobuf( + nsIContentAnalysisRequest* aIn, + content_analysis::sdk::ContentAnalysisRequest* aOut) { + aOut->set_expires_at(time(nullptr) + kAnalysisTimeoutSecs); // TODO: + + nsIContentAnalysisRequest::AnalysisType analysisType; + nsresult rv = aIn->GetAnalysisType(&analysisType); + NS_ENSURE_SUCCESS(rv, rv); + auto connector = + static_cast<content_analysis::sdk::AnalysisConnector>(analysisType); + aOut->set_analysis_connector(connector); + + nsCString requestToken; + rv = aIn->GetRequestToken(requestToken); + NS_ENSURE_SUCCESS(rv, rv); + aOut->set_request_token(requestToken.get(), requestToken.Length()); + + const std::string tag = "dlp"; // TODO: + *aOut->add_tags() = tag; + + auto* requestData = aOut->mutable_request_data(); + + nsCOMPtr<nsIURI> url; + rv = aIn->GetUrl(getter_AddRefs(url)); + NS_ENSURE_SUCCESS(rv, rv); + nsCString urlString; + rv = url->GetSpec(urlString); + NS_ENSURE_SUCCESS(rv, rv); + if (!urlString.IsEmpty()) { + requestData->set_url(urlString.get()); + } + + nsString email; + rv = aIn->GetEmail(email); + NS_ENSURE_SUCCESS(rv, rv); + if (!email.IsEmpty()) { + requestData->set_email(NS_ConvertUTF16toUTF8(email).get()); + } + + nsCString sha256Digest; + rv = aIn->GetSha256Digest(sha256Digest); + NS_ENSURE_SUCCESS(rv, rv); + if (!sha256Digest.IsEmpty()) { + requestData->set_digest(sha256Digest.get()); + } + + nsString filePath; + rv = aIn->GetFilePath(filePath); + NS_ENSURE_SUCCESS(rv, rv); + if (!filePath.IsEmpty()) { + std::string filePathStr = NS_ConvertUTF16toUTF8(filePath).get(); + aOut->set_file_path(filePathStr); + auto filename = filePathStr.substr(filePathStr.find_last_of("/\\") + 1); + if (!filename.empty()) { + requestData->set_filename(filename); + } + } else { + nsString textContent; + rv = aIn->GetTextContent(textContent); + NS_ENSURE_SUCCESS(rv, rv); + MOZ_ASSERT(!textContent.IsEmpty()); + aOut->set_text_content(NS_ConvertUTF16toUTF8(textContent).get()); + } + +#ifdef XP_WIN + ULONG userLen = 0; + GetUserNameExW(NameSamCompatible, nullptr, &userLen); + if (GetLastError() == ERROR_MORE_DATA && userLen > 0) { + auto user = mozilla::MakeUnique<wchar_t[]>(userLen); + if (GetUserNameExW(NameSamCompatible, user.get(), &userLen)) { + auto* clientMetadata = aOut->mutable_client_metadata(); + auto* browser = clientMetadata->mutable_browser(); + browser->set_machine_user(NS_ConvertUTF16toUTF8(user.get()).get()); + } + } +#endif + + nsTArray<RefPtr<nsIClientDownloadResource>> resources; + rv = aIn->GetResources(resources); + NS_ENSURE_SUCCESS(rv, rv); + if (!resources.IsEmpty()) { + auto* pbClientDownloadRequest = requestData->mutable_csd(); + for (auto& nsResource : resources) { + rv = ConvertToProtobuf(nsResource.get(), + pbClientDownloadRequest->add_resources()); + NS_ENSURE_SUCCESS(rv, rv); + } + } + + return NS_OK; +} + +static void LogRequest( + content_analysis::sdk::ContentAnalysisRequest* aPbRequest) { + // We cannot use Protocol Buffer's DebugString() because we optimize for + // lite runtime. + if (!static_cast<LogModule*>(gContentAnalysisLog) + ->ShouldLog(LogLevel::Debug)) { + return; + } + + std::stringstream ss; + ss << "ContentAnalysisRequest:" + << "\n"; + +#define ADD_FIELD(PBUF, NAME, FUNC) \ + ss << " " << (NAME) << ": "; \ + if ((PBUF)->has_##FUNC()) \ + ss << (PBUF)->FUNC() << "\n"; \ + else \ + ss << "<none>" \ + << "\n"; + +#define ADD_EXISTS(PBUF, NAME, FUNC) \ + ss << " " << (NAME) << ": " \ + << ((PBUF)->has_##FUNC() ? "<exists>" : "<none>") << "\n"; + + ADD_FIELD(aPbRequest, "Expires", expires_at); + ADD_FIELD(aPbRequest, "Analysis Type", analysis_connector); + ADD_FIELD(aPbRequest, "Request Token", request_token); + ADD_FIELD(aPbRequest, "File Path", file_path); + ADD_FIELD(aPbRequest, "Text Content", text_content); + // TODO: Tags + ADD_EXISTS(aPbRequest, "Request Data Struct", request_data); + const auto* requestData = + aPbRequest->has_request_data() ? &aPbRequest->request_data() : nullptr; + if (requestData) { + ADD_FIELD(requestData, " Url", url); + ADD_FIELD(requestData, " Email", email); + ADD_FIELD(requestData, " SHA-256 Digest", digest); + ADD_FIELD(requestData, " Filename", filename); + ADD_EXISTS(requestData, " Client Download Request struct", csd); + const auto* csd = requestData->has_csd() ? &requestData->csd() : nullptr; + if (csd) { + uint32_t i = 0; + for (const auto& resource : csd->resources()) { + ss << " Resource " << i << ":" + << "\n"; + ADD_FIELD(&resource, " Url", url); + ADD_FIELD(&resource, " Type", type); + ++i; + } + } + } + ADD_EXISTS(aPbRequest, "Client Metadata Struct", client_metadata); + const auto* clientMetadata = aPbRequest->has_client_metadata() + ? &aPbRequest->client_metadata() + : nullptr; + if (clientMetadata) { + ADD_EXISTS(clientMetadata, " Browser Struct", browser); + const auto* browser = + clientMetadata->has_browser() ? &clientMetadata->browser() : nullptr; + if (browser) { + ADD_FIELD(browser, " Machine User", machine_user); + } + } + +#undef ADD_EXISTS +#undef ADD_FIELD + + LOGD("%s", ss.str().c_str()); +} + +ContentAnalysisResponse::ContentAnalysisResponse( + content_analysis::sdk::ContentAnalysisResponse&& aResponse) + : mHasAcknowledged(false) { + mAction = Action::eUnspecified; + for (const auto& result : aResponse.results()) { + if (!result.has_status() || + result.status() != + content_analysis::sdk::ContentAnalysisResponse::Result::SUCCESS) { + mAction = Action::eUnspecified; + return; + } + // The action values increase with severity, so the max is the most severe. + for (const auto& rule : result.triggered_rules()) { + mAction = + static_cast<Action>(std::max(static_cast<uint32_t>(mAction), + static_cast<uint32_t>(rule.action()))); + } + } + + // If no rules blocked then we should allow. + if (mAction == Action::eUnspecified) { + mAction = Action::eAllow; + } + + const auto& requestToken = aResponse.request_token(); + mRequestToken.Assign(requestToken.data(), requestToken.size()); +} + +ContentAnalysisResponse::ContentAnalysisResponse( + Action aAction, const nsACString& aRequestToken) + : mAction(aAction), mRequestToken(aRequestToken), mHasAcknowledged(false) {} + +/* static */ +already_AddRefed<ContentAnalysisResponse> ContentAnalysisResponse::FromProtobuf( + content_analysis::sdk::ContentAnalysisResponse&& aResponse) { + auto ret = RefPtr<ContentAnalysisResponse>( + new ContentAnalysisResponse(std::move(aResponse))); + + if (ret->mAction == Action::eUnspecified) { + return nullptr; + } + + return ret.forget(); +} + +/* static */ +RefPtr<ContentAnalysisResponse> ContentAnalysisResponse::FromAction( + Action aAction, const nsACString& aRequestToken) { + if (aAction == Action::eUnspecified) { + return nullptr; + } + return RefPtr<ContentAnalysisResponse>( + new ContentAnalysisResponse(aAction, aRequestToken)); +} + +NS_IMETHODIMP +ContentAnalysisResponse::GetRequestToken(nsACString& aRequestToken) { + aRequestToken = mRequestToken; + return NS_OK; +} + +static void LogResponse( + content_analysis::sdk::ContentAnalysisResponse* aPbResponse) { + if (!static_cast<LogModule*>(gContentAnalysisLog) + ->ShouldLog(LogLevel::Debug)) { + return; + } + + std::stringstream ss; + ss << "ContentAnalysisResponse:" + << "\n"; + +#define ADD_FIELD(PBUF, NAME, FUNC) \ + ss << " " << (NAME) << ": "; \ + if ((PBUF)->has_##FUNC()) \ + ss << (PBUF)->FUNC() << "\n"; \ + else \ + ss << "<none>" \ + << "\n"; + + ADD_FIELD(aPbResponse, "Request Token", request_token); + uint32_t i = 0; + for (const auto& result : aPbResponse->results()) { + ss << " Result " << i << ":" + << "\n"; + ADD_FIELD(&result, " Status", status); + uint32_t j = 0; + for (const auto& rule : result.triggered_rules()) { + ss << " Rule " << j << ":" + << "\n"; + ADD_FIELD(&rule, " action", action); + ++j; + } + ++i; + } + +#undef ADD_FIELD + + LOGD("%s", ss.str().c_str()); +} + +static nsresult ConvertToProtobuf( + nsIContentAnalysisAcknowledgement* aIn, const nsACString& aRequestToken, + content_analysis::sdk::ContentAnalysisAcknowledgement* aOut) { + aOut->set_request_token(aRequestToken.Data(), aRequestToken.Length()); + + nsIContentAnalysisAcknowledgement::Result result; + nsresult rv = aIn->GetResult(&result); + NS_ENSURE_SUCCESS(rv, rv); + aOut->set_status( + static_cast<content_analysis::sdk::ContentAnalysisAcknowledgement_Status>( + result)); + + nsIContentAnalysisAcknowledgement::FinalAction finalAction; + rv = aIn->GetFinalAction(&finalAction); + NS_ENSURE_SUCCESS(rv, rv); + aOut->set_final_action( + static_cast< + content_analysis::sdk::ContentAnalysisAcknowledgement_FinalAction>( + finalAction)); + + return NS_OK; +} + +NS_IMETHODIMP +ContentAnalysisResponse::GetAction(Action* aAction) { + *aAction = mAction; + return NS_OK; +} + +static void LogAcknowledgement( + content_analysis::sdk::ContentAnalysisAcknowledgement* aPbAck) { + if (!static_cast<LogModule*>(gContentAnalysisLog) + ->ShouldLog(LogLevel::Debug)) { + return; + } + + std::stringstream ss; + ss << "ContentAnalysisAcknowledgement:" + << "\n"; + +#define ADD_FIELD(PBUF, NAME, FUNC) \ + ss << " " << (NAME) << ": "; \ + if ((PBUF)->has_##FUNC()) \ + ss << (PBUF)->FUNC() << "\n"; \ + else \ + ss << "<none>" \ + << "\n"; + + ADD_FIELD(aPbAck, "Status", status); + ADD_FIELD(aPbAck, "Final Action", final_action); + +#undef ADD_FIELD + + LOGD("%s", ss.str().c_str()); +} + +void ContentAnalysisResponse::SetOwner(RefPtr<ContentAnalysis> aOwner) { + mOwner = std::move(aOwner); +} + +void ContentAnalysisResponse::ResolveWarnAction(bool aAllowContent) { + MOZ_ASSERT(mAction == Action::eWarn); + mAction = aAllowContent ? Action::eAllow : Action::eBlock; +} + +ContentAnalysisAcknowledgement::ContentAnalysisAcknowledgement( + Result aResult, FinalAction aFinalAction) + : mResult(aResult), mFinalAction(aFinalAction) {} + +NS_IMETHODIMP +ContentAnalysisAcknowledgement::GetResult(Result* aResult) { + *aResult = mResult; + return NS_OK; +} + +NS_IMETHODIMP +ContentAnalysisAcknowledgement::GetFinalAction(FinalAction* aFinalAction) { + *aFinalAction = mFinalAction; + return NS_OK; +} + +namespace { +static bool ShouldAllowAction( + nsIContentAnalysisResponse::Action aResponseCode) { + return aResponseCode == nsIContentAnalysisResponse::Action::eAllow || + aResponseCode == nsIContentAnalysisResponse::Action::eReportOnly || + aResponseCode == nsIContentAnalysisResponse::Action::eWarn; +} +} // namespace + +NS_IMETHODIMP ContentAnalysisResponse::GetShouldAllowContent( + bool* aShouldAllowContent) { + *aShouldAllowContent = ShouldAllowAction(mAction); + return NS_OK; +} + +NS_IMETHODIMP ContentAnalysisResult::GetShouldAllowContent( + bool* aShouldAllowContent) { + if (mValue.is<NoContentAnalysisResult>()) { + NoContentAnalysisResult result = mValue.as<NoContentAnalysisResult>(); + if (Preferences::GetBool(kDefaultAllowPref)) { + *aShouldAllowContent = result != NoContentAnalysisResult::CANCELED; + } else { + // Note that we allow content if we're unable to get it (for example, if + // there's clipboard content that is not text or file) + *aShouldAllowContent = + result == NoContentAnalysisResult::CONTENT_ANALYSIS_NOT_ACTIVE || + result == + NoContentAnalysisResult::CONTEXT_EXEMPT_FROM_CONTENT_ANALYSIS || + result == NoContentAnalysisResult::ERROR_COULD_NOT_GET_DATA; + } + } else { + *aShouldAllowContent = + ShouldAllowAction(mValue.as<nsIContentAnalysisResponse::Action>()); + } + return NS_OK; +} + +NS_IMPL_CLASSINFO(ContentAnalysisRequest, nullptr, 0, {0}); +NS_IMPL_ISUPPORTS_CI(ContentAnalysisRequest, nsIContentAnalysisRequest); +NS_IMPL_CLASSINFO(ContentAnalysisResponse, nullptr, 0, {0}); +NS_IMPL_ISUPPORTS_CI(ContentAnalysisResponse, nsIContentAnalysisResponse); +NS_IMPL_ISUPPORTS(ContentAnalysisAcknowledgement, + nsIContentAnalysisAcknowledgement); +NS_IMPL_ISUPPORTS(ContentAnalysisCallback, nsIContentAnalysisCallback); +NS_IMPL_ISUPPORTS(ContentAnalysisResult, nsIContentAnalysisResult); +NS_IMPL_ISUPPORTS(ContentAnalysis, nsIContentAnalysis, ContentAnalysis); + +ContentAnalysis::ContentAnalysis() + : mCaClientPromise( + new ClientPromise::Private("ContentAnalysis::ContentAnalysis")), + mClientCreationAttempted(false), + mCallbackMap("ContentAnalysis::mCallbackMap"), + mWarnResponseDataMap("ContentAnalysis::mWarnResponseDataMap") {} + +ContentAnalysis::~ContentAnalysis() { + // Accessing mClientCreationAttempted so need to be on the main thread + MOZ_ASSERT(NS_IsMainThread()); + if (!mClientCreationAttempted) { + // Reject the promise to avoid assertions when it gets destroyed + mCaClientPromise->Reject(NS_ERROR_ILLEGAL_DURING_SHUTDOWN, __func__); + } +} + +NS_IMETHODIMP +ContentAnalysis::GetIsActive(bool* aIsActive) { + *aIsActive = false; + // Need to be on the main thread to read prefs + MOZ_ASSERT(NS_IsMainThread()); + // gAllowContentAnalysis is only set in the parent process + MOZ_ASSERT(XRE_IsParentProcess()); + if (!gAllowContentAnalysis || !Preferences::GetBool(kIsDLPEnabledPref)) { + LOGD("Local DLP Content Analysis is not active"); + return NS_OK; + } + *aIsActive = true; + LOGD("Local DLP Content Analysis is active"); + // mClientCreationAttempted is only accessed on the main thread, + // so no need for synchronization here. + if (!mClientCreationAttempted) { + mClientCreationAttempted = true; + LOGD("Dispatching background task to create Content Analysis client"); + + nsCString pipePathName; + nsresult rv = Preferences::GetCString(kPipePathNamePref, pipePathName); + if (NS_WARN_IF(NS_FAILED(rv))) { + mCaClientPromise->Reject(rv, __func__); + return rv; + } + bool isPerUser = Preferences::GetBool(kIsPerUserPref); + rv = NS_DispatchBackgroundTask(NS_NewCancelableRunnableFunction( + "ContentAnalysis::CreateContentAnalysisClient", + [owner = RefPtr{this}, pipePathName = std::move(pipePathName), + isPerUser]() mutable { + owner->CreateContentAnalysisClient(std::move(pipePathName), + isPerUser); + })); + if (NS_WARN_IF(NS_FAILED(rv))) { + mCaClientPromise->Reject(rv, __func__); + return rv; + } + } + return NS_OK; +} + +NS_IMETHODIMP +ContentAnalysis::GetMightBeActive(bool* aMightBeActive) { + // A DLP connection is not permitted to be added/removed while the + // browser is running, so we can cache this. + static bool sIsEnabled = Preferences::GetBool(kIsDLPEnabledPref); + // Note that we can't check gAllowContentAnalysis here because it + // only gets set in the parent process. + *aMightBeActive = sIsEnabled; + return NS_OK; +} + +nsresult ContentAnalysis::CancelWithError(nsCString aRequestToken, + nsresult aResult) { + return NS_DispatchToMainThread(NS_NewCancelableRunnableFunction( + "ContentAnalysis::RunAnalyzeRequestTask::HandleResponse", + [aResult, aRequestToken = std::move(aRequestToken)] { + RefPtr<ContentAnalysis> owner = GetContentAnalysisFromService(); + if (!owner) { + // May be shutting down + return; + } + nsCOMPtr<nsIObserverService> obsServ = + mozilla::services::GetObserverService(); + bool allow = Preferences::GetBool(kDefaultAllowPref); + RefPtr<ContentAnalysisResponse> response = + ContentAnalysisResponse::FromAction( + allow ? nsIContentAnalysisResponse::Action::eAllow + : nsIContentAnalysisResponse::Action::eCanceled, + aRequestToken); + response->SetOwner(owner); + obsServ->NotifyObservers(response, "dlp-response", nullptr); + nsMainThreadPtrHandle<nsIContentAnalysisCallback> callbackHolder; + { + auto lock = owner->mCallbackMap.Lock(); + auto callbackData = lock->Extract(aRequestToken); + if (callbackData.isSome()) { + callbackHolder = callbackData->TakeCallbackHolder(); + } + } + if (callbackHolder) { + if (allow) { + callbackHolder->ContentResult(response); + } else { + callbackHolder->Error(aResult); + } + } + })); +} + +RefPtr<ContentAnalysis> ContentAnalysis::GetContentAnalysisFromService() { + RefPtr<ContentAnalysis> contentAnalysisService = + mozilla::components::nsIContentAnalysis::Service(); + if (!contentAnalysisService) { + // May be shutting down + return nullptr; + } + + return contentAnalysisService; +} + +nsresult ContentAnalysis::RunAnalyzeRequestTask( + const RefPtr<nsIContentAnalysisRequest>& aRequest, bool aAutoAcknowledge, + const RefPtr<nsIContentAnalysisCallback>& aCallback) { + nsresult rv = NS_ERROR_FAILURE; + auto callbackCopy = aCallback; + auto se = MakeScopeExit([&] { + if (!NS_SUCCEEDED(rv)) { + LOGE("RunAnalyzeRequestTask failed"); + callbackCopy->Error(rv); + } + }); + + content_analysis::sdk::ContentAnalysisRequest pbRequest; + rv = ConvertToProtobuf(aRequest, &pbRequest); + NS_ENSURE_SUCCESS(rv, rv); + + nsCString requestToken; + nsMainThreadPtrHandle<nsIContentAnalysisCallback> callbackHolderCopy( + new nsMainThreadPtrHolder<nsIContentAnalysisCallback>( + "content analysis callback", aCallback)); + CallbackData callbackData(std::move(callbackHolderCopy), aAutoAcknowledge); + rv = aRequest->GetRequestToken(requestToken); + NS_ENSURE_SUCCESS(rv, rv); + { + auto lock = mCallbackMap.Lock(); + lock->InsertOrUpdate(requestToken, std::move(callbackData)); + } + + LOGD("Issuing ContentAnalysisRequest for token %s", requestToken.get()); + LogRequest(&pbRequest); + + mCaClientPromise->Then( + GetCurrentSerialEventTarget(), __func__, + [requestToken, pbRequest = std::move(pbRequest)]( + std::shared_ptr<content_analysis::sdk::Client> client) mutable { + // The content analysis call is synchronous so run in the background. + NS_DispatchBackgroundTask( + NS_NewCancelableRunnableFunction( + __func__, + [requestToken, pbRequest = std::move(pbRequest), + client = std::move(client)]() mutable { + DoAnalyzeRequest(requestToken, std::move(pbRequest), client); + }), + NS_DISPATCH_EVENT_MAY_BLOCK); + }, + [requestToken](nsresult rv) mutable { + LOGD("RunAnalyzeRequestTask failed to get client"); + RefPtr<ContentAnalysis> owner = GetContentAnalysisFromService(); + if (!owner) { + // May be shutting down + return; + } + owner->CancelWithError(std::move(requestToken), rv); + }); + + return rv; +} + +void ContentAnalysis::DoAnalyzeRequest( + nsCString aRequestToken, + content_analysis::sdk::ContentAnalysisRequest&& aRequest, + const std::shared_ptr<content_analysis::sdk::Client>& aClient) { + MOZ_ASSERT(!NS_IsMainThread()); + RefPtr<ContentAnalysis> owner = + ContentAnalysis::GetContentAnalysisFromService(); + if (!owner) { + // May be shutting down + return; + } + + if (!aClient) { + owner->CancelWithError(std::move(aRequestToken), NS_ERROR_NOT_AVAILABLE); + return; + } + + if (aRequest.has_file_path() && !aRequest.file_path().empty() && + (!aRequest.request_data().has_digest() || + aRequest.request_data().digest().empty())) { + // Calculate the digest + nsCString digest; + nsCString fileCPath(aRequest.file_path().data(), + aRequest.file_path().length()); + nsString filePath = NS_ConvertUTF8toUTF16(fileCPath); + nsresult rv = ContentAnalysisRequest::GetFileDigest(filePath, digest); + if (NS_FAILED(rv)) { + owner->CancelWithError(std::move(aRequestToken), rv); + return; + } + if (!digest.IsEmpty()) { + aRequest.mutable_request_data()->set_digest(digest.get()); + } + } + + { + auto callbackMap = owner->mCallbackMap.Lock(); + if (!callbackMap->Contains(aRequestToken)) { + LOGD( + "RunAnalyzeRequestTask token %s has already been " + "cancelled - not issuing request", + aRequestToken.get()); + return; + } + } + + // Run request, then dispatch back to main thread to resolve + // aCallback + content_analysis::sdk::ContentAnalysisResponse pbResponse; + int err = aClient->Send(aRequest, &pbResponse); + if (err != 0) { + LOGE("RunAnalyzeRequestTask client transaction failed"); + owner->CancelWithError(std::move(aRequestToken), NS_ERROR_FAILURE); + return; + } + LOGD("Content analysis client transaction succeeded"); + LogResponse(&pbResponse); + NS_DispatchToMainThread(NS_NewCancelableRunnableFunction( + "ContentAnalysis::RunAnalyzeRequestTask::HandleResponse", + [pbResponse = std::move(pbResponse)]() mutable { + RefPtr<ContentAnalysis> owner = GetContentAnalysisFromService(); + if (!owner) { + // May be shutting down + return; + } + + RefPtr<ContentAnalysisResponse> response = + ContentAnalysisResponse::FromProtobuf(std::move(pbResponse)); + if (!response) { + LOGE("Content analysis got invalid response!"); + return; + } + nsCString responseRequestToken; + nsresult requestRv = response->GetRequestToken(responseRequestToken); + if (NS_FAILED(requestRv)) { + LOGE( + "Content analysis couldn't get request token " + "from response!"); + return; + } + + Maybe<CallbackData> maybeCallbackData; + { + auto callbackMap = owner->mCallbackMap.Lock(); + maybeCallbackData = callbackMap->Extract(responseRequestToken); + } + if (maybeCallbackData.isNothing()) { + LOGD( + "Content analysis did not find callback for " + "token %s", + responseRequestToken.get()); + return; + } + response->SetOwner(owner); + if (maybeCallbackData->Canceled()) { + // request has already been cancelled, so there's + // nothing to do + LOGD( + "Content analysis got response but ignoring " + "because it was already cancelled for token %s", + responseRequestToken.get()); + // Note that we always acknowledge here, even if + // autoAcknowledge isn't set, since we raise an exception + // at the caller on cancellation. + auto acknowledgement = MakeRefPtr<ContentAnalysisAcknowledgement>( + nsIContentAnalysisAcknowledgement::Result::eTooLate, + nsIContentAnalysisAcknowledgement::FinalAction::eBlock); + response->Acknowledge(acknowledgement); + return; + } + + LOGD( + "Content analysis resolving response promise for " + "token %s", + responseRequestToken.get()); + nsIContentAnalysisResponse::Action action = response->GetAction(); + nsCOMPtr<nsIObserverService> obsServ = + mozilla::services::GetObserverService(); + if (action == nsIContentAnalysisResponse::Action::eWarn) { + { + auto warnResponseDataMap = owner->mWarnResponseDataMap.Lock(); + warnResponseDataMap->InsertOrUpdate( + responseRequestToken, + WarnResponseData(std::move(*maybeCallbackData), response)); + } + obsServ->NotifyObservers(response, "dlp-response", nullptr); + return; + } + + obsServ->NotifyObservers(response, "dlp-response", nullptr); + if (maybeCallbackData->AutoAcknowledge()) { + auto acknowledgement = MakeRefPtr<ContentAnalysisAcknowledgement>( + nsIContentAnalysisAcknowledgement::Result::eSuccess, + ConvertResult(action)); + response->Acknowledge(acknowledgement); + } + + nsMainThreadPtrHandle<nsIContentAnalysisCallback> callbackHolder = + maybeCallbackData->TakeCallbackHolder(); + callbackHolder->ContentResult(response); + })); +} + +NS_IMETHODIMP +ContentAnalysis::AnalyzeContentRequest(nsIContentAnalysisRequest* aRequest, + bool aAutoAcknowledge, JSContext* aCx, + mozilla::dom::Promise** aPromise) { + RefPtr<mozilla::dom::Promise> promise; + nsresult rv = MakePromise(aCx, &promise); + NS_ENSURE_SUCCESS(rv, rv); + RefPtr<ContentAnalysisCallback> callbackPtr = + new ContentAnalysisCallback(promise); + promise.forget(aPromise); + return AnalyzeContentRequestCallback(aRequest, aAutoAcknowledge, + callbackPtr.get()); +} + +NS_IMETHODIMP +ContentAnalysis::AnalyzeContentRequestCallback( + nsIContentAnalysisRequest* aRequest, bool aAutoAcknowledge, + nsIContentAnalysisCallback* aCallback) { + NS_ENSURE_ARG(aRequest); + NS_ENSURE_ARG(aCallback); + + bool isActive; + nsresult rv = GetIsActive(&isActive); + NS_ENSURE_SUCCESS(rv, rv); + if (!isActive) { + return NS_ERROR_NOT_AVAILABLE; + } + + nsCOMPtr<nsIObserverService> obsServ = + mozilla::services::GetObserverService(); + obsServ->NotifyObservers(aRequest, "dlp-request-made", nullptr); + + return RunAnalyzeRequestTask(aRequest, aAutoAcknowledge, aCallback); +} + +NS_IMETHODIMP +ContentAnalysis::CancelContentAnalysisRequest(const nsACString& aRequestToken) { + MOZ_ASSERT(NS_IsMainThread()); + nsCString requestToken(aRequestToken); + + auto callbackMap = mCallbackMap.Lock(); + auto entry = callbackMap->Lookup(requestToken); + LOGD("Content analysis cancelling request %s", requestToken.get()); + // Make sure the entry hasn't been cancelled already + if (entry && !entry->Canceled()) { + nsMainThreadPtrHandle<nsIContentAnalysisCallback> callbackHolder = + entry->TakeCallbackHolder(); + entry->SetCanceled(); + // Should only be called once + MOZ_ASSERT(callbackHolder); + if (callbackHolder) { + callbackHolder->Error(NS_ERROR_ABORT); + } + } else { + LOGD("Content analysis request not found when trying to cancel %s", + requestToken.get()); + } + return NS_OK; +} + +NS_IMETHODIMP +ContentAnalysis::RespondToWarnDialog(const nsACString& aRequestToken, + bool aAllowContent) { + nsCString requestToken(aRequestToken); + NS_DispatchToMainThread(NS_NewCancelableRunnableFunction( + "RespondToWarnDialog", + [aAllowContent, requestToken = std::move(requestToken)]() { + RefPtr<ContentAnalysis> self = GetContentAnalysisFromService(); + if (!self) { + // May be shutting down + return; + } + + LOGD("Content analysis getting warn response %d for request %s", + aAllowContent ? 1 : 0, requestToken.get()); + Maybe<WarnResponseData> entry; + { + auto warnResponseDataMap = self->mWarnResponseDataMap.Lock(); + entry = warnResponseDataMap->Extract(requestToken); + } + if (!entry) { + LOGD( + "Content analysis request not found when trying to send warn " + "response for request %s", + requestToken.get()); + return; + } + entry->mResponse->ResolveWarnAction(aAllowContent); + auto action = entry->mResponse->GetAction(); + if (entry->mCallbackData.AutoAcknowledge()) { + RefPtr<ContentAnalysisAcknowledgement> acknowledgement = + new ContentAnalysisAcknowledgement( + nsIContentAnalysisAcknowledgement::Result::eSuccess, + ConvertResult(action)); + entry->mResponse->Acknowledge(acknowledgement); + } + nsMainThreadPtrHandle<nsIContentAnalysisCallback> callbackHolder = + entry->mCallbackData.TakeCallbackHolder(); + if (callbackHolder) { + RefPtr<ContentAnalysisResponse> response = + ContentAnalysisResponse::FromAction(action, requestToken); + response->SetOwner(self); + callbackHolder.get()->ContentResult(response.get()); + } else { + LOGD( + "Content analysis had no callback to send warn final response " + "to for request %s", + requestToken.get()); + } + })); + return NS_OK; +} + +NS_IMETHODIMP +ContentAnalysisResponse::Acknowledge( + nsIContentAnalysisAcknowledgement* aAcknowledgement) { + MOZ_ASSERT(mOwner); + if (mHasAcknowledged) { + MOZ_ASSERT(false, "Already acknowledged this ContentAnalysisResponse!"); + return NS_ERROR_FAILURE; + } + mHasAcknowledged = true; + return mOwner->RunAcknowledgeTask(aAcknowledgement, mRequestToken); +}; + +nsresult ContentAnalysis::RunAcknowledgeTask( + nsIContentAnalysisAcknowledgement* aAcknowledgement, + const nsACString& aRequestToken) { + bool isActive; + nsresult rv = GetIsActive(&isActive); + NS_ENSURE_SUCCESS(rv, rv); + if (!isActive) { + return NS_ERROR_NOT_AVAILABLE; + } + + content_analysis::sdk::ContentAnalysisAcknowledgement pbAck; + rv = ConvertToProtobuf(aAcknowledgement, aRequestToken, &pbAck); + NS_ENSURE_SUCCESS(rv, rv); + + LOGD("Issuing ContentAnalysisAcknowledgement"); + LogAcknowledgement(&pbAck); + + // The content analysis connection is synchronous so run in the background. + LOGD("RunAcknowledgeTask dispatching acknowledge task"); + mCaClientPromise->Then( + GetCurrentSerialEventTarget(), __func__, + [pbAck = std::move(pbAck)]( + std::shared_ptr<content_analysis::sdk::Client> client) mutable { + NS_DispatchBackgroundTask( + NS_NewCancelableRunnableFunction( + __func__, + [pbAck = std::move(pbAck), + client = std::move(client)]() mutable { + RefPtr<ContentAnalysis> owner = + GetContentAnalysisFromService(); + if (!owner) { + // May be shutting down + return; + } + if (!client) { + return; + } + + int err = client->Acknowledge(pbAck); + MOZ_ASSERT(err == 0); + LOGD( + "RunAcknowledgeTask sent transaction acknowledgement, " + "err=%d", + err); + }), + NS_DISPATCH_EVENT_MAY_BLOCK); + }, + [](nsresult rv) { LOGD("RunAcknowledgeTask failed to get the client"); }); + return rv; +} + +NS_IMETHODIMP ContentAnalysisCallback::ContentResult( + nsIContentAnalysisResponse* aResponse) { + if (mPromise.isSome()) { + mPromise->get()->MaybeResolve(aResponse); + } else { + mContentResponseCallback(aResponse); + } + return NS_OK; +} + +NS_IMETHODIMP ContentAnalysisCallback::Error(nsresult aError) { + if (mPromise.isSome()) { + mPromise->get()->MaybeReject(aError); + } else { + mErrorCallback(aError); + } + return NS_OK; +} + +ContentAnalysisCallback::ContentAnalysisCallback(RefPtr<dom::Promise> aPromise) + : mPromise(Some(new nsMainThreadPtrHolder<dom::Promise>( + "content analysis promise", aPromise))) {} + +#undef LOGD +#undef LOGE +} // namespace mozilla::contentanalysis diff --git a/toolkit/components/contentanalysis/ContentAnalysis.h b/toolkit/components/contentanalysis/ContentAnalysis.h new file mode 100644 index 0000000000..4579a7113d --- /dev/null +++ b/toolkit/components/contentanalysis/ContentAnalysis.h @@ -0,0 +1,233 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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 mozilla_contentanalysis_h +#define mozilla_contentanalysis_h + +#include "mozilla/DataMutex.h" +#include "mozilla/dom/WindowGlobalParent.h" +#include "nsIContentAnalysis.h" +#include "nsProxyRelease.h" +#include "nsString.h" +#include "nsTHashMap.h" + +#include <atomic> +#include <string> + +namespace content_analysis::sdk { +class Client; +class ContentAnalysisRequest; +class ContentAnalysisResponse; +} // namespace content_analysis::sdk + +namespace mozilla::contentanalysis { + +class ContentAnalysisRequest final : public nsIContentAnalysisRequest { + public: + NS_DECL_ISUPPORTS + NS_DECL_NSICONTENTANALYSISREQUEST + + ContentAnalysisRequest(AnalysisType aAnalysisType, nsString aString, + bool aStringIsFilePath, nsCString aSha256Digest, + nsCOMPtr<nsIURI> aUrl, OperationType aOperationType, + dom::WindowGlobalParent* aWindowGlobalParent); + static nsresult GetFileDigest(const nsAString& aFilePath, + nsCString& aDigestString); + + private: + ~ContentAnalysisRequest() = default; + // Remove unneeded copy constructor/assignment + ContentAnalysisRequest(const ContentAnalysisRequest&) = delete; + ContentAnalysisRequest& operator=(ContentAnalysisRequest&) = delete; + + // See nsIContentAnalysisRequest for values + AnalysisType mAnalysisType; + + // Text content to analyze. Only one of textContent or filePath is defined. + nsString mTextContent; + + // Name of file to analyze. Only one of textContent or filePath is defined. + nsString mFilePath; + + // The URL containing the file download/upload or to which web content is + // being uploaded. + nsCOMPtr<nsIURI> mUrl; + + // Sha256 digest of file. + nsCString mSha256Digest; + + // URLs involved in the download. + nsTArray<RefPtr<nsIClientDownloadResource>> mResources; + + // Email address of user. + nsString mEmail; + + // Unique identifier for this request + nsCString mRequestToken; + + // Type of text to display, see nsIContentAnalysisRequest for values + OperationType mOperationTypeForDisplay; + + // String to display if mOperationTypeForDisplay is + // OPERATION_CUSTOMDISPLAYSTRING + nsString mOperationDisplayString; + + RefPtr<dom::WindowGlobalParent> mWindowGlobalParent; +}; + +#define CONTENTANALYSIS_IID \ + { \ + 0xa37bed74, 0x4b50, 0x443a, { \ + 0xbf, 0x58, 0xf4, 0xeb, 0xbd, 0x30, 0x67, 0xb4 \ + } \ + } + +class ContentAnalysisResponse; +class ContentAnalysis final : public nsIContentAnalysis { + public: + NS_DECLARE_STATIC_IID_ACCESSOR(CONTENTANALYSIS_IID) + NS_DECL_THREADSAFE_ISUPPORTS + NS_DECL_NSICONTENTANALYSIS + + ContentAnalysis(); + + private: + ~ContentAnalysis(); + // Remove unneeded copy constructor/assignment + ContentAnalysis(const ContentAnalysis&) = delete; + ContentAnalysis& operator=(ContentAnalysis&) = delete; + nsresult CreateContentAnalysisClient(nsCString&& aPipePathName, + bool aIsPerUser); + nsresult RunAnalyzeRequestTask( + const RefPtr<nsIContentAnalysisRequest>& aRequest, bool aAutoAcknowledge, + const RefPtr<nsIContentAnalysisCallback>& aCallback); + nsresult RunAcknowledgeTask( + nsIContentAnalysisAcknowledgement* aAcknowledgement, + const nsACString& aRequestToken); + nsresult CancelWithError(nsCString aRequestToken, nsresult aResult); + static RefPtr<ContentAnalysis> GetContentAnalysisFromService(); + static void DoAnalyzeRequest( + nsCString aRequestToken, + content_analysis::sdk::ContentAnalysisRequest&& aRequest, + const std::shared_ptr<content_analysis::sdk::Client>& aClient); + + using ClientPromise = + MozPromise<std::shared_ptr<content_analysis::sdk::Client>, nsresult, + false>; + RefPtr<ClientPromise::Private> mCaClientPromise; + // Only accessed from the main thread + bool mClientCreationAttempted; + + class CallbackData final { + public: + CallbackData( + nsMainThreadPtrHandle<nsIContentAnalysisCallback>&& aCallbackHolder, + bool aAutoAcknowledge) + : mCallbackHolder(aCallbackHolder), + mAutoAcknowledge(aAutoAcknowledge) {} + + nsMainThreadPtrHandle<nsIContentAnalysisCallback> TakeCallbackHolder() { + return std::move(mCallbackHolder); + } + bool AutoAcknowledge() const { return mAutoAcknowledge; } + void SetCanceled() { mCallbackHolder = nullptr; } + bool Canceled() const { return !mCallbackHolder; } + + private: + nsMainThreadPtrHandle<nsIContentAnalysisCallback> mCallbackHolder; + bool mAutoAcknowledge; + }; + DataMutex<nsTHashMap<nsCString, CallbackData>> mCallbackMap; + + struct WarnResponseData { + WarnResponseData(CallbackData&& aCallbackData, + RefPtr<ContentAnalysisResponse> aResponse) + : mCallbackData(std::move(aCallbackData)), mResponse(aResponse) {} + ContentAnalysis::CallbackData mCallbackData; + RefPtr<ContentAnalysisResponse> mResponse; + }; + DataMutex<nsTHashMap<nsCString, WarnResponseData>> mWarnResponseDataMap; + + friend class ContentAnalysisResponse; +}; + +NS_DEFINE_STATIC_IID_ACCESSOR(ContentAnalysis, CONTENTANALYSIS_IID) + +class ContentAnalysisResponse final : public nsIContentAnalysisResponse { + public: + NS_DECL_ISUPPORTS + NS_DECL_NSICONTENTANALYSISRESPONSE + + static RefPtr<ContentAnalysisResponse> FromAction( + Action aAction, const nsACString& aRequestToken); + + void SetOwner(RefPtr<ContentAnalysis> aOwner); + + private: + ~ContentAnalysisResponse() = default; + // Remove unneeded copy constructor/assignment + ContentAnalysisResponse(const ContentAnalysisResponse&) = delete; + ContentAnalysisResponse& operator=(ContentAnalysisResponse&) = delete; + explicit ContentAnalysisResponse( + content_analysis::sdk::ContentAnalysisResponse&& aResponse); + ContentAnalysisResponse(Action aAction, const nsACString& aRequestToken); + static already_AddRefed<ContentAnalysisResponse> FromProtobuf( + content_analysis::sdk::ContentAnalysisResponse&& aResponse); + + void ResolveWarnAction(bool aAllowContent); + + // Action requested by the agent + Action mAction; + + // Identifier for the corresponding nsIContentAnalysisRequest + nsCString mRequestToken; + + // ContentAnalysis (or, more precisely, it's Client object) must outlive + // the transaction. + RefPtr<ContentAnalysis> mOwner; + + // Whether the response has been acknowledged + bool mHasAcknowledged; + + friend class ContentAnalysis; +}; + +class ContentAnalysisAcknowledgement final + : public nsIContentAnalysisAcknowledgement { + public: + NS_DECL_THREADSAFE_ISUPPORTS + NS_DECL_NSICONTENTANALYSISACKNOWLEDGEMENT + + ContentAnalysisAcknowledgement(Result aResult, FinalAction aFinalAction); + + private: + ~ContentAnalysisAcknowledgement() = default; + + Result mResult; + FinalAction mFinalAction; +}; + +class ContentAnalysisCallback final : public nsIContentAnalysisCallback { + public: + NS_DECL_THREADSAFE_ISUPPORTS + NS_DECL_NSICONTENTANALYSISCALLBACK + ContentAnalysisCallback(std::function<void(nsIContentAnalysisResponse*)>&& + aContentResponseCallback, + std::function<void(nsresult)>&& aErrorCallback) + : mContentResponseCallback(std::move(aContentResponseCallback)), + mErrorCallback(std::move(aErrorCallback)) {} + + private: + ~ContentAnalysisCallback() = default; + explicit ContentAnalysisCallback(RefPtr<dom::Promise> aPromise); + std::function<void(nsIContentAnalysisResponse*)> mContentResponseCallback; + std::function<void(nsresult)> mErrorCallback; + Maybe<nsMainThreadPtrHandle<dom::Promise>> mPromise; + friend class ContentAnalysis; +}; + +} // namespace mozilla::contentanalysis + +#endif // mozilla_contentanalysis_h diff --git a/toolkit/components/contentanalysis/ContentAnalysisIPCTypes.h b/toolkit/components/contentanalysis/ContentAnalysisIPCTypes.h new file mode 100644 index 0000000000..a7cf812d0b --- /dev/null +++ b/toolkit/components/contentanalysis/ContentAnalysisIPCTypes.h @@ -0,0 +1,169 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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 mozilla_ContentAnalysisIPCTypes_h +#define mozilla_ContentAnalysisIPCTypes_h + +#include "ipc/EnumSerializer.h" +#include "ipc/IPCMessageUtilsSpecializations.h" +#include "js/PropertyAndElement.h" +#include "mozilla/Variant.h" +#include "nsIContentAnalysis.h" + +namespace mozilla { +namespace contentanalysis { + +enum class NoContentAnalysisResult : uint8_t { + CONTENT_ANALYSIS_NOT_ACTIVE, + CONTEXT_EXEMPT_FROM_CONTENT_ANALYSIS, + CANCELED, + ERROR_INVALID_JSON_RESPONSE, + ERROR_COULD_NOT_GET_DATA, + ERROR_OTHER, + LAST_VALUE +}; + +class ContentAnalysisResult : public nsIContentAnalysisResult { + NS_DECL_THREADSAFE_ISUPPORTS + NS_DECL_NSICONTENTANALYSISRESULT + public: + static RefPtr<ContentAnalysisResult> FromAction( + nsIContentAnalysisResponse::Action aAction) { + auto result = + RefPtr<ContentAnalysisResult>(new ContentAnalysisResult(aAction)); + return result; + } + + static RefPtr<ContentAnalysisResult> FromNoResult( + NoContentAnalysisResult aResult) { + auto result = + RefPtr<ContentAnalysisResult>(new ContentAnalysisResult(aResult)); + return result; + } + + static RefPtr<ContentAnalysisResult> FromJSONResponse( + const JS::Handle<JS::Value>& aValue, JSContext* aCx) { + if (aValue.isObject()) { + auto* obj = aValue.toObjectOrNull(); + JS::Handle<JSObject*> handle = + JS::Handle<JSObject*>::fromMarkedLocation(&obj); + JS::Rooted<JS::Value> actionValue(aCx); + if (JS_GetProperty(aCx, handle, "action", &actionValue)) { + if (actionValue.isNumber()) { + double actionNumber = actionValue.toNumber(); + return FromAction( + static_cast<nsIContentAnalysisResponse::Action>(actionNumber)); + } + } + } + return FromNoResult(NoContentAnalysisResult::ERROR_INVALID_JSON_RESPONSE); + } + + static RefPtr<ContentAnalysisResult> FromJSONContentAnalysisResponse( + const JS::Handle<JS::Value>& aValue, JSContext* aCx) { + if (aValue.isObject()) { + auto* obj = aValue.toObjectOrNull(); + JS::Handle<JSObject*> handle = + JS::Handle<JSObject*>::fromMarkedLocation(&obj); + JS::Rooted<JS::Value> shouldAllowValue(aCx); + if (JS_GetProperty(aCx, handle, "shouldAllowContent", + &shouldAllowValue)) { + if (shouldAllowValue.isTrue()) { + return FromAction(nsIContentAnalysisResponse::Action::eAllow); + } else if (shouldAllowValue.isFalse()) { + return FromAction(nsIContentAnalysisResponse::Action::eBlock); + } else { + return FromNoResult(NoContentAnalysisResult::ERROR_OTHER); + } + } + } + return FromNoResult(NoContentAnalysisResult::ERROR_INVALID_JSON_RESPONSE); + } + + static RefPtr<ContentAnalysisResult> FromContentAnalysisResponse( + nsIContentAnalysisResponse* aResponse) { + if (aResponse->GetShouldAllowContent()) { + return FromAction(nsIContentAnalysisResponse::Action::eAllow); + } else { + return FromAction(nsIContentAnalysisResponse::Action::eBlock); + } + } + + private: + explicit ContentAnalysisResult(nsIContentAnalysisResponse::Action aAction) + : mValue(aAction) {} + explicit ContentAnalysisResult(NoContentAnalysisResult aResult) + : mValue(aResult) {} + virtual ~ContentAnalysisResult() = default; + Variant<nsIContentAnalysisResponse::Action, NoContentAnalysisResult> mValue; + friend struct IPC::ParamTraits<ContentAnalysisResult>; + friend struct IPC::ParamTraits<ContentAnalysisResult*>; + friend struct IPC::ParamTraits<RefPtr<ContentAnalysisResult>>; +}; + +} // namespace contentanalysis +} // namespace mozilla + +namespace IPC { + +template <> +struct ParamTraits<mozilla::contentanalysis::NoContentAnalysisResult> + : public ContiguousEnumSerializer< + mozilla::contentanalysis::NoContentAnalysisResult, + static_cast<mozilla::contentanalysis::NoContentAnalysisResult>(0), + mozilla::contentanalysis::NoContentAnalysisResult::LAST_VALUE> {}; + +template <> +struct ParamTraits<nsIContentAnalysisResponse::Action> + : public ContiguousEnumSerializerInclusive< + nsIContentAnalysisResponse::Action, + nsIContentAnalysisResponse::Action::eUnspecified, + nsIContentAnalysisResponse::Action::eCanceled> {}; + +template <> +struct ParamTraits<mozilla::contentanalysis::ContentAnalysisResult> { + typedef mozilla::contentanalysis::ContentAnalysisResult paramType; + + static void Write(MessageWriter* aWriter, const paramType& aParam) { + WriteParam(aWriter, aParam.mValue); + } + + static bool Read(MessageReader* aReader, paramType* aResult) { + return ReadParam(aReader, &(aResult->mValue)); + } +}; + +template <> +struct ParamTraits<mozilla::contentanalysis::ContentAnalysisResult*> { + typedef mozilla::contentanalysis::ContentAnalysisResult paramType; + + static void Write(MessageWriter* aWriter, const paramType* aParam) { + if (!aParam) { + WriteParam(aWriter, true); + return; + } + WriteParam(aWriter, false); + WriteParam(aWriter, aParam->mValue); + } + + static bool Read(MessageReader* aReader, RefPtr<paramType>* aResult) { + bool isNull = false; + if (!ReadParam(aReader, &isNull)) { + return false; + } + if (isNull) { + *aResult = nullptr; + return true; + } + *aResult = mozilla::contentanalysis::ContentAnalysisResult::FromNoResult( + mozilla::contentanalysis::NoContentAnalysisResult::ERROR_OTHER); + return ReadParam(aReader, &((*aResult)->mValue)); + } +}; + +} // namespace IPC + +#endif // mozilla_ContentAnalysisIPCTypes_h diff --git a/toolkit/components/contentanalysis/components.conf b/toolkit/components/contentanalysis/components.conf new file mode 100644 index 0000000000..82236cb1b9 --- /dev/null +++ b/toolkit/components/contentanalysis/components.conf @@ -0,0 +1,15 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +Classes = [ + { + 'name': 'nsIContentAnalysis', + 'cid': '{61497587-2bba-4a88-acd3-3fbb2cedf163}', + 'contract_ids': ['@mozilla.org/contentanalysis;1'], + 'type': 'mozilla::contentanalysis::ContentAnalysis', + 'headers': ['/toolkit/components/contentanalysis/ContentAnalysis.h'], + }, +] diff --git a/toolkit/components/contentanalysis/content_analysis/sdk/analysis.pb.cc b/toolkit/components/contentanalysis/content_analysis/sdk/analysis.pb.cc new file mode 100644 index 0000000000..6a2e1ccf46 --- /dev/null +++ b/toolkit/components/contentanalysis/content_analysis/sdk/analysis.pb.cc @@ -0,0 +1,5263 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: analysis.proto + +#include "analysis.pb.h" + +#include <algorithm> + +#include <google/protobuf/io/coded_stream.h> +#include <google/protobuf/extension_set.h> +#include <google/protobuf/wire_format_lite.h> +#include <google/protobuf/io/zero_copy_stream_impl_lite.h> +// @@protoc_insertion_point(includes) +#include <google/protobuf/port_def.inc> + +PROTOBUF_PRAGMA_INIT_SEG + +namespace _pb = ::PROTOBUF_NAMESPACE_ID; +namespace _pbi = _pb::internal; + +namespace content_analysis { +namespace sdk { +PROTOBUF_CONSTEXPR ContentMetaData_PrintMetadata::ContentMetaData_PrintMetadata( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_._has_bits_)*/{} + , /*decltype(_impl_._cached_size_)*/{} + , /*decltype(_impl_.printer_name_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} + , /*decltype(_impl_.printer_type_)*/0} {} +struct ContentMetaData_PrintMetadataDefaultTypeInternal { + PROTOBUF_CONSTEXPR ContentMetaData_PrintMetadataDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~ContentMetaData_PrintMetadataDefaultTypeInternal() {} + union { + ContentMetaData_PrintMetadata _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ContentMetaData_PrintMetadataDefaultTypeInternal _ContentMetaData_PrintMetadata_default_instance_; +PROTOBUF_CONSTEXPR ContentMetaData::ContentMetaData( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_._has_bits_)*/{} + , /*decltype(_impl_._cached_size_)*/{} + , /*decltype(_impl_.url_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} + , /*decltype(_impl_.filename_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} + , /*decltype(_impl_.digest_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} + , /*decltype(_impl_.email_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} + , /*decltype(_impl_.tab_title_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} + , /*decltype(_impl_.csd_)*/nullptr + , /*decltype(_impl_.print_metadata_)*/nullptr} {} +struct ContentMetaDataDefaultTypeInternal { + PROTOBUF_CONSTEXPR ContentMetaDataDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~ContentMetaDataDefaultTypeInternal() {} + union { + ContentMetaData _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ContentMetaDataDefaultTypeInternal _ContentMetaData_default_instance_; +PROTOBUF_CONSTEXPR ClientMetadata_Browser::ClientMetadata_Browser( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_._has_bits_)*/{} + , /*decltype(_impl_._cached_size_)*/{} + , /*decltype(_impl_.machine_user_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}} {} +struct ClientMetadata_BrowserDefaultTypeInternal { + PROTOBUF_CONSTEXPR ClientMetadata_BrowserDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~ClientMetadata_BrowserDefaultTypeInternal() {} + union { + ClientMetadata_Browser _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ClientMetadata_BrowserDefaultTypeInternal _ClientMetadata_Browser_default_instance_; +PROTOBUF_CONSTEXPR ClientMetadata::ClientMetadata( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_._has_bits_)*/{} + , /*decltype(_impl_._cached_size_)*/{} + , /*decltype(_impl_.browser_)*/nullptr} {} +struct ClientMetadataDefaultTypeInternal { + PROTOBUF_CONSTEXPR ClientMetadataDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~ClientMetadataDefaultTypeInternal() {} + union { + ClientMetadata _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ClientMetadataDefaultTypeInternal _ClientMetadata_default_instance_; +PROTOBUF_CONSTEXPR ClientDownloadRequest_Resource::ClientDownloadRequest_Resource( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_._has_bits_)*/{} + , /*decltype(_impl_._cached_size_)*/{} + , /*decltype(_impl_.url_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} + , /*decltype(_impl_.type_)*/0} {} +struct ClientDownloadRequest_ResourceDefaultTypeInternal { + PROTOBUF_CONSTEXPR ClientDownloadRequest_ResourceDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~ClientDownloadRequest_ResourceDefaultTypeInternal() {} + union { + ClientDownloadRequest_Resource _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ClientDownloadRequest_ResourceDefaultTypeInternal _ClientDownloadRequest_Resource_default_instance_; +PROTOBUF_CONSTEXPR ClientDownloadRequest::ClientDownloadRequest( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_.resources_)*/{} + , /*decltype(_impl_._cached_size_)*/{}} {} +struct ClientDownloadRequestDefaultTypeInternal { + PROTOBUF_CONSTEXPR ClientDownloadRequestDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~ClientDownloadRequestDefaultTypeInternal() {} + union { + ClientDownloadRequest _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ClientDownloadRequestDefaultTypeInternal _ClientDownloadRequest_default_instance_; +PROTOBUF_CONSTEXPR ContentAnalysisRequest_PrintData::ContentAnalysisRequest_PrintData( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_._has_bits_)*/{} + , /*decltype(_impl_._cached_size_)*/{} + , /*decltype(_impl_.handle_)*/int64_t{0} + , /*decltype(_impl_.size_)*/int64_t{0}} {} +struct ContentAnalysisRequest_PrintDataDefaultTypeInternal { + PROTOBUF_CONSTEXPR ContentAnalysisRequest_PrintDataDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~ContentAnalysisRequest_PrintDataDefaultTypeInternal() {} + union { + ContentAnalysisRequest_PrintData _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ContentAnalysisRequest_PrintDataDefaultTypeInternal _ContentAnalysisRequest_PrintData_default_instance_; +PROTOBUF_CONSTEXPR ContentAnalysisRequest::ContentAnalysisRequest( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_._has_bits_)*/{} + , /*decltype(_impl_._cached_size_)*/{} + , /*decltype(_impl_.tags_)*/{} + , /*decltype(_impl_.request_token_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} + , /*decltype(_impl_.user_action_id_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} + , /*decltype(_impl_.request_data_)*/nullptr + , /*decltype(_impl_.client_metadata_)*/nullptr + , /*decltype(_impl_.expires_at_)*/int64_t{0} + , /*decltype(_impl_.user_action_requests_count_)*/int64_t{0} + , /*decltype(_impl_.analysis_connector_)*/0 + , /*decltype(_impl_.content_data_)*/{} + , /*decltype(_impl_._oneof_case_)*/{}} {} +struct ContentAnalysisRequestDefaultTypeInternal { + PROTOBUF_CONSTEXPR ContentAnalysisRequestDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~ContentAnalysisRequestDefaultTypeInternal() {} + union { + ContentAnalysisRequest _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ContentAnalysisRequestDefaultTypeInternal _ContentAnalysisRequest_default_instance_; +PROTOBUF_CONSTEXPR ContentAnalysisResponse_Result_TriggeredRule::ContentAnalysisResponse_Result_TriggeredRule( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_._has_bits_)*/{} + , /*decltype(_impl_._cached_size_)*/{} + , /*decltype(_impl_.rule_name_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} + , /*decltype(_impl_.rule_id_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} + , /*decltype(_impl_.action_)*/0} {} +struct ContentAnalysisResponse_Result_TriggeredRuleDefaultTypeInternal { + PROTOBUF_CONSTEXPR ContentAnalysisResponse_Result_TriggeredRuleDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~ContentAnalysisResponse_Result_TriggeredRuleDefaultTypeInternal() {} + union { + ContentAnalysisResponse_Result_TriggeredRule _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ContentAnalysisResponse_Result_TriggeredRuleDefaultTypeInternal _ContentAnalysisResponse_Result_TriggeredRule_default_instance_; +PROTOBUF_CONSTEXPR ContentAnalysisResponse_Result::ContentAnalysisResponse_Result( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_._has_bits_)*/{} + , /*decltype(_impl_._cached_size_)*/{} + , /*decltype(_impl_.triggered_rules_)*/{} + , /*decltype(_impl_.tag_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} + , /*decltype(_impl_.status_)*/0} {} +struct ContentAnalysisResponse_ResultDefaultTypeInternal { + PROTOBUF_CONSTEXPR ContentAnalysisResponse_ResultDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~ContentAnalysisResponse_ResultDefaultTypeInternal() {} + union { + ContentAnalysisResponse_Result _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ContentAnalysisResponse_ResultDefaultTypeInternal _ContentAnalysisResponse_Result_default_instance_; +PROTOBUF_CONSTEXPR ContentAnalysisResponse::ContentAnalysisResponse( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_._has_bits_)*/{} + , /*decltype(_impl_._cached_size_)*/{} + , /*decltype(_impl_.results_)*/{} + , /*decltype(_impl_.request_token_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}} {} +struct ContentAnalysisResponseDefaultTypeInternal { + PROTOBUF_CONSTEXPR ContentAnalysisResponseDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~ContentAnalysisResponseDefaultTypeInternal() {} + union { + ContentAnalysisResponse _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ContentAnalysisResponseDefaultTypeInternal _ContentAnalysisResponse_default_instance_; +PROTOBUF_CONSTEXPR ContentAnalysisAcknowledgement::ContentAnalysisAcknowledgement( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_._has_bits_)*/{} + , /*decltype(_impl_._cached_size_)*/{} + , /*decltype(_impl_.request_token_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} + , /*decltype(_impl_.final_action_)*/0 + , /*decltype(_impl_.status_)*/1} {} +struct ContentAnalysisAcknowledgementDefaultTypeInternal { + PROTOBUF_CONSTEXPR ContentAnalysisAcknowledgementDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~ContentAnalysisAcknowledgementDefaultTypeInternal() {} + union { + ContentAnalysisAcknowledgement _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ContentAnalysisAcknowledgementDefaultTypeInternal _ContentAnalysisAcknowledgement_default_instance_; +PROTOBUF_CONSTEXPR ContentAnalysisCancelRequests::ContentAnalysisCancelRequests( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_._has_bits_)*/{} + , /*decltype(_impl_._cached_size_)*/{} + , /*decltype(_impl_.user_action_id_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}} {} +struct ContentAnalysisCancelRequestsDefaultTypeInternal { + PROTOBUF_CONSTEXPR ContentAnalysisCancelRequestsDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~ContentAnalysisCancelRequestsDefaultTypeInternal() {} + union { + ContentAnalysisCancelRequests _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ContentAnalysisCancelRequestsDefaultTypeInternal _ContentAnalysisCancelRequests_default_instance_; +PROTOBUF_CONSTEXPR ChromeToAgent::ChromeToAgent( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_._has_bits_)*/{} + , /*decltype(_impl_._cached_size_)*/{} + , /*decltype(_impl_.request_)*/nullptr + , /*decltype(_impl_.ack_)*/nullptr + , /*decltype(_impl_.cancel_)*/nullptr} {} +struct ChromeToAgentDefaultTypeInternal { + PROTOBUF_CONSTEXPR ChromeToAgentDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~ChromeToAgentDefaultTypeInternal() {} + union { + ChromeToAgent _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ChromeToAgentDefaultTypeInternal _ChromeToAgent_default_instance_; +PROTOBUF_CONSTEXPR AgentToChrome::AgentToChrome( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_._has_bits_)*/{} + , /*decltype(_impl_._cached_size_)*/{} + , /*decltype(_impl_.response_)*/nullptr} {} +struct AgentToChromeDefaultTypeInternal { + PROTOBUF_CONSTEXPR AgentToChromeDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~AgentToChromeDefaultTypeInternal() {} + union { + AgentToChrome _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 AgentToChromeDefaultTypeInternal _AgentToChrome_default_instance_; +} // namespace sdk +} // namespace content_analysis +namespace content_analysis { +namespace sdk { +bool ContentMetaData_PrintMetadata_PrinterType_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + return true; + default: + return false; + } +} + +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<std::string> ContentMetaData_PrintMetadata_PrinterType_strings[3] = {}; + +static const char ContentMetaData_PrintMetadata_PrinterType_names[] = + "CLOUD" + "LOCAL" + "UNKNOWN"; + +static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry ContentMetaData_PrintMetadata_PrinterType_entries[] = { + { {ContentMetaData_PrintMetadata_PrinterType_names + 0, 5}, 1 }, + { {ContentMetaData_PrintMetadata_PrinterType_names + 5, 5}, 2 }, + { {ContentMetaData_PrintMetadata_PrinterType_names + 10, 7}, 0 }, +}; + +static const int ContentMetaData_PrintMetadata_PrinterType_entries_by_number[] = { + 2, // 0 -> UNKNOWN + 0, // 1 -> CLOUD + 1, // 2 -> LOCAL +}; + +const std::string& ContentMetaData_PrintMetadata_PrinterType_Name( + ContentMetaData_PrintMetadata_PrinterType value) { + static const bool dummy = + ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( + ContentMetaData_PrintMetadata_PrinterType_entries, + ContentMetaData_PrintMetadata_PrinterType_entries_by_number, + 3, ContentMetaData_PrintMetadata_PrinterType_strings); + (void) dummy; + int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( + ContentMetaData_PrintMetadata_PrinterType_entries, + ContentMetaData_PrintMetadata_PrinterType_entries_by_number, + 3, value); + return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : + ContentMetaData_PrintMetadata_PrinterType_strings[idx].get(); +} +bool ContentMetaData_PrintMetadata_PrinterType_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ContentMetaData_PrintMetadata_PrinterType* value) { + int int_value; + bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( + ContentMetaData_PrintMetadata_PrinterType_entries, 3, name, &int_value); + if (success) { + *value = static_cast<ContentMetaData_PrintMetadata_PrinterType>(int_value); + } + return success; +} +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +constexpr ContentMetaData_PrintMetadata_PrinterType ContentMetaData_PrintMetadata::UNKNOWN; +constexpr ContentMetaData_PrintMetadata_PrinterType ContentMetaData_PrintMetadata::CLOUD; +constexpr ContentMetaData_PrintMetadata_PrinterType ContentMetaData_PrintMetadata::LOCAL; +constexpr ContentMetaData_PrintMetadata_PrinterType ContentMetaData_PrintMetadata::PrinterType_MIN; +constexpr ContentMetaData_PrintMetadata_PrinterType ContentMetaData_PrintMetadata::PrinterType_MAX; +constexpr int ContentMetaData_PrintMetadata::PrinterType_ARRAYSIZE; +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +bool ClientDownloadRequest_ResourceType_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + return true; + default: + return false; + } +} + +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<std::string> ClientDownloadRequest_ResourceType_strings[6] = {}; + +static const char ClientDownloadRequest_ResourceType_names[] = + "DOWNLOAD_REDIRECT" + "DOWNLOAD_URL" + "PPAPI_DOCUMENT" + "PPAPI_PLUGIN" + "TAB_REDIRECT" + "TAB_URL"; + +static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry ClientDownloadRequest_ResourceType_entries[] = { + { {ClientDownloadRequest_ResourceType_names + 0, 17}, 1 }, + { {ClientDownloadRequest_ResourceType_names + 17, 12}, 0 }, + { {ClientDownloadRequest_ResourceType_names + 29, 14}, 4 }, + { {ClientDownloadRequest_ResourceType_names + 43, 12}, 5 }, + { {ClientDownloadRequest_ResourceType_names + 55, 12}, 3 }, + { {ClientDownloadRequest_ResourceType_names + 67, 7}, 2 }, +}; + +static const int ClientDownloadRequest_ResourceType_entries_by_number[] = { + 1, // 0 -> DOWNLOAD_URL + 0, // 1 -> DOWNLOAD_REDIRECT + 5, // 2 -> TAB_URL + 4, // 3 -> TAB_REDIRECT + 2, // 4 -> PPAPI_DOCUMENT + 3, // 5 -> PPAPI_PLUGIN +}; + +const std::string& ClientDownloadRequest_ResourceType_Name( + ClientDownloadRequest_ResourceType value) { + static const bool dummy = + ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( + ClientDownloadRequest_ResourceType_entries, + ClientDownloadRequest_ResourceType_entries_by_number, + 6, ClientDownloadRequest_ResourceType_strings); + (void) dummy; + int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( + ClientDownloadRequest_ResourceType_entries, + ClientDownloadRequest_ResourceType_entries_by_number, + 6, value); + return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : + ClientDownloadRequest_ResourceType_strings[idx].get(); +} +bool ClientDownloadRequest_ResourceType_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ClientDownloadRequest_ResourceType* value) { + int int_value; + bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( + ClientDownloadRequest_ResourceType_entries, 6, name, &int_value); + if (success) { + *value = static_cast<ClientDownloadRequest_ResourceType>(int_value); + } + return success; +} +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +constexpr ClientDownloadRequest_ResourceType ClientDownloadRequest::DOWNLOAD_URL; +constexpr ClientDownloadRequest_ResourceType ClientDownloadRequest::DOWNLOAD_REDIRECT; +constexpr ClientDownloadRequest_ResourceType ClientDownloadRequest::TAB_URL; +constexpr ClientDownloadRequest_ResourceType ClientDownloadRequest::TAB_REDIRECT; +constexpr ClientDownloadRequest_ResourceType ClientDownloadRequest::PPAPI_DOCUMENT; +constexpr ClientDownloadRequest_ResourceType ClientDownloadRequest::PPAPI_PLUGIN; +constexpr ClientDownloadRequest_ResourceType ClientDownloadRequest::ResourceType_MIN; +constexpr ClientDownloadRequest_ResourceType ClientDownloadRequest::ResourceType_MAX; +constexpr int ClientDownloadRequest::ResourceType_ARRAYSIZE; +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +bool ContentAnalysisResponse_Result_TriggeredRule_Action_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + case 3: + return true; + default: + return false; + } +} + +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<std::string> ContentAnalysisResponse_Result_TriggeredRule_Action_strings[4] = {}; + +static const char ContentAnalysisResponse_Result_TriggeredRule_Action_names[] = + "ACTION_UNSPECIFIED" + "BLOCK" + "REPORT_ONLY" + "WARN"; + +static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry ContentAnalysisResponse_Result_TriggeredRule_Action_entries[] = { + { {ContentAnalysisResponse_Result_TriggeredRule_Action_names + 0, 18}, 0 }, + { {ContentAnalysisResponse_Result_TriggeredRule_Action_names + 18, 5}, 3 }, + { {ContentAnalysisResponse_Result_TriggeredRule_Action_names + 23, 11}, 1 }, + { {ContentAnalysisResponse_Result_TriggeredRule_Action_names + 34, 4}, 2 }, +}; + +static const int ContentAnalysisResponse_Result_TriggeredRule_Action_entries_by_number[] = { + 0, // 0 -> ACTION_UNSPECIFIED + 2, // 1 -> REPORT_ONLY + 3, // 2 -> WARN + 1, // 3 -> BLOCK +}; + +const std::string& ContentAnalysisResponse_Result_TriggeredRule_Action_Name( + ContentAnalysisResponse_Result_TriggeredRule_Action value) { + static const bool dummy = + ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( + ContentAnalysisResponse_Result_TriggeredRule_Action_entries, + ContentAnalysisResponse_Result_TriggeredRule_Action_entries_by_number, + 4, ContentAnalysisResponse_Result_TriggeredRule_Action_strings); + (void) dummy; + int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( + ContentAnalysisResponse_Result_TriggeredRule_Action_entries, + ContentAnalysisResponse_Result_TriggeredRule_Action_entries_by_number, + 4, value); + return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : + ContentAnalysisResponse_Result_TriggeredRule_Action_strings[idx].get(); +} +bool ContentAnalysisResponse_Result_TriggeredRule_Action_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ContentAnalysisResponse_Result_TriggeredRule_Action* value) { + int int_value; + bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( + ContentAnalysisResponse_Result_TriggeredRule_Action_entries, 4, name, &int_value); + if (success) { + *value = static_cast<ContentAnalysisResponse_Result_TriggeredRule_Action>(int_value); + } + return success; +} +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +constexpr ContentAnalysisResponse_Result_TriggeredRule_Action ContentAnalysisResponse_Result_TriggeredRule::ACTION_UNSPECIFIED; +constexpr ContentAnalysisResponse_Result_TriggeredRule_Action ContentAnalysisResponse_Result_TriggeredRule::REPORT_ONLY; +constexpr ContentAnalysisResponse_Result_TriggeredRule_Action ContentAnalysisResponse_Result_TriggeredRule::WARN; +constexpr ContentAnalysisResponse_Result_TriggeredRule_Action ContentAnalysisResponse_Result_TriggeredRule::BLOCK; +constexpr ContentAnalysisResponse_Result_TriggeredRule_Action ContentAnalysisResponse_Result_TriggeredRule::Action_MIN; +constexpr ContentAnalysisResponse_Result_TriggeredRule_Action ContentAnalysisResponse_Result_TriggeredRule::Action_MAX; +constexpr int ContentAnalysisResponse_Result_TriggeredRule::Action_ARRAYSIZE; +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +bool ContentAnalysisResponse_Result_Status_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + return true; + default: + return false; + } +} + +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<std::string> ContentAnalysisResponse_Result_Status_strings[3] = {}; + +static const char ContentAnalysisResponse_Result_Status_names[] = + "FAILURE" + "STATUS_UNKNOWN" + "SUCCESS"; + +static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry ContentAnalysisResponse_Result_Status_entries[] = { + { {ContentAnalysisResponse_Result_Status_names + 0, 7}, 2 }, + { {ContentAnalysisResponse_Result_Status_names + 7, 14}, 0 }, + { {ContentAnalysisResponse_Result_Status_names + 21, 7}, 1 }, +}; + +static const int ContentAnalysisResponse_Result_Status_entries_by_number[] = { + 1, // 0 -> STATUS_UNKNOWN + 2, // 1 -> SUCCESS + 0, // 2 -> FAILURE +}; + +const std::string& ContentAnalysisResponse_Result_Status_Name( + ContentAnalysisResponse_Result_Status value) { + static const bool dummy = + ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( + ContentAnalysisResponse_Result_Status_entries, + ContentAnalysisResponse_Result_Status_entries_by_number, + 3, ContentAnalysisResponse_Result_Status_strings); + (void) dummy; + int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( + ContentAnalysisResponse_Result_Status_entries, + ContentAnalysisResponse_Result_Status_entries_by_number, + 3, value); + return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : + ContentAnalysisResponse_Result_Status_strings[idx].get(); +} +bool ContentAnalysisResponse_Result_Status_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ContentAnalysisResponse_Result_Status* value) { + int int_value; + bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( + ContentAnalysisResponse_Result_Status_entries, 3, name, &int_value); + if (success) { + *value = static_cast<ContentAnalysisResponse_Result_Status>(int_value); + } + return success; +} +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +constexpr ContentAnalysisResponse_Result_Status ContentAnalysisResponse_Result::STATUS_UNKNOWN; +constexpr ContentAnalysisResponse_Result_Status ContentAnalysisResponse_Result::SUCCESS; +constexpr ContentAnalysisResponse_Result_Status ContentAnalysisResponse_Result::FAILURE; +constexpr ContentAnalysisResponse_Result_Status ContentAnalysisResponse_Result::Status_MIN; +constexpr ContentAnalysisResponse_Result_Status ContentAnalysisResponse_Result::Status_MAX; +constexpr int ContentAnalysisResponse_Result::Status_ARRAYSIZE; +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +bool ContentAnalysisAcknowledgement_Status_IsValid(int value) { + switch (value) { + case 1: + case 2: + case 3: + return true; + default: + return false; + } +} + +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<std::string> ContentAnalysisAcknowledgement_Status_strings[3] = {}; + +static const char ContentAnalysisAcknowledgement_Status_names[] = + "INVALID_RESPONSE" + "SUCCESS" + "TOO_LATE"; + +static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry ContentAnalysisAcknowledgement_Status_entries[] = { + { {ContentAnalysisAcknowledgement_Status_names + 0, 16}, 2 }, + { {ContentAnalysisAcknowledgement_Status_names + 16, 7}, 1 }, + { {ContentAnalysisAcknowledgement_Status_names + 23, 8}, 3 }, +}; + +static const int ContentAnalysisAcknowledgement_Status_entries_by_number[] = { + 1, // 1 -> SUCCESS + 0, // 2 -> INVALID_RESPONSE + 2, // 3 -> TOO_LATE +}; + +const std::string& ContentAnalysisAcknowledgement_Status_Name( + ContentAnalysisAcknowledgement_Status value) { + static const bool dummy = + ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( + ContentAnalysisAcknowledgement_Status_entries, + ContentAnalysisAcknowledgement_Status_entries_by_number, + 3, ContentAnalysisAcknowledgement_Status_strings); + (void) dummy; + int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( + ContentAnalysisAcknowledgement_Status_entries, + ContentAnalysisAcknowledgement_Status_entries_by_number, + 3, value); + return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : + ContentAnalysisAcknowledgement_Status_strings[idx].get(); +} +bool ContentAnalysisAcknowledgement_Status_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ContentAnalysisAcknowledgement_Status* value) { + int int_value; + bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( + ContentAnalysisAcknowledgement_Status_entries, 3, name, &int_value); + if (success) { + *value = static_cast<ContentAnalysisAcknowledgement_Status>(int_value); + } + return success; +} +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +constexpr ContentAnalysisAcknowledgement_Status ContentAnalysisAcknowledgement::SUCCESS; +constexpr ContentAnalysisAcknowledgement_Status ContentAnalysisAcknowledgement::INVALID_RESPONSE; +constexpr ContentAnalysisAcknowledgement_Status ContentAnalysisAcknowledgement::TOO_LATE; +constexpr ContentAnalysisAcknowledgement_Status ContentAnalysisAcknowledgement::Status_MIN; +constexpr ContentAnalysisAcknowledgement_Status ContentAnalysisAcknowledgement::Status_MAX; +constexpr int ContentAnalysisAcknowledgement::Status_ARRAYSIZE; +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +bool ContentAnalysisAcknowledgement_FinalAction_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + case 3: + case 4: + return true; + default: + return false; + } +} + +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<std::string> ContentAnalysisAcknowledgement_FinalAction_strings[5] = {}; + +static const char ContentAnalysisAcknowledgement_FinalAction_names[] = + "ACTION_UNSPECIFIED" + "ALLOW" + "BLOCK" + "REPORT_ONLY" + "WARN"; + +static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry ContentAnalysisAcknowledgement_FinalAction_entries[] = { + { {ContentAnalysisAcknowledgement_FinalAction_names + 0, 18}, 0 }, + { {ContentAnalysisAcknowledgement_FinalAction_names + 18, 5}, 1 }, + { {ContentAnalysisAcknowledgement_FinalAction_names + 23, 5}, 4 }, + { {ContentAnalysisAcknowledgement_FinalAction_names + 28, 11}, 2 }, + { {ContentAnalysisAcknowledgement_FinalAction_names + 39, 4}, 3 }, +}; + +static const int ContentAnalysisAcknowledgement_FinalAction_entries_by_number[] = { + 0, // 0 -> ACTION_UNSPECIFIED + 1, // 1 -> ALLOW + 3, // 2 -> REPORT_ONLY + 4, // 3 -> WARN + 2, // 4 -> BLOCK +}; + +const std::string& ContentAnalysisAcknowledgement_FinalAction_Name( + ContentAnalysisAcknowledgement_FinalAction value) { + static const bool dummy = + ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( + ContentAnalysisAcknowledgement_FinalAction_entries, + ContentAnalysisAcknowledgement_FinalAction_entries_by_number, + 5, ContentAnalysisAcknowledgement_FinalAction_strings); + (void) dummy; + int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( + ContentAnalysisAcknowledgement_FinalAction_entries, + ContentAnalysisAcknowledgement_FinalAction_entries_by_number, + 5, value); + return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : + ContentAnalysisAcknowledgement_FinalAction_strings[idx].get(); +} +bool ContentAnalysisAcknowledgement_FinalAction_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ContentAnalysisAcknowledgement_FinalAction* value) { + int int_value; + bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( + ContentAnalysisAcknowledgement_FinalAction_entries, 5, name, &int_value); + if (success) { + *value = static_cast<ContentAnalysisAcknowledgement_FinalAction>(int_value); + } + return success; +} +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +constexpr ContentAnalysisAcknowledgement_FinalAction ContentAnalysisAcknowledgement::ACTION_UNSPECIFIED; +constexpr ContentAnalysisAcknowledgement_FinalAction ContentAnalysisAcknowledgement::ALLOW; +constexpr ContentAnalysisAcknowledgement_FinalAction ContentAnalysisAcknowledgement::REPORT_ONLY; +constexpr ContentAnalysisAcknowledgement_FinalAction ContentAnalysisAcknowledgement::WARN; +constexpr ContentAnalysisAcknowledgement_FinalAction ContentAnalysisAcknowledgement::BLOCK; +constexpr ContentAnalysisAcknowledgement_FinalAction ContentAnalysisAcknowledgement::FinalAction_MIN; +constexpr ContentAnalysisAcknowledgement_FinalAction ContentAnalysisAcknowledgement::FinalAction_MAX; +constexpr int ContentAnalysisAcknowledgement::FinalAction_ARRAYSIZE; +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +bool AnalysisConnector_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + return true; + default: + return false; + } +} + +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<std::string> AnalysisConnector_strings[6] = {}; + +static const char AnalysisConnector_names[] = + "ANALYSIS_CONNECTOR_UNSPECIFIED" + "BULK_DATA_ENTRY" + "FILE_ATTACHED" + "FILE_DOWNLOADED" + "FILE_TRANSFER" + "PRINT"; + +static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry AnalysisConnector_entries[] = { + { {AnalysisConnector_names + 0, 30}, 0 }, + { {AnalysisConnector_names + 30, 15}, 3 }, + { {AnalysisConnector_names + 45, 13}, 2 }, + { {AnalysisConnector_names + 58, 15}, 1 }, + { {AnalysisConnector_names + 73, 13}, 5 }, + { {AnalysisConnector_names + 86, 5}, 4 }, +}; + +static const int AnalysisConnector_entries_by_number[] = { + 0, // 0 -> ANALYSIS_CONNECTOR_UNSPECIFIED + 3, // 1 -> FILE_DOWNLOADED + 2, // 2 -> FILE_ATTACHED + 1, // 3 -> BULK_DATA_ENTRY + 5, // 4 -> PRINT + 4, // 5 -> FILE_TRANSFER +}; + +const std::string& AnalysisConnector_Name( + AnalysisConnector value) { + static const bool dummy = + ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( + AnalysisConnector_entries, + AnalysisConnector_entries_by_number, + 6, AnalysisConnector_strings); + (void) dummy; + int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( + AnalysisConnector_entries, + AnalysisConnector_entries_by_number, + 6, value); + return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : + AnalysisConnector_strings[idx].get(); +} +bool AnalysisConnector_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, AnalysisConnector* value) { + int int_value; + bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( + AnalysisConnector_entries, 6, name, &int_value); + if (success) { + *value = static_cast<AnalysisConnector>(int_value); + } + return success; +} + +// =================================================================== + +class ContentMetaData_PrintMetadata::_Internal { + public: + using HasBits = decltype(std::declval<ContentMetaData_PrintMetadata>()._impl_._has_bits_); + static void set_has_printer_name(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_printer_type(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } +}; + +ContentMetaData_PrintMetadata::ContentMetaData_PrintMetadata(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:content_analysis.sdk.ContentMetaData.PrintMetadata) +} +ContentMetaData_PrintMetadata::ContentMetaData_PrintMetadata(const ContentMetaData_PrintMetadata& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + ContentMetaData_PrintMetadata* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){from._impl_._has_bits_} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.printer_name_){} + , decltype(_impl_.printer_type_){}}; + + _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); + _impl_.printer_name_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.printer_name_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_printer_name()) { + _this->_impl_.printer_name_.Set(from._internal_printer_name(), + _this->GetArenaForAllocation()); + } + _this->_impl_.printer_type_ = from._impl_.printer_type_; + // @@protoc_insertion_point(copy_constructor:content_analysis.sdk.ContentMetaData.PrintMetadata) +} + +inline void ContentMetaData_PrintMetadata::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.printer_name_){} + , decltype(_impl_.printer_type_){0} + }; + _impl_.printer_name_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.printer_name_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +} + +ContentMetaData_PrintMetadata::~ContentMetaData_PrintMetadata() { + // @@protoc_insertion_point(destructor:content_analysis.sdk.ContentMetaData.PrintMetadata) + if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void ContentMetaData_PrintMetadata::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + _impl_.printer_name_.Destroy(); +} + +void ContentMetaData_PrintMetadata::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void ContentMetaData_PrintMetadata::Clear() { +// @@protoc_insertion_point(message_clear_start:content_analysis.sdk.ContentMetaData.PrintMetadata) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + _impl_.printer_name_.ClearNonDefaultToEmpty(); + } + _impl_.printer_type_ = 0; + _impl_._has_bits_.Clear(); + _internal_metadata_.Clear<std::string>(); +} + +const char* ContentMetaData_PrintMetadata::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional string printer_name = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { + auto str = _internal_mutable_printer_name(); + ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .content_analysis.sdk.ContentMetaData.PrintMetadata.PrinterType printer_type = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::content_analysis::sdk::ContentMetaData_PrintMetadata_PrinterType_IsValid(val))) { + _internal_set_printer_type(static_cast<::content_analysis::sdk::ContentMetaData_PrintMetadata_PrinterType>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(2, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<std::string>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _impl_._has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* ContentMetaData_PrintMetadata::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:content_analysis.sdk.ContentMetaData.PrintMetadata) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + // optional string printer_name = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->WriteStringMaybeAliased( + 1, this->_internal_printer_name(), target); + } + + // optional .content_analysis.sdk.ContentMetaData.PrintMetadata.PrinterType printer_type = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 2, this->_internal_printer_type(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:content_analysis.sdk.ContentMetaData.PrintMetadata) + return target; +} + +size_t ContentMetaData_PrintMetadata::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:content_analysis.sdk.ContentMetaData.PrintMetadata) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + // optional string printer_name = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_printer_name()); + } + + // optional .content_analysis.sdk.ContentMetaData.PrintMetadata.PrinterType printer_type = 2; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this->_internal_printer_type()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::_pbi::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void ContentMetaData_PrintMetadata::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::_pbi::DownCast<const ContentMetaData_PrintMetadata*>( + &from)); +} + +void ContentMetaData_PrintMetadata::MergeFrom(const ContentMetaData_PrintMetadata& from) { + ContentMetaData_PrintMetadata* const _this = this; + // @@protoc_insertion_point(class_specific_merge_from_start:content_analysis.sdk.ContentMetaData.PrintMetadata) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + _this->_internal_set_printer_name(from._internal_printer_name()); + } + if (cached_has_bits & 0x00000002u) { + _this->_impl_.printer_type_ = from._impl_.printer_type_; + } + _this->_impl_._has_bits_[0] |= cached_has_bits; + } + _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); +} + +void ContentMetaData_PrintMetadata::CopyFrom(const ContentMetaData_PrintMetadata& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:content_analysis.sdk.ContentMetaData.PrintMetadata) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ContentMetaData_PrintMetadata::IsInitialized() const { + return true; +} + +void ContentMetaData_PrintMetadata::InternalSwap(ContentMetaData_PrintMetadata* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &_impl_.printer_name_, lhs_arena, + &other->_impl_.printer_name_, rhs_arena + ); + swap(_impl_.printer_type_, other->_impl_.printer_type_); +} + +std::string ContentMetaData_PrintMetadata::GetTypeName() const { + return "content_analysis.sdk.ContentMetaData.PrintMetadata"; +} + + +// =================================================================== + +class ContentMetaData::_Internal { + public: + using HasBits = decltype(std::declval<ContentMetaData>()._impl_._has_bits_); + static void set_has_url(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_filename(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_digest(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static const ::content_analysis::sdk::ClientDownloadRequest& csd(const ContentMetaData* msg); + static void set_has_csd(HasBits* has_bits) { + (*has_bits)[0] |= 32u; + } + static void set_has_email(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } + static void set_has_tab_title(HasBits* has_bits) { + (*has_bits)[0] |= 16u; + } + static const ::content_analysis::sdk::ContentMetaData_PrintMetadata& print_metadata(const ContentMetaData* msg); + static void set_has_print_metadata(HasBits* has_bits) { + (*has_bits)[0] |= 64u; + } +}; + +const ::content_analysis::sdk::ClientDownloadRequest& +ContentMetaData::_Internal::csd(const ContentMetaData* msg) { + return *msg->_impl_.csd_; +} +const ::content_analysis::sdk::ContentMetaData_PrintMetadata& +ContentMetaData::_Internal::print_metadata(const ContentMetaData* msg) { + return *msg->_impl_.print_metadata_; +} +ContentMetaData::ContentMetaData(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:content_analysis.sdk.ContentMetaData) +} +ContentMetaData::ContentMetaData(const ContentMetaData& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + ContentMetaData* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){from._impl_._has_bits_} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.url_){} + , decltype(_impl_.filename_){} + , decltype(_impl_.digest_){} + , decltype(_impl_.email_){} + , decltype(_impl_.tab_title_){} + , decltype(_impl_.csd_){nullptr} + , decltype(_impl_.print_metadata_){nullptr}}; + + _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); + _impl_.url_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.url_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_url()) { + _this->_impl_.url_.Set(from._internal_url(), + _this->GetArenaForAllocation()); + } + _impl_.filename_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.filename_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_filename()) { + _this->_impl_.filename_.Set(from._internal_filename(), + _this->GetArenaForAllocation()); + } + _impl_.digest_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.digest_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_digest()) { + _this->_impl_.digest_.Set(from._internal_digest(), + _this->GetArenaForAllocation()); + } + _impl_.email_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.email_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_email()) { + _this->_impl_.email_.Set(from._internal_email(), + _this->GetArenaForAllocation()); + } + _impl_.tab_title_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.tab_title_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_tab_title()) { + _this->_impl_.tab_title_.Set(from._internal_tab_title(), + _this->GetArenaForAllocation()); + } + if (from._internal_has_csd()) { + _this->_impl_.csd_ = new ::content_analysis::sdk::ClientDownloadRequest(*from._impl_.csd_); + } + if (from._internal_has_print_metadata()) { + _this->_impl_.print_metadata_ = new ::content_analysis::sdk::ContentMetaData_PrintMetadata(*from._impl_.print_metadata_); + } + // @@protoc_insertion_point(copy_constructor:content_analysis.sdk.ContentMetaData) +} + +inline void ContentMetaData::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.url_){} + , decltype(_impl_.filename_){} + , decltype(_impl_.digest_){} + , decltype(_impl_.email_){} + , decltype(_impl_.tab_title_){} + , decltype(_impl_.csd_){nullptr} + , decltype(_impl_.print_metadata_){nullptr} + }; + _impl_.url_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.url_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.filename_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.filename_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.digest_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.digest_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.email_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.email_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.tab_title_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.tab_title_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +} + +ContentMetaData::~ContentMetaData() { + // @@protoc_insertion_point(destructor:content_analysis.sdk.ContentMetaData) + if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void ContentMetaData::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + _impl_.url_.Destroy(); + _impl_.filename_.Destroy(); + _impl_.digest_.Destroy(); + _impl_.email_.Destroy(); + _impl_.tab_title_.Destroy(); + if (this != internal_default_instance()) delete _impl_.csd_; + if (this != internal_default_instance()) delete _impl_.print_metadata_; +} + +void ContentMetaData::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void ContentMetaData::Clear() { +// @@protoc_insertion_point(message_clear_start:content_analysis.sdk.ContentMetaData) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x0000007fu) { + if (cached_has_bits & 0x00000001u) { + _impl_.url_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000002u) { + _impl_.filename_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000004u) { + _impl_.digest_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000008u) { + _impl_.email_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000010u) { + _impl_.tab_title_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000020u) { + GOOGLE_DCHECK(_impl_.csd_ != nullptr); + _impl_.csd_->Clear(); + } + if (cached_has_bits & 0x00000040u) { + GOOGLE_DCHECK(_impl_.print_metadata_ != nullptr); + _impl_.print_metadata_->Clear(); + } + } + _impl_._has_bits_.Clear(); + _internal_metadata_.Clear<std::string>(); +} + +const char* ContentMetaData::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional string url = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { + auto str = _internal_mutable_url(); + ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional string filename = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) { + auto str = _internal_mutable_filename(); + ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional string digest = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) { + auto str = _internal_mutable_digest(); + ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .content_analysis.sdk.ClientDownloadRequest csd = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) { + ptr = ctx->ParseMessage(_internal_mutable_csd(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional string email = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) { + auto str = _internal_mutable_email(); + ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional string tab_title = 9; + case 9: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 74)) { + auto str = _internal_mutable_tab_title(); + ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .content_analysis.sdk.ContentMetaData.PrintMetadata print_metadata = 11; + case 11: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 90)) { + ptr = ctx->ParseMessage(_internal_mutable_print_metadata(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<std::string>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _impl_._has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* ContentMetaData::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:content_analysis.sdk.ContentMetaData) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + // optional string url = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->WriteStringMaybeAliased( + 1, this->_internal_url(), target); + } + + // optional string filename = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->WriteStringMaybeAliased( + 2, this->_internal_filename(), target); + } + + // optional string digest = 3; + if (cached_has_bits & 0x00000004u) { + target = stream->WriteStringMaybeAliased( + 3, this->_internal_digest(), target); + } + + // optional .content_analysis.sdk.ClientDownloadRequest csd = 4; + if (cached_has_bits & 0x00000020u) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(4, _Internal::csd(this), + _Internal::csd(this).GetCachedSize(), target, stream); + } + + // optional string email = 5; + if (cached_has_bits & 0x00000008u) { + target = stream->WriteStringMaybeAliased( + 5, this->_internal_email(), target); + } + + // optional string tab_title = 9; + if (cached_has_bits & 0x00000010u) { + target = stream->WriteStringMaybeAliased( + 9, this->_internal_tab_title(), target); + } + + // optional .content_analysis.sdk.ContentMetaData.PrintMetadata print_metadata = 11; + if (cached_has_bits & 0x00000040u) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(11, _Internal::print_metadata(this), + _Internal::print_metadata(this).GetCachedSize(), target, stream); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:content_analysis.sdk.ContentMetaData) + return target; +} + +size_t ContentMetaData::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:content_analysis.sdk.ContentMetaData) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x0000007fu) { + // optional string url = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_url()); + } + + // optional string filename = 2; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_filename()); + } + + // optional string digest = 3; + if (cached_has_bits & 0x00000004u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_digest()); + } + + // optional string email = 5; + if (cached_has_bits & 0x00000008u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_email()); + } + + // optional string tab_title = 9; + if (cached_has_bits & 0x00000010u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_tab_title()); + } + + // optional .content_analysis.sdk.ClientDownloadRequest csd = 4; + if (cached_has_bits & 0x00000020u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *_impl_.csd_); + } + + // optional .content_analysis.sdk.ContentMetaData.PrintMetadata print_metadata = 11; + if (cached_has_bits & 0x00000040u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *_impl_.print_metadata_); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::_pbi::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void ContentMetaData::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::_pbi::DownCast<const ContentMetaData*>( + &from)); +} + +void ContentMetaData::MergeFrom(const ContentMetaData& from) { + ContentMetaData* const _this = this; + // @@protoc_insertion_point(class_specific_merge_from_start:content_analysis.sdk.ContentMetaData) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x0000007fu) { + if (cached_has_bits & 0x00000001u) { + _this->_internal_set_url(from._internal_url()); + } + if (cached_has_bits & 0x00000002u) { + _this->_internal_set_filename(from._internal_filename()); + } + if (cached_has_bits & 0x00000004u) { + _this->_internal_set_digest(from._internal_digest()); + } + if (cached_has_bits & 0x00000008u) { + _this->_internal_set_email(from._internal_email()); + } + if (cached_has_bits & 0x00000010u) { + _this->_internal_set_tab_title(from._internal_tab_title()); + } + if (cached_has_bits & 0x00000020u) { + _this->_internal_mutable_csd()->::content_analysis::sdk::ClientDownloadRequest::MergeFrom( + from._internal_csd()); + } + if (cached_has_bits & 0x00000040u) { + _this->_internal_mutable_print_metadata()->::content_analysis::sdk::ContentMetaData_PrintMetadata::MergeFrom( + from._internal_print_metadata()); + } + } + _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); +} + +void ContentMetaData::CopyFrom(const ContentMetaData& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:content_analysis.sdk.ContentMetaData) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ContentMetaData::IsInitialized() const { + if (_internal_has_csd()) { + if (!_impl_.csd_->IsInitialized()) return false; + } + return true; +} + +void ContentMetaData::InternalSwap(ContentMetaData* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &_impl_.url_, lhs_arena, + &other->_impl_.url_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &_impl_.filename_, lhs_arena, + &other->_impl_.filename_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &_impl_.digest_, lhs_arena, + &other->_impl_.digest_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &_impl_.email_, lhs_arena, + &other->_impl_.email_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &_impl_.tab_title_, lhs_arena, + &other->_impl_.tab_title_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(ContentMetaData, _impl_.print_metadata_) + + sizeof(ContentMetaData::_impl_.print_metadata_) + - PROTOBUF_FIELD_OFFSET(ContentMetaData, _impl_.csd_)>( + reinterpret_cast<char*>(&_impl_.csd_), + reinterpret_cast<char*>(&other->_impl_.csd_)); +} + +std::string ContentMetaData::GetTypeName() const { + return "content_analysis.sdk.ContentMetaData"; +} + + +// =================================================================== + +class ClientMetadata_Browser::_Internal { + public: + using HasBits = decltype(std::declval<ClientMetadata_Browser>()._impl_._has_bits_); + static void set_has_machine_user(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } +}; + +ClientMetadata_Browser::ClientMetadata_Browser(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:content_analysis.sdk.ClientMetadata.Browser) +} +ClientMetadata_Browser::ClientMetadata_Browser(const ClientMetadata_Browser& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + ClientMetadata_Browser* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){from._impl_._has_bits_} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.machine_user_){}}; + + _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); + _impl_.machine_user_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.machine_user_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_machine_user()) { + _this->_impl_.machine_user_.Set(from._internal_machine_user(), + _this->GetArenaForAllocation()); + } + // @@protoc_insertion_point(copy_constructor:content_analysis.sdk.ClientMetadata.Browser) +} + +inline void ClientMetadata_Browser::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.machine_user_){} + }; + _impl_.machine_user_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.machine_user_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +} + +ClientMetadata_Browser::~ClientMetadata_Browser() { + // @@protoc_insertion_point(destructor:content_analysis.sdk.ClientMetadata.Browser) + if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void ClientMetadata_Browser::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + _impl_.machine_user_.Destroy(); +} + +void ClientMetadata_Browser::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void ClientMetadata_Browser::Clear() { +// @@protoc_insertion_point(message_clear_start:content_analysis.sdk.ClientMetadata.Browser) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + _impl_.machine_user_.ClearNonDefaultToEmpty(); + } + _impl_._has_bits_.Clear(); + _internal_metadata_.Clear<std::string>(); +} + +const char* ClientMetadata_Browser::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional string machine_user = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) { + auto str = _internal_mutable_machine_user(); + ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<std::string>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _impl_._has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* ClientMetadata_Browser::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:content_analysis.sdk.ClientMetadata.Browser) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + // optional string machine_user = 4; + if (cached_has_bits & 0x00000001u) { + target = stream->WriteStringMaybeAliased( + 4, this->_internal_machine_user(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:content_analysis.sdk.ClientMetadata.Browser) + return target; +} + +size_t ClientMetadata_Browser::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:content_analysis.sdk.ClientMetadata.Browser) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // optional string machine_user = 4; + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_machine_user()); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::_pbi::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void ClientMetadata_Browser::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::_pbi::DownCast<const ClientMetadata_Browser*>( + &from)); +} + +void ClientMetadata_Browser::MergeFrom(const ClientMetadata_Browser& from) { + ClientMetadata_Browser* const _this = this; + // @@protoc_insertion_point(class_specific_merge_from_start:content_analysis.sdk.ClientMetadata.Browser) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_has_machine_user()) { + _this->_internal_set_machine_user(from._internal_machine_user()); + } + _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); +} + +void ClientMetadata_Browser::CopyFrom(const ClientMetadata_Browser& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:content_analysis.sdk.ClientMetadata.Browser) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientMetadata_Browser::IsInitialized() const { + return true; +} + +void ClientMetadata_Browser::InternalSwap(ClientMetadata_Browser* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &_impl_.machine_user_, lhs_arena, + &other->_impl_.machine_user_, rhs_arena + ); +} + +std::string ClientMetadata_Browser::GetTypeName() const { + return "content_analysis.sdk.ClientMetadata.Browser"; +} + + +// =================================================================== + +class ClientMetadata::_Internal { + public: + using HasBits = decltype(std::declval<ClientMetadata>()._impl_._has_bits_); + static const ::content_analysis::sdk::ClientMetadata_Browser& browser(const ClientMetadata* msg); + static void set_has_browser(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } +}; + +const ::content_analysis::sdk::ClientMetadata_Browser& +ClientMetadata::_Internal::browser(const ClientMetadata* msg) { + return *msg->_impl_.browser_; +} +ClientMetadata::ClientMetadata(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:content_analysis.sdk.ClientMetadata) +} +ClientMetadata::ClientMetadata(const ClientMetadata& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + ClientMetadata* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){from._impl_._has_bits_} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.browser_){nullptr}}; + + _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); + if (from._internal_has_browser()) { + _this->_impl_.browser_ = new ::content_analysis::sdk::ClientMetadata_Browser(*from._impl_.browser_); + } + // @@protoc_insertion_point(copy_constructor:content_analysis.sdk.ClientMetadata) +} + +inline void ClientMetadata::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.browser_){nullptr} + }; +} + +ClientMetadata::~ClientMetadata() { + // @@protoc_insertion_point(destructor:content_analysis.sdk.ClientMetadata) + if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void ClientMetadata::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + if (this != internal_default_instance()) delete _impl_.browser_; +} + +void ClientMetadata::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void ClientMetadata::Clear() { +// @@protoc_insertion_point(message_clear_start:content_analysis.sdk.ClientMetadata) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + GOOGLE_DCHECK(_impl_.browser_ != nullptr); + _impl_.browser_->Clear(); + } + _impl_._has_bits_.Clear(); + _internal_metadata_.Clear<std::string>(); +} + +const char* ClientMetadata::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .content_analysis.sdk.ClientMetadata.Browser browser = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { + ptr = ctx->ParseMessage(_internal_mutable_browser(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<std::string>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _impl_._has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* ClientMetadata::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:content_analysis.sdk.ClientMetadata) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + // optional .content_analysis.sdk.ClientMetadata.Browser browser = 1; + if (cached_has_bits & 0x00000001u) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(1, _Internal::browser(this), + _Internal::browser(this).GetCachedSize(), target, stream); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:content_analysis.sdk.ClientMetadata) + return target; +} + +size_t ClientMetadata::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:content_analysis.sdk.ClientMetadata) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // optional .content_analysis.sdk.ClientMetadata.Browser browser = 1; + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *_impl_.browser_); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::_pbi::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void ClientMetadata::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::_pbi::DownCast<const ClientMetadata*>( + &from)); +} + +void ClientMetadata::MergeFrom(const ClientMetadata& from) { + ClientMetadata* const _this = this; + // @@protoc_insertion_point(class_specific_merge_from_start:content_analysis.sdk.ClientMetadata) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_has_browser()) { + _this->_internal_mutable_browser()->::content_analysis::sdk::ClientMetadata_Browser::MergeFrom( + from._internal_browser()); + } + _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); +} + +void ClientMetadata::CopyFrom(const ClientMetadata& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:content_analysis.sdk.ClientMetadata) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientMetadata::IsInitialized() const { + return true; +} + +void ClientMetadata::InternalSwap(ClientMetadata* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); + swap(_impl_.browser_, other->_impl_.browser_); +} + +std::string ClientMetadata::GetTypeName() const { + return "content_analysis.sdk.ClientMetadata"; +} + + +// =================================================================== + +class ClientDownloadRequest_Resource::_Internal { + public: + using HasBits = decltype(std::declval<ClientDownloadRequest_Resource>()._impl_._has_bits_); + static void set_has_url(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_type(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static bool MissingRequiredFields(const HasBits& has_bits) { + return ((has_bits[0] & 0x00000003) ^ 0x00000003) != 0; + } +}; + +ClientDownloadRequest_Resource::ClientDownloadRequest_Resource(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:content_analysis.sdk.ClientDownloadRequest.Resource) +} +ClientDownloadRequest_Resource::ClientDownloadRequest_Resource(const ClientDownloadRequest_Resource& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + ClientDownloadRequest_Resource* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){from._impl_._has_bits_} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.url_){} + , decltype(_impl_.type_){}}; + + _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); + _impl_.url_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.url_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_url()) { + _this->_impl_.url_.Set(from._internal_url(), + _this->GetArenaForAllocation()); + } + _this->_impl_.type_ = from._impl_.type_; + // @@protoc_insertion_point(copy_constructor:content_analysis.sdk.ClientDownloadRequest.Resource) +} + +inline void ClientDownloadRequest_Resource::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.url_){} + , decltype(_impl_.type_){0} + }; + _impl_.url_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.url_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +} + +ClientDownloadRequest_Resource::~ClientDownloadRequest_Resource() { + // @@protoc_insertion_point(destructor:content_analysis.sdk.ClientDownloadRequest.Resource) + if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void ClientDownloadRequest_Resource::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + _impl_.url_.Destroy(); +} + +void ClientDownloadRequest_Resource::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void ClientDownloadRequest_Resource::Clear() { +// @@protoc_insertion_point(message_clear_start:content_analysis.sdk.ClientDownloadRequest.Resource) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + _impl_.url_.ClearNonDefaultToEmpty(); + } + _impl_.type_ = 0; + _impl_._has_bits_.Clear(); + _internal_metadata_.Clear<std::string>(); +} + +const char* ClientDownloadRequest_Resource::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) { + // required string url = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { + auto str = _internal_mutable_url(); + ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // required .content_analysis.sdk.ClientDownloadRequest.ResourceType type = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::content_analysis::sdk::ClientDownloadRequest_ResourceType_IsValid(val))) { + _internal_set_type(static_cast<::content_analysis::sdk::ClientDownloadRequest_ResourceType>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(2, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<std::string>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _impl_._has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* ClientDownloadRequest_Resource::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:content_analysis.sdk.ClientDownloadRequest.Resource) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + // required string url = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->WriteStringMaybeAliased( + 1, this->_internal_url(), target); + } + + // required .content_analysis.sdk.ClientDownloadRequest.ResourceType type = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 2, this->_internal_type(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:content_analysis.sdk.ClientDownloadRequest.Resource) + return target; +} + +size_t ClientDownloadRequest_Resource::RequiredFieldsByteSizeFallback() const { +// @@protoc_insertion_point(required_fields_byte_size_fallback_start:content_analysis.sdk.ClientDownloadRequest.Resource) + size_t total_size = 0; + + if (_internal_has_url()) { + // required string url = 1; + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_url()); + } + + if (_internal_has_type()) { + // required .content_analysis.sdk.ClientDownloadRequest.ResourceType type = 2; + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this->_internal_type()); + } + + return total_size; +} +size_t ClientDownloadRequest_Resource::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:content_analysis.sdk.ClientDownloadRequest.Resource) + size_t total_size = 0; + + if (((_impl_._has_bits_[0] & 0x00000003) ^ 0x00000003) == 0) { // All required fields are present. + // required string url = 1; + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_url()); + + // required .content_analysis.sdk.ClientDownloadRequest.ResourceType type = 2; + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this->_internal_type()); + + } else { + total_size += RequiredFieldsByteSizeFallback(); + } + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::_pbi::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void ClientDownloadRequest_Resource::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::_pbi::DownCast<const ClientDownloadRequest_Resource*>( + &from)); +} + +void ClientDownloadRequest_Resource::MergeFrom(const ClientDownloadRequest_Resource& from) { + ClientDownloadRequest_Resource* const _this = this; + // @@protoc_insertion_point(class_specific_merge_from_start:content_analysis.sdk.ClientDownloadRequest.Resource) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + _this->_internal_set_url(from._internal_url()); + } + if (cached_has_bits & 0x00000002u) { + _this->_impl_.type_ = from._impl_.type_; + } + _this->_impl_._has_bits_[0] |= cached_has_bits; + } + _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); +} + +void ClientDownloadRequest_Resource::CopyFrom(const ClientDownloadRequest_Resource& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:content_analysis.sdk.ClientDownloadRequest.Resource) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientDownloadRequest_Resource::IsInitialized() const { + if (_Internal::MissingRequiredFields(_impl_._has_bits_)) return false; + return true; +} + +void ClientDownloadRequest_Resource::InternalSwap(ClientDownloadRequest_Resource* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &_impl_.url_, lhs_arena, + &other->_impl_.url_, rhs_arena + ); + swap(_impl_.type_, other->_impl_.type_); +} + +std::string ClientDownloadRequest_Resource::GetTypeName() const { + return "content_analysis.sdk.ClientDownloadRequest.Resource"; +} + + +// =================================================================== + +class ClientDownloadRequest::_Internal { + public: +}; + +ClientDownloadRequest::ClientDownloadRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:content_analysis.sdk.ClientDownloadRequest) +} +ClientDownloadRequest::ClientDownloadRequest(const ClientDownloadRequest& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + ClientDownloadRequest* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_.resources_){from._impl_.resources_} + , /*decltype(_impl_._cached_size_)*/{}}; + + _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:content_analysis.sdk.ClientDownloadRequest) +} + +inline void ClientDownloadRequest::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_.resources_){arena} + , /*decltype(_impl_._cached_size_)*/{} + }; +} + +ClientDownloadRequest::~ClientDownloadRequest() { + // @@protoc_insertion_point(destructor:content_analysis.sdk.ClientDownloadRequest) + if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void ClientDownloadRequest::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + _impl_.resources_.~RepeatedPtrField(); +} + +void ClientDownloadRequest::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void ClientDownloadRequest::Clear() { +// @@protoc_insertion_point(message_clear_start:content_analysis.sdk.ClientDownloadRequest) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _impl_.resources_.Clear(); + _internal_metadata_.Clear<std::string>(); +} + +const char* ClientDownloadRequest::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) { + // repeated .content_analysis.sdk.ClientDownloadRequest.Resource resources = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) { + ptr -= 1; + do { + ptr += 1; + ptr = ctx->ParseMessage(_internal_add_resources(), ptr); + CHK_(ptr); + if (!ctx->DataAvailable(ptr)) break; + } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<34>(ptr)); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<std::string>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* ClientDownloadRequest::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:content_analysis.sdk.ClientDownloadRequest) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + // repeated .content_analysis.sdk.ClientDownloadRequest.Resource resources = 4; + for (unsigned i = 0, + n = static_cast<unsigned>(this->_internal_resources_size()); i < n; i++) { + const auto& repfield = this->_internal_resources(i); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(4, repfield, repfield.GetCachedSize(), target, stream); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:content_analysis.sdk.ClientDownloadRequest) + return target; +} + +size_t ClientDownloadRequest::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:content_analysis.sdk.ClientDownloadRequest) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // repeated .content_analysis.sdk.ClientDownloadRequest.Resource resources = 4; + total_size += 1UL * this->_internal_resources_size(); + for (const auto& msg : this->_impl_.resources_) { + total_size += + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::_pbi::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void ClientDownloadRequest::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::_pbi::DownCast<const ClientDownloadRequest*>( + &from)); +} + +void ClientDownloadRequest::MergeFrom(const ClientDownloadRequest& from) { + ClientDownloadRequest* const _this = this; + // @@protoc_insertion_point(class_specific_merge_from_start:content_analysis.sdk.ClientDownloadRequest) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _this->_impl_.resources_.MergeFrom(from._impl_.resources_); + _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); +} + +void ClientDownloadRequest::CopyFrom(const ClientDownloadRequest& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:content_analysis.sdk.ClientDownloadRequest) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientDownloadRequest::IsInitialized() const { + if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(_impl_.resources_)) + return false; + return true; +} + +void ClientDownloadRequest::InternalSwap(ClientDownloadRequest* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + _impl_.resources_.InternalSwap(&other->_impl_.resources_); +} + +std::string ClientDownloadRequest::GetTypeName() const { + return "content_analysis.sdk.ClientDownloadRequest"; +} + + +// =================================================================== + +class ContentAnalysisRequest_PrintData::_Internal { + public: + using HasBits = decltype(std::declval<ContentAnalysisRequest_PrintData>()._impl_._has_bits_); + static void set_has_handle(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_size(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } +}; + +ContentAnalysisRequest_PrintData::ContentAnalysisRequest_PrintData(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:content_analysis.sdk.ContentAnalysisRequest.PrintData) +} +ContentAnalysisRequest_PrintData::ContentAnalysisRequest_PrintData(const ContentAnalysisRequest_PrintData& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + ContentAnalysisRequest_PrintData* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){from._impl_._has_bits_} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.handle_){} + , decltype(_impl_.size_){}}; + + _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); + ::memcpy(&_impl_.handle_, &from._impl_.handle_, + static_cast<size_t>(reinterpret_cast<char*>(&_impl_.size_) - + reinterpret_cast<char*>(&_impl_.handle_)) + sizeof(_impl_.size_)); + // @@protoc_insertion_point(copy_constructor:content_analysis.sdk.ContentAnalysisRequest.PrintData) +} + +inline void ContentAnalysisRequest_PrintData::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.handle_){int64_t{0}} + , decltype(_impl_.size_){int64_t{0}} + }; +} + +ContentAnalysisRequest_PrintData::~ContentAnalysisRequest_PrintData() { + // @@protoc_insertion_point(destructor:content_analysis.sdk.ContentAnalysisRequest.PrintData) + if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void ContentAnalysisRequest_PrintData::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void ContentAnalysisRequest_PrintData::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void ContentAnalysisRequest_PrintData::Clear() { +// @@protoc_insertion_point(message_clear_start:content_analysis.sdk.ContentAnalysisRequest.PrintData) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + ::memset(&_impl_.handle_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&_impl_.size_) - + reinterpret_cast<char*>(&_impl_.handle_)) + sizeof(_impl_.size_)); + } + _impl_._has_bits_.Clear(); + _internal_metadata_.Clear<std::string>(); +} + +const char* ContentAnalysisRequest_PrintData::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional int64 handle = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) { + _Internal::set_has_handle(&has_bits); + _impl_.handle_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int64 size = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) { + _Internal::set_has_size(&has_bits); + _impl_.size_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<std::string>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _impl_._has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* ContentAnalysisRequest_PrintData::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:content_analysis.sdk.ContentAnalysisRequest.PrintData) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + // optional int64 handle = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteInt64ToArray(1, this->_internal_handle(), target); + } + + // optional int64 size = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteInt64ToArray(2, this->_internal_size(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:content_analysis.sdk.ContentAnalysisRequest.PrintData) + return target; +} + +size_t ContentAnalysisRequest_PrintData::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:content_analysis.sdk.ContentAnalysisRequest.PrintData) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + // optional int64 handle = 1; + if (cached_has_bits & 0x00000001u) { + total_size += ::_pbi::WireFormatLite::Int64SizePlusOne(this->_internal_handle()); + } + + // optional int64 size = 2; + if (cached_has_bits & 0x00000002u) { + total_size += ::_pbi::WireFormatLite::Int64SizePlusOne(this->_internal_size()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::_pbi::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void ContentAnalysisRequest_PrintData::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::_pbi::DownCast<const ContentAnalysisRequest_PrintData*>( + &from)); +} + +void ContentAnalysisRequest_PrintData::MergeFrom(const ContentAnalysisRequest_PrintData& from) { + ContentAnalysisRequest_PrintData* const _this = this; + // @@protoc_insertion_point(class_specific_merge_from_start:content_analysis.sdk.ContentAnalysisRequest.PrintData) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + _this->_impl_.handle_ = from._impl_.handle_; + } + if (cached_has_bits & 0x00000002u) { + _this->_impl_.size_ = from._impl_.size_; + } + _this->_impl_._has_bits_[0] |= cached_has_bits; + } + _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); +} + +void ContentAnalysisRequest_PrintData::CopyFrom(const ContentAnalysisRequest_PrintData& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:content_analysis.sdk.ContentAnalysisRequest.PrintData) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ContentAnalysisRequest_PrintData::IsInitialized() const { + return true; +} + +void ContentAnalysisRequest_PrintData::InternalSwap(ContentAnalysisRequest_PrintData* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(ContentAnalysisRequest_PrintData, _impl_.size_) + + sizeof(ContentAnalysisRequest_PrintData::_impl_.size_) + - PROTOBUF_FIELD_OFFSET(ContentAnalysisRequest_PrintData, _impl_.handle_)>( + reinterpret_cast<char*>(&_impl_.handle_), + reinterpret_cast<char*>(&other->_impl_.handle_)); +} + +std::string ContentAnalysisRequest_PrintData::GetTypeName() const { + return "content_analysis.sdk.ContentAnalysisRequest.PrintData"; +} + + +// =================================================================== + +class ContentAnalysisRequest::_Internal { + public: + using HasBits = decltype(std::declval<ContentAnalysisRequest>()._impl_._has_bits_); + static void set_has_request_token(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_analysis_connector(HasBits* has_bits) { + (*has_bits)[0] |= 64u; + } + static const ::content_analysis::sdk::ContentMetaData& request_data(const ContentAnalysisRequest* msg); + static void set_has_request_data(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static const ::content_analysis::sdk::ClientMetadata& client_metadata(const ContentAnalysisRequest* msg); + static void set_has_client_metadata(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } + static const ::content_analysis::sdk::ContentAnalysisRequest_PrintData& print_data(const ContentAnalysisRequest* msg); + static void set_has_expires_at(HasBits* has_bits) { + (*has_bits)[0] |= 16u; + } + static void set_has_user_action_id(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_user_action_requests_count(HasBits* has_bits) { + (*has_bits)[0] |= 32u; + } +}; + +const ::content_analysis::sdk::ContentMetaData& +ContentAnalysisRequest::_Internal::request_data(const ContentAnalysisRequest* msg) { + return *msg->_impl_.request_data_; +} +const ::content_analysis::sdk::ClientMetadata& +ContentAnalysisRequest::_Internal::client_metadata(const ContentAnalysisRequest* msg) { + return *msg->_impl_.client_metadata_; +} +const ::content_analysis::sdk::ContentAnalysisRequest_PrintData& +ContentAnalysisRequest::_Internal::print_data(const ContentAnalysisRequest* msg) { + return *msg->_impl_.content_data_.print_data_; +} +void ContentAnalysisRequest::set_allocated_print_data(::content_analysis::sdk::ContentAnalysisRequest_PrintData* print_data) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + clear_content_data(); + if (print_data) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(print_data); + if (message_arena != submessage_arena) { + print_data = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, print_data, submessage_arena); + } + set_has_print_data(); + _impl_.content_data_.print_data_ = print_data; + } + // @@protoc_insertion_point(field_set_allocated:content_analysis.sdk.ContentAnalysisRequest.print_data) +} +ContentAnalysisRequest::ContentAnalysisRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:content_analysis.sdk.ContentAnalysisRequest) +} +ContentAnalysisRequest::ContentAnalysisRequest(const ContentAnalysisRequest& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + ContentAnalysisRequest* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){from._impl_._has_bits_} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.tags_){from._impl_.tags_} + , decltype(_impl_.request_token_){} + , decltype(_impl_.user_action_id_){} + , decltype(_impl_.request_data_){nullptr} + , decltype(_impl_.client_metadata_){nullptr} + , decltype(_impl_.expires_at_){} + , decltype(_impl_.user_action_requests_count_){} + , decltype(_impl_.analysis_connector_){} + , decltype(_impl_.content_data_){} + , /*decltype(_impl_._oneof_case_)*/{}}; + + _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); + _impl_.request_token_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.request_token_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_request_token()) { + _this->_impl_.request_token_.Set(from._internal_request_token(), + _this->GetArenaForAllocation()); + } + _impl_.user_action_id_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.user_action_id_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_user_action_id()) { + _this->_impl_.user_action_id_.Set(from._internal_user_action_id(), + _this->GetArenaForAllocation()); + } + if (from._internal_has_request_data()) { + _this->_impl_.request_data_ = new ::content_analysis::sdk::ContentMetaData(*from._impl_.request_data_); + } + if (from._internal_has_client_metadata()) { + _this->_impl_.client_metadata_ = new ::content_analysis::sdk::ClientMetadata(*from._impl_.client_metadata_); + } + ::memcpy(&_impl_.expires_at_, &from._impl_.expires_at_, + static_cast<size_t>(reinterpret_cast<char*>(&_impl_.analysis_connector_) - + reinterpret_cast<char*>(&_impl_.expires_at_)) + sizeof(_impl_.analysis_connector_)); + clear_has_content_data(); + switch (from.content_data_case()) { + case kTextContent: { + _this->_internal_set_text_content(from._internal_text_content()); + break; + } + case kFilePath: { + _this->_internal_set_file_path(from._internal_file_path()); + break; + } + case kPrintData: { + _this->_internal_mutable_print_data()->::content_analysis::sdk::ContentAnalysisRequest_PrintData::MergeFrom( + from._internal_print_data()); + break; + } + case CONTENT_DATA_NOT_SET: { + break; + } + } + // @@protoc_insertion_point(copy_constructor:content_analysis.sdk.ContentAnalysisRequest) +} + +inline void ContentAnalysisRequest::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.tags_){arena} + , decltype(_impl_.request_token_){} + , decltype(_impl_.user_action_id_){} + , decltype(_impl_.request_data_){nullptr} + , decltype(_impl_.client_metadata_){nullptr} + , decltype(_impl_.expires_at_){int64_t{0}} + , decltype(_impl_.user_action_requests_count_){int64_t{0}} + , decltype(_impl_.analysis_connector_){0} + , decltype(_impl_.content_data_){} + , /*decltype(_impl_._oneof_case_)*/{} + }; + _impl_.request_token_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.request_token_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.user_action_id_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.user_action_id_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + clear_has_content_data(); +} + +ContentAnalysisRequest::~ContentAnalysisRequest() { + // @@protoc_insertion_point(destructor:content_analysis.sdk.ContentAnalysisRequest) + if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void ContentAnalysisRequest::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + _impl_.tags_.~RepeatedPtrField(); + _impl_.request_token_.Destroy(); + _impl_.user_action_id_.Destroy(); + if (this != internal_default_instance()) delete _impl_.request_data_; + if (this != internal_default_instance()) delete _impl_.client_metadata_; + if (has_content_data()) { + clear_content_data(); + } +} + +void ContentAnalysisRequest::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void ContentAnalysisRequest::clear_content_data() { +// @@protoc_insertion_point(one_of_clear_start:content_analysis.sdk.ContentAnalysisRequest) + switch (content_data_case()) { + case kTextContent: { + _impl_.content_data_.text_content_.Destroy(); + break; + } + case kFilePath: { + _impl_.content_data_.file_path_.Destroy(); + break; + } + case kPrintData: { + if (GetArenaForAllocation() == nullptr) { + delete _impl_.content_data_.print_data_; + } + break; + } + case CONTENT_DATA_NOT_SET: { + break; + } + } + _impl_._oneof_case_[0] = CONTENT_DATA_NOT_SET; +} + + +void ContentAnalysisRequest::Clear() { +// @@protoc_insertion_point(message_clear_start:content_analysis.sdk.ContentAnalysisRequest) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _impl_.tags_.Clear(); + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { + if (cached_has_bits & 0x00000001u) { + _impl_.request_token_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000002u) { + _impl_.user_action_id_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000004u) { + GOOGLE_DCHECK(_impl_.request_data_ != nullptr); + _impl_.request_data_->Clear(); + } + if (cached_has_bits & 0x00000008u) { + GOOGLE_DCHECK(_impl_.client_metadata_ != nullptr); + _impl_.client_metadata_->Clear(); + } + } + if (cached_has_bits & 0x00000070u) { + ::memset(&_impl_.expires_at_, 0, static_cast<size_t>( + reinterpret_cast<char*>(&_impl_.analysis_connector_) - + reinterpret_cast<char*>(&_impl_.expires_at_)) + sizeof(_impl_.analysis_connector_)); + } + clear_content_data(); + _impl_._has_bits_.Clear(); + _internal_metadata_.Clear<std::string>(); +} + +const char* ContentAnalysisRequest::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional string request_token = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) { + auto str = _internal_mutable_request_token(); + ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .content_analysis.sdk.AnalysisConnector analysis_connector = 9; + case 9: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 72)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::content_analysis::sdk::AnalysisConnector_IsValid(val))) { + _internal_set_analysis_connector(static_cast<::content_analysis::sdk::AnalysisConnector>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(9, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional .content_analysis.sdk.ContentMetaData request_data = 10; + case 10: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 82)) { + ptr = ctx->ParseMessage(_internal_mutable_request_data(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // repeated string tags = 11; + case 11: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 90)) { + ptr -= 1; + do { + ptr += 1; + auto str = _internal_add_tags(); + ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + if (!ctx->DataAvailable(ptr)) break; + } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<90>(ptr)); + } else + goto handle_unusual; + continue; + // optional .content_analysis.sdk.ClientMetadata client_metadata = 12; + case 12: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 98)) { + ptr = ctx->ParseMessage(_internal_mutable_client_metadata(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // string text_content = 13; + case 13: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 106)) { + auto str = _internal_mutable_text_content(); + ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // string file_path = 14; + case 14: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 114)) { + auto str = _internal_mutable_file_path(); + ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int64 expires_at = 15; + case 15: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 120)) { + _Internal::set_has_expires_at(&has_bits); + _impl_.expires_at_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional string user_action_id = 16; + case 16: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 130)) { + auto str = _internal_mutable_user_action_id(); + ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int64 user_action_requests_count = 17; + case 17: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 136)) { + _Internal::set_has_user_action_requests_count(&has_bits); + _impl_.user_action_requests_count_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // .content_analysis.sdk.ContentAnalysisRequest.PrintData print_data = 18; + case 18: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 146)) { + ptr = ctx->ParseMessage(_internal_mutable_print_data(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<std::string>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _impl_._has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* ContentAnalysisRequest::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:content_analysis.sdk.ContentAnalysisRequest) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + // optional string request_token = 5; + if (cached_has_bits & 0x00000001u) { + target = stream->WriteStringMaybeAliased( + 5, this->_internal_request_token(), target); + } + + // optional .content_analysis.sdk.AnalysisConnector analysis_connector = 9; + if (cached_has_bits & 0x00000040u) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 9, this->_internal_analysis_connector(), target); + } + + // optional .content_analysis.sdk.ContentMetaData request_data = 10; + if (cached_has_bits & 0x00000004u) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(10, _Internal::request_data(this), + _Internal::request_data(this).GetCachedSize(), target, stream); + } + + // repeated string tags = 11; + for (int i = 0, n = this->_internal_tags_size(); i < n; i++) { + const auto& s = this->_internal_tags(i); + target = stream->WriteString(11, s, target); + } + + // optional .content_analysis.sdk.ClientMetadata client_metadata = 12; + if (cached_has_bits & 0x00000008u) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(12, _Internal::client_metadata(this), + _Internal::client_metadata(this).GetCachedSize(), target, stream); + } + + switch (content_data_case()) { + case kTextContent: { + target = stream->WriteStringMaybeAliased( + 13, this->_internal_text_content(), target); + break; + } + case kFilePath: { + target = stream->WriteStringMaybeAliased( + 14, this->_internal_file_path(), target); + break; + } + default: ; + } + // optional int64 expires_at = 15; + if (cached_has_bits & 0x00000010u) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteInt64ToArray(15, this->_internal_expires_at(), target); + } + + // optional string user_action_id = 16; + if (cached_has_bits & 0x00000002u) { + target = stream->WriteStringMaybeAliased( + 16, this->_internal_user_action_id(), target); + } + + // optional int64 user_action_requests_count = 17; + if (cached_has_bits & 0x00000020u) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteInt64ToArray(17, this->_internal_user_action_requests_count(), target); + } + + // .content_analysis.sdk.ContentAnalysisRequest.PrintData print_data = 18; + if (_internal_has_print_data()) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(18, _Internal::print_data(this), + _Internal::print_data(this).GetCachedSize(), target, stream); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:content_analysis.sdk.ContentAnalysisRequest) + return target; +} + +size_t ContentAnalysisRequest::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:content_analysis.sdk.ContentAnalysisRequest) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // repeated string tags = 11; + total_size += 1 * + ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(_impl_.tags_.size()); + for (int i = 0, n = _impl_.tags_.size(); i < n; i++) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + _impl_.tags_.Get(i)); + } + + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x0000007fu) { + // optional string request_token = 5; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_request_token()); + } + + // optional string user_action_id = 16; + if (cached_has_bits & 0x00000002u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_user_action_id()); + } + + // optional .content_analysis.sdk.ContentMetaData request_data = 10; + if (cached_has_bits & 0x00000004u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *_impl_.request_data_); + } + + // optional .content_analysis.sdk.ClientMetadata client_metadata = 12; + if (cached_has_bits & 0x00000008u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *_impl_.client_metadata_); + } + + // optional int64 expires_at = 15; + if (cached_has_bits & 0x00000010u) { + total_size += ::_pbi::WireFormatLite::Int64SizePlusOne(this->_internal_expires_at()); + } + + // optional int64 user_action_requests_count = 17; + if (cached_has_bits & 0x00000020u) { + total_size += 2 + + ::_pbi::WireFormatLite::Int64Size( + this->_internal_user_action_requests_count()); + } + + // optional .content_analysis.sdk.AnalysisConnector analysis_connector = 9; + if (cached_has_bits & 0x00000040u) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this->_internal_analysis_connector()); + } + + } + switch (content_data_case()) { + // string text_content = 13; + case kTextContent: { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_text_content()); + break; + } + // string file_path = 14; + case kFilePath: { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_file_path()); + break; + } + // .content_analysis.sdk.ContentAnalysisRequest.PrintData print_data = 18; + case kPrintData: { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *_impl_.content_data_.print_data_); + break; + } + case CONTENT_DATA_NOT_SET: { + break; + } + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::_pbi::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void ContentAnalysisRequest::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::_pbi::DownCast<const ContentAnalysisRequest*>( + &from)); +} + +void ContentAnalysisRequest::MergeFrom(const ContentAnalysisRequest& from) { + ContentAnalysisRequest* const _this = this; + // @@protoc_insertion_point(class_specific_merge_from_start:content_analysis.sdk.ContentAnalysisRequest) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _this->_impl_.tags_.MergeFrom(from._impl_.tags_); + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x0000007fu) { + if (cached_has_bits & 0x00000001u) { + _this->_internal_set_request_token(from._internal_request_token()); + } + if (cached_has_bits & 0x00000002u) { + _this->_internal_set_user_action_id(from._internal_user_action_id()); + } + if (cached_has_bits & 0x00000004u) { + _this->_internal_mutable_request_data()->::content_analysis::sdk::ContentMetaData::MergeFrom( + from._internal_request_data()); + } + if (cached_has_bits & 0x00000008u) { + _this->_internal_mutable_client_metadata()->::content_analysis::sdk::ClientMetadata::MergeFrom( + from._internal_client_metadata()); + } + if (cached_has_bits & 0x00000010u) { + _this->_impl_.expires_at_ = from._impl_.expires_at_; + } + if (cached_has_bits & 0x00000020u) { + _this->_impl_.user_action_requests_count_ = from._impl_.user_action_requests_count_; + } + if (cached_has_bits & 0x00000040u) { + _this->_impl_.analysis_connector_ = from._impl_.analysis_connector_; + } + _this->_impl_._has_bits_[0] |= cached_has_bits; + } + switch (from.content_data_case()) { + case kTextContent: { + _this->_internal_set_text_content(from._internal_text_content()); + break; + } + case kFilePath: { + _this->_internal_set_file_path(from._internal_file_path()); + break; + } + case kPrintData: { + _this->_internal_mutable_print_data()->::content_analysis::sdk::ContentAnalysisRequest_PrintData::MergeFrom( + from._internal_print_data()); + break; + } + case CONTENT_DATA_NOT_SET: { + break; + } + } + _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); +} + +void ContentAnalysisRequest::CopyFrom(const ContentAnalysisRequest& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:content_analysis.sdk.ContentAnalysisRequest) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ContentAnalysisRequest::IsInitialized() const { + if (_internal_has_request_data()) { + if (!_impl_.request_data_->IsInitialized()) return false; + } + return true; +} + +void ContentAnalysisRequest::InternalSwap(ContentAnalysisRequest* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); + _impl_.tags_.InternalSwap(&other->_impl_.tags_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &_impl_.request_token_, lhs_arena, + &other->_impl_.request_token_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &_impl_.user_action_id_, lhs_arena, + &other->_impl_.user_action_id_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(ContentAnalysisRequest, _impl_.analysis_connector_) + + sizeof(ContentAnalysisRequest::_impl_.analysis_connector_) + - PROTOBUF_FIELD_OFFSET(ContentAnalysisRequest, _impl_.request_data_)>( + reinterpret_cast<char*>(&_impl_.request_data_), + reinterpret_cast<char*>(&other->_impl_.request_data_)); + swap(_impl_.content_data_, other->_impl_.content_data_); + swap(_impl_._oneof_case_[0], other->_impl_._oneof_case_[0]); +} + +std::string ContentAnalysisRequest::GetTypeName() const { + return "content_analysis.sdk.ContentAnalysisRequest"; +} + + +// =================================================================== + +class ContentAnalysisResponse_Result_TriggeredRule::_Internal { + public: + using HasBits = decltype(std::declval<ContentAnalysisResponse_Result_TriggeredRule>()._impl_._has_bits_); + static void set_has_action(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static void set_has_rule_name(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_rule_id(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } +}; + +ContentAnalysisResponse_Result_TriggeredRule::ContentAnalysisResponse_Result_TriggeredRule(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule) +} +ContentAnalysisResponse_Result_TriggeredRule::ContentAnalysisResponse_Result_TriggeredRule(const ContentAnalysisResponse_Result_TriggeredRule& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + ContentAnalysisResponse_Result_TriggeredRule* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){from._impl_._has_bits_} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.rule_name_){} + , decltype(_impl_.rule_id_){} + , decltype(_impl_.action_){}}; + + _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); + _impl_.rule_name_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.rule_name_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_rule_name()) { + _this->_impl_.rule_name_.Set(from._internal_rule_name(), + _this->GetArenaForAllocation()); + } + _impl_.rule_id_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.rule_id_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_rule_id()) { + _this->_impl_.rule_id_.Set(from._internal_rule_id(), + _this->GetArenaForAllocation()); + } + _this->_impl_.action_ = from._impl_.action_; + // @@protoc_insertion_point(copy_constructor:content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule) +} + +inline void ContentAnalysisResponse_Result_TriggeredRule::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.rule_name_){} + , decltype(_impl_.rule_id_){} + , decltype(_impl_.action_){0} + }; + _impl_.rule_name_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.rule_name_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.rule_id_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.rule_id_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +} + +ContentAnalysisResponse_Result_TriggeredRule::~ContentAnalysisResponse_Result_TriggeredRule() { + // @@protoc_insertion_point(destructor:content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule) + if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void ContentAnalysisResponse_Result_TriggeredRule::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + _impl_.rule_name_.Destroy(); + _impl_.rule_id_.Destroy(); +} + +void ContentAnalysisResponse_Result_TriggeredRule::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void ContentAnalysisResponse_Result_TriggeredRule::Clear() { +// @@protoc_insertion_point(message_clear_start:content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + _impl_.rule_name_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000002u) { + _impl_.rule_id_.ClearNonDefaultToEmpty(); + } + } + _impl_.action_ = 0; + _impl_._has_bits_.Clear(); + _internal_metadata_.Clear<std::string>(); +} + +const char* ContentAnalysisResponse_Result_TriggeredRule::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule.Action action = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule_Action_IsValid(val))) { + _internal_set_action(static_cast<::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule_Action>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional string rule_name = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) { + auto str = _internal_mutable_rule_name(); + ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional string rule_id = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) { + auto str = _internal_mutable_rule_id(); + ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<std::string>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _impl_._has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* ContentAnalysisResponse_Result_TriggeredRule::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + // optional .content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule.Action action = 1; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 1, this->_internal_action(), target); + } + + // optional string rule_name = 2; + if (cached_has_bits & 0x00000001u) { + target = stream->WriteStringMaybeAliased( + 2, this->_internal_rule_name(), target); + } + + // optional string rule_id = 3; + if (cached_has_bits & 0x00000002u) { + target = stream->WriteStringMaybeAliased( + 3, this->_internal_rule_id(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule) + return target; +} + +size_t ContentAnalysisResponse_Result_TriggeredRule::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + // optional string rule_name = 2; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_rule_name()); + } + + // optional string rule_id = 3; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_rule_id()); + } + + // optional .content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule.Action action = 1; + if (cached_has_bits & 0x00000004u) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this->_internal_action()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::_pbi::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void ContentAnalysisResponse_Result_TriggeredRule::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::_pbi::DownCast<const ContentAnalysisResponse_Result_TriggeredRule*>( + &from)); +} + +void ContentAnalysisResponse_Result_TriggeredRule::MergeFrom(const ContentAnalysisResponse_Result_TriggeredRule& from) { + ContentAnalysisResponse_Result_TriggeredRule* const _this = this; + // @@protoc_insertion_point(class_specific_merge_from_start:content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + if (cached_has_bits & 0x00000001u) { + _this->_internal_set_rule_name(from._internal_rule_name()); + } + if (cached_has_bits & 0x00000002u) { + _this->_internal_set_rule_id(from._internal_rule_id()); + } + if (cached_has_bits & 0x00000004u) { + _this->_impl_.action_ = from._impl_.action_; + } + _this->_impl_._has_bits_[0] |= cached_has_bits; + } + _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); +} + +void ContentAnalysisResponse_Result_TriggeredRule::CopyFrom(const ContentAnalysisResponse_Result_TriggeredRule& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ContentAnalysisResponse_Result_TriggeredRule::IsInitialized() const { + return true; +} + +void ContentAnalysisResponse_Result_TriggeredRule::InternalSwap(ContentAnalysisResponse_Result_TriggeredRule* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &_impl_.rule_name_, lhs_arena, + &other->_impl_.rule_name_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &_impl_.rule_id_, lhs_arena, + &other->_impl_.rule_id_, rhs_arena + ); + swap(_impl_.action_, other->_impl_.action_); +} + +std::string ContentAnalysisResponse_Result_TriggeredRule::GetTypeName() const { + return "content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule"; +} + + +// =================================================================== + +class ContentAnalysisResponse_Result::_Internal { + public: + using HasBits = decltype(std::declval<ContentAnalysisResponse_Result>()._impl_._has_bits_); + static void set_has_tag(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_status(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } +}; + +ContentAnalysisResponse_Result::ContentAnalysisResponse_Result(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:content_analysis.sdk.ContentAnalysisResponse.Result) +} +ContentAnalysisResponse_Result::ContentAnalysisResponse_Result(const ContentAnalysisResponse_Result& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + ContentAnalysisResponse_Result* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){from._impl_._has_bits_} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.triggered_rules_){from._impl_.triggered_rules_} + , decltype(_impl_.tag_){} + , decltype(_impl_.status_){}}; + + _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); + _impl_.tag_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.tag_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_tag()) { + _this->_impl_.tag_.Set(from._internal_tag(), + _this->GetArenaForAllocation()); + } + _this->_impl_.status_ = from._impl_.status_; + // @@protoc_insertion_point(copy_constructor:content_analysis.sdk.ContentAnalysisResponse.Result) +} + +inline void ContentAnalysisResponse_Result::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.triggered_rules_){arena} + , decltype(_impl_.tag_){} + , decltype(_impl_.status_){0} + }; + _impl_.tag_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.tag_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +} + +ContentAnalysisResponse_Result::~ContentAnalysisResponse_Result() { + // @@protoc_insertion_point(destructor:content_analysis.sdk.ContentAnalysisResponse.Result) + if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void ContentAnalysisResponse_Result::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + _impl_.triggered_rules_.~RepeatedPtrField(); + _impl_.tag_.Destroy(); +} + +void ContentAnalysisResponse_Result::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void ContentAnalysisResponse_Result::Clear() { +// @@protoc_insertion_point(message_clear_start:content_analysis.sdk.ContentAnalysisResponse.Result) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _impl_.triggered_rules_.Clear(); + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + _impl_.tag_.ClearNonDefaultToEmpty(); + } + _impl_.status_ = 0; + _impl_._has_bits_.Clear(); + _internal_metadata_.Clear<std::string>(); +} + +const char* ContentAnalysisResponse_Result::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional string tag = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { + auto str = _internal_mutable_tag(); + ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .content_analysis.sdk.ContentAnalysisResponse.Result.Status status = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::content_analysis::sdk::ContentAnalysisResponse_Result_Status_IsValid(val))) { + _internal_set_status(static_cast<::content_analysis::sdk::ContentAnalysisResponse_Result_Status>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(2, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // repeated .content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule triggered_rules = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) { + ptr -= 1; + do { + ptr += 1; + ptr = ctx->ParseMessage(_internal_add_triggered_rules(), ptr); + CHK_(ptr); + if (!ctx->DataAvailable(ptr)) break; + } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<26>(ptr)); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<std::string>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _impl_._has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* ContentAnalysisResponse_Result::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:content_analysis.sdk.ContentAnalysisResponse.Result) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + // optional string tag = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->WriteStringMaybeAliased( + 1, this->_internal_tag(), target); + } + + // optional .content_analysis.sdk.ContentAnalysisResponse.Result.Status status = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 2, this->_internal_status(), target); + } + + // repeated .content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule triggered_rules = 3; + for (unsigned i = 0, + n = static_cast<unsigned>(this->_internal_triggered_rules_size()); i < n; i++) { + const auto& repfield = this->_internal_triggered_rules(i); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(3, repfield, repfield.GetCachedSize(), target, stream); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:content_analysis.sdk.ContentAnalysisResponse.Result) + return target; +} + +size_t ContentAnalysisResponse_Result::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:content_analysis.sdk.ContentAnalysisResponse.Result) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // repeated .content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule triggered_rules = 3; + total_size += 1UL * this->_internal_triggered_rules_size(); + for (const auto& msg : this->_impl_.triggered_rules_) { + total_size += + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); + } + + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + // optional string tag = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_tag()); + } + + // optional .content_analysis.sdk.ContentAnalysisResponse.Result.Status status = 2; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this->_internal_status()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::_pbi::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void ContentAnalysisResponse_Result::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::_pbi::DownCast<const ContentAnalysisResponse_Result*>( + &from)); +} + +void ContentAnalysisResponse_Result::MergeFrom(const ContentAnalysisResponse_Result& from) { + ContentAnalysisResponse_Result* const _this = this; + // @@protoc_insertion_point(class_specific_merge_from_start:content_analysis.sdk.ContentAnalysisResponse.Result) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _this->_impl_.triggered_rules_.MergeFrom(from._impl_.triggered_rules_); + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + _this->_internal_set_tag(from._internal_tag()); + } + if (cached_has_bits & 0x00000002u) { + _this->_impl_.status_ = from._impl_.status_; + } + _this->_impl_._has_bits_[0] |= cached_has_bits; + } + _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); +} + +void ContentAnalysisResponse_Result::CopyFrom(const ContentAnalysisResponse_Result& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:content_analysis.sdk.ContentAnalysisResponse.Result) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ContentAnalysisResponse_Result::IsInitialized() const { + return true; +} + +void ContentAnalysisResponse_Result::InternalSwap(ContentAnalysisResponse_Result* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); + _impl_.triggered_rules_.InternalSwap(&other->_impl_.triggered_rules_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &_impl_.tag_, lhs_arena, + &other->_impl_.tag_, rhs_arena + ); + swap(_impl_.status_, other->_impl_.status_); +} + +std::string ContentAnalysisResponse_Result::GetTypeName() const { + return "content_analysis.sdk.ContentAnalysisResponse.Result"; +} + + +// =================================================================== + +class ContentAnalysisResponse::_Internal { + public: + using HasBits = decltype(std::declval<ContentAnalysisResponse>()._impl_._has_bits_); + static void set_has_request_token(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } +}; + +ContentAnalysisResponse::ContentAnalysisResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:content_analysis.sdk.ContentAnalysisResponse) +} +ContentAnalysisResponse::ContentAnalysisResponse(const ContentAnalysisResponse& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + ContentAnalysisResponse* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){from._impl_._has_bits_} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.results_){from._impl_.results_} + , decltype(_impl_.request_token_){}}; + + _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); + _impl_.request_token_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.request_token_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_request_token()) { + _this->_impl_.request_token_.Set(from._internal_request_token(), + _this->GetArenaForAllocation()); + } + // @@protoc_insertion_point(copy_constructor:content_analysis.sdk.ContentAnalysisResponse) +} + +inline void ContentAnalysisResponse::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.results_){arena} + , decltype(_impl_.request_token_){} + }; + _impl_.request_token_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.request_token_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +} + +ContentAnalysisResponse::~ContentAnalysisResponse() { + // @@protoc_insertion_point(destructor:content_analysis.sdk.ContentAnalysisResponse) + if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void ContentAnalysisResponse::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + _impl_.results_.~RepeatedPtrField(); + _impl_.request_token_.Destroy(); +} + +void ContentAnalysisResponse::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void ContentAnalysisResponse::Clear() { +// @@protoc_insertion_point(message_clear_start:content_analysis.sdk.ContentAnalysisResponse) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _impl_.results_.Clear(); + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + _impl_.request_token_.ClearNonDefaultToEmpty(); + } + _impl_._has_bits_.Clear(); + _internal_metadata_.Clear<std::string>(); +} + +const char* ContentAnalysisResponse::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional string request_token = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { + auto str = _internal_mutable_request_token(); + ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // repeated .content_analysis.sdk.ContentAnalysisResponse.Result results = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) { + ptr -= 1; + do { + ptr += 1; + ptr = ctx->ParseMessage(_internal_add_results(), ptr); + CHK_(ptr); + if (!ctx->DataAvailable(ptr)) break; + } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<34>(ptr)); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<std::string>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _impl_._has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* ContentAnalysisResponse::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:content_analysis.sdk.ContentAnalysisResponse) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + // optional string request_token = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->WriteStringMaybeAliased( + 1, this->_internal_request_token(), target); + } + + // repeated .content_analysis.sdk.ContentAnalysisResponse.Result results = 4; + for (unsigned i = 0, + n = static_cast<unsigned>(this->_internal_results_size()); i < n; i++) { + const auto& repfield = this->_internal_results(i); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(4, repfield, repfield.GetCachedSize(), target, stream); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:content_analysis.sdk.ContentAnalysisResponse) + return target; +} + +size_t ContentAnalysisResponse::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:content_analysis.sdk.ContentAnalysisResponse) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // repeated .content_analysis.sdk.ContentAnalysisResponse.Result results = 4; + total_size += 1UL * this->_internal_results_size(); + for (const auto& msg : this->_impl_.results_) { + total_size += + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); + } + + // optional string request_token = 1; + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_request_token()); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::_pbi::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void ContentAnalysisResponse::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::_pbi::DownCast<const ContentAnalysisResponse*>( + &from)); +} + +void ContentAnalysisResponse::MergeFrom(const ContentAnalysisResponse& from) { + ContentAnalysisResponse* const _this = this; + // @@protoc_insertion_point(class_specific_merge_from_start:content_analysis.sdk.ContentAnalysisResponse) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _this->_impl_.results_.MergeFrom(from._impl_.results_); + if (from._internal_has_request_token()) { + _this->_internal_set_request_token(from._internal_request_token()); + } + _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); +} + +void ContentAnalysisResponse::CopyFrom(const ContentAnalysisResponse& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:content_analysis.sdk.ContentAnalysisResponse) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ContentAnalysisResponse::IsInitialized() const { + return true; +} + +void ContentAnalysisResponse::InternalSwap(ContentAnalysisResponse* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); + _impl_.results_.InternalSwap(&other->_impl_.results_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &_impl_.request_token_, lhs_arena, + &other->_impl_.request_token_, rhs_arena + ); +} + +std::string ContentAnalysisResponse::GetTypeName() const { + return "content_analysis.sdk.ContentAnalysisResponse"; +} + + +// =================================================================== + +class ContentAnalysisAcknowledgement::_Internal { + public: + using HasBits = decltype(std::declval<ContentAnalysisAcknowledgement>()._impl_._has_bits_); + static void set_has_request_token(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_status(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static void set_has_final_action(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } +}; + +ContentAnalysisAcknowledgement::ContentAnalysisAcknowledgement(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:content_analysis.sdk.ContentAnalysisAcknowledgement) +} +ContentAnalysisAcknowledgement::ContentAnalysisAcknowledgement(const ContentAnalysisAcknowledgement& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + ContentAnalysisAcknowledgement* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){from._impl_._has_bits_} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.request_token_){} + , decltype(_impl_.final_action_){} + , decltype(_impl_.status_){}}; + + _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); + _impl_.request_token_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.request_token_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_request_token()) { + _this->_impl_.request_token_.Set(from._internal_request_token(), + _this->GetArenaForAllocation()); + } + ::memcpy(&_impl_.final_action_, &from._impl_.final_action_, + static_cast<size_t>(reinterpret_cast<char*>(&_impl_.status_) - + reinterpret_cast<char*>(&_impl_.final_action_)) + sizeof(_impl_.status_)); + // @@protoc_insertion_point(copy_constructor:content_analysis.sdk.ContentAnalysisAcknowledgement) +} + +inline void ContentAnalysisAcknowledgement::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.request_token_){} + , decltype(_impl_.final_action_){0} + , decltype(_impl_.status_){1} + }; + _impl_.request_token_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.request_token_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +} + +ContentAnalysisAcknowledgement::~ContentAnalysisAcknowledgement() { + // @@protoc_insertion_point(destructor:content_analysis.sdk.ContentAnalysisAcknowledgement) + if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void ContentAnalysisAcknowledgement::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + _impl_.request_token_.Destroy(); +} + +void ContentAnalysisAcknowledgement::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void ContentAnalysisAcknowledgement::Clear() { +// @@protoc_insertion_point(message_clear_start:content_analysis.sdk.ContentAnalysisAcknowledgement) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + _impl_.request_token_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000006u) { + _impl_.final_action_ = 0; + _impl_.status_ = 1; + } + _impl_._has_bits_.Clear(); + _internal_metadata_.Clear<std::string>(); +} + +const char* ContentAnalysisAcknowledgement::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional string request_token = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { + auto str = _internal_mutable_request_token(); + ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .content_analysis.sdk.ContentAnalysisAcknowledgement.Status status = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::content_analysis::sdk::ContentAnalysisAcknowledgement_Status_IsValid(val))) { + _internal_set_status(static_cast<::content_analysis::sdk::ContentAnalysisAcknowledgement_Status>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(2, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional .content_analysis.sdk.ContentAnalysisAcknowledgement.FinalAction final_action = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::content_analysis::sdk::ContentAnalysisAcknowledgement_FinalAction_IsValid(val))) { + _internal_set_final_action(static_cast<::content_analysis::sdk::ContentAnalysisAcknowledgement_FinalAction>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(3, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<std::string>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _impl_._has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* ContentAnalysisAcknowledgement::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:content_analysis.sdk.ContentAnalysisAcknowledgement) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + // optional string request_token = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->WriteStringMaybeAliased( + 1, this->_internal_request_token(), target); + } + + // optional .content_analysis.sdk.ContentAnalysisAcknowledgement.Status status = 2; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 2, this->_internal_status(), target); + } + + // optional .content_analysis.sdk.ContentAnalysisAcknowledgement.FinalAction final_action = 3; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 3, this->_internal_final_action(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:content_analysis.sdk.ContentAnalysisAcknowledgement) + return target; +} + +size_t ContentAnalysisAcknowledgement::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:content_analysis.sdk.ContentAnalysisAcknowledgement) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + // optional string request_token = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_request_token()); + } + + // optional .content_analysis.sdk.ContentAnalysisAcknowledgement.FinalAction final_action = 3; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this->_internal_final_action()); + } + + // optional .content_analysis.sdk.ContentAnalysisAcknowledgement.Status status = 2; + if (cached_has_bits & 0x00000004u) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this->_internal_status()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::_pbi::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void ContentAnalysisAcknowledgement::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::_pbi::DownCast<const ContentAnalysisAcknowledgement*>( + &from)); +} + +void ContentAnalysisAcknowledgement::MergeFrom(const ContentAnalysisAcknowledgement& from) { + ContentAnalysisAcknowledgement* const _this = this; + // @@protoc_insertion_point(class_specific_merge_from_start:content_analysis.sdk.ContentAnalysisAcknowledgement) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + if (cached_has_bits & 0x00000001u) { + _this->_internal_set_request_token(from._internal_request_token()); + } + if (cached_has_bits & 0x00000002u) { + _this->_impl_.final_action_ = from._impl_.final_action_; + } + if (cached_has_bits & 0x00000004u) { + _this->_impl_.status_ = from._impl_.status_; + } + _this->_impl_._has_bits_[0] |= cached_has_bits; + } + _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); +} + +void ContentAnalysisAcknowledgement::CopyFrom(const ContentAnalysisAcknowledgement& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:content_analysis.sdk.ContentAnalysisAcknowledgement) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ContentAnalysisAcknowledgement::IsInitialized() const { + return true; +} + +void ContentAnalysisAcknowledgement::InternalSwap(ContentAnalysisAcknowledgement* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &_impl_.request_token_, lhs_arena, + &other->_impl_.request_token_, rhs_arena + ); + swap(_impl_.final_action_, other->_impl_.final_action_); + swap(_impl_.status_, other->_impl_.status_); +} + +std::string ContentAnalysisAcknowledgement::GetTypeName() const { + return "content_analysis.sdk.ContentAnalysisAcknowledgement"; +} + + +// =================================================================== + +class ContentAnalysisCancelRequests::_Internal { + public: + using HasBits = decltype(std::declval<ContentAnalysisCancelRequests>()._impl_._has_bits_); + static void set_has_user_action_id(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } +}; + +ContentAnalysisCancelRequests::ContentAnalysisCancelRequests(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:content_analysis.sdk.ContentAnalysisCancelRequests) +} +ContentAnalysisCancelRequests::ContentAnalysisCancelRequests(const ContentAnalysisCancelRequests& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + ContentAnalysisCancelRequests* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){from._impl_._has_bits_} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.user_action_id_){}}; + + _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); + _impl_.user_action_id_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.user_action_id_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_user_action_id()) { + _this->_impl_.user_action_id_.Set(from._internal_user_action_id(), + _this->GetArenaForAllocation()); + } + // @@protoc_insertion_point(copy_constructor:content_analysis.sdk.ContentAnalysisCancelRequests) +} + +inline void ContentAnalysisCancelRequests::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.user_action_id_){} + }; + _impl_.user_action_id_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.user_action_id_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +} + +ContentAnalysisCancelRequests::~ContentAnalysisCancelRequests() { + // @@protoc_insertion_point(destructor:content_analysis.sdk.ContentAnalysisCancelRequests) + if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void ContentAnalysisCancelRequests::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + _impl_.user_action_id_.Destroy(); +} + +void ContentAnalysisCancelRequests::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void ContentAnalysisCancelRequests::Clear() { +// @@protoc_insertion_point(message_clear_start:content_analysis.sdk.ContentAnalysisCancelRequests) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + _impl_.user_action_id_.ClearNonDefaultToEmpty(); + } + _impl_._has_bits_.Clear(); + _internal_metadata_.Clear<std::string>(); +} + +const char* ContentAnalysisCancelRequests::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional string user_action_id = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { + auto str = _internal_mutable_user_action_id(); + ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<std::string>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _impl_._has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* ContentAnalysisCancelRequests::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:content_analysis.sdk.ContentAnalysisCancelRequests) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + // optional string user_action_id = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->WriteStringMaybeAliased( + 1, this->_internal_user_action_id(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:content_analysis.sdk.ContentAnalysisCancelRequests) + return target; +} + +size_t ContentAnalysisCancelRequests::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:content_analysis.sdk.ContentAnalysisCancelRequests) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // optional string user_action_id = 1; + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_user_action_id()); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::_pbi::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void ContentAnalysisCancelRequests::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::_pbi::DownCast<const ContentAnalysisCancelRequests*>( + &from)); +} + +void ContentAnalysisCancelRequests::MergeFrom(const ContentAnalysisCancelRequests& from) { + ContentAnalysisCancelRequests* const _this = this; + // @@protoc_insertion_point(class_specific_merge_from_start:content_analysis.sdk.ContentAnalysisCancelRequests) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_has_user_action_id()) { + _this->_internal_set_user_action_id(from._internal_user_action_id()); + } + _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); +} + +void ContentAnalysisCancelRequests::CopyFrom(const ContentAnalysisCancelRequests& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:content_analysis.sdk.ContentAnalysisCancelRequests) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ContentAnalysisCancelRequests::IsInitialized() const { + return true; +} + +void ContentAnalysisCancelRequests::InternalSwap(ContentAnalysisCancelRequests* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &_impl_.user_action_id_, lhs_arena, + &other->_impl_.user_action_id_, rhs_arena + ); +} + +std::string ContentAnalysisCancelRequests::GetTypeName() const { + return "content_analysis.sdk.ContentAnalysisCancelRequests"; +} + + +// =================================================================== + +class ChromeToAgent::_Internal { + public: + using HasBits = decltype(std::declval<ChromeToAgent>()._impl_._has_bits_); + static const ::content_analysis::sdk::ContentAnalysisRequest& request(const ChromeToAgent* msg); + static void set_has_request(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static const ::content_analysis::sdk::ContentAnalysisAcknowledgement& ack(const ChromeToAgent* msg); + static void set_has_ack(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static const ::content_analysis::sdk::ContentAnalysisCancelRequests& cancel(const ChromeToAgent* msg); + static void set_has_cancel(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } +}; + +const ::content_analysis::sdk::ContentAnalysisRequest& +ChromeToAgent::_Internal::request(const ChromeToAgent* msg) { + return *msg->_impl_.request_; +} +const ::content_analysis::sdk::ContentAnalysisAcknowledgement& +ChromeToAgent::_Internal::ack(const ChromeToAgent* msg) { + return *msg->_impl_.ack_; +} +const ::content_analysis::sdk::ContentAnalysisCancelRequests& +ChromeToAgent::_Internal::cancel(const ChromeToAgent* msg) { + return *msg->_impl_.cancel_; +} +ChromeToAgent::ChromeToAgent(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:content_analysis.sdk.ChromeToAgent) +} +ChromeToAgent::ChromeToAgent(const ChromeToAgent& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + ChromeToAgent* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){from._impl_._has_bits_} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.request_){nullptr} + , decltype(_impl_.ack_){nullptr} + , decltype(_impl_.cancel_){nullptr}}; + + _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); + if (from._internal_has_request()) { + _this->_impl_.request_ = new ::content_analysis::sdk::ContentAnalysisRequest(*from._impl_.request_); + } + if (from._internal_has_ack()) { + _this->_impl_.ack_ = new ::content_analysis::sdk::ContentAnalysisAcknowledgement(*from._impl_.ack_); + } + if (from._internal_has_cancel()) { + _this->_impl_.cancel_ = new ::content_analysis::sdk::ContentAnalysisCancelRequests(*from._impl_.cancel_); + } + // @@protoc_insertion_point(copy_constructor:content_analysis.sdk.ChromeToAgent) +} + +inline void ChromeToAgent::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.request_){nullptr} + , decltype(_impl_.ack_){nullptr} + , decltype(_impl_.cancel_){nullptr} + }; +} + +ChromeToAgent::~ChromeToAgent() { + // @@protoc_insertion_point(destructor:content_analysis.sdk.ChromeToAgent) + if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void ChromeToAgent::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + if (this != internal_default_instance()) delete _impl_.request_; + if (this != internal_default_instance()) delete _impl_.ack_; + if (this != internal_default_instance()) delete _impl_.cancel_; +} + +void ChromeToAgent::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void ChromeToAgent::Clear() { +// @@protoc_insertion_point(message_clear_start:content_analysis.sdk.ChromeToAgent) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + if (cached_has_bits & 0x00000001u) { + GOOGLE_DCHECK(_impl_.request_ != nullptr); + _impl_.request_->Clear(); + } + if (cached_has_bits & 0x00000002u) { + GOOGLE_DCHECK(_impl_.ack_ != nullptr); + _impl_.ack_->Clear(); + } + if (cached_has_bits & 0x00000004u) { + GOOGLE_DCHECK(_impl_.cancel_ != nullptr); + _impl_.cancel_->Clear(); + } + } + _impl_._has_bits_.Clear(); + _internal_metadata_.Clear<std::string>(); +} + +const char* ChromeToAgent::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .content_analysis.sdk.ContentAnalysisRequest request = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { + ptr = ctx->ParseMessage(_internal_mutable_request(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .content_analysis.sdk.ContentAnalysisAcknowledgement ack = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) { + ptr = ctx->ParseMessage(_internal_mutable_ack(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .content_analysis.sdk.ContentAnalysisCancelRequests cancel = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) { + ptr = ctx->ParseMessage(_internal_mutable_cancel(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<std::string>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _impl_._has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* ChromeToAgent::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:content_analysis.sdk.ChromeToAgent) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + // optional .content_analysis.sdk.ContentAnalysisRequest request = 1; + if (cached_has_bits & 0x00000001u) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(1, _Internal::request(this), + _Internal::request(this).GetCachedSize(), target, stream); + } + + // optional .content_analysis.sdk.ContentAnalysisAcknowledgement ack = 2; + if (cached_has_bits & 0x00000002u) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(2, _Internal::ack(this), + _Internal::ack(this).GetCachedSize(), target, stream); + } + + // optional .content_analysis.sdk.ContentAnalysisCancelRequests cancel = 3; + if (cached_has_bits & 0x00000004u) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(3, _Internal::cancel(this), + _Internal::cancel(this).GetCachedSize(), target, stream); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:content_analysis.sdk.ChromeToAgent) + return target; +} + +size_t ChromeToAgent::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:content_analysis.sdk.ChromeToAgent) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + // optional .content_analysis.sdk.ContentAnalysisRequest request = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *_impl_.request_); + } + + // optional .content_analysis.sdk.ContentAnalysisAcknowledgement ack = 2; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *_impl_.ack_); + } + + // optional .content_analysis.sdk.ContentAnalysisCancelRequests cancel = 3; + if (cached_has_bits & 0x00000004u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *_impl_.cancel_); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::_pbi::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void ChromeToAgent::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::_pbi::DownCast<const ChromeToAgent*>( + &from)); +} + +void ChromeToAgent::MergeFrom(const ChromeToAgent& from) { + ChromeToAgent* const _this = this; + // @@protoc_insertion_point(class_specific_merge_from_start:content_analysis.sdk.ChromeToAgent) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + if (cached_has_bits & 0x00000001u) { + _this->_internal_mutable_request()->::content_analysis::sdk::ContentAnalysisRequest::MergeFrom( + from._internal_request()); + } + if (cached_has_bits & 0x00000002u) { + _this->_internal_mutable_ack()->::content_analysis::sdk::ContentAnalysisAcknowledgement::MergeFrom( + from._internal_ack()); + } + if (cached_has_bits & 0x00000004u) { + _this->_internal_mutable_cancel()->::content_analysis::sdk::ContentAnalysisCancelRequests::MergeFrom( + from._internal_cancel()); + } + } + _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); +} + +void ChromeToAgent::CopyFrom(const ChromeToAgent& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:content_analysis.sdk.ChromeToAgent) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ChromeToAgent::IsInitialized() const { + if (_internal_has_request()) { + if (!_impl_.request_->IsInitialized()) return false; + } + return true; +} + +void ChromeToAgent::InternalSwap(ChromeToAgent* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(ChromeToAgent, _impl_.cancel_) + + sizeof(ChromeToAgent::_impl_.cancel_) + - PROTOBUF_FIELD_OFFSET(ChromeToAgent, _impl_.request_)>( + reinterpret_cast<char*>(&_impl_.request_), + reinterpret_cast<char*>(&other->_impl_.request_)); +} + +std::string ChromeToAgent::GetTypeName() const { + return "content_analysis.sdk.ChromeToAgent"; +} + + +// =================================================================== + +class AgentToChrome::_Internal { + public: + using HasBits = decltype(std::declval<AgentToChrome>()._impl_._has_bits_); + static const ::content_analysis::sdk::ContentAnalysisResponse& response(const AgentToChrome* msg); + static void set_has_response(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } +}; + +const ::content_analysis::sdk::ContentAnalysisResponse& +AgentToChrome::_Internal::response(const AgentToChrome* msg) { + return *msg->_impl_.response_; +} +AgentToChrome::AgentToChrome(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:content_analysis.sdk.AgentToChrome) +} +AgentToChrome::AgentToChrome(const AgentToChrome& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + AgentToChrome* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){from._impl_._has_bits_} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.response_){nullptr}}; + + _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); + if (from._internal_has_response()) { + _this->_impl_.response_ = new ::content_analysis::sdk::ContentAnalysisResponse(*from._impl_.response_); + } + // @@protoc_insertion_point(copy_constructor:content_analysis.sdk.AgentToChrome) +} + +inline void AgentToChrome::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_._has_bits_){} + , /*decltype(_impl_._cached_size_)*/{} + , decltype(_impl_.response_){nullptr} + }; +} + +AgentToChrome::~AgentToChrome() { + // @@protoc_insertion_point(destructor:content_analysis.sdk.AgentToChrome) + if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void AgentToChrome::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + if (this != internal_default_instance()) delete _impl_.response_; +} + +void AgentToChrome::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void AgentToChrome::Clear() { +// @@protoc_insertion_point(message_clear_start:content_analysis.sdk.AgentToChrome) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + GOOGLE_DCHECK(_impl_.response_ != nullptr); + _impl_.response_->Clear(); + } + _impl_._has_bits_.Clear(); + _internal_metadata_.Clear<std::string>(); +} + +const char* AgentToChrome::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .content_analysis.sdk.ContentAnalysisResponse response = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { + ptr = ctx->ParseMessage(_internal_mutable_response(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<std::string>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _impl_._has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* AgentToChrome::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:content_analysis.sdk.AgentToChrome) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + // optional .content_analysis.sdk.ContentAnalysisResponse response = 1; + if (cached_has_bits & 0x00000001u) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(1, _Internal::response(this), + _Internal::response(this).GetCachedSize(), target, stream); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:content_analysis.sdk.AgentToChrome) + return target; +} + +size_t AgentToChrome::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:content_analysis.sdk.AgentToChrome) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // optional .content_analysis.sdk.ContentAnalysisResponse response = 1; + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *_impl_.response_); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::_pbi::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void AgentToChrome::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::_pbi::DownCast<const AgentToChrome*>( + &from)); +} + +void AgentToChrome::MergeFrom(const AgentToChrome& from) { + AgentToChrome* const _this = this; + // @@protoc_insertion_point(class_specific_merge_from_start:content_analysis.sdk.AgentToChrome) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_has_response()) { + _this->_internal_mutable_response()->::content_analysis::sdk::ContentAnalysisResponse::MergeFrom( + from._internal_response()); + } + _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_); +} + +void AgentToChrome::CopyFrom(const AgentToChrome& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:content_analysis.sdk.AgentToChrome) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool AgentToChrome::IsInitialized() const { + return true; +} + +void AgentToChrome::InternalSwap(AgentToChrome* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); + swap(_impl_.response_, other->_impl_.response_); +} + +std::string AgentToChrome::GetTypeName() const { + return "content_analysis.sdk.AgentToChrome"; +} + + +// @@protoc_insertion_point(namespace_scope) +} // namespace sdk +} // namespace content_analysis +PROTOBUF_NAMESPACE_OPEN +template<> PROTOBUF_NOINLINE ::content_analysis::sdk::ContentMetaData_PrintMetadata* +Arena::CreateMaybeMessage< ::content_analysis::sdk::ContentMetaData_PrintMetadata >(Arena* arena) { + return Arena::CreateMessageInternal< ::content_analysis::sdk::ContentMetaData_PrintMetadata >(arena); +} +template<> PROTOBUF_NOINLINE ::content_analysis::sdk::ContentMetaData* +Arena::CreateMaybeMessage< ::content_analysis::sdk::ContentMetaData >(Arena* arena) { + return Arena::CreateMessageInternal< ::content_analysis::sdk::ContentMetaData >(arena); +} +template<> PROTOBUF_NOINLINE ::content_analysis::sdk::ClientMetadata_Browser* +Arena::CreateMaybeMessage< ::content_analysis::sdk::ClientMetadata_Browser >(Arena* arena) { + return Arena::CreateMessageInternal< ::content_analysis::sdk::ClientMetadata_Browser >(arena); +} +template<> PROTOBUF_NOINLINE ::content_analysis::sdk::ClientMetadata* +Arena::CreateMaybeMessage< ::content_analysis::sdk::ClientMetadata >(Arena* arena) { + return Arena::CreateMessageInternal< ::content_analysis::sdk::ClientMetadata >(arena); +} +template<> PROTOBUF_NOINLINE ::content_analysis::sdk::ClientDownloadRequest_Resource* +Arena::CreateMaybeMessage< ::content_analysis::sdk::ClientDownloadRequest_Resource >(Arena* arena) { + return Arena::CreateMessageInternal< ::content_analysis::sdk::ClientDownloadRequest_Resource >(arena); +} +template<> PROTOBUF_NOINLINE ::content_analysis::sdk::ClientDownloadRequest* +Arena::CreateMaybeMessage< ::content_analysis::sdk::ClientDownloadRequest >(Arena* arena) { + return Arena::CreateMessageInternal< ::content_analysis::sdk::ClientDownloadRequest >(arena); +} +template<> PROTOBUF_NOINLINE ::content_analysis::sdk::ContentAnalysisRequest_PrintData* +Arena::CreateMaybeMessage< ::content_analysis::sdk::ContentAnalysisRequest_PrintData >(Arena* arena) { + return Arena::CreateMessageInternal< ::content_analysis::sdk::ContentAnalysisRequest_PrintData >(arena); +} +template<> PROTOBUF_NOINLINE ::content_analysis::sdk::ContentAnalysisRequest* +Arena::CreateMaybeMessage< ::content_analysis::sdk::ContentAnalysisRequest >(Arena* arena) { + return Arena::CreateMessageInternal< ::content_analysis::sdk::ContentAnalysisRequest >(arena); +} +template<> PROTOBUF_NOINLINE ::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule* +Arena::CreateMaybeMessage< ::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule >(Arena* arena) { + return Arena::CreateMessageInternal< ::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule >(arena); +} +template<> PROTOBUF_NOINLINE ::content_analysis::sdk::ContentAnalysisResponse_Result* +Arena::CreateMaybeMessage< ::content_analysis::sdk::ContentAnalysisResponse_Result >(Arena* arena) { + return Arena::CreateMessageInternal< ::content_analysis::sdk::ContentAnalysisResponse_Result >(arena); +} +template<> PROTOBUF_NOINLINE ::content_analysis::sdk::ContentAnalysisResponse* +Arena::CreateMaybeMessage< ::content_analysis::sdk::ContentAnalysisResponse >(Arena* arena) { + return Arena::CreateMessageInternal< ::content_analysis::sdk::ContentAnalysisResponse >(arena); +} +template<> PROTOBUF_NOINLINE ::content_analysis::sdk::ContentAnalysisAcknowledgement* +Arena::CreateMaybeMessage< ::content_analysis::sdk::ContentAnalysisAcknowledgement >(Arena* arena) { + return Arena::CreateMessageInternal< ::content_analysis::sdk::ContentAnalysisAcknowledgement >(arena); +} +template<> PROTOBUF_NOINLINE ::content_analysis::sdk::ContentAnalysisCancelRequests* +Arena::CreateMaybeMessage< ::content_analysis::sdk::ContentAnalysisCancelRequests >(Arena* arena) { + return Arena::CreateMessageInternal< ::content_analysis::sdk::ContentAnalysisCancelRequests >(arena); +} +template<> PROTOBUF_NOINLINE ::content_analysis::sdk::ChromeToAgent* +Arena::CreateMaybeMessage< ::content_analysis::sdk::ChromeToAgent >(Arena* arena) { + return Arena::CreateMessageInternal< ::content_analysis::sdk::ChromeToAgent >(arena); +} +template<> PROTOBUF_NOINLINE ::content_analysis::sdk::AgentToChrome* +Arena::CreateMaybeMessage< ::content_analysis::sdk::AgentToChrome >(Arena* arena) { + return Arena::CreateMessageInternal< ::content_analysis::sdk::AgentToChrome >(arena); +} +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) +#include <google/protobuf/port_undef.inc> diff --git a/toolkit/components/contentanalysis/content_analysis/sdk/analysis.pb.h b/toolkit/components/contentanalysis/content_analysis/sdk/analysis.pb.h new file mode 100644 index 0000000000..186cc97649 --- /dev/null +++ b/toolkit/components/contentanalysis/content_analysis/sdk/analysis.pb.h @@ -0,0 +1,5958 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: analysis.proto + +#ifndef GOOGLE_PROTOBUF_INCLUDED_analysis_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_analysis_2eproto + +#include <limits> +#include <string> + +#include <google/protobuf/port_def.inc> +#if PROTOBUF_VERSION < 3021000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3021006 < PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include <google/protobuf/port_undef.inc> +#include <google/protobuf/io/coded_stream.h> +#include <google/protobuf/arena.h> +#include <google/protobuf/arenastring.h> +#include <google/protobuf/generated_message_util.h> +#include <google/protobuf/metadata_lite.h> +#include <google/protobuf/message_lite.h> +#include <google/protobuf/repeated_field.h> // IWYU pragma: export +#include <google/protobuf/extension_set.h> // IWYU pragma: export +#include <google/protobuf/generated_enum_util.h> +// @@protoc_insertion_point(includes) +#include <google/protobuf/port_def.inc> +#define PROTOBUF_INTERNAL_EXPORT_analysis_2eproto +PROTOBUF_NAMESPACE_OPEN +namespace internal { +class AnyMetadata; +} // namespace internal +PROTOBUF_NAMESPACE_CLOSE + +// Internal implementation detail -- do not use these members. +struct TableStruct_analysis_2eproto { + static const uint32_t offsets[]; +}; +namespace content_analysis { +namespace sdk { +class AgentToChrome; +struct AgentToChromeDefaultTypeInternal; +extern AgentToChromeDefaultTypeInternal _AgentToChrome_default_instance_; +class ChromeToAgent; +struct ChromeToAgentDefaultTypeInternal; +extern ChromeToAgentDefaultTypeInternal _ChromeToAgent_default_instance_; +class ClientDownloadRequest; +struct ClientDownloadRequestDefaultTypeInternal; +extern ClientDownloadRequestDefaultTypeInternal _ClientDownloadRequest_default_instance_; +class ClientDownloadRequest_Resource; +struct ClientDownloadRequest_ResourceDefaultTypeInternal; +extern ClientDownloadRequest_ResourceDefaultTypeInternal _ClientDownloadRequest_Resource_default_instance_; +class ClientMetadata; +struct ClientMetadataDefaultTypeInternal; +extern ClientMetadataDefaultTypeInternal _ClientMetadata_default_instance_; +class ClientMetadata_Browser; +struct ClientMetadata_BrowserDefaultTypeInternal; +extern ClientMetadata_BrowserDefaultTypeInternal _ClientMetadata_Browser_default_instance_; +class ContentAnalysisAcknowledgement; +struct ContentAnalysisAcknowledgementDefaultTypeInternal; +extern ContentAnalysisAcknowledgementDefaultTypeInternal _ContentAnalysisAcknowledgement_default_instance_; +class ContentAnalysisCancelRequests; +struct ContentAnalysisCancelRequestsDefaultTypeInternal; +extern ContentAnalysisCancelRequestsDefaultTypeInternal _ContentAnalysisCancelRequests_default_instance_; +class ContentAnalysisRequest; +struct ContentAnalysisRequestDefaultTypeInternal; +extern ContentAnalysisRequestDefaultTypeInternal _ContentAnalysisRequest_default_instance_; +class ContentAnalysisRequest_PrintData; +struct ContentAnalysisRequest_PrintDataDefaultTypeInternal; +extern ContentAnalysisRequest_PrintDataDefaultTypeInternal _ContentAnalysisRequest_PrintData_default_instance_; +class ContentAnalysisResponse; +struct ContentAnalysisResponseDefaultTypeInternal; +extern ContentAnalysisResponseDefaultTypeInternal _ContentAnalysisResponse_default_instance_; +class ContentAnalysisResponse_Result; +struct ContentAnalysisResponse_ResultDefaultTypeInternal; +extern ContentAnalysisResponse_ResultDefaultTypeInternal _ContentAnalysisResponse_Result_default_instance_; +class ContentAnalysisResponse_Result_TriggeredRule; +struct ContentAnalysisResponse_Result_TriggeredRuleDefaultTypeInternal; +extern ContentAnalysisResponse_Result_TriggeredRuleDefaultTypeInternal _ContentAnalysisResponse_Result_TriggeredRule_default_instance_; +class ContentMetaData; +struct ContentMetaDataDefaultTypeInternal; +extern ContentMetaDataDefaultTypeInternal _ContentMetaData_default_instance_; +class ContentMetaData_PrintMetadata; +struct ContentMetaData_PrintMetadataDefaultTypeInternal; +extern ContentMetaData_PrintMetadataDefaultTypeInternal _ContentMetaData_PrintMetadata_default_instance_; +} // namespace sdk +} // namespace content_analysis +PROTOBUF_NAMESPACE_OPEN +template<> ::content_analysis::sdk::AgentToChrome* Arena::CreateMaybeMessage<::content_analysis::sdk::AgentToChrome>(Arena*); +template<> ::content_analysis::sdk::ChromeToAgent* Arena::CreateMaybeMessage<::content_analysis::sdk::ChromeToAgent>(Arena*); +template<> ::content_analysis::sdk::ClientDownloadRequest* Arena::CreateMaybeMessage<::content_analysis::sdk::ClientDownloadRequest>(Arena*); +template<> ::content_analysis::sdk::ClientDownloadRequest_Resource* Arena::CreateMaybeMessage<::content_analysis::sdk::ClientDownloadRequest_Resource>(Arena*); +template<> ::content_analysis::sdk::ClientMetadata* Arena::CreateMaybeMessage<::content_analysis::sdk::ClientMetadata>(Arena*); +template<> ::content_analysis::sdk::ClientMetadata_Browser* Arena::CreateMaybeMessage<::content_analysis::sdk::ClientMetadata_Browser>(Arena*); +template<> ::content_analysis::sdk::ContentAnalysisAcknowledgement* Arena::CreateMaybeMessage<::content_analysis::sdk::ContentAnalysisAcknowledgement>(Arena*); +template<> ::content_analysis::sdk::ContentAnalysisCancelRequests* Arena::CreateMaybeMessage<::content_analysis::sdk::ContentAnalysisCancelRequests>(Arena*); +template<> ::content_analysis::sdk::ContentAnalysisRequest* Arena::CreateMaybeMessage<::content_analysis::sdk::ContentAnalysisRequest>(Arena*); +template<> ::content_analysis::sdk::ContentAnalysisRequest_PrintData* Arena::CreateMaybeMessage<::content_analysis::sdk::ContentAnalysisRequest_PrintData>(Arena*); +template<> ::content_analysis::sdk::ContentAnalysisResponse* Arena::CreateMaybeMessage<::content_analysis::sdk::ContentAnalysisResponse>(Arena*); +template<> ::content_analysis::sdk::ContentAnalysisResponse_Result* Arena::CreateMaybeMessage<::content_analysis::sdk::ContentAnalysisResponse_Result>(Arena*); +template<> ::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule* Arena::CreateMaybeMessage<::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule>(Arena*); +template<> ::content_analysis::sdk::ContentMetaData* Arena::CreateMaybeMessage<::content_analysis::sdk::ContentMetaData>(Arena*); +template<> ::content_analysis::sdk::ContentMetaData_PrintMetadata* Arena::CreateMaybeMessage<::content_analysis::sdk::ContentMetaData_PrintMetadata>(Arena*); +PROTOBUF_NAMESPACE_CLOSE +namespace content_analysis { +namespace sdk { + +enum ContentMetaData_PrintMetadata_PrinterType : int { + ContentMetaData_PrintMetadata_PrinterType_UNKNOWN = 0, + ContentMetaData_PrintMetadata_PrinterType_CLOUD = 1, + ContentMetaData_PrintMetadata_PrinterType_LOCAL = 2 +}; +bool ContentMetaData_PrintMetadata_PrinterType_IsValid(int value); +constexpr ContentMetaData_PrintMetadata_PrinterType ContentMetaData_PrintMetadata_PrinterType_PrinterType_MIN = ContentMetaData_PrintMetadata_PrinterType_UNKNOWN; +constexpr ContentMetaData_PrintMetadata_PrinterType ContentMetaData_PrintMetadata_PrinterType_PrinterType_MAX = ContentMetaData_PrintMetadata_PrinterType_LOCAL; +constexpr int ContentMetaData_PrintMetadata_PrinterType_PrinterType_ARRAYSIZE = ContentMetaData_PrintMetadata_PrinterType_PrinterType_MAX + 1; + +const std::string& ContentMetaData_PrintMetadata_PrinterType_Name(ContentMetaData_PrintMetadata_PrinterType value); +template<typename T> +inline const std::string& ContentMetaData_PrintMetadata_PrinterType_Name(T enum_t_value) { + static_assert(::std::is_same<T, ContentMetaData_PrintMetadata_PrinterType>::value || + ::std::is_integral<T>::value, + "Incorrect type passed to function ContentMetaData_PrintMetadata_PrinterType_Name."); + return ContentMetaData_PrintMetadata_PrinterType_Name(static_cast<ContentMetaData_PrintMetadata_PrinterType>(enum_t_value)); +} +bool ContentMetaData_PrintMetadata_PrinterType_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ContentMetaData_PrintMetadata_PrinterType* value); +enum ClientDownloadRequest_ResourceType : int { + ClientDownloadRequest_ResourceType_DOWNLOAD_URL = 0, + ClientDownloadRequest_ResourceType_DOWNLOAD_REDIRECT = 1, + ClientDownloadRequest_ResourceType_TAB_URL = 2, + ClientDownloadRequest_ResourceType_TAB_REDIRECT = 3, + ClientDownloadRequest_ResourceType_PPAPI_DOCUMENT = 4, + ClientDownloadRequest_ResourceType_PPAPI_PLUGIN = 5 +}; +bool ClientDownloadRequest_ResourceType_IsValid(int value); +constexpr ClientDownloadRequest_ResourceType ClientDownloadRequest_ResourceType_ResourceType_MIN = ClientDownloadRequest_ResourceType_DOWNLOAD_URL; +constexpr ClientDownloadRequest_ResourceType ClientDownloadRequest_ResourceType_ResourceType_MAX = ClientDownloadRequest_ResourceType_PPAPI_PLUGIN; +constexpr int ClientDownloadRequest_ResourceType_ResourceType_ARRAYSIZE = ClientDownloadRequest_ResourceType_ResourceType_MAX + 1; + +const std::string& ClientDownloadRequest_ResourceType_Name(ClientDownloadRequest_ResourceType value); +template<typename T> +inline const std::string& ClientDownloadRequest_ResourceType_Name(T enum_t_value) { + static_assert(::std::is_same<T, ClientDownloadRequest_ResourceType>::value || + ::std::is_integral<T>::value, + "Incorrect type passed to function ClientDownloadRequest_ResourceType_Name."); + return ClientDownloadRequest_ResourceType_Name(static_cast<ClientDownloadRequest_ResourceType>(enum_t_value)); +} +bool ClientDownloadRequest_ResourceType_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ClientDownloadRequest_ResourceType* value); +enum ContentAnalysisResponse_Result_TriggeredRule_Action : int { + ContentAnalysisResponse_Result_TriggeredRule_Action_ACTION_UNSPECIFIED = 0, + ContentAnalysisResponse_Result_TriggeredRule_Action_REPORT_ONLY = 1, + ContentAnalysisResponse_Result_TriggeredRule_Action_WARN = 2, + ContentAnalysisResponse_Result_TriggeredRule_Action_BLOCK = 3 +}; +bool ContentAnalysisResponse_Result_TriggeredRule_Action_IsValid(int value); +constexpr ContentAnalysisResponse_Result_TriggeredRule_Action ContentAnalysisResponse_Result_TriggeredRule_Action_Action_MIN = ContentAnalysisResponse_Result_TriggeredRule_Action_ACTION_UNSPECIFIED; +constexpr ContentAnalysisResponse_Result_TriggeredRule_Action ContentAnalysisResponse_Result_TriggeredRule_Action_Action_MAX = ContentAnalysisResponse_Result_TriggeredRule_Action_BLOCK; +constexpr int ContentAnalysisResponse_Result_TriggeredRule_Action_Action_ARRAYSIZE = ContentAnalysisResponse_Result_TriggeredRule_Action_Action_MAX + 1; + +const std::string& ContentAnalysisResponse_Result_TriggeredRule_Action_Name(ContentAnalysisResponse_Result_TriggeredRule_Action value); +template<typename T> +inline const std::string& ContentAnalysisResponse_Result_TriggeredRule_Action_Name(T enum_t_value) { + static_assert(::std::is_same<T, ContentAnalysisResponse_Result_TriggeredRule_Action>::value || + ::std::is_integral<T>::value, + "Incorrect type passed to function ContentAnalysisResponse_Result_TriggeredRule_Action_Name."); + return ContentAnalysisResponse_Result_TriggeredRule_Action_Name(static_cast<ContentAnalysisResponse_Result_TriggeredRule_Action>(enum_t_value)); +} +bool ContentAnalysisResponse_Result_TriggeredRule_Action_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ContentAnalysisResponse_Result_TriggeredRule_Action* value); +enum ContentAnalysisResponse_Result_Status : int { + ContentAnalysisResponse_Result_Status_STATUS_UNKNOWN = 0, + ContentAnalysisResponse_Result_Status_SUCCESS = 1, + ContentAnalysisResponse_Result_Status_FAILURE = 2 +}; +bool ContentAnalysisResponse_Result_Status_IsValid(int value); +constexpr ContentAnalysisResponse_Result_Status ContentAnalysisResponse_Result_Status_Status_MIN = ContentAnalysisResponse_Result_Status_STATUS_UNKNOWN; +constexpr ContentAnalysisResponse_Result_Status ContentAnalysisResponse_Result_Status_Status_MAX = ContentAnalysisResponse_Result_Status_FAILURE; +constexpr int ContentAnalysisResponse_Result_Status_Status_ARRAYSIZE = ContentAnalysisResponse_Result_Status_Status_MAX + 1; + +const std::string& ContentAnalysisResponse_Result_Status_Name(ContentAnalysisResponse_Result_Status value); +template<typename T> +inline const std::string& ContentAnalysisResponse_Result_Status_Name(T enum_t_value) { + static_assert(::std::is_same<T, ContentAnalysisResponse_Result_Status>::value || + ::std::is_integral<T>::value, + "Incorrect type passed to function ContentAnalysisResponse_Result_Status_Name."); + return ContentAnalysisResponse_Result_Status_Name(static_cast<ContentAnalysisResponse_Result_Status>(enum_t_value)); +} +bool ContentAnalysisResponse_Result_Status_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ContentAnalysisResponse_Result_Status* value); +enum ContentAnalysisAcknowledgement_Status : int { + ContentAnalysisAcknowledgement_Status_SUCCESS = 1, + ContentAnalysisAcknowledgement_Status_INVALID_RESPONSE = 2, + ContentAnalysisAcknowledgement_Status_TOO_LATE = 3 +}; +bool ContentAnalysisAcknowledgement_Status_IsValid(int value); +constexpr ContentAnalysisAcknowledgement_Status ContentAnalysisAcknowledgement_Status_Status_MIN = ContentAnalysisAcknowledgement_Status_SUCCESS; +constexpr ContentAnalysisAcknowledgement_Status ContentAnalysisAcknowledgement_Status_Status_MAX = ContentAnalysisAcknowledgement_Status_TOO_LATE; +constexpr int ContentAnalysisAcknowledgement_Status_Status_ARRAYSIZE = ContentAnalysisAcknowledgement_Status_Status_MAX + 1; + +const std::string& ContentAnalysisAcknowledgement_Status_Name(ContentAnalysisAcknowledgement_Status value); +template<typename T> +inline const std::string& ContentAnalysisAcknowledgement_Status_Name(T enum_t_value) { + static_assert(::std::is_same<T, ContentAnalysisAcknowledgement_Status>::value || + ::std::is_integral<T>::value, + "Incorrect type passed to function ContentAnalysisAcknowledgement_Status_Name."); + return ContentAnalysisAcknowledgement_Status_Name(static_cast<ContentAnalysisAcknowledgement_Status>(enum_t_value)); +} +bool ContentAnalysisAcknowledgement_Status_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ContentAnalysisAcknowledgement_Status* value); +enum ContentAnalysisAcknowledgement_FinalAction : int { + ContentAnalysisAcknowledgement_FinalAction_ACTION_UNSPECIFIED = 0, + ContentAnalysisAcknowledgement_FinalAction_ALLOW = 1, + ContentAnalysisAcknowledgement_FinalAction_REPORT_ONLY = 2, + ContentAnalysisAcknowledgement_FinalAction_WARN = 3, + ContentAnalysisAcknowledgement_FinalAction_BLOCK = 4 +}; +bool ContentAnalysisAcknowledgement_FinalAction_IsValid(int value); +constexpr ContentAnalysisAcknowledgement_FinalAction ContentAnalysisAcknowledgement_FinalAction_FinalAction_MIN = ContentAnalysisAcknowledgement_FinalAction_ACTION_UNSPECIFIED; +constexpr ContentAnalysisAcknowledgement_FinalAction ContentAnalysisAcknowledgement_FinalAction_FinalAction_MAX = ContentAnalysisAcknowledgement_FinalAction_BLOCK; +constexpr int ContentAnalysisAcknowledgement_FinalAction_FinalAction_ARRAYSIZE = ContentAnalysisAcknowledgement_FinalAction_FinalAction_MAX + 1; + +const std::string& ContentAnalysisAcknowledgement_FinalAction_Name(ContentAnalysisAcknowledgement_FinalAction value); +template<typename T> +inline const std::string& ContentAnalysisAcknowledgement_FinalAction_Name(T enum_t_value) { + static_assert(::std::is_same<T, ContentAnalysisAcknowledgement_FinalAction>::value || + ::std::is_integral<T>::value, + "Incorrect type passed to function ContentAnalysisAcknowledgement_FinalAction_Name."); + return ContentAnalysisAcknowledgement_FinalAction_Name(static_cast<ContentAnalysisAcknowledgement_FinalAction>(enum_t_value)); +} +bool ContentAnalysisAcknowledgement_FinalAction_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ContentAnalysisAcknowledgement_FinalAction* value); +enum AnalysisConnector : int { + ANALYSIS_CONNECTOR_UNSPECIFIED = 0, + FILE_DOWNLOADED = 1, + FILE_ATTACHED = 2, + BULK_DATA_ENTRY = 3, + PRINT = 4, + FILE_TRANSFER = 5 +}; +bool AnalysisConnector_IsValid(int value); +constexpr AnalysisConnector AnalysisConnector_MIN = ANALYSIS_CONNECTOR_UNSPECIFIED; +constexpr AnalysisConnector AnalysisConnector_MAX = FILE_TRANSFER; +constexpr int AnalysisConnector_ARRAYSIZE = AnalysisConnector_MAX + 1; + +const std::string& AnalysisConnector_Name(AnalysisConnector value); +template<typename T> +inline const std::string& AnalysisConnector_Name(T enum_t_value) { + static_assert(::std::is_same<T, AnalysisConnector>::value || + ::std::is_integral<T>::value, + "Incorrect type passed to function AnalysisConnector_Name."); + return AnalysisConnector_Name(static_cast<AnalysisConnector>(enum_t_value)); +} +bool AnalysisConnector_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, AnalysisConnector* value); +// =================================================================== + +class ContentMetaData_PrintMetadata final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:content_analysis.sdk.ContentMetaData.PrintMetadata) */ { + public: + inline ContentMetaData_PrintMetadata() : ContentMetaData_PrintMetadata(nullptr) {} + ~ContentMetaData_PrintMetadata() override; + explicit PROTOBUF_CONSTEXPR ContentMetaData_PrintMetadata(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + ContentMetaData_PrintMetadata(const ContentMetaData_PrintMetadata& from); + ContentMetaData_PrintMetadata(ContentMetaData_PrintMetadata&& from) noexcept + : ContentMetaData_PrintMetadata() { + *this = ::std::move(from); + } + + inline ContentMetaData_PrintMetadata& operator=(const ContentMetaData_PrintMetadata& from) { + CopyFrom(from); + return *this; + } + inline ContentMetaData_PrintMetadata& operator=(ContentMetaData_PrintMetadata&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<std::string>(); + } + + static const ContentMetaData_PrintMetadata& default_instance() { + return *internal_default_instance(); + } + static inline const ContentMetaData_PrintMetadata* internal_default_instance() { + return reinterpret_cast<const ContentMetaData_PrintMetadata*>( + &_ContentMetaData_PrintMetadata_default_instance_); + } + static constexpr int kIndexInFileMessages = + 0; + + friend void swap(ContentMetaData_PrintMetadata& a, ContentMetaData_PrintMetadata& b) { + a.Swap(&b); + } + inline void Swap(ContentMetaData_PrintMetadata* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ContentMetaData_PrintMetadata* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + ContentMetaData_PrintMetadata* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage<ContentMetaData_PrintMetadata>(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const ContentMetaData_PrintMetadata& from); + void MergeFrom(const ContentMetaData_PrintMetadata& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ContentMetaData_PrintMetadata* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "content_analysis.sdk.ContentMetaData.PrintMetadata"; + } + protected: + explicit ContentMetaData_PrintMetadata(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + typedef ContentMetaData_PrintMetadata_PrinterType PrinterType; + static constexpr PrinterType UNKNOWN = + ContentMetaData_PrintMetadata_PrinterType_UNKNOWN; + static constexpr PrinterType CLOUD = + ContentMetaData_PrintMetadata_PrinterType_CLOUD; + static constexpr PrinterType LOCAL = + ContentMetaData_PrintMetadata_PrinterType_LOCAL; + static inline bool PrinterType_IsValid(int value) { + return ContentMetaData_PrintMetadata_PrinterType_IsValid(value); + } + static constexpr PrinterType PrinterType_MIN = + ContentMetaData_PrintMetadata_PrinterType_PrinterType_MIN; + static constexpr PrinterType PrinterType_MAX = + ContentMetaData_PrintMetadata_PrinterType_PrinterType_MAX; + static constexpr int PrinterType_ARRAYSIZE = + ContentMetaData_PrintMetadata_PrinterType_PrinterType_ARRAYSIZE; + template<typename T> + static inline const std::string& PrinterType_Name(T enum_t_value) { + static_assert(::std::is_same<T, PrinterType>::value || + ::std::is_integral<T>::value, + "Incorrect type passed to function PrinterType_Name."); + return ContentMetaData_PrintMetadata_PrinterType_Name(enum_t_value); + } + static inline bool PrinterType_Parse(::PROTOBUF_NAMESPACE_ID::ConstStringParam name, + PrinterType* value) { + return ContentMetaData_PrintMetadata_PrinterType_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kPrinterNameFieldNumber = 1, + kPrinterTypeFieldNumber = 2, + }; + // optional string printer_name = 1; + bool has_printer_name() const; + private: + bool _internal_has_printer_name() const; + public: + void clear_printer_name(); + const std::string& printer_name() const; + template <typename ArgT0 = const std::string&, typename... ArgT> + void set_printer_name(ArgT0&& arg0, ArgT... args); + std::string* mutable_printer_name(); + PROTOBUF_NODISCARD std::string* release_printer_name(); + void set_allocated_printer_name(std::string* printer_name); + private: + const std::string& _internal_printer_name() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_printer_name(const std::string& value); + std::string* _internal_mutable_printer_name(); + public: + + // optional .content_analysis.sdk.ContentMetaData.PrintMetadata.PrinterType printer_type = 2; + bool has_printer_type() const; + private: + bool _internal_has_printer_type() const; + public: + void clear_printer_type(); + ::content_analysis::sdk::ContentMetaData_PrintMetadata_PrinterType printer_type() const; + void set_printer_type(::content_analysis::sdk::ContentMetaData_PrintMetadata_PrinterType value); + private: + ::content_analysis::sdk::ContentMetaData_PrintMetadata_PrinterType _internal_printer_type() const; + void _internal_set_printer_type(::content_analysis::sdk::ContentMetaData_PrintMetadata_PrinterType value); + public: + + // @@protoc_insertion_point(class_scope:content_analysis.sdk.ContentMetaData.PrintMetadata) + private: + class _Internal; + + template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr printer_name_; + int printer_type_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_analysis_2eproto; +}; +// ------------------------------------------------------------------- + +class ContentMetaData final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:content_analysis.sdk.ContentMetaData) */ { + public: + inline ContentMetaData() : ContentMetaData(nullptr) {} + ~ContentMetaData() override; + explicit PROTOBUF_CONSTEXPR ContentMetaData(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + ContentMetaData(const ContentMetaData& from); + ContentMetaData(ContentMetaData&& from) noexcept + : ContentMetaData() { + *this = ::std::move(from); + } + + inline ContentMetaData& operator=(const ContentMetaData& from) { + CopyFrom(from); + return *this; + } + inline ContentMetaData& operator=(ContentMetaData&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<std::string>(); + } + + static const ContentMetaData& default_instance() { + return *internal_default_instance(); + } + static inline const ContentMetaData* internal_default_instance() { + return reinterpret_cast<const ContentMetaData*>( + &_ContentMetaData_default_instance_); + } + static constexpr int kIndexInFileMessages = + 1; + + friend void swap(ContentMetaData& a, ContentMetaData& b) { + a.Swap(&b); + } + inline void Swap(ContentMetaData* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ContentMetaData* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + ContentMetaData* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage<ContentMetaData>(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const ContentMetaData& from); + void MergeFrom(const ContentMetaData& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ContentMetaData* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "content_analysis.sdk.ContentMetaData"; + } + protected: + explicit ContentMetaData(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + typedef ContentMetaData_PrintMetadata PrintMetadata; + + // accessors ------------------------------------------------------- + + enum : int { + kUrlFieldNumber = 1, + kFilenameFieldNumber = 2, + kDigestFieldNumber = 3, + kEmailFieldNumber = 5, + kTabTitleFieldNumber = 9, + kCsdFieldNumber = 4, + kPrintMetadataFieldNumber = 11, + }; + // optional string url = 1; + bool has_url() const; + private: + bool _internal_has_url() const; + public: + void clear_url(); + const std::string& url() const; + template <typename ArgT0 = const std::string&, typename... ArgT> + void set_url(ArgT0&& arg0, ArgT... args); + std::string* mutable_url(); + PROTOBUF_NODISCARD std::string* release_url(); + void set_allocated_url(std::string* url); + private: + const std::string& _internal_url() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_url(const std::string& value); + std::string* _internal_mutable_url(); + public: + + // optional string filename = 2; + bool has_filename() const; + private: + bool _internal_has_filename() const; + public: + void clear_filename(); + const std::string& filename() const; + template <typename ArgT0 = const std::string&, typename... ArgT> + void set_filename(ArgT0&& arg0, ArgT... args); + std::string* mutable_filename(); + PROTOBUF_NODISCARD std::string* release_filename(); + void set_allocated_filename(std::string* filename); + private: + const std::string& _internal_filename() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_filename(const std::string& value); + std::string* _internal_mutable_filename(); + public: + + // optional string digest = 3; + bool has_digest() const; + private: + bool _internal_has_digest() const; + public: + void clear_digest(); + const std::string& digest() const; + template <typename ArgT0 = const std::string&, typename... ArgT> + void set_digest(ArgT0&& arg0, ArgT... args); + std::string* mutable_digest(); + PROTOBUF_NODISCARD std::string* release_digest(); + void set_allocated_digest(std::string* digest); + private: + const std::string& _internal_digest() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_digest(const std::string& value); + std::string* _internal_mutable_digest(); + public: + + // optional string email = 5; + bool has_email() const; + private: + bool _internal_has_email() const; + public: + void clear_email(); + const std::string& email() const; + template <typename ArgT0 = const std::string&, typename... ArgT> + void set_email(ArgT0&& arg0, ArgT... args); + std::string* mutable_email(); + PROTOBUF_NODISCARD std::string* release_email(); + void set_allocated_email(std::string* email); + private: + const std::string& _internal_email() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_email(const std::string& value); + std::string* _internal_mutable_email(); + public: + + // optional string tab_title = 9; + bool has_tab_title() const; + private: + bool _internal_has_tab_title() const; + public: + void clear_tab_title(); + const std::string& tab_title() const; + template <typename ArgT0 = const std::string&, typename... ArgT> + void set_tab_title(ArgT0&& arg0, ArgT... args); + std::string* mutable_tab_title(); + PROTOBUF_NODISCARD std::string* release_tab_title(); + void set_allocated_tab_title(std::string* tab_title); + private: + const std::string& _internal_tab_title() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_tab_title(const std::string& value); + std::string* _internal_mutable_tab_title(); + public: + + // optional .content_analysis.sdk.ClientDownloadRequest csd = 4; + bool has_csd() const; + private: + bool _internal_has_csd() const; + public: + void clear_csd(); + const ::content_analysis::sdk::ClientDownloadRequest& csd() const; + PROTOBUF_NODISCARD ::content_analysis::sdk::ClientDownloadRequest* release_csd(); + ::content_analysis::sdk::ClientDownloadRequest* mutable_csd(); + void set_allocated_csd(::content_analysis::sdk::ClientDownloadRequest* csd); + private: + const ::content_analysis::sdk::ClientDownloadRequest& _internal_csd() const; + ::content_analysis::sdk::ClientDownloadRequest* _internal_mutable_csd(); + public: + void unsafe_arena_set_allocated_csd( + ::content_analysis::sdk::ClientDownloadRequest* csd); + ::content_analysis::sdk::ClientDownloadRequest* unsafe_arena_release_csd(); + + // optional .content_analysis.sdk.ContentMetaData.PrintMetadata print_metadata = 11; + bool has_print_metadata() const; + private: + bool _internal_has_print_metadata() const; + public: + void clear_print_metadata(); + const ::content_analysis::sdk::ContentMetaData_PrintMetadata& print_metadata() const; + PROTOBUF_NODISCARD ::content_analysis::sdk::ContentMetaData_PrintMetadata* release_print_metadata(); + ::content_analysis::sdk::ContentMetaData_PrintMetadata* mutable_print_metadata(); + void set_allocated_print_metadata(::content_analysis::sdk::ContentMetaData_PrintMetadata* print_metadata); + private: + const ::content_analysis::sdk::ContentMetaData_PrintMetadata& _internal_print_metadata() const; + ::content_analysis::sdk::ContentMetaData_PrintMetadata* _internal_mutable_print_metadata(); + public: + void unsafe_arena_set_allocated_print_metadata( + ::content_analysis::sdk::ContentMetaData_PrintMetadata* print_metadata); + ::content_analysis::sdk::ContentMetaData_PrintMetadata* unsafe_arena_release_print_metadata(); + + // @@protoc_insertion_point(class_scope:content_analysis.sdk.ContentMetaData) + private: + class _Internal; + + template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr url_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr filename_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr digest_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr email_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr tab_title_; + ::content_analysis::sdk::ClientDownloadRequest* csd_; + ::content_analysis::sdk::ContentMetaData_PrintMetadata* print_metadata_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_analysis_2eproto; +}; +// ------------------------------------------------------------------- + +class ClientMetadata_Browser final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:content_analysis.sdk.ClientMetadata.Browser) */ { + public: + inline ClientMetadata_Browser() : ClientMetadata_Browser(nullptr) {} + ~ClientMetadata_Browser() override; + explicit PROTOBUF_CONSTEXPR ClientMetadata_Browser(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + ClientMetadata_Browser(const ClientMetadata_Browser& from); + ClientMetadata_Browser(ClientMetadata_Browser&& from) noexcept + : ClientMetadata_Browser() { + *this = ::std::move(from); + } + + inline ClientMetadata_Browser& operator=(const ClientMetadata_Browser& from) { + CopyFrom(from); + return *this; + } + inline ClientMetadata_Browser& operator=(ClientMetadata_Browser&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<std::string>(); + } + + static const ClientMetadata_Browser& default_instance() { + return *internal_default_instance(); + } + static inline const ClientMetadata_Browser* internal_default_instance() { + return reinterpret_cast<const ClientMetadata_Browser*>( + &_ClientMetadata_Browser_default_instance_); + } + static constexpr int kIndexInFileMessages = + 2; + + friend void swap(ClientMetadata_Browser& a, ClientMetadata_Browser& b) { + a.Swap(&b); + } + inline void Swap(ClientMetadata_Browser* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ClientMetadata_Browser* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + ClientMetadata_Browser* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage<ClientMetadata_Browser>(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const ClientMetadata_Browser& from); + void MergeFrom(const ClientMetadata_Browser& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ClientMetadata_Browser* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "content_analysis.sdk.ClientMetadata.Browser"; + } + protected: + explicit ClientMetadata_Browser(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kMachineUserFieldNumber = 4, + }; + // optional string machine_user = 4; + bool has_machine_user() const; + private: + bool _internal_has_machine_user() const; + public: + void clear_machine_user(); + const std::string& machine_user() const; + template <typename ArgT0 = const std::string&, typename... ArgT> + void set_machine_user(ArgT0&& arg0, ArgT... args); + std::string* mutable_machine_user(); + PROTOBUF_NODISCARD std::string* release_machine_user(); + void set_allocated_machine_user(std::string* machine_user); + private: + const std::string& _internal_machine_user() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_machine_user(const std::string& value); + std::string* _internal_mutable_machine_user(); + public: + + // @@protoc_insertion_point(class_scope:content_analysis.sdk.ClientMetadata.Browser) + private: + class _Internal; + + template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr machine_user_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_analysis_2eproto; +}; +// ------------------------------------------------------------------- + +class ClientMetadata final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:content_analysis.sdk.ClientMetadata) */ { + public: + inline ClientMetadata() : ClientMetadata(nullptr) {} + ~ClientMetadata() override; + explicit PROTOBUF_CONSTEXPR ClientMetadata(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + ClientMetadata(const ClientMetadata& from); + ClientMetadata(ClientMetadata&& from) noexcept + : ClientMetadata() { + *this = ::std::move(from); + } + + inline ClientMetadata& operator=(const ClientMetadata& from) { + CopyFrom(from); + return *this; + } + inline ClientMetadata& operator=(ClientMetadata&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<std::string>(); + } + + static const ClientMetadata& default_instance() { + return *internal_default_instance(); + } + static inline const ClientMetadata* internal_default_instance() { + return reinterpret_cast<const ClientMetadata*>( + &_ClientMetadata_default_instance_); + } + static constexpr int kIndexInFileMessages = + 3; + + friend void swap(ClientMetadata& a, ClientMetadata& b) { + a.Swap(&b); + } + inline void Swap(ClientMetadata* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ClientMetadata* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + ClientMetadata* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage<ClientMetadata>(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const ClientMetadata& from); + void MergeFrom(const ClientMetadata& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ClientMetadata* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "content_analysis.sdk.ClientMetadata"; + } + protected: + explicit ClientMetadata(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + typedef ClientMetadata_Browser Browser; + + // accessors ------------------------------------------------------- + + enum : int { + kBrowserFieldNumber = 1, + }; + // optional .content_analysis.sdk.ClientMetadata.Browser browser = 1; + bool has_browser() const; + private: + bool _internal_has_browser() const; + public: + void clear_browser(); + const ::content_analysis::sdk::ClientMetadata_Browser& browser() const; + PROTOBUF_NODISCARD ::content_analysis::sdk::ClientMetadata_Browser* release_browser(); + ::content_analysis::sdk::ClientMetadata_Browser* mutable_browser(); + void set_allocated_browser(::content_analysis::sdk::ClientMetadata_Browser* browser); + private: + const ::content_analysis::sdk::ClientMetadata_Browser& _internal_browser() const; + ::content_analysis::sdk::ClientMetadata_Browser* _internal_mutable_browser(); + public: + void unsafe_arena_set_allocated_browser( + ::content_analysis::sdk::ClientMetadata_Browser* browser); + ::content_analysis::sdk::ClientMetadata_Browser* unsafe_arena_release_browser(); + + // @@protoc_insertion_point(class_scope:content_analysis.sdk.ClientMetadata) + private: + class _Internal; + + template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::content_analysis::sdk::ClientMetadata_Browser* browser_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_analysis_2eproto; +}; +// ------------------------------------------------------------------- + +class ClientDownloadRequest_Resource final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:content_analysis.sdk.ClientDownloadRequest.Resource) */ { + public: + inline ClientDownloadRequest_Resource() : ClientDownloadRequest_Resource(nullptr) {} + ~ClientDownloadRequest_Resource() override; + explicit PROTOBUF_CONSTEXPR ClientDownloadRequest_Resource(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + ClientDownloadRequest_Resource(const ClientDownloadRequest_Resource& from); + ClientDownloadRequest_Resource(ClientDownloadRequest_Resource&& from) noexcept + : ClientDownloadRequest_Resource() { + *this = ::std::move(from); + } + + inline ClientDownloadRequest_Resource& operator=(const ClientDownloadRequest_Resource& from) { + CopyFrom(from); + return *this; + } + inline ClientDownloadRequest_Resource& operator=(ClientDownloadRequest_Resource&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<std::string>(); + } + + static const ClientDownloadRequest_Resource& default_instance() { + return *internal_default_instance(); + } + static inline const ClientDownloadRequest_Resource* internal_default_instance() { + return reinterpret_cast<const ClientDownloadRequest_Resource*>( + &_ClientDownloadRequest_Resource_default_instance_); + } + static constexpr int kIndexInFileMessages = + 4; + + friend void swap(ClientDownloadRequest_Resource& a, ClientDownloadRequest_Resource& b) { + a.Swap(&b); + } + inline void Swap(ClientDownloadRequest_Resource* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ClientDownloadRequest_Resource* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + ClientDownloadRequest_Resource* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage<ClientDownloadRequest_Resource>(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const ClientDownloadRequest_Resource& from); + void MergeFrom(const ClientDownloadRequest_Resource& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ClientDownloadRequest_Resource* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "content_analysis.sdk.ClientDownloadRequest.Resource"; + } + protected: + explicit ClientDownloadRequest_Resource(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kUrlFieldNumber = 1, + kTypeFieldNumber = 2, + }; + // required string url = 1; + bool has_url() const; + private: + bool _internal_has_url() const; + public: + void clear_url(); + const std::string& url() const; + template <typename ArgT0 = const std::string&, typename... ArgT> + void set_url(ArgT0&& arg0, ArgT... args); + std::string* mutable_url(); + PROTOBUF_NODISCARD std::string* release_url(); + void set_allocated_url(std::string* url); + private: + const std::string& _internal_url() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_url(const std::string& value); + std::string* _internal_mutable_url(); + public: + + // required .content_analysis.sdk.ClientDownloadRequest.ResourceType type = 2; + bool has_type() const; + private: + bool _internal_has_type() const; + public: + void clear_type(); + ::content_analysis::sdk::ClientDownloadRequest_ResourceType type() const; + void set_type(::content_analysis::sdk::ClientDownloadRequest_ResourceType value); + private: + ::content_analysis::sdk::ClientDownloadRequest_ResourceType _internal_type() const; + void _internal_set_type(::content_analysis::sdk::ClientDownloadRequest_ResourceType value); + public: + + // @@protoc_insertion_point(class_scope:content_analysis.sdk.ClientDownloadRequest.Resource) + private: + class _Internal; + + // helper for ByteSizeLong() + size_t RequiredFieldsByteSizeFallback() const; + + template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr url_; + int type_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_analysis_2eproto; +}; +// ------------------------------------------------------------------- + +class ClientDownloadRequest final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:content_analysis.sdk.ClientDownloadRequest) */ { + public: + inline ClientDownloadRequest() : ClientDownloadRequest(nullptr) {} + ~ClientDownloadRequest() override; + explicit PROTOBUF_CONSTEXPR ClientDownloadRequest(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + ClientDownloadRequest(const ClientDownloadRequest& from); + ClientDownloadRequest(ClientDownloadRequest&& from) noexcept + : ClientDownloadRequest() { + *this = ::std::move(from); + } + + inline ClientDownloadRequest& operator=(const ClientDownloadRequest& from) { + CopyFrom(from); + return *this; + } + inline ClientDownloadRequest& operator=(ClientDownloadRequest&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<std::string>(); + } + + static const ClientDownloadRequest& default_instance() { + return *internal_default_instance(); + } + static inline const ClientDownloadRequest* internal_default_instance() { + return reinterpret_cast<const ClientDownloadRequest*>( + &_ClientDownloadRequest_default_instance_); + } + static constexpr int kIndexInFileMessages = + 5; + + friend void swap(ClientDownloadRequest& a, ClientDownloadRequest& b) { + a.Swap(&b); + } + inline void Swap(ClientDownloadRequest* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ClientDownloadRequest* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + ClientDownloadRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage<ClientDownloadRequest>(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const ClientDownloadRequest& from); + void MergeFrom(const ClientDownloadRequest& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ClientDownloadRequest* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "content_analysis.sdk.ClientDownloadRequest"; + } + protected: + explicit ClientDownloadRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + typedef ClientDownloadRequest_Resource Resource; + + typedef ClientDownloadRequest_ResourceType ResourceType; + static constexpr ResourceType DOWNLOAD_URL = + ClientDownloadRequest_ResourceType_DOWNLOAD_URL; + static constexpr ResourceType DOWNLOAD_REDIRECT = + ClientDownloadRequest_ResourceType_DOWNLOAD_REDIRECT; + static constexpr ResourceType TAB_URL = + ClientDownloadRequest_ResourceType_TAB_URL; + static constexpr ResourceType TAB_REDIRECT = + ClientDownloadRequest_ResourceType_TAB_REDIRECT; + static constexpr ResourceType PPAPI_DOCUMENT = + ClientDownloadRequest_ResourceType_PPAPI_DOCUMENT; + static constexpr ResourceType PPAPI_PLUGIN = + ClientDownloadRequest_ResourceType_PPAPI_PLUGIN; + static inline bool ResourceType_IsValid(int value) { + return ClientDownloadRequest_ResourceType_IsValid(value); + } + static constexpr ResourceType ResourceType_MIN = + ClientDownloadRequest_ResourceType_ResourceType_MIN; + static constexpr ResourceType ResourceType_MAX = + ClientDownloadRequest_ResourceType_ResourceType_MAX; + static constexpr int ResourceType_ARRAYSIZE = + ClientDownloadRequest_ResourceType_ResourceType_ARRAYSIZE; + template<typename T> + static inline const std::string& ResourceType_Name(T enum_t_value) { + static_assert(::std::is_same<T, ResourceType>::value || + ::std::is_integral<T>::value, + "Incorrect type passed to function ResourceType_Name."); + return ClientDownloadRequest_ResourceType_Name(enum_t_value); + } + static inline bool ResourceType_Parse(::PROTOBUF_NAMESPACE_ID::ConstStringParam name, + ResourceType* value) { + return ClientDownloadRequest_ResourceType_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kResourcesFieldNumber = 4, + }; + // repeated .content_analysis.sdk.ClientDownloadRequest.Resource resources = 4; + int resources_size() const; + private: + int _internal_resources_size() const; + public: + void clear_resources(); + ::content_analysis::sdk::ClientDownloadRequest_Resource* mutable_resources(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::content_analysis::sdk::ClientDownloadRequest_Resource >* + mutable_resources(); + private: + const ::content_analysis::sdk::ClientDownloadRequest_Resource& _internal_resources(int index) const; + ::content_analysis::sdk::ClientDownloadRequest_Resource* _internal_add_resources(); + public: + const ::content_analysis::sdk::ClientDownloadRequest_Resource& resources(int index) const; + ::content_analysis::sdk::ClientDownloadRequest_Resource* add_resources(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::content_analysis::sdk::ClientDownloadRequest_Resource >& + resources() const; + + // @@protoc_insertion_point(class_scope:content_analysis.sdk.ClientDownloadRequest) + private: + class _Internal; + + template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::content_analysis::sdk::ClientDownloadRequest_Resource > resources_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_analysis_2eproto; +}; +// ------------------------------------------------------------------- + +class ContentAnalysisRequest_PrintData final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:content_analysis.sdk.ContentAnalysisRequest.PrintData) */ { + public: + inline ContentAnalysisRequest_PrintData() : ContentAnalysisRequest_PrintData(nullptr) {} + ~ContentAnalysisRequest_PrintData() override; + explicit PROTOBUF_CONSTEXPR ContentAnalysisRequest_PrintData(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + ContentAnalysisRequest_PrintData(const ContentAnalysisRequest_PrintData& from); + ContentAnalysisRequest_PrintData(ContentAnalysisRequest_PrintData&& from) noexcept + : ContentAnalysisRequest_PrintData() { + *this = ::std::move(from); + } + + inline ContentAnalysisRequest_PrintData& operator=(const ContentAnalysisRequest_PrintData& from) { + CopyFrom(from); + return *this; + } + inline ContentAnalysisRequest_PrintData& operator=(ContentAnalysisRequest_PrintData&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<std::string>(); + } + + static const ContentAnalysisRequest_PrintData& default_instance() { + return *internal_default_instance(); + } + static inline const ContentAnalysisRequest_PrintData* internal_default_instance() { + return reinterpret_cast<const ContentAnalysisRequest_PrintData*>( + &_ContentAnalysisRequest_PrintData_default_instance_); + } + static constexpr int kIndexInFileMessages = + 6; + + friend void swap(ContentAnalysisRequest_PrintData& a, ContentAnalysisRequest_PrintData& b) { + a.Swap(&b); + } + inline void Swap(ContentAnalysisRequest_PrintData* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ContentAnalysisRequest_PrintData* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + ContentAnalysisRequest_PrintData* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage<ContentAnalysisRequest_PrintData>(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const ContentAnalysisRequest_PrintData& from); + void MergeFrom(const ContentAnalysisRequest_PrintData& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ContentAnalysisRequest_PrintData* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "content_analysis.sdk.ContentAnalysisRequest.PrintData"; + } + protected: + explicit ContentAnalysisRequest_PrintData(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kHandleFieldNumber = 1, + kSizeFieldNumber = 2, + }; + // optional int64 handle = 1; + bool has_handle() const; + private: + bool _internal_has_handle() const; + public: + void clear_handle(); + int64_t handle() const; + void set_handle(int64_t value); + private: + int64_t _internal_handle() const; + void _internal_set_handle(int64_t value); + public: + + // optional int64 size = 2; + bool has_size() const; + private: + bool _internal_has_size() const; + public: + void clear_size(); + int64_t size() const; + void set_size(int64_t value); + private: + int64_t _internal_size() const; + void _internal_set_size(int64_t value); + public: + + // @@protoc_insertion_point(class_scope:content_analysis.sdk.ContentAnalysisRequest.PrintData) + private: + class _Internal; + + template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int64_t handle_; + int64_t size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_analysis_2eproto; +}; +// ------------------------------------------------------------------- + +class ContentAnalysisRequest final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:content_analysis.sdk.ContentAnalysisRequest) */ { + public: + inline ContentAnalysisRequest() : ContentAnalysisRequest(nullptr) {} + ~ContentAnalysisRequest() override; + explicit PROTOBUF_CONSTEXPR ContentAnalysisRequest(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + ContentAnalysisRequest(const ContentAnalysisRequest& from); + ContentAnalysisRequest(ContentAnalysisRequest&& from) noexcept + : ContentAnalysisRequest() { + *this = ::std::move(from); + } + + inline ContentAnalysisRequest& operator=(const ContentAnalysisRequest& from) { + CopyFrom(from); + return *this; + } + inline ContentAnalysisRequest& operator=(ContentAnalysisRequest&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<std::string>(); + } + + static const ContentAnalysisRequest& default_instance() { + return *internal_default_instance(); + } + enum ContentDataCase { + kTextContent = 13, + kFilePath = 14, + kPrintData = 18, + CONTENT_DATA_NOT_SET = 0, + }; + + static inline const ContentAnalysisRequest* internal_default_instance() { + return reinterpret_cast<const ContentAnalysisRequest*>( + &_ContentAnalysisRequest_default_instance_); + } + static constexpr int kIndexInFileMessages = + 7; + + friend void swap(ContentAnalysisRequest& a, ContentAnalysisRequest& b) { + a.Swap(&b); + } + inline void Swap(ContentAnalysisRequest* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ContentAnalysisRequest* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + ContentAnalysisRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage<ContentAnalysisRequest>(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const ContentAnalysisRequest& from); + void MergeFrom(const ContentAnalysisRequest& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ContentAnalysisRequest* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "content_analysis.sdk.ContentAnalysisRequest"; + } + protected: + explicit ContentAnalysisRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + typedef ContentAnalysisRequest_PrintData PrintData; + + // accessors ------------------------------------------------------- + + enum : int { + kTagsFieldNumber = 11, + kRequestTokenFieldNumber = 5, + kUserActionIdFieldNumber = 16, + kRequestDataFieldNumber = 10, + kClientMetadataFieldNumber = 12, + kExpiresAtFieldNumber = 15, + kUserActionRequestsCountFieldNumber = 17, + kAnalysisConnectorFieldNumber = 9, + kTextContentFieldNumber = 13, + kFilePathFieldNumber = 14, + kPrintDataFieldNumber = 18, + }; + // repeated string tags = 11; + int tags_size() const; + private: + int _internal_tags_size() const; + public: + void clear_tags(); + const std::string& tags(int index) const; + std::string* mutable_tags(int index); + void set_tags(int index, const std::string& value); + void set_tags(int index, std::string&& value); + void set_tags(int index, const char* value); + void set_tags(int index, const char* value, size_t size); + std::string* add_tags(); + void add_tags(const std::string& value); + void add_tags(std::string&& value); + void add_tags(const char* value); + void add_tags(const char* value, size_t size); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>& tags() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>* mutable_tags(); + private: + const std::string& _internal_tags(int index) const; + std::string* _internal_add_tags(); + public: + + // optional string request_token = 5; + bool has_request_token() const; + private: + bool _internal_has_request_token() const; + public: + void clear_request_token(); + const std::string& request_token() const; + template <typename ArgT0 = const std::string&, typename... ArgT> + void set_request_token(ArgT0&& arg0, ArgT... args); + std::string* mutable_request_token(); + PROTOBUF_NODISCARD std::string* release_request_token(); + void set_allocated_request_token(std::string* request_token); + private: + const std::string& _internal_request_token() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_request_token(const std::string& value); + std::string* _internal_mutable_request_token(); + public: + + // optional string user_action_id = 16; + bool has_user_action_id() const; + private: + bool _internal_has_user_action_id() const; + public: + void clear_user_action_id(); + const std::string& user_action_id() const; + template <typename ArgT0 = const std::string&, typename... ArgT> + void set_user_action_id(ArgT0&& arg0, ArgT... args); + std::string* mutable_user_action_id(); + PROTOBUF_NODISCARD std::string* release_user_action_id(); + void set_allocated_user_action_id(std::string* user_action_id); + private: + const std::string& _internal_user_action_id() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_user_action_id(const std::string& value); + std::string* _internal_mutable_user_action_id(); + public: + + // optional .content_analysis.sdk.ContentMetaData request_data = 10; + bool has_request_data() const; + private: + bool _internal_has_request_data() const; + public: + void clear_request_data(); + const ::content_analysis::sdk::ContentMetaData& request_data() const; + PROTOBUF_NODISCARD ::content_analysis::sdk::ContentMetaData* release_request_data(); + ::content_analysis::sdk::ContentMetaData* mutable_request_data(); + void set_allocated_request_data(::content_analysis::sdk::ContentMetaData* request_data); + private: + const ::content_analysis::sdk::ContentMetaData& _internal_request_data() const; + ::content_analysis::sdk::ContentMetaData* _internal_mutable_request_data(); + public: + void unsafe_arena_set_allocated_request_data( + ::content_analysis::sdk::ContentMetaData* request_data); + ::content_analysis::sdk::ContentMetaData* unsafe_arena_release_request_data(); + + // optional .content_analysis.sdk.ClientMetadata client_metadata = 12; + bool has_client_metadata() const; + private: + bool _internal_has_client_metadata() const; + public: + void clear_client_metadata(); + const ::content_analysis::sdk::ClientMetadata& client_metadata() const; + PROTOBUF_NODISCARD ::content_analysis::sdk::ClientMetadata* release_client_metadata(); + ::content_analysis::sdk::ClientMetadata* mutable_client_metadata(); + void set_allocated_client_metadata(::content_analysis::sdk::ClientMetadata* client_metadata); + private: + const ::content_analysis::sdk::ClientMetadata& _internal_client_metadata() const; + ::content_analysis::sdk::ClientMetadata* _internal_mutable_client_metadata(); + public: + void unsafe_arena_set_allocated_client_metadata( + ::content_analysis::sdk::ClientMetadata* client_metadata); + ::content_analysis::sdk::ClientMetadata* unsafe_arena_release_client_metadata(); + + // optional int64 expires_at = 15; + bool has_expires_at() const; + private: + bool _internal_has_expires_at() const; + public: + void clear_expires_at(); + int64_t expires_at() const; + void set_expires_at(int64_t value); + private: + int64_t _internal_expires_at() const; + void _internal_set_expires_at(int64_t value); + public: + + // optional int64 user_action_requests_count = 17; + bool has_user_action_requests_count() const; + private: + bool _internal_has_user_action_requests_count() const; + public: + void clear_user_action_requests_count(); + int64_t user_action_requests_count() const; + void set_user_action_requests_count(int64_t value); + private: + int64_t _internal_user_action_requests_count() const; + void _internal_set_user_action_requests_count(int64_t value); + public: + + // optional .content_analysis.sdk.AnalysisConnector analysis_connector = 9; + bool has_analysis_connector() const; + private: + bool _internal_has_analysis_connector() const; + public: + void clear_analysis_connector(); + ::content_analysis::sdk::AnalysisConnector analysis_connector() const; + void set_analysis_connector(::content_analysis::sdk::AnalysisConnector value); + private: + ::content_analysis::sdk::AnalysisConnector _internal_analysis_connector() const; + void _internal_set_analysis_connector(::content_analysis::sdk::AnalysisConnector value); + public: + + // string text_content = 13; + bool has_text_content() const; + private: + bool _internal_has_text_content() const; + public: + void clear_text_content(); + const std::string& text_content() const; + template <typename ArgT0 = const std::string&, typename... ArgT> + void set_text_content(ArgT0&& arg0, ArgT... args); + std::string* mutable_text_content(); + PROTOBUF_NODISCARD std::string* release_text_content(); + void set_allocated_text_content(std::string* text_content); + private: + const std::string& _internal_text_content() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_text_content(const std::string& value); + std::string* _internal_mutable_text_content(); + public: + + // string file_path = 14; + bool has_file_path() const; + private: + bool _internal_has_file_path() const; + public: + void clear_file_path(); + const std::string& file_path() const; + template <typename ArgT0 = const std::string&, typename... ArgT> + void set_file_path(ArgT0&& arg0, ArgT... args); + std::string* mutable_file_path(); + PROTOBUF_NODISCARD std::string* release_file_path(); + void set_allocated_file_path(std::string* file_path); + private: + const std::string& _internal_file_path() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_file_path(const std::string& value); + std::string* _internal_mutable_file_path(); + public: + + // .content_analysis.sdk.ContentAnalysisRequest.PrintData print_data = 18; + bool has_print_data() const; + private: + bool _internal_has_print_data() const; + public: + void clear_print_data(); + const ::content_analysis::sdk::ContentAnalysisRequest_PrintData& print_data() const; + PROTOBUF_NODISCARD ::content_analysis::sdk::ContentAnalysisRequest_PrintData* release_print_data(); + ::content_analysis::sdk::ContentAnalysisRequest_PrintData* mutable_print_data(); + void set_allocated_print_data(::content_analysis::sdk::ContentAnalysisRequest_PrintData* print_data); + private: + const ::content_analysis::sdk::ContentAnalysisRequest_PrintData& _internal_print_data() const; + ::content_analysis::sdk::ContentAnalysisRequest_PrintData* _internal_mutable_print_data(); + public: + void unsafe_arena_set_allocated_print_data( + ::content_analysis::sdk::ContentAnalysisRequest_PrintData* print_data); + ::content_analysis::sdk::ContentAnalysisRequest_PrintData* unsafe_arena_release_print_data(); + + void clear_content_data(); + ContentDataCase content_data_case() const; + // @@protoc_insertion_point(class_scope:content_analysis.sdk.ContentAnalysisRequest) + private: + class _Internal; + void set_has_text_content(); + void set_has_file_path(); + void set_has_print_data(); + + inline bool has_content_data() const; + inline void clear_has_content_data(); + + template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string> tags_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr request_token_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr user_action_id_; + ::content_analysis::sdk::ContentMetaData* request_data_; + ::content_analysis::sdk::ClientMetadata* client_metadata_; + int64_t expires_at_; + int64_t user_action_requests_count_; + int analysis_connector_; + union ContentDataUnion { + constexpr ContentDataUnion() : _constinit_{} {} + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized _constinit_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr text_content_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr file_path_; + ::content_analysis::sdk::ContentAnalysisRequest_PrintData* print_data_; + } content_data_; + uint32_t _oneof_case_[1]; + + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_analysis_2eproto; +}; +// ------------------------------------------------------------------- + +class ContentAnalysisResponse_Result_TriggeredRule final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule) */ { + public: + inline ContentAnalysisResponse_Result_TriggeredRule() : ContentAnalysisResponse_Result_TriggeredRule(nullptr) {} + ~ContentAnalysisResponse_Result_TriggeredRule() override; + explicit PROTOBUF_CONSTEXPR ContentAnalysisResponse_Result_TriggeredRule(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + ContentAnalysisResponse_Result_TriggeredRule(const ContentAnalysisResponse_Result_TriggeredRule& from); + ContentAnalysisResponse_Result_TriggeredRule(ContentAnalysisResponse_Result_TriggeredRule&& from) noexcept + : ContentAnalysisResponse_Result_TriggeredRule() { + *this = ::std::move(from); + } + + inline ContentAnalysisResponse_Result_TriggeredRule& operator=(const ContentAnalysisResponse_Result_TriggeredRule& from) { + CopyFrom(from); + return *this; + } + inline ContentAnalysisResponse_Result_TriggeredRule& operator=(ContentAnalysisResponse_Result_TriggeredRule&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<std::string>(); + } + + static const ContentAnalysisResponse_Result_TriggeredRule& default_instance() { + return *internal_default_instance(); + } + static inline const ContentAnalysisResponse_Result_TriggeredRule* internal_default_instance() { + return reinterpret_cast<const ContentAnalysisResponse_Result_TriggeredRule*>( + &_ContentAnalysisResponse_Result_TriggeredRule_default_instance_); + } + static constexpr int kIndexInFileMessages = + 8; + + friend void swap(ContentAnalysisResponse_Result_TriggeredRule& a, ContentAnalysisResponse_Result_TriggeredRule& b) { + a.Swap(&b); + } + inline void Swap(ContentAnalysisResponse_Result_TriggeredRule* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ContentAnalysisResponse_Result_TriggeredRule* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + ContentAnalysisResponse_Result_TriggeredRule* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage<ContentAnalysisResponse_Result_TriggeredRule>(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const ContentAnalysisResponse_Result_TriggeredRule& from); + void MergeFrom(const ContentAnalysisResponse_Result_TriggeredRule& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ContentAnalysisResponse_Result_TriggeredRule* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule"; + } + protected: + explicit ContentAnalysisResponse_Result_TriggeredRule(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + typedef ContentAnalysisResponse_Result_TriggeredRule_Action Action; + static constexpr Action ACTION_UNSPECIFIED = + ContentAnalysisResponse_Result_TriggeredRule_Action_ACTION_UNSPECIFIED; + static constexpr Action REPORT_ONLY = + ContentAnalysisResponse_Result_TriggeredRule_Action_REPORT_ONLY; + static constexpr Action WARN = + ContentAnalysisResponse_Result_TriggeredRule_Action_WARN; + static constexpr Action BLOCK = + ContentAnalysisResponse_Result_TriggeredRule_Action_BLOCK; + static inline bool Action_IsValid(int value) { + return ContentAnalysisResponse_Result_TriggeredRule_Action_IsValid(value); + } + static constexpr Action Action_MIN = + ContentAnalysisResponse_Result_TriggeredRule_Action_Action_MIN; + static constexpr Action Action_MAX = + ContentAnalysisResponse_Result_TriggeredRule_Action_Action_MAX; + static constexpr int Action_ARRAYSIZE = + ContentAnalysisResponse_Result_TriggeredRule_Action_Action_ARRAYSIZE; + template<typename T> + static inline const std::string& Action_Name(T enum_t_value) { + static_assert(::std::is_same<T, Action>::value || + ::std::is_integral<T>::value, + "Incorrect type passed to function Action_Name."); + return ContentAnalysisResponse_Result_TriggeredRule_Action_Name(enum_t_value); + } + static inline bool Action_Parse(::PROTOBUF_NAMESPACE_ID::ConstStringParam name, + Action* value) { + return ContentAnalysisResponse_Result_TriggeredRule_Action_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kRuleNameFieldNumber = 2, + kRuleIdFieldNumber = 3, + kActionFieldNumber = 1, + }; + // optional string rule_name = 2; + bool has_rule_name() const; + private: + bool _internal_has_rule_name() const; + public: + void clear_rule_name(); + const std::string& rule_name() const; + template <typename ArgT0 = const std::string&, typename... ArgT> + void set_rule_name(ArgT0&& arg0, ArgT... args); + std::string* mutable_rule_name(); + PROTOBUF_NODISCARD std::string* release_rule_name(); + void set_allocated_rule_name(std::string* rule_name); + private: + const std::string& _internal_rule_name() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_rule_name(const std::string& value); + std::string* _internal_mutable_rule_name(); + public: + + // optional string rule_id = 3; + bool has_rule_id() const; + private: + bool _internal_has_rule_id() const; + public: + void clear_rule_id(); + const std::string& rule_id() const; + template <typename ArgT0 = const std::string&, typename... ArgT> + void set_rule_id(ArgT0&& arg0, ArgT... args); + std::string* mutable_rule_id(); + PROTOBUF_NODISCARD std::string* release_rule_id(); + void set_allocated_rule_id(std::string* rule_id); + private: + const std::string& _internal_rule_id() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_rule_id(const std::string& value); + std::string* _internal_mutable_rule_id(); + public: + + // optional .content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule.Action action = 1; + bool has_action() const; + private: + bool _internal_has_action() const; + public: + void clear_action(); + ::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule_Action action() const; + void set_action(::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule_Action value); + private: + ::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule_Action _internal_action() const; + void _internal_set_action(::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule_Action value); + public: + + // @@protoc_insertion_point(class_scope:content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule) + private: + class _Internal; + + template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr rule_name_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr rule_id_; + int action_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_analysis_2eproto; +}; +// ------------------------------------------------------------------- + +class ContentAnalysisResponse_Result final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:content_analysis.sdk.ContentAnalysisResponse.Result) */ { + public: + inline ContentAnalysisResponse_Result() : ContentAnalysisResponse_Result(nullptr) {} + ~ContentAnalysisResponse_Result() override; + explicit PROTOBUF_CONSTEXPR ContentAnalysisResponse_Result(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + ContentAnalysisResponse_Result(const ContentAnalysisResponse_Result& from); + ContentAnalysisResponse_Result(ContentAnalysisResponse_Result&& from) noexcept + : ContentAnalysisResponse_Result() { + *this = ::std::move(from); + } + + inline ContentAnalysisResponse_Result& operator=(const ContentAnalysisResponse_Result& from) { + CopyFrom(from); + return *this; + } + inline ContentAnalysisResponse_Result& operator=(ContentAnalysisResponse_Result&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<std::string>(); + } + + static const ContentAnalysisResponse_Result& default_instance() { + return *internal_default_instance(); + } + static inline const ContentAnalysisResponse_Result* internal_default_instance() { + return reinterpret_cast<const ContentAnalysisResponse_Result*>( + &_ContentAnalysisResponse_Result_default_instance_); + } + static constexpr int kIndexInFileMessages = + 9; + + friend void swap(ContentAnalysisResponse_Result& a, ContentAnalysisResponse_Result& b) { + a.Swap(&b); + } + inline void Swap(ContentAnalysisResponse_Result* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ContentAnalysisResponse_Result* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + ContentAnalysisResponse_Result* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage<ContentAnalysisResponse_Result>(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const ContentAnalysisResponse_Result& from); + void MergeFrom(const ContentAnalysisResponse_Result& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ContentAnalysisResponse_Result* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "content_analysis.sdk.ContentAnalysisResponse.Result"; + } + protected: + explicit ContentAnalysisResponse_Result(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + typedef ContentAnalysisResponse_Result_TriggeredRule TriggeredRule; + + typedef ContentAnalysisResponse_Result_Status Status; + static constexpr Status STATUS_UNKNOWN = + ContentAnalysisResponse_Result_Status_STATUS_UNKNOWN; + static constexpr Status SUCCESS = + ContentAnalysisResponse_Result_Status_SUCCESS; + static constexpr Status FAILURE = + ContentAnalysisResponse_Result_Status_FAILURE; + static inline bool Status_IsValid(int value) { + return ContentAnalysisResponse_Result_Status_IsValid(value); + } + static constexpr Status Status_MIN = + ContentAnalysisResponse_Result_Status_Status_MIN; + static constexpr Status Status_MAX = + ContentAnalysisResponse_Result_Status_Status_MAX; + static constexpr int Status_ARRAYSIZE = + ContentAnalysisResponse_Result_Status_Status_ARRAYSIZE; + template<typename T> + static inline const std::string& Status_Name(T enum_t_value) { + static_assert(::std::is_same<T, Status>::value || + ::std::is_integral<T>::value, + "Incorrect type passed to function Status_Name."); + return ContentAnalysisResponse_Result_Status_Name(enum_t_value); + } + static inline bool Status_Parse(::PROTOBUF_NAMESPACE_ID::ConstStringParam name, + Status* value) { + return ContentAnalysisResponse_Result_Status_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kTriggeredRulesFieldNumber = 3, + kTagFieldNumber = 1, + kStatusFieldNumber = 2, + }; + // repeated .content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule triggered_rules = 3; + int triggered_rules_size() const; + private: + int _internal_triggered_rules_size() const; + public: + void clear_triggered_rules(); + ::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule* mutable_triggered_rules(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule >* + mutable_triggered_rules(); + private: + const ::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule& _internal_triggered_rules(int index) const; + ::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule* _internal_add_triggered_rules(); + public: + const ::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule& triggered_rules(int index) const; + ::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule* add_triggered_rules(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule >& + triggered_rules() const; + + // optional string tag = 1; + bool has_tag() const; + private: + bool _internal_has_tag() const; + public: + void clear_tag(); + const std::string& tag() const; + template <typename ArgT0 = const std::string&, typename... ArgT> + void set_tag(ArgT0&& arg0, ArgT... args); + std::string* mutable_tag(); + PROTOBUF_NODISCARD std::string* release_tag(); + void set_allocated_tag(std::string* tag); + private: + const std::string& _internal_tag() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_tag(const std::string& value); + std::string* _internal_mutable_tag(); + public: + + // optional .content_analysis.sdk.ContentAnalysisResponse.Result.Status status = 2; + bool has_status() const; + private: + bool _internal_has_status() const; + public: + void clear_status(); + ::content_analysis::sdk::ContentAnalysisResponse_Result_Status status() const; + void set_status(::content_analysis::sdk::ContentAnalysisResponse_Result_Status value); + private: + ::content_analysis::sdk::ContentAnalysisResponse_Result_Status _internal_status() const; + void _internal_set_status(::content_analysis::sdk::ContentAnalysisResponse_Result_Status value); + public: + + // @@protoc_insertion_point(class_scope:content_analysis.sdk.ContentAnalysisResponse.Result) + private: + class _Internal; + + template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule > triggered_rules_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr tag_; + int status_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_analysis_2eproto; +}; +// ------------------------------------------------------------------- + +class ContentAnalysisResponse final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:content_analysis.sdk.ContentAnalysisResponse) */ { + public: + inline ContentAnalysisResponse() : ContentAnalysisResponse(nullptr) {} + ~ContentAnalysisResponse() override; + explicit PROTOBUF_CONSTEXPR ContentAnalysisResponse(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + ContentAnalysisResponse(const ContentAnalysisResponse& from); + ContentAnalysisResponse(ContentAnalysisResponse&& from) noexcept + : ContentAnalysisResponse() { + *this = ::std::move(from); + } + + inline ContentAnalysisResponse& operator=(const ContentAnalysisResponse& from) { + CopyFrom(from); + return *this; + } + inline ContentAnalysisResponse& operator=(ContentAnalysisResponse&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<std::string>(); + } + + static const ContentAnalysisResponse& default_instance() { + return *internal_default_instance(); + } + static inline const ContentAnalysisResponse* internal_default_instance() { + return reinterpret_cast<const ContentAnalysisResponse*>( + &_ContentAnalysisResponse_default_instance_); + } + static constexpr int kIndexInFileMessages = + 10; + + friend void swap(ContentAnalysisResponse& a, ContentAnalysisResponse& b) { + a.Swap(&b); + } + inline void Swap(ContentAnalysisResponse* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ContentAnalysisResponse* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + ContentAnalysisResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage<ContentAnalysisResponse>(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const ContentAnalysisResponse& from); + void MergeFrom(const ContentAnalysisResponse& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ContentAnalysisResponse* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "content_analysis.sdk.ContentAnalysisResponse"; + } + protected: + explicit ContentAnalysisResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + typedef ContentAnalysisResponse_Result Result; + + // accessors ------------------------------------------------------- + + enum : int { + kResultsFieldNumber = 4, + kRequestTokenFieldNumber = 1, + }; + // repeated .content_analysis.sdk.ContentAnalysisResponse.Result results = 4; + int results_size() const; + private: + int _internal_results_size() const; + public: + void clear_results(); + ::content_analysis::sdk::ContentAnalysisResponse_Result* mutable_results(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::content_analysis::sdk::ContentAnalysisResponse_Result >* + mutable_results(); + private: + const ::content_analysis::sdk::ContentAnalysisResponse_Result& _internal_results(int index) const; + ::content_analysis::sdk::ContentAnalysisResponse_Result* _internal_add_results(); + public: + const ::content_analysis::sdk::ContentAnalysisResponse_Result& results(int index) const; + ::content_analysis::sdk::ContentAnalysisResponse_Result* add_results(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::content_analysis::sdk::ContentAnalysisResponse_Result >& + results() const; + + // optional string request_token = 1; + bool has_request_token() const; + private: + bool _internal_has_request_token() const; + public: + void clear_request_token(); + const std::string& request_token() const; + template <typename ArgT0 = const std::string&, typename... ArgT> + void set_request_token(ArgT0&& arg0, ArgT... args); + std::string* mutable_request_token(); + PROTOBUF_NODISCARD std::string* release_request_token(); + void set_allocated_request_token(std::string* request_token); + private: + const std::string& _internal_request_token() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_request_token(const std::string& value); + std::string* _internal_mutable_request_token(); + public: + + // @@protoc_insertion_point(class_scope:content_analysis.sdk.ContentAnalysisResponse) + private: + class _Internal; + + template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::content_analysis::sdk::ContentAnalysisResponse_Result > results_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr request_token_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_analysis_2eproto; +}; +// ------------------------------------------------------------------- + +class ContentAnalysisAcknowledgement final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:content_analysis.sdk.ContentAnalysisAcknowledgement) */ { + public: + inline ContentAnalysisAcknowledgement() : ContentAnalysisAcknowledgement(nullptr) {} + ~ContentAnalysisAcknowledgement() override; + explicit PROTOBUF_CONSTEXPR ContentAnalysisAcknowledgement(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + ContentAnalysisAcknowledgement(const ContentAnalysisAcknowledgement& from); + ContentAnalysisAcknowledgement(ContentAnalysisAcknowledgement&& from) noexcept + : ContentAnalysisAcknowledgement() { + *this = ::std::move(from); + } + + inline ContentAnalysisAcknowledgement& operator=(const ContentAnalysisAcknowledgement& from) { + CopyFrom(from); + return *this; + } + inline ContentAnalysisAcknowledgement& operator=(ContentAnalysisAcknowledgement&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<std::string>(); + } + + static const ContentAnalysisAcknowledgement& default_instance() { + return *internal_default_instance(); + } + static inline const ContentAnalysisAcknowledgement* internal_default_instance() { + return reinterpret_cast<const ContentAnalysisAcknowledgement*>( + &_ContentAnalysisAcknowledgement_default_instance_); + } + static constexpr int kIndexInFileMessages = + 11; + + friend void swap(ContentAnalysisAcknowledgement& a, ContentAnalysisAcknowledgement& b) { + a.Swap(&b); + } + inline void Swap(ContentAnalysisAcknowledgement* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ContentAnalysisAcknowledgement* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + ContentAnalysisAcknowledgement* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage<ContentAnalysisAcknowledgement>(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const ContentAnalysisAcknowledgement& from); + void MergeFrom(const ContentAnalysisAcknowledgement& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ContentAnalysisAcknowledgement* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "content_analysis.sdk.ContentAnalysisAcknowledgement"; + } + protected: + explicit ContentAnalysisAcknowledgement(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + typedef ContentAnalysisAcknowledgement_Status Status; + static constexpr Status SUCCESS = + ContentAnalysisAcknowledgement_Status_SUCCESS; + static constexpr Status INVALID_RESPONSE = + ContentAnalysisAcknowledgement_Status_INVALID_RESPONSE; + static constexpr Status TOO_LATE = + ContentAnalysisAcknowledgement_Status_TOO_LATE; + static inline bool Status_IsValid(int value) { + return ContentAnalysisAcknowledgement_Status_IsValid(value); + } + static constexpr Status Status_MIN = + ContentAnalysisAcknowledgement_Status_Status_MIN; + static constexpr Status Status_MAX = + ContentAnalysisAcknowledgement_Status_Status_MAX; + static constexpr int Status_ARRAYSIZE = + ContentAnalysisAcknowledgement_Status_Status_ARRAYSIZE; + template<typename T> + static inline const std::string& Status_Name(T enum_t_value) { + static_assert(::std::is_same<T, Status>::value || + ::std::is_integral<T>::value, + "Incorrect type passed to function Status_Name."); + return ContentAnalysisAcknowledgement_Status_Name(enum_t_value); + } + static inline bool Status_Parse(::PROTOBUF_NAMESPACE_ID::ConstStringParam name, + Status* value) { + return ContentAnalysisAcknowledgement_Status_Parse(name, value); + } + + typedef ContentAnalysisAcknowledgement_FinalAction FinalAction; + static constexpr FinalAction ACTION_UNSPECIFIED = + ContentAnalysisAcknowledgement_FinalAction_ACTION_UNSPECIFIED; + static constexpr FinalAction ALLOW = + ContentAnalysisAcknowledgement_FinalAction_ALLOW; + static constexpr FinalAction REPORT_ONLY = + ContentAnalysisAcknowledgement_FinalAction_REPORT_ONLY; + static constexpr FinalAction WARN = + ContentAnalysisAcknowledgement_FinalAction_WARN; + static constexpr FinalAction BLOCK = + ContentAnalysisAcknowledgement_FinalAction_BLOCK; + static inline bool FinalAction_IsValid(int value) { + return ContentAnalysisAcknowledgement_FinalAction_IsValid(value); + } + static constexpr FinalAction FinalAction_MIN = + ContentAnalysisAcknowledgement_FinalAction_FinalAction_MIN; + static constexpr FinalAction FinalAction_MAX = + ContentAnalysisAcknowledgement_FinalAction_FinalAction_MAX; + static constexpr int FinalAction_ARRAYSIZE = + ContentAnalysisAcknowledgement_FinalAction_FinalAction_ARRAYSIZE; + template<typename T> + static inline const std::string& FinalAction_Name(T enum_t_value) { + static_assert(::std::is_same<T, FinalAction>::value || + ::std::is_integral<T>::value, + "Incorrect type passed to function FinalAction_Name."); + return ContentAnalysisAcknowledgement_FinalAction_Name(enum_t_value); + } + static inline bool FinalAction_Parse(::PROTOBUF_NAMESPACE_ID::ConstStringParam name, + FinalAction* value) { + return ContentAnalysisAcknowledgement_FinalAction_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kRequestTokenFieldNumber = 1, + kFinalActionFieldNumber = 3, + kStatusFieldNumber = 2, + }; + // optional string request_token = 1; + bool has_request_token() const; + private: + bool _internal_has_request_token() const; + public: + void clear_request_token(); + const std::string& request_token() const; + template <typename ArgT0 = const std::string&, typename... ArgT> + void set_request_token(ArgT0&& arg0, ArgT... args); + std::string* mutable_request_token(); + PROTOBUF_NODISCARD std::string* release_request_token(); + void set_allocated_request_token(std::string* request_token); + private: + const std::string& _internal_request_token() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_request_token(const std::string& value); + std::string* _internal_mutable_request_token(); + public: + + // optional .content_analysis.sdk.ContentAnalysisAcknowledgement.FinalAction final_action = 3; + bool has_final_action() const; + private: + bool _internal_has_final_action() const; + public: + void clear_final_action(); + ::content_analysis::sdk::ContentAnalysisAcknowledgement_FinalAction final_action() const; + void set_final_action(::content_analysis::sdk::ContentAnalysisAcknowledgement_FinalAction value); + private: + ::content_analysis::sdk::ContentAnalysisAcknowledgement_FinalAction _internal_final_action() const; + void _internal_set_final_action(::content_analysis::sdk::ContentAnalysisAcknowledgement_FinalAction value); + public: + + // optional .content_analysis.sdk.ContentAnalysisAcknowledgement.Status status = 2; + bool has_status() const; + private: + bool _internal_has_status() const; + public: + void clear_status(); + ::content_analysis::sdk::ContentAnalysisAcknowledgement_Status status() const; + void set_status(::content_analysis::sdk::ContentAnalysisAcknowledgement_Status value); + private: + ::content_analysis::sdk::ContentAnalysisAcknowledgement_Status _internal_status() const; + void _internal_set_status(::content_analysis::sdk::ContentAnalysisAcknowledgement_Status value); + public: + + // @@protoc_insertion_point(class_scope:content_analysis.sdk.ContentAnalysisAcknowledgement) + private: + class _Internal; + + template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr request_token_; + int final_action_; + int status_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_analysis_2eproto; +}; +// ------------------------------------------------------------------- + +class ContentAnalysisCancelRequests final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:content_analysis.sdk.ContentAnalysisCancelRequests) */ { + public: + inline ContentAnalysisCancelRequests() : ContentAnalysisCancelRequests(nullptr) {} + ~ContentAnalysisCancelRequests() override; + explicit PROTOBUF_CONSTEXPR ContentAnalysisCancelRequests(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + ContentAnalysisCancelRequests(const ContentAnalysisCancelRequests& from); + ContentAnalysisCancelRequests(ContentAnalysisCancelRequests&& from) noexcept + : ContentAnalysisCancelRequests() { + *this = ::std::move(from); + } + + inline ContentAnalysisCancelRequests& operator=(const ContentAnalysisCancelRequests& from) { + CopyFrom(from); + return *this; + } + inline ContentAnalysisCancelRequests& operator=(ContentAnalysisCancelRequests&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<std::string>(); + } + + static const ContentAnalysisCancelRequests& default_instance() { + return *internal_default_instance(); + } + static inline const ContentAnalysisCancelRequests* internal_default_instance() { + return reinterpret_cast<const ContentAnalysisCancelRequests*>( + &_ContentAnalysisCancelRequests_default_instance_); + } + static constexpr int kIndexInFileMessages = + 12; + + friend void swap(ContentAnalysisCancelRequests& a, ContentAnalysisCancelRequests& b) { + a.Swap(&b); + } + inline void Swap(ContentAnalysisCancelRequests* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ContentAnalysisCancelRequests* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + ContentAnalysisCancelRequests* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage<ContentAnalysisCancelRequests>(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const ContentAnalysisCancelRequests& from); + void MergeFrom(const ContentAnalysisCancelRequests& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ContentAnalysisCancelRequests* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "content_analysis.sdk.ContentAnalysisCancelRequests"; + } + protected: + explicit ContentAnalysisCancelRequests(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kUserActionIdFieldNumber = 1, + }; + // optional string user_action_id = 1; + bool has_user_action_id() const; + private: + bool _internal_has_user_action_id() const; + public: + void clear_user_action_id(); + const std::string& user_action_id() const; + template <typename ArgT0 = const std::string&, typename... ArgT> + void set_user_action_id(ArgT0&& arg0, ArgT... args); + std::string* mutable_user_action_id(); + PROTOBUF_NODISCARD std::string* release_user_action_id(); + void set_allocated_user_action_id(std::string* user_action_id); + private: + const std::string& _internal_user_action_id() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_user_action_id(const std::string& value); + std::string* _internal_mutable_user_action_id(); + public: + + // @@protoc_insertion_point(class_scope:content_analysis.sdk.ContentAnalysisCancelRequests) + private: + class _Internal; + + template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr user_action_id_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_analysis_2eproto; +}; +// ------------------------------------------------------------------- + +class ChromeToAgent final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:content_analysis.sdk.ChromeToAgent) */ { + public: + inline ChromeToAgent() : ChromeToAgent(nullptr) {} + ~ChromeToAgent() override; + explicit PROTOBUF_CONSTEXPR ChromeToAgent(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + ChromeToAgent(const ChromeToAgent& from); + ChromeToAgent(ChromeToAgent&& from) noexcept + : ChromeToAgent() { + *this = ::std::move(from); + } + + inline ChromeToAgent& operator=(const ChromeToAgent& from) { + CopyFrom(from); + return *this; + } + inline ChromeToAgent& operator=(ChromeToAgent&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<std::string>(); + } + + static const ChromeToAgent& default_instance() { + return *internal_default_instance(); + } + static inline const ChromeToAgent* internal_default_instance() { + return reinterpret_cast<const ChromeToAgent*>( + &_ChromeToAgent_default_instance_); + } + static constexpr int kIndexInFileMessages = + 13; + + friend void swap(ChromeToAgent& a, ChromeToAgent& b) { + a.Swap(&b); + } + inline void Swap(ChromeToAgent* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ChromeToAgent* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + ChromeToAgent* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage<ChromeToAgent>(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const ChromeToAgent& from); + void MergeFrom(const ChromeToAgent& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ChromeToAgent* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "content_analysis.sdk.ChromeToAgent"; + } + protected: + explicit ChromeToAgent(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kRequestFieldNumber = 1, + kAckFieldNumber = 2, + kCancelFieldNumber = 3, + }; + // optional .content_analysis.sdk.ContentAnalysisRequest request = 1; + bool has_request() const; + private: + bool _internal_has_request() const; + public: + void clear_request(); + const ::content_analysis::sdk::ContentAnalysisRequest& request() const; + PROTOBUF_NODISCARD ::content_analysis::sdk::ContentAnalysisRequest* release_request(); + ::content_analysis::sdk::ContentAnalysisRequest* mutable_request(); + void set_allocated_request(::content_analysis::sdk::ContentAnalysisRequest* request); + private: + const ::content_analysis::sdk::ContentAnalysisRequest& _internal_request() const; + ::content_analysis::sdk::ContentAnalysisRequest* _internal_mutable_request(); + public: + void unsafe_arena_set_allocated_request( + ::content_analysis::sdk::ContentAnalysisRequest* request); + ::content_analysis::sdk::ContentAnalysisRequest* unsafe_arena_release_request(); + + // optional .content_analysis.sdk.ContentAnalysisAcknowledgement ack = 2; + bool has_ack() const; + private: + bool _internal_has_ack() const; + public: + void clear_ack(); + const ::content_analysis::sdk::ContentAnalysisAcknowledgement& ack() const; + PROTOBUF_NODISCARD ::content_analysis::sdk::ContentAnalysisAcknowledgement* release_ack(); + ::content_analysis::sdk::ContentAnalysisAcknowledgement* mutable_ack(); + void set_allocated_ack(::content_analysis::sdk::ContentAnalysisAcknowledgement* ack); + private: + const ::content_analysis::sdk::ContentAnalysisAcknowledgement& _internal_ack() const; + ::content_analysis::sdk::ContentAnalysisAcknowledgement* _internal_mutable_ack(); + public: + void unsafe_arena_set_allocated_ack( + ::content_analysis::sdk::ContentAnalysisAcknowledgement* ack); + ::content_analysis::sdk::ContentAnalysisAcknowledgement* unsafe_arena_release_ack(); + + // optional .content_analysis.sdk.ContentAnalysisCancelRequests cancel = 3; + bool has_cancel() const; + private: + bool _internal_has_cancel() const; + public: + void clear_cancel(); + const ::content_analysis::sdk::ContentAnalysisCancelRequests& cancel() const; + PROTOBUF_NODISCARD ::content_analysis::sdk::ContentAnalysisCancelRequests* release_cancel(); + ::content_analysis::sdk::ContentAnalysisCancelRequests* mutable_cancel(); + void set_allocated_cancel(::content_analysis::sdk::ContentAnalysisCancelRequests* cancel); + private: + const ::content_analysis::sdk::ContentAnalysisCancelRequests& _internal_cancel() const; + ::content_analysis::sdk::ContentAnalysisCancelRequests* _internal_mutable_cancel(); + public: + void unsafe_arena_set_allocated_cancel( + ::content_analysis::sdk::ContentAnalysisCancelRequests* cancel); + ::content_analysis::sdk::ContentAnalysisCancelRequests* unsafe_arena_release_cancel(); + + // @@protoc_insertion_point(class_scope:content_analysis.sdk.ChromeToAgent) + private: + class _Internal; + + template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::content_analysis::sdk::ContentAnalysisRequest* request_; + ::content_analysis::sdk::ContentAnalysisAcknowledgement* ack_; + ::content_analysis::sdk::ContentAnalysisCancelRequests* cancel_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_analysis_2eproto; +}; +// ------------------------------------------------------------------- + +class AgentToChrome final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:content_analysis.sdk.AgentToChrome) */ { + public: + inline AgentToChrome() : AgentToChrome(nullptr) {} + ~AgentToChrome() override; + explicit PROTOBUF_CONSTEXPR AgentToChrome(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + AgentToChrome(const AgentToChrome& from); + AgentToChrome(AgentToChrome&& from) noexcept + : AgentToChrome() { + *this = ::std::move(from); + } + + inline AgentToChrome& operator=(const AgentToChrome& from) { + CopyFrom(from); + return *this; + } + inline AgentToChrome& operator=(AgentToChrome&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<std::string>(); + } + + static const AgentToChrome& default_instance() { + return *internal_default_instance(); + } + static inline const AgentToChrome* internal_default_instance() { + return reinterpret_cast<const AgentToChrome*>( + &_AgentToChrome_default_instance_); + } + static constexpr int kIndexInFileMessages = + 14; + + friend void swap(AgentToChrome& a, AgentToChrome& b) { + a.Swap(&b); + } + inline void Swap(AgentToChrome* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(AgentToChrome* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + AgentToChrome* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage<AgentToChrome>(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const AgentToChrome& from); + void MergeFrom(const AgentToChrome& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(AgentToChrome* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "content_analysis.sdk.AgentToChrome"; + } + protected: + explicit AgentToChrome(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kResponseFieldNumber = 1, + }; + // optional .content_analysis.sdk.ContentAnalysisResponse response = 1; + bool has_response() const; + private: + bool _internal_has_response() const; + public: + void clear_response(); + const ::content_analysis::sdk::ContentAnalysisResponse& response() const; + PROTOBUF_NODISCARD ::content_analysis::sdk::ContentAnalysisResponse* release_response(); + ::content_analysis::sdk::ContentAnalysisResponse* mutable_response(); + void set_allocated_response(::content_analysis::sdk::ContentAnalysisResponse* response); + private: + const ::content_analysis::sdk::ContentAnalysisResponse& _internal_response() const; + ::content_analysis::sdk::ContentAnalysisResponse* _internal_mutable_response(); + public: + void unsafe_arena_set_allocated_response( + ::content_analysis::sdk::ContentAnalysisResponse* response); + ::content_analysis::sdk::ContentAnalysisResponse* unsafe_arena_release_response(); + + // @@protoc_insertion_point(class_scope:content_analysis.sdk.AgentToChrome) + private: + class _Internal; + + template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::content_analysis::sdk::ContentAnalysisResponse* response_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_analysis_2eproto; +}; +// =================================================================== + + +// =================================================================== + +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// ContentMetaData_PrintMetadata + +// optional string printer_name = 1; +inline bool ContentMetaData_PrintMetadata::_internal_has_printer_name() const { + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool ContentMetaData_PrintMetadata::has_printer_name() const { + return _internal_has_printer_name(); +} +inline void ContentMetaData_PrintMetadata::clear_printer_name() { + _impl_.printer_name_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; +} +inline const std::string& ContentMetaData_PrintMetadata::printer_name() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentMetaData.PrintMetadata.printer_name) + return _internal_printer_name(); +} +template <typename ArgT0, typename... ArgT> +inline PROTOBUF_ALWAYS_INLINE +void ContentMetaData_PrintMetadata::set_printer_name(ArgT0&& arg0, ArgT... args) { + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.printer_name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:content_analysis.sdk.ContentMetaData.PrintMetadata.printer_name) +} +inline std::string* ContentMetaData_PrintMetadata::mutable_printer_name() { + std::string* _s = _internal_mutable_printer_name(); + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.ContentMetaData.PrintMetadata.printer_name) + return _s; +} +inline const std::string& ContentMetaData_PrintMetadata::_internal_printer_name() const { + return _impl_.printer_name_.Get(); +} +inline void ContentMetaData_PrintMetadata::_internal_set_printer_name(const std::string& value) { + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.printer_name_.Set(value, GetArenaForAllocation()); +} +inline std::string* ContentMetaData_PrintMetadata::_internal_mutable_printer_name() { + _impl_._has_bits_[0] |= 0x00000001u; + return _impl_.printer_name_.Mutable(GetArenaForAllocation()); +} +inline std::string* ContentMetaData_PrintMetadata::release_printer_name() { + // @@protoc_insertion_point(field_release:content_analysis.sdk.ContentMetaData.PrintMetadata.printer_name) + if (!_internal_has_printer_name()) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* p = _impl_.printer_name_.Release(); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.printer_name_.IsDefault()) { + _impl_.printer_name_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void ContentMetaData_PrintMetadata::set_allocated_printer_name(std::string* printer_name) { + if (printer_name != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + _impl_.printer_name_.SetAllocated(printer_name, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.printer_name_.IsDefault()) { + _impl_.printer_name_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:content_analysis.sdk.ContentMetaData.PrintMetadata.printer_name) +} + +// optional .content_analysis.sdk.ContentMetaData.PrintMetadata.PrinterType printer_type = 2; +inline bool ContentMetaData_PrintMetadata::_internal_has_printer_type() const { + bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool ContentMetaData_PrintMetadata::has_printer_type() const { + return _internal_has_printer_type(); +} +inline void ContentMetaData_PrintMetadata::clear_printer_type() { + _impl_.printer_type_ = 0; + _impl_._has_bits_[0] &= ~0x00000002u; +} +inline ::content_analysis::sdk::ContentMetaData_PrintMetadata_PrinterType ContentMetaData_PrintMetadata::_internal_printer_type() const { + return static_cast< ::content_analysis::sdk::ContentMetaData_PrintMetadata_PrinterType >(_impl_.printer_type_); +} +inline ::content_analysis::sdk::ContentMetaData_PrintMetadata_PrinterType ContentMetaData_PrintMetadata::printer_type() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentMetaData.PrintMetadata.printer_type) + return _internal_printer_type(); +} +inline void ContentMetaData_PrintMetadata::_internal_set_printer_type(::content_analysis::sdk::ContentMetaData_PrintMetadata_PrinterType value) { + assert(::content_analysis::sdk::ContentMetaData_PrintMetadata_PrinterType_IsValid(value)); + _impl_._has_bits_[0] |= 0x00000002u; + _impl_.printer_type_ = value; +} +inline void ContentMetaData_PrintMetadata::set_printer_type(::content_analysis::sdk::ContentMetaData_PrintMetadata_PrinterType value) { + _internal_set_printer_type(value); + // @@protoc_insertion_point(field_set:content_analysis.sdk.ContentMetaData.PrintMetadata.printer_type) +} + +// ------------------------------------------------------------------- + +// ContentMetaData + +// optional string url = 1; +inline bool ContentMetaData::_internal_has_url() const { + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool ContentMetaData::has_url() const { + return _internal_has_url(); +} +inline void ContentMetaData::clear_url() { + _impl_.url_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; +} +inline const std::string& ContentMetaData::url() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentMetaData.url) + return _internal_url(); +} +template <typename ArgT0, typename... ArgT> +inline PROTOBUF_ALWAYS_INLINE +void ContentMetaData::set_url(ArgT0&& arg0, ArgT... args) { + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.url_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:content_analysis.sdk.ContentMetaData.url) +} +inline std::string* ContentMetaData::mutable_url() { + std::string* _s = _internal_mutable_url(); + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.ContentMetaData.url) + return _s; +} +inline const std::string& ContentMetaData::_internal_url() const { + return _impl_.url_.Get(); +} +inline void ContentMetaData::_internal_set_url(const std::string& value) { + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.url_.Set(value, GetArenaForAllocation()); +} +inline std::string* ContentMetaData::_internal_mutable_url() { + _impl_._has_bits_[0] |= 0x00000001u; + return _impl_.url_.Mutable(GetArenaForAllocation()); +} +inline std::string* ContentMetaData::release_url() { + // @@protoc_insertion_point(field_release:content_analysis.sdk.ContentMetaData.url) + if (!_internal_has_url()) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* p = _impl_.url_.Release(); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.url_.IsDefault()) { + _impl_.url_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void ContentMetaData::set_allocated_url(std::string* url) { + if (url != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + _impl_.url_.SetAllocated(url, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.url_.IsDefault()) { + _impl_.url_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:content_analysis.sdk.ContentMetaData.url) +} + +// optional string filename = 2; +inline bool ContentMetaData::_internal_has_filename() const { + bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool ContentMetaData::has_filename() const { + return _internal_has_filename(); +} +inline void ContentMetaData::clear_filename() { + _impl_.filename_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000002u; +} +inline const std::string& ContentMetaData::filename() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentMetaData.filename) + return _internal_filename(); +} +template <typename ArgT0, typename... ArgT> +inline PROTOBUF_ALWAYS_INLINE +void ContentMetaData::set_filename(ArgT0&& arg0, ArgT... args) { + _impl_._has_bits_[0] |= 0x00000002u; + _impl_.filename_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:content_analysis.sdk.ContentMetaData.filename) +} +inline std::string* ContentMetaData::mutable_filename() { + std::string* _s = _internal_mutable_filename(); + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.ContentMetaData.filename) + return _s; +} +inline const std::string& ContentMetaData::_internal_filename() const { + return _impl_.filename_.Get(); +} +inline void ContentMetaData::_internal_set_filename(const std::string& value) { + _impl_._has_bits_[0] |= 0x00000002u; + _impl_.filename_.Set(value, GetArenaForAllocation()); +} +inline std::string* ContentMetaData::_internal_mutable_filename() { + _impl_._has_bits_[0] |= 0x00000002u; + return _impl_.filename_.Mutable(GetArenaForAllocation()); +} +inline std::string* ContentMetaData::release_filename() { + // @@protoc_insertion_point(field_release:content_analysis.sdk.ContentMetaData.filename) + if (!_internal_has_filename()) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000002u; + auto* p = _impl_.filename_.Release(); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.filename_.IsDefault()) { + _impl_.filename_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void ContentMetaData::set_allocated_filename(std::string* filename) { + if (filename != nullptr) { + _impl_._has_bits_[0] |= 0x00000002u; + } else { + _impl_._has_bits_[0] &= ~0x00000002u; + } + _impl_.filename_.SetAllocated(filename, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.filename_.IsDefault()) { + _impl_.filename_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:content_analysis.sdk.ContentMetaData.filename) +} + +// optional string digest = 3; +inline bool ContentMetaData::_internal_has_digest() const { + bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool ContentMetaData::has_digest() const { + return _internal_has_digest(); +} +inline void ContentMetaData::clear_digest() { + _impl_.digest_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000004u; +} +inline const std::string& ContentMetaData::digest() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentMetaData.digest) + return _internal_digest(); +} +template <typename ArgT0, typename... ArgT> +inline PROTOBUF_ALWAYS_INLINE +void ContentMetaData::set_digest(ArgT0&& arg0, ArgT... args) { + _impl_._has_bits_[0] |= 0x00000004u; + _impl_.digest_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:content_analysis.sdk.ContentMetaData.digest) +} +inline std::string* ContentMetaData::mutable_digest() { + std::string* _s = _internal_mutable_digest(); + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.ContentMetaData.digest) + return _s; +} +inline const std::string& ContentMetaData::_internal_digest() const { + return _impl_.digest_.Get(); +} +inline void ContentMetaData::_internal_set_digest(const std::string& value) { + _impl_._has_bits_[0] |= 0x00000004u; + _impl_.digest_.Set(value, GetArenaForAllocation()); +} +inline std::string* ContentMetaData::_internal_mutable_digest() { + _impl_._has_bits_[0] |= 0x00000004u; + return _impl_.digest_.Mutable(GetArenaForAllocation()); +} +inline std::string* ContentMetaData::release_digest() { + // @@protoc_insertion_point(field_release:content_analysis.sdk.ContentMetaData.digest) + if (!_internal_has_digest()) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000004u; + auto* p = _impl_.digest_.Release(); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.digest_.IsDefault()) { + _impl_.digest_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void ContentMetaData::set_allocated_digest(std::string* digest) { + if (digest != nullptr) { + _impl_._has_bits_[0] |= 0x00000004u; + } else { + _impl_._has_bits_[0] &= ~0x00000004u; + } + _impl_.digest_.SetAllocated(digest, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.digest_.IsDefault()) { + _impl_.digest_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:content_analysis.sdk.ContentMetaData.digest) +} + +// optional .content_analysis.sdk.ClientDownloadRequest csd = 4; +inline bool ContentMetaData::_internal_has_csd() const { + bool value = (_impl_._has_bits_[0] & 0x00000020u) != 0; + PROTOBUF_ASSUME(!value || _impl_.csd_ != nullptr); + return value; +} +inline bool ContentMetaData::has_csd() const { + return _internal_has_csd(); +} +inline void ContentMetaData::clear_csd() { + if (_impl_.csd_ != nullptr) _impl_.csd_->Clear(); + _impl_._has_bits_[0] &= ~0x00000020u; +} +inline const ::content_analysis::sdk::ClientDownloadRequest& ContentMetaData::_internal_csd() const { + const ::content_analysis::sdk::ClientDownloadRequest* p = _impl_.csd_; + return p != nullptr ? *p : reinterpret_cast<const ::content_analysis::sdk::ClientDownloadRequest&>( + ::content_analysis::sdk::_ClientDownloadRequest_default_instance_); +} +inline const ::content_analysis::sdk::ClientDownloadRequest& ContentMetaData::csd() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentMetaData.csd) + return _internal_csd(); +} +inline void ContentMetaData::unsafe_arena_set_allocated_csd( + ::content_analysis::sdk::ClientDownloadRequest* csd) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.csd_); + } + _impl_.csd_ = csd; + if (csd) { + _impl_._has_bits_[0] |= 0x00000020u; + } else { + _impl_._has_bits_[0] &= ~0x00000020u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:content_analysis.sdk.ContentMetaData.csd) +} +inline ::content_analysis::sdk::ClientDownloadRequest* ContentMetaData::release_csd() { + _impl_._has_bits_[0] &= ~0x00000020u; + ::content_analysis::sdk::ClientDownloadRequest* temp = _impl_.csd_; + _impl_.csd_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::content_analysis::sdk::ClientDownloadRequest* ContentMetaData::unsafe_arena_release_csd() { + // @@protoc_insertion_point(field_release:content_analysis.sdk.ContentMetaData.csd) + _impl_._has_bits_[0] &= ~0x00000020u; + ::content_analysis::sdk::ClientDownloadRequest* temp = _impl_.csd_; + _impl_.csd_ = nullptr; + return temp; +} +inline ::content_analysis::sdk::ClientDownloadRequest* ContentMetaData::_internal_mutable_csd() { + _impl_._has_bits_[0] |= 0x00000020u; + if (_impl_.csd_ == nullptr) { + auto* p = CreateMaybeMessage<::content_analysis::sdk::ClientDownloadRequest>(GetArenaForAllocation()); + _impl_.csd_ = p; + } + return _impl_.csd_; +} +inline ::content_analysis::sdk::ClientDownloadRequest* ContentMetaData::mutable_csd() { + ::content_analysis::sdk::ClientDownloadRequest* _msg = _internal_mutable_csd(); + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.ContentMetaData.csd) + return _msg; +} +inline void ContentMetaData::set_allocated_csd(::content_analysis::sdk::ClientDownloadRequest* csd) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete _impl_.csd_; + } + if (csd) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(csd); + if (message_arena != submessage_arena) { + csd = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, csd, submessage_arena); + } + _impl_._has_bits_[0] |= 0x00000020u; + } else { + _impl_._has_bits_[0] &= ~0x00000020u; + } + _impl_.csd_ = csd; + // @@protoc_insertion_point(field_set_allocated:content_analysis.sdk.ContentMetaData.csd) +} + +// optional string email = 5; +inline bool ContentMetaData::_internal_has_email() const { + bool value = (_impl_._has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool ContentMetaData::has_email() const { + return _internal_has_email(); +} +inline void ContentMetaData::clear_email() { + _impl_.email_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000008u; +} +inline const std::string& ContentMetaData::email() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentMetaData.email) + return _internal_email(); +} +template <typename ArgT0, typename... ArgT> +inline PROTOBUF_ALWAYS_INLINE +void ContentMetaData::set_email(ArgT0&& arg0, ArgT... args) { + _impl_._has_bits_[0] |= 0x00000008u; + _impl_.email_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:content_analysis.sdk.ContentMetaData.email) +} +inline std::string* ContentMetaData::mutable_email() { + std::string* _s = _internal_mutable_email(); + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.ContentMetaData.email) + return _s; +} +inline const std::string& ContentMetaData::_internal_email() const { + return _impl_.email_.Get(); +} +inline void ContentMetaData::_internal_set_email(const std::string& value) { + _impl_._has_bits_[0] |= 0x00000008u; + _impl_.email_.Set(value, GetArenaForAllocation()); +} +inline std::string* ContentMetaData::_internal_mutable_email() { + _impl_._has_bits_[0] |= 0x00000008u; + return _impl_.email_.Mutable(GetArenaForAllocation()); +} +inline std::string* ContentMetaData::release_email() { + // @@protoc_insertion_point(field_release:content_analysis.sdk.ContentMetaData.email) + if (!_internal_has_email()) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000008u; + auto* p = _impl_.email_.Release(); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.email_.IsDefault()) { + _impl_.email_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void ContentMetaData::set_allocated_email(std::string* email) { + if (email != nullptr) { + _impl_._has_bits_[0] |= 0x00000008u; + } else { + _impl_._has_bits_[0] &= ~0x00000008u; + } + _impl_.email_.SetAllocated(email, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.email_.IsDefault()) { + _impl_.email_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:content_analysis.sdk.ContentMetaData.email) +} + +// optional string tab_title = 9; +inline bool ContentMetaData::_internal_has_tab_title() const { + bool value = (_impl_._has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool ContentMetaData::has_tab_title() const { + return _internal_has_tab_title(); +} +inline void ContentMetaData::clear_tab_title() { + _impl_.tab_title_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000010u; +} +inline const std::string& ContentMetaData::tab_title() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentMetaData.tab_title) + return _internal_tab_title(); +} +template <typename ArgT0, typename... ArgT> +inline PROTOBUF_ALWAYS_INLINE +void ContentMetaData::set_tab_title(ArgT0&& arg0, ArgT... args) { + _impl_._has_bits_[0] |= 0x00000010u; + _impl_.tab_title_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:content_analysis.sdk.ContentMetaData.tab_title) +} +inline std::string* ContentMetaData::mutable_tab_title() { + std::string* _s = _internal_mutable_tab_title(); + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.ContentMetaData.tab_title) + return _s; +} +inline const std::string& ContentMetaData::_internal_tab_title() const { + return _impl_.tab_title_.Get(); +} +inline void ContentMetaData::_internal_set_tab_title(const std::string& value) { + _impl_._has_bits_[0] |= 0x00000010u; + _impl_.tab_title_.Set(value, GetArenaForAllocation()); +} +inline std::string* ContentMetaData::_internal_mutable_tab_title() { + _impl_._has_bits_[0] |= 0x00000010u; + return _impl_.tab_title_.Mutable(GetArenaForAllocation()); +} +inline std::string* ContentMetaData::release_tab_title() { + // @@protoc_insertion_point(field_release:content_analysis.sdk.ContentMetaData.tab_title) + if (!_internal_has_tab_title()) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000010u; + auto* p = _impl_.tab_title_.Release(); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.tab_title_.IsDefault()) { + _impl_.tab_title_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void ContentMetaData::set_allocated_tab_title(std::string* tab_title) { + if (tab_title != nullptr) { + _impl_._has_bits_[0] |= 0x00000010u; + } else { + _impl_._has_bits_[0] &= ~0x00000010u; + } + _impl_.tab_title_.SetAllocated(tab_title, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.tab_title_.IsDefault()) { + _impl_.tab_title_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:content_analysis.sdk.ContentMetaData.tab_title) +} + +// optional .content_analysis.sdk.ContentMetaData.PrintMetadata print_metadata = 11; +inline bool ContentMetaData::_internal_has_print_metadata() const { + bool value = (_impl_._has_bits_[0] & 0x00000040u) != 0; + PROTOBUF_ASSUME(!value || _impl_.print_metadata_ != nullptr); + return value; +} +inline bool ContentMetaData::has_print_metadata() const { + return _internal_has_print_metadata(); +} +inline void ContentMetaData::clear_print_metadata() { + if (_impl_.print_metadata_ != nullptr) _impl_.print_metadata_->Clear(); + _impl_._has_bits_[0] &= ~0x00000040u; +} +inline const ::content_analysis::sdk::ContentMetaData_PrintMetadata& ContentMetaData::_internal_print_metadata() const { + const ::content_analysis::sdk::ContentMetaData_PrintMetadata* p = _impl_.print_metadata_; + return p != nullptr ? *p : reinterpret_cast<const ::content_analysis::sdk::ContentMetaData_PrintMetadata&>( + ::content_analysis::sdk::_ContentMetaData_PrintMetadata_default_instance_); +} +inline const ::content_analysis::sdk::ContentMetaData_PrintMetadata& ContentMetaData::print_metadata() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentMetaData.print_metadata) + return _internal_print_metadata(); +} +inline void ContentMetaData::unsafe_arena_set_allocated_print_metadata( + ::content_analysis::sdk::ContentMetaData_PrintMetadata* print_metadata) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.print_metadata_); + } + _impl_.print_metadata_ = print_metadata; + if (print_metadata) { + _impl_._has_bits_[0] |= 0x00000040u; + } else { + _impl_._has_bits_[0] &= ~0x00000040u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:content_analysis.sdk.ContentMetaData.print_metadata) +} +inline ::content_analysis::sdk::ContentMetaData_PrintMetadata* ContentMetaData::release_print_metadata() { + _impl_._has_bits_[0] &= ~0x00000040u; + ::content_analysis::sdk::ContentMetaData_PrintMetadata* temp = _impl_.print_metadata_; + _impl_.print_metadata_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::content_analysis::sdk::ContentMetaData_PrintMetadata* ContentMetaData::unsafe_arena_release_print_metadata() { + // @@protoc_insertion_point(field_release:content_analysis.sdk.ContentMetaData.print_metadata) + _impl_._has_bits_[0] &= ~0x00000040u; + ::content_analysis::sdk::ContentMetaData_PrintMetadata* temp = _impl_.print_metadata_; + _impl_.print_metadata_ = nullptr; + return temp; +} +inline ::content_analysis::sdk::ContentMetaData_PrintMetadata* ContentMetaData::_internal_mutable_print_metadata() { + _impl_._has_bits_[0] |= 0x00000040u; + if (_impl_.print_metadata_ == nullptr) { + auto* p = CreateMaybeMessage<::content_analysis::sdk::ContentMetaData_PrintMetadata>(GetArenaForAllocation()); + _impl_.print_metadata_ = p; + } + return _impl_.print_metadata_; +} +inline ::content_analysis::sdk::ContentMetaData_PrintMetadata* ContentMetaData::mutable_print_metadata() { + ::content_analysis::sdk::ContentMetaData_PrintMetadata* _msg = _internal_mutable_print_metadata(); + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.ContentMetaData.print_metadata) + return _msg; +} +inline void ContentMetaData::set_allocated_print_metadata(::content_analysis::sdk::ContentMetaData_PrintMetadata* print_metadata) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete _impl_.print_metadata_; + } + if (print_metadata) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(print_metadata); + if (message_arena != submessage_arena) { + print_metadata = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, print_metadata, submessage_arena); + } + _impl_._has_bits_[0] |= 0x00000040u; + } else { + _impl_._has_bits_[0] &= ~0x00000040u; + } + _impl_.print_metadata_ = print_metadata; + // @@protoc_insertion_point(field_set_allocated:content_analysis.sdk.ContentMetaData.print_metadata) +} + +// ------------------------------------------------------------------- + +// ClientMetadata_Browser + +// optional string machine_user = 4; +inline bool ClientMetadata_Browser::_internal_has_machine_user() const { + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool ClientMetadata_Browser::has_machine_user() const { + return _internal_has_machine_user(); +} +inline void ClientMetadata_Browser::clear_machine_user() { + _impl_.machine_user_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; +} +inline const std::string& ClientMetadata_Browser::machine_user() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ClientMetadata.Browser.machine_user) + return _internal_machine_user(); +} +template <typename ArgT0, typename... ArgT> +inline PROTOBUF_ALWAYS_INLINE +void ClientMetadata_Browser::set_machine_user(ArgT0&& arg0, ArgT... args) { + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.machine_user_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:content_analysis.sdk.ClientMetadata.Browser.machine_user) +} +inline std::string* ClientMetadata_Browser::mutable_machine_user() { + std::string* _s = _internal_mutable_machine_user(); + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.ClientMetadata.Browser.machine_user) + return _s; +} +inline const std::string& ClientMetadata_Browser::_internal_machine_user() const { + return _impl_.machine_user_.Get(); +} +inline void ClientMetadata_Browser::_internal_set_machine_user(const std::string& value) { + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.machine_user_.Set(value, GetArenaForAllocation()); +} +inline std::string* ClientMetadata_Browser::_internal_mutable_machine_user() { + _impl_._has_bits_[0] |= 0x00000001u; + return _impl_.machine_user_.Mutable(GetArenaForAllocation()); +} +inline std::string* ClientMetadata_Browser::release_machine_user() { + // @@protoc_insertion_point(field_release:content_analysis.sdk.ClientMetadata.Browser.machine_user) + if (!_internal_has_machine_user()) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* p = _impl_.machine_user_.Release(); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.machine_user_.IsDefault()) { + _impl_.machine_user_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void ClientMetadata_Browser::set_allocated_machine_user(std::string* machine_user) { + if (machine_user != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + _impl_.machine_user_.SetAllocated(machine_user, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.machine_user_.IsDefault()) { + _impl_.machine_user_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:content_analysis.sdk.ClientMetadata.Browser.machine_user) +} + +// ------------------------------------------------------------------- + +// ClientMetadata + +// optional .content_analysis.sdk.ClientMetadata.Browser browser = 1; +inline bool ClientMetadata::_internal_has_browser() const { + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || _impl_.browser_ != nullptr); + return value; +} +inline bool ClientMetadata::has_browser() const { + return _internal_has_browser(); +} +inline void ClientMetadata::clear_browser() { + if (_impl_.browser_ != nullptr) _impl_.browser_->Clear(); + _impl_._has_bits_[0] &= ~0x00000001u; +} +inline const ::content_analysis::sdk::ClientMetadata_Browser& ClientMetadata::_internal_browser() const { + const ::content_analysis::sdk::ClientMetadata_Browser* p = _impl_.browser_; + return p != nullptr ? *p : reinterpret_cast<const ::content_analysis::sdk::ClientMetadata_Browser&>( + ::content_analysis::sdk::_ClientMetadata_Browser_default_instance_); +} +inline const ::content_analysis::sdk::ClientMetadata_Browser& ClientMetadata::browser() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ClientMetadata.browser) + return _internal_browser(); +} +inline void ClientMetadata::unsafe_arena_set_allocated_browser( + ::content_analysis::sdk::ClientMetadata_Browser* browser) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.browser_); + } + _impl_.browser_ = browser; + if (browser) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:content_analysis.sdk.ClientMetadata.browser) +} +inline ::content_analysis::sdk::ClientMetadata_Browser* ClientMetadata::release_browser() { + _impl_._has_bits_[0] &= ~0x00000001u; + ::content_analysis::sdk::ClientMetadata_Browser* temp = _impl_.browser_; + _impl_.browser_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::content_analysis::sdk::ClientMetadata_Browser* ClientMetadata::unsafe_arena_release_browser() { + // @@protoc_insertion_point(field_release:content_analysis.sdk.ClientMetadata.browser) + _impl_._has_bits_[0] &= ~0x00000001u; + ::content_analysis::sdk::ClientMetadata_Browser* temp = _impl_.browser_; + _impl_.browser_ = nullptr; + return temp; +} +inline ::content_analysis::sdk::ClientMetadata_Browser* ClientMetadata::_internal_mutable_browser() { + _impl_._has_bits_[0] |= 0x00000001u; + if (_impl_.browser_ == nullptr) { + auto* p = CreateMaybeMessage<::content_analysis::sdk::ClientMetadata_Browser>(GetArenaForAllocation()); + _impl_.browser_ = p; + } + return _impl_.browser_; +} +inline ::content_analysis::sdk::ClientMetadata_Browser* ClientMetadata::mutable_browser() { + ::content_analysis::sdk::ClientMetadata_Browser* _msg = _internal_mutable_browser(); + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.ClientMetadata.browser) + return _msg; +} +inline void ClientMetadata::set_allocated_browser(::content_analysis::sdk::ClientMetadata_Browser* browser) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete _impl_.browser_; + } + if (browser) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(browser); + if (message_arena != submessage_arena) { + browser = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, browser, submessage_arena); + } + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + _impl_.browser_ = browser; + // @@protoc_insertion_point(field_set_allocated:content_analysis.sdk.ClientMetadata.browser) +} + +// ------------------------------------------------------------------- + +// ClientDownloadRequest_Resource + +// required string url = 1; +inline bool ClientDownloadRequest_Resource::_internal_has_url() const { + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool ClientDownloadRequest_Resource::has_url() const { + return _internal_has_url(); +} +inline void ClientDownloadRequest_Resource::clear_url() { + _impl_.url_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; +} +inline const std::string& ClientDownloadRequest_Resource::url() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ClientDownloadRequest.Resource.url) + return _internal_url(); +} +template <typename ArgT0, typename... ArgT> +inline PROTOBUF_ALWAYS_INLINE +void ClientDownloadRequest_Resource::set_url(ArgT0&& arg0, ArgT... args) { + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.url_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:content_analysis.sdk.ClientDownloadRequest.Resource.url) +} +inline std::string* ClientDownloadRequest_Resource::mutable_url() { + std::string* _s = _internal_mutable_url(); + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.ClientDownloadRequest.Resource.url) + return _s; +} +inline const std::string& ClientDownloadRequest_Resource::_internal_url() const { + return _impl_.url_.Get(); +} +inline void ClientDownloadRequest_Resource::_internal_set_url(const std::string& value) { + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.url_.Set(value, GetArenaForAllocation()); +} +inline std::string* ClientDownloadRequest_Resource::_internal_mutable_url() { + _impl_._has_bits_[0] |= 0x00000001u; + return _impl_.url_.Mutable(GetArenaForAllocation()); +} +inline std::string* ClientDownloadRequest_Resource::release_url() { + // @@protoc_insertion_point(field_release:content_analysis.sdk.ClientDownloadRequest.Resource.url) + if (!_internal_has_url()) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* p = _impl_.url_.Release(); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.url_.IsDefault()) { + _impl_.url_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void ClientDownloadRequest_Resource::set_allocated_url(std::string* url) { + if (url != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + _impl_.url_.SetAllocated(url, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.url_.IsDefault()) { + _impl_.url_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:content_analysis.sdk.ClientDownloadRequest.Resource.url) +} + +// required .content_analysis.sdk.ClientDownloadRequest.ResourceType type = 2; +inline bool ClientDownloadRequest_Resource::_internal_has_type() const { + bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool ClientDownloadRequest_Resource::has_type() const { + return _internal_has_type(); +} +inline void ClientDownloadRequest_Resource::clear_type() { + _impl_.type_ = 0; + _impl_._has_bits_[0] &= ~0x00000002u; +} +inline ::content_analysis::sdk::ClientDownloadRequest_ResourceType ClientDownloadRequest_Resource::_internal_type() const { + return static_cast< ::content_analysis::sdk::ClientDownloadRequest_ResourceType >(_impl_.type_); +} +inline ::content_analysis::sdk::ClientDownloadRequest_ResourceType ClientDownloadRequest_Resource::type() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ClientDownloadRequest.Resource.type) + return _internal_type(); +} +inline void ClientDownloadRequest_Resource::_internal_set_type(::content_analysis::sdk::ClientDownloadRequest_ResourceType value) { + assert(::content_analysis::sdk::ClientDownloadRequest_ResourceType_IsValid(value)); + _impl_._has_bits_[0] |= 0x00000002u; + _impl_.type_ = value; +} +inline void ClientDownloadRequest_Resource::set_type(::content_analysis::sdk::ClientDownloadRequest_ResourceType value) { + _internal_set_type(value); + // @@protoc_insertion_point(field_set:content_analysis.sdk.ClientDownloadRequest.Resource.type) +} + +// ------------------------------------------------------------------- + +// ClientDownloadRequest + +// repeated .content_analysis.sdk.ClientDownloadRequest.Resource resources = 4; +inline int ClientDownloadRequest::_internal_resources_size() const { + return _impl_.resources_.size(); +} +inline int ClientDownloadRequest::resources_size() const { + return _internal_resources_size(); +} +inline void ClientDownloadRequest::clear_resources() { + _impl_.resources_.Clear(); +} +inline ::content_analysis::sdk::ClientDownloadRequest_Resource* ClientDownloadRequest::mutable_resources(int index) { + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.ClientDownloadRequest.resources) + return _impl_.resources_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::content_analysis::sdk::ClientDownloadRequest_Resource >* +ClientDownloadRequest::mutable_resources() { + // @@protoc_insertion_point(field_mutable_list:content_analysis.sdk.ClientDownloadRequest.resources) + return &_impl_.resources_; +} +inline const ::content_analysis::sdk::ClientDownloadRequest_Resource& ClientDownloadRequest::_internal_resources(int index) const { + return _impl_.resources_.Get(index); +} +inline const ::content_analysis::sdk::ClientDownloadRequest_Resource& ClientDownloadRequest::resources(int index) const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ClientDownloadRequest.resources) + return _internal_resources(index); +} +inline ::content_analysis::sdk::ClientDownloadRequest_Resource* ClientDownloadRequest::_internal_add_resources() { + return _impl_.resources_.Add(); +} +inline ::content_analysis::sdk::ClientDownloadRequest_Resource* ClientDownloadRequest::add_resources() { + ::content_analysis::sdk::ClientDownloadRequest_Resource* _add = _internal_add_resources(); + // @@protoc_insertion_point(field_add:content_analysis.sdk.ClientDownloadRequest.resources) + return _add; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::content_analysis::sdk::ClientDownloadRequest_Resource >& +ClientDownloadRequest::resources() const { + // @@protoc_insertion_point(field_list:content_analysis.sdk.ClientDownloadRequest.resources) + return _impl_.resources_; +} + +// ------------------------------------------------------------------- + +// ContentAnalysisRequest_PrintData + +// optional int64 handle = 1; +inline bool ContentAnalysisRequest_PrintData::_internal_has_handle() const { + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool ContentAnalysisRequest_PrintData::has_handle() const { + return _internal_has_handle(); +} +inline void ContentAnalysisRequest_PrintData::clear_handle() { + _impl_.handle_ = int64_t{0}; + _impl_._has_bits_[0] &= ~0x00000001u; +} +inline int64_t ContentAnalysisRequest_PrintData::_internal_handle() const { + return _impl_.handle_; +} +inline int64_t ContentAnalysisRequest_PrintData::handle() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentAnalysisRequest.PrintData.handle) + return _internal_handle(); +} +inline void ContentAnalysisRequest_PrintData::_internal_set_handle(int64_t value) { + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.handle_ = value; +} +inline void ContentAnalysisRequest_PrintData::set_handle(int64_t value) { + _internal_set_handle(value); + // @@protoc_insertion_point(field_set:content_analysis.sdk.ContentAnalysisRequest.PrintData.handle) +} + +// optional int64 size = 2; +inline bool ContentAnalysisRequest_PrintData::_internal_has_size() const { + bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool ContentAnalysisRequest_PrintData::has_size() const { + return _internal_has_size(); +} +inline void ContentAnalysisRequest_PrintData::clear_size() { + _impl_.size_ = int64_t{0}; + _impl_._has_bits_[0] &= ~0x00000002u; +} +inline int64_t ContentAnalysisRequest_PrintData::_internal_size() const { + return _impl_.size_; +} +inline int64_t ContentAnalysisRequest_PrintData::size() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentAnalysisRequest.PrintData.size) + return _internal_size(); +} +inline void ContentAnalysisRequest_PrintData::_internal_set_size(int64_t value) { + _impl_._has_bits_[0] |= 0x00000002u; + _impl_.size_ = value; +} +inline void ContentAnalysisRequest_PrintData::set_size(int64_t value) { + _internal_set_size(value); + // @@protoc_insertion_point(field_set:content_analysis.sdk.ContentAnalysisRequest.PrintData.size) +} + +// ------------------------------------------------------------------- + +// ContentAnalysisRequest + +// optional string request_token = 5; +inline bool ContentAnalysisRequest::_internal_has_request_token() const { + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool ContentAnalysisRequest::has_request_token() const { + return _internal_has_request_token(); +} +inline void ContentAnalysisRequest::clear_request_token() { + _impl_.request_token_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; +} +inline const std::string& ContentAnalysisRequest::request_token() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentAnalysisRequest.request_token) + return _internal_request_token(); +} +template <typename ArgT0, typename... ArgT> +inline PROTOBUF_ALWAYS_INLINE +void ContentAnalysisRequest::set_request_token(ArgT0&& arg0, ArgT... args) { + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.request_token_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:content_analysis.sdk.ContentAnalysisRequest.request_token) +} +inline std::string* ContentAnalysisRequest::mutable_request_token() { + std::string* _s = _internal_mutable_request_token(); + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.ContentAnalysisRequest.request_token) + return _s; +} +inline const std::string& ContentAnalysisRequest::_internal_request_token() const { + return _impl_.request_token_.Get(); +} +inline void ContentAnalysisRequest::_internal_set_request_token(const std::string& value) { + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.request_token_.Set(value, GetArenaForAllocation()); +} +inline std::string* ContentAnalysisRequest::_internal_mutable_request_token() { + _impl_._has_bits_[0] |= 0x00000001u; + return _impl_.request_token_.Mutable(GetArenaForAllocation()); +} +inline std::string* ContentAnalysisRequest::release_request_token() { + // @@protoc_insertion_point(field_release:content_analysis.sdk.ContentAnalysisRequest.request_token) + if (!_internal_has_request_token()) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* p = _impl_.request_token_.Release(); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.request_token_.IsDefault()) { + _impl_.request_token_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void ContentAnalysisRequest::set_allocated_request_token(std::string* request_token) { + if (request_token != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + _impl_.request_token_.SetAllocated(request_token, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.request_token_.IsDefault()) { + _impl_.request_token_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:content_analysis.sdk.ContentAnalysisRequest.request_token) +} + +// optional .content_analysis.sdk.AnalysisConnector analysis_connector = 9; +inline bool ContentAnalysisRequest::_internal_has_analysis_connector() const { + bool value = (_impl_._has_bits_[0] & 0x00000040u) != 0; + return value; +} +inline bool ContentAnalysisRequest::has_analysis_connector() const { + return _internal_has_analysis_connector(); +} +inline void ContentAnalysisRequest::clear_analysis_connector() { + _impl_.analysis_connector_ = 0; + _impl_._has_bits_[0] &= ~0x00000040u; +} +inline ::content_analysis::sdk::AnalysisConnector ContentAnalysisRequest::_internal_analysis_connector() const { + return static_cast< ::content_analysis::sdk::AnalysisConnector >(_impl_.analysis_connector_); +} +inline ::content_analysis::sdk::AnalysisConnector ContentAnalysisRequest::analysis_connector() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentAnalysisRequest.analysis_connector) + return _internal_analysis_connector(); +} +inline void ContentAnalysisRequest::_internal_set_analysis_connector(::content_analysis::sdk::AnalysisConnector value) { + assert(::content_analysis::sdk::AnalysisConnector_IsValid(value)); + _impl_._has_bits_[0] |= 0x00000040u; + _impl_.analysis_connector_ = value; +} +inline void ContentAnalysisRequest::set_analysis_connector(::content_analysis::sdk::AnalysisConnector value) { + _internal_set_analysis_connector(value); + // @@protoc_insertion_point(field_set:content_analysis.sdk.ContentAnalysisRequest.analysis_connector) +} + +// optional .content_analysis.sdk.ContentMetaData request_data = 10; +inline bool ContentAnalysisRequest::_internal_has_request_data() const { + bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; + PROTOBUF_ASSUME(!value || _impl_.request_data_ != nullptr); + return value; +} +inline bool ContentAnalysisRequest::has_request_data() const { + return _internal_has_request_data(); +} +inline void ContentAnalysisRequest::clear_request_data() { + if (_impl_.request_data_ != nullptr) _impl_.request_data_->Clear(); + _impl_._has_bits_[0] &= ~0x00000004u; +} +inline const ::content_analysis::sdk::ContentMetaData& ContentAnalysisRequest::_internal_request_data() const { + const ::content_analysis::sdk::ContentMetaData* p = _impl_.request_data_; + return p != nullptr ? *p : reinterpret_cast<const ::content_analysis::sdk::ContentMetaData&>( + ::content_analysis::sdk::_ContentMetaData_default_instance_); +} +inline const ::content_analysis::sdk::ContentMetaData& ContentAnalysisRequest::request_data() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentAnalysisRequest.request_data) + return _internal_request_data(); +} +inline void ContentAnalysisRequest::unsafe_arena_set_allocated_request_data( + ::content_analysis::sdk::ContentMetaData* request_data) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.request_data_); + } + _impl_.request_data_ = request_data; + if (request_data) { + _impl_._has_bits_[0] |= 0x00000004u; + } else { + _impl_._has_bits_[0] &= ~0x00000004u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:content_analysis.sdk.ContentAnalysisRequest.request_data) +} +inline ::content_analysis::sdk::ContentMetaData* ContentAnalysisRequest::release_request_data() { + _impl_._has_bits_[0] &= ~0x00000004u; + ::content_analysis::sdk::ContentMetaData* temp = _impl_.request_data_; + _impl_.request_data_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::content_analysis::sdk::ContentMetaData* ContentAnalysisRequest::unsafe_arena_release_request_data() { + // @@protoc_insertion_point(field_release:content_analysis.sdk.ContentAnalysisRequest.request_data) + _impl_._has_bits_[0] &= ~0x00000004u; + ::content_analysis::sdk::ContentMetaData* temp = _impl_.request_data_; + _impl_.request_data_ = nullptr; + return temp; +} +inline ::content_analysis::sdk::ContentMetaData* ContentAnalysisRequest::_internal_mutable_request_data() { + _impl_._has_bits_[0] |= 0x00000004u; + if (_impl_.request_data_ == nullptr) { + auto* p = CreateMaybeMessage<::content_analysis::sdk::ContentMetaData>(GetArenaForAllocation()); + _impl_.request_data_ = p; + } + return _impl_.request_data_; +} +inline ::content_analysis::sdk::ContentMetaData* ContentAnalysisRequest::mutable_request_data() { + ::content_analysis::sdk::ContentMetaData* _msg = _internal_mutable_request_data(); + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.ContentAnalysisRequest.request_data) + return _msg; +} +inline void ContentAnalysisRequest::set_allocated_request_data(::content_analysis::sdk::ContentMetaData* request_data) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete _impl_.request_data_; + } + if (request_data) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(request_data); + if (message_arena != submessage_arena) { + request_data = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, request_data, submessage_arena); + } + _impl_._has_bits_[0] |= 0x00000004u; + } else { + _impl_._has_bits_[0] &= ~0x00000004u; + } + _impl_.request_data_ = request_data; + // @@protoc_insertion_point(field_set_allocated:content_analysis.sdk.ContentAnalysisRequest.request_data) +} + +// repeated string tags = 11; +inline int ContentAnalysisRequest::_internal_tags_size() const { + return _impl_.tags_.size(); +} +inline int ContentAnalysisRequest::tags_size() const { + return _internal_tags_size(); +} +inline void ContentAnalysisRequest::clear_tags() { + _impl_.tags_.Clear(); +} +inline std::string* ContentAnalysisRequest::add_tags() { + std::string* _s = _internal_add_tags(); + // @@protoc_insertion_point(field_add_mutable:content_analysis.sdk.ContentAnalysisRequest.tags) + return _s; +} +inline const std::string& ContentAnalysisRequest::_internal_tags(int index) const { + return _impl_.tags_.Get(index); +} +inline const std::string& ContentAnalysisRequest::tags(int index) const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentAnalysisRequest.tags) + return _internal_tags(index); +} +inline std::string* ContentAnalysisRequest::mutable_tags(int index) { + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.ContentAnalysisRequest.tags) + return _impl_.tags_.Mutable(index); +} +inline void ContentAnalysisRequest::set_tags(int index, const std::string& value) { + _impl_.tags_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set:content_analysis.sdk.ContentAnalysisRequest.tags) +} +inline void ContentAnalysisRequest::set_tags(int index, std::string&& value) { + _impl_.tags_.Mutable(index)->assign(std::move(value)); + // @@protoc_insertion_point(field_set:content_analysis.sdk.ContentAnalysisRequest.tags) +} +inline void ContentAnalysisRequest::set_tags(int index, const char* value) { + GOOGLE_DCHECK(value != nullptr); + _impl_.tags_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:content_analysis.sdk.ContentAnalysisRequest.tags) +} +inline void ContentAnalysisRequest::set_tags(int index, const char* value, size_t size) { + _impl_.tags_.Mutable(index)->assign( + reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:content_analysis.sdk.ContentAnalysisRequest.tags) +} +inline std::string* ContentAnalysisRequest::_internal_add_tags() { + return _impl_.tags_.Add(); +} +inline void ContentAnalysisRequest::add_tags(const std::string& value) { + _impl_.tags_.Add()->assign(value); + // @@protoc_insertion_point(field_add:content_analysis.sdk.ContentAnalysisRequest.tags) +} +inline void ContentAnalysisRequest::add_tags(std::string&& value) { + _impl_.tags_.Add(std::move(value)); + // @@protoc_insertion_point(field_add:content_analysis.sdk.ContentAnalysisRequest.tags) +} +inline void ContentAnalysisRequest::add_tags(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _impl_.tags_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:content_analysis.sdk.ContentAnalysisRequest.tags) +} +inline void ContentAnalysisRequest::add_tags(const char* value, size_t size) { + _impl_.tags_.Add()->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_add_pointer:content_analysis.sdk.ContentAnalysisRequest.tags) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>& +ContentAnalysisRequest::tags() const { + // @@protoc_insertion_point(field_list:content_analysis.sdk.ContentAnalysisRequest.tags) + return _impl_.tags_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>* +ContentAnalysisRequest::mutable_tags() { + // @@protoc_insertion_point(field_mutable_list:content_analysis.sdk.ContentAnalysisRequest.tags) + return &_impl_.tags_; +} + +// optional .content_analysis.sdk.ClientMetadata client_metadata = 12; +inline bool ContentAnalysisRequest::_internal_has_client_metadata() const { + bool value = (_impl_._has_bits_[0] & 0x00000008u) != 0; + PROTOBUF_ASSUME(!value || _impl_.client_metadata_ != nullptr); + return value; +} +inline bool ContentAnalysisRequest::has_client_metadata() const { + return _internal_has_client_metadata(); +} +inline void ContentAnalysisRequest::clear_client_metadata() { + if (_impl_.client_metadata_ != nullptr) _impl_.client_metadata_->Clear(); + _impl_._has_bits_[0] &= ~0x00000008u; +} +inline const ::content_analysis::sdk::ClientMetadata& ContentAnalysisRequest::_internal_client_metadata() const { + const ::content_analysis::sdk::ClientMetadata* p = _impl_.client_metadata_; + return p != nullptr ? *p : reinterpret_cast<const ::content_analysis::sdk::ClientMetadata&>( + ::content_analysis::sdk::_ClientMetadata_default_instance_); +} +inline const ::content_analysis::sdk::ClientMetadata& ContentAnalysisRequest::client_metadata() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentAnalysisRequest.client_metadata) + return _internal_client_metadata(); +} +inline void ContentAnalysisRequest::unsafe_arena_set_allocated_client_metadata( + ::content_analysis::sdk::ClientMetadata* client_metadata) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.client_metadata_); + } + _impl_.client_metadata_ = client_metadata; + if (client_metadata) { + _impl_._has_bits_[0] |= 0x00000008u; + } else { + _impl_._has_bits_[0] &= ~0x00000008u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:content_analysis.sdk.ContentAnalysisRequest.client_metadata) +} +inline ::content_analysis::sdk::ClientMetadata* ContentAnalysisRequest::release_client_metadata() { + _impl_._has_bits_[0] &= ~0x00000008u; + ::content_analysis::sdk::ClientMetadata* temp = _impl_.client_metadata_; + _impl_.client_metadata_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::content_analysis::sdk::ClientMetadata* ContentAnalysisRequest::unsafe_arena_release_client_metadata() { + // @@protoc_insertion_point(field_release:content_analysis.sdk.ContentAnalysisRequest.client_metadata) + _impl_._has_bits_[0] &= ~0x00000008u; + ::content_analysis::sdk::ClientMetadata* temp = _impl_.client_metadata_; + _impl_.client_metadata_ = nullptr; + return temp; +} +inline ::content_analysis::sdk::ClientMetadata* ContentAnalysisRequest::_internal_mutable_client_metadata() { + _impl_._has_bits_[0] |= 0x00000008u; + if (_impl_.client_metadata_ == nullptr) { + auto* p = CreateMaybeMessage<::content_analysis::sdk::ClientMetadata>(GetArenaForAllocation()); + _impl_.client_metadata_ = p; + } + return _impl_.client_metadata_; +} +inline ::content_analysis::sdk::ClientMetadata* ContentAnalysisRequest::mutable_client_metadata() { + ::content_analysis::sdk::ClientMetadata* _msg = _internal_mutable_client_metadata(); + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.ContentAnalysisRequest.client_metadata) + return _msg; +} +inline void ContentAnalysisRequest::set_allocated_client_metadata(::content_analysis::sdk::ClientMetadata* client_metadata) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete _impl_.client_metadata_; + } + if (client_metadata) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(client_metadata); + if (message_arena != submessage_arena) { + client_metadata = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, client_metadata, submessage_arena); + } + _impl_._has_bits_[0] |= 0x00000008u; + } else { + _impl_._has_bits_[0] &= ~0x00000008u; + } + _impl_.client_metadata_ = client_metadata; + // @@protoc_insertion_point(field_set_allocated:content_analysis.sdk.ContentAnalysisRequest.client_metadata) +} + +// string text_content = 13; +inline bool ContentAnalysisRequest::_internal_has_text_content() const { + return content_data_case() == kTextContent; +} +inline bool ContentAnalysisRequest::has_text_content() const { + return _internal_has_text_content(); +} +inline void ContentAnalysisRequest::set_has_text_content() { + _impl_._oneof_case_[0] = kTextContent; +} +inline void ContentAnalysisRequest::clear_text_content() { + if (_internal_has_text_content()) { + _impl_.content_data_.text_content_.Destroy(); + clear_has_content_data(); + } +} +inline const std::string& ContentAnalysisRequest::text_content() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentAnalysisRequest.text_content) + return _internal_text_content(); +} +template <typename ArgT0, typename... ArgT> +inline void ContentAnalysisRequest::set_text_content(ArgT0&& arg0, ArgT... args) { + if (!_internal_has_text_content()) { + clear_content_data(); + set_has_text_content(); + _impl_.content_data_.text_content_.InitDefault(); + } + _impl_.content_data_.text_content_.Set( static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:content_analysis.sdk.ContentAnalysisRequest.text_content) +} +inline std::string* ContentAnalysisRequest::mutable_text_content() { + std::string* _s = _internal_mutable_text_content(); + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.ContentAnalysisRequest.text_content) + return _s; +} +inline const std::string& ContentAnalysisRequest::_internal_text_content() const { + if (_internal_has_text_content()) { + return _impl_.content_data_.text_content_.Get(); + } + return ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(); +} +inline void ContentAnalysisRequest::_internal_set_text_content(const std::string& value) { + if (!_internal_has_text_content()) { + clear_content_data(); + set_has_text_content(); + _impl_.content_data_.text_content_.InitDefault(); + } + _impl_.content_data_.text_content_.Set(value, GetArenaForAllocation()); +} +inline std::string* ContentAnalysisRequest::_internal_mutable_text_content() { + if (!_internal_has_text_content()) { + clear_content_data(); + set_has_text_content(); + _impl_.content_data_.text_content_.InitDefault(); + } + return _impl_.content_data_.text_content_.Mutable( GetArenaForAllocation()); +} +inline std::string* ContentAnalysisRequest::release_text_content() { + // @@protoc_insertion_point(field_release:content_analysis.sdk.ContentAnalysisRequest.text_content) + if (_internal_has_text_content()) { + clear_has_content_data(); + return _impl_.content_data_.text_content_.Release(); + } else { + return nullptr; + } +} +inline void ContentAnalysisRequest::set_allocated_text_content(std::string* text_content) { + if (has_content_data()) { + clear_content_data(); + } + if (text_content != nullptr) { + set_has_text_content(); + _impl_.content_data_.text_content_.InitAllocated(text_content, GetArenaForAllocation()); + } + // @@protoc_insertion_point(field_set_allocated:content_analysis.sdk.ContentAnalysisRequest.text_content) +} + +// string file_path = 14; +inline bool ContentAnalysisRequest::_internal_has_file_path() const { + return content_data_case() == kFilePath; +} +inline bool ContentAnalysisRequest::has_file_path() const { + return _internal_has_file_path(); +} +inline void ContentAnalysisRequest::set_has_file_path() { + _impl_._oneof_case_[0] = kFilePath; +} +inline void ContentAnalysisRequest::clear_file_path() { + if (_internal_has_file_path()) { + _impl_.content_data_.file_path_.Destroy(); + clear_has_content_data(); + } +} +inline const std::string& ContentAnalysisRequest::file_path() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentAnalysisRequest.file_path) + return _internal_file_path(); +} +template <typename ArgT0, typename... ArgT> +inline void ContentAnalysisRequest::set_file_path(ArgT0&& arg0, ArgT... args) { + if (!_internal_has_file_path()) { + clear_content_data(); + set_has_file_path(); + _impl_.content_data_.file_path_.InitDefault(); + } + _impl_.content_data_.file_path_.Set( static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:content_analysis.sdk.ContentAnalysisRequest.file_path) +} +inline std::string* ContentAnalysisRequest::mutable_file_path() { + std::string* _s = _internal_mutable_file_path(); + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.ContentAnalysisRequest.file_path) + return _s; +} +inline const std::string& ContentAnalysisRequest::_internal_file_path() const { + if (_internal_has_file_path()) { + return _impl_.content_data_.file_path_.Get(); + } + return ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(); +} +inline void ContentAnalysisRequest::_internal_set_file_path(const std::string& value) { + if (!_internal_has_file_path()) { + clear_content_data(); + set_has_file_path(); + _impl_.content_data_.file_path_.InitDefault(); + } + _impl_.content_data_.file_path_.Set(value, GetArenaForAllocation()); +} +inline std::string* ContentAnalysisRequest::_internal_mutable_file_path() { + if (!_internal_has_file_path()) { + clear_content_data(); + set_has_file_path(); + _impl_.content_data_.file_path_.InitDefault(); + } + return _impl_.content_data_.file_path_.Mutable( GetArenaForAllocation()); +} +inline std::string* ContentAnalysisRequest::release_file_path() { + // @@protoc_insertion_point(field_release:content_analysis.sdk.ContentAnalysisRequest.file_path) + if (_internal_has_file_path()) { + clear_has_content_data(); + return _impl_.content_data_.file_path_.Release(); + } else { + return nullptr; + } +} +inline void ContentAnalysisRequest::set_allocated_file_path(std::string* file_path) { + if (has_content_data()) { + clear_content_data(); + } + if (file_path != nullptr) { + set_has_file_path(); + _impl_.content_data_.file_path_.InitAllocated(file_path, GetArenaForAllocation()); + } + // @@protoc_insertion_point(field_set_allocated:content_analysis.sdk.ContentAnalysisRequest.file_path) +} + +// .content_analysis.sdk.ContentAnalysisRequest.PrintData print_data = 18; +inline bool ContentAnalysisRequest::_internal_has_print_data() const { + return content_data_case() == kPrintData; +} +inline bool ContentAnalysisRequest::has_print_data() const { + return _internal_has_print_data(); +} +inline void ContentAnalysisRequest::set_has_print_data() { + _impl_._oneof_case_[0] = kPrintData; +} +inline void ContentAnalysisRequest::clear_print_data() { + if (_internal_has_print_data()) { + if (GetArenaForAllocation() == nullptr) { + delete _impl_.content_data_.print_data_; + } + clear_has_content_data(); + } +} +inline ::content_analysis::sdk::ContentAnalysisRequest_PrintData* ContentAnalysisRequest::release_print_data() { + // @@protoc_insertion_point(field_release:content_analysis.sdk.ContentAnalysisRequest.print_data) + if (_internal_has_print_data()) { + clear_has_content_data(); + ::content_analysis::sdk::ContentAnalysisRequest_PrintData* temp = _impl_.content_data_.print_data_; + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + _impl_.content_data_.print_data_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline const ::content_analysis::sdk::ContentAnalysisRequest_PrintData& ContentAnalysisRequest::_internal_print_data() const { + return _internal_has_print_data() + ? *_impl_.content_data_.print_data_ + : reinterpret_cast< ::content_analysis::sdk::ContentAnalysisRequest_PrintData&>(::content_analysis::sdk::_ContentAnalysisRequest_PrintData_default_instance_); +} +inline const ::content_analysis::sdk::ContentAnalysisRequest_PrintData& ContentAnalysisRequest::print_data() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentAnalysisRequest.print_data) + return _internal_print_data(); +} +inline ::content_analysis::sdk::ContentAnalysisRequest_PrintData* ContentAnalysisRequest::unsafe_arena_release_print_data() { + // @@protoc_insertion_point(field_unsafe_arena_release:content_analysis.sdk.ContentAnalysisRequest.print_data) + if (_internal_has_print_data()) { + clear_has_content_data(); + ::content_analysis::sdk::ContentAnalysisRequest_PrintData* temp = _impl_.content_data_.print_data_; + _impl_.content_data_.print_data_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline void ContentAnalysisRequest::unsafe_arena_set_allocated_print_data(::content_analysis::sdk::ContentAnalysisRequest_PrintData* print_data) { + clear_content_data(); + if (print_data) { + set_has_print_data(); + _impl_.content_data_.print_data_ = print_data; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:content_analysis.sdk.ContentAnalysisRequest.print_data) +} +inline ::content_analysis::sdk::ContentAnalysisRequest_PrintData* ContentAnalysisRequest::_internal_mutable_print_data() { + if (!_internal_has_print_data()) { + clear_content_data(); + set_has_print_data(); + _impl_.content_data_.print_data_ = CreateMaybeMessage< ::content_analysis::sdk::ContentAnalysisRequest_PrintData >(GetArenaForAllocation()); + } + return _impl_.content_data_.print_data_; +} +inline ::content_analysis::sdk::ContentAnalysisRequest_PrintData* ContentAnalysisRequest::mutable_print_data() { + ::content_analysis::sdk::ContentAnalysisRequest_PrintData* _msg = _internal_mutable_print_data(); + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.ContentAnalysisRequest.print_data) + return _msg; +} + +// optional int64 expires_at = 15; +inline bool ContentAnalysisRequest::_internal_has_expires_at() const { + bool value = (_impl_._has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool ContentAnalysisRequest::has_expires_at() const { + return _internal_has_expires_at(); +} +inline void ContentAnalysisRequest::clear_expires_at() { + _impl_.expires_at_ = int64_t{0}; + _impl_._has_bits_[0] &= ~0x00000010u; +} +inline int64_t ContentAnalysisRequest::_internal_expires_at() const { + return _impl_.expires_at_; +} +inline int64_t ContentAnalysisRequest::expires_at() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentAnalysisRequest.expires_at) + return _internal_expires_at(); +} +inline void ContentAnalysisRequest::_internal_set_expires_at(int64_t value) { + _impl_._has_bits_[0] |= 0x00000010u; + _impl_.expires_at_ = value; +} +inline void ContentAnalysisRequest::set_expires_at(int64_t value) { + _internal_set_expires_at(value); + // @@protoc_insertion_point(field_set:content_analysis.sdk.ContentAnalysisRequest.expires_at) +} + +// optional string user_action_id = 16; +inline bool ContentAnalysisRequest::_internal_has_user_action_id() const { + bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool ContentAnalysisRequest::has_user_action_id() const { + return _internal_has_user_action_id(); +} +inline void ContentAnalysisRequest::clear_user_action_id() { + _impl_.user_action_id_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000002u; +} +inline const std::string& ContentAnalysisRequest::user_action_id() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentAnalysisRequest.user_action_id) + return _internal_user_action_id(); +} +template <typename ArgT0, typename... ArgT> +inline PROTOBUF_ALWAYS_INLINE +void ContentAnalysisRequest::set_user_action_id(ArgT0&& arg0, ArgT... args) { + _impl_._has_bits_[0] |= 0x00000002u; + _impl_.user_action_id_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:content_analysis.sdk.ContentAnalysisRequest.user_action_id) +} +inline std::string* ContentAnalysisRequest::mutable_user_action_id() { + std::string* _s = _internal_mutable_user_action_id(); + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.ContentAnalysisRequest.user_action_id) + return _s; +} +inline const std::string& ContentAnalysisRequest::_internal_user_action_id() const { + return _impl_.user_action_id_.Get(); +} +inline void ContentAnalysisRequest::_internal_set_user_action_id(const std::string& value) { + _impl_._has_bits_[0] |= 0x00000002u; + _impl_.user_action_id_.Set(value, GetArenaForAllocation()); +} +inline std::string* ContentAnalysisRequest::_internal_mutable_user_action_id() { + _impl_._has_bits_[0] |= 0x00000002u; + return _impl_.user_action_id_.Mutable(GetArenaForAllocation()); +} +inline std::string* ContentAnalysisRequest::release_user_action_id() { + // @@protoc_insertion_point(field_release:content_analysis.sdk.ContentAnalysisRequest.user_action_id) + if (!_internal_has_user_action_id()) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000002u; + auto* p = _impl_.user_action_id_.Release(); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.user_action_id_.IsDefault()) { + _impl_.user_action_id_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void ContentAnalysisRequest::set_allocated_user_action_id(std::string* user_action_id) { + if (user_action_id != nullptr) { + _impl_._has_bits_[0] |= 0x00000002u; + } else { + _impl_._has_bits_[0] &= ~0x00000002u; + } + _impl_.user_action_id_.SetAllocated(user_action_id, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.user_action_id_.IsDefault()) { + _impl_.user_action_id_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:content_analysis.sdk.ContentAnalysisRequest.user_action_id) +} + +// optional int64 user_action_requests_count = 17; +inline bool ContentAnalysisRequest::_internal_has_user_action_requests_count() const { + bool value = (_impl_._has_bits_[0] & 0x00000020u) != 0; + return value; +} +inline bool ContentAnalysisRequest::has_user_action_requests_count() const { + return _internal_has_user_action_requests_count(); +} +inline void ContentAnalysisRequest::clear_user_action_requests_count() { + _impl_.user_action_requests_count_ = int64_t{0}; + _impl_._has_bits_[0] &= ~0x00000020u; +} +inline int64_t ContentAnalysisRequest::_internal_user_action_requests_count() const { + return _impl_.user_action_requests_count_; +} +inline int64_t ContentAnalysisRequest::user_action_requests_count() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentAnalysisRequest.user_action_requests_count) + return _internal_user_action_requests_count(); +} +inline void ContentAnalysisRequest::_internal_set_user_action_requests_count(int64_t value) { + _impl_._has_bits_[0] |= 0x00000020u; + _impl_.user_action_requests_count_ = value; +} +inline void ContentAnalysisRequest::set_user_action_requests_count(int64_t value) { + _internal_set_user_action_requests_count(value); + // @@protoc_insertion_point(field_set:content_analysis.sdk.ContentAnalysisRequest.user_action_requests_count) +} + +inline bool ContentAnalysisRequest::has_content_data() const { + return content_data_case() != CONTENT_DATA_NOT_SET; +} +inline void ContentAnalysisRequest::clear_has_content_data() { + _impl_._oneof_case_[0] = CONTENT_DATA_NOT_SET; +} +inline ContentAnalysisRequest::ContentDataCase ContentAnalysisRequest::content_data_case() const { + return ContentAnalysisRequest::ContentDataCase(_impl_._oneof_case_[0]); +} +// ------------------------------------------------------------------- + +// ContentAnalysisResponse_Result_TriggeredRule + +// optional .content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule.Action action = 1; +inline bool ContentAnalysisResponse_Result_TriggeredRule::_internal_has_action() const { + bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool ContentAnalysisResponse_Result_TriggeredRule::has_action() const { + return _internal_has_action(); +} +inline void ContentAnalysisResponse_Result_TriggeredRule::clear_action() { + _impl_.action_ = 0; + _impl_._has_bits_[0] &= ~0x00000004u; +} +inline ::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule_Action ContentAnalysisResponse_Result_TriggeredRule::_internal_action() const { + return static_cast< ::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule_Action >(_impl_.action_); +} +inline ::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule_Action ContentAnalysisResponse_Result_TriggeredRule::action() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule.action) + return _internal_action(); +} +inline void ContentAnalysisResponse_Result_TriggeredRule::_internal_set_action(::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule_Action value) { + assert(::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule_Action_IsValid(value)); + _impl_._has_bits_[0] |= 0x00000004u; + _impl_.action_ = value; +} +inline void ContentAnalysisResponse_Result_TriggeredRule::set_action(::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule_Action value) { + _internal_set_action(value); + // @@protoc_insertion_point(field_set:content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule.action) +} + +// optional string rule_name = 2; +inline bool ContentAnalysisResponse_Result_TriggeredRule::_internal_has_rule_name() const { + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool ContentAnalysisResponse_Result_TriggeredRule::has_rule_name() const { + return _internal_has_rule_name(); +} +inline void ContentAnalysisResponse_Result_TriggeredRule::clear_rule_name() { + _impl_.rule_name_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; +} +inline const std::string& ContentAnalysisResponse_Result_TriggeredRule::rule_name() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule.rule_name) + return _internal_rule_name(); +} +template <typename ArgT0, typename... ArgT> +inline PROTOBUF_ALWAYS_INLINE +void ContentAnalysisResponse_Result_TriggeredRule::set_rule_name(ArgT0&& arg0, ArgT... args) { + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.rule_name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule.rule_name) +} +inline std::string* ContentAnalysisResponse_Result_TriggeredRule::mutable_rule_name() { + std::string* _s = _internal_mutable_rule_name(); + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule.rule_name) + return _s; +} +inline const std::string& ContentAnalysisResponse_Result_TriggeredRule::_internal_rule_name() const { + return _impl_.rule_name_.Get(); +} +inline void ContentAnalysisResponse_Result_TriggeredRule::_internal_set_rule_name(const std::string& value) { + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.rule_name_.Set(value, GetArenaForAllocation()); +} +inline std::string* ContentAnalysisResponse_Result_TriggeredRule::_internal_mutable_rule_name() { + _impl_._has_bits_[0] |= 0x00000001u; + return _impl_.rule_name_.Mutable(GetArenaForAllocation()); +} +inline std::string* ContentAnalysisResponse_Result_TriggeredRule::release_rule_name() { + // @@protoc_insertion_point(field_release:content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule.rule_name) + if (!_internal_has_rule_name()) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* p = _impl_.rule_name_.Release(); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.rule_name_.IsDefault()) { + _impl_.rule_name_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void ContentAnalysisResponse_Result_TriggeredRule::set_allocated_rule_name(std::string* rule_name) { + if (rule_name != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + _impl_.rule_name_.SetAllocated(rule_name, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.rule_name_.IsDefault()) { + _impl_.rule_name_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule.rule_name) +} + +// optional string rule_id = 3; +inline bool ContentAnalysisResponse_Result_TriggeredRule::_internal_has_rule_id() const { + bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool ContentAnalysisResponse_Result_TriggeredRule::has_rule_id() const { + return _internal_has_rule_id(); +} +inline void ContentAnalysisResponse_Result_TriggeredRule::clear_rule_id() { + _impl_.rule_id_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000002u; +} +inline const std::string& ContentAnalysisResponse_Result_TriggeredRule::rule_id() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule.rule_id) + return _internal_rule_id(); +} +template <typename ArgT0, typename... ArgT> +inline PROTOBUF_ALWAYS_INLINE +void ContentAnalysisResponse_Result_TriggeredRule::set_rule_id(ArgT0&& arg0, ArgT... args) { + _impl_._has_bits_[0] |= 0x00000002u; + _impl_.rule_id_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule.rule_id) +} +inline std::string* ContentAnalysisResponse_Result_TriggeredRule::mutable_rule_id() { + std::string* _s = _internal_mutable_rule_id(); + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule.rule_id) + return _s; +} +inline const std::string& ContentAnalysisResponse_Result_TriggeredRule::_internal_rule_id() const { + return _impl_.rule_id_.Get(); +} +inline void ContentAnalysisResponse_Result_TriggeredRule::_internal_set_rule_id(const std::string& value) { + _impl_._has_bits_[0] |= 0x00000002u; + _impl_.rule_id_.Set(value, GetArenaForAllocation()); +} +inline std::string* ContentAnalysisResponse_Result_TriggeredRule::_internal_mutable_rule_id() { + _impl_._has_bits_[0] |= 0x00000002u; + return _impl_.rule_id_.Mutable(GetArenaForAllocation()); +} +inline std::string* ContentAnalysisResponse_Result_TriggeredRule::release_rule_id() { + // @@protoc_insertion_point(field_release:content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule.rule_id) + if (!_internal_has_rule_id()) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000002u; + auto* p = _impl_.rule_id_.Release(); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.rule_id_.IsDefault()) { + _impl_.rule_id_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void ContentAnalysisResponse_Result_TriggeredRule::set_allocated_rule_id(std::string* rule_id) { + if (rule_id != nullptr) { + _impl_._has_bits_[0] |= 0x00000002u; + } else { + _impl_._has_bits_[0] &= ~0x00000002u; + } + _impl_.rule_id_.SetAllocated(rule_id, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.rule_id_.IsDefault()) { + _impl_.rule_id_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule.rule_id) +} + +// ------------------------------------------------------------------- + +// ContentAnalysisResponse_Result + +// optional string tag = 1; +inline bool ContentAnalysisResponse_Result::_internal_has_tag() const { + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool ContentAnalysisResponse_Result::has_tag() const { + return _internal_has_tag(); +} +inline void ContentAnalysisResponse_Result::clear_tag() { + _impl_.tag_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; +} +inline const std::string& ContentAnalysisResponse_Result::tag() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentAnalysisResponse.Result.tag) + return _internal_tag(); +} +template <typename ArgT0, typename... ArgT> +inline PROTOBUF_ALWAYS_INLINE +void ContentAnalysisResponse_Result::set_tag(ArgT0&& arg0, ArgT... args) { + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.tag_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:content_analysis.sdk.ContentAnalysisResponse.Result.tag) +} +inline std::string* ContentAnalysisResponse_Result::mutable_tag() { + std::string* _s = _internal_mutable_tag(); + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.ContentAnalysisResponse.Result.tag) + return _s; +} +inline const std::string& ContentAnalysisResponse_Result::_internal_tag() const { + return _impl_.tag_.Get(); +} +inline void ContentAnalysisResponse_Result::_internal_set_tag(const std::string& value) { + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.tag_.Set(value, GetArenaForAllocation()); +} +inline std::string* ContentAnalysisResponse_Result::_internal_mutable_tag() { + _impl_._has_bits_[0] |= 0x00000001u; + return _impl_.tag_.Mutable(GetArenaForAllocation()); +} +inline std::string* ContentAnalysisResponse_Result::release_tag() { + // @@protoc_insertion_point(field_release:content_analysis.sdk.ContentAnalysisResponse.Result.tag) + if (!_internal_has_tag()) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* p = _impl_.tag_.Release(); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.tag_.IsDefault()) { + _impl_.tag_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void ContentAnalysisResponse_Result::set_allocated_tag(std::string* tag) { + if (tag != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + _impl_.tag_.SetAllocated(tag, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.tag_.IsDefault()) { + _impl_.tag_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:content_analysis.sdk.ContentAnalysisResponse.Result.tag) +} + +// optional .content_analysis.sdk.ContentAnalysisResponse.Result.Status status = 2; +inline bool ContentAnalysisResponse_Result::_internal_has_status() const { + bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool ContentAnalysisResponse_Result::has_status() const { + return _internal_has_status(); +} +inline void ContentAnalysisResponse_Result::clear_status() { + _impl_.status_ = 0; + _impl_._has_bits_[0] &= ~0x00000002u; +} +inline ::content_analysis::sdk::ContentAnalysisResponse_Result_Status ContentAnalysisResponse_Result::_internal_status() const { + return static_cast< ::content_analysis::sdk::ContentAnalysisResponse_Result_Status >(_impl_.status_); +} +inline ::content_analysis::sdk::ContentAnalysisResponse_Result_Status ContentAnalysisResponse_Result::status() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentAnalysisResponse.Result.status) + return _internal_status(); +} +inline void ContentAnalysisResponse_Result::_internal_set_status(::content_analysis::sdk::ContentAnalysisResponse_Result_Status value) { + assert(::content_analysis::sdk::ContentAnalysisResponse_Result_Status_IsValid(value)); + _impl_._has_bits_[0] |= 0x00000002u; + _impl_.status_ = value; +} +inline void ContentAnalysisResponse_Result::set_status(::content_analysis::sdk::ContentAnalysisResponse_Result_Status value) { + _internal_set_status(value); + // @@protoc_insertion_point(field_set:content_analysis.sdk.ContentAnalysisResponse.Result.status) +} + +// repeated .content_analysis.sdk.ContentAnalysisResponse.Result.TriggeredRule triggered_rules = 3; +inline int ContentAnalysisResponse_Result::_internal_triggered_rules_size() const { + return _impl_.triggered_rules_.size(); +} +inline int ContentAnalysisResponse_Result::triggered_rules_size() const { + return _internal_triggered_rules_size(); +} +inline void ContentAnalysisResponse_Result::clear_triggered_rules() { + _impl_.triggered_rules_.Clear(); +} +inline ::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule* ContentAnalysisResponse_Result::mutable_triggered_rules(int index) { + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.ContentAnalysisResponse.Result.triggered_rules) + return _impl_.triggered_rules_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule >* +ContentAnalysisResponse_Result::mutable_triggered_rules() { + // @@protoc_insertion_point(field_mutable_list:content_analysis.sdk.ContentAnalysisResponse.Result.triggered_rules) + return &_impl_.triggered_rules_; +} +inline const ::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule& ContentAnalysisResponse_Result::_internal_triggered_rules(int index) const { + return _impl_.triggered_rules_.Get(index); +} +inline const ::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule& ContentAnalysisResponse_Result::triggered_rules(int index) const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentAnalysisResponse.Result.triggered_rules) + return _internal_triggered_rules(index); +} +inline ::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule* ContentAnalysisResponse_Result::_internal_add_triggered_rules() { + return _impl_.triggered_rules_.Add(); +} +inline ::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule* ContentAnalysisResponse_Result::add_triggered_rules() { + ::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule* _add = _internal_add_triggered_rules(); + // @@protoc_insertion_point(field_add:content_analysis.sdk.ContentAnalysisResponse.Result.triggered_rules) + return _add; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule >& +ContentAnalysisResponse_Result::triggered_rules() const { + // @@protoc_insertion_point(field_list:content_analysis.sdk.ContentAnalysisResponse.Result.triggered_rules) + return _impl_.triggered_rules_; +} + +// ------------------------------------------------------------------- + +// ContentAnalysisResponse + +// optional string request_token = 1; +inline bool ContentAnalysisResponse::_internal_has_request_token() const { + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool ContentAnalysisResponse::has_request_token() const { + return _internal_has_request_token(); +} +inline void ContentAnalysisResponse::clear_request_token() { + _impl_.request_token_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; +} +inline const std::string& ContentAnalysisResponse::request_token() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentAnalysisResponse.request_token) + return _internal_request_token(); +} +template <typename ArgT0, typename... ArgT> +inline PROTOBUF_ALWAYS_INLINE +void ContentAnalysisResponse::set_request_token(ArgT0&& arg0, ArgT... args) { + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.request_token_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:content_analysis.sdk.ContentAnalysisResponse.request_token) +} +inline std::string* ContentAnalysisResponse::mutable_request_token() { + std::string* _s = _internal_mutable_request_token(); + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.ContentAnalysisResponse.request_token) + return _s; +} +inline const std::string& ContentAnalysisResponse::_internal_request_token() const { + return _impl_.request_token_.Get(); +} +inline void ContentAnalysisResponse::_internal_set_request_token(const std::string& value) { + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.request_token_.Set(value, GetArenaForAllocation()); +} +inline std::string* ContentAnalysisResponse::_internal_mutable_request_token() { + _impl_._has_bits_[0] |= 0x00000001u; + return _impl_.request_token_.Mutable(GetArenaForAllocation()); +} +inline std::string* ContentAnalysisResponse::release_request_token() { + // @@protoc_insertion_point(field_release:content_analysis.sdk.ContentAnalysisResponse.request_token) + if (!_internal_has_request_token()) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* p = _impl_.request_token_.Release(); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.request_token_.IsDefault()) { + _impl_.request_token_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void ContentAnalysisResponse::set_allocated_request_token(std::string* request_token) { + if (request_token != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + _impl_.request_token_.SetAllocated(request_token, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.request_token_.IsDefault()) { + _impl_.request_token_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:content_analysis.sdk.ContentAnalysisResponse.request_token) +} + +// repeated .content_analysis.sdk.ContentAnalysisResponse.Result results = 4; +inline int ContentAnalysisResponse::_internal_results_size() const { + return _impl_.results_.size(); +} +inline int ContentAnalysisResponse::results_size() const { + return _internal_results_size(); +} +inline void ContentAnalysisResponse::clear_results() { + _impl_.results_.Clear(); +} +inline ::content_analysis::sdk::ContentAnalysisResponse_Result* ContentAnalysisResponse::mutable_results(int index) { + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.ContentAnalysisResponse.results) + return _impl_.results_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::content_analysis::sdk::ContentAnalysisResponse_Result >* +ContentAnalysisResponse::mutable_results() { + // @@protoc_insertion_point(field_mutable_list:content_analysis.sdk.ContentAnalysisResponse.results) + return &_impl_.results_; +} +inline const ::content_analysis::sdk::ContentAnalysisResponse_Result& ContentAnalysisResponse::_internal_results(int index) const { + return _impl_.results_.Get(index); +} +inline const ::content_analysis::sdk::ContentAnalysisResponse_Result& ContentAnalysisResponse::results(int index) const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentAnalysisResponse.results) + return _internal_results(index); +} +inline ::content_analysis::sdk::ContentAnalysisResponse_Result* ContentAnalysisResponse::_internal_add_results() { + return _impl_.results_.Add(); +} +inline ::content_analysis::sdk::ContentAnalysisResponse_Result* ContentAnalysisResponse::add_results() { + ::content_analysis::sdk::ContentAnalysisResponse_Result* _add = _internal_add_results(); + // @@protoc_insertion_point(field_add:content_analysis.sdk.ContentAnalysisResponse.results) + return _add; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::content_analysis::sdk::ContentAnalysisResponse_Result >& +ContentAnalysisResponse::results() const { + // @@protoc_insertion_point(field_list:content_analysis.sdk.ContentAnalysisResponse.results) + return _impl_.results_; +} + +// ------------------------------------------------------------------- + +// ContentAnalysisAcknowledgement + +// optional string request_token = 1; +inline bool ContentAnalysisAcknowledgement::_internal_has_request_token() const { + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool ContentAnalysisAcknowledgement::has_request_token() const { + return _internal_has_request_token(); +} +inline void ContentAnalysisAcknowledgement::clear_request_token() { + _impl_.request_token_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; +} +inline const std::string& ContentAnalysisAcknowledgement::request_token() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentAnalysisAcknowledgement.request_token) + return _internal_request_token(); +} +template <typename ArgT0, typename... ArgT> +inline PROTOBUF_ALWAYS_INLINE +void ContentAnalysisAcknowledgement::set_request_token(ArgT0&& arg0, ArgT... args) { + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.request_token_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:content_analysis.sdk.ContentAnalysisAcknowledgement.request_token) +} +inline std::string* ContentAnalysisAcknowledgement::mutable_request_token() { + std::string* _s = _internal_mutable_request_token(); + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.ContentAnalysisAcknowledgement.request_token) + return _s; +} +inline const std::string& ContentAnalysisAcknowledgement::_internal_request_token() const { + return _impl_.request_token_.Get(); +} +inline void ContentAnalysisAcknowledgement::_internal_set_request_token(const std::string& value) { + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.request_token_.Set(value, GetArenaForAllocation()); +} +inline std::string* ContentAnalysisAcknowledgement::_internal_mutable_request_token() { + _impl_._has_bits_[0] |= 0x00000001u; + return _impl_.request_token_.Mutable(GetArenaForAllocation()); +} +inline std::string* ContentAnalysisAcknowledgement::release_request_token() { + // @@protoc_insertion_point(field_release:content_analysis.sdk.ContentAnalysisAcknowledgement.request_token) + if (!_internal_has_request_token()) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* p = _impl_.request_token_.Release(); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.request_token_.IsDefault()) { + _impl_.request_token_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void ContentAnalysisAcknowledgement::set_allocated_request_token(std::string* request_token) { + if (request_token != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + _impl_.request_token_.SetAllocated(request_token, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.request_token_.IsDefault()) { + _impl_.request_token_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:content_analysis.sdk.ContentAnalysisAcknowledgement.request_token) +} + +// optional .content_analysis.sdk.ContentAnalysisAcknowledgement.Status status = 2; +inline bool ContentAnalysisAcknowledgement::_internal_has_status() const { + bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool ContentAnalysisAcknowledgement::has_status() const { + return _internal_has_status(); +} +inline void ContentAnalysisAcknowledgement::clear_status() { + _impl_.status_ = 1; + _impl_._has_bits_[0] &= ~0x00000004u; +} +inline ::content_analysis::sdk::ContentAnalysisAcknowledgement_Status ContentAnalysisAcknowledgement::_internal_status() const { + return static_cast< ::content_analysis::sdk::ContentAnalysisAcknowledgement_Status >(_impl_.status_); +} +inline ::content_analysis::sdk::ContentAnalysisAcknowledgement_Status ContentAnalysisAcknowledgement::status() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentAnalysisAcknowledgement.status) + return _internal_status(); +} +inline void ContentAnalysisAcknowledgement::_internal_set_status(::content_analysis::sdk::ContentAnalysisAcknowledgement_Status value) { + assert(::content_analysis::sdk::ContentAnalysisAcknowledgement_Status_IsValid(value)); + _impl_._has_bits_[0] |= 0x00000004u; + _impl_.status_ = value; +} +inline void ContentAnalysisAcknowledgement::set_status(::content_analysis::sdk::ContentAnalysisAcknowledgement_Status value) { + _internal_set_status(value); + // @@protoc_insertion_point(field_set:content_analysis.sdk.ContentAnalysisAcknowledgement.status) +} + +// optional .content_analysis.sdk.ContentAnalysisAcknowledgement.FinalAction final_action = 3; +inline bool ContentAnalysisAcknowledgement::_internal_has_final_action() const { + bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool ContentAnalysisAcknowledgement::has_final_action() const { + return _internal_has_final_action(); +} +inline void ContentAnalysisAcknowledgement::clear_final_action() { + _impl_.final_action_ = 0; + _impl_._has_bits_[0] &= ~0x00000002u; +} +inline ::content_analysis::sdk::ContentAnalysisAcknowledgement_FinalAction ContentAnalysisAcknowledgement::_internal_final_action() const { + return static_cast< ::content_analysis::sdk::ContentAnalysisAcknowledgement_FinalAction >(_impl_.final_action_); +} +inline ::content_analysis::sdk::ContentAnalysisAcknowledgement_FinalAction ContentAnalysisAcknowledgement::final_action() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentAnalysisAcknowledgement.final_action) + return _internal_final_action(); +} +inline void ContentAnalysisAcknowledgement::_internal_set_final_action(::content_analysis::sdk::ContentAnalysisAcknowledgement_FinalAction value) { + assert(::content_analysis::sdk::ContentAnalysisAcknowledgement_FinalAction_IsValid(value)); + _impl_._has_bits_[0] |= 0x00000002u; + _impl_.final_action_ = value; +} +inline void ContentAnalysisAcknowledgement::set_final_action(::content_analysis::sdk::ContentAnalysisAcknowledgement_FinalAction value) { + _internal_set_final_action(value); + // @@protoc_insertion_point(field_set:content_analysis.sdk.ContentAnalysisAcknowledgement.final_action) +} + +// ------------------------------------------------------------------- + +// ContentAnalysisCancelRequests + +// optional string user_action_id = 1; +inline bool ContentAnalysisCancelRequests::_internal_has_user_action_id() const { + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool ContentAnalysisCancelRequests::has_user_action_id() const { + return _internal_has_user_action_id(); +} +inline void ContentAnalysisCancelRequests::clear_user_action_id() { + _impl_.user_action_id_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; +} +inline const std::string& ContentAnalysisCancelRequests::user_action_id() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ContentAnalysisCancelRequests.user_action_id) + return _internal_user_action_id(); +} +template <typename ArgT0, typename... ArgT> +inline PROTOBUF_ALWAYS_INLINE +void ContentAnalysisCancelRequests::set_user_action_id(ArgT0&& arg0, ArgT... args) { + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.user_action_id_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:content_analysis.sdk.ContentAnalysisCancelRequests.user_action_id) +} +inline std::string* ContentAnalysisCancelRequests::mutable_user_action_id() { + std::string* _s = _internal_mutable_user_action_id(); + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.ContentAnalysisCancelRequests.user_action_id) + return _s; +} +inline const std::string& ContentAnalysisCancelRequests::_internal_user_action_id() const { + return _impl_.user_action_id_.Get(); +} +inline void ContentAnalysisCancelRequests::_internal_set_user_action_id(const std::string& value) { + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.user_action_id_.Set(value, GetArenaForAllocation()); +} +inline std::string* ContentAnalysisCancelRequests::_internal_mutable_user_action_id() { + _impl_._has_bits_[0] |= 0x00000001u; + return _impl_.user_action_id_.Mutable(GetArenaForAllocation()); +} +inline std::string* ContentAnalysisCancelRequests::release_user_action_id() { + // @@protoc_insertion_point(field_release:content_analysis.sdk.ContentAnalysisCancelRequests.user_action_id) + if (!_internal_has_user_action_id()) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* p = _impl_.user_action_id_.Release(); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.user_action_id_.IsDefault()) { + _impl_.user_action_id_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void ContentAnalysisCancelRequests::set_allocated_user_action_id(std::string* user_action_id) { + if (user_action_id != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + _impl_.user_action_id_.SetAllocated(user_action_id, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.user_action_id_.IsDefault()) { + _impl_.user_action_id_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:content_analysis.sdk.ContentAnalysisCancelRequests.user_action_id) +} + +// ------------------------------------------------------------------- + +// ChromeToAgent + +// optional .content_analysis.sdk.ContentAnalysisRequest request = 1; +inline bool ChromeToAgent::_internal_has_request() const { + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || _impl_.request_ != nullptr); + return value; +} +inline bool ChromeToAgent::has_request() const { + return _internal_has_request(); +} +inline void ChromeToAgent::clear_request() { + if (_impl_.request_ != nullptr) _impl_.request_->Clear(); + _impl_._has_bits_[0] &= ~0x00000001u; +} +inline const ::content_analysis::sdk::ContentAnalysisRequest& ChromeToAgent::_internal_request() const { + const ::content_analysis::sdk::ContentAnalysisRequest* p = _impl_.request_; + return p != nullptr ? *p : reinterpret_cast<const ::content_analysis::sdk::ContentAnalysisRequest&>( + ::content_analysis::sdk::_ContentAnalysisRequest_default_instance_); +} +inline const ::content_analysis::sdk::ContentAnalysisRequest& ChromeToAgent::request() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ChromeToAgent.request) + return _internal_request(); +} +inline void ChromeToAgent::unsafe_arena_set_allocated_request( + ::content_analysis::sdk::ContentAnalysisRequest* request) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.request_); + } + _impl_.request_ = request; + if (request) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:content_analysis.sdk.ChromeToAgent.request) +} +inline ::content_analysis::sdk::ContentAnalysisRequest* ChromeToAgent::release_request() { + _impl_._has_bits_[0] &= ~0x00000001u; + ::content_analysis::sdk::ContentAnalysisRequest* temp = _impl_.request_; + _impl_.request_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::content_analysis::sdk::ContentAnalysisRequest* ChromeToAgent::unsafe_arena_release_request() { + // @@protoc_insertion_point(field_release:content_analysis.sdk.ChromeToAgent.request) + _impl_._has_bits_[0] &= ~0x00000001u; + ::content_analysis::sdk::ContentAnalysisRequest* temp = _impl_.request_; + _impl_.request_ = nullptr; + return temp; +} +inline ::content_analysis::sdk::ContentAnalysisRequest* ChromeToAgent::_internal_mutable_request() { + _impl_._has_bits_[0] |= 0x00000001u; + if (_impl_.request_ == nullptr) { + auto* p = CreateMaybeMessage<::content_analysis::sdk::ContentAnalysisRequest>(GetArenaForAllocation()); + _impl_.request_ = p; + } + return _impl_.request_; +} +inline ::content_analysis::sdk::ContentAnalysisRequest* ChromeToAgent::mutable_request() { + ::content_analysis::sdk::ContentAnalysisRequest* _msg = _internal_mutable_request(); + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.ChromeToAgent.request) + return _msg; +} +inline void ChromeToAgent::set_allocated_request(::content_analysis::sdk::ContentAnalysisRequest* request) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete _impl_.request_; + } + if (request) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(request); + if (message_arena != submessage_arena) { + request = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, request, submessage_arena); + } + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + _impl_.request_ = request; + // @@protoc_insertion_point(field_set_allocated:content_analysis.sdk.ChromeToAgent.request) +} + +// optional .content_analysis.sdk.ContentAnalysisAcknowledgement ack = 2; +inline bool ChromeToAgent::_internal_has_ack() const { + bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; + PROTOBUF_ASSUME(!value || _impl_.ack_ != nullptr); + return value; +} +inline bool ChromeToAgent::has_ack() const { + return _internal_has_ack(); +} +inline void ChromeToAgent::clear_ack() { + if (_impl_.ack_ != nullptr) _impl_.ack_->Clear(); + _impl_._has_bits_[0] &= ~0x00000002u; +} +inline const ::content_analysis::sdk::ContentAnalysisAcknowledgement& ChromeToAgent::_internal_ack() const { + const ::content_analysis::sdk::ContentAnalysisAcknowledgement* p = _impl_.ack_; + return p != nullptr ? *p : reinterpret_cast<const ::content_analysis::sdk::ContentAnalysisAcknowledgement&>( + ::content_analysis::sdk::_ContentAnalysisAcknowledgement_default_instance_); +} +inline const ::content_analysis::sdk::ContentAnalysisAcknowledgement& ChromeToAgent::ack() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ChromeToAgent.ack) + return _internal_ack(); +} +inline void ChromeToAgent::unsafe_arena_set_allocated_ack( + ::content_analysis::sdk::ContentAnalysisAcknowledgement* ack) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.ack_); + } + _impl_.ack_ = ack; + if (ack) { + _impl_._has_bits_[0] |= 0x00000002u; + } else { + _impl_._has_bits_[0] &= ~0x00000002u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:content_analysis.sdk.ChromeToAgent.ack) +} +inline ::content_analysis::sdk::ContentAnalysisAcknowledgement* ChromeToAgent::release_ack() { + _impl_._has_bits_[0] &= ~0x00000002u; + ::content_analysis::sdk::ContentAnalysisAcknowledgement* temp = _impl_.ack_; + _impl_.ack_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::content_analysis::sdk::ContentAnalysisAcknowledgement* ChromeToAgent::unsafe_arena_release_ack() { + // @@protoc_insertion_point(field_release:content_analysis.sdk.ChromeToAgent.ack) + _impl_._has_bits_[0] &= ~0x00000002u; + ::content_analysis::sdk::ContentAnalysisAcknowledgement* temp = _impl_.ack_; + _impl_.ack_ = nullptr; + return temp; +} +inline ::content_analysis::sdk::ContentAnalysisAcknowledgement* ChromeToAgent::_internal_mutable_ack() { + _impl_._has_bits_[0] |= 0x00000002u; + if (_impl_.ack_ == nullptr) { + auto* p = CreateMaybeMessage<::content_analysis::sdk::ContentAnalysisAcknowledgement>(GetArenaForAllocation()); + _impl_.ack_ = p; + } + return _impl_.ack_; +} +inline ::content_analysis::sdk::ContentAnalysisAcknowledgement* ChromeToAgent::mutable_ack() { + ::content_analysis::sdk::ContentAnalysisAcknowledgement* _msg = _internal_mutable_ack(); + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.ChromeToAgent.ack) + return _msg; +} +inline void ChromeToAgent::set_allocated_ack(::content_analysis::sdk::ContentAnalysisAcknowledgement* ack) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete _impl_.ack_; + } + if (ack) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(ack); + if (message_arena != submessage_arena) { + ack = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, ack, submessage_arena); + } + _impl_._has_bits_[0] |= 0x00000002u; + } else { + _impl_._has_bits_[0] &= ~0x00000002u; + } + _impl_.ack_ = ack; + // @@protoc_insertion_point(field_set_allocated:content_analysis.sdk.ChromeToAgent.ack) +} + +// optional .content_analysis.sdk.ContentAnalysisCancelRequests cancel = 3; +inline bool ChromeToAgent::_internal_has_cancel() const { + bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; + PROTOBUF_ASSUME(!value || _impl_.cancel_ != nullptr); + return value; +} +inline bool ChromeToAgent::has_cancel() const { + return _internal_has_cancel(); +} +inline void ChromeToAgent::clear_cancel() { + if (_impl_.cancel_ != nullptr) _impl_.cancel_->Clear(); + _impl_._has_bits_[0] &= ~0x00000004u; +} +inline const ::content_analysis::sdk::ContentAnalysisCancelRequests& ChromeToAgent::_internal_cancel() const { + const ::content_analysis::sdk::ContentAnalysisCancelRequests* p = _impl_.cancel_; + return p != nullptr ? *p : reinterpret_cast<const ::content_analysis::sdk::ContentAnalysisCancelRequests&>( + ::content_analysis::sdk::_ContentAnalysisCancelRequests_default_instance_); +} +inline const ::content_analysis::sdk::ContentAnalysisCancelRequests& ChromeToAgent::cancel() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.ChromeToAgent.cancel) + return _internal_cancel(); +} +inline void ChromeToAgent::unsafe_arena_set_allocated_cancel( + ::content_analysis::sdk::ContentAnalysisCancelRequests* cancel) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.cancel_); + } + _impl_.cancel_ = cancel; + if (cancel) { + _impl_._has_bits_[0] |= 0x00000004u; + } else { + _impl_._has_bits_[0] &= ~0x00000004u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:content_analysis.sdk.ChromeToAgent.cancel) +} +inline ::content_analysis::sdk::ContentAnalysisCancelRequests* ChromeToAgent::release_cancel() { + _impl_._has_bits_[0] &= ~0x00000004u; + ::content_analysis::sdk::ContentAnalysisCancelRequests* temp = _impl_.cancel_; + _impl_.cancel_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::content_analysis::sdk::ContentAnalysisCancelRequests* ChromeToAgent::unsafe_arena_release_cancel() { + // @@protoc_insertion_point(field_release:content_analysis.sdk.ChromeToAgent.cancel) + _impl_._has_bits_[0] &= ~0x00000004u; + ::content_analysis::sdk::ContentAnalysisCancelRequests* temp = _impl_.cancel_; + _impl_.cancel_ = nullptr; + return temp; +} +inline ::content_analysis::sdk::ContentAnalysisCancelRequests* ChromeToAgent::_internal_mutable_cancel() { + _impl_._has_bits_[0] |= 0x00000004u; + if (_impl_.cancel_ == nullptr) { + auto* p = CreateMaybeMessage<::content_analysis::sdk::ContentAnalysisCancelRequests>(GetArenaForAllocation()); + _impl_.cancel_ = p; + } + return _impl_.cancel_; +} +inline ::content_analysis::sdk::ContentAnalysisCancelRequests* ChromeToAgent::mutable_cancel() { + ::content_analysis::sdk::ContentAnalysisCancelRequests* _msg = _internal_mutable_cancel(); + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.ChromeToAgent.cancel) + return _msg; +} +inline void ChromeToAgent::set_allocated_cancel(::content_analysis::sdk::ContentAnalysisCancelRequests* cancel) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete _impl_.cancel_; + } + if (cancel) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(cancel); + if (message_arena != submessage_arena) { + cancel = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, cancel, submessage_arena); + } + _impl_._has_bits_[0] |= 0x00000004u; + } else { + _impl_._has_bits_[0] &= ~0x00000004u; + } + _impl_.cancel_ = cancel; + // @@protoc_insertion_point(field_set_allocated:content_analysis.sdk.ChromeToAgent.cancel) +} + +// ------------------------------------------------------------------- + +// AgentToChrome + +// optional .content_analysis.sdk.ContentAnalysisResponse response = 1; +inline bool AgentToChrome::_internal_has_response() const { + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || _impl_.response_ != nullptr); + return value; +} +inline bool AgentToChrome::has_response() const { + return _internal_has_response(); +} +inline void AgentToChrome::clear_response() { + if (_impl_.response_ != nullptr) _impl_.response_->Clear(); + _impl_._has_bits_[0] &= ~0x00000001u; +} +inline const ::content_analysis::sdk::ContentAnalysisResponse& AgentToChrome::_internal_response() const { + const ::content_analysis::sdk::ContentAnalysisResponse* p = _impl_.response_; + return p != nullptr ? *p : reinterpret_cast<const ::content_analysis::sdk::ContentAnalysisResponse&>( + ::content_analysis::sdk::_ContentAnalysisResponse_default_instance_); +} +inline const ::content_analysis::sdk::ContentAnalysisResponse& AgentToChrome::response() const { + // @@protoc_insertion_point(field_get:content_analysis.sdk.AgentToChrome.response) + return _internal_response(); +} +inline void AgentToChrome::unsafe_arena_set_allocated_response( + ::content_analysis::sdk::ContentAnalysisResponse* response) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.response_); + } + _impl_.response_ = response; + if (response) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:content_analysis.sdk.AgentToChrome.response) +} +inline ::content_analysis::sdk::ContentAnalysisResponse* AgentToChrome::release_response() { + _impl_._has_bits_[0] &= ~0x00000001u; + ::content_analysis::sdk::ContentAnalysisResponse* temp = _impl_.response_; + _impl_.response_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::content_analysis::sdk::ContentAnalysisResponse* AgentToChrome::unsafe_arena_release_response() { + // @@protoc_insertion_point(field_release:content_analysis.sdk.AgentToChrome.response) + _impl_._has_bits_[0] &= ~0x00000001u; + ::content_analysis::sdk::ContentAnalysisResponse* temp = _impl_.response_; + _impl_.response_ = nullptr; + return temp; +} +inline ::content_analysis::sdk::ContentAnalysisResponse* AgentToChrome::_internal_mutable_response() { + _impl_._has_bits_[0] |= 0x00000001u; + if (_impl_.response_ == nullptr) { + auto* p = CreateMaybeMessage<::content_analysis::sdk::ContentAnalysisResponse>(GetArenaForAllocation()); + _impl_.response_ = p; + } + return _impl_.response_; +} +inline ::content_analysis::sdk::ContentAnalysisResponse* AgentToChrome::mutable_response() { + ::content_analysis::sdk::ContentAnalysisResponse* _msg = _internal_mutable_response(); + // @@protoc_insertion_point(field_mutable:content_analysis.sdk.AgentToChrome.response) + return _msg; +} +inline void AgentToChrome::set_allocated_response(::content_analysis::sdk::ContentAnalysisResponse* response) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete _impl_.response_; + } + if (response) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(response); + if (message_arena != submessage_arena) { + response = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, response, submessage_arena); + } + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + _impl_.response_ = response; + // @@protoc_insertion_point(field_set_allocated:content_analysis.sdk.AgentToChrome.response) +} + +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace sdk +} // namespace content_analysis + +PROTOBUF_NAMESPACE_OPEN + +template <> struct is_proto_enum< ::content_analysis::sdk::ContentMetaData_PrintMetadata_PrinterType> : ::std::true_type {}; +template <> struct is_proto_enum< ::content_analysis::sdk::ClientDownloadRequest_ResourceType> : ::std::true_type {}; +template <> struct is_proto_enum< ::content_analysis::sdk::ContentAnalysisResponse_Result_TriggeredRule_Action> : ::std::true_type {}; +template <> struct is_proto_enum< ::content_analysis::sdk::ContentAnalysisResponse_Result_Status> : ::std::true_type {}; +template <> struct is_proto_enum< ::content_analysis::sdk::ContentAnalysisAcknowledgement_Status> : ::std::true_type {}; +template <> struct is_proto_enum< ::content_analysis::sdk::ContentAnalysisAcknowledgement_FinalAction> : ::std::true_type {}; +template <> struct is_proto_enum< ::content_analysis::sdk::AnalysisConnector> : ::std::true_type {}; + +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) + +#include <google/protobuf/port_undef.inc> +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_analysis_2eproto diff --git a/toolkit/components/contentanalysis/moz.build b/toolkit/components/contentanalysis/moz.build new file mode 100644 index 0000000000..e602d30302 --- /dev/null +++ b/toolkit/components/contentanalysis/moz.build @@ -0,0 +1,62 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# 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/.
+
+with Files("**"):
+ BUG_COMPONENT = ("Toolkit", "General")
+
+UNIFIED_SOURCES += [
+ "content_analysis/sdk/analysis.pb.cc",
+ "ContentAnalysis.cpp",
+]
+
+UNIFIED_SOURCES += [
+ "../../../third_party/content_analysis_sdk/browser/src/client_base.cc",
+]
+
+EXPORTS += ["ContentAnalysis.h"]
+
+EXPORTS.mozilla.contentanalysis += [
+ "ContentAnalysisIPCTypes.h",
+]
+
+if CONFIG["OS_ARCH"] == "WINNT":
+ UNIFIED_SOURCES += [
+ "../../../third_party/content_analysis_sdk/browser/src/client_win.cc",
+ "../../../third_party/content_analysis_sdk/common/utils_win.cc",
+ ]
+elif CONFIG["OS_ARCH"] == "Darwin":
+ UNIFIED_SOURCES += [
+ "../../../third_party/content_analysis_sdk/browser/src/client_mac.cc",
+ ]
+else:
+ UNIFIED_SOURCES += [
+ "../../../third_party/content_analysis_sdk/browser/src/client_posix.cc",
+ ]
+
+LOCAL_INCLUDES += [
+ "../../../third_party/content_analysis_sdk",
+ "../../../third_party/content_analysis_sdk/browser/include",
+ "content_analysis/sdk/",
+]
+
+XPIDL_SOURCES += [
+ "nsIContentAnalysis.idl",
+]
+
+XPIDL_MODULE = "toolkit_contentanalysis"
+
+XPCOM_MANIFESTS += [
+ "components.conf",
+]
+
+include("/ipc/chromium/chromium-config.mozbuild")
+
+DEFINES["GOOGLE_PROTOBUF_NO_RTTI"] = True
+DEFINES["GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER"] = True
+
+FINAL_LIBRARY = "xul"
+
+TEST_DIRS += ["tests/gtest"]
diff --git a/toolkit/components/contentanalysis/nsIContentAnalysis.idl b/toolkit/components/contentanalysis/nsIContentAnalysis.idl new file mode 100644 index 0000000000..142c4c3cd3 --- /dev/null +++ b/toolkit/components/contentanalysis/nsIContentAnalysis.idl @@ -0,0 +1,239 @@ +/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */ +/* 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/. */ + +#include "nsISupports.idl" + +interface nsIURI; +webidl WindowGlobalParent; + +[scriptable, uuid(06e6a60f-3a2b-41fa-a63b-fea7a7f71649)] +interface nsIContentAnalysisAcknowledgement : nsISupports +{ + // These values must stay synchronized with ContentAnalysisAcknowledgement + // in analysis.proto! + // Acknowledgement of analysis response. + cenum Result: 32 { + eSuccess = 1, // The response was handled as specified by the agent. + eInvalidResponse = 2, // The response from the agent was not properly formatted. + eTooLate = 3, // The response from the agent was too late. + }; + + readonly attribute nsIContentAnalysisAcknowledgement_Result result; + + // These values must stay synchronized with ContentAnalysisAcknowledgement + // in analysis.proto! + // The final action that the browser took with this request. + cenum FinalAction : 32 { + eUnspecified = 0, + eAllow = 1, + eReportOnly = 2, + eWarn = 3, + eBlock = 4, + }; + + readonly attribute nsIContentAnalysisAcknowledgement_FinalAction finalAction; +}; + +[scriptable, builtinclass, uuid(89088c61-15f6-4ace-a880-a1b5ea47ca66)] +interface nsIContentAnalysisResponse : nsISupports +{ + // These values must stay synchronized with ContentAnalysisResponse + // in analysis.proto! + // Action requested in response to a successful analysis. + cenum Action : 32 { + eUnspecified = 0, + eReportOnly = 1, + eWarn = 2, + eBlock = 3, + // Values that do not appear in analysis.proto + eAllow = 1000, + eCanceled = 1001, + }; + + [infallible] readonly attribute nsIContentAnalysisResponse_Action action; + [infallible] readonly attribute boolean shouldAllowContent; + + // Identifier for the corresponding nsIContentAnalysisRequest + readonly attribute ACString requestToken; + + /** + * Acknowledge receipt of an analysis response. + * If false is passed for aAutoAcknowledge to AnalyzeContentRequest, + * the caller is responsible for calling this after successful + * resolution of the promise. + */ + void acknowledge(in nsIContentAnalysisAcknowledgement aCaa); +}; + +[scriptable, uuid(48d31df1-204d-42ce-a57f-f156bb870d89)] +interface nsIClientDownloadResource : nsISupports +{ + readonly attribute AString url; + + // These values must stay synchronized with ClientDownloadResource + // in analysis.proto! + // The final URL of the download payload. The resource URL should + // correspond to the URL field above. + const unsigned long DOWNLOAD_URL = 0; + // A redirect URL that was fetched before hitting the final DOWNLOAD_URL. + const unsigned long DOWNLOAD_REDIRECT = 1; + // The final top-level URL of the tab that triggered the download. + const unsigned long TAB_URL = 2; + // A redirect URL thas was fetched before hitting the final TAB_URL. + const unsigned long TAB_REDIRECT = 3; + // The document URL for a PPAPI plugin instance that initiated the download. + // This is the document.url for the container element for the plugin + // instance. + const unsigned long PPAPI_DOCUMENT = 4; + // The plugin URL for a PPAPI plugin instance that initiated the download. + const unsigned long PPAPI_PLUGIN = 5; + + readonly attribute unsigned long type; +}; + +/** + * A nsIContentAnalysisRequest represents a request that the browser + * consult any required content analysis resources (like external data-loss + * prevention applications) to determine if the attempted operation should + * be permitted to complete. + */ +[scriptable, uuid(c11a6636-da2a-4afc-bdd1-0bcae2310e6d)] +interface nsIContentAnalysisRequest : nsISupports +{ + // These values must stay synchronized with ContentAnalysisRequest + // in analysis.proto! + // Type of analysis being requested. + // For meaning, see analysis.proto in the content analysis module. + cenum AnalysisType : 32 { + eUnspecified = 0, + eFileDownloaded = 1, + eFileAttached = 2, + eBulkDataEntry = 3, + ePrint = 4, + eFileTransfer = 5, + }; + readonly attribute nsIContentAnalysisRequest_AnalysisType analysisType; + + // Enumeration of what operation is happening, to be displayed to the user + cenum OperationType : 32 { + eCustomDisplayString = 0, + eClipboard = 1, + eDroppedText = 2, + }; + readonly attribute nsIContentAnalysisRequest_OperationType operationTypeForDisplay; + readonly attribute AString operationDisplayString; + + // Text content to analyze. Only one of textContent or filePath is defined. + readonly attribute AString textContent; + + // Name of file to analyze. Only one of textContent or filePath is defined. + readonly attribute AString filePath; + + // The URL containing the file download/upload or to which web content is + // being uploaded. + readonly attribute nsIURI url; + + // Sha256 digest of file. Callers may pass in an empty string to have the + // content analysis code calculate this. + readonly attribute ACString sha256Digest; + + // URLs involved in the download (empty for non-downloads). + readonly attribute Array<nsIClientDownloadResource> resources; + + // Email address of user. + readonly attribute AString email; + + // Unique identifier for this request + readonly attribute ACString requestToken; + + // The window associated with this request + readonly attribute WindowGlobalParent windowGlobalParent; +}; + +[scriptable, builtinclass, uuid(9679545f-4256-4c90-9654-90292c355d25)] +interface nsIContentAnalysisResult : nsISupports +{ + [infallible] readonly attribute boolean shouldAllowContent; +}; + +[scriptable, uuid(cb09fc88-118c-411b-aa89-2e1bc5e3eba6)] +interface nsIContentAnalysisCallback : nsISupports +{ + void contentResult(in nsIContentAnalysisResponse aResult); + + void error(in nsresult aResult); +}; + +[scriptable, builtinclass, uuid(61497587-2bba-4a88-acd3-3fbb2cedf163)] +interface nsIContentAnalysis : nsISupports +{ + /** + * True if content analysis should be consulted. Must only be accessed from + * the parent process's main thread. + */ + readonly attribute boolean isActive; + + /** + * True if content analysis might be active, and False if content analysis + * is definitely not active. Reading this property is guaranteed + * to work from a content process, and can be used to avoid having to call + * into the parent process to determine whether content analysis is actually + * active. + */ + readonly attribute bool mightBeActive; + + /** + * Consults content analysis server, if any, to request a permission + * decision for a network operation. Allows blocking downloading/ + * uploading/printing/etc, based on the request. + * Consultation with the content analysis tool follows the conventional + * request, response, acknowledgement protocol. + * + * The resulting Promise resolves to a nsIContentAnalysisResponse, + * which may take some time to get from the analysis server. It will + * be rejected, with an string error description, if any error occurs. + * + * @param aCar + * The request to analyze. + * @param aAutoAcknowledge + * Whether to send an acknowledge message to the agent after the agent sends a response. + * Passing false means that the caller is responsible for + * calling nsIContentAnalysisResponse::acknowledge() if the Promise is resolved. + */ + [implicit_jscontext] + Promise analyzeContentRequest(in nsIContentAnalysisRequest aCar, in bool aAutoAcknowledge); + + /** + * Same functionality as AnalyzeContentRequest(), but more convenient to call + * from C++ since it takes a callback instead of returning a Promise. + * + * @param aCar + * The request to analyze. + * @param aAutoAcknowledge + * Whether to send an acknowledge message to the agent after the agent sends a response. + * Passing false means that the caller is responsible for + * calling nsIContentAnalysisResponse::acknowledge() if nsIContentAnalysisCallback::contentResult() + * is called. + * @param callback + * Callbacks to be called when the agent sends a response message (or when there is an error). + */ + void analyzeContentRequestCallback(in nsIContentAnalysisRequest aCar, in bool aAutoAcknowledge, in nsIContentAnalysisCallback callback); + + /** + * Cancels the request that is in progress. This may not actually cancel the request + * with the analysis server, but it means that Gecko will immediately act like the request + * was denied. + * + * @param aRequestToken + * The token for the request to cancel. + */ + void cancelContentAnalysisRequest(in ACString aRequestToken); + + /** + * Indicates that the user has responded to a WARN dialog. aAllowContent represents + * whether the user wants to allow the request to go through. + */ + void respondToWarnDialog(in ACString aRequestToken, in bool aAllowContent); +}; diff --git a/toolkit/components/contentanalysis/tests/gtest/TestContentAnalysis.cpp b/toolkit/components/contentanalysis/tests/gtest/TestContentAnalysis.cpp new file mode 100644 index 0000000000..1cf6d8fc22 --- /dev/null +++ b/toolkit/components/contentanalysis/tests/gtest/TestContentAnalysis.cpp @@ -0,0 +1,132 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* 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 "gtest/gtest.h" +#include "mozilla/ArrayUtils.h" +#include "mozilla/Assertions.h" +#include "mozilla/CmdLineAndEnvUtils.h" +#include "content_analysis/sdk/analysis_client.h" +#include "TestContentAnalysis.h" +#include <processenv.h> +#include <synchapi.h> + +using namespace content_analysis::sdk; + +MozAgentInfo LaunchAgentNormal(const wchar_t* aToBlock) { + nsString cmdLineArguments; + if (aToBlock && aToBlock[0] != 0) { + cmdLineArguments.Append(L" --toblock=.*"); + cmdLineArguments.Append(aToBlock); + cmdLineArguments.Append(L".*"); + } + cmdLineArguments.Append(L" --user"); + cmdLineArguments.Append(L" --path="); + nsString pipeName; + GeneratePipeName(L"contentanalysissdk-gtest-", pipeName); + cmdLineArguments.Append(pipeName); + MozAgentInfo agentInfo; + LaunchAgentWithCommandLineArguments(cmdLineArguments, pipeName, agentInfo); + return agentInfo; +} + +TEST(ContentAnalysis, TextShouldNotBeBlocked) +{ + auto MozAgentInfo = LaunchAgentNormal(L"block"); + // Exit the test early if the process failed to launch + ASSERT_NE(MozAgentInfo.processInfo.dwProcessId, 0UL); + ASSERT_NE(nullptr, MozAgentInfo.client.get()); + + ContentAnalysisRequest request; + request.set_request_token("request token"); + request.set_text_content("should succeed"); + ContentAnalysisResponse response; + ASSERT_EQ(0, MozAgentInfo.client->Send(request, &response)); + ASSERT_STREQ("request token", response.request_token().c_str()); + ASSERT_EQ(1, response.results().size()); + ASSERT_EQ(ContentAnalysisResponse_Result_Status_SUCCESS, + response.results().Get(0).status()); + ASSERT_EQ(0, response.results().Get(0).triggered_rules_size()); + + BOOL terminateResult = + ::TerminateProcess(MozAgentInfo.processInfo.hProcess, 0); + ASSERT_NE(FALSE, terminateResult) + << "Failed to terminate content_analysis_sdk_agent process"; +} + +TEST(ContentAnalysis, TextShouldBeBlocked) +{ + auto MozAgentInfo = LaunchAgentNormal(L"block"); + // Exit the test early if the process failed to launch + ASSERT_NE(MozAgentInfo.processInfo.dwProcessId, 0UL); + ASSERT_NE(nullptr, MozAgentInfo.client.get()); + + ContentAnalysisRequest request; + request.set_request_token("request token"); + request.set_text_content("should be blocked"); + ContentAnalysisResponse response; + ASSERT_EQ(0, MozAgentInfo.client->Send(request, &response)); + ASSERT_STREQ("request token", response.request_token().c_str()); + ASSERT_EQ(1, response.results().size()); + ASSERT_EQ(ContentAnalysisResponse_Result_Status_SUCCESS, + response.results().Get(0).status()); + ASSERT_EQ(1, response.results().Get(0).triggered_rules_size()); + ASSERT_EQ(ContentAnalysisResponse_Result_TriggeredRule_Action_BLOCK, + response.results().Get(0).triggered_rules(0).action()); + + BOOL terminateResult = + ::TerminateProcess(MozAgentInfo.processInfo.hProcess, 0); + ASSERT_NE(FALSE, terminateResult) + << "Failed to terminate content_analysis_sdk_agent process"; +} + +TEST(ContentAnalysis, FileShouldNotBeBlocked) +{ + auto MozAgentInfo = LaunchAgentNormal(L"block"); + // Exit the test early if the process failed to launch + ASSERT_NE(MozAgentInfo.processInfo.dwProcessId, 0UL); + ASSERT_NE(nullptr, MozAgentInfo.client.get()); + + ContentAnalysisRequest request; + request.set_request_token("request token"); + request.set_file_path("..\\..\\_tests\\gtest\\allowedFile.txt"); + ContentAnalysisResponse response; + ASSERT_EQ(0, MozAgentInfo.client->Send(request, &response)); + ASSERT_STREQ("request token", response.request_token().c_str()); + ASSERT_EQ(1, response.results().size()); + ASSERT_EQ(ContentAnalysisResponse_Result_Status_SUCCESS, + response.results().Get(0).status()); + ASSERT_EQ(0, response.results().Get(0).triggered_rules_size()); + + BOOL terminateResult = + ::TerminateProcess(MozAgentInfo.processInfo.hProcess, 0); + ASSERT_NE(FALSE, terminateResult) + << "Failed to terminate content_analysis_sdk_agent process"; +} + +TEST(ContentAnalysis, FileShouldBeBlocked) +{ + auto MozAgentInfo = LaunchAgentNormal(L"block"); + // Exit the test early if the process failed to launch + ASSERT_NE(MozAgentInfo.processInfo.dwProcessId, 0UL); + ASSERT_NE(nullptr, MozAgentInfo.client.get()); + + ContentAnalysisRequest request; + request.set_request_token("request token"); + request.set_file_path("..\\..\\_tests\\gtest\\blockedFile.txt"); + ContentAnalysisResponse response; + ASSERT_EQ(0, MozAgentInfo.client->Send(request, &response)); + ASSERT_STREQ("request token", response.request_token().c_str()); + ASSERT_EQ(1, response.results().size()); + ASSERT_EQ(ContentAnalysisResponse_Result_Status_SUCCESS, + response.results().Get(0).status()); + ASSERT_EQ(1, response.results().Get(0).triggered_rules_size()); + ASSERT_EQ(ContentAnalysisResponse_Result_TriggeredRule_Action_BLOCK, + response.results().Get(0).triggered_rules(0).action()); + + BOOL terminateResult = + ::TerminateProcess(MozAgentInfo.processInfo.hProcess, 0); + ASSERT_NE(FALSE, terminateResult) + << "Failed to terminate content_analysis_sdk_agent process"; +} diff --git a/toolkit/components/contentanalysis/tests/gtest/TestContentAnalysis.h b/toolkit/components/contentanalysis/tests/gtest/TestContentAnalysis.h new file mode 100644 index 0000000000..9e31036262 --- /dev/null +++ b/toolkit/components/contentanalysis/tests/gtest/TestContentAnalysis.h @@ -0,0 +1,24 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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 mozilla_testcontentanalysis_h +#define mozilla_testcontentanalysis_h + +#include <processthreadsapi.h> + +#include "content_analysis/sdk/analysis_client.h" +#include "gtest/gtest.h" +#include "nsString.h" + +struct MozAgentInfo { + PROCESS_INFORMATION processInfo; + std::unique_ptr<content_analysis::sdk::Client> client; +}; + +void GeneratePipeName(const wchar_t* prefix, nsString& pipeName); +void LaunchAgentWithCommandLineArguments(const nsString& cmdLineArguments, + const nsString& pipeName, + MozAgentInfo& agentInfo); +#endif diff --git a/toolkit/components/contentanalysis/tests/gtest/TestContentAnalysisMisbehaving.cpp b/toolkit/components/contentanalysis/tests/gtest/TestContentAnalysisMisbehaving.cpp new file mode 100644 index 0000000000..0b005e1f6c --- /dev/null +++ b/toolkit/components/contentanalysis/tests/gtest/TestContentAnalysisMisbehaving.cpp @@ -0,0 +1,416 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* 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 "gtest/gtest.h" +#include "mozilla/ArrayUtils.h" +#include "mozilla/Assertions.h" +#include "mozilla/CmdLineAndEnvUtils.h" +#include "content_analysis/sdk/analysis_client.h" +#include "TestContentAnalysis.h" +#include <processenv.h> +#include <synchapi.h> +#include <windows.h> + +using namespace content_analysis::sdk; + +namespace { +MozAgentInfo LaunchAgentMisbehaving(const wchar_t* mode) { + nsString cmdLineArguments; + cmdLineArguments.Append(L" --misbehave="); + cmdLineArguments.Append(mode); + cmdLineArguments.Append(L" --user"); + cmdLineArguments.Append(L" --path="); + nsString pipeName; + GeneratePipeName(L"contentanalysissdk-gtest-", pipeName); + cmdLineArguments.Append(pipeName); + MozAgentInfo agentInfo; + LaunchAgentWithCommandLineArguments(cmdLineArguments, pipeName, agentInfo); + return agentInfo; +} +} // namespace + +// Disabled for now +/*TEST(ContentAnalysisMisbehaving, LargeResponse) +{ + auto MozAgentInfo = LaunchAgentMisbehaving(L"largeResponse"); + // Exit the test early if the process failed to launch + ASSERT_NE(MozAgentInfo.processInfo.dwProcessId, 0UL); + ASSERT_NE(nullptr, MozAgentInfo.client.get()); + + ContentAnalysisRequest request; + request.set_request_token("request token"); + request.set_text_content("unused"); + ContentAnalysisResponse response; + ASSERT_EQ(0, MozAgentInfo.client->Send(request, &response)); + ASSERT_STREQ("request token", response.request_token().c_str()); + ASSERT_EQ(1001, response.results().size()); + + BOOL terminateResult = ::TerminateProcess(MozAgentInfo.processInfo.hProcess, +0); ASSERT_NE(FALSE, terminateResult) + << "Failed to terminate content_analysis_sdk_agent process"; +}*/ + +TEST(ContentAnalysisMisbehaving, InvalidUtf8StringStartByteIsContinuationByte) +{ + auto MozAgentInfo = + LaunchAgentMisbehaving(L"invalidUtf8StringStartByteIsContinuationByte"); + // Exit the test early if the process failed to launch + ASSERT_NE(MozAgentInfo.processInfo.dwProcessId, 0UL); + ASSERT_NE(nullptr, MozAgentInfo.client.get()); + + ContentAnalysisRequest request; + request.set_request_token("request token"); + request.set_text_content("unused"); + ContentAnalysisResponse response; + ASSERT_EQ(0, MozAgentInfo.client->Send(request, &response)); + // The protobuf spec says that strings must be valid UTF-8. So it's OK if + // this gets mangled, just want to make sure it doesn't cause a crash + // or invalid memory access or something. + ASSERT_STREQ("\x80\x41\x41\x41", response.request_token().c_str()); + + BOOL terminateResult = + ::TerminateProcess(MozAgentInfo.processInfo.hProcess, 0); + ASSERT_NE(FALSE, terminateResult) + << "Failed to terminate content_analysis_sdk_agent process"; +} + +TEST(ContentAnalysisMisbehaving, + InvalidUtf8StringEndsInMiddleOfMultibyteSequence) +{ + auto MozAgentInfo = LaunchAgentMisbehaving( + L"invalidUtf8StringEndsInMiddleOfMultibyteSequence"); + // Exit the test early if the process failed to launch + ASSERT_NE(MozAgentInfo.processInfo.dwProcessId, 0UL); + ASSERT_NE(nullptr, MozAgentInfo.client.get()); + + ContentAnalysisRequest request; + request.set_request_token("request token"); + request.set_text_content("unused"); + ContentAnalysisResponse response; + ASSERT_EQ(0, MozAgentInfo.client->Send(request, &response)); + // The protobuf spec says that strings must be valid UTF-8. So it's OK if + // this gets mangled, just want to make sure it doesn't cause a crash + // or invalid memory access or something. + ASSERT_STREQ("\x41\xf0\x90\x8d", response.request_token().c_str()); + + BOOL terminateResult = + ::TerminateProcess(MozAgentInfo.processInfo.hProcess, 0); + ASSERT_NE(FALSE, terminateResult) + << "Failed to terminate content_analysis_sdk_agent process"; +} + +TEST(ContentAnalysisMisbehaving, InvalidUtf8StringMultibyteSequenceTooShort) +{ + auto MozAgentInfo = + LaunchAgentMisbehaving(L"invalidUtf8StringMultibyteSequenceTooShort"); + // Exit the test early if the process failed to launch + ASSERT_NE(MozAgentInfo.processInfo.dwProcessId, 0UL); + ASSERT_NE(nullptr, MozAgentInfo.client.get()); + + ContentAnalysisRequest request; + request.set_request_token("request token"); + request.set_text_content("unused"); + ContentAnalysisResponse response; + ASSERT_EQ(0, MozAgentInfo.client->Send(request, &response)); + // The protobuf spec says that strings must be valid UTF-8. So it's OK if + // this gets mangled, just want to make sure it doesn't cause a crash + // or invalid memory access or something. + ASSERT_STREQ("\xf0\x90\x8d\x41", response.request_token().c_str()); + + BOOL terminateResult = + ::TerminateProcess(MozAgentInfo.processInfo.hProcess, 0); + ASSERT_NE(FALSE, terminateResult) + << "Failed to terminate content_analysis_sdk_agent process"; +} + +TEST(ContentAnalysisMisbehaving, InvalidUtf8StringDecodesToInvalidCodePoint) +{ + auto MozAgentInfo = + LaunchAgentMisbehaving(L"invalidUtf8StringDecodesToInvalidCodePoint"); + // Exit the test early if the process failed to launch + ASSERT_NE(MozAgentInfo.processInfo.dwProcessId, 0UL); + ASSERT_NE(nullptr, MozAgentInfo.client.get()); + + ContentAnalysisRequest request; + request.set_request_token("request token"); + request.set_text_content("unused"); + ContentAnalysisResponse response; + ASSERT_EQ(0, MozAgentInfo.client->Send(request, &response)); + // The protobuf spec says that strings must be valid UTF-8. So it's OK if + // this gets mangled, just want to make sure it doesn't cause a crash + // or invalid memory access or something. + ASSERT_STREQ("\xf7\xbf\xbf\xbf", response.request_token().c_str()); + + BOOL terminateResult = + ::TerminateProcess(MozAgentInfo.processInfo.hProcess, 0); + ASSERT_NE(FALSE, terminateResult) + << "Failed to terminate content_analysis_sdk_agent process"; +} + +TEST(ContentAnalysisMisbehaving, InvalidUtf8StringOverlongEncoding) +{ + auto MozAgentInfo = + LaunchAgentMisbehaving(L"invalidUtf8StringOverlongEncoding"); + // Exit the test early if the process failed to launch + ASSERT_NE(MozAgentInfo.processInfo.dwProcessId, 0UL); + ASSERT_NE(nullptr, MozAgentInfo.client.get()); + + ContentAnalysisRequest request; + request.set_request_token("request token"); + request.set_text_content("unused"); + ContentAnalysisResponse response; + ASSERT_EQ(0, MozAgentInfo.client->Send(request, &response)); + // The protobuf spec says that strings must be valid UTF-8. So it's OK if + // this gets mangled, just want to make sure it doesn't cause a crash + // or invalid memory access or something. + ASSERT_STREQ("\xf0\x82\x82\xac", response.request_token().c_str()); + + BOOL terminateResult = + ::TerminateProcess(MozAgentInfo.processInfo.hProcess, 0); + ASSERT_NE(FALSE, terminateResult) + << "Failed to terminate content_analysis_sdk_agent process"; +} + +TEST(ContentAnalysisMisbehaving, StringWithEmbeddedNull) +{ + auto MozAgentInfo = LaunchAgentMisbehaving(L"stringWithEmbeddedNull"); + // Exit the test early if the process failed to launch + ASSERT_NE(MozAgentInfo.processInfo.dwProcessId, 0UL); + ASSERT_NE(nullptr, MozAgentInfo.client.get()); + + ContentAnalysisRequest request; + request.set_request_token("request token"); + request.set_text_content("unused"); + ContentAnalysisResponse response; + ASSERT_EQ(0, MozAgentInfo.client->Send(request, &response)); + std::string expected("\x41\x00\x41"); + ASSERT_EQ(expected, response.request_token()); + + BOOL terminateResult = + ::TerminateProcess(MozAgentInfo.processInfo.hProcess, 0); + ASSERT_NE(FALSE, terminateResult) + << "Failed to terminate content_analysis_sdk_agent process"; +} + +TEST(ContentAnalysisMisbehaving, ZeroResults) +{ + auto MozAgentInfo = LaunchAgentMisbehaving(L"zeroResults"); + // Exit the test early if the process failed to launch + ASSERT_NE(MozAgentInfo.processInfo.dwProcessId, 0UL); + ASSERT_NE(nullptr, MozAgentInfo.client.get()); + + ContentAnalysisRequest request; + request.set_request_token("request token"); + request.set_text_content("unused"); + ContentAnalysisResponse response; + ASSERT_EQ(0, MozAgentInfo.client->Send(request, &response)); + ASSERT_EQ(0, response.results().size()); + + BOOL terminateResult = + ::TerminateProcess(MozAgentInfo.processInfo.hProcess, 0); + ASSERT_NE(FALSE, terminateResult) + << "Failed to terminate content_analysis_sdk_agent process"; +} + +TEST(ContentAnalysisMisbehaving, ResultWithInvalidStatus) +{ + auto MozAgentInfo = LaunchAgentMisbehaving(L"resultWithInvalidStatus"); + // Exit the test early if the process failed to launch + ASSERT_NE(MozAgentInfo.processInfo.dwProcessId, 0UL); + ASSERT_NE(nullptr, MozAgentInfo.client.get()); + + ContentAnalysisRequest request; + request.set_request_token("request token"); + request.set_text_content("unused"); + ContentAnalysisResponse response; + ASSERT_EQ(0, MozAgentInfo.client->Send(request, &response)); + ASSERT_EQ(1, response.results().size()); + // protobuf will fail to read this because it's an invalid value. + // (and leave status at its default value of 0) + // just make sure we can get the value without throwing + ASSERT_GE(static_cast<int>(response.results(0).status()), 0); + + BOOL terminateResult = + ::TerminateProcess(MozAgentInfo.processInfo.hProcess, 0); + ASSERT_NE(FALSE, terminateResult) + << "Failed to terminate content_analysis_sdk_agent process"; +} + +TEST(ContentAnalysisMisbehaving, MessageTruncatedInMiddleOfString) +{ + auto MozAgentInfo = + LaunchAgentMisbehaving(L"messageTruncatedInMiddleOfString"); + // Exit the test early if the process failed to launch + ASSERT_NE(MozAgentInfo.processInfo.dwProcessId, 0UL); + ASSERT_NE(nullptr, MozAgentInfo.client.get()); + + ContentAnalysisRequest request; + request.set_request_token("request token"); + ContentAnalysisResponse response; + // The response is an invalid serialization of protobuf, so this should fail + ASSERT_EQ(-1, MozAgentInfo.client->Send(request, &response)); + + BOOL terminateResult = + ::TerminateProcess(MozAgentInfo.processInfo.hProcess, 0); + ASSERT_NE(FALSE, terminateResult) + << "Failed to terminate content_analysis_sdk_agent process"; +} + +TEST(ContentAnalysisMisbehaving, MessageWithInvalidWireType) +{ + auto MozAgentInfo = LaunchAgentMisbehaving(L"messageWithInvalidWireType"); + // Exit the test early if the process failed to launch + ASSERT_NE(MozAgentInfo.processInfo.dwProcessId, 0UL); + ASSERT_NE(nullptr, MozAgentInfo.client.get()); + + ContentAnalysisRequest request; + request.set_request_token("request token"); + ContentAnalysisResponse response; + // The response is an invalid serialization of protobuf, so this should fail + ASSERT_EQ(-1, MozAgentInfo.client->Send(request, &response)); + + BOOL terminateResult = + ::TerminateProcess(MozAgentInfo.processInfo.hProcess, 0); + ASSERT_NE(FALSE, terminateResult) + << "Failed to terminate content_analysis_sdk_agent process"; +} + +TEST(ContentAnalysisMisbehaving, MessageWithUnusedFieldNumber) +{ + auto MozAgentInfo = LaunchAgentMisbehaving(L"messageWithUnusedFieldNumber"); + // Exit the test early if the process failed to launch + ASSERT_NE(MozAgentInfo.processInfo.dwProcessId, 0UL); + ASSERT_NE(nullptr, MozAgentInfo.client.get()); + + ContentAnalysisRequest request; + request.set_request_token("request token"); + ContentAnalysisResponse response; + ASSERT_EQ(0, MozAgentInfo.client->Send(request, &response)); + // protobuf will read the value and store it in an unused section + // just make sure we can get a value without throwing + ASSERT_STREQ("", response.request_token().c_str()); + + BOOL terminateResult = + ::TerminateProcess(MozAgentInfo.processInfo.hProcess, 0); + ASSERT_NE(FALSE, terminateResult) + << "Failed to terminate content_analysis_sdk_agent process"; +} + +TEST(ContentAnalysisMisbehaving, MessageWithWrongStringWireType) +{ + auto MozAgentInfo = LaunchAgentMisbehaving(L"messageWithWrongStringWireType"); + // Exit the test early if the process failed to launch + ASSERT_NE(MozAgentInfo.processInfo.dwProcessId, 0UL); + ASSERT_NE(nullptr, MozAgentInfo.client.get()); + + ContentAnalysisRequest request; + request.set_request_token("request token"); + ContentAnalysisResponse response; + // The response is an invalid serialization of protobuf, so this should fail + ASSERT_EQ(-1, MozAgentInfo.client->Send(request, &response)); + + BOOL terminateResult = + ::TerminateProcess(MozAgentInfo.processInfo.hProcess, 0); + ASSERT_NE(FALSE, terminateResult) + << "Failed to terminate content_analysis_sdk_agent process"; +} + +TEST(ContentAnalysisMisbehaving, MessageWithZeroTag) +{ + auto MozAgentInfo = LaunchAgentMisbehaving(L"messageWithZeroTag"); + // Exit the test early if the process failed to launch + ASSERT_NE(MozAgentInfo.processInfo.dwProcessId, 0UL); + ASSERT_NE(nullptr, MozAgentInfo.client.get()); + + ContentAnalysisRequest request; + request.set_request_token("request token"); + ContentAnalysisResponse response; + // The response is an invalid serialization of protobuf, so this should fail + ASSERT_EQ(-1, MozAgentInfo.client->Send(request, &response)); + + BOOL terminateResult = + ::TerminateProcess(MozAgentInfo.processInfo.hProcess, 0); + ASSERT_NE(FALSE, terminateResult) + << "Failed to terminate content_analysis_sdk_agent process"; +} + +TEST(ContentAnalysisMisbehaving, MessageWithZeroFieldButNonzeroWireType) +{ + auto MozAgentInfo = + LaunchAgentMisbehaving(L"messageWithZeroFieldButNonzeroWireType"); + // Exit the test early if the process failed to launch + ASSERT_NE(MozAgentInfo.processInfo.dwProcessId, 0UL); + ASSERT_NE(nullptr, MozAgentInfo.client.get()); + + ContentAnalysisRequest request; + request.set_request_token("request token"); + ContentAnalysisResponse response; + // The response is an invalid serialization of protobuf, so this should fail + ASSERT_EQ(-1, MozAgentInfo.client->Send(request, &response)); + + BOOL terminateResult = + ::TerminateProcess(MozAgentInfo.processInfo.hProcess, 0); + ASSERT_NE(FALSE, terminateResult) + << "Failed to terminate content_analysis_sdk_agent process"; +} + +TEST(ContentAnalysisMisbehaving, MessageWithGroupEnd) +{ + auto MozAgentInfo = + LaunchAgentMisbehaving(L"messageWithZeroFieldButNonzeroWireType"); + // Exit the test early if the process failed to launch + ASSERT_NE(MozAgentInfo.processInfo.dwProcessId, 0UL); + ASSERT_NE(nullptr, MozAgentInfo.client.get()); + + ContentAnalysisRequest request; + request.set_request_token("request token"); + ContentAnalysisResponse response; + // The response is an invalid serialization of protobuf, so this should fail + ASSERT_EQ(-1, MozAgentInfo.client->Send(request, &response)); + + BOOL terminateResult = + ::TerminateProcess(MozAgentInfo.processInfo.hProcess, 0); + ASSERT_NE(FALSE, terminateResult) + << "Failed to terminate content_analysis_sdk_agent process"; +} + +TEST(ContentAnalysisMisbehaving, MessageTruncatedInMiddleOfVarint) +{ + auto MozAgentInfo = + LaunchAgentMisbehaving(L"messageTruncatedInMiddleOfVarint"); + // Exit the test early if the process failed to launch + ASSERT_NE(MozAgentInfo.processInfo.dwProcessId, 0UL); + ASSERT_NE(nullptr, MozAgentInfo.client.get()); + + ContentAnalysisRequest request; + request.set_request_token("request token"); + ContentAnalysisResponse response; + // The response is an invalid serialization of protobuf, so this should fail + ASSERT_EQ(-1, MozAgentInfo.client->Send(request, &response)); + + BOOL terminateResult = + ::TerminateProcess(MozAgentInfo.processInfo.hProcess, 0); + ASSERT_NE(FALSE, terminateResult) + << "Failed to terminate content_analysis_sdk_agent process"; +} + +TEST(ContentAnalysisMisbehaving, MessageTruncatedInMiddleOfTag) +{ + auto MozAgentInfo = LaunchAgentMisbehaving(L"messageTruncatedInMiddleOfTag"); + // Exit the test early if the process failed to launch + ASSERT_NE(MozAgentInfo.processInfo.dwProcessId, 0UL); + ASSERT_NE(nullptr, MozAgentInfo.client.get()); + + ContentAnalysisRequest request; + request.set_request_token("request token"); + ContentAnalysisResponse response; + // The response is an invalid serialization of protobuf, so this should fail + ASSERT_EQ(-1, MozAgentInfo.client->Send(request, &response)); + + BOOL terminateResult = + ::TerminateProcess(MozAgentInfo.processInfo.hProcess, 0); + ASSERT_NE(FALSE, terminateResult) + << "Failed to terminate content_analysis_sdk_agent process"; +} diff --git a/toolkit/components/contentanalysis/tests/gtest/TestContentAnalysisUtils.cpp b/toolkit/components/contentanalysis/tests/gtest/TestContentAnalysisUtils.cpp new file mode 100644 index 0000000000..fc0cca5acd --- /dev/null +++ b/toolkit/components/contentanalysis/tests/gtest/TestContentAnalysisUtils.cpp @@ -0,0 +1,75 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* 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 "TestContentAnalysis.h" +#include <combaseapi.h> +#include <pathcch.h> +#include <shlwapi.h> +#include <rpc.h> +#include <windows.h> + +void GeneratePipeName(const wchar_t* prefix, nsString& pipeName) { + pipeName = u""_ns; + pipeName.Append(prefix); + UUID uuid; + ASSERT_EQ(RPC_S_OK, UuidCreate(&uuid)); + // 39 == length of a UUID string including braces and NUL. + wchar_t guidBuf[39] = {}; + ASSERT_EQ(39, StringFromGUID2(uuid, guidBuf, 39)); + // omit opening and closing braces (and trailing null) + pipeName.Append(&guidBuf[1], 36); +} + +void LaunchAgentWithCommandLineArguments(const nsString& cmdLineArguments, + const nsString& pipeName, + MozAgentInfo& agentInfo) { + wchar_t progName[MAX_PATH] = {}; + // content_analysis_sdk_agent.exe is either next to firefox.exe (for local + // builds), or in ../../tests/bin/ (for try/treeherder builds) + DWORD nameSize = ::GetModuleFileNameW(nullptr, progName, MAX_PATH); + ASSERT_NE(DWORD{0}, nameSize); + ASSERT_EQ(S_OK, PathCchRemoveFileSpec(progName, nameSize)); + wchar_t normalizedPath[MAX_PATH] = {}; + nsString test1 = nsString(progName) + u"\\content_analysis_sdk_agent.exe"_ns; + ASSERT_EQ(S_OK, PathCchCanonicalize(normalizedPath, MAX_PATH, test1.get())); + nsString agentPath; + if (::PathFileExistsW(normalizedPath)) { + agentPath = nsString(normalizedPath); + } + if (agentPath.IsEmpty()) { + nsString unNormalizedPath = + nsString(progName) + + u"\\..\\..\\tests\\bin\\content_analysis_sdk_agent.exe"_ns; + ASSERT_EQ(S_OK, PathCchCanonicalize(normalizedPath, MAX_PATH, + unNormalizedPath.get())); + if (::PathFileExistsW(normalizedPath)) { + agentPath = nsString(normalizedPath); + } + } + ASSERT_FALSE(agentPath.IsEmpty()); + nsString localCmdLine = nsString(agentPath) + u" "_ns + cmdLineArguments; + STARTUPINFOW startupInfo = {sizeof(startupInfo)}; + PROCESS_INFORMATION processInfo; + BOOL ok = + ::CreateProcessW(nullptr, localCmdLine.get(), nullptr, nullptr, FALSE, 0, + nullptr, nullptr, &startupInfo, &processInfo); + // The documentation for CreateProcessW() says that any non-zero value is a + // success + if (!ok) { + // Show the last error + ASSERT_EQ(0UL, GetLastError()) + << "Failed to launch content_analysis_sdk_agent"; + } + // Allow time for the agent to set up the pipe + ::Sleep(2000); + content_analysis::sdk::Client::Config config; + config.name = NS_ConvertUTF16toUTF8(pipeName); + config.user_specific = true; + auto clientPtr = content_analysis::sdk::Client::Create(config); + ASSERT_NE(nullptr, clientPtr.get()); + + agentInfo.processInfo = processInfo; + agentInfo.client = std::move(clientPtr); +} diff --git a/toolkit/components/contentanalysis/tests/gtest/agent/moz.build b/toolkit/components/contentanalysis/tests/gtest/agent/moz.build new file mode 100644 index 0000000000..71a3a029ed --- /dev/null +++ b/toolkit/components/contentanalysis/tests/gtest/agent/moz.build @@ -0,0 +1,40 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +Program("content_analysis_sdk_agent") + +DEFINES["UNICODE"] = True +DEFINES["GOOGLE_PROTOBUF_NO_RTTI"] = True +DEFINES["GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER"] = True + +SOURCES += [ + "../../../../../../third_party/content_analysis_sdk/agent/src/agent_base.cc", + "../../../../../../third_party/content_analysis_sdk/agent/src/agent_utils_win.cc", + "../../../../../../third_party/content_analysis_sdk/agent/src/agent_win.cc", + "../../../../../../third_party/content_analysis_sdk/agent/src/event_base.cc", + "../../../../../../third_party/content_analysis_sdk/agent/src/event_win.cc", + "../../../../../../third_party/content_analysis_sdk/agent/src/scoped_print_handle_base.cc", + "../../../../../../third_party/content_analysis_sdk/agent/src/scoped_print_handle_win.cc", + "../../../../../../third_party/content_analysis_sdk/common/utils_win.cc", + "../../../../../../third_party/content_analysis_sdk/demo/agent.cc", + "../../../content_analysis/sdk/analysis.pb.cc", +] + +LOCAL_INCLUDES += [ + "../../../", + "../../../../../../third_party/content_analysis_sdk", + "../../../../../../third_party/content_analysis_sdk/agent/include/", +] + +USE_LIBS += [ + "mozglue", + "protobuf", + "zlib", +] + +OS_LIBS += [ + "advapi32", +] diff --git a/toolkit/components/contentanalysis/tests/gtest/allowedFile.txt b/toolkit/components/contentanalysis/tests/gtest/allowedFile.txt new file mode 100644 index 0000000000..1564d2d1bc --- /dev/null +++ b/toolkit/components/contentanalysis/tests/gtest/allowedFile.txt @@ -0,0 +1 @@ +allow me
\ No newline at end of file diff --git a/toolkit/components/contentanalysis/tests/gtest/blockedFile.txt b/toolkit/components/contentanalysis/tests/gtest/blockedFile.txt new file mode 100644 index 0000000000..58d958775d --- /dev/null +++ b/toolkit/components/contentanalysis/tests/gtest/blockedFile.txt @@ -0,0 +1 @@ +block me
\ No newline at end of file diff --git a/toolkit/components/contentanalysis/tests/gtest/moz.build b/toolkit/components/contentanalysis/tests/gtest/moz.build new file mode 100644 index 0000000000..ce701987a4 --- /dev/null +++ b/toolkit/components/contentanalysis/tests/gtest/moz.build @@ -0,0 +1,23 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# 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/.
+
+LOCAL_INCLUDES += [
+ "../..",
+ "../../../../../third_party/content_analysis_sdk/browser/include/",
+]
+
+if CONFIG["OS_TARGET"] == "WINNT":
+ UNIFIED_SOURCES += [
+ "TestContentAnalysis.cpp",
+ "TestContentAnalysisMisbehaving.cpp",
+ "TestContentAnalysisUtils.cpp",
+ ]
+ DIRS += ["agent"]
+ OS_LIBS += ["pathcch"]
+
+TEST_HARNESS_FILES.gtest += ["allowedFile.txt", "blockedFile.txt"]
+
+FINAL_LIBRARY = "xul-gtest"
|