Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2860)

Unified Diff: components/autofill/core/browser/legal_message_line.h

Issue 1540423004: Add card details and legal message to Android save credit card infobar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix android compiles Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..572b8758624e797f510c5d9d6f1d129a361d1758
--- /dev/null
+++ b/components/autofill/core/browser/legal_message_line.h
@@ -0,0 +1,65 @@
+// Copyright 2016 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/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);
+ 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;
+
+} // namespace autofill
+
+#endif // COMPONENTS_AUTOFILL_CORE_BROWSER_LEGAL_MESSAGE_LINE_H_

Powered by Google App Engine
This is Rietveld 408576698