Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_LEGAL_MESSAGE_LINE_H_ | |
| 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_LEGAL_MESSAGE_LINE_H_ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/gtest_prod_util.h" | |
| 11 #include "base/strings/string16.h" | |
| 12 #include "ui/gfx/range/range.h" | |
| 13 #include "url/gurl.h" | |
| 14 | |
| 15 namespace base { | |
| 16 class DictionaryValue; | |
| 17 } | |
| 18 | |
| 19 namespace autofill { | |
| 20 | |
| 21 class LegalMessageLine { | |
| 22 public: | |
| 23 struct Link { | |
| 24 gfx::Range range; | |
| 25 GURL url; | |
| 26 }; | |
| 27 | |
| 28 // Parses |line|. Returns false on failure. | |
| 29 static bool Parse(const base::DictionaryValue& legal_message, | |
| 30 std::vector<LegalMessageLine>* out); | |
| 31 | |
| 32 LegalMessageLine(); | |
| 33 ~LegalMessageLine(); | |
| 34 | |
| 35 const base::string16& text() const { return text_; } | |
| 36 const std::vector<Link>& links() const { return links_; } | |
| 37 | |
| 38 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.
| |
| 39 FRIEND_TEST_ALL_PREFIXES(LegalMessageLineTest, NoParameters); | |
| 40 FRIEND_TEST_ALL_PREFIXES(LegalMessageLineTest, SingleParameter); | |
| 41 FRIEND_TEST_ALL_PREFIXES(LegalMessageLineTest, MissingUrl); | |
| 42 FRIEND_TEST_ALL_PREFIXES(LegalMessageLineTest, MissingDisplayText); | |
| 43 FRIEND_TEST_ALL_PREFIXES(LegalMessageLineTest, EscapeCharacters); | |
| 44 FRIEND_TEST_ALL_PREFIXES(LegalMessageLineTest, ConsecutiveDollarSigns); | |
| 45 FRIEND_TEST_ALL_PREFIXES(LegalMessageLineTest, DollarAndParenthesis); | |
| 46 FRIEND_TEST_ALL_PREFIXES(LegalMessageLineTest, MultipleParameters); | |
| 47 FRIEND_TEST_ALL_PREFIXES(LegalMessageLineTest, MultipleLineElements); | |
| 48 FRIEND_TEST_ALL_PREFIXES(LegalMessageLineTest, EmbeddedNewlines); | |
| 49 FRIEND_TEST_ALL_PREFIXES(LegalMessageLineTest, MaximumPlaceholders); | |
| 50 | |
| 51 bool ParseLine(const base::DictionaryValue& line); | |
| 52 | |
| 53 base::string16 text_; | |
| 54 std::vector<Link> links_; | |
| 55 }; | |
| 56 | |
| 57 typedef std::vector<LegalMessageLine> LegalMessageLines; | |
| 58 | |
| 59 } // namespace autofill | |
| 60 | |
| 61 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_LEGAL_MESSAGE_LINE_H_ | |
| OLD | NEW |