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 10 matching lines...) Expand all Loading... |
21 // depending upon whether upstreaming is available. | 21 // depending upon whether upstreaming is available. |
22 class SaveCardBubbleControllerImpl | 22 class SaveCardBubbleControllerImpl |
23 : public SaveCardBubbleController, | 23 : public SaveCardBubbleController, |
24 public content::WebContentsObserver, | 24 public content::WebContentsObserver, |
25 public content::WebContentsUserData<SaveCardBubbleControllerImpl> { | 25 public content::WebContentsUserData<SaveCardBubbleControllerImpl> { |
26 public: | 26 public: |
27 // |save_card_callback| will be invoked if/when the Save button is pressed. | 27 // |save_card_callback| will be invoked if/when the Save button is pressed. |
28 void SetCallback(const base::Closure& save_card_callback); | 28 void SetCallback(const base::Closure& save_card_callback); |
29 | 29 |
30 // SetCallback() must be called first. | 30 // SetCallback() must be called first. |
31 void ShowBubble(); | 31 void ShowBubble(bool user_action); |
32 | 32 |
33 // Returns true if Omnibox save credit card icon should be visible. | 33 // Returns true if Omnibox save credit card icon should be visible. |
34 bool IsIconVisible() const; | 34 bool IsIconVisible() const; |
35 | 35 |
36 // Returns true if Omnibox save credit card should be shown in its "toggled | |
37 // on" state. | |
38 bool IsIconToggled() const; | |
39 | |
40 // Returns nullptr if no bubble is currently shown. | 36 // Returns nullptr if no bubble is currently shown. |
41 SaveCardBubbleView* save_card_bubble_view() const; | 37 SaveCardBubbleView* save_card_bubble_view() const; |
42 | 38 |
43 // SaveCardBubbleController: | 39 // SaveCardBubbleController: |
44 void OnSaveButton() override; | 40 void OnSaveButton() override; |
45 void OnCancelButton() override; | 41 void OnCancelButton() override; |
46 void OnLearnMoreClicked() override; | 42 void OnLearnMoreClicked() override; |
47 void OnBubbleClosed() override; | 43 void OnBubbleClosed() override; |
48 | 44 |
49 private: | 45 private: |
(...skipping 21 matching lines...) Expand all Loading... |
71 // Used to measure the amount of time on a page; if it's less than some | 67 // Used to measure the amount of time on a page; if it's less than some |
72 // reasonable limit, then don't close the bubble upon navigation. | 68 // reasonable limit, then don't close the bubble upon navigation. |
73 scoped_ptr<base::ElapsedTimer> timer_; | 69 scoped_ptr<base::ElapsedTimer> timer_; |
74 | 70 |
75 DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleControllerImpl); | 71 DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleControllerImpl); |
76 }; | 72 }; |
77 | 73 |
78 } // namespace autofill | 74 } // namespace autofill |
79 | 75 |
80 #endif // CHROME_BROWSER_UI_AUTOFILL_SAVE_CARD_BUBBLE_CONTROLLER_IMPL_H_ | 76 #endif // CHROME_BROWSER_UI_AUTOFILL_SAVE_CARD_BUBBLE_CONTROLLER_IMPL_H_ |
OLD | NEW |