OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_FEEDBACK_ANONYMIZER_TOOL_H_ | 5 #ifndef COMPONENTS_FEEDBACK_ANONYMIZER_TOOL_H_ |
6 #define COMPONENTS_FEEDBACK_ANONYMIZER_TOOL_H_ | 6 #define COMPONENTS_FEEDBACK_ANONYMIZER_TOOL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
9 #include <string> | 10 #include <string> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 | 14 |
15 namespace re2 { | 15 namespace re2 { |
16 class RE2; | 16 class RE2; |
17 } | 17 } |
18 | 18 |
19 namespace feedback { | 19 namespace feedback { |
20 | 20 |
21 struct CustomPatternWithoutContext { | 21 struct CustomPatternWithoutContext { |
22 // A string literal used in anonymized tests. Matches to the |pattern| are | 22 // A string literal used in anonymized tests. Matches to the |pattern| are |
23 // replaced with <|alias|: 1>, <|alias|: 2>, ... | 23 // replaced with <|alias|: 1>, <|alias|: 2>, ... |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 // Like mac addresses, identifiers in custom patterns are anonymized. | 62 // Like mac addresses, identifiers in custom patterns are anonymized. |
63 // custom_patterns_with_context_[i] contains a map of original identifier to | 63 // custom_patterns_with_context_[i] contains a map of original identifier to |
64 // anonymized identifier for custom pattern number i. | 64 // anonymized identifier for custom pattern number i. |
65 std::vector<std::map<std::string, std::string>> custom_patterns_with_context_; | 65 std::vector<std::map<std::string, std::string>> custom_patterns_with_context_; |
66 std::vector<std::map<std::string, std::string>> | 66 std::vector<std::map<std::string, std::string>> |
67 custom_patterns_without_context_; | 67 custom_patterns_without_context_; |
68 | 68 |
69 // Cache to prevent the repeated compilation of the same regular expression | 69 // Cache to prevent the repeated compilation of the same regular expression |
70 // pattern. Key is the string representation of the RegEx. | 70 // pattern. Key is the string representation of the RegEx. |
71 std::map<std::string, scoped_ptr<re2::RE2>> regexp_cache_; | 71 std::map<std::string, std::unique_ptr<re2::RE2>> regexp_cache_; |
72 | 72 |
73 DISALLOW_COPY_AND_ASSIGN(AnonymizerTool); | 73 DISALLOW_COPY_AND_ASSIGN(AnonymizerTool); |
74 }; | 74 }; |
75 | 75 |
76 } // namespace feedback | 76 } // namespace feedback |
77 | 77 |
78 #endif // COMPONENTS_FEEDBACK_ANONYMIZER_TOOL_H_ | 78 #endif // COMPONENTS_FEEDBACK_ANONYMIZER_TOOL_H_ |
OLD | NEW |