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

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: Initial draft Created 5 years 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..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_

Powered by Google App Engine
This is Rietveld 408576698