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..65de44e9af4e75c952182c2aaad68bdbd07364e4 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" |
+ // } ] |
+ // |
+ // 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); |
+ void ClearLegalMessage(); |
+ |
// SetCallback() must be called first. |
void ShowBubble(); |
@@ -44,8 +73,15 @@ 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; |
+ const std::vector<gfx::Range>& GetLegalMessageLinkRanges() const override; |
+ |
+ // For testing. |
+ const std::vector<std::string>& GetLegalMessageLinkUrlsForTesting() const; |
bondd
2015/11/11 01:53:36
I'm not sure what the current best practice is for
|
+ |
private: |
friend class content::WebContentsUserData<SaveCardBubbleControllerImpl>; |
@@ -55,6 +91,8 @@ class SaveCardBubbleControllerImpl |
// 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 +106,15 @@ 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_; |
+ |
+ // These two vectors describe all of the links in legal_message_. The two |
+ // vectors will always be in sync with each other and legal_message_. Empty if |
+ // legal_message_ is an empty string. |
+ std::vector<gfx::Range> legal_message_link_ranges_; |
+ std::vector<std::string> legal_message_link_urls_; |
bondd
2015/11/11 01:53:36
Made these separate (instead of combining range an
Evan Stade
2015/11/11 22:22:54
make the testing function protected and create a T
bondd
2015/11/13 01:19:52
Thanks. If we stick with the new interface then I
|
+ |
// 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_; |