OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_AUTOFILL_SAVE_CARD_BUBBLE_CONTROLLER_IMPL_H_ | 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_SAVE_CARD_BUBBLE_CONTROLLER_IMPL_H_ |
6 #define CHROME_BROWSER_UI_AUTOFILL_SAVE_CARD_BUBBLE_CONTROLLER_IMPL_H_ | 6 #define CHROME_BROWSER_UI_AUTOFILL_SAVE_CARD_BUBBLE_CONTROLLER_IMPL_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/timer/elapsed_timer.h" | 10 #include "base/timer/elapsed_timer.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 public content::WebContentsUserData<SaveCardBubbleControllerImpl> { | 22 public content::WebContentsUserData<SaveCardBubbleControllerImpl> { |
23 public: | 23 public: |
24 // Sets up the controller for local save and shows the bubble. | 24 // Sets up the controller for local save and shows the bubble. |
25 // |save_card_callback| will be invoked if and when the Save button is | 25 // |save_card_callback| will be invoked if and when the Save button is |
26 // pressed. | 26 // pressed. |
27 void ShowBubbleForLocalSave(const base::Closure& save_card_callback); | 27 void ShowBubbleForLocalSave(const base::Closure& save_card_callback); |
28 | 28 |
29 // Sets up the controller for upload and shows the bubble. | 29 // Sets up the controller for upload and shows the bubble. |
30 // |save_card_callback| will be invoked if and when the Save button is | 30 // |save_card_callback| will be invoked if and when the Save button is |
31 // pressed. The contents of |legal_message| will be displayed in the bubble. | 31 // pressed. The contents of |legal_message| will be displayed in the bubble. |
32 // | |
33 // Example of valid |legal_message| data: | |
34 // { | |
35 // "line" : [ { | |
36 // "template" : "The legal documents are: {0} and {1}", | |
37 // "template_parameter" : [ { | |
38 // "display_text" : "Terms of Service", | |
39 // "url": "http://www.example.com/tos" | |
40 // }, { | |
41 // "display_text" : "Privacy Policy", | |
42 // "url": "http://www.example.com/pp" | |
43 // } ], | |
44 // }, { | |
45 // "template" : "This is the second line and it has no parameters" | |
46 // } ] | |
47 // } | |
48 // | |
49 // Caveats: | |
50 // 1. '{' and '}' may be displayed by escaping them with an apostrophe in the | |
51 // template string, e.g. "template" : "Here is a literal '{'" | |
52 // 2. Two or more consecutive dollar signs in the template string will not | |
53 // expand correctly. | |
54 // 3. "${" anywhere in the template string is invalid. | |
55 // 4. "\n" embedded anywhere in the template string, or an empty template | |
56 // string, can be used to separate paragraphs. It is not possible to create | |
57 // a completely blank line by using two consecutive newlines (they will be | |
58 // treated as a single newline by views::StyledLabel). | |
59 void ShowBubbleForUpload(const base::Closure& save_card_callback, | 32 void ShowBubbleForUpload(const base::Closure& save_card_callback, |
60 scoped_ptr<base::DictionaryValue> legal_message); | 33 scoped_ptr<base::DictionaryValue> legal_message); |
61 | 34 |
62 void ReshowBubble(); | 35 void ReshowBubble(); |
63 | 36 |
64 // Returns true if Omnibox save credit card icon should be visible. | 37 // Returns true if Omnibox save credit card icon should be visible. |
65 bool IsIconVisible() const; | 38 bool IsIconVisible() const; |
66 | 39 |
67 // Returns nullptr if no bubble is currently shown. | 40 // Returns nullptr if no bubble is currently shown. |
68 SaveCardBubbleView* save_card_bubble_view() const; | 41 SaveCardBubbleView* save_card_bubble_view() const; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // Used to measure the amount of time on a page; if it's less than some | 94 // Used to measure the amount of time on a page; if it's less than some |
122 // reasonable limit, then don't close the bubble upon navigation. | 95 // reasonable limit, then don't close the bubble upon navigation. |
123 scoped_ptr<base::ElapsedTimer> timer_; | 96 scoped_ptr<base::ElapsedTimer> timer_; |
124 | 97 |
125 DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleControllerImpl); | 98 DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleControllerImpl); |
126 }; | 99 }; |
127 | 100 |
128 } // namespace autofill | 101 } // namespace autofill |
129 | 102 |
130 #endif // CHROME_BROWSER_UI_AUTOFILL_SAVE_CARD_BUBBLE_CONTROLLER_IMPL_H_ | 103 #endif // CHROME_BROWSER_UI_AUTOFILL_SAVE_CARD_BUBBLE_CONTROLLER_IMPL_H_ |
OLD | NEW |