Index: components/autofill/core/browser/legal_message_line.h |
diff --git a/components/autofill/core/browser/legal_message_line.h b/components/autofill/core/browser/legal_message_line.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..47d487b12ecfb8300f21bbc9b7123a8ae77ffe08 |
--- /dev/null |
+++ b/components/autofill/core/browser/legal_message_line.h |
@@ -0,0 +1,61 @@ |
+// Copyright 2015 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 COMPONENTS_AUTOFILL_CORE_BROWSER_LEGAL_MESSAGE_LINE_H_ |
+#define COMPONENTS_AUTOFILL_CORE_BROWSER_LEGAL_MESSAGE_LINE_H_ |
+ |
+#include <vector> |
+ |
+#include "base/gtest_prod_util.h" |
+#include "base/strings/string16.h" |
+#include "ui/gfx/range/range.h" |
+#include "url/gurl.h" |
+ |
+namespace base { |
+class DictionaryValue; |
+} |
+ |
+namespace autofill { |
+ |
+class LegalMessageLine { |
+ public: |
+ struct Link { |
+ gfx::Range range; |
+ GURL url; |
+ }; |
+ |
+ // Parses |line|. Returns false on failure. |
+ static bool Parse(const base::DictionaryValue& legal_message, |
+ std::vector<LegalMessageLine>* out); |
+ |
+ LegalMessageLine(); |
+ ~LegalMessageLine(); |
+ |
+ const base::string16& text() const { return text_; } |
+ const std::vector<Link>& links() const { return links_; } |
+ |
+ private: |
Justin Donnelly
2015/12/30 18:06:37
Add DISALLOW_COPY_AND_ASSIGN.
please use gerrit instead
2016/01/07 01:39:25
Done.
|
+ FRIEND_TEST_ALL_PREFIXES(LegalMessageLineTest, NoParameters); |
+ FRIEND_TEST_ALL_PREFIXES(LegalMessageLineTest, SingleParameter); |
+ FRIEND_TEST_ALL_PREFIXES(LegalMessageLineTest, MissingUrl); |
+ FRIEND_TEST_ALL_PREFIXES(LegalMessageLineTest, MissingDisplayText); |
+ FRIEND_TEST_ALL_PREFIXES(LegalMessageLineTest, EscapeCharacters); |
+ FRIEND_TEST_ALL_PREFIXES(LegalMessageLineTest, ConsecutiveDollarSigns); |
+ FRIEND_TEST_ALL_PREFIXES(LegalMessageLineTest, DollarAndParenthesis); |
+ FRIEND_TEST_ALL_PREFIXES(LegalMessageLineTest, MultipleParameters); |
+ FRIEND_TEST_ALL_PREFIXES(LegalMessageLineTest, MultipleLineElements); |
+ FRIEND_TEST_ALL_PREFIXES(LegalMessageLineTest, EmbeddedNewlines); |
+ FRIEND_TEST_ALL_PREFIXES(LegalMessageLineTest, MaximumPlaceholders); |
+ |
+ bool ParseLine(const base::DictionaryValue& line); |
+ |
+ base::string16 text_; |
+ std::vector<Link> links_; |
+}; |
+ |
+typedef std::vector<LegalMessageLine> LegalMessageLines; |
+ |
+} // namespace autofill |
+ |
+#endif // COMPONENTS_AUTOFILL_CORE_BROWSER_LEGAL_MESSAGE_LINE_H_ |