Chromium Code Reviews| 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..5e8cbd07d8bb43022681400dfc4eff6037981973 |
| --- /dev/null |
| +++ b/components/autofill/core/browser/legal_message_line.h |
| @@ -0,0 +1,65 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
|
gone
2016/01/12 19:04:23
nit: 2016
please use gerrit instead
2016/01/12 22:58:56
Hm, technically this s almost copy-pasta. However,
|
| +// 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/macros.h" |
| +#include "base/memory/scoped_ptr.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<scoped_ptr<LegalMessageLine>>* out); |
| + |
| + LegalMessageLine(); |
| + ~LegalMessageLine(); |
| + |
| + const base::string16& text() const { return text_; } |
| + const std::vector<Link>& links() const { return links_; } |
| + |
| + private: |
| + FRIEND_TEST_ALL_PREFIXES(LegalMessageLineTest, NoParameters); |
|
Peter Kasting
2016/01/12 23:09:37
If you have this many friend declarations, conside
please use gerrit instead
2016/01/13 21:22:09
Done.
|
| + 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_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(LegalMessageLine); |
| +}; |
| + |
| +typedef std::vector<scoped_ptr<LegalMessageLine>> LegalMessageLines; |
|
Peter Kasting
2016/01/12 23:09:37
Nit: Chromium style prefers "using" to "typedef" f
please use gerrit instead
2016/01/13 21:22:09
Done.
|
| + |
| +} // namespace autofill |
| + |
| +#endif // COMPONENTS_AUTOFILL_CORE_BROWSER_LEGAL_MESSAGE_LINE_H_ |