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

Unified Diff: chrome/browser/ui/autofill/save_card_bubble_controller_impl.h

Issue 1407093007: Autofill: Add legal message footer to save credit card bubble. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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: chrome/browser/ui/autofill/save_card_bubble_controller_impl.h
diff --git a/chrome/browser/ui/autofill/save_card_bubble_controller_impl.h b/chrome/browser/ui/autofill/save_card_bubble_controller_impl.h
index 921b0a647cde90a10586d726aefcae493f4b042e..6562d768787b5f369a13af7c813f1294adcb0b65 100644
--- a/chrome/browser/ui/autofill/save_card_bubble_controller_impl.h
+++ b/chrome/browser/ui/autofill/save_card_bubble_controller_impl.h
@@ -27,6 +27,35 @@ class SaveCardBubbleControllerImpl
// |save_card_callback| will be invoked if/when the Save button is pressed.
void SetCallback(const base::Closure& save_card_callback);
+ // Example of valid |lines| data:
+ // [ {
+ // "template" : "The legal documents are: {0} and {1}",
+ // "template_parameter" : [ {
+ // "display_text" : "Terms of Service",
+ // "url": "http://www.example.com/tos"
+ // }, {
+ // "display_text" : "Privacy Policy",
+ // "url": "http://www.example.com/pp"
+ // } ],
+ // }, {
+ // "template" : "This is the second line and it has no parameters"
Evan Stade 2015/11/07 03:03:19 can jstuppy or someone explain why there are multi
+ // } ]
+ //
+ // Caveats:
+ // 1. '{' and '}' may be displayed by escaping them with an apostrophe in the
+ // template string, e.g. "template" : "Here is a literal '{"
+ // 2. Two or more consecutive dollar signs in the template string will not
+ // expand correctly.
bondd 2015/11/07 02:29:38 Can handle "$$" properly if desired by reviewer. N
+ // 3. "${" anywhere in the template string is invalid.
+ // 4. "\n" embedded anywhere in the template string, or an empty template
+ // string, can be used to separate paragraphs. It is not possible to create
+ // a completely blank line by using two consecutive newlines (they will be
+ // treated as a single newline by views::StyledLabel).
+ //
+ // Returns false if contents of |lines| are invalid.
+ bool SetLegalMessage(const base::ListValue& lines);
+ void ClearLegalMessage();
+
// SetCallback() must be called first.
void ShowBubble();
@@ -44,17 +73,30 @@ class SaveCardBubbleControllerImpl
void OnSaveButton() override;
void OnCancelButton() override;
void OnLearnMoreClicked() override;
+ void OnLegalMessageLinkClicked(const gfx::Range& link_range) override;
void OnBubbleClosed() override;
+ const base::string16& GetLegalMessage() const override;
+ size_t GetLegalMessageNumLinks() const override;
+ const gfx::Range& GetLegalMessageLinkRange(size_t index) const override;
+
private:
friend class content::WebContentsUserData<SaveCardBubbleControllerImpl>;
+ // Describes a single link in legal_message_.
+ struct LegalMessageLink {
bondd 2015/11/07 02:29:38 LegalMessageLink instead of Link because the forme
+ gfx::Range range;
+ std::string url;
+ };
+
explicit SaveCardBubbleControllerImpl(content::WebContents* web_contents);
~SaveCardBubbleControllerImpl() override;
// Update the visibility and toggled state of the Omnibox save card icon.
void UpdateIcon();
+ void OpenUrl(const std::string& url);
+
// content::WebContentsObserver:
void DidNavigateMainFrame(
const content::LoadCommittedDetails& details,
@@ -68,6 +110,13 @@ class SaveCardBubbleControllerImpl
// show and the icon is not visible.
base::Closure save_card_callback_;
+ // If no legal message should be shown then this variable is an empty string.
+ base::string16 legal_message_;
+
+ // Describes all of the links in legal_message_. Invalid if legal_message_
+ // is an empty string.
+ std::vector<LegalMessageLink> legal_message_links_;
+
// Used to measure the amount of time on a page; if it's less than some
// reasonable limit, then don't close the bubble upon navigation.
scoped_ptr<base::ElapsedTimer> timer_;

Powered by Google App Engine
This is Rietveld 408576698