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

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: Move new unittests file to non_mobile sources. 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 5368b5f4412006d8f3a6a3d06a7239746250032c..4787721073856a55595bb6fdeceebba2feb2eea7 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,34 @@ 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"
+ // } ]
+ //
+ // 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.
+ // 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);
+
// SetCallback() must be called first.
void ShowBubble(bool user_action);
@@ -40,8 +68,11 @@ class SaveCardBubbleControllerImpl
void OnSaveButton() override;
void OnCancelButton() override;
void OnLearnMoreClicked() override;
+ void OnLegalMessageLinkClicked(const GURL& url) override;
void OnBubbleClosed() override;
+ const std::vector<LegalMessageLine>& GetLegalMessageLines() const override;
+
private:
friend class content::WebContentsUserData<SaveCardBubbleControllerImpl>;
@@ -51,6 +82,8 @@ class SaveCardBubbleControllerImpl
// Update the visibility and toggled state of the Omnibox save card icon.
void UpdateIcon();
+ void OpenUrl(const GURL& url);
+
// content::WebContentsObserver:
void DidNavigateMainFrame(
const content::LoadCommittedDetails& details,
@@ -64,6 +97,9 @@ 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 vector.
+ std::vector<LegalMessageLine> legal_message_lines_;
+
// 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