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

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: Rebase. 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 dfcd522e8cd80d18c55472f79482f3570095c990..4f104fad4df4b9ce52b89380450d1ce5ccd871f1 100644
--- a/chrome/browser/ui/autofill/save_card_bubble_controller_impl.h
+++ b/chrome/browser/ui/autofill/save_card_bubble_controller_impl.h
@@ -31,6 +31,35 @@ class SaveCardBubbleControllerImpl
void InitializeForUpload(const base::Closure& save_card_callback,
scoped_ptr<base::DictionaryValue> legal_message);
+ // TODO(bondd): Combine SetLegalMessage() with InitializeForUpload().
+ // 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);
+
// InitializeForLocalSave() or InitializeForUpload() must be called first.
void ShowBubble(bool user_action);
@@ -46,8 +75,11 @@ class SaveCardBubbleControllerImpl
void OnSaveButton() override;
void OnCancelButton() override;
void OnLearnMoreClicked() override;
+ void OnLegalMessageLinkClicked(const GURL& url) override;
void OnBubbleClosed() override;
+ const LegalMessageLines& GetLegalMessageLines() const override;
+
private:
friend class content::WebContentsUserData<SaveCardBubbleControllerImpl>;
@@ -57,6 +89,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,
@@ -73,6 +107,9 @@ class SaveCardBubbleControllerImpl
// Governs whether the upload or local save version of the UI should be shown.
bool is_uploading_;
+ // If no legal message should be shown then this variable is an empty vector.
+ LegalMessageLines 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