This repository has been archived by the owner on Apr 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More fine-grained pruning in safe browsing incident reporting service.
BUG=396398 Review URL: https://codereview.chromium.org/411793004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285491 0039d316-1c4b-4281-b951-d872f2087c98
- Loading branch information
1 parent
9754c0b
commit 93ef5ea
Showing
13 changed files
with
413 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright 2014 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "chrome/browser/safe_browsing/incident_handler_util.h" | ||
|
||
#include <string> | ||
|
||
#include "base/hash.h" | ||
#include "base/logging.h" | ||
#include "third_party/protobuf/src/google/protobuf/message_lite.h" | ||
|
||
namespace safe_browsing { | ||
|
||
// Computes a simple hash digest over the serialized form of |message|. | ||
// |message| must be in a canonical form. | ||
uint32_t HashMessage(const google::protobuf::MessageLite& message) { | ||
std::string message_string; | ||
if (!message.SerializeToString(&message_string)) { | ||
NOTREACHED(); | ||
return 0; | ||
} | ||
return base::Hash(message_string); | ||
} | ||
|
||
} // namespace safe_browsing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2014 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef CHROME_BROWSER_SAFE_BROWSING_INCIDENT_HANDLER_UTIL_H_ | ||
#define CHROME_BROWSER_SAFE_BROWSING_INCIDENT_HANDLER_UTIL_H_ | ||
|
||
#include <stdint.h> | ||
|
||
namespace google { | ||
namespace protobuf { | ||
|
||
class MessageLite; | ||
|
||
} // namespace protobuf | ||
} // namespace google | ||
|
||
namespace safe_browsing { | ||
|
||
// Computes a simple hash digest over the serialized form of |message|. | ||
// |message| must be in a canonical form. For example, fields set to their | ||
// default values should be cleared. | ||
uint32_t HashMessage(const google::protobuf::MessageLite& message); | ||
|
||
} // namespace safe_browsing | ||
|
||
#endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_HANDLER_UTIL_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.