Bug 1351147 - Update protobuf to support threatHit api
MozReview-Commit-ID: IzjnWnNupvH
--- a/toolkit/components/url-classifier/chromium/README.txt
+++ b/toolkit/components/url-classifier/chromium/README.txt
@@ -1,13 +1,31 @@
# Overview
-'safebrowsing.proto' is modified from [1] with the following line added:
+'safebrowsing.proto' is modified from [1] with the following changes:
+
+- Added "package mozilla.safebrowsing;"
+- Added more threatHit information
+
+##################################
+ // Client-reported identification.
+ optional ClientInfo client_info = 5;
-"package mozilla.safebrowsing;"
+ // Details about the user that encountered the threat.
+ message UserInfo {
+ // The UN M.49 region code associated with the user's location.
+ optional string region_code = 1;
+
+ // Unique ID stable over a week or two
+ optional bytes user_id = 2;
+ }
+
+ // Details about the user that encountered the threat.
+ optional UserInfo user_info = 6;
+####################################
to avoid naming pollution. We use this source file along with protobuf compiler (protoc) to generate safebrowsing.pb.h/cc for safebrowsing v4 update and hash completion. The current generated files are compiled by protoc 2.6.1 since the protobuf library in gecko is not upgraded to 3.0 yet.
# Update
If you want to update to the latest upstream version,
1. Checkout the latest one in [2]
--- a/toolkit/components/url-classifier/chromium/safebrowsing.proto
+++ b/toolkit/components/url-classifier/chromium/safebrowsing.proto
@@ -222,16 +222,18 @@ message ThreatHit {
// The URL that matched the threat list (for which GetFullHash returned a
// valid hash).
MATCHING_URL = 1;
// The final top-level URL of the tab that the client was browsing when the
// match occurred.
TAB_URL = 2;
// A redirect URL that was fetched before hitting the final TAB_URL.
TAB_REDIRECT = 3;
+ // A resource loaded within the final TAB_URL.
+ TAB_RESOURCE = 4;
}
// A single resource related to a threat hit.
message ThreatSource {
// The URL of the resource.
optional string url = 1;
// The type of source reported.
@@ -241,16 +243,31 @@ message ThreatHit {
optional string remote_ip = 3;
// Referrer of the resource. Only set if the referrer is available.
optional string referrer = 4;
}
// The resources related to the threat hit.
repeated ThreatSource resources = 4;
+
+ // Client-reported identification.
+ optional ClientInfo client_info = 5;
+
+ // Details about the user that encountered the threat.
+ message UserInfo {
+ // The UN M.49 region code associated with the user's location.
+ optional string region_code = 1;
+
+ // Unique ID stable over a week or two
+ optional bytes user_id = 2;
+ }
+
+ // Details about the user that encountered the threat.
+ optional UserInfo user_info = 6;
}
// Types of threats.
enum ThreatType {
// Unknown.
THREAT_TYPE_UNSPECIFIED = 0;
// Malware threat type.
--- a/toolkit/components/url-classifier/protobuf/safebrowsing.pb.cc
+++ b/toolkit/components/url-classifier/protobuf/safebrowsing.pb.cc
@@ -25,16 +25,17 @@ void protobuf_ShutdownFile_safebrowsing_
delete FetchThreatListUpdatesRequest_ListUpdateRequest::default_instance_;
delete FetchThreatListUpdatesRequest_ListUpdateRequest_Constraints::default_instance_;
delete FetchThreatListUpdatesResponse::default_instance_;
delete FetchThreatListUpdatesResponse_ListUpdateResponse::default_instance_;
delete FindFullHashesRequest::default_instance_;
delete FindFullHashesResponse::default_instance_;
delete ThreatHit::default_instance_;
delete ThreatHit_ThreatSource::default_instance_;
+ delete ThreatHit_UserInfo::default_instance_;
delete ClientInfo::default_instance_;
delete ChromeClientInfo::default_instance_;
delete Checksum::default_instance_;
delete ThreatEntry::default_instance_;
delete ThreatEntrySet::default_instance_;
delete RawIndices::default_instance_;
delete RawHashes::default_instance_;
delete RiceDeltaEncoding::default_instance_;
@@ -65,16 +66,17 @@ void protobuf_AddDesc_safebrowsing_2epro
FetchThreatListUpdatesRequest_ListUpdateRequest::default_instance_ = new FetchThreatListUpdatesRequest_ListUpdateRequest();
FetchThreatListUpdatesRequest_ListUpdateRequest_Constraints::default_instance_ = new FetchThreatListUpdatesRequest_ListUpdateRequest_Constraints();
FetchThreatListUpdatesResponse::default_instance_ = new FetchThreatListUpdatesResponse();
FetchThreatListUpdatesResponse_ListUpdateResponse::default_instance_ = new FetchThreatListUpdatesResponse_ListUpdateResponse();
FindFullHashesRequest::default_instance_ = new FindFullHashesRequest();
FindFullHashesResponse::default_instance_ = new FindFullHashesResponse();
ThreatHit::default_instance_ = new ThreatHit();
ThreatHit_ThreatSource::default_instance_ = new ThreatHit_ThreatSource();
+ ThreatHit_UserInfo::default_instance_ = new ThreatHit_UserInfo();
ClientInfo::default_instance_ = new ClientInfo();
ChromeClientInfo::default_instance_ = new ChromeClientInfo();
Checksum::default_instance_ = new Checksum();
ThreatEntry::default_instance_ = new ThreatEntry();
ThreatEntrySet::default_instance_ = new ThreatEntrySet();
RawIndices::default_instance_ = new RawIndices();
RawHashes::default_instance_ = new RawHashes();
RiceDeltaEncoding::default_instance_ = new RiceDeltaEncoding();
@@ -91,16 +93,17 @@ void protobuf_AddDesc_safebrowsing_2epro
FetchThreatListUpdatesRequest_ListUpdateRequest::default_instance_->InitAsDefaultInstance();
FetchThreatListUpdatesRequest_ListUpdateRequest_Constraints::default_instance_->InitAsDefaultInstance();
FetchThreatListUpdatesResponse::default_instance_->InitAsDefaultInstance();
FetchThreatListUpdatesResponse_ListUpdateResponse::default_instance_->InitAsDefaultInstance();
FindFullHashesRequest::default_instance_->InitAsDefaultInstance();
FindFullHashesResponse::default_instance_->InitAsDefaultInstance();
ThreatHit::default_instance_->InitAsDefaultInstance();
ThreatHit_ThreatSource::default_instance_->InitAsDefaultInstance();
+ ThreatHit_UserInfo::default_instance_->InitAsDefaultInstance();
ClientInfo::default_instance_->InitAsDefaultInstance();
ChromeClientInfo::default_instance_->InitAsDefaultInstance();
Checksum::default_instance_->InitAsDefaultInstance();
ThreatEntry::default_instance_->InitAsDefaultInstance();
ThreatEntrySet::default_instance_->InitAsDefaultInstance();
RawIndices::default_instance_->InitAsDefaultInstance();
RawHashes::default_instance_->InitAsDefaultInstance();
RiceDeltaEncoding::default_instance_->InitAsDefaultInstance();
@@ -3624,27 +3627,29 @@ void FindFullHashesResponse::Swap(FindFu
// ===================================================================
bool ThreatHit_ThreatSourceType_IsValid(int value) {
switch(value) {
case 0:
case 1:
case 2:
case 3:
+ case 4:
return true;
default:
return false;
}
}
#ifndef _MSC_VER
const ThreatHit_ThreatSourceType ThreatHit::THREAT_SOURCE_TYPE_UNSPECIFIED;
const ThreatHit_ThreatSourceType ThreatHit::MATCHING_URL;
const ThreatHit_ThreatSourceType ThreatHit::TAB_URL;
const ThreatHit_ThreatSourceType ThreatHit::TAB_REDIRECT;
+const ThreatHit_ThreatSourceType ThreatHit::TAB_RESOURCE;
const ThreatHit_ThreatSourceType ThreatHit::ThreatSourceType_MIN;
const ThreatHit_ThreatSourceType ThreatHit::ThreatSourceType_MAX;
const int ThreatHit::ThreatSourceType_ARRAYSIZE;
#endif // _MSC_VER
#ifndef _MSC_VER
const int ThreatHit_ThreatSource::kUrlFieldNumber;
const int ThreatHit_ThreatSource::kTypeFieldNumber;
const int ThreatHit_ThreatSource::kRemoteIpFieldNumber;
@@ -3960,64 +3965,322 @@ void ThreatHit_ThreatSource::Swap(Threat
::std::string ThreatHit_ThreatSource::GetTypeName() const {
return "mozilla.safebrowsing.ThreatHit.ThreatSource";
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
+const int ThreatHit_UserInfo::kRegionCodeFieldNumber;
+const int ThreatHit_UserInfo::kUserIdFieldNumber;
+#endif // !_MSC_VER
+
+ThreatHit_UserInfo::ThreatHit_UserInfo()
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ // @@protoc_insertion_point(constructor:mozilla.safebrowsing.ThreatHit.UserInfo)
+}
+
+void ThreatHit_UserInfo::InitAsDefaultInstance() {
+}
+
+ThreatHit_UserInfo::ThreatHit_UserInfo(const ThreatHit_UserInfo& from)
+ : ::google::protobuf::MessageLite() {
+ SharedCtor();
+ MergeFrom(from);
+ // @@protoc_insertion_point(copy_constructor:mozilla.safebrowsing.ThreatHit.UserInfo)
+}
+
+void ThreatHit_UserInfo::SharedCtor() {
+ ::google::protobuf::internal::GetEmptyString();
+ _cached_size_ = 0;
+ region_code_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ user_id_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+ThreatHit_UserInfo::~ThreatHit_UserInfo() {
+ // @@protoc_insertion_point(destructor:mozilla.safebrowsing.ThreatHit.UserInfo)
+ SharedDtor();
+}
+
+void ThreatHit_UserInfo::SharedDtor() {
+ if (region_code_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ delete region_code_;
+ }
+ if (user_id_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ delete user_id_;
+ }
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ if (this != &default_instance()) {
+ #else
+ if (this != default_instance_) {
+ #endif
+ }
+}
+
+void ThreatHit_UserInfo::SetCachedSize(int size) const {
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ThreatHit_UserInfo& ThreatHit_UserInfo::default_instance() {
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ protobuf_AddDesc_safebrowsing_2eproto();
+#else
+ if (default_instance_ == NULL) protobuf_AddDesc_safebrowsing_2eproto();
+#endif
+ return *default_instance_;
+}
+
+ThreatHit_UserInfo* ThreatHit_UserInfo::default_instance_ = NULL;
+
+ThreatHit_UserInfo* ThreatHit_UserInfo::New() const {
+ return new ThreatHit_UserInfo;
+}
+
+void ThreatHit_UserInfo::Clear() {
+ if (_has_bits_[0 / 32] & 3) {
+ if (has_region_code()) {
+ if (region_code_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ region_code_->clear();
+ }
+ }
+ if (has_user_id()) {
+ if (user_id_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ user_id_->clear();
+ }
+ }
+ }
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+ mutable_unknown_fields()->clear();
+}
+
+bool ThreatHit_UserInfo::MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
+ ::google::protobuf::uint32 tag;
+ ::google::protobuf::io::StringOutputStream unknown_fields_string(
+ mutable_unknown_fields());
+ ::google::protobuf::io::CodedOutputStream unknown_fields_stream(
+ &unknown_fields_string);
+ // @@protoc_insertion_point(parse_start:mozilla.safebrowsing.ThreatHit.UserInfo)
+ for (;;) {
+ ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
+ tag = p.first;
+ if (!p.second) goto handle_unusual;
+ switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+ // optional string region_code = 1;
+ case 1: {
+ if (tag == 10) {
+ DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+ input, this->mutable_region_code()));
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectTag(18)) goto parse_user_id;
+ break;
+ }
+
+ // optional bytes user_id = 2;
+ case 2: {
+ if (tag == 18) {
+ parse_user_id:
+ DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
+ input, this->mutable_user_id()));
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectAtEnd()) goto success;
+ break;
+ }
+
+ default: {
+ handle_unusual:
+ if (tag == 0 ||
+ ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+ goto success;
+ }
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(
+ input, tag, &unknown_fields_stream));
+ break;
+ }
+ }
+ }
+success:
+ // @@protoc_insertion_point(parse_success:mozilla.safebrowsing.ThreatHit.UserInfo)
+ return true;
+failure:
+ // @@protoc_insertion_point(parse_failure:mozilla.safebrowsing.ThreatHit.UserInfo)
+ return false;
+#undef DO_
+}
+
+void ThreatHit_UserInfo::SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const {
+ // @@protoc_insertion_point(serialize_start:mozilla.safebrowsing.ThreatHit.UserInfo)
+ // optional string region_code = 1;
+ if (has_region_code()) {
+ ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
+ 1, this->region_code(), output);
+ }
+
+ // optional bytes user_id = 2;
+ if (has_user_id()) {
+ ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(
+ 2, this->user_id(), output);
+ }
+
+ output->WriteRaw(unknown_fields().data(),
+ unknown_fields().size());
+ // @@protoc_insertion_point(serialize_end:mozilla.safebrowsing.ThreatHit.UserInfo)
+}
+
+int ThreatHit_UserInfo::ByteSize() const {
+ int total_size = 0;
+
+ if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ // optional string region_code = 1;
+ if (has_region_code()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::StringSize(
+ this->region_code());
+ }
+
+ // optional bytes user_id = 2;
+ if (has_user_id()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::BytesSize(
+ this->user_id());
+ }
+
+ }
+ total_size += unknown_fields().size();
+
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = total_size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+ return total_size;
+}
+
+void ThreatHit_UserInfo::CheckTypeAndMergeFrom(
+ const ::google::protobuf::MessageLite& from) {
+ MergeFrom(*::google::protobuf::down_cast<const ThreatHit_UserInfo*>(&from));
+}
+
+void ThreatHit_UserInfo::MergeFrom(const ThreatHit_UserInfo& from) {
+ GOOGLE_CHECK_NE(&from, this);
+ if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ if (from.has_region_code()) {
+ set_region_code(from.region_code());
+ }
+ if (from.has_user_id()) {
+ set_user_id(from.user_id());
+ }
+ }
+ mutable_unknown_fields()->append(from.unknown_fields());
+}
+
+void ThreatHit_UserInfo::CopyFrom(const ThreatHit_UserInfo& from) {
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool ThreatHit_UserInfo::IsInitialized() const {
+
+ return true;
+}
+
+void ThreatHit_UserInfo::Swap(ThreatHit_UserInfo* other) {
+ if (other != this) {
+ std::swap(region_code_, other->region_code_);
+ std::swap(user_id_, other->user_id_);
+ std::swap(_has_bits_[0], other->_has_bits_[0]);
+ _unknown_fields_.swap(other->_unknown_fields_);
+ std::swap(_cached_size_, other->_cached_size_);
+ }
+}
+
+::std::string ThreatHit_UserInfo::GetTypeName() const {
+ return "mozilla.safebrowsing.ThreatHit.UserInfo";
+}
+
+
+// -------------------------------------------------------------------
+
+#ifndef _MSC_VER
const int ThreatHit::kThreatTypeFieldNumber;
const int ThreatHit::kPlatformTypeFieldNumber;
const int ThreatHit::kEntryFieldNumber;
const int ThreatHit::kResourcesFieldNumber;
+const int ThreatHit::kClientInfoFieldNumber;
+const int ThreatHit::kUserInfoFieldNumber;
#endif // !_MSC_VER
ThreatHit::ThreatHit()
: ::google::protobuf::MessageLite() {
SharedCtor();
// @@protoc_insertion_point(constructor:mozilla.safebrowsing.ThreatHit)
}
void ThreatHit::InitAsDefaultInstance() {
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
entry_ = const_cast< ::mozilla::safebrowsing::ThreatEntry*>(
::mozilla::safebrowsing::ThreatEntry::internal_default_instance());
#else
entry_ = const_cast< ::mozilla::safebrowsing::ThreatEntry*>(&::mozilla::safebrowsing::ThreatEntry::default_instance());
#endif
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ client_info_ = const_cast< ::mozilla::safebrowsing::ClientInfo*>(
+ ::mozilla::safebrowsing::ClientInfo::internal_default_instance());
+#else
+ client_info_ = const_cast< ::mozilla::safebrowsing::ClientInfo*>(&::mozilla::safebrowsing::ClientInfo::default_instance());
+#endif
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ user_info_ = const_cast< ::mozilla::safebrowsing::ThreatHit_UserInfo*>(
+ ::mozilla::safebrowsing::ThreatHit_UserInfo::internal_default_instance());
+#else
+ user_info_ = const_cast< ::mozilla::safebrowsing::ThreatHit_UserInfo*>(&::mozilla::safebrowsing::ThreatHit_UserInfo::default_instance());
+#endif
}
ThreatHit::ThreatHit(const ThreatHit& from)
: ::google::protobuf::MessageLite() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:mozilla.safebrowsing.ThreatHit)
}
void ThreatHit::SharedCtor() {
_cached_size_ = 0;
threat_type_ = 0;
platform_type_ = 0;
entry_ = NULL;
+ client_info_ = NULL;
+ user_info_ = NULL;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
ThreatHit::~ThreatHit() {
// @@protoc_insertion_point(destructor:mozilla.safebrowsing.ThreatHit)
SharedDtor();
}
void ThreatHit::SharedDtor() {
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
if (this != &default_instance()) {
#else
if (this != default_instance_) {
#endif
delete entry_;
+ delete client_info_;
+ delete user_info_;
}
}
void ThreatHit::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
@@ -4042,21 +4305,27 @@ void ThreatHit::Clear() {
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
- if (_has_bits_[0 / 32] & 7) {
+ if (_has_bits_[0 / 32] & 55) {
ZR_(threat_type_, platform_type_);
if (has_entry()) {
if (entry_ != NULL) entry_->::mozilla::safebrowsing::ThreatEntry::Clear();
}
+ if (has_client_info()) {
+ if (client_info_ != NULL) client_info_->::mozilla::safebrowsing::ClientInfo::Clear();
+ }
+ if (has_user_info()) {
+ if (user_info_ != NULL) user_info_->::mozilla::safebrowsing::ThreatHit_UserInfo::Clear();
+ }
}
#undef OFFSET_OF_FIELD_
#undef ZR_
resources_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->clear();
@@ -4135,16 +4404,42 @@ bool ThreatHit::MergePartialFromCodedStr
if (tag == 34) {
parse_resources:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_resources()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(34)) goto parse_resources;
+ if (input->ExpectTag(42)) goto parse_client_info;
+ break;
+ }
+
+ // optional .mozilla.safebrowsing.ClientInfo client_info = 5;
+ case 5: {
+ if (tag == 42) {
+ parse_client_info:
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
+ input, mutable_client_info()));
+ } else {
+ goto handle_unusual;
+ }
+ if (input->ExpectTag(50)) goto parse_user_info;
+ break;
+ }
+
+ // optional .mozilla.safebrowsing.ThreatHit.UserInfo user_info = 6;
+ case 6: {
+ if (tag == 50) {
+ parse_user_info:
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
+ input, mutable_user_info()));
+ } else {
+ goto handle_unusual;
+ }
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
@@ -4188,16 +4483,28 @@ void ThreatHit::SerializeWithCachedSizes
}
// repeated .mozilla.safebrowsing.ThreatHit.ThreatSource resources = 4;
for (int i = 0; i < this->resources_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessage(
4, this->resources(i), output);
}
+ // optional .mozilla.safebrowsing.ClientInfo client_info = 5;
+ if (has_client_info()) {
+ ::google::protobuf::internal::WireFormatLite::WriteMessage(
+ 5, this->client_info(), output);
+ }
+
+ // optional .mozilla.safebrowsing.ThreatHit.UserInfo user_info = 6;
+ if (has_user_info()) {
+ ::google::protobuf::internal::WireFormatLite::WriteMessage(
+ 6, this->user_info(), output);
+ }
+
output->WriteRaw(unknown_fields().data(),
unknown_fields().size());
// @@protoc_insertion_point(serialize_end:mozilla.safebrowsing.ThreatHit)
}
int ThreatHit::ByteSize() const {
int total_size = 0;
@@ -4216,16 +4523,30 @@ int ThreatHit::ByteSize() const {
// optional .mozilla.safebrowsing.ThreatEntry entry = 3;
if (has_entry()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->entry());
}
+ // optional .mozilla.safebrowsing.ClientInfo client_info = 5;
+ if (has_client_info()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+ this->client_info());
+ }
+
+ // optional .mozilla.safebrowsing.ThreatHit.UserInfo user_info = 6;
+ if (has_user_info()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+ this->user_info());
+ }
+
}
// repeated .mozilla.safebrowsing.ThreatHit.ThreatSource resources = 4;
total_size += 1 * this->resources_size();
for (int i = 0; i < this->resources_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->resources(i));
}
@@ -4251,16 +4572,22 @@ void ThreatHit::MergeFrom(const ThreatHi
set_threat_type(from.threat_type());
}
if (from.has_platform_type()) {
set_platform_type(from.platform_type());
}
if (from.has_entry()) {
mutable_entry()->::mozilla::safebrowsing::ThreatEntry::MergeFrom(from.entry());
}
+ if (from.has_client_info()) {
+ mutable_client_info()->::mozilla::safebrowsing::ClientInfo::MergeFrom(from.client_info());
+ }
+ if (from.has_user_info()) {
+ mutable_user_info()->::mozilla::safebrowsing::ThreatHit_UserInfo::MergeFrom(from.user_info());
+ }
}
mutable_unknown_fields()->append(from.unknown_fields());
}
void ThreatHit::CopyFrom(const ThreatHit& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
@@ -4272,16 +4599,18 @@ bool ThreatHit::IsInitialized() const {
}
void ThreatHit::Swap(ThreatHit* other) {
if (other != this) {
std::swap(threat_type_, other->threat_type_);
std::swap(platform_type_, other->platform_type_);
std::swap(entry_, other->entry_);
resources_.Swap(&other->resources_);
+ std::swap(client_info_, other->client_info_);
+ std::swap(user_info_, other->user_info_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.swap(other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::std::string ThreatHit::GetTypeName() const {
return "mozilla.safebrowsing.ThreatHit";
--- a/toolkit/components/url-classifier/protobuf/safebrowsing.pb.h
+++ b/toolkit/components/url-classifier/protobuf/safebrowsing.pb.h
@@ -41,16 +41,17 @@ class FetchThreatListUpdatesRequest;
class FetchThreatListUpdatesRequest_ListUpdateRequest;
class FetchThreatListUpdatesRequest_ListUpdateRequest_Constraints;
class FetchThreatListUpdatesResponse;
class FetchThreatListUpdatesResponse_ListUpdateResponse;
class FindFullHashesRequest;
class FindFullHashesResponse;
class ThreatHit;
class ThreatHit_ThreatSource;
+class ThreatHit_UserInfo;
class ClientInfo;
class ChromeClientInfo;
class Checksum;
class ThreatEntry;
class ThreatEntrySet;
class RawIndices;
class RawHashes;
class RiceDeltaEncoding;
@@ -69,21 +70,22 @@ bool FetchThreatListUpdatesResponse_List
const FetchThreatListUpdatesResponse_ListUpdateResponse_ResponseType FetchThreatListUpdatesResponse_ListUpdateResponse_ResponseType_ResponseType_MIN = FetchThreatListUpdatesResponse_ListUpdateResponse_ResponseType_RESPONSE_TYPE_UNSPECIFIED;
const FetchThreatListUpdatesResponse_ListUpdateResponse_ResponseType FetchThreatListUpdatesResponse_ListUpdateResponse_ResponseType_ResponseType_MAX = FetchThreatListUpdatesResponse_ListUpdateResponse_ResponseType_FULL_UPDATE;
const int FetchThreatListUpdatesResponse_ListUpdateResponse_ResponseType_ResponseType_ARRAYSIZE = FetchThreatListUpdatesResponse_ListUpdateResponse_ResponseType_ResponseType_MAX + 1;
enum ThreatHit_ThreatSourceType {
ThreatHit_ThreatSourceType_THREAT_SOURCE_TYPE_UNSPECIFIED = 0,
ThreatHit_ThreatSourceType_MATCHING_URL = 1,
ThreatHit_ThreatSourceType_TAB_URL = 2,
- ThreatHit_ThreatSourceType_TAB_REDIRECT = 3
+ ThreatHit_ThreatSourceType_TAB_REDIRECT = 3,
+ ThreatHit_ThreatSourceType_TAB_RESOURCE = 4
};
bool ThreatHit_ThreatSourceType_IsValid(int value);
const ThreatHit_ThreatSourceType ThreatHit_ThreatSourceType_ThreatSourceType_MIN = ThreatHit_ThreatSourceType_THREAT_SOURCE_TYPE_UNSPECIFIED;
-const ThreatHit_ThreatSourceType ThreatHit_ThreatSourceType_ThreatSourceType_MAX = ThreatHit_ThreatSourceType_TAB_REDIRECT;
+const ThreatHit_ThreatSourceType ThreatHit_ThreatSourceType_ThreatSourceType_MAX = ThreatHit_ThreatSourceType_TAB_RESOURCE;
const int ThreatHit_ThreatSourceType_ThreatSourceType_ARRAYSIZE = ThreatHit_ThreatSourceType_ThreatSourceType_MAX + 1;
enum ChromeClientInfo_SafeBrowsingReportingPopulation {
ChromeClientInfo_SafeBrowsingReportingPopulation_UNSPECIFIED = 0,
ChromeClientInfo_SafeBrowsingReportingPopulation_OPT_OUT = 1,
ChromeClientInfo_SafeBrowsingReportingPopulation_EXTENDED = 2,
ChromeClientInfo_SafeBrowsingReportingPopulation_SCOUT = 3
};
@@ -1680,16 +1682,127 @@ class ThreatHit_ThreatSource : public ::
friend void protobuf_AssignDesc_safebrowsing_2eproto();
friend void protobuf_ShutdownFile_safebrowsing_2eproto();
void InitAsDefaultInstance();
static ThreatHit_ThreatSource* default_instance_;
};
// -------------------------------------------------------------------
+class ThreatHit_UserInfo : public ::google::protobuf::MessageLite {
+ public:
+ ThreatHit_UserInfo();
+ virtual ~ThreatHit_UserInfo();
+
+ ThreatHit_UserInfo(const ThreatHit_UserInfo& from);
+
+ inline ThreatHit_UserInfo& operator=(const ThreatHit_UserInfo& from) {
+ CopyFrom(from);
+ return *this;
+ }
+
+ inline const ::std::string& unknown_fields() const {
+ return _unknown_fields_;
+ }
+
+ inline ::std::string* mutable_unknown_fields() {
+ return &_unknown_fields_;
+ }
+
+ static const ThreatHit_UserInfo& default_instance();
+
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ // Returns the internal default instance pointer. This function can
+ // return NULL thus should not be used by the user. This is intended
+ // for Protobuf internal code. Please use default_instance() declared
+ // above instead.
+ static inline const ThreatHit_UserInfo* internal_default_instance() {
+ return default_instance_;
+ }
+ #endif
+
+ void Swap(ThreatHit_UserInfo* other);
+
+ // implements Message ----------------------------------------------
+
+ ThreatHit_UserInfo* New() const;
+ void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
+ void CopyFrom(const ThreatHit_UserInfo& from);
+ void MergeFrom(const ThreatHit_UserInfo& from);
+ void Clear();
+ bool IsInitialized() const;
+
+ int ByteSize() const;
+ bool MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input);
+ void SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const;
+ void DiscardUnknownFields();
+ int GetCachedSize() const { return _cached_size_; }
+ private:
+ void SharedCtor();
+ void SharedDtor();
+ void SetCachedSize(int size) const;
+ public:
+ ::std::string GetTypeName() const;
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ // optional string region_code = 1;
+ inline bool has_region_code() const;
+ inline void clear_region_code();
+ static const int kRegionCodeFieldNumber = 1;
+ inline const ::std::string& region_code() const;
+ inline void set_region_code(const ::std::string& value);
+ inline void set_region_code(const char* value);
+ inline void set_region_code(const char* value, size_t size);
+ inline ::std::string* mutable_region_code();
+ inline ::std::string* release_region_code();
+ inline void set_allocated_region_code(::std::string* region_code);
+
+ // optional bytes user_id = 2;
+ inline bool has_user_id() const;
+ inline void clear_user_id();
+ static const int kUserIdFieldNumber = 2;
+ inline const ::std::string& user_id() const;
+ inline void set_user_id(const ::std::string& value);
+ inline void set_user_id(const char* value);
+ inline void set_user_id(const void* value, size_t size);
+ inline ::std::string* mutable_user_id();
+ inline ::std::string* release_user_id();
+ inline void set_allocated_user_id(::std::string* user_id);
+
+ // @@protoc_insertion_point(class_scope:mozilla.safebrowsing.ThreatHit.UserInfo)
+ private:
+ inline void set_has_region_code();
+ inline void clear_has_region_code();
+ inline void set_has_user_id();
+ inline void clear_has_user_id();
+
+ ::std::string _unknown_fields_;
+
+ ::google::protobuf::uint32 _has_bits_[1];
+ mutable int _cached_size_;
+ ::std::string* region_code_;
+ ::std::string* user_id_;
+ #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ friend void protobuf_AddDesc_safebrowsing_2eproto_impl();
+ #else
+ friend void protobuf_AddDesc_safebrowsing_2eproto();
+ #endif
+ friend void protobuf_AssignDesc_safebrowsing_2eproto();
+ friend void protobuf_ShutdownFile_safebrowsing_2eproto();
+
+ void InitAsDefaultInstance();
+ static ThreatHit_UserInfo* default_instance_;
+};
+// -------------------------------------------------------------------
+
class ThreatHit : public ::google::protobuf::MessageLite {
public:
ThreatHit();
virtual ~ThreatHit();
ThreatHit(const ThreatHit& from);
inline ThreatHit& operator=(const ThreatHit& from) {
@@ -1740,22 +1853,24 @@ class ThreatHit : public ::google::proto
void SharedDtor();
void SetCachedSize(int size) const;
public:
::std::string GetTypeName() const;
// nested types ----------------------------------------------------
typedef ThreatHit_ThreatSource ThreatSource;
+ typedef ThreatHit_UserInfo UserInfo;
typedef ThreatHit_ThreatSourceType ThreatSourceType;
static const ThreatSourceType THREAT_SOURCE_TYPE_UNSPECIFIED = ThreatHit_ThreatSourceType_THREAT_SOURCE_TYPE_UNSPECIFIED;
static const ThreatSourceType MATCHING_URL = ThreatHit_ThreatSourceType_MATCHING_URL;
static const ThreatSourceType TAB_URL = ThreatHit_ThreatSourceType_TAB_URL;
static const ThreatSourceType TAB_REDIRECT = ThreatHit_ThreatSourceType_TAB_REDIRECT;
+ static const ThreatSourceType TAB_RESOURCE = ThreatHit_ThreatSourceType_TAB_RESOURCE;
static inline bool ThreatSourceType_IsValid(int value) {
return ThreatHit_ThreatSourceType_IsValid(value);
}
static const ThreatSourceType ThreatSourceType_MIN =
ThreatHit_ThreatSourceType_ThreatSourceType_MIN;
static const ThreatSourceType ThreatSourceType_MAX =
ThreatHit_ThreatSourceType_ThreatSourceType_MAX;
static const int ThreatSourceType_ARRAYSIZE =
@@ -1793,33 +1908,57 @@ class ThreatHit : public ::google::proto
inline const ::mozilla::safebrowsing::ThreatHit_ThreatSource& resources(int index) const;
inline ::mozilla::safebrowsing::ThreatHit_ThreatSource* mutable_resources(int index);
inline ::mozilla::safebrowsing::ThreatHit_ThreatSource* add_resources();
inline const ::google::protobuf::RepeatedPtrField< ::mozilla::safebrowsing::ThreatHit_ThreatSource >&
resources() const;
inline ::google::protobuf::RepeatedPtrField< ::mozilla::safebrowsing::ThreatHit_ThreatSource >*
mutable_resources();
+ // optional .mozilla.safebrowsing.ClientInfo client_info = 5;
+ inline bool has_client_info() const;
+ inline void clear_client_info();
+ static const int kClientInfoFieldNumber = 5;
+ inline const ::mozilla::safebrowsing::ClientInfo& client_info() const;
+ inline ::mozilla::safebrowsing::ClientInfo* mutable_client_info();
+ inline ::mozilla::safebrowsing::ClientInfo* release_client_info();
+ inline void set_allocated_client_info(::mozilla::safebrowsing::ClientInfo* client_info);
+
+ // optional .mozilla.safebrowsing.ThreatHit.UserInfo user_info = 6;
+ inline bool has_user_info() const;
+ inline void clear_user_info();
+ static const int kUserInfoFieldNumber = 6;
+ inline const ::mozilla::safebrowsing::ThreatHit_UserInfo& user_info() const;
+ inline ::mozilla::safebrowsing::ThreatHit_UserInfo* mutable_user_info();
+ inline ::mozilla::safebrowsing::ThreatHit_UserInfo* release_user_info();
+ inline void set_allocated_user_info(::mozilla::safebrowsing::ThreatHit_UserInfo* user_info);
+
// @@protoc_insertion_point(class_scope:mozilla.safebrowsing.ThreatHit)
private:
inline void set_has_threat_type();
inline void clear_has_threat_type();
inline void set_has_platform_type();
inline void clear_has_platform_type();
inline void set_has_entry();
inline void clear_has_entry();
+ inline void set_has_client_info();
+ inline void clear_has_client_info();
+ inline void set_has_user_info();
+ inline void clear_has_user_info();
::std::string _unknown_fields_;
::google::protobuf::uint32 _has_bits_[1];
mutable int _cached_size_;
int threat_type_;
int platform_type_;
::mozilla::safebrowsing::ThreatEntry* entry_;
::google::protobuf::RepeatedPtrField< ::mozilla::safebrowsing::ThreatHit_ThreatSource > resources_;
+ ::mozilla::safebrowsing::ClientInfo* client_info_;
+ ::mozilla::safebrowsing::ThreatHit_UserInfo* user_info_;
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
friend void protobuf_AddDesc_safebrowsing_2eproto_impl();
#else
friend void protobuf_AddDesc_safebrowsing_2eproto();
#endif
friend void protobuf_AssignDesc_safebrowsing_2eproto();
friend void protobuf_ShutdownFile_safebrowsing_2eproto();
@@ -5077,16 +5216,172 @@ inline void ThreatHit_ThreatSource::set_
clear_has_referrer();
referrer_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
// @@protoc_insertion_point(field_set_allocated:mozilla.safebrowsing.ThreatHit.ThreatSource.referrer)
}
// -------------------------------------------------------------------
+// ThreatHit_UserInfo
+
+// optional string region_code = 1;
+inline bool ThreatHit_UserInfo::has_region_code() const {
+ return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void ThreatHit_UserInfo::set_has_region_code() {
+ _has_bits_[0] |= 0x00000001u;
+}
+inline void ThreatHit_UserInfo::clear_has_region_code() {
+ _has_bits_[0] &= ~0x00000001u;
+}
+inline void ThreatHit_UserInfo::clear_region_code() {
+ if (region_code_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ region_code_->clear();
+ }
+ clear_has_region_code();
+}
+inline const ::std::string& ThreatHit_UserInfo::region_code() const {
+ // @@protoc_insertion_point(field_get:mozilla.safebrowsing.ThreatHit.UserInfo.region_code)
+ return *region_code_;
+}
+inline void ThreatHit_UserInfo::set_region_code(const ::std::string& value) {
+ set_has_region_code();
+ if (region_code_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ region_code_ = new ::std::string;
+ }
+ region_code_->assign(value);
+ // @@protoc_insertion_point(field_set:mozilla.safebrowsing.ThreatHit.UserInfo.region_code)
+}
+inline void ThreatHit_UserInfo::set_region_code(const char* value) {
+ set_has_region_code();
+ if (region_code_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ region_code_ = new ::std::string;
+ }
+ region_code_->assign(value);
+ // @@protoc_insertion_point(field_set_char:mozilla.safebrowsing.ThreatHit.UserInfo.region_code)
+}
+inline void ThreatHit_UserInfo::set_region_code(const char* value, size_t size) {
+ set_has_region_code();
+ if (region_code_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ region_code_ = new ::std::string;
+ }
+ region_code_->assign(reinterpret_cast<const char*>(value), size);
+ // @@protoc_insertion_point(field_set_pointer:mozilla.safebrowsing.ThreatHit.UserInfo.region_code)
+}
+inline ::std::string* ThreatHit_UserInfo::mutable_region_code() {
+ set_has_region_code();
+ if (region_code_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ region_code_ = new ::std::string;
+ }
+ // @@protoc_insertion_point(field_mutable:mozilla.safebrowsing.ThreatHit.UserInfo.region_code)
+ return region_code_;
+}
+inline ::std::string* ThreatHit_UserInfo::release_region_code() {
+ clear_has_region_code();
+ if (region_code_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ return NULL;
+ } else {
+ ::std::string* temp = region_code_;
+ region_code_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ return temp;
+ }
+}
+inline void ThreatHit_UserInfo::set_allocated_region_code(::std::string* region_code) {
+ if (region_code_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ delete region_code_;
+ }
+ if (region_code) {
+ set_has_region_code();
+ region_code_ = region_code;
+ } else {
+ clear_has_region_code();
+ region_code_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ }
+ // @@protoc_insertion_point(field_set_allocated:mozilla.safebrowsing.ThreatHit.UserInfo.region_code)
+}
+
+// optional bytes user_id = 2;
+inline bool ThreatHit_UserInfo::has_user_id() const {
+ return (_has_bits_[0] & 0x00000002u) != 0;
+}
+inline void ThreatHit_UserInfo::set_has_user_id() {
+ _has_bits_[0] |= 0x00000002u;
+}
+inline void ThreatHit_UserInfo::clear_has_user_id() {
+ _has_bits_[0] &= ~0x00000002u;
+}
+inline void ThreatHit_UserInfo::clear_user_id() {
+ if (user_id_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ user_id_->clear();
+ }
+ clear_has_user_id();
+}
+inline const ::std::string& ThreatHit_UserInfo::user_id() const {
+ // @@protoc_insertion_point(field_get:mozilla.safebrowsing.ThreatHit.UserInfo.user_id)
+ return *user_id_;
+}
+inline void ThreatHit_UserInfo::set_user_id(const ::std::string& value) {
+ set_has_user_id();
+ if (user_id_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ user_id_ = new ::std::string;
+ }
+ user_id_->assign(value);
+ // @@protoc_insertion_point(field_set:mozilla.safebrowsing.ThreatHit.UserInfo.user_id)
+}
+inline void ThreatHit_UserInfo::set_user_id(const char* value) {
+ set_has_user_id();
+ if (user_id_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ user_id_ = new ::std::string;
+ }
+ user_id_->assign(value);
+ // @@protoc_insertion_point(field_set_char:mozilla.safebrowsing.ThreatHit.UserInfo.user_id)
+}
+inline void ThreatHit_UserInfo::set_user_id(const void* value, size_t size) {
+ set_has_user_id();
+ if (user_id_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ user_id_ = new ::std::string;
+ }
+ user_id_->assign(reinterpret_cast<const char*>(value), size);
+ // @@protoc_insertion_point(field_set_pointer:mozilla.safebrowsing.ThreatHit.UserInfo.user_id)
+}
+inline ::std::string* ThreatHit_UserInfo::mutable_user_id() {
+ set_has_user_id();
+ if (user_id_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ user_id_ = new ::std::string;
+ }
+ // @@protoc_insertion_point(field_mutable:mozilla.safebrowsing.ThreatHit.UserInfo.user_id)
+ return user_id_;
+}
+inline ::std::string* ThreatHit_UserInfo::release_user_id() {
+ clear_has_user_id();
+ if (user_id_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ return NULL;
+ } else {
+ ::std::string* temp = user_id_;
+ user_id_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ return temp;
+ }
+}
+inline void ThreatHit_UserInfo::set_allocated_user_id(::std::string* user_id) {
+ if (user_id_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
+ delete user_id_;
+ }
+ if (user_id) {
+ set_has_user_id();
+ user_id_ = user_id;
+ } else {
+ clear_has_user_id();
+ user_id_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+ }
+ // @@protoc_insertion_point(field_set_allocated:mozilla.safebrowsing.ThreatHit.UserInfo.user_id)
+}
+
+// -------------------------------------------------------------------
+
// ThreatHit
// optional .mozilla.safebrowsing.ThreatType threat_type = 1;
inline bool ThreatHit::has_threat_type() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
inline void ThreatHit::set_has_threat_type() {
_has_bits_[0] |= 0x00000001u;
@@ -5204,16 +5499,106 @@ ThreatHit::resources() const {
return resources_;
}
inline ::google::protobuf::RepeatedPtrField< ::mozilla::safebrowsing::ThreatHit_ThreatSource >*
ThreatHit::mutable_resources() {
// @@protoc_insertion_point(field_mutable_list:mozilla.safebrowsing.ThreatHit.resources)
return &resources_;
}
+// optional .mozilla.safebrowsing.ClientInfo client_info = 5;
+inline bool ThreatHit::has_client_info() const {
+ return (_has_bits_[0] & 0x00000010u) != 0;
+}
+inline void ThreatHit::set_has_client_info() {
+ _has_bits_[0] |= 0x00000010u;
+}
+inline void ThreatHit::clear_has_client_info() {
+ _has_bits_[0] &= ~0x00000010u;
+}
+inline void ThreatHit::clear_client_info() {
+ if (client_info_ != NULL) client_info_->::mozilla::safebrowsing::ClientInfo::Clear();
+ clear_has_client_info();
+}
+inline const ::mozilla::safebrowsing::ClientInfo& ThreatHit::client_info() const {
+ // @@protoc_insertion_point(field_get:mozilla.safebrowsing.ThreatHit.client_info)
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ return client_info_ != NULL ? *client_info_ : *default_instance().client_info_;
+#else
+ return client_info_ != NULL ? *client_info_ : *default_instance_->client_info_;
+#endif
+}
+inline ::mozilla::safebrowsing::ClientInfo* ThreatHit::mutable_client_info() {
+ set_has_client_info();
+ if (client_info_ == NULL) client_info_ = new ::mozilla::safebrowsing::ClientInfo;
+ // @@protoc_insertion_point(field_mutable:mozilla.safebrowsing.ThreatHit.client_info)
+ return client_info_;
+}
+inline ::mozilla::safebrowsing::ClientInfo* ThreatHit::release_client_info() {
+ clear_has_client_info();
+ ::mozilla::safebrowsing::ClientInfo* temp = client_info_;
+ client_info_ = NULL;
+ return temp;
+}
+inline void ThreatHit::set_allocated_client_info(::mozilla::safebrowsing::ClientInfo* client_info) {
+ delete client_info_;
+ client_info_ = client_info;
+ if (client_info) {
+ set_has_client_info();
+ } else {
+ clear_has_client_info();
+ }
+ // @@protoc_insertion_point(field_set_allocated:mozilla.safebrowsing.ThreatHit.client_info)
+}
+
+// optional .mozilla.safebrowsing.ThreatHit.UserInfo user_info = 6;
+inline bool ThreatHit::has_user_info() const {
+ return (_has_bits_[0] & 0x00000020u) != 0;
+}
+inline void ThreatHit::set_has_user_info() {
+ _has_bits_[0] |= 0x00000020u;
+}
+inline void ThreatHit::clear_has_user_info() {
+ _has_bits_[0] &= ~0x00000020u;
+}
+inline void ThreatHit::clear_user_info() {
+ if (user_info_ != NULL) user_info_->::mozilla::safebrowsing::ThreatHit_UserInfo::Clear();
+ clear_has_user_info();
+}
+inline const ::mozilla::safebrowsing::ThreatHit_UserInfo& ThreatHit::user_info() const {
+ // @@protoc_insertion_point(field_get:mozilla.safebrowsing.ThreatHit.user_info)
+#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
+ return user_info_ != NULL ? *user_info_ : *default_instance().user_info_;
+#else
+ return user_info_ != NULL ? *user_info_ : *default_instance_->user_info_;
+#endif
+}
+inline ::mozilla::safebrowsing::ThreatHit_UserInfo* ThreatHit::mutable_user_info() {
+ set_has_user_info();
+ if (user_info_ == NULL) user_info_ = new ::mozilla::safebrowsing::ThreatHit_UserInfo;
+ // @@protoc_insertion_point(field_mutable:mozilla.safebrowsing.ThreatHit.user_info)
+ return user_info_;
+}
+inline ::mozilla::safebrowsing::ThreatHit_UserInfo* ThreatHit::release_user_info() {
+ clear_has_user_info();
+ ::mozilla::safebrowsing::ThreatHit_UserInfo* temp = user_info_;
+ user_info_ = NULL;
+ return temp;
+}
+inline void ThreatHit::set_allocated_user_info(::mozilla::safebrowsing::ThreatHit_UserInfo* user_info) {
+ delete user_info_;
+ user_info_ = user_info;
+ if (user_info) {
+ set_has_user_info();
+ } else {
+ clear_has_user_info();
+ }
+ // @@protoc_insertion_point(field_set_allocated:mozilla.safebrowsing.ThreatHit.user_info)
+}
+
// -------------------------------------------------------------------
// ClientInfo
// optional string client_id = 1;
inline bool ClientInfo::has_client_id() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}