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_VIEWS_AUTOFILL_SAVE_CARD_ICON_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_SAVE_CARD_ICON_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_SAVE_CARD_ICON_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_SAVE_CARD_ICON_VIEW_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" |
9 #include "chrome/browser/ui/views/location_bar/bubble_icon_view.h" | 10 #include "chrome/browser/ui/views/location_bar/bubble_icon_view.h" |
10 | 11 |
11 class Browser; | 12 class Browser; |
12 class CommandUpdater; | 13 class CommandUpdater; |
13 | 14 |
14 namespace autofill { | 15 namespace autofill { |
15 | 16 |
| 17 class SaveCardBubbleControllerImpl; |
| 18 |
16 // The location bar icon to show the Save Credit Card bubble where the user can | 19 // The location bar icon to show the Save Credit Card bubble where the user can |
17 // choose to save the credit card info to use again later without re-entering | 20 // choose to save the credit card info to use again later without re-entering |
18 // it. | 21 // it. |
19 class SaveCardIconView : public BubbleIconView { | 22 class SaveCardIconView : public BubbleIconView, public TabStripModelObserver { |
20 public: | 23 public: |
21 explicit SaveCardIconView(CommandUpdater* command_updater, Browser* browser); | 24 explicit SaveCardIconView(CommandUpdater* command_updater, Browser* browser); |
22 ~SaveCardIconView() override; | 25 ~SaveCardIconView() override; |
23 | 26 |
24 protected: | 27 protected: |
25 // BubbleIconView: | 28 // BubbleIconView: |
26 void OnExecuting(BubbleIconView::ExecuteSource execute_source) override; | 29 void OnExecuting(BubbleIconView::ExecuteSource execute_source) override; |
| 30 bool OnMousePressed(const ui::MouseEvent& event) override; |
27 views::BubbleDelegateView* GetBubble() const override; | 31 views::BubbleDelegateView* GetBubble() const override; |
28 gfx::VectorIconId GetVectorIcon() const override; | 32 gfx::VectorIconId GetVectorIcon() const override; |
29 | 33 |
| 34 // TabStripModelObserver: |
| 35 void TabDeactivated(content::WebContents* contents) override; |
| 36 |
30 private: | 37 private: |
| 38 SaveCardBubbleControllerImpl* GetController() const; |
| 39 |
31 // May be nullptr. | 40 // May be nullptr. |
32 Browser* browser_; | 41 Browser* browser_; |
33 | 42 |
34 DISALLOW_COPY_AND_ASSIGN(SaveCardIconView); | 43 DISALLOW_COPY_AND_ASSIGN(SaveCardIconView); |
35 }; | 44 }; |
36 | 45 |
37 } // namespace autofill | 46 } // namespace autofill |
38 | 47 |
39 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_SAVE_CARD_ICON_VIEW_H_ | 48 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_SAVE_CARD_ICON_VIEW_H_ |
OLD | NEW |